@@ -63,6 +63,13 @@ private lemma continuousOn_Ico {f : ℝ → ℝ} {a b : ℝ} (g₀ : a < b) (h :
6363 (hd₀ : DifferentiableOn ℝ f (Ioo a b)) : ContinuousOn f (Ico a b) :=
6464 Ioo_union_left g₀ ▸ hd₀.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
6565
66+ /-- If `f` is continuous at `a, b` and differentiable on `(a, b)`, then `f` is continuous on
67+ `[a, b]`. -/
68+ private lemma continuousOn_Icc {f : ℝ → ℝ} {a b : ℝ} (g₀ : a ≤ b)
69+ (ha : ContinuousAt f a) (hb : ContinuousAt f b)
70+ (hd₀ : DifferentiableOn ℝ f (Ioo a b)) : ContinuousOn f (Icc a b) :=
71+ Ioo_union_both g₀ ▸ hd₀.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
72+
6673/-- Suppose `a < b < c`, `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonnegative on
6774`(a, b)`, and the derivative `f'` is nonpositive on `(b, c)`. Then `f` attains its maximum on
6875`(a, c)` at `b`. -/
@@ -87,13 +94,11 @@ lemma isMaxOn_of_deriv_Ioc {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁
8794 (hd₁ : DifferentiableOn ℝ f (Ioo b c))
8895 (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
8996 (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Ioc a c) b :=
90- have hIoc : ContinuousOn f (Ioc a b) := Ioo_union_right g₀ ▸
91- hd₀.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
92- have hIcc : ContinuousOn f (Icc b c) := Ioo_union_both g₁ ▸
93- hd₁.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
9497 isMaxOn_of_mono_anti_Ioc g₀ g₁
95- (monotoneOn_of_deriv_nonneg (convex_Ioc a b) hIoc (by simp_all) (by simp_all))
96- (antitoneOn_of_deriv_nonpos (convex_Icc b c) hIcc (by simp_all) (by simp_all))
98+ (monotoneOn_of_deriv_nonneg (convex_Ioc a b) (continuousOn_Ioc g₀ hb hd₀) (by simp_all)
99+ (by simp_all))
100+ (antitoneOn_of_deriv_nonpos (convex_Icc b c) (continuousOn_Icc g₁ hb hc hd₁) (by simp_all)
101+ (by simp_all))
97102
98103/-- Suppose `a ≤ b < c`, `f : ℝ → ℝ` is continuous at `b` and `c`, the derivative `f'` is
99104nonnegative on `(a,b)`, and the derivative `f'` is nonpositive on `(b,c)`. Then `f` attains its
@@ -104,13 +109,11 @@ lemma isMaxOn_of_deriv_Ico {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a ≤ b) (g
104109 (hd₁ : DifferentiableOn ℝ f (Ioo b c))
105110 (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
106111 (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Ico a c) b :=
107- have hIcc : ContinuousOn f (Icc a b) := Ioo_union_both g₀ ▸
108- hd₀.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
109- have hIco : ContinuousOn f (Ico b c) := Ioo_union_left g₁ ▸
110- hd₁.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
111112 isMaxOn_of_mono_anti_Ico g₀ g₁
112- (monotoneOn_of_deriv_nonneg (convex_Icc a b) hIcc (by simp_all) (by simp_all))
113- (antitoneOn_of_deriv_nonpos (convex_Ico b c) hIco (by simp_all) (by simp_all))
113+ (monotoneOn_of_deriv_nonneg (convex_Icc a b) (continuousOn_Icc g₀ ha hb hd₀) (by simp_all)
114+ (by simp_all))
115+ (antitoneOn_of_deriv_nonpos (convex_Ico b c) (continuousOn_Ico g₁ hb hd₁) (by simp_all)
116+ (by simp_all))
114117
115118/-- The First-Derivative Test from calculus, maxima version.
116119Suppose `a < b < c`, `f : ℝ → ℝ` is continuous at `b`,
0 commit comments