Theorem: Cardinal.isPrimePow_iff
File: Mathlib/SetTheory/Cardinal/Divisibility.lean

tactic: by_cases h : ℵ₀ ≤ a
state_before: a✝ b : Cardinal
n m : ℕ
a : Cardinal
⊢ IsPrimePow a ↔ ℵ₀ ≤ a ∨ ∃ n, a = ↑n ∧ IsPrimePow n

tactic: simp only [h, Nat.cast_inj, exists_eq_left', false_or_iff, isPrimePow_nat_iff]
state_before: case neg
a✝ b : Cardinal
n m : ℕ
a : Cardinal
h : ¬ℵ₀ ≤ a
⊢ IsPrimePow a ↔ ℵ₀ ≤ a ∨ ∃ n, a = ↑n ∧ IsPrimePow n

tactic: lift a to ℕ using not_le.mp h
state_before: case neg
a✝ b : Cardinal
n m : ℕ
a : Cardinal
h : ¬ℵ₀ ≤ a
⊢ IsPrimePow a ↔ ∃ n, a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: rw [isPrimePow_def]
state_before: case neg.intro
a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
⊢ IsPrimePow ↑a ↔ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: refine'
  ⟨_, fun ⟨n, han, p, k, hp, hk, h⟩ =>
        ⟨p, k, nat_is_prime_iff.2 hp, hk, by rw [han]; exact_mod_cast h⟩⟩
state_before: case neg.intro
a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
⊢ (∃ p k, Prime p ∧ 0 < k ∧ p ^ k = ↑a) ↔ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: rintro ⟨p, k, hp, hk, hpk⟩
state_before: case neg.intro
a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
⊢ (∃ p k, Prime p ∧ 0 < k ∧ p ^ k = ↑a) → ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: have key : p ^ 1 ≤ ↑a := by rw [←hpk]; apply power_le_power_left hp.ne_zero; exact_mod_cast hk
state_before: case neg.intro.intro.intro.intro.intro
a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: rw [power_one] at key
state_before: case neg.intro.intro.intro.intro.intro
a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
key : p ^ 1 ≤ ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: lift p to ℕ using key.trans_lt (nat_lt_aleph0 a)
state_before: case neg.intro.intro.intro.intro.intro
a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
key : p ≤ ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: exact ⟨a, rfl, p, k, nat_is_prime_iff.mp hp, hk, by exact_mod_cast hpk⟩
state_before: case neg.intro.intro.intro.intro.intro.intro
a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
k : ℕ
hk : 0 < k
p : ℕ
hp : Prime ↑p
hpk : ↑p ^ k = ↑a
key : ↑p ≤ ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

tactic: simp [h, (prime_of_aleph0_le h).isPrimePow]
state_before: case pos
a✝ b : Cardinal
n m : ℕ
a : Cardinal
h : ℵ₀ ≤ a
⊢ IsPrimePow a ↔ ℵ₀ ≤ a ∨ ∃ n, a = ↑n ∧ IsPrimePow n

tactic: rw [han]
state_before: a✝ b : Cardinal
n✝ m a : ℕ
h✝ : ¬ℵ₀ ≤ ↑a
x✝ : ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
n : ℕ
han : ↑a = ↑n
p k : ℕ
hp : Nat.Prime p
hk : 0 < k
h : p ^ k = n
⊢ ↑p ^ k = ↑a

tactic: exact_mod_cast h
state_before: a✝ b : Cardinal
n✝ m a : ℕ
h✝ : ¬ℵ₀ ≤ ↑a
x✝ : ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
n : ℕ
han : ↑a = ↑n
p k : ℕ
hp : Nat.Prime p
hk : 0 < k
h : p ^ k = n
⊢ ↑p ^ k = ↑n

tactic: rw [←hpk]
state_before: a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ p ^ 1 ≤ ↑a

tactic: apply power_le_power_left hp.ne_zero
state_before: a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ p ^ 1 ≤ p ^ k

tactic: exact_mod_cast hk
state_before: a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ 1 ≤ ↑k

tactic: exact_mod_cast hpk
state_before: a✝ b : Cardinal
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
k : ℕ
hk : 0 < k
p : ℕ
hp : Prime ↑p
hpk : ↑p ^ k = ↑a
key : ↑p ≤ ↑a
⊢ p ^ k = a