I'm currently learning dafny and ran into a really odd assertion requirement:
method M (a : seq<int>, acc : seq<int>)
requires |a| > 0
requires forall va, vacc :: va in a && vacc in acc ==> vacc <= va
{
assert forall vacc :: vacc in acc ==> vacc <= a[0];
}
The above code fails on the assertion, however if I add assert a[0] in a
it verifies?
Why is this the case, surely in all circumstances that |a| > 0
a[0] in a
holds since seq
is immutable?
(also any style guide recommendations would be appreciated :) )