NLAlib.Ops.Examples.runs_halve
Library · theorem
The halving loop with counts that depend on the data: at most Nat.size v calls of half and Nat.size v + 1 tests, where v is the number the word decodes to; the fuel is not in the bound. The counts are carried by the logic, round by round.
NLAlib.Ops.Examples.runs_halve {K : Type} {dec : K → ℕ} {h : K → K}
{I : Ops.Interp Ops.Examples.HOp Ops.Examples.HTst K} (hI : Ops.Examples.IsHalving dec h I)
(W : Ops.Examples.HOp → List ℕ → ℕ) {τ : Ops.Tape K} {k : ℕ} {m : Ops.Mem K} {x : ℕ × ℕ} {a : K}
(hx : m.store.get x.1 x.2 = some a) (hk : (dec a).size ≤ k) :
Ops.ConditionalRuns I W τ Ops.Examples.halve { idx := [k, x.2], buf := [x.1] } m
((dec a).size •
(Ops.Count.test Ops.Examples.HTst.nz [] + Ops.Count.one Ops.Examples.HOp.half []) +
Ops.Count.test Ops.Examples.HTst.nz [])
(W Ops.Examples.HOp.half []) fun m' ↦ ∃ a', m' = m.upd x a' ∧ dec a' = 0Import NLAlib.Ops.Examples.Loops.