The cycle lemma (Raney / Dvoretzky–Motzkin), sum = 1 case — PROVED #
Sorry-free, kernel-axiom-clean (propext, Classical.choice, Quot.sound).
Raney's lemma: any integers summing to 1 have exactly one cyclic shift with all partial
sums positive. We formalize it on a period-n sequence a : ℕ → ℤ with period-sum 1, via the
partial sums Q k = ∑_{j<k} a j (so Q (k+n) = Q k + 1). A shift i is good iff
Q i < Q t for all t ∈ (i, i+n); the unique good i ∈ [0,n) is the last argmin of Q
over [0,n). The count #level-canonical = C(N,d-1)/d will follow (a_k = 1 - (level counts)).
Shift i is good: every partial sum of the shifted sequence is positive, i.e.
Q i is a strict minimum of Q over the half-open window (i, i+n).
Equations
- CriticalPortraits.Cycle.Good n a i = ∀ (t : ℕ), i < t → t < i + n → CriticalPortraits.Cycle.Q a i < CriticalPortraits.Cycle.Q a t
Instances For
The cycle lemma (Raney), sum = 1. For a period-n integer sequence with period-sum 1,
exactly one shift i ∈ [0,n) is good. The witness is the last argmin of Q over [0,n).