l3lab/ntp-mathlib huggingface dataset:
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
q : ↑(Ioi t)
⊢ ∫⁻ (x : α) in s, ⨅ r, preCdf ρ (↑r) x ∂Measure.fst ρ ≤ ∫⁻ (x : α) in s, preCdf ρ (↑q) x ∂Measure.fst ρ

Next tactic:
refine' set_lintegral_mono_ae _ measurable_preCdf _
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
q : ↑(Ioi t)
⊢ Measurable fun x => ⨅ r, preCdf ρ (↑r) x

Next tactic:
exact measurable_iInf fun _ => measurable_preCdf
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
q : ↑(Ioi t)
⊢ ∀ᵐ (x : α) ∂Measure.fst ρ, x ∈ s → ⨅ r, preCdf ρ (↑r) x ≤ preCdf ρ (↑q) x

Next tactic:
filter_upwards [monotone_preCdf _] with a _
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · filter_upwards [monotone_preCdf _] with a _
        

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
q : ↑(Ioi t)
a : α
a✝ : Monotone fun r => preCdf ρ r a
⊢ a ∈ s → ⨅ r, preCdf ρ (↑r) a ≤ preCdf ρ (↑q) a

Next tactic:
exact fun _ => iInf_le _ q
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · filter_upwards [monotone_preCdf _] with a _
        exact fun _ => iInf_le _ q
    

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
h : ∀ (q : ↑(Ioi t)), ∫⁻ (x : α) in s, ⨅ r, preCdf ρ (↑r) x ∂Measure.fst ρ ≤ ↑↑(Measure.IicSnd ρ ↑↑q) s
⊢ ∫⁻ (x : α) in s, ⨅ r, preCdf ρ (↑r) x ∂Measure.fst ρ ≤ ↑↑(Measure.IicSnd ρ ↑t) s

Next tactic:
calc
      ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ⨅ q : Ioi t, ρ.IicSnd q s := le_iInf h
      _ = ρ.IicSnd t s := Measure.iInf_IicSnd_gt ρ t hs
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · filter_upwards [monotone_preCdf _] with a _
        exact fun _ => iInf_le _ q
    calc
      ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ⨅ q : Ioi t, ρ.IicSnd q s := le_iInf h
      _ = ρ.IicSnd t s := Measure.iInf_IicSnd_gt ρ t hs
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
⊢ ↑↑(Measure.IicSnd ρ ↑t) s ≤ ∫⁻ (x : α) in s, ⨅ r, preCdf ρ (↑r) x ∂Measure.fst ρ

Next tactic:
rw [(set_lintegral_preCdf_fst ρ t hs).symm]
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · filter_upwards [monotone_preCdf _] with a _
        exact fun _ => iInf_le _ q
    calc
      ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ⨅ q : Ioi t, ρ.IicSnd q s := le_iInf h
      _ = ρ.IicSnd t s := Measure.iInf_IicSnd_gt ρ t hs
  · rw [(set_lintegral_preCdf_fst ρ t hs).symm]
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
⊢ ∫⁻ (x : α) in s, preCdf ρ t x ∂Measure.fst ρ ≤ ∫⁻ (x : α) in s, ⨅ r, preCdf ρ (↑r) x ∂Measure.fst ρ

Next tactic:
refine' set_lintegral_mono_ae measurable_preCdf _ _
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · filter_upwards [monotone_preCdf _] with a _
        exact fun _ => iInf_le _ q
    calc
      ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ⨅ q : Ioi t, ρ.IicSnd q s := le_iInf h
      _ = ρ.IicSnd t s := Measure.iInf_IicSnd_gt ρ t hs
  · rw [(set_lintegral_preCdf_fst ρ t hs).symm]
    refine' set_lintegral_mono_ae measurable_preCdf _ _
    · 

Proof state:
case refine'_2.refine'_1
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
⊢ Measurable fun x => ⨅ r, preCdf ρ (↑r) x

