NLA-lib Explorer

NLAlib.Ops.writes_fillEntryRegion

Library · theorem

A variable-length inner loop fills one fixed-width entry at each visit. This includes triangular regions without extra initialization or extra scalar operations. The step gives only its actual component words; preservation and assembly of all earlier entries are shared.

NLAlib.Ops.writes_fillEntryRegion {Op Tst K E : 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}
  (C : Ops.EntryCodec K E) (b off cols : ℕ) (index : ℕ → ℕ → ℕ) (N : ℕ → ℕ)
  (hindex : Set.InjOn (fun p ↦ index p.1 p.2) {p | p.2 < cols ∧ p.1 < N p.2})
  (hn₁ : Ops.IExp.eval ρ.idx n₁ = some cols)
  (hn₂ : ∀ (j : ℕ), Ops.IExp.eval (ρ.pushIdx j).idx n₂ = some (N j)) (A : ℕ → ℕ → E)
  (pos : ℕ → ℕ → ℕ) (hpos : m.pos = pos 0 0) (hnext : ∀ j < cols, pos j (N j) = pos (j + 1) 0)
  (hstep :
    ∀ j < cols,
      ∀ i < N j,
        ∀ (m' : Ops.Mem K),
          Ops.Store.EqOff (C.regionUpto b off index N j i) m.store m'.store →
            m'.pos = pos j i →
              Ops.Writes md I τ body ((ρ.pushIdx j).pushIdx i) (C.entryBlock b off (index i j))
                (fun m'' ↦
                  (∀ (z : Fin C.width),
                      m''.store.get b (off + C.width * index i j + ↑z) = some (C.words (A i j) z)) ∧
                    m''.pos = pos j (i + 1))
                m') :
  Ops.Writes md I τ (Ops.Stmt.loop n₁ (Ops.Stmt.loop n₂ body)) ρ (C.regionFp b off cols index N)
    (fun m' ↦ m'.store.HoldsEntryRegion C b off cols index N A ∧ m'.pos = pos cols 0) m

Full source on GitHub

Import NLAlib.Ops.Logic.EntryRows.