l3lab/ntp-mathlib huggingface dataset:
theorem exists_seq_monotone_tendsto_atTop_atTop (α : Type*) [SemilatticeSup α] [Nonempty α]
    [(atTop : Filter α).IsCountablyGenerated] :
    ∃ xs : ℕ → α, Monotone xs ∧ Tendsto xs atTop atTop := by
  haveI h_ne_bot : (atTop : Filter α).NeBot := atTop_neBot
  obtain ⟨ys, h⟩ := exists_seq_tendsto (atTop : Filter α)
  let xs : ℕ → α := fun n => Finset.sup' (Finset.range (n + 1)) Finset.nonempty_range_succ ys
  have h_mono : Monotone xs := by
    intro i j hij
    rw [Finset.sup'_le_iff]
    intro k hk
    refine' Finset.le_sup'_of_le _ _ le_rfl
    rw [Finset.mem_range] at hk ⊢
    exact hk.trans_le (add_le_add_right hij _)
  refine' ⟨xs, h_mono, _⟩
  · refine' tendsto_atTop_atTop_of_monotone h_mono _
    have : ∀ a : α, ∃ n : ℕ, a ≤ ys n := by
      rw [tendsto_atTop_atTop] at h
      intro a
      obtain ⟨i, hi⟩ := h a
      exact ⟨i, hi i le_rfl⟩
    intro a
    obtain ⟨i, hi⟩ := this a
    refine' ⟨i, hi.trans _⟩
    

Proof state:
case intro.intro
ι : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
inst✝² : SemilatticeSup α
inst✝¹ : Nonempty α
inst✝ : IsCountablyGenerated atTop
h_ne_bot : NeBot atTop
ys : ℕ → α
h : Tendsto ys atTop atTop
xs : ℕ → α := fun n => Finset.sup' (Finset.range (n + 1)) (_ : Finset.Nonempty (Finset.range (n + 1))) ys
h_mono : Monotone xs
this : ∀ (a : α), ∃ n, a ≤ ys n
a : α
i : ℕ
hi : a ≤ ys i
⊢ ys i ≤ xs i

Next tactic:
refine' Finset.le_sup'_of_le _ _ le_rfl
theorem exists_seq_monotone_tendsto_atTop_atTop (α : Type*) [SemilatticeSup α] [Nonempty α]
    [(atTop : Filter α).IsCountablyGenerated] :
    ∃ xs : ℕ → α, Monotone xs ∧ Tendsto xs atTop atTop := by
  haveI h_ne_bot : (atTop : Filter α).NeBot := atTop_neBot
  obtain ⟨ys, h⟩ := exists_seq_tendsto (atTop : Filter α)
  let xs : ℕ → α := fun n => Finset.sup' (Finset.range (n + 1)) Finset.nonempty_range_succ ys
  have h_mono : Monotone xs := by
    intro i j hij
    rw [Finset.sup'_le_iff]
    intro k hk
    refine' Finset.le_sup'_of_le _ _ le_rfl
    rw [Finset.mem_range] at hk ⊢
    exact hk.trans_le (add_le_add_right hij _)
  refine' ⟨xs, h_mono, _⟩
  · refine' tendsto_atTop_atTop_of_monotone h_mono _
    have : ∀ a : α, ∃ n : ℕ, a ≤ ys n := by
      rw [tendsto_atTop_atTop] at h
      intro a
      obtain ⟨i, hi⟩ := h a
      exact ⟨i, hi i le_rfl⟩
    intro a
    obtain ⟨i, hi⟩ := this a
    refine' ⟨i, hi.trans _⟩
    refine' Finset.le_sup'_of_le _ _ le_rfl
    

Proof state:
case intro.intro
ι : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
inst✝² : SemilatticeSup α
inst✝¹ : Nonempty α
inst✝ : IsCountablyGenerated atTop
h_ne_bot : NeBot atTop
ys : ℕ → α
h : Tendsto ys atTop atTop
xs : ℕ → α := fun n => Finset.sup' (Finset.range (n + 1)) (_ : Finset.Nonempty (Finset.range (n + 1))) ys
h_mono : Monotone xs
this : ∀ (a : α), ∃ n, a ≤ ys n
a : α
i : ℕ
hi : a ≤ ys i
⊢ i ∈ Finset.range (i + 1)

Next tactic:
rw [Finset.mem_range_succ_iff]
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
⊢ Tendsto f k l ↔ ∀ (x : ℕ → α), Tendsto x atTop k → Tendsto (f ∘ x) atTop l

Next tactic:
refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  

Proof state:
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
H : ∀ (x : ℕ → α), Tendsto x atTop k → Tendsto (f ∘ x) atTop l
s : Set β
hs : s ∈ l
⊢ s ∈ map f k

Next tactic:
contrapose! H
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  contrapose! H
  

Proof state:
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
s : Set β
hs : s ∈ l
H : s ∉ map f k
⊢ ∃ x, Tendsto x atTop k ∧ ¬Tendsto (f ∘ x) atTop l

Next tactic:
have : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ)) := by simpa [neBot_iff, inf_principal_eq_bot]
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  contrapose! H
  have : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ)) := by 

