-- Mathlib/MeasureTheory/Integral/Lebesgue.lean
theorem lintegral_add_mul_meas_add_le_le_lintegral {f g : α → ℝ≥0∞} (hle : f ≤ᵐ[μ] g)
    (hg : AEMeasurable g μ) (ε : ℝ≥0∞) :
    ∫⁻ a, f a ∂μ + ε * μ { x | f x + ε ≤ g x } ≤ ∫⁻ a, g a ∂μ

Proof state:
case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
hx₂ : x ∈ {x | φ x + ε ≤ g x}
⊢ φ x + ε ≤ g x

case neg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
hx₂ : x ∉ {x | φ x + ε ≤ g x}
⊢ φ x + 0 ≤ g x

Tactic:
exacts [hx₂, (add_zero _).trans_le <| (hφ_le x).trans hx₁]

Result:
no goals

Proof state:
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ ∫⁻ (x : α), f x ∂μ + ε * μ {x | f x + ε ≤ g x} = ∫⁻ (x : α), φ x ∂μ + ε * μ {x | f x + ε ≤ g x}

Tactic:
rw [hφ_eq]

Result:
no goals

Proof state:
case intro.intro.intro
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
⊢ φ x + {x | φ x + ε ≤ g x}.indicator (fun x => ε) x ≤ g x

Tactic:
simp only [indicator_apply]

Result:
case intro.intro.intro
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
⊢ (φ x + if x ∈ {x | φ x + ε ≤ g x} then ε else 0) ≤ g x

Proof state:
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ ∫⁻ (x : α), φ x ∂μ + ε * μ {x | f x + ε ≤ g x} ≤ ∫⁻ (x : α), φ x ∂μ + ε * μ {x | φ x + ε ≤ g x}

Tactic:
gcongr

Result:
case bc.bc.h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ {x | f x + ε ≤ g x} ⊆ {x | φ x + ε ≤ g x}

Proof state:
case intro.intro.intro
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ ∫⁻ (a : α), f a ∂μ + ε * μ {x | f x + ε ≤ g x} ≤ ∫⁻ (a : α), g a ∂μ

Tactic:
calc
  ∫⁻ x, f x ∂μ + ε * μ { x | f x + ε ≤ g x } = ∫⁻ x, φ x ∂μ + ε * μ { x | f x + ε ≤ g x } := by
    rw [hφ_eq]
  _ ≤ ∫⁻ x, φ x ∂μ + ε * μ { x | φ x + ε ≤ g x } := by
    gcongr
    exact fun x => (add_le_add_right (hφ_le _) _).trans
  _ = ∫⁻ x, φ x + indicator { x | φ x + ε ≤ g x } (fun _ => ε) x ∂μ := by
    rw [lintegral_add_left hφm, lintegral_indicator₀, setLIntegral_const]
    exact measurableSet_le (hφm.nullMeasurable.measurable'.add_const _) hg.nullMeasurable
  _ ≤ ∫⁻ x, g x ∂μ := lintegral_mono_ae (hle.mono fun x hx₁ => ?_)

Result:
case intro.intro.intro
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
⊢ φ x + {x | φ x + ε ≤ g x}.indicator (fun x => ε) x ≤ g x

Proof state:
case intro.intro.intro
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
⊢ (φ x + if x ∈ {x | φ x + ε ≤ g x} then ε else 0) ≤ g x

Tactic:
split_ifs with hx₂

Result:
case pos
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
hx₂ : x ∈ {x | φ x + ε ≤ g x}
⊢ φ x + ε ≤ g x

case neg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
x : α
hx₁ : f x ≤ g x
hx₂ : x ∉ {x | φ x + ε ≤ g x}
⊢ φ x + 0 ≤ g x

Proof state:
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
⊢ ∫⁻ (a : α), f a ∂μ + ε * μ {x | f x + ε ≤ g x} ≤ ∫⁻ (a : α), g a ∂μ

Tactic:
rcases exists_measurable_le_lintegral_eq μ f with ⟨φ, hφm, hφ_le, hφ_eq⟩

Result:
case intro.intro.intro
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ ∫⁻ (a : α), f a ∂μ + ε * μ {x | f x + ε ≤ g x} ≤ ∫⁻ (a : α), g a ∂μ

Proof state:
case bc.bc.h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ {x | f x + ε ≤ g x} ⊆ {x | φ x + ε ≤ g x}

Tactic:
exact fun x => (add_le_add_right (hφ_le _) _).trans

Result:
no goals

Proof state:
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ ∫⁻ (x : α), φ x ∂μ + ε * μ {x | φ x + ε ≤ g x} = ∫⁻ (x : α), φ x + {x | φ x + ε ≤ g x}.indicator (fun x => ε) x ∂μ

Tactic:
rw [lintegral_add_left hφm, lintegral_indicator₀, setLIntegral_const]

Result:
case hs
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ NullMeasurableSet {x | φ x + ε ≤ g x} μ

Proof state:
case hs
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f g : α → ℝ≥0∞
hle : f ≤ᶠ[ae μ] g
hg : AEMeasurable g μ
ε : ℝ≥0∞
φ : α → ℝ≥0∞
hφm : Measurable φ
hφ_le : φ ≤ f
hφ_eq : ∫⁻ (a : α), f a ∂μ = ∫⁻ (a : α), φ a ∂μ
⊢ NullMeasurableSet {x | φ x + ε ≤ g x} μ

Tactic:
exact measurableSet_le (hφm.nullMeasurable.measurable'.add_const _) hg.nullMeasurable

Result:
no goals