Chapter 17 definitions: triangular and pentagonal numbers modulo
DefinitionQseriesFormalization_Chapter17_Mod5ResidueAnalysischan-invitation-qseriespartition-congruencespentagonal-numbers
This bundle defines, for , the triangular number as in (using ), and the pentagonal number as in . They support the Ramanujan--Watson mod-5 residue analysis.
Definition code
-- Generated by qseries-p2m/p2m/generate.py from QseriesFormalization.Chapter17_Mod5ResidueAnalysis: skeleton subtraction
-- keeps 2 declaration(s); proofs kept; project imports -> Definitions bundles.
import Mathlib.Data.ZMod.Basic
/-!
# Chapter 17 — Ramanujan-Watson mod-5 residue analysis
Key combinatorial facts at the heart of Ramanujan's 1919 proof of
`∀ n, 5 ∣ p(5n+4)`. Working in `ZMod 5` (where 2 is invertible with
inverse 3), the triangular and pentagonal exponents become:
- **Triangular** `T_k = k(k+1)/2`; in ZMod 5: `3·k·(k+1)`.
Range: `{0, 1, 3} ⊂ ZMod 5`.
- **Pentagonal** `P_j = j(3j+1)/2`; in ZMod 5: `3·j·(3j+1)`.
Range: `{0, 1, 2} ⊂ ZMod 5`.
The Jacobi coefficient `2k+1` vanishes in ZMod 5 exactly when `k ≡ 2`,
which is exactly when `T_k ≡ 3` (mod 5). So contributing pairs have
`T_k ∈ {0, 1}` and `P_j ∈ {0, 1, 2}`, giving `T_k + P_j ∈ {0,1,2,3}` —
**never 4**.
This file proves the enumeration facts by `decide` on `Fin 5` / `ZMod 5`.
-/
namespace QseriesFormalization
namespace PartIV
namespace Ch17
open ZMod
/-- The triangular number `T_k = k(k+1)/2`, expressed in `ZMod 5` via
the inverse of 2 (which is 3 mod 5). So `T_k mod 5 = 3 · k · (k+1) mod 5`. -/
def triangularMod5 (k : ZMod 5) : ZMod 5 := 3 * k * (k + 1)
/-- The pentagonal number `P_j = j(3j+1)/2`, expressed in `ZMod 5` via
the inverse of 2. -/
def pentagonalMod5 (j : ZMod 5) : ZMod 5 := 3 * j * (3 * j + 1)
end Ch17
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 17. Lean source: https://github.com/xiangyazi24/invitation-to-qseries-lean/blob/5df34b280b6a9c4a68ab09105b4e5d3c7bbe88d1/QseriesFormalization/Chapter17_Mod5ResidueAnalysis.lean (definitions of this module that the uploaded theorems need; ported to Lean v4.33.1 / Mathlib 0df444a).