l3lab/ntp-mathlib huggingface dataset:
/-- **Disintegration** of constant kernels. A constant kernel on a product space `α × Ω`, where `Ω`
is standard Borel, can be written as the composition-product of the constant kernel with
value `ρ.fst` (marginal measure over `α`) and a Markov kernel from `α` to `Ω`. We call that
Markov kernel `ProbabilityTheory.condKernel ρ`. -/
theorem kernel.const_eq_compProd (γ : Type*) [MeasurableSpace γ] (ρ : Measure (α × Ω))
    [IsFiniteMeasure ρ] :
    kernel.const γ ρ = kernel.const γ ρ.fst ⊗ₖ kernel.prodMkLeft γ ρ.condKernel := by
  ext a s hs : 2
  

Proof state:
case h.h
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁵ : MeasurableSpace Ω
inst✝⁴ : StandardBorelSpace Ω
inst✝³ : Nonempty Ω
ρ✝ : Measure (α × Ω)
inst✝² : IsFiniteMeasure ρ✝
γ : Type u_3
inst✝¹ : MeasurableSpace γ
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
a : γ
s : Set (α × Ω)
hs : MeasurableSet s
⊢ ↑↑((const γ ρ) a) s = ↑↑((const γ (Measure.fst ρ) ⊗ₖ prodMkLeft γ (Measure.condKernel ρ)) a) s

Next tactic:
simpa only [kernel.const_apply, kernel.compProd_apply _ _ _ hs, kernel.prodMkLeft_apply'] using
    kernel.ext_iff'.mp (kernel.const_unit_eq_compProd ρ) () s hs
theorem lintegral_condKernel_mem {s : Set (α × Ω)} (hs : MeasurableSet s) :
    ∫⁻ a, ρ.condKernel a {x | (a, x) ∈ s} ∂ρ.fst = ρ s := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set (α × Ω)
hs : MeasurableSet s
⊢ ∫⁻ (a : α), ↑↑((Measure.condKernel ρ) a) {x | (a, x) ∈ s} ∂Measure.fst ρ = ↑↑ρ s

Next tactic:
conv_rhs => rw [measure_eq_compProd ρ]
theorem lintegral_condKernel_mem {s : Set (α × Ω)} (hs : MeasurableSet s) :
    ∫⁻ a, ρ.condKernel a {x | (a, x) ∈ s} ∂ρ.fst = ρ s := by
  conv_rhs => 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set (α × Ω)
hs : MeasurableSet s
| ↑↑ρ s

Next tactic:
rw [measure_eq_compProd ρ]
theorem lintegral_condKernel_mem {s : Set (α × Ω)} (hs : MeasurableSet s) :
    ∫⁻ a, ρ.condKernel a {x | (a, x) ∈ s} ∂ρ.fst = ρ s := by
  conv_rhs => rw [measure_eq_compProd ρ]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set (α × Ω)
hs : MeasurableSet s
⊢ ∫⁻ (a : α), ↑↑((Measure.condKernel ρ) a) {x | (a, x) ∈ s} ∂Measure.fst ρ = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) s

Next tactic:
simp_rw [Measure.compProd_apply hs]
theorem lintegral_condKernel_mem {s : Set (α × Ω)} (hs : MeasurableSet s) :
    ∫⁻ a, ρ.condKernel a {x | (a, x) ∈ s} ∂ρ.fst = ρ s := by
  conv_rhs => rw [measure_eq_compProd ρ]
  simp_rw [Measure.compProd_apply hs]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set (α × Ω)
hs : MeasurableSet s
⊢ ∫⁻ (a : α), ↑↑((Measure.condKernel ρ) a) {x | (a, x) ∈ s} ∂Measure.fst ρ =
    ∫⁻ (a : α), ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s) ∂Measure.fst ρ

Next tactic:
rfl
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
⊢ ∫⁻ (a : α) in s, ↑↑((Measure.condKernel ρ) a) t ∂Measure.fst ρ = ↑↑ρ (s ×ˢ t)

Next tactic:
have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
⊢ ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)

Next tactic:
congr
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; 

Proof state:
case e_self.e_self
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
⊢ ρ = Measure.fst ρ ⊗ₘ Measure.condKernel ρ

Next tactic:
exact measure_eq_compProd ρ
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
⊢ ∫⁻ (a : α) in s, ↑↑((Measure.condKernel ρ) a) t ∂Measure.fst ρ = ↑↑ρ (s ×ˢ t)

Next tactic:
rw [this, Measure.compProd_apply (hs.prod ht)]
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
⊢ ∫⁻ (a : α) in s, ↑↑((Measure.condKernel ρ) a) t ∂Measure.fst ρ =
    ∫⁻ (a : α), ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) ∂Measure.fst ρ

