NLA-lib Explorer

NLAlib.Ops.iter_weight_le_of_invariant

Library · theorem

A loop's actual weighted count is bounded by the sum of the selected per-round weights. This does not first bound the complete count vector by its syntactic manifest. Thus an invariant can exploit a stored partition when bounding matrix-kernel work or span. The weight may be any function on counts; its algebraic laws belong to the step proof.

NLAlib.Ops.iter_weight_le_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}
  {weight : Ops.Count Op Tst → ℕ} {w : ℕ → ℕ}
  (hstep :
    ∀ (i : ℕ) (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)
  {k : ℕ} {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.