Theorem: Polynomial.Monic.irreducible_iff_natDegree'
File: Mathlib/Data/Polynomial/RingDivision.lean

tactic: simp_rw [hp.irreducible_iff_natDegree, mem_Ioc, Nat.le_div_iff_mul_le zero_lt_two, mul_two]
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]
hp : Monic p
⊢ Irreducible p ↔ p ≠ 1 ∧ ∀ (f g : R[X]), Monic f → Monic g → f * g = p → ¬natDegree g ∈ Ioc 0 (natDegree p / 2)

tactic: apply and_congr_right'
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]
hp : Monic p
⊢ (p ≠ 1 ∧ ∀ (f g : R[X]), Monic f → Monic g → f * g = p → natDegree f = 0 ∨ natDegree g = 0) ↔
    p ≠ 1 ∧ ∀ (f g : R[X]), Monic f → Monic g → f * g = p → ¬(0 < natDegree g ∧ natDegree g + natDegree g ≤ natDegree p)

tactic: constructor <;> intro h f g hf hg he <;> subst he
state_before: case h
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
p q : R[X]
hp : Monic p
⊢ (∀ (f g : R[X]), Monic f → Monic g → f * g = p → natDegree f = 0 ∨ natDegree g = 0) ↔
    ∀ (f g : R[X]), Monic f → Monic g → f * g = p → ¬(0 < natDegree g ∧ natDegree g + natDegree g ≤ natDegree p)

tactic: rw [hf.natDegree_mul hg, add_le_add_iff_right]
state_before: case h.mp
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q f g : R[X]
hf : Monic f
hg : Monic g
hp : Monic (f * g)
h : ∀ (f_1 g_1 : R[X]), Monic f_1 → Monic g_1 → f_1 * g_1 = f * g → natDegree f_1 = 0 ∨ natDegree g_1 = 0
⊢ ¬(0 < natDegree g ∧ natDegree g + natDegree g ≤ natDegree (f * g))

tactic: exact fun ha => (h f g hf hg rfl).elim (ha.1.trans_le ha.2).ne' ha.1.ne'
state_before: case h.mp
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q f g : R[X]
hf : Monic f
hg : Monic g
hp : Monic (f * g)
h : ∀ (f_1 g_1 : R[X]), Monic f_1 → Monic g_1 → f_1 * g_1 = f * g → natDegree f_1 = 0 ∨ natDegree g_1 = 0
⊢ ¬(0 < natDegree g ∧ natDegree g ≤ natDegree f)

tactic: simp_rw [hf.natDegree_mul hg, pos_iff_ne_zero] at h
state_before: case h.mpr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q f g : R[X]
hf : Monic f
hg : Monic g
hp : Monic (f * g)
h :
  ∀ (f_1 g_1 : R[X]),
    Monic f_1 → Monic g_1 → f_1 * g_1 = f * g → ¬(0 < natDegree g_1 ∧ natDegree g_1 + natDegree g_1 ≤ natDegree (f * g))
⊢ natDegree f = 0 ∨ natDegree g = 0

tactic: contrapose! h
state_before: case h.mpr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q f g : R[X]
hf : Monic f
hg : Monic g
hp : Monic (f * g)
h :
  ∀ (f_1 g_1 : R[X]),
    Monic f_1 →
      Monic g_1 → f_1 * g_1 = f * g → ¬(natDegree g_1 ≠ 0 ∧ natDegree g_1 + natDegree g_1 ≤ natDegree f + natDegree g)
⊢ natDegree f = 0 ∨ natDegree g = 0

tactic: obtain hl | hl := le_total f.natDegree g.natDegree
state_before: case h.mpr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q f g : R[X]
hf : Monic f
hg : Monic g
hp : Monic (f * g)
h : natDegree f ≠ 0 ∧ natDegree g ≠ 0
⊢ ∃ f_1 g_1,
    Monic f_1 ∧
      Monic g_1 ∧ f_1 * g_1 = f * g ∧ natDegree g_1 ≠ 0 ∧ natDegree g_1 + natDegree g_1 ≤ natDegree f + natDegree g

tactic: exact ⟨g, f, hg, hf, mul_comm g f, h.1, add_le_add_left hl _⟩
state_before: case h.mpr.inl
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q f g : R[X]
hf : Monic f
hg : Monic g
hp : Monic (f * g)
h : natDegree f ≠ 0 ∧ natDegree g ≠ 0
hl : natDegree f ≤ natDegree g
⊢ ∃ f_1 g_1,
    Monic f_1 ∧
      Monic g_1 ∧ f_1 * g_1 = f * g ∧ natDegree g_1 ≠ 0 ∧ natDegree g_1 + natDegree g_1 ≤ natDegree f + natDegree g

tactic: exact ⟨f, g, hf, hg, rfl, h.2, add_le_add_right hl _⟩
state_before: case h.mpr.inr
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommSemiring R
inst✝ : NoZeroDivisors R
q f g : R[X]
hf : Monic f
hg : Monic g
hp : Monic (f * g)
h : natDegree f ≠ 0 ∧ natDegree g ≠ 0
hl : natDegree g ≤ natDegree f
⊢ ∃ f_1 g_1,
    Monic f_1 ∧
      Monic g_1 ∧ f_1 * g_1 = f * g ∧ natDegree g_1 ≠ 0 ∧ natDegree g_1 + natDegree g_1 ≤ natDegree f + natDegree g