l3lab/ntp-mathlib huggingface dataset:
/-- 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)
    (hD : IsCountablySpanning D) :
    @Prod.instMeasurableSpace _ _ (generateFrom C) (generateFrom D) =
      generateFrom (image2 (· ×ˢ ·) C D) := by
  apply le_antisymm
  · refine' sup_le _ _ <;> rw [comap_generateFrom] <;> apply generateFrom_le <;>
      rintro _ ⟨s, hs, rfl⟩
    · rcases hD with ⟨t, h1t, h2t⟩
      rw [← prod_univ, ← h2t, prod_iUnion]
      apply MeasurableSet.iUnion
      intro n
      apply measurableSet_generateFrom
      exact ⟨s, t n, hs, h1t n, rfl⟩
    · rcases hC with ⟨t, h1t, h2t⟩
      rw [← univ_prod, ← h2t, iUnion_prod_const]
      apply MeasurableSet.iUnion
      rintro n
      apply measurableSet_generateFrom
      exact mem_image2_of_mem (h1t n) hs
  · apply generateFrom_le
    rintro _ ⟨s, t, hs, ht, rfl⟩
    dsimp only
    rw [prod_eq]
    apply (measurable_fst _).inter (measurable_snd _)
    · 

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
C : Set (Set α)
D : Set (Set β)
hC : IsCountablySpanning C
hD : IsCountablySpanning D
s : Set α
t : Set β
hs : s ∈ C
ht : t ∈ D
⊢ MeasurableSet s

Next tactic:
exact measurableSet_generateFrom hs
/-- 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)
    (hD : IsCountablySpanning D) :
    @Prod.instMeasurableSpace _ _ (generateFrom C) (generateFrom D) =
      generateFrom (image2 (· ×ˢ ·) C D) := by
  apply le_antisymm
  · refine' sup_le _ _ <;> rw [comap_generateFrom] <;> apply generateFrom_le <;>
      rintro _ ⟨s, hs, rfl⟩
    · rcases hD with ⟨t, h1t, h2t⟩
      rw [← prod_univ, ← h2t, prod_iUnion]
      apply MeasurableSet.iUnion
      intro n
      apply measurableSet_generateFrom
      exact ⟨s, t n, hs, h1t n, rfl⟩
    · rcases hC with ⟨t, h1t, h2t⟩
      rw [← univ_prod, ← h2t, iUnion_prod_const]
      apply MeasurableSet.iUnion
      rintro n
      apply measurableSet_generateFrom
      exact mem_image2_of_mem (h1t n) hs
  · apply generateFrom_le
    rintro _ ⟨s, t, hs, ht, rfl⟩
    dsimp only
    rw [prod_eq]
    apply (measurable_fst _).inter (measurable_snd _)
    · exact measurableSet_generateFrom 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
α : Type u_7
β : Type u_8
C : Set (Set α)
D : Set (Set β)
hC : IsCountablySpanning C
hD : IsCountablySpanning D
s : Set α
t : Set β
hs : s ∈ C
ht : t ∈ D
⊢ MeasurableSet t

Next tactic:
exact measurableSet_generateFrom ht
/-- 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 = ‹_›)
    (hD : generateFrom D = ‹_›) (h2C : IsCountablySpanning C) (h2D : IsCountablySpanning D) :
    generateFrom (image2 (· ×ˢ ·) C D) = Prod.instMeasurableSpace := 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
C : Set (Set α)
D : Set (Set β)
hC : generateFrom C = inst✝⁵
hD : generateFrom D = inst✝³
h2C : IsCountablySpanning C
h2D : IsCountablySpanning D
⊢ generateFrom (image2 (fun x x_1 => x ×ˢ x_1) C D) = Prod.instMeasurableSpace

Next tactic:
rw [← hC, ← hD, generateFrom_prod_eq h2C h2D]
/-- 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 [IsFiniteMeasure ν] {s : Set (α × β)}
    (hs : MeasurableSet s) : Measurable fun x => ν (Prod.mk x ⁻¹' s) := 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
⊢ Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)

Next tactic:
refine' induction_on_inter (C := fun s => Measurable fun x => ν (Prod.mk x ⁻¹' s))
    generateFrom_prod.symm isPiSystem_prod _ _ _ _ hs
/-- 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 [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
  · 

Proof state:
case refine'_1
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
⊢ (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) ∅

Next tactic:
simp [measurable_zero, const_def]
/-- 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 [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
  · simp [measurable_zero, const_def]
  · 

Proof state:
case refine'_2
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
⊢ ∀ t ∈ image2 (fun x x_1 => x ×ˢ x_1) {s | MeasurableSet s} {t | MeasurableSet t},
    (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) t

Next tactic:
rintro _ ⟨s, t, hs, _, rfl⟩
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, rfl⟩
    

Proof state:
case refine'_2.intro.intro.intro.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
inst✝ : IsFiniteMeasure ν
s✝ : Set (α × β)
hs✝ : MeasurableSet s✝
s : Set α
t : Set β
hs : s ∈ {s | MeasurableSet s}
left✝ : t ∈ {t | MeasurableSet t}
⊢ Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' (fun x x_1 => x ×ˢ x_1) s t)

Next tactic:
simp only [mk_preimage_prod_right_eq_if, measure_if]
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, rfl⟩
    simp only [mk_preimage_prod_right_eq_if, measure_if]
    

Proof state:
case refine'_2.intro.intro.intro.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
inst✝ : IsFiniteMeasure ν
s✝ : Set (α × β)
hs✝ : MeasurableSet s✝
s : Set α
t : Set β
hs : s ∈ {s | MeasurableSet s}
left✝ : t ∈ {t | MeasurableSet t}
⊢ Measurable fun x => indicator s (fun x => ↑↑ν t) x

Next tactic:
exact measurable_const.indicator hs
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, rfl⟩
    simp only [mk_preimage_prod_right_eq_if, measure_if]
    exact measurable_const.indicator hs
  · 

Proof state:
case refine'_3
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
⊢ ∀ (t : Set (α × β)),
    MeasurableSet t →
      (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) t → (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) tᶜ

Next tactic:
intro t ht h2t
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, rfl⟩
    simp only [mk_preimage_prod_right_eq_if, measure_if]
    exact measurable_const.indicator hs
  · intro t ht h2t
    

Proof state:
case refine'_3
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
t : Set (α × β)
ht : MeasurableSet t
h2t : Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' t)
⊢ Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' tᶜ)

Next tactic:
simp_rw [preimage_compl, measure_compl (measurable_prod_mk_left ht) (measure_ne_top ν _)]
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, 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 ν _)]
    

