l3lab/ntp-mathlib huggingface dataset:
theorem toIcoDiv_eq_floor (a b : α) : toIcoDiv hp a b = ⌊(b - a) / p⌋ := by
  refine' toIcoDiv_eq_of_sub_zsmul_mem_Ico hp _
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ b - ⌊(b - a) / p⌋ • p ∈ Set.Ico a (a + p)

Next tactic:
rw [Set.mem_Ico, zsmul_eq_mul, ← sub_nonneg, add_comm, sub_right_comm, ← sub_lt_iff_lt_add,
    sub_right_comm _ _ a]
theorem toIcoDiv_eq_floor (a b : α) : toIcoDiv hp a b = ⌊(b - a) / p⌋ := by
  refine' toIcoDiv_eq_of_sub_zsmul_mem_Ico hp _
  rw [Set.mem_Ico, zsmul_eq_mul, ← sub_nonneg, add_comm, sub_right_comm, ← sub_lt_iff_lt_add,
    sub_right_comm _ _ a]
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ 0 ≤ b - a - ↑⌊(b - a) / p⌋ * p ∧ b - a - ↑⌊(b - a) / p⌋ * p < p

Next tactic:
exact ⟨Int.sub_floor_div_mul_nonneg _ hp, Int.sub_floor_div_mul_lt _ hp⟩
theorem toIocDiv_eq_neg_floor (a b : α) : toIocDiv hp a b = -⌊(a + p - b) / p⌋ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ toIocDiv hp a b = -⌊(a + p - b) / p⌋

Next tactic:
refine' toIocDiv_eq_of_sub_zsmul_mem_Ioc hp _
theorem toIocDiv_eq_neg_floor (a b : α) : toIocDiv hp a b = -⌊(a + p - b) / p⌋ := by
  refine' toIocDiv_eq_of_sub_zsmul_mem_Ioc hp _
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ b - -⌊(a + p - b) / p⌋ • p ∈ Set.Ioc a (a + p)

Next tactic:
rw [Set.mem_Ioc, zsmul_eq_mul, Int.cast_neg, neg_mul, sub_neg_eq_add, ← sub_nonneg,
    sub_add_eq_sub_sub]
theorem toIocDiv_eq_neg_floor (a b : α) : toIocDiv hp a b = -⌊(a + p - b) / p⌋ := by
  refine' toIocDiv_eq_of_sub_zsmul_mem_Ioc hp _
  rw [Set.mem_Ioc, zsmul_eq_mul, Int.cast_neg, neg_mul, sub_neg_eq_add, ← sub_nonneg,
    sub_add_eq_sub_sub]
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ a < b + ↑⌊(a + p - b) / p⌋ * p ∧ 0 ≤ a + p - b - ↑⌊(a + p - b) / p⌋ * p

Next tactic:
refine' ⟨_, Int.sub_floor_div_mul_nonneg _ hp⟩
theorem toIocDiv_eq_neg_floor (a b : α) : toIocDiv hp a b = -⌊(a + p - b) / p⌋ := by
  refine' toIocDiv_eq_of_sub_zsmul_mem_Ioc hp _
  rw [Set.mem_Ioc, zsmul_eq_mul, Int.cast_neg, neg_mul, sub_neg_eq_add, ← sub_nonneg,
    sub_add_eq_sub_sub]
  refine' ⟨_, Int.sub_floor_div_mul_nonneg _ hp⟩
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ a < b + ↑⌊(a + p - b) / p⌋ * p

Next tactic:
rw [← add_lt_add_iff_right p, add_assoc, add_comm b, ← sub_lt_iff_lt_add, add_comm (_ * _), ←
    sub_lt_iff_lt_add]
theorem toIocDiv_eq_neg_floor (a b : α) : toIocDiv hp a b = -⌊(a + p - b) / p⌋ := by
  refine' toIocDiv_eq_of_sub_zsmul_mem_Ioc hp _
  rw [Set.mem_Ioc, zsmul_eq_mul, Int.cast_neg, neg_mul, sub_neg_eq_add, ← sub_nonneg,
    sub_add_eq_sub_sub]
  refine' ⟨_, Int.sub_floor_div_mul_nonneg _ hp⟩
  rw [← add_lt_add_iff_right p, add_assoc, add_comm b, ← sub_lt_iff_lt_add, add_comm (_ * _), ←
    sub_lt_iff_lt_add]
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ a + p - b - ↑⌊(a + p - b) / p⌋ * p < p

