measure_theory.constructions.prod.basicMathlib.MeasureTheory.Constructions.Prod.Basic

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

feat(probability/kernel/cond_distrib): regular conditional probability distributions (#19090)

We define the regular conditional probability distribution cond_distrib Y X μ of Y : α → Ω given X : α → β, where Ω is a standard Borel space. This is a kernel β Ω such that for almost all a, for all measurable set s, cond_distrib Y X μ (X a) s is equal to the conditional expectation μ⟦Y ⁻¹' s | mβ.comap X⟧ evaluated at a.

Also define the above notation for the conditional expectation of the indicator of a set.

Co-authored-by: Rémy Degenne <remydegenne@gmail.com>

Diff
@@ -749,6 +749,21 @@ instance [is_finite_measure ρ] : is_finite_measure ρ.fst := by { rw fst, apply
 instance [is_probability_measure ρ] : is_probability_measure ρ.fst :=
 { measure_univ := by { rw fst_univ, exact measure_univ, } }
 
+lemma fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : measure α}
+  (hX : ae_measurable X μ) (hY : ae_measurable Y μ) :
+  (μ.map (λ a, (X a, Y a))).fst = μ.map X :=
+begin
+  ext1 s hs,
+  rw [measure.fst_apply hs, measure.map_apply_of_ae_measurable (hX.prod_mk hY) (measurable_fst hs),
+    measure.map_apply_of_ae_measurable hX hs, ← prod_univ, mk_preimage_prod, preimage_univ,
+    inter_univ],
+end
+
+lemma fst_map_prod_mk {X : α → β} {Y : α → γ} {μ : measure α}
+  (hX : measurable X) (hY : measurable Y) :
+  (μ.map (λ a, (X a, Y a))).fst = μ.map X :=
+fst_map_prod_mk₀ hX.ae_measurable hY.ae_measurable
+
 /-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map prod.snd`. -/
 noncomputable
 def snd (ρ : measure (α × β)) : measure β := ρ.map prod.snd
@@ -764,6 +779,21 @@ instance [is_finite_measure ρ] : is_finite_measure ρ.snd := by { rw snd, apply
 instance [is_probability_measure ρ] : is_probability_measure ρ.snd :=
 { measure_univ := by { rw snd_univ, exact measure_univ, } }
 
+lemma snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : measure α}
+  (hX : ae_measurable X μ) (hY : ae_measurable Y μ) :
+  (μ.map (λ a, (X a, Y a))).snd = μ.map Y :=
+begin
+  ext1 s hs,
+  rw [measure.snd_apply hs, measure.map_apply_of_ae_measurable (hX.prod_mk hY) (measurable_snd hs),
+    measure.map_apply_of_ae_measurable hY hs, ← univ_prod, mk_preimage_prod, preimage_univ,
+    univ_inter],
+end
+
+lemma snd_map_prod_mk {X : α → β} {Y : α → γ} {μ : measure α}
+  (hX : measurable X) (hY : measurable Y) :
+  (μ.map (λ a, (X a, Y a))).snd = μ.map Y :=
+snd_map_prod_mk₀ hX.ae_measurable hY.ae_measurable
+
 end measure
 
 

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -78,7 +78,7 @@ theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C
     (hD : IsPiSystem D) : IsPiSystem (image2 (· ×ˢ ·) C D) :=
   by
   rintro _ ⟨s₁, t₁, hs₁, ht₁, rfl⟩ _ ⟨s₂, t₂, hs₂, ht₂, rfl⟩ hst
-  rw [prod_inter_prod] at hst ⊢; rw [prod_nonempty_iff] at hst 
+  rw [prod_inter_prod] at hst ⊢; rw [prod_nonempty_iff] at hst
   exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2)
 #align is_pi_system.prod IsPiSystem.prod
 -/
@@ -442,7 +442,7 @@ instance {α β : Type _} [TopologicalSpace α] [TopologicalSpace β] {mα : Mea
 
 #print MeasureTheory.Measure.ae_measure_lt_top /-
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.Prod ν) s ≠ ∞) :
-    ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by simp_rw [prod_apply hs] at h2s ;
+    ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by simp_rw [prod_apply hs] at h2s;
   refine' ae_lt_top (measurable_measure_prod_mk_left hs) h2s
 #align measure_theory.measure.ae_measure_lt_top MeasureTheory.Measure.ae_measure_lt_top
 -/
@@ -463,7 +463,7 @@ theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.Prod ν s = 0)
     (fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0 :=
   by
   obtain ⟨t, hst, mt, ht⟩ := exists_measurable_superset_of_null h
-  simp_rw [measure_prod_null mt] at ht 
+  simp_rw [measure_prod_null mt] at ht
   rw [eventually_le_antisymm_iff]
   exact
     ⟨eventually_le.trans_eq (eventually_of_forall fun x => (measure_mono (preimage_mono hst) : _))
@@ -594,7 +594,7 @@ theorem prodAssoc_prod [SigmaFinite τ] :
     (prod_eq_generateFrom generate_from_measurable_set generateFrom_prod is_pi_system_measurable_set
         isPiSystem_prod μ.to_finite_spanning_sets_in
         (ν.to_finite_spanning_sets_in.prod τ.to_finite_spanning_sets_in) _).symm
-  rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_set_of_eq] at hs ht hu 
+  rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_set_of_eq] at hs ht hu
   simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)),
     MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod,
     mul_assoc]
@@ -802,7 +802,7 @@ section
 #print AEMeasurable.prod_swap /-
 theorem AEMeasurable.prod_swap [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ}
     (hf : AEMeasurable f (ν.Prod μ)) : AEMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) := by
-  rw [← prod_swap] at hf ; exact hf.comp_measurable measurable_swap
+  rw [← prod_swap] at hf; exact hf.comp_measurable measurable_swap
 #align ae_measurable.prod_swap AEMeasurable.prod_swap
 -/
 
@@ -831,7 +831,7 @@ variable [SigmaFinite ν]
 
 #print MeasureTheory.lintegral_prod_swap /-
 theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
-    ∫⁻ z, f z.symm ∂ν.Prod μ = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf ;
+    ∫⁻ z, f z.symm ∂ν.Prod μ = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf;
   rw [← lintegral_map' hf measurable_swap.ae_measurable, prod_swap]
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
 -/
Diff
@@ -720,13 +720,34 @@ theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : M
     {g : α → γ → δ} (hgm : Measurable (uncurry g)) (hg : ∀ᵐ x ∂μa, map (g x) μc = μd) :
     MeasurePreserving (fun p : α × γ => (f p.1, g p.1 p.2)) (μa.Prod μc) (μb.Prod μd) := by
   classical
+  have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prod_mk hgm
+  /- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
+    to deduce `sigma_finite μc`. -/
+  rcases eq_or_ne μa 0 with (rfl | ha)
+  · rw [← hf.map_eq, zero_prod, measure.map_zero, zero_prod]
+    exact ⟨this, by simp only [measure.map_zero]⟩
+  have : sigma_finite μc :=
+    by
+    rcases(ae_ne_bot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩
+    exact sigma_finite.of_map _ hgm.of_uncurry_left.ae_measurable (by rwa [hx])
+  -- Thus we can apply `measure.prod_eq` to prove equality of measures.
+  refine' ⟨this, (prod_eq fun s t hs ht => _).symm⟩
+  rw [map_apply this (hs.prod ht)]
+  refine' (prod_apply (this <| hs.prod ht)).trans _
+  have :
+    ∀ᵐ x ∂μa, μc ((fun y => (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (fun y => μd t) x :=
+    by
+    refine' hg.mono fun x hx => _; subst hx
+    simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage]
+    split_ifs
+    exacts [(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
+  simp only [preimage_preimage]
+  rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const,
+    hf.measure_preimage hs, mul_comm]
 #align measure_theory.measure_preserving.skew_product MeasureTheory.MeasurePreserving.skew_product
 -/
 
 #print MeasureTheory.MeasurePreserving.prod /-
-/- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
-  to deduce `sigma_finite μc`. -/
--- Thus we can apply `measure.prod_eq` to prove equality of measures.
 /-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
 then `prod.map f g` sends `μa.prod μc` to `μb.prod μd`. -/
 protected theorem prod [SigmaFinite μb] [SigmaFinite μd] {f : α → β} {g : γ → δ}
Diff
@@ -720,34 +720,13 @@ theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : M
     {g : α → γ → δ} (hgm : Measurable (uncurry g)) (hg : ∀ᵐ x ∂μa, map (g x) μc = μd) :
     MeasurePreserving (fun p : α × γ => (f p.1, g p.1 p.2)) (μa.Prod μc) (μb.Prod μd) := by
   classical
-  have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prod_mk hgm
-  /- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
-    to deduce `sigma_finite μc`. -/
-  rcases eq_or_ne μa 0 with (rfl | ha)
-  · rw [← hf.map_eq, zero_prod, measure.map_zero, zero_prod]
-    exact ⟨this, by simp only [measure.map_zero]⟩
-  have : sigma_finite μc :=
-    by
-    rcases(ae_ne_bot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩
-    exact sigma_finite.of_map _ hgm.of_uncurry_left.ae_measurable (by rwa [hx])
-  -- Thus we can apply `measure.prod_eq` to prove equality of measures.
-  refine' ⟨this, (prod_eq fun s t hs ht => _).symm⟩
-  rw [map_apply this (hs.prod ht)]
-  refine' (prod_apply (this <| hs.prod ht)).trans _
-  have :
-    ∀ᵐ x ∂μa, μc ((fun y => (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (fun y => μd t) x :=
-    by
-    refine' hg.mono fun x hx => _; subst hx
-    simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage]
-    split_ifs
-    exacts [(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
-  simp only [preimage_preimage]
-  rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const,
-    hf.measure_preimage hs, mul_comm]
 #align measure_theory.measure_preserving.skew_product MeasureTheory.MeasurePreserving.skew_product
 -/
 
 #print MeasureTheory.MeasurePreserving.prod /-
+/- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
+  to deduce `sigma_finite μc`. -/
+-- Thus we can apply `measure.prod_eq` to prove equality of measures.
 /-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
 then `prod.map f g` sends `μa.prod μc` to `μb.prod μd`. -/
 protected theorem prod [SigmaFinite μb] [SigmaFinite μd] {f : α → β} {g : γ → δ}
Diff
@@ -649,22 +649,22 @@ theorem dirac_prod_dirac {x : α} {y : β} : (dirac x).Prod (dirac y) = dirac (x
 #align measure_theory.measure.dirac_prod_dirac MeasureTheory.Measure.dirac_prod_dirac
 -/
 
-#print MeasureTheory.Measure.prod_sum /-
-theorem prod_sum {ι : Type _} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] :
+#print MeasureTheory.Measure.prod_sum_right /-
+theorem prod_sum_right {ι : Type _} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] :
     μ.Prod (sum ν) = sum fun i => μ.Prod (ν i) :=
   by
   refine' prod_eq fun s t hs ht => _
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ ht, prod_prod, ENNReal.tsum_mul_left]
-#align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum
+#align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum_right
 -/
 
-#print MeasureTheory.Measure.sum_prod /-
-theorem sum_prod {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
+#print MeasureTheory.Measure.prod_sum_left /-
+theorem prod_sum_left {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
     (sum μ).Prod ν = sum fun i => (μ i).Prod ν :=
   by
   refine' prod_eq fun s t hs ht => _
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ENNReal.tsum_mul_right]
-#align measure_theory.measure.sum_prod MeasureTheory.Measure.sum_prod
+#align measure_theory.measure.sum_prod MeasureTheory.Measure.prod_sum_left
 -/
 
 #print MeasureTheory.Measure.prod_add /-
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2020 Floris van Doorn. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn
 -/
-import Mathbin.MeasureTheory.Measure.GiryMonad
-import Mathbin.Dynamics.Ergodic.MeasurePreserving
-import Mathbin.MeasureTheory.Integral.Lebesgue
-import Mathbin.MeasureTheory.Measure.OpenPos
+import MeasureTheory.Measure.GiryMonad
+import Dynamics.Ergodic.MeasurePreserving
+import MeasureTheory.Integral.Lebesgue
+import MeasureTheory.Measure.OpenPos
 
 #align_import measure_theory.constructions.prod.basic from "leanprover-community/mathlib"@"00abe0695d8767201e6d008afa22393978bb324d"
 
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2020 Floris van Doorn. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn
-
-! This file was ported from Lean 3 source module measure_theory.constructions.prod.basic
-! leanprover-community/mathlib commit 00abe0695d8767201e6d008afa22393978bb324d
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.MeasureTheory.Measure.GiryMonad
 import Mathbin.Dynamics.Ergodic.MeasurePreserving
 import Mathbin.MeasureTheory.Integral.Lebesgue
 import Mathbin.MeasureTheory.Measure.OpenPos
 
+#align_import measure_theory.constructions.prod.basic from "leanprover-community/mathlib"@"00abe0695d8767201e6d008afa22393978bb324d"
+
 /-!
 # The product measure
 
Diff
@@ -961,6 +961,7 @@ instance [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.fst := by rw [fst]; infer_ins
 instance [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.fst
     where measure_univ := by rw [fst_univ]; exact measure_univ
 
+#print MeasureTheory.Measure.fst_map_prod_mk₀ /-
 theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
     (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).fst = μ.map X :=
   by
@@ -969,11 +970,14 @@ theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX
     measure.map_apply_of_ae_measurable hX hs, ← prod_univ, mk_preimage_prod, preimage_univ,
     inter_univ]
 #align measure_theory.measure.fst_map_prod_mk₀ MeasureTheory.Measure.fst_map_prod_mk₀
+-/
 
+#print MeasureTheory.Measure.fst_map_prod_mk /-
 theorem fst_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
     (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).fst = μ.map X :=
   fst_map_prod_mk₀ hX.AEMeasurable hY.AEMeasurable
 #align measure_theory.measure.fst_map_prod_mk MeasureTheory.Measure.fst_map_prod_mk
+-/
 
 #print MeasureTheory.Measure.snd /-
 /-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map prod.snd`. -/
@@ -998,6 +1002,7 @@ instance [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.snd := by rw [snd]; infer_ins
 instance [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.snd
     where measure_univ := by rw [snd_univ]; exact measure_univ
 
+#print MeasureTheory.Measure.snd_map_prod_mk₀ /-
 theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
     (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).snd = μ.map Y :=
   by
@@ -1006,11 +1011,14 @@ theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX
     measure.map_apply_of_ae_measurable hY hs, ← univ_prod, mk_preimage_prod, preimage_univ,
     univ_inter]
 #align measure_theory.measure.snd_map_prod_mk₀ MeasureTheory.Measure.snd_map_prod_mk₀
+-/
 
+#print MeasureTheory.Measure.snd_map_prod_mk /-
 theorem snd_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
     (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).snd = μ.map Y :=
   snd_map_prod_mk₀ hX.AEMeasurable hY.AEMeasurable
 #align measure_theory.measure.snd_map_prod_mk MeasureTheory.Measure.snd_map_prod_mk
+-/
 
 end Measure
 
Diff
@@ -75,6 +75,7 @@ open Filter hiding prod_eq map
 variable {α α' β β' γ E : Type _}
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
+#print IsPiSystem.prod /-
 /-- Rectangles formed by π-systems form a π-system. -/
 theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C)
     (hD : IsPiSystem D) : IsPiSystem (image2 (· ×ˢ ·) C D) :=
@@ -83,9 +84,11 @@ theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C
   rw [prod_inter_prod] at hst ⊢; rw [prod_nonempty_iff] at hst 
   exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2)
 #align is_pi_system.prod IsPiSystem.prod
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
+#print IsCountablySpanning.prod /-
 /-- Rectangles of countably spanning sets are countably spanning. -/
 theorem IsCountablySpanning.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C)
     (hD : IsCountablySpanning D) : IsCountablySpanning (image2 (· ×ˢ ·) C D) :=
@@ -94,6 +97,7 @@ theorem IsCountablySpanning.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsC
   refine' ⟨fun n => s n.unpair.1 ×ˢ t n.unpair.2, fun n => mem_image2_of_mem (h1s _) (h1t _), _⟩
   rw [Union_unpair_prod, h2s, h2t, univ_prod_univ]
 #align is_countably_spanning.prod IsCountablySpanning.prod
+-/
 
 variable [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace β']
 
@@ -112,6 +116,7 @@ along one of the variables (using either the Lebesgue or Bochner integral) is me
 
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
+#print generateFrom_prod_eq /-
 /-- The product of generated σ-algebras is the one generated by rectangles, if both generating sets
   are countably spanning. -/
 theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C)
@@ -137,8 +142,10 @@ theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC :
     · exact measurable_set_generate_from hs
     · exact measurable_set_generate_from ht
 #align generate_from_prod_eq generateFrom_prod_eq
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
+#print generateFrom_eq_prod /-
 /-- If `C` and `D` generate the σ-algebras on `α` resp. `β`, then rectangles formed by `C` and `D`
   generate the σ-algebra on `α × β`. -/
 theorem generateFrom_eq_prod {C : Set (Set α)} {D : Set (Set β)} (hC : generateFrom C = ‹_›)
