analysis.special_functions.trigonometric.bounds
⟷
Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds
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)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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
@@ -50,7 +50,7 @@ theorem sin_lt {x : ℝ} (h : 0 < x) : sin x < x :=
· exact (sin_le_one x).trans_lt h'
have hx : |x| = x := abs_of_nonneg h.le
have := le_of_abs_le (sin_bound <| show |x| ≤ 1 by rwa [hx])
- rw [sub_le_iff_le_add', hx] at this
+ rw [sub_le_iff_le_add', hx] at this
apply this.trans_lt
rw [sub_add, sub_lt_self_iff, sub_pos, div_eq_mul_inv (x ^ 3)]
refine' mul_lt_mul' _ (by norm_num) (by norm_num) (pow_pos h 3)
@@ -69,7 +69,7 @@ theorem sin_gt_sub_cube {x : ℝ} (h : 0 < x) (h' : x ≤ 1) : x - x ^ 3 / 4 < s
by
have hx : |x| = x := abs_of_nonneg h.le
have := neg_le_of_abs_le (sin_bound <| show |x| ≤ 1 by rwa [hx])
- rw [le_sub_iff_add_le, hx] at this
+ rw [le_sub_iff_add_le, hx] at this
refine' lt_of_lt_of_le _ this
have : x ^ 3 / 4 - x ^ 3 / 6 = x ^ 3 * 12⁻¹ := by norm_num [div_eq_mul_inv, ← mul_sub]
rw [add_comm, sub_add, sub_neg_eq_add, sub_lt_sub_iff_left, ← lt_sub_iff_add_lt', this]
@@ -104,7 +104,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x :=
have sin_pos : ∀ {y : ℝ}, y ∈ interior U → 0 < sin y :=
by
intro y hy
- rw [intU] at hy
+ rw [intU] at hy
exact sin_pos_of_mem_Ioo (Ioo_subset_Ioo_right (div_le_self pi_pos.le one_le_two) hy)
have tan_cts_U : ContinuousOn tan U :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -125,7 +125,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x :=
rwa [lt_inv, inv_one]
· exact zero_lt_one
simpa only [sq, mul_self_pos] using this.ne'
- have mono := Convex.strictMonoOn_of_deriv_pos (convex_Ico 0 (π / 2)) tan_minus_id_cts deriv_pos
+ have mono := strictMonoOn_of_deriv_pos (convex_Ico 0 (π / 2)) tan_minus_id_cts deriv_pos
have zero_in_U : (0 : ℝ) ∈ U := by rwa [left_mem_Ico]
have x_in_U : x ∈ U := ⟨h1.le, h2⟩
simpa only [tan_zero, sub_zero, sub_pos] using mono zero_in_U x_in_U h1
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2022 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
-import Mathbin.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
+import Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
#align_import analysis.special_functions.trigonometric.bounds from "leanprover-community/mathlib"@"7e5137f579de09a059a5ce98f364a04e221aabf0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2022 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-
-! This file was ported from Lean 3 source module analysis.special_functions.trigonometric.bounds
-! leanprover-community/mathlib commit 7e5137f579de09a059a5ce98f364a04e221aabf0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
+#align_import analysis.special_functions.trigonometric.bounds from "leanprover-community/mathlib"@"7e5137f579de09a059a5ce98f364a04e221aabf0"
+
/-!
# Polynomial bounds for trigonometric functions
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -45,6 +45,7 @@ namespace Real
open scoped Real
+#print Real.sin_lt /-
/-- For 0 < x, we have sin x < x. -/
theorem sin_lt {x : ℝ} (h : 0 < x) : sin x < x :=
by
@@ -59,7 +60,9 @@ theorem sin_lt {x : ℝ} (h : 0 < x) : sin x < x :=
apply pow_le_pow_of_le_one h.le h'
norm_num
#align real.sin_lt Real.sin_lt
+-/
+#print Real.sin_gt_sub_cube /-
/-- For 0 < x ≤ 1 we have x - x ^ 3 / 4 < sin x.
This is also true for x > 1, but it's nontrivial for x just above 1. This inequality is not
@@ -77,13 +80,17 @@ theorem sin_gt_sub_cube {x : ℝ} (h : 0 < x) (h' : x ≤ 1) : x - x ^ 3 / 4 < s
apply pow_le_pow_of_le_one h.le h'
norm_num
#align real.sin_gt_sub_cube Real.sin_gt_sub_cube
+-/
+#print Real.deriv_tan_sub_id /-
/-- The derivative of `tan x - x` is `1/(cos x)^2 - 1` away from the zeroes of cos. -/
theorem deriv_tan_sub_id (x : ℝ) (h : cos x ≠ 0) :
deriv (fun y : ℝ => tan y - y) x = 1 / cos x ^ 2 - 1 :=
HasDerivAt.deriv <| by simpa using (has_deriv_at_tan h).add (hasDerivAt_id x).neg
#align real.deriv_tan_sub_id Real.deriv_tan_sub_id
+-/
+#print Real.lt_tan /-
/-- For all `0 < x < π/2` we have `x < tan x`.
This is proved by checking that the function `tan x - x` vanishes
@@ -126,14 +133,18 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x :=
have x_in_U : x ∈ U := ⟨h1.le, h2⟩
simpa only [tan_zero, sub_zero, sub_pos] using mono zero_in_U x_in_U h1
#align real.lt_tan Real.lt_tan
+-/
+#print Real.le_tan /-
theorem le_tan {x : ℝ} (h1 : 0 ≤ x) (h2 : x < π / 2) : x ≤ tan x :=
by
rcases eq_or_lt_of_le h1 with (rfl | h1')
· rw [tan_zero]
· exact le_of_lt (lt_tan h1' h2)
#align real.le_tan Real.le_tan
+-/
+#print Real.cos_lt_one_div_sqrt_sq_add_one /-
theorem cos_lt_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx2 : x ≤ 3 * π / 2)
(hx3 : x ≠ 0) : cos x < 1 / sqrt (x ^ 2 + 1) :=
by
@@ -158,7 +169,9 @@ theorem cos_lt_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx
refine' lt_of_le_of_lt _ (one_div_pos.mpr <| sqrt_pos_of_pos hy3)
exact cos_nonpos_of_pi_div_two_le_of_le hy1' (by linarith [pi_pos])
#align real.cos_lt_one_div_sqrt_sq_add_one Real.cos_lt_one_div_sqrt_sq_add_one
+-/
+#print Real.cos_le_one_div_sqrt_sq_add_one /-
theorem cos_le_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx2 : x ≤ 3 * π / 2) :
cos x ≤ 1 / sqrt (x ^ 2 + 1) :=
by
@@ -166,6 +179,7 @@ theorem cos_le_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx
· simp
· exact (cos_lt_one_div_sqrt_sq_add_one hx1 hx2 hx3).le
#align real.cos_le_one_div_sqrt_sq_add_one Real.cos_le_one_div_sqrt_sq_add_one
+-/
end Real
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
! This file was ported from Lean 3 source module analysis.special_functions.trigonometric.bounds
-! leanprover-community/mathlib commit 2c1d8ca2812b64f88992a5294ea3dba144755cd1
+! leanprover-community/mathlib commit 7e5137f579de09a059a5ce98f364a04e221aabf0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -13,6 +13,9 @@ import Mathbin.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
/-!
# Polynomial bounds for trigonometric functions
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
## Main statements
This file contains upper and lower bounds for real trigonometric functions in terms
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -49,7 +49,7 @@ theorem sin_lt {x : ℝ} (h : 0 < x) : sin x < x :=
· exact (sin_le_one x).trans_lt h'
have hx : |x| = x := abs_of_nonneg h.le
have := le_of_abs_le (sin_bound <| show |x| ≤ 1 by rwa [hx])
- rw [sub_le_iff_le_add', hx] at this
+ rw [sub_le_iff_le_add', hx] at this
apply this.trans_lt
rw [sub_add, sub_lt_self_iff, sub_pos, div_eq_mul_inv (x ^ 3)]
refine' mul_lt_mul' _ (by norm_num) (by norm_num) (pow_pos h 3)
@@ -66,7 +66,7 @@ theorem sin_gt_sub_cube {x : ℝ} (h : 0 < x) (h' : x ≤ 1) : x - x ^ 3 / 4 < s
by
have hx : |x| = x := abs_of_nonneg h.le
have := neg_le_of_abs_le (sin_bound <| show |x| ≤ 1 by rwa [hx])
- rw [le_sub_iff_add_le, hx] at this
+ rw [le_sub_iff_add_le, hx] at this
refine' lt_of_lt_of_le _ this
have : x ^ 3 / 4 - x ^ 3 / 6 = x ^ 3 * 12⁻¹ := by norm_num [div_eq_mul_inv, ← mul_sub]
rw [add_comm, sub_add, sub_neg_eq_add, sub_lt_sub_iff_left, ← lt_sub_iff_add_lt', this]
@@ -97,7 +97,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x :=
have sin_pos : ∀ {y : ℝ}, y ∈ interior U → 0 < sin y :=
by
intro y hy
- rw [intU] at hy
+ rw [intU] at hy
exact sin_pos_of_mem_Ioo (Ioo_subset_Ioo_right (div_le_self pi_pos.le one_le_two) hy)
have tan_cts_U : ContinuousOn tan U :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -40,7 +40,7 @@ open Set
namespace Real
-open Real
+open scoped Real
/-- For 0 < x, we have sin x < x. -/
theorem sin_lt {x : ℝ} (h : 0 < x) : sin x < x :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -139,8 +139,7 @@ theorem cos_lt_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx
rcases lt_or_lt_iff_ne.mpr hx3.symm with ⟨⟩
· exact this h hx2
· convert this (by linarith : 0 < -x) (by linarith) using 1
- · rw [cos_neg]
- · rw [neg_sq]
+ · rw [cos_neg]; · rw [neg_sq]
intro y hy1 hy2
have hy3 : 0 < y ^ 2 + 1 := by linarith [sq_nonneg y]
rcases lt_or_le y (π / 2) with (hy2' | hy1')
mathlib commit https://github.com/leanprover-community/mathlib/commit/36b8aa61ea7c05727161f96a0532897bd72aedab
@@ -4,11 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
! This file was ported from Lean 3 source module analysis.special_functions.trigonometric.bounds
-! leanprover-community/mathlib commit 9df54c1b9dd5b6d6ed1472bfb6c10819aa95b5d7
+! 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.SpecialFunctions.Trigonometric.Basic
import Mathbin.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
/-!
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -200,7 +200,7 @@ theorem le_tan {x : ℝ} (h1 : 0 ≤ x) (h2 : x < π / 2) : x ≤ tan x := by
theorem cos_lt_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx2 : x ≤ 3 * π / 2)
(hx3 : x ≠ 0) : cos x < (1 / √(x ^ 2 + 1) : ℝ) := by
- suffices ∀ {y : ℝ}, 0 < y → y ≤ 3 * π / 2 → cos y < ↑1 / sqrt (y ^ 2 + 1) by
+ suffices ∀ {y : ℝ}, 0 < y → y ≤ 3 * π / 2 → cos y < 1 / sqrt (y ^ 2 + 1) by
rcases lt_or_lt_iff_ne.mpr hx3.symm with ⟨h⟩
· exact this h hx2
· convert this (by linarith : 0 < -x) (by linarith) using 1
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>
@@ -199,7 +199,7 @@ theorem le_tan {x : ℝ} (h1 : 0 ≤ x) (h2 : x < π / 2) : x ≤ tan x := by
#align real.le_tan Real.le_tan
theorem cos_lt_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx2 : x ≤ 3 * π / 2)
- (hx3 : x ≠ 0) : cos x < ↑1 / sqrt (x ^ 2 + 1) := by
+ (hx3 : x ≠ 0) : cos x < (1 / √(x ^ 2 + 1) : ℝ) := by
suffices ∀ {y : ℝ}, 0 < y → y ≤ 3 * π / 2 → cos y < ↑1 / sqrt (y ^ 2 + 1) by
rcases lt_or_lt_iff_ne.mpr hx3.symm with ⟨h⟩
· exact this h hx2
@@ -223,7 +223,7 @@ theorem cos_lt_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx
#align real.cos_lt_one_div_sqrt_sq_add_one Real.cos_lt_one_div_sqrt_sq_add_one
theorem cos_le_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx2 : x ≤ 3 * π / 2) :
- cos x ≤ ↑1 / sqrt (x ^ 2 + 1) := by
+ cos x ≤ (1 : ℝ) / √(x ^ 2 + 1) := by
rcases eq_or_ne x 0 with (rfl | hx3)
· simp
· exact (cos_lt_one_div_sqrt_sq_add_one hx1 hx2 hx3).le
@@ -182,7 +182,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x := by
have bd2 : cos y ^ 2 < 1 := by
apply lt_of_le_of_ne y.cos_sq_le_one
rw [cos_sq']
- simpa only [Ne.def, sub_eq_self, sq_eq_zero_iff] using (sin_pos hy).ne'
+ simpa only [Ne, sub_eq_self, sq_eq_zero_iff] using (sin_pos hy).ne'
rwa [lt_inv, inv_one]
· exact zero_lt_one
simpa only [sq, mul_self_pos] using this.ne'
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 | |
@@ -67,7 +67,7 @@ lemma one_sub_sq_div_two_le_cos : 1 - x ^ 2 / 2 ≤ cos x := by
(Continuous.continuousOn <| by continuity)
(fun x _ ↦ ((hasDerivAt_cos ..).add <| (hasDerivAt_pow ..).div_const _).hasDerivWithinAt)
fun x hx ↦ ?_
- simpa [mul_div_cancel_left] using sin_le <| interior_subset hx
+ simpa [mul_div_cancel_left₀] using sin_le <| interior_subset hx
/-- **Jordan's inequality**. -/
lemma two_div_pi_mul_le_sin (hx₀ : 0 ≤ x) (hx : x ≤ π / 2) : 2 / π * x ≤ sin x := by
@@ -62,10 +62,12 @@ lemma one_sub_sq_div_two_le_cos : 1 - x ^ 2 / 2 ≤ cos x := by
· simpa using this $ neg_nonneg.2 $ le_of_not_le hx₀
suffices MonotoneOn (fun x ↦ cos x + x ^ 2 / 2) (Ici 0) by
simpa using this left_mem_Ici hx₀ hx₀
- refine monotoneOn_of_hasDerivWithinAt_nonneg (convex_Ici _) (Continuous.continuousOn $ by
- continuity) (fun x _ ↦
- ((hasDerivAt_cos ..).add $ (hasDerivAt_pow ..).div_const _).hasDerivWithinAt) fun x hx ↦ ?_
- simpa [mul_div_cancel_left] using sin_le $ interior_subset hx
+ refine monotoneOn_of_hasDerivWithinAt_nonneg
+ (convex_Ici _)
+ (Continuous.continuousOn <| by continuity)
+ (fun x _ ↦ ((hasDerivAt_cos ..).add <| (hasDerivAt_pow ..).div_const _).hasDerivWithinAt)
+ fun x hx ↦ ?_
+ simpa [mul_div_cancel_left] using sin_le <| interior_subset hx
/-- **Jordan's inequality**. -/
lemma two_div_pi_mul_le_sin (hx₀ : 0 ≤ x) (hx : x ≤ π / 2) : 2 / π * x ≤ sin x := by
@@ -98,8 +100,11 @@ lemma cos_quadratic_upper_bound (hx : |x| ≤ π) : cos x ≤ 1 - 2 / π ^ 2 * x
simp only [Nat.cast_ofNat, Nat.succ_sub_succ_eq_sub, tsub_zero, pow_one, ← neg_sub', neg_sub,
← mul_assoc] at hderiv
have hmono : MonotoneOn (fun x ↦ 1 - 2 / π ^ 2 * x ^ 2 - cos x) (Icc 0 (π / 2)) := by
- refine monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc ..) (Continuous.continuousOn $
- by continuity) (fun x _ ↦ (hderiv _).hasDerivWithinAt) fun x hx ↦ sub_nonneg.2 ?_
+ refine monotoneOn_of_hasDerivWithinAt_nonneg
+ (convex_Icc ..)
+ (Continuous.continuousOn $ by continuity)
+ (fun x _ ↦ (hderiv _).hasDerivWithinAt)
+ fun x hx ↦ sub_nonneg.2 ?_
have ⟨hx₀, hx⟩ := interior_subset hx
calc 2 / π ^ 2 * 2 * x
= 2 / π * (2 / π * x) := by ring
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -107,6 +107,7 @@ lemma cos_quadratic_upper_bound (hx : |x| ≤ π) : cos x ≤ 1 - 2 / π ^ 2 * x
gcongr; exacts [div_le_one_of_le two_le_pi (by positivity), two_div_pi_mul_le_sin hx₀ hx]
_ = sin x := one_mul _
have hconc : ConcaveOn ℝ (Icc (π / 2) π) (fun x ↦ 1 - 2 / π ^ 2 * x ^ 2 - cos x) := by
+ set_option tactic.skipAssignedInstances false in
refine concaveOn_of_hasDerivWithinAt2_nonpos (convex_Icc ..)
(Continuous.continuousOn $ by continuity) (fun x _ ↦ (hderiv _).hasDerivWithinAt)
(fun x _ ↦ ((hasDerivAt_sin ..).sub $ (hasDerivAt_id ..).const_mul _).hasDerivWithinAt)
@@ -121,7 +122,8 @@ lemma cos_quadratic_upper_bound (hx : |x| ≤ π) : cos x ≤ 1 - 2 / π ^ 2 * x
rw [← sub_nonneg]
obtain hx' | hx' := le_total x (π / 2)
· simpa using hmono (left_mem_Icc.2 $ by positivity) ⟨hx₀, hx'⟩ hx₀
- · refine (le_min ?_ ?_).trans $ hconc.min_le_of_mem_Icc ⟨hx', hx⟩ <;> field_simp <;> norm_num
+ · set_option tactic.skipAssignedInstances false in
+ refine (le_min ?_ ?_).trans $ hconc.min_le_of_mem_Icc ⟨hx', hx⟩ <;> field_simp <;> norm_num
/-- For 0 < x ≤ 1 we have x - x ^ 3 / 4 < sin x.
sin
and cos
(#10525)
... including Jordan's inequality: 2 / π * x ≤ sin x
for 0 ≤ x ≤ π / 2
From LeanAPAP
@@ -1,7 +1,7 @@
/-
Copyright (c) 2022 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
-Authors: David Loeffler
+Authors: David Loeffler, Yaël Dillies
-/
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
@@ -30,17 +30,13 @@ Here we prove the following:
sin, cos, tan, angle
-/
-
-noncomputable section
-
open Set
namespace Real
-
-open scoped Real
+variable {x : ℝ}
/-- For 0 < x, we have sin x < x. -/
-theorem sin_lt {x : ℝ} (h : 0 < x) : sin x < x := by
+theorem sin_lt (h : 0 < x) : sin x < x := by
cases' lt_or_le 1 x with h' h'
· exact (sin_le_one x).trans_lt h'
have hx : |x| = x := abs_of_nonneg h.le
@@ -53,6 +49,80 @@ theorem sin_lt {x : ℝ} (h : 0 < x) : sin x < x := by
norm_num
#align real.sin_lt Real.sin_lt
+lemma sin_le (hx : 0 ≤ x) : sin x ≤ x := by
+ obtain rfl | hx := hx.eq_or_lt
+ · simp
+ · exact (sin_lt hx).le
+
+lemma lt_sin (hx : x < 0) : x < sin x := by simpa using sin_lt <| neg_pos.2 hx
+lemma le_sin (hx : x ≤ 0) : x ≤ sin x := by simpa using sin_le <| neg_nonneg.2 hx
+
+lemma one_sub_sq_div_two_le_cos : 1 - x ^ 2 / 2 ≤ cos x := by
+ wlog hx₀ : 0 ≤ x
+ · simpa using this $ neg_nonneg.2 $ le_of_not_le hx₀
+ suffices MonotoneOn (fun x ↦ cos x + x ^ 2 / 2) (Ici 0) by
+ simpa using this left_mem_Ici hx₀ hx₀
+ refine monotoneOn_of_hasDerivWithinAt_nonneg (convex_Ici _) (Continuous.continuousOn $ by
+ continuity) (fun x _ ↦
+ ((hasDerivAt_cos ..).add $ (hasDerivAt_pow ..).div_const _).hasDerivWithinAt) fun x hx ↦ ?_
+ simpa [mul_div_cancel_left] using sin_le $ interior_subset hx
+
+/-- **Jordan's inequality**. -/
+lemma two_div_pi_mul_le_sin (hx₀ : 0 ≤ x) (hx : x ≤ π / 2) : 2 / π * x ≤ sin x := by
+ rw [← sub_nonneg]
+ suffices ConcaveOn ℝ (Icc 0 (π / 2)) (fun x ↦ sin x - 2 / π * x) by
+ refine (le_min ?_ ?_).trans $ this.min_le_of_mem_Icc ⟨hx₀, hx⟩ <;> field_simp
+ exact concaveOn_of_hasDerivWithinAt2_nonpos (convex_Icc ..)
+ (Continuous.continuousOn $ by continuity)
+ (fun x _ ↦ ((hasDerivAt_sin ..).sub $ (hasDerivAt_id ..).const_mul (2 / π)).hasDerivWithinAt)
+ (fun x _ ↦ (hasDerivAt_cos ..).hasDerivWithinAt.sub_const _)
+ fun x hx ↦ neg_nonpos.2 $ sin_nonneg_of_mem_Icc $ Icc_subset_Icc_right (by linarith) $
+ interior_subset hx
+
+/-- **Jordan's inequality** for negative values. -/
+lemma sin_le_two_div_pi_mul (hx : -(π / 2) ≤ x) (hx₀ : x ≤ 0) : sin x ≤ 2 / π * x := by
+ simpa using two_div_pi_mul_le_sin (neg_nonneg.2 hx₀) (neg_le.2 hx)
+
+/-- **Jordan's inequality** for `cos`. -/
+lemma one_sub_two_div_pi_mul_le_cos (hx₀ : 0 ≤ x) (hx : x ≤ π / 2) : 1 - 2 / π * x ≤ cos x := by
+ simpa [sin_pi_div_two_sub, mul_sub, div_mul_div_comm, mul_comm π, div_self two_pi_pos.ne']
+ using two_div_pi_mul_le_sin (x := π / 2 - x) (by simpa) (by simpa)
+
+lemma cos_quadratic_upper_bound (hx : |x| ≤ π) : cos x ≤ 1 - 2 / π ^ 2 * x ^ 2 := by
+ wlog hx₀ : 0 ≤ x
+ · simpa using this (by rwa [abs_neg]) $ neg_nonneg.2 $ le_of_not_le hx₀
+ rw [abs_of_nonneg hx₀] at hx
+ -- TODO: `compute_deriv` tactic?
+ have hderiv (x) : HasDerivAt (fun x ↦ 1 - 2 / π ^ 2 * x ^ 2 - cos x) _ x :=
+ (((hasDerivAt_pow ..).const_mul _).const_sub _).sub $ hasDerivAt_cos _
+ simp only [Nat.cast_ofNat, Nat.succ_sub_succ_eq_sub, tsub_zero, pow_one, ← neg_sub', neg_sub,
+ ← mul_assoc] at hderiv
+ have hmono : MonotoneOn (fun x ↦ 1 - 2 / π ^ 2 * x ^ 2 - cos x) (Icc 0 (π / 2)) := by
+ refine monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc ..) (Continuous.continuousOn $
+ by continuity) (fun x _ ↦ (hderiv _).hasDerivWithinAt) fun x hx ↦ sub_nonneg.2 ?_
+ have ⟨hx₀, hx⟩ := interior_subset hx
+ calc 2 / π ^ 2 * 2 * x
+ = 2 / π * (2 / π * x) := by ring
+ _ ≤ 1 * sin x := by
+ gcongr; exacts [div_le_one_of_le two_le_pi (by positivity), two_div_pi_mul_le_sin hx₀ hx]
+ _ = sin x := one_mul _
+ have hconc : ConcaveOn ℝ (Icc (π / 2) π) (fun x ↦ 1 - 2 / π ^ 2 * x ^ 2 - cos x) := by
+ refine concaveOn_of_hasDerivWithinAt2_nonpos (convex_Icc ..)
+ (Continuous.continuousOn $ by continuity) (fun x _ ↦ (hderiv _).hasDerivWithinAt)
+ (fun x _ ↦ ((hasDerivAt_sin ..).sub $ (hasDerivAt_id ..).const_mul _).hasDerivWithinAt)
+ fun x hx ↦ ?_
+ have ⟨hx, hx'⟩ := interior_subset hx
+ calc
+ _ ≤ (0 : ℝ) - 0 := by
+ gcongr
+ · exact cos_nonpos_of_pi_div_two_le_of_le hx $ hx'.trans $ by linarith
+ · positivity
+ _ = 0 := sub_zero _
+ rw [← sub_nonneg]
+ obtain hx' | hx' := le_total x (π / 2)
+ · simpa using hmono (left_mem_Icc.2 $ by positivity) ⟨hx₀, hx'⟩ hx₀
+ · refine (le_min ?_ ?_).trans $ hconc.min_le_of_mem_Icc ⟨hx', hx⟩ <;> field_simp <;> norm_num
+
/-- For 0 < x ≤ 1 we have x - x ^ 3 / 4 < sin x.
This is also true for x > 1, but it's nontrivial for x just above 1. This inequality is not
This PR provides variants of deriv
lemmas stated in terms of HasDerivAt
From LeanAPAP
@@ -109,7 +109,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x := by
rwa [lt_inv, inv_one]
· exact zero_lt_one
simpa only [sq, mul_self_pos] using this.ne'
- have mono := Convex.strictMonoOn_of_deriv_pos (convex_Ico 0 (π / 2)) tan_minus_id_cts deriv_pos
+ have mono := strictMonoOn_of_deriv_pos (convex_Ico 0 (π / 2)) tan_minus_id_cts deriv_pos
have zero_in_U : (0 : ℝ) ∈ U := by rwa [left_mem_Ico]
have x_in_U : x ∈ U := ⟨h1.le, h2⟩
simpa only [tan_zero, sub_zero, sub_pos] using mono zero_in_U x_in_U h1
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
@@ -105,7 +105,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x := by
have bd2 : cos y ^ 2 < 1 := by
apply lt_of_le_of_ne y.cos_sq_le_one
rw [cos_sq']
- simpa only [Ne.def, sub_eq_self, pow_eq_zero_iff, Nat.succ_pos'] using (sin_pos hy).ne'
+ simpa only [Ne.def, sub_eq_self, sq_eq_zero_iff] using (sin_pos hy).ne'
rwa [lt_inv, inv_one]
· exact zero_lt_one
simpa only [sq, mul_self_pos] using this.ne'
@@ -123,7 +123,7 @@ theorem le_tan {x : ℝ} (h1 : 0 ≤ x) (h2 : x < π / 2) : x ≤ tan x := by
theorem cos_lt_one_div_sqrt_sq_add_one {x : ℝ} (hx1 : -(3 * π / 2) ≤ x) (hx2 : x ≤ 3 * π / 2)
(hx3 : x ≠ 0) : cos x < ↑1 / sqrt (x ^ 2 + 1) := by
- suffices ∀ {y : ℝ} (_ : 0 < y) (_ : y ≤ 3 * π / 2), cos y < ↑1 / sqrt (y ^ 2 + 1) by
+ suffices ∀ {y : ℝ}, 0 < y → y ≤ 3 * π / 2 → cos y < ↑1 / sqrt (y ^ 2 + 1) by
rcases lt_or_lt_iff_ne.mpr hx3.symm with ⟨h⟩
· exact this h hx2
· convert this (by linarith : 0 < -x) (by linarith) using 1
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>
@@ -33,8 +33,6 @@ sin, cos, tan, angle
noncomputable section
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
open Set
namespace Real
@@ -108,7 +106,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x := by
apply lt_of_le_of_ne y.cos_sq_le_one
rw [cos_sq']
simpa only [Ne.def, sub_eq_self, pow_eq_zero_iff, Nat.succ_pos'] using (sin_pos hy).ne'
- rwa [one_div, lt_inv, inv_one]
+ rwa [lt_inv, inv_one]
· exact zero_lt_one
simpa only [sq, mul_self_pos] using this.ne'
have mono := Convex.strictMonoOn_of_deriv_pos (convex_Ico 0 (π / 2)) tan_minus_id_cts deriv_pos
norm_num
was passing the wrong syntax node to elabSimpArgs
when elaborating, which essentially had the effect of ignoring all arguments it was passed, i.e. norm_num [add_comm]
would not try to commute addition in the simp step.
The fix itself is very simple (though not obvious to debug!), probably using TSyntax more would help avoid such issues in future.
Due to this bug many norm_num [blah]
became rw [blah]; norm_num
or similar, sometimes with porting notes, sometimes not, we fix these porting notes and other regressions during the port also.
Interestingly cancel_denoms
uses norm_num [<- mul_assoc]
internally, so cancel_denoms
also got stronger with this change.
@@ -65,7 +65,7 @@ theorem sin_gt_sub_cube {x : ℝ} (h : 0 < x) (h' : x ≤ 1) : x - x ^ 3 / 4 < s
have := neg_le_of_abs_le (sin_bound <| show |x| ≤ 1 by rwa [hx])
rw [le_sub_iff_add_le, hx] at this
refine' lt_of_lt_of_le _ this
- have : x ^ 3 / ↑4 - x ^ 3 / ↑6 = x ^ 3 * 12⁻¹ := by ring
+ have : x ^ 3 / ↑4 - x ^ 3 / ↑6 = x ^ 3 * 12⁻¹ := by norm_num [div_eq_mul_inv, ← mul_sub]
rw [add_comm, sub_add, sub_neg_eq_add, sub_lt_sub_iff_left, ← lt_sub_iff_add_lt', this]
refine' mul_lt_mul' _ (by norm_num) (by norm_num) (pow_pos h 3)
apply pow_le_pow_of_le_one h.le h'
@@ -33,7 +33,7 @@ sin, cos, tan, angle
noncomputable section
-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
open Set
@@ -2,14 +2,11 @@
Copyright (c) 2022 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-
-! This file was ported from Lean 3 source module analysis.special_functions.trigonometric.bounds
-! leanprover-community/mathlib commit 2c1d8ca2812b64f88992a5294ea3dba144755cd1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
+#align_import analysis.special_functions.trigonometric.bounds from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
+
/-!
# Polynomial bounds for trigonometric functions
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
init.data.list.default
algebra.order.monoid.cancel.basic
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file