NLA-lib Explorer

NLAlib.Ops.Impl.satisfies_of_writes

Library · theorem

An implementation satisfies a contract, from a block specification. On admitted, live operands with the inputs xs read and room for the outputs, the body writes only the output blocks, advances the position by the window, and the output blocks are read back related to the inputs: then the implementation satisfies the contract. The output blocks must be pairwise disjoint (the admitted operands say so); the equation m' = (m.updBlocks outs ys).advance _ is built here, once (Mem.eq_updBlocks_of_eqOff).

NLAlib.Ops.Impl.satisfies_of_writes {Op Tst K : Type} {E : Ops.Impl Op Tst}
  {I : Ops.Interp Op Tst K} {B : Ops.BlockRel K} {adm : List ℕ → List (ℕ × ℕ) → List (ℕ × ℕ) → Prop}
  (h :
    ∀ (d : List ℕ) (ins outs : List (ℕ × ℕ)) (τ : Ops.Tape K) (m : Ops.Mem K) (xs : List (List K)),
      d.length = B.nd →
        adm d ins outs →
          m.Live (ins ++ outs) →
            m.readBlocks ins (B.inLens d) = some xs →
              B.dom d xs (τ.window B.stream m.pos (B.win d)) →
                m.Room outs (B.outLens d) →
                  E.Fits d.length ins.length outs.length ∧
                    Ops.Writes Ops.Mode.total I τ E.body (Ops.Env.frame d (ins ++ outs))
                      (Ops.Fp.blocks outs (B.outLens d))
                      (fun m' ↦
                        m'.pos = m.pos + B.win d ∧
                          ∃ ys,
                            m'.readBlocks outs (B.outLens d) = some ys ∧
                              B.rel d xs (τ.window B.stream m.pos (B.win d)) ys)
                      m) :
  E.Satisfies I Ops.Mode.total (B.spec adm)

Full source on GitHub

Import NLAlib.Ops.Logic.Writes.