Theorem: irreducible_sq_not_dvd_iff_eq_zero_and_no_irreducibles_or_squarefree
File: Mathlib/Algebra/Squarefree.lean

tactic: symm
state_before: R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
⊢ (∀ (x : R), Irreducible x → ¬x * x ∣ r) ↔ (r = 0 ∧ ∀ (x : R), ¬Irreducible x) ∨ Squarefree r

tactic: constructor
state_before: R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
⊢ (r = 0 ∧ ∀ (x : R), ¬Irreducible x) ∨ Squarefree r ↔ ∀ (x : R), Irreducible x → ¬x * x ∣ r

tactic: intro h
state_before: case mpr
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
⊢ (∀ (x : R), Irreducible x → ¬x * x ∣ r) → (r = 0 ∧ ∀ (x : R), ¬Irreducible x) ∨ Squarefree r

tactic: rcases eq_or_ne r 0 with (rfl | hr)
state_before: case mpr
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
⊢ (r = 0 ∧ ∀ (x : R), ¬Irreducible x) ∨ Squarefree r

tactic: right
state_before: case mpr.inr
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
⊢ (r = 0 ∧ ∀ (x : R), ¬Irreducible x) ∨ Squarefree r

tactic: intro x hx
state_before: case mpr.inr.h
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
⊢ Squarefree r

tactic: by_contra i
state_before: case mpr.inr.h
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
x : R
hx : x * x ∣ r
⊢ IsUnit x

tactic: have : x ≠ 0 := by
  rintro rfl
  apply hr
  simpa only [zero_dvd_iff, MulZeroClass.mul_zero] using hx
state_before: case mpr.inr.h
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
x : R
hx : x * x ∣ r
i : ¬IsUnit x
⊢ False

tactic: obtain ⟨j, hj₁, hj₂⟩ := WfDvdMonoid.exists_irreducible_factor i this
state_before: case mpr.inr.h
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
x : R
hx : x * x ∣ r
i : ¬IsUnit x
this : x ≠ 0
⊢ False

tactic: exact h _ hj₁ ((mul_dvd_mul hj₂ hj₂).trans hx)
state_before: case mpr.inr.h.intro.intro
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
x : R
hx : x * x ∣ r
i : ¬IsUnit x
this : x ≠ 0
j : R
hj₁ : Irreducible j
hj₂ : j ∣ x
⊢ False

tactic: rintro (⟨rfl, h⟩ | h)
state_before: case mp
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
⊢ (r = 0 ∧ ∀ (x : R), ¬Irreducible x) ∨ Squarefree r → ∀ (x : R), Irreducible x → ¬x * x ∣ r

tactic: intro x hx t
state_before: case mp.inr
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : Squarefree r
⊢ ∀ (x : R), Irreducible x → ¬x * x ∣ r

tactic: exact hx.not_unit (h x t)
state_before: case mp.inr
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : Squarefree r
x : R
hx : Irreducible x
t : x * x ∣ r
⊢ False

tactic: simpa using h
state_before: case mp.inl.intro
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
h : ∀ (x : R), ¬Irreducible x
⊢ ∀ (x : R), Irreducible x → ¬x * x ∣ 0

tactic: exact Or.inl (by simpa using h)
state_before: case mpr.inl
R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ 0
⊢ (0 = 0 ∧ ∀ (x : R), ¬Irreducible x) ∨ Squarefree 0

tactic: simpa using h
state_before: R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ 0
⊢ 0 = 0 ∧ ∀ (x : R), ¬Irreducible x

tactic: rintro rfl
state_before: R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
x : R
hx : x * x ∣ r
i : ¬IsUnit x
⊢ x ≠ 0

tactic: apply hr
state_before: R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
hx : 0 * 0 ∣ r
i : ¬IsUnit 0
⊢ False

tactic: simpa only [zero_dvd_iff, MulZeroClass.mul_zero] using hx
state_before: R : Type u_1
inst✝¹ : CommMonoidWithZero R
inst✝ : WfDvdMonoid R
r : R
h : ∀ (x : R), Irreducible x → ¬x * x ∣ r
hr : r ≠ 0
hx : 0 * 0 ∣ r
i : ¬IsUnit 0
⊢ r = 0