-- Mathlib/Topology/EMetricSpace/BoundedVariation.lean
theorem sub_self_monotoneOn {f : α → ℝ} {s : Set α} (hf : LocallyBoundedVariationOn f s)
    {a : α} (as : a ∈ s) : MonotoneOn (variationOnFromTo f s a - f) s

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ edist (f b) (f c) ≤ eVariationOn f (s ∩ Icc b c)

Tactic:
apply eVariationOn.edist_le f

Result:
case hx
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ b ∈ s ∩ Icc b c

case hy
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ c ∈ s ∩ Icc b c

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ variationOnFromTo f s b c = variationOnFromTo f s a c - variationOnFromTo f s a b

Tactic:
rw [← variationOnFromTo.add hf as bs cs, add_sub_cancel_left]

Result:
no goals

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ |f c - f b| = dist (f b) (f c)

Tactic:
rw [dist_comm, Real.dist_eq]

Result:
no goals

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ dist (f b) (f c) ≤ variationOnFromTo f s b c

Tactic:
rw [variationOnFromTo.eq_of_le f s bc, dist_edist]

Result:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ (edist (f b) (f c)).toReal ≤ (eVariationOn f (s ∩ Icc b c)).toReal

Proof state:
case hx
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ b ∈ s ∩ Icc b c

case hy
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ c ∈ s ∩ Icc b c

Tactic:
exacts [⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]

Result:
no goals

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ f c - f b ≤ variationOnFromTo f s a c - variationOnFromTo f s a b

Tactic:
calc
  f c - f b ≤ |f c - f b| := le_abs_self _
  _ = dist (f b) (f c) := by rw [dist_comm, Real.dist_eq]
  _ ≤ variationOnFromTo f s b c := by
    rw [variationOnFromTo.eq_of_le f s bc, dist_edist]
    apply ENNReal.toReal_mono (hf b c bs cs)
    apply eVariationOn.edist_le f
    exacts [⟨bs, le_rfl, bc⟩, ⟨cs, bc, le_rfl⟩]
  _ = variationOnFromTo f s a c - variationOnFromTo f s a b := by
    rw [← variationOnFromTo.add hf as bs cs, add_sub_cancel_left]

Result:
no goals

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
⊢ MonotoneOn (variationOnFromTo f s a - f) s

Tactic:
rintro b bs c cs bc

Result:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ (variationOnFromTo f s a - f) b ≤ (variationOnFromTo f s a - f) c

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ (variationOnFromTo f s a - f) b ≤ (variationOnFromTo f s a - f) c

Tactic:
rw [Pi.sub_apply, Pi.sub_apply, le_sub_iff_add_le, add_comm_sub, ← le_sub_iff_add_le']

Result:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ f c - f b ≤ variationOnFromTo f s a c - variationOnFromTo f s a b

Proof state:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ (edist (f b) (f c)).toReal ≤ (eVariationOn f (s ∩ Icc b c)).toReal

Tactic:
apply ENNReal.toReal_mono (hf b c bs cs)

Result:
α : Type u_1
inst✝ : LinearOrder α
f : α → ℝ
s : Set α
hf : LocallyBoundedVariationOn f s
a : α
as : a ∈ s
b : α
bs : b ∈ s
c : α
cs : c ∈ s
bc : b ≤ c
⊢ edist (f b) (f c) ≤ eVariationOn f (s ∩ Icc b c)