@@ -171,16 +171,18 @@ def DifferentiableAt (f : E → F) (x : E) :=
171
171
∃ f' : E →L[𝕜] F, HasFDerivAt f f' x
172
172
173
173
/-- If `f` has a derivative at `x` within `s`, then `fderivWithin 𝕜 f s x` is such a derivative.
174
- Otherwise, it is set to `0`. If `x` is isolated in `s`, we take the derivative within `s` to
175
- be zero for convenience. -/
174
+ Otherwise, it is set to `0`. We also set it to be zero, if zero is one of possible derivatives. -/
176
175
irreducible_def fderivWithin (f : E → F) (s : Set E) (x : E) : E →L[𝕜] F :=
177
- if 𝓝[s \ {x}] x = ⊥ then 0 else
178
- if h : ∃ f', HasFDerivWithinAt f f' s x then Classical.choose h else 0
176
+ if HasFDerivWithinAt f (0 : E →L[𝕜] F) s x
177
+ then 0
178
+ else if h : DifferentiableWithinAt 𝕜 f s x
179
+ then Classical.choose h
180
+ else 0
179
181
180
182
/-- If `f` has a derivative at `x`, then `fderiv 𝕜 f x` is such a derivative. Otherwise, it is
181
183
set to `0`. -/
182
184
irreducible_def fderiv (f : E → F) (x : E) : E →L[𝕜] F :=
183
- if h : ∃ f', HasFDerivAt f f' x then Classical.choose h else 0
185
+ fderivWithin 𝕜 f univ x
184
186
185
187
/-- `DifferentiableOn 𝕜 f s` means that `f` is differentiable within `s` at any point of `s`. -/
186
188
@[fun_prop]
@@ -199,23 +201,14 @@ variable {x : E}
199
201
variable {s t : Set E}
200
202
variable {L L₁ L₂ : Filter E}
201
203
202
- theorem fderivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : fderivWithin 𝕜 f s x = 0 := by
203
- rw [fderivWithin, if_pos h]
204
-
205
- theorem fderivWithin_zero_of_nmem_closure (h : x ∉ closure s) : fderivWithin 𝕜 f s x = 0 := by
206
- apply fderivWithin_zero_of_isolated
207
- simp only [mem_closure_iff_nhdsWithin_neBot, neBot_iff, Ne, Classical.not_not] at h
208
- rw [eq_bot_iff, ← h]
209
- exact nhdsWithin_mono _ diff_subset
210
-
211
204
theorem fderivWithin_zero_of_not_differentiableWithinAt (h : ¬DifferentiableWithinAt 𝕜 f s x) :
212
205
fderivWithin 𝕜 f s x = 0 := by
213
- have : ¬∃ f', HasFDerivWithinAt f f' s x := h
214
- simp [fderivWithin, this]
206
+ simp [fderivWithin, h]
215
207
216
- theorem fderiv_zero_of_not_differentiableAt (h : ¬DifferentiableAt 𝕜 f x) : fderiv 𝕜 f x = 0 := by
217
- have : ¬∃ f', HasFDerivAt f f' x := h
218
- simp [fderiv, this]
208
+ @[simp]
209
+ theorem fderivWithin_univ : fderivWithin 𝕜 f univ = fderiv 𝕜 f := by
210
+ ext
211
+ rw [fderiv]
219
212
220
213
section DerivativeUniqueness
221
214
@@ -375,6 +368,14 @@ theorem hasFDerivWithinAt_univ : HasFDerivWithinAt f f' univ x ↔ HasFDerivAt f
375
368
376
369
alias ⟨HasFDerivWithinAt.hasFDerivAt_of_univ, _⟩ := hasFDerivWithinAt_univ
377
370
371
+ theorem differentiableWithinAt_univ :
372
+ DifferentiableWithinAt 𝕜 f univ x ↔ DifferentiableAt 𝕜 f x := by
373
+ simp only [DifferentiableWithinAt, hasFDerivWithinAt_univ, DifferentiableAt]
374
+
375
+ theorem fderiv_zero_of_not_differentiableAt (h : ¬DifferentiableAt 𝕜 f x) : fderiv 𝕜 f x = 0 := by
376
+ rw [fderiv, fderivWithin_zero_of_not_differentiableWithinAt]
377
+ rwa [differentiableWithinAt_univ]
378
+
378
379
theorem hasFDerivWithinAt_of_mem_nhds (h : s ∈ 𝓝 x) :
379
380
HasFDerivWithinAt f f' s x ↔ HasFDerivAt f f' x := by
380
381
rw [HasFDerivAt, HasFDerivWithinAt, nhdsWithin_eq_nhds.mpr h]
@@ -486,19 +487,23 @@ theorem hasFDerivWithinAt_of_nmem_closure (h : x ∉ closure s) : HasFDerivWithi
486
487
.of_nhdsWithin_eq_bot <| eq_bot_mono (nhdsWithin_mono _ diff_subset) <| by
487
488
rwa [mem_closure_iff_nhdsWithin_neBot, not_neBot] at h
488
489
490
+ theorem fderivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : fderivWithin 𝕜 f s x = 0 := by
491
+ rw [fderivWithin, if_pos (.of_nhdsWithin_eq_bot h)]
492
+
493
+ theorem fderivWithin_zero_of_nmem_closure (h : x ∉ closure s) : fderivWithin 𝕜 f s x = 0 := by
494
+ rw [fderivWithin, if_pos (hasFDerivWithinAt_of_nmem_closure h)]
495
+
489
496
theorem DifferentiableWithinAt.hasFDerivWithinAt (h : DifferentiableWithinAt 𝕜 f s x) :
490
497
HasFDerivWithinAt f (fderivWithin 𝕜 f s x) s x := by
491
- by_cases H : 𝓝[s \ {x}] x = ⊥
492
- · exact .of_nhdsWithin_eq_bot H
493
- · unfold DifferentiableWithinAt at h
494
- rw [fderivWithin, if_neg H, dif_pos h]
495
- exact Classical.choose_spec h
498
+ simp only [fderivWithin, dif_pos h]
499
+ split_ifs with h₀
500
+ exacts [h₀, Classical.choose_spec h]
496
501
497
502
theorem DifferentiableAt.hasFDerivAt (h : DifferentiableAt 𝕜 f x) :
498
503
HasFDerivAt f (fderiv 𝕜 f x) x := by
499
- dsimp only [DifferentiableAt] at h
500
- rw [fderiv, dif_pos h]
501
- exact Classical.choose_spec h
504
+ rw [fderiv, ← hasFDerivWithinAt_univ]
505
+ rw [← differentiableWithinAt_univ] at h
506
+ exact h.hasFDerivWithinAt
502
507
503
508
theorem DifferentiableOn.hasFDerivAt (h : DifferentiableOn 𝕜 f s) (hs : s ∈ 𝓝 x) :
504
509
HasFDerivAt f (fderiv 𝕜 f x) x :=
@@ -575,10 +580,6 @@ theorem differentiableWithinAt_congr_nhds {t : Set E} (hst : 𝓝[s] x = 𝓝[t]
575
580
DifferentiableWithinAt 𝕜 f s x ↔ DifferentiableWithinAt 𝕜 f t x :=
576
581
⟨fun h => h.congr_nhds hst, fun h => h.congr_nhds hst.symm⟩
577
582
578
- theorem differentiableWithinAt_univ :
579
- DifferentiableWithinAt 𝕜 f univ x ↔ DifferentiableAt 𝕜 f x := by
580
- simp only [DifferentiableWithinAt, hasFDerivWithinAt_univ, DifferentiableAt]
581
-
582
583
theorem differentiableWithinAt_inter (ht : t ∈ 𝓝 x) :
583
584
DifferentiableWithinAt 𝕜 f (s ∩ t) x ↔ DifferentiableWithinAt 𝕜 f s x := by
584
585
simp only [DifferentiableWithinAt, hasFDerivWithinAt_inter ht]
@@ -647,19 +648,7 @@ theorem fderivWithin_subset (st : s ⊆ t) (ht : UniqueDiffWithinAt 𝕜 s x)
647
648
fderivWithin_of_mem_nhdsWithin (nhdsWithin_mono _ st self_mem_nhdsWithin) ht h
648
649
649
650
theorem fderivWithin_inter (ht : t ∈ 𝓝 x) : fderivWithin 𝕜 f (s ∩ t) x = fderivWithin 𝕜 f s x := by
650
- have A : 𝓝[(s ∩ t) \ {x}] x = 𝓝[s \ {x}] x := by
651
- have : (s ∩ t) \ {x} = (s \ {x}) ∩ t := by rw [inter_comm, inter_diff_assoc, inter_comm]
652
- rw [this, ← nhdsWithin_restrict' _ ht]
653
- simp [fderivWithin, A, hasFDerivWithinAt_inter ht]
654
-
655
- @[simp]
656
- theorem fderivWithin_univ : fderivWithin 𝕜 f univ = fderiv 𝕜 f := by
657
- ext1 x
658
- nontriviality E
659
- have H : 𝓝[univ \ {x}] x ≠ ⊥ := by
660
- rw [← compl_eq_univ_diff, ← neBot_iff]
661
- exact Module.punctured_nhds_neBot 𝕜 E x
662
- simp [fderivWithin, fderiv, H]
651
+ simp [fderivWithin, hasFDerivWithinAt_inter ht, DifferentiableWithinAt]
663
652
664
653
theorem fderivWithin_of_mem_nhds (h : s ∈ 𝓝 x) : fderivWithin 𝕜 f s x = fderiv 𝕜 f x := by
665
654
rw [← fderivWithin_univ, ← univ_inter s, fderivWithin_inter h]
@@ -803,11 +792,7 @@ theorem differentiableWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) :
803
792
804
793
theorem fderivWithin_congr_set' (y : E) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) :
805
794
fderivWithin 𝕜 f s x = fderivWithin 𝕜 f t x := by
806
- have : s =ᶠ[𝓝[{x}ᶜ] x] t := nhdsWithin_compl_singleton_le x y h
807
- have : 𝓝[s \ {x}] x = 𝓝[t \ {x}] x := by
808
- simpa only [set_eventuallyEq_iff_inf_principal, ← nhdsWithin_inter', diff_eq,
809
- inter_comm] using this
810
- simp only [fderivWithin, hasFDerivWithinAt_congr_set' y h, this]
795
+ simp only [fderivWithin, differentiableWithinAt_congr_set' _ h, hasFDerivWithinAt_congr_set' _ h]
811
796
812
797
theorem fderivWithin_congr_set (h : s =ᶠ[𝓝 x] t) : fderivWithin 𝕜 f s x = fderivWithin 𝕜 f t x :=
813
798
fderivWithin_congr_set' x <| h.filter_mono inf_le_left
@@ -937,7 +922,7 @@ theorem DifferentiableWithinAt.fderivWithin_congr_mono (h : DifferentiableWithin
937
922
938
923
theorem Filter.EventuallyEq.fderivWithin_eq (hs : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) :
939
924
fderivWithin 𝕜 f₁ s x = fderivWithin 𝕜 f s x := by
940
- simp only [fderivWithin, hs.hasFDerivWithinAt_iff hx]
925
+ simp only [fderivWithin, DifferentiableWithinAt, hs.hasFDerivWithinAt_iff hx]
941
926
942
927
theorem Filter.EventuallyEq.fderivWithin_eq_of_mem (hs : f₁ =ᶠ[𝓝[s] x] f) (hx : x ∈ s) :
943
928
fderivWithin 𝕜 f₁ s x = fderivWithin 𝕜 f s x :=
@@ -1068,19 +1053,21 @@ theorem differentiableAt_const (c : F) : DifferentiableAt 𝕜 (fun _ => c) x :=
1068
1053
theorem differentiableWithinAt_const (c : F) : DifferentiableWithinAt 𝕜 (fun _ => c) s x :=
1069
1054
DifferentiableAt.differentiableWithinAt (differentiableAt_const _)
1070
1055
1056
+ theorem fderivWithin_const_apply (c : F) : fderivWithin 𝕜 (fun _ => c) s x = 0 := by
1057
+ rw [fderivWithin, if_pos]
1058
+ apply hasFDerivWithinAt_const
1059
+
1060
+ @[simp]
1061
+ theorem fderivWithin_const (c : F) : fderivWithin 𝕜 (fun _ ↦ c) s = 0 := by
1062
+ ext
1063
+ rw [fderivWithin_const_apply, Pi.zero_apply]
1064
+
1071
1065
theorem fderiv_const_apply (c : F) : fderiv 𝕜 (fun _ => c) x = 0 :=
1072
- HasFDerivAt.fderiv (hasFDerivAt_const c x)
1066
+ (hasFDerivAt_const c x).fderiv
1073
1067
1074
1068
@[simp]
1075
1069
theorem fderiv_const (c : F) : (fderiv 𝕜 fun _ : E => c) = 0 := by
1076
- ext m
1077
- rw [fderiv_const_apply]
1078
- rfl
1079
-
1080
- theorem fderivWithin_const_apply (c : F) (hxs : UniqueDiffWithinAt 𝕜 s x) :
1081
- fderivWithin 𝕜 (fun _ => c) s x = 0 := by
1082
- rw [DifferentiableAt.fderivWithin (differentiableAt_const _) hxs]
1083
- exact fderiv_const_apply _
1070
+ rw [← fderivWithin_univ, fderivWithin_const]
1084
1071
1085
1072
@[simp, fun_prop]
1086
1073
theorem differentiable_const (c : F) : Differentiable 𝕜 fun _ : E => c := fun _ =>
0 commit comments