Theorem: minpoly.unique
File: Mathlib/FieldTheory/Minpoly/Field.lean

tactic: have hx : IsIntegral A x := ⟨p, pmonic, hp⟩
state_before: A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
⊢ p = minpoly A x

tactic: symm
state_before: A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
⊢ p = minpoly A x

tactic: apply eq_of_sub_eq_zero
state_before: A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
⊢ minpoly A x = p

tactic: by_contra hnz
state_before: case h
A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
⊢ minpoly A x - p = 0

tactic: have hd := degree_le_of_ne_zero A x hnz (by simp [hp])
state_before: case h
A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
hnz : ¬minpoly A x - p = 0
⊢ False

tactic: contrapose! hd
state_before: case h
A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
hnz : ¬minpoly A x - p = 0
hd : degree (minpoly A x) ≤ degree (minpoly A x - p)
⊢ False

tactic: apply degree_sub_lt _ (minpoly.ne_zero hx)
state_before: case h
A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
hnz : ¬minpoly A x - p = 0
hd : ¬False
⊢ degree (minpoly A x - p) < degree (minpoly A x)

tactic: simp [hp]
state_before: A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
hnz : ¬minpoly A x - p = 0
⊢ ↑(Polynomial.aeval x) (minpoly A x - p) = 0

tactic: rw [(monic hx).leadingCoeff, pmonic.leadingCoeff]
state_before: case h
A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
hnz : ¬minpoly A x - p = 0
hd : ¬False
⊢ leadingCoeff (minpoly A x) = leadingCoeff p

tactic: exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x))
state_before: A : Type u_1
B : Type u_2
inst✝² : Field A
inst✝¹ : Ring B
inst✝ : Algebra A B
x : B
p : A[X]
pmonic : Monic p
hp : ↑(Polynomial.aeval x) p = 0
pmin : ∀ (q : A[X]), Monic q → ↑(Polynomial.aeval x) q = 0 → degree p ≤ degree q
hx : IsIntegral A x
hnz : ¬minpoly A x - p = 0
hd : ¬False
⊢ degree (minpoly A x) = degree p