l3lab/ntp-mathlib huggingface dataset:
theorem integral_withDensity_eq_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  by_cases hE : CompleteSpace E; swap; · simp [integral, hE]
  by_cases hg : Integrable g (μ.withDensity fun x => f x); swap
  · rw [integral_undef hg, integral_undef]
    rwa [← integrable_withDensity_iff_integrable_smul f_meas]
  refine' Integrable.induction
    (P := fun g => ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ) _ _ _ _ hg
  · intro c s s_meas hs
    rw [integral_indicator s_meas]
    simp_rw [← indicator_smul_apply, integral_indicator s_meas]
    simp only [s_meas, integral_const, Measure.restrict_apply', univ_inter, withDensity_apply]
    rw [lintegral_coe_eq_integral, ENNReal.toReal_ofReal, ← integral_smul_const]
    · rfl
    · exact integral_nonneg fun x => NNReal.coe_nonneg _
    · refine' ⟨f_meas.coe_nnreal_real.aemeasurable.aestronglyMeasurable, _⟩
      rw [withDensity_apply _ s_meas] at hs
      rw [HasFiniteIntegral]
      convert hs with x
      simp only [NNReal.nnnorm_eq]
  · intro u u' _ u_int u'_int h h'
    change
      (∫ a : α, u a + u' a ∂μ.withDensity fun x : α => ↑(f x)) = ∫ a : α, f a • (u a + u' a) ∂μ
    simp_rw [smul_add]
    rw [integral_add u_int u'_int, h, h', integral_add]
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u_int
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u'_int
  · have C1 :
      Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) =>
        ∫ x, u x ∂μ.withDensity fun x => f x :=
      continuous_integral
    have C2 : Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) => ∫ x, f x • u x ∂μ := by
      have : Continuous ((fun u : Lp E 1 μ => ∫ x, u x ∂μ) ∘ withDensitySMulLI (E := E) μ f_meas) :=
        continuous_integral.comp (withDensitySMulLI (E := E) μ f_meas).continuous
      convert this with u
      simp only [Function.comp_apply, withDensitySMulLI_apply]
      exact integral_congr_ae (memℒ1_smul_of_L1_withDensity f_meas u).coeFn_toLp.symm
    exact isClosed_eq C1 C2
  · intro u v huv _ hu
    rw [← integral_congr_ae huv, hu]
    apply integral_congr_ae
    

Proof state:
case pos.refine'_4.h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
f_meas : Measurable f
g : α → E
hE : CompleteSpace E
hg : Integrable g
u v : α → E
huv : u =ᵐ[Measure.withDensity μ fun x => ↑(f x)] v
a✝ : Integrable u
hu : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
⊢ (fun a => f a • u a) =ᵐ[μ] fun a => f a • v a

Next tactic:
filter_upwards [(ae_withDensity_iff f_meas.coe_nnreal_ennreal).1 huv] with x hx
theorem integral_withDensity_eq_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  by_cases hE : CompleteSpace E; swap; · simp [integral, hE]
  by_cases hg : Integrable g (μ.withDensity fun x => f x); swap
  · rw [integral_undef hg, integral_undef]
    rwa [← integrable_withDensity_iff_integrable_smul f_meas]
  refine' Integrable.induction
    (P := fun g => ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ) _ _ _ _ hg
  · intro c s s_meas hs
    rw [integral_indicator s_meas]
    simp_rw [← indicator_smul_apply, integral_indicator s_meas]
    simp only [s_meas, integral_const, Measure.restrict_apply', univ_inter, withDensity_apply]
    rw [lintegral_coe_eq_integral, ENNReal.toReal_ofReal, ← integral_smul_const]
    · rfl
    · exact integral_nonneg fun x => NNReal.coe_nonneg _
    · refine' ⟨f_meas.coe_nnreal_real.aemeasurable.aestronglyMeasurable, _⟩
      rw [withDensity_apply _ s_meas] at hs
      rw [HasFiniteIntegral]
      convert hs with x
      simp only [NNReal.nnnorm_eq]
  · intro u u' _ u_int u'_int h h'
    change
      (∫ a : α, u a + u' a ∂μ.withDensity fun x : α => ↑(f x)) = ∫ a : α, f a • (u a + u' a) ∂μ
    simp_rw [smul_add]
    rw [integral_add u_int u'_int, h, h', integral_add]
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u_int
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u'_int
  · have C1 :
      Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) =>
        ∫ x, u x ∂μ.withDensity fun x => f x :=
      continuous_integral
    have C2 : Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) => ∫ x, f x • u x ∂μ := by
      have : Continuous ((fun u : Lp E 1 μ => ∫ x, u x ∂μ) ∘ withDensitySMulLI (E := E) μ f_meas) :=
        continuous_integral.comp (withDensitySMulLI (E := E) μ f_meas).continuous
      convert this with u
      simp only [Function.comp_apply, withDensitySMulLI_apply]
      exact integral_congr_ae (memℒ1_smul_of_L1_withDensity f_meas u).coeFn_toLp.symm
    exact isClosed_eq C1 C2
  · intro u v huv _ hu
    rw [← integral_congr_ae huv, hu]
    apply integral_congr_ae
    filter_upwards [(ae_withDensity_iff f_meas.coe_nnreal_ennreal).1 huv] with x hx
    

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
f_meas : Measurable f
g : α → E
hE : CompleteSpace E
hg : Integrable g
u v : α → E
huv : u =ᵐ[Measure.withDensity μ fun x => ↑(f x)] v
a✝ : Integrable u
hu : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
x : α
hx : ↑(f x) ≠ 0 → u x = v x
⊢ f x • u x = f x • v x

