NLA-lib Explorer

NLAlib.Ops.Algorithm.ofWpActual

Library · def

Construct a total certificate using bounds on the actual canonical instruction count. The total word-level proof supplies execution; the resource premise analyzes that same execution. Work and span need not bound the weight of a conservative count manifest. Scratch and resident memory retain their independent static bounds.

NLAlib.Ops.Algorithm.ofWpActual {Op Tst K : Type} {r b : ℕ} {P : Ops.Problem K r b}
  {M : Ops.AccessModel Op Tst P} {S : Ops.Specification Op Tst P} (p : Ops.Program Op Tst r b)
  (ht : p.wellTyped M.resources P.formats = true)
  (hwp :
    ∀ (d : Fin r → ℕ),
      P.valid d →
        ∀ (x : P.Input d) (I : Ops.Interp Op Tst K),
          M.contracts d x I →
            ∀ (τ : Ops.Tape K),
              Ops.Wp Ops.Mode.total I τ p.body (Ops.Program.environment d)
                (fun m' ↦ ∀ c ≤ S.budget d, S.good d x τ c m') (P.initial d x))
  (hActual :
    ∀ (d : Fin r → ℕ),
      P.valid d →
        ∀ (x : P.Input d) (I : Ops.Interp Op Tst K),
          M.contracts d x I →
            ∀ (τ : Ops.Tape K) (st : Ops.St (Op ⊕ Ops.Bookkeeping) Tst K),
              Ops.exec p I M.resources P.formats τ d (P.initial d x) = some st →
                st.cost ≤ S.budget d ∧
                  M.resources.work st.cost ≤ S.work d ∧ M.resources.span st.cost ≤ S.span d)
  (hspace : ∀ (d : Fin r → ℕ), P.valid d → Ops.staticPeak M.resources p d ≤ S.scratch d)
  (hmemory :
    ∀ (d : Fin r → ℕ),
      P.valid d → ∀ (x : P.Input d), P.initialBytes d x + S.scratch d ≤ S.memory d) :
  Ops.Algorithm M S

Full source on GitHub

Import NLAlib.Ops.Certification.