Theorem: MonotoneOn.eVariationOn_le
File: Mathlib/Analysis/BoundedVariation.lean

tactic: apply iSup_le _
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
⊢ eVariationOn f (s ∩ Icc a b) ≤ ENNReal.ofReal (f b - f a)
state_after: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
⊢ ∀ (i : ℕ × { u // Monotone u ∧ ∀ (i : ℕ), u i ∈ s ∩ Icc a b }),
    ∑ i_1 ∈ Finset.range i.1, edist (f (↑i.2 (i_1 + 1))) (f (↑i.2 i_1)) ≤ ENNReal.ofReal (f b - f a)

tactic: rintro ⟨n, ⟨u, hu, us⟩⟩
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
⊢ ∀ (i : ℕ × { u // Monotone u ∧ ∀ (i : ℕ), u i ∈ s ∩ Icc a b }),
    ∑ i_1 ∈ Finset.range i.1, edist (f (↑i.2 (i_1 + 1))) (f (↑i.2 i_1)) ≤ ENNReal.ofReal (f b - f a)
state_after: case mk.mk.intro
α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ∑ i ∈ Finset.range (n, ⟨u, ⋯⟩).1, edist (f (↑(n, ⟨u, ⋯⟩).2 (i + 1))) (f (↑(n, ⟨u, ⋯⟩).2 i)) ≤
    ENNReal.ofReal (f b - f a)

tactic: calc
  (∑ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) =
      ∑ i ∈ Finset.range n, ENNReal.ofReal (f (u (i + 1)) - f (u i)) := by
    refine Finset.sum_congr rfl fun i hi => ?_
    simp only [Finset.mem_range] at hi
    rw [edist_dist, Real.dist_eq, abs_of_nonneg]
    exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
  _ = ENNReal.ofReal (∑ i ∈ Finset.range n, (f (u (i + 1)) - f (u i))) := by
    rw [ENNReal.ofReal_sum_of_nonneg]
    intro i _
    exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
  _ = ENNReal.ofReal (f (u n) - f (u 0)) := by rw [Finset.sum_range_sub fun i => f (u i)]
  _ ≤ ENNReal.ofReal (f b - f a) := by
    apply ENNReal.ofReal_le_ofReal
    exact sub_le_sub (hf (us n).1 bs (us n).2.2) (hf as (us 0).1 (us 0).2.1)
state_before: case mk.mk.intro
α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ∑ i ∈ Finset.range (n, ⟨u, ⋯⟩).1, edist (f (↑(n, ⟨u, ⋯⟩).2 (i + 1))) (f (↑(n, ⟨u, ⋯⟩).2 i)) ≤
    ENNReal.ofReal (f b - f a)
state_after: no goals

tactic: refine Finset.sum_congr rfl fun i hi => ?_
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ∑ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i)) = ∑ i ∈ Finset.range n, ENNReal.ofReal (f (u (i + 1)) - f (u i))
state_after: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
hi : i ∈ Finset.range n
⊢ edist (f (u (i + 1))) (f (u i)) = ENNReal.ofReal (f (u (i + 1)) - f (u i))

tactic: simp only [Finset.mem_range] at hi
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
hi : i ∈ Finset.range n
⊢ edist (f (u (i + 1))) (f (u i)) = ENNReal.ofReal (f (u (i + 1)) - f (u i))
state_after: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
hi : i < n
⊢ edist (f (u (i + 1))) (f (u i)) = ENNReal.ofReal (f (u (i + 1)) - f (u i))

tactic: rw [edist_dist, Real.dist_eq, abs_of_nonneg]
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
hi : i < n
⊢ edist (f (u (i + 1))) (f (u i)) = ENNReal.ofReal (f (u (i + 1)) - f (u i))
state_after: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
hi : i < n
⊢ 0 ≤ f (u (i + 1)) - f (u i)

tactic: exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
hi : i < n
⊢ 0 ≤ f (u (i + 1)) - f (u i)
state_after: no goals

tactic: rw [ENNReal.ofReal_sum_of_nonneg]
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ∑ i ∈ Finset.range n, ENNReal.ofReal (f (u (i + 1)) - f (u i)) =
    ENNReal.ofReal (∑ i ∈ Finset.range n, (f (u (i + 1)) - f (u i)))
state_after: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ∀ i ∈ Finset.range n, 0 ≤ f (u (i + 1)) - f (u i)

tactic: intro i _
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ∀ i ∈ Finset.range n, 0 ≤ f (u (i + 1)) - f (u i)
state_after: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
a✝ : i ∈ Finset.range n
⊢ 0 ≤ f (u (i + 1)) - f (u i)

tactic: exact sub_nonneg_of_le (hf (us i).1 (us (i + 1)).1 (hu (Nat.le_succ _)))
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
i : ℕ
a✝ : i ∈ Finset.range n
⊢ 0 ≤ f (u (i + 1)) - f (u i)
state_after: no goals

tactic: rw [Finset.sum_range_sub fun i => f (u i)]
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ENNReal.ofReal (∑ i ∈ Finset.range n, (f (u (i + 1)) - f (u i))) = ENNReal.ofReal (f (u n) - f (u 0))
state_after: no goals

tactic: apply ENNReal.ofReal_le_ofReal
state_before: α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ ENNReal.ofReal (f (u n) - f (u 0)) ≤ ENNReal.ofReal (f b - f a)
state_after: case h
α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ f (u n) - f (u 0) ≤ f b - f a

tactic: exact sub_le_sub (hf (us n).1 bs (us n).2.2) (hf as (us 0).1 (us 0).2.1)
state_before: case h
α : Type u_1
inst✝¹ : LinearOrder α
E : Type u_2
inst✝ : PseudoEMetricSpace E
f : α → ℝ
s : Set α
hf : MonotoneOn f s
a b : α
as : a ∈ s
bs : b ∈ s
n : ℕ
u : ℕ → α
hu : Monotone u
us : ∀ (i : ℕ), u i ∈ s ∩ Icc a b
⊢ f (u n) - f (u 0) ≤ f b - f a
state_after: no goals