l3lab/ntp-mathlib huggingface dataset:
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by 

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
x✝ : Nodup (b :: l)
⊢ take 0 (b :: l) = List.filter (fun x => decide (x ∈ take 0 (b :: l))) (b :: l)

Next tactic:
simp
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by simp
  | b::l, n+1, hl => by
    

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
n : ℕ
hl : Nodup (b :: l)
⊢ take (n + 1) (b :: l) = List.filter (fun x => decide (x ∈ take (n + 1) (b :: l))) (b :: l)

Next tactic:
rw [take_cons, Nodup.take_eq_filter_mem (Nodup.of_cons hl), List.filter_cons_of_pos _ (by simp)]
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by simp
  | b::l, n+1, hl => by
    rw [take_cons, Nodup.take_eq_filter_mem (Nodup.of_cons hl), List.filter_cons_of_pos _ (by 

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
n : ℕ
hl : Nodup (b :: l)
⊢ decide (b ∈ b :: List.filter (fun x => decide (x ∈ take n l)) l) = true

Next tactic:
simp
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by simp
  | b::l, n+1, hl => by
    rw [take_cons, Nodup.take_eq_filter_mem (Nodup.of_cons hl), List.filter_cons_of_pos _ (by simp)]
    

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
n : ℕ
hl : Nodup (b :: l)
⊢ b :: List.filter (fun x => decide (x ∈ take n l)) l =
    b :: List.filter (fun x => decide (x ∈ b :: List.filter (fun x => decide (x ∈ take n l)) l)) l

Next tactic:
congr 1
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by simp
  | b::l, n+1, hl => by
    rw [take_cons, Nodup.take_eq_filter_mem (Nodup.of_cons hl), List.filter_cons_of_pos _ (by simp)]
    congr 1
    

Proof state:
case e_tail
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
n : ℕ
hl : Nodup (b :: l)
⊢ List.filter (fun x => decide (x ∈ take n l)) l =
    List.filter (fun x => decide (x ∈ b :: List.filter (fun x => decide (x ∈ take n l)) l)) l

Next tactic:
refine' List.filter_congr' _
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by simp
  | b::l, n+1, hl => by
    rw [take_cons, Nodup.take_eq_filter_mem (Nodup.of_cons hl), List.filter_cons_of_pos _ (by simp)]
    congr 1
    refine' List.filter_congr' _
    

Proof state:
case e_tail
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
n : ℕ
hl : Nodup (b :: l)
⊢ ∀ x ∈ l, decide (x ∈ take n l) = true ↔ decide (x ∈ b :: List.filter (fun x => decide (x ∈ take n l)) l) = true

Next tactic:
intro x hx
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by simp
  | b::l, n+1, hl => by
    rw [take_cons, Nodup.take_eq_filter_mem (Nodup.of_cons hl), List.filter_cons_of_pos _ (by simp)]
    congr 1
    refine' List.filter_congr' _
    intro x hx
    

Proof state:
case e_tail
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
n : ℕ
hl : Nodup (b :: l)
x : α
hx : x ∈ l
⊢ decide (x ∈ take n l) = true ↔ decide (x ∈ b :: List.filter (fun x => decide (x ∈ take n l)) l) = true

Next tactic:
have : x ≠ b := fun h => (nodup_cons.1 hl).1 (h ▸ hx)
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by simp
  | b::l, 0, _ => by simp
  | b::l, n+1, hl => by
    rw [take_cons, Nodup.take_eq_filter_mem (Nodup.of_cons hl), List.filter_cons_of_pos _ (by simp)]
    congr 1
    refine' List.filter_congr' _
    intro x hx
    have : x ≠ b := fun h => (nodup_cons.1 hl).1 (h ▸ hx)
    

Proof state:
case e_tail
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b✝ : α
inst✝ : DecidableEq α
b : α
l : List α
n : ℕ
hl : Nodup (b :: l)
x : α
hx : x ∈ l
this : x ≠ b
⊢ decide (x ∈ take n l) = true ↔ decide (x ∈ b :: List.filter (fun x => decide (x ∈ take n l)) l) = true

Next tactic:
simp (config := {contextual := true}) [List.mem_filter, this, hx]
@[simp]
theorem get_mem (i : Fin n) (v : Vector α n) : v.get i ∈ v.toList := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
i : Fin n
v : Vector α n
⊢ get v i ∈ toList v

Next tactic:
rw [get_eq_get]
@[simp]
theorem get_mem (i : Fin n) (v : Vector α n) : v.get i ∈ v.toList := by
  rw [get_eq_get]
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
i : Fin n
v : Vector α n
⊢ List.get (toList v) (Fin.cast (_ : n = List.length (toList v)) i) ∈ toList v

Next tactic:
exact List.get_mem _ _ _
theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α n
⊢ a ∈ toList v ↔ ∃ i, get v i = a

Next tactic:
simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get]
theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by
  simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get]
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α n
⊢ (∃ i, ∃ (h : i < List.length (toList v)), List.get (toList v) { val := i, isLt := h } = a) ↔
    ∃ i, ∃ (h : i < n), List.get (toList v) (Fin.cast (_ : n = List.length (toList v)) { val := i, isLt := h }) = a

