Foissy 2021 Theorem 5.1 multi-tree insertion (path-based) #
[foissy-typed-decorated-rooted-trees-2018] [foissy-introduction-hopf-algebras-trees]
The Foissy 2021 Theorem 5.1 multi-tree multi-vertex insertion operator.
Defined as a sum over functions Ts → V(T) of multiGraft, taken as
a Multiset to make the sum-over-choices commutative.
Sibling to Graft.lean (path-based multi-graft primitive). Lives under
namespace RoseTree.Pathed.
File scope #
- §1:
listChoices— choice-list enumeration (representation-independent). - §2:
insertion— Foissy 2021 Theorem 5.1, single-tree host. - §3:
insertionForest— forest host + identity/nil lemmas. - §4: Pair-list
Perm-invariance formultiGraft. - §5: Guest-list invariance for
insertion(insertion_permEquiv_guests). - §5.5: Validity discharge for
listChoices-derived pair lists. - §6: Host invariance via the
swapPathAtpath-relabel bijection. - §7: Forest invariance (
insertionForest_permEquiv_host,insertionForest_perm_guests). - §8: Singleton-host insertion.
Status #
[UPSTREAM] candidate. Sorry-free.
§1: listChoices enumeration #
All length-n lists with entries from xs (with repetition).
The "n-fold list power" used in Foissy 2021 Theorem 5.1's
vertex-choice sum. Representation-independent (no Vertex
dependence): copied from the legacy Insertion.lean.
Equations
- RoseTree.Pathed.listChoices x✝ 0 = [[]]
- RoseTree.Pathed.listChoices x✝ n.succ = List.flatMap (fun (v : β) => List.map (fun (x : List β) => v :: x) (RoseTree.Pathed.listChoices x✝ n)) x✝
Instances For
Foissy 2021 Theorem 5.1 multi-graft on a single-tree host. Sum over
(v₁, …, vₙ) ∈ V(T)ⁿ of multiGraft T [(v₁, T₁), …, (vₙ, Tₙ)].
Equations
- One or more equations did not get rendered due to their size.
Instances For
§3: insertionForest — forest host #
Multi-graft into a host forest. Disjoint pattern cases for clean auto-generated equation lemmas.
Equations
- One or more equations did not get rendered due to their size.
- RoseTree.Pathed.insertionForest [] [] = {[]}
- RoseTree.Pathed.insertionForest [] (head :: tail) = 0
- RoseTree.Pathed.insertionForest (T :: F) [] = {T :: F}
Instances For
§4: Pair-list Perm invariance for multiGraft #
multiGraft T pairs is PermEquiv-invariant under permutation of the
pair list: grafts at distinct paths commute, and grafts at the same
path are root-list permutations (lift via permEquiv_root_perm).
Path-based reformulation of the legacy multiGraft_perm_pair /
multiGraftList_perm_pair.
Forall₂-version of multiGraft_perm_pair #
For insertion_permEquiv_guests we need: when Ts ~ᶠ Ts' (Forall₂
PermEquiv) and we zip with the same choice, the resulting pair lists
satisfy a Forall₂ relation (same fst, PermEquiv snd). Then this lifts
to multiGraft T pairs ~ multiGraft T pairs' (PermEquiv).
Path-based version of the legacy multiGraft_permEquiv_pair_Forall₂.
§5: Guest-list invariance for insertion #
pairSum t pre Ts aggregates mk (multiGraft t (pre ++ c.zip Ts)) over
all choices c ∈ listChoices (vertices t) |Ts|. The clean recursive
equation pairSum t pre (x :: rest) = bind v over vertices of pairSum t (pre ++ [(v, x)]) rest lets us prove Ts-perm invariance by
Perm induction.
Path-based reformulation of the legacy pairSum / insertion_perm_guests
machinery. The pair type changes from Vertex t × RoseTree α to
Path × RoseTree α.
Guest-list Forall₂ PermEquiv lifts to insertion mk-equality.
§5.5: Validity discharge for listChoices-derived pair lists #
Every element of a listChoices-enumerated choice is a member of the
alphabet (mem_of_mem_listChoices), so a pair list of the canonical
shape choice.zip Ts automatically satisfies the validity hypothesis
that graft operations require (forall_zip_isValidPath_of_listChoices).
These utilities are consumed by InsertionNodeDecomp and
InsertionCompose.
Every element of a choice ∈ listChoices xs n is a member of xs.
Lifts membership-in-an-enumerated-choice to membership-in-the-alphabet.
Every path in a choice.zip Ts pair list is a valid path in T, when
choice ∈ listChoices (vertices T) Ts.length. Discharges the validity
hypothesis of the graft operations for listChoices-derived pair lists.
§6: Host invariance via path-swap bijection #
insertion T Ts is mk-invariant under PermEquiv of the host: the
original blocker for the path-based refactor.
Strategy:
swapPathAt n— swap the first indexn ↔ n+1in a path.vertices_swap_perm— applyingswapPathAt pre.lengthto vertices ofnode a (pre ++ l :: r :: post)is aList.Permof vertices ofnode a (pre ++ r :: l :: post). Reduces to aList.Permof two appendable middle blocks, viaverticesAux_append+ aList.perm_append_comm.multiGraft_swap_permEquiv— the multiGraft results differ only by the swap of l/r in the root children list; lift viaPermStep.swapAtRoot.- Combine via listChoices Perm-respect →
insertion_swap_invariant. - Lift via
PermStep(recurse case) andPermEquiv = EqvGen PermStep.
§6.2 substrate: pair-relabel + permEquiv prefix-cons-lift #
§6.3 substrate for insertion_permEquiv_host #
The swapAtRoot case of insertion_permStep_host needs to lift a Perm
of vertices into a Perm of choice lists (via listChoices), then combine
with multiGraft_swap_permEquiv to get equal mk-mapped insertion
outputs. Helpers below build this bridge.
listChoices is compatible with List.map: applying f element-wise
to choices in xs.map f gives the same as mapping List.map f over
listChoices xs n.
Forest host invariance: Forall₂ PermEquiv F F' lifts to
mk-equality of insertionForest F Ts and insertionForest F' Ts.
§7.1 substrate for insertionForest_perm_guests #
Forest-side analogue of pairSum: a Multiset aggregator that splits the
guest list into a pre_T bucket (going to the head host T) and a
pre_F bucket (going to the tail forest), then aggregates over all
remaining assignments. Used to make Ts-Perm-invariance provable by
induction on the Perm structure (the swap case becomes a clean
Multiset.bind_bind after lifting to the mk-mapped level).
Forest guest invariance: List.Perm of guests lifts to
mk-equality of insertionForest.
§8: Singleton-host insertion = single-tree insertion lifted to singleton lists #
insertionForest [T] gs = (insertion T gs).map (fun T' => [T']) — when the
host has exactly one tree, the multi-graft is just the single-tree multi-graft
with each output wrapped in a singleton list. Used downstream to handle
hostTripleSum T [T'] F patterns at the singleton-F_A level.
Singleton-host insertion: when the host has exactly one tree,
insertionForest reduces to single-tree insertion followed by singleton
lift. This lets us match hostTripleSum T [T_other] F patterns by
converting (insertionForest [T_other] pre).bind to (insertion T_other pre).bind
(via Multiset.bind_map).