l3lab/ntp-mathlib huggingface dataset:
theorem tsum_pos (hsum : Summable g) (hg : ∀ i, 0 ≤ g i) (i : ι) (hi : 0 < g i) :
    0 < ∑' i, g i := by
  

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : OrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalAddGroup α
inst✝ : OrderClosedTopology α
f g : ι → α
a₁ a₂ : α
i✝ : ι
hsum : Summable g
hg : ∀ (i : ι), 0 ≤ g i
i : ι
hi : 0 < g i
⊢ 0 < ∑' (i : ι), g i

Next tactic:
rw [← tsum_zero]
theorem tsum_pos (hsum : Summable g) (hg : ∀ i, 0 ≤ g i) (i : ι) (hi : 0 < g i) :
    0 < ∑' i, g i := by
  rw [← tsum_zero]
  

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : OrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalAddGroup α
inst✝ : OrderClosedTopology α
f g : ι → α
a₁ a₂ : α
i✝ : ι
hsum : Summable g
hg : ∀ (i : ι), 0 ≤ g i
i : ι
hi : 0 < g i
⊢ ∑' (x : ?m.45660), 0 < ∑' (i : ι), g i
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : OrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalAddGroup α
inst✝ : OrderClosedTopology α
f g : ι → α
a₁ a₂ : α
i✝ : ι
hsum : Summable g
hg : ∀ (i : ι), 0 ≤ g i
i : ι
hi : 0 < g i
⊢ Type ?u.45658

Next tactic:
exact tsum_lt_tsum hg hi summable_zero hsum
theorem tsum_eq_zero_iff (hf : Summable f) : ∑' i, f i = 0 ↔ ∀ x, f x = 0 := by
  

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝² : CanonicallyOrderedAddCommMonoid α
inst✝¹ : TopologicalSpace α
inst✝ : OrderClosedTopology α
f : ι → α
a : α
hf : Summable f
⊢ ∑' (i : ι), f i = 0 ↔ ∀ (x : ι), f x = 0

Next tactic:
rw [← hasSum_zero_iff, hf.hasSum_iff]
theorem tsum_ne_zero_iff (hf : Summable f) : ∑' i, f i ≠ 0 ↔ ∃ x, f x ≠ 0 := by
  

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝² : CanonicallyOrderedAddCommMonoid α
inst✝¹ : TopologicalSpace α
inst✝ : OrderClosedTopology α
f : ι → α
a : α
hf : Summable f
⊢ ∑' (i : ι), f i ≠ 0 ↔ ∃ x, f x ≠ 0

Next tactic:
rw [Ne.def, tsum_eq_zero_iff hf, not_forall]
theorem summable_abs_iff [LinearOrderedAddCommGroup α] [UniformSpace α] [UniformAddGroup α]
    [CompleteSpace α] {f : ι → α} : (Summable fun x => |f x|) ↔ Summable f :=
  let s := { x | 0 ≤ f x }
  have h1 : ∀ x : s, |f x| = f x := fun x => abs_of_nonneg x.2
  have h2 : ∀ x : ↑sᶜ, |f x| = -f x := fun x => abs_of_neg (not_le.1 x.2)
  calc (Summable fun x => |f x|) ↔
      (Summable fun x : s => |f x|) ∧ Summable fun x : ↑sᶜ => |f x| :=
        summable_subtype_and_compl.symm
  _ ↔ (Summable fun x : s => f x) ∧ Summable fun x : ↑sᶜ => -f x := by 

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : UniformSpace α
inst✝¹ : UniformAddGroup α
inst✝ : CompleteSpace α
f : ι → α
s : Set ι := {x | 0 ≤ f x}
h1 : ∀ (x : ↑s), |f ↑x| = f ↑x
h2 : ∀ (x : ↑sᶜ), |f ↑x| = -f ↑x
⊢ ((Summable fun x => |f ↑x|) ∧ Summable fun x => |f ↑x|) ↔ (Summable fun x => f ↑x) ∧ Summable fun x => -f ↑x