Next tactic:
exact measurable_iInf fun _ => measurable_preCdf
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · filter_upwards [monotone_preCdf _] with a _
        exact fun _ => iInf_le _ q
    calc
      ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ⨅ q : Ioi t, ρ.IicSnd q s := le_iInf h
      _ = ρ.IicSnd t s := Measure.iInf_IicSnd_gt ρ t hs
  · rw [(set_lintegral_preCdf_fst ρ t hs).symm]
    refine' set_lintegral_mono_ae measurable_preCdf _ _
    · exact measurable_iInf fun _ => measurable_preCdf
    · 

Proof state:
case refine'_2.refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
⊢ ∀ᵐ (x : α) ∂Measure.fst ρ, x ∈ s → preCdf ρ t x ≤ ⨅ r, preCdf ρ (↑r) x

Next tactic:
filter_upwards [monotone_preCdf _] with a ha_mono
theorem set_lintegral_iInf_gt_preCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (t : ℚ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst = ρ.IicSnd t s := by
  refine' le_antisymm _ _
  · have h : ∀ q : Ioi t, ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ρ.IicSnd q s := by
      intro q
      rw [← set_lintegral_preCdf_fst ρ _ hs]
      refine' set_lintegral_mono_ae _ measurable_preCdf _
      · exact measurable_iInf fun _ => measurable_preCdf
      · filter_upwards [monotone_preCdf _] with a _
        exact fun _ => iInf_le _ q
    calc
      ∫⁻ x in s, ⨅ r : Ioi t, preCdf ρ r x ∂ρ.fst ≤ ⨅ q : Ioi t, ρ.IicSnd q s := le_iInf h
      _ = ρ.IicSnd t s := Measure.iInf_IicSnd_gt ρ t hs
  · rw [(set_lintegral_preCdf_fst ρ t hs).symm]
    refine' set_lintegral_mono_ae measurable_preCdf _ _
    · exact measurable_iInf fun _ => measurable_preCdf
    · filter_upwards [monotone_preCdf _] with a ha_mono
      

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
t : ℚ
s : Set α
hs : MeasurableSet s
a : α
ha_mono : Monotone fun r => preCdf ρ r a
⊢ a ∈ s → preCdf ρ t a ≤ ⨅ r, preCdf ρ (↑r) a

Next tactic:
exact fun _ => le_iInf fun r => ha_mono (le_of_lt r.prop)
theorem preCdf_le_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, ∀ r, preCdf ρ r a ≤ 1 := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
⊢ ∀ᵐ (a : α) ∂Measure.fst ρ, ∀ (r : ℚ), preCdf ρ r a ≤ 1

Next tactic:
rw [ae_all_iff]
theorem preCdf_le_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, ∀ r, preCdf ρ r a ≤ 1 := by
  rw [ae_all_iff]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
⊢ ∀ (i : ℚ), ∀ᵐ (a : α) ∂Measure.fst ρ, preCdf ρ i a ≤ 1

Next tactic:
refine' fun r =>
    ae_le_of_forall_set_lintegral_le_of_sigmaFinite measurable_preCdf measurable_const
      fun s hs _ => _
theorem preCdf_le_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, ∀ r, preCdf ρ r a ≤ 1 := by
  rw [ae_all_iff]
  refine' fun r =>
    ae_le_of_forall_set_lintegral_le_of_sigmaFinite measurable_preCdf measurable_const
      fun s hs _ => _
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
s : Set α
hs : MeasurableSet s
x✝ : ↑↑(Measure.fst ρ) s < ⊤
⊢ ∫⁻ (x : α) in s, preCdf ρ r x ∂Measure.fst ρ ≤ ∫⁻ (x : α) in s, 1 ∂Measure.fst ρ

Next tactic:
rw [set_lintegral_preCdf_fst ρ r hs]
theorem preCdf_le_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, ∀ r, preCdf ρ r a ≤ 1 := by
  rw [ae_all_iff]
  refine' fun r =>
    ae_le_of_forall_set_lintegral_le_of_sigmaFinite measurable_preCdf measurable_const
      fun s hs _ => _
  rw [set_lintegral_preCdf_fst ρ r hs]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
s : Set α
hs : MeasurableSet s
x✝ : ↑↑(Measure.fst ρ) s < ⊤
⊢ ↑↑(Measure.IicSnd ρ ↑r) s ≤ ∫⁻ (x : α) in s, 1 ∂Measure.fst ρ

Next tactic:
simp only [Pi.one_apply, lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
theorem preCdf_le_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, ∀ r, preCdf ρ r a ≤ 1 := by
  rw [ae_all_iff]
  refine' fun r =>
    ae_le_of_forall_set_lintegral_le_of_sigmaFinite measurable_preCdf measurable_const
      fun s hs _ => _
  rw [set_lintegral_preCdf_fst ρ r hs]
  simp only [Pi.one_apply, lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
s : Set α
hs : MeasurableSet s
x✝ : ↑↑(Measure.fst ρ) s < ⊤
⊢ ↑↑(Measure.IicSnd ρ ↑r) s ≤ ↑↑(Measure.fst ρ) s

Next tactic:
exact Measure.IicSnd_le_fst ρ r s hs
theorem tendsto_lintegral_preCdf_atTop (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    Tendsto (fun r => ∫⁻ a, preCdf ρ r a ∂ρ.fst) atTop (𝓝 (ρ univ)) := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
⊢ Tendsto (fun r => ∫⁻ (a : α), preCdf ρ r a ∂Measure.fst ρ) atTop (𝓝 (↑↑ρ univ))

Next tactic:
convert ρ.tendsto_IicSnd_atTop MeasurableSet.univ
theorem tendsto_lintegral_preCdf_atTop (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    Tendsto (fun r => ∫⁻ a, preCdf ρ r a ∂ρ.fst) atTop (𝓝 (ρ univ)) := by
  convert ρ.tendsto_IicSnd_atTop MeasurableSet.univ
  · 

Proof state:
case h.e'_3.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x✝ : ℚ
⊢ ∫⁻ (a : α), preCdf ρ x✝ a ∂Measure.fst ρ = ↑↑(Measure.IicSnd ρ ↑x✝) univ

Next tactic:
rw [← set_lintegral_univ, set_lintegral_preCdf_fst ρ _ MeasurableSet.univ]
theorem tendsto_lintegral_preCdf_atTop (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    Tendsto (fun r => ∫⁻ a, preCdf ρ r a ∂ρ.fst) atTop (𝓝 (ρ univ)) := by
  convert ρ.tendsto_IicSnd_atTop MeasurableSet.univ
  · rw [← set_lintegral_univ, set_lintegral_preCdf_fst ρ _ MeasurableSet.univ]
  · 

Proof state:
case h.e'_5.h.e'_3
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
⊢ ↑↑ρ univ = ↑↑(Measure.fst ρ) univ

Next tactic:
exact Measure.fst_univ.symm
theorem tendsto_lintegral_preCdf_atBot (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    Tendsto (fun r => ∫⁻ a, preCdf ρ r a ∂ρ.fst) atBot (𝓝 0) := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
⊢ Tendsto (fun r => ∫⁻ (a : α), preCdf ρ r a ∂Measure.fst ρ) atBot (𝓝 0)

Next tactic:
convert ρ.tendsto_IicSnd_atBot MeasurableSet.univ
theorem tendsto_lintegral_preCdf_atBot (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    Tendsto (fun r => ∫⁻ a, preCdf ρ r a ∂ρ.fst) atBot (𝓝 0) := by
  convert ρ.tendsto_IicSnd_atBot MeasurableSet.univ
  

Proof state:
case h.e'_3.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x✝ : ℚ
⊢ ∫⁻ (a : α), preCdf ρ x✝ a ∂Measure.fst ρ = ↑↑(Measure.IicSnd ρ ↑x✝) univ

Next tactic:
rw [← set_lintegral_univ, set_lintegral_preCdf_fst ρ _ MeasurableSet.univ]
theorem tendsto_preCdf_atTop_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1) := by
  -- We show first that `preCdf` has a limit almost everywhere. That limit has to be at most 1.
  -- We then show that the integral of `preCdf` tends to the integral of 1, and that it also tends
  -- to the integral of the limit. Since the limit is at most 1 and has same integral as 1, it is
  -- equal to 1 a.e.
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
⊢ ∀ᵐ (a : α) ∂Measure.fst ρ, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1)

Next tactic:
have h_mono := monotone_preCdf ρ
theorem tendsto_preCdf_atTop_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1) := by
  -- We show first that `preCdf` has a limit almost everywhere. That limit has to be at most 1.
  -- We then show that the integral of `preCdf` tends to the integral of 1, and that it also tends
  -- to the integral of the limit. Since the limit is at most 1 and has same integral as 1, it is
  -- equal to 1 a.e.
  have h_mono := monotone_preCdf ρ
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
h_mono : ∀ᵐ (a : α) ∂Measure.fst ρ, Monotone fun r => preCdf ρ r a
⊢ ∀ᵐ (a : α) ∂Measure.fst ρ, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1)

Next tactic:
have h_le_one := preCdf_le_one ρ
theorem tendsto_preCdf_atTop_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1) := by
  -- We show first that `preCdf` has a limit almost everywhere. That limit has to be at most 1.
  -- We then show that the integral of `preCdf` tends to the integral of 1, and that it also tends
  -- to the integral of the limit. Since the limit is at most 1 and has same integral as 1, it is
  -- equal to 1 a.e.
  have h_mono := monotone_preCdf ρ
  have h_le_one := preCdf_le_one ρ
  -- `preCdf` has a limit a.e.
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
h_mono : ∀ᵐ (a : α) ∂Measure.fst ρ, Monotone fun r => preCdf ρ r a
h_le_one : ∀ᵐ (a : α) ∂Measure.fst ρ, ∀ (r : ℚ), preCdf ρ r a ≤ 1
⊢ ∀ᵐ (a : α) ∂Measure.fst ρ, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1)

Next tactic:
have h_exists : ∀ᵐ a ∂ρ.fst, ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) := by
    filter_upwards [h_mono, h_le_one] with a ha_mono ha_le_one
    have h_tendsto :
      Tendsto (fun r => preCdf ρ r a) atTop atTop ∨
        ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) :=
      tendsto_of_monotone ha_mono
    cases' h_tendsto with h_absurd h_tendsto
    · rw [Monotone.tendsto_atTop_atTop_iff ha_mono] at h_absurd
      obtain ⟨r, hr⟩ := h_absurd 2
      exact absurd (hr.trans (ha_le_one r)) ENNReal.one_lt_two.not_le
    · exact h_tendsto
