analysis.calculus.local_extr
⟷
Mathlib.Topology.Algebra.Order.Rolle
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Analysis.Calculus.Deriv.Polynomial
-import Topology.Algebra.Order.ExtendFrom
+import Topology.Order.ExtendFrom
import Topology.Algebra.Polynomial
#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"f60c6087a7275b72d5db3c5a1d0e19e35a429c0a"
@@ -118,7 +118,7 @@ theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segmen
#print mem_posTangentConeAt_of_segment_subset' /-
theorem mem_posTangentConeAt_of_segment_subset' {s : Set E} {x y : E}
(h : segment ℝ x (x + y) ⊆ s) : y ∈ posTangentConeAt s x := by
- simpa only [add_sub_cancel'] using mem_posTangentConeAt_of_segment_subset h
+ simpa only [add_sub_cancel_left] using mem_posTangentConeAt_of_segment_subset h
#align mem_pos_tangent_cone_at_of_segment_subset' mem_posTangentConeAt_of_segment_subset'
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -142,7 +142,7 @@ theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s
exact
tendsto_inf.2
⟨tendsto_const_nhds.add (tangentConeAt.lim_zero _ hc' hcd), by rwa [tendsto_principal]⟩
- rw [add_zero] at hd
+ rw [add_zero] at hd
replace h : ∀ᶠ n in at_top, f (a + d n) ≤ f a; exact mem_map.1 (hd h)
replace hc : ∀ᶠ n in at_top, 0 ≤ c n; exact mem_map.1 (hc (mem_at_top (0 : ℝ)))
filter_upwards [h, hc]
@@ -423,7 +423,7 @@ theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l
show ∃ c ∈ Ioo a b, deriv f c = 0 from
exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).HasDerivAt)
fun h : ¬∀ x ∈ Ioo a b, DifferentiableAt ℝ f x =>
- have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h ; exact h
+ have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h; exact h
let ⟨c, hc, hcdiff⟩ := h
⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
#align exists_deriv_eq_zero' exists_deriv_eq_zero'
@@ -446,7 +446,7 @@ theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]
exact zero_le _
have hp : p ≠ 0 := ne_of_apply_ne derivative (by rwa [derivative_zero])
refine' Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => _
- rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
+ rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
obtain ⟨z, hz1, hz2⟩ :=
exists_deriv_eq_zero (fun x : ℝ => eval x p) hxy p.continuous_on (hx.trans hy.symm)
refine' ⟨z, _, hz1⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2019 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
-import Mathbin.Analysis.Calculus.Deriv.Polynomial
-import Mathbin.Topology.Algebra.Order.ExtendFrom
-import Mathbin.Topology.Algebra.Polynomial
+import Analysis.Calculus.Deriv.Polynomial
+import Topology.Algebra.Order.ExtendFrom
+import Topology.Algebra.Polynomial
#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"f60c6087a7275b72d5db3c5a1d0e19e35a429c0a"
mathlib commit https://github.com/leanprover-community/mathlib/commit/d11f435d4e34a6cea0a1797d6b625b0c170be845
@@ -359,21 +359,21 @@ theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (h
#align exists_Ioo_extr_on_Icc exists_Ioo_extr_on_Icc
-/
-#print exists_local_extr_Ioo /-
+#print exists_isLocalExtr_Ioo /-
/-- A continuous function on a closed interval with `f a = f b` has a local extremum at some
point of the corresponding open interval. -/
-theorem exists_local_extr_Ioo (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
+theorem exists_isLocalExtr_Ioo (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
∃ c ∈ Ioo a b, IsLocalExtr f c :=
let ⟨c, cmem, hc⟩ := exists_Ioo_extr_on_Icc f hab hfc hfI
⟨c, cmem, hc.IsLocalExtr <| Icc_mem_nhds cmem.1 cmem.2⟩
-#align exists_local_extr_Ioo exists_local_extr_Ioo
+#align exists_local_extr_Ioo exists_isLocalExtr_Ioo
-/
#print exists_hasDerivAt_eq_zero /-
/-- **Rolle's Theorem** `has_deriv_at` version -/
theorem exists_hasDerivAt_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b)
(hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) : ∃ c ∈ Ioo a b, f' c = 0 :=
- let ⟨c, cmem, hc⟩ := exists_local_extr_Ioo f hab hfc hfI
+ let ⟨c, cmem, hc⟩ := exists_isLocalExtr_Ioo f hab hfc hfI
⟨c, cmem, hc.hasDerivAt_eq_zero <| hff' c cmem⟩
#align exists_has_deriv_at_eq_zero exists_hasDerivAt_eq_zero
-/
@@ -382,7 +382,7 @@ theorem exists_hasDerivAt_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b))
/-- **Rolle's Theorem** `deriv` version -/
theorem exists_deriv_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
∃ c ∈ Ioo a b, deriv f c = 0 :=
- let ⟨c, cmem, hc⟩ := exists_local_extr_Ioo f hab hfc hfI
+ let ⟨c, cmem, hc⟩ := exists_isLocalExtr_Ioo f hab hfc hfI
⟨c, cmem, hc.deriv_eq_zero⟩
#align exists_deriv_eq_zero exists_deriv_eq_zero
-/
@@ -401,7 +401,7 @@ theorem exists_hasDerivAt_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (
have hcont := continuousOn_Icc_extendFrom_Ioo hab.ne this hfa hfb
obtain ⟨c, hc, hcextr⟩ : ∃ c ∈ Ioo a b, IsLocalExtr (extendFrom (Ioo a b) f) c :=
by
- apply exists_local_extr_Ioo _ hab hcont
+ apply exists_isLocalExtr_Ioo _ hab hcont
rw [eq_lim_at_right_extendFrom_Ioo hab hfb]
exact eq_lim_at_left_extendFrom_Ioo hab hfa
use c, hc
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2019 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-
-! This file was ported from Lean 3 source module analysis.calculus.local_extr
-! leanprover-community/mathlib commit f60c6087a7275b72d5db3c5a1d0e19e35a429c0a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Analysis.Calculus.Deriv.Polynomial
import Mathbin.Topology.Algebra.Order.ExtendFrom
import Mathbin.Topology.Algebra.Polynomial
+#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"f60c6087a7275b72d5db3c5a1d0e19e35a429c0a"
+
/-!
# Local extrema of smooth functions
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -91,12 +91,15 @@ def posTangentConeAt (s : Set E) (x : E) : Set E :=
#align pos_tangent_cone_at posTangentConeAt
-/
+#print posTangentConeAt_mono /-
theorem posTangentConeAt_mono : Monotone fun s => posTangentConeAt s a :=
by
rintro s t hst y ⟨c, d, hd, hc, hcd⟩
exact ⟨c, d, mem_of_superset hd fun h hn => hst hn, hc, hcd⟩
#align pos_tangent_cone_at_mono posTangentConeAt_mono
+-/
+#print mem_posTangentConeAt_of_segment_subset /-
theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segment ℝ x y ⊆ s) :
y - x ∈ posTangentConeAt s x :=
by
@@ -113,11 +116,14 @@ theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segmen
rw [mul_inv_cancel, one_smul]
exact pow_ne_zero _ two_ne_zero
#align mem_pos_tangent_cone_at_of_segment_subset mem_posTangentConeAt_of_segment_subset
+-/
+#print mem_posTangentConeAt_of_segment_subset' /-
theorem mem_posTangentConeAt_of_segment_subset' {s : Set E} {x y : E}
(h : segment ℝ x (x + y) ⊆ s) : y ∈ posTangentConeAt s x := by
simpa only [add_sub_cancel'] using mem_posTangentConeAt_of_segment_subset h
#align mem_pos_tangent_cone_at_of_segment_subset' mem_posTangentConeAt_of_segment_subset'
+-/
#print posTangentConeAt_univ /-
theorem posTangentConeAt_univ : posTangentConeAt univ a = univ :=
@@ -125,6 +131,7 @@ theorem posTangentConeAt_univ : posTangentConeAt univ a = univ :=
#align pos_tangent_cone_at_univ posTangentConeAt_univ
-/
+#print IsLocalMaxOn.hasFDerivWithinAt_nonpos /-
/-- If `f` has a local max on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s a)
@@ -146,7 +153,9 @@ theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s
intro n hnf hn
exact mul_nonpos_of_nonneg_of_nonpos hn (sub_nonpos.2 hnf)
#align is_local_max_on.has_fderiv_within_at_nonpos IsLocalMaxOn.hasFDerivWithinAt_nonpos
+-/
+#print IsLocalMaxOn.fderivWithin_nonpos /-
/-- If `f` has a local max on `s` at `a` and `y` belongs to the positive tangent cone
of `s` at `a`, then `f' y ≤ 0`. -/
theorem IsLocalMaxOn.fderivWithin_nonpos {s : Set E} (h : IsLocalMaxOn f s a) {y}
@@ -154,7 +163,9 @@ theorem IsLocalMaxOn.fderivWithin_nonpos {s : Set E} (h : IsLocalMaxOn f s a) {y
if hf : DifferentiableWithinAt ℝ f s a then h.hasFDerivWithinAt_nonpos hf.HasFDerivWithinAt hy
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_max_on.fderiv_within_nonpos IsLocalMaxOn.fderivWithin_nonpos
+-/
+#print IsLocalMaxOn.hasFDerivWithinAt_eq_zero /-
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
both `y` and `-y` belong to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
theorem IsLocalMaxOn.hasFDerivWithinAt_eq_zero {s : Set E} (h : IsLocalMaxOn f s a)
@@ -163,7 +174,9 @@ theorem IsLocalMaxOn.hasFDerivWithinAt_eq_zero {s : Set E} (h : IsLocalMaxOn f s
le_antisymm (h.hasFDerivWithinAt_nonpos hf hy) <| by
simpa using h.has_fderiv_within_at_nonpos hf hy'
#align is_local_max_on.has_fderiv_within_at_eq_zero IsLocalMaxOn.hasFDerivWithinAt_eq_zero
+-/
+#print IsLocalMaxOn.fderivWithin_eq_zero /-
/-- If `f` has a local max on `s` at `a` and both `y` and `-y` belong to the positive tangent cone
of `s` at `a`, then `f' y = 0`. -/
theorem IsLocalMaxOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMaxOn f s a) {y}
@@ -173,14 +186,18 @@ theorem IsLocalMaxOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMaxOn f s a) {
h.hasFDerivWithinAt_eq_zero hf.HasFDerivWithinAt hy hy'
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_max_on.fderiv_within_eq_zero IsLocalMaxOn.fderivWithin_eq_zero
+-/
+#print IsLocalMinOn.hasFDerivWithinAt_nonneg /-
/-- If `f` has a local min on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `0 ≤ f' y`. -/
theorem IsLocalMinOn.hasFDerivWithinAt_nonneg {s : Set E} (h : IsLocalMinOn f s a)
(hf : HasFDerivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a) : 0 ≤ f' y := by
simpa using h.neg.has_fderiv_within_at_nonpos hf.neg hy
#align is_local_min_on.has_fderiv_within_at_nonneg IsLocalMinOn.hasFDerivWithinAt_nonneg
+-/
+#print IsLocalMinOn.fderivWithin_nonneg /-
/-- If `f` has a local min on `s` at `a` and `y` belongs to the positive tangent cone
of `s` at `a`, then `0 ≤ f' y`. -/
theorem IsLocalMinOn.fderivWithin_nonneg {s : Set E} (h : IsLocalMinOn f s a) {y}
@@ -188,7 +205,9 @@ theorem IsLocalMinOn.fderivWithin_nonneg {s : Set E} (h : IsLocalMinOn f s a) {y
if hf : DifferentiableWithinAt ℝ f s a then h.hasFDerivWithinAt_nonneg hf.HasFDerivWithinAt hy
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_min_on.fderiv_within_nonneg IsLocalMinOn.fderivWithin_nonneg
+-/
+#print IsLocalMinOn.hasFDerivWithinAt_eq_zero /-
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
both `y` and `-y` belong to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
theorem IsLocalMinOn.hasFDerivWithinAt_eq_zero {s : Set E} (h : IsLocalMinOn f s a)
@@ -196,7 +215,9 @@ theorem IsLocalMinOn.hasFDerivWithinAt_eq_zero {s : Set E} (h : IsLocalMinOn f s
(hy' : -y ∈ posTangentConeAt s a) : f' y = 0 := by
simpa using h.neg.has_fderiv_within_at_eq_zero hf.neg hy hy'
#align is_local_min_on.has_fderiv_within_at_eq_zero IsLocalMinOn.hasFDerivWithinAt_eq_zero
+-/
+#print IsLocalMinOn.fderivWithin_eq_zero /-
/-- If `f` has a local min on `s` at `a` and both `y` and `-y` belong to the positive tangent cone
of `s` at `a`, then `f' y = 0`. -/
theorem IsLocalMinOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMinOn f s a) {y}
@@ -206,6 +227,7 @@ theorem IsLocalMinOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMinOn f s a) {
h.hasFDerivWithinAt_eq_zero hf.HasFDerivWithinAt hy hy'
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_min_on.fderiv_within_eq_zero IsLocalMinOn.fderivWithin_eq_zero
+-/
#print IsLocalMin.hasFDerivAt_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
@@ -261,38 +283,50 @@ section Real
variable {f : ℝ → ℝ} {f' : ℝ} {a b : ℝ}
+#print IsLocalMin.hasDerivAt_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.hasDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasDerivAt f f' a) : f' = 0 := by
simpa using
ContinuousLinearMap.ext_iff.1 (h.has_fderiv_at_eq_zero (hasDerivAt_iff_hasFDerivAt.1 hf)) 1
#align is_local_min.has_deriv_at_eq_zero IsLocalMin.hasDerivAt_eq_zero
+-/
+#print IsLocalMin.deriv_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.deriv_eq_zero (h : IsLocalMin f a) : deriv f a = 0 :=
if hf : DifferentiableAt ℝ f a then h.hasDerivAt_eq_zero hf.HasDerivAt
else deriv_zero_of_not_differentiableAt hf
#align is_local_min.deriv_eq_zero IsLocalMin.deriv_eq_zero
+-/
+#print IsLocalMax.hasDerivAt_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.hasDerivAt_eq_zero (h : IsLocalMax f a) (hf : HasDerivAt f f' a) : f' = 0 :=
neg_eq_zero.1 <| h.neg.hasDerivAt_eq_zero hf.neg
#align is_local_max.has_deriv_at_eq_zero IsLocalMax.hasDerivAt_eq_zero
+-/
+#print IsLocalMax.deriv_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.deriv_eq_zero (h : IsLocalMax f a) : deriv f a = 0 :=
if hf : DifferentiableAt ℝ f a then h.hasDerivAt_eq_zero hf.HasDerivAt
else deriv_zero_of_not_differentiableAt hf
#align is_local_max.deriv_eq_zero IsLocalMax.deriv_eq_zero
+-/
+#print IsLocalExtr.hasDerivAt_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.hasDerivAt_eq_zero (h : IsLocalExtr f a) : HasDerivAt f f' a → f' = 0 :=
h.elim IsLocalMin.hasDerivAt_eq_zero IsLocalMax.hasDerivAt_eq_zero
#align is_local_extr.has_deriv_at_eq_zero IsLocalExtr.hasDerivAt_eq_zero
+-/
+#print IsLocalExtr.deriv_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.deriv_eq_zero (h : IsLocalExtr f a) : deriv f a = 0 :=
h.elim IsLocalMin.deriv_eq_zero IsLocalMax.deriv_eq_zero
#align is_local_extr.deriv_eq_zero IsLocalExtr.deriv_eq_zero
+-/
end Real
@@ -300,6 +334,7 @@ section Rolle
variable (f f' : ℝ → ℝ) {a b : ℝ}
+#print exists_Ioo_extr_on_Icc /-
/-- A continuous function on a closed interval with `f a = f b` takes either its maximum
or its minimum value at a point in the interior of the interval. -/
theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
@@ -325,7 +360,9 @@ theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (h
· refine' ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt _ hc, lt_of_le_of_ne cmem.2 <| mt _ hc⟩, Or.inl cle⟩
exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
#align exists_Ioo_extr_on_Icc exists_Ioo_extr_on_Icc
+-/
+#print exists_local_extr_Ioo /-
/-- A continuous function on a closed interval with `f a = f b` has a local extremum at some
point of the corresponding open interval. -/
theorem exists_local_extr_Ioo (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
@@ -333,23 +370,29 @@ theorem exists_local_extr_Ioo (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hf
let ⟨c, cmem, hc⟩ := exists_Ioo_extr_on_Icc f hab hfc hfI
⟨c, cmem, hc.IsLocalExtr <| Icc_mem_nhds cmem.1 cmem.2⟩
#align exists_local_extr_Ioo exists_local_extr_Ioo
+-/
+#print exists_hasDerivAt_eq_zero /-
/-- **Rolle's Theorem** `has_deriv_at` version -/
theorem exists_hasDerivAt_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b)
(hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) : ∃ c ∈ Ioo a b, f' c = 0 :=
let ⟨c, cmem, hc⟩ := exists_local_extr_Ioo f hab hfc hfI
⟨c, cmem, hc.hasDerivAt_eq_zero <| hff' c cmem⟩
#align exists_has_deriv_at_eq_zero exists_hasDerivAt_eq_zero
+-/
+#print exists_deriv_eq_zero /-
/-- **Rolle's Theorem** `deriv` version -/
theorem exists_deriv_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
∃ c ∈ Ioo a b, deriv f c = 0 :=
let ⟨c, cmem, hc⟩ := exists_local_extr_Ioo f hab hfc hfI
⟨c, cmem, hc.deriv_eq_zero⟩
#align exists_deriv_eq_zero exists_deriv_eq_zero
+-/
variable {f f'} {l : ℝ}
+#print exists_hasDerivAt_eq_zero' /-
/-- **Rolle's Theorem**, a version for a function on an open interval: if `f` has derivative `f'`
on `(a, b)` and has the same limit `l` at `𝓝[>] a` and `𝓝[<] b`, then `f' c = 0`
for some `c ∈ (a, b)`. -/
@@ -369,7 +412,9 @@ theorem exists_hasDerivAt_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (
rw [eventually_eq_iff_exists_mem]
exact ⟨Ioo a b, Ioo_mem_nhds hc.1 hc.2, extendFrom_extends this⟩
#align exists_has_deriv_at_eq_zero' exists_hasDerivAt_eq_zero'
+-/
+#print exists_deriv_eq_zero' /-
/-- **Rolle's Theorem**, a version for a function on an open interval: if `f` has the same limit
`l` at `𝓝[>] a` and `𝓝[<] b`, then `deriv f c = 0` for some `c ∈ (a, b)`. This version
does not require differentiability of `f` because we define `deriv f c = 0` whenever `f` is not
@@ -385,6 +430,7 @@ theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l
let ⟨c, hc, hcdiff⟩ := h
⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
#align exists_deriv_eq_zero' exists_deriv_eq_zero'
+-/
end Rolle
@@ -392,6 +438,7 @@ namespace Polynomial
open scoped BigOperators
+#print Polynomial.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ /-
/-- The number of roots of a real polynomial `p` is at most the number of roots of its derivative
that are not roots of `p` plus one. -/
theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]) :
@@ -408,7 +455,9 @@ theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]
refine' ⟨z, _, hz1⟩
rwa [Multiset.mem_toFinset, mem_roots hp', is_root, ← p.deriv]
#align polynomial.card_roots_to_finset_le_card_roots_derivative_diff_roots_succ Polynomial.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ
+-/
+#print Polynomial.card_roots_toFinset_le_derivative /-
/-- The number of roots of a real polynomial is at most the number of roots of its derivative plus
one. -/
theorem card_roots_toFinset_le_derivative (p : ℝ[X]) :
@@ -416,7 +465,9 @@ theorem card_roots_toFinset_le_derivative (p : ℝ[X]) :
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ.trans <|
add_le_add_right (Finset.card_mono <| Finset.sdiff_subset _ _) _
#align polynomial.card_roots_to_finset_le_derivative Polynomial.card_roots_toFinset_le_derivative
+-/
+#print Polynomial.card_roots_le_derivative /-
/-- The number of roots of a real polynomial (counted with multiplicities) is at most the number of
roots of its derivative (counted with multiplicities) plus one. -/
theorem card_roots_le_derivative (p : ℝ[X]) : p.roots.card ≤ p.derivative.roots.card + 1 :=
@@ -452,7 +503,9 @@ theorem card_roots_le_derivative (p : ℝ[X]) : p.roots.card ≤ p.derivative.ro
intro x hx₁ hx₂
simpa only [Multiset.mem_toFinset, Multiset.count_eq_zero] using hx₂
#align polynomial.card_roots_le_derivative Polynomial.card_roots_le_derivative
+-/
+#print Polynomial.card_rootSet_le_derivative /-
/-- The number of real roots of a polynomial is at most the number of roots of its derivative plus
one. -/
theorem card_rootSet_le_derivative {F : Type _} [CommRing F] [Algebra F ℝ] (p : F[X]) :
@@ -460,6 +513,7 @@ theorem card_rootSet_le_derivative {F : Type _} [CommRing F] [Algebra F ℝ] (p
simpa only [root_set_def, Finset.coe_sort_coe, Fintype.card_coe, derivative_map] using
card_roots_to_finset_le_derivative (p.map (algebraMap F ℝ))
#align polynomial.card_root_set_le_derivative Polynomial.card_rootSet_le_derivative
+-/
end Polynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -423,23 +423,22 @@ theorem card_roots_le_derivative (p : ℝ[X]) : p.roots.card ≤ p.derivative.ro
calc
p.roots.card = ∑ x in p.roots.toFinset, p.roots.count x :=
(Multiset.toFinset_sum_count_eq _).symm
- _ = ∑ x in p.roots.toFinset, p.roots.count x - 1 + 1 :=
+ _ = ∑ x in p.roots.toFinset, (p.roots.count x - 1 + 1) :=
(Eq.symm <|
Finset.sum_congr rfl fun x hx =>
tsub_add_cancel_of_le <|
Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx)
- _ = (∑ x in p.roots.toFinset, p.rootMultiplicity x - 1) + p.roots.toFinset.card := by
+ _ = ∑ x in p.roots.toFinset, (p.rootMultiplicity x - 1) + p.roots.toFinset.card := by
simp only [Finset.sum_add_distrib, Finset.card_eq_sum_ones, count_roots]
_ ≤
- (∑ x in p.roots.toFinset, p.derivative.rootMultiplicity x) +
+ ∑ x in p.roots.toFinset, p.derivative.rootMultiplicity x +
((p.derivative.roots.toFinset \ p.roots.toFinset).card + 1) :=
(add_le_add
(Finset.sum_le_sum fun x hx => rootMultiplicity_sub_one_le_derivative_rootMultiplicity _ _)
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ)
_ ≤
- (∑ x in p.roots.toFinset, p.derivative.roots.count x) +
- ((∑ x in p.derivative.roots.toFinset \ p.roots.toFinset, p.derivative.roots.count x) +
- 1) :=
+ ∑ x in p.roots.toFinset, p.derivative.roots.count x +
+ (∑ x in p.derivative.roots.toFinset \ p.roots.toFinset, p.derivative.roots.count x + 1) :=
by
simp only [← count_roots]
refine' add_le_add_left (add_le_add_right ((Finset.card_eq_sum_ones _).trans_le _) _) _
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -452,7 +452,6 @@ theorem card_roots_le_derivative (p : ℝ[X]) : p.roots.card ≤ p.derivative.ro
Multiset.toFinset_sum_count_eq, ← Finset.sum_subset (Finset.subset_union_right _ _)]
intro x hx₁ hx₂
simpa only [Multiset.mem_toFinset, Multiset.count_eq_zero] using hx₂
-
#align polynomial.card_roots_le_derivative Polynomial.card_roots_le_derivative
/-- The number of real roots of a polynomial is at most the number of roots of its derivative plus
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -84,10 +84,10 @@ variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → ℝ}
is that we require `c n → ∞` instead of `‖c n‖ → ∞`. One can think about `pos_tangent_cone_at`
as `tangent_cone_at nnreal` but we have no theory of normed semifields yet. -/
def posTangentConeAt (s : Set E) (x : E) : Set E :=
- { y : E |
+ {y : E |
∃ (c : ℕ → ℝ) (d : ℕ → E),
(∀ᶠ n in atTop, x + d n ∈ s) ∧
- Tendsto c atTop atTop ∧ Tendsto (fun n => c n • d n) atTop (𝓝 y) }
+ Tendsto c atTop atTop ∧ Tendsto (fun n => c n • d n) atTop (𝓝 y)}
#align pos_tangent_cone_at posTangentConeAt
-/
@@ -381,7 +381,7 @@ theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l
show ∃ c ∈ Ioo a b, deriv f c = 0 from
exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).HasDerivAt)
fun h : ¬∀ x ∈ Ioo a b, DifferentiableAt ℝ f x =>
- have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h ; exact h
+ have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h ; exact h
let ⟨c, hc, hcdiff⟩ := h
⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
#align exists_deriv_eq_zero' exists_deriv_eq_zero'
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -85,7 +85,7 @@ is that we require `c n → ∞` instead of `‖c n‖ → ∞`. One can think a
as `tangent_cone_at nnreal` but we have no theory of normed semifields yet. -/
def posTangentConeAt (s : Set E) (x : E) : Set E :=
{ y : E |
- ∃ (c : ℕ → ℝ)(d : ℕ → E),
+ ∃ (c : ℕ → ℝ) (d : ℕ → E),
(∀ᶠ n in atTop, x + d n ∈ s) ∧
Tendsto c atTop atTop ∧ Tendsto (fun n => c n • d n) atTop (𝓝 y) }
#align pos_tangent_cone_at posTangentConeAt
@@ -106,7 +106,7 @@ theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segmen
show x + d n ∈ segment ℝ x y
· rw [segment_eq_image']
refine' ⟨(c n)⁻¹, ⟨_, _⟩, rfl⟩
- exacts[inv_nonneg.2 (pow_nonneg zero_le_two _), inv_le_one (one_le_pow_of_one_le one_le_two _)]
+ exacts [inv_nonneg.2 (pow_nonneg zero_le_two _), inv_le_one (one_le_pow_of_one_le one_le_two _)]
show tendsto (fun n => c n • d n) at_top (𝓝 (y - x))
· convert tendsto_const_nhds; ext n
simp only [d, smul_smul]
@@ -138,7 +138,7 @@ theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s
exact
tendsto_inf.2
⟨tendsto_const_nhds.add (tangentConeAt.lim_zero _ hc' hcd), by rwa [tendsto_principal]⟩
- rw [add_zero] at hd
+ rw [add_zero] at hd
replace h : ∀ᶠ n in at_top, f (a + d n) ≤ f a; exact mem_map.1 (hd h)
replace hc : ∀ᶠ n in at_top, 0 ≤ c n; exact mem_map.1 (hc (mem_at_top (0 : ℝ)))
filter_upwards [h, hc]
@@ -321,9 +321,9 @@ theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (h
rw [mem_set_of_eq, this x hx, ← hC]
exact Cge c' ⟨le_of_lt hc'.1, le_of_lt hc'.2⟩
· refine' ⟨C, ⟨lt_of_le_of_ne Cmem.1 <| mt _ hC, lt_of_le_of_ne Cmem.2 <| mt _ hC⟩, Or.inr Cge⟩
- exacts[fun h => by rw [h], fun h => by rw [h, hfI]]
+ exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
· refine' ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt _ hc, lt_of_le_of_ne cmem.2 <| mt _ hc⟩, Or.inl cle⟩
- exacts[fun h => by rw [h], fun h => by rw [h, hfI]]
+ exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
#align exists_Ioo_extr_on_Icc exists_Ioo_extr_on_Icc
/-- A continuous function on a closed interval with `f a = f b` has a local extremum at some
@@ -381,7 +381,7 @@ theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l
show ∃ c ∈ Ioo a b, deriv f c = 0 from
exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).HasDerivAt)
fun h : ¬∀ x ∈ Ioo a b, DifferentiableAt ℝ f x =>
- have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h; exact h
+ have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h ; exact h
let ⟨c, hc, hcdiff⟩ := h
⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
#align exists_deriv_eq_zero' exists_deriv_eq_zero'
@@ -402,7 +402,7 @@ theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]
exact zero_le _
have hp : p ≠ 0 := ne_of_apply_ne derivative (by rwa [derivative_zero])
refine' Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => _
- rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
+ rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
obtain ⟨z, hz1, hz2⟩ :=
exists_deriv_eq_zero (fun x : ℝ => eval x p) hxy p.continuous_on (hx.trans hy.symm)
refine' ⟨z, _, hz1⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
! This file was ported from Lean 3 source module analysis.calculus.local_extr
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
+! leanprover-community/mathlib commit f60c6087a7275b72d5db3c5a1d0e19e35a429c0a
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -15,6 +15,9 @@ import Mathbin.Topology.Algebra.Polynomial
/-!
# Local extrema of smooth functions
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
## Main definitions
In a real normed space `E` we define `pos_tangent_cone_at (s : set E) (x : E)`.
@@ -76,6 +79,7 @@ section Module
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → ℝ} {a : E} {f' : E →L[ℝ] ℝ}
+#print posTangentConeAt /-
/-- "Positive" tangent cone to `s` at `x`; the only difference from `tangent_cone_at`
is that we require `c n → ∞` instead of `‖c n‖ → ∞`. One can think about `pos_tangent_cone_at`
as `tangent_cone_at nnreal` but we have no theory of normed semifields yet. -/
@@ -85,6 +89,7 @@ def posTangentConeAt (s : Set E) (x : E) : Set E :=
(∀ᶠ n in atTop, x + d n ∈ s) ∧
Tendsto c atTop atTop ∧ Tendsto (fun n => c n • d n) atTop (𝓝 y) }
#align pos_tangent_cone_at posTangentConeAt
+-/
theorem posTangentConeAt_mono : Monotone fun s => posTangentConeAt s a :=
by
@@ -114,9 +119,11 @@ theorem mem_posTangentConeAt_of_segment_subset' {s : Set E} {x y : E}
simpa only [add_sub_cancel'] using mem_posTangentConeAt_of_segment_subset h
#align mem_pos_tangent_cone_at_of_segment_subset' mem_posTangentConeAt_of_segment_subset'
+#print posTangentConeAt_univ /-
theorem posTangentConeAt_univ : posTangentConeAt univ a = univ :=
eq_univ_of_forall fun x => mem_posTangentConeAt_of_segment_subset' (subset_univ _)
#align pos_tangent_cone_at_univ posTangentConeAt_univ
+-/
/-- If `f` has a local max on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
@@ -200,6 +207,7 @@ theorem IsLocalMinOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMinOn f s a) {
else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_min_on.fderiv_within_eq_zero IsLocalMinOn.fderivWithin_eq_zero
+#print IsLocalMin.hasFDerivAt_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.hasFDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasFDerivAt f f' a) : f' = 0 :=
by
@@ -208,33 +216,44 @@ theorem IsLocalMin.hasFDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasFDerivAt f
rw [posTangentConeAt_univ] <;>
apply mem_univ
#align is_local_min.has_fderiv_at_eq_zero IsLocalMin.hasFDerivAt_eq_zero
+-/
+#print IsLocalMin.fderiv_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.fderiv_eq_zero (h : IsLocalMin f a) : fderiv ℝ f a = 0 :=
if hf : DifferentiableAt ℝ f a then h.hasFDerivAt_eq_zero hf.HasFDerivAt
else fderiv_zero_of_not_differentiableAt hf
#align is_local_min.fderiv_eq_zero IsLocalMin.fderiv_eq_zero
+-/
+#print IsLocalMax.hasFDerivAt_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.hasFDerivAt_eq_zero (h : IsLocalMax f a) (hf : HasFDerivAt f f' a) : f' = 0 :=
neg_eq_zero.1 <| h.neg.hasFDerivAt_eq_zero hf.neg
#align is_local_max.has_fderiv_at_eq_zero IsLocalMax.hasFDerivAt_eq_zero
+-/
+#print IsLocalMax.fderiv_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.fderiv_eq_zero (h : IsLocalMax f a) : fderiv ℝ f a = 0 :=
if hf : DifferentiableAt ℝ f a then h.hasFDerivAt_eq_zero hf.HasFDerivAt
else fderiv_zero_of_not_differentiableAt hf
#align is_local_max.fderiv_eq_zero IsLocalMax.fderiv_eq_zero
+-/
+#print IsLocalExtr.hasFDerivAt_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.hasFDerivAt_eq_zero (h : IsLocalExtr f a) : HasFDerivAt f f' a → f' = 0 :=
h.elim IsLocalMin.hasFDerivAt_eq_zero IsLocalMax.hasFDerivAt_eq_zero
#align is_local_extr.has_fderiv_at_eq_zero IsLocalExtr.hasFDerivAt_eq_zero
+-/
+#print IsLocalExtr.fderiv_eq_zero /-
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.fderiv_eq_zero (h : IsLocalExtr f a) : fderiv ℝ f a = 0 :=
h.elim IsLocalMin.fderiv_eq_zero IsLocalMax.fderiv_eq_zero
#align is_local_extr.fderiv_eq_zero IsLocalExtr.fderiv_eq_zero
+-/
end Module
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -70,7 +70,7 @@ universe u v
open Filter Set
-open Topology Classical Polynomial
+open scoped Topology Classical Polynomial
section Module
@@ -371,7 +371,7 @@ end Rolle
namespace Polynomial
-open BigOperators
+open scoped BigOperators
/-- The number of roots of a real polynomial `p` is at most the number of roots of its derivative
that are not roots of `p` plus one. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -103,8 +103,7 @@ theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segmen
refine' ⟨(c n)⁻¹, ⟨_, _⟩, rfl⟩
exacts[inv_nonneg.2 (pow_nonneg zero_le_two _), inv_le_one (one_le_pow_of_one_le one_le_two _)]
show tendsto (fun n => c n • d n) at_top (𝓝 (y - x))
- · convert tendsto_const_nhds
- ext n
+ · convert tendsto_const_nhds; ext n
simp only [d, smul_smul]
rw [mul_inv_cancel, one_smul]
exact pow_ne_zero _ two_ne_zero
@@ -133,10 +132,8 @@ theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s
tendsto_inf.2
⟨tendsto_const_nhds.add (tangentConeAt.lim_zero _ hc' hcd), by rwa [tendsto_principal]⟩
rw [add_zero] at hd
- replace h : ∀ᶠ n in at_top, f (a + d n) ≤ f a
- exact mem_map.1 (hd h)
- replace hc : ∀ᶠ n in at_top, 0 ≤ c n
- exact mem_map.1 (hc (mem_at_top (0 : ℝ)))
+ replace h : ∀ᶠ n in at_top, f (a + d n) ≤ f a; exact mem_map.1 (hd h)
+ replace hc : ∀ᶠ n in at_top, 0 ≤ c n; exact mem_map.1 (hc (mem_at_top (0 : ℝ)))
filter_upwards [h, hc]
simp only [smul_eq_mul, mem_preimage, subset_def]
intro n hnf hn
@@ -148,9 +145,7 @@ of `s` at `a`, then `f' y ≤ 0`. -/
theorem IsLocalMaxOn.fderivWithin_nonpos {s : Set E} (h : IsLocalMaxOn f s a) {y}
(hy : y ∈ posTangentConeAt s a) : (fderivWithin ℝ f s a : E → ℝ) y ≤ 0 :=
if hf : DifferentiableWithinAt ℝ f s a then h.hasFDerivWithinAt_nonpos hf.HasFDerivWithinAt hy
- else by
- rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
- rfl
+ else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_max_on.fderiv_within_nonpos IsLocalMaxOn.fderivWithin_nonpos
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
@@ -169,9 +164,7 @@ theorem IsLocalMaxOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMaxOn f s a) {
(fderivWithin ℝ f s a : E → ℝ) y = 0 :=
if hf : DifferentiableWithinAt ℝ f s a then
h.hasFDerivWithinAt_eq_zero hf.HasFDerivWithinAt hy hy'
- else by
- rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
- rfl
+ else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_max_on.fderiv_within_eq_zero IsLocalMaxOn.fderivWithin_eq_zero
/-- If `f` has a local min on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
@@ -186,9 +179,7 @@ of `s` at `a`, then `0 ≤ f' y`. -/
theorem IsLocalMinOn.fderivWithin_nonneg {s : Set E} (h : IsLocalMinOn f s a) {y}
(hy : y ∈ posTangentConeAt s a) : (0 : ℝ) ≤ (fderivWithin ℝ f s a : E → ℝ) y :=
if hf : DifferentiableWithinAt ℝ f s a then h.hasFDerivWithinAt_nonneg hf.HasFDerivWithinAt hy
- else by
- rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
- rfl
+ else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_min_on.fderiv_within_nonneg IsLocalMinOn.fderivWithin_nonneg
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
@@ -206,9 +197,7 @@ theorem IsLocalMinOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMinOn f s a) {
(fderivWithin ℝ f s a : E → ℝ) y = 0 :=
if hf : DifferentiableWithinAt ℝ f s a then
h.hasFDerivWithinAt_eq_zero hf.HasFDerivWithinAt hy hy'
- else by
- rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
- rfl
+ else by rw [fderivWithin_zero_of_not_differentiableWithinAt hf]; rfl
#align is_local_min_on.fderiv_within_eq_zero IsLocalMinOn.fderivWithin_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
@@ -373,10 +362,7 @@ theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l
show ∃ c ∈ Ioo a b, deriv f c = 0 from
exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).HasDerivAt)
fun h : ¬∀ x ∈ Ioo a b, DifferentiableAt ℝ f x =>
- have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x :=
- by
- push_neg at h
- exact h
+ have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h; exact h
let ⟨c, hc, hcdiff⟩ := h
⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
#align exists_deriv_eq_zero' exists_deriv_eq_zero'
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -4,11 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
! This file was ported from Lean 3 source module analysis.calculus.local_extr
-! leanprover-community/mathlib commit 2c1d8ca2812b64f88992a5294ea3dba144755cd1
+! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
-import Mathbin.Analysis.Calculus.Deriv
+import Mathbin.Analysis.Calculus.Deriv.Polynomial
import Mathbin.Topology.Algebra.Order.ExtendFrom
import Mathbin.Topology.Algebra.Polynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/33c67ae661dd8988516ff7f247b0be3018cdd952
@@ -121,8 +121,8 @@ theorem posTangentConeAt_univ : posTangentConeAt univ a = univ :=
/-- If `f` has a local max on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
-theorem IsLocalMaxOn.hasFderivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s a)
- (hf : HasFderivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a) : f' y ≤ 0 :=
+theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s a)
+ (hf : HasFDerivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a) : f' y ≤ 0 :=
by
rcases hy with ⟨c, d, hd, hc, hcd⟩
have hc' : tendsto (fun n => ‖c n‖) at_top at_top :=
@@ -141,13 +141,13 @@ theorem IsLocalMaxOn.hasFderivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s
simp only [smul_eq_mul, mem_preimage, subset_def]
intro n hnf hn
exact mul_nonpos_of_nonneg_of_nonpos hn (sub_nonpos.2 hnf)
-#align is_local_max_on.has_fderiv_within_at_nonpos IsLocalMaxOn.hasFderivWithinAt_nonpos
+#align is_local_max_on.has_fderiv_within_at_nonpos IsLocalMaxOn.hasFDerivWithinAt_nonpos
/-- If `f` has a local max on `s` at `a` and `y` belongs to the positive tangent cone
of `s` at `a`, then `f' y ≤ 0`. -/
theorem IsLocalMaxOn.fderivWithin_nonpos {s : Set E} (h : IsLocalMaxOn f s a) {y}
(hy : y ∈ posTangentConeAt s a) : (fderivWithin ℝ f s a : E → ℝ) y ≤ 0 :=
- if hf : DifferentiableWithinAt ℝ f s a then h.hasFderivWithinAt_nonpos hf.HasFderivWithinAt hy
+ if hf : DifferentiableWithinAt ℝ f s a then h.hasFDerivWithinAt_nonpos hf.HasFDerivWithinAt hy
else by
rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
rfl
@@ -155,12 +155,12 @@ theorem IsLocalMaxOn.fderivWithin_nonpos {s : Set E} (h : IsLocalMaxOn f s a) {y
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
both `y` and `-y` belong to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
-theorem IsLocalMaxOn.hasFderivWithinAt_eq_zero {s : Set E} (h : IsLocalMaxOn f s a)
- (hf : HasFderivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a)
+theorem IsLocalMaxOn.hasFDerivWithinAt_eq_zero {s : Set E} (h : IsLocalMaxOn f s a)
+ (hf : HasFDerivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a)
(hy' : -y ∈ posTangentConeAt s a) : f' y = 0 :=
- le_antisymm (h.hasFderivWithinAt_nonpos hf hy) <| by
+ le_antisymm (h.hasFDerivWithinAt_nonpos hf hy) <| by
simpa using h.has_fderiv_within_at_nonpos hf hy'
-#align is_local_max_on.has_fderiv_within_at_eq_zero IsLocalMaxOn.hasFderivWithinAt_eq_zero
+#align is_local_max_on.has_fderiv_within_at_eq_zero IsLocalMaxOn.hasFDerivWithinAt_eq_zero
/-- If `f` has a local max on `s` at `a` and both `y` and `-y` belong to the positive tangent cone
of `s` at `a`, then `f' y = 0`. -/
@@ -168,7 +168,7 @@ theorem IsLocalMaxOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMaxOn f s a) {
(hy : y ∈ posTangentConeAt s a) (hy' : -y ∈ posTangentConeAt s a) :
(fderivWithin ℝ f s a : E → ℝ) y = 0 :=
if hf : DifferentiableWithinAt ℝ f s a then
- h.hasFderivWithinAt_eq_zero hf.HasFderivWithinAt hy hy'
+ h.hasFDerivWithinAt_eq_zero hf.HasFDerivWithinAt hy hy'
else by
rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
rfl
@@ -176,16 +176,16 @@ theorem IsLocalMaxOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMaxOn f s a) {
/-- If `f` has a local min on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `0 ≤ f' y`. -/
-theorem IsLocalMinOn.hasFderivWithinAt_nonneg {s : Set E} (h : IsLocalMinOn f s a)
- (hf : HasFderivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a) : 0 ≤ f' y := by
+theorem IsLocalMinOn.hasFDerivWithinAt_nonneg {s : Set E} (h : IsLocalMinOn f s a)
+ (hf : HasFDerivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a) : 0 ≤ f' y := by
simpa using h.neg.has_fderiv_within_at_nonpos hf.neg hy
-#align is_local_min_on.has_fderiv_within_at_nonneg IsLocalMinOn.hasFderivWithinAt_nonneg
+#align is_local_min_on.has_fderiv_within_at_nonneg IsLocalMinOn.hasFDerivWithinAt_nonneg
/-- If `f` has a local min on `s` at `a` and `y` belongs to the positive tangent cone
of `s` at `a`, then `0 ≤ f' y`. -/
theorem IsLocalMinOn.fderivWithin_nonneg {s : Set E} (h : IsLocalMinOn f s a) {y}
(hy : y ∈ posTangentConeAt s a) : (0 : ℝ) ≤ (fderivWithin ℝ f s a : E → ℝ) y :=
- if hf : DifferentiableWithinAt ℝ f s a then h.hasFderivWithinAt_nonneg hf.HasFderivWithinAt hy
+ if hf : DifferentiableWithinAt ℝ f s a then h.hasFDerivWithinAt_nonneg hf.HasFDerivWithinAt hy
else by
rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
rfl
@@ -193,11 +193,11 @@ theorem IsLocalMinOn.fderivWithin_nonneg {s : Set E} (h : IsLocalMinOn f s a) {y
/-- If `f` has a local max on `s` at `a`, `f'` is a derivative of `f` at `a` within `s`, and
both `y` and `-y` belong to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
-theorem IsLocalMinOn.hasFderivWithinAt_eq_zero {s : Set E} (h : IsLocalMinOn f s a)
- (hf : HasFderivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a)
+theorem IsLocalMinOn.hasFDerivWithinAt_eq_zero {s : Set E} (h : IsLocalMinOn f s a)
+ (hf : HasFDerivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a)
(hy' : -y ∈ posTangentConeAt s a) : f' y = 0 := by
simpa using h.neg.has_fderiv_within_at_eq_zero hf.neg hy hy'
-#align is_local_min_on.has_fderiv_within_at_eq_zero IsLocalMinOn.hasFderivWithinAt_eq_zero
+#align is_local_min_on.has_fderiv_within_at_eq_zero IsLocalMinOn.hasFDerivWithinAt_eq_zero
/-- If `f` has a local min on `s` at `a` and both `y` and `-y` belong to the positive tangent cone
of `s` at `a`, then `f' y = 0`. -/
@@ -205,42 +205,42 @@ theorem IsLocalMinOn.fderivWithin_eq_zero {s : Set E} (h : IsLocalMinOn f s a) {
(hy : y ∈ posTangentConeAt s a) (hy' : -y ∈ posTangentConeAt s a) :
(fderivWithin ℝ f s a : E → ℝ) y = 0 :=
if hf : DifferentiableWithinAt ℝ f s a then
- h.hasFderivWithinAt_eq_zero hf.HasFderivWithinAt hy hy'
+ h.hasFDerivWithinAt_eq_zero hf.HasFDerivWithinAt hy hy'
else by
rw [fderivWithin_zero_of_not_differentiableWithinAt hf]
rfl
#align is_local_min_on.fderiv_within_eq_zero IsLocalMinOn.fderivWithin_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
-theorem IsLocalMin.hasFderivAt_eq_zero (h : IsLocalMin f a) (hf : HasFderivAt f f' a) : f' = 0 :=
+theorem IsLocalMin.hasFDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasFDerivAt f f' a) : f' = 0 :=
by
ext y
- apply (h.on univ).hasFderivWithinAt_eq_zero hf.has_fderiv_within_at <;>
+ apply (h.on univ).hasFDerivWithinAt_eq_zero hf.has_fderiv_within_at <;>
rw [posTangentConeAt_univ] <;>
apply mem_univ
-#align is_local_min.has_fderiv_at_eq_zero IsLocalMin.hasFderivAt_eq_zero
+#align is_local_min.has_fderiv_at_eq_zero IsLocalMin.hasFDerivAt_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.fderiv_eq_zero (h : IsLocalMin f a) : fderiv ℝ f a = 0 :=
- if hf : DifferentiableAt ℝ f a then h.hasFderivAt_eq_zero hf.HasFderivAt
+ if hf : DifferentiableAt ℝ f a then h.hasFDerivAt_eq_zero hf.HasFDerivAt
else fderiv_zero_of_not_differentiableAt hf
#align is_local_min.fderiv_eq_zero IsLocalMin.fderiv_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
-theorem IsLocalMax.hasFderivAt_eq_zero (h : IsLocalMax f a) (hf : HasFderivAt f f' a) : f' = 0 :=
- neg_eq_zero.1 <| h.neg.hasFderivAt_eq_zero hf.neg
-#align is_local_max.has_fderiv_at_eq_zero IsLocalMax.hasFderivAt_eq_zero
+theorem IsLocalMax.hasFDerivAt_eq_zero (h : IsLocalMax f a) (hf : HasFDerivAt f f' a) : f' = 0 :=
+ neg_eq_zero.1 <| h.neg.hasFDerivAt_eq_zero hf.neg
+#align is_local_max.has_fderiv_at_eq_zero IsLocalMax.hasFDerivAt_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local maximum equals zero. -/
theorem IsLocalMax.fderiv_eq_zero (h : IsLocalMax f a) : fderiv ℝ f a = 0 :=
- if hf : DifferentiableAt ℝ f a then h.hasFderivAt_eq_zero hf.HasFderivAt
+ if hf : DifferentiableAt ℝ f a then h.hasFDerivAt_eq_zero hf.HasFDerivAt
else fderiv_zero_of_not_differentiableAt hf
#align is_local_max.fderiv_eq_zero IsLocalMax.fderiv_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
-theorem IsLocalExtr.hasFderivAt_eq_zero (h : IsLocalExtr f a) : HasFderivAt f f' a → f' = 0 :=
- h.elim IsLocalMin.hasFderivAt_eq_zero IsLocalMax.hasFderivAt_eq_zero
-#align is_local_extr.has_fderiv_at_eq_zero IsLocalExtr.hasFderivAt_eq_zero
+theorem IsLocalExtr.hasFDerivAt_eq_zero (h : IsLocalExtr f a) : HasFDerivAt f f' a → f' = 0 :=
+ h.elim IsLocalMin.hasFDerivAt_eq_zero IsLocalMax.hasFDerivAt_eq_zero
+#align is_local_extr.has_fderiv_at_eq_zero IsLocalExtr.hasFDerivAt_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local extremum equals zero. -/
theorem IsLocalExtr.fderiv_eq_zero (h : IsLocalExtr f a) : fderiv ℝ f a = 0 :=
@@ -256,7 +256,7 @@ variable {f : ℝ → ℝ} {f' : ℝ} {a b : ℝ}
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.hasDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasDerivAt f f' a) : f' = 0 := by
simpa using
- ContinuousLinearMap.ext_iff.1 (h.has_fderiv_at_eq_zero (hasDerivAt_iff_hasFderivAt.1 hf)) 1
+ ContinuousLinearMap.ext_iff.1 (h.has_fderiv_at_eq_zero (hasDerivAt_iff_hasFDerivAt.1 hf)) 1
#align is_local_min.has_deriv_at_eq_zero IsLocalMin.hasDerivAt_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/36b8aa61ea7c05727161f96a0532897bd72aedab
@@ -4,15 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
! This file was ported from Lean 3 source module analysis.calculus.local_extr
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 2c1d8ca2812b64f88992a5294ea3dba144755cd1
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.Analysis.Calculus.Deriv
-import Mathbin.Data.Polynomial.FieldDivision
import Mathbin.Topology.Algebra.Order.ExtendFrom
import Mathbin.Topology.Algebra.Polynomial
-import Mathbin.Topology.LocalExtr
/-!
# Local extrema of smooth functions
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -421,18 +421,18 @@ theorem card_roots_le_derivative (p : ℝ[X]) : p.roots.card ≤ p.derivative.ro
p.roots.card = ∑ x in p.roots.toFinset, p.roots.count x :=
(Multiset.toFinset_sum_count_eq _).symm
_ = ∑ x in p.roots.toFinset, p.roots.count x - 1 + 1 :=
- Eq.symm <|
+ (Eq.symm <|
Finset.sum_congr rfl fun x hx =>
tsub_add_cancel_of_le <|
- Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx
+ Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx)
_ = (∑ x in p.roots.toFinset, p.rootMultiplicity x - 1) + p.roots.toFinset.card := by
simp only [Finset.sum_add_distrib, Finset.card_eq_sum_ones, count_roots]
_ ≤
(∑ x in p.roots.toFinset, p.derivative.rootMultiplicity x) +
((p.derivative.roots.toFinset \ p.roots.toFinset).card + 1) :=
- add_le_add
+ (add_le_add
(Finset.sum_le_sum fun x hx => rootMultiplicity_sub_one_le_derivative_rootMultiplicity _ _)
- p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ
+ p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ)
_ ≤
(∑ x in p.roots.toFinset, p.derivative.roots.count x) +
((∑ x in p.derivative.roots.toFinset \ p.roots.toFinset, p.derivative.roots.count x) +
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -25,7 +25,7 @@ We prove four versions of this theorem.
point $x ∈ (a, b)$ function $f$ has derivative $f'(x)$, then concludes that $f'(c)=0$ for some
$c∈(a, b)$.
* `exists_deriv_eq_zero` deals with `deriv f` instead of an arbitrary function `f'` and a predicate
- `has_deriv_at`; since we use zero as the "junk" value for `deriv f c`, this version does not
+ `HasDerivAt`; since we use zero as the "junk" value for `deriv f c`, this version does not
assume that `f` is differentiable on the open interval.
* `exists_hasDerivAt_eq_zero'` is similar to `exists_hasDerivAt_eq_zero` but instead of assuming
continuity on the closed interval $[a, b]$ it assumes that $f$ tends to the same limit as $x$
Move files from Topology.Algebra.Order
to Topology.Order
when they do not contain any algebra. Also move Topology.LocalExtr
to Topology.Order.LocalExtr
.
According to git, the moves are:
Mathlib/Topology/{Algebra => }/Order/ExtendFrom.lean
Mathlib/Topology/{Algebra => }/Order/ExtrClosure.lean
Mathlib/Topology/{Algebra => }/Order/Filter.lean
Mathlib/Topology/{Algebra => }/Order/IntermediateValue.lean
Mathlib/Topology/{Algebra => }/Order/LeftRight.lean
Mathlib/Topology/{Algebra => }/Order/LeftRightLim.lean
Mathlib/Topology/{Algebra => }/Order/MonotoneContinuity.lean
Mathlib/Topology/{Algebra => }/Order/MonotoneConvergence.lean
Mathlib/Topology/{Algebra => }/Order/ProjIcc.lean
Mathlib/Topology/{Algebra => }/Order/T5.lean
Mathlib/Topology/{ => Order}/LocalExtr.lean
@@ -3,10 +3,10 @@ Copyright (c) 2019 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
-import Mathlib.Topology.Algebra.Order.ExtendFrom
+import Mathlib.Topology.Order.ExtendFrom
import Mathlib.Topology.Algebra.Order.Compact
-import Mathlib.Topology.Algebra.Order.T5
-import Mathlib.Topology.LocalExtr
+import Mathlib.Topology.Order.LocalExtr
+import Mathlib.Topology.Order.T5
#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
mul
-div
cancellation lemmas (#11530)
Lemma names around cancellation of multiplication and division are a mess.
This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero
lemma name, the Group
lemma, the AddGroup
lemma name).
| Statement | New name | Old name | |
@@ -98,7 +98,7 @@ theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segmen
theorem mem_posTangentConeAt_of_segment_subset' {s : Set E} {x y : E}
(h : segment ℝ x (x + y) ⊆ s) : y ∈ posTangentConeAt s x := by
- simpa only [add_sub_cancel'] using mem_posTangentConeAt_of_segment_subset h
+ simpa only [add_sub_cancel_left] using mem_posTangentConeAt_of_segment_subset h
#align mem_pos_tangent_cone_at_of_segment_subset' mem_posTangentConeAt_of_segment_subset'
theorem posTangentConeAt_univ : posTangentConeAt univ a = univ :=
have
, replace
and suffices
(#10640)
No changes to tactic file, it's just boring fixes throughout the library.
This follows on from #6964.
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -115,10 +115,10 @@ theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s
(hf : HasFDerivWithinAt f f' s a) {y} (hy : y ∈ posTangentConeAt s a) : f' y ≤ 0 := by
rcases hy with ⟨c, d, hd, hc, hcd⟩
have hc' : Tendsto (‖c ·‖) atTop atTop := tendsto_abs_atTop_atTop.comp hc
- suffices : ∀ᶠ n in atTop, c n • (f (a + d n) - f a) ≤ 0
- · exact le_of_tendsto (hf.lim atTop hd hc' hcd) this
- replace hd : Tendsto (fun n => a + d n) atTop (𝓝[s] (a + 0))
- · exact tendsto_nhdsWithin_iff.2 ⟨tendsto_const_nhds.add (tangentConeAt.lim_zero _ hc' hcd), hd⟩
+ suffices ∀ᶠ n in atTop, c n • (f (a + d n) - f a) ≤ 0 from
+ le_of_tendsto (hf.lim atTop hd hc' hcd) this
+ replace hd : Tendsto (fun n => a + d n) atTop (𝓝[s] (a + 0)) :=
+ tendsto_nhdsWithin_iff.2 ⟨tendsto_const_nhds.add (tangentConeAt.lim_zero _ hc' hcd), hd⟩
rw [add_zero] at hd
filter_upwards [hd.eventually h, hc.eventually_ge_atTop 0] with n hfn hcn
exact mul_nonpos_of_nonneg_of_nonpos hcn (sub_nonpos.2 hfn)
@@ -14,7 +14,7 @@ import Mathlib.Topology.LocalExtr
# Rolle's Theorem (topological part)
In this file we prove the purely topological part of Rolle's Theorem:
-a function that is continuous on an interval $[a, b]$, $a<b$,
+a function that is continuous on an interval $[a, b]$, $a < b$,
has a local extremum at a point $x ∈ (a, b)$ provided that $f(a)=f(b)$.
We also prove several variations of this statement.
@@ -25,11 +25,9 @@ to prove several versions of Rolle's Theorem from calculus.
local minimum, local maximum, extremum, Rolle's Theorem
-/
-set_option autoImplicit true
-
open Filter Set Topology
-variable
+variable {X Y : Type*}
[ConditionallyCompleteLinearOrder X] [DenselyOrdered X] [TopologicalSpace X] [OrderTopology X]
[LinearOrder Y] [TopologicalSpace Y] [OrderTopology Y]
{f : X → Y} {a b : X} {l : Y}
FunLike
to DFunLike
(#9785)
This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.
This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:
sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@@ -230,7 +230,7 @@ variable {f : ℝ → ℝ} {f' : ℝ} {a b : ℝ}
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
theorem IsLocalMin.hasDerivAt_eq_zero (h : IsLocalMin f a) (hf : HasDerivAt f f' a) : f' = 0 := by
- simpa using FunLike.congr_fun (h.hasFDerivAt_eq_zero (hasDerivAt_iff_hasFDerivAt.1 hf)) 1
+ simpa using DFunLike.congr_fun (h.hasFDerivAt_eq_zero (hasDerivAt_iff_hasFDerivAt.1 hf)) 1
#align is_local_min.has_deriv_at_eq_zero IsLocalMin.hasDerivAt_eq_zero
/-- **Fermat's Theorem**: the derivative of a function at a local minimum equals zero. -/
$
with <|
(#9319)
See Zulip thread for the discussion.
@@ -83,4 +83,4 @@ lemma exists_isLocalExtr_Ioo_of_tendsto (hab : a < b) (hfc : ContinuousOn f (Ioo
(ha : Tendsto f (𝓝[>] a) (𝓝 l)) (hb : Tendsto f (𝓝[<] b) (𝓝 l)) :
∃ c ∈ Ioo a b, IsLocalExtr f c :=
let ⟨c, cmem, hc⟩ := exists_isExtrOn_Ioo_of_tendsto hab hfc ha hb
- ⟨c, cmem, hc.isLocalExtr $ Ioo_mem_nhds cmem.1 cmem.2⟩
+ ⟨c, cmem, hc.isLocalExtr <| Ioo_mem_nhds cmem.1 cmem.2⟩
cases'
(#9171)
I literally went through and regex'd some uses of cases'
, replacing them with rcases
; this is meant to be a low effort PR as I hope that tools can do this in the future.
rcases
is an easier replacement than cases
, though with better tools we could in future do a second pass converting simple rcases
added here (and existing ones) to cases
.
@@ -37,7 +37,7 @@ open scoped BigOperators
that are not roots of `p` plus one. -/
theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]) :
p.roots.toFinset.card ≤ (p.derivative.roots.toFinset \ p.roots.toFinset).card + 1 := by
- cases' eq_or_ne (derivative p) 0 with hp' hp'
+ rcases eq_or_ne (derivative p) 0 with hp' | hp'
· rw [eq_C_of_derivative_eq_zero hp', roots_C, Multiset.toFinset_zero, Finset.card_empty]
exact zero_le _
have hp : p ≠ 0 := ne_of_apply_ne derivative (by rwa [derivative_zero])
Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.
The intent of this PR is to make autoImplicit
opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true
in the few files that rely on it.
That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.
I claim that many of the uses of autoImplicit
in these files are accidental; situations such as:
variables
are in scope, but pasting the lemma in the wrong sectionHaving set_option autoImplicit false
as the default prevents these types of mistake being made in the 90% of files where autoImplicit
s are not used at all, and causes them to be caught by CI during review.
I think there were various points during the port where we encouraged porters to delete the universes u v
lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.
A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18
as the no:dontcare:yes
vote ratio.
While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true
has been placed locally within a section, rather than at the top of the file.
@@ -25,6 +25,8 @@ to prove several versions of Rolle's Theorem from calculus.
local minimum, local maximum, extremum, Rolle's Theorem
-/
+set_option autoImplicit true
+
open Filter Set Topology
variable
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -90,7 +90,7 @@ theorem card_roots_le_derivative (p : ℝ[X]) :
/-- The number of real roots of a polynomial is at most the number of roots of its derivative plus
one. -/
-theorem card_rootSet_le_derivative {F : Type _} [CommRing F] [Algebra F ℝ] (p : F[X]) :
+theorem card_rootSet_le_derivative {F : Type*} [CommRing F] [Algebra F ℝ] (p : F[X]) :
Fintype.card (p.rootSet ℝ) ≤ Fintype.card (p.derivative.rootSet ℝ) + 1 := by
simpa only [rootSet_def, Finset.coe_sort_coe, Fintype.card_coe, derivative_map] using
card_roots_toFinset_le_derivative (p.map (algebraMap F ℝ))
Analysis.Calculus.LocalExtr
(#5944)
Also make f
/f'
arguments implicit in all versions of Rolle's Theorem.
Fixes #4830
exists_Ioo_extr_on_Icc
:
f : ℝ → ℝ
to functions from a conditionally complete linear order
to a linear order.f
implicit;exists_local_extr_Ioo
:
exists_isLocalExtr_Ioo
;f
implicit;exists_isExtrOn_Ioo_of_tendsto
, exists_isLocalExtr_Ioo_of_tendsto
:
new lemmas extracted from the proof of exists_hasDerivAt_eq_zero'
;exists_hasDerivAt_eq_zero
, exists_hasDerivAt_eq_zero'
:
make f
and f'
implicit;exists_deriv_eq_zero
, exists_deriv_eq_zero'
:
make f
implicit.Analysis.Calculus.LocalExtr
(#5944)
Also make f
/f'
arguments implicit in all versions of Rolle's Theorem.
Fixes #4830
exists_Ioo_extr_on_Icc
:
f : ℝ → ℝ
to functions from a conditionally complete linear order
to a linear order.f
implicit;exists_local_extr_Ioo
:
exists_isLocalExtr_Ioo
;f
implicit;exists_isExtrOn_Ioo_of_tendsto
, exists_isLocalExtr_Ioo_of_tendsto
:
new lemmas extracted from the proof of exists_hasDerivAt_eq_zero'
;exists_hasDerivAt_eq_zero
, exists_hasDerivAt_eq_zero'
:
make f
and f'
implicit;exists_deriv_eq_zero
, exists_deriv_eq_zero'
:
make f
implicit.Analysis.Calculus.LocalExtr
(#5944)
Also make f
/f'
arguments implicit in all versions of Rolle's Theorem.
Fixes #4830
exists_Ioo_extr_on_Icc
:
f : ℝ → ℝ
to functions from a conditionally complete linear order
to a linear order.f
implicit;exists_local_extr_Ioo
:
exists_isLocalExtr_Ioo
;f
implicit;exists_isExtrOn_Ioo_of_tendsto
, exists_isLocalExtr_Ioo_of_tendsto
:
new lemmas extracted from the proof of exists_hasDerivAt_eq_zero'
;exists_hasDerivAt_eq_zero
, exists_hasDerivAt_eq_zero'
:
make f
and f'
implicit;exists_deriv_eq_zero
, exists_deriv_eq_zero'
:
make f
implicit.Analysis.Calculus.LocalExtr
(#5944)
Also make f
/f'
arguments implicit in all versions of Rolle's Theorem.
Fixes #4830
exists_Ioo_extr_on_Icc
:
f : ℝ → ℝ
to functions from a conditionally complete linear order
to a linear order.f
implicit;exists_local_extr_Ioo
:
exists_isLocalExtr_Ioo
;f
implicit;exists_isExtrOn_Ioo_of_tendsto
, exists_isLocalExtr_Ioo_of_tendsto
:
new lemmas extracted from the proof of exists_hasDerivAt_eq_zero'
;exists_hasDerivAt_eq_zero
, exists_hasDerivAt_eq_zero'
:
make f
and f'
implicit;exists_deriv_eq_zero
, exists_deriv_eq_zero'
:
make f
implicit.@@ -3,14 +3,12 @@ Copyright (c) 2019 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
-import Mathlib.Analysis.Calculus.Deriv.Polynomial
-import Mathlib.Topology.Algebra.Order.ExtendFrom
-import Mathlib.Topology.Algebra.Polynomial
+import Mathlib.Analysis.Calculus.Deriv.Add
#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
-# Local extrema of smooth functions
+# Local extrema of differentiable functions
## Main definitions
@@ -24,7 +22,7 @@ This set is used in the proof of Fermat's Theorem (see below), and can be used t
For each theorem name listed below,
we also prove similar theorems for `min`, `extr` (if applicable),
-and `(f)deriv` instead of `has_fderiv`.
+and `fderiv`/`deriv` instead of `HasFDerivAt`/`HasDerivAt`.
* `IsLocalMaxOn.hasFDerivWithinAt_nonpos` : `f' y ≤ 0` whenever `a` is a local maximum
of `f` on `s`, `f` has derivative `f'` at `a` within `s`, and `y` belongs to the positive tangent
@@ -37,10 +35,6 @@ and `(f)deriv` instead of `has_fderiv`.
[Fermat's Theorem](https://en.wikipedia.org/wiki/Fermat's_theorem_(stationary_points)),
the derivative of a differentiable function at a local extremum point equals zero.
-* `exists_hasDerivAt_eq_zero` :
- [Rolle's Theorem](https://en.wikipedia.org/wiki/Rolle's_theorem): given a function `f` continuous
- on `[a, b]` and differentiable on `(a, b)`, there exists `c ∈ (a, b)` such that `f' c = 0`.
-
## Implementation notes
For each mathematical fact we prove several versions of its formalization:
@@ -54,12 +48,11 @@ due to the fact that `fderiv` and `deriv` are defined to be zero for non-differe
## References
* [Fermat's Theorem](https://en.wikipedia.org/wiki/Fermat's_theorem_(stationary_points));
-* [Rolle's Theorem](https://en.wikipedia.org/wiki/Rolle's_theorem);
* [Tangent cone](https://en.wikipedia.org/wiki/Tangent_cone);
## Tags
-local extremum, Fermat's Theorem, Rolle's Theorem
+local extremum, tangent cone, Fermat's Theorem
-/
@@ -67,12 +60,16 @@ universe u v
open Filter Set
-open scoped Topology Classical Polynomial
+open scoped Topology Classical
section Module
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → ℝ} {a : E} {f' : E →L[ℝ] ℝ}
+/-!
+### Positive tangent cone
+-/
+
/-- "Positive" tangent cone to `s` at `x`; the only difference from `tangentConeAt`
is that we require `c n → ∞` instead of `‖c n‖ → ∞`. One can think about `posTangentConeAt`
as `tangentConeAt NNReal` but we have no theory of normed semifields yet. -/
@@ -108,6 +105,10 @@ theorem posTangentConeAt_univ : posTangentConeAt univ a = univ :=
eq_univ_of_forall fun _ => mem_posTangentConeAt_of_segment_subset' (subset_univ _)
#align pos_tangent_cone_at_univ posTangentConeAt_univ
+/-!
+### Fermat's Theorem (vector space)
+-/
+
/-- If `f` has a local max on `s` at `a`, `f'` is the derivative of `f` at `a` within `s`, and
`y` belongs to the positive tangent cone of `s` at `a`, then `f' y ≤ 0`. -/
theorem IsLocalMaxOn.hasFDerivWithinAt_nonpos {s : Set E} (h : IsLocalMaxOn f s a)
@@ -219,6 +220,10 @@ theorem IsLocalExtr.fderiv_eq_zero (h : IsLocalExtr f a) : fderiv ℝ f a = 0 :=
end Module
+/-!
+### Fermat's Theorem
+-/
+
section Real
variable {f : ℝ → ℝ} {f' : ℝ} {a b : ℝ}
@@ -256,160 +261,3 @@ theorem IsLocalExtr.deriv_eq_zero (h : IsLocalExtr f a) : deriv f a = 0 :=
#align is_local_extr.deriv_eq_zero IsLocalExtr.deriv_eq_zero
end Real
-
-section Rolle
-
-variable (f f' : ℝ → ℝ) {a b : ℝ}
-
-/-- A continuous function on a closed interval with `f a = f b` takes either its maximum
-or its minimum value at a point in the interior of the interval. -/
-theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
- ∃ c ∈ Ioo a b, IsExtrOn f (Icc a b) c := by
- have ne : (Icc a b).Nonempty := nonempty_Icc.2 (le_of_lt hab)
- -- Consider absolute min and max points
- obtain ⟨c, cmem, cle⟩ : ∃ c ∈ Icc a b, ∀ x ∈ Icc a b, f c ≤ f x :=
- isCompact_Icc.exists_forall_le ne hfc
- obtain ⟨C, Cmem, Cge⟩ : ∃ C ∈ Icc a b, ∀ x ∈ Icc a b, f x ≤ f C :=
- isCompact_Icc.exists_forall_ge ne hfc
- by_cases hc : f c = f a
- · by_cases hC : f C = f a
- · have : ∀ x ∈ Icc a b, f x = f a := fun x hx => le_antisymm (hC ▸ Cge x hx) (hc ▸ cle x hx)
- -- `f` is a constant, so we can take any point in `Ioo a b`
- rcases nonempty_Ioo.2 hab with ⟨c', hc'⟩
- refine ⟨c', hc', Or.inl fun x hx ↦ ?_⟩
- simp only [mem_setOf_eq, this x hx, this c' (Ioo_subset_Icc_self hc'), le_rfl]
- · refine' ⟨C, ⟨lt_of_le_of_ne Cmem.1 <| mt _ hC, lt_of_le_of_ne Cmem.2 <| mt _ hC⟩, Or.inr Cge⟩
- exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
- · refine' ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt _ hc, lt_of_le_of_ne cmem.2 <| mt _ hc⟩, Or.inl cle⟩
- exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
-#align exists_Ioo_extr_on_Icc exists_Ioo_extr_on_Icc
-
-/-- A continuous function on a closed interval with `f a = f b` has a local extremum at some
-point of the corresponding open interval. -/
-theorem exists_local_extr_Ioo (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
- ∃ c ∈ Ioo a b, IsLocalExtr f c :=
- let ⟨c, cmem, hc⟩ := exists_Ioo_extr_on_Icc f hab hfc hfI
- ⟨c, cmem, hc.isLocalExtr <| Icc_mem_nhds cmem.1 cmem.2⟩
-#align exists_local_extr_Ioo exists_local_extr_Ioo
-
-/-- **Rolle's Theorem** `HasDerivAt` version -/
-theorem exists_hasDerivAt_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b)
- (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) : ∃ c ∈ Ioo a b, f' c = 0 :=
- let ⟨c, cmem, hc⟩ := exists_local_extr_Ioo f hab hfc hfI
- ⟨c, cmem, hc.hasDerivAt_eq_zero <| hff' c cmem⟩
-#align exists_has_deriv_at_eq_zero exists_hasDerivAt_eq_zero
-
-/-- **Rolle's Theorem** `deriv` version -/
-theorem exists_deriv_eq_zero (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) :
- ∃ c ∈ Ioo a b, deriv f c = 0 :=
- let ⟨c, cmem, hc⟩ := exists_local_extr_Ioo f hab hfc hfI
- ⟨c, cmem, hc.deriv_eq_zero⟩
-#align exists_deriv_eq_zero exists_deriv_eq_zero
-
-variable {f f'} {l : ℝ}
-
-/-- **Rolle's Theorem**, a version for a function on an open interval: if `f` has derivative `f'`
-on `(a, b)` and has the same limit `l` at `𝓝[>] a` and `𝓝[<] b`, then `f' c = 0`
-for some `c ∈ (a, b)`. -/
-theorem exists_hasDerivAt_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l))
- (hfb : Tendsto f (𝓝[<] b) (𝓝 l)) (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) :
- ∃ c ∈ Ioo a b, f' c = 0 := by
- have : ContinuousOn f (Ioo a b) := fun x hx => (hff' x hx).continuousAt.continuousWithinAt
- have hcont := continuousOn_Icc_extendFrom_Ioo hab.ne this hfa hfb
- obtain ⟨c, hc, hcextr⟩ : ∃ c ∈ Ioo a b, IsLocalExtr (extendFrom (Ioo a b) f) c := by
- apply exists_local_extr_Ioo _ hab hcont
- rw [eq_lim_at_right_extendFrom_Ioo hab hfb]
- exact eq_lim_at_left_extendFrom_Ioo hab hfa
- use c, hc
- apply (hcextr.congr _).hasDerivAt_eq_zero (hff' c hc)
- rw [eventuallyEq_iff_exists_mem]
- exact ⟨Ioo a b, Ioo_mem_nhds hc.1 hc.2, extendFrom_extends this⟩
-#align exists_has_deriv_at_eq_zero' exists_hasDerivAt_eq_zero'
-
-/-- **Rolle's Theorem**, a version for a function on an open interval: if `f` has the same limit
-`l` at `𝓝[>] a` and `𝓝[<] b`, then `deriv f c = 0` for some `c ∈ (a, b)`. This version
-does not require differentiability of `f` because we define `deriv f c = 0` whenever `f` is not
-differentiable at `c`. -/
-theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l))
- (hfb : Tendsto f (𝓝[<] b) (𝓝 l)) : ∃ c ∈ Ioo a b, deriv f c = 0 :=
- by_cases
- (fun h : ∀ x ∈ Ioo a b, DifferentiableAt ℝ f x =>
- show ∃ c ∈ Ioo a b, deriv f c = 0 from
- exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).hasDerivAt)
- fun h : ¬∀ x ∈ Ioo a b, DifferentiableAt ℝ f x =>
- have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h; exact h
- let ⟨c, hc, hcdiff⟩ := h
- ⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
-#align exists_deriv_eq_zero' exists_deriv_eq_zero'
-
-end Rolle
-
-namespace Polynomial
-
-open scoped BigOperators
-
-/-- The number of roots of a real polynomial `p` is at most the number of roots of its derivative
-that are not roots of `p` plus one. -/
-theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]) :
- p.roots.toFinset.card ≤ (p.derivative.roots.toFinset \ p.roots.toFinset).card + 1 := by
- cases' eq_or_ne (derivative p) 0 with hp' hp'
- · rw [eq_C_of_derivative_eq_zero hp', roots_C, Multiset.toFinset_zero, Finset.card_empty]
- exact zero_le _
- have hp : p ≠ 0 := ne_of_apply_ne derivative (by rwa [derivative_zero])
- refine' Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => _
- rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
- obtain ⟨z, hz1, hz2⟩ :=
- exists_deriv_eq_zero (fun x : ℝ => eval x p) hxy p.continuousOn (hx.trans hy.symm)
- refine' ⟨z, _, hz1⟩
- rwa [Multiset.mem_toFinset, mem_roots hp', IsRoot, ← p.deriv]
-#align polynomial.card_roots_to_finset_le_card_roots_derivative_diff_roots_succ Polynomial.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ
-
-/-- The number of roots of a real polynomial is at most the number of roots of its derivative plus
-one. -/
-theorem card_roots_toFinset_le_derivative (p : ℝ[X]) :
- p.roots.toFinset.card ≤ p.derivative.roots.toFinset.card + 1 :=
- p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ.trans <|
- add_le_add_right (Finset.card_mono <| Finset.sdiff_subset _ _) _
-#align polynomial.card_roots_to_finset_le_derivative Polynomial.card_roots_toFinset_le_derivative
-
-/-- The number of roots of a real polynomial (counted with multiplicities) is at most the number of
-roots of its derivative (counted with multiplicities) plus one. -/
-theorem card_roots_le_derivative (p : ℝ[X]) :
- Multiset.card p.roots ≤ Multiset.card (derivative p).roots + 1 :=
- calc
- Multiset.card p.roots = ∑ x in p.roots.toFinset, p.roots.count x :=
- (Multiset.toFinset_sum_count_eq _).symm
- _ = ∑ x in p.roots.toFinset, (p.roots.count x - 1 + 1) :=
- (Eq.symm <| Finset.sum_congr rfl fun x hx => tsub_add_cancel_of_le <|
- Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx)
- _ = (∑ x in p.roots.toFinset, (p.rootMultiplicity x - 1)) + p.roots.toFinset.card := by
- simp only [Finset.sum_add_distrib, Finset.card_eq_sum_ones, count_roots]
- _ ≤ (∑ x in p.roots.toFinset, p.derivative.rootMultiplicity x) +
- ((p.derivative.roots.toFinset \ p.roots.toFinset).card + 1) :=
- (add_le_add
- (Finset.sum_le_sum fun x _ => rootMultiplicity_sub_one_le_derivative_rootMultiplicity _ _)
- p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ)
- _ ≤ (∑ x in p.roots.toFinset, p.derivative.roots.count x) +
- ((∑ x in p.derivative.roots.toFinset \ p.roots.toFinset,
- p.derivative.roots.count x) + 1) := by
- simp only [← count_roots]
- refine' add_le_add_left (add_le_add_right ((Finset.card_eq_sum_ones _).trans_le _) _) _
- refine' Finset.sum_le_sum fun x hx => Nat.succ_le_iff.2 <| _
- rw [Multiset.count_pos, ← Multiset.mem_toFinset]
- exact (Finset.mem_sdiff.1 hx).1
- _ = Multiset.card (derivative p).roots + 1 := by
- rw [← add_assoc, ← Finset.sum_union Finset.disjoint_sdiff, Finset.union_sdiff_self_eq_union, ←
- Multiset.toFinset_sum_count_eq, ← Finset.sum_subset (Finset.subset_union_right _ _)]
- intro x _ hx₂
- simpa only [Multiset.mem_toFinset, Multiset.count_eq_zero] using hx₂
-#align polynomial.card_roots_le_derivative Polynomial.card_roots_le_derivative
-
-/-- The number of real roots of a polynomial is at most the number of roots of its derivative plus
-one. -/
-theorem card_rootSet_le_derivative {F : Type _} [CommRing F] [Algebra F ℝ] (p : F[X]) :
- Fintype.card (p.rootSet ℝ) ≤ Fintype.card (p.derivative.rootSet ℝ) + 1 := by
- simpa only [rootSet_def, Finset.coe_sort_coe, Fintype.card_coe, derivative_map] using
- card_roots_toFinset_le_derivative (p.map (algebraMap F ℝ))
-#align polynomial.card_root_set_le_derivative Polynomial.card_rootSet_le_derivative
-
-end Polynomial
@@ -2,16 +2,13 @@
Copyright (c) 2019 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-
-! This file was ported from Lean 3 source module analysis.calculus.local_extr
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Topology.Algebra.Order.ExtendFrom
import Mathlib.Topology.Algebra.Polynomial
+#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
+
/-!
# Local extrema of smooth functions
at
and goals (#5387)
Changes are of the form
some_tactic at h⊢
-> some_tactic at h ⊢
some_tactic at h
-> some_tactic at h
@@ -340,7 +340,7 @@ theorem exists_deriv_eq_zero' (hab : a < b) (hfa : Tendsto f (𝓝[>] a) (𝓝 l
show ∃ c ∈ Ioo a b, deriv f c = 0 from
exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).hasDerivAt)
fun h : ¬∀ x ∈ Ioo a b, DifferentiableAt ℝ f x =>
- have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h; exact h
+ have h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x := by push_neg at h; exact h
let ⟨c, hc, hcdiff⟩ := h
⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩
#align exists_deriv_eq_zero' exists_deriv_eq_zero'
I wrote a script to find lines that contain an odd number of backticks
@@ -26,7 +26,7 @@ This set is used in the proof of Fermat's Theorem (see below), and can be used t
## Main statements
For each theorem name listed below,
-we also prove similar theorems for `min`, `extr` (if applicable)`,
+we also prove similar theorems for `min`, `extr` (if applicable),
and `(f)deriv` instead of `has_fderiv`.
* `IsLocalMaxOn.hasFDerivWithinAt_nonpos` : `f' y ≤ 0` whenever `a` is a local maximum
@@ -97,7 +97,7 @@ theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segmen
show x + d n ∈ segment ℝ x y
· rw [segment_eq_image']
refine' ⟨(c n)⁻¹, ⟨_, _⟩, rfl⟩
- exacts[inv_nonneg.2 (pow_nonneg zero_le_two _), inv_le_one (one_le_pow_of_one_le one_le_two _)]
+ exacts [inv_nonneg.2 (pow_nonneg zero_le_two _), inv_le_one (one_le_pow_of_one_le one_le_two _)]
show Tendsto (fun n => c n • d n) atTop (𝓝 (y - x))
· exact tendsto_const_nhds.congr fun n ↦ (smul_inv_smul₀ (pow_ne_zero _ two_ne_zero) _).symm
#align mem_pos_tangent_cone_at_of_segment_subset mem_posTangentConeAt_of_segment_subset
@@ -282,9 +282,9 @@ theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (h
refine ⟨c', hc', Or.inl fun x hx ↦ ?_⟩
simp only [mem_setOf_eq, this x hx, this c' (Ioo_subset_Icc_self hc'), le_rfl]
· refine' ⟨C, ⟨lt_of_le_of_ne Cmem.1 <| mt _ hC, lt_of_le_of_ne Cmem.2 <| mt _ hC⟩, Or.inr Cge⟩
- exacts[fun h => by rw [h], fun h => by rw [h, hfI]]
+ exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
· refine' ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt _ hc, lt_of_le_of_ne cmem.2 <| mt _ hc⟩, Or.inl cle⟩
- exacts[fun h => by rw [h], fun h => by rw [h, hfI]]
+ exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
#align exists_Ioo_extr_on_Icc exists_Ioo_extr_on_Icc
/-- A continuous function on a closed interval with `f a = f b` has a local extremum at some
The unported dependencies are
algebra.order.module
init.core
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
algebra.order.monoid.cancel.basic
init.data.list.default
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file