forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdd.lean
More file actions
476 lines (349 loc) · 16.8 KB
/
Copy pathAdd.lean
File metadata and controls
476 lines (349 loc) · 16.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
/-
Copyright (c) 2019 Gabriel Ebner. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Gabriel Ebner, Sébastien Gouëzel, Yury Kudryashov, Anatole Dedecker
-/
module
public import Mathlib.Analysis.Calculus.Deriv.Basic
public import Mathlib.Analysis.Calculus.FDeriv.Add
/-!
# One-dimensional derivatives of sums etc
In this file we prove formulas about derivatives of `f + g`, `-f`, `f - g`, and `∑ i, f i x` for
functions from the base field to a normed space over this field.
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Analysis/Calculus/Deriv/Basic`.
## Keywords
derivative
-/
public section
universe u v w
open scoped Topology Filter ENNReal
open Asymptotics Set
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {f g : 𝕜 → F}
variable {f' g' : F}
variable {x : 𝕜} {s : Set 𝕜} {L : Filter (𝕜 × 𝕜)}
section Add
/-! ### Derivative of the sum of two functions -/
@[to_fun]
theorem HasDerivAtFilter.add (hf : HasDerivAtFilter f f' L)
(hg : HasDerivAtFilter g g' L) : HasDerivAtFilter (f + g) (f' + g') L := by
simpa using (hf.hasFDerivAtFilter.add hg.hasFDerivAtFilter).hasDerivAtFilter
@[to_fun]
theorem HasStrictDerivAt.add (hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) :
HasStrictDerivAt (f + g) (f' + g') x :=
HasDerivAtFilter.add hf hg
@[to_fun]
theorem HasDerivWithinAt.add (hf : HasDerivWithinAt f f' s x)
(hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (f + g) (f' + g') s x :=
HasDerivAtFilter.add hf hg
@[to_fun]
theorem HasDerivAt.add (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) :
HasDerivAt (f + g) (f' + g') x :=
HasDerivAtFilter.add hf hg
theorem derivWithin_fun_add (hf : DifferentiableWithinAt 𝕜 f s x)
(hg : DifferentiableWithinAt 𝕜 g s x) :
derivWithin (fun y ↦ f y + g y) s x = derivWithin f s x + derivWithin g s x := by
by_cases hsx : UniqueDiffWithinAt 𝕜 s x
· exact (hf.hasDerivWithinAt.add hg.hasDerivWithinAt).derivWithin hsx
· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_add (hf : DifferentiableWithinAt 𝕜 f s x)
(hg : DifferentiableWithinAt 𝕜 g s x) :
derivWithin (f + g) s x = derivWithin f s x + derivWithin g s x :=
derivWithin_fun_add hf hg
@[simp]
theorem deriv_fun_add (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) :
deriv (fun y ↦ f y + g y) x = deriv f x + deriv g x :=
(hf.hasDerivAt.add hg.hasDerivAt).deriv
@[simp]
theorem deriv_add (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) :
deriv (f + g) x = deriv f x + deriv g x :=
(hf.hasDerivAt.add hg.hasDerivAt).deriv
@[simp]
theorem hasDerivAtFilter_add_const_iff (c : F) :
HasDerivAtFilter (f · + c) f' L ↔ HasDerivAtFilter f f' L :=
hasFDerivAtFilter_add_const_iff c
alias ⟨_, HasDerivAtFilter.add_const⟩ := hasDerivAtFilter_add_const_iff
@[simp]
theorem hasStrictDerivAt_add_const_iff (c : F) :
HasStrictDerivAt (f · + c) f' x ↔ HasStrictDerivAt f f' x :=
hasDerivAtFilter_add_const_iff c
alias ⟨_, HasStrictDerivAt.add_const⟩ := hasStrictDerivAt_add_const_iff
@[simp]
theorem hasDerivWithinAt_add_const_iff (c : F) :
HasDerivWithinAt (f · + c) f' s x ↔ HasDerivWithinAt f f' s x :=
hasDerivAtFilter_add_const_iff c
alias ⟨_, HasDerivWithinAt.add_const⟩ := hasDerivWithinAt_add_const_iff
@[simp]
theorem hasDerivAt_add_const_iff (c : F) : HasDerivAt (f · + c) f' x ↔ HasDerivAt f f' x :=
hasDerivAtFilter_add_const_iff c
alias ⟨_, HasDerivAt.add_const⟩ := hasDerivAt_add_const_iff
theorem derivWithin_add_const (c : F) :
derivWithin (fun y ↦ f y + c) s x = derivWithin f s x := by
simp only [derivWithin, fderivWithin_add_const]
theorem deriv_add_const (c : F) : deriv (fun y ↦ f y + c) x = deriv f x := by
simp only [deriv, fderiv_add_const]
@[simp]
theorem deriv_add_const' (c : F) : (deriv fun y ↦ f y + c) = deriv f :=
funext fun _ ↦ deriv_add_const c
theorem hasDerivAtFilter_const_add_iff (c : F) :
HasDerivAtFilter (c + f ·) f' L ↔ HasDerivAtFilter f f' L :=
hasFDerivAtFilter_const_add_iff c
alias ⟨_, HasDerivAtFilter.const_add⟩ := hasDerivAtFilter_const_add_iff
@[simp]
theorem hasStrictDerivAt_const_add_iff (c : F) :
HasStrictDerivAt (c + f ·) f' x ↔ HasStrictDerivAt f f' x :=
hasDerivAtFilter_const_add_iff c
alias ⟨_, HasStrictDerivAt.const_add⟩ := hasStrictDerivAt_const_add_iff
@[simp]
theorem hasDerivWithinAt_const_add_iff (c : F) :
HasDerivWithinAt (c + f ·) f' s x ↔ HasDerivWithinAt f f' s x :=
hasDerivAtFilter_const_add_iff c
alias ⟨_, HasDerivWithinAt.const_add⟩ := hasDerivWithinAt_const_add_iff
@[simp]
theorem hasDerivAt_const_add_iff (c : F) : HasDerivAt (c + f ·) f' x ↔ HasDerivAt f f' x :=
hasDerivAtFilter_const_add_iff c
alias ⟨_, HasDerivAt.const_add⟩ := hasDerivAt_const_add_iff
theorem derivWithin_const_add (c : F) :
derivWithin (c + f ·) s x = derivWithin f s x := by
simp only [derivWithin, fderivWithin_const_add]
@[simp]
theorem derivWithin_const_add_fun (c : F) :
derivWithin (c + f ·) = derivWithin f := by
ext
apply derivWithin_const_add
theorem deriv_const_add (c : F) : deriv (c + f ·) x = deriv f x := by
simp only [deriv, fderiv_const_add]
@[simp]
theorem deriv_const_add' (c : F) : (deriv (c + f ·)) = deriv f :=
funext fun _ ↦ deriv_const_add c
theorem deriv_const_add_id (c : 𝕜) : deriv (c + ·) x = 1 := by
rw [deriv_const_add c, deriv_id'']
@[simp]
theorem deriv_const_add_id' (c : 𝕜) : (deriv (c + ·)) = fun _ => 1 :=
funext fun _ ↦ deriv_const_add_id c
lemma differentiableAt_comp_add_const {a b : 𝕜} :
DifferentiableAt 𝕜 (fun x ↦ f (x + b)) a ↔ DifferentiableAt 𝕜 f (a + b) := by
grind [add_comm, differentiableAt_comp_add_left]
lemma differentiableAt_iff_comp_const_add {a b : 𝕜} :
DifferentiableAt 𝕜 f a ↔ DifferentiableAt 𝕜 (fun x ↦ f (b + x)) (-b + a) := by
simp [differentiableAt_comp_add_left]
lemma differentiableAt_iff_comp_add_const {a b : 𝕜} :
DifferentiableAt 𝕜 f a ↔ DifferentiableAt 𝕜 (fun x ↦ f (x + b)) (a - b) := by
simp [differentiableAt_comp_add_const]
end Add
section Sum
/-! ### Derivative of a finite sum of functions -/
variable {ι : Type*} {u : Finset ι} {A : ι → 𝕜 → F} {A' : ι → F}
theorem HasDerivAtFilter.fun_sum (h : ∀ i ∈ u, HasDerivAtFilter (A i) (A' i) L) :
HasDerivAtFilter (fun y ↦ ∑ i ∈ u, A i y) (∑ i ∈ u, A' i) L := by
simpa using (HasFDerivAtFilter.fun_sum h).hasDerivAtFilter
theorem HasDerivAtFilter.sum (h : ∀ i ∈ u, HasDerivAtFilter (A i) (A' i) L) :
HasDerivAtFilter (∑ i ∈ u, A i) (∑ i ∈ u, A' i) L := by
convert! HasDerivAtFilter.fun_sum h
simp
theorem HasStrictDerivAt.fun_sum (h : ∀ i ∈ u, HasStrictDerivAt (A i) (A' i) x) :
HasStrictDerivAt (fun y ↦ ∑ i ∈ u, A i y) (∑ i ∈ u, A' i) x :=
HasDerivAtFilter.fun_sum h
theorem HasStrictDerivAt.sum (h : ∀ i ∈ u, HasStrictDerivAt (A i) (A' i) x) :
HasStrictDerivAt (∑ i ∈ u, A i) (∑ i ∈ u, A' i) x :=
HasDerivAtFilter.sum h
theorem HasDerivWithinAt.fun_sum (h : ∀ i ∈ u, HasDerivWithinAt (A i) (A' i) s x) :
HasDerivWithinAt (fun y ↦ ∑ i ∈ u, A i y) (∑ i ∈ u, A' i) s x :=
HasDerivAtFilter.fun_sum h
theorem HasDerivWithinAt.sum (h : ∀ i ∈ u, HasDerivWithinAt (A i) (A' i) s x) :
HasDerivWithinAt (∑ i ∈ u, A i) (∑ i ∈ u, A' i) s x :=
HasDerivAtFilter.sum h
theorem HasDerivAt.fun_sum (h : ∀ i ∈ u, HasDerivAt (A i) (A' i) x) :
HasDerivAt (fun y ↦ ∑ i ∈ u, A i y) (∑ i ∈ u, A' i) x :=
HasDerivAtFilter.fun_sum h
theorem HasDerivAt.sum (h : ∀ i ∈ u, HasDerivAt (A i) (A' i) x) :
HasDerivAt (∑ i ∈ u, A i) (∑ i ∈ u, A' i) x :=
HasDerivAtFilter.sum h
theorem derivWithin_fun_sum (h : ∀ i ∈ u, DifferentiableWithinAt 𝕜 (A i) s x) :
derivWithin (fun y ↦ ∑ i ∈ u, A i y) s x = ∑ i ∈ u, derivWithin (A i) s x := by
by_cases hsx : UniqueDiffWithinAt 𝕜 s x
· exact (HasDerivWithinAt.fun_sum fun i hi ↦ (h i hi).hasDerivWithinAt).derivWithin hsx
· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
theorem derivWithin_sum (h : ∀ i ∈ u, DifferentiableWithinAt 𝕜 (A i) s x) :
derivWithin (∑ i ∈ u, A i) s x = ∑ i ∈ u, derivWithin (A i) s x := by
by_cases hsx : UniqueDiffWithinAt 𝕜 s x
· exact (HasDerivWithinAt.sum fun i hi ↦ (h i hi).hasDerivWithinAt).derivWithin hsx
· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
@[simp]
theorem deriv_fun_sum (h : ∀ i ∈ u, DifferentiableAt 𝕜 (A i) x) :
deriv (fun y ↦ ∑ i ∈ u, A i y) x = ∑ i ∈ u, deriv (A i) x :=
(HasDerivAt.fun_sum fun i hi ↦ (h i hi).hasDerivAt).deriv
@[simp]
theorem deriv_sum (h : ∀ i ∈ u, DifferentiableAt 𝕜 (A i) x) :
deriv (∑ i ∈ u, A i) x = ∑ i ∈ u, deriv (A i) x :=
(HasDerivAt.sum fun i hi ↦ (h i hi).hasDerivAt).deriv
end Sum
section Neg
/-! ### Derivative of the negative of a function -/
@[to_fun]
theorem HasDerivAtFilter.neg (h : HasDerivAtFilter f f' L) :
HasDerivAtFilter (-f) (-f') L := by simpa using (HasFDerivAtFilter.neg h).hasDerivAtFilter
@[to_fun]
theorem HasDerivWithinAt.neg (h : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (-f) (-f') s x :=
HasDerivAtFilter.neg h
@[to_fun]
theorem HasDerivAt.neg (h : HasDerivAt f f' x) : HasDerivAt (-f) (-f') x :=
HasDerivAtFilter.neg h
@[to_fun]
theorem HasStrictDerivAt.neg (h : HasStrictDerivAt f f' x) : HasStrictDerivAt (-f) (-f') x :=
HasDerivAtFilter.neg h
@[to_fun]
theorem derivWithin.neg : derivWithin (-f) s x = -derivWithin f s x := by
by_cases hsx : UniqueDiffWithinAt 𝕜 s x
· simp only [derivWithin, fderivWithin_neg hsx, neg_apply]
· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
@[to_fun]
theorem deriv.neg : deriv (-f) x = -deriv f x := by
simp only [deriv, fderiv_neg, neg_apply]
@[to_fun (attr := simp)]
theorem deriv.neg' : (deriv (-f)) = fun x ↦ -deriv f x :=
funext fun _ ↦ deriv.neg
end Neg
section Neg2
/-! ### Derivative of the negation function (i.e `Neg.neg`) -/
variable (s x L)
theorem hasDerivAtFilter_neg : HasDerivAtFilter Neg.neg (-1) L :=
HasDerivAtFilter.neg <| hasDerivAtFilter_id _
theorem hasDerivWithinAt_neg : HasDerivWithinAt Neg.neg (-1) s x :=
hasDerivAtFilter_neg _
theorem hasDerivAt_neg : HasDerivAt Neg.neg (-1) x :=
hasDerivAtFilter_neg _
theorem hasDerivAt_neg' : HasDerivAt (fun x ↦ -x) (-1) x :=
hasDerivAtFilter_neg _
theorem hasStrictDerivAt_neg : HasStrictDerivAt Neg.neg (-1) x :=
HasStrictDerivAt.neg <| hasStrictDerivAt_id _
theorem deriv_neg : deriv Neg.neg x = -1 :=
HasDerivAt.deriv (hasDerivAt_neg x)
@[simp]
theorem deriv_neg' : deriv (Neg.neg : 𝕜 → 𝕜) = fun _ ↦ -1 :=
funext deriv_neg
@[simp]
theorem deriv_neg'' : deriv (fun x : 𝕜 ↦ -x) x = -1 :=
deriv_neg x
theorem derivWithin_neg (hxs : UniqueDiffWithinAt 𝕜 s x) : derivWithin Neg.neg s x = -1 :=
(hasDerivWithinAt_neg x s).derivWithin hxs
theorem differentiable_neg : Differentiable 𝕜 (Neg.neg : 𝕜 → 𝕜) :=
Differentiable.neg differentiable_id
theorem differentiableOn_neg : DifferentiableOn 𝕜 (Neg.neg : 𝕜 → 𝕜) s :=
DifferentiableOn.neg differentiableOn_id
lemma differentiableAt_comp_neg {a : 𝕜} :
DifferentiableAt 𝕜 (fun x ↦ f (-x)) a ↔ DifferentiableAt 𝕜 f (-a) := by
refine ⟨fun H ↦ ?_, fun H ↦ H.comp a differentiable_neg.differentiableAt⟩
convert! ((neg_neg a).symm ▸ H).comp (-a) differentiable_neg.differentiableAt
ext
simp only [Function.comp_apply, neg_neg]
lemma differentiableAt_iff_comp_neg {a : 𝕜} :
DifferentiableAt 𝕜 f a ↔ DifferentiableAt 𝕜 (fun x ↦ f (-x)) (-a) := by
simp_rw [← differentiableAt_comp_neg, neg_neg]
end Neg2
section Sub
/-! ### Derivative of the difference of two functions -/
@[to_fun]
theorem HasDerivAtFilter.sub (hf : HasDerivAtFilter f f' L) (hg : HasDerivAtFilter g g' L) :
HasDerivAtFilter (f - g) (f' - g') L := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
@[to_fun]
theorem HasDerivWithinAt.sub (hf : HasDerivWithinAt f f' s x)
(hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (f - g) (f' - g') s x :=
HasDerivAtFilter.sub hf hg
@[to_fun]
theorem HasDerivAt.sub (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) :
HasDerivAt (f - g) (f' - g') x :=
HasDerivAtFilter.sub hf hg
@[to_fun]
theorem HasStrictDerivAt.sub (hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) :
HasStrictDerivAt (f - g) (f' - g') x :=
HasDerivAtFilter.sub hf hg
theorem derivWithin_fun_sub (hf : DifferentiableWithinAt 𝕜 f s x)
(hg : DifferentiableWithinAt 𝕜 g s x) :
derivWithin (fun y ↦ f y - g y) s x = derivWithin f s x - derivWithin g s x := by
simp only [sub_eq_add_neg, derivWithin_fun_add hf hg.fun_neg, derivWithin.fun_neg]
theorem derivWithin_sub (hf : DifferentiableWithinAt 𝕜 f s x)
(hg : DifferentiableWithinAt 𝕜 g s x) :
derivWithin (f - g) s x = derivWithin f s x - derivWithin g s x :=
derivWithin_fun_sub hf hg
@[simp]
theorem deriv_fun_sub (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) :
deriv (fun y ↦ f y - g y) x = deriv f x - deriv g x :=
(hf.hasDerivAt.sub hg.hasDerivAt).deriv
@[simp]
theorem deriv_sub (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) :
deriv (f - g) x = deriv f x - deriv g x :=
(hf.hasDerivAt.sub hg.hasDerivAt).deriv
@[simp]
theorem hasDerivAtFilter_sub_const_iff (c : F) :
HasDerivAtFilter (fun x ↦ f x - c) f' L ↔ HasDerivAtFilter f f' L :=
hasFDerivAtFilter_sub_const_iff c
alias ⟨_, HasDerivAtFilter.sub_const⟩ := hasDerivAtFilter_sub_const_iff
@[simp]
theorem hasDerivWithinAt_sub_const_iff (c : F) :
HasDerivWithinAt (f · - c) f' s x ↔ HasDerivWithinAt f f' s x :=
hasDerivAtFilter_sub_const_iff c
alias ⟨_, HasDerivWithinAt.sub_const⟩ := hasDerivWithinAt_sub_const_iff
@[simp]
theorem hasDerivAt_sub_const_iff (c : F) : HasDerivAt (f · - c) f' x ↔ HasDerivAt f f' x :=
hasDerivAtFilter_sub_const_iff c
alias ⟨_, HasDerivAt.sub_const⟩ := hasDerivAt_sub_const_iff
theorem derivWithin_sub_const (c : F) :
derivWithin (fun y ↦ f y - c) s x = derivWithin f s x := by
simp only [derivWithin, fderivWithin_sub_const]
@[simp]
theorem derivWithin_sub_const_fun (c : F) : derivWithin (f · - c) = derivWithin f := by
ext
apply derivWithin_sub_const
theorem deriv_sub_const (c : F) : deriv (fun y ↦ f y - c) x = deriv f x := by
simp only [deriv, fderiv_sub_const]
@[simp]
theorem deriv_sub_const_fun (c : F) : deriv (f · - c) = deriv f := by
ext
apply deriv_sub_const
theorem HasDerivAtFilter.const_sub (c : F) (hf : HasDerivAtFilter f f' L) :
HasDerivAtFilter (fun x ↦ c - f x) (-f') L := by
simpa only [sub_eq_add_neg] using! hf.neg.const_add c
theorem HasDerivWithinAt.const_sub (c : F) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (fun x ↦ c - f x) (-f') s x :=
HasDerivAtFilter.const_sub c hf
theorem HasStrictDerivAt.const_sub (c : F) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun x ↦ c - f x) (-f') x :=
HasDerivAtFilter.const_sub c hf
nonrec theorem HasDerivAt.const_sub (c : F) (hf : HasDerivAt f f' x) :
HasDerivAt (fun x ↦ c - f x) (-f') x :=
hf.const_sub c
theorem derivWithin_const_sub (c : F) :
derivWithin (fun y ↦ c - f y) s x = -derivWithin f s x := by
simp [sub_eq_add_neg, derivWithin.fun_neg]
theorem deriv_const_sub (c : F) : deriv (c - f ·) x = -deriv f x := by
simp only [← derivWithin_univ, derivWithin_const_sub]
@[simp]
theorem deriv_const_sub' (c : F) : deriv (c - f ·) = (-deriv f ·) :=
funext fun _ => deriv_const_sub c
theorem deriv_const_sub_id (c : 𝕜) : deriv (c - ·) x = -1 := by
rw [deriv_const_sub c, deriv_id'']
@[simp]
theorem deriv_const_sub_id' (c : 𝕜) : deriv (c - ·) = fun _ => -1 :=
funext fun _ => deriv_const_sub_id c
lemma differentiableAt_comp_sub_const {a b : 𝕜} :
DifferentiableAt 𝕜 (fun x ↦ f (x - b)) a ↔ DifferentiableAt 𝕜 f (a - b) := by
simp [sub_eq_add_neg, differentiableAt_comp_add_const]
lemma differentiableAt_comp_const_sub {a b : 𝕜} :
DifferentiableAt 𝕜 (fun x ↦ f (b - x)) a ↔ DifferentiableAt 𝕜 f (b - a) := by
refine ⟨fun H ↦ ?_, fun H ↦ H.comp a (differentiable_id.const_sub _).differentiableAt⟩
convert!
((sub_sub_cancel _ a).symm ▸ H).comp (b - a) (differentiable_id.const_sub _).differentiableAt
ext
simp
lemma differentiableAt_iff_comp_sub_const {a b : 𝕜} :
DifferentiableAt 𝕜 f a ↔ DifferentiableAt 𝕜 (fun x ↦ f (x - b)) (a + b) := by
simp [sub_eq_add_neg, differentiableAt_comp_add_const]
lemma differentiableAt_iff_comp_const_sub {a b : 𝕜} :
DifferentiableAt 𝕜 f a ↔ DifferentiableAt 𝕜 (fun x ↦ f (b - x)) (b - a) := by
simp [differentiableAt_comp_const_sub]
end Sub