l3lab/ntp-mathlib huggingface dataset:
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
⊢ IntegrableOn (fun x => R) {x | R < f x}

Next tactic:
refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
⊢ ∫⁻ (a : α) in {x | R < f x}, ↑‖(fun x => R) a‖₊ ∂μ ≤ ∫⁻ (a : α) in {x | R < f x}, ↑‖f a‖₊ ∂μ

Next tactic:
refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
⊢ Measurable fun a => (fun x => R) a

Next tactic:
exact measurable_const
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
x : α
hx : x ∈ {x | R < f x}
⊢ ↑‖(fun x => R) x‖₊ ≤ ↑‖f x‖₊

Next tactic:
simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
x : α
hx : x ∈ {x | R < f x}
⊢ { val := R, property := hR } ≤ { val := f x, property := (_ : 0 ≤ f x) }

Next tactic:
exact le_of_lt hx
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ ENNReal.toReal (↑↑μ {x | R < f x}) * R < ∫ (x : α) in {x | R < f x}, f x ∂μ

Next tactic:
rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ 0 < ↑↑μ ((support fun a => f a - R) ∩ {x | R < f x})

Next tactic:
rw [← zero_lt_iff] at hμ
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · rw [← zero_lt_iff] at hμ
    

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : 0 < ↑↑μ {x | R < f x}
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ 0 < ↑↑μ ((support fun a => f a - R) ∩ {x | R < f x})

Next tactic:
rwa [Set.inter_eq_self_of_subset_right]
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · rw [← zero_lt_iff] at hμ
    rwa [Set.inter_eq_self_of_subset_right]
    

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : 0 < ↑↑μ {x | R < f x}
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ {x | R < f x} ⊆ support fun a => f a - R

Next tactic:
exact fun x hx => Ne.symm (ne_of_lt <| sub_pos.2 hx)
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · rw [← zero_lt_iff] at hμ
    rwa [Set.inter_eq_self_of_subset_right]
    exact fun x hx => Ne.symm (ne_of_lt <| sub_pos.2 hx)
  · 

Proof state:
case hf
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ 0 ≤ᵐ[Measure.restrict μ {x | R < f x}] fun a => f a - R

Next tactic:
change ∀ᵐ x ∂μ.restrict _, _
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · rw [← zero_lt_iff] at hμ
    rwa [Set.inter_eq_self_of_subset_right]
    exact fun x hx => Ne.symm (ne_of_lt <| sub_pos.2 hx)
  · change ∀ᵐ x ∂μ.restrict _, _
    

Proof state:
case hf
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ {x | R < f x}, OfNat.ofNat 0 x ≤ (fun a => f a - R) x

Next tactic:
rw [ae_restrict_iff]
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · rw [← zero_lt_iff] at hμ
    rwa [Set.inter_eq_self_of_subset_right]
    exact fun x hx => Ne.symm (ne_of_lt <| sub_pos.2 hx)
  · change ∀ᵐ x ∂μ.restrict _, _
    rw [ae_restrict_iff]
    · 

Proof state:
case hf
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ ∀ᵐ (x : α) ∂μ, x ∈ {x | R < f x} → OfNat.ofNat 0 x ≤ (fun a => f a - R) x

Next tactic:
exact eventually_of_forall fun x hx => sub_nonneg.2 <| le_of_lt hx
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · rw [← zero_lt_iff] at hμ
    rwa [Set.inter_eq_self_of_subset_right]
    exact fun x hx => Ne.symm (ne_of_lt <| sub_pos.2 hx)
  · change ∀ᵐ x ∂μ.restrict _, _
    rw [ae_restrict_iff]
    · exact eventually_of_forall fun x hx => sub_nonneg.2 <| le_of_lt hx
    · 

Proof state:
case hf
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ MeasurableSet {x | OfNat.ofNat 0 x ≤ (fun a => f a - R) x}

Next tactic:
exact measurableSet_le measurable_zero (hfm.sub measurable_const)
theorem set_integral_gt_gt {R : ℝ} {f : α → ℝ} (hR : 0 ≤ R) (hfm : Measurable f)
    (hfint : IntegrableOn f {x | ↑R < f x} μ) (hμ : μ {x | ↑R < f x} ≠ 0) :
    (μ {x | ↑R < f x}).toReal * R < ∫ x in {x | ↑R < f x}, f x ∂μ := by
  have : IntegrableOn (fun _ => R) {x | ↑R < f x} μ := by
    refine' ⟨aestronglyMeasurable_const, lt_of_le_of_lt _ hfint.2⟩
    refine'
      set_lintegral_mono (Measurable.nnnorm _).coe_nnreal_ennreal hfm.nnnorm.coe_nnreal_ennreal
        fun x hx => _
    · exact measurable_const
    · simp only [ENNReal.coe_le_coe, Real.nnnorm_of_nonneg hR,
        Real.nnnorm_of_nonneg (hR.trans <| le_of_lt hx), Subtype.mk_le_mk]
      exact le_of_lt hx
  rw [← sub_pos, ← smul_eq_mul, ← set_integral_const, ← integral_sub hfint this,
    set_integral_pos_iff_support_of_nonneg_ae]
  · rw [← zero_lt_iff] at hμ
    rwa [Set.inter_eq_self_of_subset_right]
    exact fun x hx => Ne.symm (ne_of_lt <| sub_pos.2 hx)
  · change ∀ᵐ x ∂μ.restrict _, _
    rw [ae_restrict_iff]
    · exact eventually_of_forall fun x hx => sub_nonneg.2 <| le_of_lt hx
    · exact measurableSet_le measurable_zero (hfm.sub measurable_const)
  · 

