Theorem: IsPrimePow.exists_ord_compl_eq_one
File: Mathlib/Data/Nat/Factorization/PrimePow.lean

tactic: rcases eq_or_ne n 0 with (rfl | hn0)
state_before: R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
h : IsPrimePow n
⊢ ∃ p, Nat.Prime p ∧ n / p ^ ↑(Nat.factorization n) p = 1

tactic: rcases isPrimePow_iff_factorization_eq_single.mp h with ⟨p, k, hk0, h1⟩
state_before: case inr
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
⊢ ∃ p, Nat.Prime p ∧ n / p ^ ↑(Nat.factorization n) p = 1

tactic: rcases em' p.Prime with (pp | pp)
state_before: case inr.intro.intro.intro
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
⊢ ∃ p, Nat.Prime p ∧ n / p ^ ↑(Nat.factorization n) p = 1

tactic: refine' ⟨p, pp, _⟩
state_before: case inr.intro.intro.intro.inr
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
pp : Nat.Prime p
⊢ ∃ p, Nat.Prime p ∧ n / p ^ ↑(Nat.factorization n) p = 1

tactic: refine' Nat.eq_of_factorization_eq (Nat.ord_compl_pos p hn0).ne' (by simp) fun q => _
state_before: case inr.intro.intro.intro.inr
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
pp : Nat.Prime p
⊢ n / p ^ ↑(Nat.factorization n) p = 1

tactic: rw [Nat.factorization_ord_compl n p, h1]
state_before: case inr.intro.intro.intro.inr
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
pp : Nat.Prime p
q : ℕ
⊢ ↑(Nat.factorization (n / p ^ ↑(Nat.factorization n) p)) q = ↑(Nat.factorization 1) q

tactic: simp
state_before: case inr.intro.intro.intro.inr
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
pp : Nat.Prime p
q : ℕ
⊢ ↑(Finsupp.erase p (Finsupp.single p k)) q = ↑(Nat.factorization 1) q

tactic: cases not_isPrimePow_zero h
state_before: case inl
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n p : R
k : ℕ
h : IsPrimePow 0
⊢ ∃ p, Nat.Prime p ∧ 0 / p ^ ↑(Nat.factorization 0) p = 1

tactic: refine' absurd _ hk0.ne'
state_before: case inr.intro.intro.intro.inl
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
pp : ¬Nat.Prime p
⊢ ∃ p, Nat.Prime p ∧ n / p ^ ↑(Nat.factorization n) p = 1

tactic: simp [← Nat.factorization_eq_zero_of_non_prime n pp, h1]
state_before: case inr.intro.intro.intro.inl
R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
pp : ¬Nat.Prime p
⊢ k = 0

tactic: simp
state_before: R : Type ?u.4264
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : Nat.factorization n = Finsupp.single p k
pp : Nat.Prime p
⊢ 1 ≠ 0