Next tactic:
classical
  have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    intro a
    by_cases ha : a ∈ s <;> simp [ha]
  simp_rw [this]
  rw [lintegral_indicator _ hs]
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  classical
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
⊢ ∫⁻ (a : α) in s, ↑↑((Measure.condKernel ρ) a) t ∂Measure.fst ρ =
    ∫⁻ (a : α), ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) ∂Measure.fst ρ

Next tactic:
have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    intro a
    by_cases ha : a ∈ s <;> simp [ha]
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  classical
  have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
⊢ ∀ (a : α),
    ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) = indicator s (fun a => ↑↑((Measure.condKernel ρ) a) t) a

Next tactic:
intro a
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  classical
  have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    intro a
    

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
a : α
⊢ ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) = indicator s (fun a => ↑↑((Measure.condKernel ρ) a) t) a

Next tactic:
by_cases ha : a ∈ s
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  classical
  have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    intro a
    by_cases ha : a ∈ s <;> 

Proof state:
case pos
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
a : α
ha : a ∈ s
⊢ ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) = indicator s (fun a => ↑↑((Measure.condKernel ρ) a) t) a

Next tactic:
simp [ha]
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  classical
  have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    intro a
    by_cases ha : a ∈ s <;> 

Proof state:
case neg
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
a : α
ha : a ∉ s
⊢ ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) = indicator s (fun a => ↑↑((Measure.condKernel ρ) a) t) a

Next tactic:
simp [ha]
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  classical
  have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    intro a
    by_cases ha : a ∈ s <;> simp [ha]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this✝ : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
this :
  ∀ (a : α),
    ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) = indicator s (fun a => ↑↑((Measure.condKernel ρ) a) t) a
⊢ ∫⁻ (a : α) in s, ↑↑((Measure.condKernel ρ) a) t ∂Measure.fst ρ =
    ∫⁻ (a : α), ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) ∂Measure.fst ρ

