analysis.convex.specific_functions.deriv
⟷
Mathlib.Analysis.Convex.SpecificFunctions.Deriv
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)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,7 +3,7 @@ Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
-/
-import Analysis.Calculus.Deriv.Zpow
+import Analysis.Calculus.Deriv.ZPow
import Analysis.SpecialFunctions.Pow.Deriv
import Analysis.SpecialFunctions.Sqrt
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -82,7 +82,7 @@ theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in
by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn; · simp
- rw [← two_mul] at ihn
+ rw [← two_mul] at ihn
rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, bit0, ← add_assoc, Finset.prod_range_succ,
Finset.prod_range_succ, mul_assoc]
refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
@@ -99,7 +99,7 @@ theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0
0 < ∏ k in Finset.range n, (m - k) :=
by
refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
- rw [eq_comm, Finset.prod_eq_zero_iff] at h
+ rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
@@ -117,8 +117,8 @@ theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
rw [iter_deriv_zpow]
refine' mul_pos _ (zpow_pos_of_pos hx _)
exact_mod_cast int_prod_range_pos (even_bit0 1) fun hm => _
- norm_cast at hm
- rw [← Finset.coe_Ico] at hm
+ norm_cast at hm
+ rw [← Finset.coe_Ico] at hm
fin_cases hm <;> cc
#align strict_convex_on_zpow strictConvexOn_zpow
-/
@@ -198,7 +198,7 @@ open scoped Real
theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin :=
by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuous_on_sin fun x hx => _
- rw [interior_Icc] at hx
+ rw [interior_Icc] at hx
simp [sin_pos_of_mem_Ioo hx]
#align strict_concave_on_sin_Icc strictConcaveOn_sin_Icc
-/
@@ -207,7 +207,7 @@ theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin :=
theorem strictConcaveOn_cos_Icc : StrictConcaveOn ℝ (Icc (-(π / 2)) (π / 2)) cos :=
by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuous_on_cos fun x hx => _
- rw [interior_Icc] at hx
+ rw [interior_Icc] at hx
simp [cos_pos_of_mem_Ioo hx]
#align strict_concave_on_cos_Icc strictConcaveOn_cos_Icc
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -44,7 +44,7 @@ theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0)
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y hy hxy =>
- mul_lt_mul_of_pos_left (pow_lt_pow_of_lt_left hxy hx.le <| Nat.sub_pos_of_lt hn)
+ mul_lt_mul_of_pos_left (pow_lt_pow_left hxy hx.le <| Nat.sub_pos_of_lt hn)
(Nat.cast_pos.2 <| zero_lt_two.trans_le hn)
#align strict_convex_on_pow strictConvexOn_pow
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
-/
-import Mathbin.Analysis.Calculus.Deriv.Zpow
-import Mathbin.Analysis.SpecialFunctions.Pow.Deriv
-import Mathbin.Analysis.SpecialFunctions.Sqrt
+import Analysis.Calculus.Deriv.Zpow
+import Analysis.SpecialFunctions.Pow.Deriv
+import Analysis.SpecialFunctions.Sqrt
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"c20927220ef87bb4962ba08bf6da2ce3cf50a6dd"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.convex.specific_functions.deriv
-! leanprover-community/mathlib commit c20927220ef87bb4962ba08bf6da2ce3cf50a6dd
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Analysis.Calculus.Deriv.Zpow
import Mathbin.Analysis.SpecialFunctions.Pow.Deriv
import Mathbin.Analysis.SpecialFunctions.Sqrt
+#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"c20927220ef87bb4962ba08bf6da2ce3cf50a6dd"
+
/-!
# Collection of convex functions
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -40,6 +40,7 @@ open Real Set
open scoped BigOperators NNReal
+#print strictConvexOn_pow /-
/-- `x^n`, `n : ℕ` is strictly convex on `[0, +∞)` for all `n` greater than `2`. -/
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n :=
by
@@ -49,7 +50,9 @@ theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0)
mul_lt_mul_of_pos_left (pow_lt_pow_of_lt_left hxy hx.le <| Nat.sub_pos_of_lt hn)
(Nat.cast_pos.2 <| zero_lt_two.trans_le hn)
#align strict_convex_on_pow strictConvexOn_pow
+-/
+#print Even.strictConvexOn_pow /-
/-- `x^n`, `n : ℕ` is strictly convex on the whole real line whenever `n ≠ 0` is even. -/
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n :=
@@ -61,7 +64,9 @@ theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
+-/
+#print Finset.prod_nonneg_of_card_nonpos_even /-
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type _} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filterₓ fun x => f x ≤ 0).card) :
0 ≤ ∏ x in s, f x :=
@@ -73,7 +78,9 @@ theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type _} [LinearOrderedCo
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
+-/
+#print int_prod_range_nonneg /-
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in Finset.range n, (m - k) :=
by
rcases hn with ⟨n, rfl⟩
@@ -88,7 +95,9 @@ theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
+-/
+#print int_prod_range_pos /-
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k in Finset.range n, (m - k) :=
by
@@ -98,7 +107,9 @@ theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
+-/
+#print strictConvexOn_zpow /-
/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m` except `0` and `1`. -/
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m :=
@@ -113,9 +124,11 @@ theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
rw [← Finset.coe_Ico] at hm
fin_cases hm <;> cc
#align strict_convex_on_zpow strictConvexOn_zpow
+-/
section SqrtMulLog
+#print hasDerivAt_sqrt_mul_log /-
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x :=
by
@@ -123,7 +136,9 @@ theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
rw [add_div, div_mul_right (sqrt x) two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
div_eq_mul_one_div, mul_comm]
#align has_deriv_at_sqrt_mul_log hasDerivAt_sqrt_mul_log
+-/
+#print deriv_sqrt_mul_log /-
theorem deriv_sqrt_mul_log (x : ℝ) :
deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) :=
by
@@ -134,12 +149,16 @@ theorem deriv_sqrt_mul_log (x : ℝ) :
refine' (hasDerivWithinAt_const x _ 0).congr_of_mem (fun x hx => _) hx
rw [sqrt_eq_zero_of_nonpos hx, MulZeroClass.zero_mul]
#align deriv_sqrt_mul_log deriv_sqrt_mul_log
+-/
+#print deriv_sqrt_mul_log' /-
theorem deriv_sqrt_mul_log' :
(deriv fun x => sqrt x * log x) = fun x => (2 + log x) / (2 * sqrt x) :=
funext deriv_sqrt_mul_log
#align deriv_sqrt_mul_log' deriv_sqrt_mul_log'
+-/
+#print deriv2_sqrt_mul_log /-
theorem deriv2_sqrt_mul_log (x : ℝ) :
(deriv^[2]) (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) :=
by
@@ -157,7 +176,9 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
nth_rw 3 [← mul_self_sqrt hx.le]
field_simp; ring
#align deriv2_sqrt_mul_log deriv2_sqrt_mul_log
+-/
+#print strictConcaveOn_sqrt_mul_log_Ioi /-
theorem strictConcaveOn_sqrt_mul_log_Ioi : StrictConcaveOn ℝ (Set.Ioi 1) fun x => sqrt x * log x :=
by
apply strictConcaveOn_of_deriv2_neg' (convex_Ioi 1) _ fun x hx => _
@@ -170,22 +191,27 @@ theorem strictConcaveOn_sqrt_mul_log_Ioi : StrictConcaveOn ℝ (Set.Ioi 1) fun x
div_neg_of_neg_of_pos (neg_neg_of_pos (log_pos hx))
(mul_pos four_pos (pow_pos (sqrt_pos.mpr (zero_lt_one.trans hx)) 3))
#align strict_concave_on_sqrt_mul_log_Ioi strictConcaveOn_sqrt_mul_log_Ioi
+-/
end SqrtMulLog
open scoped Real
+#print strictConcaveOn_sin_Icc /-
theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin :=
by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuous_on_sin fun x hx => _
rw [interior_Icc] at hx
simp [sin_pos_of_mem_Ioo hx]
#align strict_concave_on_sin_Icc strictConcaveOn_sin_Icc
+-/
+#print strictConcaveOn_cos_Icc /-
theorem strictConcaveOn_cos_Icc : StrictConcaveOn ℝ (Icc (-(π / 2)) (π / 2)) cos :=
by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuous_on_cos fun x hx => _
rw [interior_Icc] at hx
simp [cos_pos_of_mem_Ioo hx]
#align strict_concave_on_cos_Icc strictConcaveOn_cos_Icc
+-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -74,7 +74,7 @@ theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type _} [LinearOrderedCo
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
-theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in Finset.range n, m - k :=
+theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in Finset.range n, (m - k) :=
by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn; · simp
@@ -90,7 +90,7 @@ theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
- 0 < ∏ k in Finset.range n, m - k :=
+ 0 < ∏ k in Finset.range n, (m - k) :=
by
refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
rw [eq_comm, Finset.prod_eq_zero_iff] at h
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -72,7 +72,6 @@ theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type _} [LinearOrderedCo
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
-
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in Finset.range n, m - k :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/31c24aa72e7b3e5ed97a8412470e904f82b81004
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
! This file was ported from Lean 3 source module analysis.convex.specific_functions.deriv
-! leanprover-community/mathlib commit a16665637b378379689c566204817ae792ac8b39
+! leanprover-community/mathlib commit c20927220ef87bb4962ba08bf6da2ce3cf50a6dd
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -15,6 +15,9 @@ import Mathbin.Analysis.SpecialFunctions.Sqrt
/-!
# Collection of convex functions
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
In this file we prove that certain specific functions are strictly convex, including the following:
* `even.strict_convex_on_pow` : For an even `n : ℕ` with `2 ≤ n`, `λ x, x ^ n` is strictly convex.
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -4,15 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
! This file was ported from Lean 3 source module analysis.convex.specific_functions.deriv
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
+! leanprover-community/mathlib commit a16665637b378379689c566204817ae792ac8b39
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
-import Mathbin.Analysis.Convex.SpecificFunctions.Basic
import Mathbin.Analysis.Calculus.Deriv.Zpow
import Mathbin.Analysis.SpecialFunctions.Pow.Deriv
import Mathbin.Analysis.SpecialFunctions.Sqrt
-import Mathbin.Tactic.LinearCombination
/-!
# Collection of convex functions
@@ -109,7 +107,7 @@ theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
rw [iter_deriv_zpow]
refine' mul_pos _ (zpow_pos_of_pos hx _)
exact_mod_cast int_prod_range_pos (even_bit0 1) fun hm => _
- norm_cast at hm
+ norm_cast at hm
rw [← Finset.coe_Ico] at hm
fin_cases hm <;> cc
#align strict_convex_on_zpow strictConvexOn_zpow
@@ -119,7 +117,7 @@ section SqrtMulLog
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x :=
by
- convert(has_deriv_at_sqrt hx).mul (has_deriv_at_log hx)
+ convert (has_deriv_at_sqrt hx).mul (has_deriv_at_log hx)
rw [add_div, div_mul_right (sqrt x) two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
div_eq_mul_one_div, mul_comm]
#align has_deriv_at_sqrt_mul_log hasDerivAt_sqrt_mul_log
@@ -150,7 +148,8 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx
rw [sqrt_eq_zero_of_nonpos hx, MulZeroClass.mul_zero, div_zero]
· have h₀ : sqrt x ≠ 0 := sqrt_ne_zero'.2 hx
- convert(((has_deriv_at_log hx.ne').const_add 2).div ((has_deriv_at_sqrt hx.ne').const_mul 2) <|
+ convert
+ (((has_deriv_at_log hx.ne').const_add 2).div ((has_deriv_at_sqrt hx.ne').const_mul 2) <|
mul_ne_zero two_ne_zero h₀).deriv using
1
nth_rw 3 [← mul_self_sqrt hx.le]
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -66,7 +66,7 @@ theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type _} [LinearOrderedCo
0 ≤ ∏ x in s, f x :=
calc
0 ≤ ∏ x in s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
- Finset.prod_nonneg fun x _ => by split_ifs with hx hx; · simp [hx]; simp at hx⊢;
+ Finset.prod_nonneg fun x _ => by split_ifs with hx hx; · simp [hx]; simp at hx ⊢;
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
@@ -78,7 +78,7 @@ theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k in
by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn; · simp
- rw [← two_mul] at ihn
+ rw [← two_mul] at ihn
rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, bit0, ← add_assoc, Finset.prod_range_succ,
Finset.prod_range_succ, mul_assoc]
refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
@@ -93,7 +93,7 @@ theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0
0 < ∏ k in Finset.range n, m - k :=
by
refine' (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm _
- rw [eq_comm, Finset.prod_eq_zero_iff] at h
+ rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
@@ -109,8 +109,8 @@ theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
rw [iter_deriv_zpow]
refine' mul_pos _ (zpow_pos_of_pos hx _)
exact_mod_cast int_prod_range_pos (even_bit0 1) fun hm => _
- norm_cast at hm
- rw [← Finset.coe_Ico] at hm
+ norm_cast at hm
+ rw [← Finset.coe_Ico] at hm
fin_cases hm <;> cc
#align strict_convex_on_zpow strictConvexOn_zpow
@@ -177,14 +177,14 @@ open scoped Real
theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin :=
by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuous_on_sin fun x hx => _
- rw [interior_Icc] at hx
+ rw [interior_Icc] at hx
simp [sin_pos_of_mem_Ioo hx]
#align strict_concave_on_sin_Icc strictConcaveOn_sin_Icc
theorem strictConcaveOn_cos_Icc : StrictConcaveOn ℝ (Icc (-(π / 2)) (π / 2)) cos :=
by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuous_on_cos fun x hx => _
- rw [interior_Icc] at hx
+ rw [interior_Icc] at hx
simp [cos_pos_of_mem_Ioo hx]
#align strict_concave_on_cos_Icc strictConcaveOn_cos_Icc
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -37,7 +37,7 @@ of these could also be switched to elementary proofs, like in
open Real Set
-open BigOperators NNReal
+open scoped BigOperators NNReal
/-- `x^n`, `n : ℕ` is strictly convex on `[0, +∞)` for all `n` greater than `2`. -/
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n :=
@@ -172,7 +172,7 @@ theorem strictConcaveOn_sqrt_mul_log_Ioi : StrictConcaveOn ℝ (Set.Ioi 1) fun x
end SqrtMulLog
-open Real
+open scoped Real
theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -66,10 +66,7 @@ theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type _} [LinearOrderedCo
0 ≤ ∏ x in s, f x :=
calc
0 ≤ ∏ x in s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
- Finset.prod_nonneg fun x _ => by
- split_ifs with hx hx
- · simp [hx]
- simp at hx⊢
+ Finset.prod_nonneg fun x _ => by split_ifs with hx hx; · simp [hx]; simp at hx⊢;
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
@@ -157,8 +154,7 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
mul_ne_zero two_ne_zero h₀).deriv using
1
nth_rw 3 [← mul_self_sqrt hx.le]
- field_simp
- ring
+ field_simp; ring
#align deriv2_sqrt_mul_log deriv2_sqrt_mul_log
theorem strictConcaveOn_sqrt_mul_log_Ioi : StrictConcaveOn ℝ (Set.Ioi 1) fun x => sqrt x * log x :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -4,11 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
! This file was ported from Lean 3 source module analysis.convex.specific_functions.deriv
-! leanprover-community/mathlib commit 8f9fea08977f7e450770933ee6abb20733b47c92
+! 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.Convex.SpecificFunctions.Basic
+import Mathbin.Analysis.Calculus.Deriv.Zpow
import Mathbin.Analysis.SpecialFunctions.Pow.Deriv
import Mathbin.Analysis.SpecialFunctions.Sqrt
import Mathbin.Tactic.LinearCombination
mathlib commit https://github.com/leanprover-community/mathlib/commit/95a87616d63b3cb49d3fe678d416fbe9c4217bf4
This adds the notation √r
for Real.sqrt r
. The precedence is such that √x⁻¹
is parsed as √(x⁻¹)
; not because this is particularly desirable, but because it's the default and the choice doesn't really matter.
This is extracted from #7907, which adds a more general nth root typeclass.
The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot.
This PR also won't rot as quickly, as it does not forbid writing x.sqrt
as that PR does.
While perhaps claiming √
for Real.sqrt
is greedy; it:
NNReal.sqrt
and Nat.sqrt
sqrt
on Float
Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
@@ -113,14 +113,14 @@ theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
section SqrtMulLog
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
- HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x := by
+ HasDerivAt (fun x => √x * log x) ((2 + log x) / (2 * √x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
one_div, one_div, ← div_eq_inv_mul]
#align has_deriv_at_sqrt_mul_log hasDerivAt_sqrt_mul_log
theorem deriv_sqrt_mul_log (x : ℝ) :
- deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
+ deriv (fun x => √x * log x) x = (2 + log x) / (2 * √x) := by
cases' lt_or_le 0 x with hx hx
· exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
· rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
@@ -130,29 +130,29 @@ theorem deriv_sqrt_mul_log (x : ℝ) :
#align deriv_sqrt_mul_log deriv_sqrt_mul_log
theorem deriv_sqrt_mul_log' :
- (deriv fun x => sqrt x * log x) = fun x => (2 + log x) / (2 * sqrt x) :=
+ (deriv fun x => √x * log x) = fun x => (2 + log x) / (2 * √x) :=
funext deriv_sqrt_mul_log
#align deriv_sqrt_mul_log' deriv_sqrt_mul_log'
theorem deriv2_sqrt_mul_log (x : ℝ) :
- deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
+ deriv^[2] (fun x => √x * log x) x = -log x / (4 * √x ^ 3) := by
simp only [Nat.iterate, deriv_sqrt_mul_log']
rcases le_or_lt x 0 with hx | hx
· rw [sqrt_eq_zero_of_nonpos hx, zero_pow three_ne_zero, mul_zero, div_zero]
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx
rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
- · have h₀ : sqrt x ≠ 0 := sqrt_ne_zero'.2 hx
+ · have h₀ : √x ≠ 0 := sqrt_ne_zero'.2 hx
convert (((hasDerivAt_log hx.ne').const_add 2).div ((hasDerivAt_sqrt hx.ne').const_mul 2) <|
mul_ne_zero two_ne_zero h₀).deriv using 1
nth_rw 3 [← mul_self_sqrt hx.le]
- generalize sqrt x = sqx at h₀ -- else field_simp rewrites sqrt x * sqrt x back to x
+ generalize √x = sqx at h₀ -- else field_simp rewrites sqrt x * sqrt x back to x
field_simp
ring
#align deriv2_sqrt_mul_log deriv2_sqrt_mul_log
theorem strictConcaveOn_sqrt_mul_log_Ioi :
- StrictConcaveOn ℝ (Set.Ioi 1) fun x => sqrt x * log x := by
+ StrictConcaveOn ℝ (Set.Ioi 1) fun x => √x * log x := by
apply strictConcaveOn_of_deriv2_neg' (convex_Ioi 1) _ fun x hx => ?_
· exact continuous_sqrt.continuousOn.mul
(continuousOn_log.mono fun x hx => ne_of_gt (zero_lt_one.trans hx))
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 | |
@@ -115,8 +115,8 @@ section SqrtMulLog
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
- rw [add_div, div_mul_right (sqrt x) two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
- div_eq_mul_one_div, mul_comm]
+ rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
+ one_div, one_div, ← div_eq_inv_mul]
#align has_deriv_at_sqrt_mul_log hasDerivAt_sqrt_mul_log
theorem deriv_sqrt_mul_log (x : ℝ) :
This PR carves off lemmas about convex functions from Analysis/Calculus/MeanValue.lean
and relocates them to a new file. (This is a preparatory step for adding some more lemmas on this topic, since MeanValue.lean
is already over-long.)
@@ -7,6 +7,7 @@ import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
+import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
f ^ n
(#9617)
This involves moving lemmas from Algebra.GroupPower.Ring
to Algebra.GroupWithZero.Basic
and changing some 0 < n
assumptions to n ≠ 0
.
From LeanAPAP
@@ -137,7 +137,7 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
simp only [Nat.iterate, deriv_sqrt_mul_log']
rcases le_or_lt x 0 with hx | hx
- · rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, mul_zero, div_zero]
+ · rw [sqrt_eq_zero_of_nonpos hx, zero_pow three_ne_zero, mul_zero, div_zero]
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx
rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
@@ -4,8 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
-/
import Mathlib.Analysis.Calculus.Deriv.ZPow
-import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
import Mathlib.Analysis.SpecialFunctions.Sqrt
+import Mathlib.Analysis.SpecialFunctions.Log.Deriv
+import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
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
.
@@ -76,7 +76,7 @@ theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
rw [← two_mul, Nat.succ_eq_add_one, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine' mul_nonneg ihn _; generalize (1 + 1) * n = k
- cases' le_or_lt m k with hmk hmk
+ rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
@@ -135,7 +135,7 @@ theorem deriv_sqrt_mul_log' :
theorem deriv2_sqrt_mul_log (x : ℝ) :
deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
simp only [Nat.iterate, deriv_sqrt_mul_log']
- cases' le_or_lt x 0 with hx hx
+ rcases le_or_lt x 0 with hx | hx
· rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, mul_zero, div_zero]
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx
The names for lemmas about monotonicity of (a ^ ·)
and (· ^ n)
were a mess. This PR tidies up everything related by following the naming convention for (a * ·)
and (· * b)
. Namely, (a ^ ·)
is pow_right
and (· ^ n)
is pow_left
in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Order
pow_mono
→ pow_right_mono
pow_le_pow
→ pow_le_pow_right
pow_le_pow_of_le_left
→ pow_le_pow_left
pow_lt_pow_of_lt_left
→ pow_lt_pow_left
strictMonoOn_pow
→ pow_left_strictMonoOn
pow_strictMono_right
→ pow_right_strictMono
pow_lt_pow
→ pow_lt_pow_right
pow_lt_pow_iff
→ pow_lt_pow_iff_right
pow_le_pow_iff
→ pow_le_pow_iff_right
self_lt_pow
→ lt_self_pow
strictAnti_pow
→ pow_right_strictAnti
pow_lt_pow_iff_of_lt_one
→ pow_lt_pow_iff_right_of_lt_one
pow_lt_pow_of_lt_one
→ pow_lt_pow_right_of_lt_one
lt_of_pow_lt_pow
→ lt_of_pow_lt_pow_left
le_of_pow_le_pow
→ le_of_pow_le_pow_left
pow_lt_pow₀
→ pow_lt_pow_right₀
Algebra.GroupPower.CovariantClass
pow_le_pow_of_le_left'
→ pow_le_pow_left'
nsmul_le_nsmul_of_le_right
→ nsmul_le_nsmul_right
pow_lt_pow'
→ pow_lt_pow_right'
nsmul_lt_nsmul
→ nsmul_lt_nsmul_left
pow_strictMono_left
→ pow_right_strictMono'
nsmul_strictMono_right
→ nsmul_left_strictMono
StrictMono.pow_right'
→ StrictMono.pow_const
StrictMono.nsmul_left
→ StrictMono.const_nsmul
pow_strictMono_right'
→ pow_left_strictMono
nsmul_strictMono_left
→ nsmul_right_strictMono
Monotone.pow_right
→ Monotone.pow_const
Monotone.nsmul_left
→ Monotone.const_nsmul
lt_of_pow_lt_pow'
→ lt_of_pow_lt_pow_left'
lt_of_nsmul_lt_nsmul
→ lt_of_nsmul_lt_nsmul_right
pow_le_pow'
→ pow_le_pow_right'
nsmul_le_nsmul
→ nsmul_le_nsmul_left
pow_le_pow_of_le_one'
→ pow_le_pow_right_of_le_one'
nsmul_le_nsmul_of_nonpos
→ nsmul_le_nsmul_left_of_nonpos
le_of_pow_le_pow'
→ le_of_pow_le_pow_left'
le_of_nsmul_le_nsmul'
→ le_of_nsmul_le_nsmul_right'
pow_le_pow_iff'
→ pow_le_pow_iff_right'
nsmul_le_nsmul_iff
→ nsmul_le_nsmul_iff_left
pow_lt_pow_iff'
→ pow_lt_pow_iff_right'
nsmul_lt_nsmul_iff
→ nsmul_lt_nsmul_iff_left
Data.Nat.Pow
Nat.pow_lt_pow_of_lt_left
→ Nat.pow_lt_pow_left
Nat.pow_le_iff_le_left
→ Nat.pow_le_pow_iff_left
Nat.pow_lt_iff_lt_left
→ Nat.pow_lt_pow_iff_left
pow_le_pow_iff_left
pow_lt_pow_iff_left
pow_right_injective
pow_right_inj
Nat.pow_le_pow_left
to have the correct name since Nat.pow_le_pow_of_le_left
is in Std.Nat.pow_le_pow_right
to have the correct name since Nat.pow_le_pow_of_le_right
is in Std.self_le_pow
was a duplicate of le_self_pow
.Nat.pow_lt_pow_of_lt_right
is defeq to pow_lt_pow_right
.Nat.pow_right_strictMono
is defeq to pow_right_strictMono
.Nat.pow_le_iff_le_right
is defeq to pow_le_pow_iff_right
.Nat.pow_lt_iff_lt_right
is defeq to pow_lt_pow_iff_right
.0 < n
or 1 ≤ n
to n ≠ 0
.Nat
lemmas have been protected
.@@ -38,9 +38,8 @@ open scoped BigOperators NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
- exact fun x (hx : 0 < x) y hy hxy =>
- mul_lt_mul_of_pos_left (pow_lt_pow_of_lt_left hxy hx.le <| Nat.sub_pos_of_lt hn)
- (Nat.cast_pos.2 <| zero_lt_two.trans_le hn)
+ exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
+ (pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
/-- `x^n`, `n : ℕ` is strictly convex on the whole real line whenever `n ≠ 0` is even. -/
@@ -61,7 +61,7 @@ theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCom
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
- simp at hx ⊢
+ simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -34,8 +34,6 @@ open Real Set
open scoped BigOperators NNReal
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
/-- `x^n`, `n : ℕ` is strictly convex on `[0, +∞)` for all `n` greater than `2`. -/
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
@@ -105,7 +103,7 @@ theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
rw [iter_deriv_zpow]
refine' mul_pos _ (zpow_pos_of_pos hx _)
norm_cast
- refine' int_prod_range_pos (by simp only) fun hm => _
+ refine' int_prod_range_pos (by decide) fun hm => _
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
The main reasons is that having h : 0 < denom
in the context should suffice for field_simp
to do its job, without the need to manually pass h.ne
or similar.
Quite a few have := … ≠ 0
could be dropped, and some field_simp
calls no longer need explicit arguments; this is promising.
This does break some proofs where field_simp
was not used as a closing tactic, and it now
shuffles terms around a bit different. These were fixed. Using field_simp
in the middle of a proof seems rather fragile anyways.
As a drive-by contribution, positivity
now knows about π > 0
.
fixes: #4835
Co-authored-by: Matthew Ballard <matt@mrb.email>
@@ -147,7 +147,9 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
convert (((hasDerivAt_log hx.ne').const_add 2).div ((hasDerivAt_sqrt hx.ne').const_mul 2) <|
mul_ne_zero two_ne_zero h₀).deriv using 1
nth_rw 3 [← mul_self_sqrt hx.le]
- field_simp; ring
+ generalize sqrt x = sqx at h₀ -- else field_simp rewrites sqrt x * sqrt x back to x
+ field_simp
+ ring
#align deriv2_sqrt_mul_log deriv2_sqrt_mul_log
theorem strictConcaveOn_sqrt_mul_log_Ioi :
MulZeroClass.
in mul_zero
/zero_mul
(#6682)
Search&replace MulZeroClass.mul_zero
-> mul_zero
, MulZeroClass.zero_mul
-> zero_mul
.
These were introduced by Mathport, as the full name of mul_zero
is actually MulZeroClass.mul_zero
(it's exported with the short name).
@@ -124,10 +124,10 @@ theorem deriv_sqrt_mul_log (x : ℝ) :
deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
cases' lt_or_le 0 x with hx hx
· exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
- · rw [sqrt_eq_zero_of_nonpos hx, MulZeroClass.mul_zero, div_zero]
+ · rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
refine' (hasDerivWithinAt_const x _ 0).congr_of_mem (fun x hx => _) hx
- rw [sqrt_eq_zero_of_nonpos hx, MulZeroClass.zero_mul]
+ rw [sqrt_eq_zero_of_nonpos hx, zero_mul]
#align deriv_sqrt_mul_log deriv_sqrt_mul_log
theorem deriv_sqrt_mul_log' :
@@ -139,10 +139,10 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
simp only [Nat.iterate, deriv_sqrt_mul_log']
cases' le_or_lt x 0 with hx hx
- · rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, MulZeroClass.mul_zero, div_zero]
+ · rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, mul_zero, div_zero]
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx
- rw [sqrt_eq_zero_of_nonpos hx, MulZeroClass.mul_zero, div_zero]
+ rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
· have h₀ : sqrt x ≠ 0 := sqrt_ne_zero'.2 hx
convert (((hasDerivAt_log hx.ne').const_add 2).div ((hasDerivAt_sqrt hx.ne').const_mul 2) <|
mul_ne_zero two_ne_zero h₀).deriv using 1
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -55,7 +55,7 @@ theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
-theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type _} [LinearOrderedCommRing β] {f : α → β}
+theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x in s, f x :=
calc
@@ -34,7 +34,7 @@ open Real Set
open scoped BigOperators NNReal
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
/-- `x^n`, `n : ℕ` is strictly convex on `[0, +∞)` for all `n` greater than `2`. -/
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
@@ -2,16 +2,13 @@
Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.convex.specific_functions.deriv
-! leanprover-community/mathlib commit a16665637b378379689c566204817ae792ac8b39
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
import Mathlib.Analysis.SpecialFunctions.Sqrt
+#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
+
/-!
# Collection of convex functions
@@ -139,7 +139,7 @@ theorem deriv_sqrt_mul_log' :
#align deriv_sqrt_mul_log' deriv_sqrt_mul_log'
theorem deriv2_sqrt_mul_log (x : ℝ) :
- (deriv^[2]) (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
+ deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
simp only [Nat.iterate, deriv_sqrt_mul_log']
cases' le_or_lt x 0 with hx hx
· rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, MulZeroClass.mul_zero, div_zero]
Cf. this Zulip thread.
@@ -37,9 +37,10 @@ open Real Set
open scoped BigOperators NNReal
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+
/-- `x^n`, `n : ℕ` is strictly convex on `[0, +∞)` for all `n` greater than `2`. -/
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
- simp_rw [rpow_nat_cast]
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y hy hxy =>
@@ -50,7 +51,6 @@ theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0)
/-- `x^n`, `n : ℕ` is strictly convex on the whole real line whenever `n ≠ 0` is even. -/
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
- simp_rw [rpow_nat_cast]
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
@@ -102,12 +102,9 @@ theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
- · simp only [rpow_int_cast]
- exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
+ · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
- -- Porting note: some extra `simp only`s and `norm_cast`s needed to untangle coercions
- simp only [rpow_int_cast]
- simp only [mem_Ioi] at hx
+ rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine' mul_pos _ (zpow_pos_of_pos hx _)
norm_cast
@@ -145,8 +142,7 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
(deriv^[2]) (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
simp only [Nat.iterate, deriv_sqrt_mul_log']
cases' le_or_lt x 0 with hx hx
- · rw [sqrt_eq_zero_of_nonpos hx]
- norm_num
+ · rw [sqrt_eq_zero_of_nonpos hx, zero_pow zero_lt_three, MulZeroClass.mul_zero, div_zero]
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx
rw [sqrt_eq_zero_of_nonpos hx, MulZeroClass.mul_zero, div_zero]
@@ -154,9 +150,7 @@ theorem deriv2_sqrt_mul_log (x : ℝ) :
convert (((hasDerivAt_log hx.ne').const_add 2).div ((hasDerivAt_sqrt hx.ne').const_mul 2) <|
mul_ne_zero two_ne_zero h₀).deriv using 1
nth_rw 3 [← mul_self_sqrt hx.le]
- have := pow_ne_zero 3 h₀
- have h₁ : sqrt x ^ 3 ≠ 0 := by norm_cast
- field_simp; norm_cast; ring
+ field_simp; ring
#align deriv2_sqrt_mul_log deriv2_sqrt_mul_log
theorem strictConcaveOn_sqrt_mul_log_Ioi :
@@ -165,7 +159,6 @@ theorem strictConcaveOn_sqrt_mul_log_Ioi :
· exact continuous_sqrt.continuousOn.mul
(continuousOn_log.mono fun x hx => ne_of_gt (zero_lt_one.trans hx))
· rw [deriv2_sqrt_mul_log x]
- norm_cast
exact div_neg_of_neg_of_pos (neg_neg_of_pos (log_pos hx))
(mul_pos four_pos (pow_pos (sqrt_pos.mpr (zero_lt_one.trans hx)) 3))
#align strict_concave_on_sqrt_mul_log_Ioi strictConcaveOn_sqrt_mul_log_Ioi
The unported dependencies are
algebra.order.module
init.core
linear_algebra.free_module.finite.rank
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
linear_algebra.free_module.rank
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