NLA-lib Explorer

NLAlib.Ops.stmtWeightedCost_le_countPoly

Library · theorem

The weighted static cost of a tree is at most its instruction polynomial, when every primitive and query weight is at most one and the index variables are within their bounds.

NLAlib.Ops.stmtWeightedCost_le_countPoly {Op Tst : Type} {op : Op → List ℕ → ℕ}
  {query : Tst → List ℕ → ℕ} (hop : ∀ (o : Op) (d : List ℕ), op o d ≤ 1)
  (hq : ∀ (q : Tst) (d : List ℕ), query q d ≤ 1) (s : Ops.Stmt Op Tst) {x idx : List ℕ}
  {env : List Ops.CountPoly} (h : Ops.BoundedBy x idx env) :
  Ops.stmtWeightedCost op query s idx ≤ Ops.CountPoly.eval x (s.countPoly env)

Full source on GitHub

Import NLAlib.Ops.OperationCount.