Next tactic:
simp_rw [this]
theorem set_lintegral_condKernel_eq_measure_prod {s : Set α} (hs : MeasurableSet s) {t : Set Ω}
    (ht : MeasurableSet t) : ∫⁻ a in s, ρ.condKernel a t ∂ρ.fst = ρ (s ×ˢ t) := by
  have : ρ (s ×ˢ t) = (ρ.fst ⊗ₘ ρ.condKernel) (s ×ˢ t) := by
    congr; exact measure_eq_compProd ρ
  rw [this, Measure.compProd_apply (hs.prod ht)]
  classical
  have : ∀ a, ρ.condKernel a (Prod.mk a ⁻¹' s ×ˢ t)
      = s.indicator (fun a ↦ ρ.condKernel a t) a := by
    intro a
    by_cases ha : a ∈ s <;> simp [ha]
  simp_rw [this]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
this✝ : ↑↑ρ (s ×ˢ t) = ↑↑(Measure.fst ρ ⊗ₘ Measure.condKernel ρ) (s ×ˢ t)
this :
  ∀ (a : α),
    ↑↑((Measure.condKernel ρ) a) (Prod.mk a ⁻¹' s ×ˢ t) = indicator s (fun a => ↑↑((Measure.condKernel ρ) a) t) a
⊢ ∫⁻ (a : α) in s, ↑↑((Measure.condKernel ρ) a) t ∂Measure.fst ρ =
    ∫⁻ (a : α), indicator s (fun a => ↑↑((Measure.condKernel ρ) a) t) a ∂Measure.fst ρ

Next tactic:
rw [lintegral_indicator _ hs]
theorem lintegral_condKernel {f : α × Ω → ℝ≥0∞} (hf : Measurable f) :
    ∫⁻ a, ∫⁻ ω, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x, f x ∂ρ := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
⊢ ∫⁻ (a : α), ∫⁻ (ω : Ω), f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ = ∫⁻ (x : α × Ω), f x ∂ρ

Next tactic:
conv_rhs => rw [measure_eq_compProd ρ]
theorem lintegral_condKernel {f : α × Ω → ℝ≥0∞} (hf : Measurable f) :
    ∫⁻ a, ∫⁻ ω, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x, f x ∂ρ := by
  conv_rhs => 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
| ∫⁻ (x : α × Ω), f x ∂ρ

Next tactic:
rw [measure_eq_compProd ρ]
theorem lintegral_condKernel {f : α × Ω → ℝ≥0∞} (hf : Measurable f) :
    ∫⁻ a, ∫⁻ ω, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x, f x ∂ρ := by
  conv_rhs => rw [measure_eq_compProd ρ]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
⊢ ∫⁻ (a : α), ∫⁻ (ω : Ω), f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ =
    ∫⁻ (x : α × Ω), f x ∂Measure.fst ρ ⊗ₘ Measure.condKernel ρ

Next tactic:
rw [Measure.lintegral_compProd hf]
theorem set_lintegral_condKernel {f : α × Ω → ℝ≥0∞} (hf : Measurable f) {s : Set α}
    (hs : MeasurableSet s) {t : Set Ω} (ht : MeasurableSet t) :
    ∫⁻ a in s, ∫⁻ ω in t, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x in s ×ˢ t, f x ∂ρ := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
⊢ ∫⁻ (a : α) in s, ∫⁻ (ω : Ω) in t, f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ = ∫⁻ (x : α × Ω) in s ×ˢ t, f x ∂ρ

Next tactic:
conv_rhs => rw [measure_eq_compProd ρ]
theorem set_lintegral_condKernel {f : α × Ω → ℝ≥0∞} (hf : Measurable f) {s : Set α}
    (hs : MeasurableSet s) {t : Set Ω} (ht : MeasurableSet t) :
    ∫⁻ a in s, ∫⁻ ω in t, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x in s ×ˢ t, f x ∂ρ := by
  conv_rhs => 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
| ∫⁻ (x : α × Ω) in s ×ˢ t, f x ∂ρ

Next tactic:
rw [measure_eq_compProd ρ]
theorem set_lintegral_condKernel {f : α × Ω → ℝ≥0∞} (hf : Measurable f) {s : Set α}
    (hs : MeasurableSet s) {t : Set Ω} (ht : MeasurableSet t) :
    ∫⁻ a in s, ∫⁻ ω in t, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x in s ×ˢ t, f x ∂ρ := by
  conv_rhs => rw [measure_eq_compProd ρ]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
t : Set Ω
ht : MeasurableSet t
⊢ ∫⁻ (a : α) in s, ∫⁻ (ω : Ω) in t, f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ =
    ∫⁻ (x : α × Ω) in s ×ˢ t, f x ∂Measure.fst ρ ⊗ₘ Measure.condKernel ρ

Next tactic:
rw [Measure.set_lintegral_compProd hf hs ht]
theorem set_lintegral_condKernel_univ_right {f : α × Ω → ℝ≥0∞} (hf : Measurable f) {s : Set α}
    (hs : MeasurableSet s) :
    ∫⁻ a in s, ∫⁻ ω, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x in s ×ˢ univ, f x ∂ρ := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
⊢ ∫⁻ (a : α) in s, ∫⁻ (ω : Ω), f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ = ∫⁻ (x : α × Ω) in s ×ˢ univ, f x ∂ρ

Next tactic:
rw [← set_lintegral_condKernel ρ hf hs MeasurableSet.univ]
theorem set_lintegral_condKernel_univ_right {f : α × Ω → ℝ≥0∞} (hf : Measurable f) {s : Set α}
    (hs : MeasurableSet s) :
    ∫⁻ a in s, ∫⁻ ω, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x in s ×ˢ univ, f x ∂ρ := by
  rw [← set_lintegral_condKernel ρ hf hs MeasurableSet.univ]; 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
s : Set α
hs : MeasurableSet s
⊢ ∫⁻ (a : α) in s, ∫⁻ (ω : Ω), f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ =
    ∫⁻ (a : α) in s, ∫⁻ (ω : Ω) in univ, f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ

Next tactic:
simp_rw [Measure.restrict_univ]
theorem set_lintegral_condKernel_univ_left {f : α × Ω → ℝ≥0∞} (hf : Measurable f) {t : Set Ω}
    (ht : MeasurableSet t) :
    ∫⁻ a, ∫⁻ ω in t, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x in univ ×ˢ t, f x ∂ρ := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
t : Set Ω
ht : MeasurableSet t
⊢ ∫⁻ (a : α), ∫⁻ (ω : Ω) in t, f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ = ∫⁻ (x : α × Ω) in univ ×ˢ t, f x ∂ρ

Next tactic:
rw [← set_lintegral_condKernel ρ hf MeasurableSet.univ ht]
theorem set_lintegral_condKernel_univ_left {f : α × Ω → ℝ≥0∞} (hf : Measurable f) {t : Set Ω}
    (ht : MeasurableSet t) :
    ∫⁻ a, ∫⁻ ω in t, f (a, ω) ∂ρ.condKernel a ∂ρ.fst = ∫⁻ x in univ ×ˢ t, f x ∂ρ := by
  rw [← set_lintegral_condKernel ρ hf MeasurableSet.univ ht]; 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝³ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → ℝ≥0∞
hf : Measurable f
t : Set Ω
ht : MeasurableSet t
⊢ ∫⁻ (a : α), ∫⁻ (ω : Ω) in t, f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ =
    ∫⁻ (a : α) in univ, ∫⁻ (ω : Ω) in t, f (a, ω) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ

Next tactic:
simp_rw [Measure.restrict_univ]
theorem _root_.MeasureTheory.AEStronglyMeasurable.integral_condKernel {ρ : Measure (α × Ω)}
    [IsFiniteMeasure ρ] {f : α × Ω → E} (hf : AEStronglyMeasurable f ρ) :
    AEStronglyMeasurable (fun x => ∫ y, f (x, y) ∂ρ.condKernel x) ρ.fst := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁷ : MeasurableSpace Ω
inst✝⁶ : StandardBorelSpace Ω
inst✝⁵ : Nonempty Ω
ρ✝ : Measure (α × Ω)
inst✝⁴ : IsFiniteMeasure ρ✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → E
hf : AEStronglyMeasurable f ρ
⊢ AEStronglyMeasurable (fun x => ∫ (y : Ω), f (x, y) ∂(Measure.condKernel ρ) x) (Measure.fst ρ)

Next tactic:
rw [measure_eq_compProd ρ] at hf
theorem _root_.MeasureTheory.AEStronglyMeasurable.integral_condKernel {ρ : Measure (α × Ω)}
    [IsFiniteMeasure ρ] {f : α × Ω → E} (hf : AEStronglyMeasurable f ρ) :
    AEStronglyMeasurable (fun x => ∫ y, f (x, y) ∂ρ.condKernel x) ρ.fst := by
  rw [measure_eq_compProd ρ] at hf
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁷ : MeasurableSpace Ω
inst✝⁶ : StandardBorelSpace Ω
inst✝⁵ : Nonempty Ω
ρ✝ : Measure (α × Ω)
inst✝⁴ : IsFiniteMeasure ρ✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → E
hf : AEStronglyMeasurable f (Measure.fst ρ ⊗ₘ Measure.condKernel ρ)
⊢ AEStronglyMeasurable (fun x => ∫ (y : Ω), f (x, y) ∂(Measure.condKernel ρ) x) (Measure.fst ρ)

Next tactic:
exact AEStronglyMeasurable.integral_kernel_compProd hf
theorem integral_condKernel {ρ : Measure (α × Ω)} [IsFiniteMeasure ρ] {f : α × Ω → E}
    (hf : Integrable f ρ) : ∫ a, ∫ x, f (a, x) ∂ρ.condKernel a ∂ρ.fst = ∫ ω, f ω ∂ρ := by
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁷ : MeasurableSpace Ω
inst✝⁶ : StandardBorelSpace Ω
inst✝⁵ : Nonempty Ω
ρ✝ : Measure (α × Ω)
inst✝⁴ : IsFiniteMeasure ρ✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → E
hf : Integrable f
⊢ ∫ (a : α), ∫ (x : Ω), f (a, x) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ = ∫ (ω : α × Ω), f ω ∂ρ

Next tactic:
conv_rhs => rw [measure_eq_compProd ρ]
theorem integral_condKernel {ρ : Measure (α × Ω)} [IsFiniteMeasure ρ] {f : α × Ω → E}
    (hf : Integrable f ρ) : ∫ a, ∫ x, f (a, x) ∂ρ.condKernel a ∂ρ.fst = ∫ ω, f ω ∂ρ := by
  conv_rhs => 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁷ : MeasurableSpace Ω
inst✝⁶ : StandardBorelSpace Ω
inst✝⁵ : Nonempty Ω
ρ✝ : Measure (α × Ω)
inst✝⁴ : IsFiniteMeasure ρ✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → E
hf : Integrable f
| ∫ (ω : α × Ω), f ω ∂ρ

Next tactic:
rw [measure_eq_compProd ρ]
theorem integral_condKernel {ρ : Measure (α × Ω)} [IsFiniteMeasure ρ] {f : α × Ω → E}
    (hf : Integrable f ρ) : ∫ a, ∫ x, f (a, x) ∂ρ.condKernel a ∂ρ.fst = ∫ ω, f ω ∂ρ := by
  conv_rhs => rw [measure_eq_compProd ρ]
  

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁷ : MeasurableSpace Ω
inst✝⁶ : StandardBorelSpace Ω
inst✝⁵ : Nonempty Ω
ρ✝ : Measure (α × Ω)
inst✝⁴ : IsFiniteMeasure ρ✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
ρ : Measure (α × Ω)
inst✝ : IsFiniteMeasure ρ
f : α × Ω → E
hf : Integrable f
⊢ ∫ (a : α), ∫ (x : Ω), f (a, x) ∂(Measure.condKernel ρ) a ∂Measure.fst ρ =
    ∫ (ω : α × Ω), f ω ∂Measure.fst ρ ⊗ₘ Measure.condKernel ρ

Next tactic:
have hf': Integrable f (ρ.fst ⊗ₘ ρ.condKernel) := by rwa [measure_eq_compProd ρ] at hf