Quantum-calculus definitions: -derivative, -integers, -factorial, -Taylor top term
DefinitionQseriesFormalization_QCalculuschan-invitation-qseriesq-binomialq-series
This bundle defines, over a field, the -derivative , the -integer , the iterated -derivative , the -factorial , the -falling factorial , and the top -Taylor term of , namely . These objects connect -calculus to the partition-theoretic products of the book.
All divisions use Lean’s totalized field convention . Precisely, the falling factorial is with saturated natural subtraction; it is when . Nonzero-denominator hypotheses occur in the separate theorems.
Definition code
-- Generated by qseries-p2m/p2m/generate.py from QseriesFormalization.QCalculus: skeleton subtraction
-- keeps 6 declaration(s); proofs kept; project imports -> Definitions bundles.
import Mathlib
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Complex.Basic
/-!
# Chapter 15 — A differential equation for R(q) (Chan §15) — **MISLABELED**
⚠️ **MISLABELED CHAPTER — Chan §15 main result OPEN**.
Per `PLAYBOOK_AUDIT.md` (2026-05-22):
**Chan §15 is "A differential equation for the Rogers-Ramanujan
continued fraction".** Its main results are:
- **Theorem 15.1 (=Eq 15.1):** `F(x, z) = G(x) − G(z)`, where
`F` and `G` are specific Laurent expansions on the RRCF side.
- **Eq (15.7) / (15.24) / (15.30):** the differential equation
`(q d/dq)² F(q) + 2 G_2(q) (q d/dq) F(q) − (11/5) G_4(q) F(q) = 0`
satisfied by the right-hand sides `y₁`, `y₂` of the two RR identities,
proved by Milas (2004) via Vertex Operator Algebras (Zhu's theorem).
**What this file actually contains** is general q-calculus / q-Taylor
infrastructure (`qDeriv`, `qDeriv_qPoch`, `qExpTrunc`, `qFactorial`,
`qTaylorMonomialTopTerm_eq_pow`, etc.). These are real and useful
q-calculus theorems with proper hypotheses, but they do **not** address
Chan §15's specific differential equation for R(q), nor Milas's
vertex-operator-algebra proof.
So Chan §15's R(q) differential equation is **not formalized**. The
q-Taylor work in this file is genuine background infrastructure — it
just doesn't belong under the chapter number "15".
-/
namespace QseriesFormalization
namespace PartIII
namespace QCalc
section Field
variable {R : Type*} [Field R]
/-- The q-derivative operator: `D_q f(x) = (f(qx) - f(x)) / ((q-1)x)`.
This is the discrete analogue of differentiation appearing in
Chan's Chapter 15 for the RRCF differential equation. -/
noncomputable def qDeriv (f : R → R) (q x : R) : R :=
(f (q * x) - f x) / ((q - 1) * x)
/-- The q-integer [n]_q = ∑_{i=0}^{n-1} q^i = (q^n - 1)/(q - 1). -/
noncomputable def qInt (q : R) (n : ℕ) : R := ∑ i ∈ Finset.range n, q ^ i
/-- Iterated q-derivative: D_q^0 f = f, D_q^{n+1} f = D_q(D_q^n f). -/
noncomputable def qDerivIter (f : R → R) (q : R) : ℕ → R → R
| 0 => f
| n + 1 => fun x => qDeriv (qDerivIter f q n) q x
/-- q-factorial: [n]_q! = [1]_q · [2]_q · ⋯ · [n]_q. -/
noncomputable def qFactorial (q : R) : ℕ → R
| 0 => 1
| n + 1 => qFactorial q n * qInt q (n + 1)
/-- q-falling factorial: [n]_q^{(k)} = [n]_q · [n-1]_q · ⋯ · [n-k+1]_q.
This is the q-analog of the falling factorial n(n-1)⋯(n-k+1). -/
noncomputable def qFallingFactorial (q : R) (n k : ℕ) : R :=
∏ i ∈ Finset.range k, qInt q (n - i)
/-- The top q-Taylor monomial term extracted from `x^n`.
It is written at a nonzero expansion point because this file's `qDeriv`
is a difference quotient with denominator `(q - 1) * x`. -/
noncomputable def qTaylorMonomialTopTerm (q x : R) (n : ℕ) : R :=
(qDerivIter (fun t => t ^ n) q n x / qFactorial q n) * x ^ n
end Field
end QCalc
end PartIII
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). Lean source: https://github.com/xiangyazi24/invitation-to-qseries-lean/blob/5df34b280b6a9c4a68ab09105b4e5d3c7bbe88d1/QseriesFormalization/QCalculus.lean (definitions of this module that the uploaded theorems need; ported to Lean v4.33.1 / Mathlib 0df444a).