@@ -146,8 +153,10 @@ theorem generateFrom_eq_prod {C : Set (Set α)} {D : Set (Set β)} (hC : generat
     generateFrom (image2 (· ×ˢ ·) C D) = Prod.instMeasurableSpace := by
   rw [← hC, ← hD, generateFrom_prod_eq h2C h2D]
 #align generate_from_eq_prod generateFrom_eq_prod
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
+#print generateFrom_prod /-
 /-- The product σ-algebra is generated from boxes, i.e. `s ×ˢ t` for sets `s : set α` and
   `t : set β`. -/
 theorem generateFrom_prod :
@@ -156,13 +165,16 @@ theorem generateFrom_prod :
   generateFrom_eq_prod generateFrom_measurableSet generateFrom_measurableSet
     isCountablySpanning_measurableSet isCountablySpanning_measurableSet
 #align generate_from_prod generateFrom_prod
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
+#print isPiSystem_prod /-
 /-- Rectangles form a π-system. -/
 theorem isPiSystem_prod :
     IsPiSystem (image2 (· ×ˢ ·) {s : Set α | MeasurableSet s} {t : Set β | MeasurableSet t}) :=
   isPiSystem_measurableSet.Prod isPiSystem_measurableSet
 #align is_pi_system_prod isPiSystem_prod
+-/
 
 #print measurable_measure_prod_mk_left_finite /-
 /-- If `ν` is a finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
@@ -199,12 +211,14 @@ theorem measurable_measure_prod_mk_left [SigmaFinite ν] {s : Set (α × β)} (h
 #align measurable_measure_prod_mk_left measurable_measure_prod_mk_left
 -/
 
+#print measurable_measure_prod_mk_right /-
 /-- If `μ` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `y ↦ μ { x | (x, y) ∈ s }` is
   a measurable function. -/
 theorem measurable_measure_prod_mk_right {μ : Measure α} [SigmaFinite μ] {s : Set (α × β)}
     (hs : MeasurableSet s) : Measurable fun y => μ ((fun x => (x, y)) ⁻¹' s) :=
   measurable_measure_prod_mk_left (measurableSet_swap_iff.mpr hs)
 #align measurable_measure_prod_mk_right measurable_measure_prod_mk_right
+-/
 
 #print Measurable.map_prod_mk_left /-
 theorem Measurable.map_prod_mk_left [SigmaFinite ν] : Measurable fun x : α => map (Prod.mk x) ν :=
@@ -215,6 +229,7 @@ theorem Measurable.map_prod_mk_left [SigmaFinite ν] : Measurable fun x : α =>
 #align measurable.map_prod_mk_left Measurable.map_prod_mk_left
 -/
 
+#print Measurable.map_prod_mk_right /-
 theorem Measurable.map_prod_mk_right {μ : Measure α} [SigmaFinite μ] :
     Measurable fun y : β => map (fun x : α => (x, y)) μ :=
   by
@@ -222,7 +237,9 @@ theorem Measurable.map_prod_mk_right {μ : Measure α} [SigmaFinite μ] :
   simp_rw [map_apply measurable_prod_mk_right hs]
   exact measurable_measure_prod_mk_right hs
 #align measurable.map_prod_mk_right Measurable.map_prod_mk_right
+-/
 
+#print MeasurableEmbedding.prod_mk /-
 theorem MeasurableEmbedding.prod_mk {α β γ δ : Type _} {mα : MeasurableSpace α}
     {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ} {mδ : MeasurableSpace δ} {f : α → β}
     {g : γ → δ} (hg : MeasurableEmbedding g) (hf : MeasurableEmbedding f) :
@@ -253,6 +270,7 @@ theorem MeasurableEmbedding.prod_mk {α β γ δ : Type _} {mα : MeasurableSpac
       simp_rw [Set.image_iUnion]
       exact MeasurableSet.iUnion hg
 #align measurable_embedding.prod_mk MeasurableEmbedding.prod_mk
+-/
 
 #print Measurable.lintegral_prod_right' /-
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
@@ -284,13 +302,16 @@ theorem Measurable.lintegral_prod_right [SigmaFinite ν] {f : α → β → ℝ
 #align measurable.lintegral_prod_right Measurable.lintegral_prod_right
 -/
 
+#print Measurable.lintegral_prod_left' /-
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   the symmetric version of Tonelli's theorem is measurable. -/
 theorem Measurable.lintegral_prod_left' [SigmaFinite μ] {f : α × β → ℝ≥0∞} (hf : Measurable f) :
     Measurable fun y => ∫⁻ x, f (x, y) ∂μ :=
   (measurable_swap_iff.mpr hf).lintegral_prod_right'
 #align measurable.lintegral_prod_left' Measurable.lintegral_prod_left'
+-/
 
+#print Measurable.lintegral_prod_left /-
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   the symmetric version of Tonelli's theorem is measurable.
   This version has the argument `f` in curried form. -/
@@ -298,6 +319,7 @@ theorem Measurable.lintegral_prod_left [SigmaFinite μ] {f : α → β → ℝ
     (hf : Measurable (uncurry f)) : Measurable fun y => ∫⁻ x, f x y ∂μ :=
   hf.lintegral_prod_left'
 #align measurable.lintegral_prod_left Measurable.lintegral_prod_left
+-/
 
 /-! ### The product measure -/
 
@@ -322,10 +344,12 @@ instance prod.measureSpace {α β} [MeasureSpace α] [MeasureSpace β] : Measure
 
 variable [SigmaFinite ν]
 
+#print MeasureTheory.Measure.volume_eq_prod /-
 theorem volume_eq_prod (α β) [MeasureSpace α] [MeasureSpace β] :
     (volume : Measure (α × β)) = (volume : Measure α).Prod (volume : Measure β) :=
   rfl
 #align measure_theory.measure.volume_eq_prod MeasureTheory.Measure.volume_eq_prod
+-/
 
 #print MeasureTheory.Measure.prod_apply /-
 theorem prod_apply {s : Set (α × β)} (hs : MeasurableSet s) :
@@ -341,6 +365,7 @@ theorem prod_apply {s : Set (α × β)} (hs : MeasurableSet s) :
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print MeasureTheory.Measure.prod_prod /-
 /-- The product measure of the product of two sets is the product of their measures. Note that we
 do not need the sets to be measurable. -/
 @[simp]
@@ -374,6 +399,7 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.Prod ν (s ×ˢ t) = μ s * ν
       _ = μ.prod ν ST := (prod_apply hSTm).symm
       _ = μ.prod ν (s ×ˢ t) := measure_to_measurable _
 #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod
+-/
 
 instance {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y] {m : MeasurableSpace X}
     {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y} {ν : Measure Y}
@@ -417,18 +443,23 @@ instance {α β : Type _} [TopologicalSpace α] [TopologicalSpace β] {mα : Mea
     mul_lt_top (IsCompact.measure_lt_top (hK.image continuous_fst)).Ne
       (IsCompact.measure_lt_top (hK.image continuous_snd)).Ne
 
+#print MeasureTheory.Measure.ae_measure_lt_top /-
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.Prod ν) s ≠ ∞) :
     ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by simp_rw [prod_apply hs] at h2s ;
   refine' ae_lt_top (measurable_measure_prod_mk_left hs) h2s
 #align measure_theory.measure.ae_measure_lt_top MeasureTheory.Measure.ae_measure_lt_top
+-/
 
+#print MeasureTheory.Measure.measure_prod_null /-
 /-- Note: the assumption `hs` cannot be dropped. For a counterexample, see
   Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
 theorem measure_prod_null {s : Set (α × β)} (hs : MeasurableSet s) :
     μ.Prod ν s = 0 ↔ (fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0 := by
   simp_rw [prod_apply hs, lintegral_eq_zero_iff (measurable_measure_prod_mk_left hs)]
 #align measure_theory.measure.measure_prod_null MeasureTheory.Measure.measure_prod_null
+-/
 
+#print MeasureTheory.Measure.measure_ae_null_of_prod_null /-
 /-- Note: the converse is not true without assuming that `s` is measurable. For a counterexample,
   see Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
 theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.Prod ν s = 0) :
@@ -442,6 +473,7 @@ theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.Prod ν s = 0)
         ht,
       eventually_of_forall fun x => zero_le _⟩
 #align measure_theory.measure.measure_ae_null_of_prod_null MeasureTheory.Measure.measure_ae_null_of_prod_null
+-/
 
 #print MeasureTheory.Measure.AbsolutelyContinuous.prod /-
 theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν ≪ ν') :
@@ -453,12 +485,14 @@ theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν 
 #align measure_theory.measure.absolutely_continuous.prod MeasureTheory.Measure.AbsolutelyContinuous.prod
 -/
 
+#print MeasureTheory.Measure.ae_ae_of_ae_prod /-
 /-- Note: the converse is not true. For a counterexample, see
   Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
 theorem ae_ae_of_ae_prod {p : α × β → Prop} (h : ∀ᵐ z ∂μ.Prod ν, p z) :
     ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, p (x, y) :=
   measure_ae_null_of_prod_null h
 #align measure_theory.measure.ae_ae_of_ae_prod MeasureTheory.Measure.ae_ae_of_ae_prod
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
@@ -503,6 +537,7 @@ instance prod.instSigmaFinite : SigmaFinite (μ.Prod ν) :=
 -/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print MeasureTheory.Measure.prod_eq_generateFrom /-
 /-- A measure on a product space equals the product measure if they are equal on rectangles
   with as sides sets that generate the corresponding σ-algebras. -/
 theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
@@ -517,8 +552,10 @@ theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set 
   · rintro _ ⟨s, t, hs, ht, rfl⟩; haveI := h3D.sigma_finite
     rw [h₁ s hs t ht, prod_prod]
 #align measure_theory.measure.prod_eq_generate_from MeasureTheory.Measure.prod_eq_generateFrom
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print MeasureTheory.Measure.prod_eq /-
 /-- A measure on a product space equals the product measure if they are equal on rectangles. -/
 theorem prod_eq {μν : Measure (α × β)}
     (h : ∀ s t, MeasurableSet s → MeasurableSet t → μν (s ×ˢ t) = μ s * ν t) : μ.Prod ν = μν :=
@@ -526,13 +563,16 @@ theorem prod_eq {μν : Measure (α × β)}
     isPiSystem_measurableSet isPiSystem_measurableSet μ.toFiniteSpanningSetsIn
     ν.toFiniteSpanningSetsIn fun s hs t ht => h s t hs ht
 #align measure_theory.measure.prod_eq MeasureTheory.Measure.prod_eq
+-/
 
+#print MeasureTheory.Measure.prod_swap /-
 theorem prod_swap : map Prod.swap (μ.Prod ν) = ν.Prod μ :=
   by
   refine' (prod_eq _).symm
   intro s t hs ht
   simp_rw [map_apply measurable_swap (hs.prod ht), preimage_swap_prod, prod_prod, mul_comm]
 #align measure_theory.measure.prod_swap MeasureTheory.Measure.prod_swap
+-/
 
 #print MeasureTheory.Measure.measurePreserving_swap /-
 theorem measurePreserving_swap : MeasurePreserving Prod.swap (μ.Prod ν) (ν.Prod μ) :=
@@ -549,6 +589,7 @@ theorem prod_apply_symm {s : Set (α × β)} (hs : MeasurableSet s) :
 #align measure_theory.measure.prod_apply_symm MeasureTheory.Measure.prod_apply_symm
 -/
 
+#print MeasureTheory.Measure.prodAssoc_prod /-
 theorem prodAssoc_prod [SigmaFinite τ] :
     map MeasurableEquiv.prodAssoc ((μ.Prod ν).Prod τ) = μ.Prod (ν.Prod τ) :=
   by
@@ -561,11 +602,13 @@ theorem prodAssoc_prod [SigmaFinite τ] :
     MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod,
     mul_assoc]
 #align measure_theory.measure.prod_assoc_prod MeasureTheory.Measure.prodAssoc_prod
+-/
 
 /-! ### The product of specific measures -/
 
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print MeasureTheory.Measure.prod_restrict /-
 theorem prod_restrict (s : Set α) (t : Set β) :
     (μ.restrict s).Prod (ν.restrict t) = (μ.Prod ν).restrict (s ×ˢ t) :=
   by
@@ -573,32 +616,41 @@ theorem prod_restrict (s : Set α) (t : Set β) :
   rw [restrict_apply (hs'.prod ht'), prod_inter_prod, prod_prod, restrict_apply hs',
     restrict_apply ht']
 #align measure_theory.measure.prod_restrict MeasureTheory.Measure.prod_restrict
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print MeasureTheory.Measure.restrict_prod_eq_prod_univ /-
 theorem restrict_prod_eq_prod_univ (s : Set α) :
     (μ.restrict s).Prod ν = (μ.Prod ν).restrict (s ×ˢ (univ : Set β)) :=
   by
   have : ν = ν.restrict Set.univ := measure.restrict_univ.symm
   rwa [this, measure.prod_restrict, ← this]
 #align measure_theory.measure.restrict_prod_eq_prod_univ MeasureTheory.Measure.restrict_prod_eq_prod_univ
+-/
 
+#print MeasureTheory.Measure.prod_dirac /-
 theorem prod_dirac (y : β) : μ.Prod (dirac y) = map (fun x => (x, y)) μ :=
   by
   refine' prod_eq fun s t hs ht => _
   simp_rw [map_apply measurable_prod_mk_right (hs.prod ht), mk_preimage_prod_left_eq_if, measure_if,
     dirac_apply' _ ht, ← indicator_mul_right _ fun x => μ s, Pi.one_apply, mul_one]
 #align measure_theory.measure.prod_dirac MeasureTheory.Measure.prod_dirac
+-/
 
+#print MeasureTheory.Measure.dirac_prod /-
 theorem dirac_prod (x : α) : (dirac x).Prod ν = map (Prod.mk x) ν :=
   by
   refine' prod_eq fun s t hs ht => _
   simp_rw [map_apply measurable_prod_mk_left (hs.prod ht), mk_preimage_prod_right_eq_if, measure_if,
     dirac_apply' _ hs, ← indicator_mul_left _ _ fun x => ν t, Pi.one_apply, one_mul]
 #align measure_theory.measure.dirac_prod MeasureTheory.Measure.dirac_prod
+-/
 
+#print MeasureTheory.Measure.dirac_prod_dirac /-
 theorem dirac_prod_dirac {x : α} {y : β} : (dirac x).Prod (dirac y) = dirac (x, y) := by
   rw [prod_dirac, map_dirac measurable_prod_mk_right]
 #align measure_theory.measure.dirac_prod_dirac MeasureTheory.Measure.dirac_prod_dirac
+-/
 
 #print MeasureTheory.Measure.prod_sum /-
 theorem prod_sum {ι : Type _} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] :
@@ -609,12 +661,14 @@ theorem prod_sum {ι : Type _} [Finite ι] (ν : ι → Measure β) [∀ i, Sigm
 #align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum
 -/
 
+#print MeasureTheory.Measure.sum_prod /-
 theorem sum_prod {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
     (sum μ).Prod ν = sum fun i => (μ i).Prod ν :=
   by
   refine' prod_eq fun s t hs ht => _
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ENNReal.tsum_mul_right]
 #align measure_theory.measure.sum_prod MeasureTheory.Measure.sum_prod
+-/
 
 #print MeasureTheory.Measure.prod_add /-
 theorem prod_add (ν' : Measure β) [SigmaFinite ν'] : μ.Prod (ν + ν') = μ.Prod ν + μ.Prod ν' := by
@@ -622,9 +676,11 @@ theorem prod_add (ν' : Measure β) [SigmaFinite ν'] : μ.Prod (ν + ν') = μ.
 #align measure_theory.measure.prod_add MeasureTheory.Measure.prod_add
 -/
 
+#print MeasureTheory.Measure.add_prod /-
 theorem add_prod (μ' : Measure α) [SigmaFinite μ'] : (μ + μ').Prod ν = μ.Prod ν + μ'.Prod ν := by
   refine' prod_eq fun s t hs ht => _; simp_rw [add_apply, prod_prod, right_distrib]
 #align measure_theory.measure.add_prod MeasureTheory.Measure.add_prod
+-/
 
 #print MeasureTheory.Measure.zero_prod /-
 @[simp]
@@ -633,10 +689,13 @@ theorem zero_prod (ν : Measure β) : (0 : Measure α).Prod ν = 0 := by rw [mea
 #align measure_theory.measure.zero_prod MeasureTheory.Measure.zero_prod
 -/
 
+#print MeasureTheory.Measure.prod_zero /-
 @[simp]
 theorem prod_zero (μ : Measure α) : μ.Prod (0 : Measure β) = 0 := by simp [measure.prod]
 #align measure_theory.measure.prod_zero MeasureTheory.Measure.prod_zero
+-/
 
+#print MeasureTheory.Measure.map_prod_map /-
 theorem map_prod_map {δ} [MeasurableSpace δ] {f : α → β} {g : γ → δ} {μa : Measure α}
     {μc : Measure γ} (hfa : SigmaFinite (map f μa)) (hgc : SigmaFinite (map g μc))
     (hf : Measurable f) (hg : Measurable g) :
@@ -647,6 +706,7 @@ theorem map_prod_map {δ} [MeasurableSpace δ] {f : α → β} {g : γ → δ} {
   rw [map_apply (hf.prod_map hg) (hs.prod ht), map_apply hf hs, map_apply hg ht]
   exact prod_prod (f ⁻¹' s) (g ⁻¹' t)
 #align measure_theory.measure.map_prod_map MeasureTheory.Measure.map_prod_map
+-/
 
 end Measure
 
@@ -658,6 +718,7 @@ variable {δ : Type _} [MeasurableSpace δ] {μa : Measure α} {μb : Measure β
   {μd : Measure δ}
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print MeasureTheory.MeasurePreserving.skew_product /-
 theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : MeasurePreserving f μa μb)
     {g : α → γ → δ} (hgm : Measurable (uncurry g)) (hg : ∀ᵐ x ∂μa, map (g x) μc = μd) :
     MeasurePreserving (fun p : α × γ => (f p.1, g p.1 p.2)) (μa.Prod μc) (μb.Prod μd) := by
@@ -687,7 +748,9 @@ theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : M
   rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const,
     hf.measure_preimage hs, mul_comm]
 #align measure_theory.measure_preserving.skew_product MeasureTheory.MeasurePreserving.skew_product
+-/
 
+#print MeasureTheory.MeasurePreserving.prod /-
 /-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
 then `prod.map f g` sends `μa.prod μc` to `μb.prod μd`. -/
 protected theorem prod [SigmaFinite μb] [SigmaFinite μd] {f : α → β} {g : γ → δ}
@@ -696,11 +759,13 @@ protected theorem prod [SigmaFinite μb] [SigmaFinite μd] {f : α → β} {g :
   have : Measurable (uncurry fun _ : α => g) := hg.1.comp measurable_snd
   hf.skew_product this <| Filter.eventually_of_forall fun _ => hg.map_eq
 #align measure_theory.measure_preserving.prod MeasureTheory.MeasurePreserving.prod
+-/
 
 end MeasurePreserving
 
 namespace QuasiMeasurePreserving
 
+#print MeasureTheory.QuasiMeasurePreserving.prod_of_right /-
 theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
     (hf : Measurable f) [SigmaFinite ν]
     (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
@@ -711,7 +776,9 @@ theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β}
   simp_rw [map_apply hf hs, prod_apply (hf hs), preimage_preimage,
     lintegral_congr_ae (h2f.mono fun x hx => hx.preimage_null h2s), lintegral_zero]
 #align measure_theory.quasi_measure_preserving.prod_of_right MeasureTheory.QuasiMeasurePreserving.prod_of_right
+-/
 
+#print MeasureTheory.QuasiMeasurePreserving.prod_of_left /-
 theorem prod_of_left {α β γ} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
     {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ} (hf : Measurable f)
     [SigmaFinite μ] [SigmaFinite ν]
@@ -725,6 +792,7 @@ theorem prod_of_left {α β γ} [MeasurableSpace α] [MeasurableSpace β] [Measu
           MeasurableEquiv.prodComm).QuasiMeasurePreserving
   ext ⟨x, y⟩; rfl
 #align measure_theory.quasi_measure_preserving.prod_of_left MeasureTheory.QuasiMeasurePreserving.prod_of_left
+-/
 
 end QuasiMeasurePreserving
 
@@ -734,20 +802,26 @@ open MeasureTheory.Measure
 
 section
 
+#print AEMeasurable.prod_swap /-
 theorem AEMeasurable.prod_swap [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ}
     (hf : AEMeasurable f (ν.Prod μ)) : AEMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) := by
   rw [← prod_swap] at hf ; exact hf.comp_measurable measurable_swap
 #align ae_measurable.prod_swap AEMeasurable.prod_swap
+-/
 
+#print AEMeasurable.fst /-
 theorem AEMeasurable.fst [SigmaFinite ν] {f : α → γ} (hf : AEMeasurable f μ) :
     AEMeasurable (fun z : α × β => f z.1) (μ.Prod ν) :=
   hf.comp_quasiMeasurePreserving quasiMeasurePreserving_fst
 #align ae_measurable.fst AEMeasurable.fst
+-/
 
+#print AEMeasurable.snd /-
 theorem AEMeasurable.snd [SigmaFinite ν] {f : β → γ} (hf : AEMeasurable f ν) :
     AEMeasurable (fun z : α × β => f z.2) (μ.Prod ν) :=
   hf.comp_quasiMeasurePreserving quasiMeasurePreserving_snd
 #align ae_measurable.snd AEMeasurable.snd
+-/
 
 end
 
@@ -758,11 +832,14 @@ namespace MeasureTheory
 
 variable [SigmaFinite ν]
 
+#print MeasureTheory.lintegral_prod_swap /-
 theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
     ∫⁻ z, f z.symm ∂ν.Prod μ = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf ;
   rw [← lintegral_map' hf measurable_swap.ae_measurable, prod_swap]
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
+-/
 
+#print MeasureTheory.lintegral_prod_of_measurable /-
 /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued measurable functions on `α × β`,
   the integral of `f` is equal to the iterated integral. -/
 theorem lintegral_prod_of_measurable :
@@ -783,7 +860,9 @@ theorem lintegral_prod_of_measurable :
       lintegral_mono (k2f x hij)
     simp only [lintegral_supr hf h2f, lintegral_supr (kf _), k2f, lintegral_supr lf l2f, h3f]
 #align measure_theory.lintegral_prod_of_measurable MeasureTheory.lintegral_prod_of_measurable
+-/
 
+#print MeasureTheory.lintegral_prod /-
 /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued almost everywhere measurable functions on `α × β`,
   the integral of `f` is equal to the iterated integral. -/
 theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
@@ -797,20 +876,25 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Pr
   rw [A, B, lintegral_prod_of_measurable _ hf.measurable_mk]
   infer_instance
 #align measure_theory.lintegral_prod MeasureTheory.lintegral_prod
+-/
 
+#print MeasureTheory.lintegral_prod_symm /-
 /-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
     ∫⁻ z, f z ∂μ.Prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by simp_rw [← lintegral_prod_swap f hf];
   exact lintegral_prod _ hf.prod_swap
 #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm
+-/
 
+#print MeasureTheory.lintegral_prod_symm' /-
 /-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
     ∫⁻ z, f z ∂μ.Prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
   lintegral_prod_symm f hf.AEMeasurable
 #align measure_theory.lintegral_prod_symm' MeasureTheory.lintegral_prod_symm'
+-/
 
 #print MeasureTheory.lintegral_lintegral /-
 /-- The reversed version of **Tonelli's Theorem**. In this version `f` is in curried form, which
@@ -821,6 +905,7 @@ theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurabl
 #align measure_theory.lintegral_lintegral MeasureTheory.lintegral_lintegral
 -/
 
+#print MeasureTheory.lintegral_lintegral_symm /-
 /-- The reversed version of **Tonelli's Theorem** (symmetric version). In this version `f` is in
 curried form, which makes it easier for the elaborator to figure out `f` automatically. -/
 theorem lintegral_lintegral_symm [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
@@ -828,18 +913,23 @@ theorem lintegral_lintegral_symm [SigmaFinite μ] ⦃f : α → β → ℝ≥0
     ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.2 z.1 ∂ν.Prod μ :=
   (lintegral_prod_symm _ hf.prod_swap).symm
 #align measure_theory.lintegral_lintegral_symm MeasureTheory.lintegral_lintegral_symm
+-/
 
+#print MeasureTheory.lintegral_lintegral_swap /-
 /-- Change the order of Lebesgue integration. -/
 theorem lintegral_lintegral_swap [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
     (hf : AEMeasurable (uncurry f) (μ.Prod ν)) :
     ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
   (lintegral_lintegral hf).trans (lintegral_prod_symm _ hf)
 #align measure_theory.lintegral_lintegral_swap MeasureTheory.lintegral_lintegral_swap
+-/
 
+#print MeasureTheory.lintegral_prod_mul /-
 theorem lintegral_prod_mul {f : α → ℝ≥0∞} {g : β → ℝ≥0∞} (hf : AEMeasurable f μ)
     (hg : AEMeasurable g ν) : ∫⁻ z, f z.1 * g z.2 ∂μ.Prod ν = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by
   simp [lintegral_prod _ (hf.fst.mul hg.snd), lintegral_lintegral_mul hf hg]
 #align measure_theory.lintegral_prod_mul MeasureTheory.lintegral_prod_mul
+-/
 
 /-! ### Marginals of a measure defined on a product -/
 
@@ -855,12 +945,16 @@ noncomputable def fst (ρ : Measure (α × β)) : Measure α :=
 #align measure_theory.measure.fst MeasureTheory.Measure.fst
 -/
 
+#print MeasureTheory.Measure.fst_apply /-
 theorem fst_apply {s : Set α} (hs : MeasurableSet s) : ρ.fst s = ρ (Prod.fst ⁻¹' s) := by
   rw [fst, measure.map_apply measurable_fst hs]
 #align measure_theory.measure.fst_apply MeasureTheory.Measure.fst_apply
+-/
 
+#print MeasureTheory.Measure.fst_univ /-
 theorem fst_univ : ρ.fst univ = ρ univ := by rw [fst_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.fst_univ MeasureTheory.Measure.fst_univ
+-/
 
 instance [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.fst := by rw [fst]; infer_instance
 
Diff
@@ -759,14 +759,14 @@ namespace MeasureTheory
 variable [SigmaFinite ν]
 
 theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
-    (∫⁻ z, f z.symm ∂ν.Prod μ) = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf ;
+    ∫⁻ z, f z.symm ∂ν.Prod μ = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf ;
   rw [← lintegral_map' hf measurable_swap.ae_measurable, prod_swap]
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
 
 /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued measurable functions on `α × β`,
   the integral of `f` is equal to the iterated integral. -/
 theorem lintegral_prod_of_measurable :
-    ∀ (f : α × β → ℝ≥0∞) (hf : Measurable f), (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
+    ∀ (f : α × β → ℝ≥0∞) (hf : Measurable f), ∫⁻ z, f z ∂μ.Prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
   by
   have m := @measurable_prod_mk_left
   refine' Measurable.ennreal_induction _ _ _
@@ -787,10 +787,10 @@ theorem lintegral_prod_of_measurable :
 /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued almost everywhere measurable functions on `α × β`,
   the integral of `f` is equal to the iterated integral. -/
 theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
-    (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
+    ∫⁻ z, f z ∂μ.Prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
   by
-  have A : (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ z, hf.mk f z ∂μ.prod ν := lintegral_congr_ae hf.ae_eq_mk
-  have B : (∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ) = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂ν ∂μ :=
+  have A : ∫⁻ z, f z ∂μ.prod ν = ∫⁻ z, hf.mk f z ∂μ.prod ν := lintegral_congr_ae hf.ae_eq_mk
+  have B : ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂ν ∂μ :=
     by
     apply lintegral_congr_ae
     filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha
@@ -801,14 +801,14 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Pr
 /-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
-    (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by simp_rw [← lintegral_prod_swap f hf];
+    ∫⁻ z, f z ∂μ.Prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by simp_rw [← lintegral_prod_swap f hf];
   exact lintegral_prod _ hf.prod_swap
 #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm
 
 /-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
-    (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
+    ∫⁻ z, f z ∂μ.Prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
   lintegral_prod_symm f hf.AEMeasurable
 #align measure_theory.lintegral_prod_symm' MeasureTheory.lintegral_prod_symm'
 
@@ -816,7 +816,7 @@ theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf
 /-- The reversed version of **Tonelli's Theorem**. In this version `f` is in curried form, which
 makes it easier for the elaborator to figure out `f` automatically. -/
 theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurable (uncurry f) (μ.Prod ν)) :
-    (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ z, f z.1 z.2 ∂μ.Prod ν :=
+    ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.1 z.2 ∂μ.Prod ν :=
   (lintegral_prod _ hf).symm
 #align measure_theory.lintegral_lintegral MeasureTheory.lintegral_lintegral
 -/
@@ -825,19 +825,19 @@ theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurabl
 curried form, which makes it easier for the elaborator to figure out `f` automatically. -/
 theorem lintegral_lintegral_symm [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
     (hf : AEMeasurable (uncurry f) (μ.Prod ν)) :
-    (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ z, f z.2 z.1 ∂ν.Prod μ :=
+    ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.2 z.1 ∂ν.Prod μ :=
   (lintegral_prod_symm _ hf.prod_swap).symm
 #align measure_theory.lintegral_lintegral_symm MeasureTheory.lintegral_lintegral_symm
 
 /-- Change the order of Lebesgue integration. -/
 theorem lintegral_lintegral_swap [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
     (hf : AEMeasurable (uncurry f) (μ.Prod ν)) :
-    (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
+    ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
   (lintegral_lintegral hf).trans (lintegral_prod_symm _ hf)
 #align measure_theory.lintegral_lintegral_swap MeasureTheory.lintegral_lintegral_swap
 
 theorem lintegral_prod_mul {f : α → ℝ≥0∞} {g : β → ℝ≥0∞} (hf : AEMeasurable f μ)
-    (hg : AEMeasurable g ν) : (∫⁻ z, f z.1 * g z.2 ∂μ.Prod ν) = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by
+    (hg : AEMeasurable g ν) : ∫⁻ z, f z.1 * g z.2 ∂μ.Prod ν = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by
   simp [lintegral_prod _ (hf.fst.mul hg.snd), lintegral_lintegral_mul hf hg]
 #align measure_theory.lintegral_prod_mul MeasureTheory.lintegral_prod_mul
 
Diff
@@ -358,7 +358,6 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.Prod ν (s ×ˢ t) = μ s * ν
           lintegral_indicator _ (measurable_set_to_measurable _ _), lintegral_const,
           restrict_apply_univ, mul_comm]
       _ = μ s * ν t := by rw [measure_to_measurable, measure_to_measurable]
-      
   · -- Formalization is based on https://mathoverflow.net/a/254134/136589
     set ST := to_measurable (μ.prod ν) (s ×ˢ t)
     have hSTm : MeasurableSet ST := measurable_set_to_measurable _ _
@@ -374,7 +373,6 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.Prod ν (s ×ˢ t) = μ s * ν
       _ ≤ ∫⁻ x, f x ∂μ := (lintegral_mono' restrict_le_self le_rfl)
       _ = μ.prod ν ST := (prod_apply hSTm).symm
       _ = μ.prod ν (s ×ˢ t) := measure_to_measurable _
-      
 #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod
 
 instance {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y] {m : MeasurableSpace X}
Diff
@@ -151,7 +151,7 @@ theorem generateFrom_eq_prod {C : Set (Set α)} {D : Set (Set β)} (hC : generat
 /-- The product σ-algebra is generated from boxes, i.e. `s ×ˢ t` for sets `s : set α` and
   `t : set β`. -/
 theorem generateFrom_prod :
-    generateFrom (image2 (· ×ˢ ·) { s : Set α | MeasurableSet s } { t : Set β | MeasurableSet t }) =
+    generateFrom (image2 (· ×ˢ ·) {s : Set α | MeasurableSet s} {t : Set β | MeasurableSet t}) =
       Prod.instMeasurableSpace :=
   generateFrom_eq_prod generateFrom_measurableSet generateFrom_measurableSet
     isCountablySpanning_measurableSet isCountablySpanning_measurableSet
@@ -160,14 +160,14 @@ theorem generateFrom_prod :
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
 /-- Rectangles form a π-system. -/
 theorem isPiSystem_prod :
-    IsPiSystem (image2 (· ×ˢ ·) { s : Set α | MeasurableSet s } { t : Set β | MeasurableSet t }) :=
+    IsPiSystem (image2 (· ×ˢ ·) {s : Set α | MeasurableSet s} {t : Set β | MeasurableSet t}) :=
   isPiSystem_measurableSet.Prod isPiSystem_measurableSet
 #align is_pi_system_prod isPiSystem_prod
 
 #print measurable_measure_prod_mk_left_finite /-
 /-- If `ν` is a finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
   a measurable function. `measurable_measure_prod_mk_left` is strictly more general. -/
-theorem measurable_measure_prod_mk_left_finite [FiniteMeasure ν] {s : Set (α × β)}
+theorem measurable_measure_prod_mk_left_finite [IsFiniteMeasure ν] {s : Set (α × β)}
     (hs : MeasurableSet s) : Measurable fun x => ν (Prod.mk x ⁻¹' s) :=
   by
   refine' induction_on_inter generate_from_prod.symm isPiSystem_prod _ _ _ _ hs
@@ -365,7 +365,7 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.Prod ν (s ×ˢ t) = μ s * ν
     have hST : s ×ˢ t ⊆ ST := subset_to_measurable _ _
     set f : α → ℝ≥0∞ := fun x => ν (Prod.mk x ⁻¹' ST)
     have hfm : Measurable f := measurable_measure_prod_mk_left hSTm
-    set s' : Set α := { x | ν t ≤ f x }
+    set s' : Set α := {x | ν t ≤ f x}
     have hss' : s ⊆ s' := fun x hx => measure_mono fun y hy => hST <| mk_mem_prod hx hy
     calc
       μ s * ν t ≤ μ s' * ν t := mul_le_mul_right' (measure_mono hss') _
@@ -378,8 +378,8 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.Prod ν (s ×ˢ t) = μ s * ν
 #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod
 
 instance {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y] {m : MeasurableSpace X}
-    {μ : Measure X} [OpenPosMeasure μ] {m' : MeasurableSpace Y} {ν : Measure Y} [OpenPosMeasure ν]
-    [SigmaFinite ν] : OpenPosMeasure (μ.Prod ν) :=
+    {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y} {ν : Measure Y}
+    [IsOpenPosMeasure ν] [SigmaFinite ν] : IsOpenPosMeasure (μ.Prod ν) :=
   by
   constructor
   rintro U U_open ⟨⟨x, y⟩, hxy⟩
@@ -391,20 +391,21 @@ instance {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y] {m : Measurabl
   · exact v_open.measure_pos ν ⟨y, yv⟩
 
 instance {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α)
-    (ν : Measure β) [FiniteMeasure μ] [FiniteMeasure ν] : FiniteMeasure (μ.Prod ν) :=
+    (ν : Measure β) [IsFiniteMeasure μ] [IsFiniteMeasure ν] : IsFiniteMeasure (μ.Prod ν) :=
   by
   constructor
   rw [← univ_prod_univ, prod_prod]
   exact mul_lt_top (measure_lt_top _ _).Ne (measure_lt_top _ _).Ne
 
 instance {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α)
-    (ν : Measure β) [ProbabilityMeasure μ] [ProbabilityMeasure ν] : ProbabilityMeasure (μ.Prod ν) :=
+    (ν : Measure β) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] :
+    IsProbabilityMeasure (μ.Prod ν) :=
   ⟨by rw [← univ_prod_univ, prod_prod, measure_univ, measure_univ, mul_one]⟩
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 instance {α β : Type _} [TopologicalSpace α] [TopologicalSpace β] {mα : MeasurableSpace α}
-    {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [FiniteMeasureOnCompacts μ]
-    [FiniteMeasureOnCompacts ν] [SigmaFinite ν] : FiniteMeasureOnCompacts (μ.Prod ν) :=
+    {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsFiniteMeasureOnCompacts μ]
+    [IsFiniteMeasureOnCompacts ν] [SigmaFinite ν] : IsFiniteMeasureOnCompacts (μ.Prod ν) :=
   by
   refine' ⟨fun K hK => _⟩
   set L := (Prod.fst '' K) ×ˢ (Prod.snd '' K) with hL
@@ -663,30 +664,30 @@ theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : M
     {g : α → γ → δ} (hgm : Measurable (uncurry g)) (hg : ∀ᵐ x ∂μa, map (g x) μc = μd) :
     MeasurePreserving (fun p : α × γ => (f p.1, g p.1 p.2)) (μa.Prod μc) (μb.Prod μd) := by
   classical
-    have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prod_mk hgm
-    /- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
-      to deduce `sigma_finite μc`. -/
-    rcases eq_or_ne μa 0 with (rfl | ha)
-    · rw [← hf.map_eq, zero_prod, measure.map_zero, zero_prod]
-      exact ⟨this, by simp only [measure.map_zero]⟩
-    have : sigma_finite μc :=
-      by
-      rcases(ae_ne_bot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩
-      exact sigma_finite.of_map _ hgm.of_uncurry_left.ae_measurable (by rwa [hx])
-    -- Thus we can apply `measure.prod_eq` to prove equality of measures.
-    refine' ⟨this, (prod_eq fun s t hs ht => _).symm⟩
-    rw [map_apply this (hs.prod ht)]
-    refine' (prod_apply (this <| hs.prod ht)).trans _
-    have :
-      ∀ᵐ x ∂μa, μc ((fun y => (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (fun y => μd t) x :=
-      by
-      refine' hg.mono fun x hx => _; subst hx
-      simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage]
-      split_ifs
-      exacts [(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
-    simp only [preimage_preimage]
-    rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const,
-      hf.measure_preimage hs, mul_comm]
+  have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prod_mk hgm
+  /- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
+    to deduce `sigma_finite μc`. -/
+  rcases eq_or_ne μa 0 with (rfl | ha)
+  · rw [← hf.map_eq, zero_prod, measure.map_zero, zero_prod]
+    exact ⟨this, by simp only [measure.map_zero]⟩
+  have : sigma_finite μc :=
+    by
+    rcases(ae_ne_bot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩
+    exact sigma_finite.of_map _ hgm.of_uncurry_left.ae_measurable (by rwa [hx])
+  -- Thus we can apply `measure.prod_eq` to prove equality of measures.
+  refine' ⟨this, (prod_eq fun s t hs ht => _).symm⟩
+  rw [map_apply this (hs.prod ht)]
+  refine' (prod_apply (this <| hs.prod ht)).trans _
+  have :
+    ∀ᵐ x ∂μa, μc ((fun y => (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (fun y => μd t) x :=
+    by
+    refine' hg.mono fun x hx => _; subst hx
+    simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage]
+    split_ifs
+    exacts [(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
+  simp only [preimage_preimage]
+  rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const,
+    hf.measure_preimage hs, mul_comm]
 #align measure_theory.measure_preserving.skew_product MeasureTheory.MeasurePreserving.skew_product
 
 /-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
@@ -720,7 +721,8 @@ theorem prod_of_left {α β γ} [MeasurableSpace α] [MeasurableSpace β] [Measu
     QuasiMeasurePreserving f (μ.Prod ν) τ :=
   by
   rw [← prod_swap]
-  convert(quasi_measure_preserving.prod_of_right (hf.comp measurable_swap) h2f).comp
+  convert
+    (quasi_measure_preserving.prod_of_right (hf.comp measurable_swap) h2f).comp
       ((measurable_swap.measure_preserving (ν.prod μ)).symm
           MeasurableEquiv.prodComm).QuasiMeasurePreserving
   ext ⟨x, y⟩; rfl
@@ -793,7 +795,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Pr
   have B : (∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ) = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂ν ∂μ :=
     by
     apply lintegral_congr_ae
-    filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with _ ha using lintegral_congr_ae ha
+    filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha
   rw [A, B, lintegral_prod_of_measurable _ hf.measurable_mk]
   infer_instance
 #align measure_theory.lintegral_prod MeasureTheory.lintegral_prod
@@ -862,9 +864,9 @@ theorem fst_apply {s : Set α} (hs : MeasurableSet s) : ρ.fst s = ρ (Prod.fst
 theorem fst_univ : ρ.fst univ = ρ univ := by rw [fst_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.fst_univ MeasureTheory.Measure.fst_univ
 
-instance [FiniteMeasure ρ] : FiniteMeasure ρ.fst := by rw [fst]; infer_instance
+instance [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.fst := by rw [fst]; infer_instance
 
-instance [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.fst
+instance [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.fst
     where measure_univ := by rw [fst_univ]; exact measure_univ
 
 theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
@@ -899,9 +901,9 @@ theorem snd_univ : ρ.snd univ = ρ univ := by rw [snd_apply MeasurableSet.univ,
 #align measure_theory.measure.snd_univ MeasureTheory.Measure.snd_univ
 -/
 
-instance [FiniteMeasure ρ] : FiniteMeasure ρ.snd := by rw [snd]; infer_instance
+instance [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.snd := by rw [snd]; infer_instance
 
-instance [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.snd
+instance [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.snd
     where measure_univ := by rw [snd_univ]; exact measure_univ
 
 theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
Diff
@@ -80,7 +80,7 @@ theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C
     (hD : IsPiSystem D) : IsPiSystem (image2 (· ×ˢ ·) C D) :=
   by
   rintro _ ⟨s₁, t₁, hs₁, ht₁, rfl⟩ _ ⟨s₂, t₂, hs₂, ht₂, rfl⟩ hst
-  rw [prod_inter_prod] at hst⊢; rw [prod_nonempty_iff] at hst
+  rw [prod_inter_prod] at hst ⊢; rw [prod_nonempty_iff] at hst 
   exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2)
 #align is_pi_system.prod IsPiSystem.prod
 
@@ -232,7 +232,7 @@ theorem MeasurableEmbedding.prod_mk {α β γ δ : Type _} {mα : MeasurableSpac
     by
     intro x y hxy
     rw [← @Prod.mk.eta _ _ x, ← @Prod.mk.eta _ _ y]
-    simp only [Prod.mk.inj_iff] at hxy⊢
+    simp only [Prod.mk.inj_iff] at hxy ⊢
     exact ⟨hg.injective hxy.1, hf.injective hxy.2⟩
   refine' ⟨h_inj, _, _⟩
   · exact (hg.measurable.comp measurable_fst).prod_mk (hf.measurable.comp measurable_snd)
@@ -419,7 +419,7 @@ instance {α β : Type _} [TopologicalSpace α] [TopologicalSpace β] {mα : Mea
       (IsCompact.measure_lt_top (hK.image continuous_snd)).Ne
 
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.Prod ν) s ≠ ∞) :
-    ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by simp_rw [prod_apply hs] at h2s;
+    ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by simp_rw [prod_apply hs] at h2s ;
   refine' ae_lt_top (measurable_measure_prod_mk_left hs) h2s
 #align measure_theory.measure.ae_measure_lt_top MeasureTheory.Measure.ae_measure_lt_top
 
@@ -436,7 +436,7 @@ theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.Prod ν s = 0)
     (fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0 :=
   by
   obtain ⟨t, hst, mt, ht⟩ := exists_measurable_superset_of_null h
-  simp_rw [measure_prod_null mt] at ht
+  simp_rw [measure_prod_null mt] at ht 
   rw [eventually_le_antisymm_iff]
   exact
     ⟨eventually_le.trans_eq (eventually_of_forall fun x => (measure_mono (preimage_mono hst) : _))
@@ -449,7 +449,7 @@ theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν 
     μ.Prod ν ≪ μ'.Prod ν' :=
   by
   refine' absolutely_continuous.mk fun s hs h2s => _
-  simp_rw [measure_prod_null hs] at h2s⊢
+  simp_rw [measure_prod_null hs] at h2s ⊢
   exact (h2s.filter_mono h1.ae_le).mono fun _ h => h2 h
 #align measure_theory.measure.absolutely_continuous.prod MeasureTheory.Measure.AbsolutelyContinuous.prod
 -/
@@ -557,7 +557,7 @@ theorem prodAssoc_prod [SigmaFinite τ] :
     (prod_eq_generateFrom generate_from_measurable_set generateFrom_prod is_pi_system_measurable_set
         isPiSystem_prod μ.to_finite_spanning_sets_in
         (ν.to_finite_spanning_sets_in.prod τ.to_finite_spanning_sets_in) _).symm
-  rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_set_of_eq] at hs ht hu
+  rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_set_of_eq] at hs ht hu 
   simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)),
     MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod,
     mul_assoc]
@@ -683,7 +683,7 @@ theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : M
       refine' hg.mono fun x hx => _; subst hx
       simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage]
       split_ifs
-      exacts[(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
+      exacts [(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
     simp only [preimage_preimage]
     rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const,
       hf.measure_preimage hs, mul_comm]
@@ -736,7 +736,7 @@ section
 
 theorem AEMeasurable.prod_swap [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ}
     (hf : AEMeasurable f (ν.Prod μ)) : AEMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) := by
-  rw [← prod_swap] at hf; exact hf.comp_measurable measurable_swap
+  rw [← prod_swap] at hf ; exact hf.comp_measurable measurable_swap
 #align ae_measurable.prod_swap AEMeasurable.prod_swap
 
 theorem AEMeasurable.fst [SigmaFinite ν] {f : α → γ} (hf : AEMeasurable f μ) :
@@ -759,7 +759,7 @@ namespace MeasureTheory
 variable [SigmaFinite ν]
 
 theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
-    (∫⁻ z, f z.symm ∂ν.Prod μ) = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf;
+    (∫⁻ z, f z.symm ∂ν.Prod μ) = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf ;
   rw [← lintegral_map' hf measurable_swap.ae_measurable, prod_swap]
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn
 
 ! This file was ported from Lean 3 source module measure_theory.constructions.prod.basic
-! leanprover-community/mathlib commit 3b88f4005dc2e28d42f974cc1ce838f0dafb39b8
+! leanprover-community/mathlib commit 00abe0695d8767201e6d008afa22393978bb324d
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -16,6 +16,9 @@ import Mathbin.MeasureTheory.Measure.OpenPos
 /-!
 # The product measure
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we define and prove properties about the binary product measure. If `α` and `β` have
 σ-finite measures `μ` resp. `ν` then `α × β` can be equipped with a σ-finite measure `μ.prod ν` that
 satisfies `(μ.prod ν) s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`.
@@ -161,6 +164,7 @@ theorem isPiSystem_prod :
   isPiSystem_measurableSet.Prod isPiSystem_measurableSet
 #align is_pi_system_prod isPiSystem_prod
 
+#print measurable_measure_prod_mk_left_finite /-
 /-- If `ν` is a finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
   a measurable function. `measurable_measure_prod_mk_left` is strictly more general. -/
 theorem measurable_measure_prod_mk_left_finite [FiniteMeasure ν] {s : Set (α × β)}
@@ -179,7 +183,9 @@ theorem measurable_measure_prod_mk_left_finite [FiniteMeasure ν] {s : Set (α 
         measurable_prod_mk_left (h2f i)
     simp_rw [this]; apply Measurable.ennreal_tsum h3f
 #align measurable_measure_prod_mk_left_finite measurable_measure_prod_mk_left_finite
+-/
 
+#print measurable_measure_prod_mk_left /-
 /-- If `ν` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
   a measurable function. -/
 theorem measurable_measure_prod_mk_left [SigmaFinite ν] {s : Set (α × β)} (hs : MeasurableSet s) :
@@ -191,6 +197,7 @@ theorem measurable_measure_prod_mk_left [SigmaFinite ν] {s : Set (α × β)} (h
   haveI := Fact.mk (measure_spanning_sets_lt_top ν i)
   exact measurable_measure_prod_mk_left_finite hs
 #align measurable_measure_prod_mk_left measurable_measure_prod_mk_left
+-/
 
 /-- If `μ` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `y ↦ μ { x | (x, y) ∈ s }` is
   a measurable function. -/
@@ -199,12 +206,14 @@ theorem measurable_measure_prod_mk_right {μ : Measure α} [SigmaFinite μ] {s :
   measurable_measure_prod_mk_left (measurableSet_swap_iff.mpr hs)
 #align measurable_measure_prod_mk_right measurable_measure_prod_mk_right
 
+#print Measurable.map_prod_mk_left /-
 theorem Measurable.map_prod_mk_left [SigmaFinite ν] : Measurable fun x : α => map (Prod.mk x) ν :=
   by
   apply measurable_of_measurable_coe; intro s hs
   simp_rw [map_apply measurable_prod_mk_left hs]
   exact measurable_measure_prod_mk_left hs
 #align measurable.map_prod_mk_left Measurable.map_prod_mk_left
+-/
 
 theorem Measurable.map_prod_mk_right {μ : Measure α} [SigmaFinite μ] :
     Measurable fun y : β => map (fun x : α => (x, y)) μ :=
@@ -245,6 +254,7 @@ theorem MeasurableEmbedding.prod_mk {α β γ δ : Type _} {mα : MeasurableSpac
       exact MeasurableSet.iUnion hg
 #align measurable_embedding.prod_mk MeasurableEmbedding.prod_mk
 
+#print Measurable.lintegral_prod_right' /-
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   Tonelli's theorem is measurable. -/
 theorem Measurable.lintegral_prod_right' [SigmaFinite ν] :
@@ -262,7 +272,9 @@ theorem Measurable.lintegral_prod_right' [SigmaFinite ν] :
     have : ∀ x, Monotone fun n y => f n (x, y) := fun x i j hij y => h2f hij (x, y)
     simpa [lintegral_supr fun n => (hf n).comp m, this]
 #align measurable.lintegral_prod_right' Measurable.lintegral_prod_right'
+-/
 
+#print Measurable.lintegral_prod_right /-
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   Tonelli's theorem is measurable.
   This version has the argument `f` in curried form. -/
@@ -270,6 +282,7 @@ theorem Measurable.lintegral_prod_right [SigmaFinite ν] {f : α → β → ℝ
     (hf : Measurable (uncurry f)) : Measurable fun x => ∫⁻ y, f x y ∂ν :=
   hf.lintegral_prod_right'
 #align measurable.lintegral_prod_right Measurable.lintegral_prod_right
+-/
 
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   the symmetric version of Tonelli's theorem is measurable. -/
@@ -293,15 +306,19 @@ namespace MeasureTheory
 
 namespace Measure
 
+#print MeasureTheory.Measure.prod /-
 /-- The binary product of measures. They are defined for arbitrary measures, but we basically
   prove all properties under the assumption that at least one of them is σ-finite. -/
 protected irreducible_def prod (μ : Measure α) (ν : Measure β) : Measure (α × β) :=
   bind μ fun x : α => map (Prod.mk x) ν
 #align measure_theory.measure.prod MeasureTheory.Measure.prod
+-/
 
+#print MeasureTheory.Measure.prod.measureSpace /-
 instance prod.measureSpace {α β} [MeasureSpace α] [MeasureSpace β] : MeasureSpace (α × β)
     where volume := volume.Prod volume
 #align measure_theory.measure.prod.measure_space MeasureTheory.Measure.prod.measureSpace
+-/
 
 variable [SigmaFinite ν]
 
@@ -310,11 +327,13 @@ theorem volume_eq_prod (α β) [MeasureSpace α] [MeasureSpace β] :
   rfl
 #align measure_theory.measure.volume_eq_prod MeasureTheory.Measure.volume_eq_prod
 
+#print MeasureTheory.Measure.prod_apply /-
 theorem prod_apply {s : Set (α × β)} (hs : MeasurableSet s) :
     μ.Prod ν s = ∫⁻ x, ν (Prod.mk x ⁻¹' s) ∂μ := by
   simp_rw [measure.prod, bind_apply hs Measurable.map_prod_mk_left,
     map_apply measurable_prod_mk_left hs]
 #align measure_theory.measure.prod_apply MeasureTheory.Measure.prod_apply
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@@ -425,6 +444,7 @@ theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.Prod ν s = 0)
       eventually_of_forall fun x => zero_le _⟩
 #align measure_theory.measure.measure_ae_null_of_prod_null MeasureTheory.Measure.measure_ae_null_of_prod_null
 
+#print MeasureTheory.Measure.AbsolutelyContinuous.prod /-
 theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν ≪ ν') :
     μ.Prod ν ≪ μ'.Prod ν' :=
   by
@@ -432,6 +452,7 @@ theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν 
   simp_rw [measure_prod_null hs] at h2s⊢
   exact (h2s.filter_mono h1.ae_le).mono fun _ h => h2 h
 #align measure_theory.measure.absolutely_continuous.prod MeasureTheory.Measure.AbsolutelyContinuous.prod
+-/
 
 /-- Note: the converse is not true. For a counterexample, see
   Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
@@ -442,6 +463,7 @@ theorem ae_ae_of_ae_prod {p : α × β → Prop} (h : ∀ᵐ z ∂μ.Prod ν, p
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:228:8: unsupported: ambiguous notation -/
+#print MeasureTheory.Measure.FiniteSpanningSetsIn.prod /-
 /-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/
 noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
     (hμ : μ.FiniteSpanningSetsIn C) (hν : ν.FiniteSpanningSetsIn D) :
@@ -455,24 +477,31 @@ noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)}
     exact mul_lt_top (hμ.finite _).Ne (hν.finite _).Ne
   · simp_rw [Union_unpair_prod, hμ.spanning, hν.spanning, univ_prod_univ]
 #align measure_theory.measure.finite_spanning_sets_in.prod MeasureTheory.Measure.FiniteSpanningSetsIn.prod
+-/
 
+#print MeasureTheory.Measure.quasiMeasurePreserving_fst /-
 theorem quasiMeasurePreserving_fst : QuasiMeasurePreserving Prod.fst (μ.Prod ν) μ :=
   by
   refine' ⟨measurable_fst, absolutely_continuous.mk fun s hs h2s => _⟩
   rw [map_apply measurable_fst hs, ← prod_univ, prod_prod, h2s, MulZeroClass.zero_mul]
 #align measure_theory.measure.quasi_measure_preserving_fst MeasureTheory.Measure.quasiMeasurePreserving_fst
+-/
 
+#print MeasureTheory.Measure.quasiMeasurePreserving_snd /-
 theorem quasiMeasurePreserving_snd : QuasiMeasurePreserving Prod.snd (μ.Prod ν) ν :=
   by
   refine' ⟨measurable_snd, absolutely_continuous.mk fun s hs h2s => _⟩
   rw [map_apply measurable_snd hs, ← univ_prod, prod_prod, h2s, MulZeroClass.mul_zero]
 #align measure_theory.measure.quasi_measure_preserving_snd MeasureTheory.Measure.quasiMeasurePreserving_snd
+-/
 
 variable [SigmaFinite μ]
 
-instance prod.sigmaFinite : SigmaFinite (μ.Prod ν) :=
+#print MeasureTheory.Measure.prod.instSigmaFinite /-
+instance prod.instSigmaFinite : SigmaFinite (μ.Prod ν) :=
   (μ.toFiniteSpanningSetsIn.Prod ν.toFiniteSpanningSetsIn).SigmaFinite
-#align measure_theory.measure.prod.sigma_finite MeasureTheory.Measure.prod.sigmaFinite
+#align measure_theory.measure.prod.sigma_finite MeasureTheory.Measure.prod.instSigmaFinite
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /-- A measure on a product space equals the product measure if they are equal on rectangles
@@ -506,16 +535,20 @@ theorem prod_swap : map Prod.swap (μ.Prod ν) = ν.Prod μ :=
   simp_rw [map_apply measurable_swap (hs.prod ht), preimage_swap_prod, prod_prod, mul_comm]
 #align measure_theory.measure.prod_swap MeasureTheory.Measure.prod_swap
 
+#print MeasureTheory.Measure.measurePreserving_swap /-
 theorem measurePreserving_swap : MeasurePreserving Prod.swap (μ.Prod ν) (ν.Prod μ) :=
   ⟨measurable_swap, prod_swap⟩
 #align measure_theory.measure.measure_preserving_swap MeasureTheory.Measure.measurePreserving_swap
+-/
 
+#print MeasureTheory.Measure.prod_apply_symm /-
 theorem prod_apply_symm {s : Set (α × β)} (hs : MeasurableSet s) :
     μ.Prod ν s = ∫⁻ y, μ ((fun x => (x, y)) ⁻¹' s) ∂ν :=
   by
   rw [← prod_swap, map_apply measurable_swap hs]
   simp only [prod_apply (measurable_swap hs)]; rfl
 #align measure_theory.measure.prod_apply_symm MeasureTheory.Measure.prod_apply_symm
+-/
 
 theorem prodAssoc_prod [SigmaFinite τ] :
     map MeasurableEquiv.prodAssoc ((μ.Prod ν).Prod τ) = μ.Prod (ν.Prod τ) :=
@@ -568,12 +601,14 @@ theorem dirac_prod_dirac {x : α} {y : β} : (dirac x).Prod (dirac y) = dirac (x
   rw [prod_dirac, map_dirac measurable_prod_mk_right]
 #align measure_theory.measure.dirac_prod_dirac MeasureTheory.Measure.dirac_prod_dirac
 
+#print MeasureTheory.Measure.prod_sum /-
 theorem prod_sum {ι : Type _} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] :
     μ.Prod (sum ν) = sum fun i => μ.Prod (ν i) :=
   by
   refine' prod_eq fun s t hs ht => _
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ ht, prod_prod, ENNReal.tsum_mul_left]
 #align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum
+-/
 
 theorem sum_prod {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
     (sum μ).Prod ν = sum fun i => (μ i).Prod ν :=
@@ -582,18 +617,22 @@ theorem sum_prod {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, Sigm
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ENNReal.tsum_mul_right]
 #align measure_theory.measure.sum_prod MeasureTheory.Measure.sum_prod
 
+#print MeasureTheory.Measure.prod_add /-
 theorem prod_add (ν' : Measure β) [SigmaFinite ν'] : μ.Prod (ν + ν') = μ.Prod ν + μ.Prod ν' := by
   refine' prod_eq fun s t hs ht => _; simp_rw [add_apply, prod_prod, left_distrib]
 #align measure_theory.measure.prod_add MeasureTheory.Measure.prod_add
+-/
 
 theorem add_prod (μ' : Measure α) [SigmaFinite μ'] : (μ + μ').Prod ν = μ.Prod ν + μ'.Prod ν := by
   refine' prod_eq fun s t hs ht => _; simp_rw [add_apply, prod_prod, right_distrib]
 #align measure_theory.measure.add_prod MeasureTheory.Measure.add_prod
 
+#print MeasureTheory.Measure.zero_prod /-
 @[simp]
 theorem zero_prod (ν : Measure β) : (0 : Measure α).Prod ν = 0 := by rw [measure.prod];
   exact bind_zero_left _
 #align measure_theory.measure.zero_prod MeasureTheory.Measure.zero_prod
+-/
 
 @[simp]
 theorem prod_zero (μ : Measure α) : μ.Prod (0 : Measure β) = 0 := by simp [measure.prod]
@@ -773,12 +812,14 @@ theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf
   lintegral_prod_symm f hf.AEMeasurable
 #align measure_theory.lintegral_prod_symm' MeasureTheory.lintegral_prod_symm'
 
+#print MeasureTheory.lintegral_lintegral /-
 /-- The reversed version of **Tonelli's Theorem**. In this version `f` is in curried form, which
 makes it easier for the elaborator to figure out `f` automatically. -/
 theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurable (uncurry f) (μ.Prod ν)) :
     (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ z, f z.1 z.2 ∂μ.Prod ν :=
   (lintegral_prod _ hf).symm
 #align measure_theory.lintegral_lintegral MeasureTheory.lintegral_lintegral
+-/
 
 /-- The reversed version of **Tonelli's Theorem** (symmetric version). In this version `f` is in
 curried form, which makes it easier for the elaborator to figure out `f` automatically. -/
@@ -807,10 +848,12 @@ namespace Measure
 
 variable {ρ : Measure (α × β)}
 
+#print MeasureTheory.Measure.fst /-
 /-- Marginal measure on `α` obtained from a measure `ρ` on `α × β`, defined by `ρ.map prod.fst`. -/
 noncomputable def fst (ρ : Measure (α × β)) : Measure α :=
   ρ.map Prod.fst
 #align measure_theory.measure.fst MeasureTheory.Measure.fst
+-/
 
 theorem fst_apply {s : Set α} (hs : MeasurableSet s) : ρ.fst s = ρ (Prod.fst ⁻¹' s) := by
   rw [fst, measure.map_apply measurable_fst hs]
@@ -824,23 +867,57 @@ instance [FiniteMeasure ρ] : FiniteMeasure ρ.fst := by rw [fst]; infer_instanc
 instance [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.fst
     where measure_univ := by rw [fst_univ]; exact measure_univ
 
+theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
+    (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).fst = μ.map X :=
+  by
+  ext1 s hs
+  rw [measure.fst_apply hs, measure.map_apply_of_ae_measurable (hX.prod_mk hY) (measurable_fst hs),
+    measure.map_apply_of_ae_measurable hX hs, ← prod_univ, mk_preimage_prod, preimage_univ,
+    inter_univ]
+#align measure_theory.measure.fst_map_prod_mk₀ MeasureTheory.Measure.fst_map_prod_mk₀
+
+theorem fst_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
+    (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).fst = μ.map X :=
+  fst_map_prod_mk₀ hX.AEMeasurable hY.AEMeasurable
+#align measure_theory.measure.fst_map_prod_mk MeasureTheory.Measure.fst_map_prod_mk
+
+#print MeasureTheory.Measure.snd /-
 /-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map prod.snd`. -/
 noncomputable def snd (ρ : Measure (α × β)) : Measure β :=
   ρ.map Prod.snd
 #align measure_theory.measure.snd MeasureTheory.Measure.snd
+-/
 
+#print MeasureTheory.Measure.snd_apply /-
 theorem snd_apply {s : Set β} (hs : MeasurableSet s) : ρ.snd s = ρ (Prod.snd ⁻¹' s) := by
   rw [snd, measure.map_apply measurable_snd hs]
 #align measure_theory.measure.snd_apply MeasureTheory.Measure.snd_apply
+-/
 
+#print MeasureTheory.Measure.snd_univ /-
 theorem snd_univ : ρ.snd univ = ρ univ := by rw [snd_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.snd_univ MeasureTheory.Measure.snd_univ
+-/
 
 instance [FiniteMeasure ρ] : FiniteMeasure ρ.snd := by rw [snd]; infer_instance
 
 instance [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.snd
     where measure_univ := by rw [snd_univ]; exact measure_univ
 
+theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
+    (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).snd = μ.map Y :=
+  by
+  ext1 s hs
+  rw [measure.snd_apply hs, measure.map_apply_of_ae_measurable (hX.prod_mk hY) (measurable_snd hs),
+    measure.map_apply_of_ae_measurable hY hs, ← univ_prod, mk_preimage_prod, preimage_univ,
+    univ_inter]
+#align measure_theory.measure.snd_map_prod_mk₀ MeasureTheory.Measure.snd_map_prod_mk₀
+
+theorem snd_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
+    (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).snd = μ.map Y :=
+  snd_map_prod_mk₀ hX.AEMeasurable hY.AEMeasurable
+#align measure_theory.measure.snd_map_prod_mk MeasureTheory.Measure.snd_map_prod_mk
+
 end Measure
 
 end MeasureTheory
Diff
@@ -59,7 +59,7 @@ product measure, Tonelli's theorem, Fubini-Tonelli theorem
 
 noncomputable section
 
-open Classical Topology ENNReal MeasureTheory
+open scoped Classical Topology ENNReal MeasureTheory
 
 open Set Function Real ENNReal
 
Diff
@@ -122,18 +122,14 @@ theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC :
     · rcases hD with ⟨t, h1t, h2t⟩
       rw [← prod_univ, ← h2t, prod_Union]
       apply MeasurableSet.iUnion
-      intro n
-      apply measurable_set_generate_from
+      intro n; apply measurable_set_generate_from
       exact ⟨s, t n, hs, h1t n, rfl⟩
     · rcases hC with ⟨t, h1t, h2t⟩
       rw [← univ_prod, ← h2t, Union_prod_const]
       apply MeasurableSet.iUnion
-      rintro n
-      apply measurable_set_generate_from
+      rintro n; apply measurable_set_generate_from
       exact mem_image2_of_mem (h1t n) hs
-  · apply generate_from_le
-    rintro _ ⟨s, t, hs, ht, rfl⟩
-    rw [prod_eq]
+  · apply generate_from_le; rintro _ ⟨s, t, hs, ht, rfl⟩; rw [prod_eq]
     apply (measurable_fst _).inter (measurable_snd _)
     · exact measurable_set_generate_from hs
     · exact measurable_set_generate_from ht
@@ -172,19 +168,16 @@ theorem measurable_measure_prod_mk_left_finite [FiniteMeasure ν] {s : Set (α 
   by
   refine' induction_on_inter generate_from_prod.symm isPiSystem_prod _ _ _ _ hs
   · simp [measurable_zero, const_def]
-  · rintro _ ⟨s, t, hs, ht, rfl⟩
-    simp only [mk_preimage_prod_right_eq_if, measure_if]
+  · rintro _ ⟨s, t, hs, ht, rfl⟩; simp only [mk_preimage_prod_right_eq_if, measure_if]
     exact measurable_const.indicator hs
   · intro t ht h2t
     simp_rw [preimage_compl, measure_compl (measurable_prod_mk_left ht) (measure_ne_top ν _)]
     exact h2t.const_sub _
-  · intro f h1f h2f h3f
-    simp_rw [preimage_Union]
+  · intro f h1f h2f h3f; simp_rw [preimage_Union]
     have : ∀ b, ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' i, ν (Prod.mk b ⁻¹' f i) := fun b =>
       measure_Union (fun i j hij => Disjoint.preimage _ (h1f hij)) fun i =>
         measurable_prod_mk_left (h2f i)
-    simp_rw [this]
-    apply Measurable.ennreal_tsum h3f
+    simp_rw [this]; apply Measurable.ennreal_tsum h3f
 #align measurable_measure_prod_mk_left_finite measurable_measure_prod_mk_left_finite
 
 /-- If `ν` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
@@ -259,12 +252,10 @@ theorem Measurable.lintegral_prod_right' [SigmaFinite ν] :
   by
   have m := @measurable_prod_mk_left
   refine' Measurable.ennreal_induction _ _ _
-  · intro c s hs
-    simp only [← indicator_comp_right]
+  · intro c s hs; simp only [← indicator_comp_right]
     suffices Measurable fun x => c * ν (Prod.mk x ⁻¹' s) by simpa [lintegral_indicator _ (m hs)]
     exact (measurable_measure_prod_mk_left hs).const_mul _
-  · rintro f g - hf hg h2f h2g
-    simp_rw [Pi.add_apply, lintegral_add_left (hf.comp m)]
+  · rintro f g - hf hg h2f h2g; simp_rw [Pi.add_apply, lintegral_add_left (hf.comp m)]
     exact h2f.add h2g
   · intro f hf h2f h3f
     have := measurable_iSup h3f
@@ -409,9 +400,7 @@ instance {α β : Type _} [TopologicalSpace α] [TopologicalSpace β] {mα : Mea
       (IsCompact.measure_lt_top (hK.image continuous_snd)).Ne
 
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.Prod ν) s ≠ ∞) :
-    ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ :=
-  by
-  simp_rw [prod_apply hs] at h2s
+    ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by simp_rw [prod_apply hs] at h2s;
   refine' ae_lt_top (measurable_measure_prod_mk_left hs) h2s
 #align measure_theory.measure.ae_measure_lt_top MeasureTheory.Measure.ae_measure_lt_top
 
@@ -497,8 +486,7 @@ theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set 
     (h3C.prod h3D).ext
       (generateFrom_eq_prod hC hD h3C.is_countably_spanning h3D.is_countably_spanning).symm
       (h2C.prod h2D) _
-  · rintro _ ⟨s, t, hs, ht, rfl⟩
-    haveI := h3D.sigma_finite
+  · rintro _ ⟨s, t, hs, ht, rfl⟩; haveI := h3D.sigma_finite
     rw [h₁ s hs t ht, prod_prod]
 #align measure_theory.measure.prod_eq_generate_from MeasureTheory.Measure.prod_eq_generateFrom
 
@@ -526,8 +514,7 @@ theorem prod_apply_symm {s : Set (α × β)} (hs : MeasurableSet s) :
     μ.Prod ν s = ∫⁻ y, μ ((fun x => (x, y)) ⁻¹' s) ∂ν :=
   by
   rw [← prod_swap, map_apply measurable_swap hs]
-  simp only [prod_apply (measurable_swap hs)]
-  rfl
+  simp only [prod_apply (measurable_swap hs)]; rfl
 #align measure_theory.measure.prod_apply_symm MeasureTheory.Measure.prod_apply_symm
 
 theorem prodAssoc_prod [SigmaFinite τ] :
@@ -595,22 +582,16 @@ theorem sum_prod {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, Sigm
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ENNReal.tsum_mul_right]
 #align measure_theory.measure.sum_prod MeasureTheory.Measure.sum_prod
 
-theorem prod_add (ν' : Measure β) [SigmaFinite ν'] : μ.Prod (ν + ν') = μ.Prod ν + μ.Prod ν' :=
-  by
-  refine' prod_eq fun s t hs ht => _
-  simp_rw [add_apply, prod_prod, left_distrib]
+theorem prod_add (ν' : Measure β) [SigmaFinite ν'] : μ.Prod (ν + ν') = μ.Prod ν + μ.Prod ν' := by
+  refine' prod_eq fun s t hs ht => _; simp_rw [add_apply, prod_prod, left_distrib]
 #align measure_theory.measure.prod_add MeasureTheory.Measure.prod_add
 
-theorem add_prod (μ' : Measure α) [SigmaFinite μ'] : (μ + μ').Prod ν = μ.Prod ν + μ'.Prod ν :=
-  by
-  refine' prod_eq fun s t hs ht => _
-  simp_rw [add_apply, prod_prod, right_distrib]
+theorem add_prod (μ' : Measure α) [SigmaFinite μ'] : (μ + μ').Prod ν = μ.Prod ν + μ'.Prod ν := by
+  refine' prod_eq fun s t hs ht => _; simp_rw [add_apply, prod_prod, right_distrib]
 #align measure_theory.measure.add_prod MeasureTheory.Measure.add_prod
 
 @[simp]
-theorem zero_prod (ν : Measure β) : (0 : Measure α).Prod ν = 0 :=
-  by
-  rw [measure.prod]
+theorem zero_prod (ν : Measure β) : (0 : Measure α).Prod ν = 0 := by rw [measure.prod];
   exact bind_zero_left _
 #align measure_theory.measure.zero_prod MeasureTheory.Measure.zero_prod
 
@@ -660,8 +641,7 @@ theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : M
     have :
       ∀ᵐ x ∂μa, μc ((fun y => (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (fun y => μd t) x :=
       by
-      refine' hg.mono fun x hx => _
-      subst hx
+      refine' hg.mono fun x hx => _; subst hx
       simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage]
       split_ifs
       exacts[(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
@@ -716,10 +696,8 @@ open MeasureTheory.Measure
 section
 
 theorem AEMeasurable.prod_swap [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ}
-    (hf : AEMeasurable f (ν.Prod μ)) : AEMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) :=
-  by
-  rw [← prod_swap] at hf
-  exact hf.comp_measurable measurable_swap
+    (hf : AEMeasurable f (ν.Prod μ)) : AEMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) := by
+  rw [← prod_swap] at hf; exact hf.comp_measurable measurable_swap
 #align ae_measurable.prod_swap AEMeasurable.prod_swap
 
 theorem AEMeasurable.fst [SigmaFinite ν] {f : α → γ} (hf : AEMeasurable f μ) :
@@ -742,9 +720,7 @@ namespace MeasureTheory
 variable [SigmaFinite ν]
 
 theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
-    (∫⁻ z, f z.symm ∂ν.Prod μ) = ∫⁻ z, f z ∂μ.Prod ν :=
-  by
-  rw [← prod_swap] at hf
+    (∫⁻ z, f z.symm ∂ν.Prod μ) = ∫⁻ z, f z ∂μ.Prod ν := by rw [← prod_swap] at hf;
   rw [← lintegral_map' hf measurable_swap.ae_measurable, prod_swap]
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
 
@@ -755,8 +731,7 @@ theorem lintegral_prod_of_measurable :
   by
   have m := @measurable_prod_mk_left
   refine' Measurable.ennreal_induction _ _ _
-  · intro c s hs
-    simp only [← indicator_comp_right]
+  · intro c s hs; simp only [← indicator_comp_right]
     simp [lintegral_indicator, m hs, hs, lintegral_const_mul, measurable_measure_prod_mk_left hs,
       prod_apply]
   · rintro f g - hf hg h2f h2g
@@ -787,9 +762,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Pr
 /-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.Prod ν)) :
-    (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
-  by
-  simp_rw [← lintegral_prod_swap f hf]
+    (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by simp_rw [← lintegral_prod_swap f hf];
   exact lintegral_prod _ hf.prod_swap
 #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm
 
@@ -846,15 +819,10 @@ theorem fst_apply {s : Set α} (hs : MeasurableSet s) : ρ.fst s = ρ (Prod.fst
 theorem fst_univ : ρ.fst univ = ρ univ := by rw [fst_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.fst_univ MeasureTheory.Measure.fst_univ
 
-instance [FiniteMeasure ρ] : FiniteMeasure ρ.fst :=
-  by
-  rw [fst]
-  infer_instance
+instance [FiniteMeasure ρ] : FiniteMeasure ρ.fst := by rw [fst]; infer_instance
 
 instance [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.fst
-    where measure_univ := by
-    rw [fst_univ]
-    exact measure_univ
+    where measure_univ := by rw [fst_univ]; exact measure_univ
 
 /-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map prod.snd`. -/
 noncomputable def snd (ρ : Measure (α × β)) : Measure β :=
@@ -868,15 +836,10 @@ theorem snd_apply {s : Set β} (hs : MeasurableSet s) : ρ.snd s = ρ (Prod.snd
 theorem snd_univ : ρ.snd univ = ρ univ := by rw [snd_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.snd_univ MeasureTheory.Measure.snd_univ
 
-instance [FiniteMeasure ρ] : FiniteMeasure ρ.snd :=
-  by
-  rw [snd]
-  infer_instance
+instance [FiniteMeasure ρ] : FiniteMeasure ρ.snd := by rw [snd]; infer_instance
 
 instance [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.snd
-    where measure_univ := by
-    rw [snd_univ]
-    exact measure_univ
+    where measure_univ := by rw [snd_univ]; exact measure_univ
 
 end Measure
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn
 
 ! This file was ported from Lean 3 source module measure_theory.constructions.prod.basic
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
+! leanprover-community/mathlib commit 3b88f4005dc2e28d42f974cc1ce838f0dafb39b8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -221,6 +221,37 @@ theorem Measurable.map_prod_mk_right {μ : Measure α} [SigmaFinite μ] :
   exact measurable_measure_prod_mk_right hs
 #align measurable.map_prod_mk_right Measurable.map_prod_mk_right
 
+theorem MeasurableEmbedding.prod_mk {α β γ δ : Type _} {mα : MeasurableSpace α}
+    {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ} {mδ : MeasurableSpace δ} {f : α → β}
+    {g : γ → δ} (hg : MeasurableEmbedding g) (hf : MeasurableEmbedding f) :
+    MeasurableEmbedding fun x : γ × α => (g x.1, f x.2) :=
+  by
+  have h_inj : Function.Injective fun x : γ × α => (g x.fst, f x.snd) :=
+    by
+    intro x y hxy
+    rw [← @Prod.mk.eta _ _ x, ← @Prod.mk.eta _ _ y]
+    simp only [Prod.mk.inj_iff] at hxy⊢
+    exact ⟨hg.injective hxy.1, hf.injective hxy.2⟩
+  refine' ⟨h_inj, _, _⟩
+  · exact (hg.measurable.comp measurable_fst).prod_mk (hf.measurable.comp measurable_snd)
+  · -- Induction using the π-system of rectangles
+    refine' fun s hs =>
+      @MeasurableSpace.induction_on_inter _
+        (fun s => MeasurableSet ((fun x : γ × α => (g x.fst, f x.snd)) '' s)) _ _
+        generate_from_prod.symm isPiSystem_prod _ _ _ _ _ hs
+    · simp only [Set.image_empty, MeasurableSet.empty]
+    · rintro t ⟨t₁, t₂, ht₁, ht₂, rfl⟩
+      rw [← Set.prod_image_image_eq]
+      exact (hg.measurable_set_image.mpr ht₁).Prod (hf.measurable_set_image.mpr ht₂)
+    · intro t ht ht_m
+      rw [← Set.range_diff_image h_inj, ← Set.prod_range_range_eq]
+      exact
+        MeasurableSet.diff (MeasurableSet.prod hg.measurable_set_range hf.measurable_set_range) ht_m
+    · intro g hg_disj hg_meas hg
+      simp_rw [Set.image_iUnion]
+      exact MeasurableSet.iUnion hg
+#align measurable_embedding.prod_mk MeasurableEmbedding.prod_mk
+
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   Tonelli's theorem is measurable. -/
 theorem Measurable.lintegral_prod_right' [SigmaFinite ν] :
Diff
@@ -227,7 +227,7 @@ theorem Measurable.lintegral_prod_right' [SigmaFinite ν] :
     ∀ {f : α × β → ℝ≥0∞} (hf : Measurable f), Measurable fun x => ∫⁻ y, f (x, y) ∂ν :=
   by
   have m := @measurable_prod_mk_left
-  refine' Measurable.eNNReal_induction _ _ _
+  refine' Measurable.ennreal_induction _ _ _
   · intro c s hs
     simp only [← indicator_comp_right]
     suffices Measurable fun x => c * ν (Prod.mk x ⁻¹' s) by simpa [lintegral_indicator _ (m hs)]
@@ -723,7 +723,7 @@ theorem lintegral_prod_of_measurable :
     ∀ (f : α × β → ℝ≥0∞) (hf : Measurable f), (∫⁻ z, f z ∂μ.Prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
   by
   have m := @measurable_prod_mk_left
-  refine' Measurable.eNNReal_induction _ _ _
+  refine' Measurable.ennreal_induction _ _ _
   · intro c s hs
     simp only [← indicator_comp_right]
     simp [lintegral_indicator, m hs, hs, lintegral_const_mul, measurable_measure_prod_mk_left hs,
Diff
@@ -184,7 +184,7 @@ theorem measurable_measure_prod_mk_left_finite [FiniteMeasure ν] {s : Set (α 
       measure_Union (fun i j hij => Disjoint.preimage _ (h1f hij)) fun i =>
         measurable_prod_mk_left (h2f i)
     simp_rw [this]
-    apply Measurable.eNNReal_tsum h3f
+    apply Measurable.ennreal_tsum h3f
 #align measurable_measure_prod_mk_left_finite measurable_measure_prod_mk_left_finite
 
 /-- If `ν` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
Diff
@@ -3,14 +3,14 @@ Copyright (c) 2020 Floris van Doorn. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn
 
-! This file was ported from Lean 3 source module measure_theory.constructions.prod
-! leanprover-community/mathlib commit 726d2fe4fd196a6e796d3bc827d025abd32673ff
+! This file was ported from Lean 3 source module measure_theory.constructions.prod.basic
+! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.MeasureTheory.Measure.GiryMonad
 import Mathbin.Dynamics.Ergodic.MeasurePreserving
-import Mathbin.MeasureTheory.Integral.SetIntegral
+import Mathbin.MeasureTheory.Integral.Lebesgue
 import Mathbin.MeasureTheory.Measure.OpenPos
 
 /-!
@@ -22,7 +22,7 @@ satisfies `(μ.prod ν) s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`.
 We also have `(μ.prod ν) (s ×ˢ t) = μ s * ν t`, i.e. the measure of a rectangle is the product of
 the measures of the sides.
 
-We also prove Tonelli's theorem and Fubini's theorem.
+We also prove Tonelli's theorem.
 
 ## Main definition
 
@@ -40,14 +40,6 @@ We also prove Tonelli's theorem and Fubini's theorem.
   a variant with `_symm` appended, where the order of integration is reversed.
   The lemma `measurable.lintegral_prod_right'` states that the inner integral of the right-hand side
   is measurable.
-* `measure_theory.integrable_prod_iff` states that a binary function is integrable iff both
-  * `y ↦ f (x, y)` is integrable for almost every `x`, and
-  * the function `x ↦ ∫ ‖f (x, y)‖ dy` is integrable.
-* `measure_theory.integral_prod`: Fubini's theorem. It states that for a integrable function
-  `α × β → E` (where `E` is a second countable Banach space) we have
-  `∫ z, f z ∂(μ.prod ν) = ∫ x, ∫ y, f (x, y) ∂ν ∂μ`. This theorem has the same variants as
-  Tonelli's theorem. The lemma `measure_theory.integrable.integral_prod_right` states that the
-  inner integral of the right-hand side is integrable.
 
 ## Implementation Notes
 
@@ -56,12 +48,12 @@ functions in uncurried form (`α × β → γ`). The former often has an assumpt
 `measurable (uncurry f)`, which could be inconvenient to discharge, but for the latter it is more
 common that the function has to be given explicitly, since Lean cannot synthesize the function by
 itself. We name the lemmas about the uncurried form with a prime.
-Tonelli's theorem and Fubini's theorem have a different naming scheme, since the version for the
-uncurried version is reversed.
+Tonelli's theorem has a different naming scheme, since the version for the uncurried version is
+reversed.
 
 ## Tags
 
-product measure, Fubini's theorem, Tonelli's theorem, Fubini-Tonelli theorem
+product measure, Tonelli's theorem, Fubini-Tonelli theorem
 -/
 
 
@@ -272,99 +264,6 @@ theorem Measurable.lintegral_prod_left [SigmaFinite μ] {f : α → β → ℝ
   hf.lintegral_prod_left'
 #align measurable.lintegral_prod_left Measurable.lintegral_prod_left
 
-theorem measurableSet_integrable [SigmaFinite ν] ⦃f : α → β → E⦄
-    (hf : StronglyMeasurable (uncurry f)) : MeasurableSet { x | Integrable (f x) ν } :=
-  by
-  simp_rw [integrable, hf.of_uncurry_left.ae_strongly_measurable, true_and_iff]
-  exact measurableSet_lt (Measurable.lintegral_prod_right hf.ennnorm) measurable_const
-#align measurable_set_integrable measurableSet_integrable
-
-section
-
-variable [NormedSpace ℝ E] [CompleteSpace E]
-
-/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
-  Fubini's theorem is measurable.
-  This version has `f` in curried form. -/
-theorem MeasureTheory.StronglyMeasurable.integral_prod_right [SigmaFinite ν] ⦃f : α → β → E⦄
-    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂ν :=
-  by
-  borelize E
-  haveI : separable_space (range (uncurry f) ∪ {0} : Set E) :=
-    hf.separable_space_range_union_singleton
-  let s : ℕ → simple_func (α × β) E :=
-    simple_func.approx_on _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
-  let s' : ℕ → α → simple_func β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
-  let f' : ℕ → α → E := fun n => { x | integrable (f x) ν }.indicator fun x => (s' n x).integral ν
-  have hf' : ∀ n, strongly_measurable (f' n) :=
-    by
-    intro n
-    refine' strongly_measurable.indicator _ (measurableSet_integrable hf)
-    have : ∀ x, ((s' n x).range.filterₓ fun x => x ≠ 0) ⊆ (s n).range :=
-      by
-      intro x
-      refine' Finset.Subset.trans (Finset.filter_subset _ _) _
-      intro y
-      simp_rw [simple_func.mem_range]
-      rintro ⟨z, rfl⟩
-      exact ⟨(x, z), rfl⟩
-    simp only [simple_func.integral_eq_sum_of_subset (this _)]
-    refine' Finset.stronglyMeasurable_sum _ fun x _ => _
-    refine' (Measurable.eNNReal_toReal _).StronglyMeasurable.smul_const _
-    simp (config := { singlePass := true }) only [simple_func.coe_comp, preimage_comp]
-    apply measurable_measure_prod_mk_left
-    exact (s n).measurableSet_fiber x
-  have h2f' : tendsto f' at_top (𝓝 fun x : α => ∫ y : β, f x y ∂ν) :=
-    by
-    rw [tendsto_pi_nhds]
-    intro x
-    by_cases hfx : integrable (f x) ν
-    · have : ∀ n, integrable (s' n x) ν := by
-        intro n
-        apply (hfx.norm.add hfx.norm).mono' (s' n x).AeStronglyMeasurable
-        apply eventually_of_forall
-        intro y
-        simp_rw [s', simple_func.coe_comp]
-        exact simple_func.norm_approx_on_zero_le _ _ (x, y) n
-      simp only [f', hfx, simple_func.integral_eq_integral _ (this _), indicator_of_mem,
-        mem_set_of_eq]
-      refine'
-        tendsto_integral_of_dominated_convergence (fun y => ‖f x y‖ + ‖f x y‖)
-          (fun n => (s' n x).AeStronglyMeasurable) (hfx.norm.add hfx.norm) _ _
-      · exact fun n => eventually_of_forall fun y => simple_func.norm_approx_on_zero_le _ _ (x, y) n
-      · refine' eventually_of_forall fun y => simple_func.tendsto_approx_on _ _ _
-        apply subset_closure
-        simp [-uncurry_apply_pair]
-    · simp [f', hfx, integral_undef]
-  exact stronglyMeasurable_of_tendsto _ hf' h2f'
-#align measure_theory.strongly_measurable.integral_prod_right MeasureTheory.StronglyMeasurable.integral_prod_right
-
-/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
-  Fubini's theorem is measurable. -/
-theorem MeasureTheory.StronglyMeasurable.integral_prod_right' [SigmaFinite ν] ⦃f : α × β → E⦄
-    (hf : StronglyMeasurable f) : StronglyMeasurable fun x => ∫ y, f (x, y) ∂ν :=
-  by
-  rw [← uncurry_curry f] at hf
-  exact hf.integral_prod_right
-#align measure_theory.strongly_measurable.integral_prod_right' MeasureTheory.StronglyMeasurable.integral_prod_right'
-
-/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
-  the symmetric version of Fubini's theorem is measurable.
-  This version has `f` in curried form. -/
-theorem MeasureTheory.StronglyMeasurable.integral_prod_left [SigmaFinite μ] ⦃f : α → β → E⦄
-    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun y => ∫ x, f x y ∂μ :=
-  (hf.comp_measurable measurable_swap).integral_prod_right'
-#align measure_theory.strongly_measurable.integral_prod_left MeasureTheory.StronglyMeasurable.integral_prod_left
-
-/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
-  the symmetric version of Fubini's theorem is measurable. -/
-theorem MeasureTheory.StronglyMeasurable.integral_prod_left' [SigmaFinite μ] ⦃f : α × β → E⦄
-    (hf : StronglyMeasurable f) : StronglyMeasurable fun y => ∫ x, f (x, y) ∂μ :=
-  (hf.comp_measurable measurable_swap).integral_prod_right'
-#align measure_theory.strongly_measurable.integral_prod_left' MeasureTheory.StronglyMeasurable.integral_prod_left'
-
-end
-
 /-! ### The product measure -/
 
 
@@ -485,16 +384,6 @@ theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ
   refine' ae_lt_top (measurable_measure_prod_mk_left hs) h2s
 #align measure_theory.measure.ae_measure_lt_top MeasureTheory.Measure.ae_measure_lt_top
 
-theorem integrable_measure_prod_mk_left {s : Set (α × β)} (hs : MeasurableSet s)
-    (h2s : (μ.Prod ν) s ≠ ∞) : Integrable (fun x => (ν (Prod.mk x ⁻¹' s)).toReal) μ :=
-  by
-  refine' ⟨(measurable_measure_prod_mk_left hs).eNNReal_toReal.AEMeasurable.AeStronglyMeasurable, _⟩
-  simp_rw [has_finite_integral, ennnorm_eq_of_real to_real_nonneg]
-  convert h2s.lt_top using 1; simp_rw [prod_apply hs]; apply lintegral_congr_ae
-  refine' (ae_measure_lt_top hs h2s).mp _; apply eventually_of_forall; intro x hx
-  rw [lt_top_iff_ne_top] at hx; simp [of_real_to_real, hx]
-#align measure_theory.measure.integrable_measure_prod_mk_left MeasureTheory.Measure.integrable_measure_prod_mk_left
-
 /-- Note: the assumption `hs` cannot be dropped. For a counterexample, see
   Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
 theorem measure_prod_null {s : Set (α × β)} (hs : MeasurableSet s) :
@@ -802,14 +691,6 @@ theorem AEMeasurable.prod_swap [SigmaFinite μ] [SigmaFinite ν] {f : β × α 
   exact hf.comp_measurable measurable_swap
 #align ae_measurable.prod_swap AEMeasurable.prod_swap
 
-theorem MeasureTheory.AeStronglyMeasurable.prod_swap {γ : Type _} [TopologicalSpace γ]
-    [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ} (hf : AeStronglyMeasurable f (ν.Prod μ)) :
-    AeStronglyMeasurable (fun z : α × β => f z.symm) (μ.Prod ν) :=
-  by
-  rw [← prod_swap] at hf
-  exact hf.comp_measurable measurable_swap
-#align measure_theory.ae_strongly_measurable.prod_swap MeasureTheory.AeStronglyMeasurable.prod_swap
-
 theorem AEMeasurable.fst [SigmaFinite ν] {f : α → γ} (hf : AEMeasurable f μ) :
     AEMeasurable (fun z : α × β => f z.1) (μ.Prod ν) :=
   hf.comp_quasiMeasurePreserving quasiMeasurePreserving_fst
@@ -820,34 +701,6 @@ theorem AEMeasurable.snd [SigmaFinite ν] {f : β → γ} (hf : AEMeasurable f 
   hf.comp_quasiMeasurePreserving quasiMeasurePreserving_snd
 #align ae_measurable.snd AEMeasurable.snd
 
-theorem MeasureTheory.AeStronglyMeasurable.fst {γ} [TopologicalSpace γ] [SigmaFinite ν] {f : α → γ}
-    (hf : AeStronglyMeasurable f μ) : AeStronglyMeasurable (fun z : α × β => f z.1) (μ.Prod ν) :=
-  hf.comp_quasiMeasurePreserving quasiMeasurePreserving_fst
-#align measure_theory.ae_strongly_measurable.fst MeasureTheory.AeStronglyMeasurable.fst
-
-theorem MeasureTheory.AeStronglyMeasurable.snd {γ} [TopologicalSpace γ] [SigmaFinite ν] {f : β → γ}
-    (hf : AeStronglyMeasurable f ν) : AeStronglyMeasurable (fun z : α × β => f z.2) (μ.Prod ν) :=
-  hf.comp_quasiMeasurePreserving quasiMeasurePreserving_snd
-#align measure_theory.ae_strongly_measurable.snd MeasureTheory.AeStronglyMeasurable.snd
-
-/-- The Bochner integral is a.e.-measurable.
-  This shows that the integrand of (the right-hand-side of) Fubini's theorem is a.e.-measurable. -/
-theorem MeasureTheory.AeStronglyMeasurable.integral_prod_right' [SigmaFinite ν] [NormedSpace ℝ E]
-    [CompleteSpace E] ⦃f : α × β → E⦄ (hf : AeStronglyMeasurable f (μ.Prod ν)) :
-    AeStronglyMeasurable (fun x => ∫ y, f (x, y) ∂ν) μ :=
-  ⟨fun x => ∫ y, hf.mk f (x, y) ∂ν, hf.stronglyMeasurable_mk.integral_prod_right', by
-    filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with _ hx using integral_congr_ae hx⟩
-#align measure_theory.ae_strongly_measurable.integral_prod_right' MeasureTheory.AeStronglyMeasurable.integral_prod_right'
-
-theorem MeasureTheory.AeStronglyMeasurable.prod_mk_left {γ : Type _} [SigmaFinite ν]
-    [TopologicalSpace γ] {f : α × β → γ} (hf : AeStronglyMeasurable f (μ.Prod ν)) :
-    ∀ᵐ x ∂μ, AeStronglyMeasurable (fun y => f (x, y)) ν :=
-  by
-  filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with x hx
-  exact
-    ⟨fun y => hf.mk f (x, y), hf.strongly_measurable_mk.comp_measurable measurable_prod_mk_left, hx⟩
-#align measure_theory.ae_strongly_measurable.prod_mk_left MeasureTheory.AeStronglyMeasurable.prod_mk_left
-
 end
 
 namespace MeasureTheory
@@ -943,336 +796,6 @@ theorem lintegral_prod_mul {f : α → ℝ≥0∞} {g : β → ℝ≥0∞} (hf :
   simp [lintegral_prod _ (hf.fst.mul hg.snd), lintegral_lintegral_mul hf hg]
 #align measure_theory.lintegral_prod_mul MeasureTheory.lintegral_prod_mul
 
-/-! ### Integrability on a product -/
-
-
-section
-
-theorem Integrable.swap [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) :
-    Integrable (f ∘ Prod.swap) (ν.Prod μ) :=
-  ⟨hf.AeStronglyMeasurable.prod_swap,
-    (lintegral_prod_swap _ hf.AeStronglyMeasurable.ennnorm : _).le.trans_lt hf.HasFiniteIntegral⟩
-#align measure_theory.integrable.swap MeasureTheory.Integrable.swap
-
-theorem integrable_swap_iff [SigmaFinite μ] ⦃f : α × β → E⦄ :
-    Integrable (f ∘ Prod.swap) (ν.Prod μ) ↔ Integrable f (μ.Prod ν) :=
-  ⟨fun hf => by
-    convert hf.swap
-    ext ⟨x, y⟩
-    rfl, fun hf => hf.symm⟩
-#align measure_theory.integrable_swap_iff MeasureTheory.integrable_swap_iff
-
-theorem hasFiniteIntegral_prod_iff ⦃f : α × β → E⦄ (h1f : StronglyMeasurable f) :
-    HasFiniteIntegral f (μ.Prod ν) ↔
-      (∀ᵐ x ∂μ, HasFiniteIntegral (fun y => f (x, y)) ν) ∧
-        HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ :=
-  by
-  simp only [has_finite_integral, lintegral_prod_of_measurable _ h1f.ennnorm]
-  have : ∀ x, ∀ᵐ y ∂ν, 0 ≤ ‖f (x, y)‖ := fun x => eventually_of_forall fun y => norm_nonneg _
-  simp_rw [integral_eq_lintegral_of_nonneg_ae (this _)
-      (h1f.norm.comp_measurable measurable_prod_mk_left).AeStronglyMeasurable,
-    ennnorm_eq_of_real to_real_nonneg, ofReal_norm_eq_coe_nnnorm]
-  -- this fact is probably too specialized to be its own lemma
-  have : ∀ {p q r : Prop} (h1 : r → p), (r ↔ p ∧ q) ↔ p → (r ↔ q) := fun p q r h1 => by
-    rw [← and_congr_right_iff, and_iff_right_of_imp h1]
-  rw [this]
-  · intro h2f
-    rw [lintegral_congr_ae]
-    refine' h2f.mp _
-    apply eventually_of_forall
-    intro x hx
-    dsimp only
-    rw [of_real_to_real]
-    rw [← lt_top_iff_ne_top]
-    exact hx
-  · intro h2f
-    refine' ae_lt_top _ h2f.ne
-    exact h1f.ennnorm.lintegral_prod_right'
-#align measure_theory.has_finite_integral_prod_iff MeasureTheory.hasFiniteIntegral_prod_iff
-
-theorem hasFiniteIntegral_prod_iff' ⦃f : α × β → E⦄ (h1f : AeStronglyMeasurable f (μ.Prod ν)) :
-    HasFiniteIntegral f (μ.Prod ν) ↔
-      (∀ᵐ x ∂μ, HasFiniteIntegral (fun y => f (x, y)) ν) ∧
-        HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ :=
-  by
-  rw [has_finite_integral_congr h1f.ae_eq_mk,
-    has_finite_integral_prod_iff h1f.strongly_measurable_mk]
-  apply and_congr
-  · apply eventually_congr
-    filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm]
-    intro x hx
-    exact has_finite_integral_congr hx
-  · apply has_finite_integral_congr
-    filter_upwards [ae_ae_of_ae_prod
-        h1f.ae_eq_mk.symm]with _ hx using integral_congr_ae (eventually_eq.fun_comp hx _)
-  · infer_instance
-#align measure_theory.has_finite_integral_prod_iff' MeasureTheory.hasFiniteIntegral_prod_iff'
-
-/-- A binary function is integrable if the function `y ↦ f (x, y)` is integrable for almost every
-  `x` and the function `x ↦ ∫ ‖f (x, y)‖ dy` is integrable. -/
-theorem integrable_prod_iff ⦃f : α × β → E⦄ (h1f : AeStronglyMeasurable f (μ.Prod ν)) :
-    Integrable f (μ.Prod ν) ↔
-      (∀ᵐ x ∂μ, Integrable (fun y => f (x, y)) ν) ∧ Integrable (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ :=
-  by
-  simp [integrable, h1f, has_finite_integral_prod_iff', h1f.norm.integral_prod_right',
-    h1f.prod_mk_left]
-#align measure_theory.integrable_prod_iff MeasureTheory.integrable_prod_iff
-
-/-- A binary function is integrable if the function `x ↦ f (x, y)` is integrable for almost every
-  `y` and the function `y ↦ ∫ ‖f (x, y)‖ dx` is integrable. -/
-theorem integrable_prod_iff' [SigmaFinite μ] ⦃f : α × β → E⦄
-    (h1f : AeStronglyMeasurable f (μ.Prod ν)) :
-    Integrable f (μ.Prod ν) ↔
-      (∀ᵐ y ∂ν, Integrable (fun x => f (x, y)) μ) ∧ Integrable (fun y => ∫ x, ‖f (x, y)‖ ∂μ) ν :=
-  by
-  convert integrable_prod_iff h1f.prod_swap using 1
-  rw [integrable_swap_iff]
-#align measure_theory.integrable_prod_iff' MeasureTheory.integrable_prod_iff'
-
-theorem Integrable.prod_left_ae [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) :
-    ∀ᵐ y ∂ν, Integrable (fun x => f (x, y)) μ :=
-  ((integrable_prod_iff' hf.AeStronglyMeasurable).mp hf).1
-#align measure_theory.integrable.prod_left_ae MeasureTheory.Integrable.prod_left_ae
-
-theorem Integrable.prod_right_ae [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) :
-    ∀ᵐ x ∂μ, Integrable (fun y => f (x, y)) ν :=
-  hf.symm.prod_left_ae
-#align measure_theory.integrable.prod_right_ae MeasureTheory.Integrable.prod_right_ae
-
-theorem Integrable.integral_norm_prod_left ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) :
-    Integrable (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ :=
-  ((integrable_prod_iff hf.AeStronglyMeasurable).mp hf).2
-#align measure_theory.integrable.integral_norm_prod_left MeasureTheory.Integrable.integral_norm_prod_left
-
-theorem Integrable.integral_norm_prod_right [SigmaFinite μ] ⦃f : α × β → E⦄
-    (hf : Integrable f (μ.Prod ν)) : Integrable (fun y => ∫ x, ‖f (x, y)‖ ∂μ) ν :=
-  hf.symm.integral_norm_prod_left
-#align measure_theory.integrable.integral_norm_prod_right MeasureTheory.Integrable.integral_norm_prod_right
-
-theorem integrable_prod_mul {L : Type _} [IsROrC L] {f : α → L} {g : β → L} (hf : Integrable f μ)
-    (hg : Integrable g ν) : Integrable (fun z : α × β => f z.1 * g z.2) (μ.Prod ν) :=
-  by
-  refine' (integrable_prod_iff _).2 ⟨_, _⟩
-  · exact hf.1.fst.mul hg.1.snd
-  · exact eventually_of_forall fun x => hg.const_mul (f x)
-  · simpa only [norm_mul, integral_mul_left] using hf.norm.mul_const _
-#align measure_theory.integrable_prod_mul MeasureTheory.integrable_prod_mul
-
-end
-
-variable [NormedSpace ℝ E] [CompleteSpace E]
-
-theorem Integrable.integral_prod_left ⦃f : α × β → E⦄ (hf : Integrable f (μ.Prod ν)) :
-    Integrable (fun x => ∫ y, f (x, y) ∂ν) μ :=
-  Integrable.mono hf.integral_norm_prod_left hf.AeStronglyMeasurable.integral_prod_right' <|
-    eventually_of_forall fun x =>
-      (norm_integral_le_integral_norm _).trans_eq <|
-        (norm_of_nonneg <|
-            integral_nonneg_of_ae <|
-              eventually_of_forall fun y => (norm_nonneg (f (x, y)) : _)).symm
-#align measure_theory.integrable.integral_prod_left MeasureTheory.Integrable.integral_prod_left
-
-theorem Integrable.integral_prod_right [SigmaFinite μ] ⦃f : α × β → E⦄
-    (hf : Integrable f (μ.Prod ν)) : Integrable (fun y => ∫ x, f (x, y) ∂μ) ν :=
-  hf.symm.integral_prod_left
-#align measure_theory.integrable.integral_prod_right MeasureTheory.Integrable.integral_prod_right
-
-/-! ### The Bochner integral on a product -/
-
-
-variable [SigmaFinite μ]
-
-theorem integral_prod_swap (f : α × β → E) (hf : AeStronglyMeasurable f (μ.Prod ν)) :
-    (∫ z, f z.symm ∂ν.Prod μ) = ∫ z, f z ∂μ.Prod ν :=
-  by
-  rw [← prod_swap] at hf
-  rw [← integral_map measurable_swap.ae_measurable hf, prod_swap]
-#align measure_theory.integral_prod_swap MeasureTheory.integral_prod_swap
-
-variable {E' : Type _} [NormedAddCommGroup E'] [CompleteSpace E'] [NormedSpace ℝ E']
-
-/-! Some rules about the sum/difference of double integrals. They follow from `integral_add`, but
-  we separate them out as separate lemmas, because they involve quite some steps. -/
-
-
-/-- Integrals commute with addition inside another integral. `F` can be any function. -/
-theorem integral_fn_integral_add ⦃f g : α × β → E⦄ (F : E → E') (hf : Integrable f (μ.Prod ν))
-    (hg : Integrable g (μ.Prod ν)) :
-    (∫ x, F (∫ y, f (x, y) + g (x, y) ∂ν) ∂μ) = ∫ x, F ((∫ y, f (x, y) ∂ν) + ∫ y, g (x, y) ∂ν) ∂μ :=
-  by
-  refine' integral_congr_ae _
-  filter_upwards [hf.prod_right_ae, hg.prod_right_ae]with _ h2f h2g
-  simp [integral_add h2f h2g]
-#align measure_theory.integral_fn_integral_add MeasureTheory.integral_fn_integral_add
-
-/-- Integrals commute with subtraction inside another integral.
-  `F` can be any measurable function. -/
-theorem integral_fn_integral_sub ⦃f g : α × β → E⦄ (F : E → E') (hf : Integrable f (μ.Prod ν))
-    (hg : Integrable g (μ.Prod ν)) :
-    (∫ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ) = ∫ x, F ((∫ y, f (x, y) ∂ν) - ∫ y, g (x, y) ∂ν) ∂μ :=
-  by
-  refine' integral_congr_ae _
-  filter_upwards [hf.prod_right_ae, hg.prod_right_ae]with _ h2f h2g
-  simp [integral_sub h2f h2g]
-#align measure_theory.integral_fn_integral_sub MeasureTheory.integral_fn_integral_sub
-
-/-- Integrals commute with subtraction inside a lower Lebesgue integral.
-  `F` can be any function. -/
-theorem lintegral_fn_integral_sub ⦃f g : α × β → E⦄ (F : E → ℝ≥0∞) (hf : Integrable f (μ.Prod ν))
-    (hg : Integrable g (μ.Prod ν)) :
-    (∫⁻ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ) =
-      ∫⁻ x, F ((∫ y, f (x, y) ∂ν) - ∫ y, g (x, y) ∂ν) ∂μ :=
-  by
-  refine' lintegral_congr_ae _
-  filter_upwards [hf.prod_right_ae, hg.prod_right_ae]with _ h2f h2g
-  simp [integral_sub h2f h2g]
-#align measure_theory.lintegral_fn_integral_sub MeasureTheory.lintegral_fn_integral_sub
-
-/-- Double integrals commute with addition. -/
-theorem integral_integral_add ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν))
-    (hg : Integrable g (μ.Prod ν)) :
-    (∫ x, ∫ y, f (x, y) + g (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) + ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
-  (integral_fn_integral_add id hf hg).trans <|
-    integral_add hf.integral_prod_left hg.integral_prod_left
-#align measure_theory.integral_integral_add MeasureTheory.integral_integral_add
-
-/-- Double integrals commute with addition. This is the version with `(f + g) (x, y)`
-  (instead of `f (x, y) + g (x, y)`) in the LHS. -/
-theorem integral_integral_add' ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν))
-    (hg : Integrable g (μ.Prod ν)) :
-    (∫ x, ∫ y, (f + g) (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) + ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
-  integral_integral_add hf hg
-#align measure_theory.integral_integral_add' MeasureTheory.integral_integral_add'
-
-/-- Double integrals commute with subtraction. -/
-theorem integral_integral_sub ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν))
-    (hg : Integrable g (μ.Prod ν)) :
-    (∫ x, ∫ y, f (x, y) - g (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) - ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
-  (integral_fn_integral_sub id hf hg).trans <|
-    integral_sub hf.integral_prod_left hg.integral_prod_left
-#align measure_theory.integral_integral_sub MeasureTheory.integral_integral_sub
-
-/-- Double integrals commute with subtraction. This is the version with `(f - g) (x, y)`
-  (instead of `f (x, y) - g (x, y)`) in the LHS. -/
-theorem integral_integral_sub' ⦃f g : α × β → E⦄ (hf : Integrable f (μ.Prod ν))
-    (hg : Integrable g (μ.Prod ν)) :
-    (∫ x, ∫ y, (f - g) (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) - ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
-  integral_integral_sub hf hg
-#align measure_theory.integral_integral_sub' MeasureTheory.integral_integral_sub'
-
-/-- The map that sends an L¹-function `f : α × β → E` to `∫∫f` is continuous. -/
-theorem continuous_integral_integral :
-    Continuous fun f : α × β →₁[μ.Prod ν] E => ∫ x, ∫ y, f (x, y) ∂ν ∂μ :=
-  by
-  rw [continuous_iff_continuousAt]; intro g
-  refine'
-    tendsto_integral_of_L1 _ (L1.integrable_coe_fn g).integral_prod_left
-      (eventually_of_forall fun h => (L1.integrable_coe_fn h).integral_prod_left) _
-  simp_rw [←
-    lintegral_fn_integral_sub (fun x => (‖x‖₊ : ℝ≥0∞)) (L1.integrable_coe_fn _)
-      (L1.integrable_coe_fn g)]
-  refine' tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds _ (fun i => zero_le _) _
-  · exact fun i => ∫⁻ x, ∫⁻ y, ‖i (x, y) - g (x, y)‖₊ ∂ν ∂μ
-  swap; · exact fun i => lintegral_mono fun x => ennnorm_integral_le_lintegral_ennnorm _
-  show
-    tendsto (fun i : α × β →₁[μ.prod ν] E => ∫⁻ x, ∫⁻ y : β, ‖i (x, y) - g (x, y)‖₊ ∂ν ∂μ) (𝓝 g)
-      (𝓝 0)
-  have : ∀ i : α × β →₁[μ.prod ν] E, Measurable fun z => (‖i z - g z‖₊ : ℝ≥0∞) := fun i =>
-    ((Lp.strongly_measurable i).sub (Lp.strongly_measurable g)).ennnorm
-  simp_rw [← lintegral_prod_of_measurable _ (this _), ← L1.of_real_norm_sub_eq_lintegral, ←
-    of_real_zero]
-  refine' (continuous_of_real.tendsto 0).comp _
-  rw [← tendsto_iff_norm_tendsto_zero]; exact tendsto_id
-#align measure_theory.continuous_integral_integral MeasureTheory.continuous_integral_integral
-
-/-- **Fubini's Theorem**: For integrable functions on `α × β`,
-  the Bochner integral of `f` is equal to the iterated Bochner integral.
-  `integrable_prod_iff` can be useful to show that the function in question in integrable.
-  `measure_theory.integrable.integral_prod_right` is useful to show that the inner integral
-  of the right-hand side is integrable. -/
-theorem integral_prod :
-    ∀ (f : α × β → E) (hf : Integrable f (μ.Prod ν)),
-      (∫ z, f z ∂μ.Prod ν) = ∫ x, ∫ y, f (x, y) ∂ν ∂μ :=
-  by
-  apply integrable.induction
-  · intro c s hs h2s
-    simp_rw [integral_indicator hs, ← indicator_comp_right, Function.comp,
-      integral_indicator (measurable_prod_mk_left hs), set_integral_const, integral_smul_const,
-      integral_to_real (measurable_measure_prod_mk_left hs).AEMeasurable
-        (ae_measure_lt_top hs h2s.ne),
-      prod_apply hs]
-  · intro f g hfg i_f i_g hf hg
-    simp_rw [integral_add' i_f i_g, integral_integral_add' i_f i_g, hf, hg]
-  · exact isClosed_eq continuous_integral continuous_integral_integral
-  · intro f g hfg i_f hf
-    convert hf using 1
-    · exact integral_congr_ae hfg.symm
-    · refine' integral_congr_ae _
-      refine' (ae_ae_of_ae_prod hfg).mp _
-      apply eventually_of_forall
-      intro x hfgx
-      exact integral_congr_ae (ae_eq_symm hfgx)
-#align measure_theory.integral_prod MeasureTheory.integral_prod
-
-/-- Symmetric version of **Fubini's Theorem**: For integrable functions on `α × β`,
-  the Bochner integral of `f` is equal to the iterated Bochner integral.
-  This version has the integrals on the right-hand side in the other order. -/
-theorem integral_prod_symm (f : α × β → E) (hf : Integrable f (μ.Prod ν)) :
-    (∫ z, f z ∂μ.Prod ν) = ∫ y, ∫ x, f (x, y) ∂μ ∂ν :=
-  by
-  simp_rw [← integral_prod_swap f hf.ae_strongly_measurable]
-  exact integral_prod _ hf.swap
-#align measure_theory.integral_prod_symm MeasureTheory.integral_prod_symm
-
-/-- Reversed version of **Fubini's Theorem**. -/
-theorem integral_integral {f : α → β → E} (hf : Integrable (uncurry f) (μ.Prod ν)) :
-    (∫ x, ∫ y, f x y ∂ν ∂μ) = ∫ z, f z.1 z.2 ∂μ.Prod ν :=
-  (integral_prod _ hf).symm
-#align measure_theory.integral_integral MeasureTheory.integral_integral
-
-/-- Reversed version of **Fubini's Theorem** (symmetric version). -/
-theorem integral_integral_symm {f : α → β → E} (hf : Integrable (uncurry f) (μ.Prod ν)) :
-    (∫ x, ∫ y, f x y ∂ν ∂μ) = ∫ z, f z.2 z.1 ∂ν.Prod μ :=
-  (integral_prod_symm _ hf.symm).symm
-#align measure_theory.integral_integral_symm MeasureTheory.integral_integral_symm
-
-/-- Change the order of Bochner integration. -/
-theorem integral_integral_swap ⦃f : α → β → E⦄ (hf : Integrable (uncurry f) (μ.Prod ν)) :
-    (∫ x, ∫ y, f x y ∂ν ∂μ) = ∫ y, ∫ x, f x y ∂μ ∂ν :=
-  (integral_integral hf).trans (integral_prod_symm _ hf)
-#align measure_theory.integral_integral_swap MeasureTheory.integral_integral_swap
-
-/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-/-- **Fubini's Theorem** for set integrals. -/
-theorem set_integral_prod (f : α × β → E) {s : Set α} {t : Set β}
-    (hf : IntegrableOn f (s ×ˢ t) (μ.Prod ν)) :
-    (∫ z in s ×ˢ t, f z ∂μ.Prod ν) = ∫ x in s, ∫ y in t, f (x, y) ∂ν ∂μ :=
-  by
-  simp only [← measure.prod_restrict s t, integrable_on] at hf⊢
-  exact integral_prod f hf
-#align measure_theory.set_integral_prod MeasureTheory.set_integral_prod
-
-theorem integral_prod_mul {L : Type _} [IsROrC L] (f : α → L) (g : β → L) :
-    (∫ z, f z.1 * g z.2 ∂μ.Prod ν) = (∫ x, f x ∂μ) * ∫ y, g y ∂ν :=
-  by
-  by_cases h : integrable (fun z : α × β => f z.1 * g z.2) (μ.prod ν)
-  · rw [integral_prod _ h]
-    simp_rw [integral_mul_left, integral_mul_right]
-  have H : ¬integrable f μ ∨ ¬integrable g ν :=
-    by
-    contrapose! h
-    exact integrable_prod_mul h.1 h.2
-  cases H <;> simp [integral_undef h, integral_undef H]
-#align measure_theory.integral_prod_mul MeasureTheory.integral_prod_mul
-
-/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-theorem set_integral_prod_mul {L : Type _} [IsROrC L] (f : α → L) (g : β → L) (s : Set α)
-    (t : Set β) :
-    (∫ z in s ×ˢ t, f z.1 * g z.2 ∂μ.Prod ν) = (∫ x in s, f x ∂μ) * ∫ y in t, g y ∂ν := by
-  simp only [← measure.prod_restrict s t, integrable_on, integral_prod_mul]
-#align measure_theory.set_integral_prod_mul MeasureTheory.set_integral_prod_mul
-
 /-! ### Marginals of a measure defined on a product -/
 
 

Changes in mathlib4

mathlib3
mathlib4
chore: superfluous parentheses part 2 (#12131)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -372,8 +372,8 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν
     calc
       μ s * ν t ≤ μ s' * ν t := mul_le_mul_right' (measure_mono hss') _
       _ = ∫⁻ _ in s', ν t ∂μ := by rw [set_lintegral_const, mul_comm]
-      _ ≤ ∫⁻ x in s', f x ∂μ := (set_lintegral_mono measurable_const hfm fun x => id)
-      _ ≤ ∫⁻ x, f x ∂μ := (lintegral_mono' restrict_le_self le_rfl)
+      _ ≤ ∫⁻ x in s', f x ∂μ := set_lintegral_mono measurable_const hfm fun x => id
+      _ ≤ ∫⁻ x, f x ∂μ := lintegral_mono' restrict_le_self le_rfl
       _ = μ.prod ν ST := (prod_apply hSTm).symm
       _ = μ.prod ν (s ×ˢ t) := measure_toMeasurable _
 #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -86,11 +86,8 @@ theorem IsCountablySpanning.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsC
 #align is_countably_spanning.prod IsCountablySpanning.prod
 
 variable [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace β']
-
 variable [MeasurableSpace γ]
-
 variable {μ μ' : Measure α} {ν ν' : Measure β} {τ : Measure γ}
-
 variable [NormedAddCommGroup E]
 
 /-! ### Measurability
chore: scope open Classical (#11199)

We remove all but one open Classicals, instead preferring to use open scoped Classical. The only real side-effect this led to is moving a couple declarations to use Exists.choose instead of Classical.choose.

The first few commits are explicitly labelled regex replaces for ease of review.

Diff
@@ -56,7 +56,8 @@ product measure, Tonelli's theorem, Fubini-Tonelli theorem
 
 noncomputable section
 
-open Classical Topology ENNReal MeasureTheory
+open scoped Classical
+open Topology ENNReal MeasureTheory
 
 open Set Function Real ENNReal
 
chore: move Mathlib to v4.7.0-rc1 (#11162)

This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0 branch as we update to intermediate nightlies.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>

Diff
@@ -359,7 +359,7 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν
         measure_mono <| Set.prod_mono (subset_toMeasurable _ _) (subset_toMeasurable _ _)
       _ = μ (toMeasurable μ s) * ν (toMeasurable ν t) := by
         rw [prod_apply hSTm]
-        simp_rw [mk_preimage_prod_right_eq_if, measure_if,
+        simp_rw [ST, mk_preimage_prod_right_eq_if, measure_if,
           lintegral_indicator _ (measurableSet_toMeasurable _ _), lintegral_const,
           restrict_apply_univ, mul_comm]
       _ = μ s * ν t := by rw [measure_toMeasurable, measure_toMeasurable]
@@ -438,7 +438,8 @@ instance prod.instIsFiniteMeasureOnCompacts {α β : Type*} [TopologicalSpace α
   set L := (Prod.fst '' K) ×ˢ (Prod.snd '' K) with hL
   have : K ⊆ L := by
     rintro ⟨x, y⟩ hxy
-    simp only [prod_mk_mem_set_prod_eq, mem_image, Prod.exists, exists_and_right, exists_eq_right]
+    simp only [L, prod_mk_mem_set_prod_eq, mem_image, Prod.exists, exists_and_right,
+      exists_eq_right]
     exact ⟨⟨y, hxy⟩, ⟨x, hxy⟩⟩
   apply lt_of_le_of_lt (measure_mono this)
   rw [hL, prod_prod]
chore: remove terminal, terminal refines (#10762)

I replaced a few "terminal" refine/refine's with exact.

The strategy was very simple-minded: essentially any refine whose following line had smaller indentation got replaced by exact and then I cleaned up the mess.

This PR certainly leaves some further terminal refines, but maybe the current change is beneficial.

Diff
@@ -466,7 +466,7 @@ instance prod.instNoAtoms_snd [NoAtoms ν] :
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.prod ν) s ≠ ∞) :
     ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by
   rw [prod_apply hs] at h2s
-  refine' ae_lt_top (measurable_measure_prod_mk_left hs) h2s
+  exact ae_lt_top (measurable_measure_prod_mk_left hs) h2s
 #align measure_theory.measure.ae_measure_lt_top MeasureTheory.Measure.ae_measure_lt_top
 
 /-- Note: the assumption `hs` cannot be dropped. For a counterexample, see
feat(Probability): condKernel and condDistrib applied to singletons of non-zero measure (#9351)

From the PFR project.

Diff
@@ -233,6 +233,44 @@ theorem MeasurableEmbedding.prod_mk {α β γ δ : Type*} {mα : MeasurableSpace
       exact MeasurableSet.iUnion hg
 #align measurable_embedding.prod_mk MeasurableEmbedding.prod_mk
 
+lemma MeasurableEmbedding.prod_mk_left {β γ : Type*} [MeasurableSingletonClass α]
+    {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
+    (x : α) {f : γ → β} (hf : MeasurableEmbedding f) :
+    MeasurableEmbedding (fun y ↦ (x, f y)) where
+  injective := by
+    intro y y'
+    simp only [Prod.mk.injEq, true_and]
+    exact fun h ↦ hf.injective h
+  measurable := Measurable.prod_mk measurable_const hf.measurable
+  measurableSet_image' := by
+    intro s hs
+    convert (MeasurableSet.singleton x).prod (hf.measurableSet_image.mpr hs)
+    ext x
+    simp
+
+lemma measurableEmbedding_prod_mk_left [MeasurableSingletonClass α] (x : α) :
+    MeasurableEmbedding (Prod.mk x : β → α × β) :=
+  MeasurableEmbedding.prod_mk_left x MeasurableEmbedding.id
+
+lemma MeasurableEmbedding.prod_mk_right {β γ : Type*} [MeasurableSingletonClass α]
+    {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
+    {f : γ → β} (hf : MeasurableEmbedding f) (x : α) :
+    MeasurableEmbedding (fun y ↦ (f y, x)) where
+  injective := by
+    intro y y'
+    simp only [Prod.mk.injEq, and_true]
+    exact fun h ↦ hf.injective h
+  measurable := Measurable.prod_mk hf.measurable measurable_const
+  measurableSet_image' := by
+    intro s hs
+    convert (hf.measurableSet_image.mpr hs).prod (MeasurableSet.singleton x)
+    ext x
+    simp
+
+lemma measurableEmbedding_prod_mk_right [MeasurableSingletonClass α] (x : α) :
+    MeasurableEmbedding (fun y ↦ (y, x) : β → β × α) :=
+  MeasurableEmbedding.prod_mk_right MeasurableEmbedding.id x
+
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   Tonelli's theorem is measurable. -/
 theorem Measurable.lintegral_prod_right' [SFinite ν] :
refactor(*): change definition of Set.image2 etc (#9275)
  • Redefine Set.image2 to use ∃ a ∈ s, ∃ b ∈ t, f a b = c instead of ∃ a b, a ∈ s ∧ b ∈ t ∧ f a b = c.
  • Redefine Set.seq as Set.image2. The new definition is equal to the old one but rw [Set.seq] gives a different result.
  • Redefine Filter.map₂ to use ∃ u ∈ f, ∃ v ∈ g, image2 m u v ⊆ s instead of ∃ u v, u ∈ f ∧ v ∈ g ∧ ...
  • Update lemmas like Set.mem_image2, Finset.mem_image₂, Set.mem_mul, Finset.mem_div etc

The two reasons to make the change are:

  • ∃ a ∈ s, ∃ b ∈ t, _ is a simp-normal form, and
  • it looks a bit nicer.
Diff
@@ -71,7 +71,7 @@ variable {α α' β β' γ E : Type*}
 /-- Rectangles formed by π-systems form a π-system. -/
 theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C)
     (hD : IsPiSystem D) : IsPiSystem (image2 (· ×ˢ ·) C D) := by
-  rintro _ ⟨s₁, t₁, hs₁, ht₁, rfl⟩ _ ⟨s₂, t₂, hs₂, ht₂, rfl⟩ hst
+  rintro _ ⟨s₁, hs₁, t₁, ht₁, rfl⟩ _ ⟨s₂, hs₂, t₂, ht₂, rfl⟩ hst
   rw [prod_inter_prod] at hst ⊢; rw [prod_nonempty_iff] at hst
   exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2)
 #align is_pi_system.prod IsPiSystem.prod
@@ -113,7 +113,7 @@ theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC :
       apply MeasurableSet.iUnion
       intro n
       apply measurableSet_generateFrom
-      exact ⟨s, t n, hs, h1t n, rfl⟩
+      exact ⟨s, hs, t n, h1t n, rfl⟩
     · rcases hC with ⟨t, h1t, h2t⟩
       rw [← univ_prod, ← h2t, iUnion_prod_const]
       apply MeasurableSet.iUnion
@@ -121,7 +121,7 @@ theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC :
       apply measurableSet_generateFrom
       exact mem_image2_of_mem (h1t n) hs
   · apply generateFrom_le
-    rintro _ ⟨s, t, hs, ht, rfl⟩
+    rintro _ ⟨s, hs, t, ht, rfl⟩
     dsimp only
     rw [prod_eq]
     apply (measurable_fst _).inter (measurable_snd _)
@@ -159,7 +159,7 @@ theorem measurable_measure_prod_mk_left_finite [IsFiniteMeasure ν] {s : Set (α
   refine' induction_on_inter (C := fun s => Measurable fun x => ν (Prod.mk x ⁻¹' s))
     generateFrom_prod.symm isPiSystem_prod _ _ _ _ hs
   · simp [measurable_zero, const_def]
-  · rintro _ ⟨s, t, hs, _, rfl⟩
+  · rintro _ ⟨s, hs, t, _, rfl⟩
     simp only [mk_preimage_prod_right_eq_if, measure_if]
     exact measurable_const.indicator hs
   · intro t ht h2t
@@ -221,7 +221,7 @@ theorem MeasurableEmbedding.prod_mk {α β γ δ : Type*} {mα : MeasurableSpace
         (fun s => MeasurableSet ((fun x : γ × α => (g x.fst, f x.snd)) '' s)) _ _
         generateFrom_prod.symm isPiSystem_prod _ _ _ _ _ hs
     · simp only [Set.image_empty, MeasurableSet.empty]
-    · rintro t ⟨t₁, t₂, ht₁, ht₂, rfl⟩
+    · rintro t ⟨t₁, ht₁, t₂, ht₂, rfl⟩
       rw [← Set.prod_image_image_eq]
       exact (hg.measurableSet_image.mpr ht₁).prod (hf.measurableSet_image.mpr ht₂)
     · intro t _ ht_m
@@ -600,7 +600,7 @@ theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set 
     (h3C.prod h3D).ext
       (generateFrom_eq_prod hC hD h3C.isCountablySpanning h3D.isCountablySpanning).symm
       (h2C.prod h2D) _
-  · rintro _ ⟨s, t, hs, ht, rfl⟩
+  · rintro _ ⟨s, hs, t, ht, rfl⟩
     haveI := h3D.sigmaFinite
     rw [h₁ s hs t ht, prod_prod]
 #align measure_theory.measure.prod_eq_generate_from MeasureTheory.Measure.prod_eq_generateFrom
@@ -703,7 +703,7 @@ theorem prodAssoc_prod [SFinite τ] :
     isPiSystem_measurableSet isPiSystem_prod ((sFiniteSeq μ i.1.1)).toFiniteSpanningSetsIn
     ((sFiniteSeq ν i.1.2).toFiniteSpanningSetsIn.prod (sFiniteSeq τ i.2).toFiniteSpanningSetsIn)
       _).symm
-  rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_setOf_eq] at hs ht hu
+  rintro s hs _ ⟨t, ht, u, hu, rfl⟩; rw [mem_setOf_eq] at hs ht hu
   simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)),
     MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod,
     mul_assoc]
chore: tidy various files (#9016)
Diff
@@ -694,7 +694,7 @@ theorem prodAssoc_prod [SFinite τ] :
         (sFiniteSeq μ p.1.1).prod ((sFiniteSeq ν p.1.2).prod (sFiniteSeq τ p.2))) := by
     ext s hs
     rw [sum_apply _ hs, sum_apply _ hs, ← (Equiv.prodAssoc _ _ _).tsum_eq]
-    rfl
+    simp only [Equiv.prodAssoc_apply]
   rw [← sum_sFiniteSeq μ, ← sum_sFiniteSeq ν, ← sum_sFiniteSeq τ, prod_sum, prod_sum,
     map_sum MeasurableEquiv.prodAssoc.measurable.aemeasurable, prod_sum, prod_sum, this]
   congr
@@ -820,8 +820,8 @@ theorem skew_product [SFinite μa] [SFinite μc] {f : α → β} (hf : MeasurePr
     ← hf.lintegral_comp (measurable_measure_prod_mk_left hs)]
   apply lintegral_congr_ae
   filter_upwards [hg] with a ha
-  rw [← ha, map_apply hgm.of_uncurry_left (measurable_prod_mk_left hs)]
-  rfl
+  rw [← ha, map_apply hgm.of_uncurry_left (measurable_prod_mk_left hs), preimage_preimage,
+    preimage_preimage]
 #align measure_theory.measure_preserving.skew_product MeasureTheory.MeasurePreserving.skew_product
 
 /-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
feat: extend results on product measures from sigma-finite to s-finite measures (#8713)

Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Diff
@@ -14,7 +14,7 @@ import Mathlib.MeasureTheory.Measure.OpenPos
 # The product measure
 
 In this file we define and prove properties about the binary product measure. If `α` and `β` have
-σ-finite measures `μ` resp. `ν` then `α × β` can be equipped with a σ-finite measure `μ.prod ν` that
+s-finite measures `μ` resp. `ν` then `α × β` can be equipped with a s-finite measure `μ.prod ν` that
 satisfies `(μ.prod ν) s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`.
 We also have `(μ.prod ν) (s ×ˢ t) = μ s * ν t`, i.e. the measure of a rectangle is the product of
 the measures of the sides.
@@ -174,32 +174,30 @@ theorem measurable_measure_prod_mk_left_finite [IsFiniteMeasure ν] {s : Set (α
     apply Measurable.ennreal_tsum h3f
 #align measurable_measure_prod_mk_left_finite measurable_measure_prod_mk_left_finite
 
-/-- If `ν` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
-  a measurable function. -/
-theorem measurable_measure_prod_mk_left [SigmaFinite ν] {s : Set (α × β)} (hs : MeasurableSet s) :
+/-- If `ν` is an s-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }`
+  is a measurable function. -/
+theorem measurable_measure_prod_mk_left [SFinite ν] {s : Set (α × β)} (hs : MeasurableSet s) :
     Measurable fun x => ν (Prod.mk x ⁻¹' s) := by
-  have : ∀ x, MeasurableSet (Prod.mk x ⁻¹' s) := fun x => measurable_prod_mk_left hs
-  simp only [← @iSup_restrict_spanningSets _ _ ν, this]
-  apply measurable_iSup; intro i
-  haveI := Fact.mk (measure_spanningSets_lt_top ν i)
-  exact measurable_measure_prod_mk_left_finite hs
+  rw [← sum_sFiniteSeq ν]
+  simp_rw [Measure.sum_apply_of_countable]
+  exact Measurable.ennreal_tsum (fun i ↦ measurable_measure_prod_mk_left_finite hs)
 #align measurable_measure_prod_mk_left measurable_measure_prod_mk_left
 
 /-- If `μ` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `y ↦ μ { x | (x, y) ∈ s }` is
   a measurable function. -/
-theorem measurable_measure_prod_mk_right {μ : Measure α} [SigmaFinite μ] {s : Set (α × β)}
+theorem measurable_measure_prod_mk_right {μ : Measure α} [SFinite μ] {s : Set (α × β)}
     (hs : MeasurableSet s) : Measurable fun y => μ ((fun x => (x, y)) ⁻¹' s) :=
   measurable_measure_prod_mk_left (measurableSet_swap_iff.mpr hs)
 #align measurable_measure_prod_mk_right measurable_measure_prod_mk_right
 
-theorem Measurable.map_prod_mk_left [SigmaFinite ν] :
+theorem Measurable.map_prod_mk_left [SFinite ν] :
     Measurable fun x : α => map (Prod.mk x) ν := by
   apply measurable_of_measurable_coe; intro s hs
   simp_rw [map_apply measurable_prod_mk_left hs]
   exact measurable_measure_prod_mk_left hs
 #align measurable.map_prod_mk_left Measurable.map_prod_mk_left
 
-theorem Measurable.map_prod_mk_right {μ : Measure α} [SigmaFinite μ] :
+theorem Measurable.map_prod_mk_right {μ : Measure α} [SFinite μ] :
     Measurable fun y : β => map (fun x : α => (x, y)) μ := by
   apply measurable_of_measurable_coe; intro s hs
   simp_rw [map_apply measurable_prod_mk_right hs]
@@ -237,7 +235,7 @@ theorem MeasurableEmbedding.prod_mk {α β γ δ : Type*} {mα : MeasurableSpace
 
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   Tonelli's theorem is measurable. -/
-theorem Measurable.lintegral_prod_right' [SigmaFinite ν] :
+theorem Measurable.lintegral_prod_right' [SFinite ν] :
     ∀ {f : α × β → ℝ≥0∞}, Measurable f → Measurable fun x => ∫⁻ y, f (x, y) ∂ν := by
   have m := @measurable_prod_mk_left
   refine' Measurable.ennreal_induction (P := fun f => Measurable fun (x : α) => ∫⁻ y, f (x, y) ∂ν)
@@ -260,14 +258,14 @@ theorem Measurable.lintegral_prod_right' [SigmaFinite ν] :
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   Tonelli's theorem is measurable.
   This version has the argument `f` in curried form. -/
-theorem Measurable.lintegral_prod_right [SigmaFinite ν] {f : α → β → ℝ≥0∞}
+theorem Measurable.lintegral_prod_right [SFinite ν] {f : α → β → ℝ≥0∞}
     (hf : Measurable (uncurry f)) : Measurable fun x => ∫⁻ y, f x y ∂ν :=
   hf.lintegral_prod_right'
 #align measurable.lintegral_prod_right Measurable.lintegral_prod_right
 
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   the symmetric version of Tonelli's theorem is measurable. -/
-theorem Measurable.lintegral_prod_left' [SigmaFinite μ] {f : α × β → ℝ≥0∞} (hf : Measurable f) :
+theorem Measurable.lintegral_prod_left' [SFinite μ] {f : α × β → ℝ≥0∞} (hf : Measurable f) :
     Measurable fun y => ∫⁻ x, f (x, y) ∂μ :=
   (measurable_swap_iff.mpr hf).lintegral_prod_right'
 #align measurable.lintegral_prod_left' Measurable.lintegral_prod_left'
@@ -275,7 +273,7 @@ theorem Measurable.lintegral_prod_left' [SigmaFinite μ] {f : α × β → ℝ
 /-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
   the symmetric version of Tonelli's theorem is measurable.
   This version has the argument `f` in curried form. -/
-theorem Measurable.lintegral_prod_left [SigmaFinite μ] {f : α → β → ℝ≥0∞}
+theorem Measurable.lintegral_prod_left [SFinite μ] {f : α → β → ℝ≥0∞}
     (hf : Measurable (uncurry f)) : Measurable fun y => ∫⁻ x, f x y ∂μ :=
   hf.lintegral_prod_left'
 #align measurable.lintegral_prod_left Measurable.lintegral_prod_left
@@ -288,7 +286,7 @@ namespace MeasureTheory
 namespace Measure
 
 /-- The binary product of measures. They are defined for arbitrary measures, but we basically
-  prove all properties under the assumption that at least one of them is σ-finite. -/
+  prove all properties under the assumption that at least one of them is s-finite. -/
 protected irreducible_def prod (μ : Measure α) (ν : Measure β) : Measure (α × β) :=
   bind μ fun x : α => map (Prod.mk x) ν
 #align measure_theory.measure.prod MeasureTheory.Measure.prod
@@ -302,7 +300,7 @@ theorem volume_eq_prod (α β) [MeasureSpace α] [MeasureSpace β] :
   rfl
 #align measure_theory.measure.volume_eq_prod MeasureTheory.Measure.volume_eq_prod
 
-variable [SigmaFinite ν]
+variable [SFinite ν]
 
 theorem prod_apply {s : Set (α × β)} (hs : MeasurableSet s) :
     μ.prod ν s = ∫⁻ x, ν (Prod.mk x ⁻¹' s) ∂μ := by
@@ -354,7 +352,7 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν
 
 instance prod.instIsOpenPosMeasure {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
     {m : MeasurableSpace X} {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y}
-    {ν : Measure Y} [IsOpenPosMeasure ν] [SigmaFinite ν] : IsOpenPosMeasure (μ.prod ν) := by
+    {ν : Measure Y} [IsOpenPosMeasure ν] [SFinite ν] : IsOpenPosMeasure (μ.prod ν) := by
   constructor
   rintro U U_open ⟨⟨x, y⟩, hxy⟩
   rcases isOpen_prod_iff.1 U_open x y hxy with ⟨u, v, u_open, v_open, xu, yv, huv⟩
@@ -368,7 +366,7 @@ instance prod.instIsOpenPosMeasure {X Y : Type*} [TopologicalSpace X] [Topologic
 instance {X Y : Type*}
     [TopologicalSpace X] [MeasureSpace X] [IsOpenPosMeasure (volume : Measure X)]
     [TopologicalSpace Y] [MeasureSpace Y] [IsOpenPosMeasure (volume : Measure Y)]
-    [SigmaFinite (volume : Measure Y)] : IsOpenPosMeasure (volume : Measure (X × Y)) :=
+    [SFinite (volume : Measure Y)] : IsOpenPosMeasure (volume : Measure (X × Y)) :=
   prod.instIsOpenPosMeasure
 
 instance prod.instIsFiniteMeasure {α β : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
@@ -396,7 +394,7 @@ instance {α β : Type*} [MeasureSpace α] [MeasureSpace β]
 
 instance prod.instIsFiniteMeasureOnCompacts {α β : Type*} [TopologicalSpace α] [TopologicalSpace β]
     {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β)
-    [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] [SigmaFinite ν] :
+    [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] [SFinite ν] :
     IsFiniteMeasureOnCompacts (μ.prod ν) := by
   refine' ⟨fun K hK => _⟩
   set L := (Prod.fst '' K) ×ˢ (Prod.snd '' K) with hL
@@ -414,7 +412,7 @@ instance prod.instIsFiniteMeasureOnCompacts {α β : Type*} [TopologicalSpace α
 instance {X Y : Type*}
     [TopologicalSpace X] [MeasureSpace X] [IsFiniteMeasureOnCompacts (volume : Measure X)]
     [TopologicalSpace Y] [MeasureSpace Y] [IsFiniteMeasureOnCompacts (volume : Measure Y)]
-    [SigmaFinite (volume : Measure Y)] : IsFiniteMeasureOnCompacts (volume : Measure (X × Y)) :=
+    [SFinite (volume : Measure Y)] : IsFiniteMeasureOnCompacts (volume : Measure (X × Y)) :=
   prod.instIsFiniteMeasureOnCompacts _ _
 
 instance prod.instNoAtoms_fst [NoAtoms μ] :
@@ -453,7 +451,7 @@ theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.prod ν s = 0)
       eventually_of_forall fun x => zero_le _⟩
 #align measure_theory.measure.measure_ae_null_of_prod_null MeasureTheory.Measure.measure_ae_null_of_prod_null
 
-theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν ≪ ν') :
+theorem AbsolutelyContinuous.prod [SFinite ν'] (h1 : μ ≪ μ') (h2 : ν ≪ ν') :
     μ.prod ν ≪ μ'.prod ν' := by
   refine' AbsolutelyContinuous.mk fun s hs h2s => _
   rw [measure_prod_null hs] at h2s ⊢
@@ -546,16 +544,52 @@ noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)}
   · simp_rw [iUnion_unpair_prod, hμ.spanning, hν.spanning, univ_prod_univ]
 #align measure_theory.measure.finite_spanning_sets_in.prod MeasureTheory.Measure.FiniteSpanningSetsIn.prod
 
-variable [SigmaFinite μ]
+lemma prod_sum_left {ι : Type*} (m : ι → Measure α) (μ : Measure β) [SFinite μ] :
+    (Measure.sum m).prod μ = Measure.sum (fun i ↦ (m i).prod μ) := by
+  ext s hs
+  simp only [prod_apply hs, lintegral_sum_measure, hs, sum_apply, ENNReal.tsum_prod']
+#align measure_theory.measure.sum_prod MeasureTheory.Measure.prod_sum_left
 
-instance prod.instSigmaFinite : SigmaFinite (μ.prod ν) :=
+lemma prod_sum_right {ι' : Type*} [Countable ι'] (m : Measure α) (m' : ι' → Measure β)
+    [∀ n, SFinite (m' n)] :
+    m.prod (Measure.sum m') = Measure.sum (fun p ↦ m.prod (m' p)) := by
+  ext s hs
+  simp only [prod_apply hs, lintegral_sum_measure, hs, sum_apply, ENNReal.tsum_prod']
+  have M : ∀ x, MeasurableSet (Prod.mk x ⁻¹' s) := fun x => measurable_prod_mk_left hs
+  simp_rw [Measure.sum_apply _ (M _)]
+  rw [lintegral_tsum (fun i ↦ (measurable_measure_prod_mk_left hs).aemeasurable)]
+#align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum_right
+
+lemma prod_sum {ι ι' : Type*} [Countable ι'] (m : ι → Measure α) (m' : ι' → Measure β)
+    [∀ n, SFinite (m' n)] :
+    (Measure.sum m).prod (Measure.sum m') =
+      Measure.sum (fun (p : ι × ι') ↦ (m p.1).prod (m' p.2)) := by
+  simp_rw [prod_sum_left, prod_sum_right, sum_sum]
+
+instance prod.instSigmaFinite {α β : Type*} {_ : MeasurableSpace α} {μ : Measure α}
+    [SigmaFinite μ] {_ : MeasurableSpace β} {ν : Measure β} [SigmaFinite ν] :
+    SigmaFinite (μ.prod ν) :=
   (μ.toFiniteSpanningSetsIn.prod ν.toFiniteSpanningSetsIn).sigmaFinite
 #align measure_theory.measure.prod.sigma_finite MeasureTheory.Measure.prod.instSigmaFinite
 
+instance prod.instSFinite {α β : Type*} {_ : MeasurableSpace α} {μ : Measure α}
+    [SFinite μ] {_ : MeasurableSpace β} {ν : Measure β} [SFinite ν] :
+    SFinite (μ.prod ν) := by
+  have : μ.prod ν =
+      Measure.sum (fun (p : ℕ × ℕ) ↦ (sFiniteSeq μ p.1).prod (sFiniteSeq ν p.2)) := by
+    conv_lhs => rw [← sum_sFiniteSeq μ, ← sum_sFiniteSeq ν]
+    apply prod_sum
+  rw [this]
+  infer_instance
+
 instance {α β} [MeasureSpace α] [SigmaFinite (volume : Measure α)]
     [MeasureSpace β] [SigmaFinite (volume : Measure β)] : SigmaFinite (volume : Measure (α × β)) :=
   prod.instSigmaFinite
 
+instance {α β} [MeasureSpace α] [SFinite (volume : Measure α)]
+    [MeasureSpace β] [SFinite (volume : Measure β)] : SFinite (volume : Measure (α × β)) :=
+  prod.instSFinite
+
 /-- A measure on a product space equals the product measure if they are equal on rectangles
   with as sides sets that generate the corresponding σ-algebras. -/
 theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
@@ -571,15 +605,35 @@ theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set 
     rw [h₁ s hs t ht, prod_prod]
 #align measure_theory.measure.prod_eq_generate_from MeasureTheory.Measure.prod_eq_generateFrom
 
-/-- A measure on a product space equals the product measure if they are equal on rectangles. -/
-theorem prod_eq {μν : Measure (α × β)}
+/- Note that the next theorem is not true for s-finite measures: let `μ = ν = ∞ • Leb` on `[0,1]`
+(they are  s-finite as countable sums of the finite Lebesgue measure), and let `μν = μ.prod ν + λ`
+where `λ` is Lebesgue measure on the diagonal. Then both measures give infinite mass to rectangles
+`s × t` whose sides have positive Lebesgue measure, and `0` measure when one of the sides has zero
+Lebesgue measure. And yet they do not coincide, as the first one gives zero mass to the diagonal,
+and the second one gives mass one.
+-/
+/-- A measure on a product space equals the product measure of sigma-finite measures if they are
+equal on rectangles. -/
+theorem prod_eq {μ : Measure α} [SigmaFinite μ] {ν : Measure β} [SigmaFinite ν]
+    {μν : Measure (α × β)}
     (h : ∀ s t, MeasurableSet s → MeasurableSet t → μν (s ×ˢ t) = μ s * ν t) : μ.prod ν = μν :=
   prod_eq_generateFrom generateFrom_measurableSet generateFrom_measurableSet
     isPiSystem_measurableSet isPiSystem_measurableSet μ.toFiniteSpanningSetsIn
     ν.toFiniteSpanningSetsIn fun s hs t ht => h s t hs ht
 #align measure_theory.measure.prod_eq MeasureTheory.Measure.prod_eq
 
+variable [SFinite μ]
+
 theorem prod_swap : map Prod.swap (μ.prod ν) = ν.prod μ := by
+  have : sum (fun (i : ℕ × ℕ) ↦ map Prod.swap ((sFiniteSeq μ i.1).prod (sFiniteSeq ν i.2)))
+       = sum (fun (i : ℕ × ℕ) ↦ map Prod.swap ((sFiniteSeq μ i.2).prod (sFiniteSeq ν i.1))) := by
+    ext s hs
+    rw [sum_apply _ hs, sum_apply _ hs]
+    exact ((Equiv.prodComm ℕ ℕ).tsum_eq _).symm
+  rw [← sum_sFiniteSeq μ, ← sum_sFiniteSeq ν, prod_sum, prod_sum,
+    map_sum measurable_swap.aemeasurable, this]
+  congr 1
+  ext1 i
   refine' (prod_eq _).symm
   intro s t hs ht
   simp_rw [map_apply measurable_swap (hs.prod ht), preimage_swap_prod, prod_prod, mul_comm]
@@ -632,11 +686,23 @@ lemma nullMeasurableSet_prod {s : Set α} {t : Set β} :
   rcases eq_or_ne (ν t) 0 with ht | ht; · simp [NullMeasurableSet.of_null, *]
   simp [*, nullMeasurableSet_prod_of_ne_zero]
 
-theorem prodAssoc_prod [SigmaFinite τ] :
+theorem prodAssoc_prod [SFinite τ] :
     map MeasurableEquiv.prodAssoc ((μ.prod ν).prod τ) = μ.prod (ν.prod τ) := by
+  have : sum (fun (p : ℕ × ℕ × ℕ) ↦
+        (sFiniteSeq μ p.1).prod ((sFiniteSeq ν p.2.1).prod (sFiniteSeq τ p.2.2)))
+      = sum (fun (p : (ℕ × ℕ) × ℕ) ↦
+        (sFiniteSeq μ p.1.1).prod ((sFiniteSeq ν p.1.2).prod (sFiniteSeq τ p.2))) := by
+    ext s hs
+    rw [sum_apply _ hs, sum_apply _ hs, ← (Equiv.prodAssoc _ _ _).tsum_eq]
+    rfl
+  rw [← sum_sFiniteSeq μ, ← sum_sFiniteSeq ν, ← sum_sFiniteSeq τ, prod_sum, prod_sum,
+    map_sum MeasurableEquiv.prodAssoc.measurable.aemeasurable, prod_sum, prod_sum, this]
+  congr
+  ext1 i
   refine' (prod_eq_generateFrom generateFrom_measurableSet generateFrom_prod
-    isPiSystem_measurableSet isPiSystem_prod μ.toFiniteSpanningSetsIn
-    (ν.toFiniteSpanningSetsIn.prod τ.toFiniteSpanningSetsIn) _).symm
+    isPiSystem_measurableSet isPiSystem_prod ((sFiniteSeq μ i.1.1)).toFiniteSpanningSetsIn
+    ((sFiniteSeq ν i.1.2).toFiniteSpanningSetsIn.prod (sFiniteSeq τ i.2).toFiniteSpanningSetsIn)
+      _).symm
   rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_setOf_eq] at hs ht hu
   simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)),
     MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod,
@@ -647,6 +713,10 @@ theorem prodAssoc_prod [SigmaFinite τ] :
 
 theorem prod_restrict (s : Set α) (t : Set β) :
     (μ.restrict s).prod (ν.restrict t) = (μ.prod ν).restrict (s ×ˢ t) := by
+  rw [← sum_sFiniteSeq μ, ← sum_sFiniteSeq ν, restrict_sum_of_countable, restrict_sum_of_countable,
+    prod_sum, prod_sum, restrict_sum_of_countable]
+  congr 1
+  ext1 i
   refine' prod_eq fun s' t' hs' ht' => _
   rw [restrict_apply (hs'.prod ht'), prod_inter_prod, prod_prod, restrict_apply hs',
     restrict_apply ht']
@@ -659,39 +729,41 @@ theorem restrict_prod_eq_prod_univ (s : Set α) :
 #align measure_theory.measure.restrict_prod_eq_prod_univ MeasureTheory.Measure.restrict_prod_eq_prod_univ
 
 theorem prod_dirac (y : β) : μ.prod (dirac y) = map (fun x => (x, y)) μ := by
+  rw [← sum_sFiniteSeq μ, prod_sum_left, map_sum measurable_prod_mk_right.aemeasurable]
+  congr
+  ext1 i
   refine' prod_eq fun s t hs ht => _
   simp_rw [map_apply measurable_prod_mk_right (hs.prod ht), mk_preimage_prod_left_eq_if, measure_if,
-    dirac_apply' _ ht, ← indicator_mul_right _ fun _ => μ s, Pi.one_apply, mul_one]
+    dirac_apply' _ ht, ← indicator_mul_right _ fun _ => sFiniteSeq μ i s, Pi.one_apply, mul_one]
 #align measure_theory.measure.prod_dirac MeasureTheory.Measure.prod_dirac
 
 theorem dirac_prod (x : α) : (dirac x).prod ν = map (Prod.mk x) ν := by
+  rw [← sum_sFiniteSeq ν, prod_sum_right, map_sum measurable_prod_mk_left.aemeasurable]
+  congr
+  ext1 i
   refine' prod_eq fun s t hs ht => _
   simp_rw [map_apply measurable_prod_mk_left (hs.prod ht), mk_preimage_prod_right_eq_if, measure_if,
-    dirac_apply' _ hs, ← indicator_mul_left _ _ fun _ => ν t, Pi.one_apply, one_mul]
+    dirac_apply' _ hs, ← indicator_mul_left _ _ fun _ => sFiniteSeq ν i t, Pi.one_apply, one_mul]
 #align measure_theory.measure.dirac_prod MeasureTheory.Measure.dirac_prod
 
 theorem dirac_prod_dirac {x : α} {y : β} : (dirac x).prod (dirac y) = dirac (x, y) := by
   rw [prod_dirac, map_dirac measurable_prod_mk_right]
 #align measure_theory.measure.dirac_prod_dirac MeasureTheory.Measure.dirac_prod_dirac
 
-theorem prod_sum {ι : Type*} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] :
-    μ.prod (sum ν) = sum fun i => μ.prod (ν i) := by
-  refine' prod_eq fun s t hs ht => _
-  simp_rw [sum_apply _ (hs.prod ht), sum_apply _ ht, prod_prod, ENNReal.tsum_mul_left]
-#align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum
-
-theorem sum_prod {ι : Type*} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
-    (sum μ).prod ν = sum fun i => (μ i).prod ν := by
-  refine' prod_eq fun s t hs ht => _
-  simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ENNReal.tsum_mul_right]
-#align measure_theory.measure.sum_prod MeasureTheory.Measure.sum_prod
-
-theorem prod_add (ν' : Measure β) [SigmaFinite ν'] : μ.prod (ν + ν') = μ.prod ν + μ.prod ν' := by
+theorem prod_add (ν' : Measure β) [SFinite ν'] : μ.prod (ν + ν') = μ.prod ν + μ.prod ν' := by
+  simp_rw [← sum_sFiniteSeq ν, ← sum_sFiniteSeq ν', sum_add_sum, ← sum_sFiniteSeq μ, prod_sum,
+    sum_add_sum]
+  congr
+  ext1 i
   refine' prod_eq fun s t _ _ => _
   simp_rw [add_apply, prod_prod, left_distrib]
 #align measure_theory.measure.prod_add MeasureTheory.Measure.prod_add
 
-theorem add_prod (μ' : Measure α) [SigmaFinite μ'] : (μ + μ').prod ν = μ.prod ν + μ'.prod ν := by
+theorem add_prod (μ' : Measure α) [SFinite μ'] : (μ + μ').prod ν = μ.prod ν + μ'.prod ν := by
+  simp_rw [← sum_sFiniteSeq μ, ← sum_sFiniteSeq μ', sum_add_sum, ← sum_sFiniteSeq ν, prod_sum,
+    sum_add_sum]
+  congr
+  ext1 i
   refine' prod_eq fun s t _ _ => _
   simp_rw [add_apply, prod_prod, right_distrib]
 #align measure_theory.measure.add_prod MeasureTheory.Measure.add_prod
@@ -706,11 +778,13 @@ theorem zero_prod (ν : Measure β) : (0 : Measure α).prod ν = 0 := by
 theorem prod_zero (μ : Measure α) : μ.prod (0 : Measure β) = 0 := by simp [Measure.prod]
 #align measure_theory.measure.prod_zero MeasureTheory.Measure.prod_zero
 
-theorem map_prod_map {δ} [MeasurableSpace δ] {f : α → β} {g : γ → δ} {μa : Measure α}
-    {μc : Measure γ} (hfa : SigmaFinite (map f μa)) (hgc : SigmaFinite (map g μc))
-    (hf : Measurable f) (hg : Measurable g) :
+theorem map_prod_map {δ} [MeasurableSpace δ] {f : α → β} {g : γ → δ} (μa : Measure α)
+    (μc : Measure γ) [SFinite μa] [SFinite μc] (hf : Measurable f) (hg : Measurable g) :
     (map f μa).prod (map g μc) = map (Prod.map f g) (μa.prod μc) := by
-  haveI := hgc.of_map μc hg.aemeasurable
+  simp_rw [← sum_sFiniteSeq μa, ← sum_sFiniteSeq μc, map_sum hf.aemeasurable,
+    map_sum hg.aemeasurable, prod_sum, map_sum (hf.prod_map hg).aemeasurable]
+  congr
+  ext1 i
   refine' prod_eq fun s t hs ht => _
   rw [map_apply (hf.prod_map hg) (hs.prod ht), map_apply hf hs, map_apply hg ht]
   exact prod_prod (f ⁻¹' s) (g ⁻¹' t)
@@ -725,38 +799,34 @@ namespace MeasurePreserving
 variable {δ : Type*} [MeasurableSpace δ] {μa : Measure α} {μb : Measure β} {μc : Measure γ}
   {μd : Measure δ}
 
-theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : MeasurePreserving f μa μb)
+theorem skew_product [SFinite μa] [SFinite μc] {f : α → β} (hf : MeasurePreserving f μa μb)
     {g : α → γ → δ} (hgm : Measurable (uncurry g)) (hg : ∀ᵐ x ∂μa, map (g x) μc = μd) :
     MeasurePreserving (fun p : α × γ => (f p.1, g p.1 p.2)) (μa.prod μc) (μb.prod μd) := by
   classical
-    have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prod_mk hgm
-    /- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
-      to deduce `SigmaFinite μc`. -/
-    rcases eq_or_ne μa 0 with (rfl | ha)
-    · rw [← hf.map_eq, zero_prod, Measure.map_zero, zero_prod]
-      exact ⟨this, by simp only [Measure.map_zero]⟩
-    have sf : SigmaFinite μc := by
-      rcases (ae_neBot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩
-      exact SigmaFinite.of_map _ hgm.of_uncurry_left.aemeasurable (by rwa [hx])
-    -- Thus we can apply `Measure.prod_eq` to prove equality of measures.
-    refine' ⟨this, (prod_eq fun s t hs ht => _).symm⟩
-    rw [map_apply this (hs.prod ht)]
-    refine' (prod_apply (this <| hs.prod ht)).trans _
-    have : ∀ᵐ x ∂μa,
-        μc ((fun y => (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (fun _ => μd t) x := by
-      refine' hg.mono fun x hx => _
-      subst hx
-      simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage]
-      split_ifs
-      exacts [(map_apply hgm.of_uncurry_left ht).symm, measure_empty]
-    simp only [preimage_preimage]
-    rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs), set_lintegral_const,
-      hf.measure_preimage hs, mul_comm]
+  have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prod_mk hgm
+  /- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
+    to deduce `SFinite μd`. -/
+  rcases eq_or_ne μa 0 with (rfl | ha)
+  · rw [← hf.map_eq, zero_prod, Measure.map_zero, zero_prod]
+    exact ⟨this, by simp only [Measure.map_zero]⟩
+  have sf : SFinite μd := by
+    rcases (ae_neBot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩
+    rw [← hx]
+    infer_instance
+  -- Thus we can use the integral formula for the product measure, and compute things explicitly
+  refine ⟨this, ?_⟩
+  ext s hs
+  rw [map_apply this hs, prod_apply (this hs), prod_apply hs,
+    ← hf.lintegral_comp (measurable_measure_prod_mk_left hs)]
+  apply lintegral_congr_ae
+  filter_upwards [hg] with a ha
+  rw [← ha, map_apply hgm.of_uncurry_left (measurable_prod_mk_left hs)]
+  rfl
 #align measure_theory.measure_preserving.skew_product MeasureTheory.MeasurePreserving.skew_product
 
 /-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
 then `Prod.map f g` sends `μa.prod μc` to `μb.prod μd`. -/
-protected theorem prod [SigmaFinite μb] [SigmaFinite μd] {f : α → β} {g : γ → δ}
+protected theorem prod [SFinite μa] [SFinite μc] {f : α → β} {g : γ → δ}
     (hf : MeasurePreserving f μa μb) (hg : MeasurePreserving g μc μd) :
     MeasurePreserving (Prod.map f g) (μa.prod μc) (μb.prod μd) :=
   have : Measurable (uncurry fun _ : α => g) := hg.1.comp measurable_snd
@@ -768,7 +838,7 @@ end MeasurePreserving
 namespace QuasiMeasurePreserving
 
 theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
-    (hf : Measurable f) [SigmaFinite ν]
+    (hf : Measurable f) [SFinite ν]
     (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
     QuasiMeasurePreserving f (μ.prod ν) τ := by
   refine' ⟨hf, _⟩
@@ -779,7 +849,7 @@ theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β}
 
 theorem prod_of_left {α β γ} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
     {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ} (hf : Measurable f)
-    [SigmaFinite μ] [SigmaFinite ν]
+    [SFinite μ] [SFinite ν]
     (h2f : ∀ᵐ y ∂ν, QuasiMeasurePreserving (fun x => f (x, y)) μ τ) :
     QuasiMeasurePreserving f (μ.prod ν) τ := by
   rw [← prod_swap]
@@ -796,18 +866,18 @@ open MeasureTheory.Measure
 
 section
 
-theorem AEMeasurable.prod_swap [SigmaFinite μ] [SigmaFinite ν] {f : β × α → γ}
+theorem AEMeasurable.prod_swap [SFinite μ] [SFinite ν] {f : β × α → γ}
     (hf : AEMeasurable f (ν.prod μ)) : AEMeasurable (fun z : α × β => f z.swap) (μ.prod ν) := by
   rw [← Measure.prod_swap] at hf
   exact hf.comp_measurable measurable_swap
 #align ae_measurable.prod_swap AEMeasurable.prod_swap
 
-theorem AEMeasurable.fst [SigmaFinite ν] {f : α → γ} (hf : AEMeasurable f μ) :
+theorem AEMeasurable.fst [SFinite ν] {f : α → γ} (hf : AEMeasurable f μ) :
     AEMeasurable (fun z : α × β => f z.1) (μ.prod ν) :=
   hf.comp_quasiMeasurePreserving quasiMeasurePreserving_fst
 #align ae_measurable.fst AEMeasurable.fst
 
-theorem AEMeasurable.snd [SigmaFinite ν] {f : β → γ} (hf : AEMeasurable f ν) :
+theorem AEMeasurable.snd [SFinite ν] {f : β → γ} (hf : AEMeasurable f ν) :
     AEMeasurable (fun z : α × β => f z.2) (μ.prod ν) :=
   hf.comp_quasiMeasurePreserving quasiMeasurePreserving_snd
 #align ae_measurable.snd AEMeasurable.snd
@@ -819,9 +889,9 @@ namespace MeasureTheory
 /-! ### The Lebesgue integral on a product -/
 
 
-variable [SigmaFinite ν]
+variable [SFinite ν]
 
-theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) :
+theorem lintegral_prod_swap [SFinite μ] (f : α × β → ℝ≥0∞) :
     ∫⁻ z, f z.swap ∂ν.prod μ = ∫⁻ z, f z ∂μ.prod ν :=
   measurePreserving_swap.lintegral_comp_emb MeasurableEquiv.prodComm.measurableEmbedding f
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
@@ -869,7 +939,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.pr
 
 /-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
 functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
-theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
+theorem lintegral_prod_symm [SFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
     ∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by
   simp_rw [← lintegral_prod_swap f]
   exact lintegral_prod _ hf.prod_swap
@@ -877,7 +947,7 @@ theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf :
 
 /-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
 functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
-theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
+theorem lintegral_prod_symm' [SFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
     ∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
   lintegral_prod_symm f hf.aemeasurable
 #align measure_theory.lintegral_prod_symm' MeasureTheory.lintegral_prod_symm'
@@ -891,14 +961,14 @@ theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurabl
 
 /-- The reversed version of **Tonelli's Theorem** (symmetric version). In this version `f` is in
 curried form, which makes it easier for the elaborator to figure out `f` automatically. -/
-theorem lintegral_lintegral_symm [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
+theorem lintegral_lintegral_symm [SFinite μ] ⦃f : α → β → ℝ≥0∞⦄
     (hf : AEMeasurable (uncurry f) (μ.prod ν)) :
     ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.2 z.1 ∂ν.prod μ :=
   (lintegral_prod_symm _ hf.prod_swap).symm
 #align measure_theory.lintegral_lintegral_symm MeasureTheory.lintegral_lintegral_symm
 
 /-- Change the order of Lebesgue integration. -/
-theorem lintegral_lintegral_swap [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
+theorem lintegral_lintegral_swap [SFinite μ] ⦃f : α → β → ℝ≥0∞⦄
     (hf : AEMeasurable (uncurry f) (μ.prod ν)) :
     ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
   (lintegral_lintegral hf).trans (lintegral_prod_symm _ hf)
feat: Add NoAtoms instances for product measures (#8207)

The instance exists for Measure.pi, see MeasureTheory.Measure.pi_noAtoms', but not for Measure.prod.

Diff
@@ -417,6 +417,16 @@ instance {X Y : Type*}
     [SigmaFinite (volume : Measure Y)] : IsFiniteMeasureOnCompacts (volume : Measure (X × Y)) :=
   prod.instIsFiniteMeasureOnCompacts _ _
 
+instance prod.instNoAtoms_fst [NoAtoms μ] :
+    NoAtoms (Measure.prod μ ν) := by
+  refine NoAtoms.mk (fun x => ?_)
+  rw [← Set.singleton_prod_singleton, Measure.prod_prod, measure_singleton, zero_mul]
+
+instance prod.instNoAtoms_snd [NoAtoms ν] :
+    NoAtoms (Measure.prod μ ν) := by
+  refine NoAtoms.mk (fun x => ?_)
+  rw [← Set.singleton_prod_singleton, Measure.prod_prod, measure_singleton (μ := ν), mul_zero]
+
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.prod ν) s ≠ ∞) :
     ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by
   rw [prod_apply hs] at h2s
chore: cleanup typo in filter_upwards (#7719)

mathport was forgetting a space in filter_upwards [...]with instead of filter_upwards [...] with.

Diff
@@ -853,7 +853,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.pr
   have A : ∫⁻ z, f z ∂μ.prod ν = ∫⁻ z, hf.mk f z ∂μ.prod ν := lintegral_congr_ae hf.ae_eq_mk
   have B : (∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ) = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂ν ∂μ := by
     apply lintegral_congr_ae
-    filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with _ ha using lintegral_congr_ae ha
+    filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha
   rw [A, B, lintegral_prod_of_measurable _ hf.measurable_mk]
 #align measure_theory.lintegral_prod MeasureTheory.lintegral_prod
 
feat(MeasureTheory/../Prod): drop unneeded assumptions (#7620)
  • Drop CompleteSpace assumption in all theorems about Bochner integral on α × β.
  • Drop measurability assumption in lintegral_prod_swap.
Diff
@@ -99,7 +99,6 @@ functions. We show that if `f` is a binary measurable function, then the functio
 along one of the variables (using either the Lebesgue or Bochner integral) is measurable.
 -/
 
-
 /-- The product of generated σ-algebras is the one generated by rectangles, if both generating sets
   are countably spanning. -/
 theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C)
@@ -812,10 +811,9 @@ namespace MeasureTheory
 
 variable [SigmaFinite ν]
 
-theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
-    ∫⁻ z, f z.swap ∂ν.prod μ = ∫⁻ z, f z ∂μ.prod ν := by
-  rw [← prod_swap] at hf
-  rw [← lintegral_map' hf measurable_swap.aemeasurable, prod_swap]
+theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) :
+    ∫⁻ z, f z.swap ∂ν.prod μ = ∫⁻ z, f z ∂μ.prod ν :=
+  measurePreserving_swap.lintegral_comp_emb MeasurableEquiv.prodComm.measurableEmbedding f
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
 
 /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued measurable functions on `α × β`,
@@ -863,7 +861,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.pr
 functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
     ∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by
-  simp_rw [← lintegral_prod_swap f hf]
+  simp_rw [← lintegral_prod_swap f]
   exact lintegral_prod _ hf.prod_swap
 #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm
 
feat(MeasureTheory/../Prod): null measurability of f ∘ fst (#7610)

A function on the product that depends only on one component is null measurable iff it is null measurable as a function of one variable.

Diff
@@ -509,6 +509,21 @@ lemma _root_.MeasureTheory.NullMeasurableSet.right_of_prod {s : Set α} {t : Set
   refine ⟨Prod.mk x ⁻¹' u, measurable_prod_mk_left hum, ?_⟩
   rwa [mk_preimage_prod_right hxs] at hx
 
+/-- If `Prod.snd ⁻¹' t` is a null measurable set and `μ ≠ 0`, then `t` is a null measurable set. -/
+lemma _root_.MeasureTheory.NullMeasurableSet.of_preimage_snd [NeZero μ] {t : Set β}
+    (h : NullMeasurableSet (Prod.snd ⁻¹' t) (μ.prod ν)) : NullMeasurableSet t ν :=
+  .right_of_prod (by rwa [univ_prod]) (NeZero.ne _)
+
+/-- `Prod.snd ⁻¹' t` is null measurable w.r.t. `μ.prod ν` iff `t` is null measurable w.r.t. `ν`
+provided that `μ ≠ 0`. -/
+lemma nullMeasurableSet_preimage_snd [NeZero μ] {t : Set β} :
+    NullMeasurableSet (Prod.snd ⁻¹' t) (μ.prod ν) ↔ NullMeasurableSet t ν :=
+  ⟨.of_preimage_snd, (.preimage · quasiMeasurePreserving_snd)⟩
+
+lemma nullMeasurable_comp_snd [NeZero μ] {f : β → γ} :
+    NullMeasurable (f ∘ Prod.snd) (μ.prod ν) ↔ NullMeasurable f ν :=
+  forall₂_congr fun s _ ↦ nullMeasurableSet_preimage_snd (t := f ⁻¹' s)
+
 /-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/
 noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
     (hμ : μ.FiniteSpanningSetsIn C) (hν : ν.FiniteSpanningSetsIn D) :
@@ -578,6 +593,21 @@ lemma _root_.MeasureTheory.NullMeasurableSet.left_of_prod {s : Set α} {t : Set
   rw [← preimage_swap_prod]
   exact h.preimage measurePreserving_swap.quasiMeasurePreserving
 
+/-- If `Prod.fst ⁻¹' s` is a null measurable set and `ν ≠ 0`, then `s` is a null measurable set. -/
+lemma _root_.MeasureTheory.NullMeasurableSet.of_preimage_fst [NeZero ν] {s : Set α}
+    (h : NullMeasurableSet (Prod.fst ⁻¹' s) (μ.prod ν)) : NullMeasurableSet s μ :=
+  .left_of_prod (by rwa [prod_univ]) (NeZero.ne _)
+
+/-- `Prod.fst ⁻¹' s` is null measurable w.r.t. `μ.prod ν` iff `s` is null measurable w.r.t. `μ`
+provided that `ν ≠ 0`. -/
+lemma nullMeasurableSet_preimage_fst [NeZero ν] {s : Set α} :
+    NullMeasurableSet (Prod.fst ⁻¹' s) (μ.prod ν) ↔ NullMeasurableSet s μ :=
+  ⟨.of_preimage_fst, (.preimage · quasiMeasurePreserving_fst)⟩
+
+lemma nullMeasurable_comp_fst [NeZero ν] {f : α → γ} :
+    NullMeasurable (f ∘ Prod.fst) (μ.prod ν) ↔ NullMeasurable f μ :=
+  forall₂_congr fun s _ ↦ nullMeasurableSet_preimage_fst (s := f ⁻¹' s)
+
 /-- The product of two non-null sets is null measurable
 if and only if both of them are null measurable. -/
 lemma nullMeasurableSet_prod_of_ne_zero {s : Set α} {t : Set β} (hs : μ s ≠ 0) (ht : ν t ≠ 0) :
feat(MeasureTheory/../Prod): add lemmas about NullMeasurableSet (#7578)

Also golf a proof.

The informal proof was provided by Felix Weilacher on Zulip.

Co-authored-by: @Felix-Weilacher

Diff
@@ -298,13 +298,13 @@ instance prod.measureSpace {α β} [MeasureSpace α] [MeasureSpace β] : Measure
   volume := volume.prod volume
 #align measure_theory.measure.prod.measure_space MeasureTheory.Measure.prod.measureSpace
 
-variable [SigmaFinite ν]
-
 theorem volume_eq_prod (α β) [MeasureSpace α] [MeasureSpace β] :
     (volume : Measure (α × β)) = (volume : Measure α).prod (volume : Measure β) :=
   rfl
 #align measure_theory.measure.volume_eq_prod MeasureTheory.Measure.volume_eq_prod
 
+variable [SigmaFinite ν]
+
 theorem prod_apply {s : Set (α × β)} (hs : MeasurableSet s) :
     μ.prod ν s = ∫⁻ x, ν (Prod.mk x ⁻¹' s) ∂μ := by
   simp_rw [Measure.prod, bind_apply hs (Measurable.map_prod_mk_left (ν := ν)),
@@ -459,10 +459,33 @@ theorem ae_ae_of_ae_prod {p : α × β → Prop} (h : ∀ᵐ z ∂μ.prod ν, p
   measure_ae_null_of_prod_null h
 #align measure_theory.measure.ae_ae_of_ae_prod MeasureTheory.Measure.ae_ae_of_ae_prod
 
+theorem ae_ae_eq_curry_of_prod {f g : α × β → γ} (h : f =ᵐ[μ.prod ν] g) :
+    ∀ᵐ x ∂μ, curry f x =ᵐ[ν] curry g x :=
+  ae_ae_of_ae_prod h
+
+theorem ae_ae_eq_of_ae_eq_uncurry {f g : α → β → γ} (h : uncurry f =ᵐ[μ.prod ν] uncurry g) :
+    ∀ᵐ x ∂μ, f x =ᵐ[ν] g x :=
+  ae_ae_eq_curry_of_prod h
+
 theorem ae_prod_mem_iff_ae_ae_mem {s : Set (α × β)} (hs : MeasurableSet s) :
     (∀ᵐ z ∂μ.prod ν, z ∈ s) ↔ ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, (x, y) ∈ s :=
   measure_prod_null hs.compl
 
+theorem quasiMeasurePreserving_fst : QuasiMeasurePreserving Prod.fst (μ.prod ν) μ := by
+  refine' ⟨measurable_fst, AbsolutelyContinuous.mk fun s hs h2s => _⟩
+  rw [map_apply measurable_fst hs, ← prod_univ, prod_prod, h2s, zero_mul]
+#align measure_theory.measure.quasi_measure_preserving_fst MeasureTheory.Measure.quasiMeasurePreserving_fst
+
+theorem quasiMeasurePreserving_snd : QuasiMeasurePreserving Prod.snd (μ.prod ν) ν := by
+  refine' ⟨measurable_snd, AbsolutelyContinuous.mk fun s hs h2s => _⟩
+  rw [map_apply measurable_snd hs, ← univ_prod, prod_prod, h2s, mul_zero]
+#align measure_theory.measure.quasi_measure_preserving_snd MeasureTheory.Measure.quasiMeasurePreserving_snd
+
+lemma set_prod_ae_eq {s s' : Set α} {t t' : Set β} (hs : s =ᵐ[μ] s') (ht : t =ᵐ[ν] t') :
+    (s ×ˢ t : Set (α × β)) =ᵐ[μ.prod ν] (s' ×ˢ t' : Set (α × β)) :=
+  (quasiMeasurePreserving_fst.preimage_ae_eq hs).inter
+    (quasiMeasurePreserving_snd.preimage_ae_eq ht)
+
 lemma measure_prod_compl_eq_zero {s : Set α} {t : Set β}
     (s_ae_univ : μ sᶜ = 0) (t_ae_univ : ν tᶜ = 0) :
     μ.prod ν (s ×ˢ t)ᶜ = 0 := by
@@ -472,19 +495,19 @@ lemma measure_prod_compl_eq_zero {s : Set α} {t : Set β}
 
 lemma _root_.MeasureTheory.NullMeasurableSet.prod {s : Set α} {t : Set β}
     (s_mble : NullMeasurableSet s μ) (t_mble : NullMeasurableSet t ν) :
-    NullMeasurableSet (s ×ˢ t) (μ.prod ν) := by
-  obtain ⟨s₀, ⟨mble_s₀, s_aeeq_s₀⟩⟩ := s_mble
-  obtain ⟨t₀, ⟨mble_t₀, t_aeeq_t₀⟩⟩ := t_mble
-  refine ⟨s₀ ×ˢ t₀, ⟨mble_s₀.prod mble_t₀, ?_⟩⟩
-  rw [Measure.ae, Filter.eventuallyEq_iff_exists_mem] at *
-  simp only [Filter.mem_mk, mem_setOf_eq] at *
-  rcases s_aeeq_s₀ with ⟨u, ⟨u_mem, s_eq_s₀⟩⟩
-  rcases t_aeeq_t₀ with ⟨v, ⟨v_mem, t_eq_t₀⟩⟩
-  refine ⟨u ×ˢ v, ⟨measure_prod_compl_eq_zero u_mem v_mem, ?_⟩⟩
-  intro p hp
-  change (p ∈ s ×ˢ t) = (p ∈ s₀ ×ˢ t₀)
-  simp [show p.fst ∈ s ↔ p.fst ∈ s₀ from Iff.of_eq (s_eq_s₀ hp.1),
-        show p.snd ∈ t ↔ p.snd ∈ t₀ from Iff.of_eq (t_eq_t₀ hp.2)]
+    NullMeasurableSet (s ×ˢ t) (μ.prod ν) :=
+  let ⟨s₀, mble_s₀, s_aeeq_s₀⟩ := s_mble
+  let ⟨t₀, mble_t₀, t_aeeq_t₀⟩ := t_mble
+  ⟨s₀ ×ˢ t₀, ⟨mble_s₀.prod mble_t₀, set_prod_ae_eq s_aeeq_s₀ t_aeeq_t₀⟩⟩
+
+/-- If `s ×ˢ t` is a null measurable set and `μ s ≠ 0`, then `t` is a null measurable set. -/
+lemma _root_.MeasureTheory.NullMeasurableSet.right_of_prod {s : Set α} {t : Set β}
+    (h : NullMeasurableSet (s ×ˢ t) (μ.prod ν)) (hs : μ s ≠ 0) : NullMeasurableSet t ν := by
+  rcases h with ⟨u, hum, hu⟩
+  obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, (Prod.mk x ⁻¹' (s ×ˢ t)) =ᵐ[ν] (Prod.mk x ⁻¹' u) :=
+    ((frequently_ae_iff.2 hs).and_eventually (ae_ae_eq_curry_of_prod hu)).exists
+  refine ⟨Prod.mk x ⁻¹' u, measurable_prod_mk_left hum, ?_⟩
+  rwa [mk_preimage_prod_right hxs] at hx
 
 /-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/
 noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
@@ -499,16 +522,6 @@ noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)}
   · simp_rw [iUnion_unpair_prod, hμ.spanning, hν.spanning, univ_prod_univ]
 #align measure_theory.measure.finite_spanning_sets_in.prod MeasureTheory.Measure.FiniteSpanningSetsIn.prod
 
-theorem quasiMeasurePreserving_fst : QuasiMeasurePreserving Prod.fst (μ.prod ν) μ := by
-  refine' ⟨measurable_fst, AbsolutelyContinuous.mk fun s hs h2s => _⟩
-  rw [map_apply measurable_fst hs, ← prod_univ, prod_prod, h2s, zero_mul]
-#align measure_theory.measure.quasi_measure_preserving_fst MeasureTheory.Measure.quasiMeasurePreserving_fst
-
-theorem quasiMeasurePreserving_snd : QuasiMeasurePreserving Prod.snd (μ.prod ν) ν := by
-  refine' ⟨measurable_snd, AbsolutelyContinuous.mk fun s hs h2s => _⟩
-  rw [map_apply measurable_snd hs, ← univ_prod, prod_prod, h2s, mul_zero]
-#align measure_theory.measure.quasi_measure_preserving_snd MeasureTheory.Measure.quasiMeasurePreserving_snd
-
 variable [SigmaFinite μ]
 
 instance prod.instSigmaFinite : SigmaFinite (μ.prod ν) :=
@@ -558,12 +571,33 @@ theorem prod_apply_symm {s : Set (α × β)} (hs : MeasurableSet s) :
   rfl
 #align measure_theory.measure.prod_apply_symm MeasureTheory.Measure.prod_apply_symm
 
+/-- If `s ×ˢ t` is a null measurable set and `ν t ≠ 0`, then `s` is a null measurable set. -/
+lemma _root_.MeasureTheory.NullMeasurableSet.left_of_prod {s : Set α} {t : Set β}
+    (h : NullMeasurableSet (s ×ˢ t) (μ.prod ν)) (ht : ν t ≠ 0) : NullMeasurableSet s μ := by
+  refine .right_of_prod ?_ ht
+  rw [← preimage_swap_prod]
+  exact h.preimage measurePreserving_swap.quasiMeasurePreserving
+
+/-- The product of two non-null sets is null measurable
+if and only if both of them are null measurable. -/
+lemma nullMeasurableSet_prod_of_ne_zero {s : Set α} {t : Set β} (hs : μ s ≠ 0) (ht : ν t ≠ 0) :
+    NullMeasurableSet (s ×ˢ t) (μ.prod ν) ↔ NullMeasurableSet s μ ∧ NullMeasurableSet t ν :=
+  ⟨fun h ↦ ⟨h.left_of_prod ht, h.right_of_prod hs⟩, fun ⟨hs, ht⟩ ↦ hs.prod ht⟩
+
+/-- The product of two sets is null measurable
+if and only if both of them are null measurable or one of them has measure zero. -/
+lemma nullMeasurableSet_prod {s : Set α} {t : Set β} :
+    NullMeasurableSet (s ×ˢ t) (μ.prod ν) ↔
+      NullMeasurableSet s μ ∧ NullMeasurableSet t ν ∨ μ s = 0 ∨ ν t = 0 := by
+  rcases eq_or_ne (μ s) 0 with hs | hs; · simp [NullMeasurableSet.of_null, *]
+  rcases eq_or_ne (ν t) 0 with ht | ht; · simp [NullMeasurableSet.of_null, *]
+  simp [*, nullMeasurableSet_prod_of_ne_zero]
+
 theorem prodAssoc_prod [SigmaFinite τ] :
     map MeasurableEquiv.prodAssoc ((μ.prod ν).prod τ) = μ.prod (ν.prod τ) := by
-  refine'
-    (prod_eq_generateFrom generateFrom_measurableSet generateFrom_prod isPiSystem_measurableSet
-        isPiSystem_prod μ.toFiniteSpanningSetsIn
-        (ν.toFiniteSpanningSetsIn.prod τ.toFiniteSpanningSetsIn) _).symm
+  refine' (prod_eq_generateFrom generateFrom_measurableSet generateFrom_prod
+    isPiSystem_measurableSet isPiSystem_prod μ.toFiniteSpanningSetsIn
+    (ν.toFiniteSpanningSetsIn.prod τ.toFiniteSpanningSetsIn) _).symm
   rintro s hs _ ⟨t, u, ht, hu, rfl⟩; rw [mem_setOf_eq] at hs ht hu
   simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)),
     MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod,
@@ -572,7 +606,6 @@ theorem prodAssoc_prod [SigmaFinite τ] :
 
 /-! ### The product of specific measures -/
 
-
 theorem prod_restrict (s : Set α) (t : Set β) :
     (μ.restrict s).prod (ν.restrict t) = (μ.prod ν).restrict (s ×ˢ t) := by
   refine' prod_eq fun s' t' hs' ht' => _
feat: disintegration of Lebesgue measure in vector spaces (#7252)

To check that a property is true ae in a vector space, it suffices to check that it is true ae along all translates of a given vector subspace.

Diff
@@ -345,6 +345,14 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν
       _ = μ.prod ν (s ×ˢ t) := measure_toMeasurable _
 #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod
 
+@[simp] lemma map_fst_prod : Measure.map Prod.fst (μ.prod ν) = (ν univ) • μ := by
+  ext s hs
+  simp [Measure.map_apply measurable_fst hs, ← prod_univ, mul_comm]
+
+@[simp] lemma map_snd_prod : Measure.map Prod.snd (μ.prod ν) = (μ univ) • ν := by
+  ext s hs
+  simp [Measure.map_apply measurable_snd hs, ← univ_prod]
+
 instance prod.instIsOpenPosMeasure {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
     {m : MeasurableSpace X} {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y}
     {ν : Measure Y} [IsOpenPosMeasure ν] [SigmaFinite ν] : IsOpenPosMeasure (μ.prod ν) := by
style: fix wrapping of where (#7149)
Diff
@@ -294,8 +294,8 @@ protected irreducible_def prod (μ : Measure α) (ν : Measure β) : Measure (α
   bind μ fun x : α => map (Prod.mk x) ν
 #align measure_theory.measure.prod MeasureTheory.Measure.prod
 
-instance prod.measureSpace {α β} [MeasureSpace α] [MeasureSpace β] : MeasureSpace (α × β)
-    where volume := volume.prod volume
+instance prod.measureSpace {α β} [MeasureSpace α] [MeasureSpace β] : MeasureSpace (α × β) where
+  volume := volume.prod volume
 #align measure_theory.measure.prod.measure_space MeasureTheory.Measure.prod.measureSpace
 
 variable [SigmaFinite ν]
chore: generalize layercake formulas to null-measurable and a.e.-nonnegative functions (#6936)

The layercake formulas (a typical example of which is ∫⁻ f^p ∂μ = p * ∫⁻ t in 0..∞, t^(p-1) * μ {ω | f(ω) > t}) had been originally proven assuming measurability and nonnegativity of f. This PR generalizes them to null-measurable and a.e.-nonnegative f.

Co-authored-by: kkytola <“kalle.kytola@aalto.fi”> Co-authored-by: kkytola <39528102+kkytola@users.noreply.github.com>

Diff
@@ -455,6 +455,29 @@ theorem ae_prod_mem_iff_ae_ae_mem {s : Set (α × β)} (hs : MeasurableSet s) :
     (∀ᵐ z ∂μ.prod ν, z ∈ s) ↔ ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, (x, y) ∈ s :=
   measure_prod_null hs.compl
 
+lemma measure_prod_compl_eq_zero {s : Set α} {t : Set β}
+    (s_ae_univ : μ sᶜ = 0) (t_ae_univ : ν tᶜ = 0) :
+    μ.prod ν (s ×ˢ t)ᶜ = 0 := by
+  rw [Set.compl_prod_eq_union]
+  apply le_antisymm ((measure_union_le _ _).trans _) (zero_le _)
+  simp [s_ae_univ, t_ae_univ]
+
+lemma _root_.MeasureTheory.NullMeasurableSet.prod {s : Set α} {t : Set β}
+    (s_mble : NullMeasurableSet s μ) (t_mble : NullMeasurableSet t ν) :
+    NullMeasurableSet (s ×ˢ t) (μ.prod ν) := by
+  obtain ⟨s₀, ⟨mble_s₀, s_aeeq_s₀⟩⟩ := s_mble
+  obtain ⟨t₀, ⟨mble_t₀, t_aeeq_t₀⟩⟩ := t_mble
+  refine ⟨s₀ ×ˢ t₀, ⟨mble_s₀.prod mble_t₀, ?_⟩⟩
+  rw [Measure.ae, Filter.eventuallyEq_iff_exists_mem] at *
+  simp only [Filter.mem_mk, mem_setOf_eq] at *
+  rcases s_aeeq_s₀ with ⟨u, ⟨u_mem, s_eq_s₀⟩⟩
+  rcases t_aeeq_t₀ with ⟨v, ⟨v_mem, t_eq_t₀⟩⟩
+  refine ⟨u ×ˢ v, ⟨measure_prod_compl_eq_zero u_mem v_mem, ?_⟩⟩
+  intro p hp
+  change (p ∈ s ×ˢ t) = (p ∈ s₀ ×ˢ t₀)
+  simp [show p.fst ∈ s ↔ p.fst ∈ s₀ from Iff.of_eq (s_eq_s₀ hp.1),
+        show p.snd ∈ t ↔ p.snd ∈ t₀ from Iff.of_eq (t_eq_t₀ hp.2)]
+
 /-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/
 noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
     (hμ : μ.FiniteSpanningSetsIn C) (hν : ν.FiniteSpanningSetsIn D) :
feat: expand API on locally integrable functions (#7006)

Measure theory prerequisites for Rademacher theorem in #7003.

Diff
@@ -444,11 +444,17 @@ theorem AbsolutelyContinuous.prod [SigmaFinite ν'] (h1 : μ ≪ μ') (h2 : ν 
 #align measure_theory.measure.absolutely_continuous.prod MeasureTheory.Measure.AbsolutelyContinuous.prod
 
 /-- Note: the converse is not true. For a counterexample, see
-  Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
+  Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. It is true if the set is
+  measurable, see `ae_prod_mem_iff_ae_ae_mem`. -/
 theorem ae_ae_of_ae_prod {p : α × β → Prop} (h : ∀ᵐ z ∂μ.prod ν, p z) :
     ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, p (x, y) :=
   measure_ae_null_of_prod_null h
 #align measure_theory.measure.ae_ae_of_ae_prod MeasureTheory.Measure.ae_ae_of_ae_prod
+
+theorem ae_prod_mem_iff_ae_ae_mem {s : Set (α × β)} (hs : MeasurableSet s) :
+    (∀ᵐ z ∂μ.prod ν, z ∈ s) ↔ ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, (x, y) ∈ s :=
+  measure_prod_null hs.compl
+
 /-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/
 noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
     (hμ : μ.FiniteSpanningSetsIn C) (hν : ν.FiniteSpanningSetsIn D) :
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -464,12 +464,12 @@ noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)}
 
 theorem quasiMeasurePreserving_fst : QuasiMeasurePreserving Prod.fst (μ.prod ν) μ := by
   refine' ⟨measurable_fst, AbsolutelyContinuous.mk fun s hs h2s => _⟩
-  rw [map_apply measurable_fst hs, ← prod_univ, prod_prod, h2s, MulZeroClass.zero_mul]
+  rw [map_apply measurable_fst hs, ← prod_univ, prod_prod, h2s, zero_mul]
 #align measure_theory.measure.quasi_measure_preserving_fst MeasureTheory.Measure.quasiMeasurePreserving_fst
 
 theorem quasiMeasurePreserving_snd : QuasiMeasurePreserving Prod.snd (μ.prod ν) ν := by
   refine' ⟨measurable_snd, AbsolutelyContinuous.mk fun s hs h2s => _⟩
-  rw [map_apply measurable_snd hs, ← univ_prod, prod_prod, h2s, MulZeroClass.mul_zero]
+  rw [map_apply measurable_snd hs, ← univ_prod, prod_prod, h2s, mul_zero]
 #align measure_theory.measure.quasi_measure_preserving_snd MeasureTheory.Measure.quasiMeasurePreserving_snd
 
 variable [SigmaFinite μ]
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -66,7 +66,7 @@ open TopologicalSpace hiding generateFrom
 
 open Filter hiding prod_eq map
 
-variable {α α' β β' γ E : Type _}
+variable {α α' β β' γ E : Type*}
 
 /-- Rectangles formed by π-systems form a π-system. -/
 theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C)
@@ -207,7 +207,7 @@ theorem Measurable.map_prod_mk_right {μ : Measure α} [SigmaFinite μ] :
   exact measurable_measure_prod_mk_right hs
 #align measurable.map_prod_mk_right Measurable.map_prod_mk_right
 
-theorem MeasurableEmbedding.prod_mk {α β γ δ : Type _} {mα : MeasurableSpace α}
+theorem MeasurableEmbedding.prod_mk {α β γ δ : Type*} {mα : MeasurableSpace α}
     {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ} {mδ : MeasurableSpace δ} {f : α → β}
     {g : γ → δ} (hg : MeasurableEmbedding g) (hf : MeasurableEmbedding f) :
     MeasurableEmbedding fun x : γ × α => (g x.1, f x.2) := by
@@ -345,7 +345,7 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν
       _ = μ.prod ν (s ×ˢ t) := measure_toMeasurable _
 #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod
 
-instance prod.instIsOpenPosMeasure {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y]
+instance prod.instIsOpenPosMeasure {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
     {m : MeasurableSpace X} {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y}
     {ν : Measure Y} [IsOpenPosMeasure ν] [SigmaFinite ν] : IsOpenPosMeasure (μ.prod ν) := by
   constructor
@@ -358,13 +358,13 @@ instance prod.instIsOpenPosMeasure {X Y : Type _} [TopologicalSpace X] [Topologi
   · exact v_open.measure_pos ν ⟨y, yv⟩
 #align measure_theory.measure.prod.is_open_pos_measure MeasureTheory.Measure.prod.instIsOpenPosMeasure
 
-instance {X Y : Type _}
+instance {X Y : Type*}
     [TopologicalSpace X] [MeasureSpace X] [IsOpenPosMeasure (volume : Measure X)]
     [TopologicalSpace Y] [MeasureSpace Y] [IsOpenPosMeasure (volume : Measure Y)]
     [SigmaFinite (volume : Measure Y)] : IsOpenPosMeasure (volume : Measure (X × Y)) :=
   prod.instIsOpenPosMeasure
 
-instance prod.instIsFiniteMeasure {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
+instance prod.instIsFiniteMeasure {α β : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
     (μ : Measure α) (ν : Measure β) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
     IsFiniteMeasure (μ.prod ν) := by
   constructor
@@ -372,22 +372,22 @@ instance prod.instIsFiniteMeasure {α β : Type _} {mα : MeasurableSpace α} {m
   exact mul_lt_top (measure_lt_top _ _).ne (measure_lt_top _ _).ne
 #align measure_theory.measure.prod.measure_theory.is_finite_measure MeasureTheory.Measure.prod.instIsFiniteMeasure
 
-instance {α β : Type _} [MeasureSpace α] [MeasureSpace β] [IsFiniteMeasure (volume : Measure α)]
+instance {α β : Type*} [MeasureSpace α] [MeasureSpace β] [IsFiniteMeasure (volume : Measure α)]
     [IsFiniteMeasure (volume : Measure β)] : IsFiniteMeasure (volume : Measure (α × β)) :=
   prod.instIsFiniteMeasure _ _
 
-instance prod.instIsProbabilityMeasure {α β : Type _} {mα : MeasurableSpace α}
+instance prod.instIsProbabilityMeasure {α β : Type*} {mα : MeasurableSpace α}
     {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsProbabilityMeasure μ]
     [IsProbabilityMeasure ν] : IsProbabilityMeasure (μ.prod ν) :=
   ⟨by rw [← univ_prod_univ, prod_prod, measure_univ, measure_univ, mul_one]⟩
 #align measure_theory.measure.prod.measure_theory.is_probability_measure MeasureTheory.Measure.prod.instIsProbabilityMeasure
 
-instance {α β : Type _} [MeasureSpace α] [MeasureSpace β]
+instance {α β : Type*} [MeasureSpace α] [MeasureSpace β]
     [IsProbabilityMeasure (volume : Measure α)] [IsProbabilityMeasure (volume : Measure β)] :
     IsProbabilityMeasure (volume : Measure (α × β)) :=
   prod.instIsProbabilityMeasure _ _
 
-instance prod.instIsFiniteMeasureOnCompacts {α β : Type _} [TopologicalSpace α] [TopologicalSpace β]
+instance prod.instIsFiniteMeasureOnCompacts {α β : Type*} [TopologicalSpace α] [TopologicalSpace β]
     {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β)
     [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] [SigmaFinite ν] :
     IsFiniteMeasureOnCompacts (μ.prod ν) := by
@@ -404,7 +404,7 @@ instance prod.instIsFiniteMeasureOnCompacts {α β : Type _} [TopologicalSpace 
       (IsCompact.measure_lt_top (hK.image continuous_snd)).ne
 #align measure_theory.measure.prod.measure_theory.is_finite_measure_on_compacts MeasureTheory.Measure.prod.instIsFiniteMeasureOnCompacts
 
-instance {X Y : Type _}
+instance {X Y : Type*}
     [TopologicalSpace X] [MeasureSpace X] [IsFiniteMeasureOnCompacts (volume : Measure X)]
     [TopologicalSpace Y] [MeasureSpace Y] [IsFiniteMeasureOnCompacts (volume : Measure Y)]
     [SigmaFinite (volume : Measure Y)] : IsFiniteMeasureOnCompacts (volume : Measure (X × Y)) :=
@@ -565,13 +565,13 @@ theorem dirac_prod_dirac {x : α} {y : β} : (dirac x).prod (dirac y) = dirac (x
   rw [prod_dirac, map_dirac measurable_prod_mk_right]
 #align measure_theory.measure.dirac_prod_dirac MeasureTheory.Measure.dirac_prod_dirac
 
-theorem prod_sum {ι : Type _} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] :
+theorem prod_sum {ι : Type*} [Finite ι] (ν : ι → Measure β) [∀ i, SigmaFinite (ν i)] :
     μ.prod (sum ν) = sum fun i => μ.prod (ν i) := by
   refine' prod_eq fun s t hs ht => _
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ ht, prod_prod, ENNReal.tsum_mul_left]
 #align measure_theory.measure.prod_sum MeasureTheory.Measure.prod_sum
 
-theorem sum_prod {ι : Type _} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
+theorem sum_prod {ι : Type*} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
     (sum μ).prod ν = sum fun i => (μ i).prod ν := by
   refine' prod_eq fun s t hs ht => _
   simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ENNReal.tsum_mul_right]
@@ -613,7 +613,7 @@ open Measure
 
 namespace MeasurePreserving
 
-variable {δ : Type _} [MeasurableSpace δ] {μa : Measure α} {μb : Measure β} {μc : Measure γ}
+variable {δ : Type*} [MeasurableSpace δ] {μa : Measure α} {μb : Measure β} {μc : Measure γ}
   {μd : Measure δ}
 
 theorem skew_product [SigmaFinite μb] [SigmaFinite μd] {f : α → β} (hf : MeasurePreserving f μa μb)
chore(Probability.Kernel): drop AEMeasurable assumptions (#6129)
Diff
@@ -820,6 +820,8 @@ theorem fst_apply {s : Set α} (hs : MeasurableSet s) : ρ.fst s = ρ (Prod.fst
 theorem fst_univ : ρ.fst univ = ρ univ := by rw [fst_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.fst_univ MeasureTheory.Measure.fst_univ
 
+@[simp] theorem fst_zero : fst (0 : Measure (α × β)) = 0 := by simp [fst]
+
 instance fst.instIsFiniteMeasure [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.fst := by
   rw [fst]
   infer_instance
@@ -836,17 +838,21 @@ lemma fst_prod [IsProbabilityMeasure ν] : (μ.prod ν).fst = μ := by
   ext1 s hs
   rw [fst_apply hs, ← prod_univ, prod_prod, measure_univ, mul_one]
 
-theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
+theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α}
     (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).fst = μ.map X := by
-  ext1 s hs
-  rw [Measure.fst_apply hs, Measure.map_apply_of_aemeasurable (hX.prod_mk hY) (measurable_fst hs),
-    Measure.map_apply_of_aemeasurable hX hs, ← prod_univ, mk_preimage_prod, preimage_univ,
-    inter_univ]
+  by_cases hX : AEMeasurable X μ
+  · ext1 s hs
+    rw [Measure.fst_apply hs, Measure.map_apply_of_aemeasurable (hX.prod_mk hY) (measurable_fst hs),
+      Measure.map_apply_of_aemeasurable hX hs, ← prod_univ, mk_preimage_prod, preimage_univ,
+      inter_univ]
+  · have : ¬AEMeasurable (fun x ↦ (X x, Y x)) μ := by
+      contrapose! hX; exact measurable_fst.comp_aemeasurable hX
+    simp [map_of_not_aemeasurable, hX, this]
 #align measure_theory.measure.fst_map_prod_mk₀ MeasureTheory.Measure.fst_map_prod_mk₀
 
-theorem fst_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
+theorem fst_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α}
     (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).fst = μ.map X :=
-  fst_map_prod_mk₀ hX.aemeasurable hY.aemeasurable
+  fst_map_prod_mk₀ hY.aemeasurable
 #align measure_theory.measure.fst_map_prod_mk MeasureTheory.Measure.fst_map_prod_mk
 
 /-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map Prod.snd`. -/
@@ -861,6 +867,8 @@ theorem snd_apply {s : Set β} (hs : MeasurableSet s) : ρ.snd s = ρ (Prod.snd
 theorem snd_univ : ρ.snd univ = ρ univ := by rw [snd_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.snd_univ MeasureTheory.Measure.snd_univ
 
+@[simp] theorem snd_zero : snd (0 : Measure (α × β)) = 0 := by simp [snd]
+
 instance snd.instIsFiniteMeasure [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.snd := by
   rw [snd]
   infer_instance
@@ -877,17 +885,22 @@ lemma snd_prod [IsProbabilityMeasure μ] : (μ.prod ν).snd = ν := by
   ext1 s hs
   rw [snd_apply hs, ← univ_prod, prod_prod, measure_univ, one_mul]
 
-theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
-    (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).snd = μ.map Y := by
-  ext1 s hs
-  rw [Measure.snd_apply hs, Measure.map_apply_of_aemeasurable (hX.prod_mk hY) (measurable_snd hs),
-    Measure.map_apply_of_aemeasurable hY hs, ← univ_prod, mk_preimage_prod, preimage_univ,
-    univ_inter]
+theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ) :
+    (μ.map fun a => (X a, Y a)).snd = μ.map Y := by
+  by_cases hY : AEMeasurable Y μ
+  · ext1 s hs
+    rw [Measure.snd_apply hs, Measure.map_apply_of_aemeasurable (hX.prod_mk hY) (measurable_snd hs),
+      Measure.map_apply_of_aemeasurable hY hs, ← univ_prod, mk_preimage_prod, preimage_univ,
+      univ_inter]
+  · have : ¬AEMeasurable (fun x ↦ (X x, Y x)) μ := by
+      contrapose! hY; exact measurable_snd.comp_aemeasurable hY
+    simp [map_of_not_aemeasurable, hY, this]
+
 #align measure_theory.measure.snd_map_prod_mk₀ MeasureTheory.Measure.snd_map_prod_mk₀
 
-theorem snd_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
-    (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).snd = μ.map Y :=
-  snd_map_prod_mk₀ hX.aemeasurable hY.aemeasurable
+theorem snd_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X) :
+    (μ.map fun a => (X a, Y a)).snd = μ.map Y :=
+  snd_map_prod_mk₀ hX.aemeasurable
 #align measure_theory.measure.snd_map_prod_mk MeasureTheory.Measure.snd_map_prod_mk
 
 end Measure
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2020 Floris van Doorn. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn
-
-! This file was ported from Lean 3 source module measure_theory.constructions.prod.basic
-! leanprover-community/mathlib commit 00abe0695d8767201e6d008afa22393978bb324d
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.MeasureTheory.Measure.GiryMonad
 import Mathlib.Dynamics.Ergodic.MeasurePreserving
 import Mathlib.MeasureTheory.Integral.Lebesgue
 import Mathlib.MeasureTheory.Measure.OpenPos
 
+#align_import measure_theory.constructions.prod.basic from "leanprover-community/mathlib"@"00abe0695d8767201e6d008afa22393978bb324d"
+
 /-!
 # The product measure
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -763,7 +763,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.pr
 #align measure_theory.lintegral_prod MeasureTheory.lintegral_prod
 
 /-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
-functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
+functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
     ∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by
   simp_rw [← lintegral_prod_swap f hf]
@@ -771,7 +771,7 @@ theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf :
 #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm
 
 /-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
-functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
+functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
     ∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
   lintegral_prod_symm f hf.aemeasurable
chore: remove superfluous parentheses around integrals (#5591)
Diff
@@ -716,7 +716,7 @@ namespace MeasureTheory
 variable [SigmaFinite ν]
 
 theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
-    (∫⁻ z, f z.swap ∂ν.prod μ) = ∫⁻ z, f z ∂μ.prod ν := by
+    ∫⁻ z, f z.swap ∂ν.prod μ = ∫⁻ z, f z ∂μ.prod ν := by
   rw [← prod_swap] at hf
   rw [← lintegral_map' hf measurable_swap.aemeasurable, prod_swap]
 #align measure_theory.lintegral_prod_swap MeasureTheory.lintegral_prod_swap
@@ -724,10 +724,10 @@ theorem lintegral_prod_swap [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf :
 /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued measurable functions on `α × β`,
   the integral of `f` is equal to the iterated integral. -/
 theorem lintegral_prod_of_measurable :
-    ∀ (f : α × β → ℝ≥0∞), Measurable f → (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by
+    ∀ (f : α × β → ℝ≥0∞), Measurable f → ∫⁻ z, f z ∂μ.prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by
   have m := @measurable_prod_mk_left
   refine' Measurable.ennreal_induction
-    (P := fun f => (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ) _ _ _
+    (P := fun f => ∫⁻ z, f z ∂μ.prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ) _ _ _
   · intro c s hs
     conv_rhs =>
       enter [2, x, 2, y]
@@ -754,8 +754,8 @@ theorem lintegral_prod_of_measurable :
 /-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued almost everywhere measurable functions on `α × β`,
   the integral of `f` is equal to the iterated integral. -/
 theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
-    (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by
-  have A : (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ z, hf.mk f z ∂μ.prod ν := lintegral_congr_ae hf.ae_eq_mk
+    ∫⁻ z, f z ∂μ.prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by
+  have A : ∫⁻ z, f z ∂μ.prod ν = ∫⁻ z, hf.mk f z ∂μ.prod ν := lintegral_congr_ae hf.ae_eq_mk
   have B : (∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ) = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂ν ∂μ := by
     apply lintegral_congr_ae
     filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk]with _ ha using lintegral_congr_ae ha
@@ -765,7 +765,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.pr
 /-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
-    (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by
+    ∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by
   simp_rw [← lintegral_prod_swap f hf]
   exact lintegral_prod _ hf.prod_swap
 #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm
@@ -773,14 +773,14 @@ theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf :
 /-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
-    (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
+    ∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
   lintegral_prod_symm f hf.aemeasurable
 #align measure_theory.lintegral_prod_symm' MeasureTheory.lintegral_prod_symm'
 
 /-- The reversed version of **Tonelli's Theorem**. In this version `f` is in curried form, which
 makes it easier for the elaborator to figure out `f` automatically. -/
 theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurable (uncurry f) (μ.prod ν)) :
-    (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ z, f z.1 z.2 ∂μ.prod ν :=
+    ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.1 z.2 ∂μ.prod ν :=
   (lintegral_prod _ hf).symm
 #align measure_theory.lintegral_lintegral MeasureTheory.lintegral_lintegral
 
@@ -788,19 +788,19 @@ theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurabl
 curried form, which makes it easier for the elaborator to figure out `f` automatically. -/
 theorem lintegral_lintegral_symm [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
     (hf : AEMeasurable (uncurry f) (μ.prod ν)) :
-    (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ z, f z.2 z.1 ∂ν.prod μ :=
+    ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.2 z.1 ∂ν.prod μ :=
   (lintegral_prod_symm _ hf.prod_swap).symm
 #align measure_theory.lintegral_lintegral_symm MeasureTheory.lintegral_lintegral_symm
 
 /-- Change the order of Lebesgue integration. -/
 theorem lintegral_lintegral_swap [SigmaFinite μ] ⦃f : α → β → ℝ≥0∞⦄
     (hf : AEMeasurable (uncurry f) (μ.prod ν)) :
-    (∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ) = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
+    ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
   (lintegral_lintegral hf).trans (lintegral_prod_symm _ hf)
 #align measure_theory.lintegral_lintegral_swap MeasureTheory.lintegral_lintegral_swap
 
 theorem lintegral_prod_mul {f : α → ℝ≥0∞} {g : β → ℝ≥0∞} (hf : AEMeasurable f μ)
-    (hg : AEMeasurable g ν) : (∫⁻ z, f z.1 * g z.2 ∂μ.prod ν) = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by
+    (hg : AEMeasurable g ν) : ∫⁻ z, f z.1 * g z.2 ∂μ.prod ν = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by
   simp [lintegral_prod _ (hf.fst.mul hg.snd), lintegral_lintegral_mul hf hg]
 #align measure_theory.lintegral_prod_mul MeasureTheory.lintegral_prod_mul
 
chore: tidy various files (#5482)
Diff
@@ -38,7 +38,7 @@ We also prove Tonelli's theorem.
   `α × β → ℝ≥0∞` we have `∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ`. The version
   for functions `α → β → ℝ≥0∞` is reversed, and called `lintegral_lintegral`. Both versions have
   a variant with `_symm` appended, where the order of integration is reversed.
-  The lemma `measurable.lintegral_prod_right'` states that the inner integral of the right-hand side
+  The lemma `Measurable.lintegral_prod_right'` states that the inner integral of the right-hand side
   is measurable.
 
 ## Implementation Notes
feat(Probability/Cdf): cumulative distribution function of a probability measure (#5392)

Co-authored-by: RemyDegenne <remydegenne@gmail.com>

Diff
@@ -834,6 +834,11 @@ instance fst.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityM
     exact measure_univ
 #align measure_theory.measure.fst.measure_theory.is_probability_measure MeasureTheory.Measure.fst.instIsProbabilityMeasure
 
+@[simp]
+lemma fst_prod [IsProbabilityMeasure ν] : (μ.prod ν).fst = μ := by
+  ext1 s hs
+  rw [fst_apply hs, ← prod_univ, prod_prod, measure_univ, mul_one]
+
 theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
     (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).fst = μ.map X := by
   ext1 s hs
@@ -870,6 +875,11 @@ instance snd.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityM
     exact measure_univ
 #align measure_theory.measure.snd.measure_theory.is_probability_measure MeasureTheory.Measure.snd.instIsProbabilityMeasure
 
+@[simp]
+lemma snd_prod [IsProbabilityMeasure μ] : (μ.prod ν).snd = ν := by
+  ext1 s hs
+  rw [snd_apply hs, ← univ_prod, prod_prod, measure_univ, one_mul]
+
 theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
     (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).snd = μ.map Y := by
   ext1 s hs
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -217,7 +217,7 @@ theorem MeasurableEmbedding.prod_mk {α β γ δ : Type _} {mα : MeasurableSpac
   have h_inj : Function.Injective fun x : γ × α => (g x.fst, f x.snd) := by
     intro x y hxy
     rw [← @Prod.mk.eta _ _ x, ← @Prod.mk.eta _ _ y]
-    simp only [Prod.mk.inj_iff] at hxy⊢
+    simp only [Prod.mk.inj_iff] at hxy ⊢
     exact ⟨hg.injective hxy.1, hf.injective hxy.2⟩
   refine' ⟨h_inj, _, _⟩
   · exact (hg.measurable.comp measurable_fst).prod_mk (hf.measurable.comp measurable_snd)
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn
 
 ! This file was ported from Lean 3 source module measure_theory.constructions.prod.basic
-! leanprover-community/mathlib commit 3b88f4005dc2e28d42f974cc1ce838f0dafb39b8
+! leanprover-community/mathlib commit 00abe0695d8767201e6d008afa22393978bb324d
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -834,6 +834,19 @@ instance fst.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityM
     exact measure_univ
 #align measure_theory.measure.fst.measure_theory.is_probability_measure MeasureTheory.Measure.fst.instIsProbabilityMeasure
 
+theorem fst_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
+    (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).fst = μ.map X := by
+  ext1 s hs
+  rw [Measure.fst_apply hs, Measure.map_apply_of_aemeasurable (hX.prod_mk hY) (measurable_fst hs),
+    Measure.map_apply_of_aemeasurable hX hs, ← prod_univ, mk_preimage_prod, preimage_univ,
+    inter_univ]
+#align measure_theory.measure.fst_map_prod_mk₀ MeasureTheory.Measure.fst_map_prod_mk₀
+
+theorem fst_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
+    (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).fst = μ.map X :=
+  fst_map_prod_mk₀ hX.aemeasurable hY.aemeasurable
+#align measure_theory.measure.fst_map_prod_mk MeasureTheory.Measure.fst_map_prod_mk
+
 /-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map Prod.snd`. -/
 noncomputable def snd (ρ : Measure (α × β)) : Measure β :=
   ρ.map Prod.snd
@@ -857,6 +870,19 @@ instance snd.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityM
     exact measure_univ
 #align measure_theory.measure.snd.measure_theory.is_probability_measure MeasureTheory.Measure.snd.instIsProbabilityMeasure
 
+theorem snd_map_prod_mk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ)
+    (hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).snd = μ.map Y := by
+  ext1 s hs
+  rw [Measure.snd_apply hs, Measure.map_apply_of_aemeasurable (hX.prod_mk hY) (measurable_snd hs),
+    Measure.map_apply_of_aemeasurable hY hs, ← univ_prod, mk_preimage_prod, preimage_univ,
+    univ_inter]
+#align measure_theory.measure.snd_map_prod_mk₀ MeasureTheory.Measure.snd_map_prod_mk₀
+
+theorem snd_map_prod_mk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X)
+    (hY : Measurable Y) : (μ.map fun a => (X a, Y a)).snd = μ.map Y :=
+  snd_map_prod_mk₀ hX.aemeasurable hY.aemeasurable
+#align measure_theory.measure.snd_map_prod_mk MeasureTheory.Measure.snd_map_prod_mk
+
 end Measure
 
 end MeasureTheory
feat: add instances about volume (#4628)

Lean 3 was able to apply, e.g., instances about measure_theory.measure.prod to the volume on the Cartesian product. Lean 4 can't do this, so we need to duplicate many instances.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Komyyy <pol_tta@outlook.jp>

Diff
@@ -361,6 +361,12 @@ instance prod.instIsOpenPosMeasure {X Y : Type _} [TopologicalSpace X] [Topologi
   · exact v_open.measure_pos ν ⟨y, yv⟩
 #align measure_theory.measure.prod.is_open_pos_measure MeasureTheory.Measure.prod.instIsOpenPosMeasure
 
+instance {X Y : Type _}
+    [TopologicalSpace X] [MeasureSpace X] [IsOpenPosMeasure (volume : Measure X)]
+    [TopologicalSpace Y] [MeasureSpace Y] [IsOpenPosMeasure (volume : Measure Y)]
+    [SigmaFinite (volume : Measure Y)] : IsOpenPosMeasure (volume : Measure (X × Y)) :=
+  prod.instIsOpenPosMeasure
+
 instance prod.instIsFiniteMeasure {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
     (μ : Measure α) (ν : Measure β) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
     IsFiniteMeasure (μ.prod ν) := by
@@ -369,12 +375,21 @@ instance prod.instIsFiniteMeasure {α β : Type _} {mα : MeasurableSpace α} {m
   exact mul_lt_top (measure_lt_top _ _).ne (measure_lt_top _ _).ne
 #align measure_theory.measure.prod.measure_theory.is_finite_measure MeasureTheory.Measure.prod.instIsFiniteMeasure
 
+instance {α β : Type _} [MeasureSpace α] [MeasureSpace β] [IsFiniteMeasure (volume : Measure α)]
+    [IsFiniteMeasure (volume : Measure β)] : IsFiniteMeasure (volume : Measure (α × β)) :=
+  prod.instIsFiniteMeasure _ _
+
 instance prod.instIsProbabilityMeasure {α β : Type _} {mα : MeasurableSpace α}
     {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsProbabilityMeasure μ]
     [IsProbabilityMeasure ν] : IsProbabilityMeasure (μ.prod ν) :=
   ⟨by rw [← univ_prod_univ, prod_prod, measure_univ, measure_univ, mul_one]⟩
 #align measure_theory.measure.prod.measure_theory.is_probability_measure MeasureTheory.Measure.prod.instIsProbabilityMeasure
 
+instance {α β : Type _} [MeasureSpace α] [MeasureSpace β]
+    [IsProbabilityMeasure (volume : Measure α)] [IsProbabilityMeasure (volume : Measure β)] :
+    IsProbabilityMeasure (volume : Measure (α × β)) :=
+  prod.instIsProbabilityMeasure _ _
+
 instance prod.instIsFiniteMeasureOnCompacts {α β : Type _} [TopologicalSpace α] [TopologicalSpace β]
     {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β)
     [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] [SigmaFinite ν] :
@@ -392,6 +407,12 @@ instance prod.instIsFiniteMeasureOnCompacts {α β : Type _} [TopologicalSpace 
       (IsCompact.measure_lt_top (hK.image continuous_snd)).ne
 #align measure_theory.measure.prod.measure_theory.is_finite_measure_on_compacts MeasureTheory.Measure.prod.instIsFiniteMeasureOnCompacts
 
+instance {X Y : Type _}
+    [TopologicalSpace X] [MeasureSpace X] [IsFiniteMeasureOnCompacts (volume : Measure X)]
+    [TopologicalSpace Y] [MeasureSpace Y] [IsFiniteMeasureOnCompacts (volume : Measure Y)]
+    [SigmaFinite (volume : Measure Y)] : IsFiniteMeasureOnCompacts (volume : Measure (X × Y)) :=
+  prod.instIsFiniteMeasureOnCompacts _ _
+
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.prod ν) s ≠ ∞) :
     ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by
   rw [prod_apply hs] at h2s
@@ -460,6 +481,10 @@ instance prod.instSigmaFinite : SigmaFinite (μ.prod ν) :=
   (μ.toFiniteSpanningSetsIn.prod ν.toFiniteSpanningSetsIn).sigmaFinite
 #align measure_theory.measure.prod.sigma_finite MeasureTheory.Measure.prod.instSigmaFinite
 
+instance {α β} [MeasureSpace α] [SigmaFinite (volume : Measure α)]
+    [MeasureSpace β] [SigmaFinite (volume : Measure β)] : SigmaFinite (volume : Measure (α × β)) :=
+  prod.instSigmaFinite
+
 /-- A measure on a product space equals the product measure if they are equal on rectangles
   with as sides sets that generate the corresponding σ-algebras. -/
 theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
style: allow _ for an argument in notation3 & replace _foo with _ in notation3 (#4652)
Diff
@@ -341,7 +341,7 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν
     have hss' : s ⊆ s' := fun x hx => measure_mono fun y hy => hST <| mk_mem_prod hx hy
     calc
       μ s * ν t ≤ μ s' * ν t := mul_le_mul_right' (measure_mono hss') _
-      _ = ∫⁻ _x in s', ν t ∂μ := by rw [set_lintegral_const, mul_comm]
+      _ = ∫⁻ _ in s', ν t ∂μ := by rw [set_lintegral_const, mul_comm]
       _ ≤ ∫⁻ x in s', f x ∂μ := (set_lintegral_mono measurable_const hfm fun x => id)
       _ ≤ ∫⁻ x, f x ∂μ := (lintegral_mono' restrict_le_self le_rfl)
       _ = μ.prod ν ST := (prod_apply hSTm).symm
style: recover Is of Foo which is ported from is_foo (#4639)

I have misported is_foo to Foo because I misunderstood the rule for IsLawfulFoo. This PR recover Is of Foo which is ported from is_foo. This PR also renames some misported theorems.

Diff
@@ -158,7 +158,7 @@ theorem isPiSystem_prod :
 
 /-- If `ν` is a finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
   a measurable function. `measurable_measure_prod_mk_left` is strictly more general. -/
-theorem measurable_measure_prod_mk_left_finite [FiniteMeasure ν] {s : Set (α × β)}
+theorem measurable_measure_prod_mk_left_finite [IsFiniteMeasure ν] {s : Set (α × β)}
     (hs : MeasurableSet s) : Measurable fun x => ν (Prod.mk x ⁻¹' s) := by
   refine' induction_on_inter (C := fun s => Measurable fun x => ν (Prod.mk x ⁻¹' s))
     generateFrom_prod.symm isPiSystem_prod _ _ _ _ hs
@@ -348,9 +348,9 @@ theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν
       _ = μ.prod ν (s ×ˢ t) := measure_toMeasurable _
 #align measure_theory.measure.prod_prod MeasureTheory.Measure.prod_prod
 
-instance prod.instOpenPosMeasure {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y]
-    {m : MeasurableSpace X} {μ : Measure X} [OpenPosMeasure μ] {m' : MeasurableSpace Y}
-    {ν : Measure Y} [OpenPosMeasure ν] [SigmaFinite ν] : OpenPosMeasure (μ.prod ν) := by
+instance prod.instIsOpenPosMeasure {X Y : Type _} [TopologicalSpace X] [TopologicalSpace Y]
+    {m : MeasurableSpace X} {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y}
+    {ν : Measure Y} [IsOpenPosMeasure ν] [SigmaFinite ν] : IsOpenPosMeasure (μ.prod ν) := by
   constructor
   rintro U U_open ⟨⟨x, y⟩, hxy⟩
   rcases isOpen_prod_iff.1 U_open x y hxy with ⟨u, v, u_open, v_open, xu, yv, huv⟩
@@ -359,26 +359,26 @@ instance prod.instOpenPosMeasure {X Y : Type _} [TopologicalSpace X] [Topologica
   constructor
   · exact u_open.measure_pos μ ⟨x, xu⟩
   · exact v_open.measure_pos ν ⟨y, yv⟩
-#align measure_theory.measure.prod.is_open_pos_measure MeasureTheory.Measure.prod.instOpenPosMeasure
+#align measure_theory.measure.prod.is_open_pos_measure MeasureTheory.Measure.prod.instIsOpenPosMeasure
 
-instance prod.instFiniteMeasure {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
-    (μ : Measure α) (ν : Measure β) [FiniteMeasure μ] [FiniteMeasure ν] :
-    FiniteMeasure (μ.prod ν) := by
+instance prod.instIsFiniteMeasure {α β : Type _} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
+    (μ : Measure α) (ν : Measure β) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
+    IsFiniteMeasure (μ.prod ν) := by
   constructor
   rw [← univ_prod_univ, prod_prod]
   exact mul_lt_top (measure_lt_top _ _).ne (measure_lt_top _ _).ne
-#align measure_theory.measure.prod.measure_theory.is_finite_measure MeasureTheory.Measure.prod.instFiniteMeasure
+#align measure_theory.measure.prod.measure_theory.is_finite_measure MeasureTheory.Measure.prod.instIsFiniteMeasure
 
-instance prod.instProbabilityMeasure {α β : Type _} {mα : MeasurableSpace α}
-    {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [ProbabilityMeasure μ]
-    [ProbabilityMeasure ν] : ProbabilityMeasure (μ.prod ν) :=
+instance prod.instIsProbabilityMeasure {α β : Type _} {mα : MeasurableSpace α}
+    {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsProbabilityMeasure μ]
+    [IsProbabilityMeasure ν] : IsProbabilityMeasure (μ.prod ν) :=
   ⟨by rw [← univ_prod_univ, prod_prod, measure_univ, measure_univ, mul_one]⟩
-#align measure_theory.measure.prod.measure_theory.is_probability_measure MeasureTheory.Measure.prod.instProbabilityMeasure
+#align measure_theory.measure.prod.measure_theory.is_probability_measure MeasureTheory.Measure.prod.instIsProbabilityMeasure
 
-instance prod.instFiniteMeasureOnCompacts {α β : Type _} [TopologicalSpace α] [TopologicalSpace β]
+instance prod.instIsFiniteMeasureOnCompacts {α β : Type _} [TopologicalSpace α] [TopologicalSpace β]
     {mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β)
-    [FiniteMeasureOnCompacts μ] [FiniteMeasureOnCompacts ν] [SigmaFinite ν] :
-    FiniteMeasureOnCompacts (μ.prod ν) := by
+    [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] [SigmaFinite ν] :
+    IsFiniteMeasureOnCompacts (μ.prod ν) := by
   refine' ⟨fun K hK => _⟩
   set L := (Prod.fst '' K) ×ˢ (Prod.snd '' K) with hL
   have : K ⊆ L := by
@@ -390,7 +390,7 @@ instance prod.instFiniteMeasureOnCompacts {α β : Type _} [TopologicalSpace α]
   exact
     mul_lt_top (IsCompact.measure_lt_top (hK.image continuous_fst)).ne
       (IsCompact.measure_lt_top (hK.image continuous_snd)).ne
-#align measure_theory.measure.prod.measure_theory.is_finite_measure_on_compacts MeasureTheory.Measure.prod.instFiniteMeasureOnCompacts
+#align measure_theory.measure.prod.measure_theory.is_finite_measure_on_compacts MeasureTheory.Measure.prod.instIsFiniteMeasureOnCompacts
 
 theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.prod ν) s ≠ ∞) :
     ∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by
@@ -798,16 +798,16 @@ theorem fst_apply {s : Set α} (hs : MeasurableSet s) : ρ.fst s = ρ (Prod.fst
 theorem fst_univ : ρ.fst univ = ρ univ := by rw [fst_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.fst_univ MeasureTheory.Measure.fst_univ
 
-instance fst.instFiniteMeasure [FiniteMeasure ρ] : FiniteMeasure ρ.fst := by
+instance fst.instIsFiniteMeasure [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.fst := by
   rw [fst]
   infer_instance
-#align measure_theory.measure.fst.measure_theory.is_finite_measure MeasureTheory.Measure.fst.instFiniteMeasure
+#align measure_theory.measure.fst.measure_theory.is_finite_measure MeasureTheory.Measure.fst.instIsFiniteMeasure
 
-instance fst.instProbabilityMeasure [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.fst where
+instance fst.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.fst where
   measure_univ := by
     rw [fst_univ]
     exact measure_univ
-#align measure_theory.measure.fst.measure_theory.is_probability_measure MeasureTheory.Measure.fst.instProbabilityMeasure
+#align measure_theory.measure.fst.measure_theory.is_probability_measure MeasureTheory.Measure.fst.instIsProbabilityMeasure
 
 /-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map Prod.snd`. -/
 noncomputable def snd (ρ : Measure (α × β)) : Measure β :=
@@ -821,16 +821,16 @@ theorem snd_apply {s : Set β} (hs : MeasurableSet s) : ρ.snd s = ρ (Prod.snd
 theorem snd_univ : ρ.snd univ = ρ univ := by rw [snd_apply MeasurableSet.univ, preimage_univ]
 #align measure_theory.measure.snd_univ MeasureTheory.Measure.snd_univ
 
-instance snd.instFiniteMeasure [FiniteMeasure ρ] : FiniteMeasure ρ.snd := by
+instance snd.instIsFiniteMeasure [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.snd := by
   rw [snd]
   infer_instance
-#align measure_theory.measure.snd.measure_theory.is_finite_measure MeasureTheory.Measure.snd.instFiniteMeasure
+#align measure_theory.measure.snd.measure_theory.is_finite_measure MeasureTheory.Measure.snd.instIsFiniteMeasure
 
-instance snd.instProbabilityMeasure [ProbabilityMeasure ρ] : ProbabilityMeasure ρ.snd where
+instance snd.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.snd where
   measure_univ := by
     rw [snd_univ]
     exact measure_univ
-#align measure_theory.measure.snd.measure_theory.is_probability_measure MeasureTheory.Measure.snd.instProbabilityMeasure
+#align measure_theory.measure.snd.measure_theory.is_probability_measure MeasureTheory.Measure.snd.instIsProbabilityMeasure
 
 end Measure
 
chore: fix many typos (#4535)

Run codespell Mathlib and keep some suggestions.

Diff
@@ -737,7 +737,7 @@ theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.pr
   rw [A, B, lintegral_prod_of_measurable _ hf.measurable_mk]
 #align measure_theory.lintegral_prod MeasureTheory.lintegral_prod
 
-/-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
+/-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
     (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by
@@ -745,7 +745,7 @@ theorem lintegral_prod_symm [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf :
   exact lintegral_prod _ hf.prod_swap
 #align measure_theory.lintegral_prod_symm MeasureTheory.lintegral_prod_symm
 
-/-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
+/-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
 functions on `α × β`,  the integral of `f` is equal to the iterated integral, in reverse order. -/
 theorem lintegral_prod_symm' [SigmaFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
     (∫⁻ z, f z ∂μ.prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
feat: port MeasureTheory.Constructions.Prod.Basic (#4433)

Dependencies 10 + 638

639 files ported (98.5%)
288840 lines ported (98.2%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file