AFTD Auto-Formalizing Theoretical Domains

plane_tree_num_leaves

def

The number of leaves of a plane tree T, denoted ℓ(T).

Statement

def plane_tree_num_leaves : PlaneTree → ℕ
Defined in
arXiv:2611.10154 Sec. 2.2
Verified
10 Nov 2026
Axioms
none listed
Built on 1
  • PlaneTreeA finite plane tree is either a leaf or an internal node with a list of child plane trees.
Used by 6

Read back from the Lean

The definition of a function plane_tree_num_leaves : PlaneTree → ℕ by recursion on PlaneTree: - For PlaneTree.leaf, it returns 1. - For PlaneTree.node cs (where cs is a List PlaneTree), it returns the sum over all child trees c in cs of plane_tree_num_leaves c.

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 number of leaves in a finite plane tree. -/
def plane_tree_num_leaves : PlaneTree → ℕ
  | .leaf => 1
  | .node cs => cs.attach.map (fun ⟨c, _⟩ => plane_tree_num_leaves c) |>.sum
termination_by t => sizeOf t
See it in the graphDiscuss this resultChallenge it