Next tactic:
exact
    ⟨fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length] at hi, h⟩, fun ⟨i, hi, h⟩ =>
      ⟨i, by rwa [toList_length], h⟩⟩
theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by
  simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get]
  exact
    ⟨fun ⟨i, hi, h⟩ => ⟨i, by 

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α n
x✝ : ∃ i, ∃ (h : i < List.length (toList v)), List.get (toList v) { val := i, isLt := h } = a
i : ℕ
hi : i < List.length (toList v)
h : List.get (toList v) { val := i, isLt := hi } = a
⊢ i < n

Next tactic:
rwa [toList_length] at hi
theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by
  simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get]
  exact
    ⟨fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length] at hi, h⟩, fun ⟨i, hi, h⟩ =>
      ⟨i, by 

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α n
x✝ : ∃ i, ∃ (h : i < n), List.get (toList v) (Fin.cast (_ : n = List.length (toList v)) { val := i, isLt := h }) = a
i : ℕ
hi : i < n
h : List.get (toList v) (Fin.cast (_ : n = List.length (toList v)) { val := i, isLt := hi }) = a
⊢ i < List.length (toList v)

Next tactic:
rwa [toList_length]
theorem not_mem_nil : a ∉ (Vector.nil : Vector α 0).toList := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
⊢ a ∉ toList nil

Next tactic:
unfold Vector.nil
theorem not_mem_nil : a ∉ (Vector.nil : Vector α 0).toList := by
  unfold Vector.nil
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
⊢ a ∉ toList { val := [], property := (_ : List.length [] = List.length []) }

Next tactic:
dsimp
theorem not_mem_nil : a ∉ (Vector.nil : Vector α 0).toList := by
  unfold Vector.nil
  dsimp
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
⊢ a ∉ []

Next tactic:
simp
theorem mem_cons_iff (v : Vector α n) : a' ∈ (a ::ᵥ v).toList ↔ a' = a ∨ a' ∈ v.toList := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α n
⊢ a' ∈ toList (a ::ᵥ v) ↔ a' = a ∨ a' ∈ toList v

Next tactic:
rw [Vector.toList_cons, List.mem_cons]
theorem mem_succ_iff (v : Vector α (n + 1)) : a ∈ v.toList ↔ a = v.head ∨ a ∈ v.tail.toList := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α (n + 1)
⊢ a ∈ toList v ↔ a = head v ∨ a ∈ toList (tail v)

Next tactic:
obtain ⟨a', v', h⟩ := exists_eq_cons v
theorem mem_succ_iff (v : Vector α (n + 1)) : a ∈ v.toList ↔ a = v.head ∨ a ∈ v.tail.toList := by
  obtain ⟨a', v', h⟩ := exists_eq_cons v
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
n : ℕ
a a'✝ : α
v : Vector α (n + 1)
a' : α
v' : Vector α n
h : v = a' ::ᵥ v'
⊢ a ∈ toList v ↔ a = head v ∨ a ∈ toList (tail v)

Next tactic:
simp_rw [h, Vector.mem_cons_iff, Vector.head_cons, Vector.tail_cons]
theorem mem_of_mem_tail (v : Vector α n) (ha : a ∈ v.tail.toList) : a ∈ v.toList := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α n
ha : a ∈ toList (tail v)
⊢ a ∈ toList v

Next tactic:
induction' n with n _
theorem mem_of_mem_tail (v : Vector α n) (ha : a ∈ v.tail.toList) : a ∈ v.toList := by
  induction' n with n _
  · 

Proof state:
case zero
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
v : Vector α Nat.zero
ha : a ∈ toList (tail v)
⊢ a ∈ toList v