Proof state:
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
s : Set β
hs : s ∈ l
H : s ∉ map f k
⊢ NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ))

Next tactic:
simpa [neBot_iff, inf_principal_eq_bot]
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  contrapose! H
  have : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ)) := by simpa [neBot_iff, inf_principal_eq_bot]
  

Proof state:
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
s : Set β
hs : s ∈ l
H : s ∉ map f k
this : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ))
⊢ ∃ x, Tendsto x atTop k ∧ ¬Tendsto (f ∘ x) atTop l

Next tactic:
rcases (k ⊓ 𝓟 (f ⁻¹' sᶜ)).exists_seq_tendsto with ⟨x, hx⟩
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  contrapose! H
  have : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ)) := by simpa [neBot_iff, inf_principal_eq_bot]
  rcases (k ⊓ 𝓟 (f ⁻¹' sᶜ)).exists_seq_tendsto with ⟨x, hx⟩
  

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
s : Set β
hs : s ∈ l
H : s ∉ map f k
this : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ))
x : ℕ → α
hx : Tendsto x atTop (k ⊓ 𝓟 (f ⁻¹' sᶜ))
⊢ ∃ x, Tendsto x atTop k ∧ ¬Tendsto (f ∘ x) atTop l

Next tactic:
rw [tendsto_inf, tendsto_principal] at hx
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  contrapose! H
  have : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ)) := by simpa [neBot_iff, inf_principal_eq_bot]
  rcases (k ⊓ 𝓟 (f ⁻¹' sᶜ)).exists_seq_tendsto with ⟨x, hx⟩
  rw [tendsto_inf, tendsto_principal] at hx
  

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
s : Set β
hs : s ∈ l
H : s ∉ map f k
this : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ))
x : ℕ → α
hx : Tendsto x atTop k ∧ ∀ᶠ (a : ℕ) in atTop, x a ∈ f ⁻¹' sᶜ
⊢ ∃ x, Tendsto x atTop k ∧ ¬Tendsto (f ∘ x) atTop l

Next tactic:
refine' ⟨x, hx.1, fun h => _⟩
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  contrapose! H
  have : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ)) := by simpa [neBot_iff, inf_principal_eq_bot]
  rcases (k ⊓ 𝓟 (f ⁻¹' sᶜ)).exists_seq_tendsto with ⟨x, hx⟩
  rw [tendsto_inf, tendsto_principal] at hx
  refine' ⟨x, hx.1, fun h => _⟩
  

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
s : Set β
hs : s ∈ l
H : s ∉ map f k
this : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ))
x : ℕ → α
hx : Tendsto x atTop k ∧ ∀ᶠ (a : ℕ) in atTop, x a ∈ f ⁻¹' sᶜ
h : Tendsto (f ∘ x) atTop l
⊢ False

