Theorem: DivisorChain.eq_second_of_chain_of_prime_dvd
File: Mathlib/RingTheory/ChainOfDivisors.lean

tactic: cases' n with n
state_before: M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p q r : Associates M
n : ℕ
hn : n ≠ 0
c : Fin (n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
hp : Prime p
hr : r ∣ q
hp' : p ∣ r
⊢ p = c 1

tactic: obtain ⟨i, rfl⟩ := h₂.1 (dvd_trans hp' hr)
state_before: case succ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p q r : Associates M
hp : Prime p
hr : r ∣ q
hp' : p ∣ r
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ p = c 1

tactic: refine' congr_arg c (eq_of_ge_of_not_gt _ fun hi => _)
state_before: case succ.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
i : Fin (Nat.succ n + 1)
hp : Prime (c i)
hp' : c i ∣ r
⊢ c i = c 1

tactic: obtain rfl | ⟨j, rfl⟩ := i.eq_zero_or_eq_succ
state_before: case succ.intro.refine'_2
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
i : Fin (Nat.succ n + 1)
hp : Prime (c i)
hp' : c i ∣ r
hi : 1 < i
⊢ False

tactic: refine'
  not_irreducible_of_not_unit_dvdNotUnit
    (DvdNotUnit.not_unit
      (Associates.dvdNotUnit_iff_lt.2 (h₁ (show (0 : Fin (n + 2)) < j from _))))
    _ hp.irreducible
state_before: case succ.intro.refine'_2.inr.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
j : Fin (n + 1)
hp : Prime (c (Fin.succ j))
hp' : c (Fin.succ j) ∣ r
hi : 1 < Fin.succ j
⊢ False

tactic: contradiction
state_before: case zero
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p q r : Associates M
hp : Prime p
hr : r ∣ q
hp' : p ∣ r
hn : Nat.zero ≠ 0
c : Fin (Nat.zero + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ p = c 1

tactic: rw [Fin.le_iff_val_le_val, Fin.val_one, Nat.succ_le_iff, ← Fin.val_zero (n.succ + 1), ←
  Fin.lt_iff_val_lt_val, Fin.pos_iff_ne_zero]
state_before: case succ.intro.refine'_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
i : Fin (Nat.succ n + 1)
hp : Prime (c i)
hp' : c i ∣ r
⊢ 1 ≤ i

tactic: rintro rfl
state_before: case succ.intro.refine'_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
i : Fin (Nat.succ n + 1)
hp : Prime (c i)
hp' : c i ∣ r
⊢ i ≠ 0

tactic: exact hp.not_unit (first_of_chain_isUnit h₁ @h₂)
state_before: case succ.intro.refine'_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
hp : Prime (c 0)
hp' : c 0 ∣ r
⊢ False

tactic: cases hi
state_before: case succ.intro.refine'_2.inl
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
hp : Prime (c 0)
hp' : c 0 ∣ r
hi : 1 < 0
⊢ False

tactic: simpa [Fin.succ_lt_succ_iff, Fin.lt_iff_val_lt_val] using hi
state_before: case succ.intro.refine'_2.inr.intro.refine'_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
j : Fin (n + 1)
hp : Prime (c (Fin.succ j))
hp' : c (Fin.succ j) ∣ r
hi : 1 < Fin.succ j
⊢ 0 < ↑↑j

tactic: refine' Associates.dvdNotUnit_iff_lt.2 (h₁ _)
state_before: case succ.intro.refine'_2.inr.intro.refine'_2
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
j : Fin (n + 1)
hp : Prime (c (Fin.succ j))
hp' : c (Fin.succ j) ∣ r
hi : 1 < Fin.succ j
⊢ DvdNotUnit (c ↑↑j) (c (Fin.succ j))

tactic: simpa only [Fin.coe_eq_castSucc] using Fin.lt_succ
state_before: case succ.intro.refine'_2.inr.intro.refine'_2
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q r : Associates M
hr : r ∣ q
n : ℕ
hn : Nat.succ n ≠ 0
c : Fin (Nat.succ n + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
j : Fin (n + 1)
hp : Prime (c (Fin.succ j))
hp' : c (Fin.succ j) ∣ r
hi : 1 < Fin.succ j
⊢ ↑↑j < Fin.succ j