l3lab/ntp-mathlib huggingface dataset:
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
    rw [not_frequently]
    

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 : ι) in l, ¬¬p x

Next tactic:
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
    rw [not_frequently]
    simp_rw [not_not]
  

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
this : (∀ᶠ (n : ι) in l, p n) ↔ ¬∃ᶠ (n : ι) in l, ¬p n
⊢ (∀ᶠ (n : ι) in l, p n) ↔ ∀ (x : ℕ → ι), Tendsto x atTop l → ∀ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
rw [this, frequently_iff_seq_frequently]
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
    rw [not_frequently]
    simp_rw [not_not]
  rw [this, frequently_iff_seq_frequently]
  

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
this : (∀ᶠ (n : ι) in l, p n) ↔ ¬∃ᶠ (n : ι) in l, ¬p n
⊢ (¬∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, ¬p (x n)) ↔
    ∀ (x : ℕ → ι), Tendsto x atTop l → ∀ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
push_neg
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
    rw [not_frequently]
    simp_rw [not_not]
  rw [this, frequently_iff_seq_frequently]
  push_neg
  

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
this : (∀ᶠ (n : ι) in l, p n) ↔ ¬∃ᶠ (n : ι) in l, ¬p n
⊢ (∀ (x : ℕ → ι), Tendsto x atTop l → ¬∃ᶠ (n : ℕ) in atTop, ¬p (x n)) ↔
    ∀ (x : ℕ → ι), Tendsto x atTop l → ∀ᶠ (n : ℕ) in atTop, p (x n)

Next tactic:
simp_rw [not_frequently, not_not]
theorem subseq_forall_of_frequently {ι : Type*} {x : ℕ → ι} {p : ι → Prop} {l : Filter ι}
    (h_tendsto : Tendsto x atTop l) (h : ∃ᶠ n in atTop, p (x n)) :
    ∃ ns : ℕ → ℕ, Tendsto (fun n => x (ns n)) atTop l ∧ ∀ n, p (x (ns n)) := by
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
x : ℕ → ι
p : ι → Prop
l : Filter ι
h_tendsto : Tendsto x atTop l
h : ∃ᶠ (n : ℕ) in atTop, p (x n)
⊢ ∃ ns, Tendsto (fun n => x (ns n)) atTop l ∧ ∀ (n : ℕ), p (x (ns n))

Next tactic:
rw [tendsto_iff_seq_tendsto] at h_tendsto
theorem subseq_forall_of_frequently {ι : Type*} {x : ℕ → ι} {p : ι → Prop} {l : Filter ι}
    (h_tendsto : Tendsto x atTop l) (h : ∃ᶠ n in atTop, p (x n)) :
    ∃ ns : ℕ → ℕ, Tendsto (fun n => x (ns n)) atTop l ∧ ∀ n, p (x (ns n)) := by
  rw [tendsto_iff_seq_tendsto] at h_tendsto
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
x : ℕ → ι
p : ι → Prop
l : Filter ι
h_tendsto : ∀ (x_1 : ℕ → ℕ), Tendsto x_1 atTop atTop → Tendsto (x ∘ x_1) atTop l
h : ∃ᶠ (n : ℕ) in atTop, p (x n)
⊢ ∃ ns, Tendsto (fun n => x (ns n)) atTop l ∧ ∀ (n : ℕ), p (x (ns n))

Next tactic:
choose ns hge hns using frequently_atTop.1 h
theorem subseq_forall_of_frequently {ι : Type*} {x : ℕ → ι} {p : ι → Prop} {l : Filter ι}
    (h_tendsto : Tendsto x atTop l) (h : ∃ᶠ n in atTop, p (x n)) :
    ∃ ns : ℕ → ℕ, Tendsto (fun n => x (ns n)) atTop l ∧ ∀ n, p (x (ns n)) := by
  rw [tendsto_iff_seq_tendsto] at h_tendsto
  choose ns hge hns using frequently_atTop.1 h
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
ι : Type u_6
x : ℕ → ι
p : ι → Prop
l : Filter ι
h_tendsto : ∀ (x_1 : ℕ → ℕ), Tendsto x_1 atTop atTop → Tendsto (x ∘ x_1) atTop l
h : ∃ᶠ (n : ℕ) in atTop, p (x n)
ns : ℕ → ℕ
hge : ∀ (a : ℕ), ns a ≥ a
hns : ∀ (a : ℕ), p (x (ns a))
⊢ ∃ ns, Tendsto (fun n => x (ns n)) atTop l ∧ ∀ (n : ℕ), p (x (ns n))

