Blueprint

🔍 Explore view: explanations, figures, other mathematical languages and labs are shown, marked commentary; they are not part of the paper. Switch to Paper for the statements, proofs and evidence only.

Huddling, diatonic and pentatonic scales in Z12: Fourier maxima and convex-energy minima formalized in Lean 4

🏷️ Mathematical music theory · discrete Fourier analysis on ℤ₁₂

Carles Marín

At a glance

What the paper contributes

  • A connected Lean 4 formalization, with complete twelve-tone equality conditions, of why the seven white keys solve two optimization problems: they maximize $|\widehat A(5)|$ and minimize every strictly admissible convex pair energy (Theorem 3).
  • The route: Huddling in $\mathbb{Z}_{12}$ (Theorem 1), transported to frequency five by $M_5$; double Abel summation for the energy (Theorem 2); complementation carries both to the pentatonic sets (Theorem 4).
  • Exact arithmetic throughout: comparisons in $\mathbb{Z}[\sqrt3]$, no rounded trigonometric values. Two finite censuses use native_decide (trusted compiled evaluation), stated in the axiom audit.
  • The mathematics is classical; the paper claims the connected formalization, not a new characterization.

🚀 Start here: Theorem 1: consecutive arcs maximize the first Fourier magnitude, exactly on their transposition orbit.

Main results:

  • Theorem 3: Fourier maximum and energy minimum have the same equality class: the twelve diatonic transpositions
  • Theorem 4: the pentatonic sets inherit both extremal properties through complementation
4 results ✅ 3 entirely in Lean ◐ 1 partly in Lean 💻 2 checked by a program written proof only (a result can carry several tags)
🗺️ Map of the results (click a box to go to it)

Dependencies in the written proof: an arrow A → B means that this proof of B uses A. Every result rests on its written proof; the tags record what was checked besides, and each statement's “Evidence & scope” block says how far. The colour of a box is its strongest tag, in the order above; the tags in the box give the rest. Boxes with a thick border are the main results; click a box to read the statement.

cluster_0 What Huddling contributes cluster_1 Why the energy selects the same collection cluster_2 The two questions have one equality class cluster_3 What happens to the five notes left over? thm:huddling Theorem 1 consecutive arcs maximize the first Fourier magnitude, exactly on their transposition orbit ✅ Lean · 💻 program thm:connection Theorem 3 Fourier maximum and energy minimum have the same equality class: the twelve diatonic transpositions ✅ Lean · 💻 program thm:huddling->thm:connection thm:energy Theorem 2 the diatonic orbit minimizes every admissible convex pair energy, uniquely under strictness ◐ part in Lean thm:energy->thm:connection thm:pentatonic Theorem 4 the pentatonic sets inherit both extremal properties through complementation ✅ Lean thm:connection->thm:pentatonic
📐 Setting (copied from the paper, §2)

For an unweighted set \(A\subseteq \mathbb {Z}_{12}\), use the unnormalized DFT

\[ \widehat A(t)=\sum _{a\in A}e^{-2\pi i at/12},\qquad S_t(A)=|\widehat A(t)|^2. \]

Transposition \(T_sA=A+s\) changes phase and preserves \(S_t\). For a unit \(u\in \mathbb {Z}_{12}^\times \), put \(M_uA=\{ ua:a\in A\} \). Reindexing the finite sum gives \(\widehat{M_uA}(t)=\widehat A(ut)\). For \(C_7=\{ 0,1,2,3,4,5,6\} \) and \(D=\{ 0,2,4,5,7,9,11\} \), \(T_{11}M_5C_7=D\) and \(M_5D=T_7C_7\). (§4) Write \(d(a,b)=\min ((a-b)\bmod 12,(b-a)\bmod 12)\). For a real potential \(V:\{ 1,\ldots ,6\} \to \mathbb R\), the all-pairs energy is \(E_V(A)=\sum _{\{ a,b\} \subseteq A}V(d(a,b))=\sum _{j=1}^{6}i_j(A)V(j)\). We call \(V\) admissible when \(\Delta ^2V(j):=V(j)-2V(j+1)+V(j+2)\ge 0\) \((1\le j\le 4)\) and \(V(6)\le V(5)\). Strict admissibility means that all five displayed inequalities are strict.

Abstract.

The diatonic collection solves two optimization problems on the twelve pitch classes: it maximizes the magnitude of the fifth discrete Fourier coefficient and minimizes an all-pairs energy for every decreasing, discretely convex potential. We formalize the connection in Lean 4. The route begins with the twelve-tone Huddling theorem: at each cardinality, consecutive pitch classes maximize the first Fourier magnitude, with equality exactly on their transposition orbit. Multiplication by five transports this maximum to frequency five; at cardinality seven, the resulting orbit is precisely the diatonic orbit. An Abel summation identity supplies the energy side. Under strict convexity and decrease, the two equality classes coincide: for every seven-note set \(A\), \(|{\widehat A}(5)|=2+\sqrt3\) if and only if \(E_V(A)=E_V(D)\). The contribution is a connected formalization of classical mathematics in \({\mathbb {Z}_{12}}\), with exact algebraic comparisons, explicit equality conditions, and independently reproducible cyclotomic checks. Two finite certificates use trusted compiled evaluation (native_decide); the axiom audit makes these dependencies explicit. A symbolic complement-energy identity transfers the result to five-note pentatonic sets without another census. Homometry, tritone transposition, and the parity coefficient connect the argument to the earlier notes.

Keywords: Huddling lemma; diatonic scale; pentatonic scale; pitch-class sets; discrete Fourier transform; maximal evenness; convex energy; Lean 4.