theorem tendsto_preCdf_atTop_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1) := by
  -- We show first that `preCdf` has a limit almost everywhere. That limit has to be at most 1.
  -- We then show that the integral of `preCdf` tends to the integral of 1, and that it also tends
  -- to the integral of the limit. Since the limit is at most 1 and has same integral as 1, it is
  -- equal to 1 a.e.
  have h_mono := monotone_preCdf ρ
  have h_le_one := preCdf_le_one ρ
  -- `preCdf` has a limit a.e.
  have h_exists : ∀ᵐ a ∂ρ.fst, ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) := by
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
h_mono : ∀ᵐ (a : α) ∂Measure.fst ρ, Monotone fun r => preCdf ρ r a
h_le_one : ∀ᵐ (a : α) ∂Measure.fst ρ, ∀ (r : ℚ), preCdf ρ r a ≤ 1
⊢ ∀ᵐ (a : α) ∂Measure.fst ρ, ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l)

Next tactic:
filter_upwards [h_mono, h_le_one] with a ha_mono ha_le_one
theorem tendsto_preCdf_atTop_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1) := by
  -- We show first that `preCdf` has a limit almost everywhere. That limit has to be at most 1.
  -- We then show that the integral of `preCdf` tends to the integral of 1, and that it also tends
  -- to the integral of the limit. Since the limit is at most 1 and has same integral as 1, it is
  -- equal to 1 a.e.
  have h_mono := monotone_preCdf ρ
  have h_le_one := preCdf_le_one ρ
  -- `preCdf` has a limit a.e.
  have h_exists : ∀ᵐ a ∂ρ.fst, ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) := by
    filter_upwards [h_mono, h_le_one] with a ha_mono ha_le_one
    

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
h_mono : ∀ᵐ (a : α) ∂Measure.fst ρ, Monotone fun r => preCdf ρ r a
h_le_one : ∀ᵐ (a : α) ∂Measure.fst ρ, ∀ (r : ℚ), preCdf ρ r a ≤ 1
a : α
ha_mono : Monotone fun r => preCdf ρ r a
ha_le_one : ∀ (r : ℚ), preCdf ρ r a ≤ 1
⊢ ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l)

