AFTD Auto-Formalizing Theoretical Domains

DecisionTree.signEval

defimported Lean

The $\pm 1$-valued function computed by a decision tree $T$, namely $x \mapsto \mathrm{boolToSign}(T.\mathrm{eval}\,x)$, where $\mathrm{false} \mapsto 1$ and $\mathrm{true} \mapsto -1$.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open BooleanAnalysis in
variable {n : ℕ} in
noncomputable def DecisionTree.signEval (T : DecisionTree n) : BooleanFunc n
Defined in
TCSlib, `DecisionTree.signEval`
Lean proof
By Hydroxyi, Owen McGinty, Seyoon Ragavan (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (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
Built on 4
  • BooleanAnalysis.boolToSignThe sign encoding maps $\mathrm{Bool}$ to $\{-1,1\}\subset\bbr$:…
  • DecisionTreeA decision tree on $n$ Boolean variables: a leaf $\mathtt{leaf}\,b$ outputs $b$, and a branch $\mathtt{branch}\,i\,lo\,hi$ queries…
  • 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$…
  • BooleanAnalysis.BooleanFuncA Boolean function of arity $n$ is a function $f : \{0,1\}^n \to \bbr$.
Used by 4
  • 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.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…

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open BooleanAnalysis in
variable {n : ℕ} in
/-- The ±1-valued function computed by a decision tree (`false ↦ 1`, `true ↦ -1`, following `boolToSign`). -/
noncomputable def DecisionTree.signEval (T : DecisionTree n) : BooleanFunc n :=
  fun x => boolToSign (T.eval x)
See it in the graphDiscuss this resultChallenge it