AFTD Auto-Formalizing Theoretical Domains

comparison_decision_tree_depth

def

The depth of a comparison decision tree is the maximum number of comparisons along any path from the root to a leaf.

Statement

def comparison_decision_tree_depth {n : ℕ} {β : Type} : ComparisonDecisionTree n β → ℕ
Defined in
arXiv:2611.26297
Verified
22 Nov 2026
Axioms
none listed
Built on 1

Read back from the Lean

A definition of a function comparison_decision_tree_depth that, given a natural number n and a type β, assigns a natural number (the depth) to each ComparisonDecisionTree n β: the depth of a leaf node is 0, and the depth of a branch node with left subtree l and right subtree r is 1 + max (depth l) (depth r).

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

/-- The depth (worst-case number of comparisons) of a comparison decision tree. -/
def comparison_decision_tree_depth {n : ℕ} {β : Type} : ComparisonDecisionTree n β → ℕ := fun
  | .leaf _ => 0
  | .branch _ _ l r => 1 + max (comparison_decision_tree_depth l) (comparison_decision_tree_depth r)
See it in the graphDiscuss this resultChallenge it