l3lab/ntp-mathlib huggingface dataset:
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 `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
    

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
⊢ SFinite μd

Next tactic:
rcases (ae_neBot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩
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 `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⟩
    

Proof state:
case intro
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
x : α
hx : map (g x) μc = μd
⊢ SFinite μd

Next tactic:
rw [← hx]
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 `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]
    

Proof state:
case intro
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
x : α
hx : map (g x) μc = μd
⊢ SFinite (map (g x) μc)

Next tactic:
infer_instance
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 `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
  

Proof state:
case inr
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
sf : SFinite μd
⊢ MeasurePreserving fun p => (f p.1, g p.1 p.2)

Next tactic:
refine ⟨this, ?_⟩
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 `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, ?_⟩
  

Proof state:
case inr
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
sf : SFinite μd
⊢ map (fun p => (f p.1, g p.1 p.2)) (Measure.prod μa μc) = Measure.prod μb μd

Next tactic:
ext s hs
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 `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
  

Proof state:
case inr.h
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
sf : SFinite μd
s : Set (β × δ)
hs : MeasurableSet s
⊢ ↑↑(map (fun p => (f p.1, g p.1 p.2)) (Measure.prod μa μc)) s = ↑↑(Measure.prod μb μd) s

Next tactic:
rw [map_apply this hs, prod_apply (this hs), prod_apply hs,
    ← hf.lintegral_comp (measurable_measure_prod_mk_left hs)]
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 `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)]
  

Proof state:
case inr.h
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
sf : SFinite μd
s : Set (β × δ)
hs : MeasurableSet s
⊢ ∫⁻ (x : α), ↑↑μc (Prod.mk x ⁻¹' ((fun p => (f p.1, g p.1 p.2)) ⁻¹' s)) ∂μa =
    ∫⁻ (a : α), ↑↑μd (Prod.mk (f a) ⁻¹' s) ∂μa

Next tactic:
apply lintegral_congr_ae
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 `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
  

