Nonplanar n-ary rooted trees as a quotient of Planar α #
@cite{marcolli-chomsky-berwick-2025} @cite{foissy-introduction-hopf-algebras-trees}
A nonplanar rooted tree is a Planar α modulo the equivalence
relation generated by:
- swapping two adjacent children of any vertex
- replacing a child with a nonplanar-equivalent tree (recursive step)
The quotient Nonplanar α := Quotient PlanarSetoid gives the carrier MCB §1.1.2 +
§1.10 actually wants for syntactic objects: trees with unordered
children at each node.
Strategy #
Define a primitive Step relation that captures a single elementary
move (a swap or a recursive substitution), then take the equivalence
closure via Relation.EqvGen. This way:
- The equivalence relation IS automatically an equivalence (via the
reflexive/symmetric/transitive constructors of
EqvGen). - Proving things about it reduces to handling the elementary
Stepcases plus the equivalence-closure constructors.
Foissy connection #
With Nonplanar α as carrier, B+_a : Multiset (Nonplanar α) → Nonplanar α
becomes well-defined: graft the multiset of children under a new root
labeled a. (For Planar α with multiset forests, B+ wasn't well-defined
because the resulting tree's child-list ordering depended on choice of
multiset representative.) This unblocks Foissy's clean cocycle proof of
Δ^p coassoc on the nonplanar Hopf algebra (Phase A.7).
MCB anchor #
@cite{marcolli-chomsky-berwick-2025} §1.1.3 (book p. 20) — explicit
caveat: {α, {β, γ}} = α △ β γ = α △ γ β = γ β △ α. This file's
Nonplanar α realizes that unordered-children semantics for general
arity.
Status #
[UPSTREAM] candidate. No sorries.
PlanarStep — elementary moves #
A PlanarStep t s says: s is obtained from t by either:
- swapping two adjacent children of some vertex, or
- replacing a single child with a tree related by
PlanarStep(recursion).
A single-step nonplanar permutation move on a planar tree.
- swapAtRoot
{α : Type u_1}
{a : α}
{l r : Planar α}
{pre post : List (Planar α)}
: (node a (pre ++ l :: r :: post)).PlanarStep (node a (pre ++ r :: l :: post))
Swap two adjacent children at the root vertex.
- recurse
{α : Type u_1}
{a : α}
{pre : List (Planar α)}
{old new : Planar α}
{post : List (Planar α)}
(h : old.PlanarStep new)
: (node a (pre ++ old :: post)).PlanarStep (node a (pre ++ new :: post))
Apply a step inside a child subtree, leaving siblings unchanged.
Instances For
PlanarEquiv — equivalence closure #
The nonplanar-equivalence relation on planar trees: the equivalence
closure of PlanarStep. Built using Relation.EqvGen, so it's
automatically reflexive / symmetric / transitive.
Nonplanar equivalence on planar trees: equivalence closure of
PlanarStep.
Equations
- RootedTree.Planar.PlanarEquiv = Relation.EqvGen RootedTree.Planar.PlanarStep
Instances For
Lifting structural invariants from Planar to Nonplanar #
Functions Planar α → β that are invariant under PlanarStep lift
through the equivalence closure to functions Nonplanar α → β. Below
we lift weight (vertex count) and arity-at-root as worked examples.
The pattern: prove invariance under the elementary PlanarStep, then
extend to PlanarEquiv = EqvGen PlanarStep by an EqvGen induction.
Weight invariance #
Weight is invariant under PlanarEquiv. By induction on EqvGen.
Label invariance #
The root label is preserved by PlanarEquiv.
Lifting child-list operations to PlanarEquiv #
The smart constructor Nonplanar.node needs to know that the
parent-node equivalence respects the natural list-of-children
operations: cons (sibling-prepend), permutation, and componentwise
equivalence.
Lift a PlanarEquiv from a child to the parent that has identical
pre- and post-siblings (a chain of recurse moves).
A PlanarEquiv between root nodes lifts under a sibling-cons.
A List.Perm at root level lifts to PlanarEquiv on the node.
A componentwise PlanarEquiv on root children lifts to PlanarEquiv
on the node.
Arity / depth / isLeaf invariance #
Three more invariants of tree structure that are preserved by
PlanarEquiv. The pattern follows weight (§3a): prove *_planarStep
by case on the step constructor (using a per-list permutation lemma
when the function aggregates over children), then lift to *_planarEquiv
via EqvGen induction.
Arity is invariant under PlanarEquiv.
Depth is invariant under PlanarEquiv.
Leaf-ness is invariant under PlanarEquiv.
Setoid instance #
The setoid on Planar α whose quotient is Nonplanar α.
Equations
- RootedTree.Planar.instSetoid = { r := RootedTree.Planar.PlanarEquiv, iseqv := ⋯ }
Nonplanar — the quotient type #
A nonplanar n-ary rooted tree with α-labeled vertices: the quotient
of Planar α by PlanarEquiv.
Equations
- RootedTree.Nonplanar α = Quotient RootedTree.Planar.instSetoid
Instances For
The canonical projection from planar to nonplanar trees.
Equations
- RootedTree.Nonplanar.mk t = ⟦t⟧
Instances For
Two planar trees give the same nonplanar tree iff they're
PlanarEquiv.
Lift a function Planar α → β that's invariant under PlanarEquiv
to Nonplanar α → β.
Equations
- RootedTree.Nonplanar.lift f h = Quotient.lift f h
Instances For
Smart leaf constructor + lifted weight #
A leaf in Nonplanar α is mk (Planar.leaf a). Weight is the
canonical first lifted invariant.
A nonplanar leaf labeled a.
Equations
Instances For
The weight (vertex count) of a nonplanar tree, lifted from
Planar.weight via PlanarEquiv-invariance.
Instances For
The arity (root child count) of a nonplanar tree.
Instances For
The depth (longest root-to-leaf path) of a nonplanar tree.
Instances For
A nonplanar tree is a leaf if its root has no children. (Audit
item: queue migrate to Prop + [DecidablePred] once the matching
Planar.isLeaf is migrated.)
Instances For
Smart node constructor #
The B+ operator (Phase A.7) and the Δ^c trace coproduct (Phase D) both
require building a Nonplanar α from a label and an unordered
collection of children. The smart constructor node a cs does this on
Multiset (Nonplanar α); well-definedness follows from
Planar.planarEquiv_root_perm (children-list permutation invariance).
The characterization node_mk_planar_list then bridges back to the
underlying planar node via Quotient.mk_out componentwise.
Build a Nonplanar α from a label and an unordered multiset of
children. Implementation: pick a list representative of the
multiset (Quotient.liftOn), then per-child planar representatives
via Quotient.out, and quotient back.
Equations
- RootedTree.Nonplanar.node a cs = Quotient.liftOn cs (fun (lst : List (RootedTree.Nonplanar α)) => RootedTree.Nonplanar.mk (RootedTree.Planar.node a (List.map Quotient.out lst))) ⋯
Instances For
Characterization: building a Nonplanar α from a list of planar
children (lifted to nonplanar via mk) agrees with directly lifting
the planar node a ps.
Sanity tests #
Functoriality of map under PlanarEquiv #
Setup for Nonplanar.map: lift Planar.map through the quotient by
showing it preserves the equivalence relation. Done in two steps:
elementary PlanarStep preservation, then closure under EqvGen.
Planar.map preserves PlanarEquiv (the equivalence closure of
PlanarStep). Substrate for Nonplanar.map.
Functoriality #
Lift Planar.map through the quotient. Counterpart of List.map for
lists: a function f : α → β lifts to Nonplanar α → Nonplanar β by
relabeling every vertex.
Map a function over the vertex labels of a nonplanar rooted tree.
Lifted from Planar.map via Quotient.map.
Equations
- RootedTree.Nonplanar.map f = Quotient.map (RootedTree.Planar.map f) ⋯
Instances For
Quotient-unfolding for Nonplanar.map. Plain lemma (not @[simp])
since mathlib's generic Quotient.map_mk covers the same ground.