forIn loop-invariant gadgets #
ForIn.forInWithInvariant and ForIn'.forInWithInvariant' annotate a forIn/forIn' loop with its
invariant so that vcgen reads the invariant from the program. Their @[spec] specifications
restate Spec.forIn_list/Spec.forIn'_list for every container with a PureForIn instance.
Gadgets #
A forIn loop annotated with its loop invariant, which vcgen reads from the inv argument.
It is definitionally forIn xs init f, so the annotation is erased at runtime. The invariant
ranges over the elements consumed so far, the elements remaining, and the loop state.
Equations
- Std.Internal.Do.ForIn.forInWithInvariant xs init f inv = forIn xs init f
Instances For
A membership-aware forIn' loop annotated with its loop invariant, which vcgen reads from the
inv argument. It is definitionally forIn' xs init f, so the annotation is erased at runtime. The
invariant ranges over the elements consumed so far, the elements remaining, and the loop state.
Equations
- Std.Internal.Do.ForIn'.forInWithInvariant' xs init f inv = forIn' xs init f