l3lab/ntp-mathlib huggingface dataset:
theorem ofReal_condCdf_ae_eq (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) :
    (fun a => ENNReal.ofReal (condCdf ρ a r)) =ᵐ[ρ.fst] preCdf ρ r := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
⊢ (fun a => ENNReal.ofReal (↑(condCdf ρ a) ↑r)) =ᵐ[Measure.fst ρ] preCdf ρ r

Next tactic:
filter_upwards [condCdf_ae_eq ρ r, preCdf_le_one ρ] with a ha ha_le_one
theorem ofReal_condCdf_ae_eq (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) :
    (fun a => ENNReal.ofReal (condCdf ρ a r)) =ᵐ[ρ.fst] preCdf ρ r := by
  filter_upwards [condCdf_ae_eq ρ r, preCdf_le_one ρ] with a ha ha_le_one
  

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
a : α
ha : ↑(condCdf ρ a) ↑r = ENNReal.toReal (preCdf ρ r a)
ha_le_one : ∀ (r : ℚ), preCdf ρ r a ≤ 1
⊢ ENNReal.ofReal (↑(condCdf ρ a) ↑r) = preCdf ρ r a

Next tactic:
rw [ha, ENNReal.ofReal_toReal]
theorem ofReal_condCdf_ae_eq (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) :
    (fun a => ENNReal.ofReal (condCdf ρ a r)) =ᵐ[ρ.fst] preCdf ρ r := by
  filter_upwards [condCdf_ae_eq ρ r, preCdf_le_one ρ] with a ha ha_le_one
  rw [ha, ENNReal.ofReal_toReal]
  

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
a : α
ha : ↑(condCdf ρ a) ↑r = ENNReal.toReal (preCdf ρ r a)
ha_le_one : ∀ (r : ℚ), preCdf ρ r a ≤ 1
⊢ preCdf ρ r a ≠ ⊤

Next tactic:
exact ((ha_le_one r).trans_lt ENNReal.one_lt_top).ne
/-- The conditional cdf is a measurable function of `a : α` for all `x : ℝ`. -/
theorem measurable_condCdf (ρ : Measure (α × ℝ)) (x : ℝ) : Measurable fun a => condCdf ρ a x := by
  

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

Next tactic:
have : (fun a => condCdf ρ a x) = fun a => ⨅ r : { r' : ℚ // x < r' }, condCdfRat ρ a ↑r := by
    ext1 a
    rw [← StieltjesFunction.iInf_rat_gt_eq]
    congr with q
    rw [condCdf_eq_condCdfRat]
/-- The conditional cdf is a measurable function of `a : α` for all `x : ℝ`. -/
theorem measurable_condCdf (ρ : Measure (α × ℝ)) (x : ℝ) : Measurable fun a => condCdf ρ a x := by
  have : (fun a => condCdf ρ a x) = fun a => ⨅ r : { r' : ℚ // x < r' }, condCdfRat ρ a ↑r := by
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
x : ℝ
⊢ (fun a => ↑(condCdf ρ a) x) = fun a => ⨅ r, condCdfRat ρ a ↑r

Next tactic:
ext1 a
/-- The conditional cdf is a measurable function of `a : α` for all `x : ℝ`. -/
theorem measurable_condCdf (ρ : Measure (α × ℝ)) (x : ℝ) : Measurable fun a => condCdf ρ a x := by
  have : (fun a => condCdf ρ a x) = fun a => ⨅ r : { r' : ℚ // x < r' }, condCdfRat ρ a ↑r := by
    ext1 a
    

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
x : ℝ
a : α
⊢ ↑(condCdf ρ a) x = ⨅ r, condCdfRat ρ a ↑r

Next tactic:
rw [← StieltjesFunction.iInf_rat_gt_eq]
/-- The conditional cdf is a measurable function of `a : α` for all `x : ℝ`. -/
theorem measurable_condCdf (ρ : Measure (α × ℝ)) (x : ℝ) : Measurable fun a => condCdf ρ a x := by
  have : (fun a => condCdf ρ a x) = fun a => ⨅ r : { r' : ℚ // x < r' }, condCdfRat ρ a ↑r := by
    ext1 a
    rw [← StieltjesFunction.iInf_rat_gt_eq]
    

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
x : ℝ
a : α
⊢ ⨅ r, ↑(condCdf ρ a) ↑↑r = ⨅ r, condCdfRat ρ a ↑r

