NLAlib.Ops.iter_within_of_invariant
Library · theorem
Iteration preserves a state invariant and accumulates its per-round resource bounds. The step premise is needed only on states satisfying the invariant. This lemma concerns an actual counted iteration; total program correctness supplies its execution separately.
NLAlib.Ops.iter_within_of_invariant {Op Tst K : Type}
{f : ℕ → Ops.St Op Tst K → Option (Ops.St Op Tst K)} {P : ℕ → Ops.St Op Tst K → Prop}
{c : ℕ → Ops.Count Op Tst} {p : ℕ → ℕ}
(hstep :
∀ (i : ℕ) (a b : Ops.St Op Tst K),
P i a → f i a = some b → P (i + 1) b ∧ a.Within b (c i) (p i))
{k : ℕ} {s s' : Ops.St Op Tst K} (hs : P 0 s) (hk : Ops.iter f k s = some s') :
P k s' ∧ s.Within s' (∑ i ∈ Finset.range k, c i) ((Finset.range k).sup p)Import NLAlib.Ops.CountedLoop.