Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Chapter 15 definitions: Chan's (15.8) left-hand side as a formal series, Legendre symbol mod 5, residue divisor sums

Definition
QseriesFormalization_Pending_Chapter15_R_ODE

by FormallyCorrect · Oct 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

chan-invitation-qseriesformal-power-seriesidentitiesq-pochhammer

This bundle defines the Legendre symbol mod 555 (valued in Z\mathbb{Z}Z), the integer coefficient of XNX^NXN in Chan's Eq. (15.8) left side, namely 111 for N=0N=0N=0 and −5∑d∣Nd (d5)-5\sum_{d\mid N}d\,\big(\tfrac d5\big)−5∑d∣N​d(5d​) for N>0N>0N>0, and the same coefficient in any commutative ring and as a formal power series chan15LHSPS. It also defines an integer coefficient model for powers of (q;q)∞(q;q)_\infty(q;q)∞​ via the pentagonal signs and Cauchy convolution, the integer coefficient core of the left side, and the rational divisor-sum coefficient ∑0≤d≤n, d∣n, n>0, d mod 5=rd\sum_{0\le d\le n,\ d\mid n,\ n>0,\ d\bmod5=r}d∑0≤d≤n, d∣n, n>0, dmod5=r​d.

In the last finite sum rrr is a literal natural remainder, so the value is 000 for r≥5r\ge5r≥5 and also for n=0n=0n=0.

Definition code
-- Generated by qseries-p2m/p2m/generate.py from QseriesFormalization.Pending.Chapter15_R_ODE: skeleton subtraction
-- keeps 14 declaration(s); proofs kept; project imports -> Definitions bundles.
import Definitions.Def_QseriesFormalization_Chapter05_Franklin
import Mathlib.Combinatorics.Enumerative.Partition.GenFun
import Mathlib.RingTheory.PowerSeries.Basic
import Mathlib.RingTheory.PowerSeries.Expand
import Mathlib.RingTheory.PowerSeries.Inverse
import Mathlib
import Mathlib.Combinatorics.Enumerative.Partition.Basic
import Mathlib.Tactic.Linarith
import Mathlib.RingTheory.PowerSeries.Derivative
import Mathlib.Topology.Algebra.InfiniteSum.NatInt
import Mathlib.Analysis.SpecialFunctions.Log.Summable
import Mathlib.Analysis.Normed.Group.Tannery
import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Analysis.Normed.Ring.InfiniteSum

namespace QseriesFormalization.PartIV.Ch19 end QseriesFormalization.PartIV.Ch19
namespace QseriesFormalization.PartIV.Ch20 end QseriesFormalization.PartIV.Ch20
namespace QseriesFormalization.Pending.Ch10TenthOrder end QseriesFormalization.Pending.Ch10TenthOrder
namespace QseriesFormalization.Pending.Ch15FormalDeriv end QseriesFormalization.Pending.Ch15FormalDeriv
namespace QseriesFormalization.Pending.Ch15WronskianIndependent end QseriesFormalization.Pending.Ch15WronskianIndependent

/-!
# Chapter 15 — Differential equation for `R(q)` (Chan §15 / Theorem 11.7)

⚠️ **Resolves MISLABELED status of Chan §15.** Adds the precise Chan §15 chapter-main
result statement, replacing the q-Taylor infrastructure (which remains useful as
*background* in `Chapter15.lean` but is not the actual §15 content).

Chan Theorem 11.7 (proved in §15) is the differential equation
  `5q · d/dq · ln R(q) = η⁵(τ) / η(5τ)`

which, by integrating term-by-term (Theorem 11.1), is equivalent to the
formal-power-series identity (Eq 15.8 in Chan):

  `1 − 5 · Σ_{n≥1} (n|5) · n · qⁿ / (1 − qⁿ) = η⁵(τ) / η(5τ)`

where `(n|5)` denotes the Legendre symbol modulo `5`:
  +1 if n ≡ ±1 (mod 5),
  -1 if n ≡ ±2 (mod 5),
   0 if n ≡  0 (mod 5).

In our formal-PS setting `etaPS R := qPochInfPS R` (no `q^{1/24}` prefactor),
so `η⁵/η(5τ)` translates to `(qPochInfPS R)⁵ / PowerSeries.expand 5 (qPochInfPS R)`.
The denominator has constant coefficient `1`, so the division is well-defined
in `R⟦X⟧` and we state the identity as a *multiplicative* equality below to
avoid `Inv` typeclass issues over a general `CommRing R`.

## Open closure path (Chan §15)

Chan's proof in §15.2 uses **Dobbie's identity (1955)**, Eq. 15.1:
  `(x-z)(1-xz) / ((1-x)²(1-z)²) · [JTP-products] = LHS as a 2-variable Laurent series`

