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

tactic: cases' n with n
state_before: M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : 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
hq : q ≠ 0
⊢ Irreducible (c 1)
state_after: case zero
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
hn : 0 ≠ 0
c : Fin (0 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ Irreducible (c 1)

case succ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ Irreducible (c 1)

tactic: refine (Associates.isAtom_iff (ne_zero_of_dvd_ne_zero hq (h₂.2 ⟨1, rfl⟩))).mp ⟨?_, fun b hb => ?_⟩
state_before: case succ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ Irreducible (c 1)
state_after: case succ.refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ c 1 ≠ ⊥

case succ.refine_2
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
b : Associates M
hb : b < c 1
⊢ b = ⊥

tactic: obtain ⟨⟨i, hi⟩, rfl⟩ := h₂.1 (hb.le.trans (h₂.2 ⟨1, rfl⟩))
state_before: case succ.refine_2
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
b : Associates M
hb : b < c 1
⊢ b = ⊥
state_after: case succ.refine_2.intro.mk
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
i : ℕ
hi : i < n + 1 + 1
hb : c ⟨i, hi⟩ < c 1
⊢ c ⟨i, hi⟩ = ⊥

tactic: cases i
state_before: case succ.refine_2.intro.mk
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
i : ℕ
hi : i < n + 1 + 1
hb : c ⟨i, hi⟩ < c 1
⊢ c ⟨i, hi⟩ = ⊥
state_after: case succ.refine_2.intro.mk.zero
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
hi : 0 < n + 1 + 1
hb : c ⟨0, hi⟩ < c 1
⊢ c ⟨0, hi⟩ = ⊥

case succ.refine_2.intro.mk.succ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
n✝ : ℕ
hi : n✝ + 1 < n + 1 + 1
hb : c ⟨n✝ + 1, hi⟩ < c 1
⊢ c ⟨n✝ + 1, hi⟩ = ⊥

tactic: contradiction
state_before: case zero
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
hn : 0 ≠ 0
c : Fin (0 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ Irreducible (c 1)
state_after: no goals

tactic: exact ne_bot_of_gt (h₁ (show (0 : Fin (n + 2)) < 1 from Fin.one_pos))
state_before: case succ.refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
⊢ c 1 ≠ ⊥
state_after: no goals

tactic: exact (Associates.isUnit_iff_eq_one _).mp (first_of_chain_isUnit h₁ @h₂)
state_before: case succ.refine_2.intro.mk.zero
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
hi : 0 < n + 1 + 1
hb : c ⟨0, hi⟩ < c 1
⊢ c ⟨0, hi⟩ = ⊥
state_after: no goals

tactic: simpa [Fin.lt_iff_val_lt_val] using h₁.lt_iff_lt.mp hb
state_before: case succ.refine_2.intro.mk.succ
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
q : Associates M
hq : q ≠ 0
n : ℕ
hn : n + 1 ≠ 0
c : Fin (n + 1 + 1) → Associates M
h₁ : StrictMono c
h₂ : ∀ {r : Associates M}, r ≤ q ↔ ∃ i, r = c i
n✝ : ℕ
hi : n✝ + 1 < n + 1 + 1
hb : c ⟨n✝ + 1, hi⟩ < c 1
⊢ c ⟨n✝ + 1, hi⟩ = ⊥
state_after: no goals