AFTD Auto-Formalizing Theoretical Domains

DecisionTree.depth

defimported Lean

The 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 subtrees' depths.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def DecisionTree.depth {n : ℕ} : DecisionTree n → ℕ
Defined in
TCSlib, `DecisionTree.depth`
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
Built on 1
  • DecisionTreeA decision tree on $n$ Boolean variables: a leaf $\mathtt{leaf}\,b$ outputs $b$, and a branch $\mathtt{branch}\,i\,lo\,hi$ queries…
Used by 5
  • 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.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.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.buildFull_depthThe complete tree started at level k has depth at most n - k.

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
/-- Depth of a decision tree (maximum path length to a leaf). [OD14, §3.2] -/
def DecisionTree.depth {n : ℕ} : DecisionTree n → ℕ
  | .leaf _          => 0
  | .branch _ lo hi  => 1 + max lo.depth hi.depth
See it in the graphDiscuss this resultChallenge it