1 Why do the same seven notes appear twice?

The seven white keys of the piano give the pitch-class collection \(D=\{ 0,2,4,5,7,9,11\} \), with \(C=0\). On the twelve-position pitch-class clock they are spread around the circle. Read in a different order, they form a consecutive chain of fifths. These two views lead to two precise extremal properties of the same collection.

P0. Why does this seven-note collection maximize a Fourier magnitude and also minimize a repulsive pair energy?

The historical routes to the question were different. Lewin’s 1959 note on intervallic relations  [ 1 ] supplied an early Fourier viewpoint. Clough and Douthett’s 1991 study  [ 2 ] developed maximal evenness as a property of scales. Amiot recalls a more specific meeting of these ideas: the John Clough Memorial Days in Chicago in July 2005, where Quinn’s dissertation helped revive Lewin’s Fourier approach to chord quality  [ 5 ] . The occasion is a useful reminder that a change of mathematical language can make connections in familiar musical material visible.

Douthett and Krantz connected maximally even configurations to interaction energies and one-dimensional spin models  [ 6 ] . Amiot developed the Fourier characterization  [ 3 ] . This note follows the connection between those viewpoints at one fixed scale. Its thread is the diatonic collection throughout: first seen as a rearranged chromatic cluster, then as a Fourier maximizer, and finally as an energy minimizer. The Lean statements make the change of coordinates and the equality class explicit.

2 The change of coordinates

For an unweighted set \(A\subseteq {\mathbb {Z}_{12}}\), use the unnormalized DFT

\begin{equation} \tag {1} {\widehat A}(t)=\sum _{a\in A}e^{-2\pi i at/12},\qquad S_t(A)=|{\widehat A}(t)|^2. \end{equation}
1

In Lean, \(A\) is a Finset (ZMod 12) and the transform is Mathlib’s ZMod.dft applied to its indicator. The complex-valued Fourier.powerSpec has real part \(S_t(A)\); the bridge to the squared norm is Huddling.powerSpec_re_eq_norm_sq. Transposition \(T_sA=A+s\) changes phase and preserves \(S_t\).

P1. Which coordinates turn a consecutive chromatic cluster into a diatonic collection?

For a unit \(u\in {\mathbb {Z}_{12}}^\times \), put \(M_uA=\{ ua:a\in A\} \). Reindexing the finite sum gives

\begin{equation} \tag {2} \widehat{M_uA}(t)={\widehat A}(ut). \end{equation}
2

This is MTransform.Ahat_mul. Multiplication by five is its own inverse modulo twelve, so it preserves cardinality and exchanges frequencies one and five. Five semitones is a fourth, the reverse direction around the circle of fifths; this orientation has no effect on the transposition class at issue here. For \(C_7=\{ 0,1,2,3,4,5,6\} \),

\[ T_{11}M_5C_7=D,\qquad M_5D=T_7C_7. \]

Both identities are checked on the same set definitions used in the theorems.

🖼️ Figure 1
The same seven positions in two coordinates. Filled nodes denote membership; the dashed path on the right follows repeated addition of five, from \(11\) to \(5\). The map permutes pitch classes and Fourier indices, carrying the first-frequency cluster problem to the fifth-frequency diatonic problem.

The same seven positions in two coordinates. Filled nodes denote membership; the dashed path on the right follows repeated addition of five, from \(11\) to \(5\). The map permutes pitch classes and Fourier indices, carrying the first-frequency cluster problem to the fifth-frequency diatonic problem.

3 What Huddling contributes

The roots-of-unity lemma recorded by Amiot  [ 5 , Lemma 2 ] says that consecutive roots maximize the magnitude of a sum of distinct roots. Here we certify its twelve-tone instance and the complete equality class.

For every \(A\subseteq {\mathbb {Z}_{12}}\), with \(k=|A|\) and \(C_k=\{ 0,\ldots ,k-1\} \),

\[ S_1(A)\le S_1(C_k),\qquad S_1(A)=S_1(C_k)\ \Longleftrightarrow \ A=T_sC_k\text{ for some }s\in {\mathbb {Z}_{12}}. \]

The same inequality and equality condition hold for Fourier magnitudes.

Lean · oursshow

added to the Lean repository after publication (23-oct-2026): the general statement for every cyclic group Z_N (Amiot’s Lemma 2, of which the paper certifies the twelve-tone instance): for every unit frequency the arc maximizes the Fourier magnitude, exactly on its translates, and the maximum is sin(πm/N)/sin(π/N); added to the Lean repository after publication (23-oct-2026): the general statement for every cyclic group Z_N (Amiot’s Lemma 2, of which the paper certifies the twelve-tone instance): for every unit frequency the arc maximizes the Fourier magnitude, exactly on its translates, and the maximum is sin(πm/N)/sin(π/N)

✅ Checked when this page was built: CyclicHuddlingClosedForm.lean, CyclicHuddlingGeometry.lean, Huddling.lean, MTransform.lean compiles with Lean 4.35.0, no errors, no sorry. Axioms — arc_maximizes_power, arc_unique, powerSpec_one_re_le_iff, norm_Ahat_unit_le_arc, norm_Ahat_unit_eq_arc_iff, norm_Ahat_unit_le_sine_ratio, norm_Ahat_unit_eq_sine_ratio_iff, norm_Ahat_arc_sine_ratio: propext, Classical.choice, Quot.sound.
Reproduce: Lean 4.35.0, Mathlib f0b4c8150aa0; in that Lean project, lake env lean CyclicHuddlingClosedForm.lean CyclicHuddlingGeometry.lean Huddling.lean MTransform.lean (SHA-256 of the compiled file: e53d6d27167c0ac7…; a source page on this site may show it with comments edited, under its own hash).