Next tactic:
congr with q
/-- The conditional cdf is a measurable function of `a : α` for all `x : ℝ`. -/
theorem measurable_condCdf (ρ : Measure (α × ℝ)) (x : ℝ) : Measurable fun a => condCdf ρ a x := by
  have : (fun a => condCdf ρ a x) = fun a => ⨅ r : { r' : ℚ // x < r' }, condCdfRat ρ a ↑r := by
    ext1 a
    rw [← StieltjesFunction.iInf_rat_gt_eq]
    congr with q
    

Proof state:
case h.e_s.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
x : ℝ
a : α
q : { r' // x < ↑r' }
⊢ ↑(condCdf ρ a) ↑↑q = condCdfRat ρ a ↑q

Next tactic:
rw [condCdf_eq_condCdfRat]
/-- The conditional cdf is a measurable function of `a : α` for all `x : ℝ`. -/
theorem measurable_condCdf (ρ : Measure (α × ℝ)) (x : ℝ) : Measurable fun a => condCdf ρ a x := by
  have : (fun a => condCdf ρ a x) = fun a => ⨅ r : { r' : ℚ // x < r' }, condCdfRat ρ a ↑r := by
    ext1 a
    rw [← StieltjesFunction.iInf_rat_gt_eq]
    congr with q
    rw [condCdf_eq_condCdfRat]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
x : ℝ
this : (fun a => ↑(condCdf ρ a) x) = fun a => ⨅ r, condCdfRat ρ a ↑r
⊢ Measurable fun a => ↑(condCdf ρ a) x

Next tactic:
rw [this]
/-- The conditional cdf is a measurable function of `a : α` for all `x : ℝ`. -/
theorem measurable_condCdf (ρ : Measure (α × ℝ)) (x : ℝ) : Measurable fun a => condCdf ρ a x := by
  have : (fun a => condCdf ρ a x) = fun a => ⨅ r : { r' : ℚ // x < r' }, condCdfRat ρ a ↑r := by
    ext1 a
    rw [← StieltjesFunction.iInf_rat_gt_eq]
    congr with q
    rw [condCdf_eq_condCdfRat]
  rw [this]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
x : ℝ
this : (fun a => ↑(condCdf ρ a) x) = fun a => ⨅ r, condCdfRat ρ a ↑r
⊢ Measurable fun a => ⨅ r, condCdfRat ρ a ↑r

Next tactic:
exact measurable_iInf (fun q => measurable_condCdfRat ρ q)
/-- Auxiliary lemma for `set_lintegral_cond_cdf`. -/
theorem set_lintegral_condCdf_rat (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) {s : Set α}
    (hs : MeasurableSet s) :
    ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a r) ∂ρ.fst = ρ (s ×ˢ Iic (r : ℝ)) := by
  

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

Next tactic:
have : ∀ᵐ a ∂ρ.fst, a ∈ s → ENNReal.ofReal (condCdf ρ a r) = preCdf ρ r a := by
    filter_upwards [ofReal_condCdf_ae_eq ρ r] with a ha using fun _ => ha
/-- Auxiliary lemma for `set_lintegral_cond_cdf`. -/
theorem set_lintegral_condCdf_rat (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) {s : Set α}
    (hs : MeasurableSet s) :
    ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a r) ∂ρ.fst = ρ (s ×ˢ Iic (r : ℝ)) := by
  have : ∀ᵐ a ∂ρ.fst, a ∈ s → ENNReal.ofReal (condCdf ρ a r) = preCdf ρ r a := by
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
s : Set α
hs : MeasurableSet s
⊢ ∀ᵐ (a : α) ∂Measure.fst ρ, a ∈ s → ENNReal.ofReal (↑(condCdf ρ a) ↑r) = preCdf ρ r a

Next tactic:
filter_upwards [ofReal_condCdf_ae_eq ρ r] with a ha using fun _ => ha
/-- Auxiliary lemma for `set_lintegral_cond_cdf`. -/
theorem set_lintegral_condCdf_rat (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) {s : Set α}
    (hs : MeasurableSet s) :
    ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a r) ∂ρ.fst = ρ (s ×ˢ Iic (r : ℝ)) := by
  have : ∀ᵐ a ∂ρ.fst, a ∈ s → ENNReal.ofReal (condCdf ρ a r) = preCdf ρ r a := by
    filter_upwards [ofReal_condCdf_ae_eq ρ r] with a ha using fun _ => ha
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
ρ : Measure (α × ℝ)
inst✝ : IsFiniteMeasure ρ
r : ℚ
s : Set α
hs : MeasurableSet s
this : ∀ᵐ (a : α) ∂Measure.fst ρ, a ∈ s → ENNReal.ofReal (↑(condCdf ρ a) ↑r) = preCdf ρ r a
⊢ ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) ↑r) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic ↑r)