Specializing to `x = e^{2πi/5}, z = x²` collapses by Gaussian-period algebra
(`θ := β + β⁻¹` for the Golden ratio β) to Eq. 15.5, and the `qPochInfPS`
prefactor cancels by Eq. 14.35 (the 5-th root JTP infinite-product identity).

Modern proof (Milas 2004): vertex operator algebra / Zhu's theorem; out of
scope for this formalization without a Mathlib VOA module.
-/

namespace QseriesFormalization
namespace Pending
namespace Ch15RODE

open PowerSeries
open QseriesFormalization.PartIV.Ch19
open QseriesFormalization.PartIV.Ch20
open QseriesFormalization.Pending.Ch15FormalDeriv
open QseriesFormalization.Pending.Ch10TenthOrder
open QseriesFormalization.Pending.Ch15WronskianIndependent

/-- The Legendre symbol mod 5, valued in `ℤ`:
  +1 if n ≡ ±1 (mod 5), -1 if n ≡ ±2 (mod 5), 0 if n ≡ 0 (mod 5). -/
def legendre5 (n : ℕ) : ℤ :=
  match n % 5 with
  | 0 => 0
  | 1 => 1
  | 2 => -1
  | 3 => -1
  | 4 => 1
  | _ => 0  -- unreachable

@[simp] theorem legendre5_zero : legendre5 0 = 0 := rfl
@[simp] theorem legendre5_one : legendre5 1 = 1 := rfl
@[simp] theorem legendre5_two : legendre5 2 = -1 := rfl
@[simp] theorem legendre5_three : legendre5 3 = -1 := rfl
@[simp] theorem legendre5_four : legendre5 4 = 1 := rfl
@[simp] theorem legendre5_five : legendre5 5 = 0 := rfl

/-- Closed-form coefficient at `X^N` of Chan's Eq 15.8 LHS:
  `[X^N] (1 - 5 · Σ_{n≥1} (n|5) · n · X^n / (1 - X^n))`
  = `[N=0 ? 1 : 0] - 5 · Σ_{d|N} d · legendre5(d)`.
This is the Lambert-series coefficient expansion: each `(n|5)·n·X^n / (1-X^n)`
contributes `n·(n|5)` to coefficients at `X^{nm}` for every `m≥1`, i.e. at
every multiple of `n`. Summing over `n ≤ N` divisors of `N` gives the formula. -/
def chan15LHSCoeffInt (N : ℕ) : ℤ :=
  if N = 0 then 1
  else -5 * (∑ d ∈ N.divisors, (d : ℤ) * legendre5 d)

/-- Coefficient at `X^N` of Chan's Eq 15.8 LHS, as a value in any commutative
ring `R`, via canonical ℤ→R coercion. -/
def chan15LHSCoeff (R : Type*) [CommRing R] (N : ℕ) : R :=
  ((chan15LHSCoeffInt N : ℤ) : R)

/-- Chan Eq 15.8 LHS as a formal power series. -/
noncomputable def chan15LHSPS (R : Type*) [CommRing R] : R⟦X⟧ :=
  PowerSeries.mk (chan15LHSCoeff R)

@[simp] theorem chan15LHSCoeffInt_zero : chan15LHSCoeffInt 0 = 1 := rfl

/-- Pure integer left side of the coefficient core, after replacing
`qPochInfPS` coefficients by Euler's pentagonal-sign coefficients. -/
def chan15CoreCoeffLHSZ (N : ℕ) : ℤ :=
  ∑ ij ∈ Finset.HasAntidiagonal.antidiagonal N,
    (chan15LHSCoeffInt ij.1 : ℤ) *
      (if 5 ∣ ij.2 then
        QseriesFormalization.PartI.Ch04Franklin.pentagonalSign (ij.2 / 5)
      else 0)

/-- Computable coefficient model for powers of `(q;q)_∞`, using Euler's
pentagonal-sign coefficients and ordinary Cauchy convolution. -/
def qPochPowPentagonalCoeff : ℕ → ℕ → ℤ
  | 0 => fun n => if n = 0 then 1 else 0
  | e + 1 => fun n =>
      ∑ k ∈ Finset.range (n + 1), qPochPowPentagonalCoeff e k *
        QseriesFormalization.PartI.Ch04Franklin.pentagonalSign (n - k)

set_option maxRecDepth 8192 in
set_option maxHeartbeats 1200000 in
noncomputable def residueDivisorSigmaCoeff (r n : ℕ) : ℚ :=
  ∑ d ∈ Finset.range (n + 1),
    if d ∣ n ∧ 0 < n ∧ d % 5 = r then (d : ℚ) else 0

end Ch15RODE
end Pending
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 15. Lean source: https://github.com/xiangyazi24/invitation-to-qseries-lean/blob/5df34b280b6a9c4a68ab09105b4e5d3c7bbe88d1/QseriesFormalization/Pending/Chapter15_R_ODE.lean (definitions of this module that the uploaded theorems need; ported to Lean v4.33.1 / Mathlib 0df444a).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me