mathlib4 review helperopen PRs by @wwylele on leanprover-community/mathlib4

← queue

#43978 feat(Analysis/SpecialFunctions): generating function of besselJ

t-analysis CI success

+153 −1 · 4 files · 2 commits · head 0526386 · updated 2 days ago · Files changed on GitHub

In plain words

Proves the generating function of the Bessel functions of integer order (DLMF 10.12.1): for every and , , with summability and analyticity of the series in . Along the way it adds exponential bounds on and on the regularized function, and Gamma-function comparisons. It builds on the derivative recurrence from #42825 and the @[fun_prop] tags from #45102 (whose versions of #42825's proofs here are slightly older than #42825's head).

The transcriptions were written for revision 70efb3a; the PR is now at 0526386. Check them against the code.

Transcriptions are drafted with an LLM from the diff and are a reading aid, not a verified statement: the Lean code is the reference.

PR description

This proves


![Open in Gitpod](gitpod.io/from-referrer/)

Conversation on GitHub 11
github-actions[bot] · comment · 2026-09-19
PR summary 0526386b37

<details><summary>

Import changes for modified files

</summary>

Dependency changes

| File | Base Count | Head Count | Change | | --- | --- | --- | --- | | Mathlib.Analysis.SpecialFunctions.Bessel | 2867 | 2881 | +14 (+0.49%) |

<details><summary>Import changes for all files</summary>

|Files|Import difference| |-|-| | Mathlib.Analysis.SpecialFunctions.Bessel|14| | Mathlib.Analysis.SpecialFunctions.GeneratingFunction (new file)|2832|

</details>

</details>


<details><summary>

Declarations diff (regex)

</summary>

+ hasDerivAt_besselJ + hasDerivAt_besselJ_int + hasSum_zpow_mul_besselJ + norm_besselJ_le_exp + norm_besselJ_le_exp_int + norm_regularizedHGFun_le_exp_of_one_le_re + summable_bound + tsum_zpow_mul_besselJ + tsum_zpow_smul_eq_exp_smul + zpow_mul_besselJ_le <details> <summary>You can run this locally as follows</summary>

## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

</details>

The doc-module for scripts/pr_summary/declarations_diff.sh in the undefined repository contains some details about this script.

</details>

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 0526386).

  • +8 new declarations
  • −0 removed declarations
+Complex.hasDerivAt_besselJ
+Complex.hasDerivAt_besselJ_int
+Complex.hasSum_zpow_mul_besselJ
+Complex.norm_besselJ_le_exp
+Complex.norm_besselJ_le_exp_int
+Complex.norm_regularizedHGFun_le_exp_of_one_le_re
+Complex.tsum_zpow_mul_besselJ
+Complex.tsum_zpow_smul_eq_exp_smul

No changes to strong technical debt. No changes to weak technical debt.

Current commit 0526386b37 Reference commit 7569ed00f9

This script lives in the undefined repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
mathlib-bors[bot] · comment · 2026-09-19

This pull request is now in draft mode. No active bors state needed cleanup.

While this PR remains draft, bors will ignore commands on this PR. Mark it ready for review before using commands like bors r+ or bors try.

Copilot · on Mathlib/Analysis/SpecialFunctions/Bessel.lean:226 (outdated) · 2026-09-20

This helper bounds J a x * t ^ a; it does not bound a derivative. The deriv_ prefix is misleading, especially beside the actual derivative-interchange use below. Rename it to besselJ_mul_pow_le and update its three call sites.

copilot-pull-request-reviewer[bot] · commented · 2026-09-20

Copilot review overview

🟡 Changes recommended

Two derivative recurrences have incorrect DLMF references, alongside minor naming and spelling issues.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced Findings: 3 <picture><source media="(prefers-color-scheme: dark)" srcset="github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"<source media="(prefers-color-scheme: light)" srcset="github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"<img src="github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture>

<details open> <summary><strong>Open (3)</strong></summary>

</details>

<details> <summary><strong>What changed in this PR</strong></summary>

Adds the generating function for integer-order Bessel functions, supported by recurrence, derivative, convergence, and norm-bound lemmas.

Changes:

  • Adds Bessel recurrence and derivative identities.
  • Proves summability, analyticity, and the Bessel generating function.
  • Adds supporting hypergeometric, Gamma, and multiset norm lemmas.