Trust base: 🔒 kernel only. Lean: 8 results, standard axioms only

Proof: in this note·Formalized: Lean 4, by the author (public formalizations repository)·Covers: the whole statement·Cite: Theorem 1, p. 2, doi:10.5281/zenodo.23123219

🆕 Classical and new: classical: the roots-of-unity lemma recorded by Amiot [Amiot2009, Lemma 2]; the paper certifies its twelve-tone instance with the complete equality class.

↳ Used in: Theorem 3

Proof ▼

Formalized in Lean (see the linked declarations).

💡 In plain words (commentary, not part of the paper)

Put the twelve pitch classes on a clock and give each note of \(A\) a unit arrow pointing at its hour; \(\widehat A(1)\) is the sum of the arrows and \(S_1(A)\) its squared length. Arrows pointing in nearly the same direction add up best, so among all sets with \(k\) notes the longest sum comes from \(k\) consecutive hours, a “huddled” arc, and only from the twelve rotations of that arc (one set when \(k=0\) or \(12\)). This is the twelve-tone instance of the roots-of-unity lemma recorded by Amiot; the paper does not claim it as new. What it adds is a proof without rounded cosines: it writes \(2S_1(A)=P(A)+Q(A)\sqrt3\) with integers \(P,Q\) counted from the intervals of \(A\), so every comparison is exact in \(\mathbb {Z}[\sqrt3]\), and it checks all \(2^{12}=4096\) sets.

🛡️ Evidence & scope
  • Program: all 4096 subsets, by integer pairs (P,Q) in ℤ[√3]. huddling_verify.py

  • Program: all 4096 subsets, Fourier sums in Q(ζ₁₂) with exact algebraic-real comparison (SageMath). sage/huddling_check.py

🧪 Lab: Figure 1 with your own set, unit and shift

Applies \(T_s M_u\) to a set \(A\subseteq \mathbb {Z}_{12}\): the two clocks, the Fourier magnitudes of both (\(M_u\) permutes the frequencies), and a torus on which every pitch class sits on the chromatic circle and on the circle of fifths at once: \(M_5\) swaps the two circles.

The formal proof reduces the comparison to an exact decidable order. If \(i_j(A)\) counts unordered pairs at circular distance \(j\), the autocorrelation/DFT bridge from Fourier.lean gives

\begin{equation} \tag {3} 2S_1(A)=P(A)+Q(A)\sqrt3, \end{equation}
3

where

\[ P(A)=2|A|+2i_2(A)-2i_4(A)-4i_6(A),\qquad Q(A)=2i_1(A)-2i_5(A). \]

The factor at the tritone matters: the interval-vector convention here counts each unordered tritone once. MTransform.psZ represents the right-hand side in \(\mathbb Z[\sqrt3]\); powerSpec_one_re_le_iff proves that its decidable comparison agrees with real Fourier power. No rounded trigonometric values enter the proof.

The finite certificate bounds all \(2^{12}=4096\) sets and identifies every equality witness. The converse equality implication uses transposition invariance symbolically. Table 1 makes the finite scope and exact constants visible. At cardinalities zero and twelve there is one maximizing set; at every intermediate cardinality there are twelve, precisely the twelve distinct rotations of a proper consecutive arc.

2ctA!7white

\(k\)

Sets checked

\(2S_1(C_k)\)

Maximizers

\(0,12\)

\(1\) each

\(0\)

\(1\) each

\(1,11\)

\(12\) each

\(2\)

\(12\) each

\(2,10\)

\(66\) each

\(4+2\sqrt3\)

\(12\) each

\(3,9\)

\(220\) each

\(8+4\sqrt3\)

\(12\) each

\(4,8\)

\(495\) each

\(12+6\sqrt3\)

\(12\) each

\(5,7\)

\(792\) each

\(14+8\sqrt3\)

\(12\) each

\(6\)

\(924\)

\(16+8\sqrt3\)

\(12\)

Table 1 The exact Huddling census. Complementary cardinalities share the nonzero-frequency maximum, in agreement with the complement identity of Fourier.lean.

Colour: blue shade = the number’s size within its column.

P2. What does the cluster maximum say about the seven white keys?

Apply Theorem 1 to \(M_5A\) and use Equation (2). For \(|A|=7\) the result is

\begin{equation} \tag {4} S_5(A)\le S_5(D)=7+4\sqrt3, \qquad |{\widehat A}(5)|\le 2+\sqrt3. \end{equation}
4

Equality holds exactly on \({\mathcal O_D}=\{ T_sD:s\in {\mathbb {Z}_{12}}\} \). The inversions of \(D\) already belong to this orbit, so the transposition and \(T/I\) descriptions name the same twelve sets. This is why the word diatonic is appropriate for this Fourier extremum: the characterization singles out the collection up to transposition, rather than selecting a tonic or one of its modal orderings.

4 Why the energy selects the same collection

P3. Can the equality class be recovered by measuring separation between every pair of notes?

Write \(d(a,b)=\min ((a-b)\bmod 12,(b-a)\bmod 12)\). For a real potential \(V:\{ 1,\ldots ,6\} \to \mathbb R\), the all-pairs energy is

\begin{equation} \tag {5} E_V(A)=\sum _{\{ a,b\} \subseteq A}V(d(a,b)) =\sum _{j=1}^{6}i_j(A)V(j). \end{equation}
5

