Documentation

Formalizations.MusicTheory.Fourier

The discrete Fourier transform of a pitch-class set #

A pitch-class set A βŠ† β„€/12 is represented by its 0/1 indicator ind A : ZMod 12 β†’ β„‚, and its Fourier transform is Mathlib's ZMod.dft of the indicator: Ahat A = 𝓕 (ind A), so Ahat A t = βˆ‘ a ∈ A, exp (-2Ο€i a t / 12). This file proves the classical invariants of pitch-class set theory in terms of Ahat, ordered by how much of the phase of Ahat they use.

Main results #

References #

noncomputable def MusicTheory.Fourier.ind (A : Finset (ZMod 12)) :
ZMod 12 β†’ β„‚

The 0/1 indicator of a pc-set, as a complex-valued function on ZMod 12.

Equations
Instances For
    noncomputable def MusicTheory.Fourier.Ahat (A : Finset (ZMod 12)) :
    ZMod 12 β†’ β„‚

    The DFT of a pc-set: Γ‚ A t = Ξ£_{a ∈ A} exp(βˆ’2Ο€iΒ·aΒ·t/12).

    Equations
    Instances For
      theorem MusicTheory.Fourier.Ahat_apply (A : Finset (ZMod 12)) (t : ZMod 12) :
      Ahat A t = βˆ‘ a ∈ A, ZMod.stdAddChar (-(a * t))

      Γ‚ A t is the sum of stdAddChar(βˆ’(aΒ·t)) over a ∈ A (indicator collapses the sum to A).

      theorem MusicTheory.Fourier.Ahat_zero (A : Finset (ZMod 12)) :
      Ahat A 0 = ↑A.card

      Step 1. The DC coefficient is the cardinality: Γ‚ A 0 = |A|.

      def MusicTheory.Fourier.tpose (k : ZMod 12) (A : Finset (ZMod 12)) :

      Transposition Tβ‚– : a ↦ a + k, as a Finset embedding (matches IntervalVector.tpose).

      Equations
      Instances For
        theorem MusicTheory.Fourier.Ahat_tpose (k : ZMod 12) (A : Finset (ZMod 12)) (t : ZMod 12) :
        Ahat (tpose k A) t = ZMod.stdAddChar (-(k * t)) * Ahat A t

        Step 2 (transposition). Γ‚ (Tβ‚– A) t = exp(βˆ’2Ο€iΒ·kΒ·t/12) Β· Γ‚ A t.

        theorem MusicTheory.Fourier.dft_one_apply_ne {t : ZMod 12} (ht : t β‰  0) :
        βˆ‘ j : ZMod 12, ZMod.stdAddChar (-(j * t)) = 0

        The DFT of the all-ones indicator vanishes off 0: 𝓕 (fun _ => 1) t = 0 for t β‰  0.

        theorem MusicTheory.Fourier.Ahat_compl {t : ZMod 12} (ht : t β‰  0) (A : Finset (ZMod 12)) :

        Step 2 (complement) β€” the B.2 engine. Γ‚ Aᢜ t = βˆ’Γ‚ A t for t β‰  0.

        The circle character is unitary: conj (stdAddChar x) = stdAddChar (βˆ’x).

        The (ordered) autocorrelation of a pc-set: the number of ordered pairs (a,b) ∈ AΓ—A whose difference a βˆ’ b equals d. This is IVraw graded by raw difference, not by ivc.

        Equations
        Instances For
          noncomputable def MusicTheory.Fourier.powerSpec (A : Finset (ZMod 12)) :
          ZMod 12 β†’ β„‚

          The power spectrum |Γ‚ A|Β² = Γ‚ A Β· conj (Γ‚ A), as a function ZMod 12 β†’ β„‚.

          Equations
          Instances For
            theorem MusicTheory.Fourier.powerSpec_apply (A : Finset (ZMod 12)) (t : ZMod 12) :
            powerSpec A t = βˆ‘ a ∈ A, βˆ‘ b ∈ A, ZMod.stdAddChar (-(a * t)) * ZMod.stdAddChar (b * t)

            The power spectrum expanded as a double sum over A Γ— A.

            theorem MusicTheory.Fourier.autocorr_eq_invDFT (A : Finset (ZMod 12)) (d : ZMod 12) :
            ↑(autocorr A d) = ZMod.dft.symm (powerSpec A) d

            Step 3 β€” THE BRIDGE. The ordered interval-difference count is the inverse DFT of the power spectrum (Wiener–Khinchin / autocorrelation theorem), as complex numbers: #{(a,b)∈AΓ—A : aβˆ’b=d} = 𝓕⁻(|Γ‚ A|Β²) d.

            The keystone: interval vector = inverse DFT of the power spectrum. #

            ivc/IVraw are the same definitions as in IntervalVector.

            Interval class of a difference (= IntervalVector.ivc).

            Equations
            Instances For

              Raw (ordered) interval vector (= IntervalVector.IVraw).

              Equations
              Instances For
                theorem MusicTheory.Fourier.IVraw_eq_sum_autocorr (A : Finset (ZMod 12)) (k : β„•) :
                IVraw A k = βˆ‘ d : ZMod 12 with ivc d = k, autocorr A d

                IVraw regraded: summing the autocorrelation over all differences of a fixed interval class recovers the raw interval vector.

                theorem MusicTheory.Fourier.IVraw_eq_invDFT_power (A : Finset (ZMod 12)) (k : β„•) :
                ↑(IVraw A k) = βˆ‘ d : ZMod 12 with ivc d = k, ZMod.dft.symm (powerSpec A) d

                Keystone (B.1 ↔ D.1). The raw interval vector is the inverse DFT of the power spectrum, summed over each interval class: IVraw A k = Ξ£_{ivc d = k} 𝓕⁻(|Γ‚ A|Β²) d.

                O.1 β€” The common-tone theorem under transposition (rides on autocorr). #

                commonTones A k = number of pitch classes held fixed when A is transposed by k, i.e. #(A ∩ Tβ‚– A). Lewin's ordered interval function makes this the autocorrelation: commonTones A k = #{(a,b)∈AΓ—A : aβˆ’b=k} = autocorr A k, hence = 𝓕⁻(|Γ‚ A|Β²) k (via Step 3). The relation to the interval vector carries the tritone doubling: the ivc-fibre is a doubleton {k,βˆ’k} for 1≀k≀5 (β‡’ IVraw A k = 2Β·commonTones A k) but a singleton {6} at the tritone (β‡’ IVraw A 6 = commonTones A 6 β€” the T₆ fixed point, same central element as the 6-30 finding).

                The pitch classes of A held fixed under transposition by k: #(A ∩ Tβ‚– A).

                Equations
                Instances For
                  theorem MusicTheory.Fourier.mem_tpose (k : ZMod 12) (A : Finset (ZMod 12)) (x : ZMod 12) :
                  x ∈ tpose k A ↔ x - k ∈ A

                  x survives a transposition by k iff its preimage x βˆ’ k is also in A.

                  theorem MusicTheory.Fourier.commonTones_eq_card_filter (A : Finset (ZMod 12)) (k : ZMod 12) :
                  commonTones A k = {x ∈ A | x - k ∈ A}.card

                  Common tones as a filtered cardinality: {x ∈ A : x βˆ’ k ∈ A}.

                  theorem MusicTheory.Fourier.autocorr_eq_card_filter (A : Finset (ZMod 12)) (k : ZMod 12) :
                  autocorr A k = {a ∈ A | a - k ∈ A}.card

                  The autocorrelation collapses one index: autocorr A k = #{a ∈ A : a βˆ’ k ∈ A}.

                  O.1 master identity. Held tones under Tβ‚– = the ordered autocorrelation at k.

                  O.1, Fourier form. Held tones under Tβ‚– are the inverse DFT of the power spectrum: #(A ∩ Tβ‚– A) = 𝓕⁻(|Γ‚ A|Β²) k.

                  At k = 0 everything is held: commonTones A 0 = |A|.

                  theorem MusicTheory.Fourier.autocorr_neg (A : Finset (ZMod 12)) (k : ZMod 12) :
                  autocorr A (-k) = autocorr A k

                  Autocorrelation is even in the difference: autocorr A (βˆ’k) = autocorr A k (swap the two indices). This is what forces the ivc-fibre to fold {k,βˆ’k}.

                  theorem MusicTheory.Fourier.ivc_fibre_lt (k : β„•) (h1 : 1 ≀ k) (h5 : k ≀ 5) :
                  {d : ZMod 12 | ivc d = k} = {↑k, -↑k}

                  The ivc-fibre over a class 1 ≀ k ≀ 5 is the doubleton {k, βˆ’k}.

                  The ivc-fibre over the tritone class 6 is the singleton {6} (the T₆ fixed point).

                  theorem MusicTheory.Fourier.IVraw_eq_two_commonTones (A : Finset (ZMod 12)) (k : β„•) (h1 : 1 ≀ k) (h5 : k ≀ 5) :
                  IVraw A k = 2 * commonTones A ↑k

                  O.1 interval-vector bridge, generic class. For 1 ≀ k ≀ 5 the raw interval vector is twice the common-tone count: IVraw A k = 2 Β· commonTones A k (each unordered interval counted both ways). Equivalently commonTones A k = ICV[k] for the textbook ICV = IVraw/2.

                  O.1 tritone anomaly. At k = 6 the fibre is a singleton, so there is NO factor 2: IVraw A 6 = commonTones A 6. Since textbook ICV[6] = IVraw A 6 / 2, this is the famous commonTones A 6 = 2 Β· ICV[6] doubling β€” T₆ fixes a note onto itself.

                  The interval vector is the power spectrum folded over conjugate pairs. #

                  The object {k,βˆ’k} that indexes the interval-vector fibres here (ivc_fibre_lt) is the SAME object that indexes the dihedral blocks of the T/I action in the DFT basis β€” InversionDFT.conjPair k (= InversionDFT.block k's spanning frequencies). This block welds the invariant-theory side (this file, Note #2) to the representation-theory side (InversionDFT.lean, Note #3): both are functions on, or folds over, the inversion quotient ℀₁₂/(kβˆΌβˆ’k). The fresh content is powerSpec_neg β€” that the power spectrum is constant on each conjugate pair, hence descends to that quotient β€” which is exactly why homometry (homometric_iff_powerSpec_eq) is equality of a function on the conjugate pairs. The literal cross-file identity ivc_fibre_lt k = InversionDFT.conjPair k is left to the de-dup cleanup.

                  theorem MusicTheory.Fourier.Ahat_neg (A : Finset (ZMod 12)) (t : ZMod 12) :
                  Ahat A (-t) = (starRingEnd β„‚) (Ahat A t)

                  The DFT of a real pc-set is Hermitian: Γ‚(βˆ’t) = conj(Γ‚(t)). Each term stdAddChar(-(aΒ·(βˆ’t))) is the conjugate of stdAddChar(-(aΒ·t)) (conj_stdAddChar).

                  theorem MusicTheory.Fourier.powerSpec_neg (A : Finset (ZMod 12)) (t : ZMod 12) :

                  The power spectrum is constant on conjugate pairs: |Γ‚|Β²(βˆ’t) = |Γ‚|Β²(t). Since Γ‚ is Hermitian (Ahat_neg), powerSpec descends to the inversion quotient ℀₁₂/(tβˆΌβˆ’t) β€” the conjugate pairs {t,βˆ’t} that also index the dihedral blocks (InversionDFT.conjPair). The "lives on the quotient" fact behind both the interval vector and the block decomposition.

                  theorem MusicTheory.Fourier.IVraw_eq_powerSpec_conjPair (A : Finset (ZMod 12)) (k : β„•) (h1 : 1 ≀ k) (h5 : k ≀ 5) :
                  ↑(IVraw A k) = ZMod.dft.symm (powerSpec A) ↑k + ZMod.dft.symm (powerSpec A) (-↑k)

                  The interval vector is the power spectrum folded over the conjugate pair. For 1 ≀ k ≀ 5, IVraw A k = 𝓕⁻(|Γ‚|Β²)(k) + 𝓕⁻(|Γ‚|Β²)(βˆ’k) β€” the inverse DFT of the power spectrum summed over the conjugate pair {k,βˆ’k} (= InversionDFT.conjPair k = the dihedral block index). With powerSpec_neg the two summands coincide, recovering IVraw = 2Β·commonTones. One object β€” the conjugate pair β€” behind the interval vector (Note #2) and the dihedral blocks (Note #3).

                  L.4 β€” Deep scales (rides on IVraw). #

                  A pitch-class set is deep when its interval-class multiplicities are all distinct. Via O.1 those multiplicities are exactly the transposition common-tone counts (doubled off the tritone), so a deep scale is one where every transposition shares a different number of notes with the original β€” the property that makes the diatonic scale a maximally-articulated reference (Gamer 1967, Browne 1981). This formalizes the definition and its witnesses, not new mathematics; in particular the chromatic aggregate is NOT deep, correcting a common misconception.

                  A scale is deep iff its six interval-vector entries IVraw A 1 … IVraw A 6 are all distinct.

                  Equations
                  Instances For

                    O.1 reading of deepness. The interval-vector entries ARE the transposition common-tone counts, doubled on classes 1..5 and taken raw at the tritone 6 (the T₆ fixed-point doubling).

                    Deepness in common-tone terms. A scale is deep iff the six counts 2Β·#(A∩T₁A), …, 2Β·#(A∩Tβ‚…A), #(A∩T₆A) are all distinct.

                    The diatonic scale {0,2,4,5,7,9,11} is deep β€” IVraw = [4,10,8,6,12,2], all distinct Each transposition retains a different number of notes.

                    The augmented triad {0,4,8} is NOT deep β€” IVraw = [0,0,0,6,0,0] (its Tβ‚„-symmetry collapses every class but the major third). A cheap non-deep witness.

                    The chromatic aggregate ℀₁₂ is NOT deep: IVraw = [24,24,24,24,24,12], so the multiplicities are not distinct β€” deep β‰  "uses all intervals". (Not checked here.)

                    Step 4 β€” Babbitt's hexachord theorem (B.2) as a DFT corollary. #

                    theorem MusicTheory.Fourier.hexachord_abs_eq (A : Finset (ZMod 12)) (_hA : A.card = 6) {t : ZMod 12} (ht : t β‰  0) :

                    Step 4 (Babbitt B.2). A hexachord and its complement have equal Fourier magnitude away from t = 0: |A| = 6 β†’ βˆ€ t β‰  0, β€–Γ‚ A tβ€– = β€–Γ‚ Aᢜ tβ€–. Since IVraw is determined by the power spectrum (IVraw_eq_invDFT_power), and the power spectrum is ‖·‖², this gives A and Aᢜ the same interval vector β€” Babbitt's hexachord theorem.

                    theorem MusicTheory.Fourier.hexachord_powerSpec_eq (A : Finset (ZMod 12)) (_hA : A.card = 6) {t : ZMod 12} (ht : t β‰  0) :

                    The power spectra of a hexachord and its complement agree off t = 0 (the form actually feeding IVraw_eq_invDFT_power).

                    theorem MusicTheory.Fourier.powerSpec_zero (A : Finset (ZMod 12)) :
                    powerSpec A 0 = ↑A.card * ↑A.card

                    The power spectrum at the origin is |A|Β² (the DC term: Γ‚ A 0 = |A|).

                    A hexachord and its complement have the same power spectrum at every frequency β€” not just off t = 0 (hexachord_powerSpec_eq): at t = 0 both equal |A|Β² = |Aᢜ|Β² = 36.

                    theorem MusicTheory.Fourier.hexachord_IVraw_eq (A : Finset (ZMod 12)) (hA : A.card = 6) (k : β„•) :
                    ↑(IVraw A k) = ↑(IVraw Aᢜ k)

                    Babbitt's hexachord theorem (B.2 capstone). A hexachord and its complement have the same interval vector: IVraw A k = IVraw Aᢜ k for every interval class k. The interval vector is the inverse DFT of the power spectrum (IVraw_eq_invDFT_power), and a hexachord shares its full power spectrum with its complement (hexachord_powerSpec_eq_all) β€” so the interval content is forced to agree. (Babbitt 1955 / Lewin 1959.)

                    Babbitt's hexachord theorem, over β„•. The interval-vector entries (natural numbers) of a hexachord and its complement coincide.

                    P1 β€” Homometry and the crystallographic phase problem (rides on autocorr_eq_invDFT). #

                    Two pc-sets are homometric when they share the same autocorrelation autocorr. In crystallography that autocorrelation is the Patterson function (Patterson 1934) and |Γ‚|Β² is the X-ray diffraction intensity (structure factor). The theorem below is the discrete phase problem: the Patterson function determines, and is determined by, the power spectrum |Γ‚|Β² (Wiener–Khinchin, autocorr_eq_invDFT) β€” but NOT the phase of Γ‚, so distinct sets can share a diffraction pattern. In music this is exactly the Z-relation: same interval content, not T/I-related. Refs: Patterson (1934); Lewin / Soderberg ("homometry"); Mandereau–Andreatta–Amiot–Agon, J.Math&Music 5(2) 2011 (Z-relation ↔ Patterson).

                    The Patterson function of a pc-set = its (ordered) autocorrelation.

                    Equations
                    Instances For

                      Two pc-sets are homometric iff they have the same autocorrelation / Patterson function (equivalently, the same directed interval content).

                      Equations
                      Instances For

                        P1 β€” the discrete phase problem. Two pc-sets are homometric iff they have the same power spectrum |Γ‚|Β². Autocorrelation and diffraction intensity determine each other (Wiener–Khinchin); the information lost β€” what homometry cannot see β€” is the PHASE of Γ‚.

                        P1, crystallographic form. Homometric ⟺ equal diffraction intensity |Γ‚|Β² (the structure factor normSq Γ‚) at every frequency. The phase of Γ‚ is invisible to this data.

                        The classic Z-related / homometric pair: the all-interval tetrachords 4-Z15 {0,1,4,6} and 4-Z29 {0,1,3,7} share the autocorrelation [4,1,1,1,1,1,2,1,1,1,1,1], yet are not T/I-related β€” same diffraction, different phase.

                        P2 β€” The phase-taxonomy capstone: the FULL DFT is a complete invariant. #

                        The whole "phase taxonomy" of pc-set invariants organizes around exactly how much of Γ‚ each invariant retains:

                        β€’ |Γ‚|Β² (= powerSpec = autocorrelation = interval vector, B.1/D.1) is phase-BLIND and therefore NOT a complete invariant β€” homometry collapses it: distinct sets share it (allIntervalTetrachords_homometric, the all-interval tetrachords {0,1,4,6}≉{0,1,3,7}). β€’ ² (= sqSpec = the sum/index vector, O.2) retains some phase β€” enough to split that homometric pair (sumVector_distinguishes_homometric) β€” but still not all of it. β€’ The FULL Γ‚ (magnitude AND phase) IS a complete invariant: it determines the pc-set exactly (Ahat_injective below). The phase carries precisely the information |Γ‚| discards.

                        This is the capstone of the taxonomy. It is not new mathematics: DFT injectivity is classical (the transform is a LinearEquiv, ZMod.dft); the contribution is the organization β€” pinning each invariant to its slice of Γ‚ and machine-checking the completeness boundary that homometry sits just below.

                        theorem MusicTheory.Fourier.mem_iff_ind_eq_one (A : Finset (ZMod 12)) (x : ZMod 12) :
                        x ∈ A ↔ ind A x = 1

                        The indicator is 0/1-valued, so x ∈ A ↔ ind A x = 1 (the set is recoverable from ind).

                        The indicator map ind : Finset (ZMod 12) β†’ (ZMod 12 β†’ β„‚) is injective: a pc-set is determined by its 0/1 indicator (recover membership as ind A x = 1, using (1 : β„‚) β‰  0).

                        theorem MusicTheory.Fourier.Ahat_injective {A B : Finset (ZMod 12)} (h : Ahat A = Ahat B) :
                        A = B

                        P2 β€” the complete-invariant capstone. The full DFT Γ‚ determines the pitch-class SET exactly: Γ‚ A = Γ‚ B β†’ A = B. The transform ZMod.dft is a LinearEquiv (hence injective), and the indicator recovers the set, so the phase of Γ‚ is exactly the data that completes the interval vector to a total invariant.

                        P2, biconditional form. Equal full DFT ⟺ equal pc-set. (⟸ is just congrArg.)

                        The common-tone theorem under INVERSION (the sum / index vector) #

                        Where the previous section counts tones held under transposition Tβ‚– (the difference pairing aβˆ’b, governed by the interval vector / |Γ‚|Β², phase-blind), this one counts tones held under inversion I_j(x) = j βˆ’ x β€” the sum pairing a+aβ€², governed by the sum (index) vector ISUM. Its transform is Γ‚(t)Β² (the coefficient SQUARED, not |Γ‚|Β²), so ISUM is phase-DEPENDENT: it sees exactly the phase that homometry / the Z-relation (|Γ‚|Β²) cannot. Combinatorial identity is classical (Lewin, GMIT 1987; Rahn, Basic Atonal Theory 1980); the "phase β‰ˆ pitch-class sum" intuition is Tymoczko–Yust (MCM 2019, under transposition β€” a different theorem). Unlike O.1's interval vector there is no tritone factor-2: ISUM counts the ordered pair (a, jβˆ’a) directly, the held axis tone x (2x = j, even j) contributing the diagonal pair (x,x) exactly once.

                        def MusicTheory.Fourier.inv (j : ZMod 12) (A : Finset (ZMod 12)) :

                        Inversion image I_j A = {j βˆ’ a : a ∈ A} (axis j/2).

                        Equations
                        Instances For
                          theorem MusicTheory.Fourier.mem_inv (j : ZMod 12) (A : Finset (ZMod 12)) (x : ZMod 12) :
                          x ∈ inv j A ↔ j - x ∈ A

                          x survives the inversion I_j iff its partner j βˆ’ x is also in A.

                          Pitch classes of A held fixed under inversion I_j: #(A ∩ I_j A).

                          Equations
                          Instances For

                            The sum (index) vector ISUM(A)(j) = #{(a,b) ∈ AΓ—A : a + b = j} β€” the sum-pairing count.

                            Equations
                            Instances For
                              noncomputable def MusicTheory.Fourier.sqSpec (A : Finset (ZMod 12)) :
                              ZMod 12 β†’ β„‚

                              The sum spectrum: the SQUARE of the coefficient (not its squared magnitude).

                              Equations
                              Instances For
                                theorem MusicTheory.Fourier.sqSpec_eq_sq (A : Finset (ZMod 12)) (t : ZMod 12) :
                                sqSpec A t = Ahat A t ^ 2

                                sqSpec = ² β€” and the phase is retained (contrast powerSpec = Γ‚ Β· conj Γ‚ = |Γ‚|Β²).

                                theorem MusicTheory.Fourier.sqSpec_apply (A : Finset (ZMod 12)) (t : ZMod 12) :
                                sqSpec A t = βˆ‘ a ∈ A, βˆ‘ b ∈ A, ZMod.stdAddChar (-(a * t)) * ZMod.stdAddChar (-(b * t))

                                The sum spectrum expanded as a double sum over A Γ— A.

                                theorem MusicTheory.Fourier.commonTonesInv_eq_card_filter (A : Finset (ZMod 12)) (j : ZMod 12) :
                                commonTonesInv A j = {x ∈ A | j - x ∈ A}.card

                                Common tones under I_j as a filtered cardinality: {x ∈ A : j βˆ’ x ∈ A}.

                                theorem MusicTheory.Fourier.sumcorr_eq_card_filter (A : Finset (ZMod 12)) (j : ZMod 12) :
                                sumcorr A j = {a ∈ A | j - a ∈ A}.card

                                The sum vector collapses one index: sumcorr A j = #{a ∈ A : j βˆ’ a ∈ A}.

                                O.2 master identity. Held tones under I_j = the sum (index) vector at j: #(A ∩ I_j A) = #{(a,b) ∈ AΓ—A : a + b = j}. (Lewin/Rahn.)

                                theorem MusicTheory.Fourier.sumcorr_eq_invDFT (A : Finset (ZMod 12)) (j : ZMod 12) :
                                ↑(sumcorr A j) = ZMod.dft.symm (sqSpec A) j

                                O.2, the phase-dependent Fourier form. The sum vector is the inverse DFT of the SQUARED coefficient: #{(a,b)∈AΓ—A : a+b=j} = 𝓕⁻(Γ‚ A Β²) j. Where O.1's |Γ‚|Β² discards the phase, here the phase survives β€” this is why ISUM distinguishes some homometric sets.

                                O.2, Fourier form. Held tones under I_j are the inverse DFT of ²: #(A ∩ I_j A) = 𝓕⁻(Γ‚ A Β²) j.

                                Phase visibility (the headline). The homometric pair 4-Z15 {0,1,4,6} / 4-Z29 {0,1,3,7} share the interval vector (allIntervalTetrachords_homometric, i.e. equal |Γ‚|Β²), yet the inversional common-tone count tells them apart: about axis j = 0 one holds 2 tones, the other 1. The sum/index vector (²) sees the phase the interval vector (|Γ‚|Β²) cannot.

                                Rhythmic Oddity Property (Chemillier–Truchet 2003) #

                                A cyclic rhythm A βŠ† β„€β‚™ has the Rhythmic Oddity Property when it cannot be split into two arcs of equal length β€” equivalently (for n = 12, n/2 = 6) no two onsets are antipodal (differ by the tritone 6). This is the SAME T₆ central element as the 6-30 finding and the tritone factor in O.1: ROP ⟺ the autocorrelation / interval-vector entry at the tritone vanishes.

                                N.1 β€” ROP. A has the Rhythmic Oddity Property iff it is disjoint from its tritone-transpose, i.e. no onset has an antipode (a partner 6 apart).

                                Equations
                                Instances For

                                  ROP ⟺ no tones are held under the tritone transposition T₆.

                                  ROP ⟺ the autocorrelation vanishes at the tritone (autocorr A 6 = 0).

                                  ROP ⟺ the interval vector's tritone entry vanishes (IVraw A 6 = 0) β€” the B.1 face.

                                  Lopsidedness bound (pigeonhole). ROP forces at most n/2 = 6 onsets: A and its disjoint tritone-copy T₆ A have equal size and together fit inside ℀₁₂, so 2|A| ≀ 12. Corollary: no 7-subset of ℀₁₂ is ROP.

                                  Set-class completeness: the T/I-orbit ⟺ DFT-up-to-phase characterization. #

                                  That no two of the 224 T/I orbits share their DFT up to phase is here a THEOREM over all of ZMod 12. The point: membership of B in the T/I-orbit of A (B = Tβ‚– A for some k, or B = I_j A for some j) is EXACTLY the statement that BΜ‚ equals Γ‚ up to a transposition phase ramp stdAddChar(βˆ’kΒ·t), or up to conjugation-plus-ramp. The forward maps are the existing Ahat_tpose / Ahat_inv; injectivity (Ahat_injective) supplies the converses. The completeness of the set-class fingerprint thus follows from DFT injectivity, not from enumeration.

                                  theorem MusicTheory.Fourier.Ahat_inv (j : ZMod 12) (A : Finset (ZMod 12)) (t : ZMod 12) :
                                  Ahat (inv j A) t = ZMod.stdAddChar (-(j * t)) * (starRingEnd β„‚) (Ahat A t)

                                  Inversion analog of Ahat_tpose. Γ‚ (I_j A) t = stdAddChar(βˆ’jΒ·t) Β· conj(Γ‚ A t). The conjugate appears because I_j reflects the sum, turning stdAddChar(βˆ’(aΒ·t)) into stdAddChar(aΒ·t) = conj(stdAddChar(βˆ’(aΒ·t))).

                                  theorem MusicTheory.Fourier.tpose_iff_Ahat_ramp (k : ZMod 12) (A B : Finset (ZMod 12)) :
                                  B = tpose k A ↔ Ahat B = fun (t : ZMod 12) => ZMod.stdAddChar (-(k * t)) * Ahat A t

                                  Transposition ⟺ DFT ramp. B = Tβ‚– A iff BΜ‚ = stdAddChar(βˆ’kΒ·t) Β· Γ‚ A pointwise. Forward is Ahat_tpose; backward is Ahat_injective.

                                  theorem MusicTheory.Fourier.inv_iff_Ahat_conj_ramp (j : ZMod 12) (A B : Finset (ZMod 12)) :
                                  B = inv j A ↔ Ahat B = fun (t : ZMod 12) => ZMod.stdAddChar (-(j * t)) * (starRingEnd β„‚) (Ahat A t)

                                  Inversion ⟺ conjugated DFT ramp. B = I_j A iff BΜ‚ = stdAddChar(βˆ’jΒ·t) Β· conj(Γ‚ A) pointwise. Forward is Ahat_inv; backward is Ahat_injective.

                                  theorem MusicTheory.Fourier.setClass_iff_Ahat_mod_phase (A B : Finset (ZMod 12)) :
                                  ((βˆƒ (k : ZMod 12), B = tpose k A) ∨ βˆƒ (j : ZMod 12), B = inv j A) ↔ (βˆƒ (k : ZMod 12), Ahat B = fun (t : ZMod 12) => ZMod.stdAddChar (-(k * t)) * Ahat A t) ∨ βˆƒ (j : ZMod 12), Ahat B = fun (t : ZMod 12) => ZMod.stdAddChar (-(j * t)) * (starRingEnd β„‚) (Ahat A t)

                                  Set-class completeness, the headline. B lies in the T/I-orbit of A (B = Tβ‚– A for some k, or B = I_j A for some j) IFF its DFT BΜ‚ equals Γ‚ up to a transposition ramp, or up to conjugation-plus-ramp. The set-class fingerprint is therefore a COMPLETE invariant of the orbit β€” the "0 collisions" computation made into a theorem over all of ZMod 12, with DFT injectivity (Ahat_injective) as the engine.

                                  The real-space TRIPLE CORRELATION: the missing middle row of the taxonomy. #

                                  The phase taxonomy so far has a 2nd-order row (|Γ‚|Β² = interval vector = autocorrelation, phase-blind, collapsed by homometry) and the full-Γ‚ capstone (complete invariant, all phase). The triple correlation triple A j k = #{x : x, xβˆ’j, xβˆ’k ∈ A} is the missing middle row: a 3rd-order, phase-blind (built from real-space membership only), transposition-invariant statistic whose Fourier dual is the bispectrum Γ‚(t₁)Β·Γ‚(tβ‚‚)Β·conj Γ‚(t₁+tβ‚‚). Crucially it resolves homometry: it tells apart the all-interval tetrachords 4-Z15 {0,1,4,6} / 4-Z29 {0,1,3,7} that |Γ‚|Β² cannot (carterPair_triple_distinct). It is genuinely finer than the interval vector yet still a real, combinatorial, transposition-invariant object β€” the classical reason the triple correlation / bispectrum reconstructs a signal up to translation where the power spectrum fails. It is not inversion-invariant (triple_not_inversionInvariant), so it sits strictly between the T-orbit and the full T/I data: folded by inversion it would complete to a T/I invariant. Refs: the 3-deck / triple correlation of combinatorics; bispectral reconstruction (Tukey); Amiot's DFT-of-pc-sets program.

                                  def MusicTheory.Fourier.triple (A : Finset (ZMod 12)) (j k : ZMod 12) :

                                  The triple correlation of a pc-set: the number of pitch classes x with x, xβˆ’j, xβˆ’k all in A (real-space 3-deck). Equivalently #(A ∩ Tβ±Ό A ∩ Tβ‚– A) since x ∈ Tβ±Ό A ↔ xβˆ’j ∈ A.

                                  Equations
                                  Instances For
                                    theorem MusicTheory.Fourier.tpose_inter (m : ZMod 12) (A B : Finset (ZMod 12)) :
                                    tpose m (A ∩ B) = tpose m A ∩ tpose m B

                                    tpose distributes over intersection (it is a Finset.map by an embedding).

                                    theorem MusicTheory.Fourier.tpose_tpose (j m : ZMod 12) (A : Finset (ZMod 12)) :
                                    tpose j (tpose m A) = tpose m (tpose j A)

                                    Translations commute: Tβ±Ό (Tβ‚˜ A) = Tβ‚˜ (Tβ±Ό A) (both shift by j + m).

                                    theorem MusicTheory.Fourier.card_tpose (m : ZMod 12) (A : Finset (ZMod 12)) :
                                    (tpose m A).card = A.card

                                    The cardinality is unchanged by tpose (it is an injective Finset.map).

                                    theorem MusicTheory.Fourier.triple_tpose_invariant (m : ZMod 12) (A : Finset (ZMod 12)) (j k : ZMod 12) :
                                    triple (tpose m A) j k = triple A j k

                                    Transposition invariance. The triple correlation is unchanged when the whole set is transposed: triple (Tβ‚˜ A) j k = triple A j k. (Tβ‚˜ commutes with Tβ±Ό/Tβ‚– and distributes over ∩, then card is map-invariant.) This is the defining feature: a 3rd-order statistic that, like the interval vector, is blind to absolute transposition.

                                    theorem MusicTheory.Fourier.carterPair_triple_distinct :
                                    βˆƒ (j : ZMod 12) (k : ZMod 12), triple {0, 1, 4, 6} j k β‰  triple {0, 1, 3, 7} j k

                                    Homometry resolution. The triple correlation distinguishes the all-interval tetrachords 4-Z15 {0,1,4,6} and 4-Z29 {0,1,3,7}, which are homometric (allIntervalTetrachords_homometric: equal interval vector |Γ‚|Β²) yet NOT T/I-related. At (j,k) = (1,6) the first holds 0, the second 1 β€” the 3rd-order statistic sees what the 2nd-order |Γ‚|Β² is blind to. This is the Z-relation broken by the bispectrum.

                                    theorem MusicTheory.Fourier.triple_not_inversionInvariant :
                                    βˆƒ (A : Finset (ZMod 12)) (j : ZMod 12) (k : ZMod 12), triple A j k β‰  triple (inv 0 A) j k

                                    Not inversion-invariant. The triple correlation distinguishes a set from its inversion Iβ‚€ A = inv 0 A: at A = {0,1,4,6}, (j,k) = (1,4), A holds 0 but Iβ‚€ A holds 1. So triple is strictly finer than a T/I invariant β€” it lives between the T-orbit and the full T/I data; folding it by inversion would complete it to a T/I-complete object.

                                    Parity marginals of the index vector are phase-blind #

                                    The per-frequency index vector sumcorr A j = ISUM is phase-AWARE: its transform is ² (sqSpec), so it splits homometric pairs (sumVector_distinguishes_homometric). A refinement: its parity marginals β€” the partial sums over even j and over odd j β€” are PHASE-BLIND, i.e. functions of |Γ‚|Β² (powerSpec) alone. The mechanism is the recurring {0,6} 2-torsion (inversion- fixed frequencies): Ξ£_{j even} f(j) = Β½(Ξ£_j f(j) + Ξ£_j (βˆ’1)Κ² f(j)), and for f = 𝓕⁻(sqSpec) the two character sums collapse to sqSpec 0 = |A|Β² and sqSpec 6 = Γ‚(6)Β²; since Γ‚(6) is real (6 = βˆ’6), Γ‚(6)Β² = |Γ‚(6)|Β² = powerSpec 6. So the marginals see only |Γ‚|Β² at the inversion-fixed t ∈ {0,6}.

                                    Combinatorially the same fact is the parity bridge a+b even ⟺ a,b same parity ⟺ aβˆ’b even, so the even/odd marginal of the SUM count equals the even/odd marginal of the DIFFERENCE count (autocorrelation, the canonical phase-blind statistic).

                                    The even residues of ℀₁₂ (the {0,2,4,6,8,10} index set; 2·℀₆, contains the {0,6} 2-torsion).

                                    Equations
                                    Instances For

                                      The odd residues of ℀₁₂ (the {1,3,5,7,9,11} index set).

                                      Equations
                                      Instances For
                                        theorem MusicTheory.Fourier.sum_sumcorr_eq (A S : Finset (ZMod 12)) :
                                        βˆ‘ j ∈ S, sumcorr A j = βˆ‘ a ∈ A, βˆ‘ b ∈ A, if a + b ∈ S then 1 else 0

                                        A marginal of sumcorr over an index set S counts the ordered pairs whose SUM lands in S: Σ_{j∈S} sumcorr A j = #{(a,b)∈A² : a+b ∈ S}.

                                        theorem MusicTheory.Fourier.sum_autocorr_eq (A D : Finset (ZMod 12)) :
                                        βˆ‘ d ∈ D, autocorr A d = βˆ‘ a ∈ A, βˆ‘ b ∈ A, if a - b ∈ D then 1 else 0

                                        A marginal of autocorr over a difference set D counts the ordered pairs whose DIFFERENCE lands in D: Ξ£_{d∈D} autocorr A d = #{(a,b)∈AΒ² : aβˆ’b ∈ D}.

                                        The parity bridge. For every a,b ∈ ℀₁₂, a+b is even iff aβˆ’b is even (they differ by 2b). Pointwise over all 144 pairs by decide; this is what makes the marginals phase-blind.

                                        Likewise for the odd index set.

                                        theorem MusicTheory.Fourier.sum_evenSet_sumcorr_eq_autocorr (A : Finset (ZMod 12)) :
                                        βˆ‘ j ∈ evenSet, sumcorr A j = βˆ‘ d ∈ evenSet, autocorr A d

                                        Parity marginal = autocorrelation marginal (even). The even-j marginal of the index vector equals the even-d marginal of the autocorrelation β€” the sum count and the difference count agree on each parity class (a+b even ⟺ aβˆ’b even).

                                        theorem MusicTheory.Fourier.sum_oddSet_sumcorr_eq_autocorr (A : Finset (ZMod 12)) :
                                        βˆ‘ j ∈ oddSet, sumcorr A j = βˆ‘ d ∈ oddSet, autocorr A d

                                        Parity marginal = autocorrelation marginal (odd).

                                        autocorr A 0 = |A|: every element pairs with itself (the diagonal), nothing else has aβˆ’a=0.

                                        theorem MusicTheory.Fourier.sumcorr_odd_marginal (A : Finset (ZMod 12)) :
                                        βˆ‘ j ∈ oddSet, sumcorr A j = 2 * (autocorr A 1 + autocorr A 3 + autocorr A 5)

                                        ID-8 (odd marginal, the β„• form). The odd-index marginal of the index vector folds onto the short autocorrelation classes: Ξ£_{j∈{1,3,5,7,9,11}} sumcorr A j = 2Β·(c₁+c₃+cβ‚…) where cβ‚– = autocorr A k. (autocorr_neg: c₇=cβ‚…, c₉=c₃, c₁₁=c₁.)

                                        theorem MusicTheory.Fourier.sumcorr_even_marginal (A : Finset (ZMod 12)) :
                                        βˆ‘ j ∈ evenSet, sumcorr A j = A.card + 2 * (autocorr A 2 + autocorr A 4) + autocorr A 6

                                        ID-7 (even marginal, the β„• form). The even-index marginal: Ξ£_{j∈{0,2,4,6,8,10}} sumcorr A j = |A| + 2Β·(cβ‚‚+cβ‚„) + c₆ where cβ‚– = autocorr A k. The lone |A| is the diagonal cβ‚€ = |A| and the lone c₆ is the tritone self-fixed class (6 = βˆ’6), both 2-torsion β€” the same {0,6}.

                                        The phase-blind β„‚-form (THE PAYLOAD): marginals = (|Γ‚(0)|Β² Β± |Γ‚(6)|Β²)/2. #

                                        The even/odd marginals depend ONLY on powerSpec (= |Γ‚|Β²) at the inversion-fixed frequencies 0 and 6 β€” even though the per-j index vector itself is phase-aware. Proved via the DFT route on sumcorr_eq_invDFT: summing 𝓕⁻(sqSpec) against the even/odd parity sets picks out exactly sqSpec 0 and sqSpec 6, and Γ‚(6) is real so sqSpec 6 = Γ‚(6)Β² = |Γ‚(6)|Β² = powerSpec 6.

                                        sqSpec A 0 = powerSpec A 0 = |A|Β² (the DC term is real and equals |Γ‚(0)|Β²).

                                        theorem MusicTheory.Fourier.neg_mul_six (a : ZMod 12) :
                                        -(a * 6) = a * 6

                                        6 is its own negative as a multiplier mod 12: -(aΒ·6) = aΒ·6 for every a (the 2-torsion).

                                        Γ‚(6) is real: conj (Γ‚ A 6) = Γ‚ A 6. Because 6 = βˆ’6 in ℀₁₂, the inversion-fixed frequency is its own conjugate (stdAddChar(βˆ’(aΒ·6)) is Β±1). This is the {0,6} 2-torsion made analytic.

                                        sqSpec A 6 = powerSpec A 6 = |Γ‚(6)|Β² (the tritone frequency is real, so its square is its squared magnitude). The second inversion-fixed point of the {0,6} 2-torsion.

                                        The even and odd index sets PARTITION ℀₁₂ (their disjoint union is the universe).

                                        theorem MusicTheory.Fourier.powerSpec_eq_dft_autocorr (A : Finset (ZMod 12)) (t : ZMod 12) :
                                        powerSpec A t = βˆ‘ d : ZMod 12, ZMod.stdAddChar (-(d * t)) * ↑(autocorr A d)

                                        powerSpec as the FORWARD DFT of the autocorrelation: powerSpec A t = Ξ£_d stdAddChar(βˆ’(dΒ·t))Β·c(d) (apply 𝓕 to autocorr_eq_invDFT; π“•βˆ˜π“•β» = id).

                                        theorem MusicTheory.Fourier.powerSpec_zero_eq_sum_autocorr (A : Finset (ZMod 12)) :
                                        powerSpec A 0 = βˆ‘ d : ZMod 12, ↑(autocorr A d)

                                        powerSpec A 0 is the TOTAL pair count Ξ£_d c(d) = |A|Β² (forward DFT at the DC frequency).

                                        The tritone character value: stdAddChar (6 : ℀₁₂) = exp(Ο€i) = βˆ’1. The analytic root of the (βˆ’1)ᡈ sign that makes frequency 6 a parity detector.

                                        On the even residues stdAddChar(βˆ’(dΒ·6)) = 1; on the odd residues it is βˆ’1 (since dΒ·6 is 0 or 6 in ℀₁₂). The {0,6}-frequency reads off the parity of d.

                                        theorem MusicTheory.Fourier.powerSpec_six_eq_signed_autocorr (A : Finset (ZMod 12)) :
                                        powerSpec A 6 = βˆ‘ d ∈ evenSet, ↑(autocorr A d) - βˆ‘ d ∈ oddSet, ↑(autocorr A d)

                                        powerSpec A 6 is the SIGNED pair count Ξ£_d (βˆ’1)ᡈ c(d) = Ξ£_even c βˆ’ Ξ£_odd c (forward DFT at the inversion-fixed tritone frequency 6; stdAddChar(βˆ’6d) = (βˆ’1)ᡈ).

                                        theorem MusicTheory.Fourier.sumcorr_even_marginal_phaseblind (A : Finset (ZMod 12)) :
                                        βˆ‘ j ∈ evenSet, ↑(sumcorr A j) = (powerSpec A 0 + powerSpec A 6) / 2

                                        The phase-blind payload (even, β„‚-form). The even-index marginal of the index vector equals (|Γ‚(0)|Β² + |Γ‚(6)|Β²)/2 = (powerSpec 0 + powerSpec 6)/2. It is a function of |Γ‚|Β² alone β€” at the inversion-fixed frequencies {0,6} β€” even though sumcorr per-j is phase-aware.

                                        theorem MusicTheory.Fourier.sumcorr_odd_marginal_phaseblind (A : Finset (ZMod 12)) :
                                        βˆ‘ j ∈ oddSet, ↑(sumcorr A j) = (powerSpec A 0 - powerSpec A 6) / 2

                                        The phase-blind payload (odd, β„‚-form). The odd-index marginal equals (|Γ‚(0)|Β² βˆ’ |Γ‚(6)|Β²)/2 = (powerSpec 0 βˆ’ powerSpec 6)/2. Again |Γ‚|Β² at {0,6} only.

                                        The punchline witness: per-j index vectors DIFFER (phase-aware), marginals AGREE (phase-blind). #

                                        The homometric Z-pair 4-Z15 {0,1,4,6} and 4-Z29 {0,1,3,7} are NOT T/I-related; their index vectors sumcorr differ at individual j (sumVector_distinguishes_homometric β€” that is why ² resolves the Z-relation). Yet their PARITY MARGINALS coincide β€” the phase-collapse made concrete.

                                        The per-j index vectors differ at j = 0: {0,1,4,6} holds 2, {0,1,3,7} holds 1.

                                        theorem MusicTheory.Fourier.carterPair_even_marginal_agree :
                                        βˆ‘ j ∈ evenSet, sumcorr {0, 1, 4, 6} j = βˆ‘ j ∈ evenSet, sumcorr {0, 1, 3, 7} j

                                        ...yet the EVEN-index marginals agree (phase-blind).

                                        theorem MusicTheory.Fourier.carterPair_odd_marginal_agree :
                                        βˆ‘ j ∈ oddSet, sumcorr {0, 1, 4, 6} j = βˆ‘ j ∈ oddSet, sumcorr {0, 1, 3, 7} j

                                        ...and the ODD-index marginals agree (phase-blind).