Monomial bounds on the number of instructions of a program
Library · Source module
Monomial bounds on the number of instructions of a program
A syntactic bound on NLAlib.Ops.Count.size of the static count NLAlib.Ops.stmtCost, as a monomial c\,\prod_i \mathbf{b}_i^{e_i} in a list of bases, computed from the tree alone (NLAlib.Ops.stmtWorkMono): every index slot carries a monomial bound on its value, a loop or a whileFuel multiplies by the bound of its count, and a sum takes the larger exponents. The guard ifPos (e + 1 - j) of a comparison j \le e narrows the bound of the slot j in its body to that of e (NLAlib.Ops.loopSlots). A call site contributes one instruction for each list of dimensions its bounds allow, counted once: the static count takes a pointwise supremum over the branches of an ite, the values of a bindIdx and the exits of a whileFuel, so the bound needs one count that dominates them all, and one exists that depends only on the bounds of the slots. The bound of a fixed program is evaluated by kernel_rfl (NLAlib/Ops/Logic/KernelRfl.lean), an equation by reflexivity left to the kernel (which evaluates it with sharing, where the elaborator's rfl does not). It keeps each base with its own exponent, unlike the one-base estimate NLAlib.Ops.stmtWeightedCost_le_coefficient_mul_pow. The bases are a list, one per size of the program; a monomial lists its exponents, missing ones being 0.
Main definitions
* NLAlib.Ops.WorkMono: a monomial in a list of bases. * NLAlib.Ops.stmtWorkMono: the monomial bound of a tree at monomial bounds of its slots.
Main results
* NLAlib.Ops.size_stmtCost_le_stmtWorkMono: the number of instructions of the static count is at most the monomial bound. * NLAlib.Ops.stmtWorkMono_instrument: the bound of an instrumented tree is computed on the tree (NLAlib.Ops.instrWorkMono), without building the instrumented tree.
Declarations
- NLAlib.Ops.IExp.evalList_le_workMono
- NLAlib.Ops.IExp.eval_le_workMono
- NLAlib.Ops.IExp.guardLe
- NLAlib.Ops.IExp.le_of_guardLe
- NLAlib.Ops.IExp.workMono
- NLAlib.Ops.SlotsLe
- NLAlib.Ops.WorkMono
- NLAlib.Ops.WorkMono.add
- NLAlib.Ops.WorkMono.add_eval_le_eval_add
- NLAlib.Ops.WorkMono.const
- NLAlib.Ops.WorkMono.eval
- NLAlib.Ops.WorkMono.eval_const
- NLAlib.Ops.WorkMono.eval_le_of_le
- NLAlib.Ops.WorkMono.eval_mul
- NLAlib.Ops.WorkMono.mul
- NLAlib.Ops.WorkMonoDominates
- NLAlib.Ops.addExps
- NLAlib.Ops.boxCount
- NLAlib.Ops.boxLists
- NLAlib.Ops.boxWorkMono
- NLAlib.Ops.card_boxLists_le_eval
- NLAlib.Ops.evalList_map_le_boxCount
- NLAlib.Ops.getD_eval_le_workMono
- NLAlib.Ops.instDecidableEqWorkMono.decEq
- NLAlib.Ops.instReprWorkMono.repr
- NLAlib.Ops.instrWorkMono
- NLAlib.Ops.loopSlots
- NLAlib.Ops.maxExps
- NLAlib.Ops.maxExps_comm
- NLAlib.Ops.mem_boxLists
- NLAlib.Ops.powProd
- NLAlib.Ops.powProd_addExps
- NLAlib.Ops.powProd_cons_cons
- NLAlib.Ops.powProd_le_powProd_maxExps
- NLAlib.Ops.powProd_le_powProd_of_forall₂
- NLAlib.Ops.powProd_nil_left
- NLAlib.Ops.powProd_nil_right
- NLAlib.Ops.size_boxCount
- NLAlib.Ops.size_mono
- NLAlib.Ops.size_single
- NLAlib.Ops.size_stmtCost_le_stmtWorkMono
- NLAlib.Ops.size_sup_add_size_inf
- NLAlib.Ops.slotsLe_append
- NLAlib.Ops.slotsLe_loopSlots
- NLAlib.Ops.slotsLe_set
- NLAlib.Ops.stmtWorkMono
- NLAlib.Ops.stmtWorkMono_instrument
- NLAlib.Ops.stmtWorkMono_tally
- NLAlib.Ops.sum_range_le_nsmul
- NLAlib.Ops.tallyWorkMono
- NLAlib.Ops.workMonoDominates
- NLAlib.Ops.workMonoDominates_whileFuel