NLA-lib Explorer

NLAlib.Ops.writes_allocsAs

Library · theorem

A formatted allocation chain: scratch buffers at the handles L, L + 1, …, L + k - 1 (L = m.store.length) with their lengths, as one named state; after the body they are all freed. The rule for the blocks that allocate seven or eight buffers.

NLAlib.Ops.writes_allocsAs {Op Tst K : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K}
  {τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K} {allocations : List (Ops.StorageFormat × Ops.IExp)}
  {body : Ops.Stmt Op Tst} {ns : List ℕ}
  (hn : Ops.IExp.evalList ρ.idx (List.map Prod.snd allocations) = some ns) {F : Ops.Fp}
  {P : Ops.Mem K → Prop}
  (h :
    ∀ (s₁ : Ops.Store K),
      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₁ →
            Ops.Writes md I τ body
              { idx := ρ.idx,
                buf := ρ.buf ++ List.map (fun x ↦ List.length m.store + x) (List.range ns.length) }
              (F ⊔ Ops.Fp.above (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.allocsAs allocations body) ρ F P m

Full source on GitHub

Import NLAlib.Ops.Logic.Writes.