Proof state:
case hfi
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
R : ℝ
f : α → ℝ
hR : 0 ≤ R
hfm : Measurable f
hfint : IntegrableOn f {x | R < f x}
hμ : ↑↑μ {x | R < f x} ≠ 0
this : IntegrableOn (fun x => R) {x | R < f x}
⊢ IntegrableOn (fun a => f a - R) {x | R < f x}

Next tactic:
exact Integrable.sub hfint this
theorem set_integral_trim {α} {m m0 : MeasurableSpace α} {μ : Measure α} (hm : m ≤ m0) {f : α → E}
    (hf_meas : StronglyMeasurable[m] f) {s : Set α} (hs : MeasurableSet[m] s) :
    ∫ x in s, f x ∂μ = ∫ x in s, f x ∂μ.trim hm := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α✝
inst✝¹ : NormedAddCommGroup E
f✝ g : α✝ → E
s✝ t : Set α✝
μ✝ ν : Measure α✝
l l' : Filter α✝
inst✝ : NormedSpace ℝ E
α : Type u_5
m m0 : MeasurableSpace α
μ : Measure α
hm : m ≤ m0
f : α → E
hf_meas : StronglyMeasurable f
s : Set α
hs : MeasurableSet s
⊢ ∫ (x : α) in s, f x ∂μ = ∫ (x : α) in s, f x ∂Measure.trim μ hm

Next tactic:
rwa [integral_trim hm hf_meas, restrict_trim hm μ]
theorem integral_Icc_eq_integral_Ioo : ∫ t in Icc a b, f t ∂μ = ∫ t in Ico a b, f t ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁴ : MeasurableSpace α
inst✝³ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝² : NormedSpace ℝ E
inst✝¹ : PartialOrder α
a b : α
inst✝ : NoAtoms μ
⊢ ∫ (t : α) in Icc a b, f t ∂μ = ∫ (t : α) in Ico a b, f t ∂μ

