NLA-lib Explorer

NLAlib.Ops.iter_weight_le_of_invariant_upto

Library · theorem

The invariant-sensitive weighted rule needs its step proof only for the rounds actually reserved by this iteration count. This is the usual bounded loop-invariant interface.

NLAlib.Ops.iter_weight_le_of_invariant_upto {Op Tst K : Type}
  {f : ℕ → Ops.St Op Tst K → Option (Ops.St Op Tst K)} {P : ℕ → Ops.St Op Tst K → Prop}
  {weight : Ops.Count Op Tst → ℕ} {w : ℕ → ℕ} {k : ℕ}
  (hstep :
    ∀ i < k,
      ∀ (a b : Ops.St Op Tst K),
        P i a → f i a = some b → P (i + 1) b ∧ weight b.cost ≤ weight a.cost + w i)
  {s s' : Ops.St Op Tst K} (hs : P 0 s) (hk : Ops.iter f k s = some s') :
  P k s' ∧ weight s'.cost ≤ weight s.cost + ∑ i ∈ Finset.range k, w i

Full source on GitHub

Import NLAlib.Ops.CountedLoop.