Next tactic:
simp only [h1, h2]
theorem summable_abs_iff [LinearOrderedAddCommGroup α] [UniformSpace α] [UniformAddGroup α]
    [CompleteSpace α] {f : ι → α} : (Summable fun x => |f x|) ↔ Summable f :=
  let s := { x | 0 ≤ f x }
  have h1 : ∀ x : s, |f x| = f x := fun x => abs_of_nonneg x.2
  have h2 : ∀ x : ↑sᶜ, |f x| = -f x := fun x => abs_of_neg (not_le.1 x.2)
  calc (Summable fun x => |f x|) ↔
      (Summable fun x : s => |f x|) ∧ Summable fun x : ↑sᶜ => |f x| :=
        summable_subtype_and_compl.symm
  _ ↔ (Summable fun x : s => f x) ∧ Summable fun x : ↑sᶜ => -f x := by simp only [h1, h2]
  _ ↔ Summable f := by 

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : UniformSpace α
inst✝¹ : UniformAddGroup α
inst✝ : CompleteSpace α
f : ι → α
s : Set ι := {x | 0 ≤ f x}
h1 : ∀ (x : ↑s), |f ↑x| = f ↑x
h2 : ∀ (x : ↑sᶜ), |f ↑x| = -f ↑x
⊢ ((Summable fun x => f ↑x) ∧ Summable fun x => -f ↑x) ↔ Summable f

Next tactic:
simp only [summable_neg_iff, summable_subtype_and_compl]
theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
    [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) :
    Finite ι := by
  

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : Archimedean α
inst✝ : OrderClosedTopology α
b : α
hb : 0 < b
hf : Summable fun x => b
⊢ Finite ι

Next tactic:
have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s => by
    simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum
theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
    [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) :
    Finite ι := by
  have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s => by
    

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : Archimedean α
inst✝ : OrderClosedTopology α
b : α
hb : 0 < b
hf : Summable fun x => b
s : Finset ι
⊢ card s • b ≤ ∑' (x : ι), b

Next tactic:
simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum
theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
    [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) :
    Finite ι := by
  have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s => by
    simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum
  

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : Archimedean α
inst✝ : OrderClosedTopology α
b : α
hb : 0 < b
hf : Summable fun x => b
H : ∀ (s : Finset ι), card s • b ≤ ∑' (x : ι), b
⊢ Finite ι

