Dafny assertion error with forall statement

223 Views Asked by At
assert forall k :: 0 <= k < a.Length && index > 0 && a[0] != 0 ==> a[k] != k;

Consider the above dafny code. Assume that a is an array of natural numbers. In English, I'd like to say "For all k such that 0 <= k < a.Length where index > 0 and a[0] != 0 then, a[k] != k". When I write this I get an assertion error in dafny. Why might I be getting this assertion error. Can I not have a quantifier like this and if not, how am I able to quantify variables in dafny assertions?

0

There are 0 best solutions below