NLA-lib Explorer

NLAlib.Ops.Program.certifies_iff_exec

Library · theorem

Certification, read with the evaluator: on every admitted input, under every interpretation satisfying the model and every tape, canonical execution succeeds with the same scratch, counts, work, span, resident memory and output condition.

NLAlib.Ops.Program.certifies_iff_exec {Op Tst K : Type} {r b : ℕ} {P : Ops.Problem K r b}
  (p : Ops.Program Op Tst r b) (M : Ops.AccessModel Op Tst P) (S : Ops.Specification Op Tst P) :
  p.Certifies M S ↔
    ∀ (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.exec p I M.resources P.formats τ d (P.initial d x) = some st ∧
                  st.peak ≤ S.scratch d ∧
                    st.cost ≤ S.budget d ∧
                      M.resources.work st.cost ≤ S.work d ∧
                        M.resources.span st.cost ≤ S.span d ∧
                          P.initialBytes d x + st.peak ≤ S.memory d ∧ S.good d x τ st.cost st.mem

Full source on GitHub

Import NLAlib.Ops.Reference.Equivalence.