AFTD Auto-Formalizing Theoretical Domains

DecisionTree

inductiveimported Lean

A decision tree on $n$ Boolean variables: a leaf $\mathtt{leaf}\,b$ outputs $b$, and a branch $\mathtt{branch}\,i\,lo\,hi$ queries variable $i$, following $lo$ on false and $hi$ on true.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
inductive DecisionTree (n : ℕ)
Defined in
TCSlib, `DecisionTree`
Lean proof
By Hydroxyi, from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Copyright (c) 2026 TCSlib contributors. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
none listed
Used by 13
  • DecisionTree.buildFullBuild a complete decision tree querying variables 0, 1, …, n−1 in order.
  • DecisionTree.coeffs_eq_zero_of_depth_ltFourier coefficients vanish above the tree depth. Let $T$ be a decision tree on $n$ Boolean variables, and let…
  • dtDepthThe decision-tree depth of $f : (\mathrm{Fin}\,n \to \mathrm{Bool}) \to \mathrm{Bool}$ is the least $d$ such that some decision tree of…
  • DecisionTree.fourierCoeff_signEvalFourier coefficients of a decision tree. Let $T$ be a decision tree on $n$ Boolean variables, and let $\sigma\!\circ\! T$ denote its…
  • DecisionTree.signEval_eq_sum_coeffsWalsh expansion of a decision tree's sign function. Let $T$ be a decision tree on $n$ Boolean variables, computing the $\pm 1$-valued…
  • DecisionTree.degree_le_depthFourier degree of a decision tree is at most its depth. Let $T$ be a decision tree on $n$ Boolean variables, and let…
  • DecisionTree.buildFull_evalThe complete tree computes f on every input it is consistent with. Proof sketch. Induction on the number of variables still to be…
  • DecisionTree.depthThe depth of a decision tree (maximum path length to a leaf): a leaf has depth $0$ and a branch has depth $1$ plus the maximum of its two…
  • DecisionTree.exists_dtree_of_dtDepthAttainment of the decision-tree depth. For every Boolean function $f : (\mathrm{Fin}\,n \to \mathrm{Bool}) \to \mathrm{Bool}$, there is a…
  • DecisionTree.coeffsThe coefficient function $\mathrm{coeffs}\,T : \mathcal{P}(\mathrm{Fin}\,n) \to \bbr$ defined by structural recursion on $T$. A leaf…
  • DecisionTree.signEvalThe $\pm 1$-valued function computed by a decision tree $T$, namely $x \mapsto \mathrm{boolToSign}(T.\mathrm{eval}\,x)$, where…
  • DecisionTree.degree_le_dtDepthDegree bounded by decision-tree depth. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean-valued function, and let $D(f)$ denote its…
  • DecisionTree.evalEvaluates a decision tree on an input $x$: a leaf returns its stored bit, and a branch on variable $i$ follows the high subtree when $x_i$…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
/-- A decision tree on `n` Boolean variables. [OD14, Def 3.13] - `leaf b`: output `b`. - `branch i lo hi`: query variable `i`; follow `lo` on `false`, `hi` on `true`. -/
inductive DecisionTree (n : ℕ) where
  | leaf   (val : Bool)                            : DecisionTree n
  | branch (var : Fin n) (lo hi : DecisionTree n) : DecisionTree n
See it in the graphDiscuss this resultChallenge it