l3lab/ntp-mathlib huggingface dataset:
theorem set_lintegral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a x) ∂ρ.fst = ρ (s ×ˢ Iic x) := by
  -- We have the result for `x : ℚ` thanks to `set_lintegral_cond_cdf_rat`. We use the equality
  -- `cond_cdf ρ a x = ⨅ r : {r' : ℚ // x < r'}, cond_cdf ρ a r` and a monotone convergence
  -- argument to extend it to the reals.
  by_cases hρ_zero : ρ.fst.restrict s = 0
  · rw [hρ_zero, lintegral_zero_measure]
    refine' le_antisymm (zero_le _) _
    calc
      ρ (s ×ˢ Iic x) ≤ ρ (Prod.fst ⁻¹' s) := measure_mono (prod_subset_preimage_fst s (Iic x))
      _ = ρ.fst s := by rw [Measure.fst_apply hs]
      _ = ρ.fst.restrict s univ := by rw [Measure.restrict_apply_univ]
      _ = 0 := by simp only [hρ_zero, Measure.coe_zero, Pi.zero_apply]
  have h :
    ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a x) ∂ρ.fst =
      ∫⁻ a in s, ENNReal.ofReal (⨅ r : { r' : ℚ // x < r' }, condCdf ρ a r) ∂ρ.fst := by
    congr with a : 1
    rw [← (condCdf ρ a).iInf_rat_gt_eq x]
  have h_nonempty : Nonempty { r' : ℚ // x < ↑r' } := by
    obtain ⟨r, hrx⟩ := exists_rat_gt x
    exact ⟨⟨r, hrx⟩⟩
  rw [h]
  simp_rw [ENNReal.ofReal_cinfi]
  have h_coe : ∀ b : { r' : ℚ // x < ↑r' }, (b : ℝ) = ((b : ℚ) : ℝ) := fun _ => by congr
  rw [lintegral_iInf_directed_of_measurable hρ_zero fun q : { r' : ℚ // x < ↑r' } =>
      (measurable_condCdf ρ q).ennreal_ofReal]
  rotate_left
  · intro b
    rw [set_lintegral_condCdf_rat ρ _ hs]
    exact measure_ne_top ρ _
  · refine' Monotone.directed_ge fun i j hij a => ENNReal.ofReal_le_ofReal ((condCdf ρ a).mono _)
    rw [h_coe, h_coe]
    exact mod_cast hij
  simp_rw [set_lintegral_condCdf_rat ρ _ hs]
  rw [← measure_iInter_eq_iInf]
  · rw [← prod_iInter]
    congr with y
    simp only [mem_iInter, mem_Iic, Subtype.forall, Subtype.coe_mk]
    exact ⟨le_of_forall_lt_rat_imp_le, fun hyx q hq => hyx.trans hq.le⟩
  · exact fun i => hs.prod measurableSet_Iic
  · refine' Monotone.directed_ge fun i j hij => _
    refine' prod_subset_prod_iff.mpr (Or.inl ⟨subset_rfl, Iic_subset_Iic.mpr _⟩)
    

Proof state:
case neg.hd
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
hρ_zero : ¬Measure.restrict (Measure.fst ρ) s = 0
h :
  ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ =
    ∫⁻ (a : α) in s, ENNReal.ofReal (⨅ r, ↑(condCdf ρ a) ↑↑r) ∂Measure.fst ρ
h_nonempty : Nonempty { r' // x < ↑r' }
h_coe : ∀ (b : { r' // x < ↑r' }), ↑↑b = ↑↑b
i j : { r' // x < ↑r' }
hij : i ≤ j
⊢ ↑↑i ≤ ↑↑j

