Occurrence and transition counts of a finite word #
A word w : Fin N → α over an arbitrary alphabet α has two elementary statistics: the
occurrence count occCount w a, the number of positions carrying the letter a, and — for a
word of length n + 1 — the transition count transitionCount w a b, the number of positions
at which the letter a is immediately followed by the letter b.
The main result is that a word of positive length is determined up to rearrangement by its first letter together with its transition counts:
exists_perm_comp_of_transitionCount_eq.
The mechanism is a conservation law. Summing transitionCount w a · recovers the number of
positions other than the last carrying a, and summing transitionCount w · a recovers the number
of positions other than the first carrying a; comparing the two expressions for occCount w a
pins the last letter once the first letter is known, and then pins every occurrence count. Equal
occurrence counts glue the fibrewise bijections into a permutation of the positions.
This is the combinatorial heart of Markov exchangeability (Diaconis–Freedman), where the
transition counts of a path are the sufficient statistic: see
TauCeti/Probability/Exchangeability/MarkovExchangeable.lean.
Main definitions #
TauCeti.transitionCount: the number of positions of a word at which a given ordered pair of letters occurs consecutively.
Main results #
TauCeti.occCount_eq_of_transitionCount_eq: equal first letters and equal transition counts force equal occurrence counts.TauCeti.exists_perm_comp_of_transitionCount_eq: two such words are rearrangements of each other.TauCeti.consecutivePairs_append_cons: splitting a word at a letter splits its consecutive pairs.TauCeti.transitionCount_getD: the transition counts of a list, read as aFin-indexed word, count its consecutive pairs.TauCeti.prod_consecutivePairs_getD: a product of transition weights along a list, read as aFin-indexed word, is the product over its consecutive pairs.TauCeti.prod_transitionCount: a product of transition weights along a word depends on the word only through its transition counts.TauCeti.prod_eq_of_transitionCount_eq: the resulting comparison of two words with equal transition counts.
References #
- P. Diaconis and D. Freedman, "de Finetti's theorem for Markov chains", Annals of Probability 8 (1980), 115–130.
The number of positions i of the word w at which the letter a is immediately followed by
the letter b.
Equations
Instances For
Splitting off the last transition: the transitions in a word are those in its initial segment together with a possible transition at the final position.
Splitting off the first transition: the transitions in a word are those in its final segment together with a possible transition at the first position.
Words presented as lists #
A word can equally be presented as a list, read through List.getD; its transitions are then the
occurrences among the list List.consecutivePairs of consecutive pairs supplied by Mathlib.
Splitting a word at a letter y splits its consecutive pairs: those of the part up to and
including y, followed by those of the part from y on.
Transition counts count consecutive pairs. Reading a list of length n + 1 as a word
indexed by Fin (n + 1), its transition count from a to b is the number of occurrences of
(a, b) among its consecutive pairs.
A product of transition weights along a word is a product over its consecutive pairs.
Reading a list of length n + 1 as a word indexed by Fin (n + 1), the product of a weight over
the n transitions of the word is the product of that weight over the list of its consecutive
pairs. This is the multiplicative counterpart of transitionCount_getD.
Summing the transitions out of a counts the positions carrying a other than the last one.
The index set S only has to contain the successors of transitions in w.
Summing the transitions into a counts the positions carrying a other than the first one.
The index set S only has to contain the predecessors of transitions in w.
The transition counts and the first letter determine the occurrence counts.
Words with the same first letter and the same transition counts are rearrangements of each other. This is the elementary fact underlying Markov exchangeability: the transition counts of a path, together with its starting point, are a sufficient statistic finer than the occurrence counts, so any symmetry expressed through them is implied by exchangeability.
A product of transition weights along a word is a function of its transition counts. The
index set S only has to contain both endpoints of every transition in w.
Words with the same transition counts have the same product of transition weights. This is
prod_transitionCount with the index set eliminated: the two words are compared through the common
Finset of letters they use.