NLAlib.Ops.BackwardStep.allocs
Library · theorem
A backward step through a scratch allocation: let the dimensions lens evaluate to ns. Suppose that for every caller store length L the body is a backward step, in the environment with the fresh handles L, \dots, L + k - 1 (k the length of ns) appended to the buffers and with footprint F ⊔ Fp.above L, from every memory obtained by allocating after a precondition memory of length L (same tape position, the old handles unchanged below L, the new handles of lengths ns). If the postcondition of every state survives replacing the handles from the caller's length on, the allocation is the same backward step in the caller's environment.
NLAlib.Ops.BackwardStep.allocs.{u_1} {Op Tst K : Type} {α : Type u_1} {md : Ops.Mode}
{I : Ops.Interp Op Tst K} {τ : Ops.Tape K} {ρ : Ops.Env} {F : Ops.Fp} {R : ℝ → α → α → Prop}
{S S' : α → Ops.Mem K → Prop} {ε : ℝ} {lens : List Ops.IExp} {body : Ops.Stmt Op Tst}
{ns : List ℕ} (hn : Ops.IExp.evalList ρ.idx lens = some ns)
(hkeep :
∀ (a : α) (m : Ops.Mem K),
S a m →
∀ (b : α) {s s' : Ops.Store K} {p : ℕ},
Ops.Store.Below (List.length m.store) s s' →
S' b { store := s, pos := p } → S' b { store := s', pos := p })
(h :
∀ (L : ℕ),
Ops.BackwardStep md I τ body
{ idx := ρ.idx, buf := ρ.buf ++ List.map (fun x ↦ L + x) (List.range ns.length) }
(F ⊔ Ops.Fp.above L) R
(fun a m₁ ↦
∃ m,
S a m ∧
List.length m.store = L ∧
m₁.pos = m.pos ∧
List.length m₁.store = L + ns.length ∧
(∀ (i : ℕ) (hi : i < ns.length), m₁.store.len (L + i) = ns[i]) ∧
Ops.Store.Below L m.store m₁.store)
S' ε) :
Ops.BackwardStep md I τ (Ops.Stmt.allocs lens body) ρ F R S S' εImport NLAlib.Ops.Logic.BackwardFrame.