@@ -65,76 +65,157 @@ private lemma continuousOn_Ico {f : ℝ → ℝ} {a b : ℝ} (g₀ : a < b) (h :
6565
6666/-- If `f` is continuous at `a, b` and differentiable on `(a, b)`, then `f` is continuous on
6767`[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) :=
68+ private lemma continuousOn_Icc {f : ℝ → ℝ} {a b : ℝ} (g₀ : a ≤ b) (ha : ContinuousAt f a)
69+ (hb : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b)) : ContinuousOn f (Icc a b) :=
7170 Ioo_union_both g₀ ▸ hd₀.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
7271
72+ /-- If `f` is continuous at `b` and differentiable on `(-∞, b)`, then `f` is continuous on
73+ `(-∞, b]`. -/
74+ private lemma continuousOn_Iic {f : ℝ → ℝ} {b : ℝ} (h : ContinuousAt f b)
75+ (hd₀ : DifferentiableOn ℝ f (Iio b)) : ContinuousOn f (Iic b) := by
76+ simp_rw [← Iio_union_right]
77+ apply hd₀.continuousOn.union_continuousAt isOpen_Iio (by simp [h])
78+
79+ /-- If `f` is continuous at `a` and differentiable on `(a, ∞)`, then `f` is continuous on
80+ `[a, ∞)`. -/
81+ private lemma continuousOn_Ici {f : ℝ → ℝ} {a : ℝ} (h : ContinuousAt f a)
82+ (hd₀ : DifferentiableOn ℝ f (Ioi a)) : ContinuousOn f (Ici a) := by
83+ rw [← Ioi_union_left]
84+ exact hd₀.continuousOn.union_continuousAt isOpen_Ioi (by simp [h])
85+
7386/-- Suppose `a < b < c`, `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonnegative on
7487`(a, b)`, and the derivative `f'` is nonpositive on `(b, c)`. Then `f` attains its maximum on
7588`(a, c)` at `b`. -/
7689lemma isMaxOn_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁ : b < c)
77- (h : ContinuousAt f b)
78- (hd₀ : DifferentiableOn ℝ f (Ioo a b))
79- (hd₁ : DifferentiableOn ℝ f (Ioo b c))
80- (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
90+ (h : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
91+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
8192 (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Ioo a c) b :=
8293 isMaxOn_of_mono_anti_Ioo g₀ g₁
8394 (monotoneOn_of_deriv_nonneg (convex_Ioc a b) (continuousOn_Ioc g₀ h hd₀) (by simp_all)
84- (by simp_all))
95+ (by simp_all))
8596 (antitoneOn_of_deriv_nonpos (convex_Ico b c) (continuousOn_Ico g₁ h hd₁) (by simp_all)
86- (by simp_all))
97+ (by simp_all))
8798
8899/-- Suppose `a < b ≤ c`, `f : ℝ → ℝ` is continuous at `b` and `c`, the derivative `f'` is
89100nonnegative on `(a, b)`, and the derivative `f'` is nonpositive on `(b, c)`. Then `f` attains its
90101maximum on `(a, c]` at `b`. -/
91102lemma isMaxOn_of_deriv_Ioc {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁ : b ≤ c)
92- (hb : ContinuousAt f b) (hc : ContinuousAt f c)
93- (hd₀ : DifferentiableOn ℝ f (Ioo a b))
94- (hd₁ : DifferentiableOn ℝ f (Ioo b c))
95- (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
103+ (hb : ContinuousAt f b) (hc : ContinuousAt f c) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
104+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
96105 (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Ioc a c) b :=
97106 isMaxOn_of_mono_anti_Ioc g₀ g₁
98107 (monotoneOn_of_deriv_nonneg (convex_Ioc a b) (continuousOn_Ioc g₀ hb hd₀) (by simp_all)
99- (by simp_all))
108+ (by simp_all))
100109 (antitoneOn_of_deriv_nonpos (convex_Icc b c) (continuousOn_Icc g₁ hb hc hd₁) (by simp_all)
101- (by simp_all))
110+ (by simp_all))
102111
103112/-- Suppose `a ≤ b < c`, `f : ℝ → ℝ` is continuous at `b` and `c`, the derivative `f'` is
104113nonnegative on `(a,b)`, and the derivative `f'` is nonpositive on `(b,c)`. Then `f` attains its
105114maximum on `(a,c]` at `b`. -/
106115lemma isMaxOn_of_deriv_Ico {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a ≤ b) (g₁ : b < c)
107- (ha : ContinuousAt f a) (hb : ContinuousAt f b)
108- (hd₀ : DifferentiableOn ℝ f (Ioo a b))
109- (hd₁ : DifferentiableOn ℝ f (Ioo b c))
110- (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
116+ (ha : ContinuousAt f a) (hb : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
117+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
111118 (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Ico a c) b :=
112119 isMaxOn_of_mono_anti_Ico g₀ g₁
113120 (monotoneOn_of_deriv_nonneg (convex_Icc a b) (continuousOn_Icc g₀ ha hb hd₀) (by simp_all)
114- (by simp_all))
121+ (by simp_all))
115122 (antitoneOn_of_deriv_nonpos (convex_Ico b c) (continuousOn_Ico g₁ hb hd₁) (by simp_all)
116- (by simp_all))
123+ (by simp_all))
124+
125+ /-- Suppose `a ≤ b ≤ c`, `f : ℝ → ℝ` is continuous at `a`, `b`, and `c`, the derivative `f'` is
126+ nonnegative on `(a, b)`, and the derivative `f'` is nonpositive on `(b, c)`. Then `f` attains its
127+ maximum on `[a, c]` at `b`. -/
128+ lemma isMaxOn_of_deriv_Icc {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a ≤ b) (g₁ : b ≤ c)
129+ (ha : ContinuousAt f a) (hb : ContinuousAt f b) (hc : ContinuousAt f c)
130+ (hd₀ : DifferentiableOn ℝ f (Ioo a b)) (hd₁ : DifferentiableOn ℝ f (Ioo b c))
131+ (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
132+ (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Icc a c) b :=
133+ isMaxOn_of_mono_anti_Icc g₀ g₁
134+ (monotoneOn_of_deriv_nonneg (convex_Icc a b) (continuousOn_Icc g₀ ha hb hd₀) (by simp_all)
135+ (by simp_all))
136+ (antitoneOn_of_deriv_nonpos (convex_Icc b c) (continuousOn_Icc g₁ hb hc hd₁) (by simp_all)
137+ (by simp_all))
138+
139+ /-- Suppose `a < b`, `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonnegative on
140+ `(a, b)`, and the derivative `f'` is nonpositive on `(b, ∞)`. Then `f` attains its maximum on
141+ `(a, ∞)` at `b`. -/
142+ lemma isMaxOn_of_deriv_Ioi {f : ℝ → ℝ} {a b : ℝ} (g₀ : a < b) (hb : ContinuousAt f b)
143+ (hd₀ : DifferentiableOn ℝ f (Ioo a b)) (hd₁ : DifferentiableOn ℝ f (Ioi b))
144+ (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x) (h₁ : ∀ x ∈ Ioi b, deriv f x ≤ 0 ) :
145+ IsMaxOn f (Ioi a) b :=
146+ isMaxOn_of_mono_anti_Ioi g₀
147+ (monotoneOn_of_deriv_nonneg (convex_Ioc a b) (continuousOn_Ioc g₀ hb hd₀) (by simp_all)
148+ (by simp_all))
149+ (antitoneOn_of_deriv_nonpos (convex_Ici b) (continuousOn_Ici hb hd₁) (by simp_all)
150+ (by simp_all))
151+
152+ /-- Suppose `a ≤ b`, `f : ℝ → ℝ` is continuous at `a` and `b`, the derivative `f'` is nonnegative
153+ on `(a, b)`, and the derivative `f'` is nonpositive on `(b, ∞)`. Then `f` attains its maximum on
154+ `[a, ∞)` at `b`. -/
155+ lemma isMaxOn_of_deriv_Ici {f : ℝ → ℝ} {a b : ℝ} (g₀ : a ≤ b) (ha : ContinuousAt f a)
156+ (hb : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
157+ (hd₁ : DifferentiableOn ℝ f (Ioi b)) (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
158+ (h₁ : ∀ x ∈ Ioi b, deriv f x ≤ 0 ) : IsMaxOn f (Ici a) b :=
159+ isMaxOn_of_mono_anti_Ici g₀
160+ (monotoneOn_of_deriv_nonneg (convex_Icc a b) (continuousOn_Icc g₀ ha hb hd₀) (by simp_all)
161+ (by simp_all))
162+ (antitoneOn_of_deriv_nonpos (convex_Ici b) (continuousOn_Ici hb hd₁) (by simp_all)
163+ (by simp_all))
164+
165+ /-- Suppose `b < c`, `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonnegative on
166+ `(-∞, b)`, and the derivative `f'` is nonpositive on `(b, c)`. Then `f` attains its maximum on
167+ `(-∞, c)` at `b`. -/
168+ lemma isMaxOn_of_deriv_Iio {f : ℝ → ℝ} {b c : ℝ} (g₁ : b < c) (hb : ContinuousAt f b)
169+ (hd₀ : DifferentiableOn ℝ f (Iio b)) (hd₁ : DifferentiableOn ℝ f (Ioo b c))
170+ (h₀ : ∀ x ∈ Iio b, 0 ≤ deriv f x) (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Iio c) b :=
171+ isMaxOn_of_mono_anti_Iio g₁
172+ (monotoneOn_of_deriv_nonneg (convex_Iic b) (continuousOn_Iic hb hd₀) (by simp_all)
173+ (by simp_all))
174+ (antitoneOn_of_deriv_nonpos (convex_Ico b c) (continuousOn_Ico g₁ hb hd₁) (by simp_all)
175+ (by simp_all))
176+
177+ /-- Suppose `b ≤ c`, `f : ℝ → ℝ` is continuous at `b` and `c`, the derivative `f'` is nonnegative
178+ on `(-∞, b)`, and the derivative `f'` is nonpositive on `(b, c)`. Then `f` attains its maximum on
179+ `(-∞, c]` at `b`. -/
180+ lemma isMaxOn_of_deriv_Iic {f : ℝ → ℝ} {b c : ℝ} (g₁ : b ≤ c) (hb : ContinuousAt f b)
181+ (hc : ContinuousAt f c) (hd₀ : DifferentiableOn ℝ f (Iio b))
182+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Iio b, 0 ≤ deriv f x)
183+ (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsMaxOn f (Iic c) b :=
184+ isMaxOn_of_mono_anti_Iic g₁
185+ (monotoneOn_of_deriv_nonneg (convex_Iic b) (continuousOn_Iic hb hd₀) (by simp_all)
186+ (by simp_all))
187+ (antitoneOn_of_deriv_nonpos (convex_Icc b c) (continuousOn_Icc g₁ hb hc hd₁) (by simp_all)
188+ (by simp_all))
189+
190+ /-- Suppose `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonnegative on `(-∞, b)`,
191+ and the derivative `f'` is nonpositive on `(b, ∞)`. Then `f` attains its maximum on `ℝ`
192+ at `b`. -/
193+ lemma isMaxOn_of_deriv_univ {f : ℝ → ℝ} {b : ℝ} (hb : ContinuousAt f b)
194+ (hd₀ : DifferentiableOn ℝ f (Iio b)) (hd₁ : DifferentiableOn ℝ f (Ioi b))
195+ (h₀ : ∀ x ∈ Iio b, 0 ≤ deriv f x) (h₁ : ∀ x ∈ Ioi b, deriv f x ≤ 0 ) :
196+ IsMaxOn f univ b :=
197+ isMaxOn_of_mono_anti_univ
198+ (monotoneOn_of_deriv_nonneg (convex_Iic b) (continuousOn_Iic hb hd₀) (by simp_all)
199+ (by simp_all))
200+ (antitoneOn_of_deriv_nonpos (convex_Ici b) (continuousOn_Ici hb hd₁) (by simp_all)
201+ (by simp_all))
117202
118203/-- The First-Derivative Test from calculus, maxima version.
119204Suppose `a < b < c`, `f : ℝ → ℝ` is continuous at `b`,
120205the derivative `f'` is nonnegative on `(a,b)`, and
121206the derivative `f'` is nonpositive on `(b,c)`. Then `f` has a local maximum at `b`. -/
122207lemma isLocalMax_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁ : b < c)
123- (h : ContinuousAt f b)
124- (hd₀ : DifferentiableOn ℝ f (Ioo a b))
125- (hd₁ : DifferentiableOn ℝ f (Ioo b c))
126- (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
208+ (h : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
209+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
127210 (h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0 ) : IsLocalMax f b :=
128211 (isMaxOn_of_deriv_Ioo g₀ g₁ h hd₀ hd₁ h₀ h₁).isLocalMax (Ioo_mem_nhds g₀ g₁)
129212
130213/-- Suppose `a < b < c`, `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonpositive on
131214`(a,b)`, and the derivative `f'` is nonnegative on `(b,c)`. Then `f` attains its minimum on `(a,c)`
132215at `b`. -/
133216lemma isMinOn_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁ : b < c)
134- (h : ContinuousAt f b)
135- (hd₀ : DifferentiableOn ℝ f (Ioo a b))
136- (hd₁ : DifferentiableOn ℝ f (Ioo b c))
137- (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 )
217+ (h : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
218+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 )
138219 (h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) : IsMinOn f (Ioo a c) b :=
139220 have hIoc : ContinuousOn f (Ioc a b) := Ioo_union_right g₀ ▸
140221 hd₀.continuousOn.union_continuousAt isOpen_Ioo (by simp_all)
@@ -144,11 +225,115 @@ lemma isMinOn_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁
144225 (antitoneOn_of_deriv_nonpos (convex_Ioc a b) hIoc (by simp_all) (by simp_all))
145226 (monotoneOn_of_deriv_nonneg (convex_Ico b c) hIco (by simp_all) (by simp_all))
146227
147- /-- The First-Derivative Test from calculus, minima version. -/
148- lemma isLocalMin_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ}
149- (g₀ : a < b) (g₁ : b < c) (h : ContinuousAt f b)
228+ /-- Suppose `a < b ≤ c`, `f : ℝ → ℝ` is continuous at `b` and `c`, the derivative `f'` is
229+ nonpositive on `(a, b)`, and the derivative `f'` is nonnegative on `(b, c)`. Then `f` attains its
230+ minimum on `(a, c]` at `b`. -/
231+ lemma isMinOn_of_deriv_Ioc {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁ : b ≤ c)
232+ (hb : ContinuousAt f b) (hc : ContinuousAt f c) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
233+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 )
234+ (h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) : IsMinOn f (Ioc a c) b :=
235+ isMinOn_of_anti_mono_Ioc g₀ g₁
236+ (antitoneOn_of_deriv_nonpos (convex_Ioc a b) (continuousOn_Ioc g₀ hb hd₀) (by simp_all)
237+ (by simp_all))
238+ (monotoneOn_of_deriv_nonneg (convex_Icc b c) (continuousOn_Icc g₁ hb hc hd₁) (by simp_all)
239+ (by simp_all))
240+
241+ /-- Suppose `a ≤ b < c`, `f : ℝ → ℝ` is continuous at `a` and `b`, the derivative `f'` is
242+ nonpositive on `(a, b)`, and the derivative `f'` is nonnegative on `(b, c)`. Then `f` attains its
243+ minimum on `[a, c)` at `b`. -/
244+ lemma isMinOn_of_deriv_Ico {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a ≤ b) (g₁ : b < c)
245+ (ha : ContinuousAt f a) (hb : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
246+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 )
247+ (h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) : IsMinOn f (Ico a c) b :=
248+ isMinOn_of_anti_mono_Ico g₀ g₁
249+ (antitoneOn_of_deriv_nonpos (convex_Icc a b) (continuousOn_Icc g₀ ha hb hd₀) (by simp_all)
250+ (by simp_all))
251+ (monotoneOn_of_deriv_nonneg (convex_Ico b c) (continuousOn_Ico g₁ hb hd₁) (by simp_all)
252+ (by simp_all))
253+
254+ /-- Suppose `a ≤ b ≤ c`, `f : ℝ → ℝ` is continuous at `a`, `b`, and `c`, the derivative `f'` is
255+ nonpositive on `(a, b)`, and the derivative `f'` is nonnegative on `(b, c)`. Then `f` attains its
256+ minimum on `[a, c]` at `b`. -/
257+ lemma isMinOn_of_deriv_Icc {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a ≤ b) (g₁ : b ≤ c)
258+ (ha : ContinuousAt f a) (hb : ContinuousAt f b) (hc : ContinuousAt f c)
150259 (hd₀ : DifferentiableOn ℝ f (Ioo a b)) (hd₁ : DifferentiableOn ℝ f (Ioo b c))
151- (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 )
260+ (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 ) (h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) :
261+ IsMinOn f (Icc a c) b :=
262+ isMinOn_of_anti_mono_Icc g₀ g₁
263+ (antitoneOn_of_deriv_nonpos (convex_Icc a b) (continuousOn_Icc g₀ ha hb hd₀) (by simp_all)
264+ (by simp_all))
265+ (monotoneOn_of_deriv_nonneg (convex_Icc b c) (continuousOn_Icc g₁ hb hc hd₁) (by simp_all)
266+ (by simp_all))
267+
268+ /-- Suppose `a < b`, `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonpositive on
269+ `(a, b)`, and the derivative `f'` is nonnegative on `(b, ∞)`. Then `f` attains its minimum on
270+ `(a, ∞)` at `b`. -/
271+ lemma isMinOn_of_deriv_Ioi {f : ℝ → ℝ} {a b : ℝ} (g₀ : a < b) (hb : ContinuousAt f b)
272+ (hd₀ : DifferentiableOn ℝ f (Ioo a b)) (hd₁ : DifferentiableOn ℝ f (Ioi b))
273+ (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 ) (h₁ : ∀ x ∈ Ioi b, 0 ≤ deriv f x) :
274+ IsMinOn f (Ioi a) b :=
275+ isMinOn_of_anti_mono_Ioi g₀
276+ (antitoneOn_of_deriv_nonpos (convex_Ioc a b) (continuousOn_Ioc g₀ hb hd₀) (by simp_all)
277+ (by simp_all))
278+ (monotoneOn_of_deriv_nonneg (convex_Ici b) (continuousOn_Ici hb hd₁) (by simp_all)
279+ (by simp_all))
280+
281+ /-- Suppose `a ≤ b`, `f : ℝ → ℝ` is continuous at `a` and `b`, the derivative `f'` is nonpositive
282+ on `(a, b)`, and the derivative `f'` is nonnegative on `(b, ∞)`. Then `f` attains its minimum on
283+ `[a, ∞)` at `b`. -/
284+ lemma isMinOn_of_deriv_Ici {f : ℝ → ℝ} {a b : ℝ} (g₀ : a ≤ b) (ha : ContinuousAt f a)
285+ (hb : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
286+ (hd₁ : DifferentiableOn ℝ f (Ioi b)) (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 )
287+ (h₁ : ∀ x ∈ Ioi b, 0 ≤ deriv f x) : IsMinOn f (Ici a) b :=
288+ isMinOn_of_anti_mono_Ici g₀
289+ (antitoneOn_of_deriv_nonpos (convex_Icc a b) (continuousOn_Icc g₀ ha hb hd₀) (by simp_all)
290+ (by simp_all))
291+ (monotoneOn_of_deriv_nonneg (convex_Ici b) (continuousOn_Ici hb hd₁) (by simp_all)
292+ (by simp_all))
293+
294+ /-- Suppose `b < c`, `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonpositive on
295+ `(-∞, b)`, and the derivative `f'` is nonnegative on `(b, c)`. Then `f` attains its minimum on
296+ `(-∞, c)` at `b`. -/
297+ lemma isMinOn_of_deriv_Iio {f : ℝ → ℝ} {b c : ℝ} (g₁ : b < c) (hb : ContinuousAt f b)
298+ (hd₀ : DifferentiableOn ℝ f (Iio b)) (hd₁ : DifferentiableOn ℝ f (Ioo b c))
299+ (h₀ : ∀ x ∈ Iio b, deriv f x ≤ 0 ) (h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) :
300+ IsMinOn f (Iio c) b :=
301+ isMinOn_of_anti_mono_Iio g₁
302+ (antitoneOn_of_deriv_nonpos (convex_Iic b) (continuousOn_Iic hb hd₀) (by simp_all)
303+ (by simp_all))
304+ (monotoneOn_of_deriv_nonneg (convex_Ico b c) (continuousOn_Ico g₁ hb hd₁) (by simp_all)
305+ (by simp_all))
306+
307+ /-- Suppose `b ≤ c`, `f : ℝ → ℝ` is continuous at `b` and `c`, the derivative `f'` is nonpositive
308+ on `(-∞, b)`, and the derivative `f'` is nonnegative on `(b, c)`. Then `f` attains its minimum on
309+ `(-∞, c]` at `b`. -/
310+ lemma isMinOn_of_deriv_Iic {f : ℝ → ℝ} {b c : ℝ} (g₁ : b ≤ c) (hb : ContinuousAt f b)
311+ (hc : ContinuousAt f c) (hd₀ : DifferentiableOn ℝ f (Iio b))
312+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Iio b, deriv f x ≤ 0 )
313+ (h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) : IsMinOn f (Iic c) b :=
314+ isMinOn_of_anti_mono_Iic g₁
315+ (antitoneOn_of_deriv_nonpos (convex_Iic b) (continuousOn_Iic hb hd₀) (by simp_all)
316+ (by simp_all))
317+ (monotoneOn_of_deriv_nonneg (convex_Icc b c) (continuousOn_Icc g₁ hb hc hd₁) (by simp_all)
318+ (by simp_all))
319+
320+ /-- Suppose `f : ℝ → ℝ` is continuous at `b`, the derivative `f'` is nonpositive on `(-∞, b)`,
321+ and the derivative `f'` is nonnegative on `(b, ∞)`. Then `f` attains its minimum on `ℝ`
322+ at `b`. -/
323+ lemma isMinOn_of_deriv_univ {f : ℝ → ℝ} {b : ℝ} (hb : ContinuousAt f b)
324+ (hd₀ : DifferentiableOn ℝ f (Iio b)) (hd₁ : DifferentiableOn ℝ f (Ioi b))
325+ (h₀ : ∀ x ∈ Iio b, deriv f x ≤ 0 ) (h₁ : ∀ x ∈ Ioi b, 0 ≤ deriv f x) :
326+ IsMinOn f univ b :=
327+ isMinOn_of_anti_mono_univ
328+ (antitoneOn_of_deriv_nonpos (convex_Iic b) (continuousOn_Iic hb hd₀) (by simp_all)
329+ (by simp_all))
330+ (monotoneOn_of_deriv_nonneg (convex_Ici b) (continuousOn_Ici hb hd₁) (by simp_all)
331+ (by simp_all))
332+
333+ /-- The First-Derivative Test from calculus, minima version. -/
334+ lemma isLocalMin_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g₁ : b < c)
335+ (h : ContinuousAt f b) (hd₀ : DifferentiableOn ℝ f (Ioo a b))
336+ (hd₁ : DifferentiableOn ℝ f (Ioo b c)) (h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0 )
152337 (h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) : IsLocalMin f b :=
153338 (isMinOn_of_deriv_Ioo g₀ g₁ h hd₀ hd₁ h₀ h₁).isLocalMin (Ioo_mem_nhds g₀ g₁)
154339
0 commit comments