l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem eval₂_algebraMap_X {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (p : R[X])
    (f : R[X] →ₐ[R] A) : eval₂ (algebraMap R A) (f X) p = f p := by
  conv_rhs => rw [← Polynomial.sum_C_mul_X_pow_eq p]
  

Proof state:
R✝ : Type u
S : Type v
T : Type w
A✝ : Type z
A' : Type u_1
B : Type u_2
a b : R✝
n : ℕ
inst✝⁷ : CommSemiring R✝
inst✝⁶ : Semiring A✝
inst✝⁵ : Semiring B
inst✝⁴ : Algebra R✝ A✝
inst✝³ : Algebra R✝ B
p✝ q r : R✝[X]
R : Type u_3
A : Type u_4
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
f : R[X] →ₐ[R] A
⊢ eval₂ (algebraMap R A) (f X) p = f (sum p fun n a => C a * X ^ n)

Next tactic:
simp only [eval₂_eq_sum, sum_def]
@[simp]
theorem eval₂_algebraMap_X {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (p : R[X])
    (f : R[X] →ₐ[R] A) : eval₂ (algebraMap R A) (f X) p = f p := by
  conv_rhs => rw [← Polynomial.sum_C_mul_X_pow_eq p]
  simp only [eval₂_eq_sum, sum_def]
  

Proof state:
R✝ : Type u
S : Type v
T : Type w
A✝ : Type z
A' : Type u_1
B : Type u_2
a b : R✝
n : ℕ
inst✝⁷ : CommSemiring R✝
inst✝⁶ : Semiring A✝
inst✝⁵ : Semiring B
inst✝⁴ : Algebra R✝ A✝
inst✝³ : Algebra R✝ B
p✝ q r : R✝[X]
R : Type u_3
A : Type u_4
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
f : R[X] →ₐ[R] A
⊢ ∑ n in support p, (algebraMap R A) (coeff p n) * f X ^ n = f (∑ n in support p, C (coeff p n) * X ^ n)

Next tactic:
simp only [f.map_sum, f.map_mul, f.map_pow, eq_intCast, map_intCast]
@[simp]
theorem eval₂_algebraMap_X {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (p : R[X])
    (f : R[X] →ₐ[R] A) : eval₂ (algebraMap R A) (f X) p = f p := by
  conv_rhs => rw [← Polynomial.sum_C_mul_X_pow_eq p]
  simp only [eval₂_eq_sum, sum_def]
  simp only [f.map_sum, f.map_mul, f.map_pow, eq_intCast, map_intCast]
  

Proof state:
R✝ : Type u
S : Type v
T : Type w
A✝ : Type z
A' : Type u_1
B : Type u_2
a b : R✝
n : ℕ
inst✝⁷ : CommSemiring R✝
inst✝⁶ : Semiring A✝
inst✝⁵ : Semiring B
inst✝⁴ : Algebra R✝ A✝
inst✝³ : Algebra R✝ B
p✝ q r : R✝[X]
R : Type u_3
A : Type u_4
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
f : R[X] →ₐ[R] A
⊢ ∑ n in support p, (algebraMap R A) (coeff p n) * f X ^ n = ∑ x in support p, f (C (coeff p x)) * f X ^ x

Next tactic:
simp [Polynomial.C_eq_algebraMap]
@[simp]
theorem adjoin_X : Algebra.adjoin R ({X} : Set R[X]) = ⊤ := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p q : R[X]
x : A
⊢ Algebra.adjoin R {X} = ⊤

Next tactic:
refine' top_unique fun p _hp => _
@[simp]
theorem adjoin_X : Algebra.adjoin R ({X} : Set R[X]) = ⊤ := by
  refine' top_unique fun p _hp => _
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q : R[X]
x : A
p : R[X]
_hp : p ∈ ⊤
⊢ p ∈ Algebra.adjoin R {X}

Next tactic:
set S := Algebra.adjoin R ({X} : Set R[X])
@[simp]
theorem adjoin_X : Algebra.adjoin R ({X} : Set R[X]) = ⊤ := by
  refine' top_unique fun p _hp => _
  set S := Algebra.adjoin R ({X} : Set R[X])
  

Proof state:
R : Type u
S✝ : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q : R[X]
x : A
p : R[X]
_hp : p ∈ ⊤
S : Subalgebra R R[X] := Algebra.adjoin R {X}
⊢ p ∈ S

Next tactic:
rw [← sum_monomial_eq p]
@[simp]
theorem adjoin_X : Algebra.adjoin R ({X} : Set R[X]) = ⊤ := by
  refine' top_unique fun p _hp => _
  set S := Algebra.adjoin R ({X} : Set R[X])
  rw [← sum_monomial_eq p]; 

Proof state:
R : Type u
S✝ : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q : R[X]
x : A
p : R[X]
_hp : p ∈ ⊤
S : Subalgebra R R[X] := Algebra.adjoin R {X}
⊢ (sum p fun n a => (monomial n) a) ∈ S

Next tactic:
simp only [← smul_X_eq_monomial, Sum]
@[simp]
theorem adjoin_X : Algebra.adjoin R ({X} : Set R[X]) = ⊤ := by
  refine' top_unique fun p _hp => _
  set S := Algebra.adjoin R ({X} : Set R[X])
  rw [← sum_monomial_eq p]; simp only [← smul_X_eq_monomial, Sum]
  

Proof state:
R : Type u
S✝ : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q : R[X]
x : A
p : R[X]
_hp : p ∈ ⊤
S : Subalgebra R R[X] := Algebra.adjoin R {X}
⊢ (sum p fun n a => a • X ^ n) ∈ Algebra.adjoin R {X}

Next tactic:
exact S.sum_mem fun n _hn => S.smul_mem (S.pow_mem (Algebra.subset_adjoin rfl) _) _
/-- Two polynomials `p` and `q` such that `p(q(X))=X` and `q(p(X))=X`
  induces an automorphism of the polynomial algebra. -/
@[simps!]
def algEquivOfCompEqX (p q : R[X]) (hpq : p.comp q = X) (hqp : q.comp p = X) : R[X] ≃ₐ[R] R[X] := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q✝ : R[X]
x : A
p q : R[X]
hpq : comp p q = X
hqp : comp q p = X
⊢ R[X] ≃ₐ[R] R[X]

Next tactic:
refine AlgEquiv.ofAlgHom (aeval p) (aeval q) ?_ ?_
/-- Two polynomials `p` and `q` such that `p(q(X))=X` and `q(p(X))=X`
  induces an automorphism of the polynomial algebra. -/
@[simps!]
def algEquivOfCompEqX (p q : R[X]) (hpq : p.comp q = X) (hqp : q.comp p = X) : R[X] ≃ₐ[R] R[X] := by
  refine AlgEquiv.ofAlgHom (aeval p) (aeval q) ?_ ?_ <;>
    

Proof state:
case refine_1
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q✝ : R[X]
x : A
p q : R[X]
hpq : comp p q = X
hqp : comp q p = X
⊢ AlgHom.comp (aeval p) (aeval q) = AlgHom.id R R[X]

Next tactic:
exact AlgHom.ext fun _ ↦ by simp [← comp_eq_aeval, comp_assoc, hpq, hqp]
/-- Two polynomials `p` and `q` such that `p(q(X))=X` and `q(p(X))=X`
  induces an automorphism of the polynomial algebra. -/
@[simps!]
def algEquivOfCompEqX (p q : R[X]) (hpq : p.comp q = X) (hqp : q.comp p = X) : R[X] ≃ₐ[R] R[X] := by
  refine AlgEquiv.ofAlgHom (aeval p) (aeval q) ?_ ?_ <;>
    exact AlgHom.ext fun _ ↦ by 

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q✝ : R[X]
x : A
p q : R[X]
hpq : comp p q = X
hqp : comp q p = X
x✝ : R[X]
⊢ (AlgHom.comp (aeval p) (aeval q)) x✝ = (AlgHom.id R R[X]) x✝

Next tactic:
simp [← comp_eq_aeval, comp_assoc, hpq, hqp]
/-- Two polynomials `p` and `q` such that `p(q(X))=X` and `q(p(X))=X`
  induces an automorphism of the polynomial algebra. -/
@[simps!]
def algEquivOfCompEqX (p q : R[X]) (hpq : p.comp q = X) (hqp : q.comp p = X) : R[X] ≃ₐ[R] R[X] := by
  refine AlgEquiv.ofAlgHom (aeval p) (aeval q) ?_ ?_ <;>
    

Proof state:
case refine_2
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q✝ : R[X]
x : A
p q : R[X]
hpq : comp p q = X
hqp : comp q p = X
⊢ AlgHom.comp (aeval q) (aeval p) = AlgHom.id R R[X]

Next tactic:
exact AlgHom.ext fun _ ↦ by simp [← comp_eq_aeval, comp_assoc, hpq, hqp]
/-- Two polynomials `p` and `q` such that `p(q(X))=X` and `q(p(X))=X`
  induces an automorphism of the polynomial algebra. -/
@[simps!]
def algEquivOfCompEqX (p q : R[X]) (hpq : p.comp q = X) (hqp : q.comp p = X) : R[X] ≃ₐ[R] R[X] := by
  refine AlgEquiv.ofAlgHom (aeval p) (aeval q) ?_ ?_ <;>
    exact AlgHom.ext fun _ ↦ by 

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q✝ : R[X]
x : A
p q : R[X]
hpq : comp p q = X
hqp : comp q p = X
x✝ : R[X]
⊢ (AlgHom.comp (aeval q) (aeval p)) x✝ = (AlgHom.id R R[X]) x✝

Next tactic:
simp [← comp_eq_aeval, comp_assoc, hpq, hqp]
/-- The automorphism of the polynomial algebra given by `p(X) ↦ p(X+t)`,
  with inverse `p(X) ↦ p(X-t)`. -/
@[simps!]
def algEquivAevalXAddC {R} [CommRing R] (t : R) : R[X] ≃ₐ[R] R[X] :=
  algEquivOfCompEqX (X + C t) (X - C t) (by 

Proof state:
R✝ : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R✝
n : ℕ
inst✝⁷ : CommSemiring R✝
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R✝ A
inst✝² : Algebra R✝ A'
inst✝¹ : Algebra R✝ B
p q : R✝[X]
x : A
R : Type ?u.954399
inst✝ : CommRing R
t : R
⊢ comp (X + C t) (X - C t) = X

Next tactic:
simp
/-- The automorphism of the polynomial algebra given by `p(X) ↦ p(X+t)`,
  with inverse `p(X) ↦ p(X-t)`. -/
@[simps!]
def algEquivAevalXAddC {R} [CommRing R] (t : R) : R[X] ≃ₐ[R] R[X] :=
  algEquivOfCompEqX (X + C t) (X - C t) (by simp) (by 

Proof state:
R✝ : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R✝
n : ℕ
inst✝⁷ : CommSemiring R✝
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R✝ A
inst✝² : Algebra R✝ A'
inst✝¹ : Algebra R✝ B
p q : R✝[X]
x : A
R : Type ?u.954399
inst✝ : CommRing R
t : R
⊢ comp (X - C t) (X + C t) = X

Next tactic:
simp
theorem aeval_algHom (f : A →ₐ[R] B) (x : A) : aeval (f x) = f.comp (aeval x) :=
  algHom_ext <| by 

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p q : R[X]
x✝ : A
f : A →ₐ[R] B
x : A
⊢ (aeval (f x)) X = (AlgHom.comp f (aeval x)) X

Next tactic:
simp only [aeval_X, AlgHom.comp_apply]
theorem eval_unique (φ : R[X] →ₐ[R] A) (p) : φ p = eval₂ (algebraMap R A) (φ X) p := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q : R[X]
x : A
φ : R[X] →ₐ[R] A
p : R[X]
⊢ φ p = eval₂ (algebraMap R A) (φ X) p

Next tactic:
rw [← aeval_def, aeval_algHom, aeval_X_left, AlgHom.comp_id]
theorem aeval_algHom_apply {F : Type*} [AlgHomClass F R A B] (f : F) (x : A) (p : R[X]) :
    aeval (f x) p = f (aeval x p) := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R A
inst✝² : Algebra R A'
inst✝¹ : Algebra R B
p✝ q : R[X]
x✝ : A
F : Type u_3
inst✝ : AlgHomClass F R A B
f : F
x : A
p : R[X]
⊢ (aeval (f x)) p = f ((aeval x) p)

Next tactic:
refine' Polynomial.induction_on p (by simp [AlgHomClass.commutes]) (fun p q hp hq => _)
    (by simp [AlgHomClass.commutes])
theorem aeval_algHom_apply {F : Type*} [AlgHomClass F R A B] (f : F) (x : A) (p : R[X]) :
    aeval (f x) p = f (aeval x p) := by
  refine' Polynomial.induction_on p (by 

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R A
inst✝² : Algebra R A'
inst✝¹ : Algebra R B
p✝ q : R[X]
x✝ : A
F : Type u_3
inst✝ : AlgHomClass F R A B
f : F
x : A
p : R[X]
⊢ ∀ (a : R), (aeval (f x)) (C a) = f ((aeval x) (C a))

Next tactic:
simp [AlgHomClass.commutes]
theorem aeval_algHom_apply {F : Type*} [AlgHomClass F R A B] (f : F) (x : A) (p : R[X]) :
    aeval (f x) p = f (aeval x p) := by
  refine' Polynomial.induction_on p (by simp [AlgHomClass.commutes]) (fun p q hp hq => _)
    (by 

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R A
inst✝² : Algebra R A'
inst✝¹ : Algebra R B
p✝ q : R[X]
x✝ : A
F : Type u_3
inst✝ : AlgHomClass F R A B
f : F
x : A
p : R[X]
⊢ ∀ (n : ℕ) (a : R),
    (aeval (f x)) (C a * X ^ n) = f ((aeval x) (C a * X ^ n)) →
      (aeval (f x)) (C a * X ^ (n + 1)) = f ((aeval x) (C a * X ^ (n + 1)))

Next tactic:
simp [AlgHomClass.commutes]
theorem aeval_algHom_apply {F : Type*} [AlgHomClass F R A B] (f : F) (x : A) (p : R[X]) :
    aeval (f x) p = f (aeval x p) := by
  refine' Polynomial.induction_on p (by simp [AlgHomClass.commutes]) (fun p q hp hq => _)
    (by simp [AlgHomClass.commutes])
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R A
inst✝² : Algebra R A'
inst✝¹ : Algebra R B
p✝¹ q✝ : R[X]
x✝ : A
F : Type u_3
inst✝ : AlgHomClass F R A B
f : F
x : A
p✝ p q : R[X]
hp : (aeval (f x)) p = f ((aeval x) p)
hq : (aeval (f x)) q = f ((aeval x) q)
⊢ (aeval (f x)) (p + q) = f ((aeval x) (p + q))

Next tactic:
rw [map_add, hp, hq, ← map_add, ← map_add]
theorem coeff_zero_eq_aeval_zero (p : R[X]) : p.coeff 0 = aeval 0 p := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q : R[X]
x : A
p : R[X]
⊢ coeff p 0 = (aeval 0) p

Next tactic:
simp [coeff_zero_eq_eval_zero]
theorem coeff_zero_eq_aeval_zero' (p : R[X]) : algebraMap R A (p.coeff 0) = aeval (0 : A) p := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p✝ q : R[X]
x : A
p : R[X]
⊢ (algebraMap R A) (coeff p 0) = (aeval 0) p

Next tactic:
simp [aeval_def]
theorem map_aeval_eq_aeval_map {S T U : Type*} [CommSemiring S] [CommSemiring T] [Semiring U]
    [Algebra R S] [Algebra T U] {φ : R →+* T} {ψ : S →+* U}
    (h : (algebraMap T U).comp φ = ψ.comp (algebraMap R S)) (p : R[X]) (a : S) :
    ψ (aeval a p) = aeval (ψ a) (p.map φ) := by
  

Proof state:
R : Type u
S✝ : Type v
T✝ : Type w
A : Type z
A' : Type u_1
B : Type u_2
a✝ b : R
n : ℕ
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : Semiring A
inst✝⁹ : CommSemiring A'
inst✝⁸ : Semiring B
inst✝⁷ : Algebra R A
inst✝⁶ : Algebra R A'
inst✝⁵ : Algebra R B
p✝ q : R[X]
x : A
S : Type u_3
T : Type u_4
U : Type u_5
inst✝⁴ : CommSemiring S
inst✝³ : CommSemiring T
inst✝² : Semiring U
inst✝¹ : Algebra R S
inst✝ : Algebra T U
φ : R →+* T
ψ : S →+* U
h : RingHom.comp (algebraMap T U) φ = RingHom.comp ψ (algebraMap R S)
p : R[X]
a : S
⊢ ψ ((aeval a) p) = (aeval (ψ a)) (map φ p)

Next tactic:
conv_rhs => rw [aeval_def, ← eval_map]
theorem map_aeval_eq_aeval_map {S T U : Type*} [CommSemiring S] [CommSemiring T] [Semiring U]
    [Algebra R S] [Algebra T U] {φ : R →+* T} {ψ : S →+* U}
    (h : (algebraMap T U).comp φ = ψ.comp (algebraMap R S)) (p : R[X]) (a : S) :
    ψ (aeval a p) = aeval (ψ a) (p.map φ) := by
  conv_rhs => 

Proof state:
R : Type u
S✝ : Type v
T✝ : Type w
A : Type z
A' : Type u_1
B : Type u_2
a✝ b : R
n : ℕ
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : Semiring A
inst✝⁹ : CommSemiring A'
inst✝⁸ : Semiring B
inst✝⁷ : Algebra R A
inst✝⁶ : Algebra R A'
inst✝⁵ : Algebra R B
p✝ q : R[X]
x : A
S : Type u_3
T : Type u_4
U : Type u_5
inst✝⁴ : CommSemiring S
inst✝³ : CommSemiring T
inst✝² : Semiring U
inst✝¹ : Algebra R S
inst✝ : Algebra T U
φ : R →+* T
ψ : S →+* U
h : RingHom.comp (algebraMap T U) φ = RingHom.comp ψ (algebraMap R S)
p : R[X]
a : S
| (aeval (ψ a)) (map φ p)

Next tactic:
rw [aeval_def, ← eval_map]
theorem map_aeval_eq_aeval_map {S T U : Type*} [CommSemiring S] [CommSemiring T] [Semiring U]
    [Algebra R S] [Algebra T U] {φ : R →+* T} {ψ : S →+* U}
    (h : (algebraMap T U).comp φ = ψ.comp (algebraMap R S)) (p : R[X]) (a : S) :
    ψ (aeval a p) = aeval (ψ a) (p.map φ) := by
  conv_rhs => rw [aeval_def, ← eval_map]
  

Proof state:
R : Type u
S✝ : Type v
T✝ : Type w
A : Type z
A' : Type u_1
B : Type u_2
a✝ b : R
n : ℕ
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : Semiring A
inst✝⁹ : CommSemiring A'
inst✝⁸ : Semiring B
inst✝⁷ : Algebra R A
inst✝⁶ : Algebra R A'
inst✝⁵ : Algebra R B
p✝ q : R[X]
x : A
S : Type u_3
T : Type u_4
U : Type u_5
inst✝⁴ : CommSemiring S
inst✝³ : CommSemiring T
inst✝² : Semiring U
inst✝¹ : Algebra R S
inst✝ : Algebra T U
φ : R →+* T
ψ : S →+* U
h : RingHom.comp (algebraMap T U) φ = RingHom.comp ψ (algebraMap R S)
p : R[X]
a : S
⊢ ψ ((aeval a) p) = eval (ψ a) (map (algebraMap T U) (map φ p))

Next tactic:
rw [map_map, h, ← map_map, eval_map, eval₂_at_apply, aeval_def, eval_map]
theorem aeval_eq_zero_of_dvd_aeval_eq_zero [CommSemiring S] [CommSemiring T] [Algebra S T]
    {p q : S[X]} (h₁ : p ∣ q) {a : T} (h₂ : aeval a p = 0) : aeval a q = 0 := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a✝ b : R
n : ℕ
inst✝⁹ : CommSemiring R
inst✝⁸ : Semiring A
inst✝⁷ : CommSemiring A'
inst✝⁶ : Semiring B
inst✝⁵ : Algebra R A
inst✝⁴ : Algebra R A'
inst✝³ : Algebra R B
p✝ q✝ : R[X]
x : A
inst✝² : CommSemiring S
inst✝¹ : CommSemiring T
inst✝ : Algebra S T
p q : S[X]
h₁ : p ∣ q
a : T
h₂ : (aeval a) p = 0
⊢ (aeval a) q = 0

Next tactic:
rw [aeval_def, ← eval_map] at h₂ ⊢
theorem aeval_eq_zero_of_dvd_aeval_eq_zero [CommSemiring S] [CommSemiring T] [Algebra S T]
    {p q : S[X]} (h₁ : p ∣ q) {a : T} (h₂ : aeval a p = 0) : aeval a q = 0 := by
  rw [aeval_def, ← eval_map] at h₂ ⊢
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a✝ b : R
n : ℕ
inst✝⁹ : CommSemiring R
inst✝⁸ : Semiring A
inst✝⁷ : CommSemiring A'
inst✝⁶ : Semiring B
inst✝⁵ : Algebra R A
inst✝⁴ : Algebra R A'
inst✝³ : Algebra R B
p✝ q✝ : R[X]
x : A
inst✝² : CommSemiring S
inst✝¹ : CommSemiring T
inst✝ : Algebra S T
p q : S[X]
h₁ : p ∣ q
a : T
h₂ : eval a (map (algebraMap S T) p) = 0
⊢ eval a (map (algebraMap S T) q) = 0

Next tactic:
exact eval_eq_zero_of_dvd_of_eval_eq_zero (Polynomial.map_dvd (algebraMap S T) h₁) h₂
theorem _root_.Algebra.adjoin_singleton_eq_range_aeval (x : A) :
    Algebra.adjoin R {x} = (Polynomial.aeval x).range := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring A
inst✝⁴ : CommSemiring A'
inst✝³ : Semiring B
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R B
p q : R[X]
x✝ x : A
⊢ Algebra.adjoin R {x} = AlgHom.range (aeval x)

Next tactic:
rw [← Algebra.map_top, ← adjoin_X, AlgHom.map_adjoin, Set.image_singleton, aeval_X]
theorem aeval_eq_sum_range [Algebra R S] {p : R[X]} (x : S) :
    aeval x p = ∑ i in Finset.range (p.natDegree + 1), p.coeff i • x ^ i := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁸ : CommSemiring R
inst✝⁷ : Semiring A
inst✝⁶ : CommSemiring A'
inst✝⁵ : Semiring B
inst✝⁴ : Algebra R A
inst✝³ : Algebra R A'
inst✝² : Algebra R B
p✝ q : R[X]
x✝ : A
inst✝¹ : Semiring S
f : R →+* S
inst✝ : Algebra R S
p : R[X]
x : S
⊢ (aeval x) p = ∑ i in range (natDegree p + 1), coeff p i • x ^ i

Next tactic:
simp_rw [Algebra.smul_def]
theorem aeval_eq_sum_range [Algebra R S] {p : R[X]} (x : S) :
    aeval x p = ∑ i in Finset.range (p.natDegree + 1), p.coeff i • x ^ i := by
  simp_rw [Algebra.smul_def]
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁸ : CommSemiring R
inst✝⁷ : Semiring A
inst✝⁶ : CommSemiring A'
inst✝⁵ : Semiring B
inst✝⁴ : Algebra R A
inst✝³ : Algebra R A'
inst✝² : Algebra R B
p✝ q : R[X]
x✝ : A
inst✝¹ : Semiring S
f : R →+* S
inst✝ : Algebra R S
p : R[X]
x : S
⊢ (aeval x) p = ∑ x_1 in range (natDegree p + 1), (algebraMap R S) (coeff p x_1) * x ^ x_1

Next tactic:
exact eval₂_eq_sum_range (algebraMap R S) x
theorem aeval_eq_sum_range' [Algebra R S] {p : R[X]} {n : ℕ} (hn : p.natDegree < n) (x : S) :
    aeval x p = ∑ i in Finset.range n, p.coeff i • x ^ i := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n✝ : ℕ
inst✝⁸ : CommSemiring R
inst✝⁷ : Semiring A
inst✝⁶ : CommSemiring A'
inst✝⁵ : Semiring B
inst✝⁴ : Algebra R A
inst✝³ : Algebra R A'
inst✝² : Algebra R B
p✝ q : R[X]
x✝ : A
inst✝¹ : Semiring S
f : R →+* S
inst✝ : Algebra R S
p : R[X]
n : ℕ
hn : natDegree p < n
x : S
⊢ (aeval x) p = ∑ i in range n, coeff p i • x ^ i

Next tactic:
simp_rw [Algebra.smul_def]
theorem aeval_eq_sum_range' [Algebra R S] {p : R[X]} {n : ℕ} (hn : p.natDegree < n) (x : S) :
    aeval x p = ∑ i in Finset.range n, p.coeff i • x ^ i := by
  simp_rw [Algebra.smul_def]
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n✝ : ℕ
inst✝⁸ : CommSemiring R
inst✝⁷ : Semiring A
inst✝⁶ : CommSemiring A'
inst✝⁵ : Semiring B
inst✝⁴ : Algebra R A
inst✝³ : Algebra R A'
inst✝² : Algebra R B
p✝ q : R[X]
x✝ : A
inst✝¹ : Semiring S
f : R →+* S
inst✝ : Algebra R S
p : R[X]
n : ℕ
hn : natDegree p < n
x : S
⊢ (aeval x) p = ∑ x_1 in range n, (algebraMap R S) (coeff p x_1) * x ^ x_1

Next tactic:
exact eval₂_eq_sum_range' (algebraMap R S) hn x
theorem isRoot_of_eval₂_map_eq_zero (hf : Function.Injective f) {r : R} :
    eval₂ f (f r) p = 0 → p.IsRoot r := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R A
inst✝² : Algebra R A'
inst✝¹ : Algebra R B
p q : R[X]
x : A
inst✝ : Semiring S
f : R →+* S
hf : Function.Injective ⇑f
r : R
⊢ eval₂ f (f r) p = 0 → IsRoot p r

Next tactic:
intro h
theorem isRoot_of_eval₂_map_eq_zero (hf : Function.Injective f) {r : R} :
    eval₂ f (f r) p = 0 → p.IsRoot r := by
  intro h
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R A
inst✝² : Algebra R A'
inst✝¹ : Algebra R B
p q : R[X]
x : A
inst✝ : Semiring S
f : R →+* S
hf : Function.Injective ⇑f
r : R
h : eval₂ f (f r) p = 0
⊢ IsRoot p r

Next tactic:
apply hf
theorem isRoot_of_eval₂_map_eq_zero (hf : Function.Injective f) {r : R} :
    eval₂ f (f r) p = 0 → p.IsRoot r := by
  intro h
  apply hf
  

Proof state:
case a
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring A
inst✝⁵ : CommSemiring A'
inst✝⁴ : Semiring B
inst✝³ : Algebra R A
inst✝² : Algebra R A'
inst✝¹ : Algebra R B
p q : R[X]
x : A
inst✝ : Semiring S
f : R →+* S
hf : Function.Injective ⇑f
r : R
h : eval₂ f (f r) p = 0
⊢ f (eval r p) = f 0

Next tactic:
rw [← eval₂_hom, h, f.map_zero]
@[simp]
theorem aevalTower_id : aevalTower (AlgHom.id S S) = aeval := by
  

Proof state:
R : Type u
S : Type v
T : Type w
A : Type z
A' : Type u_1
B : Type u_2
a b : R
n : ℕ
inst✝¹⁰ : CommSemiring R
inst✝⁹ : Semiring A
inst✝⁸ : CommSemiring A'
inst✝⁷ : Semiring B
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R A'
inst✝⁴ : Algebra R B
p q : R[X]
x : A
inst✝³ : CommSemiring S
inst✝² : Algebra S R
inst✝¹ : Algebra S A'
inst✝ : Algebra S B
g : R →ₐ[S] A'
y : A'
⊢ aevalTower (AlgHom.id S S) = aeval

Next tactic:
ext s