Node-host decomposition of the multi-graft insertion #
For a single-tree host node a cs, the vertex set splits as
{root} ⊔ vertices(cs), so the simultaneous multi-graft insertion
decomposes by which guests land at the root (they are prepended as new
children) versus inside the child forest (a recursive insertionForest).
This is the node-level analog of insertionMultiset_add_host's
forest-append bucketing (InsertionAddHost.lean).
Main results #
listChoices_alphabet_split: choices over an appended alphabetys ++ zsenumerate as a boolean mask plus per-bucket choices, recombined bymergeMask.insertionForest_eq_multiGraftChildren_choices: the vertex-choice form ofinsertionForest— grafting into a host forestcsis the sum oververticesAux 0 cs-choices ofmultiGraftChildren.insertion_node_split: the headlineRoseTree-level decomposition ofinsertion (node a cs) gsby root-vs-subtree guest masks.
All three statements are validated computationally on concrete trees (multi-vertex hosts, repeated guests, empty edge cases) prior to proof.
Interleave us (used at true positions) and ws (used at false
positions) along the mask m. Off-length inputs truncate.
Equations
- RoseTree.Pathed.mergeMask [] x✝¹ x✝ = []
- RoseTree.Pathed.mergeMask (true :: m) (u :: us) x✝ = u :: RoseTree.Pathed.mergeMask m us x✝
- RoseTree.Pathed.mergeMask (true :: tail) [] x✝ = []
- RoseTree.Pathed.mergeMask (false :: m) x✝ (w :: ws) = w :: RoseTree.Pathed.mergeMask m x✝ ws
- RoseTree.Pathed.mergeMask (false :: tail) x✝ [] = []
Instances For
Alphabet split for listChoices #
Choices over an appended alphabet enumerate as: a boolean mask over
the positions, a choice vector over ys for the true positions,
and a choice vector over zs for the false positions, recombined
by mergeMask.
Choices over a singleton alphabet: the constant vector.
Index shift for verticesAux #
filterMap plumbing through mergeMask-zips #
multiGraft's three pair filters (rootPrependFilter,
headChildFilter, tailChildFilter) each kill all pairs from one
bucket of a mergeMask-interleaved choice vector; the surviving bucket
zips against its own guests.
Vertex-choice form of insertionForest #
Grafting a guest list into a host forest, in vertex-choice form:
insertionForest cs gs is the sum over assignments of each guest to
a forest vertex (a verticesAux 0 cs path) of the simultaneous
multiGraftChildren.
The node-host decomposition #
Node-host decomposition of the simultaneous multi-graft: guests
split by a boolean mask into root-guests (prepended as new children,
in guest order) and subtree-guests (an insertionForest into the
child forest).