Next tactic:
exact ⟨ns, h_tendsto ns (tendsto_atTop_mono hge tendsto_id), hns⟩
theorem exists_seq_forall_of_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] (h : ∃ᶠ n in l, p n) :
    ∃ ns : ℕ → ι, Tendsto ns atTop l ∧ ∀ n, p (ns 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
h : ∃ᶠ (n : ι) in l, p n
⊢ ∃ ns, Tendsto ns atTop l ∧ ∀ (n : ℕ), p (ns n)

Next tactic:
rw [frequently_iff_seq_frequently] at h
theorem exists_seq_forall_of_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] (h : ∃ᶠ n in l, p n) :
    ∃ ns : ℕ → ι, Tendsto ns atTop l ∧ ∀ n, p (ns n) := by
  rw [frequently_iff_seq_frequently] at h
  

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 : ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)
⊢ ∃ ns, Tendsto ns atTop l ∧ ∀ (n : ℕ), p (ns n)

Next tactic:
obtain ⟨x, hx_tendsto, hx_freq⟩ := h
theorem exists_seq_forall_of_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] (h : ∃ᶠ n in l, p n) :
    ∃ ns : ℕ → ι, Tendsto ns atTop l ∧ ∀ n, p (ns n) := by
  rw [frequently_iff_seq_frequently] at h
  obtain ⟨x, hx_tendsto, hx_freq⟩ := h
  

Proof state:
case 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)
⊢ ∃ ns, Tendsto ns atTop l ∧ ∀ (n : ℕ), p (ns n)

Next tactic:
obtain ⟨n_to_n, h_tendsto, h_freq⟩ := subseq_forall_of_frequently hx_tendsto hx_freq
theorem exists_seq_forall_of_frequently {ι : Type*} {l : Filter ι} {p : ι → Prop}
    [hl : l.IsCountablyGenerated] (h : ∃ᶠ n in l, p n) :
    ∃ ns : ℕ → ι, Tendsto ns atTop l ∧ ∀ n, p (ns n) := by
  rw [frequently_iff_seq_frequently] at h
  obtain ⟨x, hx_tendsto, hx_freq⟩ := h
  obtain ⟨n_to_n, h_tendsto, h_freq⟩ := subseq_forall_of_frequently hx_tendsto hx_freq
  

Proof state:
case intro.intro.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_to_n : ℕ → ℕ
h_tendsto : Tendsto (fun n => x (n_to_n n)) atTop l
h_freq : ∀ (n : ℕ), p (x (n_to_n n))
⊢ ∃ ns, Tendsto ns atTop l ∧ ∀ (n : ℕ), p (ns n)

Next tactic:
exact ⟨x ∘ n_to_n, h_tendsto, h_freq⟩
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
hxy : ∀ (ns : ℕ → ι), Tendsto ns atTop l → ∃ ms, Tendsto (fun n => x (ns (ms n))) atTop f
⊢ Tendsto x l f

Next tactic:
by_contra h
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
hxy : ∀ (ns : ℕ → ι), Tendsto ns atTop l → ∃ ms, Tendsto (fun n => x (ns (ms n))) atTop f
h : ¬Tendsto x l f
⊢ False

Next tactic:
obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ 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
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
hxy : ∀ (ns : ℕ → ι), Tendsto ns atTop l → ∃ ms, Tendsto (fun n => x (ns (ms n))) atTop f
h : ¬Tendsto x l f
⊢ ∃ s ∈ f, ∃ᶠ (n : ι) in l, x n ∉ s