| File | Description | | ---- | ----------- | | Mathlib/​Analysis/​SpecialFunctions/​Bessel.lean | Proves recurrences, bounds, and generating function. | | Mathlib/​Analysis/​SpecialFunctions/​RegularizedHypergeometric.lean | Adds coefficient, derivative, and norm bounds. | | Mathlib/​Analysis/​SpecialFunctions/​Gamma/​Basic.lean | Adds Gamma norm-growth bounds. | | Mathlib/​Analysis/​Normed/​Ring/​Basic.lean | Adds multiset product norm lemmas. | | Mathlib/​Analysis/​Calculus/​FDeriv/​Analytic.lean | Registers analytic derivatives for fun_prop. | </details>


💡 <a href="/leanprover-community/mathlib4/new/master?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>

Copilot · on Mathlib/Analysis/SpecialFunctions/Bessel.lean:261 (outdated) · 2026-09-20

Correct the spelling of “sufficies” to “suffices.”

This issue also appears on line 270 of the same file.

mathlib-merge-conflicts[bot] · comment · 2026-09-22

This pull request has conflicts, please merge master and resolve them.

mathlib-merge-conflicts[bot] · comment · 2026-10-21

This pull request has conflicts, please merge master and resolve them.

mathlib-dependent-issues[bot] · comment · 2026-11-18

This PR/issue depends on:

  • ~~leanprover-community/mathlib4#42825~~
  • ~~leanprover-community/mathlib4#43979~~
  • ~~leanprover-community/mathlib4#45102~~
  • ~~leanprover-community/mathlib4#45103~~

By Dependent Issues (🤖). Happy coding!

github-actions[bot] · comment · 2026-11-18
Crossref diff

| Declaration | Reference | Comment | |---|---|---| | undefined | undefined | | | undefined | undefined | | | undefined | undefined | |

wwylele · comment · 2026-11-22

As suggested in #mathlib4 > Bessel functions @ 💬, I extracted Complex.tsum_zpow_smul_eq_exp_smul for generating functions in a similar shape. There are a few other generating function that can use this (e.g. Bernoulli polynomials). I put it in a new file as I don't find a suitable place in existing once

mathlib-merge-conflicts[bot] · comment · 2026-12-03

This pull request has conflicts, please merge master and resolve them.

Mathlib.lean +1 −0

public import Mathlib.Analysis.SpecialFunctions.Gamma.Digamma
2469public import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform
2470public import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral
2471public import Mathlib.Analysis.SpecialFunctions.Gaussian.PoissonSummation
2472public import Mathlib.Analysis.SpecialFunctions.GeneratingFunction
2473public import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals
2474public import Mathlib.Analysis.SpecialFunctions.Integrability.Basic
2475public import Mathlib.Analysis.SpecialFunctions.Integrability.Log

Mathlib/Analysis/SpecialFunctions/Bessel.lean +69 −1