Next tactic:
rcases eq_or_ne (f x) 0 with (h'x | h'x)
theorem integral_withDensity_eq_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  by_cases hE : CompleteSpace E; swap; · simp [integral, hE]
  by_cases hg : Integrable g (μ.withDensity fun x => f x); swap
  · rw [integral_undef hg, integral_undef]
    rwa [← integrable_withDensity_iff_integrable_smul f_meas]
  refine' Integrable.induction
    (P := fun g => ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ) _ _ _ _ hg
  · intro c s s_meas hs
    rw [integral_indicator s_meas]
    simp_rw [← indicator_smul_apply, integral_indicator s_meas]
    simp only [s_meas, integral_const, Measure.restrict_apply', univ_inter, withDensity_apply]
    rw [lintegral_coe_eq_integral, ENNReal.toReal_ofReal, ← integral_smul_const]
    · rfl
    · exact integral_nonneg fun x => NNReal.coe_nonneg _
    · refine' ⟨f_meas.coe_nnreal_real.aemeasurable.aestronglyMeasurable, _⟩
      rw [withDensity_apply _ s_meas] at hs
      rw [HasFiniteIntegral]
      convert hs with x
      simp only [NNReal.nnnorm_eq]
  · intro u u' _ u_int u'_int h h'
    change
      (∫ a : α, u a + u' a ∂μ.withDensity fun x : α => ↑(f x)) = ∫ a : α, f a • (u a + u' a) ∂μ
    simp_rw [smul_add]
    rw [integral_add u_int u'_int, h, h', integral_add]
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u_int
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u'_int
  · have C1 :
      Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) =>
        ∫ x, u x ∂μ.withDensity fun x => f x :=
      continuous_integral
    have C2 : Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) => ∫ x, f x • u x ∂μ := by
      have : Continuous ((fun u : Lp E 1 μ => ∫ x, u x ∂μ) ∘ withDensitySMulLI (E := E) μ f_meas) :=
        continuous_integral.comp (withDensitySMulLI (E := E) μ f_meas).continuous
      convert this with u
      simp only [Function.comp_apply, withDensitySMulLI_apply]
      exact integral_congr_ae (memℒ1_smul_of_L1_withDensity f_meas u).coeFn_toLp.symm
    exact isClosed_eq C1 C2
  · intro u v huv _ hu
    rw [← integral_congr_ae huv, hu]
    apply integral_congr_ae
    filter_upwards [(ae_withDensity_iff f_meas.coe_nnreal_ennreal).1 huv] with x hx
    rcases eq_or_ne (f x) 0 with (h'x | h'x)
    · 

Proof state:
case h.inl
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
f_meas : Measurable f
g : α → E
hE : CompleteSpace E
hg : Integrable g
u v : α → E
huv : u =ᵐ[Measure.withDensity μ fun x => ↑(f x)] v
a✝ : Integrable u
hu : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
x : α
hx : ↑(f x) ≠ 0 → u x = v x
h'x : f x = 0
⊢ f x • u x = f x • v x

