Loops at a base point and their excursions #
A finite word that starts at a letter a₀ and returns to it splits at its visits to a₀ into
excursions: the (possibly empty) stretches of letters strictly between consecutive visits.
Conversely a list bs : List (List α) of excursions spells out a word
a₀, bs[0], a₀, bs[1], a₀, …, bs[k-1], a₀
which this file calls TauCeti.loopPath a₀ bs.
The theorem of this file is that the transition counts of a loop are the sum of the transition
counts of its individual excursion loops (TauCeti.transitionCount_loopPathAt), so they do not
see the order in which the excursions are traversed
(TauCeti.transitionCount_loopPathAt_eq_of_perm). Together with the first-letter equality
TauCeti.loopPathAt_zero this is exactly the input of Diaconis and Freedman's Markov
exchangeability, where the first letter and the transition counts of a finite path are its
sufficient statistic: see TauCeti/Probability/Exchangeability/Excursion.lean.
The mechanism is a bookkeeping identity for the list List.consecutivePairs l of consecutive
pairs of a word. Concatenating two words at a shared letter y splits that list as the pairs of
the first word closed off with y, followed by the pairs of the second word
(TauCeti.consecutivePairs_append_cons); every excursion of a loop is closed off with a₀, so
iterating the split writes the pairs of loopPath a₀ bs as a List.flatMap over bs, which a
permutation of bs rearranges.
Words are lists here, while TauCeti.transitionCount counts transitions of a
Fin (n + 1)-indexed word; the bridge is TauCeti.transitionCount_getD, which reads a list of
length n + 1 as such a word through List.getD. Both of those list lemmas live in
TauCeti/Combinatorics/Enumerative/TransitionCount.lean.
Main definitions #
TauCeti.loopPath: the word spelled out by a base letter and a list of excursions.TauCeti.loopSteps: its number of transitions.TauCeti.loopPathAt:loopPathread as a function onℕ, padded with the base letter.
Main results #
TauCeti.transitionCount_loopPathAt: the transition counts of a loop are the sum of those of its excursion loops.TauCeti.transitionCount_loopPathAt_eq_of_perm: reordering the excursions leaves them unchanged.TauCeti.exists_loopPath: every word that starts and ends ata₀is a loop path, with excursions that avoida₀.TauCeti.loopPath_injOn: those excursions are unique.TauCeti.loopPathAt_cons_add: past its first excursion a loop is the loop of the remaining ones.TauCeti.loopPathAt_append_of_le: over the span of its first excursions a loop is their loop.TauCeti.infinite_setOf_loopPathAt_eq: read as a function onℕ, a loop returns to its base letter infinitely often.TauCeti.map_range_loopPathAt: reading that function over the loop's span spells the loop word out again.
References #
- P. Diaconis and D. Freedman, "de Finetti's theorem for Markov chains", Annals of Probability 8 (1980), 115–130.
Loops and their excursions #
The word spelled out by a base letter a₀ and a list of excursions: a₀, the first
excursion, a₀ again, the second excursion, and so on, ending with a final a₀.
Equations
- TauCeti.loopPath a₀ [] = [a₀]
- TauCeti.loopPath a₀ (e :: bs) = a₀ :: (e ++ TauCeti.loopPath a₀ bs)
Instances For
Concatenating two lists of excursions splices their loops at the shared base letter: the final letter of the first loop is the initial letter of the second.
The number of transitions of a loop with the given excursions: each excursion contributes its own length, plus the one step that returns to the base letter.
Instances For
A loop, read as a function on ℕ: past its last letter it is padded with the base letter.
Equations
- TauCeti.loopPathAt a₀ bs i = (TauCeti.loopPath a₀ bs).getD i a₀
Instances For
A loop sits at its base letter from its final letter onwards: loopPathAt pads with the base
letter past the end of the word.
A loop extends its own initial stretches. Over the span of bs, the loop of bs ++ cs
spells out the loop of bs: the two words share the prefix loopPath a₀ bs, and at the very end
of that span both sit at the base letter, where the loop of cs starts.
A loop returns to its base letter infinitely often, since loopPathAt pads with that
letter. This is what lets the excursion decomposition of a loop be read with no side condition.
A loop read as a function on ℕ recovers the loop word. Reading loopPathAt over the
whole span of the loop spells out loopPath again.
The excursions of a loop are determined by the loop. Two lists of excursions that avoid
the base letter and spell out the same word are equal, so together with
TauCeti.exists_loopPath this makes TauCeti.loopPath a bijection between such lists and the
words that start and end at the base letter.
The consecutive pairs of a loop, gathered excursion by excursion.
The transition counts of a loop are the sum of those of its excursions. Each excursion is counted as the loop it forms on its own, from the base letter back to it.
Reordering the excursions of a loop leaves its transition counts unchanged.
Every loop decomposes into excursions #
A word that starts and ends at a₀ is the loop of its excursions. The excursions are the
stretches strictly between consecutive visits to a₀, so none of them visits a₀.
A word that ends where it starts is the loop of its excursions. The Fin-indexed form of
TauCeti.exists_loopPath.