Next tactic:
exact mod_cast hij
theorem set_lintegral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a x) ∂ρ.fst = ρ (s ×ˢ Iic x) := by
  -- We have the result for `x : ℚ` thanks to `set_lintegral_cond_cdf_rat`. We use the equality
  -- `cond_cdf ρ a x = ⨅ r : {r' : ℚ // x < r'}, cond_cdf ρ a r` and a monotone convergence
  -- argument to extend it to the reals.
  by_cases hρ_zero : ρ.fst.restrict s = 0
  · rw [hρ_zero, lintegral_zero_measure]
    refine' le_antisymm (zero_le _) _
    calc
      ρ (s ×ˢ Iic x) ≤ ρ (Prod.fst ⁻¹' s) := measure_mono (prod_subset_preimage_fst s (Iic x))
      _ = ρ.fst s := by rw [Measure.fst_apply hs]
      _ = ρ.fst.restrict s univ := by rw [Measure.restrict_apply_univ]
      _ = 0 := by simp only [hρ_zero, Measure.coe_zero, Pi.zero_apply]
  have h :
    ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a x) ∂ρ.fst =
      ∫⁻ a in s, ENNReal.ofReal (⨅ r : { r' : ℚ // x < r' }, condCdf ρ a r) ∂ρ.fst := by
    congr with a : 1
    rw [← (condCdf ρ a).iInf_rat_gt_eq x]
  have h_nonempty : Nonempty { r' : ℚ // x < ↑r' } := by
    obtain ⟨r, hrx⟩ := exists_rat_gt x
    exact ⟨⟨r, hrx⟩⟩
  rw [h]
  simp_rw [ENNReal.ofReal_cinfi]
  have h_coe : ∀ b : { r' : ℚ // x < ↑r' }, (b : ℝ) = ((b : ℚ) : ℝ) := fun _ => by congr
  rw [lintegral_iInf_directed_of_measurable hρ_zero fun q : { r' : ℚ // x < ↑r' } =>
      (measurable_condCdf ρ q).ennreal_ofReal]
  rotate_left
  · intro b
    rw [set_lintegral_condCdf_rat ρ _ hs]
    exact measure_ne_top ρ _
  · refine' Monotone.directed_ge fun i j hij a => ENNReal.ofReal_le_ofReal ((condCdf ρ a).mono _)
    rw [h_coe, h_coe]
    exact mod_cast hij
  simp_rw [set_lintegral_condCdf_rat ρ _ hs]
  rw [← measure_iInter_eq_iInf]
  · rw [← prod_iInter]
    congr with y
    simp only [mem_iInter, mem_Iic, Subtype.forall, Subtype.coe_mk]
    exact ⟨le_of_forall_lt_rat_imp_le, fun hyx q hq => hyx.trans hq.le⟩
  · exact fun i => hs.prod measurableSet_Iic
  · refine' Monotone.directed_ge fun i j hij => _
    refine' prod_subset_prod_iff.mpr (Or.inl ⟨subset_rfl, Iic_subset_Iic.mpr _⟩)
    exact mod_cast hij
  · 

Proof state:
case neg.hfin
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
hρ_zero : ¬Measure.restrict (Measure.fst ρ) s = 0
h :
  ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ =
    ∫⁻ (a : α) in s, ENNReal.ofReal (⨅ r, ↑(condCdf ρ a) ↑↑r) ∂Measure.fst ρ
h_nonempty : Nonempty { r' // x < ↑r' }
h_coe : ∀ (b : { r' // x < ↑r' }), ↑↑b = ↑↑b
⊢ ∃ i, ↑↑ρ (s ×ˢ Iic ↑↑i) ≠ ⊤

Next tactic:
exact ⟨h_nonempty.some, measure_ne_top _ _⟩
theorem lintegral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    ∫⁻ a, ENNReal.ofReal (condCdf ρ a x) ∂ρ.fst = ρ (univ ×ˢ Iic x) := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
⊢ ∫⁻ (a : α), ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (univ ×ˢ Iic x)

Next tactic:
rw [← set_lintegral_univ, set_lintegral_condCdf ρ _ MeasurableSet.univ]
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
⊢ Integrable fun a => ↑(condCdf ρ a) x

Next tactic:
refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
⊢ AEStronglyMeasurable (fun a => ↑(condCdf ρ a) x) (Measure.fst ρ)

Next tactic:
exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
⊢ ∫⁻ (x_1 : α) in t, ↑‖↑(condCdf ρ x_1) x‖₊ ∂Measure.fst ρ ≤ ↑↑(Measure.fst ρ) univ

