Forest codes #
For ℓ ≥ 1, a forest code is an integer word with all entries at least -1, sum -ℓ, and all
proper prefix sums (the empty prefix included) strictly above -ℓ: the first passage to -ℓ
happens at the terminal time. Prepending the artificial-root increment ℓ - 1 turns such a word
into a tree excursion, so forest codes are exactly the increments of the ordered forests with ℓ
components, each forest being determined by its code. The weight of a forest, the product of the
weights of its components, is the walk weight of its code.
The rotation of a word of sum -ℓ is a forest code exactly when its starting index is a strict
running minimum of the prefix sums that later prefix sums do not undercut by ℓ or more. The
generalized cycle lemma follows: a word of length n, entries at least -1 and sum -ℓ has
exactly ℓ good rotation indices (indices are counted, not distinct rotated words, so periodic
words are covered). Counting the pairs of a bridge word and a good index in two ways gives
Kemperman's formula for forests in weight form,
n * forestWeight p ℓ n = ℓ * (total walk weight of the words of length n and sum -ℓ),
for arbitrary step masses p. Adapted from PoissonDeclumping/Bridge/Kemperman.lean
(card_filter_rotate_firstPassageAt, forestMap_bijective, natCast_mul_forestSizeWeight); the
forest coding goes through the artificial root and the tree excursion bijection instead of a second
parser, and the first-passage convolution is not part of this module.
The artificial root: a forest code with ℓ components is a tree excursion once the increment
ℓ - 1 of a root with ℓ children is prepended.
A forest is determined by its code.
Forest codes with ℓ ≥ 1 components are exactly the codes of the unique ordered forests
with ℓ components.
The weight of a forest is the walk weight of its code.
Discrete intermediate value property: if the steps are at least -1, v ≤ 0 and some prefix
sum is at most v, then v is attained at a first time, all earlier prefix sums being above v.
Adapted from PoissonDeclumping/Bridge/Kemperman.lean.
The rotation of a word of sum -ℓ by i < n is a forest code iff i is a strict running
minimum of the prefix sums that later prefix sums (before time n) do not undercut by ℓ.
Generalized cycle lemma. A word of length n, entries at least -1 and sum -ℓ with
ℓ ≥ 1 has exactly ℓ indices i < n whose left rotation is a forest code. Indices are counted,
not distinct rotated words, so periodic words are covered: [-1, -1] has two good indices.
Total weight of the ordered forests of ℓ trees with n vertices in total.
Equations
- BGW.forestWeight p ℓ n = ∑' (ts : BGW.PlaneForest), if List.length ts = ℓ ∧ ts.size = n then (List.map (BGW.PlaneTree.weight p) ts).prod else 0
Instances For
Kemperman's formula for forests, in weight form. For every p : ℕ → ℝ≥0∞, ℓ ≥ 1 and
n: n times the total weight of the ordered forests of ℓ trees with n vertices is ℓ times
the total walk weight of the words of length n, entries at least -1 and sum -ℓ.
Fewer vertices than components: no forest.