Formulas over the full binary basis #
A formula is a tree whose leaves are input variables or constants and whose internal nodes apply one of the sixteen binary Boolean functions. Its size is its number of variable leaves, the standard leaf-size measure; constants are free, as they can be absorbed into the adjacent gate.
leavesIn Y counts the variable leaves whose index lies in a block Y. Over
pairwise disjoint blocks these counts add up to at most the total leaf count
(sum_leavesIn_le_leaves), and a formula with no leaf in Y does not depend
on the coordinates in Y (eval_eq_of_leavesIn_eq_zero). These are the two
facts Nechiporuk's argument uses.
Evaluate a formula on an input.
Equations
- (Algebraic.Binary.Formula.var index).eval x✝ = x✝ index
- (Algebraic.Binary.Formula.const value).eval x✝ = value
- (Algebraic.Binary.Formula.gate op left right).eval x✝ = op (left.eval x✝) (right.eval x✝)
Instances For
The number of variable leaves: the leaf size of the formula. Constant leaves
count 0. This differs from Algebraic.KW.Formula.leaves, which also counts
constant leaves (so there every formula has leaf size at least 1); the
Nechiporuk and cutwidth bounds use this convention.
Equations
- (Algebraic.Binary.Formula.var index).leaves = 1
- (Algebraic.Binary.Formula.const value).leaves = 0
- (Algebraic.Binary.Formula.gate op left right).leaves = left.leaves + right.leaves
Instances For
The number of variable leaves whose index lies in Y.
Equations
- Algebraic.Binary.Formula.leavesIn Y (Algebraic.Binary.Formula.var index) = if index ∈ Y then 1 else 0
- Algebraic.Binary.Formula.leavesIn Y (Algebraic.Binary.Formula.const value) = 0
- Algebraic.Binary.Formula.leavesIn Y (Algebraic.Binary.Formula.gate op left right) = Algebraic.Binary.Formula.leavesIn Y left + Algebraic.Binary.Formula.leavesIn Y right