We call \(V\) admissible when

\begin{equation} \tag {6} \Delta ^2V(j):=V(j)-2V(j+1)+V(j+2)\ge 0\quad (1\le j\le 4), \qquad V(6)\le V(5). \end{equation}
6

These hypotheses imply that \(V\) is nonincreasing: its first differences are nondecreasing, and the last is nonpositive. Strict admissibility means that all five displayed inequalities are strict. No particular formula or positivity assumption on \(V\) is required.

The proof reuses the symbolic engine in AllPairsEvenness.lean. For \(|A|=7\), set \(d_j=i_{j+1}(A)-i_{j+1}(D)\), \(0\le j\le 5\), and

\[ H_j=\sum _{\ell =0}^{j}(j+1-\ell )d_\ell . \]

Both sets have \(\binom 72=21\) pairs, so \(\sum _{j=0}^5d_j=0\). Double Abel summation then gives

\begin{equation} \tag {7} E_V(A)-E_V(D)=\sum _{j=0}^{3}H_j\Delta ^2V(j+1) +H_4\bigl(V(5)-V(6)\bigr). \end{equation}
7

This identity is proved algebraically for arbitrary real \(V\), independently of the census. The finite input is that \(H_0,\ldots ,H_4\ge 0\) for every seven-note set, and some \(H_j{\gt}0\) outside \({\mathcal O_D}\). On \({\mathcal O_D}\) the whole interval vector agrees with that of \(D\). Equation (7) therefore establishes a minimum for every admissible potential, and identifies its equality class under the strict hypotheses.

For every admissible \(V\) and every \(A\subseteq {\mathbb {Z}_{12}}\) with \(|A|=7\), \(E_V(D)\le E_V(A)\). If \(V\) is strictly admissible, then

\[ E_V(A)=E_V(D)\ \Longleftrightarrow \ A\in {\mathcal O_D}. \]
Lean · ours, in partshow

the Abel identity symbolically; the seven-note certificate H_j ≥ 0 by native_decide

✅ Checked when this page was built: AllPairsEvenness.lean, DiatonicExtremality.lean compiles with Lean 4.35.0, no errors, no sorry. Axioms — abel_bridge, diatonic_energy_unique: propext, Classical.choice, Quot.sound.
Reproduce: Lean 4.35.0, Mathlib f0b4c8150aa0; in that Lean project, lake env lean AllPairsEvenness.lean DiatonicExtremality.lean (SHA-256 of the compiled file: b6d144324b2b8efa…; a source page on this site may show it with comments edited, under its own hash).

Trust base: 🔒 kernel only — only part of the statement is formal (see the box). Lean: 2 results, standard axioms only

Proof: in this note·Formalized: Lean 4, by the author (public formalizations repository)·Covers: part: the Abel identity symbolically; the seven-note certificate H_j ≥ 0 by native_decide·Cite: Theorem 2, p. 4, doi:10.5281/zenodo.23123219

🆕 Classical and new: classical viewpoint (Douthett–Krantz [DK]); the contribution is the formalization with the complete equality class.

↳ Used in: Theorem 3

💡 In plain words (commentary, not part of the paper)

Let every pair of notes of \(A\) repel each other with a strength \(V(d)\) that depends only on their distance \(d\) around the clock, and add over the \(21\) pairs of a seven-note set: that is the energy \(E_V(A)\). If closer pairs repel more (\(V\) nonincreasing) and the repulsion falls off in a convex way, the diatonic collection \(D\) has the least energy of all seven-note sets; if the falling-off is strictly convex, only its twelve transpositions do. The proof subtracts the two energies and, by summing by parts twice, writes the difference as a sum of the second differences of \(V\) times numbers \(H_j\) that depend only on the intervals of \(A\) and \(D\); a census shows \(H_j\ge 0\) for all \(792\) seven-note sets. Strictness matters: with \(V\) constant every seven-note set has energy \(21\) (the paper’s own example).

Strictness is essential to the equality statement. For the constant potential \(V=1\), every seven-note set has energy \(21\), while only twelve maximize \(S_5\). The weak minimum theorem thus cannot be substituted for the strict uniqueness theorem in the connection below.

5 The two questions have one equality class

We can now return to P0. Huddling identifies a consecutive arc; \(M_5\) turns that arc into the diatonic orbit; the Abel engine independently selects that same orbit. The conjunction of the two characterizations gives the formal connection.

For every strictly admissible \(V\) and every seven-element \(A\subseteq {\mathbb {Z}_{12}}\),

\[ \boxed {\quad |{\widehat A}(5)|=2+\sqrt3\quad \Longleftrightarrow \quad E_V(A)=E_V(D).\quad } \]

Both sides hold precisely for the twelve transpositions of \(D\).

Lean · oursshow

✅ Checked when this page was built: DiatonicExtremality.lean, Huddling.lean compiles with Lean 4.35.0, no errors, no sorry. Axioms — spectral_energy_equivalence, diatonic_norm_unique, fifth_frequency_unique: propext, Classical.choice, Quot.sound.
Reproduce: Lean 4.35.0, Mathlib f0b4c8150aa0; in that Lean project, lake env lean DiatonicExtremality.lean Huddling.lean (SHA-256 of the compiled file: b39e90bd655cefdb…; a source page on this site may show it with comments edited, under its own hash).

Trust base: 🔒 kernel only. Lean: 3 results, standard axioms only

Proof: in this note·Formalized: Lean 4, by the author (public formalizations repository)·Covers: the whole statement·Cite: Theorem 3, p. 5, doi:10.5281/zenodo.23123219