Next tactic:
rwa [not_tendsto_iff_exists_frequently_nmem] at h
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  

Proof state:
case intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
hxy : ∀ (ns : ℕ → ι), Tendsto ns atTop l → ∃ ms, Tendsto (fun n => x (ns (ms n))) atTop f
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
⊢ False

Next tactic:
obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  

Proof state:
case intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
hxy : ∀ (ns : ℕ → ι), Tendsto ns atTop l → ∃ ms, Tendsto (fun n => x (ns (ms n))) atTop f
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
⊢ False

Next tactic:
specialize hxy y hy_tendsto
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  

Proof state:
case intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
hxy : ∃ ms, Tendsto (fun n => x (y (ms n))) atTop f
⊢ False

Next tactic:
obtain ⟨ms, hms_tendsto⟩ := hxy
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  

Proof state:
case intro.intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : Tendsto (fun n => x (y (ms n))) atTop f
⊢ False

Next tactic:
specialize hms_tendsto hs
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  

Proof state:
case intro.intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : s ∈ map (fun n => x (y (ms n))) atTop
⊢ False

Next tactic:
rw [mem_map] at hms_tendsto
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  rw [mem_map] at hms_tendsto
  

Proof state:
case intro.intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : (fun n => x (y (ms n))) ⁻¹' s ∈ atTop
⊢ False

Next tactic:
have hms_freq : ∀ n : ℕ, x (y (ms n)) ∉ s := fun n => hy_freq (ms n)
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  rw [mem_map] at hms_tendsto
  have hms_freq : ∀ n : ℕ, x (y (ms n)) ∉ s := fun n => hy_freq (ms n)
  

Proof state:
case intro.intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : (fun n => x (y (ms n))) ⁻¹' s ∈ atTop
hms_freq : ∀ (n : ℕ), x (y (ms n)) ∉ s
⊢ False

Next tactic:
have h_empty : (fun n : ℕ => x (y (ms n))) ⁻¹' s = ∅ := by
    ext1 n
    simp only [Set.mem_preimage, Set.mem_empty_iff_false, iff_false_iff]
    exact hms_freq n
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  rw [mem_map] at hms_tendsto
  have hms_freq : ∀ n : ℕ, x (y (ms n)) ∉ s := fun n => hy_freq (ms n)
  have h_empty : (fun n : ℕ => x (y (ms n))) ⁻¹' s = ∅ := by
    

Proof state:
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : (fun n => x (y (ms n))) ⁻¹' s ∈ atTop
hms_freq : ∀ (n : ℕ), x (y (ms n)) ∉ s
⊢ (fun n => x (y (ms n))) ⁻¹' s = ∅

Next tactic:
ext1 n
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  rw [mem_map] at hms_tendsto
  have hms_freq : ∀ n : ℕ, x (y (ms n)) ∉ s := fun n => hy_freq (ms n)
  have h_empty : (fun n : ℕ => x (y (ms n))) ⁻¹' s = ∅ := by
    ext1 n
    

Proof state:
case h
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : (fun n => x (y (ms n))) ⁻¹' s ∈ atTop
hms_freq : ∀ (n : ℕ), x (y (ms n)) ∉ s
n : ℕ
⊢ n ∈ (fun n => x (y (ms n))) ⁻¹' s ↔ n ∈ ∅

Next tactic:
simp only [Set.mem_preimage, Set.mem_empty_iff_false, iff_false_iff]
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  rw [mem_map] at hms_tendsto
  have hms_freq : ∀ n : ℕ, x (y (ms n)) ∉ s := fun n => hy_freq (ms n)
  have h_empty : (fun n : ℕ => x (y (ms n))) ⁻¹' s = ∅ := by
    ext1 n
    simp only [Set.mem_preimage, Set.mem_empty_iff_false, iff_false_iff]
    

Proof state:
case h
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : (fun n => x (y (ms n))) ⁻¹' s ∈ atTop
hms_freq : ∀ (n : ℕ), x (y (ms n)) ∉ s
n : ℕ
⊢ x (y (ms n)) ∉ s