Next tactic:
exact False.elim (Vector.not_mem_zero a v.tail ha)
theorem mem_of_mem_tail (v : Vector α n) (ha : a ∈ v.tail.toList) : a ∈ v.toList := by
  induction' n with n _
  · exact False.elim (Vector.not_mem_zero a v.tail ha)
  · 

Proof state:
case succ
α : Type u_1
β : Type u_2
n✝ : ℕ
a a' : α
n : ℕ
n_ih✝ : ∀ (v : Vector α n), a ∈ toList (tail v) → a ∈ toList v
v : Vector α (Nat.succ n)
ha : a ∈ toList (tail v)
⊢ a ∈ toList v

Next tactic:
exact (mem_succ_iff a v).2 (Or.inr ha)
theorem mem_map_iff (b : β) (v : Vector α n) (f : α → β) :
    b ∈ (v.map f).toList ↔ ∃ a : α, a ∈ v.toList ∧ f a = b := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
b : β
v : Vector α n
f : α → β
⊢ b ∈ toList (map f v) ↔ ∃ a ∈ toList v, f a = b

Next tactic:
rw [Vector.toList_map, List.mem_map]
theorem not_mem_map_zero (b : β) (v : Vector α 0) (f : α → β) : b ∉ (v.map f).toList := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
b : β
v : Vector α 0
f : α → β
⊢ b ∉ toList (map f v)

Next tactic:
simpa only [Vector.eq_nil v, Vector.map_nil, Vector.toList_nil] using List.not_mem_nil b
theorem mem_map_succ_iff (b : β) (v : Vector α (n + 1)) (f : α → β) :
    b ∈ (v.map f).toList ↔ f v.head = b ∨ ∃ a : α, a ∈ v.tail.toList ∧ f a = b := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
a a' : α
b : β
v : Vector α (n + 1)
f : α → β
⊢ b ∈ toList (map f v) ↔ f (head v) = b ∨ ∃ a ∈ toList (tail v), f a = b

Next tactic:
rw [mem_succ_iff, head_map, tail_map, mem_map_iff, @eq_comm _ b]
/-- An equivalent definition for prime powers: `n` is a prime power iff there is a prime `p` and a
natural `k` such that `n` can be written as `p^(k+1)`. -/
theorem isPrimePow_iff_pow_succ : IsPrimePow n ↔ ∃ (p : R) (k : ℕ), Prime p ∧ p ^ (k + 1) = n :=
  (isPrimePow_def _).trans
    ⟨fun ⟨p, k, hp, hk, hn⟩ => ⟨_, _, hp, by 

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ : ℕ
x✝ : ∃ p k, Prime p ∧ 0 < k ∧ p ^ k = n
p : R
k : ℕ
hp : Prime p
hk : 0 < k
hn : p ^ k = n
⊢ p ^ (?m.1372 x✝ p k hp hk hn + 1) = n

Next tactic:
rwa [Nat.sub_add_cancel hk]
theorem not_isPrimePow_zero [NoZeroDivisors R] : ¬IsPrimePow (0 : R) := by
  

Proof state:
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n p : R
k : ℕ
inst✝ : NoZeroDivisors R
⊢ ¬IsPrimePow 0

