Boolean decision trees #
Decision trees query named input coordinates and branch on their Boolean values. The false branch is stored first. Depth is the largest number of query nodes on a root-to-leaf path.
The semantic restriction operation removes queries fixed by a partial assignment and retains live queries. Its correctness and depth monotonicity are proved structurally. Decision-tree depth bounds are existential propositions; this module does not compute or search for optimal trees.
A Boolean decision tree on n named input variables.
- leaf {n : ℕ} (value : Bool) : DecisionTree n
- query {n : ℕ} (index : Fin n) (onFalse onTrue : DecisionTree n) : DecisionTree n
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Algebraic.AC0.instDecidableEqDecisionTree.decEq (Algebraic.AC0.DecisionTree.leaf a) (Algebraic.AC0.DecisionTree.leaf b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Algebraic.AC0.instDecidableEqDecisionTree.decEq (Algebraic.AC0.DecisionTree.leaf value) (Algebraic.AC0.DecisionTree.query index onFalse onTrue) = isFalse ⋯
- Algebraic.AC0.instDecidableEqDecisionTree.decEq (Algebraic.AC0.DecisionTree.query index onFalse onTrue) (Algebraic.AC0.DecisionTree.leaf value) = isFalse ⋯
Instances For
A finite root-to-subtree path. The endpoint need not be a leaf, which lets us take an exact-length prefix of any sufficiently deep branch.
- nil {n : ℕ} (tree : DecisionTree n) : tree.Path [] tree
- takeFalse {n : ℕ} {index : Fin n} {onFalse onTrue endpoint : DecisionTree n} {steps : List (PathStep n)} (tail : onFalse.Path steps endpoint) : (query index onFalse onTrue).Path ({ index := index, value := false } :: steps) endpoint
- takeTrue {n : ℕ} {index : Fin n} {onFalse onTrue endpoint : DecisionTree n} {steps : List (PathStep n)} (tail : onTrue.Path steps endpoint) : (query index onFalse onTrue).Path ({ index := index, value := true } :: steps) endpoint
Instances For
Evaluate a decision tree on a complete input.
Equations
Instances For
Maximum number of queries on a root-to-leaf path.
Equations
- (Algebraic.AC0.DecisionTree.leaf value).depth = 0
- (Algebraic.AC0.DecisionTree.query index onFalse onTrue).depth = (max onFalse.depth onTrue.depth).succ
Instances For
Traversing a path consumes at most the depth of its source tree. The strong form retains the depth still available at the endpoint.
Every requested length not exceeding the tree depth occurs as the length of a root-to-subtree path.
The queried coordinates of a path transcript.
Equations
Instances For
The partial assignment made by a path transcript. Earlier occurrences win; canonical paths will later be proved duplicate-free.
Equations
Instances For
Every root-to-leaf path queries distinct coordinates drawn from the given available set. At a query node, that coordinate is removed before checking either child.
Equations
- (Algebraic.AC0.DecisionTree.leaf value).ReadOnceWithin x✝ = True
- (Algebraic.AC0.DecisionTree.query index onFalse onTrue).ReadOnceWithin x✝ = (index ∈ x✝ ∧ onFalse.ReadOnceWithin (x✝.erase index) ∧ onTrue.ReadOnceWithin (x✝.erase index))
Instances For
A transcript assignment fixes exactly the coordinates appearing in its query list.
A path through a read-once tree has no repeated coordinate, and all its coordinates lie in the original available set.
Number of leaves in a decision tree.
Equations
- (Algebraic.AC0.DecisionTree.leaf value).leafCount = 1
- (Algebraic.AC0.DecisionTree.query index onFalse onTrue).leafCount = onFalse.leafCount + onTrue.leafCount
Instances For
A tree computes a scalar Boolean function pointwise.
Instances For
Negate every leaf of a decision tree.
Equations
- (Algebraic.AC0.DecisionTree.leaf value).negate = Algebraic.AC0.DecisionTree.leaf !value
- (Algebraic.AC0.DecisionTree.query index onFalse onTrue).negate = Algebraic.AC0.DecisionTree.query index onFalse.negate onTrue.negate
Instances For
Negating a computing tree computes the pointwise complement.
Restrict a decision tree, selecting a branch at fixed queries and retaining queries of live variables. Repeated queries are all simplified.
Equations
- One or more equations did not get rendered due to their size.
- Algebraic.AC0.DecisionTree.restrict rho (Algebraic.AC0.DecisionTree.leaf value) = Algebraic.AC0.DecisionTree.leaf value
Instances For
Tree restriction agrees exactly with semantic input restriction.
Restriction cannot increase decision-tree depth.
Sequential semantic restrictions compose structurally on decision trees.
Restricting a computing tree computes the restricted scalar function.
Build the full Shannon decision tree over an ordered list of coordinates. At the empty list the remaining function is evaluated on the all-false input; the correctness theorem below states the dependency condition under which that choice is immaterial.
Equations
- One or more equations did not get rendered due to their size.
- Algebraic.AC0.DecisionTree.build [] x✝ = Algebraic.AC0.DecisionTree.leaf (x✝ fun (x : Fin n) => false)
Instances For
The Shannon tree computes any function that depends only on its duplicate- free query list.
A function has decision-tree depth at most bound when some computing tree
has depth at most that bound. No minimization procedure is part of this
definition.
Equations
- Algebraic.AC0.DecisionTree.DepthAtMost function bound = ∃ (tree : Algebraic.AC0.DecisionTree n), tree.Computes function ∧ tree.depth ≤ bound
Instances For
Every decision tree computing the function has depth at least bound.
Equations
- Algebraic.AC0.DecisionTree.DepthAtLeast function bound = ∀ (tree : Algebraic.AC0.DecisionTree n), tree.Computes function → bound ≤ tree.depth
Instances For
Proof-level decidability of the semantic upper-depth predicate. This is a classical instance for forming exact finite events; it does not define or run an optimal decision-tree search.
Equations
- Algebraic.AC0.DecisionTree.depthAtMostDecidable function bound = Classical.propDecidable (Algebraic.AC0.DecisionTree.DepthAtMost function bound)
Proof-level decidability of the semantic lower-depth predicate. This is a classical instance for forming exact finite events; it does not define or run an optimal decision-tree search.
Equations
- Algebraic.AC0.DecisionTree.depthAtLeastDecidable function bound = Classical.propDecidable (Algebraic.AC0.DecisionTree.DepthAtLeast function bound)
Every n-variable Boolean function has a decision tree of depth at most
n. This is a structural Shannon expansion, not an optimal-tree search.
A larger allowance preserves an upper decision-tree depth bound.
Restriction preserves any upper bound on decision-tree depth.
Depth at least bound + 1 is exactly failure to have depth at most
bound.
A function has depth zero exactly when it is constant.