NLA-lib Explorer

NLAlib.Ops.writes_loop₂

Library · theorem

Two nested counted loops, with an invariant indexed by the row i and the column j; the end of a row is the start of the next (hnext).

NLAlib.Ops.writes_loop₂ {Op Tst K : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K} {τ : Ops.Tape K}
  {ρ : Ops.Env} {m : Ops.Mem K} {n₁ n₂ : Ops.IExp} {body : Ops.Stmt Op Tst} {M N : ℕ}
  (hn₁ : Ops.IExp.eval ρ.idx n₁ = some M)
  (hn₂ : ∀ (i : ℕ), Ops.IExp.eval (ρ.pushIdx i).idx n₂ = some N) (F : ℕ → ℕ → Ops.Fp)
  (hF : ∀ i < M, ∀ j < N, F i j ≤ F i (j + 1)) (hrow : ∀ i < M, F i N ≤ F (i + 1) 0)
  (P : ℕ → ℕ → Ops.Mem K → Prop) (h0 : P 0 0 m)
  (hnext : ∀ i < M, ∀ (m' : Ops.Mem K), P i N m' → P (i + 1) 0 m')
  (hstep :
    ∀ i < M,
      ∀ j < N,
        ∀ (m' : Ops.Mem K),
          Ops.Store.EqOff (F i j) m.store m'.store →
            P i j m' →
              Ops.Writes md I τ body ((ρ.pushIdx i).pushIdx j) (F i (j + 1)) (P i (j + 1)) m') :
  Ops.Writes md I τ (Ops.Stmt.loop n₁ (Ops.Stmt.loop n₂ body)) ρ (F M 0) (P M 0) m

Full source on GitHub

Import NLAlib.Ops.Logic.Loop.