NLA-lib Explorer

NLAlib.Ops.writes_alloc

Library · theorem

A scratch buffer as a named state. The body is proved from every store s₁ with one more buffer, of length n, at the handle L = m.store.length, that agrees with the store below L; its footprint may include the new buffer. The postcondition is asked of every store of length L that agrees with the final one below L (the store after the pop is one), so no pop appears in a goal, and a fact about the buffers below L transfers by Store.Below.keep.

NLAlib.Ops.writes_alloc {Op Tst K : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K} {τ : Ops.Tape K}
  {ρ : Ops.Env} {m : Ops.Mem K} {format : Ops.StorageFormat} {len : Ops.IExp}
  {body : Ops.Stmt Op Tst} {n : ℕ} (hn : Ops.IExp.eval ρ.idx len = some n) {F : Ops.Fp}
  {P : Ops.Mem K → Prop}
  (h :
    ∀ (s₁ : Ops.Store K),
      List.length s₁ = List.length m.store + 1 →
        s₁.len (List.length m.store) = n →
          Ops.Store.Below (List.length m.store) m.store s₁ →
            Ops.Writes md I τ body (ρ.pushBuf (List.length m.store))
              (F ⊔ Ops.Store.inBuf (List.length m.store))
              (fun m' ↦
                ∀ (s₂ : Ops.Store K),
                  List.length s₂ = List.length m.store →
                    Ops.Store.Below (List.length m.store) m'.store s₂ →
                      P { store := s₂, pos := m'.pos })
              { store := s₁, pos := m.pos }) :
  Ops.Writes md I τ (Ops.Stmt.allocAs format len body) ρ F P m

Full source on GitHub

Import NLAlib.Ops.Logic.Writes.