Foissy 2021 Theorem 5.1 multi-tree insertion (path-based) #
@cite{foissy-typed-decorated-rooted-trees-2018} @cite{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 RootedTree.Planar.Pathed for now; the Pathed
sub-namespace will be hoisted to RootedTree.Planar once the legacy
Vertex.lean consumers (InsertSum.lean, Algebra.lean,
VertexBijection.lean) migrate to the path-based representation.
File scope #
- §1:
listChoices— choice-list enumeration (representation-independent). - §2:
insertion— Foissy 2021 Theorem 5.1, single-tree host. - §3:
insertionForest— forest host (Foissy 2021 §5.1) + identity/nil lemmas. - §4: Pair-list
Perm-invariance (multiGraft_perm_pair). - §5: Guest-list invariance (
insertion_perm_guests,insertion_planarEquiv_guests). - §6: Host invariance substrate —
swapPathAtpath-relabel bijection,vertices_swap_perm,multiGraft_swap_planarEquiv,insertion_planarEquiv_host. - §7: Forest invariance variants.
Status #
[UPSTREAM] candidate. Sorry-free.
- §1–§5: sorry-free.
- §6 (
multiGraft_swap_planarEquiv,insertion_planarEquiv_host): sorry-free. Architecture:PlanarStep.exists_pathBijectiongives, for anyPlanarStep t t', a path bijectionfsatisfying both((vertices t).map f).Perm (vertices t')and themultiGraft-equivalent after pair relabel. Built by induction on the step (swap usesswapPathAt n; recurse usespathLiftRecurse nof inner bijection).insertion_eq_of_pathBijis the generic lifter from path bijection tomk-equality of insertions. Together they yieldinsertion_planarStep_hostin two lines; the outerEqvGeninduction finishesinsertion_planarEquiv_host. - §7 (
insertionForest_planarEquiv_host): sorry-free. Induction onForall₂ PlanarEquiv; cons case lifts viaMultiset.map_bind+Multiset.bind_map+insertion_planarEquiv_host(head) + IH (tail). - §7 (
insertionForest_perm_guests): sorry-free. Outer induction onF; cons-Fcase routes throughforestPairSum, a Multiset aggregator that splits the guest list intopre_T(going to the head host) andpre_F(going to the tail forest). The bridgeforestPairSum_eq_insertionForestreduces to the canonicalinsertionForest; Perm invariance is then established viaforestPairSum_pre_perm_mk(Perm of accumulators, usinginsertion_perm_guestsfor the head + the outer F-IH for the tail) +forestPairSum_swap_mk(adjacent swap viaMultiset.bind_bind+ the pre-perm lemma) + induction onList.Perm.
§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
- RootedTree.Planar.Pathed.listChoices x✝ 0 = [[]]
- RootedTree.Planar.Pathed.listChoices x✝ n.succ = List.flatMap (fun (v : β) => List.map (fun (x : List β) => v :: x) (RootedTree.Planar.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.
- RootedTree.Planar.Pathed.insertionForest [] [] = {[]}
- RootedTree.Planar.Pathed.insertionForest [] (head :: tail) = 0
- RootedTree.Planar.Pathed.insertionForest (T :: F) [] = {T :: F}
Instances For
§4: Pair-list Perm invariance for multiGraft #
multiGraft T pairs is PlanarEquiv-invariant under permutation of the
pair list: grafts at distinct paths commute, and grafts at the same
path are root-list permutations (lift via planarEquiv_root_perm).
Path-based reformulation of the legacy multiGraft_perm_pair /
multiGraftList_perm_pair.
PlanarEquiv of multiGraft T pairs and multiGraft T pairs'
follows from a List.Perm between pairs and pairs'. Mutual
recursion on T with the children-list aux.
List-level companion to multiGraft_perm_pair: pair-list Perm
lifts to Forall₂ PlanarEquiv on the children list output of
multiGraftChildren.
Forall₂-version of multiGraft_perm_pair #
For insertion_planarEquiv_guests we need: when Ts ~ᶠ Ts' (Forall₂
PlanarEquiv) and we zip with the same choice, the resulting pair lists
satisfy a Forall₂ relation (same fst, PlanarEquiv snd). Then this lifts
to multiGraft T pairs ~ multiGraft T pairs' (PlanarEquiv).
Path-based version of the legacy multiGraft_planarEquiv_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 × Planar α to
Path × Planar α.
Single-tree insertion is mk-invariant under List.Perm of guests.
Guest-list Forall₂ PlanarEquiv lifts to insertion mk-equality.
§5.5: Validity discharge for multiGraft_compose at canonical shapes #
When the outer-pair list has the canonical shape choice.zip Ts with
choice ∈ listChoices (vertices T) Ts.length, the validity hypothesis
of multiGraft_compose (every pair's .fst is a valid path in the
host) discharges automatically via forall_isValidPath lifted from
mem_of_mem_listChoices.
Why this lives here and not in Graft.lean: listChoices is defined in
Insertion.lean §1, but multiGraft_compose is defined in Graft.lean
§11. The validity bridge crossing between them belongs here.
Consumer status (2026-05-16): previously used by the A3.3 basis-level
helpers (deleted with InsertionAssoc.lean). These specializations
remain as general-purpose validity-discharge utilities for any caller
working with listChoices-derived pair lists.
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
h_outer_valid hypothesis of multiGraft_compose for the canonical
A3.3 outer pair shape.
Auto-discharge variant of multiGraft_compose for the canonical A3.3
outer-pair shape choice_o.zip outer_Ts with choice_o ∈ listChoices (vertices T) outer_Ts.length. The inner pair list's validity is
passed as a hypothesis.
Doubly auto-discharged variant: both outer and inner choices come from
listChoices-derived enumerations. Specifically for the A3.3 TRUE-side
shape where inner = (v_c :: ch).zip (c :: filter_t) with v_c ∈ vertices T' and ch ∈ listChoices (vertices T') filter_t.length.
Cons-form specialization for the A3.3 TRUE-side pattern: the inner
pair list has shape (v_c, c) :: ch.zip filter_t where v_c ∈ vertices T'
and ch ∈ listChoices (vertices T') filter_t.length. The output of
multiGraft_compose_at_choice becomes a single multiGraft T with
composePairs building the combined pair list.
Distribute vertices_multiGraft_decomp's 3-class partition through a
bind over Multiset.ofList (vertices (multiGraft T pairs)). The v_c
bind in the A3.3 TRUE-side helper has exactly this shape; after this
rewrite, the bind splits into 3 binds (one per class), each ready for
per-class absorption (Sessions 2-3 substrate).
F-side analog: distribute vertices_forest_eq_partition's per-tree
3-class partition through a bind over Multiset.ofList (verticesAux 0 (forest as constructed)). Specifically the A3.3 FALSE-side helper
binds over the F'-side vertex enumeration, which has this shape with
cs = F_A (preserved + sourceSelf) and per-tree lifted into pre_FA_B.
NOTE: the FALSE side of A3.3 actually binds over perKFChoice F' not
raw vertices of F'; see perKFChoice_eq_forest_bind (Session 4
substrate) for the bridge from perKFChoice enumeration to vertex
enumeration with per-tree (i, v) pairs. This lemma is the raw vertex
form; pair with the forthcoming bridge to get the perKFChoice form.
Decompose insertion T (c :: filter_t) by extracting the leading vertex
v_c as a bind variable. The first vertex choice routes c; the
remaining filter_t.length choices route the rest of the guests.
Combined form for insertion (multiGraft T pairs) (c :: filter_t) binding
into a function K: the v_c bind splits into preserved + sourceSelf + lifted
via vc_partition_via_bind, with each class producing a sub-bind over
ch ∈ listChoices (vertices (multiGraft T pairs)) filter_t.length.
§5.6: A3.3 substrate — Session 3 auto-discharge specializations #
Specializations of insertion_cons_pair_at_multiGraft_bind for the canonical
A3.3 outer-pair shape pairs = choice.zip Ts with
choice ∈ listChoices (vertices T) Ts.length. The validity hypothesis is
auto-discharged via forall_zip_isValidPath_of_listChoices.
Used by LHS_TRUE_eq_T_buckets (and Session 4's analog) to split the inner
(insertion T' (c :: filter_t)).bind K into preserved+sourceSelf and lifted
classes WITHOUT requiring the proof to discharge validity inline.
Auto-discharge specialization of insertion_cons_pair_at_multiGraft_bind
for the canonical A3.3 shape pairs = choice.zip Ts. The validity
hypothesis is supplied internally via forall_zip_isValidPath_of_listChoices.
Unfold (insertion T Ts).bind K to its choice-bind form, exposing the
choice ∈ listChoices (vertices T) Ts.length bind variable so that
mG T (choice.zip Ts) is substituted into K. Bridge from the abstract
insertion T Ts form to the concrete pair-list-choice form needed for
insertion_cons_pair_at_multiGraft_bind_at_choice.
Proof: unfold insertion_def, then ← Multiset.map_coe + Multiset.bind_map
to expose choice as the bind variable.
Bundled substrate for Session 4: the bind-over-listChoices composed with
the inner cons-pair split. Discharges h_choice internally via
Multiset.mem_coe. The K parameter is universally quantified over the
choice (so it can carry context from outer binds in the calling proof).
Use this when the goal has form (Mset.ofList (lC vT Ts.length)).bind (fun choice => (insertion (mG T (choice.zip Ts)) (c :: filter_t)).bind (K choice)) and you want to split the inner bind into preserved+lifted
classes without manually peeling the choice-bind via Multiset.bind_congr.
§5.7: composePairs_planarEquiv_partition — partition of composePairs result #
The PE-level partition theorem for composePairs (defined in Graft.lean §11).
For an outer pair list and inner pair list (with inner paths valid in
mG T outer), applying multiGraft T to composePairs outer inner is
PE-equivalent (at Nonplanar.mk level) to applying multiGraft T to:
- For each
k : Fin outer.length: outer[k] modified to have its.sndmulti-grafted withliftedInnerAt outer inner k(the inner pairs lifted into outer[k]'s subtree, with paths stripped viastripLiftMulti). - Plus
rootInner outer inner: the preserved/sourceSelf inner pairs with paths untransported back to T-coordinates viauntransport.
DEPRECATED 2026-05-16 as critical-path substrate. Off the GL
associativity path under the abstract OG pivot
(scratch/pivot_to_prelie_pbw.md,
Linglib/Core/Algebra/PreLie/OudomGuinCirc.lean). Sorry remains; the
helpers liftedInnerAt/rootInner are kept as generic
vertex-decomposition primitives.
Partition assembly: applying multiGraft T to composePairs outer inner
is PE-equivalent (at Nonplanar level) to applying multiGraft T to the
assembled per-outer-k sub-multiGrafts plus untransported root inner.
§6: Host invariance via path-swap bijection #
insertion T Ts is mk-invariant under PlanarEquiv 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_planarEquiv— the multiGraft results differ only by the swap of l/r in the root children list; lift viaPlanarStep.swapAtRoot.- Combine via listChoices Perm-respect →
insertion_swap_invariant. - Lift via
PlanarStep(recurse case) andPlanarEquiv = EqvGen PlanarStep.
Swap the first index n ↔ n+1 of a path. Acts as identity on paths
starting outside {n, n+1} and on the root path [].
Equations
- RootedTree.Planar.Pathed.swapPathAt n [] = []
- RootedTree.Planar.Pathed.swapPathAt n (i :: rest) = if i = n then (n + 1) :: rest else if i = n + 1 then n :: rest else i :: rest
Instances For
Vertices of node a (pre ++ l :: r :: post) mapped through
swapPathAt pre.length is a List.Perm of vertices of
node a (pre ++ r :: l :: post).
§6.2 substrate: pair-relabel + planarEquiv prefix-cons-lift #
multiGraft is PlanarEquiv-invariant under swap of two adjacent
root children, with pairs relabeled via swapPathAt. The proof
decomposes both sides into matching children lists (up to a single
swap), then applies PlanarStep.swapAtRoot.
Sub-lemmas for the filter equalities are proved inline as have
statements to ensure the inline-match expressions unify with the
matcher generated by multiGraft_node.
§6.3 substrate for insertion_planarEquiv_host #
The swapAtRoot case of insertion_planarStep_host needs to lift a Perm
of vertices into a Perm of choice lists (via listChoices), then combine
with multiGraft_swap_planarEquiv 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.
listChoices respects List.Perm of the source: a Perm of xs and
ys lifts to a Perm of listChoices xs n and listChoices ys n.
insertion T Ts is mk-invariant under PlanarEquiv of the host.
Forest host invariance: Forall₂ PlanarEquiv 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).