module
9public import Mathlib.Analysis.SpecialFunctions.RegularizedHypergeometric
11import Mathlib.Analysis.Analytic.IsolatedZeros
12import Mathlib.Analysis.Normed.Module.Connected
13import Mathlib.Analysis.SpecialFunctions.Complex.Analytic
14import Mathlib.Analysis.SpecialFunctions.GeneratingFunction
16/-!
17# Bessel function
$J_a(0) = 0$ for all complex $a \ne 0$. For $a = 0$, we have $J_0(0) = 1$.
40* Bessel function of the second kind
41* Differential equations
−* Generating functions
42* Bessel's integrals
43-/
theorem two_mul_deriv_besselJ (a : ℂ) {x : ℂ} (h : x ∈ slitPlane) :
170 linear_combination mul_deriv_besselJ_eq_besselJ_sub_one a h +
171 mul_deriv_besselJ_eq_besselJ_add_one a h
theorem hasDerivAt_besselJ newL173–177
173@[dlmf 10.6.E1]
174theorem hasDerivAt_besselJ (a : ℂ) {x : ℂ} (h : x ∈ slitPlane) :
175 HasDerivAt (J a) ((J (a - 1) x - J (a + 1) x) / 2) x := by
176 convert (analyticAt_besselJ a h).differentiableAt.hasDerivAt
177 linear_combination -two_mul_deriv_besselJ a h / 2
179@[dlmf 10.6.E1]
180theorem two_mul_deriv_besselJ_int (a : ℤ) (x : ℂ) :
181 2 * deriv (J a) x = J (a - 1) x - J (a + 1) x := by
theorem two_mul_deriv_besselJ_int (a : ℤ) (x : ℂ) :
185 refine (eventually_nhdsWithin_of_eventually_nhds (eventually_nhds_iff.mpr ?_)).frequently
186 exact ⟨slitPlane, fun x hx ↦ two_mul_deriv_besselJ a hx, isOpen_slitPlane, by simp⟩
theorem hasDerivAt_besselJ_int newL188–192
188@[dlmf 10.6.E1]
189theorem hasDerivAt_besselJ_int (a : ℤ) (x : ℂ) :
190 HasDerivAt (J a) ((J (a - 1) x - J (a + 1) x) / 2) x := by
191 convert (analyticAt_besselJ_int a x).differentiableAt.hasDerivAt
192 linear_combination -two_mul_deriv_besselJ_int a x / 2
194@[dlmf 10.6.E2]
195theorem mul_deriv_besselJ_eq_besselJ_add_one_int (a : ℤ) (x : ℂ) :
196 x * deriv (J a) x = a * J a x - x * J (a + 1) x := by
theorem mul_deriv_besselJ_eq_besselJ_sub_one_int (a : ℤ) (x : ℂ) :
201 x * deriv (J a) x = x * J (a - 1) x - a * J a x := by
202 linear_combination two_mul_self_mul_besselJ a x + mul_deriv_besselJ_eq_besselJ_add_one_int a x
theorem norm_besselJ_le_exp newL204–207
204theorem norm_besselJ_le_exp {a : ℂ} (ha : 0 ≤ a.re) (x : ℂ) :
205 ‖J a x‖ ≤ ‖Gamma (a + 1)‖⁻¹ * ‖(x / 2) ^ a‖ * Real.exp (‖x / 2‖ ^ 2) := by
206 grw [besselJ, norm_mul, norm_regularizedHGFun_le_exp_of_one_le_re (by simpa using ha)]
207 simp [mul_left_comm, mul_assoc]
theorem norm_besselJ_le_exp_int newL209–216
209theorem norm_besselJ_le_exp_int (a : ℤ) (x : ℂ) :
210 ‖J a x‖ ≤ (a.natAbs ! : ℝ)⁻¹ * ‖x / 2‖ ^ a.natAbs * Real.exp (‖x / 2‖ ^ 2) := by
211 wlog! ha : 0 ≤ a
212 · specialize this (-a) (-x) (by simpa using ha.le)
213 simpa [besselJ_neg_comm] using this
214 lift a to ℕ using ha
215 grw [norm_besselJ_le_exp (by simp)]
216 simp [Gamma_nat_eq_factorial]
218-- Within a bounded set, `t ^ a * J a x` can be bounded uniformly by exp series terms.
theorem zpow_mul_besselJ_le newL219–226
219private theorem zpow_mul_besselJ_le (t : ℂ) {s : Set ℂ} (hs : Bornology.IsBounded s) :
220 ∃ u v, ∀ a : ℤ, ∀ x ∈ s,
221 ‖t ^ a * J a x‖ ≤ (a.natAbs ! : ℝ)⁻¹ * (u ^ a.natAbs * ‖t ^ a‖) * v := by
222 obtain ⟨c, hc0, hc⟩ := hs.exists_pos_norm_le
223 refine ⟨c / 2, Real.exp ((c / 2) ^ 2), fun a y hy ↦ ?_⟩
224 have hy' : ‖y / 2‖ ≤ c / 2 := by simpa using div_le_div_of_nonneg_right (hc y hy) zero_le_two
225 grw [norm_mul, norm_besselJ_le_exp_int, hy', hy']
226 exact le_of_eq (by ring)
228-- The uniform bound on `t ^ a * J a x` is summable
theorem summable_bound newL229–235
229private theorem summable_bound (u v : ℝ) (t : ℂ) :
230 Summable fun a : ℤ ↦ (a.natAbs ! : ℝ)⁻¹ * (u ^ a.natAbs * ‖t ^ a‖) * v := by
231 refine summable_int_iff_summable_nat_and_neg.mpr ⟨?_, ?_⟩
232 · simpa [mul_pow] using
233 (NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) (u * ‖t‖)).summable.mul_right v
234 · simpa [mul_pow] using
235 (NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) (u * ‖t‖⁻¹)).summable.mul_right v
theorem tsum_zpow_mul_besselJ newL237–251
237/-- $f(t) = e^{x(t - t^{-1})/2}$ at $t = 0$ is the generating function for $J_a(x)$. -/
238@[dlmf 10.12.E1]
239theorem tsum_zpow_mul_besselJ (x : ℂ) {t : ℂ} (ht : t ≠ 0) :
240 ∑' a : ℤ, t ^ a * J a x = exp (x / 2 * (t - t⁻¹)) := by
241 suffices ∑' a : ℤ, t ^ a • J a x = exp (x / 2 * (t - t⁻¹)) by simpa
242 obtain ⟨u, v, h⟩ := zpow_mul_besselJ_le t (Metric.isBounded_ball (x := 0) (r := ‖x‖ + 1))
243 have (a : ℤ) (y : ℂ) (hy : y ∈ Metric.ball 0 (‖x‖ + 1)) :
244 HasDerivAt (J a) (∑ i, ![(1 / 2 : ℂ), -1 / 2] i • J (a - ![1, -1] i : ℤ) y) y := by
245 convert hasDerivAt_besselJ_int a y
246 simp
247 ring
248 rw [tsum_zpow_smul_eq_exp_smul Metric.isOpen_ball Metric.isPreconnected_ball this ht
249 (summable_bound u v t) h (Metric.mem_ball_self (by positivity)) (by simp)]
250 simp [besselJ_zero, Fin.sum_univ_two]
251 grind
theorem hasSum_zpow_mul_besselJ newL253–257
253theorem hasSum_zpow_mul_besselJ (x : ℂ) {t : ℂ} (ht : t ≠ 0) :
254 HasSum (fun a : ℤ ↦ t ^ a * J a x) (exp (x / 2 * (t - t⁻¹))) :=
255 let ⟨u, v, h⟩ := zpow_mul_besselJ_le t (Bornology.isBounded_singleton (x := x))
256 ((summable_bound u v t).of_norm_bounded fun a ↦ h a x (Set.mem_singleton x)).hasSum_iff.mpr
257 (tsum_zpow_mul_besselJ x ht)
259end Complex