Next tactic:
have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      intro y
      rw [Real.nnnorm_of_nonneg (condCdf_nonneg _ _ _)]
      -- Porting note: was exact_mod_cast condCdf_le_one _ _ _
      simp only [ENNReal.coe_le_one_iff]
      exact condCdf_le_one _ _ _
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
⊢ ∀ (y : α), ↑‖↑(condCdf ρ y) x‖₊ ≤ 1

Next tactic:
intro y
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      intro y
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
y : α
⊢ ↑‖↑(condCdf ρ y) x‖₊ ≤ 1

Next tactic:
rw [Real.nnnorm_of_nonneg (condCdf_nonneg _ _ _)]
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      intro y
      rw [Real.nnnorm_of_nonneg (condCdf_nonneg _ _ _)]
      -- Porting note: was exact_mod_cast condCdf_le_one _ _ _
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
y : α
⊢ ↑{ val := ↑(condCdf ρ y) x, property := (_ : 0 ≤ ↑(condCdf ρ y) x) } ≤ 1

Next tactic:
simp only [ENNReal.coe_le_one_iff]
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      intro y
      rw [Real.nnnorm_of_nonneg (condCdf_nonneg _ _ _)]
      -- Porting note: was exact_mod_cast condCdf_le_one _ _ _
      simp only [ENNReal.coe_le_one_iff]
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
y : α
⊢ { val := ↑(condCdf ρ y) x, property := (_ : 0 ≤ ↑(condCdf ρ y) x) } ≤ 1

Next tactic:
exact condCdf_le_one _ _ _
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      intro y
      rw [Real.nnnorm_of_nonneg (condCdf_nonneg _ _ _)]
      -- Porting note: was exact_mod_cast condCdf_le_one _ _ _
      simp only [ENNReal.coe_le_one_iff]
      exact condCdf_le_one _ _ _
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
this : ∀ (y : α), ↑‖↑(condCdf ρ y) x‖₊ ≤ 1
⊢ ∫⁻ (x_1 : α) in t, ↑‖↑(condCdf ρ x_1) x‖₊ ∂Measure.fst ρ ≤ ↑↑(Measure.fst ρ) univ

Next tactic:
refine'
      (set_lintegral_mono (measurable_condCdf _ _).ennnorm measurable_one fun y _ => this y).trans
        _
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      intro y
      rw [Real.nnnorm_of_nonneg (condCdf_nonneg _ _ _)]
      -- Porting note: was exact_mod_cast condCdf_le_one _ _ _
      simp only [ENNReal.coe_le_one_iff]
      exact condCdf_le_one _ _ _
    refine'
      (set_lintegral_mono (measurable_condCdf _ _).ennnorm measurable_one fun y _ => this y).trans
        _
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
this : ∀ (y : α), ↑‖↑(condCdf ρ y) x‖₊ ≤ 1
⊢ ∫⁻ (x : α) in t, OfNat.ofNat 1 x ∂Measure.fst ρ ≤ ↑↑(Measure.fst ρ) univ

