Unordered rooted trees #
An unordered rooted tree with vertices labelled in α is a RoseTree α modulo the permutation
of children at every vertex: the quotient UnorderedTree α := Quotient RoseTree.isSetoid. In the
Connes–Kreimer literature these are the rooted trees and the ordered ones the planar rooted
trees ([Foi]); [marcolli-chomsky-berwick-2025] §1.1.3 builds
syntactic objects on them, since Merge is set formation and {α, {β, γ}} has no order. The
identity criterion is RoseTree.Perm (Core/Data/RoseTree/Perm.lean); this file owns the
quotient: the projection mk, the lifting API, the lifted invariants, and the constructor node
on Multiset children, under which the grafting B⁺ of a multiset of trees is well defined.
Main definitions #
References #
- [M. Marcolli, N. Chomsky and R. C. Berwick, Mathematical Structure of Syntactic Merge (2025)][marcolli-chomsky-berwick-2025]
- L. Foissy, An introduction to Hopf algebras of trees
The quotient type #
An unordered rooted tree with α-labelled vertices: the quotient of RoseTree α by the
permutation of children at every vertex, RoseTree.Perm.
Equations
- UnorderedTree α = Quotient RoseTree.isSetoid
Instances For
The canonical projection from ordered to nonplanar trees.
Equations
- UnorderedTree.mk t = ⟦t⟧
Instances For
Two trees give the same nonplanar tree iff they're RoseTree.Perm-related.
Lift a function RoseTree α → β that's invariant under RoseTree.Perm
to UnorderedTree α → β.
Equations
- UnorderedTree.lift f h = Quotient.lift f h
Instances For
Induction in mk-form (cf. Multiset.induction_on): goals display
UnorderedTree.mk rather than Quotient.mk, so mk-stated lemmas rewrite.
Binary induction in mk-form.
Smart leaf constructor + lifted counts #
A leaf in UnorderedTree α is mk (RoseTree.leaf a). numNodes is the
canonical first lifted invariant.
A nonplanar leaf labeled a.
Equations
Instances For
The node count (number of vertices) of a nonplanar tree, lifted
from RoseTree.numNodes via RoseTree.Perm-invariance.
Equations
Instances For
The leaf count (number of childless vertices) of a nonplanar tree,
lifted from RoseTree.numLeaves via RoseTree.Perm-invariance. MCB's
complexity grading #L (Def. 1.6.2) is built on this.
Equations
Instances For
The arity (root child count) of a nonplanar tree.
Equations
Instances For
The depth (longest root-to-leaf path in vertices) of a nonplanar tree.
Equations
Instances For
A nonplanar tree is a leaf if its root has no children. (Audit
item: queue migrate to Prop + [DecidablePred] once the matching
RoseTree.isLeaf is migrated.)
Equations
Instances For
Destructors and node injectivity #
The root value and the children (as a multiset of nonplanar trees) are
RoseTree.Perm-invariant, so they descend to UnorderedTree. congrArg on these destructors
inverts mk-equality at a node with no induction, giving the injectivity
characterization mk_node_eq_mk_node_iff.
The root value of a nonplanar tree.
Equations
Instances For
The children of a nonplanar tree, as a multiset of nonplanar trees.
Equations
- UnorderedTree.children = UnorderedTree.lift (fun (t : RoseTree α) => ↑(List.map UnorderedTree.mk t.children)) ⋯
Instances For
Injectivity of the node constructor on the quotient: mk-images of two nodes are
equal iff the root values agree and the children agree as multisets of nonplanar
trees. The forward direction is congrArg on the value and children
destructors; the backward direction assembles a RoseTree.Perm componentwise.
Smart node constructor #
The B+ operator (Phase A.7) and the Δ^c trace coproduct (Phase D) both
require building a UnorderedTree α from a label and an unordered
collection of children. The smart constructor node a cs does this on
Multiset (UnorderedTree α); well-definedness follows from
RoseTree.Perm.node_of_perm (children-list permutation invariance).
The characterization node_mk_tree_list then bridges back to the
underlying RoseTree node via Quotient.mk_out componentwise.
Build a UnorderedTree α from a label and an unordered multiset of
children. Implementation: pick a list representative of the
multiset (Quotient.liftOn), then per-child tree representatives
via Quotient.out, and quotient back.
Equations
- UnorderedTree.node a cs = Quotient.liftOn cs (fun (lst : List (UnorderedTree α)) => UnorderedTree.mk (RoseTree.node a (List.map Quotient.out lst))) ⋯
Instances For
Characterization: building a UnorderedTree α from a list of tree
children (lifted to nonplanar via mk) agrees with directly lifting
the tree node a ps.
Binary case of node_mk_tree_list: a bare pair of mk-lifted trees.
The empty-forest node is the leaf.
Choose planar representatives for a whole forest at once: every
Multiset (UnorderedTree α) is the mk-image of a list of planar trees. Descent
proofs that use this eliminator meet node_mk_tree_list on the nose, with no
Quotient.out repair.
Sanity tests #
Root value and children #
Root-level projections, lifted through the quotient: RoseTree.value is
RoseTree.Perm-invariant on the nose (Perm.value_eq), and the mk-image of
RoseTree.children is invariant as a multiset (perm_children_map_mk).
The root value of a nonplanar tree.
Equations
Instances For
The multiset of root children of a nonplanar tree.
Equations
- UnorderedTree.rootChildren = UnorderedTree.lift (fun (t : RoseTree α) => ↑(List.map UnorderedTree.mk t.children)) ⋯
Instances For
Eta law: every tree is the node of its root value and root children.
Every tree has at least one vertex (the root).
Node count of a smart-constructor node: one (the root) plus the
total node count of the children multiset.
A tree's depth is strictly less than the depth of any node containing it as a child.
Edge count of a forest #
Total edge count of a forest of nonplanar trees: each tree with n
vertices contributes n - 1 edges. Defined as a per-tree sum (no
global subtraction) so additivity is immediate.
Equations
- UnorderedTree.Forest.edgeCount F = (Multiset.map (fun (T : UnorderedTree α) => T.numNodes - 1) F).sum
Instances For
Functoriality #
Lift RoseTree.map through the quotient. Counterpart of List.map for
lists: a function f : α → β lifts to UnorderedTree α → UnorderedTree β by
relabeling every vertex.
Map a function over the vertex labels of a nonplanar rooted tree.
Lifted from RoseTree.map via Quotient.map.
Equations
- UnorderedTree.map f = Quotient.map (RoseTree.map f) ⋯
Instances For
Quotient-unfolding for UnorderedTree.map. Plain lemma (not @[simp])
since mathlib's generic Quotient.map_mk covers the same ground.