l3lab/ntp-mathlib huggingface dataset:
lemma minpolyDiv_eval_eq_zero_of_ne_of_aeval_eq_zero [IsDomain S]
    {y} (hxy : y ≠ x) (hy : aeval y (minpoly R x) = 0) : (minpolyDiv R x).eval y = 0 := by
  rw [aeval_def, ← eval_map, ← minpolyDiv_spec R x] at hy
  

Proof state:
R : Type u_2
K : Type ?u.123788
L : Type ?u.123791
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : IsDomain S
y : S
hxy : y ≠ x
hy : eval y (minpolyDiv R x * (X - C x)) = 0
⊢ eval y (minpolyDiv R x) = 0

Next tactic:
simp only [eval_mul, eval_sub, eval_X, eval_C, mul_eq_zero] at hy
lemma minpolyDiv_eval_eq_zero_of_ne_of_aeval_eq_zero [IsDomain S]
    {y} (hxy : y ≠ x) (hy : aeval y (minpoly R x) = 0) : (minpolyDiv R x).eval y = 0 := by
  rw [aeval_def, ← eval_map, ← minpolyDiv_spec R x] at hy
  simp only [eval_mul, eval_sub, eval_X, eval_C, mul_eq_zero] at hy
  

Proof state:
R : Type u_2
K : Type ?u.123788
L : Type ?u.123791
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : IsDomain S
y : S
hxy : y ≠ x
hy : eval y (minpolyDiv R x) = 0 ∨ y - x = 0
⊢ eval y (minpolyDiv R x) = 0

