|
| 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 |
0 commit comments