-- Mathlib/MeasureTheory/Measure/LevyProkhorovMetric.lean
/-- Assuming `levyProkhorovEDist μ ν < ε`, we can bound `∫ f ∂μ` in terms of
`∫ t in (0, ‖f‖], ν (thickening ε {x | f(x) ≥ t}) dt` and `‖f‖`. -/
lemma BoundedContinuousFunction.integral_le_of_levyProkhorovEDist_lt (μ ν : Measure Ω)
    [IsFiniteMeasure μ] [IsFiniteMeasure ν] {ε : ℝ} (ε_pos : 0 < ε)
    (hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε) (f : Ω →ᵇ ℝ) (f_nn : 0 ≤ᵐ[μ] f) :
    ∫ ω, f ω ∂μ
      ≤ (∫ t in Ioc 0 ‖f‖, ENNReal.toReal (ν (thickening ε {a | t ≤ f a}))) + ε * ‖f‖

Proof state:
Ω : Type u_1
inst✝⁴ : MeasurableSpace Ω
inst✝³ : PseudoMetricSpace Ω
inst✝² : OpensMeasurableSpace Ω
μ ν : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
ε : ℝ
ε_pos : 0 < ε
hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε
f : Ω →ᵇ ℝ
f_nn : 0 ≤ᶠ[ae μ] ⇑f
key : (fun t => (μ {a | t ≤ f a}).toReal) ≤ fun t => (ν (thickening ε {a | t ≤ f a})).toReal + ε
intble₁ : IntegrableOn (fun t => (μ {a | t ≤ f a}).toReal) (Ioc 0 ‖f‖) volume
intble₂ : IntegrableOn (fun t => (ν (thickening ε {a | t ≤ f a})).toReal) (Ioc 0 ‖f‖) volume
⊢ ∫ (x : ℝ) in Ioc 0 ‖f‖, (ν (thickening ε {a | x ≤ f a})).toReal + ε ≤
    (∫ (t : ℝ) in Ioc 0 ‖f‖, (ν (thickening ε {a | t ≤ f a})).toReal) + ε * ‖f‖

Tactic:
rw [integral_add]

Result:
Ω : Type u_1
inst✝⁴ : MeasurableSpace Ω
inst✝³ : PseudoMetricSpace Ω
inst✝² : OpensMeasurableSpace Ω
μ ν : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
ε : ℝ
ε_pos : 0 < ε
hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε
f : Ω →ᵇ ℝ
f_nn : 0 ≤ᶠ[ae μ] ⇑f
key : (fun t => (μ {a | t ≤ f a}).toReal) ≤ fun t => (ν (thickening ε {a | t ≤ f a})).toReal + ε
intble₁ : IntegrableOn (fun t => (μ {a | t ≤ f a}).toReal) (Ioc 0 ‖f‖) volume
intble₂ : IntegrableOn (fun t => (ν (thickening ε {a | t ≤ f a})).toReal) (Ioc 0 ‖f‖) volume
⊢ (∫ (a : ℝ) in Ioc 0 ‖f‖, (ν (thickening ε {a_1 | a ≤ f a_1})).toReal) + ∫ (a : ℝ) in Ioc 0 ‖f‖, ε ≤
    (∫ (t : ℝ) in Ioc 0 ‖f‖, (ν (thickening ε {a | t ≤ f a})).toReal) + ε * ‖f‖

case hf
Ω : Type u_1
inst✝⁴ : MeasurableSpace Ω
inst✝³ : PseudoMetricSpace Ω
inst✝² : OpensMeasurableSpace Ω
μ ν : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
ε : ℝ
ε_pos : 0 < ε
hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε
f : Ω →ᵇ ℝ
f_nn : 0 ≤ᶠ[ae μ] ⇑f
key : (fun t => (μ {a | t ≤ f a}).toReal) ≤ fun t => (ν (thickening ε {a | t ≤ f a})).toReal + ε
intble₁ : IntegrableOn (fun t => (μ {a | t ≤ f a}).toReal) (Ioc 0 ‖f‖) volume
intble₂ : IntegrableOn (fun t => (ν (thickening ε {a | t ≤ f a})).toReal) (Ioc 0 ‖f‖) volume
⊢ Integrable (fun x => (ν (thickening ε {a | x ≤ f a})).toReal) (volume.restrict (Ioc 0 ‖f‖))

