NLAlib.Ops.writes_whileFuel_iterate
Library · theorem
A capped loop implements the iterate of the transition that acts while active and is the identity afterwards. The step proof supplies only the mathematical state transition and its footprint. The actual query must return the state predicate at every reachable represented state; early termination is handled by the generic rule.
NLAlib.Ops.writes_whileFuel_iterate {Op Tst K S : Type} {I : Ops.Interp Op Tst K} {τ : Ops.Tape K}
{ρ : Ops.Env} {m : Ops.Mem K} {fuel : Ops.IExp} {q : Tst} {ds : List Ops.IExp}
{ins : List Ops.Operand} {body : Ops.Stmt Op Tst} {N : ℕ} {F : Ops.Fp}
(State : S → Ops.Mem K → Prop) (active : S → Bool) (next : S → S) {s : S}
(hn : Ops.IExp.eval ρ.idx fuel = some N) (hs : State s m)
(htest :
∀ i < N,
∀ (m' : Ops.Mem K),
Ops.Store.EqOff F m.store m'.store →
State ((fun s ↦ if active s = true then next s else s)^[i] s) m' →
I.testAt q ds ins (ρ.pushIdx i) m' =
some (active ((fun s ↦ if active s = true then next s else s)^[i] s)))
(hstep :
∀ i < N,
∀ (m' : Ops.Mem K),
Ops.Store.EqOff F m.store m'.store →
State ((fun s ↦ if active s = true then next s else s)^[i] s) m' →
active ((fun s ↦ if active s = true then next s else s)^[i] s) = true →
Ops.Writes Ops.Mode.total I τ body (ρ.pushIdx i) F
(State (next ((fun s ↦ if active s = true then next s else s)^[i] s))) m') :
Ops.Writes Ops.Mode.total I τ (Ops.Stmt.whileFuel fuel q ds ins body Ops.Stmt.skip) ρ F
(State ((fun s ↦ if active s = true then next s else s)^[N] s)) mImport NLAlib.Ops.Logic.While.