Leaf-labelled binary tree 2026-10-24
A binary tree with each data label stored at a leaf of a tree. One useful Haskell datatype has constructors One a for a leaf and Two (Tree a) (Tree a) for an internal node. Every finite inhabitant has at least one leaf, so this datatype cannot encode an empty leaf sequence. Its natural tree fold has a leaf operation a -> b and an internal operation b -> b -> b; replacing the two constructors by those operations defines the structural recursion.
A finite tree is a nonempty connected graph with no graph cycles. We show by mathematical induction on its number of vertices that it has edges. For there are no edges, so the assertion holds.
If , take a path in a graph of maximal length among those without repeated vertices. Each endpoint is a leaf of a tree: an additional incident edge would either extend the path in a graph or create a graph cycle. Delete one such leaf of a tree and its unique incident edge. The remaining graph stays connected, since a path in a graph between remaining vertices never needs that terminal edge, and it has no graph cycles. It is therefore a tree with vertices and, by mathematical induction, edges. Restoring the deleted edge gives .
Thus its Euler characteristic is