Question: method Filter ( a:seq, b:set ) returns ( c:set ) ensures forall j :: 0 < = j < | a | = = >
method Filtera:seq, b:set returnsc:set
ensures forall j :: j a if aj in b then aj in c
else aj in c
c :;
var i : int :;
while i a
invariant i a
invariant forall j :: j i if aj in b then aj in c else aj in c
if ai in b
c : c ai;
i : i ;
for my code why ype errors detected in filter.dfy
z@vx:~sengexam$ seng dafny verify filter.dfy
filter.dfy: Error: this invariant could not be proved to be maintained by the loop
Related message: loop invariant violation
invariant forall j :: j i if aj in b then aj in c else aj in c
Dafny program verifier finished with verified, err
why is my invariant weak
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
