l3lab/ntp-mathlib huggingface dataset:
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      

Proof state:
case hρ''.h.e_f.h
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
s : Set (α × ℝ)
hs : MeasurableSet s
x : α
⊢ ↑↑(κ x) (Prod.mk x ⁻¹' (Prod.map id f ⁻¹' s)) = ↑↑(Measure.map f (κ x)) (Prod.mk x ⁻¹' s)

Next tactic:
rw [Measure.map_apply hf.measurable]
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · 

Proof state:
case hρ''.h.e_f.h
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
s : Set (α × ℝ)
hs : MeasurableSet s
x : α
⊢ ↑↑(κ x) (Prod.mk x ⁻¹' (Prod.map id f ⁻¹' s)) = ↑↑(κ x) (f ⁻¹' (Prod.mk x ⁻¹' s))

Next tactic:
rfl
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · 

Proof state:
case hρ''.h.e_f.h
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
s : Set (α × ℝ)
hs : MeasurableSet s
x : α
⊢ MeasurableSet (Prod.mk x ⁻¹' s)

Next tactic:
exact measurable_prod_mk_left hs
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
s : Set (α × ℝ)
hs : MeasurableSet s
⊢ Measure.fst (Measure.map (Prod.map id f) ρ) = Measure.fst ρ

Next tactic:
rw [Measure.fst_map_prod_mk]
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · rw [Measure.fst_map_prod_mk]
      · 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
s : Set (α × ℝ)
hs : MeasurableSet s
⊢ Measure.map (fun a => (Prod.map id f a).1) ρ = Measure.fst ρ

Next tactic:
simp only [Prod_map, id_eq]
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · rw [Measure.fst_map_prod_mk]
      · simp only [Prod_map, id_eq]; 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
s : Set (α × ℝ)
hs : MeasurableSet s
⊢ Measure.map (fun a => a.1) ρ = Measure.fst ρ

Next tactic:
rfl
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · rw [Measure.fst_map_prod_mk]
      · simp only [Prod_map, id_eq]; rfl
      · 

Proof state:
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
s : Set (α × ℝ)
hs : MeasurableSet s
⊢ Measurable fun a => (Prod.map id f a).2

Next tactic:
exact (hf.measurable.comp measurable_snd)
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · rw [Measure.fst_map_prod_mk]
      · simp only [Prod_map, id_eq]; rfl
      · exact (hf.measurable.comp measurable_snd)
  

Proof state:
case intro
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
hρ'' : ∀ᵐ (x : α) ∂Measure.fst ρ', (kernel.map κ f (_ : Measurable f)) x = (Measure.condKernel ρ') x
⊢ ∀ᵐ (x : α) ∂Measure.fst ρ, κ x = (Measure.condKernel ρ) x

