ComparisonDecisionTree
inductiveoriginal
A binary comparison decision tree on n elements whose leaves return a value of type β.
Statement
inductive ComparisonDecisionTree (n : ℕ) (β : Type) : Type
- Related work
- arXiv:2611.26297
- Verified
- 22 Nov 2026
- Axioms
- none listed
- Used by 3
- comparison_decision_tree_depthThe depth of a comparison decision tree is the maximum number of comparisons along any path from the root to a leaf.
- comparison_decision_tree_evalEvaluation of a comparison decision tree on an input sequence v : Fin n → α over a linear order α, branching left if v i < v j and right…
- comparison_tree_finds_guaranteed_rollercoasterA comparison decision tree T on n elements correctly finds a guaranteed-length k-rollercoaster if for every permutation σ of Fin n, the…
Read back from the Lean
An inductive datatype ComparisonDecisionTree n β, parameterized by a natural number n : ℕ and a type β : Type, representing a binary comparison decision tree with two constructors:
1. leaf: takes a value of type β and produces a tree.
2. branch: takes two indices of type Fin n (the items being compared) and two subtrees of type ComparisonDecisionTree n β (representing the two branches of the decision), producing a tree.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- A binary comparison decision tree on n elements whose internal nodes perform pairwise comparisons and whose leaves return a value of type β. -/ inductive ComparisonDecisionTree (n : ℕ) (β : Type) : Type where | leaf : β → ComparisonDecisionTree n β | branch : Fin n → Fin n → ComparisonDecisionTree n β → ComparisonDecisionTree n β → ComparisonDecisionTree n β