l3lab/ntp-mathlib huggingface dataset:
/-- A characterization of weak convergence in terms of integrals of bounded continuous
real-valued functions. -/
theorem tendsto_iff_forall_integral_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
    {μ : FiniteMeasure Ω} :
    Tendsto μs F (𝓝 μ) ↔
      ∀ f : Ω →ᵇ ℝ,
        Tendsto (fun i => ∫ x, f x ∂(μs i : Measure Ω)) F (𝓝 (∫ x, f x ∂(μ : Measure Ω))) := by
  refine' ⟨_, tendsto_of_forall_integral_tendsto⟩
  rw [tendsto_iff_forall_lintegral_tendsto]
  intro h f
  simp_rw [BoundedContinuousFunction.integral_eq_integral_nnrealPart_sub]
  set f_pos := f.nnrealPart with _def_f_pos
  set f_neg := (-f).nnrealPart with _def_f_neg
  have tends_pos := (ENNReal.tendsto_toReal (f_pos.lintegral_lt_top_of_nnreal μ).ne).comp (h f_pos)
  have tends_neg := (ENNReal.tendsto_toReal (f_neg.lintegral_lt_top_of_nnreal μ).ne).comp (h f_neg)
  have aux :
    ∀ g : Ω →ᵇ ℝ≥0,
      (ENNReal.toReal ∘ fun i : γ => ∫⁻ x : Ω, ↑(g x) ∂(μs i : Measure Ω)) = fun i : γ =>
        (∫⁻ x : Ω, ↑(g x) ∂(μs i : Measure Ω)).toReal :=
    fun _ => rfl
  simp_rw [aux, BoundedContinuousFunction.toReal_lintegral_coe_eq_integral] at tends_pos tends_neg
  

Proof state:
Ω : Type u_1
inst✝² : MeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω
inst✝ : OpensMeasurableSpace Ω
γ : Type u_2
F : Filter γ
μs : γ → FiniteMeasure Ω
μ : FiniteMeasure Ω
h : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(μs i)) F (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑μ))
f : Ω →ᵇ ℝ
f_pos : Ω →ᵇ ℝ≥0 := nnrealPart f
_def_f_pos : f_pos = nnrealPart f
f_neg : Ω →ᵇ ℝ≥0 := nnrealPart (-f)
_def_f_neg : f_neg = nnrealPart (-f)
aux :
  ∀ (g : Ω →ᵇ ℝ≥0),
    (ENNReal.toReal ∘ fun i => ∫⁻ (x : Ω), ↑(g x) ∂↑(μs i)) = fun i => ENNReal.toReal (∫⁻ (x : Ω), ↑(g x) ∂↑(μs i))
tends_pos : Tendsto (fun i => ∫ (x : Ω), ↑((nnrealPart f) x) ∂↑(μs i)) F (𝓝 (∫ (x : Ω), ↑((nnrealPart f) x) ∂↑μ))
tends_neg : Tendsto (fun i => ∫ (x : Ω), ↑((nnrealPart (-f)) x) ∂↑(μs i)) F (𝓝 (∫ (x : Ω), ↑((nnrealPart (-f)) x) ∂↑μ))
⊢ Tendsto (fun i => ∫ (x : Ω), ↑(f_pos x) ∂↑(μs i) - ∫ (x : Ω), ↑(f_neg x) ∂↑(μs i)) F
    (𝓝 (∫ (x : Ω), ↑(f_pos x) ∂↑μ - ∫ (x : Ω), ↑(f_neg x) ∂↑μ))