Next tactic:
rw [integral_Icc_eq_integral_Ico, integral_Ico_eq_integral_Ioo]
theorem set_integral_mono_on (hs : MeasurableSet s) (h : ∀ x ∈ s, f x ≤ g x) :
    (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ :=
  set_integral_mono_ae_restrict hf hg
    (by 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f g : α → ℝ
s t : Set α
hf : IntegrableOn f s
hg : IntegrableOn g s
hs : MeasurableSet s
h : ∀ x ∈ s, f x ≤ g x
⊢ (fun a => f a) ≤ᵐ[Measure.restrict μ s] fun a => g a

Next tactic:
simp [hs, EventuallyLE, eventually_inf_principal, ae_of_all _ h]
theorem set_integral_mono_on_ae (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x ≤ g x) :
    (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f g : α → ℝ
s t : Set α
hf : IntegrableOn f s
hg : IntegrableOn g s
hs : MeasurableSet s
h : ∀ᵐ (x : α) ∂μ, x ∈ s → f x ≤ g x
⊢ ∫ (a : α) in s, f a ∂μ ≤ ∫ (a : α) in s, g a ∂μ

Next tactic:
refine' set_integral_mono_ae_restrict hf hg _
theorem set_integral_mono_on_ae (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x ≤ g x) :
    (∫ a in s, f a ∂μ) ≤ ∫ a in s, g a ∂μ := by
  refine' set_integral_mono_ae_restrict hf hg _; 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f g : α → ℝ
s t : Set α
hf : IntegrableOn f s
hg : IntegrableOn g s
hs : MeasurableSet s
h : ∀ᵐ (x : α) ∂μ, x ∈ s → f x ≤ g x
⊢ (fun a => f a) ≤ᵐ[Measure.restrict μ s] fun a => g a

Next tactic:
rwa [EventuallyLE, ae_restrict_iff' hs]
theorem set_integral_ge_of_const_le {c : ℝ} (hs : MeasurableSet s) (hμs : μ s ≠ ∞)
    (hf : ∀ x ∈ s, c ≤ f x) (hfint : IntegrableOn (fun x : α => f x) s μ) :
    c * (μ s).toReal ≤ ∫ x in s, f x ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f g : α → ℝ
s t : Set α
hf✝ : IntegrableOn f s
hg : IntegrableOn g s
c : ℝ
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
hf : ∀ x ∈ s, c ≤ f x
hfint : IntegrableOn (fun x => f x) s
⊢ c * ENNReal.toReal (↑↑μ s) ≤ ∫ (x : α) in s, f x ∂μ

Next tactic:
rw [mul_comm, ← smul_eq_mul, ← set_integral_const c]
theorem set_integral_ge_of_const_le {c : ℝ} (hs : MeasurableSet s) (hμs : μ s ≠ ∞)
    (hf : ∀ x ∈ s, c ≤ f x) (hfint : IntegrableOn (fun x : α => f x) s μ) :
    c * (μ s).toReal ≤ ∫ x in s, f x ∂μ := by
  rw [mul_comm, ← smul_eq_mul, ← set_integral_const c]
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f g : α → ℝ
s t : Set α
hf✝ : IntegrableOn f s
hg : IntegrableOn g s
c : ℝ
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
hf : ∀ x ∈ s, c ≤ f x
hfint : IntegrableOn (fun x => f x) s
⊢ ∫ (x : α) in s, c ∂μ ≤ ∫ (x : α) in s, f x ∂μ

Next tactic:
exact set_integral_mono_on (integrableOn_const.2 (Or.inr hμs.lt_top)) hfint hs hf
theorem set_integral_nonneg_ae (hs : MeasurableSet s) (hf : ∀ᵐ a ∂μ, a ∈ s → 0 ≤ f a) :
    0 ≤ ∫ a in s, f a ∂μ :=
  set_integral_nonneg_of_ae_restrict <| by 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f : α → ℝ
s : Set α
hs : MeasurableSet s
hf : ∀ᵐ (a : α) ∂μ, a ∈ s → 0 ≤ f a
⊢ 0 ≤ᵐ[Measure.restrict μ s] fun a => f a

Next tactic:
rwa [EventuallyLE, ae_restrict_iff' hs]
theorem set_integral_le_nonneg {s : Set α} (hs : MeasurableSet s) (hf : StronglyMeasurable f)
    (hfi : Integrable f μ) : (∫ x in s, f x ∂μ) ≤ ∫ x in {y | 0 ≤ f y}, f x ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f : α → ℝ
s✝ s : Set α
hs : MeasurableSet s
hf : StronglyMeasurable f
hfi : Integrable f
⊢ ∫ (x : α) in s, f x ∂μ ≤ ∫ (x : α) in {y | 0 ≤ f y}, f x ∂μ

Next tactic:
rw [← integral_indicator hs, ←
    integral_indicator (stronglyMeasurable_const.measurableSet_le hf)]
theorem set_integral_le_nonneg {s : Set α} (hs : MeasurableSet s) (hf : StronglyMeasurable f)
    (hfi : Integrable f μ) : (∫ x in s, f x ∂μ) ≤ ∫ x in {y | 0 ≤ f y}, f x ∂μ := by
  rw [← integral_indicator hs, ←
    integral_indicator (stronglyMeasurable_const.measurableSet_le hf)]
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f : α → ℝ
s✝ s : Set α
hs : MeasurableSet s
hf : StronglyMeasurable f
hfi : Integrable f
⊢ ∫ (x : α), indicator s (fun x => f x) x ∂μ ≤ ∫ (x : α), indicator {a | 0 ≤ f a} (fun x => f x) x ∂μ

Next tactic:
exact
    integral_mono (hfi.indicator hs)
      (hfi.indicator (stronglyMeasurable_const.measurableSet_le hf))
      (indicator_le_indicator_nonneg s f)
theorem set_integral_nonpos_ae (hs : MeasurableSet s) (hf : ∀ᵐ a ∂μ, a ∈ s → f a ≤ 0) :
    (∫ a in s, f a ∂μ) ≤ 0 :=
  set_integral_nonpos_of_ae_restrict <| by 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f : α → ℝ
s : Set α
hs : MeasurableSet s
hf : ∀ᵐ (a : α) ∂μ, a ∈ s → f a ≤ 0
⊢ (fun a => f a) ≤ᵐ[Measure.restrict μ s] 0

Next tactic:
rwa [EventuallyLE, ae_restrict_iff' hs]
theorem set_integral_nonpos_le {s : Set α} (hs : MeasurableSet s) (hf : StronglyMeasurable f)
    (hfi : Integrable f μ) : (∫ x in {y | f y ≤ 0}, f x ∂μ) ≤ ∫ x in s, f x ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝ : MeasurableSpace α
μ : Measure α
f : α → ℝ
s✝ s : Set α
hs : MeasurableSet s
hf : StronglyMeasurable f
hfi : Integrable f
⊢ ∫ (x : α) in {y | f y ≤ 0}, f x ∂μ ≤ ∫ (x : α) in s, f x ∂μ

Next tactic:
rw [← integral_indicator hs, ←
    integral_indicator (hf.measurableSet_le stronglyMeasurable_const)]