🆕 Classical and new: the paper calls it a corollary of published equality-class characterizations, not a new characterization (§9).

↳ Used in: Theorem 4

Proof ▼

Equation (4) identifies the left-hand equality class with \({\mathcal O_D}\). Theorem 2 identifies the right-hand equality class with \({\mathcal O_D}\). This is DiatonicExtremality.spectral_energy_equivalence.

💡 In plain words (commentary, not part of the paper)

Two questions about seven-note sets, with one answer. Which sets are most aligned with the circle of fifths, that is, have the largest fifth Fourier magnitude \(|\widehat A(5)|\)? Multiplying every note by \(5\) turns the circle of fifths into the chromatic circle, so Theorem 1 answers: the sets that become a consecutive arc, which are the twelve transpositions of the diatonic collection, with \(|\widehat A(5)|=2+\sqrt3\). Which sets have the least strictly convex pair energy? Theorem 2 answers: the same twelve. So for seven-note sets the two properties are the same property. The paper presents this as the conjunction of known characterizations (a corollary), formalized as one Lean theorem.

🛡️ Evidence & scope
  • Program: all 792 seven-note sets at frequency five, two arithmetic routes. huddling_verify.py, sage/huddling_check.py

  • Program: the three language tabs of this theorem: the 12 maximizers of |Â(5)| are the 12 minimizers of E_V for four strictly convex nonincreasing V, and the transpositions of D; controls: V constant gives all 792, V concave not the twelve (a check of the blueprint, published with it). lab/comprueba_pestanas.py

🧪 Lab: Figure 2: every set, in Fourier and in energy, for your own potential

All \(k\)-note sets as points \((S_1, S_5, E_V)\) with \(V(j)=(7-j)^p\): the maximizers of \(S_5\) (orange) and how the minimum of the energy follows them only when \(V\) is strictly convex (\(p{\gt}1\)).

🔤 Read this theorem in another mathematical language
Read this theorem in:

Commentary, not part of the paper. Read a seven-note set as a binary signal of length \(12\). Its magnitude at frequency bin \(5\) is at most \(2+\sqrt3\), and only the twelve cyclic shifts of the diatonic signal reach it; those same shifts are the only seven-sample signals of least energy for every strictly convex, nonincreasing pair potential on the cyclic distance.

Commentary, not part of the paper. Seven identical particles sit on \(12\) sites of a ring and repel each other with a strength \(V(d)\) of their cyclic distance, strictly convex and nonincreasing. The configurations of least energy are exactly the twelve rotations of \(D=\{ 0,2,4,5,7,9,11\} \), and they are exactly the configurations that maximize the order parameter \(\bigl|\sum _{a}e^{-2\pi i\, 5a/12}\bigr|\), with maximum \(2+\sqrt3\).

Commentary, not part of the paper. Up to transposition, the white-key collection is the only seven-note collection that is at once the most strongly aligned with the circle of fifths (the largest fifth Fourier magnitude) and the most evenly spread under any strictly convex repulsion between its notes. Neither property selects a tonic or a mode: both see the collection, not its order.

For the concrete strictly admissible potential \(V_0(j)=(7-j)^2\), the diatonic interval vector is \((2,5,4,3,6,1)\) and its energy is \(313\). Figure 2 shows all seven-note sets in the two measurements. It illustrates the shared equality class; the theorem quantifies over every strict admissible \(V\), not just this plotted example.

🖼️ Figure 2
All \(792\) seven-note sets, grouped into \(34\) exact (Fourier power, energy) classes; marker area increases with multiplicity. The diamond represents the twelve diatonic transpositions, simultaneously at the largest \(S_5\) and the smallest \(E_{V_0}\). Coordinates are computed exactly before con…

All \(792\) seven-note sets, grouped into \(34\) exact (Fourier power, energy) classes; marker area increases with multiplicity. The diamond represents the twelve diatonic transpositions, simultaneously at the largest \(S_5\) and the smallest \(E_{V_0}\). Coordinates are computed exactly before conversion to plotting numbers. Coincidence of the optimizers does not assert an ordering correspondence for every pair of sets.

The previous note on the per-voice Fourier signature  [ 9 ] used \(a_5\) to measure diatonic character in duration-weighted distributions. The present theorem explains the extremal set interpretation of that name. Its domain is binary indicators at cardinality seven: arbitrary duration weights require their own constraints, and the empirical voice findings do not follow from this finite-set theorem.

6 What happens to the five notes left over?

P4. Do the black keys inherit both extremal properties of the white keys?

Let \(P=\{ 0,2,4,7,9\} \) be the anhemitonic pentatonic collection. The five black keys form \(D^c=T_6P\). Complementation is already part of the Fourier language of Note 2  [ 10 ] : for \(t\ne 0\), \(\widehat{A^c}(t)=-{\widehat A}(t)\), so the magnitudes agree. This identity and the complement closure of maximal evenness are classical  [ 4 ] . The energy side requires keeping track of the unordered tritone convention. Our symbolic proof first counts common tones under transposition:

\[ |A^c\cap T_tA^c|+2|A|=12+|A\cap T_tA|. \]

Consequently, \(i_j(A^c)-i_j(A)=12-2|A|\) for \(1\le j\le 5\), and \(i_6(A^c)-i_6(A)=6-|A|\). Multiplying by the potential gives

\begin{equation} \tag {8} E_V(A^c)-E_V(A)=(6-|A|)\left(2\sum _{j=1}^5V(j)+V(6)\right). \end{equation}
8