Next tactic:
simp only [isPrimePow_def, not_exists, not_and', and_imp]
theorem not_isPrimePow_zero [NoZeroDivisors R] : ¬IsPrimePow (0 : R) := by
  simp only [isPrimePow_def, not_exists, not_and', and_imp]
  

Proof state:
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n p : R
k : ℕ
inst✝ : NoZeroDivisors R
⊢ ∀ (x : R) (x_1 : ℕ), 0 < x_1 → x ^ x_1 = 0 → ¬Prime x

Next tactic:
intro x n _hn hx
theorem not_isPrimePow_zero [NoZeroDivisors R] : ¬IsPrimePow (0 : R) := by
  simp only [isPrimePow_def, not_exists, not_and', and_imp]
  intro x n _hn hx
  

Proof state:
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n✝ p : R
k : ℕ
inst✝ : NoZeroDivisors R
x : R
n : ℕ
_hn : 0 < n
hx : x ^ n = 0
⊢ ¬Prime x

Next tactic:
rw [pow_eq_zero hx]
theorem not_isPrimePow_zero [NoZeroDivisors R] : ¬IsPrimePow (0 : R) := by
  simp only [isPrimePow_def, not_exists, not_and', and_imp]
  intro x n _hn hx
  rw [pow_eq_zero hx]
  

Proof state:
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n✝ p : R
k : ℕ
inst✝ : NoZeroDivisors R
x : R
n : ℕ
_hn : 0 < n
hx : x ^ n = 0
⊢ ¬Prime 0

Next tactic:
simp
theorem Prime.isPrimePow {p : R} (hp : Prime p) : IsPrimePow p :=
  ⟨p, 1, hp, zero_lt_one, by 

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k : ℕ
p : R
hp : Prime p
⊢ p ^ 1 = p

Next tactic:
simp
theorem IsPrimePow.pow {n : R} (hn : IsPrimePow n) {k : ℕ} (hk : k ≠ 0) : IsPrimePow (n ^ k) :=
  let ⟨p, k', hp, hk', hn⟩ := hn
  ⟨p, k * k', hp, mul_pos hk.bot_lt hk', by 

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ : ℕ
n : R
hn✝ : IsPrimePow n
k : ℕ
hk : k ≠ 0
p : R
k' : ℕ
hp : Prime p
hk' : 0 < k'
hn : p ^ k' = n
⊢ p ^ (k * k') = n ^ k

Next tactic:
rw [pow_mul', hn]
theorem isPrimePow_nat_iff (n : ℕ) : IsPrimePow n ↔ ∃ p k : ℕ, Nat.Prime p ∧ 0 < k ∧ p ^ k = n := by
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ IsPrimePow n ↔ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

Next tactic:
simp only [isPrimePow_def, Nat.prime_iff]
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ IsPrimePow n ↔ ∃ p ≤ n, ∃ k ≤ n, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

Next tactic:
rw [isPrimePow_nat_iff]
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ (∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n) ↔ ∃ p ≤ n, ∃ k ≤ n, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

Next tactic:
refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ (∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n) → ∃ p ≤ n, ∃ k ≤ n, Nat.Prime p ∧ 0 < k ∧ p ^ k = n

Next tactic:
rintro ⟨p, k, hp, hk, rfl⟩
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
  rintro ⟨p, k, hp, hk, rfl⟩
  

Proof state:
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
⊢ ∃ p_1 ≤ p ^ k, ∃ k_1 ≤ p ^ k, Nat.Prime p_1 ∧ 0 < k_1 ∧ p_1 ^ k_1 = p ^ k

Next tactic:
refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
  rintro ⟨p, k, hp, hk, rfl⟩
  refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩
  

Proof state:
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
⊢ p ≤ p ^ k

Next tactic:
conv => { lhs; rw [← (pow_one p)] }
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
  rintro ⟨p, k, hp, hk, rfl⟩
  refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩
  conv => 

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
| p ≤ p ^ k

Next tactic:
{ lhs; rw [← (pow_one p)] }
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
  rintro ⟨p, k, hp, hk, rfl⟩
  refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩
  conv => { 

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
| p ≤ p ^ k

Next tactic:
lhs
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
  rintro ⟨p, k, hp, hk, rfl⟩
  refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩
  conv => { lhs; 

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
| p

Next tactic:
rw [← (pow_one p)]
theorem isPrimePow_nat_iff_bounded (n : ℕ) :
    IsPrimePow n ↔ ∃ p : ℕ, p ≤ n ∧ ∃ k : ℕ, k ≤ n ∧ p.Prime ∧ 0 < k ∧ p ^ k = n := by
  rw [isPrimePow_nat_iff]
  refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
  rintro ⟨p, k, hp, hk, rfl⟩
  refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩
  conv => { lhs; rw [← (pow_one p)] }
  

Proof state:
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
⊢ p ^ 1 ≤ p ^ k

Next tactic:
exact pow_le_pow_right hp.one_lt.le hk
theorem IsPrimePow.dvd {n m : ℕ} (hn : IsPrimePow n) (hm : m ∣ n) (hm₁ : m ≠ 1) : IsPrimePow m := by
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n m : ℕ
hn : IsPrimePow n
hm : m ∣ n
hm₁ : m ≠ 1
⊢ IsPrimePow m

Next tactic:
rw [isPrimePow_nat_iff] at hn ⊢
theorem IsPrimePow.dvd {n m : ℕ} (hn : IsPrimePow n) (hm : m ∣ n) (hm₁ : m ≠ 1) : IsPrimePow m := by
  rw [isPrimePow_nat_iff] at hn ⊢
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n m : ℕ
hn : ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
hm : m ∣ n
hm₁ : m ≠ 1
⊢ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = m

Next tactic:
rcases hn with ⟨p, k, hp, _hk, rfl⟩
theorem IsPrimePow.dvd {n m : ℕ} (hn : IsPrimePow n) (hm : m ∣ n) (hm₁ : m ≠ 1) : IsPrimePow m := by
  rw [isPrimePow_nat_iff] at hn ⊢
  rcases hn with ⟨p, k, hp, _hk, rfl⟩
  

Proof state:
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ m : ℕ
hm₁ : m ≠ 1
p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
hm : m ∣ p ^ k
⊢ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = m

Next tactic:
obtain ⟨i, hik, rfl⟩ := (Nat.dvd_prime_pow hp).1 hm
theorem IsPrimePow.dvd {n m : ℕ} (hn : IsPrimePow n) (hm : m ∣ n) (hm₁ : m ≠ 1) : IsPrimePow m := by
  rw [isPrimePow_nat_iff] at hn ⊢
  rcases hn with ⟨p, k, hp, _hk, rfl⟩
  obtain ⟨i, hik, rfl⟩ := (Nat.dvd_prime_pow hp).1 hm
  

Proof state:
case intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
i : ℕ
hik : i ≤ k
hm₁ : p ^ i ≠ 1
hm : p ^ i ∣ p ^ k
⊢ ∃ p_1 k, Nat.Prime p_1 ∧ 0 < k ∧ p_1 ^ k = p ^ i

Next tactic:
refine' ⟨p, i, hp, _, rfl⟩
theorem IsPrimePow.dvd {n m : ℕ} (hn : IsPrimePow n) (hm : m ∣ n) (hm₁ : m ≠ 1) : IsPrimePow m := by
  rw [isPrimePow_nat_iff] at hn ⊢
  rcases hn with ⟨p, k, hp, _hk, rfl⟩
  obtain ⟨i, hik, rfl⟩ := (Nat.dvd_prime_pow hp).1 hm
  refine' ⟨p, i, hp, _, rfl⟩
  

Proof state:
case intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
i : ℕ
hik : i ≤ k
hm₁ : p ^ i ≠ 1
hm : p ^ i ∣ p ^ k
⊢ 0 < i

Next tactic:
apply Nat.pos_of_ne_zero
theorem IsPrimePow.dvd {n m : ℕ} (hn : IsPrimePow n) (hm : m ∣ n) (hm₁ : m ≠ 1) : IsPrimePow m := by
  rw [isPrimePow_nat_iff] at hn ⊢
  rcases hn with ⟨p, k, hp, _hk, rfl⟩
  obtain ⟨i, hik, rfl⟩ := (Nat.dvd_prime_pow hp).1 hm
  refine' ⟨p, i, hp, _, rfl⟩
  apply Nat.pos_of_ne_zero
  

Proof state:
case intro.intro.intro.intro.intro.intro.a
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
i : ℕ
hik : i ≤ k
hm₁ : p ^ i ≠ 1
hm : p ^ i ∣ p ^ k
⊢ i ≠ 0

Next tactic:
rintro rfl
theorem IsPrimePow.dvd {n m : ℕ} (hn : IsPrimePow n) (hm : m ∣ n) (hm₁ : m ≠ 1) : IsPrimePow m := by
  rw [isPrimePow_nat_iff] at hn ⊢
  rcases hn with ⟨p, k, hp, _hk, rfl⟩
  obtain ⟨i, hik, rfl⟩ := (Nat.dvd_prime_pow hp).1 hm
  refine' ⟨p, i, hp, _, rfl⟩
  apply Nat.pos_of_ne_zero
  rintro rfl
  

Proof state:
case intro.intro.intro.intro.intro.intro.a
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
hik : 0 ≤ k
hm₁ : p ^ 0 ≠ 1
hm : p ^ 0 ∣ p ^ k
⊢ False

Next tactic:
simp only [pow_zero, ne_eq, not_true_eq_false] at hm₁
theorem Nat.disjoint_divisors_filter_isPrimePow {a b : ℕ} (hab : a.Coprime b) :
    Disjoint (a.divisors.filter IsPrimePow) (b.divisors.filter IsPrimePow) := by
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n p : R
k a b : ℕ
hab : Coprime a b
⊢ Disjoint (Finset.filter IsPrimePow (divisors a)) (Finset.filter IsPrimePow (divisors b))

Next tactic:
simp only [Finset.disjoint_left, Finset.mem_filter, and_imp, Nat.mem_divisors, not_and]
theorem Nat.disjoint_divisors_filter_isPrimePow {a b : ℕ} (hab : a.Coprime b) :
    Disjoint (a.divisors.filter IsPrimePow) (b.divisors.filter IsPrimePow) := by
  simp only [Finset.disjoint_left, Finset.mem_filter, and_imp, Nat.mem_divisors, not_and]
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n p : R
k a b : ℕ
hab : Coprime a b
⊢ ∀ ⦃a_1 : ℕ⦄, a_1 ∣ a → a ≠ 0 → IsPrimePow a_1 → a_1 ∣ b → b ≠ 0 → ¬IsPrimePow a_1

Next tactic:
rintro n han _ha hn hbn _hb -
theorem Nat.disjoint_divisors_filter_isPrimePow {a b : ℕ} (hab : a.Coprime b) :
    Disjoint (a.divisors.filter IsPrimePow) (b.divisors.filter IsPrimePow) := by
  simp only [Finset.disjoint_left, Finset.mem_filter, and_imp, Nat.mem_divisors, not_and]
  rintro n han _ha hn hbn _hb -
  

Proof state:
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k a b : ℕ
hab : Coprime a b
n : ℕ
han : n ∣ a
_ha : a ≠ 0
hn : IsPrimePow n
hbn : n ∣ b
_hb : b ≠ 0
⊢ False

Next tactic:
exact hn.ne_one (Nat.eq_one_of_dvd_coprimes hab han hbn)
theorem setOf_liouvilleWith_subset_aux :
    { x : ℝ | ∃ p > 2, LiouvilleWith p x } ⊆
      ⋃ m : ℤ, (· + (m : ℝ)) ⁻¹' ⋃ n > (0 : ℕ),
        { x : ℝ | ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b,
          |x - (a : ℤ) / b| < 1 / (b : ℝ) ^ (2 + 1 / n : ℝ) } := by
  

Proof state:
⊢ {x | ∃ p > 2, LiouvilleWith p x} ⊆
    ⋃ m,
      (fun x => x + ↑m) ⁻¹'
        ⋃ n, ⋃ (_ : n > 0), {x | ∃ᶠ (b : ℕ) in atTop, ∃ a ∈ Finset.Icc 0 ↑b, |x - ↑a / ↑b| < 1 / ↑b ^ (2 + 1 / ↑n)}

Next tactic:
rintro x ⟨p, hp, hxp⟩
theorem setOf_liouvilleWith_subset_aux :
    { x : ℝ | ∃ p > 2, LiouvilleWith p x } ⊆
      ⋃ m : ℤ, (· + (m : ℝ)) ⁻¹' ⋃ n > (0 : ℕ),
        { x : ℝ | ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b,
          |x - (a : ℤ) / b| < 1 / (b : ℝ) ^ (2 + 1 / n : ℝ) } := by
  rintro x ⟨p, hp, hxp⟩
  

Proof state:
case intro.intro
x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
⊢ x ∈
    ⋃ m,
      (fun x => x + ↑m) ⁻¹'
        ⋃ n, ⋃ (_ : n > 0), {x | ∃ᶠ (b : ℕ) in atTop, ∃ a ∈ Finset.Icc 0 ↑b, |x - ↑a / ↑b| < 1 / ↑b ^ (2 + 1 / ↑n)}

Next tactic:
rcases exists_nat_one_div_lt (sub_pos.2 hp) with ⟨n, hn⟩
theorem setOf_liouvilleWith_subset_aux :
    { x : ℝ | ∃ p > 2, LiouvilleWith p x } ⊆
      ⋃ m : ℤ, (· + (m : ℝ)) ⁻¹' ⋃ n > (0 : ℕ),
        { x : ℝ | ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b,
          |x - (a : ℤ) / b| < 1 / (b : ℝ) ^ (2 + 1 / n : ℝ) } := by
  rintro x ⟨p, hp, hxp⟩
  rcases exists_nat_one_div_lt (sub_pos.2 hp) with ⟨n, hn⟩
  

Proof state:
case intro.intro.intro
x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 1 / (↑n + 1) < p - 2
⊢ x ∈
    ⋃ m,
      (fun x => x + ↑m) ⁻¹'
        ⋃ n, ⋃ (_ : n > 0), {x | ∃ᶠ (b : ℕ) in atTop, ∃ a ∈ Finset.Icc 0 ↑b, |x - ↑a / ↑b| < 1 / ↑b ^ (2 + 1 / ↑n)}

Next tactic:
rw [lt_sub_iff_add_lt'] at hn