Next tactic:
exact hy.resolve_right (by rwa [sub_eq_zero])
lemma minpolyDiv_eval_eq_zero_of_ne_of_aeval_eq_zero [IsDomain S]
    {y} (hxy : y ≠ x) (hy : aeval y (minpoly R x) = 0) : (minpolyDiv R x).eval y = 0 := by
  rw [aeval_def, ← eval_map, ← minpolyDiv_spec R x] at hy
  simp only [eval_mul, eval_sub, eval_X, eval_C, mul_eq_zero] at hy
  exact hy.resolve_right (by 

Proof state:
R : Type u_2
K : Type ?u.123788
L : Type ?u.123791
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : IsDomain S
y : S
hxy : y ≠ x
hy : eval y (minpolyDiv R x) = 0 ∨ y - x = 0
⊢ ¬y - x = 0

Next tactic:
rwa [sub_eq_zero]
lemma eval₂_minpolyDiv_of_eval₂_eq_zero {T} [CommRing T]
    [IsDomain T] [DecidableEq T] {x y}
    (σ : S →+* T) (hy : eval₂ (σ.comp (algebraMap R S)) y (minpoly R x) = 0) :
    eval₂ σ y (minpolyDiv R x) =
      if σ x = y then σ (aeval x (derivative <| minpoly R x)) else 0 := by
  

Proof state:
R : Type u_3
K : Type ?u.144971
L : Type ?u.144974
S : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : Field K
inst✝⁶ : Field L
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
T : Type u_1
inst✝² : CommRing T
inst✝¹ : IsDomain T
inst✝ : DecidableEq T
x : S
y : T
σ : S →+* T
hy : eval₂ (RingHom.comp σ (algebraMap R S)) y (minpoly R x) = 0
⊢ eval₂ σ y (minpolyDiv R x) = if σ x = y then σ ((aeval x) (derivative (minpoly R x))) else 0

Next tactic:
split_ifs with h
lemma eval₂_minpolyDiv_of_eval₂_eq_zero {T} [CommRing T]
    [IsDomain T] [DecidableEq T] {x y}
    (σ : S →+* T) (hy : eval₂ (σ.comp (algebraMap R S)) y (minpoly R x) = 0) :
    eval₂ σ y (minpolyDiv R x) =
      if σ x = y then σ (aeval x (derivative <| minpoly R x)) else 0 := by
  split_ifs with h
  · 

Proof state:
case pos
R : Type u_3
K : Type ?u.144971
L : Type ?u.144974
S : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : Field K
inst✝⁶ : Field L
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
T : Type u_1
inst✝² : CommRing T
inst✝¹ : IsDomain T
inst✝ : DecidableEq T
x : S
y : T
σ : S →+* T
hy : eval₂ (RingHom.comp σ (algebraMap R S)) y (minpoly R x) = 0
h : σ x = y
⊢ eval₂ σ y (minpolyDiv R x) = σ ((aeval x) (derivative (minpoly R x)))

Next tactic:
rw [← h, eval₂_hom, eval_minpolyDiv_self]
lemma eval₂_minpolyDiv_of_eval₂_eq_zero {T} [CommRing T]
    [IsDomain T] [DecidableEq T] {x y}
    (σ : S →+* T) (hy : eval₂ (σ.comp (algebraMap R S)) y (minpoly R x) = 0) :
    eval₂ σ y (minpolyDiv R x) =
      if σ x = y then σ (aeval x (derivative <| minpoly R x)) else 0 := by
  split_ifs with h
  · rw [← h, eval₂_hom, eval_minpolyDiv_self]
  · 

Proof state:
case neg
R : Type u_3
K : Type ?u.144971
L : Type ?u.144974
S : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : Field K
inst✝⁶ : Field L
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
T : Type u_1
inst✝² : CommRing T
inst✝¹ : IsDomain T
inst✝ : DecidableEq T
x : S
y : T
σ : S →+* T
hy : eval₂ (RingHom.comp σ (algebraMap R S)) y (minpoly R x) = 0
h : ¬σ x = y
⊢ eval₂ σ y (minpolyDiv R x) = 0

Next tactic:
rw [← eval₂_map, ← minpolyDiv_spec] at hy
lemma eval₂_minpolyDiv_of_eval₂_eq_zero {T} [CommRing T]
    [IsDomain T] [DecidableEq T] {x y}
    (σ : S →+* T) (hy : eval₂ (σ.comp (algebraMap R S)) y (minpoly R x) = 0) :
    eval₂ σ y (minpolyDiv R x) =
      if σ x = y then σ (aeval x (derivative <| minpoly R x)) else 0 := by
  split_ifs with h
  · rw [← h, eval₂_hom, eval_minpolyDiv_self]
  · rw [← eval₂_map, ← minpolyDiv_spec] at hy
    

Proof state:
case neg
R : Type u_3
K : Type ?u.144971
L : Type ?u.144974
S : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : Field K
inst✝⁶ : Field L
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
T : Type u_1
inst✝² : CommRing T
inst✝¹ : IsDomain T
inst✝ : DecidableEq T
x : S
y : T
σ : S →+* T
hy : eval₂ σ y (minpolyDiv R x * (X - C x)) = 0
h : ¬σ x = y
⊢ eval₂ σ y (minpolyDiv R x) = 0

Next tactic:
simpa [sub_eq_zero, Ne.symm h] using hy
lemma eval₂_minpolyDiv_self {T} [CommRing T] [Algebra R T] [IsDomain T] [DecidableEq T] (x : S)
    (σ₁ σ₂ : S →ₐ[R] T) :
    eval₂ σ₁ (σ₂ x) (minpolyDiv R x) =
      if σ₁ x = σ₂ x then σ₁ (aeval x (derivative <| minpoly R x)) else 0 := by
  

Proof state:
R : Type u_2
K : Type ?u.221848
L : Type ?u.221851
S : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : Field K
inst✝⁷ : Field L
inst✝⁶ : CommRing S
inst✝⁵ : Algebra R S
inst✝⁴ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
T : Type u_1
inst✝³ : CommRing T
inst✝² : Algebra R T
inst✝¹ : IsDomain T
inst✝ : DecidableEq T
x : S
σ₁ σ₂ : S →ₐ[R] T
⊢ eval₂ (↑σ₁) (σ₂ x) (minpolyDiv R x) = if σ₁ x = σ₂ x then σ₁ ((aeval x) (derivative (minpoly R x))) else 0

Next tactic:
apply eval₂_minpolyDiv_of_eval₂_eq_zero
lemma eval₂_minpolyDiv_self {T} [CommRing T] [Algebra R T] [IsDomain T] [DecidableEq T] (x : S)
    (σ₁ σ₂ : S →ₐ[R] T) :
    eval₂ σ₁ (σ₂ x) (minpolyDiv R x) =
      if σ₁ x = σ₂ x then σ₁ (aeval x (derivative <| minpoly R x)) else 0 := by
  apply eval₂_minpolyDiv_of_eval₂_eq_zero
  

Proof state:
case hy
R : Type u_2
K : Type ?u.221848
L : Type ?u.221851
S : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : Field K
inst✝⁷ : Field L
inst✝⁶ : CommRing S
inst✝⁵ : Algebra R S
inst✝⁴ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
T : Type u_1
inst✝³ : CommRing T
inst✝² : Algebra R T
inst✝¹ : IsDomain T
inst✝ : DecidableEq T
x : S
σ₁ σ₂ : S →ₐ[R] T
⊢ eval₂ (RingHom.comp (↑σ₁) (algebraMap R S)) (σ₂ x) (minpoly R x) = 0

Next tactic:
rw [AlgHom.comp_algebraMap, ← σ₂.comp_algebraMap, ← eval₂_map, ← RingHom.coe_coe, eval₂_hom,
    eval_map, ← aeval_def, minpoly.aeval, map_zero]
lemma eval_minpolyDiv_of_aeval_eq_zero [IsDomain S] [DecidableEq S]
    {y} (hy : aeval y (minpoly R x) = 0) :
    (minpolyDiv R x).eval y = if x = y then aeval x (derivative <| minpoly R x) else 0 := by
  

Proof state:
R : Type u_2
K : Type ?u.313869
L : Type ?u.313872
S : Type u_1
inst✝⁷ : CommRing R
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : CommRing S
inst✝³ : Algebra R S
inst✝² : Algebra K L
x : S
hx : IsIntegral R x
inst✝¹ : IsDomain S
inst✝ : DecidableEq S
y : S
hy : (aeval y) (minpoly R x) = 0
⊢ eval y (minpolyDiv R x) = if x = y then (aeval x) (derivative (minpoly R x)) else 0

Next tactic:
rw [eval, eval₂_minpolyDiv_of_eval₂_eq_zero]
lemma eval_minpolyDiv_of_aeval_eq_zero [IsDomain S] [DecidableEq S]
    {y} (hy : aeval y (minpoly R x) = 0) :
    (minpolyDiv R x).eval y = if x = y then aeval x (derivative <| minpoly R x) else 0 := by
  rw [eval, eval₂_minpolyDiv_of_eval₂_eq_zero]; 

Proof state:
R : Type u_2
K : Type ?u.313869
L : Type ?u.313872
S : Type u_1
inst✝⁷ : CommRing R
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : CommRing S
inst✝³ : Algebra R S
inst✝² : Algebra K L
x : S
hx : IsIntegral R x
inst✝¹ : IsDomain S
inst✝ : DecidableEq S
y : S
hy : (aeval y) (minpoly R x) = 0
⊢ (if (RingHom.id S) x = y then (RingHom.id S) ((aeval x) (derivative (minpoly R x))) else 0) =
    if x = y then (aeval x) (derivative (minpoly R x)) else 0
case hy
R : Type u_2
K : Type ?u.313869
L : Type ?u.313872
S : Type u_1
inst✝⁷ : CommRing R
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : CommRing S
inst✝³ : Algebra R S
inst✝² : Algebra K L
x : S
hx : IsIntegral R x
inst✝¹ : IsDomain S
inst✝ : DecidableEq S
y : S
hy : (aeval y) (minpoly R x) = 0
⊢ eval₂ (RingHom.comp (RingHom.id S) (algebraMap R S)) y (minpoly R x) = 0

Next tactic:
rfl
lemma eval_minpolyDiv_of_aeval_eq_zero [IsDomain S] [DecidableEq S]
    {y} (hy : aeval y (minpoly R x) = 0) :
    (minpolyDiv R x).eval y = if x = y then aeval x (derivative <| minpoly R x) else 0 := by
  rw [eval, eval₂_minpolyDiv_of_eval₂_eq_zero]; rfl
  

Proof state:
case hy
R : Type u_2
K : Type ?u.313869
L : Type ?u.313872
S : Type u_1
inst✝⁷ : CommRing R
inst✝⁶ : Field K
inst✝⁵ : Field L
inst✝⁴ : CommRing S
inst✝³ : Algebra R S
inst✝² : Algebra K L
x : S
hx : IsIntegral R x
inst✝¹ : IsDomain S
inst✝ : DecidableEq S
y : S
hy : (aeval y) (minpoly R x) = 0
⊢ eval₂ (RingHom.comp (RingHom.id S) (algebraMap R S)) y (minpoly R x) = 0

Next tactic:
exact hy
lemma natDegree_minpolyDiv_succ [Nontrivial S] :
    natDegree (minpolyDiv R x) + 1 = natDegree (minpoly R x) := by
  

Proof state:
R : Type u_2
K : Type ?u.353602
L : Type ?u.353605
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : Nontrivial S
⊢ natDegree (minpolyDiv R x) + 1 = natDegree (minpoly R x)

Next tactic:
rw [← (minpoly.monic hx).natDegree_map (algebraMap R S), ← minpolyDiv_spec, natDegree_mul']
lemma natDegree_minpolyDiv_succ [Nontrivial S] :
    natDegree (minpolyDiv R x) + 1 = natDegree (minpoly R x) := by
  rw [← (minpoly.monic hx).natDegree_map (algebraMap R S), ← minpolyDiv_spec, natDegree_mul']
  · 

Proof state:
R : Type u_2
K : Type ?u.353602
L : Type ?u.353605
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : Nontrivial S
⊢ natDegree (minpolyDiv R x) + 1 = natDegree (minpolyDiv R x) + natDegree (X - C x)

Next tactic:
simp
lemma natDegree_minpolyDiv_succ [Nontrivial S] :
    natDegree (minpolyDiv R x) + 1 = natDegree (minpoly R x) := by
  rw [← (minpoly.monic hx).natDegree_map (algebraMap R S), ← minpolyDiv_spec, natDegree_mul']
  · simp
  · 

Proof state:
R : Type u_2
K : Type ?u.353602
L : Type ?u.353605
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : Nontrivial S
⊢ leadingCoeff (minpolyDiv R x) * leadingCoeff (X - C x) ≠ 0

Next tactic:
simpa using minpolyDiv_ne_zero hx
lemma natDegree_minpolyDiv :
    natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1 := by
  

Proof state:
R : Type u_2
K : Type ?u.356831
L : Type ?u.356834
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x : S
hx : IsIntegral R x
⊢ natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1

Next tactic:
nontriviality S
lemma natDegree_minpolyDiv :
    natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1 := by
  nontriviality S
  

Proof state:
R : Type u_2
K : Type ?u.356831
L : Type ?u.356834
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x : S
hx : IsIntegral R x
✝ : Nontrivial S
⊢ natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1

Next tactic:
by_cases hx : IsIntegral R x
lemma natDegree_minpolyDiv :
    natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1 := by
  nontriviality S
  by_cases hx : IsIntegral R x
  · 

Proof state:
case pos
R : Type u_2
K : Type ?u.356831
L : Type ?u.356834
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x : S
hx✝ : IsIntegral R x
✝ : Nontrivial S
hx : IsIntegral R x
⊢ natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1

Next tactic:
rw [← natDegree_minpolyDiv_succ hx]
lemma natDegree_minpolyDiv :
    natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1 := by
  nontriviality S
  by_cases hx : IsIntegral R x
  · rw [← natDegree_minpolyDiv_succ hx]; 

Proof state:
case pos
R : Type u_2
K : Type ?u.356831
L : Type ?u.356834
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x : S
hx✝ : IsIntegral R x
✝ : Nontrivial S
hx : IsIntegral R x
⊢ natDegree (minpolyDiv R x) = natDegree (minpolyDiv R x) + 1 - 1

Next tactic:
rfl
lemma natDegree_minpolyDiv :
    natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1 := by
  nontriviality S
  by_cases hx : IsIntegral R x
  · rw [← natDegree_minpolyDiv_succ hx]; rfl
  · 

Proof state:
case neg
R : Type u_2
K : Type ?u.356831
L : Type ?u.356834
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x : S
hx✝ : IsIntegral R x
✝ : Nontrivial S
hx : ¬IsIntegral R x
⊢ natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1

Next tactic:
rw [minpolyDiv_eq_zero hx, minpoly.eq_zero hx]
lemma natDegree_minpolyDiv :
    natDegree (minpolyDiv R x) = natDegree (minpoly R x) - 1 := by
  nontriviality S
  by_cases hx : IsIntegral R x
  · rw [← natDegree_minpolyDiv_succ hx]; rfl
  · rw [minpolyDiv_eq_zero hx, minpoly.eq_zero hx]; 

Proof state:
case neg
R : Type u_2
K : Type ?u.356831
L : Type ?u.356834
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x : S
hx✝ : IsIntegral R x
✝ : Nontrivial S
hx : ¬IsIntegral R x
⊢ natDegree 0 = natDegree 0 - 1

Next tactic:
rfl
lemma natDegree_minpolyDiv_lt [Nontrivial S] :
    natDegree (minpolyDiv R x) < natDegree (minpoly R x) := by
  

Proof state:
R : Type u_2
K : Type ?u.361674
L : Type ?u.361677
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : Nontrivial S
⊢ natDegree (minpolyDiv R x) < natDegree (minpoly R x)

Next tactic:
rw [← natDegree_minpolyDiv_succ hx]
lemma natDegree_minpolyDiv_lt [Nontrivial S] :
    natDegree (minpolyDiv R x) < natDegree (minpoly R x) := by
  rw [← natDegree_minpolyDiv_succ hx]
  

Proof state:
R : Type u_2
K : Type ?u.361674
L : Type ?u.361677
S : Type u_1
inst✝⁶ : CommRing R
inst✝⁵ : Field K
inst✝⁴ : Field L
inst✝³ : CommRing S
inst✝² : Algebra R S
inst✝¹ : Algebra K L
x : S
hx : IsIntegral R x
inst✝ : Nontrivial S
⊢ natDegree (minpolyDiv R x) < natDegree (minpolyDiv R x) + 1

Next tactic:
exact Nat.lt.base _
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  

Proof state:
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
⊢ coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x}

Next tactic:
by_contra H
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  

Proof state:
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
⊢ False

Next tactic:
have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · 

Proof state:
case this
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
⊢ ∀ (j : ℕ), coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}

Next tactic:
intro j
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; 

Proof state:
case this
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
j : ℕ
⊢ coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}

Next tactic:
induction j with
    | zero => exact H
    | succ j IH =>
      intro H; apply IH
      rw [coeff_minpolyDiv]
      refine add_mem ?_ (mul_mem H (Algebra.self_mem_adjoin_singleton R x))
      exact Subalgebra.algebraMap_mem _ _
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    

Proof state:
case this.zero
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
⊢ coeff (minpolyDiv R x) (i + Nat.zero) ∉ Algebra.adjoin R {x}

Next tactic:
| zero => exact H
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => 

Proof state:
case this.zero
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
⊢ coeff (minpolyDiv R x) (i + Nat.zero) ∉ Algebra.adjoin R {x}

Next tactic:
exact H
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => exact H
    

Proof state:
case this.succ
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
j : ℕ
IH : coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
⊢ coeff (minpolyDiv R x) (i + Nat.succ j) ∉ Algebra.adjoin R {x}

Next tactic:
| succ j IH =>
      intro H; apply IH
      rw [coeff_minpolyDiv]
      refine add_mem ?_ (mul_mem H (Algebra.self_mem_adjoin_singleton R x))
      exact Subalgebra.algebraMap_mem _ _
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => exact H
    | succ j IH =>
      

Proof state:
case this.succ
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
j : ℕ
IH : coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
⊢ coeff (minpolyDiv R x) (i + Nat.succ j) ∉ Algebra.adjoin R {x}

Next tactic:
intro H
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => exact H
    | succ j IH =>
      intro H; 

Proof state:
case this.succ
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H✝ : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
j : ℕ
IH : coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
H : coeff (minpolyDiv R x) (i + Nat.succ j) ∈ Algebra.adjoin R {x}
⊢ False

Next tactic:
apply IH
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => exact H
    | succ j IH =>
      intro H; apply IH
      

Proof state:
case this.succ
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H✝ : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
j : ℕ
IH : coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
H : coeff (minpolyDiv R x) (i + Nat.succ j) ∈ Algebra.adjoin R {x}
⊢ coeff (minpolyDiv R x) (i + j) ∈ Algebra.adjoin R {x}

Next tactic:
rw [coeff_minpolyDiv]
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => exact H
    | succ j IH =>
      intro H; apply IH
      rw [coeff_minpolyDiv]
      

Proof state:
case this.succ
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H✝ : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
j : ℕ
IH : coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
H : coeff (minpolyDiv R x) (i + Nat.succ j) ∈ Algebra.adjoin R {x}
⊢ (algebraMap R S) (coeff (minpoly R x) (i + j + 1)) + coeff (minpolyDiv R x) (i + j + 1) * x ∈ Algebra.adjoin R {x}

Next tactic:
refine add_mem ?_ (mul_mem H (Algebra.self_mem_adjoin_singleton R x))
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => exact H
    | succ j IH =>
      intro H; apply IH
      rw [coeff_minpolyDiv]
      refine add_mem ?_ (mul_mem H (Algebra.self_mem_adjoin_singleton R x))
      

Proof state:
case this.succ
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H✝ : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
j : ℕ
IH : coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
H : coeff (minpolyDiv R x) (i + Nat.succ j) ∈ Algebra.adjoin R {x}
⊢ (algebraMap R S) (coeff (minpoly R x) (i + j + 1)) ∈ Algebra.adjoin R {x}

Next tactic:
exact Subalgebra.algebraMap_mem _ _
lemma coeff_minpolyDiv_mem_adjoin (x : S) (i) :
    coeff (minpolyDiv R x) i ∈ Algebra.adjoin R {x} := by
  by_contra H
  have : ∀ j, coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
  · intro j; induction j with
    | zero => exact H
    | succ j IH =>
      intro H; apply IH
      rw [coeff_minpolyDiv]
      refine add_mem ?_ (mul_mem H (Algebra.self_mem_adjoin_singleton R x))
      exact Subalgebra.algebraMap_mem _ _
  

Proof state:
R : Type u_2
K : Type ?u.362955
L : Type ?u.362958
S : Type u_1
inst✝⁵ : CommRing R
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
x : S
i : ℕ
H : coeff (minpolyDiv R x) i ∉ Algebra.adjoin R {x}
this : ∀ (j : ℕ), coeff (minpolyDiv R x) (i + j) ∉ Algebra.adjoin R {x}
⊢ False

Next tactic:
apply this (natDegree (minpolyDiv R x) + 1)