Next tactic:
rw [set_lintegral_congr_fun hs this, set_lintegral_preCdf_fst ρ r hs]
/-- Auxiliary lemma for `set_lintegral_cond_cdf`. -/
theorem set_lintegral_condCdf_rat (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) {s : Set α}
    (hs : MeasurableSet s) :
    ∫⁻ a in s, ENNReal.ofReal (condCdf ρ a r) ∂ρ.fst = ρ (s ×ˢ Iic (r : ℝ)) := by
  have : ∀ᵐ a ∂ρ.fst, a ∈ s → ENNReal.ofReal (condCdf ρ a r) = preCdf ρ r a := by
    filter_upwards [ofReal_condCdf_ae_eq ρ r] with a ha using fun _ => ha
  rw [set_lintegral_congr_fun hs this, 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
this : ∀ᵐ (a : α) ∂Measure.fst ρ, a ∈ s → ENNReal.ofReal (↑(condCdf ρ a) ↑r) = preCdf ρ r a
⊢ ↑↑(Measure.IicSnd ρ ↑r) s = ↑↑ρ (s ×ˢ Iic ↑r)

Next tactic:
exact ρ.IicSnd_apply r hs
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.
  

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, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic x)

Next tactic:
by_cases hρ_zero : ρ.fst.restrict s = 0
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
  · 

Proof state:
case pos
α : 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
⊢ ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic x)

Next tactic:
rw [hρ_zero, lintegral_zero_measure]
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]
    

Proof state:
case pos
α : 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
⊢ 0 = ↑↑ρ (s ×ˢ Iic x)

Next tactic:
refine' le_antisymm (zero_le _) _
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 _) _
    

Proof state:
case pos
α : 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
⊢ ↑↑ρ (s ×ˢ Iic x) ≤ 0

Next tactic:
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]
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 

Proof state:
α : 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
⊢ ↑↑ρ (Prod.fst ⁻¹' s) = ↑↑(Measure.fst ρ) s

Next tactic:
rw [Measure.fst_apply hs]
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 

Proof state:
α : 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
⊢ ↑↑(Measure.fst ρ) s = ↑↑(Measure.restrict (Measure.fst ρ) s) univ

Next tactic:
rw [Measure.restrict_apply_univ]
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 

Proof state:
α : 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
⊢ ↑↑(Measure.restrict (Measure.fst ρ) s) univ = 0

Next tactic:
simp only [hρ_zero, Measure.coe_zero, Pi.zero_apply]
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]
  

Proof state:
case neg
α : 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
⊢ ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic x)

Next tactic:
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]
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
    

Proof state:
α : 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
⊢ ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ =
    ∫⁻ (a : α) in s, ENNReal.ofReal (⨅ r, ↑(condCdf ρ a) ↑↑r) ∂Measure.fst ρ

Next tactic:
congr with a : 1
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
    

Proof state:
case e_f.h
α : 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
a : α
⊢ ENNReal.ofReal (↑(condCdf ρ a) x) = ENNReal.ofReal (⨅ r, ↑(condCdf ρ a) ↑↑r)

Next tactic:
rw [← (condCdf ρ a).iInf_rat_gt_eq x]
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]
  

Proof state:
case neg
α : 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 ρ
⊢ ∫⁻ (a : α) in s, ENNReal.ofReal (↑(condCdf ρ a) x) ∂Measure.fst ρ = ↑↑ρ (s ×ˢ Iic x)

Next tactic:
have h_nonempty : Nonempty { r' : ℚ // x < ↑r' } := by
    obtain ⟨r, hrx⟩ := exists_rat_gt x
    exact ⟨⟨r, hrx⟩⟩
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
    

Proof state:
α : 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 ρ
⊢ Nonempty { r' // x < ↑r' }

Next tactic:
obtain ⟨r, hrx⟩ := exists_rat_gt x
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
    

Proof state:
case intro
α : 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 ρ
r : ℚ
hrx : x < ↑r
⊢ Nonempty { r' // x < ↑r' }

Next tactic:
exact ⟨⟨r, hrx⟩⟩