Words, the definitional factorial ledger, and word-level collapse #
PAPER_MAP node D-ledger for Deng–Shen (arXiv:2607.10105),
implementing the pure word model of DESIGN §5.5: all §5.4 permutation sums with
multiplicities ((5.15), (5.33)) are stated as sums over word maps w : Fin M → α
with prescribed fiber sizes (validWords), never over labeled copies.
Anderson4D.validWords,Anderson4D.inducedWord— admissible words and the word induced by a labeled arrangementσ : Fin M ≃ Σ a, Fin (mult a).Anderson4D.card_arrangements_fiber,Anderson4D.ledger_sum— a valid word is induced by exactly∏ a, (mult a)!labeled arrangements, so any statistic summed over labeled arrangements equals∏ a, (mult a)!times its sum over valid words.Anderson4D.wordSum,Anderson4D.paperSum— the definitional ledgerpaperSum mult F := (∏ a, ((mult a)! : ℝ)) * wordSum mult F; statements of P-5.7/P-5.9/P-5.10 putpaperSumon the left-hand side, andpaperSum_eq_sum_arrangementsconverts at statement boundaries.Anderson4D.NoAdjacentEqual— the "no adjacent equal letters" side condition of (5.15)/(5.33), with a decidability instance.Anderson4D.wordCollapseEquiv— the §5.4.1 collapse as an honest word-levelEquiv: a word overA ⊕ Bis the same data as its nonempty blocks (maximal runs of inside letters) plus its collapsed word overUnit ⊕ Bwith markers pairwise non-adjacent and marker count = block count. Letter counts transport (count_inl_collapse,count_inr_collapse).Anderson4D.wordSumFiltered,Anderson4D.paperSumFiltered— restricted sums over words satisfying a side condition, with monotonicity for nonnegativeF.
This is the stable word carrier used by the permutation-sum formalization.
The word-level collapse equivalence #
No two adjacent letters of s are both markers (Sum.inl _). This expresses that
the marked positions come from maximal runs of inside letters.
Equations
Instances For
The number of markers in a collapsed word. Stated via countP Sum.isLeft so that no
decidable equality on B is needed; see markerCount_eq_count for the version with
List.count (Sum.inl ()).
Equations
- Anderson4D.markerCount s = List.countP (fun (x : Unit ⊕ B) => x.isLeft) s
Instances For
Collapse a word into its list of blocks (maximal runs of inside letters) and its
collapsed word (each maximal run replaced by one marker Sum.inl ()).
Equations
- Anderson4D.collapse [] = ([], [])
- Anderson4D.collapse (Sum.inr b :: w) = ((Anderson4D.collapse w).1, Sum.inr b :: (Anderson4D.collapse w).2)
- Anderson4D.collapse [Sum.inl a] = ([[a]], [Sum.inl ()])
- Anderson4D.collapse (Sum.inl a :: Sum.inl a' :: w) = (List.modifyHead (fun (x : List A) => a :: x) (Anderson4D.collapse (Sum.inl a' :: w)).1, (Anderson4D.collapse (Sum.inl a' :: w)).2)
- Anderson4D.collapse (Sum.inl a :: Sum.inr b :: w) = ([a] :: (Anderson4D.collapse (Sum.inr b :: w)).1, Sum.inl () :: (Anderson4D.collapse (Sum.inr b :: w)).2)
Instances For
Substitute the i-th block for the i-th marker (in order): the inverse of collapse.
On inputs violating the block/marker bookkeeping it silently drops the offending data;
such inputs are excluded by the subtype in wordCollapseEquiv.
Equations
- Anderson4D.expand x✝ [] = []
- Anderson4D.expand x✝ (Sum.inr b :: s) = Sum.inr b :: Anderson4D.expand x✝ s
- Anderson4D.expand [] (Sum.inl val :: s) = Anderson4D.expand [] s
- Anderson4D.expand (blk :: bs) (Sum.inl val :: s) = List.map Sum.inl blk ++ Anderson4D.expand bs s
Instances For
Small facts about NoTwoAdjacentMarkers #
A word starting with an inside letter collapses to a first block starting with that letter and a collapsed word starting with a marker.
Collapsing a nonempty inside run prepended to a word that does not start with an inside letter: the run becomes the first block and contributes one marker.
The three structural invariants of a collapsed word: all blocks are nonempty, the marker count equals the block count, and no two markers are adjacent.
Right inverse: collapsing an expansion recovers the block/marker data.
Word-level collapse equivalence (§5.4.1 collapse, DESIGN §5.5). A word over
A ⊕ B is the same data as a list of nonempty blocks over A together with a collapsed
word over Unit ⊕ B whose marker count equals the number of blocks and in which no two
markers are adjacent. The forward map is collapse; the inverse substitutes the i-th
block for the i-th marker.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Letter-count transport #
Mathlib's Sum.instBEq currently has no LawfulBEq instance, so we first record how
== computes on constructors; this lets simp normalize List.count on sum types.
With decidable equality available, markerCount is the count of the marker letter.
Inside-letter counts sum over the blocks of the collapse.
Outside-letter counts are preserved by the collapse.
The factorial ledger #
The fiber of a sigma type over a point a of the base.
Equations
Instances For
The family of fiber bijections extracted from a labeled arrangement inducing w.
Equations
- Anderson4D.toFiberEquiv mult w σ hσ a = (σ.subtypeEquiv ⋯).trans (Anderson4D.sigmaFstFiber a)
Instances For
A labeled arrangement inducing the word w is the same data as a family of
bijections from the fibers of w to the multiplicity index sets.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fiber-count lemma. A word w with the fiber condition
#{j | w j = a} = mult a is induced by exactly ∏ a, (mult a)! labeled arrangements:
the (mult a)! relabelings within each letter fiber act freely and transitively.
Every induced word satisfies the fiber condition.
The words Fin M → α satisfying the fiber condition for mult: DESIGN §5.5's
admissible words with prescribed letter multiplicities (paper (5.15), (5.33)).
Equations
Instances For
Finset.filter form of the fiber-count lemma: the labeled arrangements inducing a
fixed valid word w number exactly ∏ a, (mult a)!.
Factorial ledger (ℕ-valued statistics). Summing any word statistic over all
labeled arrangements counts each admissible word exactly ∏ a, (mult a)! times. (This
is where the (s+1)!⁻¹ of (5.45)(i) comes from: it cancels the ledger factor, and is
not produced by the collapse itself.)
Factorial ledger, real-valued form: the version consumed by the analytic estimates (the statistics of §5.4 are real).
The definitional ledger #
paperSum is defined as ∏ a, (mult a)! times the raw word sum. Statements of
P-5.7, P-5.9, P-5.10 and R-decomp's (5.10) put paperSum on the left-hand side with
the paper's right-hand sides verbatim; internal proofs manipulate wordSum and convert
only at statement boundaries via paperSum_eq_sum_arrangements.
Sum of a real word statistic over the admissible words for mult.
Equations
- Anderson4D.wordSum mult F = ∑ w ∈ Anderson4D.validWords mult, F w
Instances For
The paper's labeled-arrangement sum, defined through the factorial ledger:
paperSum mult F = (∏ a, (mult a)!) * wordSum mult F.
Equations
- Anderson4D.paperSum mult F = (∏ a : α, ↑(mult a).factorial) * Anderson4D.wordSum mult F
Instances For
Statement-boundary conversion. The definitional paperSum equals the honest
sum over labeled arrangements; this is the only bridge the analytic layer needs.
Restricted word sums #
Sums over the admissible words satisfying a side condition P (e.g. the adjacency and
primitivity restrictions of (5.15)/(5.33)), with the monotonicity in P used by the
estimates.
Sum of a real word statistic over the admissible words satisfying P.
Equations
- Anderson4D.wordSumFiltered mult P F = ∑ w ∈ Anderson4D.validWords mult with P w, F w
Instances For
The paperSum analogue of wordSumFiltered: ledger factor times restricted sum.
Equations
- Anderson4D.paperSumFiltered mult P F = (∏ a : α, ↑(mult a).factorial) * Anderson4D.wordSumFiltered mult P F
Instances For
Dropping a side condition can only increase a sum of nonnegative statistics.
Dropping a side condition can only increase a paperSum of nonnegative statistics.
Word predicates (paper (5.15)/(5.33) side conditions) #
Primitivity of words is not defined here: in the paper it is relative to the tree structure and enters only with the collapse induction.