Next tactic:
simp only [Pi.one_apply, lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
theorem integrable_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    Integrable (fun a => condCdf ρ a x) ρ.fst := by
  refine' integrable_of_forall_fin_meas_le _ (measure_lt_top ρ.fst univ) _ fun t _ _ => _
  · exact (stronglyMeasurable_condCdf ρ _).aestronglyMeasurable
  · have : ∀ y, (‖condCdf ρ y x‖₊ : ℝ≥0∞) ≤ 1 := by
      intro y
      rw [Real.nnnorm_of_nonneg (condCdf_nonneg _ _ _)]
      -- Porting note: was exact_mod_cast condCdf_le_one _ _ _
      simp only [ENNReal.coe_le_one_iff]
      exact condCdf_le_one _ _ _
    refine'
      (set_lintegral_mono (measurable_condCdf _ _).ennnorm measurable_one fun y _ => this y).trans
        _
    simp only [Pi.one_apply, lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
t : Set α
x✝¹ : MeasurableSet t
x✝ : ↑↑(Measure.fst ρ) t ≠ ⊤
this : ∀ (y : α), ↑‖↑(condCdf ρ y) x‖₊ ≤ 1
⊢ ↑↑(Measure.fst ρ) t ≤ ↑↑(Measure.fst ρ) univ

Next tactic:
exact measure_mono (subset_univ _)
theorem set_integral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫ a in s, condCdf ρ a x ∂ρ.fst = (ρ (s ×ˢ Iic x)).toReal := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
⊢ ∫ (a : α) in s, ↑(condCdf ρ a) x ∂Measure.fst ρ = ENNReal.toReal (↑↑ρ (s ×ˢ Iic x))

Next tactic:
have h := set_lintegral_condCdf ρ x hs
theorem set_integral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫ a in s, condCdf ρ a x ∂ρ.fst = (ρ (s ×ˢ Iic x)).toReal := by
  have h := set_lintegral_condCdf ρ x hs
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
h : ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic x)
⊢ ∫ (a : α) in s, ↑(condCdf ρ a) x ∂Measure.fst ρ = ENNReal.toReal (↑↑ρ (s ×ˢ Iic x))

Next tactic:
rw [← ofReal_integral_eq_lintegral_ofReal] at h
theorem set_integral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫ a in s, condCdf ρ a x ∂ρ.fst = (ρ (s ×ˢ Iic x)).toReal := by
  have h := set_lintegral_condCdf ρ x hs
  rw [← ofReal_integral_eq_lintegral_ofReal] at h
  · 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
h : ENNReal.ofReal (∫ (x_1 : α) in s, ↑(condCdf ρ x_1) x ∂Measure.fst ρ) = ↑↑ρ (s ×ˢ Iic x)
⊢ ∫ (a : α) in s, ↑(condCdf ρ a) x ∂Measure.fst ρ = ENNReal.toReal (↑↑ρ (s ×ˢ Iic x))

Next tactic:
rw [← h, ENNReal.toReal_ofReal]
theorem set_integral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫ a in s, condCdf ρ a x ∂ρ.fst = (ρ (s ×ˢ Iic x)).toReal := by
  have h := set_lintegral_condCdf ρ x hs
  rw [← ofReal_integral_eq_lintegral_ofReal] at h
  · rw [← h, ENNReal.toReal_ofReal]
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
h : ENNReal.ofReal (∫ (x_1 : α) in s, ↑(condCdf ρ x_1) x ∂Measure.fst ρ) = ↑↑ρ (s ×ˢ Iic x)
⊢ 0 ≤ ∫ (x_1 : α) in s, ↑(condCdf ρ x_1) x ∂Measure.fst ρ

Next tactic:
exact integral_nonneg fun _ => condCdf_nonneg _ _ _
theorem set_integral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫ a in s, condCdf ρ a x ∂ρ.fst = (ρ (s ×ˢ Iic x)).toReal := by
  have h := set_lintegral_condCdf ρ x hs
  rw [← ofReal_integral_eq_lintegral_ofReal] at h
  · rw [← h, ENNReal.toReal_ofReal]
    exact integral_nonneg fun _ => condCdf_nonneg _ _ _
  · 

Proof state:
case hfi
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
h : ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic x)
⊢ Integrable fun a => ↑(condCdf ρ a) x

Next tactic:
exact (integrable_condCdf _ _).integrableOn
theorem set_integral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) {s : Set α}
    (hs : MeasurableSet s) : ∫ a in s, condCdf ρ a x ∂ρ.fst = (ρ (s ×ˢ Iic x)).toReal := by
  have h := set_lintegral_condCdf ρ x hs
  rw [← ofReal_integral_eq_lintegral_ofReal] at h
  · rw [← h, ENNReal.toReal_ofReal]
    exact integral_nonneg fun _ => condCdf_nonneg _ _ _
  · exact (integrable_condCdf _ _).integrableOn
  · 

Proof state:
case f_nn
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
s : Set α
hs : MeasurableSet s
h : ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic x)
⊢ 0 ≤ᵐ[Measure.restrict (Measure.fst ρ) s] fun a => ↑(condCdf ρ a) x

