The step-gap energy and balanced gap configurations #
A gap configuration of k parts of n is g : Fin k → ℕ with 1 ≤ g i and ∑ g i = n; it is
balanced when its maximum and minimum differ by at most one. For a strictly convex potential V
on [0, ∞), the gap energy ∑ V (g i) is minimized exactly by the balanced configurations.
This energy depends only on the multiset of gaps, so being balanced is necessary but not
sufficient for maximal evenness; the all-pairs energy of AllPairsEvenness singles out the
maximally even sets.
Main results #
swap_lt,exists_improve: an unbalanced configuration can be improved.balanced_energy_eq: balanced configurations have equal energy.isMinimizer_iff_balanced: global minimizer iff balanced.diatonic_balanced: the diatonic gap word(2, 2, 1, 2, 2, 2, 1)is balanced.
References #
- P. Bak, R. Bruinsma, One-dimensional Ising model and the complete devil's staircase, Phys. Rev. Lett. 49 (1982).
- J. Clough, J. Douthett, Maximally even sets, J. Music Theory 35 (1991).
- J. Douthett, R. Krantz, Maximally even sets and configurations: common threads in mathematics, physics, and music, J. Comb. Optim. 14 (2007).
- C. Marín, One transform and one duality: a machine-checked core of music theory in Lean 4, Zenodo (2026), doi:10.5281/zenodo.20953767.
Definitions #
Part 1 — the swap lemma (strict convexity) #
Swap lemma. For V strictly convex on s and endpoints a, b ∈ s with b + 2 ≤ a, pulling the
two gaps one step together strictly lowers the pair energy: V (a-1) + V (b+1) < V a + V b.
Proof: write a-1 and b+1 as strict convex combinations of the endpoints a, b, apply binary
strict Jensen to each, and add — the endpoint coefficients each total 1.
Part 2 — minimality (the payoff) #
A two-index split of a Finset.univ sum: pull out the values at two distinct indices i, j.
Improvement step. If a valid configuration is not Balanced, one swap of an unbalanced pair gives another valid configuration with the same sum and strictly smaller energy.
ME characterization. Any configuration that minimizes the (strictly convex) energy over all valid
configurations of the same sum is Balanced — i.e. maximally even.
Part 3 — the converse: every Balanced config is a global energy minimizer #
Closed form of the energy of ANY balanced valid config: it depends only on (k, n, V).
Writing m = ⌊n/k⌋ and r = n % k, exactly r gaps equal m+1 and k − r equal m, so
energy V g = r · V(m+1) + (k−r) · V(m). (Counting identity; no convexity needed.)
Balanced configs all have the same energy. Any two balanced valid configs of the same (k, n)
have equal energy for any V (they are permutations of each other).
Termination measure for the swap descent: Φ g = ∑ (g i)², a strictly-decreasing ℕ-valued
well-founded measure under any balancing swap (independent of V).
Equations
- MusicTheory.MaximalEvenness.phi g = ∑ i : Fin k, g i ^ 2
Instances For
Improvement step with the Φ measure. Same single swap as exists_improve, additionally
certifying that the termination measure Φ strictly drops (Δ = 2(b−a)+2 ≤ −2).
The converse (target). For strictly convex V, any Balanced valid config is a GLOBAL energy
minimizer over all valid configs of the same sum. Proof: well-founded descent on Φ = ∑ (g i)² —
a non-balanced config strictly improves (lower energy AND lower Φ) via exists_improve_phi, and a
balanced config matches g's energy via balanced_energy_eq.
Ground-state characterization of maximal evenness (full iff). For strictly convex V, a valid
config g is a global energy minimizer over all valid configs of the same sum iff it is
Balanced (maximally even). Combines minimizer_balanced (⇒) and balanced_isMinimizer (⇐).
Part 4 — concrete music instance: the diatonic scale #
Every diatonic gap is positive.
The diatonic gaps sum to the octave, n = 12.
The diatonic scale is maximally even: its gap word (2,2,1,2,2,2,1) is Balanced
(max − min = 2 − 1 = 1).
Strict convexity of x ↦ x² on [0,∞) (the canonical repulsive potential).
Concrete corollary. For the quadratic energy E g = ∑ (g i)², any minimizer over valid configs
of a fixed sum is Balanced (maximally even). Specializing the convex minimizer_balanced.
The diatonic gap word is a global minimizer of ∑ gaps². Concrete instance of the converse:
the diatonic (2,2,1,2,2,2,1) minimizes the quadratic energy over every valid 7-gap config
summing to 12 — the full ground-state statement of its maximal evenness.
Full iff at the diatonic. Specializing the ground-state characterization to V = x², 7-of-12.