Proof state:
case refine'_3
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
t : Set (α × β)
ht : MeasurableSet t
h2t : Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' t)
⊢ Measurable fun x => ↑↑ν univ - ↑↑ν (Prod.mk x ⁻¹' t)

Next tactic:
exact h2t.const_sub _
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, 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 _
  · 

Proof state:
case refine'_4
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
⊢ ∀ (f : ℕ → Set (α × β)),
    Pairwise (Disjoint on f) →
      (∀ (i : ℕ), MeasurableSet (f i)) →
        (∀ (i : ℕ), (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) (f i)) →
          (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) (⋃ i, f i)

Next tactic:
intro f h1f h2f h3f
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, 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
    

Proof state:
case refine'_4
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
f : ℕ → Set (α × β)
h1f : Pairwise (Disjoint on f)
h2f : ∀ (i : ℕ), MeasurableSet (f i)
h3f : ∀ (i : ℕ), (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) (f i)
⊢ Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' ⋃ i, f i)

Next tactic:
simp_rw [preimage_iUnion]
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, 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_iUnion]
    

Proof state:
case refine'_4
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
f : ℕ → Set (α × β)
h1f : Pairwise (Disjoint on f)
h2f : ∀ (i : ℕ), MeasurableSet (f i)
h3f : ∀ (i : ℕ), (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) (f i)
⊢ Measurable fun x => ↑↑ν (⋃ i, Prod.mk x ⁻¹' f i)

Next tactic:
have : ∀ b, ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' i, ν (Prod.mk b ⁻¹' f i) := fun b =>
      measure_iUnion (fun i j hij => Disjoint.preimage _ (h1f hij)) fun i =>
        measurable_prod_mk_left (h2f i)
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, 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_iUnion]
    have : ∀ b, ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' i, ν (Prod.mk b ⁻¹' f i) := fun b =>
      measure_iUnion (fun i j hij => Disjoint.preimage _ (h1f hij)) fun i =>
        measurable_prod_mk_left (h2f i)
    

Proof state:
case refine'_4
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
f : ℕ → Set (α × β)
h1f : Pairwise (Disjoint on f)
h2f : ∀ (i : ℕ), MeasurableSet (f i)
h3f : ∀ (i : ℕ), (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) (f i)
this : ∀ (b : α), ↑↑ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' (i : ℕ), ↑↑ν (Prod.mk b ⁻¹' f i)
⊢ Measurable fun x => ↑↑ν (⋃ i, Prod.mk x ⁻¹' f i)

Next tactic:
simp_rw [this]
/-- 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 [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
  · simp [measurable_zero, const_def]
  · rintro _ ⟨s, t, hs, _, 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_iUnion]
    have : ∀ b, ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' i, ν (Prod.mk b ⁻¹' f i) := fun b =>
      measure_iUnion (fun i j hij => Disjoint.preimage _ (h1f hij)) fun i =>
        measurable_prod_mk_left (h2f i)
    simp_rw [this]
    

Proof state:
case refine'_4
α : 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✝ : IsFiniteMeasure ν
s : Set (α × β)
hs : MeasurableSet s
f : ℕ → Set (α × β)
h1f : Pairwise (Disjoint on f)
h2f : ∀ (i : ℕ), MeasurableSet (f i)
h3f : ∀ (i : ℕ), (fun s => Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)) (f i)
this : ∀ (b : α), ↑↑ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' (i : ℕ), ↑↑ν (Prod.mk b ⁻¹' f i)
⊢ Measurable fun x => ∑' (i : ℕ), ↑↑ν (Prod.mk x ⁻¹' f i)

Next tactic:
apply Measurable.ennreal_tsum h3f
/-- 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
  

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 ν
s : Set (α × β)
hs : MeasurableSet s
⊢ Measurable fun x => ↑↑ν (Prod.mk x ⁻¹' s)

Next tactic:
rw [← sum_sFiniteSeq ν]
/-- 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
  rw [← sum_sFiniteSeq ν]
  

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 ν
s : Set (α × β)
hs : MeasurableSet s
⊢ Measurable fun x => ↑↑(sum (sFiniteSeq ν)) (Prod.mk x ⁻¹' s)

Next tactic:
simp_rw [Measure.sum_apply_of_countable]
/-- 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
  rw [← sum_sFiniteSeq ν]
  simp_rw [Measure.sum_apply_of_countable]
  

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 ν
s : Set (α × β)
hs : MeasurableSet s
⊢ Measurable fun x => ∑' (i : ℕ), ↑↑(sFiniteSeq ν i) (Prod.mk x ⁻¹' s)

Next tactic:
exact Measurable.ennreal_tsum (fun i ↦ measurable_measure_prod_mk_left_finite hs)