NLA-lib Explorer

NLAlib.Ops.writes_loop_frame_iterate

Library · theorem

A framed state transition composes into mathematical iteration. Clients supply the stored state predicate, its transition and the valid executed states; liveness, binder stability, position chaining and the loop invariant are shared here. The frame from the initial store is forwarded to each round for any additional capacity or input facts it needs.

NLAlib.Ops.writes_loop_frame_iterate {Op Tst K : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K}
  {τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K} {S : Type} {n : Ops.IExp} {N : ℕ}
  {ds : List Ops.IExp} {args : List Ops.Operand} {body : Ops.Stmt Op Tst} {d : List ℕ}
  {a : List (ℕ × ℕ)} {F : Ops.Fp} (State : S → Ops.Mem K → Prop) (transition : S → S)
  (valid : S → Prop) {s : S} (hn : Ops.IExp.eval ρ.idx n = some N)
  (hd : Ops.IExp.evalList ρ.idx ds = some d) (ha : Ops.Operand.evalList ρ args = some a)
  (hl : m.Live a) (hs : State s m) (hvalid : ∀ i < N, valid (transition^[i] s))
  (hstep :
    ∀ (s' : S) (m' : Ops.Mem K),
      Ops.Store.EqOff F m.store m'.store →
        m'.Live a →
          State s' m' →
            valid s' →
              Ops.Writes md I τ body (Ops.Env.frame d a) F
                (fun m'' ↦ m''.pos = m'.pos ∧ State (transition s') m'') m') :
  Ops.Writes md I τ (Ops.Stmt.loop n (Ops.Stmt.frame ds args body)) ρ F
    (fun m' ↦ m'.pos = m.pos ∧ State (transition^[N] s) m') m

Full source on GitHub

Import NLAlib.Ops.Logic.Loop.