Theorem: Associates.one_or_eq_of_le_of_prime
File: Mathlib/Algebra/Associated.lean

tactic: have dvd_rfl' : p ∣ m * d := by rw[r]
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
⊢ m = 1 ∨ m = p

tactic: rw [r]
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
⊢ m = 1 ∨ m = p

tactic: match h m d dvd_rfl' with
| Or.inl h' =>
  by_cases h : m = 0
  case pos =>
    simp [h, zero_mul]
  case neg =>
    rw [r] at h'
    have : m * d ≤ m * 1 := by simpa using h'
    have : d ≤ 1 := Associates.le_of_mul_le_mul_left m d 1 ‹m ≠ 0› this
    have : d = 1 := bot_unique this
    simp [this]
| Or.inr h' =>
    by_cases h : d = 0
    case pos =>
      rw [r] at hp0
      have : m * d = 0 := by rw [h]; simp
      contradiction
    case neg =>
      rw [r] at h'
      have : d * m ≤ d * 1 := by simpa [mul_comm] using h'
      exact Or.inl <| bot_unique <| Associates.le_of_mul_le_mul_left d m 1 ‹d ≠ 0› this
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
⊢ m = 1 ∨ m = m * d

tactic: rw[r]
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
⊢ p ∣ m * d

tactic: by_cases h : m = 0
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ m
⊢ m = 1 ∨ m = m * d

tactic: case pos =>
  simp [h, zero_mul]
state_before: case pos
α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ m
h : m = 0
⊢ m = 1 ∨ m = m * d

case neg
α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ m
h : ¬m = 0
⊢ m = 1 ∨ m = m * d

tactic: case neg =>
  rw [r] at h'
  have : m * d ≤ m * 1 := by simpa using h'
  have : d ≤ 1 := Associates.le_of_mul_le_mul_left m d 1 ‹m ≠ 0› this
  have : d = 1 := bot_unique this
  simp [this]
state_before: case neg
α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ m
h : ¬m = 0
⊢ m = 1 ∨ m = m * d

tactic: simp [h, zero_mul]
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ m
h : m = 0
⊢ m = 1 ∨ m = m * d

tactic: rw [r] at h'
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ m
h : ¬m = 0
⊢ m = 1 ∨ m = m * d

tactic: have : m * d ≤ m * 1 := by simpa using h'
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ m
h : ¬m = 0
⊢ m = 1 ∨ m = m * d

tactic: have : d ≤ 1 := Associates.le_of_mul_le_mul_left m d 1 ‹m ≠ 0› this
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ m
h : ¬m = 0
this : m * d ≤ m * 1
⊢ m = 1 ∨ m = m * d

tactic: have : d = 1 := bot_unique this
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ m
h : ¬m = 0
this✝ : m * d ≤ m * 1
this : d ≤ 1
⊢ m = 1 ∨ m = m * d

tactic: simp [this]
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ m
h : ¬m = 0
this✝¹ : m * d ≤ m * 1
this✝ : d ≤ 1
this : d = 1
⊢ m = 1 ∨ m = m * d

tactic: simpa using h'
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ m
h : ¬m = 0
⊢ m * d ≤ m * 1

tactic: by_cases h : d = 0
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
⊢ m = 1 ∨ m = m * d

tactic: case pos =>
  rw [r] at hp0
  have : m * d = 0 := by rw [h]; simp
  contradiction
state_before: case pos
α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : d = 0
⊢ m = 1 ∨ m = m * d

case neg
α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : ¬d = 0
⊢ m = 1 ∨ m = m * d

tactic: case neg =>
  rw [r] at h'
  have : d * m ≤ d * 1 := by simpa [mul_comm] using h'
  exact Or.inl <| bot_unique <| Associates.le_of_mul_le_mul_left d m 1 ‹d ≠ 0› this
state_before: case neg
α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : ¬d = 0
⊢ m = 1 ∨ m = m * d

tactic: rw [r] at hp0
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : d = 0
⊢ m = 1 ∨ m = m * d

tactic: have : m * d = 0 := by rw [h]; simp
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
hp0 : m * d ≠ 0
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : d = 0
⊢ m = 1 ∨ m = m * d

tactic: contradiction
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
hp0 : m * d ≠ 0
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : d = 0
this : m * d = 0
⊢ m = 1 ∨ m = m * d

tactic: rw [h]
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
hp0 : m * d ≠ 0
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : d = 0
⊢ m * d = 0

tactic: simp
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
hp0 : m * d ≠ 0
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : d = 0
⊢ m * 0 = 0

tactic: rw [r] at h'
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : p ∣ d
h : ¬d = 0
⊢ m = 1 ∨ m = m * d

tactic: have : d * m ≤ d * 1 := by simpa [mul_comm] using h'
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ d
h : ¬d = 0
⊢ m = 1 ∨ m = m * d

tactic: exact Or.inl <| bot_unique <| Associates.le_of_mul_le_mul_left d m 1 ‹d ≠ 0› this
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ d
h : ¬d = 0
this : d * m ≤ d * 1
⊢ m = 1 ∨ m = m * d

tactic: simpa [mul_comm] using h'
state_before: α : Type u_1
β : Type ?u.335369
γ : Type ?u.335372
δ : Type ?u.335375
inst✝ : CancelCommMonoidWithZero α
p m : Associates α
hp0 : p ≠ 0
left✝ : ¬IsUnit p
h✝ : ∀ (a b : Associates α), p ∣ a * b → p ∣ a ∨ p ∣ b
d : Associates α
r : p = m * d
dvd_rfl' : p ∣ m * d
h' : m * d ∣ d
h : ¬d = 0
⊢ d * m ≤ d * 1