NLAlib.Ops.writes_indexLit_bindIdx
Library · theorem
A stored dimension can be read back by a bounded index binder when its literal is exact. The continuation receives an arbitrary framed post-state, not a concrete chain of updates. Both the writing call and the index query remain in the executed statement.
NLAlib.Ops.writes_indexLit_bindIdx {K Op Tst : Type} {I : Ops.Interp Op Tst K} {τ : Ops.Tape K}
{ρ : Ops.Env} {m : Ops.Mem K} [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.IdxTst Tst] {dec : K → ℝ}
{M : Ops.Machine K} (hL : Ops.IsIndexLit M I) (hQ : Ops.IsToNat dec I) {e bound : Ops.IExp}
{cell : Ops.Operand} {body : Ops.Stmt Op Tst} {n B : ℕ} {z : ℕ × ℕ} {F : Ops.Fp}
{P : Ops.Mem K → Prop} (he : Ops.IExp.eval ρ.idx e = some n)
(hB : Ops.IExp.eval ρ.idx bound = some B) (hz : Ops.Operand.eval ρ cell = some z)
(hroom : z.2 < m.store.len z.1) (hexact : Ops.IsExactNatLit dec M B) (hn : n ≤ B)
(hbody :
∀ (m' : Ops.Mem K),
Ops.Store.EqOff (Ops.Store.inBlock z.1 z.2 1) m.store m'.store →
m'.pos = m.pos →
m'.store.get z.1 z.2 = some (M.lit ↑n) →
Ops.Writes Ops.Mode.total I τ body (ρ.pushIdx n) F P m') :
Ops.Writes Ops.Mode.total I τ
((Ops.Stmt.call (Ops.Has.inj Ops.IndexOp.lit) [e] [] [cell]).seq
(Ops.Stmt.bindIdx (Ops.Has.inj Ops.IdxTst.toNat) [cell] bound body))
ρ (Ops.Store.inBlock z.1 z.2 1 ⊔ F) P mImport NLAlib.Ops.Logic.IndexLiteral.