No convexity is needed for this identity. It is the \(C_{12}\) instance of the stronger distance-degree-regular graph theorem of Bushaw, Cody, and Leffler  [ 7 , Theorem 3.5 ] . The new formal bridge exposes why the correction depends only on cardinality. For a finite abelian group \(G\) and an even potential \(f(x)=f(-x)\), set \(E_f(A)=\frac12\sum _{a,b\in A}f(b-a)\). Translation makes every row sum equal to \(R_f=\sum _{x\in G}f(x)\), and hence

\begin{equation} \tag {9} E_f(A^c)-E_f(A)=\left(\frac{|G|}{2}-|A|\right)R_f. \end{equation}
9

Equal-size sets therefore retain their energy gap under complementation; in particular, complementation transports cardinality-constrained minimizers. For \(G={\mathbb {Z}_{12}}\), \(R_f=V(0)+2\sum _{j=1}^5V(j)+V(6)\). Our interval energy \(E_V\) omits the diagonal; setting \(V(0)=0\) identifies its complement difference with Equation (9). A six-note set has the same energy as its complement for every circular-distance potential. These are classical consequences of symmetry, now linked to the exact twelve-tone convention in Lean. For \(|A|=5\), comparison with \(D\) and \(D^c=T_6P\) yields the exact gap identity

\[ E_V(A)-E_V(P)=E_V(A^c)-E_V(D). \]

Thus the five-note problem is obtained from the seven-note problem by a bijection, with the energy difference preserved and the fifth Fourier coefficient negated.

For every five-element \(A\subseteq {\mathbb {Z}_{12}}\), \(|{\widehat A}(5)|\le 2+\sqrt3\). For every admissible \(V\), \(E_V(P)\le E_V(A)\). Under strict admissibility,

\[ |{\widehat A}(5)|=2+\sqrt3\quad \Longleftrightarrow \quad E_V(A)=E_V(P)\quad \Longleftrightarrow \quad A=T_sP\text{ for some }s. \]
Lean · oursshow

✅ Checked when this page was built: ExtremalityConnections.lean compiles with Lean 4.35.0, no errors, no sorry. Axioms — pentatonic_spectral_energy_equivalence, pentatonic_energy_gap, energy_compl: propext, Classical.choice, Quot.sound.
Reproduce: Lean 4.35.0, Mathlib f0b4c8150aa0; in that Lean project, lake env lean ExtremalityConnections.lean (SHA-256 of the compiled file: 1c529e4f4155bab6…; a source page on this site may show it with comments edited, under its own hash).

Trust base: 🔒 kernel only. Lean: 3 results, standard axioms only

Proof: in this note·Formalized: Lean 4, by the author (public formalizations repository)·Covers: the whole statement·Cite: Theorem 4, p. 6, doi:10.5281/zenodo.23123219

🆕 Classical and new: complement-energy transport is covered in greater generality by Bushaw, Cody and Leffler [BCL, Thms 2.16 and 3.5].

↳ Not used by another result of the paper.

Proof ▼

Formalized in Lean (see the linked declarations).

💡 In plain words (commentary, not part of the paper)

The five black keys are the complement of the seven white keys. Complementing a set only flips the sign of its Fourier coefficients away from frequency \(0\), so magnitudes are kept; and it changes the energy by an amount that depends only on how many notes the set has, \(E_V(A^c)-E_V(A)=(6-|A|)\bigl(2\sum _{j=1}^5V(j)+V(6)\bigr)\). So the five-note problem is the seven-note problem seen in a mirror: the pentatonic sets \(T_sP\) inherit both extremal properties, with no new census. The complement identity is a case of a theorem of Bushaw, Cody and Leffler for distance-degree-regular graphs, as the paper says.

The Lean proof uses the same two finite certificates as the diatonic result. The complement bridge itself is symbolic. This also closes the opening piano image: the white and black keys solve complementary problems, rather than providing unrelated examples of regularity.

7 What the earlier notes can now say

P5. Can a measurement that forgets phase still identify this scale?

Note 2 studies homometry: equality of autocorrelation, equivalently of Fourier power. Our bridge between its ordered interval counts and the unordered counts in Equation (5) proves

\[ A\text{ and }B\text{ homometric}\quad \Longrightarrow \quad E_V(A)=E_V(B) \quad \text{for every }V. \]

This is a consequence of the classical equivalent descriptions of homometry  [ 8 ] . Moreover, homometry survives complementation: the autocorrelation identity above changes every nonzero displacement count by the same cardinality-dependent constant. Thus homometric \(A,B\) also have homometric complements, whose pair energies agree for every potential. This joins the phase question to the complement bridge without an additional finite census. For general sets, pair energies cannot recover phase or distinguish a nontrivial homometric pair. At the diatonic extremum, however, spectral uniqueness implies

\[ A\text{ homometric to }D\quad \Longleftrightarrow \quad A\in {\mathcal O_D}. \]

The equality class is rigid enough that forgetting phase leaves only the expected transposition ambiguity. This corollary links the earlier phase question directly to extremality; it is not claimed as a new mathematical theorem.

The same coordinate map also links the tritone of Note 1  [ 11 ] to the parity channel of Note 4  [ 9 ] . Since \(5\cdot 6=6\pmod{12}\),

\[ \widehat{M_5A}(6)={\widehat A}(6),\qquad M_5(T_6A)=T_6(M_5A). \]

Thus \(M_5\) exchanges the chromatic and diatonic Fourier coordinates while preserving the sixth coefficient and commuting with the central tritone transposition. These identities do not assert that a diatonic set has the 6-30 stabilizer, or explain a duration-weighted corpus effect by themselves.