Next tactic:
exact Int.sub_floor_div_mul_lt _ hp
theorem toIcoDiv_zero_one (b : α) : toIcoDiv (zero_lt_one' α) 0 b = ⌊b⌋ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
b : α
⊢ toIcoDiv (_ : 0 < 1) 0 b = ⌊b⌋

Next tactic:
simp [toIcoDiv_eq_floor]
theorem toIcoMod_eq_add_fract_mul (a b : α) :
    toIcoMod hp a b = a + Int.fract ((b - a) / p) * p := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ toIcoMod hp a b = a + Int.fract ((b - a) / p) * p

Next tactic:
rw [toIcoMod, toIcoDiv_eq_floor, Int.fract]
theorem toIcoMod_eq_add_fract_mul (a b : α) :
    toIcoMod hp a b = a + Int.fract ((b - a) / p) * p := by
  rw [toIcoMod, toIcoDiv_eq_floor, Int.fract]
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ b - ⌊(b - a) / p⌋ • p = a + ((b - a) / p - ↑⌊(b - a) / p⌋) * p

Next tactic:
field_simp
theorem toIcoMod_eq_add_fract_mul (a b : α) :
    toIcoMod hp a b = a + Int.fract ((b - a) / p) * p := by
  rw [toIcoMod, toIcoDiv_eq_floor, Int.fract]
  field_simp
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ b - ↑⌊(b - a) / p⌋ * p = a + (b - a - p * ↑⌊(b - a) / p⌋)

Next tactic:
ring
theorem toIcoMod_eq_fract_mul (b : α) : toIcoMod hp 0 b = Int.fract (b / p) * p := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
b : α
⊢ toIcoMod hp 0 b = Int.fract (b / p) * p

Next tactic:
simp [toIcoMod_eq_add_fract_mul]
theorem toIocMod_eq_sub_fract_mul (a b : α) :
    toIocMod hp a b = a + p - Int.fract ((a + p - b) / p) * p := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ toIocMod hp a b = a + p - Int.fract ((a + p - b) / p) * p

Next tactic:
rw [toIocMod, toIocDiv_eq_neg_floor, Int.fract]
theorem toIocMod_eq_sub_fract_mul (a b : α) :
    toIocMod hp a b = a + p - Int.fract ((a + p - b) / p) * p := by
  rw [toIocMod, toIocDiv_eq_neg_floor, Int.fract]
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ b - -⌊(a + p - b) / p⌋ • p = a + p - ((a + p - b) / p - ↑⌊(a + p - b) / p⌋) * p

Next tactic:
field_simp
theorem toIocMod_eq_sub_fract_mul (a b : α) :
    toIocMod hp a b = a + p - Int.fract ((a + p - b) / p) * p := by
  rw [toIocMod, toIocDiv_eq_neg_floor, Int.fract]
  field_simp
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
a b : α
⊢ b + ↑⌊(a + p - b) / p⌋ * p = a + p - (a + p - b - p * ↑⌊(a + p - b) / p⌋)

Next tactic:
ring
theorem toIcoMod_zero_one (b : α) : toIcoMod (zero_lt_one' α) 0 b = Int.fract b := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
p : α
hp : 0 < p
b : α
⊢ toIcoMod (_ : 0 < 1) 0 b = Int.fract b

Next tactic:
simp [toIcoMod_eq_add_fract_mul]
theorem iUnion_Ioc_add_zsmul : ⋃ n : ℤ, Ioc (a + n • p) (a + (n + 1) • p) = univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a : α
⊢ ⋃ n, Ioc (a + n • p) (a + (n + 1) • p) = univ

Next tactic:
refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
theorem iUnion_Ioc_add_zsmul : ⋃ n : ℤ, Ioc (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
⊢ ∃ i, b ∈ Ioc (a + i • p) (a + (i + 1) • p)

Next tactic:
rcases sub_toIocDiv_zsmul_mem_Ioc hp a b with ⟨hl, hr⟩
theorem iUnion_Ioc_add_zsmul : ⋃ n : ℤ, Ioc (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIocDiv_zsmul_mem_Ioc hp a b with ⟨hl, hr⟩
  

Proof state:
case intro
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a < b - toIocDiv hp a b • p
hr : b - toIocDiv hp a b • p ≤ a + p
⊢ ∃ i, b ∈ Ioc (a + i • p) (a + (i + 1) • p)

Next tactic:
refine' ⟨toIocDiv hp a b, ⟨lt_sub_iff_add_lt.mp hl, _⟩⟩
theorem iUnion_Ioc_add_zsmul : ⋃ n : ℤ, Ioc (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIocDiv_zsmul_mem_Ioc hp a b with ⟨hl, hr⟩
  refine' ⟨toIocDiv hp a b, ⟨lt_sub_iff_add_lt.mp hl, _⟩⟩
  

Proof state:
case intro
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a < b - toIocDiv hp a b • p
hr : b - toIocDiv hp a b • p ≤ a + p
⊢ b ≤ a + (toIocDiv hp a b + 1) • p

Next tactic:
rw [add_smul, one_smul, ← add_assoc]
theorem iUnion_Ioc_add_zsmul : ⋃ n : ℤ, Ioc (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIocDiv_zsmul_mem_Ioc hp a b with ⟨hl, hr⟩
  refine' ⟨toIocDiv hp a b, ⟨lt_sub_iff_add_lt.mp hl, _⟩⟩
  rw [add_smul, one_smul, ← add_assoc]
  

Proof state:
case intro
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a < b - toIocDiv hp a b • p
hr : b - toIocDiv hp a b • p ≤ a + p
⊢ b ≤ a + toIocDiv hp a b • p + p

Next tactic:
convert sub_le_iff_le_add.mp hr using 1
theorem iUnion_Ioc_add_zsmul : ⋃ n : ℤ, Ioc (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIocDiv_zsmul_mem_Ioc hp a b with ⟨hl, hr⟩
  refine' ⟨toIocDiv hp a b, ⟨lt_sub_iff_add_lt.mp hl, _⟩⟩
  rw [add_smul, one_smul, ← add_assoc]
  convert sub_le_iff_le_add.mp hr using 1; 

Proof state:
case h.e'_4
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a < b - toIocDiv hp a b • p
hr : b - toIocDiv hp a b • p ≤ a + p
⊢ a + toIocDiv hp a b • p + p = a + p + toIocDiv hp a b • p

Next tactic:
abel
theorem iUnion_Ico_add_zsmul : ⋃ n : ℤ, Ico (a + n • p) (a + (n + 1) • p) = univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a : α
⊢ ⋃ n, Ico (a + n • p) (a + (n + 1) • p) = univ

Next tactic:
refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
theorem iUnion_Ico_add_zsmul : ⋃ n : ℤ, Ico (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
⊢ ∃ i, b ∈ Ico (a + i • p) (a + (i + 1) • p)

Next tactic:
rcases sub_toIcoDiv_zsmul_mem_Ico hp a b with ⟨hl, hr⟩
theorem iUnion_Ico_add_zsmul : ⋃ n : ℤ, Ico (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIcoDiv_zsmul_mem_Ico hp a b with ⟨hl, hr⟩
  

Proof state:
case intro
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a ≤ b - toIcoDiv hp a b • p
hr : b - toIcoDiv hp a b • p < a + p
⊢ ∃ i, b ∈ Ico (a + i • p) (a + (i + 1) • p)

Next tactic:
refine' ⟨toIcoDiv hp a b, ⟨le_sub_iff_add_le.mp hl, _⟩⟩
theorem iUnion_Ico_add_zsmul : ⋃ n : ℤ, Ico (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIcoDiv_zsmul_mem_Ico hp a b with ⟨hl, hr⟩
  refine' ⟨toIcoDiv hp a b, ⟨le_sub_iff_add_le.mp hl, _⟩⟩
  

Proof state:
case intro
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a ≤ b - toIcoDiv hp a b • p
hr : b - toIcoDiv hp a b • p < a + p
⊢ b < a + (toIcoDiv hp a b + 1) • p

Next tactic:
rw [add_smul, one_smul, ← add_assoc]
theorem iUnion_Ico_add_zsmul : ⋃ n : ℤ, Ico (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIcoDiv_zsmul_mem_Ico hp a b with ⟨hl, hr⟩
  refine' ⟨toIcoDiv hp a b, ⟨le_sub_iff_add_le.mp hl, _⟩⟩
  rw [add_smul, one_smul, ← add_assoc]
  

Proof state:
case intro
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a ≤ b - toIcoDiv hp a b • p
hr : b - toIcoDiv hp a b • p < a + p
⊢ b < a + toIcoDiv hp a b • p + p

Next tactic:
convert sub_lt_iff_lt_add.mp hr using 1
theorem iUnion_Ico_add_zsmul : ⋃ n : ℤ, Ico (a + n • p) (a + (n + 1) • p) = univ := by
  refine' eq_univ_iff_forall.mpr fun b => mem_iUnion.mpr _
  rcases sub_toIcoDiv_zsmul_mem_Ico hp a b with ⟨hl, hr⟩
  refine' ⟨toIcoDiv hp a b, ⟨le_sub_iff_add_le.mp hl, _⟩⟩
  rw [add_smul, one_smul, ← add_assoc]
  convert sub_lt_iff_lt_add.mp hr using 1; 

Proof state:
case h.e'_4
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a b : α
hl : a ≤ b - toIcoDiv hp a b • p
hr : b - toIcoDiv hp a b • p < a + p
⊢ a + toIcoDiv hp a b • p + p = a + p + toIcoDiv hp a b • p

Next tactic:
abel
theorem iUnion_Icc_add_zsmul : ⋃ n : ℤ, Icc (a + n • p) (a + (n + 1) • p) = univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a : α
⊢ ⋃ n, Icc (a + n • p) (a + (n + 1) • p) = univ

Next tactic:
simpa only [iUnion_Ioc_add_zsmul hp a, univ_subset_iff] using
    iUnion_mono fun n : ℤ => (Ioc_subset_Icc_self : Ioc (a + n • p) (a + (n + 1) • p) ⊆ Icc _ _)
theorem iUnion_Ioc_zsmul : ⋃ n : ℤ, Ioc (n • p) ((n + 1) • p) = univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a : α
⊢ ⋃ n, Ioc (n • p) ((n + 1) • p) = univ

Next tactic:
simpa only [zero_add] using iUnion_Ioc_add_zsmul hp 0
theorem iUnion_Ico_zsmul : ⋃ n : ℤ, Ico (n • p) ((n + 1) • p) = univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a : α
⊢ ⋃ n, Ico (n • p) ((n + 1) • p) = univ

Next tactic:
simpa only [zero_add] using iUnion_Ico_add_zsmul hp 0
theorem iUnion_Icc_zsmul : ⋃ n : ℤ, Icc (n • p) ((n + 1) • p) = univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedAddCommGroup α
inst✝ : Archimedean α
p : α
hp : 0 < p
a : α
⊢ ⋃ n, Icc (n • p) ((n + 1) • p) = univ

Next tactic:
simpa only [zero_add] using iUnion_Icc_add_zsmul hp 0
theorem iUnion_Ioc_add_int_cast : ⋃ n : ℤ, Ioc (a + n) (a + n + 1) = Set.univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedRing α
inst✝ : Archimedean α
a : α
⊢ ⋃ n, Ioc (a + ↑n) (a + ↑n + 1) = univ

Next tactic:
simpa only [zsmul_one, Int.cast_add, Int.cast_one, ← add_assoc] using
    iUnion_Ioc_add_zsmul zero_lt_one a
theorem iUnion_Ico_add_int_cast : ⋃ n : ℤ, Ico (a + n) (a + n + 1) = Set.univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedRing α
inst✝ : Archimedean α
a : α
⊢ ⋃ n, Ico (a + ↑n) (a + ↑n + 1) = univ

Next tactic:
simpa only [zsmul_one, Int.cast_add, Int.cast_one, ← add_assoc] using
    iUnion_Ico_add_zsmul zero_lt_one a
theorem iUnion_Icc_add_int_cast : ⋃ n : ℤ, Icc (a + n) (a + n + 1) = Set.univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedRing α
inst✝ : Archimedean α
a : α
⊢ ⋃ n, Icc (a + ↑n) (a + ↑n + 1) = univ

Next tactic:
simpa only [zsmul_one, Int.cast_add, Int.cast_one, ← add_assoc] using
    iUnion_Icc_add_zsmul zero_lt_one a
theorem iUnion_Ioc_int_cast : ⋃ n : ℤ, Ioc (n : α) (n + 1) = Set.univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedRing α
inst✝ : Archimedean α
a : α
⊢ ⋃ n, Ioc (↑n) (↑n + 1) = univ

Next tactic:
simpa only [zero_add] using iUnion_Ioc_add_int_cast (0 : α)
theorem iUnion_Ico_int_cast : ⋃ n : ℤ, Ico (n : α) (n + 1) = Set.univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedRing α
inst✝ : Archimedean α
a : α
⊢ ⋃ n, Ico (↑n) (↑n + 1) = univ

Next tactic:
simpa only [zero_add] using iUnion_Ico_add_int_cast (0 : α)
theorem iUnion_Icc_int_cast : ⋃ n : ℤ, Icc (n : α) (n + 1) = Set.univ := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedRing α
inst✝ : Archimedean α
a : α
⊢ ⋃ n, Icc (↑n) (↑n + 1) = univ

Next tactic:
simpa only [zero_add] using iUnion_Icc_add_int_cast (0 : α)
lemma minpolyDiv_spec :
    minpolyDiv R x * (X - C x) = (minpoly R x).map (algebraMap R S) := by
  

Proof state:
R : Type u_2
K : Type ?u.27839
L : Type ?u.27842
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
⊢ minpolyDiv R x * (X - C x) = map (algebraMap R S) (minpoly R x)

Next tactic:
delta minpolyDiv
lemma minpolyDiv_spec :
    minpolyDiv R x * (X - C x) = (minpoly R x).map (algebraMap R S) := by
  delta minpolyDiv
  

Proof state:
R : Type u_2
K : Type ?u.27839
L : Type ?u.27842
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
⊢ map (algebraMap R S) (minpoly R x) /ₘ (X - C x) * (X - C x) = map (algebraMap R S) (minpoly R x)

Next tactic:
rw [mul_comm, mul_divByMonic_eq_iff_isRoot, IsRoot, eval_map, ← aeval_def, minpoly.aeval]
lemma coeff_minpolyDiv (i) : coeff (minpolyDiv R x) i =
    algebraMap R S (coeff (minpoly R x) (i + 1)) + coeff (minpolyDiv R x) (i + 1) * x := by
  

Proof state:
R : Type u_2
K : Type ?u.56632
L : Type ?u.56635
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
i : ℕ
⊢ coeff (minpolyDiv R x) i = (algebraMap R S) (coeff (minpoly R x) (i + 1)) + coeff (minpolyDiv R x) (i + 1) * x

Next tactic:
rw [← coeff_map, ← minpolyDiv_spec R x]
lemma coeff_minpolyDiv (i) : coeff (minpolyDiv R x) i =
    algebraMap R S (coeff (minpoly R x) (i + 1)) + coeff (minpolyDiv R x) (i + 1) * x := by
  rw [← coeff_map, ← minpolyDiv_spec R x]; 

Proof state:
R : Type u_2
K : Type ?u.56632
L : Type ?u.56635
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
i : ℕ
⊢ coeff (minpolyDiv R x) i = coeff (minpolyDiv R x * (X - C x)) (i + 1) + coeff (minpolyDiv R x) (i + 1) * x

Next tactic:
simp [mul_sub]
lemma minpolyDiv_ne_zero [Nontrivial S] : minpolyDiv R x ≠ 0 := by
  

Proof state:
R : Type u_2
K : Type ?u.86210
L : Type ?u.86213
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
⊢ minpolyDiv R x ≠ 0

Next tactic:
intro e
lemma minpolyDiv_ne_zero [Nontrivial S] : minpolyDiv R x ≠ 0 := by
  intro e
  

Proof state:
R : Type u_2
K : Type ?u.86210
L : Type ?u.86213
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
e : minpolyDiv R x = 0
⊢ False

Next tactic:
have := minpolyDiv_spec R x
lemma minpolyDiv_ne_zero [Nontrivial S] : minpolyDiv R x ≠ 0 := by
  intro e
  have := minpolyDiv_spec R x
  

Proof state:
R : Type u_2
K : Type ?u.86210
L : Type ?u.86213
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
e : minpolyDiv R x = 0
this : minpolyDiv R x * (X - C x) = map (algebraMap R S) (minpoly R x)
⊢ False

Next tactic:
rw [e, zero_mul] at this
lemma minpolyDiv_ne_zero [Nontrivial S] : minpolyDiv R x ≠ 0 := by
  intro e
  have := minpolyDiv_spec R x
  rw [e, zero_mul] at this
  

Proof state:
R : Type u_2
K : Type ?u.86210
L : Type ?u.86213
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
e : minpolyDiv R x = 0
this : 0 = map (algebraMap R S) (minpoly R x)
⊢ False

Next tactic:
exact ((minpoly.monic hx).map (algebraMap R S)).ne_zero this.symm
lemma minpolyDiv_eq_zero (hx : ¬IsIntegral R x) : minpolyDiv R x = 0 := by
  

Proof state:
R : Type u_2
K : Type ?u.87653
L : Type ?u.87656
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
hx : ¬IsIntegral R x
⊢ minpolyDiv R x = 0

Next tactic:
delta minpolyDiv minpoly
lemma minpolyDiv_eq_zero (hx : ¬IsIntegral R x) : minpolyDiv R x = 0 := by
  delta minpolyDiv minpoly
  

Proof state:
R : Type u_2
K : Type ?u.87653
L : Type ?u.87656
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
hx : ¬IsIntegral R x
⊢ map (algebraMap R S)
        (if hx : IsIntegral R x then
          WellFounded.min (_ : WellFounded fun p q => degree p < degree q)
            (fun x_1 => Monic x_1 ∧ eval₂ (algebraMap R S) x x_1 = 0) hx
        else 0) /ₘ
      (X - C x) =
    0

Next tactic:
rw [dif_neg hx, Polynomial.map_zero, zero_divByMonic]
lemma minpolyDiv_monic : Monic (minpolyDiv R x) := by
  

Proof state:
R : Type u_2
K : Type ?u.89092
L : Type ?u.89095
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
⊢ Monic (minpolyDiv R x)

Next tactic:
nontriviality S
lemma minpolyDiv_monic : Monic (minpolyDiv R x) := by
  nontriviality S
  

Proof state:
R : Type u_2
K : Type ?u.89092
L : Type ?u.89095
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
⊢ Monic (minpolyDiv R x)

Next tactic:
have := congr_arg leadingCoeff (minpolyDiv_spec R x)
lemma minpolyDiv_monic : Monic (minpolyDiv R x) := by
  nontriviality S
  have := congr_arg leadingCoeff (minpolyDiv_spec R x)
  

Proof state:
R : Type u_2
K : Type ?u.89092
L : Type ?u.89095
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
this : leadingCoeff (minpolyDiv R x * (X - C x)) = leadingCoeff (map (algebraMap R S) (minpoly R x))
⊢ Monic (minpolyDiv R x)

Next tactic:
rw [leadingCoeff_mul', ((minpoly.monic hx).map (algebraMap R S)).leadingCoeff] at this
lemma minpolyDiv_monic : Monic (minpolyDiv R x) := by
  nontriviality S
  have := congr_arg leadingCoeff (minpolyDiv_spec R x)
  rw [leadingCoeff_mul', ((minpoly.monic hx).map (algebraMap R S)).leadingCoeff] at this
  · 

Proof state:
R : Type u_2
K : Type ?u.89092
L : Type ?u.89095
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
this : leadingCoeff (minpolyDiv R x) * leadingCoeff (X - C x) = 1
⊢ Monic (minpolyDiv R x)

Next tactic:
simpa using this
lemma minpolyDiv_monic : Monic (minpolyDiv R x) := by
  nontriviality S
  have := congr_arg leadingCoeff (minpolyDiv_spec R x)
  rw [leadingCoeff_mul', ((minpoly.monic hx).map (algebraMap R S)).leadingCoeff] at this
  · simpa using this
  · 

Proof state:
R : Type u_2
K : Type ?u.89092
L : Type ?u.89095
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
this : leadingCoeff (minpolyDiv R x * (X - C x)) = leadingCoeff (map (algebraMap R S) (minpoly R x))
⊢ leadingCoeff (minpolyDiv R x) * leadingCoeff (X - C x) ≠ 0

Next tactic:
simpa using minpolyDiv_ne_zero hx
lemma eval_minpolyDiv_self : (minpolyDiv R x).eval x = aeval x (derivative <| minpoly R x) := by
  

Proof state:
R : Type u_2
K : Type ?u.94098
L : Type ?u.94101
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
⊢ eval x (minpolyDiv R x) = (aeval x) (derivative (minpoly R x))

Next tactic:
rw [aeval_def, ← eval_map, ← derivative_map, ← minpolyDiv_spec R x]
lemma eval_minpolyDiv_self : (minpolyDiv R x).eval x = aeval x (derivative <| minpoly R x) := by
  rw [aeval_def, ← eval_map, ← derivative_map, ← minpolyDiv_spec R x]; 

Proof state:
R : Type u_2
K : Type ?u.94098
L : Type ?u.94101
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
⊢ eval x (minpolyDiv R x) = eval x (derivative (minpolyDiv R x * (X - C x)))

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

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 : (aeval y) (minpoly R x) = 0
⊢ eval y (minpolyDiv R x) = 0

Next tactic:
rw [aeval_def, ← eval_map, ← minpolyDiv_spec R x] at hy