Next tactic:
rcases (hx.2.and (h hs)).exists with ⟨N, hnmem, hmem⟩
/-- An abstract version of continuity of sequentially continuous functions on metric spaces:
if a filter `k` is countably generated then `Tendsto f k l` iff for every sequence `u`
converging to `k`, `f ∘ u` tends to `l`. -/
theorem tendsto_iff_seq_tendsto {f : α → β} {k : Filter α} {l : Filter β} [k.IsCountablyGenerated] :
    Tendsto f k l ↔ ∀ x : ℕ → α, Tendsto x atTop k → Tendsto (f ∘ x) atTop l := by
  refine' ⟨fun h x hx => h.comp hx, fun H s hs => _⟩
  contrapose! H
  have : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ)) := by simpa [neBot_iff, inf_principal_eq_bot]
  rcases (k ⊓ 𝓟 (f ⁻¹' sᶜ)).exists_seq_tendsto with ⟨x, hx⟩
  rw [tendsto_inf, tendsto_principal] at hx
  refine' ⟨x, hx.1, fun h => _⟩
  rcases (hx.2.and (h hs)).exists with ⟨N, hnmem, hmem⟩
  

Proof state:
case intro.intro.intro
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : α → β
k : Filter α
l : Filter β
inst✝ : IsCountablyGenerated k
s : Set β
hs : s ∈ l
H : s ∉ map f k
this : NeBot (k ⊓ 𝓟 (f ⁻¹' sᶜ))
x : ℕ → α
hx : Tendsto x atTop k ∧ ∀ᶠ (a : ℕ) in atTop, x a ∈ f ⁻¹' sᶜ
h : Tendsto (f ∘ x) atTop l
N : ℕ
hnmem : x N ∈ f ⁻¹' sᶜ
hmem : (f ∘ x) N ∈ s
⊢ False

Next tactic:
exact hnmem hmem
theorem not_tendsto_iff_exists_frequently_nmem {x : ι → α} {f : Filter α} {l : Filter ι} :
    ¬Tendsto x l f ↔ ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
x : ι → α
f : Filter α
l : Filter ι
⊢ ¬Tendsto x l f ↔ ∃ s ∈ f, ∃ᶠ (n : ι) in l, x n ∉ s

Next tactic:
simp only [tendsto_iff_forall_eventually_mem, not_forall, exists_prop, Filter.Frequently, not_not]
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
⊢ (∃ᶠ (n : ι) in l, p n) ↔ ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · 

Proof state:
case refine'_1
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
⊢ ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by 

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
⊢ NeBot (l ⊓ 𝓟 {x | p x})

Next tactic:
simpa [neBot_iff, inf_principal_eq_bot]
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    

Proof state:
case refine'_1
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
this : NeBot (l ⊓ 𝓟 {x | p x})
⊢ ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    

Proof state:
case refine'_1.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
this : NeBot (l ⊓ 𝓟 {x | p x})
x : ℕ → ι
hx : Tendsto x atTop (l ⊓ 𝓟 {x | p x})
⊢ ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
rw [tendsto_inf] at hx
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    

Proof state:
case refine'_1.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
this : NeBot (l ⊓ 𝓟 {x | p x})
x : ℕ → ι
hx : Tendsto x atTop l ∧ Tendsto x atTop (𝓟 {x | p x})
⊢ ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
cases' hx with hx_l hx_p
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    

Proof state:
case refine'_1.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
this : NeBot (l ⊓ 𝓟 {x | p x})
x : ℕ → ι
hx_l : Tendsto x atTop l
hx_p : Tendsto x atTop (𝓟 {x | p x})
⊢ ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
refine' ⟨x, hx_l, _⟩
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    refine' ⟨x, hx_l, _⟩
    

Proof state:
case refine'_1.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
this : NeBot (l ⊓ 𝓟 {x | p x})
x : ℕ → ι
hx_l : Tendsto x atTop l
hx_p : Tendsto x atTop (𝓟 {x | p x})
⊢ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
rw [tendsto_principal] at hx_p
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    refine' ⟨x, hx_l, _⟩
    rw [tendsto_principal] at hx_p
    

Proof state:
case refine'_1.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
this : NeBot (l ⊓ 𝓟 {x | p x})
x : ℕ → ι
hx_l : Tendsto x atTop l
hx_p : ∀ᶠ (a : ℕ) in atTop, x a ∈ {x | p x}
⊢ ∃ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
exact hx_p.frequently
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    refine' ⟨x, hx_l, _⟩
    rw [tendsto_principal] at hx_p
    exact hx_p.frequently
  · 

Proof state:
case refine'_2
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_exists_freq : ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)
⊢ ∃ᶠ (n : ι) in l, p n

Next tactic:
obtain ⟨x, hx_tendsto, hx_freq⟩ := h_exists_freq
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    refine' ⟨x, hx_l, _⟩
    rw [tendsto_principal] at hx_p
    exact hx_p.frequently
  · obtain ⟨x, hx_tendsto, hx_freq⟩ := h_exists_freq
    

Proof state:
case refine'_2.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
x : ℕ → ι
hx_tendsto : Tendsto x atTop l
hx_freq : ∃ᶠ (n : ℕ) in atTop, p (x n)
⊢ ∃ᶠ (n : ι) in l, p n

Next tactic:
simp_rw [Filter.Frequently, Filter.Eventually] at hx_freq ⊢
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    refine' ⟨x, hx_l, _⟩
    rw [tendsto_principal] at hx_p
    exact hx_p.frequently
  · obtain ⟨x, hx_tendsto, hx_freq⟩ := h_exists_freq
    simp_rw [Filter.Frequently, Filter.Eventually] at hx_freq ⊢
    

Proof state:
case refine'_2.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
x : ℕ → ι
hx_tendsto : Tendsto x atTop l
hx_freq : {x_1 | ¬p (x x_1)} ∉ atTop
⊢ {x | ¬p x} ∉ l

Next tactic:
have : { n : ℕ | ¬p (x n) } = { n | x n ∈ { y | ¬p y } } := rfl
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    refine' ⟨x, hx_l, _⟩
    rw [tendsto_principal] at hx_p
    exact hx_p.frequently
  · obtain ⟨x, hx_tendsto, hx_freq⟩ := h_exists_freq
    simp_rw [Filter.Frequently, Filter.Eventually] at hx_freq ⊢
    have : { n : ℕ | ¬p (x n) } = { n | x n ∈ { y | ¬p y } } := rfl
    

Proof state:
case refine'_2.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
x : ℕ → ι
hx_tendsto : Tendsto x atTop l
hx_freq : {x_1 | ¬p (x x_1)} ∉ atTop
this : {n | ¬p (x n)} = {n | x n ∈ {y | ¬p y}}
⊢ {x | ¬p x} ∉ l

Next tactic:
rw [this, ← mem_map'] at hx_freq
theorem frequently_iff_seq_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∃ᶠ n in l, p n) ↔ ∃ x : ℕ → ι, Tendsto x atTop l ∧ ∃ᶠ n : ℕ in atTop, p (x n) := by
  refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
  · have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
    obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
    rw [tendsto_inf] at hx
    cases' hx with hx_l hx_p
    refine' ⟨x, hx_l, _⟩
    rw [tendsto_principal] at hx_p
    exact hx_p.frequently
  · obtain ⟨x, hx_tendsto, hx_freq⟩ := h_exists_freq
    simp_rw [Filter.Frequently, Filter.Eventually] at hx_freq ⊢
    have : { n : ℕ | ¬p (x n) } = { n | x n ∈ { y | ¬p y } } := rfl
    rw [this, ← mem_map'] at hx_freq
    

Proof state:
case refine'_2.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
x : ℕ → ι
hx_tendsto : Tendsto x atTop l
hx_freq : {y | ¬p y} ∉ map (fun n => x n) atTop
this : {n | ¬p (x n)} = {n | x n ∈ {y | ¬p y}}
⊢ {x | ¬p x} ∉ l

Next tactic:
exact mt (@hx_tendsto _) hx_freq
theorem eventually_iff_seq_eventually {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∀ᶠ n in l, p n) ↔ ∀ x : ℕ → ι, Tendsto x atTop l → ∀ᶠ n : ℕ in atTop, p (x n) := by
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
⊢ (∀ᶠ (n : ι) in l, p n) ↔ ∀ (x : ℕ → ι), Tendsto x atTop l → ∀ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
have : (∀ᶠ n in l, p n) ↔ ¬∃ᶠ n in l, ¬p n := by
    rw [not_frequently]
    simp_rw [not_not]
theorem eventually_iff_seq_eventually {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] :
    (∀ᶠ n in l, p n) ↔ ∀ x : ℕ → ι, Tendsto x atTop l → ∀ᶠ n : ℕ in atTop, p (x n) := by
  have : (∀ᶠ n in l, p n) ↔ ¬∃ᶠ n in l, ¬p n := by
    

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
⊢ (∀ᶠ (n : ι) in l, p n) ↔ ¬∃ᶠ (n : ι) in l, ¬p n

Next tactic:
rw [not_frequently]