NLA-lib Explorer

NLAlib.Ops.writes_loop_rows

Library · theorem

Nested counted loops whose inner bound depends on the outer index. Their invariant and footprint are indexed by the two mathematical loop indices.

NLAlib.Ops.writes_loop_rows {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 i)) (F : ℕ → ℕ → Ops.Fp)
  (hF : ∀ i < M, ∀ j < N i, F i j ≤ F i (j + 1)) (hrow : ∀ i < M, F i (N i) ≤ F (i + 1) 0)
  (P : ℕ → ℕ → Ops.Mem K → Prop) (h0 : P 0 0 m)
  (hnext : ∀ i < M, ∀ (m' : Ops.Mem K), P i (N i) m' → P (i + 1) 0 m')
  (hstep :
    ∀ i < M,
      ∀ j < N i,
        ∀ (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.EntryRows.