Theorem: Polynomial.ringHom_ext
File: Mathlib/Data/Polynomial/Monomial.lean

tactic: set f' := f.comp (toFinsuppIso R).symm.toRingHom with hf'
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
⊢ f = g

tactic: set g' := g.comp (toFinsuppIso R).symm.toRingHom with hg'
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
⊢ f = g

tactic: have B : f = f'.comp (toFinsuppIso R) := by
  rw [hf', RingHom.comp_assoc]
  ext x
  simp only [RingEquiv.toRingHom_eq_coe, RingEquiv.symm_apply_apply, Function.comp_apply,
    RingHom.coe_comp, RingEquiv.coe_toRingHom]
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
⊢ f = g

tactic: have C' : g = g'.comp (toFinsuppIso R) := by
  rw [hg', RingHom.comp_assoc]
  ext x
  simp only [RingEquiv.toRingHom_eq_coe, RingEquiv.symm_apply_apply, Function.comp_apply,
    RingHom.coe_comp, RingEquiv.coe_toRingHom]
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
B : f = RingHom.comp f' ↑(toFinsuppIso R)
⊢ f = g

tactic: rw [B, C', A]
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
B : f = RingHom.comp f' ↑(toFinsuppIso R)
C' : g = RingHom.comp g' ↑(toFinsuppIso R)
⊢ f = g

tactic: ext : 1
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
⊢ f' = g'

tactic: ext
state_before: case h₁
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
⊢ RingHom.comp f' AddMonoidAlgebra.singleZeroRingHom = RingHom.comp g' AddMonoidAlgebra.singleZeroRingHom

tactic: simp [h₁, RingEquiv.toRingHom_eq_coe]
state_before: case h₁.a
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
x✝ : R
⊢ ↑(RingHom.comp f' AddMonoidAlgebra.singleZeroRingHom) x✝ = ↑(RingHom.comp g' AddMonoidAlgebra.singleZeroRingHom) x✝

tactic: refine MonoidHom.ext_mnat ?_
state_before: case h_of
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
⊢ MonoidHom.comp (↑f') (AddMonoidAlgebra.of R ℕ) = MonoidHom.comp (↑g') (AddMonoidAlgebra.of R ℕ)

tactic: simpa [RingEquiv.toRingHom_eq_coe] using h₂
state_before: case h_of
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
⊢ ↑(MonoidHom.comp (↑f') (AddMonoidAlgebra.of R ℕ)) (↑Multiplicative.ofAdd 1) =
    ↑(MonoidHom.comp (↑g') (AddMonoidAlgebra.of R ℕ)) (↑Multiplicative.ofAdd 1)

tactic: rw [hf', RingHom.comp_assoc]
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
⊢ f = RingHom.comp f' ↑(toFinsuppIso R)

tactic: ext x
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
⊢ f = RingHom.comp f (RingHom.comp (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R))) ↑(toFinsuppIso R))

tactic: simp only [RingEquiv.toRingHom_eq_coe, RingEquiv.symm_apply_apply, Function.comp_apply,
  RingHom.coe_comp, RingEquiv.coe_toRingHom]
state_before: case a
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
x : R[X]
⊢ ↑f x = ↑(RingHom.comp f (RingHom.comp (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R))) ↑(toFinsuppIso R))) x

tactic: rw [hg', RingHom.comp_assoc]
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
B : f = RingHom.comp f' ↑(toFinsuppIso R)
⊢ g = RingHom.comp g' ↑(toFinsuppIso R)

tactic: ext x
state_before: R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
B : f = RingHom.comp f' ↑(toFinsuppIso R)
⊢ g = RingHom.comp g (RingHom.comp (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R))) ↑(toFinsuppIso R))

tactic: simp only [RingEquiv.toRingHom_eq_coe, RingEquiv.symm_apply_apply, Function.comp_apply,
  RingHom.coe_comp, RingEquiv.coe_toRingHom]
state_before: case a
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q r : R[X]
S : Type u_1
inst✝ : Semiring S
f g : R[X] →+* S
h₁ : ∀ (a : R), ↑f (↑C a) = ↑g (↑C a)
h₂ : ↑f X = ↑g X
f' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hf' : f' = RingHom.comp f (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
g' : AddMonoidAlgebra R ℕ →+* S := RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
hg' : g' = RingHom.comp g (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R)))
A : f' = g'
B : f = RingHom.comp f' ↑(toFinsuppIso R)
x : R[X]
⊢ ↑g x = ↑(RingHom.comp g (RingHom.comp (RingEquiv.toRingHom (RingEquiv.symm (toFinsuppIso R))) ↑(toFinsuppIso R))) x