Finally, Note 3’s Tonnetz spectrum  [ 12 ] contains \(2\cos (\pi /12)\) as the fifth-frequency magnitude of a generating triad. Here the extremal seven-note scale has magnitude \(2+\sqrt3\). The common Fourier coordinate connects the measurements; their different cardinalities explain the different constants.

8 What is machine-checked

P6. Where are the links in this argument checked?

🖼️ Figure 3
The proof has two routes to the same equality class. The Fourier route uses Huddling and the index permutation; the energy route uses finite integer counts and a symbolic identity. The final theorem joins the routes rather than repeating two separate optimization claims.

The proof has two routes to the same equality class. The Fourier route uses Huddling and the index permutation; the energy route uses finite integer counts and a symbolic identity. The final theorem joins the routes rather than repeating two separate optimization claims.

2ctA!7white

Lean declaration

Role in the argument

MTransform.Ahat_mul

Unit multiplication permutes Fourier indices.

MTransform.powerSpec_one_re_le_iff

Exact \(\mathbb Z[\sqrt3]\) comparison equals real power comparison.

Huddling.arc_maximizes_power, arc_unique

All-cardinality Huddling inequality and equality class in \({\mathbb {Z}_{12}}\).

Huddling.fifth_frequency_unique

Transports the complete equality characterization through \(M_5\).

DiatonicExtremality.diatonic_norm_unique

The seven-note maximum is \(2+\sqrt3\), exactly on \({\mathcal O_D}\).

AllPairsEvenness.abel_bridge

Symbolic double summation by parts, for arbitrary real potentials.

DiatonicExtremality.diatonic_energy_unique

The same orbit is the strict-energy equality class.

DiatonicExtremality.
spectral_energy_equivalence

The joined Fourier–energy theorem.

Table 2 The statements behind the narrative. Unqualified names in the Huddling row belong to the same namespace.

The file ExtremalityConnections.lean adds the connections in Sections 6–7:

energy_eq_of_homometric, diatonic_homometric_iff;
m5_preserves_a6, m5_commutes_tritone;
energy_compl, pentatonic_energy_gap;
pentatonic_spectral_energy_equivalence.

The same file also proves homometric_compl and energy_compl_eq_of_homometric. The separate TranslationInvariantEnergy.lean proves the finite-group normal form energy_compl_card and energy_gap_compl; its PitchClassEnergy specialization checks the row-sum formula, the bridge to \(E_V\), and complementary hexachord energy equality.

The development pins Lean 4.30.0-rc2 and Mathlib commit 701fb6e9c3b9 (the full revision is in lakefile.lean). The two new finite censuses use native_decide on exact arithmetic. This adds trusted compiled-evaluation dependencies to the ordinary foundational axioms propext, Classical.choice, and Quot.sound; it is not kernel reduction of the entire census. The explicit #print axioms output accompanies the build. The symbolic Fourier transport and Abel identity use only the ordinary foundational axioms; the final extremality theorem also inherits the two census dependencies. The earlier AllPairsEvenness file contains its own native census theorems, but the new interface reuses its symbolic engine with the separately audited seven-note certificate. No sorry, admit, or handwritten mathematical axiom is used.

Independent checks use two arithmetic routes: integer pairs \((P,Q)\) in huddling_verify.py, and \(\mathbb Q(\zeta _{12})\) with exact algebraic-real comparisons in sage/huddling_check.py. The latter computes Fourier sums directly, independently of Equation (3). Both verify all \(4096\) sets and all \(792\) seven-note frequency-five cases. They support reproducibility; the Lean artifact specifies the theorem.

9 Novelty, scope, and what this note does not claim

Huddling, the Fourier index permutation, maximal evenness, and the energy viewpoint are classical  [ 3 , 5 , 2 , 6 ] . The contribution here is their connected formalization with the complete twelve-tone equality conditions, and the explicit theorem joining the spectral and energy optimizers. The conjunction of published equality-class characterizations is a corollary, not a new characterization. Complement-energy transport is likewise covered in greater generality by Bushaw, Cody, and Leffler  [ 7 , Theorems 2.16 and 3.5 ] ; the homometry and parity connections follow from classical identities. It extends the earlier Fourier and Abel machinery in this project.

The statement-level literature audit is recorded in literature_novelty_2026-10-03.json. It separates published theorems, their consequences, and the question of proof-assistant implementation. The targeted review establishes positive antecedents for the central mathematics; it does not claim an exhaustive survey of every manuscript.

A dated overlap audit searched the October 3, 2026 Mathlib source snapshot (\(8592\) Lean files) and the checked Prismriver snapshot (\(35\) Lean files), inspected their relevant Fourier and music modules, and ran indexed Huddling searches for Lean, Coq/Rocq, Isabelle, and Agda. No matching formalization was located in those sources. The audit records revisions, queries, and coverage in formalization_prior_art_2026-10-03.json; a negative indexed search cannot establish absence from every public or private codebase. Related Christoffel-word results do exist in another Lean project and require a separate overlap review.

All Huddling statements in this note use \({\mathbb {Z}_{12}}\); the joined energy statements fix cardinalities seven and five. We do not infer an arbitrary-universe formal theorem from this finite census, or identify the energy optimizer with the fifth-frequency optimizer at every other cardinality. The theorem concerns unweighted sets, not melodic order, tonics, acoustic consonance, or the historical origin of the diatonic scale.

Coda: where the question leads

The starting question has an exact answer: the seven white keys belong to one orbit selected by two different objective functions, and \(M_5\) connects the Fourier maximum to a consecutive cluster. The resulting formalization leaves a concrete next question.

