Theorem: Polynomial.Monic.not_irreducible_iff_exists_add_mul_eq_coeff
File: Mathlib/Data/Polynomial/RingDivision.lean

tactic: cases subsingleton_or_nontrivial R
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
⊢ ¬Irreducible p ↔ ∃ c₁ c₂, coeff p 0 = c₁ * c₂ ∧ coeff p 1 = c₁ + c₂

tactic: rw [hm.irreducible_iff_natDegree', and_iff_right, hnd]
state_before: case inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ ¬Irreducible p ↔ ∃ c₁ c₂, coeff p 0 = c₁ * c₂ ∧ coeff p 1 = c₁ + c₂

tactic: push_neg
state_before: case inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ (¬∀ (f g : R[X]), Monic f → Monic g → f * g = p → ¬natDegree g ∈ Ioc 0 (2 / 2)) ↔
    ∃ c₁ c₂, coeff p 0 = c₁ * c₂ ∧ coeff p 1 = c₁ + c₂

case inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ p ≠ 1

tactic: constructor
state_before: case inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ (∃ f g, Monic f ∧ Monic g ∧ f * g = p ∧ natDegree g ∈ Ioc 0 (2 / 2)) ↔
    ∃ c₁ c₂, coeff p 0 = c₁ * c₂ ∧ coeff p 1 = c₁ + c₂

case inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ p ≠ 1

tactic: simp [natDegree_of_subsingleton] at hnd
state_before: case inl
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Subsingleton R
⊢ ¬Irreducible p ↔ ∃ c₁ c₂, coeff p 0 = c₁ * c₂ ∧ coeff p 1 = c₁ + c₂

tactic: rintro ⟨a, b, ha, hb, rfl, hdb⟩
state_before: case inr.mp
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ (∃ f g, Monic f ∧ Monic g ∧ f * g = p ∧ natDegree g ∈ Ioc 0 (2 / 2)) →
    ∃ c₁ c₂, coeff p 0 = c₁ * c₂ ∧ coeff p 1 = c₁ + c₂

tactic: simp only [zero_lt_two, Nat.div_self, ge_iff_le,
  Nat.Ioc_succ_singleton, zero_add, mem_singleton] at hdb
state_before: case inr.mp.intro.intro.intro.intro.intro
R : Type u
S : Type v
T : Type w
a✝ b✝ : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q : R[X]
h✝ : Nontrivial R
a b : R[X]
ha : Monic a
hb : Monic b
hdb : natDegree b ∈ Ioc 0 (2 / 2)
hm : Monic (a * b)
hnd : natDegree (a * b) = 2
⊢ ∃ c₁ c₂, coeff (a * b) 0 = c₁ * c₂ ∧ coeff (a * b) 1 = c₁ + c₂

tactic: have hda := hnd
state_before: case inr.mp.intro.intro.intro.intro.intro
R : Type u
S : Type v
T : Type w
a✝ b✝ : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q : R[X]
h✝ : Nontrivial R
a b : R[X]
ha : Monic a
hb : Monic b
hm : Monic (a * b)
hnd : natDegree (a * b) = 2
hdb : natDegree b = 1
⊢ ∃ c₁ c₂, coeff (a * b) 0 = c₁ * c₂ ∧ coeff (a * b) 1 = c₁ + c₂

tactic: rw [ha.natDegree_mul hb, hdb] at hda
state_before: case inr.mp.intro.intro.intro.intro.intro
R : Type u
S : Type v
T : Type w
a✝ b✝ : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q : R[X]
h✝ : Nontrivial R
a b : R[X]
ha : Monic a
hb : Monic b
hm : Monic (a * b)
hnd : natDegree (a * b) = 2
hdb : natDegree b = 1
hda : natDegree (a * b) = 2
⊢ ∃ c₁ c₂, coeff (a * b) 0 = c₁ * c₂ ∧ coeff (a * b) 1 = c₁ + c₂

tactic: use a.coeff 0, b.coeff 0, mul_coeff_zero a b
state_before: case inr.mp.intro.intro.intro.intro.intro
R : Type u
S : Type v
T : Type w
a✝ b✝ : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q : R[X]
h✝ : Nontrivial R
a b : R[X]
ha : Monic a
hb : Monic b
hm : Monic (a * b)
hnd : natDegree (a * b) = 2
hdb : natDegree b = 1
hda : natDegree a + 1 = 2
⊢ ∃ c₁ c₂, coeff (a * b) 0 = c₁ * c₂ ∧ coeff (a * b) 1 = c₁ + c₂

tactic: simpa only [nextCoeff, hnd, add_right_cancel hda, hdb] using ha.nextCoeff_mul hb
state_before: case inr.mp.intro.intro.intro.intro.intro
R : Type u
S : Type v
T : Type w
a✝ b✝ : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q : R[X]
h✝ : Nontrivial R
a b : R[X]
ha : Monic a
hb : Monic b
hm : Monic (a * b)
hnd : natDegree (a * b) = 2
hdb : natDegree b = 1
hda : natDegree a + 1 = 2
⊢ coeff (a * b) 1 = coeff a 0 + coeff b 0

tactic: rintro ⟨c₁, c₂, hmul, hadd⟩
state_before: case inr.mpr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ (∃ c₁ c₂, coeff p 0 = c₁ * c₂ ∧ coeff p 1 = c₁ + c₂) →
    ∃ f g, Monic f ∧ Monic g ∧ f * g = p ∧ natDegree g ∈ Ioc 0 (2 / 2)

tactic: refine
  ⟨X + C c₁, X + C c₂, monic_X_add_C _, monic_X_add_C _, ?_, ?_ ⟩
state_before: case inr.mpr.intro.intro.intro
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
c₁ c₂ : R
hmul : coeff p 0 = c₁ * c₂
hadd : coeff p 1 = c₁ + c₂
⊢ ∃ f g, Monic f ∧ Monic g ∧ f * g = p ∧ natDegree g ∈ Ioc 0 (2 / 2)

tactic: rw [p.as_sum_range_C_mul_X_pow, hnd, Finset.sum_range_succ, Finset.sum_range_succ,
  Finset.sum_range_one, ← hnd, hm.coeff_natDegree, hnd, hmul, hadd, C_mul, C_add, C_1]
state_before: case inr.mpr.intro.intro.intro.refine_1
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
c₁ c₂ : R
hmul : coeff p 0 = c₁ * c₂
hadd : coeff p 1 = c₁ + c₂
⊢ (X + ↑C c₁) * (X + ↑C c₂) = p

tactic: ring
state_before: case inr.mpr.intro.intro.intro.refine_1
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
c₁ c₂ : R
hmul : coeff p 0 = c₁ * c₂
hadd : coeff p 1 = c₁ + c₂
⊢ (X + ↑C c₁) * (X + ↑C c₂) = ↑C c₁ * ↑C c₂ * X ^ 0 + (↑C c₁ + ↑C c₂) * X ^ 1 + 1 * X ^ 2

tactic: rw [mem_Ioc, natDegree_X_add_C _]
state_before: case inr.mpr.intro.intro.intro.refine_2
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
c₁ c₂ : R
hmul : coeff p 0 = c₁ * c₂
hadd : coeff p 1 = c₁ + c₂
⊢ natDegree (X + ↑C c₂) ∈ Ioc 0 (2 / 2)

tactic: simp
state_before: case inr.mpr.intro.intro.intro.refine_2
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
c₁ c₂ : R
hmul : coeff p 0 = c₁ * c₂
hadd : coeff p 1 = c₁ + c₂
⊢ 0 < 1 ∧ 1 ≤ 2 / 2

tactic: rintro rfl
state_before: case inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hm : Monic p
hnd : natDegree p = 2
h✝ : Nontrivial R
⊢ p ≠ 1

tactic: simp [natDegree_one] at hnd
state_before: case inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q : R[X]
h✝ : Nontrivial R
hm : Monic 1
hnd : natDegree 1 = 2
⊢ False