NLA-lib Explorer

NLAlib.Ops.writes_loop_disjoint_prefix

Library · theorem

Independent output initialization with a precise completed-round frame. This permits a round to read its own original output region, as when an already-computed leaf is retained.

NLAlib.Ops.writes_loop_disjoint_prefix {K Op Tst : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K}
  {τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K} {n : Ops.IExp} {N : ℕ} {body : Ops.Stmt Op Tst}
  {F : Ops.Fp} (region : ℕ → Ops.Fp) (result : ℕ → Ops.Store K → Prop)
  (hn : Ops.IExp.eval ρ.idx n = some N) (hsub : ∀ i < N, region i ≤ F)
  (hdisj : ∀ i < N, ∀ j < N, i ≠ j → (region i).Disj (region j))
  (hread : ∀ i < N, Ops.Store.ReadsOnly (region i) (result i))
  (hstep :
    ∀ i < N,
      ∀ (m' : Ops.Mem K),
        Ops.Store.EqOff (Ops.Fp.loopPrefix region i) m.store m'.store →
          Ops.Writes md I τ body (ρ.pushIdx i) (region i)
            (fun m'' ↦ m''.pos = m'.pos ∧ result i m''.store) m') :
  Ops.Writes md I τ (Ops.Stmt.loop n body) ρ F
    (fun m' ↦ m'.pos = m.pos ∧ ∀ i < N, result i m'.store) m

Full source on GitHub

Import NLAlib.Ops.Logic.IndependentLoop.