Next tactic:
have h_tendsto :
      Tendsto (fun r => preCdf ρ r a) atTop atTop ∨
        ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) :=
      tendsto_of_monotone ha_mono
theorem tendsto_preCdf_atTop_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1) := by
  -- We show first that `preCdf` has a limit almost everywhere. That limit has to be at most 1.
  -- We then show that the integral of `preCdf` tends to the integral of 1, and that it also tends
  -- to the integral of the limit. Since the limit is at most 1 and has same integral as 1, it is
  -- equal to 1 a.e.
  have h_mono := monotone_preCdf ρ
  have h_le_one := preCdf_le_one ρ
  -- `preCdf` has a limit a.e.
  have h_exists : ∀ᵐ a ∂ρ.fst, ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) := by
    filter_upwards [h_mono, h_le_one] with a ha_mono ha_le_one
    have h_tendsto :
      Tendsto (fun r => preCdf ρ r a) atTop atTop ∨
        ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) :=
      tendsto_of_monotone ha_mono
    

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
h_mono : ∀ᵐ (a : α) ∂Measure.fst ρ, Monotone fun r => preCdf ρ r a
h_le_one : ∀ᵐ (a : α) ∂Measure.fst ρ, ∀ (r : ℚ), preCdf ρ r a ≤ 1
a : α
ha_mono : Monotone fun r => preCdf ρ r a
ha_le_one : ∀ (r : ℚ), preCdf ρ r a ≤ 1
h_tendsto : Tendsto (fun r => preCdf ρ r a) atTop atTop ∨ ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l)
⊢ ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l)