case hg
Ω : Type u_1
inst✝⁴ : MeasurableSpace Ω
inst✝³ : PseudoMetricSpace Ω
inst✝² : OpensMeasurableSpace Ω
μ ν : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
ε : ℝ
ε_pos : 0 < ε
hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε
f : Ω →ᵇ ℝ
f_nn : 0 ≤ᶠ[ae μ] ⇑f
key : (fun t => (μ {a | t ≤ f a}).toReal) ≤ fun t => (ν (thickening ε {a | t ≤ f a})).toReal + ε
intble₁ : IntegrableOn (fun t => (μ {a | t ≤ f a}).toReal) (Ioc 0 ‖f‖) volume
intble₂ : IntegrableOn (fun t => (ν (thickening ε {a | t ≤ f a})).toReal) (Ioc 0 ‖f‖) volume
⊢ Integrable (fun x => ε) (volume.restrict (Ioc 0 ‖f‖))

Proof state:
Ω : Type u_1
inst✝⁴ : MeasurableSpace Ω
inst✝³ : PseudoMetricSpace Ω
inst✝² : OpensMeasurableSpace Ω
μ ν : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
ε : ℝ
ε_pos : 0 < ε
hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε
f : Ω →ᵇ ℝ
f_nn : 0 ≤ᶠ[ae μ] ⇑f
key : (fun t => (μ {a | t ≤ f a}).toReal) ≤ fun t => (ν (thickening ε {a | t ≤ f a})).toReal + ε
intble₁ : IntegrableOn (fun t => (μ {a | t ≤ f a}).toReal) (Ioc 0 ‖f‖) volume
⊢ Antitone fun x => ν (thickening ε {a | x ≤ f a})

Tactic:
exact fun _ _ hst ↦ measure_mono <| thickening_subset_of_subset ε (fun _ h ↦ hst.trans h)

Result:
no goals

Proof state:
Ω : Type u_1
inst✝⁴ : MeasurableSpace Ω
inst✝³ : PseudoMetricSpace Ω
inst✝² : OpensMeasurableSpace Ω
μ ν : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
ε : ℝ
ε_pos : 0 < ε
hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε
f : Ω →ᵇ ℝ
f_nn : 0 ≤ᶠ[ae μ] ⇑f
key : (fun t => (μ {a | t ≤ f a}).toReal) ≤ fun t => (ν (thickening ε {a | t ≤ f a})).toReal + ε
intble₁ : IntegrableOn (fun t => (μ {a | t ≤ f a}).toReal) (Ioc 0 ‖f‖) volume
intble₂ : IntegrableOn (fun t => (ν (thickening ε {a | t ≤ f a})).toReal) (Ioc 0 ‖f‖) volume
⊢ (∫ (a : ℝ) in Ioc 0 ‖f‖, (ν (thickening ε {a_1 | a ≤ f a_1})).toReal) + ∫ (a : ℝ) in Ioc 0 ‖f‖, ε ≤
    (∫ (t : ℝ) in Ioc 0 ‖f‖, (ν (thickening ε {a | t ≤ f a})).toReal) + ε * ‖f‖

Tactic:
apply add_le_add_left

Result:
case bc
Ω : Type u_1
inst✝⁴ : MeasurableSpace Ω
inst✝³ : PseudoMetricSpace Ω
inst✝² : OpensMeasurableSpace Ω
μ ν : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
ε : ℝ
ε_pos : 0 < ε
hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε
f : Ω →ᵇ ℝ
f_nn : 0 ≤ᶠ[ae μ] ⇑f
key : (fun t => (μ {a | t ≤ f a}).toReal) ≤ fun t => (ν (thickening ε {a | t ≤ f a})).toReal + ε
intble₁ : IntegrableOn (fun t => (μ {a | t ≤ f a}).toReal) (Ioc 0 ‖f‖) volume
intble₂ : IntegrableOn (fun t => (ν (thickening ε {a | t ≤ f a})).toReal) (Ioc 0 ‖f‖) volume
⊢ ∫ (a : ℝ) in Ioc 0 ‖f‖, ε ≤ ε * ‖f‖