Proof state:
case inr.h.h
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha : μa ≠ 0
sf : SFinite μd
s : Set (β × δ)
hs : MeasurableSet s
⊢ (fun a => ↑↑μc (Prod.mk a ⁻¹' ((fun p => (f p.1, g p.1 p.2)) ⁻¹' s))) =ᶠ[ae μa] fun a => ↑↑μd (Prod.mk (f a) ⁻¹' s)

Next tactic:
filter_upwards [hg] with a ha
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 `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
  

Proof state:
case h
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁸ : MeasurableSpace α
inst✝⁷ : MeasurableSpace α'
inst✝⁶ : MeasurableSpace β
inst✝⁵ : MeasurableSpace β'
inst✝⁴ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝³ : NormedAddCommGroup E
δ : Type u_7
inst✝² : MeasurableSpace δ
μa : Measure α
μb : Measure β
μc : Measure γ
μd : Measure δ
inst✝¹ : SFinite μa
inst✝ : SFinite μc
f : α → β
hf : MeasurePreserving f
g : α → γ → δ
hgm : Measurable (uncurry g)
hg : ∀ᵐ (x : α) ∂μa, map (g x) μc = μd
this : Measurable fun p => (f p.1, g p.1 p.2)
ha✝ : μa ≠ 0
sf : SFinite μd
s : Set (β × δ)
hs : MeasurableSet s
a : α
ha : map (g a) μc = μd
⊢ ↑↑μc (Prod.mk a ⁻¹' ((fun p => (f p.1, g p.1 p.2)) ⁻¹' s)) = ↑↑μd (Prod.mk (f a) ⁻¹' s)

Next tactic:
rw [← ha, map_apply hgm.of_uncurry_left (measurable_prod_mk_left hs), preimage_preimage,
    preimage_preimage]
theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
    (hf : Measurable f) [SFinite ν]
    (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
    QuasiMeasurePreserving f (μ.prod ν) τ := by
  

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁶ : MeasurableSpace α
inst✝⁵ : MeasurableSpace α'
inst✝⁴ : MeasurableSpace β
inst✝³ : MeasurableSpace β'
inst✝² : MeasurableSpace γ
μ✝ μ' : Measure α
ν✝ ν' : Measure β
τ✝ : Measure γ
inst✝¹ : NormedAddCommGroup E
f : α × β → γ
μ : Measure α
ν : Measure β
τ : Measure γ
hf : Measurable f
inst✝ : SFinite ν
h2f : ∀ᵐ (x : α) ∂μ, QuasiMeasurePreserving fun y => f (x, y)
⊢ QuasiMeasurePreserving f

Next tactic:
refine' ⟨hf, _⟩
theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
    (hf : Measurable f) [SFinite ν]
    (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
    QuasiMeasurePreserving f (μ.prod ν) τ := by
  refine' ⟨hf, _⟩
  

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁶ : MeasurableSpace α
inst✝⁵ : MeasurableSpace α'
inst✝⁴ : MeasurableSpace β
inst✝³ : MeasurableSpace β'
inst✝² : MeasurableSpace γ
μ✝ μ' : Measure α
ν✝ ν' : Measure β
τ✝ : Measure γ
inst✝¹ : NormedAddCommGroup E
f : α × β → γ
μ : Measure α
ν : Measure β
τ : Measure γ
hf : Measurable f
inst✝ : SFinite ν
h2f : ∀ᵐ (x : α) ∂μ, QuasiMeasurePreserving fun y => f (x, y)
⊢ map f (Measure.prod μ ν) ≪ τ

Next tactic:
refine' AbsolutelyContinuous.mk fun s hs h2s => _
theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
    (hf : Measurable f) [SFinite ν]
    (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
    QuasiMeasurePreserving f (μ.prod ν) τ := by
  refine' ⟨hf, _⟩
  refine' AbsolutelyContinuous.mk fun s hs h2s => _
  

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁶ : MeasurableSpace α
inst✝⁵ : MeasurableSpace α'
inst✝⁴ : MeasurableSpace β
inst✝³ : MeasurableSpace β'
inst✝² : MeasurableSpace γ
μ✝ μ' : Measure α
ν✝ ν' : Measure β
τ✝ : Measure γ
inst✝¹ : NormedAddCommGroup E
f : α × β → γ
μ : Measure α
ν : Measure β
τ : Measure γ
hf : Measurable f
inst✝ : SFinite ν
h2f : ∀ᵐ (x : α) ∂μ, QuasiMeasurePreserving fun y => f (x, y)
s : Set γ
hs : MeasurableSet s
h2s : ↑↑τ s = 0
⊢ ↑↑(map f (Measure.prod μ ν)) s = 0

Next tactic:
rw [map_apply hf hs, prod_apply (hf hs)]
theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
    (hf : Measurable f) [SFinite ν]
    (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
    QuasiMeasurePreserving f (μ.prod ν) τ := by
  refine' ⟨hf, _⟩
  refine' AbsolutelyContinuous.mk fun s hs h2s => _
  rw [map_apply hf hs, prod_apply (hf hs)]; 

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁶ : MeasurableSpace α
inst✝⁵ : MeasurableSpace α'
inst✝⁴ : MeasurableSpace β
inst✝³ : MeasurableSpace β'
inst✝² : MeasurableSpace γ
μ✝ μ' : Measure α
ν✝ ν' : Measure β
τ✝ : Measure γ
inst✝¹ : NormedAddCommGroup E
f : α × β → γ
μ : Measure α
ν : Measure β
τ : Measure γ
hf : Measurable f
inst✝ : SFinite ν
h2f : ∀ᵐ (x : α) ∂μ, QuasiMeasurePreserving fun y => f (x, y)
s : Set γ
hs : MeasurableSet s
h2s : ↑↑τ s = 0
⊢ ∫⁻ (x : α), ↑↑ν (Prod.mk x ⁻¹' (f ⁻¹' s)) ∂μ = 0

Next tactic:
simp_rw [preimage_preimage]
theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
    (hf : Measurable f) [SFinite ν]
    (h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
    QuasiMeasurePreserving f (μ.prod ν) τ := by
  refine' ⟨hf, _⟩
  refine' AbsolutelyContinuous.mk fun s hs h2s => _
  rw [map_apply hf hs, prod_apply (hf hs)]; simp_rw [preimage_preimage]
  

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁶ : MeasurableSpace α
inst✝⁵ : MeasurableSpace α'
inst✝⁴ : MeasurableSpace β
inst✝³ : MeasurableSpace β'
inst✝² : MeasurableSpace γ
μ✝ μ' : Measure α
ν✝ ν' : Measure β
τ✝ : Measure γ
inst✝¹ : NormedAddCommGroup E
f : α × β → γ
μ : Measure α
ν : Measure β
τ : Measure γ
hf : Measurable f
inst✝ : SFinite ν
h2f : ∀ᵐ (x : α) ∂μ, QuasiMeasurePreserving fun y => f (x, y)
s : Set γ
hs : MeasurableSet s
h2s : ↑↑τ s = 0
⊢ ∫⁻ (x : α), ↑↑ν ((fun x_1 => f (x, x_1)) ⁻¹' s) ∂μ = 0

Next tactic:
rw [lintegral_congr_ae (h2f.mono fun x hx => hx.preimage_null h2s), lintegral_zero]
theorem prod_of_left {α β γ} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
    {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ} (hf : Measurable f)
    [SFinite μ] [SFinite ν]
    (h2f : ∀ᵐ y ∂ν, QuasiMeasurePreserving (fun x => f (x, y)) μ τ) :
    QuasiMeasurePreserving f (μ.prod ν) τ := by
  

Proof state:
α✝ : Type u_1
α' : Type u_2
β✝ : Type u_3
β' : Type u_4
γ✝ : Type u_5
E : Type u_6
inst✝¹⁰ : MeasurableSpace α✝
inst✝⁹ : MeasurableSpace α'
inst✝⁸ : MeasurableSpace β✝
inst✝⁷ : MeasurableSpace β'
inst✝⁶ : MeasurableSpace γ✝
μ✝ μ' : Measure α✝
ν✝ ν' : Measure β✝
τ✝ : Measure γ✝
inst✝⁵ : NormedAddCommGroup E
α : Type u_7
β : Type u_8
γ : Type u_9
inst✝⁴ : MeasurableSpace α
inst✝³ : MeasurableSpace β
inst✝² : MeasurableSpace γ
f : α × β → γ
μ : Measure α
ν : Measure β
τ : Measure γ
hf : Measurable f
inst✝¹ : SFinite μ
inst✝ : SFinite ν
h2f : ∀ᵐ (y : β) ∂ν, QuasiMeasurePreserving fun x => f (x, y)
⊢ QuasiMeasurePreserving f

Next tactic:
rw [← prod_swap]
theorem prod_of_left {α β γ} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
    {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ} (hf : Measurable f)
    [SFinite μ] [SFinite ν]
    (h2f : ∀ᵐ y ∂ν, QuasiMeasurePreserving (fun x => f (x, y)) μ τ) :
    QuasiMeasurePreserving f (μ.prod ν) τ := by
  rw [← prod_swap]
  

Proof state:
α✝ : Type u_1
α' : Type u_2
β✝ : Type u_3
β' : Type u_4
γ✝ : Type u_5
E : Type u_6
inst✝¹⁰ : MeasurableSpace α✝
inst✝⁹ : MeasurableSpace α'
inst✝⁸ : MeasurableSpace β✝
inst✝⁷ : MeasurableSpace β'
inst✝⁶ : MeasurableSpace γ✝
μ✝ μ' : Measure α✝
ν✝ ν' : Measure β✝
τ✝ : Measure γ✝
inst✝⁵ : NormedAddCommGroup E
α : Type u_7
β : Type u_8
γ : Type u_9
inst✝⁴ : MeasurableSpace α
inst✝³ : MeasurableSpace β
inst✝² : MeasurableSpace γ
f : α × β → γ
μ : Measure α
ν : Measure β
τ : Measure γ
hf : Measurable f
inst✝¹ : SFinite μ
inst✝ : SFinite ν
h2f : ∀ᵐ (y : β) ∂ν, QuasiMeasurePreserving fun x => f (x, y)
⊢ QuasiMeasurePreserving f

Next tactic:
convert (QuasiMeasurePreserving.prod_of_right (hf.comp measurable_swap) h2f).comp
      ((measurable_swap.measurePreserving (ν.prod μ)).symm
          MeasurableEquiv.prodComm).quasiMeasurePreserving
theorem AEMeasurable.prod_swap [SFinite μ] [SFinite ν] {f : β × α → γ}
    (hf : AEMeasurable f (ν.prod μ)) : AEMeasurable (fun z : α × β => f z.swap) (μ.prod ν) := by
  

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁷ : MeasurableSpace α
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : MeasurableSpace β
inst✝⁴ : MeasurableSpace β'
inst✝³ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝² : NormedAddCommGroup E
inst✝¹ : SFinite μ
inst✝ : SFinite ν
f : β × α → γ
hf : AEMeasurable f
⊢ AEMeasurable fun z => f (Prod.swap z)

Next tactic:
rw [← Measure.prod_swap] at hf
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
  

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁷ : MeasurableSpace α
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : MeasurableSpace β
inst✝⁴ : MeasurableSpace β'
inst✝³ : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝² : NormedAddCommGroup E
inst✝¹ : SFinite μ
inst✝ : SFinite ν
f : β × α → γ
hf : AEMeasurable f
⊢ AEMeasurable fun z => f (Prod.swap z)

Next tactic:
exact hf.comp_measurable measurable_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∞), Measurable f → ∫⁻ z, f z ∂μ.prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by
  

Proof state:
α : Type u_1
α' : Type u_2
β : Type u_3
β' : Type u_4
γ : Type u_5
E : Type u_6
inst✝⁶ : MeasurableSpace α
inst✝⁵ : MeasurableSpace α'
inst✝⁴ : MeasurableSpace β
inst✝³ : MeasurableSpace β'
inst✝² : MeasurableSpace γ
μ μ' : Measure α
ν ν' : Measure β
τ : Measure γ
inst✝¹ : NormedAddCommGroup E
inst✝ : SFinite ν
⊢ ∀ (f : α × β → ℝ≥0∞), Measurable f → ∫⁻ (z : α × β), f z ∂Measure.prod μ ν = ∫⁻ (x : α), ∫⁻ (y : β), f (x, y) ∂ν ∂μ

Next tactic:
have m := @measurable_prod_mk_left