Size measures on unordered trees and their forests #
Main definitions #
UnorderedTree.numEdges: the edge countnumNodes - 1of a rooted tree.
Main results #
UnorderedTree.sum_map_numNodes: Euler's relation#V = b₀ + #Efor forests, withMultiset.cardthe component count.UnorderedTree.countP_leaves_le_numEdges: counted leaves are among the non-root vertices whenever some vertex is uncounted.
The number of edges of a rooted tree, numNodes - 1: every vertex except the root
has exactly one parent edge.
Instances For
Euler's relation for a rooted tree: #V = 1 + #E.
The edges of a node are the root-to-child edges plus each child's own: the total vertex count of the children.
Adjoining a root above a pair of trees adds two edges.
Adjoining a root above a pair of trees adds one vertex.
theorem
UnorderedTree.countP_leaves_le_numEdges
{α : Type u_1}
(p : α → Prop)
[DecidablePred p]
(t : UnorderedTree α)
(h : Multiset.countP p t.leaves < t.numNodes)
:
Counted leaves are among the non-root vertices whenever some vertex is uncounted.
Euler's relation for forests: #V = b₀ + #E, with Multiset.card the number of
component trees.