NLA-lib Explorer

NLAlib.Ops.Program.exec_weight_le_countPoly

Library · theorem

The weight of a canonical run under any weights that are at most one is at most the instruction polynomial of the program at its sizes. The weights R' need not be those R of the run: a count is weighed after the fact, for instance with the weight of some primitives set to zero.

NLAlib.Ops.Program.exec_weight_le_countPoly {Op Tst K : Type} {r b : ℕ} (p : Ops.Program Op Tst r b)
  (R R' : Ops.ResourceModel Op Tst) (hop : ∀ (o : Op) (d : List ℕ), R'.operationWork o d ≤ 1)
  (hcore : ∀ (k : Ops.Bookkeeping) (d : List ℕ), R'.coreWork k d ≤ 1)
  (hq : ∀ (q : Tst) (d : List ℕ), R'.queryWork q d ≤ 1) {I : Ops.Interp Op Tst K} {τ : Ops.Tape K}
  {formats : Fin b → Ops.StorageFormat} {d : Fin r → ℕ} {m : Ops.Mem K}
  {st : Ops.St (Op ⊕ Ops.Bookkeeping) Tst K} (hr : Ops.exec p I R formats τ d m = some st) :
  R'.work st.cost ≤ Ops.CountPoly.eval (List.ofFn d) p.countPoly

Full source on GitHub

Import NLAlib.Ops.OperationCount.