Leaf projections of a rose tree #
leavesWithDepth collects the leaves of a rose tree as a multiset of
(label, root-distance) pairs; leaves forgets the depths. Leaf statistics are then
Multiset computations — counts are Multiset.countP, bounds are inherited from
Multiset.countP_le_card — instead of one bespoke fold per statistic.
Main definitions #
RoseTree.leavesWithDepth,RoseTree.leaves: the projections, with descentsRootedTree.Nonplanar.leavesWithDepthandRootedTree.Nonplanar.leaves.
Main results #
RoseTree.card_leavesWithDepth: the projection hasnumLeaveselements.RoseTree.numLeaves_le_numNodes: a leaf is a vertex.
[UPSTREAM] candidate alongside the RoseTree carrier.
The projections #
The leaves of a rose tree, each paired with its distance from the root.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The multiset of leaf labels of a rose tree.
Equations
- t.leaves = Multiset.map Prod.fst t.leavesWithDepth
Instances For
Cardinality #
The projection has one element per leaf.
Perm invariance #
leavesWithDepth is a Perm-invariant: the fold algebra reads its arguments only
through a nil test and a sum.
Descent to Nonplanar #
The leaves of a nonplanar tree, each paired with its distance from the root.
Equations
Instances For
The multiset of leaf labels of a nonplanar tree.
Equations
- t.leaves = Multiset.map Prod.fst t.leavesWithDepth
Instances For
The projection has one element per leaf.