l3lab/ntp-mathlib huggingface dataset:
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    

Proof state:
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
s : Finset ι
f : ι → R[X]
I : Ideal R
n : ι → ℕ
h : ∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
k : ℕ
⊢ coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)

Next tactic:
induction' s using Finset.induction with a s ha hs generalizing k
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · 

Proof state:
case empty
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
h : ∀ i ∈ ∅, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
k : ℕ
⊢ coeff (Finset.prod ∅ f) k ∈ I ^ (Finset.sum ∅ n - k)

Next tactic:
rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      

Proof state:
case empty
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
h : ∀ i ∈ ∅, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
k : ℕ
⊢ (if k = 0 then 1 else 0) ∈ ⊤

Next tactic:
exact Submodule.mem_top
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      exact Submodule.mem_top
    · 

Proof state:
case insert
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
a : ι
s : Finset ι
ha : a ∉ s
hs :
  (∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)) → ∀ (k : ℕ), coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)
h : ∀ i ∈ insert a s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
k : ℕ
⊢ coeff (Finset.prod (insert a s) f) k ∈ I ^ (Finset.sum (insert a s) n - k)

Next tactic:
rw [sum_insert ha, prod_insert ha, coeff_mul]
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      exact Submodule.mem_top
    · rw [sum_insert ha, prod_insert ha, coeff_mul]
      

Proof state:
case insert
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
a : ι
s : Finset ι
ha : a ∉ s
hs :
  (∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)) → ∀ (k : ℕ), coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)
h : ∀ i ∈ insert a s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
k : ℕ
⊢ ∑ x in antidiagonal k, coeff (f a) x.1 * coeff (∏ x in s, f x) x.2 ∈ I ^ (n a + ∑ x in s, n x - k)

Next tactic:
apply sum_mem
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      exact Submodule.mem_top
    · rw [sum_insert ha, prod_insert ha, coeff_mul]
      apply sum_mem
      

Proof state:
case insert.a
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
a : ι
s : Finset ι
ha : a ∉ s
hs :
  (∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)) → ∀ (k : ℕ), coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)
h : ∀ i ∈ insert a s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
k : ℕ
⊢ ∀ c ∈ antidiagonal k, coeff (f a) c.1 * coeff (∏ x in s, f x) c.2 ∈ I ^ (n a + ∑ x in s, n x - k)

Next tactic:
rintro ⟨i, j⟩ e
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      exact Submodule.mem_top
    · rw [sum_insert ha, prod_insert ha, coeff_mul]
      apply sum_mem
      rintro ⟨i, j⟩ e
      

Proof state:
case insert.a.mk
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
a : ι
s : Finset ι
ha : a ∉ s
hs :
  (∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)) → ∀ (k : ℕ), coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)
h : ∀ i ∈ insert a s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
k i j : ℕ
e : (i, j) ∈ antidiagonal k
⊢ coeff (f a) (i, j).1 * coeff (∏ x in s, f x) (i, j).2 ∈ I ^ (n a + ∑ x in s, n x - k)

Next tactic:
obtain rfl : i + j = k := mem_antidiagonal.mp e
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      exact Submodule.mem_top
    · rw [sum_insert ha, prod_insert ha, coeff_mul]
      apply sum_mem
      rintro ⟨i, j⟩ e
      obtain rfl : i + j = k := mem_antidiagonal.mp e
      

Proof state:
case insert.a.mk
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
a : ι
s : Finset ι
ha : a ∉ s
hs :
  (∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)) → ∀ (k : ℕ), coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)
h : ∀ i ∈ insert a s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
i j : ℕ
e : (i, j) ∈ antidiagonal (i + j)
⊢ coeff (f a) (i, j).1 * coeff (∏ x in s, f x) (i, j).2 ∈ I ^ (n a + ∑ x in s, n x - (i + j))

Next tactic:
apply Ideal.pow_le_pow_right add_tsub_add_le_tsub_add_tsub
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      exact Submodule.mem_top
    · rw [sum_insert ha, prod_insert ha, coeff_mul]
      apply sum_mem
      rintro ⟨i, j⟩ e
      obtain rfl : i + j = k := mem_antidiagonal.mp e
      apply Ideal.pow_le_pow_right add_tsub_add_le_tsub_add_tsub
      

Proof state:
case insert.a.mk.a
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
a : ι
s : Finset ι
ha : a ∉ s
hs :
  (∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)) → ∀ (k : ℕ), coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)