Next tactic:
rw [hρ'] at hρ''
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · rw [Measure.fst_map_prod_mk]
      · simp only [Prod_map, id_eq]; rfl
      · exact (hf.measurable.comp measurable_snd)
  rw [hρ'] at hρ''
  

Proof state:
case intro
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
hρ'' : ∀ᵐ (x : α) ∂Measure.fst ρ, (kernel.map κ f (_ : Measurable f)) x = (Measure.condKernel ρ') x
⊢ ∀ᵐ (x : α) ∂Measure.fst ρ, κ x = (Measure.condKernel ρ) x

Next tactic:
suffices : ∀ᵐ x ∂ρ.fst, ∀ s, MeasurableSet s →
    ((ρ.map (Prod.map id f)).condKernel x) s = (ρ.condKernel x) (f ⁻¹' s)
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · rw [Measure.fst_map_prod_mk]
      · simp only [Prod_map, id_eq]; rfl
      · exact (hf.measurable.comp measurable_snd)
  rw [hρ'] at hρ''
  suffices : ∀ᵐ x ∂ρ.fst, ∀ s, MeasurableSet s →
    ((ρ.map (Prod.map id f)).condKernel x) s = (ρ.condKernel x) (f ⁻¹' s)
  · 

Proof state:
case intro
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
hρ'' : ∀ᵐ (x : α) ∂Measure.fst ρ, (kernel.map κ f (_ : Measurable f)) x = (Measure.condKernel ρ') x
this :
  ∀ᵐ (x : α) ∂Measure.fst ρ,
    ∀ (s : Set ℝ),
      MeasurableSet s →
        ↑↑((Measure.condKernel (Measure.map (Prod.map id f) ρ)) x) s = ↑↑((Measure.condKernel ρ) x) (f ⁻¹' s)
⊢ ∀ᵐ (x : α) ∂Measure.fst ρ, κ x = (Measure.condKernel ρ) x

Next tactic:
filter_upwards [hρ'', this] with x hx h
/-- A finite kernel which satisfies the disintegration property is almost everywhere equal to the
disintegration kernel. -/
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ]
    (hκ : ρ = ρ.fst ⊗ₘ κ) :
    ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transporting the question to `ℝ` from `Ω` using `exists_measurableEmbedding_real`
-- and then constructing a measure on `α × ℝ` using the obtained measurable embedding
  obtain ⟨f, hf⟩ := exists_measurableEmbedding_real Ω
  set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def
  have hρ' : ρ'.fst = ρ.fst
  · ext s hs
    rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply]
    exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd,
      measurable_fst hs, hs, hs]
  have hρ'' : ∀ᵐ x ∂ρ'.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x
  · refine' eq_condKernel_of_measure_eq_compProd_real ρ' (kernel.map κ f hf.measurable) _
    ext s hs
    simp only [Measure.map_apply (measurable_id.prod_map hf.measurable) hs]
    conv_lhs => congr; rw [hκ]
    rw [Measure.compProd_apply hs, Measure.compProd_apply
      (measurable_id.prod_map hf.measurable hs), (_ : (ρ.map (Prod.map id f)).fst = ρ.fst)]
    · congr
      ext x
      simp only [Set.mem_preimage, Prod_map, id_eq, kernel.prodMkLeft_apply, kernel.map_apply]
      rw [Measure.map_apply hf.measurable]
      · rfl
      · exact measurable_prod_mk_left hs
    · rw [Measure.fst_map_prod_mk]
      · simp only [Prod_map, id_eq]; rfl
      · exact (hf.measurable.comp measurable_snd)
  rw [hρ'] at hρ''
  suffices : ∀ᵐ x ∂ρ.fst, ∀ s, MeasurableSet s →
    ((ρ.map (Prod.map id f)).condKernel x) s = (ρ.condKernel x) (f ⁻¹' s)
  · filter_upwards [hρ'', this] with x hx h
    

Proof state:
case h
α : Type u_1
mα : MeasurableSpace α
Ω : Type u_2
inst✝⁴ : MeasurableSpace Ω
inst✝³ : StandardBorelSpace Ω
inst✝² : Nonempty Ω
ρ : Measure (α × Ω)
inst✝¹ : IsFiniteMeasure ρ
κ : ↥(kernel α Ω)
inst✝ : IsFiniteKernel κ
hκ : ρ = Measure.fst ρ ⊗ₘ κ
f : Ω → ℝ
hf : MeasurableEmbedding f
ρ' : Measure (α × ℝ) := Measure.map (Prod.map id f) ρ
hρ'def : ρ' = Measure.map (Prod.map id f) ρ
hρ' : Measure.fst ρ' = Measure.fst ρ
hρ'' : ∀ᵐ (x : α) ∂Measure.fst ρ, (kernel.map κ f (_ : Measurable f)) x = (Measure.condKernel ρ') x
this :
  ∀ᵐ (x : α) ∂Measure.fst ρ,
    ∀ (s : Set ℝ),
      MeasurableSet s →
        ↑↑((Measure.condKernel (Measure.map (Prod.map id f) ρ)) x) s = ↑↑((Measure.condKernel ρ) x) (f ⁻¹' s)
x : α
hx : (kernel.map κ f (_ : Measurable f)) x = (Measure.condKernel ρ') x
h :
  ∀ (s : Set ℝ),
    MeasurableSet s →
      ↑↑((Measure.condKernel (Measure.map (Prod.map id f) ρ)) x) s = ↑↑((Measure.condKernel ρ) x) (f ⁻¹' s)
⊢ κ x = (Measure.condKernel ρ) x

Next tactic:
rw [kernel.map_apply] at hx