Next tactic:
exact Tendsto.sub tends_pos tends_neg
/-- The push-forward of a finite measure by a function between measurable spaces. -/
noncomputable def map (ν : FiniteMeasure Ω) (f : Ω → Ω') : FiniteMeasure Ω' :=
  ⟨(ν : Measure Ω).map f, by
    

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
ν : FiniteMeasure Ω
f : Ω → Ω'
⊢ IsFiniteMeasure (Measure.map f ↑ν)

Next tactic:
constructor
/-- The push-forward of a finite measure by a function between measurable spaces. -/
noncomputable def map (ν : FiniteMeasure Ω) (f : Ω → Ω') : FiniteMeasure Ω' :=
  ⟨(ν : Measure Ω).map f, by
    constructor
    

Proof state:
case measure_univ_lt_top
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
ν : FiniteMeasure Ω
f : Ω → Ω'
⊢ ↑↑(Measure.map f ↑ν) univ < ⊤

Next tactic:
by_cases f_aemble : AEMeasurable f ν
/-- The push-forward of a finite measure by a function between measurable spaces. -/
noncomputable def map (ν : FiniteMeasure Ω) (f : Ω → Ω') : FiniteMeasure Ω' :=
  ⟨(ν : Measure Ω).map f, by
    constructor
    by_cases f_aemble : AEMeasurable f ν
    · 

Proof state:
case pos
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
ν : FiniteMeasure Ω
f : Ω → Ω'
f_aemble : AEMeasurable f
⊢ ↑↑(Measure.map f ↑ν) univ < ⊤

Next tactic:
rw [Measure.map_apply_of_aemeasurable f_aemble MeasurableSet.univ]
/-- The push-forward of a finite measure by a function between measurable spaces. -/
noncomputable def map (ν : FiniteMeasure Ω) (f : Ω → Ω') : FiniteMeasure Ω' :=
  ⟨(ν : Measure Ω).map f, by
    constructor
    by_cases f_aemble : AEMeasurable f ν
    · rw [Measure.map_apply_of_aemeasurable f_aemble MeasurableSet.univ]
      

Proof state:
case pos
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
ν : FiniteMeasure Ω
f : Ω → Ω'
f_aemble : AEMeasurable f
⊢ ↑↑↑ν (f ⁻¹' univ) < ⊤

Next tactic:
exact measure_lt_top (↑ν) (f ⁻¹' univ)
/-- The push-forward of a finite measure by a function between measurable spaces. -/
noncomputable def map (ν : FiniteMeasure Ω) (f : Ω → Ω') : FiniteMeasure Ω' :=
  ⟨(ν : Measure Ω).map f, by
    constructor
    by_cases f_aemble : AEMeasurable f ν
    · rw [Measure.map_apply_of_aemeasurable f_aemble MeasurableSet.univ]
      exact measure_lt_top (↑ν) (f ⁻¹' univ)
    · 

Proof state:
case neg
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
ν : FiniteMeasure Ω
f : Ω → Ω'
f_aemble : ¬AEMeasurable f
⊢ ↑↑(Measure.map f ↑ν) univ < ⊤

Next tactic:
simp [Measure.map, f_aemble]
lemma map_apply_of_aemeasurable (ν : FiniteMeasure Ω) {f : Ω → Ω'} (f_aemble : AEMeasurable f ν)
    {A : Set Ω'} (A_mble : MeasurableSet A) :
    ν.map f A = ν (f ⁻¹' A) := by
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
ν : FiniteMeasure Ω
f : Ω → Ω'
f_aemble : AEMeasurable f
A : Set Ω'
A_mble : MeasurableSet A
⊢ (fun s => ENNReal.toNNReal (↑↑↑(map ν f) s)) A = (fun s => ENNReal.toNNReal (↑↑↑ν s)) (f ⁻¹' A)

Next tactic:
have := ν.map_apply' f_aemble A_mble
lemma map_apply_of_aemeasurable (ν : FiniteMeasure Ω) {f : Ω → Ω'} (f_aemble : AEMeasurable f ν)
    {A : Set Ω'} (A_mble : MeasurableSet A) :
    ν.map f A = ν (f ⁻¹' A) := by
  have := ν.map_apply' f_aemble A_mble
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
ν : FiniteMeasure Ω
f : Ω → Ω'
f_aemble : AEMeasurable f
A : Set Ω'
A_mble : MeasurableSet A
this : ↑↑↑(map ν f) A = ↑↑↑ν (f ⁻¹' A)
⊢ (fun s => ENNReal.toNNReal (↑↑↑(map ν f) s)) A = (fun s => ENNReal.toNNReal (↑↑↑ν s)) (f ⁻¹' A)

Next tactic:
exact (ENNReal.toNNReal_eq_toNNReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mpr this
@[simp] lemma map_add {f : Ω → Ω'} (f_mble : Measurable f) (ν₁ ν₂ : FiniteMeasure Ω) :
    (ν₁ + ν₂).map f = ν₁.map f + ν₂.map f := by
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
f : Ω → Ω'
f_mble : Measurable f
ν₁ ν₂ : FiniteMeasure Ω
⊢ map (ν₁ + ν₂) f = map ν₁ f + map ν₂ f

Next tactic:
ext s s_mble
@[simp] lemma map_add {f : Ω → Ω'} (f_mble : Measurable f) (ν₁ ν₂ : FiniteMeasure Ω) :
    (ν₁ + ν₂).map f = ν₁.map f + ν₂.map f := by
  ext s s_mble
  

Proof state:
case h
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
f : Ω → Ω'
f_mble : Measurable f
ν₁ ν₂ : FiniteMeasure Ω
s : Set Ω'
s_mble : MeasurableSet s
⊢ ↑↑↑(map (ν₁ + ν₂) f) s = ↑↑↑(map ν₁ f + map ν₂ f) s

Next tactic:
simp only [map_apply' _ f_mble.aemeasurable s_mble, toMeasure_add, Measure.add_apply]
@[simp] lemma map_smul {f : Ω → Ω'} (c : ℝ≥0) (ν : FiniteMeasure Ω) :
    (c • ν).map f = c • (ν.map f) := by
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
f : Ω → Ω'
c : ℝ≥0
ν : FiniteMeasure Ω
⊢ map (c • ν) f = c • map ν f

Next tactic:
ext s _
@[simp] lemma map_smul {f : Ω → Ω'} (c : ℝ≥0) (ν : FiniteMeasure Ω) :
    (c • ν).map f = c • (ν.map f) := by
  ext s _
  

Proof state:
case h
Ω : Type u_1
Ω' : Type u_2
inst✝¹ : MeasurableSpace Ω
inst✝ : MeasurableSpace Ω'
f : Ω → Ω'
c : ℝ≥0
ν : FiniteMeasure Ω
s : Set Ω'
a✝ : MeasurableSet s
⊢ ↑↑↑(map (c • ν) f) s = ↑↑↑(c • map ν f) s

Next tactic:
simp [toMeasure_smul]
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : Tendsto νs L (𝓝 ν)
f : Ω → Ω'
f_cont : Continuous f
⊢ Tendsto (fun i => map (νs i) f) L (𝓝 (map ν f))

Next tactic:
rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
⊢ ∀ (f_1 : Ω' →ᵇ ℝ≥0),
    Tendsto (fun i => ∫⁻ (x : Ω'), ↑(f_1 x) ∂↑(map (νs i) f)) L (𝓝 (∫⁻ (x : Ω'), ↑(f_1 x) ∂↑(map ν f)))

Next tactic:
intro g
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  intro g
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
g : Ω' →ᵇ ℝ≥0
⊢ Tendsto (fun i => ∫⁻ (x : Ω'), ↑(g x) ∂↑(map (νs i) f)) L (𝓝 (∫⁻ (x : Ω'), ↑(g x) ∂↑(map ν f)))

Next tactic:
convert lim (g.compContinuous ⟨f, f_cont⟩)
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  intro g
  convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
  · 

Proof state:
case h.e'_3.h
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
g : Ω' →ᵇ ℝ≥0
x✝ : ι
⊢ ∫⁻ (x : Ω'), ↑(g x) ∂↑(map (νs x✝) f) = ∫⁻ (x : Ω), ↑((compContinuous g (ContinuousMap.mk f)) x) ∂↑(νs x✝)

Next tactic:
simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  intro g
  convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
  · simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
    

Proof state:
case h.e'_3.h
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
g : Ω' →ᵇ ℝ≥0
x✝ : ι
⊢ ∫⁻ (x : Ω'), ↑(g x) ∂↑{ val := Measure.map f ↑(νs x✝), property := (_ : IsFiniteMeasure (Measure.map f ↑(νs x✝))) } =
    ∫⁻ (x : Ω), ↑(g (f x)) ∂↑(νs x✝)

Next tactic:
refine lintegral_map ?_ f_cont.measurable
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  intro g
  convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
  · simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
    refine lintegral_map ?_ f_cont.measurable
    

Proof state:
case h.e'_3.h
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
g : Ω' →ᵇ ℝ≥0
x✝ : ι
⊢ Measurable fun x => ↑(g x)

Next tactic:
exact (ENNReal.continuous_coe.comp g.continuous).measurable
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  intro g
  convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
  · 

Proof state:
case h.e'_5.h.e'_3
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
g : Ω' →ᵇ ℝ≥0
⊢ ∫⁻ (x : Ω'), ↑(g x) ∂↑(map ν f) = ∫⁻ (x : Ω), ↑((compContinuous g (ContinuousMap.mk f)) x) ∂↑ν

Next tactic:
simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  intro g
  convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
  · simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
    

Proof state:
case h.e'_5.h.e'_3
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
g : Ω' →ᵇ ℝ≥0
⊢ ∫⁻ (x : Ω'), ↑(g x) ∂↑{ val := Measure.map f ↑ν, property := (_ : IsFiniteMeasure (Measure.map f ↑ν)) } =
    ∫⁻ (x : Ω), ↑(g (f x)) ∂↑ν

Next tactic:
refine lintegral_map ?_ f_cont.measurable
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
    (νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
    {f : Ω → Ω'} (f_cont : Continuous f) :
    Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
  rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
  intro g
  convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
  · simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
    refine lintegral_map ?_ f_cont.measurable
    

Proof state:
case h.e'_5.h.e'_3
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
ι : Type u_3
L : Filter ι
νs : ι → FiniteMeasure Ω
ν : FiniteMeasure Ω
lim : ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (x : Ω), ↑(f x) ∂↑(νs i)) L (𝓝 (∫⁻ (x : Ω), ↑(f x) ∂↑ν))
f : Ω → Ω'
f_cont : Continuous f
g : Ω' →ᵇ ℝ≥0
⊢ Measurable fun x => ↑(g x)

Next tactic:
exact (ENNReal.continuous_coe.comp g.continuous).measurable
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
the push-forward of finite measures `f* : FiniteMeasure X → FiniteMeasure Y` is continuous
(in the topologies of weak convergence of measures). -/
lemma continuous_map {f : Ω → Ω'} (f_cont : Continuous f) :
    Continuous (fun ν ↦ FiniteMeasure.map ν f) := by
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
f : Ω → Ω'
f_cont : Continuous f
⊢ Continuous fun ν => map ν f

Next tactic:
rw [continuous_iff_continuousAt]
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
the push-forward of finite measures `f* : FiniteMeasure X → FiniteMeasure Y` is continuous
(in the topologies of weak convergence of measures). -/
lemma continuous_map {f : Ω → Ω'} (f_cont : Continuous f) :
    Continuous (fun ν ↦ FiniteMeasure.map ν f) := by
  rw [continuous_iff_continuousAt]
  

Proof state:
Ω : Type u_1
Ω' : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : MeasurableSpace Ω'
inst✝³ : TopologicalSpace Ω
inst✝² : OpensMeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω'
inst✝ : BorelSpace Ω'
f : Ω → Ω'
f_cont : Continuous f
⊢ ∀ (x : FiniteMeasure Ω), ContinuousAt (fun ν => map ν f) x

Next tactic:
exact fun _ ↦ tendsto_map_of_tendsto_of_continuous _ _ continuous_id.continuousAt f_cont
theorem cons_mem_subchain_iff :
    (a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
⊢ a :: l ∈ subchain s ↔ a ∈ s ∧ l ∈ subchain s ∧ ∀ b ∈ head? l, a < b

Next tactic:
simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm,
    and_assoc]
@[simp] -- porting note: new lemma + `simp`
theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
⊢ [a] ∈ subchain s ↔ a ∈ s

Next tactic:
simp [cons_mem_subchain_iff]
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
    ∃ l ∈ s.subchain, length l = n := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
n : ℕ
hn : ↑n ≤ chainHeight s
⊢ ∃ l ∈ subchain s, length l = n

Next tactic:
rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
    ∃ l ∈ s.subchain, length l = n := by
  rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
    

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
n : ℕ
hn : ↑n ≤ chainHeight s
ha : chainHeight s = ⊤
⊢ ∃ l ∈ subchain s, length l = n

Next tactic:
rw [chainHeight_eq_iSup_subtype] at ha
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
    ∃ l ∈ s.subchain, length l = n := by
  rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
    

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
n : ℕ
hn : ↑n ≤ chainHeight s
ha : chainHeight s < ⊤
⊢ ∃ l ∈ subchain s, length l = n

Next tactic:
rw [chainHeight_eq_iSup_subtype] at ha
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
    ∃ l ∈ s.subchain, length l = n := by
  rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
    rw [chainHeight_eq_iSup_subtype] at ha
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
n : ℕ
hn : ↑n ≤ chainHeight s
ha : ⨆ l, ↑(length ↑l) = ⊤
⊢ ∃ l ∈ subchain s, length l = n

Next tactic:
obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ :=
      not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
    ∃ l ∈ s.subchain, length l = n := by
  rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
    rw [chainHeight_eq_iSup_subtype] at ha
  · obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ :=
      not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
    

Proof state:
case inl.intro.intro.intro.mk.intro
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l✝ : List α
a : α
n : ℕ
hn : ↑n ≤ chainHeight s
ha : ⨆ l, ↑(length ↑l) = ⊤
l : List α
h₁ : Chain' (fun x x_1 => x < x_1) l
h₂ : ∀ i ∈ l, i ∈ s
h₃ : ¬(fun x => ↑(length ↑x)) { val := l, property := (_ : Chain' (fun x x_1 => x < x_1) l ∧ ∀ i ∈ l, i ∈ s) } ≤ n
⊢ ∃ l ∈ subchain s, length l = n

Next tactic:
exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
      (l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
    ∃ l ∈ s.subchain, length l = n := by
  rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
    rw [chainHeight_eq_iSup_subtype] at ha
  · obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ :=
      not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
    exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
      (l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
n : ℕ
hn : ↑n ≤ chainHeight s
ha : ⨆ l, ↑(length ↑l) < ⊤
⊢ ∃ l ∈ subchain s, length l = n

Next tactic:
rw [ENat.iSup_coe_lt_top] at ha
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
    ∃ l ∈ s.subchain, length l = n := by
  rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
    rw [chainHeight_eq_iSup_subtype] at ha
  · obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ :=
      not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
    exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
      (l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩
  · rw [ENat.iSup_coe_lt_top] at ha
    

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : LT α
inst✝ : LT β
s t : Set α
l : List α
a : α
n : ℕ
hn : ↑n ≤ chainHeight s
ha : BddAbove (range fun l => length ↑l)
⊢ ∃ l ∈ subchain s, length l = n

Next tactic:
obtain ⟨⟨l, h₁, h₂⟩, e : l.length = _⟩ := Nat.sSup_mem (Set.range_nonempty _) ha