Counting expansions of a run-compressed word #
This module supplies the finite-fiber count needed in the deduction of
Proposition 5.7 from Proposition 5.9. Once the compressed word is fixed, an
original word is determined by the positive lengths of its constant runs.
Those lengths form an ordinary composition of the original word length, so
every compression fiber has cardinality at most 2 ^ M.
Run-length reconstruction #
Expand a list of run representatives using the corresponding list of
run lengths. Mismatched tails are ignored by zipWith; all applications
below carry an equality of the two list lengths.
Equations
- Anderson4D.expandRunLengths representatives lengths = (List.zipWith (fun (a : α) (n : ℕ) => List.replicate n a) representatives lengths).flatten
Instances For
A compressed nonempty list still starts with the original first letter.
Every list is obtained from its run-compressed list by a positive composition of its length.
Composition coordinates on finite words #
Finite-word form of the run-length reconstruction theorem.
A chosen positive run-length vector for a finite word. Its two specification lemmas below, rather than the choice itself, are the public interface.
Equations
Instances For
Among words with one fixed compressed representative list, the chosen run-length composition is injective.
Every fixed-compressed-list fiber in any finite family of length-M
words has cardinality at most 2 ^ M.
The prescribed multiplicity/compressed-word fiber #
Original valid words with prescribed compressed multiplicity and
prescribed compressed word list. Using List.ofFn v avoids any dependent
cast between the varying compressed lengths.
Equations
- Anderson4D.mergeExpansionFiber ml sl v = {w ∈ Anderson4D.validWords ml | Anderson4D.mergedMultiplicity w = sl ∧ Anderson4D.mergedWordList w = List.ofFn v}
Instances For
The exact fiber requested in the run-compression regrouping costs at
most 2 ^ M. The bound is stronger than needed: validity, the value of
sl, and the no-adjacent condition on v play no role in the count.
Generic nonnegative weighted regrouping #
The nondependent key carried by a run-compressed word.
Instances For
The finite set of compression outcomes realized by a finite word family.
Equations
Instances For
A fiber of the full compression outcome is no larger than the fiber obtained by retaining only its compressed representative list.
Exact finite regrouping of a statistic that depends only on the compression outcome.
Generic weighted run-compression bound. A nonnegative statistic on
compressed outcomes loses at most 2 ^ M when pulled back and summed over
any finite family of original words.
Primitivity transport #
Run expansion distributes over an aligned concatenation.
A letter predicate holding on all run representatives holds throughout their expansion.
Positive aligned run lengths make the expansion of a nonempty representative list nonempty.
Split a length list along an aligned three-part decomposition of its representative list.
Finite-word specialization of
letterPositions_eq_Icc_of_decompose, avoiding dependent casts through
(List.ofFn w).length.
Inserting positive repetitions inside constant runs preserves the paper's no-proper-leaf-block condition. Thus run compression transports primitivity to the compressed word.