Download data/lean/OAI/NumberTheory/PiExponent/Jets/CommutingTaylor.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.44 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PiExponent/Jets/CommutingTaylor.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/PiExponent/Jets/CommutingTaylor.lean
-
curl -L -o CommutingTaylor.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PiExponent/Jets/CommutingTaylor.lean
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 | |