l3lab/ntp-mathlib huggingface dataset:
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
  

Proof state:
case h
R : Type u
L : Type v
M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : LieRing L
inst✝⁴ : LieAlgebra R L
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : LieRingModule L M
inst✝ : LieModule R L M
K : LieSubalgebra R L
x y : ↥K
⊢ ((ad R L) ↑x ∘ₗ ↑(incl K)) y = (↑(incl K) ∘ₗ (ad R ↥K) x) y

Next tactic:
simp only [ad_apply, LieHom.coe_toLinearMap, LieSubalgebra.coe_incl, LinearMap.coe_comp,
    LieSubalgebra.coe_bracket, Function.comp_apply]
/-- 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
      

Proof state:
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

Next tactic:
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
      change ⁅x, y⁆ ∈ A'; 

Proof state:
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'

Next tactic:
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'; change x ∈ A' at hx; 

Proof state:
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'

Next tactic:
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; change y ∈ A' at hy
      

Proof state:
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'

Next tactic:
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
      rw [LieRing.of_associative_ring_bracket]
      

Proof state:
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'

Next tactic:
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]
      have hxy := A'.mul_mem hx hy
      

Proof state:
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'

Next tactic:
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
      have hyx := A'.mul_mem hy hx
      

Proof state:
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'

Next tactic:
exact Submodule.sub_mem (Subalgebra.toSubmodule A') hxy hyx
/-- 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
        

Proof state:
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⁆

Next tactic:
simp only [LieRing.of_associative_ring_bracket, LinearMap.mul_eq_comp, e.conj_comp,
          LinearEquiv.map_sub]
/-- 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
      

Proof state:
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⁆

Next tactic:
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
      have : e.toEquiv.toFun = e := rfl
      

Proof state:
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⁆

Next tactic:
simp_rw [LieRing.of_associative_ring_bracket, this, map_sub, map_mul]
@[simp]
theorem T_add_two (n : ℕ) : T R (n + 2) = 2 * X * T R (n + 1) - T R n := by 

Proof state:
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

Next tactic:
rw [T]
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by 

Proof state:
R : Type u_1
S : Type u_2
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ T R 2 = 2 * X ^ 2 - 1

Next tactic:
simp only [T, sub_left_inj, sq, mul_assoc]
theorem T_of_two_le (n : ℕ) (h : 2 ≤ n) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
  

Proof state:
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)

Next tactic:
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
  obtain ⟨n, rfl⟩ := Nat.exists_eq_add_of_le h
  

Proof state:
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)

Next tactic:
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
  rw [add_comm]
  

Proof state:
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)

Next tactic:
exact T_add_two R n
@[simp]
theorem U_add_two (n : ℕ) : U R (n + 2) = 2 * X * U R (n + 1) - U R n := by 

Proof state:
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

Next tactic:
rw [U]
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
  

Proof state:
R : Type u_1
S : Type u_2
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ U R 2 = 4 * X ^ 2 - 1

Next tactic:
simp only [U]
theorem U_two : U R 2 = 4 * X ^ 2 - 1 := by
  simp only [U]
  

Proof state:
R : Type u_1
S : Type u_2
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ 2 * X * (2 * X) - 1 = 4 * X ^ 2 - 1

Next tactic:
ring
theorem U_of_two_le (n : ℕ) (h : 2 ≤ n) : U R n = 2 * X * U R (n - 1) - U R (n - 2) := by
  

Proof state:
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)

Next tactic:
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
  obtain ⟨n, rfl⟩ := Nat.exists_eq_add_of_le h
  

Proof state:
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)

Next tactic:
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
  rw [add_comm]
  

Proof state:
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)

Next tactic:
exact U_add_two R n
theorem U_eq_X_mul_U_add_T : ∀ n : ℕ, U R (n + 1) = X * U R n + T R (n + 1)
  | 0 => by 

Proof state:
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)

Next tactic:
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 simp only [T, U, two_mul, mul_one]
  | 1 => by 

Proof state:
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)

Next tactic:
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 simp only [T, U]; 

Proof state:
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)

Next tactic:
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
        

Proof state:
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))

Next tactic:
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
        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 

Proof state:
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))

Next tactic:
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 ring
      _ = X * U R (n + 2) + T R (n + 2 + 1) := by 

Proof state:
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)

Next tactic:
simp only [U_add_two, T_add_two]
theorem T_eq_U_sub_X_mul_U (n : ℕ) : T R (n + 1) = U R (n + 1) - X * U R n := by
  

Proof state:
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

Next tactic:
rw [U_eq_X_mul_U_add_T, add_comm (X * U R n), add_sub_cancel]
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 

Proof state:
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

Next tactic:
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]; 

Proof state:
R : Type u_1
S : Type u_2
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ 2 * X * X - 1 = X * X - (1 - X ^ 2) * 1

Next tactic:
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 

Proof state:
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

Next tactic:
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 simp only [T, U]; 

Proof state:
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)

Next tactic:
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 

Proof state:
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)

Next tactic:
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 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 

Proof state:
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)

Next tactic:
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 ring
      _ = X * T R (n + 2 + 1) - (1 - X ^ 2) * U R (n + 2) := by 

Proof state:
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)

Next tactic:
rw [T_add_two _ (n + 1), U_add_two]
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
  

Proof state:
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)

Next tactic:
rw [T_eq_X_mul_T_sub_pol_U, ← sub_add, sub_self, zero_add]
@[simp]
theorem map_T (f : R →+* S) : ∀ n : ℕ, map f (T R n) = T S n
  | 0 => by 

Proof state:
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

Next tactic:
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 simp only [T_zero, Polynomial.map_one]
  | 1 => by 

Proof state:
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

Next tactic:
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 simp only [T_one, map_X]
  | n + 2 => by
    

Proof state:
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)

Next tactic:
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_U (f : R →+* S) : ∀ n : ℕ, map f (U R n) = U S n
  | 0 => by 

Proof state:
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

Next tactic:
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 simp only [U_zero, Polynomial.map_one]
  | 1 => by
    

Proof state:
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

Next tactic:
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
    simp [U_one, map_X, Polynomial.map_mul, Polynomial.map_add, Polynomial.map_one]
  | n + 2 => by
    

Proof state:
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)

Next tactic:
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
    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]
    

Proof state:
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

Next tactic:
norm_num
theorem T_derivative_eq_U : ∀ n : ℕ, derivative (T R (n + 1)) = (n + 1) * U R n
  | 0 => by 

Proof state:
R : Type u_1
S : Type u_2
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ derivative (T R (0 + 1)) = (↑0 + 1) * U R 0

Next tactic:
simp only [T_one, U_zero, derivative_X, Nat.cast_zero, zero_add, mul_one]