Next tactic:
simp only [h'x, zero_smul]
theorem integral_withDensity_eq_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  by_cases hE : CompleteSpace E; swap; · simp [integral, hE]
  by_cases hg : Integrable g (μ.withDensity fun x => f x); swap
  · rw [integral_undef hg, integral_undef]
    rwa [← integrable_withDensity_iff_integrable_smul f_meas]
  refine' Integrable.induction
    (P := fun g => ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ) _ _ _ _ hg
  · intro c s s_meas hs
    rw [integral_indicator s_meas]
    simp_rw [← indicator_smul_apply, integral_indicator s_meas]
    simp only [s_meas, integral_const, Measure.restrict_apply', univ_inter, withDensity_apply]
    rw [lintegral_coe_eq_integral, ENNReal.toReal_ofReal, ← integral_smul_const]
    · rfl
    · exact integral_nonneg fun x => NNReal.coe_nonneg _
    · refine' ⟨f_meas.coe_nnreal_real.aemeasurable.aestronglyMeasurable, _⟩
      rw [withDensity_apply _ s_meas] at hs
      rw [HasFiniteIntegral]
      convert hs with x
      simp only [NNReal.nnnorm_eq]
  · intro u u' _ u_int u'_int h h'
    change
      (∫ a : α, u a + u' a ∂μ.withDensity fun x : α => ↑(f x)) = ∫ a : α, f a • (u a + u' a) ∂μ
    simp_rw [smul_add]
    rw [integral_add u_int u'_int, h, h', integral_add]
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u_int
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u'_int
  · have C1 :
      Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) =>
        ∫ x, u x ∂μ.withDensity fun x => f x :=
      continuous_integral
    have C2 : Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) => ∫ x, f x • u x ∂μ := by
      have : Continuous ((fun u : Lp E 1 μ => ∫ x, u x ∂μ) ∘ withDensitySMulLI (E := E) μ f_meas) :=
        continuous_integral.comp (withDensitySMulLI (E := E) μ f_meas).continuous
      convert this with u
      simp only [Function.comp_apply, withDensitySMulLI_apply]
      exact integral_congr_ae (memℒ1_smul_of_L1_withDensity f_meas u).coeFn_toLp.symm
    exact isClosed_eq C1 C2
  · intro u v huv _ hu
    rw [← integral_congr_ae huv, hu]
    apply integral_congr_ae
    filter_upwards [(ae_withDensity_iff f_meas.coe_nnreal_ennreal).1 huv] with x hx
    rcases eq_or_ne (f x) 0 with (h'x | h'x)
    · simp only [h'x, zero_smul]
    · 

Proof state:
case h.inr
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
f_meas : Measurable f
g : α → E
hE : CompleteSpace E
hg : Integrable g
u v : α → E
huv : u =ᵐ[Measure.withDensity μ fun x => ↑(f x)] v
a✝ : Integrable u
hu : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
x : α
hx : ↑(f x) ≠ 0 → u x = v x
h'x : f x ≠ 0
⊢ f x • u x = f x • v x

Next tactic:
rw [hx _]
theorem integral_withDensity_eq_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  by_cases hE : CompleteSpace E; swap; · simp [integral, hE]
  by_cases hg : Integrable g (μ.withDensity fun x => f x); swap
  · rw [integral_undef hg, integral_undef]
    rwa [← integrable_withDensity_iff_integrable_smul f_meas]
  refine' Integrable.induction
    (P := fun g => ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ) _ _ _ _ hg
  · intro c s s_meas hs
    rw [integral_indicator s_meas]
    simp_rw [← indicator_smul_apply, integral_indicator s_meas]
    simp only [s_meas, integral_const, Measure.restrict_apply', univ_inter, withDensity_apply]
    rw [lintegral_coe_eq_integral, ENNReal.toReal_ofReal, ← integral_smul_const]
    · rfl
    · exact integral_nonneg fun x => NNReal.coe_nonneg _
    · refine' ⟨f_meas.coe_nnreal_real.aemeasurable.aestronglyMeasurable, _⟩
      rw [withDensity_apply _ s_meas] at hs
      rw [HasFiniteIntegral]
      convert hs with x
      simp only [NNReal.nnnorm_eq]
  · intro u u' _ u_int u'_int h h'
    change
      (∫ a : α, u a + u' a ∂μ.withDensity fun x : α => ↑(f x)) = ∫ a : α, f a • (u a + u' a) ∂μ
    simp_rw [smul_add]
    rw [integral_add u_int u'_int, h, h', integral_add]
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u_int
    · exact (integrable_withDensity_iff_integrable_smul f_meas).1 u'_int
  · have C1 :
      Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) =>
        ∫ x, u x ∂μ.withDensity fun x => f x :=
      continuous_integral
    have C2 : Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) => ∫ x, f x • u x ∂μ := by
      have : Continuous ((fun u : Lp E 1 μ => ∫ x, u x ∂μ) ∘ withDensitySMulLI (E := E) μ f_meas) :=
        continuous_integral.comp (withDensitySMulLI (E := E) μ f_meas).continuous
      convert this with u
      simp only [Function.comp_apply, withDensitySMulLI_apply]
      exact integral_congr_ae (memℒ1_smul_of_L1_withDensity f_meas u).coeFn_toLp.symm
    exact isClosed_eq C1 C2
  · intro u v huv _ hu
    rw [← integral_congr_ae huv, hu]
    apply integral_congr_ae
    filter_upwards [(ae_withDensity_iff f_meas.coe_nnreal_ennreal).1 huv] with x hx
    rcases eq_or_ne (f x) 0 with (h'x | h'x)
    · simp only [h'x, zero_smul]
    · rw [hx _]
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
f_meas : Measurable f
g : α → E
hE : CompleteSpace E
hg : Integrable g
u v : α → E
huv : u =ᵐ[Measure.withDensity μ fun x => ↑(f x)] v
a✝ : Integrable u
hu : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
x : α
hx : ↑(f x) ≠ 0 → u x = v x
h'x : f x ≠ 0
⊢ ↑(f x) ≠ 0

Next tactic:
simpa only [Ne.def, ENNReal.coe_eq_zero] using h'x
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
⊢ (∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • g a ∂μ

Next tactic:
let f' := hf.mk _
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
⊢ (∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • g a ∂μ

Next tactic:
calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      congr 1
      apply withDensity_congr_ae
      filter_upwards [hf.ae_eq_mk] with x hx
      rw [hx]
    _ = ∫ a, f' a • g a ∂μ := (integral_withDensity_eq_integral_smul hf.measurable_mk _)
    _ = ∫ a, f a • g a ∂μ := by
      apply integral_congr_ae
      filter_upwards [hf.ae_eq_mk] with x hx
      rw [hx]
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
⊢ (∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f' x)

Next tactic:
congr 1
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      congr 1
      

Proof state:
case e_μ
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
⊢ (Measure.withDensity μ fun x => ↑(f x)) = Measure.withDensity μ fun x => ↑(f' x)

Next tactic:
apply withDensity_congr_ae
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      congr 1
      apply withDensity_congr_ae
      

Proof state:
case e_μ.h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
⊢ (fun x => ↑(f x)) =ᵐ[μ] fun x => ↑(f' x)

Next tactic:
filter_upwards [hf.ae_eq_mk] with x hx
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      congr 1
      apply withDensity_congr_ae
      filter_upwards [hf.ae_eq_mk] with x hx
      

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
x : α
hx : f x = AEMeasurable.mk f hf x
⊢ ↑(f x) = ↑(f' x)

Next tactic:
rw [hx]
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      congr 1
      apply withDensity_congr_ae
      filter_upwards [hf.ae_eq_mk] with x hx
      rw [hx]
    _ = ∫ a, f' a • g a ∂μ := (integral_withDensity_eq_integral_smul hf.measurable_mk _)
    _ = ∫ a, f a • g a ∂μ := by
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
⊢ ∫ (a : α), f' a • g a ∂μ = ∫ (a : α), f a • g a ∂μ

Next tactic:
apply integral_congr_ae
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      congr 1
      apply withDensity_congr_ae
      filter_upwards [hf.ae_eq_mk] with x hx
      rw [hx]
    _ = ∫ a, f' a • g a ∂μ := (integral_withDensity_eq_integral_smul hf.measurable_mk _)
    _ = ∫ a, f a • g a ∂μ := by
      apply integral_congr_ae
      

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
⊢ (fun a => f' a • g a) =ᵐ[μ] fun a => f a • g a

Next tactic:
filter_upwards [hf.ae_eq_mk] with x hx
theorem integral_withDensity_eq_integral_smul₀ {f : α → ℝ≥0} (hf : AEMeasurable f μ) (g : α → E) :
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, f a • g a ∂μ := by
  let f' := hf.mk _
  calc
    ∫ a, g a ∂μ.withDensity (fun x => f x) = ∫ a, g a ∂μ.withDensity fun x => f' x := by
      congr 1
      apply withDensity_congr_ae
      filter_upwards [hf.ae_eq_mk] with x hx
      rw [hx]
    _ = ∫ a, f' a • g a ∂μ := (integral_withDensity_eq_integral_smul hf.measurable_mk _)
    _ = ∫ a, f a • g a ∂μ := by
      apply integral_congr_ae
      filter_upwards [hf.ae_eq_mk] with x hx
      

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
hf : AEMeasurable f
g : α → E
f' : α → ℝ≥0 := AEMeasurable.mk f hf
x : α
hx : f x = AEMeasurable.mk f hf x
⊢ f' x • g x = f x • g x

Next tactic:
rw [hx]
theorem set_integral_withDensity_eq_set_integral_smul {f : α → ℝ≥0} (f_meas : Measurable f)
    (g : α → E) {s : Set α} (hs : MeasurableSet s) :
    ∫ a in s, g a ∂μ.withDensity (fun x => f x) = ∫ a in s, f a • g a ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁷ : MeasurableSpace α
ι : Type u_5
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝¹ : NormedSpace ℝ E
inst✝ : NormedSpace ℝ F
f : α → ℝ≥0
f_meas : Measurable f
g : α → E
s : Set α
hs : MeasurableSet s
⊢ (∫ (a : α) in s, g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α) in s, f a • g a ∂μ

Next tactic:
rw [restrict_withDensity hs, integral_withDensity_eq_integral_smul f_meas]