Can the finite Huddling certificate be replaced by a structural Lean proof for arbitrary roots of unity, retaining the full equality condition?

The mathematical theorem already exists; the next task is to make its geometric argument reusable in a proof assistant. Once that is available, the same coordinate change can be studied for other cyclic universes. A further question is then precise rather than metaphorical: which Fourier frequency and cardinality select the same orbit as a given convex-energy problem? The present seven-of-twelve result supplies one checked instance and a shared interface on which to build.

Data and code availability

The source files Huddling.lean, DiatonicExtremality.lean, ExtremalityConnections.lean, MTransform.lean, Fourier.lean, and AllPairsEvenness.lean accompany this note, together with the exact verification and figure scripts, the dated overlap audit, and the pinned Lake configuration. The figure is reproducible from the code; no corpus measurements are introduced in this note.

📊 Tables

Every table of the paper, in its order: click one to unfold it, with where the paper cites it, how its numbers were checked, and its data as CSV. The typeset table is one click away, on its page of the PDF.

Table 1. The exact Huddling census. Complementary cardinalities share the nonzero-frequency maximum, in agreement with the complement identity of Fourier.lean.
$k$Sets checked$2S_1(C_k)$Maximizers
$0,12$$1$ each$0$$1$ each
$1,11$$12$ each$2$$12$ each
$2,10$$66$ each$4+2\sqrt3$$12$ each
$3,9$$220$ each$8+4\sqrt3$$12$ each
$4,8$$495$ each$12+6\sqrt3$$12$ each
$5,7$$792$ each$14+8\sqrt3$$12$ each
$6$$924$$16+8\sqrt3$$12$

Colour: blue shade = the number’s size within its column.

📄 p. 3 in the PDF⬇ CSVcited in §3 What Huddling contributes
Table 2. The statements behind the narrative. Unqualified names in the Huddling row belong to the same namespace.
Lean declarationRole in the argument
MTransform.Ahat_mulUnit multiplication permutes Fourier indices.
MTransform.powerSpec_one_re_le_iffExact $\mathbb Z[\sqrt3]$ comparison equals real power comparison.
Huddling.arc_maximizes_power, arc_uniqueAll-cardinality Huddling inequality and equality class in ${\mathbb{Z}_{12}}$.
Huddling.fifth_frequency_uniqueTransports the complete equality characterization through $M_5$.
DiatonicExtremality.diatonic_norm_uniqueThe seven-note maximum is $2+\sqrt3$, exactly on ${\mathcal O_D}$.
AllPairsEvenness.abel_bridgeSymbolic double summation by parts, for arbitrary real potentials.
DiatonicExtremality.diatonic_energy_uniqueThe same orbit is the strict-energy equality class.
DiatonicExtremality.spectral_energy_equivalenceThe joined Fourier–energy theorem.
📄 p. 8 in the PDF⬇ CSVnot cited in the text

References

1

D. Lewin, “Re: Intervallic relations between two collections of notes,” Journal of Music Theory 3(2) (1959), 298–301. doi:10.2307/842856.

2

J. Clough and J. Douthett, “Maximally even sets,” Journal of Music Theory 35(1/2) (1991), 93–173. doi:10.2307/843811.

3

E. Amiot, “David Lewin and maximally even sets,” Journal of Mathematics and Music 1(3) (2007), 157–172. doi:10.1080/17459730701654990.

4

E. Amiot, “Gammes bien réparties et transformée de Fourier discrète,” arXiv:math/0604210 (2006), Theorems 2, 6, and 7. https://arxiv.org/abs/math/0604210.

5

E. Amiot, “Discrete Fourier Transform and Bach’s Good Temperament,” Music Theory Online 15(2) (2009). https://mtosmt.org/issues/mto.09.15.2/mto.09.15.2.amiot.html.

6

J. Douthett and R. Krantz, “Maximally even sets and configurations: common threads in mathematics, physics, and music,” Journal of Combinatorial Optimization 14 (2007), 385–410. doi:10.1007/s10878-006-9041-5.

7

N. Bushaw, B. Cody, and C. Leffler, “Sets of vertices with extremal energy,” arXiv:2407.18785 (2024), version 3 (2025), Theorems 2.16 and 3.5. https://arxiv.org/abs/2407.18785.

8

E. Amiot and W. A. Sethares, “An algebra for periodic rhythms and scales,” author manuscript (2009), Section 4.2.2. https://sethares.engr.wisc.edu/paperspdf/AlgofScales.pdf.

9

C. Marín Muñoz, “The per-voice Fourier signature: the bass is the spectrally purest voice,” music-math series (2026). doi:10.5281/zenodo.20971090.

10

C. Marín, “The phase taxonomy of pitch-class set invariants,” music-math series, Note 2 (2026). doi:10.5281/zenodo.20826774.

11

C. Marín, “A tritone-centered self-duality: the set class 6-30 and its order-12 neo-Riemannian dual,” music-math series, Note 1 (2026). doi:10.5281/zenodo.20820962.

12

C. Marín, “The Tonnetz spectrum is the generating triad’s Fourier balance profile,” music-math series, Note 3 (2026). doi:10.5281/zenodo.20862822.

13

The Mathlib Community, Mathlib4, with the ZMod.dft development by D. Loeffler. https://github.com/leanprover-community/mathlib4.

14

L. Aniva and C. Wang, Prismriver: Formalization of Music Theory and Algorithmic Composition in Lean 4, arXiv:2606.19936 (2026). https://github.com/lenianiva/Prismriver.