Skip to content

Commit 94d40e8

Browse files
committed
feat(RingTheory/PowerSeries): split off Exp.lean (#34256)
The new file `RingTheory/PowerSeries/Exp.lean` takes definition and theorems from `RingTheory/PowerSeries/Wellknown.lean`, and tweaks one import in `NumberTheory/Bernoulli.lean`.
1 parent 8dab25d commit 94d40e8

File tree

4 files changed

+125
-80
lines changed

4 files changed

+125
-80
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6294,6 +6294,7 @@ public import Mathlib.RingTheory.PowerSeries.Catalan
62946294
public import Mathlib.RingTheory.PowerSeries.CoeffMulMem
62956295
public import Mathlib.RingTheory.PowerSeries.Derivative
62966296
public import Mathlib.RingTheory.PowerSeries.Evaluation
6297+
public import Mathlib.RingTheory.PowerSeries.Exp
62976298
public import Mathlib.RingTheory.PowerSeries.Expand
62986299
public import Mathlib.RingTheory.PowerSeries.GaussNorm
62996300
public import Mathlib.RingTheory.PowerSeries.Ideal

Mathlib/NumberTheory/Bernoulli.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module
77

88
public import Mathlib.Algebra.BigOperators.Field
99
public import Mathlib.RingTheory.PowerSeries.Inverse
10-
public import Mathlib.RingTheory.PowerSeries.WellKnown
10+
public import Mathlib.RingTheory.PowerSeries.Exp
1111

1212
/-!
1313
# Bernoulli numbers
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/-
2+
Copyright (c) 2026 Mathlib contributors. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Mathlib contributors
5+
-/
6+
module
7+
8+
public import Mathlib.Algebra.Algebra.Rat
9+
public import Mathlib.Data.Nat.Cast.Field
10+
public import Mathlib.RingTheory.PowerSeries.Basic
11+
12+
/-!
13+
# Exponential Power Series
14+
15+
This file defines the exponential power series `exp A = ∑ Xⁿ/n!` over ℚ-algebras.
16+
17+
## Main definitions
18+
19+
* `PowerSeries.exp`: The exponential power series `exp A = ∑ Xⁿ/n!` over a ℚ-algebra `A`.
20+
21+
## Main results
22+
23+
* `PowerSeries.coeff_exp`: The coefficient of `exp A` at `n` is `1/n!`.
24+
* `PowerSeries.constantCoeff_exp`: The constant term of `exp A` is `1`.
25+
* `PowerSeries.map_exp`: `exp` is preserved by ring homomorphisms between ℚ-algebras.
26+
* `PowerSeries.exp_mul_exp_eq_exp_add`: The functional equation `e^{aX} * e^{bX} = e^{(a+b)X}`.
27+
* `PowerSeries.exp_mul_exp_neg_eq_one`: The identity `e^X * e^{-X} = 1`.
28+
* `PowerSeries.exp_pow_eq_rescale_exp`: Powers of exp satisfy `(e^X)^k = e^{kX}`.
29+
* `PowerSeries.exp_pow_sum`: Formula for the sum of powers of `exp`.
30+
-/
31+
32+
@[expose] public section
33+
34+
namespace PowerSeries
35+
36+
variable (A A' : Type*) [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A']
37+
38+
open Nat
39+
40+
/-- Power series for the exponential function at zero. -/
41+
def exp : PowerSeries A :=
42+
mk fun n => algebraMap ℚ A (1 / n !)
43+
44+
variable {A A'} (n : ℕ)
45+
46+
variable (f : A →+* A')
47+
48+
@[simp]
49+
theorem coeff_exp : coeff n (exp A) = algebraMap ℚ A (1 / n !) :=
50+
coeff_mk _ _
51+
52+
@[simp]
53+
theorem constantCoeff_exp : constantCoeff (exp A) = 1 := by
54+
rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp]
55+
simp
56+
57+
@[simp]
58+
theorem map_exp : map (f : A →+* A') (exp A) = exp A' := by
59+
ext
60+
simp
61+
62+
open RingHom
63+
64+
open Finset Nat
65+
66+
variable {A : Type*} [CommRing A]
67+
68+
/-- Shows that $e^{aX} * e^{bX} = e^{(a + b)X}$ -/
69+
theorem exp_mul_exp_eq_exp_add [Algebra ℚ A] (a b : A) :
70+
rescale a (exp A) * rescale b (exp A) = rescale (a + b) (exp A) := by
71+
ext n
72+
simp only [coeff_mul, exp, rescale, coeff_mk, MonoidHom.coe_mk, OneHom.coe_mk, coe_mk,
73+
Nat.sum_antidiagonal_eq_sum_range_succ_mk, add_pow, sum_mul]
74+
apply sum_congr rfl
75+
rintro x hx
76+
suffices
77+
a ^ x * b ^ (n - x) *
78+
(algebraMap ℚ A (1 / ↑x.factorial) * algebraMap ℚ A (1 / ↑(n - x).factorial)) =
79+
a ^ x * b ^ (n - x) * (↑(n.choose x) * (algebraMap ℚ A) (1 / ↑n.factorial))
80+
by convert this using 1 <;> ring
81+
congr 1
82+
rw [← map_natCast (algebraMap ℚ A) (n.choose x), ← map_mul, ← map_mul]
83+
refine RingHom.congr_arg _ ?_
84+
rw [mul_one_div (↑(n.choose x) : ℚ), one_div_mul_one_div]
85+
symm
86+
rw [div_eq_iff, div_mul_eq_mul_div, one_mul, choose_eq_factorial_div_factorial]
87+
· norm_cast
88+
rw [cast_div_charZero]
89+
apply factorial_mul_factorial_dvd_factorial (mem_range_succ_iff.1 hx)
90+
· apply mem_range_succ_iff.1 hx
91+
· rintro h
92+
apply factorial_ne_zero n
93+
rw [cast_eq_zero.1 h]
94+
95+
/-- Shows that $e^{x} * e^{-x} = 1$ -/
96+
theorem exp_mul_exp_neg_eq_one [Algebra ℚ A] : exp A * evalNegHom (exp A) = 1 := by
97+
convert exp_mul_exp_eq_exp_add (1 : A) (-1) <;> simp
98+
99+
/-- Shows that $(e^{X})^k = e^{kX}$. -/
100+
theorem exp_pow_eq_rescale_exp [Algebra ℚ A] (k : ℕ) : exp A ^ k = rescale (k : A) (exp A) := by
101+
induction k with
102+
| zero =>
103+
simp only [rescale_zero, constantCoeff_exp, Function.comp_apply, map_one, cast_zero,
104+
pow_zero (exp A), coe_comp]
105+
| succ k h =>
106+
simpa only [succ_eq_add_one, cast_add, ← exp_mul_exp_eq_exp_add (k : A), ← h, cast_one,
107+
id_apply, rescale_one] using pow_succ (exp A) k
108+
109+
/-- Shows that
110+
$\sum_{k = 0}^{n - 1} (e^{X})^k = \sum_{p = 0}^{\infty} \sum_{k = 0}^{n - 1} \frac{k^p}{p!}X^p$. -/
111+
theorem exp_pow_sum [Algebra ℚ A] (n : ℕ) :
112+
((Finset.range n).sum fun k => exp A ^ k) =
113+
PowerSeries.mk fun p => (Finset.range n).sum
114+
fun k => (k ^ p : A) * algebraMap ℚ A p.factorial⁻¹ := by
115+
simp only [exp_pow_eq_rescale_exp, rescale]
116+
ext
117+
simp only [one_div, coeff_mk, coe_mk, MonoidHom.coe_mk, OneHom.coe_mk,
118+
coeff_exp, map_sum]
119+
120+
end PowerSeries
121+
122+
end

Mathlib/RingTheory/PowerSeries/WellKnown.lean

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Authors: Yury Kudryashov
66
module
77

88
public import Mathlib.Algebra.Algebra.Rat
9-
public import Mathlib.Data.Nat.Cast.Field
109
public import Mathlib.RingTheory.PowerSeries.Basic
1110

1211
/-!
@@ -181,10 +180,6 @@ variable (A A' : Type*) [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A']
181180

182181
open Nat
183182

184-
/-- Power series for the exponential function at zero. -/
185-
def exp : PowerSeries A :=
186-
mk fun n => algebraMap ℚ A (1 / n !)
187-
188183
/-- Power series for the sine function at zero. -/
189184
def sin : PowerSeries A :=
190185
mk fun n => if Even n then 0 else algebraMap ℚ A ((-1) ^ (n / 2) / n !)
@@ -193,23 +188,7 @@ def sin : PowerSeries A :=
193188
def cos : PowerSeries A :=
194189
mk fun n => if Even n then algebraMap ℚ A ((-1) ^ (n / 2) / n !) else 0
195190

196-
variable {A A'} (n : ℕ)
197-
198-
@[simp]
199-
theorem coeff_exp : coeff n (exp A) = algebraMap ℚ A (1 / n !) :=
200-
coeff_mk _ _
201-
202-
@[simp]
203-
theorem constantCoeff_exp : constantCoeff (exp A) = 1 := by
204-
rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp]
205-
simp
206-
207-
variable (f : A →+* A')
208-
209-
@[simp]
210-
theorem map_exp : map (f : A →+* A') (exp A) = exp A' := by
211-
ext
212-
simp
191+
variable {A A'} (n : ℕ) (f : A →+* A')
213192

214193
@[simp]
215194
theorem map_sin : map f (sin A) = sin A' := by
@@ -223,62 +202,5 @@ theorem map_cos : map f (cos A) = cos A' := by
223202

224203
end Field
225204

226-
open RingHom
227-
228-
open Finset Nat
229-
230-
variable {A : Type*} [CommRing A]
231-
232-
/-- Shows that $e^{aX} * e^{bX} = e^{(a + b)X}$ -/
233-
theorem exp_mul_exp_eq_exp_add [Algebra ℚ A] (a b : A) :
234-
rescale a (exp A) * rescale b (exp A) = rescale (a + b) (exp A) := by
235-
ext n
236-
simp only [coeff_mul, exp, rescale, coeff_mk, MonoidHom.coe_mk, OneHom.coe_mk, coe_mk,
237-
Nat.sum_antidiagonal_eq_sum_range_succ_mk, add_pow, sum_mul]
238-
apply sum_congr rfl
239-
rintro x hx
240-
suffices
241-
a ^ x * b ^ (n - x) *
242-
(algebraMap ℚ A (1 / ↑x.factorial) * algebraMap ℚ A (1 / ↑(n - x).factorial)) =
243-
a ^ x * b ^ (n - x) * (↑(n.choose x) * (algebraMap ℚ A) (1 / ↑n.factorial))
244-
by convert this using 1 <;> ring
245-
congr 1
246-
rw [← map_natCast (algebraMap ℚ A) (n.choose x), ← map_mul, ← map_mul]
247-
refine RingHom.congr_arg _ ?_
248-
rw [mul_one_div (↑(n.choose x) : ℚ), one_div_mul_one_div]
249-
symm
250-
rw [div_eq_iff, div_mul_eq_mul_div, one_mul, choose_eq_factorial_div_factorial]
251-
· norm_cast
252-
rw [cast_div_charZero]
253-
apply factorial_mul_factorial_dvd_factorial (mem_range_succ_iff.1 hx)
254-
· apply mem_range_succ_iff.1 hx
255-
· rintro h
256-
apply factorial_ne_zero n
257-
rw [cast_eq_zero.1 h]
258-
259-
/-- Shows that $e^{x} * e^{-x} = 1$ -/
260-
theorem exp_mul_exp_neg_eq_one [Algebra ℚ A] : exp A * evalNegHom (exp A) = 1 := by
261-
convert exp_mul_exp_eq_exp_add (1 : A) (-1) <;> simp
262-
263-
/-- Shows that $(e^{X})^k = e^{kX}$. -/
264-
theorem exp_pow_eq_rescale_exp [Algebra ℚ A] (k : ℕ) : exp A ^ k = rescale (k : A) (exp A) := by
265-
induction k with
266-
| zero =>
267-
simp only [rescale_zero, constantCoeff_exp, Function.comp_apply, map_one, cast_zero,
268-
pow_zero (exp A), coe_comp]
269-
| succ k h =>
270-
simpa only [succ_eq_add_one, cast_add, ← exp_mul_exp_eq_exp_add (k : A), ← h, cast_one,
271-
id_apply, rescale_one] using pow_succ (exp A) k
272-
273-
/-- Shows that
274-
$\sum_{k = 0}^{n - 1} (e^{X})^k = \sum_{p = 0}^{\infty} \sum_{k = 0}^{n - 1} \frac{k^p}{p!}X^p$. -/
275-
theorem exp_pow_sum [Algebra ℚ A] (n : ℕ) :
276-
((Finset.range n).sum fun k => exp A ^ k) =
277-
PowerSeries.mk fun p => (Finset.range n).sum
278-
fun k => (k ^ p : A) * algebraMap ℚ A p.factorial⁻¹ := by
279-
simp only [exp_pow_eq_rescale_exp, rescale]
280-
ext
281-
simp only [one_div, coeff_mk, coe_mk, MonoidHom.coe_mk, OneHom.coe_mk,
282-
coeff_exp, map_sum]
283205

284206
end PowerSeries

0 commit comments

Comments
 (0)