NLAlib.Ops.PWrites.allocs
Library · theorem
Scratch allocations (PL3f-allocs, the mirror of writes_allocs_preserving_post): the body runs on the memory with fresh buffers at the handles L, L + 1, \dots above the L buffers of the memory, may write above L, and its postcondition survives the release of the scratch buffers. The failure probability is the body's.
NLAlib.Ops.PWrites.allocs {Op Tst K : Type} [Inhabited K] [MeasurableSpace K] {law : ℕ → Measure K}
{I : Ops.Interp Op Tst K} {ρ : Ops.Env} {F : Ops.Fp} {Pre Post : Ops.Mem K → Prop} {φ : ℝ}
{lens : List Ops.IExp} {body : Ops.Stmt Op Tst} {ns : List ℕ}
(hn : Ops.IExp.evalList ρ.idx lens = some ns) {Pre₁ : ℕ → Ops.Mem K → Prop}
(hpre :
∀ (m : Ops.Mem K) (s₁ : Ops.Store K),
Pre m →
List.length s₁ = List.length m.store + ns.length →
(∀ (i : ℕ) (hi : i < ns.length), s₁.len (List.length m.store + i) = ns[i]) →
Ops.Store.Below (List.length m.store) m.store s₁ →
Pre₁ (List.length m.store) { store := s₁, pos := m.pos })
(hkeep :
∀ (m : Ops.Mem K),
Pre m →
∀ {s s' : Ops.Store K} {p : ℕ},
Ops.Store.Below (List.length m.store) s s' →
Post { store := s, pos := p } → Post { store := s', pos := p })
(h :
∀ (L : ℕ),
Ops.PWrites law I body
{ idx := ρ.idx, buf := ρ.buf ++ List.map (fun x ↦ L + x) (List.range ns.length) }
(F ⊔ Ops.Fp.above L) (Pre₁ L) Post φ) :
Ops.PWrites law I (Ops.Stmt.allocs lens body) ρ F Pre Post φImport NLAlib.Ops.Logic.Probabilistic.