Chapter 20 definitions: , , , coefficient lists and partition congruence predicates
DefinitionQseriesFormalization_Chapter20chan-invitation-qseriesmodular-formspartition-congruencesramanujan-tau
This bundle defines the formal Dedekind eta as (without the factor), the discriminant as a formal power series, and Ramanujan's as the -th coefficient of over any commutative ring. It defines computable integer coefficient lists for (from the pentagonal signs) and its powers via truncated convolution, including a stored explicit list of initial coefficients of , and dot/multiplication helpers for lists. It also defines the predicate PartitionAPCongruence m A B ( and for all ) and InfinitelyManyPartitionAPCongruences m (such congruences exist with arbitrarily large step).
Definition code
-- Generated by qseries-p2m/p2m/generate.py from QseriesFormalization.Chapter20: skeleton subtraction
-- keeps 15 declaration(s); proofs kept; project imports -> Definitions bundles.
import Definitions.Def_QseriesFormalization_Chapter05_Franklin
import Definitions.Def_QseriesFormalization_DefCoreQSeries
import Mathlib
import Mathlib.Combinatorics.Enumerative.Partition.GenFun
import Mathlib.RingTheory.PowerSeries.Basic
import Mathlib.RingTheory.PowerSeries.Expand
import Mathlib.RingTheory.PowerSeries.Inverse
import Mathlib.RingTheory.PowerSeries.Derivative
import Mathlib.Analysis.SpecialFunctions.Log.Summable
import Mathlib.Analysis.Normed.Group.Tannery
import Mathlib.Combinatorics.Enumerative.Partition.Basic
import Mathlib.Tactic.Linarith
import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Analysis.Normed.Ring.InfiniteSum
namespace QseriesFormalization.Pending.Ch15FormalDeriv end QseriesFormalization.Pending.Ch15FormalDeriv
/-!
# Chapter 20 — Modular discriminant Δ and the Ramanujan τ-function
⚠️ **AUX CHAPTER — full modularity of Δ(τ) OPEN**.
Per `PLAYBOOK_AUDIT.md` (2026-05-22): this file is the formal-PS landing
strip for the Ramanujan τ-function and the discriminant. Genuine
results proved here:
• Values: `ramanujanTau_zero .. ramanujanTau_fifty` matching OEIS A000594
• Multiplicativity checks at coprime factor pairs up to 50
• Prime-power Hecke recursion checks for p ∈ {2, 3, 5, 7} up to 50
• Log-derivative recurrence for all `n ≥ 2`
• Parity theorem: `τ(n)` is odd iff `n` is an odd square
• Mod-691 congruence `τ(n) ≡ σ₁₁(n)` verified through `n ≤ 50`
• Mod-p congruences: `ramanujanTau_p_mod_p` for `p ∈ {2,3,5,7}`
• n = 0 unconditional Ramanujan trio:
`ramanujan_partition_four_mod_five`, `_five_mod_seven`,
`_six_mod_eleven`
• Frobenius: `discriminantPS_pow_eq_expand`
• Algebraic structure: `etaPS_isUnit`, `discriminantPS_not_isUnit`,
`discriminantPS_eq_X_mul_etaPS_pow_24`,
`discriminantPS_eq_X_mul_tprod_pow_24`
**Chan's Ch 20 main result — the modular invariance of Δ(τ) under
SL₂(ℤ) and the resulting full multiplicativity of `τ(n)` — is NOT
formalized here**, because the formal-PS approach does not see the
complex-analytic modularity directly; that requires Mathlib's
`ModularForm` infrastructure which is incomplete for the η-quotient
case. Tracked as Tier 5 #18 in `TODO_THEOREMS.md`.
-/
namespace QseriesFormalization
namespace PartIV
namespace Ch20
section Field
variable {R : Type*} [Field R]
end Field
section Complex
open Filter Topology
end Complex
/-! ### Formal power series eta and discriminant
We lift Chan's η and Δ to formal power series over a commutative ring, using
the partition generating function infrastructure from Chapter 19. -/
section FormalPS
open PowerSeries QseriesFormalization.PartIV.Ch19
open QseriesFormalization.Pending.Ch15FormalDeriv
variable (R : Type*) [CommRing R]
/-- The Dedekind eta function as a formal power series over `R` (without the
`q^{1/24}` prefactor): `η_PS = (q;q)_∞ = ∏(1 - q^n)`. -/
noncomputable def etaPS : R⟦X⟧ := qPochInfPS R
/-- The modular discriminant as a formal power series: `Δ_PS = X · η_PS^24`. -/
noncomputable def discriminantPS : R⟦X⟧ := PowerSeries.X * (etaPS R) ^ 24
/-- The coefficient sequence of `Δ_PS` is the Ramanujan τ function. -/
noncomputable def ramanujanTau (n : Nat) : R := (discriminantPS R).coeff n
-- B2 small case verifications removed (they don't help the general proof).
-- General B2 target: (qPochInfPS R)^3 = jacobiThetaPS R requires Sylvester
-- combinatorial or analytic-formal bridge.
/-! ### Unconditional Ramanujan congruence: p(4) ≡ 0 (mod 5)
Closing the n=0 case of Ramanujan p(5n+4) ≡ 0 (mod 5) using the formal-PS
framework: compute `((q;q)∞^4).coeff 4` directly via the coeff_four_pow helper
and the Euler-pentagonal coefficient values, then bridge to `partitionCount 4`
via `coeff_pochInfPow_eq_partitionCount_of_lt`. -/
/-! ### Extended Ramanujan τ values through 50 -/
set_option maxHeartbeats 0
set_option maxRecDepth 100000
set_option linter.unusedSimpArgs false
/-- Integer coefficient of `(q;q)_inf`, via Euler's pentagonal theorem. -/
def tauEtaCoeffZ (n : Nat) : Int := QseriesFormalization.PartI.Ch04Franklin.pentagonalSign n
/-- One truncated convolution step for powers of `(q;q)_inf`, keeping coefficients `0..N`. -/
def tauEtaPowStep (N : Nat) (v : Vector Int (N + 1)) : Vector Int (N + 1) :=
Vector.ofFn fun j : Fin (N + 1) =>
∑ i : Fin (j.1 + 1),
v.get ⟨i.1, by omega⟩ * tauEtaCoeffZ (j.1 - i.1)
/-- Coefficients `0..N` of `(q;q)_inf^k`, computed by repeated truncated convolution. -/
def tauEtaPowVec (N : Nat) : Nat → Vector Int (N + 1)
| 0 => Vector.ofFn fun j : Fin (N + 1) => if j.1 = 0 then 1 else 0
| k + 1 => tauEtaPowStep N (tauEtaPowVec N k)
def tauEtaPowVecCoeffZ (N k n : Nat) : Int :=
if h : n < N + 1 then (tauEtaPowVec N k).get ⟨n, h⟩ else 0
def tauEtaPowVec49_24_coeffs : List Int :=
[1, -24, 252, -1472, 4830, -6048, -16744, 84480,
-113643, -115920, 534612, -370944, -577738, 401856, 1217160, 987136,
-6905934, 2727432, 10661420, -7109760, -4219488, -12830688, 18643272,
21288960, -25499225, 13865712, -73279080, 24647168, 128406630, -29211840,
-52843168, -196706304, 134722224, 165742416, -80873520, 167282496,
-182213314, -255874080, -145589976, 408038400, 308120442, 101267712,
-17125708, -786948864, -548895690, -447438528, 2687348496, 248758272,
-1696965207, 611981400]
/-! #### Certified fast evaluation of the coefficients of `η²⁴` up to `q⁴⁹`
`tauEtaPowVec 49 24` performs 24 truncated convolutions over `Vector`/`Fin` sums, which the
kernel evaluates slowly. Below, the same coefficients are computed by repeated squaring on plain
integer lists (`η² , η⁴, η⁸, η¹⁶`, then `η¹⁶ · η⁸`), five truncated products in all. Each list
product is proved to compute the coefficients of the power-series product
(`tauListMul_getD`), so the list for `η²⁴` equals the coefficients of `(etaPS ℤ)^24`; the vector
side equals them by `tauEtaPowVec_spec`. Only the final 50-entry comparison of the fast list with
the stated table is a kernel computation. -/
/-- Dot product of two integer lists (stops at the shorter one). -/
def tauListDot : List Int → List Int → Int
| x :: xs, y :: ys => x * y + tauListDot xs ys
| _, _ => 0
/-- Truncated product of two coefficient lists, keeping coefficients `0..N`: coefficient `j`
is the dot product of `a` with the reversed prefix `b_j, …, b_0`. -/
def tauListMul (N : Nat) (a b : List Int) : List Int :=
(List.range (N + 1)).map fun j => tauListDot a (b.take (j + 1)).reverse
/-- Coefficients `0..N` of `(q;q)_∞`, from Euler's pentagonal theorem. -/
def tauEtaList (N : Nat) : List Int := (List.range (N + 1)).map tauEtaCoeffZ
/-- Coefficients `0..N` of `(q;q)_∞^24` by repeated squaring: `η²⁴ = η¹⁶ · η⁸`. -/
def tauEta24List (N : Nat) : List Int :=
let e1 := tauEtaList N
let e2 := tauListMul N e1 e1
let e4 := tauListMul N e2 e2
let e8 := tauListMul N e4 e4
let e16 := tauListMul N e8 e8
tauListMul N e16 e8
/-- Port helper: `Vector.get` agrees with `getElem` (no simp lemma in Lean 4.33). -/
@[simp] theorem vector_get_eq_getElem_port {α : Type*} {n : Nat} (v : Vector α n) (i : Fin n) :
v.get i = v[i.1] := rfl
/-! ### Hecke multiplicativity checks at coprime factor pairs up to 50 -/
/-! ### Prime-power Hecke recursion checks -/
/-! ### Parity and coefficient bounds through 50 -/
/-! ### Ramanujan's mod-691 congruence through 50 -/
/-! #### Formal Eisenstein series for the mod-691 route -/
/-! ### Log-derivative recurrence -/
/-! ### Ramanujan τ congruences at primes p ∈ {2, 3, 5, 7}
For the Ramanujan tau function, classical results show `τ(p) ≡ 0 (mod p)` for certain
small primes (and more generally `τ(p) ≡ 1 + p¹¹ (mod 691)` etc.). We verify the
prime divisibility for p = 2, 3, 5, 7 directly from the computed values. -/
/-! ### Chan Theorem 20.1 / Ono target -/
/-- An arithmetic-progression partition congruence modulo `m`:
`p(A * n + B) = 0 (mod m)` for every `n`, with positive step `A`. -/
def PartitionAPCongruence (m A B : Nat) : Prop :=
0 < A ∧
∀ n : Nat,
((QseriesFormalization.Ch01.partitionCount (A * n + B) : Nat) : ZMod m) = 0
/-- "Infinitely many congruences" in the unbounded-step sense. For every lower
bound `C`, there is a partition congruence with step at least `C`. -/
def InfinitelyManyPartitionAPCongruences (m : Nat) : Prop :=
∀ C : Nat, ∃ A B : Nat, C ≤ A ∧ PartitionAPCongruence m A B
section DiscriminantEulerProduct
open scoped PowerSeries.WithPiTopology
end DiscriminantEulerProduct
end FormalPS
end Ch20
end PartIV
end QseriesFormalization
Source
Lean formalization (Xiang Huang) of Hei-Chi Chan, An Invitation to q-Series: From Jacobi's Triple Product Identity to Ramanujan's "Most Beautiful Identity" (World Scientific, 2011), Chapter 20. Lean source: https://github.com/xiangyazi24/invitation-to-qseries-lean/blob/5df34b280b6a9c4a68ab09105b4e5d3c7bbe88d1/QseriesFormalization/Chapter20.lean (definitions of this module that the uploaded theorems need; ported to Lean v4.33.1 / Mathlib 0df444a).