state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
R : Type u
instβΒ² : CommRing R
A : Type v
instβΒΉ : Ring A
instβ : Algebra R A
A' : Subalgebra R A
srcβ : Submodule R A := Subalgebra.toSubmodule A'
x y : A
hx :
x β
{ toAddSubmonoid := srcβ.toAddSubmonoid,
smul_mem' :=
(_ :
β (c : R) {x : A}, x β srcβ.carrier β c β’ x β srcβ.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier
hy :
y β
{ toAddSubmonoid := srcβ.toAddSubmonoid,
smul_mem' :=
(_ :
β (c : R) {x : A}, x β srcβ.carrier β c β’ x β srcβ.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier
β’ β
x, yβ β
{ toAddSubmonoid := srcβ.toAddSubmonoid,
smul_mem' :=
(_ :
β (c : R) {x : A}, x β srcβ.carrier β c β’ x β srcβ.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
| change β
x, yβ β A' | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
| Mathlib.Algebra.Lie.OfAssociative.322_0.ll51mLev4p7Z1wP | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
instβΒ² : CommRing R
A : Type v
instβΒΉ : Ring A
instβ : Algebra R A
A' : Subalgebra R A
srcβ : Submodule R A := Subalgebra.toSubmodule A'
x y : A
hx :
x β
{ toAddSubmonoid := srcβ.toAddSubmonoid,
smul_mem' :=
(_ :
β (c : R) {x : A}, x β srcβ.carrier β c β’ x β srcβ.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier
hy :
y β
{ toAddSubmonoid := srcβ.toAddSubmonoid,
smul_mem' :=
(_ :
β (c : R) {x : A}, x β srcβ.carrier β c β’ x β srcβ.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier
β’ β
x, yβ β A' | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; | change x β A' at hx | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; | Mathlib.Algebra.Lie.OfAssociative.322_0.ll51mLev4p7Z1wP | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
instβΒ² : CommRing R
A : Type v
instβΒΉ : Ring A
instβ : Algebra R A
A' : Subalgebra R A
srcβ : Submodule R A := Subalgebra.toSubmodule A'
x y : A
hy :
y β
{ toAddSubmonoid := srcβ.toAddSubmonoid,
smul_mem' :=
(_ :
β (c : R) {x : A}, x β srcβ.carrier β c β’ x β srcβ.carrier) }.toAddSubmonoid.toAddSubsemigroup.carrier
hx : x β A'
β’ β
x, yβ β A' | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; | change y β A' at hy | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; | Mathlib.Algebra.Lie.OfAssociative.322_0.ll51mLev4p7Z1wP | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
instβΒ² : CommRing R
A : Type v
instβΒΉ : Ring A
instβ : Algebra R A
A' : Subalgebra R A
srcβ : Submodule R A := Subalgebra.toSubmodule A'
x y : A
hx : x β A'
hy : y β A'
β’ β
x, yβ β A' | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
| rw [LieRing.of_associative_ring_bracket] | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
| Mathlib.Algebra.Lie.OfAssociative.322_0.ll51mLev4p7Z1wP | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
instβΒ² : CommRing R
A : Type v
instβΒΉ : Ring A
instβ : Algebra R A
A' : Subalgebra R A
srcβ : Submodule R A := Subalgebra.toSubmodule A'
x y : A
hx : x β A'
hy : y β A'
β’ x * y - y * x β A' | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
| have hxy := A'.mul_mem hx hy | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
| Mathlib.Algebra.Lie.OfAssociative.322_0.ll51mLev4p7Z1wP | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
instβΒ² : CommRing R
A : Type v
instβΒΉ : Ring A
instβ : Algebra R A
A' : Subalgebra R A
srcβ : Submodule R A := Subalgebra.toSubmodule A'
x y : A
hx : x β A'
hy : y β A'
hxy : x * y β A'
β’ x * y - y * x β A' | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
have hxy := A'.mul_mem hx hy
| have hyx := A'.mul_mem hy hx | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
have hxy := A'.mul_mem hx hy
| Mathlib.Algebra.Lie.OfAssociative.322_0.ll51mLev4p7Z1wP | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
instβΒ² : CommRing R
A : Type v
instβΒΉ : Ring A
instβ : Algebra R A
A' : Subalgebra R A
srcβ : Submodule R A := Subalgebra.toSubmodule A'
x y : A
hx : x β A'
hy : y β A'
hxy : x * y β A'
hyx : y * x β A'
β’ x * y - y * x β A' | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
have hxy := A'.mul_mem hx hy
have hyx := A'.mul_mem hy hx
| exact Submodule.sub_mem (Subalgebra.toSubmodule A') hxy hyx | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
have hxy := A'.mul_mem hx hy
have hyx := A'.mul_mem hy hx
| Mathlib.Algebra.Lie.OfAssociative.322_0.ll51mLev4p7Z1wP | /-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
Mβ : Type v
Mβ : Type w
instββ΄ : CommRing R
instβΒ³ : AddCommGroup Mβ
instβΒ² : Module R Mβ
instβΒΉ : AddCommGroup Mβ
instβ : Module R Mβ
e : Mβ ββ[R] Mβ
srcβ : Module.End R Mβ ββ[R] Module.End R Mβ := conj e
f g : Module.End R Mβ
β’ (conj e) β
f, gβ = β
(conj e) f, (conj e) gβ | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
have hxy := A'.mul_mem hx hy
have hyx := A'.mul_mem hy hx
exact Submodule.sub_mem (Subalgebra.toSubmodule A') hxy hyx }
#align lie_subalgebra_of_subalgebra lieSubalgebraOfSubalgebra
namespace LinearEquiv
variable {R : Type u} {Mβ : Type v} {Mβ : Type w}
variable [CommRing R] [AddCommGroup Mβ] [Module R Mβ] [AddCommGroup Mβ] [Module R Mβ]
variable (e : Mβ ββ[R] Mβ)
/-- A linear equivalence of two modules induces a Lie algebra equivalence of their endomorphisms. -/
def lieConj : Module.End R Mβ βββ
Rβ Module.End R Mβ :=
{ e.conj with
map_lie' := fun {f g} =>
show e.conj β
f, gβ = β
e.conj f, e.conj gβ by
| simp only [LieRing.of_associative_ring_bracket, LinearMap.mul_eq_comp, e.conj_comp,
LinearEquiv.map_sub] | /-- A linear equivalence of two modules induces a Lie algebra equivalence of their endomorphisms. -/
def lieConj : Module.End R Mβ βββ
Rβ Module.End R Mβ :=
{ e.conj with
map_lie' := fun {f g} =>
show e.conj β
f, gβ = β
e.conj f, e.conj gβ by
| Mathlib.Algebra.Lie.OfAssociative.342_0.ll51mLev4p7Z1wP | /-- A linear equivalence of two modules induces a Lie algebra equivalence of their endomorphisms. -/
def lieConj : Module.End R Mβ βββ
Rβ Module.End R Mβ | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
Aβ : Type v
Aβ : Type w
instββ΄ : CommRing R
instβΒ³ : Ring Aβ
instβΒ² : Ring Aβ
instβΒΉ : Algebra R Aβ
instβ : Algebra R Aβ
e : Aβ ββ[R] Aβ
srcβ : Aβ ββ[R] Aβ := toLinearEquiv e
x y : Aβ
β’ AddHom.toFun
{
toAddHom :=
{ toFun := e.toFun,
map_add' :=
(_ :
β (x y : Aβ),
AddHom.toFun srcβ.toAddHom (x + y) = AddHom.toFun srcβ.toAddHom x + AddHom.toFun srcβ.toAddHom y) },
map_smul' :=
(_ :
β (r : R) (x : Aβ),
AddHom.toFun srcβ.toAddHom (r β’ x) = (RingHom.id R) r β’ AddHom.toFun srcβ.toAddHom x) }.toAddHom
β
x, yβ =
β
AddHom.toFun
{
toAddHom :=
{ toFun := e.toFun,
map_add' :=
(_ :
β (x y : Aβ),
AddHom.toFun srcβ.toAddHom (x + y) =
AddHom.toFun srcβ.toAddHom x + AddHom.toFun srcβ.toAddHom y) },
map_smul' :=
(_ :
β (r : R) (x : Aβ),
AddHom.toFun srcβ.toAddHom (r β’ x) = (RingHom.id R) r β’ AddHom.toFun srcβ.toAddHom x) }.toAddHom
x,
AddHom.toFun
{
toAddHom :=
{ toFun := e.toFun,
map_add' :=
(_ :
β (x y : Aβ),
AddHom.toFun srcβ.toAddHom (x + y) =
AddHom.toFun srcβ.toAddHom x + AddHom.toFun srcβ.toAddHom y) },
map_smul' :=
(_ :
β (r : R) (x : Aβ),
AddHom.toFun srcβ.toAddHom (r β’ x) = (RingHom.id R) r β’ AddHom.toFun srcβ.toAddHom x) }.toAddHom
yβ | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
have hxy := A'.mul_mem hx hy
have hyx := A'.mul_mem hy hx
exact Submodule.sub_mem (Subalgebra.toSubmodule A') hxy hyx }
#align lie_subalgebra_of_subalgebra lieSubalgebraOfSubalgebra
namespace LinearEquiv
variable {R : Type u} {Mβ : Type v} {Mβ : Type w}
variable [CommRing R] [AddCommGroup Mβ] [Module R Mβ] [AddCommGroup Mβ] [Module R Mβ]
variable (e : Mβ ββ[R] Mβ)
/-- A linear equivalence of two modules induces a Lie algebra equivalence of their endomorphisms. -/
def lieConj : Module.End R Mβ βββ
Rβ Module.End R Mβ :=
{ e.conj with
map_lie' := fun {f g} =>
show e.conj β
f, gβ = β
e.conj f, e.conj gβ by
simp only [LieRing.of_associative_ring_bracket, LinearMap.mul_eq_comp, e.conj_comp,
LinearEquiv.map_sub] }
#align linear_equiv.lie_conj LinearEquiv.lieConj
@[simp]
theorem lieConj_apply (f : Module.End R Mβ) : e.lieConj f = e.conj f :=
rfl
#align linear_equiv.lie_conj_apply LinearEquiv.lieConj_apply
@[simp]
theorem lieConj_symm : e.lieConj.symm = e.symm.lieConj :=
rfl
#align linear_equiv.lie_conj_symm LinearEquiv.lieConj_symm
end LinearEquiv
namespace AlgEquiv
variable {R : Type u} {Aβ : Type v} {Aβ : Type w}
variable [CommRing R] [Ring Aβ] [Ring Aβ] [Algebra R Aβ] [Algebra R Aβ]
variable (e : Aβ ββ[R] Aβ)
/-- An equivalence of associative algebras is an equivalence of associated Lie algebras. -/
def toLieEquiv : Aβ βββ
Rβ Aβ :=
{ e.toLinearEquiv with
toFun := e.toFun
map_lie' := fun {x y} => by
| have : e.toEquiv.toFun = e := rfl | /-- An equivalence of associative algebras is an equivalence of associated Lie algebras. -/
def toLieEquiv : Aβ βββ
Rβ Aβ :=
{ e.toLinearEquiv with
toFun := e.toFun
map_lie' := fun {x y} => by
| Mathlib.Algebra.Lie.OfAssociative.371_0.ll51mLev4p7Z1wP | /-- An equivalence of associative algebras is an equivalence of associated Lie algebras. -/
def toLieEquiv : Aβ βββ
Rβ Aβ | Mathlib_Algebra_Lie_OfAssociative |
R : Type u
Aβ : Type v
Aβ : Type w
instββ΄ : CommRing R
instβΒ³ : Ring Aβ
instβΒ² : Ring Aβ
instβΒΉ : Algebra R Aβ
instβ : Algebra R Aβ
e : Aβ ββ[R] Aβ
srcβ : Aβ ββ[R] Aβ := toLinearEquiv e
x y : Aβ
this : e.toFun = βe
β’ AddHom.toFun
{
toAddHom :=
{ toFun := e.toFun,
map_add' :=
(_ :
β (x y : Aβ),
AddHom.toFun srcβ.toAddHom (x + y) = AddHom.toFun srcβ.toAddHom x + AddHom.toFun srcβ.toAddHom y) },
map_smul' :=
(_ :
β (r : R) (x : Aβ),
AddHom.toFun srcβ.toAddHom (r β’ x) = (RingHom.id R) r β’ AddHom.toFun srcβ.toAddHom x) }.toAddHom
β
x, yβ =
β
AddHom.toFun
{
toAddHom :=
{ toFun := e.toFun,
map_add' :=
(_ :
β (x y : Aβ),
AddHom.toFun srcβ.toAddHom (x + y) =
AddHom.toFun srcβ.toAddHom x + AddHom.toFun srcβ.toAddHom y) },
map_smul' :=
(_ :
β (r : R) (x : Aβ),
AddHom.toFun srcβ.toAddHom (r β’ x) = (RingHom.id R) r β’ AddHom.toFun srcβ.toAddHom x) }.toAddHom
x,
AddHom.toFun
{
toAddHom :=
{ toFun := e.toFun,
map_add' :=
(_ :
β (x y : Aβ),
AddHom.toFun srcβ.toAddHom (x + y) =
AddHom.toFun srcβ.toAddHom x + AddHom.toFun srcβ.toAddHom y) },
map_smul' :=
(_ :
β (r : R) (x : Aβ),
AddHom.toFun srcβ.toAddHom (r β’ x) = (RingHom.id R) r β’ AddHom.toFun srcβ.toAddHom x) }.toAddHom
yβ | /-
Copyright (c) 2021 Oliver Nash. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Oliver Nash
-/
import Mathlib.Algebra.Lie.Basic
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.lie.of_associative from "leanprover-community/mathlib"@"f0f3d964763ecd0090c9eb3ae0d15871d08781c4"
/-!
# Lie algebras of associative algebras
This file defines the Lie algebra structure that arises on an associative algebra via the ring
commutator.
Since the linear endomorphisms of a Lie algebra form an associative algebra, one can define the
adjoint action as a morphism of Lie algebras from a Lie algebra to its linear endomorphisms. We
make such a definition in this file.
## Main definitions
* `LieAlgebra.ofAssociativeAlgebra`
* `LieAlgebra.ofAssociativeAlgebraHom`
* `LieModule.toEndomorphism`
* `LieAlgebra.ad`
* `LinearEquiv.lieConj`
* `AlgEquiv.toLieEquiv`
## Tags
lie algebra, ring commutator, adjoint action
-/
universe u v w wβ wβ
section OfAssociative
variable {A : Type v} [Ring A]
namespace Ring
/-- The bracket operation for rings is the ring commutator, which captures the extent to which a
ring is commutative. It is identically zero exactly when the ring is commutative. -/
instance (priority := 100) instBracket : Bracket A A :=
β¨fun x y => x * y - y * xβ©
theorem lie_def (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align ring.lie_def Ring.lie_def
end Ring
theorem commute_iff_lie_eq {x y : A} : Commute x y β β
x, yβ = 0 :=
sub_eq_zero.symm
#align commute_iff_lie_eq commute_iff_lie_eq
theorem Commute.lie_eq {x y : A} (h : Commute x y) : β
x, yβ = 0 :=
sub_eq_zero_of_eq h
#align commute.lie_eq Commute.lie_eq
namespace LieRing
/-- An associative ring gives rise to a Lie ring by taking the bracket to be the ring commutator. -/
instance (priority := 100) ofAssociativeRing : LieRing A where
add_lie _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_add _ _ _ := by simp only [Ring.lie_def, right_distrib, left_distrib]; abel
lie_self := by simp only [Ring.lie_def, forall_const, sub_self]
leibniz_lie _ _ _ := by
simp only [Ring.lie_def, mul_sub_left_distrib, mul_sub_right_distrib, mul_assoc]; abel
#align lie_ring.of_associative_ring LieRing.ofAssociativeRing
theorem of_associative_ring_bracket (x y : A) : β
x, yβ = x * y - y * x :=
rfl
#align lie_ring.of_associative_ring_bracket LieRing.of_associative_ring_bracket
@[simp]
theorem lie_apply {Ξ± : Type*} (f g : Ξ± β A) (a : Ξ±) : β
f, gβ a = β
f a, g aβ :=
rfl
#align lie_ring.lie_apply LieRing.lie_apply
end LieRing
section AssociativeModule
variable {M : Type w} [AddCommGroup M] [Module A M]
/-- We can regard a module over an associative ring `A` as a Lie ring module over `A` with Lie
bracket equal to its ring commutator.
Note that this cannot be a global instance because it would create a diamond when `M = A`,
specifically we can build two mathematically-different `bracket A A`s:
1. `@Ring.bracket A _` which says `β
a, bβ = a * b - b * a`
2. `(@LieRingModule.ofAssociativeModule A _ A _ _).toBracket` which says `β
a, bβ = a β’ b`
(and thus `β
a, bβ = a * b`)
See note [reducible non-instances] -/
@[reducible]
def LieRingModule.ofAssociativeModule : LieRingModule A M where
bracket := (Β· β’ Β·)
add_lie := add_smul
lie_add := smul_add
leibniz_lie := by simp [LieRing.of_associative_ring_bracket, sub_smul, mul_smul, sub_add_cancel]
#align lie_ring_module.of_associative_module LieRingModule.ofAssociativeModule
attribute [local instance] LieRingModule.ofAssociativeModule
theorem lie_eq_smul (a : A) (m : M) : β
a, mβ = a β’ m :=
rfl
#align lie_eq_smul lie_eq_smul
end AssociativeModule
section LieAlgebra
variable {R : Type u} [CommRing R] [Algebra R A]
/-- An associative algebra gives rise to a Lie algebra by taking the bracket to be the ring
commutator. -/
instance (priority := 100) LieAlgebra.ofAssociativeAlgebra : LieAlgebra R A where
lie_smul t x y := by
rw [LieRing.of_associative_ring_bracket, LieRing.of_associative_ring_bracket,
Algebra.mul_smul_comm, Algebra.smul_mul_assoc, smul_sub]
#align lie_algebra.of_associative_algebra LieAlgebra.ofAssociativeAlgebra
attribute [local instance] LieRingModule.ofAssociativeModule
section AssociativeRepresentation
variable {M : Type w} [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M]
/-- A representation of an associative algebra `A` is also a representation of `A`, regarded as a
Lie algebra via the ring commutator.
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
this cannot be a global instance. -/
theorem LieModule.ofAssociativeModule : LieModule R A M where
smul_lie := smul_assoc
lie_smul := smul_algebra_smul_comm
#align lie_module.of_associative_module LieModule.ofAssociativeModule
instance Module.End.lieRingModule : LieRingModule (Module.End R M) M :=
LieRingModule.ofAssociativeModule
#align module.End.lie_ring_module Module.End.lieRingModule
instance Module.End.lieModule : LieModule R (Module.End R M) M :=
LieModule.ofAssociativeModule
#align module.End.lie_module Module.End.lieModule
end AssociativeRepresentation
namespace AlgHom
variable {B : Type w} {C : Type wβ} [Ring B] [Ring C] [Algebra R B] [Algebra R C]
variable (f : A ββ[R] B) (g : B ββ[R] C)
/-- The map `ofAssociativeAlgebra` associating a Lie algebra to an associative algebra is
functorial. -/
def toLieHom : A βββ
Rβ B :=
{ f.toLinearMap with
map_lie' := fun {_ _} => by simp [LieRing.of_associative_ring_bracket] }
#align alg_hom.to_lie_hom AlgHom.toLieHom
instance : Coe (A ββ[R] B) (A βββ
Rβ B) :=
β¨toLieHomβ©
/- Porting note: is a syntactic tautology
@[simp]
theorem toLieHom_coe : f.toLieHom = βf :=
rfl
-/
#noalign alg_hom.to_lie_hom_coe
@[simp]
theorem coe_toLieHom : ((f : A βββ
Rβ B) : A β B) = f :=
rfl
#align alg_hom.coe_to_lie_hom AlgHom.coe_toLieHom
theorem toLieHom_apply (x : A) : f.toLieHom x = f x :=
rfl
#align alg_hom.to_lie_hom_apply AlgHom.toLieHom_apply
@[simp]
theorem toLieHom_id : (AlgHom.id R A : A βββ
Rβ A) = LieHom.id :=
rfl
#align alg_hom.to_lie_hom_id AlgHom.toLieHom_id
@[simp]
theorem toLieHom_comp : (g.comp f : A βββ
Rβ C) = (g : B βββ
Rβ C).comp (f : A βββ
Rβ B) :=
rfl
#align alg_hom.to_lie_hom_comp AlgHom.toLieHom_comp
theorem toLieHom_injective {f g : A ββ[R] B} (h : (f : A βββ
Rβ B) = (g : A βββ
Rβ B)) : f = g := by
ext a; exact LieHom.congr_fun h a
#align alg_hom.to_lie_hom_injective AlgHom.toLieHom_injective
end AlgHom
end LieAlgebra
end OfAssociative
section AdjointAction
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
/-- A Lie module yields a Lie algebra morphism into the linear endomorphisms of the module.
See also `LieModule.toModuleHom`. -/
@[simps]
def LieModule.toEndomorphism : L βββ
Rβ Module.End R M where
toFun x :=
{ toFun := fun m => β
x, mβ
map_add' := lie_add x
map_smul' := fun t => lie_smul t x }
map_add' x y := by ext m; apply add_lie
map_smul' t x := by ext m; apply smul_lie
map_lie' {x y} := by ext m; apply lie_lie
#align lie_module.to_endomorphism LieModule.toEndomorphism
/-- The adjoint action of a Lie algebra on itself. -/
def LieAlgebra.ad : L βββ
Rβ Module.End R L :=
LieModule.toEndomorphism R L L
#align lie_algebra.ad LieAlgebra.ad
@[simp]
theorem LieAlgebra.ad_apply (x y : L) : LieAlgebra.ad R L x y = β
x, yβ :=
rfl
#align lie_algebra.ad_apply LieAlgebra.ad_apply
@[simp]
theorem LieModule.toEndomorphism_module_end :
LieModule.toEndomorphism R (Module.End R M) M = LieHom.id := by ext g m; simp [lie_eq_smul]
#align lie_module.to_endomorphism_module_End LieModule.toEndomorphism_module_end
theorem LieSubalgebra.toEndomorphism_eq (K : LieSubalgebra R L) {x : K} :
LieModule.toEndomorphism R K M x = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_eq LieSubalgebra.toEndomorphism_eq
@[simp]
theorem LieSubalgebra.toEndomorphism_mk (K : LieSubalgebra R L) {x : L} (hx : x β K) :
LieModule.toEndomorphism R K M β¨x, hxβ© = LieModule.toEndomorphism R L M x :=
rfl
#align lie_subalgebra.to_endomorphism_mk LieSubalgebra.toEndomorphism_mk
variable {R L M}
namespace LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
(f : M βββ
R,Lβ Mβ) (k : β) (x : L)
lemma toEndomorphism_pow_comp_lieHom :
(toEndomorphism R L Mβ x ^ k) ββ f = f ββ toEndomorphism R L M x ^ k := by
apply LinearMap.commute_pow_left_of_commute
ext
simp
lemma toEndomorphism_pow_apply_map (m : M) :
(toEndomorphism R L Mβ x ^ k) (f m) = f ((toEndomorphism R L M x ^ k) m) :=
LinearMap.congr_fun (toEndomorphism_pow_comp_lieHom f k x) m
end LieModule
namespace LieSubmodule
open LieModule Set
variable {N : LieSubmodule R L M} {x : L}
theorem coe_map_toEndomorphism_le :
(N : Submodule R M).map (LieModule.toEndomorphism R L M x) β€ N := by
rintro n β¨m, hm, rflβ©
exact N.lie_mem hm
#align lie_submodule.coe_map_to_endomorphism_le LieSubmodule.coe_map_toEndomorphism_le
variable (N x)
theorem toEndomorphism_comp_subtype_mem (m : M) (hm : m β (N : Submodule R M)) :
(toEndomorphism R L M x).comp (N : Submodule R M).subtype β¨m, hmβ© β (N : Submodule R M) := by
simpa using N.lie_mem hm
#align lie_submodule.to_endomorphism_comp_subtype_mem LieSubmodule.toEndomorphism_comp_subtype_mem
@[simp]
theorem toEndomorphism_restrict_eq_toEndomorphism (h := N.toEndomorphism_comp_subtype_mem x) :
(toEndomorphism R L M x).restrict h = toEndomorphism R L N x := by
ext; simp [LinearMap.restrict_apply]
#align lie_submodule.to_endomorphism_restrict_eq_to_endomorphism LieSubmodule.toEndomorphism_restrict_eq_toEndomorphism
lemma mapsTo_pow_toEndomorphism_sub_algebraMap {Ο : R} {k : β} {x : L} :
MapsTo ((toEndomorphism R L M x - algebraMap R (Module.End R M) Ο) ^ k) N N := by
rw [LinearMap.coe_pow]
exact MapsTo.iterate (fun m hm β¦ N.sub_mem (N.lie_mem hm) (N.smul_mem _ hm)) k
end LieSubmodule
open LieAlgebra
theorem LieAlgebra.ad_eq_lmul_left_sub_lmul_right (A : Type v) [Ring A] [Algebra R A] :
(ad R A : A β Module.End R A) = LinearMap.mulLeft R - LinearMap.mulRight R := by
ext a b; simp [LieRing.of_associative_ring_bracket]
#align lie_algebra.ad_eq_lmul_left_sub_lmul_right LieAlgebra.ad_eq_lmul_left_sub_lmul_right
theorem LieSubalgebra.ad_comp_incl_eq (K : LieSubalgebra R L) (x : K) :
(ad R L βx).comp (K.incl : K ββ[R] L) = (K.incl : K ββ[R] L).comp (ad R K x) := by
ext y
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
LieSubalgebra.coe_bracket, Function.comp_apply]
#align lie_subalgebra.ad_comp_incl_eq LieSubalgebra.ad_comp_incl_eq
end AdjointAction
/-- A subalgebra of an associative algebra is a Lie subalgebra of the associated Lie algebra. -/
def lieSubalgebraOfSubalgebra (R : Type u) [CommRing R] (A : Type v) [Ring A] [Algebra R A]
(A' : Subalgebra R A) : LieSubalgebra R A :=
{ Subalgebra.toSubmodule A' with
lie_mem' := fun {x y} hx hy => by
change β
x, yβ β A'; change x β A' at hx; change y β A' at hy
rw [LieRing.of_associative_ring_bracket]
have hxy := A'.mul_mem hx hy
have hyx := A'.mul_mem hy hx
exact Submodule.sub_mem (Subalgebra.toSubmodule A') hxy hyx }
#align lie_subalgebra_of_subalgebra lieSubalgebraOfSubalgebra
namespace LinearEquiv
variable {R : Type u} {Mβ : Type v} {Mβ : Type w}
variable [CommRing R] [AddCommGroup Mβ] [Module R Mβ] [AddCommGroup Mβ] [Module R Mβ]
variable (e : Mβ ββ[R] Mβ)
/-- A linear equivalence of two modules induces a Lie algebra equivalence of their endomorphisms. -/
def lieConj : Module.End R Mβ βββ
Rβ Module.End R Mβ :=
{ e.conj with
map_lie' := fun {f g} =>
show e.conj β
f, gβ = β
e.conj f, e.conj gβ by
simp only [LieRing.of_associative_ring_bracket, LinearMap.mul_eq_comp, e.conj_comp,
LinearEquiv.map_sub] }
#align linear_equiv.lie_conj LinearEquiv.lieConj
@[simp]
theorem lieConj_apply (f : Module.End R Mβ) : e.lieConj f = e.conj f :=
rfl
#align linear_equiv.lie_conj_apply LinearEquiv.lieConj_apply
@[simp]
theorem lieConj_symm : e.lieConj.symm = e.symm.lieConj :=
rfl
#align linear_equiv.lie_conj_symm LinearEquiv.lieConj_symm
end LinearEquiv
namespace AlgEquiv
variable {R : Type u} {Aβ : Type v} {Aβ : Type w}
variable [CommRing R] [Ring Aβ] [Ring Aβ] [Algebra R Aβ] [Algebra R Aβ]
variable (e : Aβ ββ[R] Aβ)
/-- An equivalence of associative algebras is an equivalence of associated Lie algebras. -/
def toLieEquiv : Aβ βββ
Rβ Aβ :=
{ e.toLinearEquiv with
toFun := e.toFun
map_lie' := fun {x y} => by
have : e.toEquiv.toFun = e := rfl
| simp_rw [LieRing.of_associative_ring_bracket, this, map_sub, map_mul] | /-- An equivalence of associative algebras is an equivalence of associated Lie algebras. -/
def toLieEquiv : Aβ βββ
Rβ Aβ :=
{ e.toLinearEquiv with
toFun := e.toFun
map_lie' := fun {x y} => by
have : e.toEquiv.toFun = e := rfl
| Mathlib.Algebra.Lie.OfAssociative.371_0.ll51mLev4p7Z1wP | /-- An equivalence of associative algebras is an equivalence of associated Lie algebras. -/
def toLieEquiv : Aβ βββ
Rβ Aβ | Mathlib_Algebra_Lie_OfAssociative |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ T R (n + 2) = 2 * X * T R (n + 1) - T R n | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by | rw [T] | @[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by | Mathlib.RingTheory.Polynomial.Chebyshev.81_0.SRy1jgYRAFbFJky | @[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ T R 2 = 2 * X ^ 2 - 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by | simp only [T, sub_left_inj, sq, mul_assoc] | theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by | Mathlib.RingTheory.Polynomial.Chebyshev.85_0.SRy1jgYRAFbFJky | theorem T_two : T R 2 = 2 * X ^ 2 - 1 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h : 2 β€ n
β’ T R n = 2 * X * T R (n - 1) - T R (n - 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
| obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h | theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.88_0.SRy1jgYRAFbFJky | theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
case intro
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h : 2 β€ 2 + n
β’ T R (2 + n) = 2 * X * T R (2 + n - 1) - T R (2 + n - 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
| rw [add_comm] | theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
| Mathlib.RingTheory.Polynomial.Chebyshev.88_0.SRy1jgYRAFbFJky | theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
case intro
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h : 2 β€ 2 + n
β’ T R (n + 2) = 2 * X * T R (n + 2 - 1) - T R (n + 2 - 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
| exact T_add_two R n | theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
| Mathlib.RingTheory.Polynomial.Chebyshev.88_0.SRy1jgYRAFbFJky | theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ U R (n + 2) = 2 * X * U R (n + 1) - U R n | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by | rw [U] | @[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by | Mathlib.RingTheory.Polynomial.Chebyshev.109_0.SRy1jgYRAFbFJky | @[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ U R 2 = 4 * X ^ 2 - 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
| simp only [U] | theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
| Mathlib.RingTheory.Polynomial.Chebyshev.113_0.SRy1jgYRAFbFJky | theorem U_two : U R 2 = 4 * X ^ 2 - 1 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ 2 * X * (2 * X) - 1 = 4 * X ^ 2 - 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
| ring | theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
| Mathlib.RingTheory.Polynomial.Chebyshev.113_0.SRy1jgYRAFbFJky | theorem U_two : U R 2 = 4 * X ^ 2 - 1 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h : 2 β€ n
β’ U R n = 2 * X * U R (n - 1) - U R (n - 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
| obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h | theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.118_0.SRy1jgYRAFbFJky | theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
case intro
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h : 2 β€ 2 + n
β’ U R (2 + n) = 2 * X * U R (2 + n - 1) - U R (2 + n - 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
| rw [add_comm] | theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
| Mathlib.RingTheory.Polynomial.Chebyshev.118_0.SRy1jgYRAFbFJky | theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
case intro
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h : 2 β€ 2 + n
β’ U R (n + 2) = 2 * X * U R (n + 2 - 1) - U R (n + 2 - 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
| exact U_add_two R n | theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
| Mathlib.RingTheory.Polynomial.Chebyshev.118_0.SRy1jgYRAFbFJky | theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ U R (0 + 1) = X * U R 0 + T R (0 + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by | simp only [T, U, two_mul, mul_one] | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by | Mathlib.RingTheory.Polynomial.Chebyshev.124_0.SRy1jgYRAFbFJky | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ U R (1 + 1) = X * U R 1 + T R (1 + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by | simp only [T, U] | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by | Mathlib.RingTheory.Polynomial.Chebyshev.124_0.SRy1jgYRAFbFJky | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ 2 * X * (2 * X) - 1 = X * (2 * X) + (2 * X * X - 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; | ring | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; | Mathlib.RingTheory.Polynomial.Chebyshev.124_0.SRy1jgYRAFbFJky | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
| rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n] | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.124_0.SRy1jgYRAFbFJky | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) =
X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by | ring | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by | Mathlib.RingTheory.Polynomial.Chebyshev.124_0.SRy1jgYRAFbFJky | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) = X * U R (n + 2) + T R (n + 2 + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by | simp only [U_add_two, T_add_two] | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by | Mathlib.RingTheory.Polynomial.Chebyshev.124_0.SRy1jgYRAFbFJky | theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ T R (n + 1) = U R (n + 1) - X * U R n | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
| rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel] | theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
| Mathlib.RingTheory.Polynomial.Chebyshev.135_0.SRy1jgYRAFbFJky | theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ T R (0 + 2) = X * T R (0 + 1) - (1 - X ^ 2) * U R 0 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by | simp only [T, U] | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by | Mathlib.RingTheory.Polynomial.Chebyshev.139_0.SRy1jgYRAFbFJky | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ 2 * X * X - 1 = X * X - (1 - X ^ 2) * 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; | ring | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; | Mathlib.RingTheory.Polynomial.Chebyshev.139_0.SRy1jgYRAFbFJky | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ T R (1 + 2) = X * T R (1 + 1) - (1 - X ^ 2) * U R 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by | simp only [T, U] | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by | Mathlib.RingTheory.Polynomial.Chebyshev.139_0.SRy1jgYRAFbFJky | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ 2 * X * (2 * X * X - 1) - X = X * (2 * X * X - 1) - (1 - X ^ 2) * (2 * X) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; | ring | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; | Mathlib.RingTheory.Polynomial.Chebyshev.139_0.SRy1jgYRAFbFJky | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ 2 * X * T R (n + 2 + 1) - T R (n + 2) =
2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) - (X * T R (n + 1) - (1 - X ^ 2) * U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by | simp only [T_eq_X_mul_T_sub_pol_U] | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by | Mathlib.RingTheory.Polynomial.Chebyshev.139_0.SRy1jgYRAFbFJky | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) - (X * T R (n + 1) - (1 - X ^ 2) * U R n) =
X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by | ring | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by | Mathlib.RingTheory.Polynomial.Chebyshev.139_0.SRy1jgYRAFbFJky | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) =
X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by | rw [T_add_two _ (n + 1), U_add_two] | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by | Mathlib.RingTheory.Polynomial.Chebyshev.139_0.SRy1jgYRAFbFJky | theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
| rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add] | theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.153_0.SRy1jgYRAFbFJky | theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
β’ map f (T R 0) = T S 0 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by | simp only [T_zero, Polynomial.map_one] | @[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by | Mathlib.RingTheory.Polynomial.Chebyshev.160_0.SRy1jgYRAFbFJky | @[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n] | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
β’ map f (T R 1) = T S 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by | simp only [T_one, map_X] | @[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by | Mathlib.RingTheory.Polynomial.Chebyshev.160_0.SRy1jgYRAFbFJky | @[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n] | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
n : β
β’ map f (T R (n + 2)) = T S (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
| simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n] | @[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
| Mathlib.RingTheory.Polynomial.Chebyshev.160_0.SRy1jgYRAFbFJky | @[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n] | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
β’ map f (U R 0) = U S 0 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by | simp only [U_zero, Polynomial.map_one] | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by | Mathlib.RingTheory.Polynomial.Chebyshev.169_0.SRy1jgYRAFbFJky | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
β’ map f (U R 1) = U S 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
| simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one] | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
| Mathlib.RingTheory.Polynomial.Chebyshev.169_0.SRy1jgYRAFbFJky | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
n : β
β’ map f (U R (n + 2)) = U S (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
| simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n] | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
| Mathlib.RingTheory.Polynomial.Chebyshev.169_0.SRy1jgYRAFbFJky | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
f : R β+* S
n : β
β’ map f 2 * X * U S (n + 1) - U S n = 2 * X * U S (n + 1) - U S n | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
| norm_num | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
| Mathlib.RingTheory.Polynomial.Chebyshev.169_0.SRy1jgYRAFbFJky | @[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ derivative (T R (0 + 1)) = (β0 + 1) * U R 0 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by | simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one] | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by | Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ derivative (T R (1 + 1)) = (β1 + 1) * U R 1 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
| simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul] | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
| Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ derivative (T R (n + 2 + 1)) = 2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
| rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat] | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (0 * X + 2 * 1) * T R (n + 1 + 1) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
| ring_nf | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
| Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ 2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) =
2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * ((βn + 1 + 1) * U R (n + 1)) - (βn + 1) * U R n | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
| rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)] | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
| Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * ((βn + 1 + 1) * U R (n + 1)) - (βn + 1) * U R n =
(βn + 1) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by | ring | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by | Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (βn + 1) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) = (βn + 1) * U R (n + 2) + 2 * U R (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by | rw [U_add_two] | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by | Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (βn + 1) * U R (n + 2) + 2 * U R (n + 2) = (βn + 2 + 1) * U R (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by | ring | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by | Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (βn + 2 + 1) * U R (n + 2) = (β(n + 2) + 1) * U R (n + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by | norm_cast | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by | Mathlib.RingTheory.Polynomial.Chebyshev.180_0.SRy1jgYRAFbFJky | theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((βn + 1) * U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
| rw [T_derivative_eq_U] | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.200_0.SRy1jgYRAFbFJky | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (1 - X ^ 2) * ((βn + 1) * U R n) = (βn + 1) * ((1 - X ^ 2) * U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by | ring | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by | Mathlib.RingTheory.Polynomial.Chebyshev.200_0.SRy1jgYRAFbFJky | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (βn + 1) * ((1 - X ^ 2) * U R n) = (βn + 1) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
| rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two] | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.200_0.SRy1jgYRAFbFJky | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (βn + 1) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) = (βn + 1) * (T R n - X * T R (n + 1)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by | ring | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by | Mathlib.RingTheory.Polynomial.Chebyshev.200_0.SRy1jgYRAFbFJky | theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ (βn + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
| have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ derivative (T R (n + 2)) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
| conv_lhs => rw [T_eq_X_mul_T_sub_pol_U] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
| derivative (T R (n + 2)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => | rw [T_eq_X_mul_T_sub_pol_U] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => | Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
| derivative (T R (n + 2)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => | rw [T_eq_X_mul_T_sub_pol_U] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => | Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
| derivative (T R (n + 2)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => | rw [T_eq_X_mul_T_sub_pol_U] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => | Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ derivative (X * T R (n + 1) - (1 - X ^ 2) * U R n) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
| simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
| Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ T R (n + 1) + X * ((βn + 1) * U R n) - ((0 - C β2 * X ^ (2 - 1)) * U R n + (1 - X ^ 2) * derivative (U R n)) =
U R (n + 1) - X * U R n + X * ((βn + 1) * U R n) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
| rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
| Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
β’ U R (n + 1) - X * U R n + X * ((βn + 1) * U R n) -
((0 - β2 * X ^ (2 - 1)) * U R n + (1 - X ^ 2) * derivative (U R n)) =
U R (n + 1) - X * U R n + X * ((βn + 1) * U R n) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
| ring | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
| Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h :
derivative (T R (n + 2)) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n)
β’ (βn + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
| calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
| Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h :
derivative (T R (n + 2)) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n)
β’ (βn + 1) * T R (n + 1) = (βn + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((βn + 1) * U R n) - (X * U R n + T R (n + 1)) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by | ring | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by | Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h :
derivative (T R (n + 2)) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n)
β’ (βn + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((βn + 1) * U R n) - (X * U R n + T R (n + 1)) =
derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
| rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h :
derivative (T R (n + 2)) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n)
β’ derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by | rw [h] | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by | Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
n : β
h :
derivative (T R (n + 2)) =
U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n)
β’ U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) =
X * U R n - (1 - X ^ 2) * derivative (U R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by | ring | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by | Mathlib.RingTheory.Polynomial.Chebyshev.211_0.SRy1jgYRAFbFJky | theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ β (k : β), 2 * T R 0 * T R (0 + k) = T R (2 * 0 + k) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by | simp [two_mul, add_mul] | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ β (k : β), 2 * T R 1 * T R (1 + k) = T R (2 * 1 + k) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by | simp [add_comm] | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m : β
β’ β (k : β), 2 * T R (m + 2) * T R (m + 2 + k) = T R (2 * (m + 2) + k) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
| intro k | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
β’ 2 * T R (m + 2) * T R (m + 2 + k) = T R (2 * (m + 2) + k) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
| suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
this : 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k
β’ 2 * T R (m + 2) * T R (m + 2 + k) = T R (2 * (m + 2) + k) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
| have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
this : 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k
β’ 2 * (m + 2) + k = 2 * m + k + 4 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by | ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
this : 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k
h_natβ : 2 * (m + 2) + k = 2 * m + k + 4
β’ 2 * T R (m + 2) * T R (m + 2 + k) = T R (2 * (m + 2) + k) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
| have h_natβ : m + 2 + k = m + k + 2 := by ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
this : 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k
h_natβ : 2 * (m + 2) + k = 2 * m + k + 4
β’ m + 2 + k = m + k + 2 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by | ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
this : 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k
h_natβ : 2 * (m + 2) + k = 2 * m + k + 4
h_natβ : m + 2 + k = m + k + 2
β’ 2 * T R (m + 2) * T R (m + 2 + k) = T R (2 * (m + 2) + k) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
| simpa [h_natβ, h_natβ] using this | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
β’ 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
| have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1) | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
β’ 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
| have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
β’ m + 1 + (k + 1) = m + k + 2 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by | ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
h_natβ : m + 1 + (k + 1) = m + k + 2
β’ 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
| have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
h_natβ : m + 1 + (k + 1) = m + k + 2
β’ 2 * (m + 1) + (k + 1) = 2 * m + k + 3 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by | ring | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
h_natβ : m + 1 + (k + 1) = m + k + 2
h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3
β’ 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
| simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1) | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
β’ 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
| have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2) | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
β’ 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
| have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc] | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
β’ 2 * m + (k + 2) = 2 * m + k + 2 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by | simp [add_assoc] | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
h_natβ : 2 * m + (k + 2) = 2 * m + k + 2
β’ 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
| have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc] | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
h_natβ : 2 * m + (k + 2) = 2 * m + k + 2
β’ m + (k + 2) = m + k + 2 | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by | simp [add_assoc] | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by | Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
h_natβ : 2 * m + (k + 2) = 2 * m + k + 2
h_natβ : m + (k + 2) = m + k + 2
β’ 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
| simpa [h_natβ, h_natβ] using mul_T m (k + 2) | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2)
β’ 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
| have hβ := T_add_two R m | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2)
hβ : T R (m + 2) = 2 * X * T R (m + 1) - T R m
β’ 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
| have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2) | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2)
hβ : T R (m + 2) = 2 * X * T R (m + 1) - T R m
hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2)
β’ 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
| have hβ := T_add_two R k | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m k : β
Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1)
Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2)
hβ : T R (m + 2) = 2 * X * T R (m + 1) - T R m
hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2)
hβ : T R (k + 2) = 2 * X * T R (k + 1) - T R k
β’ 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
| linear_combination 2 * T R (m + k + 2) * hβ + 2 * (X : R[X]) * Hβ - Hβ - hβ - hβ | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
| Mathlib.RingTheory.Polynomial.Chebyshev.238_0.SRy1jgYRAFbFJky | /-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ β (n : β), T R (0 * n) = comp (T R 0) (T R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
linear_combination 2 * T R (m + k + 2) * hβ + 2 * (X : R[X]) * Hβ - Hβ - hβ - hβ
#align polynomial.chebyshev.mul_T Polynomial.Chebyshev.mul_T
/-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by | simp | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by | Mathlib.RingTheory.Polynomial.Chebyshev.268_0.SRy1jgYRAFbFJky | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
β’ β (n : β), T R (1 * n) = comp (T R 1) (T R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
linear_combination 2 * T R (m + k + 2) * hβ + 2 * (X : R[X]) * Hβ - Hβ - hβ - hβ
#align polynomial.chebyshev.mul_T Polynomial.Chebyshev.mul_T
/-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by | simp | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by | Mathlib.RingTheory.Polynomial.Chebyshev.268_0.SRy1jgYRAFbFJky | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m : β
β’ β (n : β), T R ((m + 2) * n) = comp (T R (m + 2)) (T R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
linear_combination 2 * T R (m + k + 2) * hβ + 2 * (X : R[X]) * Hβ - Hβ - hβ - hβ
#align polynomial.chebyshev.mul_T Polynomial.Chebyshev.mul_T
/-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
| intro n | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
| Mathlib.RingTheory.Polynomial.Chebyshev.268_0.SRy1jgYRAFbFJky | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m n : β
β’ T R ((m + 2) * n) = comp (T R (m + 2)) (T R n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
linear_combination 2 * T R (m + k + 2) * hβ + 2 * (X : R[X]) * Hβ - Hβ - hβ - hβ
#align polynomial.chebyshev.mul_T Polynomial.Chebyshev.mul_T
/-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
| have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) := by
convert mul_T R n (m * n) using 1 <;> ring_nf | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
| Mathlib.RingTheory.Polynomial.Chebyshev.268_0.SRy1jgYRAFbFJky | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) | Mathlib_RingTheory_Polynomial_Chebyshev |
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m n : β
β’ 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
linear_combination 2 * T R (m + k + 2) * hβ + 2 * (X : R[X]) * Hβ - Hβ - hβ - hβ
#align polynomial.chebyshev.mul_T Polynomial.Chebyshev.mul_T
/-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) := by
| convert mul_T R n (m * n) using 1 | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) := by
| Mathlib.RingTheory.Polynomial.Chebyshev.268_0.SRy1jgYRAFbFJky | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) | Mathlib_RingTheory_Polynomial_Chebyshev |
case h.e'_2
R : Type u_1
S : Type u_2
instβΒΉ : CommRing R
instβ : CommRing S
m n : β
β’ 2 * T R n * T R ((m + 1) * n) = 2 * T R n * T R (n + m * n) | /-
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Julian Kuelshammer, Heather Macbeth
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
/-!
# Chebyshev polynomials
The Chebyshev polynomials are two families of polynomials indexed by `β`,
with integral coefficients.
## Main definitions
* `Polynomial.Chebyshev.T`: the Chebyshev polynomials of the first kind.
* `Polynomial.Chebyshev.U`: the Chebyshev polynomials of the second kind.
## Main statements
* The formal derivative of the Chebyshev polynomials of the first kind is a scalar multiple of the
Chebyshev polynomials of the second kind.
* `Polynomial.Chebyshev.mul_T`, the product of the `m`-th and `(m + k)`-th Chebyshev polynomials of
the first kind is the sum of the `(2 * m + k)`-th and `k`-th Chebyshev polynomials of the first
kind.
* `Polynomial.Chebyshev.T_mul`, the `(m * n)`-th Chebyshev polynomial of the first kind is the
composition of the `m`-th and `n`-th Chebyshev polynomials of the first kind.
## Implementation details
Since Chebyshev polynomials have interesting behaviour over the complex numbers and modulo `p`,
we define them to have coefficients in an arbitrary commutative ring, even though
technically `β€` would suffice.
The benefit of allowing arbitrary coefficient rings, is that the statements afterwards are clean,
and do not have `map (Int.castRingHom R)` interfering all the time.
## References
[Lionel Ponton, _Roots of the Chebyshev polynomials: A purely algebraic approach_]
[ponton2020chebyshev]
## TODO
* Redefine and/or relate the definition of Chebyshev polynomials to `LinearRecurrence`.
* Add explicit formula involving square roots for Chebyshev polynomials
* Compute zeroes and extrema of Chebyshev polynomials.
* Prove that the roots of the Chebyshev polynomials (except 0) are irrational.
* Prove minimax properties of Chebyshev polynomials.
-/
noncomputable section
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
/-- `T n` is the `n`-th Chebyshev polynomial of the first kind -/
noncomputable def T : β β R[X]
| 0 => 1
| 1 => X
| n + 2 => 2 * X * T (n + 1) - T n
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
@[simp]
theorem T_add_two (n : β) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by rw [T]
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simp only [T, sub_left_inj, sq, mul_assoc]
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
theorem T_of_two_le (n : β) (h : 2 β€ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact T_add_two R n
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_of_two_le
/-- `U n` is the `n`-th Chebyshev polynomial of the second kind -/
noncomputable def U : β β R[X]
| 0 => 1
| 1 => 2 * X
| n + 2 => 2 * X * U (n + 1) - U n
#align polynomial.chebyshev.U Polynomial.Chebyshev.U
@[simp]
theorem U_zero : U R 0 = 1 := rfl
#align polynomial.chebyshev.U_zero Polynomial.Chebyshev.U_zero
@[simp]
theorem U_one : U R 1 = 2 * X := rfl
#align polynomial.chebyshev.U_one Polynomial.Chebyshev.U_one
@[simp]
theorem U_add_two (n : β) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by rw [U]
#align polynomial.chebyshev.U_add_two Polynomial.Chebyshev.U_add_two
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
simp only [U]
ring
#align polynomial.chebyshev.U_two Polynomial.Chebyshev.U_two
theorem U_of_two_le (n : β) (h : 2 β€ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
obtain β¨n, rflβ© := Nat.exists_eq_add_of_le h
rw [add_comm]
exact U_add_two R n
#align polynomial.chebyshev.U_of_two_le Polynomial.Chebyshev.U_of_two_le
theorem U_eq_X_mul_U_add_T : β n : β, U R (n + 1) = X * U R n + T R (n + 1)
| 0 => by simp only [T, U, two_mul, mul_one]
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
U R (n + 2 + 1) = 2 * X * (X * U R (n + 1) + T R (n + 2)) - (X * U R n + T R (n + 1)) := by
rw [U_add_two, U_eq_X_mul_U_add_T n, U_eq_X_mul_U_add_T (n + 1), U_eq_X_mul_U_add_T n]
_ = X * (2 * X * U R (n + 1) - U R n) + (2 * X * T R (n + 2) - T R (n + 1)) := by ring
_ = X * U R (n + 2) + T R (n + 2 + 1) := by simp only [U_add_two, T_add_two]
#align polynomial.chebyshev.U_eq_X_mul_U_add_T Polynomial.Chebyshev.U_eq_X_mul_U_add_T
theorem T_eq_U_sub_X_mul_U (n : β) : T R (n + 1) = U R (n + 1) - X * U R n := by
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
#align polynomial.chebyshev.T_eq_U_sub_X_mul_U Polynomial.Chebyshev.T_eq_U_sub_X_mul_U
theorem T_eq_X_mul_T_sub_pol_U : β n : β, T R (n + 2) = X * T R (n + 1) - (1 - X ^ 2) * U R n
| 0 => by simp only [T, U]; ring
| 1 => by simp only [T, U]; ring
| n + 2 =>
calc
T R (n + 2 + 2) = 2 * X * T R (n + 2 + 1) - T R (n + 2) := T_add_two _ _
_ = 2 * X * (X * T R (n + 2) - (1 - X ^ 2) * U R (n + 1)) -
(X * T R (n + 1) - (1 - X ^ 2) * U R n) :=
by simp only [T_eq_X_mul_T_sub_pol_U]
_ = X * (2 * X * T R (n + 2) - T R (n + 1)) - (1 - X ^ 2) * (2 * X * U R (n + 1) - U R n) :=
by ring
_ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by rw [T_add_two _ (n + 1), U_add_two]
#align polynomial.chebyshev.T_eq_X_mul_T_sub_pol_U Polynomial.Chebyshev.T_eq_X_mul_T_sub_pol_U
theorem one_sub_X_sq_mul_U_eq_pol_in_T (n : β) :
(1 - X ^ 2) * U R n = X * T R (n + 1) - T R (n + 2) := by
rw [T_eq_X_mul_T_sub_pol_U, β sub_add, sub_self, zero_add]
#align polynomial.chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_U_eq_pol_in_T
variable {R S}
@[simp]
theorem map_T (f : R β+* S) : β n : β, map f (T R n) = T S n
| 0 => by simp only [T_zero, Polynomial.map_one]
| 1 => by simp only [T_one, map_X]
| n + 2 => by
simp only [T_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, Polynomial.map_ofNat, map_T f (n + 1), map_T f n]
#align polynomial.chebyshev.map_T Polynomial.Chebyshev.map_T
@[simp]
theorem map_U (f : R β+* S) : β n : β, map f (U R n) = U S n
| 0 => by simp only [U_zero, Polynomial.map_one]
| 1 => by
simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
| n + 2 => by
simp only [U_add_two, Polynomial.map_mul, Polynomial.map_sub, map_X, Polynomial.map_add,
Polynomial.map_one, map_U f (n + 1), map_U f n]
norm_num
#align polynomial.chebyshev.map_U Polynomial.Chebyshev.map_U
theorem T_derivative_eq_U : β n : β, derivative (T R (n + 1)) = (n + 1) * U R n
| 0 => by simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]
| 1 => by
simp [T_two, U_one, derivative_sub, derivative_one, derivative_mul, derivative_X_pow, add_mul]
| n + 2 =>
calc
derivative (T R (n + 2 + 1)) =
2 * T R (n + 2) + 2 * X * derivative (T R (n + 1 + 1)) - derivative (T R (n + 1)) := by
rw [T_add_two _ (n + 1), derivative_sub, derivative_mul, derivative_mul, derivative_X,
derivative_ofNat]
ring_nf
_ = 2 * (U R (n + 1 + 1) - X * U R (n + 1)) + 2 * X * (((n + 1 + 1) : R[X]) * U R (n + 1))
- ((n + 1) : R[X]) * U R n := by
rw_mod_cast [T_derivative_eq_U (n + 1), T_derivative_eq_U n, T_eq_U_sub_X_mul_U _ (n + 1)]
_ = (n + 1 : R[X]) * (2 * X * U R (n + 1) - U R n) + 2 * U R (n + 2) := by ring
_ = (n + 1) * U R (n + 2) + 2 * U R (n + 2) := by rw [U_add_two]
_ = (n + 2 + 1) * U R (n + 2) := by ring
_ = (β(n + 2) + 1) * U R (n + 2) := by norm_cast
#align polynomial.chebyshev.T_derivative_eq_U Polynomial.Chebyshev.T_derivative_eq_U
theorem one_sub_X_sq_mul_derivative_T_eq_poly_in_T (n : β) :
(1 - X ^ 2) * derivative (T R (n + 1)) = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) :=
calc
(1 - X ^ 2) * derivative (T R (n + 1)) = (1 - X ^ 2) * ((n + 1 : R[X]) * U R n) := by
rw [T_derivative_eq_U]
_ = (n + 1 : R[X]) * ((1 - X ^ 2) * U R n) := by ring
_ = (n + 1 : R[X]) * (X * T R (n + 1) - (2 * X * T R (n + 1) - T R n)) := by
rw [one_sub_X_sq_mul_U_eq_pol_in_T, T_add_two]
_ = (n + 1 : R[X]) * (T R n - X * T R (n + 1)) := by ring
#align polynomial.chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T Polynomial.Chebyshev.one_sub_X_sq_mul_derivative_T_eq_poly_in_T
theorem add_one_mul_T_eq_poly_in_U (n : β) :
((n : R[X]) + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * derivative (U R n) := by
have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) +
2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by
conv_lhs => rw [T_eq_X_mul_T_sub_pol_U]
simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow,
one_mul, T_derivative_eq_U]
rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast]
ring
calc
((n : R[X]) + 1) * T R (n + 1) =
((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) -
(X * U R n + T R (n + 1)) :=
by ring
_ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by
rw [β U_eq_X_mul_U_add_T, β T_derivative_eq_U, β Nat.cast_one, β Nat.cast_add, Nat.cast_one, β
T_derivative_eq_U (n + 1)]
_ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n -
(1 - X ^ 2) * derivative (U R n) -
X * derivative (T R (n + 1)) -
U R (n + 1) :=
by rw [h]
_ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring
#align polynomial.chebyshev.add_one_mul_T_eq_poly_in_U Polynomial.Chebyshev.add_one_mul_T_eq_poly_in_U
variable (R)
/-- The product of two Chebyshev polynomials is the sum of two other Chebyshev polynomials. -/
theorem mul_T : β m k, 2 * T R m * T R (m + k) = T R (2 * m + k) + T R k
| 0 => by simp [two_mul, add_mul]
| 1 => by simp [add_comm]
| m + 2 => by
intro k
-- clean up the `T` nat indices in the goal
suffices 2 * T R (m + 2) * T R (m + k + 2) = T R (2 * m + k + 4) + T R k by
have h_natβ : 2 * (m + 2) + k = 2 * m + k + 4 := by ring
have h_natβ : m + 2 + k = m + k + 2 := by ring
simpa [h_natβ, h_natβ] using this
-- clean up the `T` nat indices in the inductive hypothesis applied to `m + 1` and `k + 1`
have Hβ : 2 * T R (m + 1) * T R (m + k + 2) = T R (2 * m + k + 3) + T R (k + 1) := by
have h_natβ : m + 1 + (k + 1) = m + k + 2 := by ring
have h_natβ : 2 * (m + 1) + (k + 1) = 2 * m + k + 3 := by ring
simpa [h_natβ, h_natβ] using mul_T (m + 1) (k + 1)
-- clean up the `T` nat indices in the inductive hypothesis applied to `m` and `k + 2`
have Hβ : 2 * T R m * T R (m + k + 2) = T R (2 * m + k + 2) + T R (k + 2) := by
have h_natβ : 2 * m + (k + 2) = 2 * m + k + 2 := by simp [add_assoc]
have h_natβ : m + (k + 2) = m + k + 2 := by simp [add_assoc]
simpa [h_natβ, h_natβ] using mul_T m (k + 2)
-- state the `T` recurrence relation for a few useful indices
have hβ := T_add_two R m
have hβ : T R (2 * m + k + 4) = 2 * X * T R (2 * m + k + 3) - T R (2 * m + k + 2) :=
T_add_two R (2 * m + k + 2)
have hβ := T_add_two R k
-- the desired identity is an appropriate linear combination of Hβ, Hβ, hβ, hβ, hβ
linear_combination 2 * T R (m + k + 2) * hβ + 2 * (X : R[X]) * Hβ - Hβ - hβ - hβ
#align polynomial.chebyshev.mul_T Polynomial.Chebyshev.mul_T
/-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) := by
convert mul_T R n (m * n) using 1 <;> | ring_nf | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) := by
convert mul_T R n (m * n) using 1 <;> | Mathlib.RingTheory.Polynomial.Chebyshev.268_0.SRy1jgYRAFbFJky | /-- The `(m * n)`-th Chebyshev polynomial is the composition of the `m`-th and `n`-th -/
theorem T_mul : β m n, T R (m * n) = (T R m).comp (T R n)
| 0 => by simp
| 1 => by simp
| m + 2 => by
intro n
have : 2 * T R n * T R ((m + 1) * n) = T R ((m + 2) * n) + T R (m * n) | Mathlib_RingTheory_Polynomial_Chebyshev |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.