h : ∀ i ∈ insert a s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
i j : ℕ
e : (i, j) ∈ antidiagonal (i + j)
⊢ coeff (f a) (i, j).1 * coeff (∏ x in s, f x) (i, j).2 ∈ I ^ (n a - i + (∑ x in s, n x - j))

Next tactic:
rw [pow_add]
/-- If `I` is an ideal, and `pᵢ` is a finite family of polynomials each satisfying
`∀ k, (pᵢ)ₖ ∈ Iⁿⁱ⁻ᵏ` for some `nᵢ`, then `p = ∏ pᵢ` also satisfies `∀ k, pₖ ∈ Iⁿ⁻ᵏ` with `n = ∑ nᵢ`.
-/
theorem _root_.Polynomial.coeff_prod_mem_ideal_pow_tsub {ι : Type*} (s : Finset ι) (f : ι → R[X])
    (I : Ideal R) (n : ι → ℕ) (h : ∀ i ∈ s, ∀ (k), (f i).coeff k ∈ I ^ (n i - k)) (k : ℕ) :
    (s.prod f).coeff k ∈ I ^ (s.sum n - k) := by
  classical
    induction' s using Finset.induction with a s ha hs generalizing k
    · rw [sum_empty, prod_empty, coeff_one, zero_tsub, pow_zero, Ideal.one_eq_top]
      exact Submodule.mem_top
    · rw [sum_insert ha, prod_insert ha, coeff_mul]
      apply sum_mem
      rintro ⟨i, j⟩ e
      obtain rfl : i + j = k := mem_antidiagonal.mp e
      apply Ideal.pow_le_pow_right add_tsub_add_le_tsub_add_tsub
      rw [pow_add]
      

Proof state:
case insert.a.mk.a
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I✝ : Ideal R[X]
ι : Type u_2
f : ι → R[X]
I : Ideal R
n : ι → ℕ
a : ι
s : Finset ι
ha : a ∉ s
hs :
  (∀ i ∈ s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)) → ∀ (k : ℕ), coeff (Finset.prod s f) k ∈ I ^ (Finset.sum s n - k)
h : ∀ i ∈ insert a s, ∀ (k : ℕ), coeff (f i) k ∈ I ^ (n i - k)
i j : ℕ
e : (i, j) ∈ antidiagonal (i + j)
⊢ coeff (f a) (i, j).1 * coeff (∏ x in s, f x) (i, j).2 ∈ I ^ (n a - i) * I ^ (∑ x in s, n x - j)

Next tactic:
exact
        Ideal.mul_mem_mul (h _ (Finset.mem_insert.mpr <| Or.inl rfl) _)
          (hs (fun i hi k => h _ (Finset.mem_insert.mpr <| Or.inr hi) _) j)
/-- `R[X]` is never a field for any ring `R`. -/
theorem polynomial_not_isField : ¬IsField R[X] := by
  

Proof state:
R : Type u
S : Type u_1
inst✝ : Ring R
⊢ ¬IsField R[X]

Next tactic:
nontriviality R
/-- `R[X]` is never a field for any ring `R`. -/
theorem polynomial_not_isField : ¬IsField R[X] := by
  nontriviality R
  

Proof state:
R : Type u
S : Type u_1
inst✝ : Ring R
✝ : Nontrivial R
⊢ ¬IsField R[X]

Next tactic:
intro hR
/-- `R[X]` is never a field for any ring `R`. -/
theorem polynomial_not_isField : ¬IsField R[X] := by
  nontriviality R
  intro hR
  

Proof state:
R : Type u
S : Type u_1
inst✝ : Ring R
✝ : Nontrivial R
hR : IsField R[X]
⊢ False

Next tactic:
obtain ⟨p, hp⟩ := hR.mul_inv_cancel X_ne_zero
/-- `R[X]` is never a field for any ring `R`. -/
theorem polynomial_not_isField : ¬IsField R[X] := by
  nontriviality R
  intro hR
  obtain ⟨p, hp⟩ := hR.mul_inv_cancel X_ne_zero
  

Proof state:
case intro
R : Type u
S : Type u_1
inst✝ : Ring R
✝ : Nontrivial R
hR : IsField R[X]
p : R[X]
hp : X * p = 1
⊢ False