Next tactic:
exact hms_freq n
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  rw [mem_map] at hms_tendsto
  have hms_freq : ∀ n : ℕ, x (y (ms n)) ∉ s := fun n => hy_freq (ms n)
  have h_empty : (fun n : ℕ => x (y (ms n))) ⁻¹' s = ∅ := by
    ext1 n
    simp only [Set.mem_preimage, Set.mem_empty_iff_false, iff_false_iff]
    exact hms_freq n
  

Proof state:
case intro.intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : (fun n => x (y (ms n))) ⁻¹' s ∈ atTop
hms_freq : ∀ (n : ℕ), x (y (ms n)) ∉ s
h_empty : (fun n => x (y (ms n))) ⁻¹' s = ∅
⊢ False

Next tactic:
rw [h_empty] at hms_tendsto
/-- A sequence converges if every subsequence has a convergent subsequence. -/
theorem tendsto_of_subseq_tendsto {α ι : Type*} {x : ι → α} {f : Filter α} {l : Filter ι}
    [l.IsCountablyGenerated]
    (hxy :
      ∀ ns : ℕ → ι, Tendsto ns atTop l → ∃ ms : ℕ → ℕ, Tendsto (fun n => x (ns <| ms n)) atTop f) :
    Tendsto x l f := by
  by_contra h
  obtain ⟨s, hs, hfreq⟩ : ∃ s ∈ f, ∃ᶠ n in l, x n ∉ s := by
    rwa [not_tendsto_iff_exists_frequently_nmem] at h
  obtain ⟨y, hy_tendsto, hy_freq⟩ := exists_seq_forall_of_frequently hfreq
  specialize hxy y hy_tendsto
  obtain ⟨ms, hms_tendsto⟩ := hxy
  specialize hms_tendsto hs
  rw [mem_map] at hms_tendsto
  have hms_freq : ∀ n : ℕ, x (y (ms n)) ∉ s := fun n => hy_freq (ms n)
  have h_empty : (fun n : ℕ => x (y (ms n))) ⁻¹' s = ∅ := by
    ext1 n
    simp only [Set.mem_preimage, Set.mem_empty_iff_false, iff_false_iff]
    exact hms_freq n
  rw [h_empty] at hms_tendsto
  

Proof state:
case intro.intro.intro.intro.intro
ι✝ : Type u_1
ι' : Type u_2
α✝ : Type u_3
β : Type u_4
γ : Type u_5
α : Type u_6
ι : Type u_7
x : ι → α
f : Filter α
l : Filter ι
inst✝ : IsCountablyGenerated l
h : ¬Tendsto x l f
s : Set α
hs : s ∈ f
hfreq : ∃ᶠ (n : ι) in l, x n ∉ s
y : ℕ → ι
hy_tendsto : Tendsto y atTop l
hy_freq : ∀ (n : ℕ), x (y n) ∉ s
ms : ℕ → ℕ
hms_tendsto : ∅ ∈ atTop
hms_freq : ∀ (n : ℕ), x (y (ms n)) ∉ s
h_empty : (fun n => x (y (ms n))) ⁻¹' s = ∅
⊢ False

Next tactic:
exact empty_not_mem atTop hms_tendsto
theorem subseq_tendsto_of_neBot {f : Filter α} [IsCountablyGenerated f] {u : ℕ → α}
    (hx : NeBot (f ⊓ map u atTop)) : ∃ θ : ℕ → ℕ, StrictMono θ ∧ Tendsto (u ∘ θ) atTop f := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
α : Type u_3
β : Type u_4
γ : Type u_5
f : Filter α
inst✝ : IsCountablyGenerated f
u : ℕ → α
hx : NeBot (f ⊓ map u atTop)
⊢ ∃ θ, StrictMono θ ∧ Tendsto (u ∘ θ) atTop f

Next tactic:
obtain ⟨B, h⟩ := f.exists_antitone_basis