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

tactic: refine ⟨fun i => p ^ (i : ℕ), ?_, fun n m h => ?_, @fun y => ⟨fun h => ?_, ?_⟩⟩
state_before: M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
⊢ ∃ c, c 1 = p ∧ StrictMono c ∧ ∀ {r : Associates M}, r ≤ p ^ n ↔ ∃ i, r = c i
state_after: case refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
⊢ (fun i => p ^ ↑i) 1 = p

case refine_2
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n✝ : ℕ
hn : n✝ ≠ 0
hp : Prime p
n m : Fin (n✝ + 1)
h : n < m
⊢ (fun i => p ^ ↑i) n < (fun i => p ^ ↑i) m

case refine_3
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
h : y ≤ p ^ n
⊢ ∃ i, y = (fun i => p ^ ↑i) i

case refine_4
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
⊢ (∃ i, y = (fun i => p ^ ↑i) i) → y ≤ p ^ n

tactic: dsimp only
state_before: case refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
⊢ (fun i => p ^ ↑i) 1 = p
state_after: case refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
⊢ p ^ ↑1 = p

tactic: rw [Fin.val_one', Nat.mod_eq_of_lt, pow_one]
state_before: case refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
⊢ p ^ ↑1 = p
state_after: case refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
⊢ 1 < n + 1

tactic: exact Nat.lt_succ_of_le (Nat.one_le_iff_ne_zero.mpr hn)
state_before: case refine_1
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
⊢ 1 < n + 1
state_after: no goals

tactic: exact Associates.dvdNotUnit_iff_lt.mp
    ⟨pow_ne_zero n hp.ne_zero, p ^ (m - n : ℕ),
      not_isUnit_of_not_isUnit_dvd hp.not_unit (dvd_pow dvd_rfl (Nat.sub_pos_of_lt h).ne'),
      (pow_mul_pow_sub p h.le).symm⟩
state_before: case refine_2
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n✝ : ℕ
hn : n✝ ≠ 0
hp : Prime p
n m : Fin (n✝ + 1)
h : n < m
⊢ (fun i => p ^ ↑i) n < (fun i => p ^ ↑i) m
state_after: no goals

tactic: obtain ⟨i, i_le, hi⟩ := (dvd_prime_pow hp n).1 h
state_before: case refine_3
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
h : y ≤ p ^ n
⊢ ∃ i, y = (fun i => p ^ ↑i) i
state_after: case refine_3.intro.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
h : y ≤ p ^ n
i : ℕ
i_le : i ≤ n
hi : Associated y (p ^ i)
⊢ ∃ i, y = (fun i => p ^ ↑i) i

tactic: rw [associated_iff_eq] at hi
state_before: case refine_3.intro.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
h : y ≤ p ^ n
i : ℕ
i_le : i ≤ n
hi : Associated y (p ^ i)
⊢ ∃ i, y = (fun i => p ^ ↑i) i
state_after: case refine_3.intro.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
h : y ≤ p ^ n
i : ℕ
i_le : i ≤ n
hi : y = p ^ i
⊢ ∃ i, y = (fun i => p ^ ↑i) i

tactic: exact ⟨⟨i, Nat.lt_succ_of_le i_le⟩, hi⟩
state_before: case refine_3.intro.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
h : y ≤ p ^ n
i : ℕ
i_le : i ≤ n
hi : y = p ^ i
⊢ ∃ i, y = (fun i => p ^ ↑i) i
state_after: no goals

tactic: rintro ⟨i, rfl⟩
state_before: case refine_4
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
y : Associates M
⊢ (∃ i, y = (fun i => p ^ ↑i) i) → y ≤ p ^ n
state_after: case refine_4.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
i : Fin (n + 1)
⊢ (fun i => p ^ ↑i) i ≤ p ^ n

tactic: exact ⟨p ^ (n - i : ℕ), (pow_mul_pow_sub p (Nat.succ_le_succ_iff.mp i.2)).symm⟩
state_before: case refine_4.intro
M : Type u_1
inst✝ : CancelCommMonoidWithZero M
p : Associates M
n : ℕ
hn : n ≠ 0
hp : Prime p
i : Fin (n + 1)
⊢ (fun i => p ^ ↑i) i ≤ p ^ n
state_after: no goals