Next tactic:
have hp0 : p ≠ 0 := right_ne_zero_of_mul_eq_one hp
/-- `R[X]` is never a field for any ring `R`. -/
theorem polynomial_not_isField : ¬IsField R[X] := by
  nontriviality R
  intro hR
  obtain ⟨p, hp⟩ := hR.mul_inv_cancel X_ne_zero
  have hp0 : p ≠ 0 := right_ne_zero_of_mul_eq_one hp
  

Proof state:
case intro
R : Type u
S : Type u_1
inst✝ : Ring R
✝ : Nontrivial R
hR : IsField R[X]
p : R[X]
hp : X * p = 1
hp0 : p ≠ 0
⊢ False

Next tactic:
have := degree_lt_degree_mul_X hp0
/-- `R[X]` is never a field for any ring `R`. -/
theorem polynomial_not_isField : ¬IsField R[X] := by
  nontriviality R
  intro hR
  obtain ⟨p, hp⟩ := hR.mul_inv_cancel X_ne_zero
  have hp0 : p ≠ 0 := right_ne_zero_of_mul_eq_one hp
  have := degree_lt_degree_mul_X hp0
  

Proof state:
case intro
R : Type u
S : Type u_1
inst✝ : Ring R
✝ : Nontrivial R
hR : IsField R[X]
p : R[X]
hp : X * p = 1
hp0 : p ≠ 0
this : degree p < degree (p * X)
⊢ False

Next tactic:
rw [← X_mul, congr_arg degree hp, degree_one, Nat.WithBot.lt_zero_iff, degree_eq_bot] at this
/-- `R[X]` is never a field for any ring `R`. -/
theorem polynomial_not_isField : ¬IsField R[X] := by
  nontriviality R
  intro hR
  obtain ⟨p, hp⟩ := hR.mul_inv_cancel X_ne_zero
  have hp0 : p ≠ 0 := right_ne_zero_of_mul_eq_one hp
  have := degree_lt_degree_mul_X hp0
  rw [← X_mul, congr_arg degree hp, degree_one, Nat.WithBot.lt_zero_iff, degree_eq_bot] at this
  

Proof state:
case intro
R : Type u
S : Type u_1
inst✝ : Ring R
✝ : Nontrivial R
hR : IsField R[X]
p : R[X]
hp : X * p = 1
hp0 : p ≠ 0
this : p = 0
⊢ False

Next tactic:
exact hp0 this
/-- The only constant in a maximal ideal over a field is `0`. -/
theorem eq_zero_of_constant_mem_of_maximal (hR : IsField R) (I : Ideal R[X]) [hI : I.IsMaximal]
    (x : R) (hx : C x ∈ I) : x = 0 := by
  

Proof state:
R : Type u
S : Type u_1
inst✝ : Ring R
hR : IsField R
I : Ideal R[X]
hI : IsMaximal I
x : R
hx : C x ∈ I
⊢ x = 0

Next tactic:
refine' Classical.by_contradiction fun hx0 => hI.ne_top ((eq_top_iff_one I).2 _)
/-- The only constant in a maximal ideal over a field is `0`. -/
theorem eq_zero_of_constant_mem_of_maximal (hR : IsField R) (I : Ideal R[X]) [hI : I.IsMaximal]
    (x : R) (hx : C x ∈ I) : x = 0 := by
  refine' Classical.by_contradiction fun hx0 => hI.ne_top ((eq_top_iff_one I).2 _)
  

Proof state:
R : Type u
S : Type u_1
inst✝ : Ring R
hR : IsField R
I : Ideal R[X]
hI : IsMaximal I
x : R
hx : C x ∈ I
hx0 : ¬x = 0
⊢ 1 ∈ I

Next tactic:
obtain ⟨y, hy⟩ := hR.mul_inv_cancel hx0
/-- The only constant in a maximal ideal over a field is `0`. -/
theorem eq_zero_of_constant_mem_of_maximal (hR : IsField R) (I : Ideal R[X]) [hI : I.IsMaximal]
    (x : R) (hx : C x ∈ I) : x = 0 := by
  refine' Classical.by_contradiction fun hx0 => hI.ne_top ((eq_top_iff_one I).2 _)
  obtain ⟨y, hy⟩ := hR.mul_inv_cancel hx0
  

Proof state:
case intro
R : Type u
S : Type u_1
inst✝ : Ring R
hR : IsField R
I : Ideal R[X]
hI : IsMaximal I
x : R
hx : C x ∈ I
hx0 : ¬x = 0
y : R
hy : x * y = 1
⊢ 1 ∈ I