Next tactic:
obtain ⟨n, hn⟩ := Archimedean.arch (∑' _ : ι, b) hb
theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
    [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) :
    Finite ι := by
  have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s => by
    simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum
  obtain ⟨n, hn⟩ := Archimedean.arch (∑' _ : ι, b) hb
  

Proof state:
case intro
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : Archimedean α
inst✝ : OrderClosedTopology α
b : α
hb : 0 < b
hf : Summable fun x => b
H : ∀ (s : Finset ι), card s • b ≤ ∑' (x : ι), b
n : ℕ
hn : ∑' (x : ι), b ≤ n • b
⊢ Finite ι

Next tactic:
have : ∀ s : Finset ι, s.card ≤ n := fun s => by
    simpa [nsmul_le_nsmul_iff_left hb] using (H s).trans hn
theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
    [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) :
    Finite ι := by
  have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s => by
    simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum
  obtain ⟨n, hn⟩ := Archimedean.arch (∑' _ : ι, b) hb
  have : ∀ s : Finset ι, s.card ≤ n := fun s => by
    

Proof state:
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : Archimedean α
inst✝ : OrderClosedTopology α
b : α
hb : 0 < b
hf : Summable fun x => b
H : ∀ (s : Finset ι), card s • b ≤ ∑' (x : ι), b
n : ℕ
hn : ∑' (x : ι), b ≤ n • b
s : Finset ι
⊢ card s ≤ n

Next tactic:
simpa [nsmul_le_nsmul_iff_left hb] using (H s).trans hn
theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
    [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) :
    Finite ι := by
  have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s => by
    simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum
  obtain ⟨n, hn⟩ := Archimedean.arch (∑' _ : ι, b) hb
  have : ∀ s : Finset ι, s.card ≤ n := fun s => by
    simpa [nsmul_le_nsmul_iff_left hb] using (H s).trans hn
  

Proof state:
case intro
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : Archimedean α
inst✝ : OrderClosedTopology α
b : α
hb : 0 < b
hf : Summable fun x => b
H : ∀ (s : Finset ι), card s • b ≤ ∑' (x : ι), b
n : ℕ
hn : ∑' (x : ι), b ≤ n • b
this : ∀ (s : Finset ι), card s ≤ n
⊢ Finite ι

Next tactic:
have : Fintype ι := fintypeOfFinsetCardLe n this
theorem Finite.of_summable_const [LinearOrderedAddCommGroup α] [TopologicalSpace α] [Archimedean α]
    [OrderClosedTopology α] {b : α} (hb : 0 < b) (hf : Summable fun _ : ι => b) :
    Finite ι := by
  have H : ∀ s : Finset ι, s.card • b ≤ ∑' _ : ι, b := fun s => by
    simpa using sum_le_hasSum s (fun a _ => hb.le) hf.hasSum
  obtain ⟨n, hn⟩ := Archimedean.arch (∑' _ : ι, b) hb
  have : ∀ s : Finset ι, s.card ≤ n := fun s => by
    simpa [nsmul_le_nsmul_iff_left hb] using (H s).trans hn
  have : Fintype ι := fintypeOfFinsetCardLe n this
  

Proof state:
case intro
ι : Type u_1
κ : Type u_2
α : Type u_3
inst✝³ : LinearOrderedAddCommGroup α
inst✝² : TopologicalSpace α
inst✝¹ : Archimedean α
inst✝ : OrderClosedTopology α
b : α
hb : 0 < b
hf : Summable fun x => b
H : ∀ (s : Finset ι), card s • b ≤ ∑' (x : ι), b
n : ℕ
hn : ∑' (x : ι), b ≤ n • b
this✝ : ∀ (s : Finset ι), card s ≤ n
this : Fintype ι
⊢ Finite ι

Next tactic:
infer_instance
theorem atImInfty_mem (S : Set ℍ) : S ∈ atImInfty ↔ ∃ A : ℝ, ∀ z : ℍ, A ≤ im z → z ∈ S := by
  

Proof state:
S : Set ℍ
⊢ S ∈ atImInfty ↔ ∃ A, ∀ (z : ℍ), A ≤ im z → z ∈ S

Next tactic:
simp only [atImInfty_basis.mem_iff, true_and]
theorem atImInfty_mem (S : Set ℍ) : S ∈ atImInfty ↔ ∃ A : ℝ, ∀ z : ℍ, A ≤ im z → z ∈ S := by
  simp only [atImInfty_basis.mem_iff, true_and]; 

Proof state:
S : Set ℍ
⊢ (∃ i, im ⁻¹' Set.Ici i ⊆ S) ↔ ∃ A, ∀ (z : ℍ), A ≤ im z → z ∈ S

Next tactic:
rfl
nonrec theorem IsBoundedAtImInfty.mul {f g : ℍ → ℂ} (hf : IsBoundedAtImInfty f)
    (hg : IsBoundedAtImInfty g) : IsBoundedAtImInfty (f * g) := by
  

Proof state:
f g : ℍ → ℂ
hf : IsBoundedAtImInfty f
hg : IsBoundedAtImInfty g
⊢ IsBoundedAtImInfty (f * g)

Next tactic:
simpa only [Pi.one_apply, mul_one, norm_eq_abs] using hf.mul hg
theorem bounded_mem (f : ℍ → ℂ) :
    IsBoundedAtImInfty f ↔ ∃ M A : ℝ, ∀ z : ℍ, A ≤ im z → abs (f z) ≤ M := by
  

Proof state:
f : ℍ → ℂ
⊢ IsBoundedAtImInfty f ↔ ∃ M A, ∀ (z : ℍ), A ≤ im z → Complex.abs (f z) ≤ M

Next tactic:
simp [IsBoundedAtImInfty, BoundedAtFilter, Asymptotics.isBigO_iff, Filter.Eventually,
    atImInfty_mem]
theorem zero_at_im_infty (f : ℍ → ℂ) :
    IsZeroAtImInfty f ↔ ∀ ε : ℝ, 0 < ε → ∃ A : ℝ, ∀ z : ℍ, A ≤ im z → abs (f z) ≤ ε :=
  (atImInfty_basis.tendsto_iff Metric.nhds_basis_closedBall).trans <| by
    

Proof state:
f : ℍ → ℂ
⊢ (∀ (ib : ℝ), 0 < ib → ∃ ia, True ∧ ∀ x ∈ im ⁻¹' Set.Ici ia, f x ∈ Metric.closedBall 0 ib) ↔
    ∀ (ε : ℝ), 0 < ε → ∃ A, ∀ (z : ℍ), A ≤ im z → Complex.abs (f z) ≤ ε

Next tactic:
simp only [true_and, mem_closedBall_zero_iff]
theorem zero_at_im_infty (f : ℍ → ℂ) :
    IsZeroAtImInfty f ↔ ∀ ε : ℝ, 0 < ε → ∃ A : ℝ, ∀ z : ℍ, A ≤ im z → abs (f z) ≤ ε :=
  (atImInfty_basis.tendsto_iff Metric.nhds_basis_closedBall).trans <| by
    simp only [true_and, mem_closedBall_zero_iff]; 

Proof state:
f : ℍ → ℂ
⊢ (∀ (ib : ℝ), 0 < ib → ∃ ia, ∀ x ∈ im ⁻¹' Set.Ici ia, ‖f x‖ ≤ ib) ↔
    ∀ (ε : ℝ), 0 < ε → ∃ A, ∀ (z : ℍ), A ≤ im z → Complex.abs (f z) ≤ ε

Next tactic:
rfl
lemma polynomial_eq : W.polynomial =
    Cubic.toPoly
      ⟨0, 1, Cubic.toPoly ⟨0, 0, W.a₁, W.a₃⟩, Cubic.toPoly ⟨-1, -W.a₂, -W.a₄, -W.a₆⟩⟩ := by
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
⊢ W.polynomial =
    Cubic.toPoly
      { a := 0, b := 1, c := Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ },
        d := Cubic.toPoly { a := -1, b := -W.a₂, c := -W.a₄, d := -W.a₆ } }

Next tactic:
simp only [polynomial, Cubic.toPoly]
lemma polynomial_eq : W.polynomial =
    Cubic.toPoly
      ⟨0, 1, Cubic.toPoly ⟨0, 0, W.a₁, W.a₃⟩, Cubic.toPoly ⟨-1, -W.a₂, -W.a₄, -W.a₆⟩⟩ := by
  simp only [polynomial, Cubic.toPoly]
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
⊢ Y ^ 2 + C (C W.a₁ * Y + C W.a₃) * Y - C (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆) =
    C 0 * Y ^ 3 + C 1 * Y ^ 2 + C (C 0 * Y ^ 3 + C 0 * Y ^ 2 + C W.a₁ * Y + C W.a₃) * Y +
      C (C (-1) * Y ^ 3 + C (-W.a₂) * Y ^ 2 + C (-W.a₄) * Y + C (-W.a₆))

Next tactic:
C_simp
lemma polynomial_eq : W.polynomial =
    Cubic.toPoly
      ⟨0, 1, Cubic.toPoly ⟨0, 0, W.a₁, W.a₃⟩, Cubic.toPoly ⟨-1, -W.a₂, -W.a₄, -W.a₆⟩⟩ := by
  simp only [polynomial, Cubic.toPoly]
  C_simp
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
⊢ Y ^ 2 + (C (C W.a₁) * C Y + C (C W.a₃)) * Y - (C Y ^ 3 + C (C W.a₂) * C Y ^ 2 + C (C W.a₄) * C Y + C (C W.a₆)) =
    0 * Y ^ 3 + 1 * Y ^ 2 + (0 * C Y ^ 3 + 0 * C Y ^ 2 + C (C W.a₁) * C Y + C (C W.a₃)) * Y +
      (-1 * C Y ^ 3 + -C (C W.a₂) * C Y ^ 2 + -C (C W.a₄) * C Y + -C (C W.a₆))

Next tactic:
ring1
lemma polynomial_ne_zero [Nontrivial R] : W.polynomial ≠ 0 := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
⊢ W.polynomial ≠ 0

Next tactic:
rw [polynomial_eq]
lemma polynomial_ne_zero [Nontrivial R] : W.polynomial ≠ 0 := by
  rw [polynomial_eq]
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
⊢ Cubic.toPoly
      { a := 0, b := 1, c := Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ },
        d := Cubic.toPoly { a := -1, b := -W.a₂, c := -W.a₄, d := -W.a₆ } } ≠
    0

Next tactic:
exact Cubic.ne_zero_of_b_ne_zero one_ne_zero
@[simp]
lemma degree_polynomial [Nontrivial R] : W.polynomial.degree = 2 := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
⊢ degree W.polynomial = 2

Next tactic:
rw [polynomial_eq]
@[simp]
lemma degree_polynomial [Nontrivial R] : W.polynomial.degree = 2 := by
  rw [polynomial_eq]
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
⊢ degree
      (Cubic.toPoly
        { a := 0, b := 1, c := Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ },
          d := Cubic.toPoly { a := -1, b := -W.a₂, c := -W.a₄, d := -W.a₆ } }) =
    2

Next tactic:
exact Cubic.degree_of_b_ne_zero' one_ne_zero
@[simp]
lemma natDegree_polynomial [Nontrivial R] : W.polynomial.natDegree = 2 := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
⊢ natDegree W.polynomial = 2

Next tactic:
rw [polynomial_eq]
@[simp]
lemma natDegree_polynomial [Nontrivial R] : W.polynomial.natDegree = 2 := by
  rw [polynomial_eq]
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
⊢ natDegree
      (Cubic.toPoly
        { a := 0, b := 1, c := Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ },
          d := Cubic.toPoly { a := -1, b := -W.a₂, c := -W.a₄, d := -W.a₆ } }) =
    2

Next tactic:
exact Cubic.natDegree_of_b_ne_zero' one_ne_zero
lemma monic_polynomial : W.polynomial.Monic := by
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
⊢ Monic W.polynomial

Next tactic:
nontriviality R
lemma monic_polynomial : W.polynomial.Monic := by
  nontriviality R
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
✝ : Nontrivial R
⊢ Monic W.polynomial

Next tactic:
simpa only [polynomial_eq] using Cubic.monic_of_b_eq_one'
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
⊢ Irreducible W.polynomial

Next tactic:
by_contra h
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h : ¬Irreducible W.polynomial
⊢ False

Next tactic:
rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  

Proof state:
case intro.intro.intro
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h : ¬Irreducible W.polynomial
f g : R[X]
h0 : coeff W.polynomial 0 = f * g
h1 : coeff W.polynomial 1 = f + g
⊢ False

Next tactic:
simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  

Proof state:
case intro.intro.intro
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h : ¬Irreducible W.polynomial
f g : R[X]
h0 : Cubic.toPoly { a := -1, b := -W.a₂, c := -W.a₄, d := -W.a₆ } = f * g
h1 : Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ } = f + g
⊢ False

Next tactic:
apply_fun degree at h0 h1
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  apply_fun degree at h0 h1
  

Proof state:
case intro.intro.intro
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h : ¬Irreducible W.polynomial
f g : R[X]
h0 : degree (Cubic.toPoly { a := -1, b := -W.a₂, c := -W.a₄, d := -W.a₆ }) = degree (f * g)
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
⊢ False

Next tactic:
rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  apply_fun degree at h0 h1
  rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
  

Proof state:
case intro.intro.intro
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
⊢ False

Next tactic:
apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_lt
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  apply_fun degree at h0 h1
  rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
  apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_lt
  

Proof state:
case intro.intro.intro
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
⊢ 1 < degree (f + g)

Next tactic:
rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  apply_fun degree at h0 h1
  rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
  apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_lt
  rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h
  -- porting note: replaced two `any_goals` proofs with two `iterate 2` proofs
  

Proof state:
case intro.intro.intro.inl
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h✝ : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
h : degree f = 0 ∧ degree g = 3
⊢ 1 < degree (f + g)
case intro.intro.intro.inr.inl
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h✝ : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
h : degree f = 1 ∧ degree g = 2
⊢ 1 < degree (f + g)
case intro.intro.intro.inr.inr.inl
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h✝ : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
h : degree f = 2 ∧ degree g = 1
⊢ 1 < degree (f + g)
case intro.intro.intro.inr.inr.inr
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h✝ : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
h : degree f = 3 ∧ degree g = 0
⊢ 1 < degree (f + g)

Next tactic:
iterate 2 rw [degree_add_eq_right_of_degree_lt] <;> simp only [h] <;> decide
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  apply_fun degree at h0 h1
  rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
  apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_lt
  rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h
  -- porting note: replaced two `any_goals` proofs with two `iterate 2` proofs
  iterate 2 

Proof state:
case intro.intro.intro.inl
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h✝ : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
h : degree f = 0 ∧ degree g = 3
⊢ 1 < degree (f + g)

Next tactic:
rw [degree_add_eq_right_of_degree_lt]
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  apply_fun degree at h0 h1
  rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
  apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_lt
  rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h
  -- porting note: replaced two `any_goals` proofs with two `iterate 2` proofs
  iterate 2 rw [degree_add_eq_right_of_degree_lt] <;> 

Proof state:
case intro.intro.intro.inl
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h✝ : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
h : degree f = 0 ∧ degree g = 3
⊢ 1 < degree g

Next tactic:
simp only [h]
lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
  by_contra h
  rcases (W.monic_polynomial.not_irreducible_iff_exists_add_mul_eq_coeff W.natDegree_polynomial).mp
    h with ⟨f, g, h0, h1⟩
  simp only [polynomial_eq, Cubic.coeff_eq_c, Cubic.coeff_eq_d] at h0 h1
  apply_fun degree at h0 h1
  rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
  apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_lt
  rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h
  -- porting note: replaced two `any_goals` proofs with two `iterate 2` proofs
  iterate 2 rw [degree_add_eq_right_of_degree_lt] <;> 

Proof state:
case intro.intro.intro.inl
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
h✝ : ¬Irreducible W.polynomial
f g : R[X]
h0 : 3 = degree f + degree g
h1 : degree (Cubic.toPoly { a := 0, b := 0, c := W.a₁, d := W.a₃ }) = degree (f + g)
h : degree f = 0 ∧ degree g = 3
⊢ degree f < degree g

Next tactic:
simp only [h]