Next tactic:
cases' h_tendsto with h_absurd h_tendsto
theorem tendsto_preCdf_atTop_one (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    ∀ᵐ a ∂ρ.fst, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 1) := by
  -- We show first that `preCdf` has a limit almost everywhere. That limit has to be at most 1.
  -- We then show that the integral of `preCdf` tends to the integral of 1, and that it also tends
  -- to the integral of the limit. Since the limit is at most 1 and has same integral as 1, it is
  -- equal to 1 a.e.
  have h_mono := monotone_preCdf ρ
  have h_le_one := preCdf_le_one ρ
  -- `preCdf` has a limit a.e.
  have h_exists : ∀ᵐ a ∂ρ.fst, ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) := by
    filter_upwards [h_mono, h_le_one] with a ha_mono ha_le_one
    have h_tendsto :
      Tendsto (fun r => preCdf ρ r a) atTop atTop ∨
        ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l) :=
      tendsto_of_monotone ha_mono
    cases' h_tendsto with h_absurd h_tendsto
    · 

Proof state:
case h.inl
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
h_mono : ∀ᵐ (a : α) ∂Measure.fst ρ, Monotone fun r => preCdf ρ r a
h_le_one : ∀ᵐ (a : α) ∂Measure.fst ρ, ∀ (r : ℚ), preCdf ρ r a ≤ 1
a : α
ha_mono : Monotone fun r => preCdf ρ r a
ha_le_one : ∀ (r : ℚ), preCdf ρ r a ≤ 1
h_absurd : Tendsto (fun r => preCdf ρ r a) atTop atTop
⊢ ∃ l, Tendsto (fun r => preCdf ρ r a) atTop (𝓝 l)

Next tactic:
rw [Monotone.tendsto_atTop_atTop_iff ha_mono] at h_absurd