Next tactic:
exact eventually_of_forall fun _ => condCdf_nonneg _ _ _
theorem integral_condCdf (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (x : ℝ) :
    ∫ a, condCdf ρ a x ∂ρ.fst = (ρ (univ ×ˢ Iic x)).toReal := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
x : ℝ
⊢ ∫ (a : α), ↑(condCdf ρ a) x ∂Measure.fst ρ = ENNReal.toReal (↑↑ρ (univ ×ˢ Iic x))

Next tactic:
rw [← set_integral_condCdf ρ _ MeasurableSet.univ, Measure.restrict_univ]
theorem measure_condCdf_Iic (ρ : Measure (α × ℝ)) (a : α) (x : ℝ) :
    (condCdf ρ a).measure (Iic x) = ENNReal.ofReal (condCdf ρ a x) := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
a : α
x : ℝ
⊢ ↑↑(StieltjesFunction.measure (condCdf ρ a)) (Iic x) = ENNReal.ofReal (↑(condCdf ρ a) x)

Next tactic:
rw [← sub_zero (condCdf ρ a x)]
theorem measure_condCdf_Iic (ρ : Measure (α × ℝ)) (a : α) (x : ℝ) :
    (condCdf ρ a).measure (Iic x) = ENNReal.ofReal (condCdf ρ a x) := by
  rw [← sub_zero (condCdf ρ a x)]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
a : α
x : ℝ
⊢ ↑↑(StieltjesFunction.measure (condCdf ρ a)) (Iic x) = ENNReal.ofReal (↑(condCdf ρ a) x - 0)

Next tactic:
exact (condCdf ρ a).measure_Iic (tendsto_condCdf_atBot ρ a) _
theorem measure_condCdf_univ (ρ : Measure (α × ℝ)) (a : α) : (condCdf ρ a).measure univ = 1 := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
a : α
⊢ ↑↑(StieltjesFunction.measure (condCdf ρ a)) univ = 1

Next tactic:
rw [← ENNReal.ofReal_one, ← sub_zero (1 : ℝ)]
theorem measure_condCdf_univ (ρ : Measure (α × ℝ)) (a : α) : (condCdf ρ a).measure univ = 1 := by
  rw [← ENNReal.ofReal_one, ← sub_zero (1 : ℝ)]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
a : α
⊢ ↑↑(StieltjesFunction.measure (condCdf ρ a)) univ = ENNReal.ofReal (1 - 0)

Next tactic:
exact StieltjesFunction.measure_univ _ (tendsto_condCdf_atBot ρ a) (tendsto_condCdf_atTop ρ a)
/-- The function `a ↦ (condCdf ρ a).measure` is measurable. -/
theorem measurable_measure_condCdf (ρ : Measure (α × ℝ)) :
    Measurable fun a => (condCdf ρ a).measure := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
⊢ Measurable fun a => StieltjesFunction.measure (condCdf ρ a)

Next tactic:
rw [Measure.measurable_measure]
/-- The function `a ↦ (condCdf ρ a).measure` is measurable. -/
theorem measurable_measure_condCdf (ρ : Measure (α × ℝ)) :
    Measurable fun a => (condCdf ρ a).measure := by
  rw [Measure.measurable_measure]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
⊢ ∀ (s : Set ℝ), MeasurableSet s → Measurable fun b => ↑↑(StieltjesFunction.measure (condCdf ρ b)) s

Next tactic:
refine' fun s hs => ?_
/-- The function `a ↦ (condCdf ρ a).measure` is measurable. -/
theorem measurable_measure_condCdf (ρ : Measure (α × ℝ)) :
    Measurable fun a => (condCdf ρ a).measure := by
  rw [Measure.measurable_measure]
  refine' fun s hs => ?_
  -- Porting note: supplied `C`
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
s : Set ℝ
hs : MeasurableSet s
⊢ Measurable fun b => ↑↑(StieltjesFunction.measure (condCdf ρ b)) s

Next tactic:
refine' MeasurableSpace.induction_on_inter
    (C := fun s => Measurable fun b ↦ StieltjesFunction.measure (condCdf ρ b) s)
    (borel_eq_generateFrom_Iic ℝ) isPiSystem_Iic _ _ _ _ hs
/-- The function `a ↦ (condCdf ρ a).measure` is measurable. -/
theorem measurable_measure_condCdf (ρ : Measure (α × ℝ)) :
    Measurable fun a => (condCdf ρ a).measure := by
  rw [Measure.measurable_measure]
  refine' fun s hs => ?_
  -- Porting note: supplied `C`
  refine' MeasurableSpace.induction_on_inter
    (C := fun s => Measurable fun b ↦ StieltjesFunction.measure (condCdf ρ b) s)
    (borel_eq_generateFrom_Iic ℝ) isPiSystem_Iic _ _ _ _ hs
  · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
s : Set ℝ
hs : MeasurableSet s
⊢ (fun s => Measurable fun b => ↑↑(StieltjesFunction.measure (condCdf ρ b)) s) ∅

Next tactic:
simp only [measure_empty, measurable_const]
/-- The function `a ↦ (condCdf ρ a).measure` is measurable. -/
theorem measurable_measure_condCdf (ρ : Measure (α × ℝ)) :
    Measurable fun a => (condCdf ρ a).measure := by
  rw [Measure.measurable_measure]
  refine' fun s hs => ?_
  -- Porting note: supplied `C`
  refine' MeasurableSpace.induction_on_inter
    (C := fun s => Measurable fun b ↦ StieltjesFunction.measure (condCdf ρ b) s)
    (borel_eq_generateFrom_Iic ℝ) isPiSystem_Iic _ _ _ _ hs
  · simp only [measure_empty, measurable_const]
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
s : Set ℝ
hs : MeasurableSet s
⊢ ∀ t ∈ range Iic, (fun s => Measurable fun b => ↑↑(StieltjesFunction.measure (condCdf ρ b)) s) t

Next tactic:
rintro S ⟨u, rfl⟩
/-- The function `a ↦ (condCdf ρ a).measure` is measurable. -/
theorem measurable_measure_condCdf (ρ : Measure (α × ℝ)) :
    Measurable fun a => (condCdf ρ a).measure := by
  rw [Measure.measurable_measure]
  refine' fun s hs => ?_
  -- Porting note: supplied `C`
  refine' MeasurableSpace.induction_on_inter
    (C := fun s => Measurable fun b ↦ StieltjesFunction.measure (condCdf ρ b) s)
    (borel_eq_generateFrom_Iic ℝ) isPiSystem_Iic _ _ _ _ hs
  · simp only [measure_empty, measurable_const]
  · rintro S ⟨u, rfl⟩
    

Proof state:
case refine'_2.intro
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
s : Set ℝ
hs : MeasurableSet s
u : ℝ
⊢ Measurable fun b => ↑↑(StieltjesFunction.measure (condCdf ρ b)) (Iic u)

Next tactic:
simp_rw [measure_condCdf_Iic ρ _ u]
/-- The function `a ↦ (condCdf ρ a).measure` is measurable. -/
theorem measurable_measure_condCdf (ρ : Measure (α × ℝ)) :
    Measurable fun a => (condCdf ρ a).measure := by
  rw [Measure.measurable_measure]
  refine' fun s hs => ?_
  -- Porting note: supplied `C`
  refine' MeasurableSpace.induction_on_inter
    (C := fun s => Measurable fun b ↦ StieltjesFunction.measure (condCdf ρ b) s)
    (borel_eq_generateFrom_Iic ℝ) isPiSystem_Iic _ _ _ _ hs
  · simp only [measure_empty, measurable_const]
  · rintro S ⟨u, rfl⟩
    simp_rw [measure_condCdf_Iic ρ _ u]
    

Proof state:
case refine'_2.intro
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
s : Set ℝ
hs : MeasurableSet s
u : ℝ
⊢ Measurable fun b => ENNReal.ofReal (↑(condCdf ρ b) u)

Next tactic:
exact (measurable_condCdf ρ u).ennreal_ofReal