Next tactic:
convert I.mul_mem_left (C y) hx
/-- The only constant in a maximal ideal over a field is `0`. -/
theorem eq_zero_of_constant_mem_of_maximal (hR : IsField R) (I : Ideal R[X]) [hI : I.IsMaximal]
    (x : R) (hx : C x ∈ I) : x = 0 := by
  refine' Classical.by_contradiction fun hx0 => hI.ne_top ((eq_top_iff_one I).2 _)
  obtain ⟨y, hy⟩ := hR.mul_inv_cancel hx0
  convert I.mul_mem_left (C y) hx
  

Proof state:
case h.e'_4
R : Type u
S : Type u_1
inst✝ : Ring R
hR : IsField R
I : Ideal R[X]
hI : IsMaximal I
x : R
hx : C x ∈ I
hx0 : ¬x = 0
y : R
hy : x * y = 1
⊢ 1 = C y * C x

Next tactic:
rw [← C.map_mul, hR.mul_comm y x, hy, RingHom.map_one]
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  

Proof state:
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
⊢ IsPrime (map C P) ↔ IsPrime P

Next tactic:
constructor
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · 

Proof state:
case mp
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
⊢ IsPrime (map C P) → IsPrime P

Next tactic:
intro H
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    

Proof state:
case mp
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
⊢ IsPrime P

Next tactic:
have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    

Proof state:
case mp
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
⊢ IsPrime P

Next tactic:
convert this using 1
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    convert this using 1
    

Proof state:
case h.e'_3
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
⊢ P = comap C (map C P)

Next tactic:
ext x
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    convert this using 1
    ext x
    

Proof state:
case h.e'_3.h
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
x : R
⊢ x ∈ P ↔ x ∈ comap C (map C P)

Next tactic:
simp only [mem_comap, mem_map_C_iff]
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    convert this using 1
    ext x
    simp only [mem_comap, mem_map_C_iff]
    

Proof state:
case h.e'_3.h
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
x : R
⊢ x ∈ P ↔ ∀ (n : ℕ), coeff (C x) n ∈ P

Next tactic:
constructor
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    convert this using 1
    ext x
    simp only [mem_comap, mem_map_C_iff]
    constructor
    · 

Proof state:
case h.e'_3.h.mp
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
x : R
⊢ x ∈ P → ∀ (n : ℕ), coeff (C x) n ∈ P

Next tactic:
rintro h (- | n)
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    convert this using 1
    ext x
    simp only [mem_comap, mem_map_C_iff]
    constructor
    · rintro h (- | n)
      · 

Proof state:
case h.e'_3.h.mp.zero
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
x : R
h : x ∈ P
⊢ coeff (C x) Nat.zero ∈ P

Next tactic:
rwa [coeff_C_zero]
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    convert this using 1
    ext x
    simp only [mem_comap, mem_map_C_iff]
    constructor
    · rintro h (- | n)
      · rwa [coeff_C_zero]
      · 

Proof state:
case h.e'_3.h.mp.succ
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
x : R
h : x ∈ P
n : ℕ
⊢ coeff (C x) (Nat.succ n) ∈ P

Next tactic:
simp only [coeff_C_ne_zero (Nat.succ_ne_zero _), Submodule.zero_mem]
/-- If `P` is a prime ideal of `R`, then `P.R[x]` is a prime ideal of `R[x]`. -/
theorem isPrime_map_C_iff_isPrime (P : Ideal R) :
    IsPrime (map (C : R →+* R[X]) P : Ideal R[X]) ↔ IsPrime P := by
  -- Porting note: the following proof avoids quotient rings
  -- It can be golfed substantially by using something like
  -- `(Quotient.isDomain_iff_prime (map C P : Ideal R[X]))`
  constructor
  · intro H
    have := @comap_isPrime R R[X] (R →+* R[X]) _ _ _ C (map C P) H
    convert this using 1
    ext x
    simp only [mem_comap, mem_map_C_iff]
    constructor
    · rintro h (- | n)
      · rwa [coeff_C_zero]
      · simp only [coeff_C_ne_zero (Nat.succ_ne_zero _), Submodule.zero_mem]
    · 

Proof state:
case h.e'_3.h.mpr
R : Type u
S : Type u_1
inst✝ : CommRing R
P : Ideal R
H : IsPrime (map C P)
this : IsPrime (comap C (map C P))
x : R
⊢ (∀ (n : ℕ), coeff (C x) n ∈ P) → x ∈ P

Next tactic:
intro h