Theorem: aemeasurable_of_tendsto_metrizable_ae
File: Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean

tactic: rcases u.exists_seq_tendsto with ⟨v, hv⟩
state_before: α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
⊢ AEMeasurable g

tactic: have h'f : ∀ n, AEMeasurable (f (v n)) μ := fun n => hf (v n)
state_before: case intro
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
⊢ AEMeasurable g

tactic: set p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
state_before: case intro
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
⊢ AEMeasurable g

tactic: have hp : ∀ᵐ x ∂μ, p x fun n => f (v n) x := by
  filter_upwards [h_tendsto]with x hx using hx.comp hv
state_before: case intro
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
⊢ AEMeasurable g

tactic: set aeSeqLim := fun x => ite (x ∈ aeSeqSet h'f p) (g x) (⟨f (v 0) x⟩ : Nonempty β).some
state_before: case intro
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
⊢ AEMeasurable g

tactic: refine'
  ⟨aeSeqLim,
    measurable_of_tendsto_metrizable' atTop (aeSeq.measurable h'f p)
      (tendsto_pi_nhds.mpr fun x => _),
    _⟩
state_before: case intro
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
aeSeqLim : α → β := fun x => if x ∈ aeSeqSet h'f p then g x else Nonempty.some (_ : Nonempty β)
⊢ AEMeasurable g

tactic: filter_upwards [h_tendsto]with x hx using hx.comp hv
state_before: α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
⊢ ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x

tactic: simp_rw [aeSeq]
state_before: case intro.refine'_1
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
aeSeqLim : α → β := fun x => if x ∈ aeSeqSet h'f p then g x else Nonempty.some (_ : Nonempty β)
x : α
⊢ Tendsto (fun i => aeSeq h'f p i x) atTop (𝓝 (aeSeqLim x))

tactic: split_ifs with hx
state_before: case intro.refine'_1
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
aeSeqLim : α → β := fun x => if x ∈ aeSeqSet h'f p then g x else Nonempty.some (_ : Nonempty β)
x : α
⊢ Tendsto
    (fun i =>
      if x ∈ aeSeqSet h'f fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x)) then
        AEMeasurable.mk (f (v i)) (_ : AEMeasurable (f (v i))) x
      else Nonempty.some (_ : Nonempty β))
    atTop
    (𝓝
      (if x ∈ aeSeqSet h'f fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x)) then g x
      else Nonempty.some (_ : Nonempty β)))

tactic: simp_rw [aeSeq.mk_eq_fun_of_mem_aeSeqSet h'f hx]
state_before: case intro.refine'_1.inl
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
aeSeqLim : α → β := fun x => if x ∈ aeSeqSet h'f p then g x else Nonempty.some (_ : Nonempty β)
x : α
hx : x ∈ aeSeqSet h'f fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
⊢ Tendsto (fun i => AEMeasurable.mk (f (v i)) (_ : AEMeasurable (f (v i))) x) atTop (𝓝 (g x))

tactic: exact @aeSeq.fun_prop_of_mem_aeSeqSet _ α β _ _ _ _ _ h'f x hx
state_before: case intro.refine'_1.inl
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
aeSeqLim : α → β := fun x => if x ∈ aeSeqSet h'f p then g x else Nonempty.some (_ : Nonempty β)
x : α
hx : x ∈ aeSeqSet h'f fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
⊢ Tendsto (fun i => f (v i) x) atTop (𝓝 (g x))

tactic: exact tendsto_const_nhds
state_before: case intro.refine'_1.inr
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
aeSeqLim : α → β := fun x => if x ∈ aeSeqSet h'f p then g x else Nonempty.some (_ : Nonempty β)
x : α
hx : ¬x ∈ aeSeqSet h'f fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
⊢ Tendsto (fun i => Nonempty.some (_ : Nonempty β)) atTop (𝓝 (Nonempty.some (_ : Nonempty β)))

tactic: exact
  (ite_ae_eq_of_measure_compl_zero g (fun x => (⟨f (v 0) x⟩ : Nonempty β).some) (aeSeqSet h'f p)
      (aeSeq.measure_compl_aeSeqSet_eq_zero h'f hp)).symm
state_before: case intro.refine'_2
α : Type u_2
β : Type u_3
inst✝⁵ : MeasurableSpace α
inst✝⁴ : TopologicalSpace β
inst✝³ : PseudoMetrizableSpace β
inst✝² : MeasurableSpace β
inst✝¹ : BorelSpace β
ι : Type u_1
μ : MeasureTheory.Measure α
f : ι → α → β
g : α → β
u : Filter ι
hu : NeBot u
inst✝ : IsCountablyGenerated u
hf : ∀ (n : ι), AEMeasurable (f n)
h_tendsto : ∀ᵐ (x : α) ∂μ, Tendsto (fun n => f n x) u (𝓝 (g x))
v : ℕ → ι
hv : Tendsto v atTop u
h'f : ∀ (n : ℕ), AEMeasurable (f (v n))
p : α → (ℕ → β) → Prop := fun x f' => Tendsto (fun n => f' n) atTop (𝓝 (g x))
hp : ∀ᵐ (x : α) ∂μ, p x fun n => f (v n) x
aeSeqLim : α → β := fun x => if x ∈ aeSeqSet h'f p then g x else Nonempty.some (_ : Nonempty β)
⊢ g =ᵐ[μ] aeSeqLim