Mathlib/Analysis/SpecialFunctions/GeneratingFunction.lean +66 −0 new file

1/-
2Copyright (c) 2026 Weiyi Wang. All rights reserved.
3Released under Apache 2.0 license as described in the file LICENSE.
4Authors: Weiyi Wang
5-/
6
7module
8
9public import Mathlib.Analysis.Calculus.Deriv.Basic
10public import Mathlib.Analysis.Complex.Basic
11public import Mathlib.Analysis.Complex.Exponential
13import Mathlib.Analysis.Complex.LocallyUniformLimit
15/-!
16# Miscellaneous lemmas about generating functions
17-/
19public section
21namespace Complex
theorem tsum_zpow_smul_eq_exp_smul newL23–64
23/-- If a family of functions `f : ℤ → ℂ → E` satisfies the equation
24`deriv (f k) x = ∑ i ∈ s, c i • f (k - p i) x`, then its generating function satisfies
25`∑' k, t ^ k • f k x = exp ((x - x₀) * ∑ i ∈ s, c i * t ^ p i) • C`, where
26`C = ∑' k, t ^ k • f k x₀` is a constant determined by a fixed point `x₀`. We require bound on
27`t ^ k • f k x` uniform over `x` to ensure exchangeability of summation and derivative. -/
28theorem tsum_zpow_smul_eq_exp_smul {ι : Type*} {s : Finset ι} {c : ι → ℂ} {p : ι → ℤ}
29 {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E]
30 {U : Set ℂ} (hU : IsOpen U) (hUc : IsPreconnected U)
31 {f : ℤ → ℂ → E} (hderiv : ∀ k, ∀ x ∈ U, HasDerivAt (f k) (∑ i ∈ s, c i • f (k - p i) x) x)
32 {t : ℂ} (ht : t ≠ 0) {u : ℤ → ℝ} (hu : Summable u)
33 (hbound : ∀ k, ∀ x ∈ U, ‖t ^ k • f k x‖ ≤ u k) {x₀ x : ℂ} (hx₀ : x₀ ∈ U) (hx : x ∈ U) :
34 ∑' k, t ^ k • f k x = exp ((x - x₀) * ∑ i ∈ s, c i * t ^ p i) • (∑' k, t ^ k • f k x₀) := by
35 have hdiff (k : ℤ) : DifferentiableOn ℂ (t ^ k • f k ·) U := fun x hx ↦
36 ((hderiv k x hx).differentiableAt.const_smul _).differentiableWithinAt
37 set w := ∑ i ∈ s, c i * t ^ p i
38 set g := fun x ↦ ∑' k, t ^ k • f k x
39 have hg : DifferentiableOn ℂ g U := differentiableOn_tsum_of_summable_norm hu hdiff hU hbound
40 suffices ∀ x ∈ U, deriv (fun x ↦ exp (x * -w) • g x) x = 0 by
41 rw [← neg_sub, neg_mul, ← mul_neg, sub_mul, exp_sub, div_eq_mul_inv, mul_comm, ← smul_smul,
42 eq_inv_smul_iff₀ (exp_ne_zero _)]
43 exact hU.is_const_of_deriv_eq_zero hUc (by fun_prop) this hx hx₀
44 intro x hx
45 suffices deriv g x = w • g x by
46 rw [deriv_fun_smul (by fun_prop) ((hg x hx).differentiableAt (hU.mem_nhds hx)), this,
47 deriv_cexp (by fun_prop)]
48 simp
49 module
50 calc
51 _ = ∑' k, deriv (fun w ↦ t ^ k • f k w) x :=
52 (hasSum_deriv_of_summable_norm hu hdiff hU hbound hx).tsum_eq.symm
53 _ = ∑' k, ∑ i ∈ s, (c i * t ^ p i) • (t ^ (k - p i) • f (k - p i) x) := by
54 congr with k
55 rw [((hderiv k x hx).fun_const_smul (t ^ k)).deriv, Finset.smul_sum]
56 congr with i
57 rw [smul_smul, smul_smul, mul_assoc, ← zpow_add₀ ht, add_sub_cancel, mul_comm]
58 _ = ∑ i ∈ s, ∑' k, (c i * t ^ p i) • (t ^ (k - p i) • f (k - p i) x) := by
59 refine Summable.tsum_finsetSum fun i _ ↦ .const_smul _ ?_
60 simpa [Function.comp_def] using
61 (Equiv.subRight (p i)).summable_iff.mpr (hu.of_norm_bounded (hbound · x hx))
62 _ = _ := by
63 simp_rw [w, Finset.sum_smul, tsum_const_smul'']
64 congrm ∑ i ∈ s, _ • $((Equiv.subRight (p i)).tsum_eq fun k ↦ t ^ k • f k x)
66end Complex

