Theorem: Filter.frequently_iff_seq_frequently
File: Mathlib/Order/Filter/AtTopBot.lean

tactic: refine' ⟨fun h_freq => _, fun h_exists_freq => _⟩
state_before: ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
⊢ (∃ᶠ (n : ι) in l, p n) ↔ ∃ x, Tendsto x atTop l ∧ ∃ᶠ (n : ℕ) in atTop, p (x n)

tactic: have : NeBot (l ⊓ 𝓟 { x : ι | p x }) := by simpa [neBot_iff, inf_principal_eq_bot]
state_before: case refine'_1
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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)

tactic: obtain ⟨x, hx⟩ := exists_seq_tendsto (l ⊓ 𝓟 { x : ι | p x })
state_before: case refine'_1
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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)

tactic: rw [tendsto_inf] at hx
state_before: case refine'_1.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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)

tactic: cases' hx with hx_l hx_p
state_before: case refine'_1.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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)

tactic: refine' ⟨x, hx_l, _⟩
state_before: case refine'_1.intro.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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)

tactic: rw [tendsto_principal] at hx_p
state_before: case refine'_1.intro.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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)

tactic: exact hx_p.frequently
state_before: case refine'_1.intro.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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)

tactic: simpa [neBot_iff, inf_principal_eq_bot]
state_before: ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
l : Filter ι
p : ι → Prop
hl : IsCountablyGenerated l
h_freq : ∃ᶠ (n : ι) in l, p n
⊢ NeBot (l ⊓ 𝓟 {x | p x})

tactic: obtain ⟨x, hx_tendsto, hx_freq⟩ := h_exists_freq
state_before: case refine'_2
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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

tactic: simp_rw [Filter.Frequently, Filter.Eventually] at hx_freq⊢
state_before: case refine'_2.intro.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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

tactic: have : { n : ℕ | ¬p (x n) } = { n | x n ∈ { y | ¬p y } } := rfl
state_before: case refine'_2.intro.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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

tactic: rw [this, ← mem_map'] at hx_freq
state_before: case refine'_2.intro.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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

tactic: exact mt (@hx_tendsto _) hx_freq
state_before: case refine'_2.intro.intro
ι✝ : Type ?u.368461
ι' : Type ?u.368464
α : Type ?u.368467
β : Type ?u.368470
γ : Type ?u.368473
ι : Type u_1
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