math / data /lean /OAI /NumberTheory /PiExponent /Jets /CommutingTaylor.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
9.44 kB
import Mathlib
namespace OAI
noncomputable section
namespace PiExponent.CommutingTaylor
open Finset Nat
variable {R : Type*} [CommRing R] [Algebra β„š R]
def iter (D : Derivation β„š R R) (n : β„•) : R β†’β‚—[β„š] R := D.toLinearMap ^ n
@[simp] theorem iter_zero (D : Derivation β„š R R) (a : R) : iter D 0 a = a := rfl
@[simp] theorem iter_succ (D : Derivation β„š R R) (n : β„•) (a : R) :
iter D (n+1) a = D (iter D n a) := by
change (D.toLinearMap ^ (n + 1)) a = D ((D.toLinearMap ^ n) a)
calc
(D.toLinearMap ^ (n + 1)) a = (D.toLinearMap * D.toLinearMap ^ n) a :=
congrArg (fun f : Module.End β„š R => f a) (_root_.pow_succ' D.toLinearMap n)
_ = D.toLinearMap ((D.toLinearMap ^ n) a) :=
Module.End.mul_apply D.toLinearMap (D.toLinearMap ^ n) a
_ = D ((D.toLinearMap ^ n) a) :=
congrFun (Derivation.coeFn_coe D) ((D.toLinearMap ^ n) a)
theorem iter_mul (D : Derivation β„š R R) (n : β„•) (a b : R) :
iter D n (a*b) = βˆ‘ ij ∈ antidiagonal n,
n.choose ij.1 β€’ (iter D ij.1 a * iter D ij.2 b) := by
induction n with
| zero => simp
| succ n ih =>
rw [sum_antidiagonal_choose_succ_nsmul
(fun i j => iter D i a * iter D j b) n]
simp only [iter_succ, ih, map_sum, map_nsmul, Derivation.leibniz,
smul_eq_mul, nsmul_add, Finset.sum_add_distrib]
congr 1
apply Finset.sum_congr rfl
intro ij hij
rw [n.choose_symm_of_eq_add (mem_antidiagonal.mp hij).symm]
rw [mul_comm]
private theorem factorial_normalize (i j : β„•) :
(1 / ((i+j).factorial : β„š)) * ((i+j).choose i : β„š) =
(1 / (i.factorial : β„š)) * (1 / (j.factorial : β„š)) := by
have h : (((i+j).choose i : β„š) * (i.factorial : β„š) * (j.factorial : β„š)) =
((i+j).factorial : β„š) := by
exact_mod_cast (by
simpa using Nat.choose_mul_factorial_mul_factorial (Nat.le_add_right i j) :
(i+j).choose i * i.factorial * j.factorial = (i+j).factorial)
have hi : (i.factorial : β„š) β‰  0 := by exact_mod_cast Nat.factorial_ne_zero i
have hj : (j.factorial : β„š) β‰  0 := by exact_mod_cast Nat.factorial_ne_zero j
have hn : ((i+j).factorial : β„š) β‰  0 := by exact_mod_cast Nat.factorial_ne_zero (i+j)
field_simp
nlinarith [h]
def taylorSeries (D : Derivation β„š R R) (a : R) : PowerSeries R :=
PowerSeries.mk fun n => (1 / (n.factorial : β„š)) β€’ iter D n a
@[simp] theorem coeff_taylorSeries (D : Derivation β„š R R) (a : R) (n : β„•) :
PowerSeries.coeff n (taylorSeries D a) = (1 / (n.factorial : β„š)) β€’ iter D n a := by
exact PowerSeries.coeff_mk n _
theorem taylorSeries_mul (D : Derivation β„š R R) (a b : R) :
taylorSeries D (a*b) = taylorSeries D a * taylorSeries D b := by
ext n
rw [PowerSeries.coeff_mul, coeff_taylorSeries, iter_mul, Finset.smul_sum]
apply Finset.sum_congr rfl
intro ij hij
have hn : ij.1 + ij.2 = n := mem_antidiagonal.mp hij
rw [coeff_taylorSeries, coeff_taylorSeries]
rw [← Nat.cast_smul_eq_nsmul β„š, smul_smul, smul_mul_smul_comm]
rw [← hn, factorial_normalize]
def taylorHom (D : Derivation β„š R R) : R β†’+* PowerSeries R where
toFun := taylorSeries D
map_zero' := by ext n; simp [taylorSeries]
map_one' := by
ext n
cases n with
| zero => simp [taylorSeries]
| succ n =>
have h : iter D (n+1) (1:R) = 0 := by
induction n with
| zero => simp
| succ n ih => simp [ih]
simp [taylorSeries, h]
map_add' a b := by ext n; simp [taylorSeries, smul_add]
map_mul' := taylorSeries_mul D
@[simp] theorem coeff_taylorHom (D : Derivation β„š R R) (a : R) (n : β„•) :
PowerSeries.coeff n (taylorHom D a) = (1 / (n.factorial : β„š)) β€’ iter D n a := by
exact coeff_taylorSeries D a n
@[simp] theorem constantCoeff_taylorHom (D : Derivation β„š R R) (a : R) :
PowerSeries.constantCoeff (taylorHom D a) = a := by
rw [← PowerSeries.coeff_zero_eq_constantCoeff_apply, coeff_taylorHom]
simp
def mixedIter : (m : β„•) β†’ (Fin m β†’ Derivation β„š R R) β†’ (Fin m β†’β‚€ β„•) β†’ R β†’β‚—[β„š] R
| 0, _, _ => LinearMap.id
| m+1, D, Ξ± => (mixedIter m (fun i => D i.succ) Ξ±.tail).comp (iter (D 0) (Ξ± 0))
def taylorHomFin : (m : β„•) β†’ (Fin m β†’ Derivation β„š R R) β†’ R β†’+* MvPowerSeries (Fin m) R
| 0, _ => MvPowerSeries.C
| m+1, D => (MvPowerSeries.finSuccEquiv R m).symm.toRingHom.comp
((PowerSeries.map (taylorHomFin m (fun i => D i.succ))).comp (taylorHom (D 0)))
theorem coeff_taylorHomFin (m : β„•) (D : Fin m β†’ Derivation β„š R R)
(Ξ± : Fin m β†’β‚€ β„•) (a : R) :
MvPowerSeries.coeff Ξ± (taylorHomFin m D a) =
(∏ i, (1 / ((Ξ± i).factorial : β„š))) β€’ mixedIter m D Ξ± a := by
induction m generalizing a with
| zero =>
have hΞ± : Ξ± = 0 := Subsingleton.elim _ _
simp [taylorHomFin, mixedIter, hΞ±]
| succ m ih =>
have hcoeff := MvPowerSeries.coeff_coeff_finSuccEquiv
((MvPowerSeries.finSuccEquiv R m).symm
(PowerSeries.map (taylorHomFin m (fun i => D i.succ)) (taylorHom (D 0) a)))
(k := Ξ± 0) (x := Ξ±.tail)
simp only [AlgEquiv.apply_symm_apply] at hcoeff
rw [show Ξ±.tail.cons (Ξ± 0) = Ξ± by ext i; refine Fin.cases ?_ (fun j => ?_) i <;> simp] at hcoeff
rw [taylorHomFin, RingHom.comp_apply, RingHom.comp_apply]
change MvPowerSeries.coeff Ξ± ((MvPowerSeries.finSuccEquiv R m).symm
(PowerSeries.map (taylorHomFin m (fun i => D i.succ)) (taylorHom (D 0) a))) = _
rw [← hcoeff, PowerSeries.coeff_map, coeff_taylorHom, ih]
simp only [map_smul, mixedIter, LinearMap.comp_apply, Fin.prod_univ_succ,
Finsupp.tail_apply, smul_smul]
rw [mul_comm]
@[simp] theorem mixedIter_zero (m : β„•) (D : Fin m β†’ Derivation β„š R R) (a : R) :
mixedIter m D 0 a = a := by
induction m generalizing a with
| zero => rfl
| succ m ih =>
have ht : (0 : Fin (m+1) β†’β‚€ β„•).tail = 0 := by ext i; rfl
simp [mixedIter, ht, ih]
@[simp] theorem mixedIter_single (m : β„•) (D : Fin m β†’ Derivation β„š R R)
(i : Fin m) (a : R) : mixedIter m D (Finsupp.single i 1) a = D i a := by
induction m generalizing a with
| zero => exact Fin.elim0 i
| succ m ih =>
refine Fin.cases ?_ (fun j => ?_) i
Β· rw [← Finsupp.cons_zero_eq_single_zero]
simp [mixedIter, iter]
Β· rw [← Finsupp.cons_zero_single_eq_single_succ]
simp [mixedIter, ih]
@[simp] theorem coeff_zero_taylorHomFin (m : β„•) (D : Fin m β†’ Derivation β„š R R) (a : R) :
MvPowerSeries.coeff 0 (taylorHomFin m D a) = a := by
simp [coeff_taylorHomFin]
@[simp] theorem coeff_single_taylorHomFin (m : β„•) (D : Fin m β†’ Derivation β„š R R)
(i : Fin m) (a : R) :
MvPowerSeries.coeff (Finsupp.single i 1) (taylorHomFin m D a) = D i a := by
rw [coeff_taylorHomFin, mixedIter_single]
have h : (∏ j : Fin m, (1 / ((Finsupp.single i 1 j).factorial : β„š))) = 1 := by
apply Finset.prod_eq_one
intro j hj
by_cases he : i = j <;> simp [he]
rw [h, one_smul]
def residueTaylorFin {K : Type*} [CommRing K]
(m : β„•) (D : Fin m β†’ Derivation β„š R R) (ρ : R β†’+* K) :
R β†’+* MvPowerSeries (Fin m) K :=
(MvPowerSeries.map ρ).comp (taylorHomFin m D)
theorem coeff_residueTaylorFin {K : Type*} [CommRing K] [Algebra β„š K]
(m : β„•) (D : Fin m β†’ Derivation β„š R R) (ρ : R β†’+* K)
(Ξ± : Fin m β†’β‚€ β„•) (a : R) :
MvPowerSeries.coeff α (residueTaylorFin m D ρ a) =
(∏ i, (1 / ((Ξ± i).factorial : β„š))) β€’ ρ (mixedIter m D Ξ± a) := by
simp [residueTaylorFin, coeff_taylorHomFin, map_rat_smul]
@[simp] theorem coeff_zero_residueTaylorFin {K : Type*} [CommRing K]
(m : β„•) (D : Fin m β†’ Derivation β„š R R) (ρ : R β†’+* K) (a : R) :
MvPowerSeries.coeff 0 (residueTaylorFin m D ρ a) = ρ a := by
simp [residueTaylorFin]
@[simp] theorem coeff_single_residueTaylorFin {K : Type*} [CommRing K]
(m : β„•) (D : Fin m β†’ Derivation β„š R R) (ρ : R β†’+* K) (i : Fin m) (a : R) :
MvPowerSeries.coeff (Finsupp.single i 1) (residueTaylorFin m D ρ a) = ρ (D i a) := by
simp [residueTaylorFin]
@[simp] theorem constantCoeff_residueTaylorFin {K : Type*} [CommRing K]
(m : β„•) (D : Fin m β†’ Derivation β„š R R) (ρ : R β†’+* K) (a : R) :
MvPowerSeries.constantCoeff (residueTaylorFin m D ρ a) = ρ a := by
rw [← MvPowerSeries.coeff_zero_eq_constantCoeff_apply]
exact coeff_zero_residueTaylorFin m D ρ a
theorem constantCoeff_comp_residueTaylorFin {K : Type*} [CommRing K]
(m : β„•) (D : Fin m β†’ Derivation β„š R R) (ρ : R β†’+* K) :
MvPowerSeries.constantCoeff.comp (residueTaylorFin m D ρ) = ρ := by
ext a
exact constantCoeff_residueTaylorFin m D ρ a
theorem iter_commute (D E : Derivation β„š R R)
(h : Commute D.toLinearMap E.toLinearMap) (i j : β„•) (a : R) :
iter D i (iter E j a) = iter E j (iter D i a) := by
exact LinearMap.congr_fun ((h.pow_left i).pow_right j).eq a
theorem mixedIter_commute (m : β„•) (D : Fin m β†’ Derivation β„š R R)
(E : Derivation β„š R R) (Ξ± : Fin m β†’β‚€ β„•)
(h : βˆ€ i, Commute (D i).toLinearMap E.toLinearMap) (a : R) :
mixedIter m D Ξ± (E a) = E (mixedIter m D Ξ± a) := by
induction m generalizing a with
| zero => rfl
| succ m ih =>
simp only [mixedIter, LinearMap.comp_apply]
rw [show iter (D 0) (Ξ± 0) (E a) = E (iter (D 0) (Ξ± 0) a) from
iter_commute (D 0) E (h 0) (Ξ± 0) 1 a]
exact ih (fun i => D i.succ) Ξ±.tail (fun i => h i.succ) _
end PiExponent.CommutingTaylor
end
end OAI