NLAlib.Ops.whileIter_within
Library · theorem
A loop with early exit stays within the sum over the rounds it may do of the counts c i of one round (test and body), and within the largest workspace of a body.
NLAlib.Ops.whileIter_within {Op Tst K : Type}
{test : ℕ → Ops.St Op Tst K → Option (Bool × Ops.St Op Tst K)}
{body : ℕ → Ops.St Op Tst K → Option (Ops.St Op Tst K)} {ct cb : ℕ → Ops.Count Op Tst} {p : ℕ → ℕ}
(ht :
∀ (i : ℕ) (a : Ops.St Op Tst K) (bs : Bool × Ops.St Op Tst K),
test i a = some bs → a.Within bs.2 (ct i) 0)
(h : ∀ (i : ℕ) (a b : Ops.St Op Tst K), body i a = some b → a.Within b (cb i) (p i)) {r i : ℕ}
{s : Ops.St Op Tst K} {js : ℕ × Ops.St Op Tst K} (hk : Ops.whileIter test body r i s = some js) :
s.Within js.2 (∑ l ∈ Finset.range r, (ct (i + l) + cb (i + l)))
((Finset.range r).sup fun l ↦ p (i + l))Import NLAlib.Ops.Static.