Size measures on rooted nonplanar trees and their forests #
Main definitions #
RoseTree.leafCountP/RoseTree.leafDepthsP/RoseTree.leafDepthSumP(withNonplanardescents): leaf statistics by predicate over the leaf projection — the count isMultiset.countP, and the depth statistics are the card and sum of the depth multiset (card_leafDepthsP).RootedTree.Nonplanar.numEdges: the edge countnumNodes - 1of a rooted tree.RootedTree.Forest.numNodes/RootedTree.Forest.numEdges: the forest totals.
Main results #
RootedTree.Forest.numNodes_eq_card_add_numEdges: Euler's relation#V = b₀ + #Efor forests, withMultiset.cardthe component count.RoseTree.leafCountP_le_numNodes: a counted leaf is a vertex; strict when the root is uncounted (leafCountP_lt_numNodes_of_not).
[UPSTREAM] candidate alongside the Nonplanar carrier.
Leaf statistics by predicate #
The number of leaves whose label satisfies p.
Equations
- RoseTree.leafCountP p t = Multiset.countP p t.leaves
Instances For
The multiset of root-distances of the leaves whose label satisfies p.
Equations
- RoseTree.leafDepthsP p t = Multiset.map Prod.snd (Multiset.filter (fun (q : α × ℕ) => p q.1) t.leavesWithDepth)
Instances For
The sum of root-distances of the leaves whose label satisfies p.
Equations
- RoseTree.leafDepthSumP p t = (RoseTree.leafDepthsP p t).sum
Instances For
On a non-leaf node the count is the children's total, for any root label.
A root failing p contributes nothing, for any child list.
The count exhausts the leaves exactly when every leaf label satisfies p.
The counted leaves are exactly the depth entries: leafCountP is their number.
The counted-leaf depths of a node are the children's, each one edge deeper.
Each child contributes its own depth-weighted count plus one per counted leaf it carries (the extra edge from the node to the child).
leafCountP is a Perm-invariant.
leafDepthsP is a Perm-invariant.
leafDepthSumP is a Perm-invariant.
The children's counted leaves are bounded by the node's.
A counted leaf is a vertex: Multiset.countP_le_card through the leaf projection.
A root failing p is an uncounted vertex, so the count is strict.
A root failing p puts every counted leaf at depth ≥ 1, so the depth-weighted
count dominates the plain count.
Leaf statistics by predicate, on the quotient #
The number of leaves whose label satisfies p.
Equations
Instances For
A root failing p contributes nothing: the count is the children's total.
The sum of root-distances of the leaves whose label satisfies p.
Equations
Instances For
Each child contributes its own depth-weighted count plus one per counted leaf it carries.
A root failing p is an uncounted vertex, so the count is strict.
A root failing p puts every counted leaf at depth ≥ 1.
Counted leaves are among the non-root vertices whenever some vertex is uncounted.
Forest measures #
The total vertex count of a forest.
Equations
- RootedTree.Forest.numNodes F = (Multiset.map RootedTree.Nonplanar.numNodes F).sum
Instances For
The total edge count of a forest.
Equations
- RootedTree.Forest.numEdges F = (Multiset.map RootedTree.Nonplanar.numEdges F).sum