Mathlib/Analysis/SpecialFunctions/RegularizedHypergeometric.lean +17 −0

theorem deriv_regularizedHGFun {z : ℂ} (hz : ‖z‖ₑ < (regularizedHGFunSer
435end Derivative
theorem norm_regularizedHGFun_le_exp_of_one_le_re newL437–452
437theorem norm_regularizedHGFun_le_exp_of_one_le_re (h : ∀ u ∈ b, 1 ≤ u.re) (z : ℂ) :
438 ‖regularizedHGFun 0 b z‖ ≤ ‖(b.map Gamma).prod‖⁻¹ * Real.exp ‖z‖ := by
439 rw [Real.exp_eq_exp_ℝ]
440 apply ((regularizedHGFunSeries 0 b).hasSum (show z ∈ _ by simp)).norm_le_of_bounded
441 ((NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) ‖z‖).mul_left ‖(b.map Gamma).prod‖⁻¹)
442 intro n
443 suffices ‖(Multiset.map (fun x ↦ Gamma (x + ↑n)) b).prod‖⁻¹ ≤ ‖(b.map Gamma).prod‖⁻¹ by
444 grw [← this]
445 apply le_of_eq
446 simp [regularizedHGFunCoeff]
447 ring
448 simp_rw [Multiset.norm_prod_map, ← Multiset.prod_map_inv]
449 refine Multiset.prod_map_le_prod_map₀ _ _ (by simp) fun u hu ↦ ?_
450 apply inv_le_of_inv_le₀ (by grind [inv_pos, norm_pos_iff, neg_re, natCast_re])
451 rw [inv_inv]
452 exact norm_Gamma_le_norm_Gamma_add_of_one_le_re (h u hu) n
454section ZeroZero
456/-- The regularized hypergeometric series with `a = b = 0` is exponential series. -/
0/10 declarations checked

Your review, as Markdown

Paste it as a comment or a review on the PR. Line links to the head commit unfold into code snippets on GitHub.