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 _
    · 

Proof state:
case pos.refine'_1.hfi
α : 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
c : E
s : Set α
s_meas : MeasurableSet s
hs : ↑↑(Measure.withDensity μ fun x => ↑(f x)) s < ⊤
⊢ Integrable fun x => ↑(f x)

Next tactic:
refine' ⟨f_meas.coe_nnreal_real.aemeasurable.aestronglyMeasurable, _⟩
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, _⟩
      

Proof state:
case pos.refine'_1.hfi
α : 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
c : E
s : Set α
s_meas : MeasurableSet s
hs : ↑↑(Measure.withDensity μ fun x => ↑(f x)) s < ⊤
⊢ HasFiniteIntegral fun x => ↑(f x)

Next tactic:
rw [withDensity_apply _ s_meas] at hs
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
      

Proof state:
case pos.refine'_1.hfi
α : 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
c : E
s : Set α
s_meas : MeasurableSet s
hs : ∫⁻ (a : α) in s, ↑(f a) ∂μ < ⊤
⊢ HasFiniteIntegral fun x => ↑(f x)

Next tactic:
rw [HasFiniteIntegral]
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]
      

Proof state:
case pos.refine'_1.hfi
α : 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
c : E
s : Set α
s_meas : MeasurableSet s
hs : ∫⁻ (a : α) in s, ↑(f a) ∂μ < ⊤
⊢ ∫⁻ (a : α) in s, ↑‖↑(f a)‖₊ ∂μ < ⊤

Next tactic:
convert hs with 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
      

Proof state:
case h.e'_3.h.e'_4.h.h.e'_1
α : 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
c : E
s : Set α
s_meas : MeasurableSet s
hs : ∫⁻ (a : α) in s, ↑(f a) ∂μ < ⊤
x : α
⊢ ‖↑(f x)‖₊ = f x

Next tactic:
simp only [NNReal.nnnorm_eq]
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]
  · 

Proof state:
case pos.refine'_2
α : 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
⊢ ∀ ⦃f_1 g : α → E⦄,
    Disjoint (support f_1) (support g) →
      Integrable f_1 →
        Integrable g →
          (fun g => (∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • g a ∂μ) f_1 →
            (fun g => (∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • g a ∂μ) g →
              (fun g => (∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • g a ∂μ) (f_1 + g)

Next tactic:
intro u u' _ u_int u'_int h h'
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'
    

Proof state:
case pos.refine'_2
α : 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 u' : α → E
a✝ : Disjoint (support u) (support u')
u_int : Integrable u
u'_int : Integrable u'
h : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
h' : (∫ (a : α), u' a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u' a ∂μ
⊢ (∫ (a : α), (u + u') a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • (u + u') a ∂μ

Next tactic:
change
      (∫ a : α, u a + u' a ∂μ.withDensity fun x : α => ↑(f x)) = ∫ a : α, f a • (u a + u' a) ∂μ
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) ∂μ
    

Proof state:
case pos.refine'_2
α : 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 u' : α → E
a✝ : Disjoint (support u) (support u')
u_int : Integrable u
u'_int : Integrable u'
h : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
h' : (∫ (a : α), u' a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u' a ∂μ
⊢ (∫ (a : α), u a + u' a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • (u a + u' a) ∂μ

Next tactic:
simp_rw [smul_add]
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]
    

Proof state:
case pos.refine'_2
α : 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 u' : α → E
a✝ : Disjoint (support u) (support u')
u_int : Integrable u
u'_int : Integrable u'
h : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
h' : (∫ (a : α), u' a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u' a ∂μ
⊢ (∫ (a : α), u a + u' a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a + f a • u' a ∂μ

Next tactic:
rw [integral_add u_int u'_int, h, h', integral_add]
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]
    · 

Proof state:
case pos.refine'_2.hf
α : 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 u' : α → E
a✝ : Disjoint (support u) (support u')
u_int : Integrable u
u'_int : Integrable u'
h : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
h' : (∫ (a : α), u' a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u' a ∂μ
⊢ Integrable fun a => f a • u a

Next tactic:
exact (integrable_withDensity_iff_integrable_smul f_meas).1 u_int
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
    · 

Proof state:
case pos.refine'_2.hg
α : 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 u' : α → E
a✝ : Disjoint (support u) (support u')
u_int : Integrable u
u'_int : Integrable u'
h : (∫ (a : α), u a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u a ∂μ
h' : (∫ (a : α), u' a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • u' a ∂μ
⊢ Integrable fun a => f a • u' a

Next tactic:
exact (integrable_withDensity_iff_integrable_smul f_meas).1 u'_int
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
  · 

Proof state:
case pos.refine'_3
α : 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
⊢ IsClosed {f_1 | (fun g => (∫ (a : α), g a ∂Measure.withDensity μ fun x => ↑(f x)) = ∫ (a : α), f a • g a ∂μ) ↑↑f_1}

Next tactic:
have C1 :
      Continuous fun u : Lp E 1 (μ.withDensity fun x => f x) =>
        ∫ x, u x ∂μ.withDensity fun x => f x :=
      continuous_integral