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_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
h : IsPrimePow n
⊢ ∃ p, Nat.Prime p ∧ n / p ^ n.factorization p = 1
state_after: case inl
R : Type u_1
inst✝ : CommMonoidWithZero R
n p : R
k : ℕ
h : IsPrimePow 0
⊢ ∃ p, Nat.Prime p ∧ 0 / p ^ (Nat.factorization 0) p = 1

case inr
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
⊢ ∃ p, Nat.Prime p ∧ n / p ^ n.factorization p = 1

tactic: rcases isPrimePow_iff_factorization_eq_single.mp h with ⟨p, k, hk0, h1⟩
state_before: case inr
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
⊢ ∃ p, Nat.Prime p ∧ n / p ^ n.factorization p = 1
state_after: case inr.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : n.factorization = Finsupp.single p k
⊢ ∃ p, Nat.Prime p ∧ n / p ^ n.factorization p = 1

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

case inr.intro.intro.intro.inr
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : n.factorization = Finsupp.single p k
pp : Nat.Prime p
⊢ ∃ p, Nat.Prime p ∧ n / p ^ n.factorization p = 1

tactic: refine ⟨p, pp, ?_⟩
state_before: case inr.intro.intro.intro.inr
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : n.factorization = Finsupp.single p k
pp : Nat.Prime p
⊢ ∃ p, Nat.Prime p ∧ n / p ^ n.factorization p = 1
state_after: case inr.intro.intro.intro.inr
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : n.factorization = Finsupp.single p k
pp : Nat.Prime p
⊢ n / p ^ n.factorization 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_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : n.factorization = Finsupp.single p k
pp : Nat.Prime p
⊢ n / p ^ n.factorization p = 1
state_after: case inr.intro.intro.intro.inr
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ n : ℕ
h : IsPrimePow n
hn0 : n ≠ 0
p k : ℕ
hk0 : 0 < k
h1 : n.factorization = Finsupp.single p k
pp : Nat.Prime p
q : ℕ
⊢ (n / p ^ n.factorization p).factorization q = (Nat.factorization 1) q

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

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

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

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

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

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