Skip to content

Commit 009b047

Browse files
hrmacbethParcly-Taxelkim-emfpvandoorn
committed
chore: forward-port #19026 (#4129)
Fiddly, not done yet ... help welcome. Cross-reference: leanprover-community/mathlib3#19026. Co-authored-by: Parcly Taxel <reddeloostw@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>
1 parent 100392f commit 009b047

File tree

3 files changed

+197
-73
lines changed

3 files changed

+197
-73
lines changed

Mathlib/Analysis/Convex/Slope.lean

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yury Kudriashov, Malo Jaffré
55
66
! This file was ported from Lean 3 source module analysis.convex.slope
7-
! leanprover-community/mathlib commit 78261225eb5cedc61c5c74ecb44e5b385d13b733
7+
! leanprover-community/mathlib commit a8b2226cfb0a79f5986492053fc49b1a0c6aeffb
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -237,6 +237,114 @@ theorem strictConcaveOn_iff_slope_strict_anti_adjacent :
237237
strictConcaveOn_of_slope_strict_anti_adjacent h.1 (@fun _ _ _ hx hy => h.2 hx hy)⟩
238238
#align strict_concave_on_iff_slope_strict_anti_adjacent strictConcaveOn_iff_slope_strict_anti_adjacent
239239

240+
theorem ConvexOn.secant_mono_aux1 (hf : ConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
241+
(hxy : x < y) (hyz : y < z) : (z - x) * f y ≤ (z - y) * f x + (y - x) * f z := by
242+
have hxy' : 0 < y - x := by linarith
243+
have hyz' : 0 < z - y := by linarith
244+
have hxz' : 0 < z - x := by linarith
245+
rw [← le_div_iff' hxz']
246+
have ha : 0 ≤ (z - y) / (z - x) := by positivity
247+
have hb : 0 ≤ (y - x) / (z - x) := by positivity
248+
calc
249+
f y = f ((z - y) / (z - x) * x + (y - x) / (z - x) * z) := ?_
250+
_ ≤ (z - y) / (z - x) * f x + (y - x) / (z - x) * f z := hf.2 hx hz ha hb ?_
251+
_ = ((z - y) * f x + (y - x) * f z) / (z - x) := ?_
252+
· congr 1
253+
field_simp [hxy'.ne', hyz'.ne', hxz'.ne']
254+
ring
255+
· -- Porting note: this `show` wasn't needed in Lean 3
256+
show (z - y) / (z - x) + (y - x) / (z - x) = 1
257+
field_simp [hxy'.ne', hyz'.ne', hxz'.ne']
258+
· field_simp [hxy'.ne', hyz'.ne', hxz'.ne']
259+
#align convex_on.secant_mono_aux1 ConvexOn.secant_mono_aux1
260+
261+
theorem ConvexOn.secant_mono_aux2 (hf : ConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
262+
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) ≤ (f z - f x) / (z - x) := by
263+
have hxy' : 0 < y - x := by linarith
264+
have hxz' : 0 < z - x := by linarith
265+
rw [div_le_div_iff hxy' hxz']
266+
linarith only [hf.secant_mono_aux1 hx hz hxy hyz]
267+
#align convex_on.secant_mono_aux2 ConvexOn.secant_mono_aux2
268+
269+
theorem ConvexOn.secant_mono_aux3 (hf : ConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
270+
(hxy : x < y) (hyz : y < z) : (f z - f x) / (z - x) ≤ (f z - f y) / (z - y) := by
271+
have hyz' : 0 < z - y := by linarith
272+
have hxz' : 0 < z - x := by linarith
273+
rw [div_le_div_iff hxz' hyz']
274+
linarith only [hf.secant_mono_aux1 hx hz hxy hyz]
275+
#align convex_on.secant_mono_aux3 ConvexOn.secant_mono_aux3
276+
277+
theorem ConvexOn.secant_mono (hf : ConvexOn 𝕜 s f) {a x y : 𝕜} (ha : a ∈ s) (hx : x ∈ s)
278+
(hy : y ∈ s) (hxa : x ≠ a) (hya : y ≠ a) (hxy : x ≤ y) :
279+
(f x - f a) / (x - a) ≤ (f y - f a) / (y - a) := by
280+
rcases eq_or_lt_of_le hxy with (rfl | hxy)
281+
· simp
282+
cases' lt_or_gt_of_ne hxa with hxa hxa
283+
· cases' lt_or_gt_of_ne hya with hya hya
284+
· convert hf.secant_mono_aux3 hx ha hxy hya using 1 <;> rw [← neg_div_neg_eq] <;> field_simp
285+
· convert hf.slope_mono_adjacent hx hy hxa hya using 1
286+
rw [← neg_div_neg_eq]; field_simp
287+
· exact hf.secant_mono_aux2 ha hy hxa hxy
288+
#align convex_on.secant_mono ConvexOn.secant_mono
289+
290+
theorem StrictConvexOn.secant_strict_mono_aux1 (hf : StrictConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s)
291+
(hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (z - x) * f y < (z - y) * f x + (y - x) * f z := by
292+
have hxy' : 0 < y - x := by linarith
293+
have hyz' : 0 < z - y := by linarith
294+
have hxz' : 0 < z - x := by linarith
295+
rw [← lt_div_iff' hxz']
296+
have ha : 0 < (z - y) / (z - x) := by positivity
297+
have hb : 0 < (y - x) / (z - x) := by positivity
298+
calc
299+
f y = f ((z - y) / (z - x) * x + (y - x) / (z - x) * z) := ?_
300+
_ < (z - y) / (z - x) * f x + (y - x) / (z - x) * f z := (hf.2 hx hz (by linarith) ha hb ?_)
301+
_ = ((z - y) * f x + (y - x) * f z) / (z - x) := ?_
302+
· congr 1
303+
field_simp [hxy'.ne', hyz'.ne', hxz'.ne']
304+
ring
305+
· -- Porting note: this `show` wasn't needed in Lean 3
306+
show (z - y) / (z - x) + (y - x) / (z - x) = 1
307+
field_simp [hxy'.ne', hyz'.ne', hxz'.ne']
308+
· field_simp [hxy'.ne', hyz'.ne', hxz'.ne']
309+
#align strict_convex_on.secant_strict_mono_aux1 StrictConvexOn.secant_strict_mono_aux1
310+
311+
theorem StrictConvexOn.secant_strict_mono_aux2 (hf : StrictConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s)
312+
(hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) < (f z - f x) / (z - x) := by
313+
have hxy' : 0 < y - x := by linarith
314+
have hxz' : 0 < z - x := by linarith
315+
rw [div_lt_div_iff hxy' hxz']
316+
linarith only [hf.secant_strict_mono_aux1 hx hz hxy hyz]
317+
#align strict_convex_on.secant_strict_mono_aux2 StrictConvexOn.secant_strict_mono_aux2
318+
319+
theorem StrictConvexOn.secant_strict_mono_aux3 (hf : StrictConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s)
320+
(hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f z - f x) / (z - x) < (f z - f y) / (z - y) := by
321+
have hyz' : 0 < z - y := by linarith
322+
have hxz' : 0 < z - x := by linarith
323+
rw [div_lt_div_iff hxz' hyz']
324+
linarith only [hf.secant_strict_mono_aux1 hx hz hxy hyz]
325+
#align strict_convex_on.secant_strict_mono_aux3 StrictConvexOn.secant_strict_mono_aux3
326+
327+
theorem StrictConvexOn.secant_strict_mono (hf : StrictConvexOn 𝕜 s f) {a x y : 𝕜} (ha : a ∈ s)
328+
(hx : x ∈ s) (hy : y ∈ s) (hxa : x ≠ a) (hya : y ≠ a) (hxy : x < y) :
329+
(f x - f a) / (x - a) < (f y - f a) / (y - a) := by
330+
cases' lt_or_gt_of_ne hxa with hxa hxa
331+
· cases' lt_or_gt_of_ne hya with hya hya
332+
· convert hf.secant_strict_mono_aux3 hx ha hxy hya using 1 <;> rw [← neg_div_neg_eq] <;>
333+
field_simp
334+
· convert hf.slope_strict_mono_adjacent hx hy hxa hya using 1
335+
rw [← neg_div_neg_eq]; field_simp
336+
· exact hf.secant_strict_mono_aux2 ha hy hxa hxy
337+
#align strict_convex_on.secant_strict_mono StrictConvexOn.secant_strict_mono
338+
339+
theorem StrictConcaveOn.secant_strict_mono (hf : StrictConcaveOn 𝕜 s f) {a x y : 𝕜} (ha : a ∈ s)
340+
(hx : x ∈ s) (hy : y ∈ s) (hxa : x ≠ a) (hya : y ≠ a) (hxy : x < y) :
341+
(f y - f a) / (y - a) < (f x - f a) / (x - a) := by
342+
have key := hf.neg.secant_strict_mono ha hx hy hxa hya hxy
343+
simp only [Pi.neg_apply] at key
344+
rw [← neg_lt_neg_iff]
345+
convert key using 1 <;> field_simp <;> ring
346+
#align strict_concave_on.secant_strict_mono StrictConcaveOn.secant_strict_mono
347+
240348
/-- If `f` is convex on a set `s` in a linearly ordered field, and `f x < f y` for two points
241349
`x < y` in `s`, then `f` is strictly monotone on `s ∩ [y, ∞)`. -/
242350
theorem ConvexOn.strict_mono_of_lt (hf : ConvexOn 𝕜 s f) {x y : 𝕜} (hx : x ∈ s) (hxy : x < y)

Mathlib/Analysis/SpecialFunctions/Log/Basic.lean

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Chris Hughes, Abhimanyu Pallavi Sudhir, Jean Lo, Calle Sönne
55
66
! This file was ported from Lean 3 source module analysis.special_functions.log.basic
7-
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
7+
! leanprover-community/mathlib commit a8b2226cfb0a79f5986492053fc49b1a0c6aeffb
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -219,6 +219,13 @@ theorem log_injOn_pos : Set.InjOn log (Set.Ioi 0) :=
219219
strictMonoOn_log.injOn
220220
#align real.log_inj_on_pos Real.log_injOn_pos
221221

222+
theorem log_lt_sub_one_of_pos (hx1 : 0 < x) (hx2 : x ≠ 1) : log x < x - 1 := by
223+
have h : log x ≠ 0
224+
· rwa [← log_one, log_injOn_pos.ne_iff hx1]
225+
exact mem_Ioi.mpr zero_lt_one
226+
linarith [add_one_lt_exp_of_nonzero h, exp_log hx1]
227+
#align real.log_lt_sub_one_of_pos Real.log_lt_sub_one_of_pos
228+
222229
theorem eq_one_of_pos_of_log_eq_zero {x : ℝ} (h₁ : 0 < x) (h₂ : log x = 0) : x = 1 :=
223230
log_injOn_pos (Set.mem_Ioi.2 h₁) (Set.mem_Ioi.2 zero_lt_one) (h₂.trans Real.log_one.symm)
224231
#align real.eq_one_of_pos_of_log_eq_zero Real.eq_one_of_pos_of_log_eq_zero

Mathlib/Data/Complex/Exponential.lean

Lines changed: 80 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Chris Hughes, Abhimanyu Pallavi Sudhir
55
66
! This file was ported from Lean 3 source module data.complex.exponential
7-
! leanprover-community/mathlib commit caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c
7+
! leanprover-community/mathlib commit a8b2226cfb0a79f5986492053fc49b1a0c6aeffb
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -1472,27 +1472,36 @@ nonrec theorem sinh_three_mul : sinh (3 * x) = 4 * sinh x ^ 3 + 3 * sinh x := by
14721472
rw [← ofReal_inj]; simp [sinh_three_mul]
14731473
#align real.sinh_three_mul Real.sinh_three_mul
14741474

1475-
open IsAbsoluteValue
1475+
open IsAbsoluteValue Nat
14761476

1477-
/-- This is an intermediate result that is later replaced by `Real.add_one_le_exp`; use that lemma
1478-
instead. -/
1479-
theorem add_one_le_exp_of_nonneg {x : ℝ} (hx : 0 ≤ x) : x + 1 ≤ exp x :=
1477+
theorem sum_le_exp_of_nonneg {x : ℝ} (hx : 0 ≤ x) (n : ℕ) : (∑ i in range n, x ^ i / i !) ≤ exp x :=
14801478
calc
1481-
x + 1 ≤ CauSeq.lim (⟨fun n : ℕ => ((exp' x) n).re, isCauSeq_re (exp' x)⟩ : CauSeq ℝ Abs.abs) :=
1482-
le_lim
1483-
(CauSeq.le_of_exists
1484-
2, fun j hj =>
1485-
show x + (1 : ℝ) ≤ (∑ m in range j, ((x : ℂ) ^ m / m.factorial)).re by
1486-
have h₁ : (((fun m : ℕ => ((x : ℂ) ^ m / m.factorial)) ∘ Nat.succ) 0).re = x :=
1487-
by simp [show Nat.succ 0 = 1 from rfl, Complex.ofReal_re]
1488-
have h₂ : ((x : ℂ) ^ 0 / (Nat.factorial 0)).re = 1 := by simp
1489-
erw [← tsub_add_cancel_of_le hj, sum_range_succ', sum_range_succ', add_re, add_re, h₁,
1490-
h₂, add_assoc, ← coe_reAddGroupHom, reAddGroupHom.map_sum,
1491-
coe_reAddGroupHom]
1492-
refine' le_add_of_nonneg_of_le (sum_nonneg fun m _ => _) le_rfl
1493-
rw [← ofReal_pow, ← ofReal_nat_cast, ← ofReal_div, ofReal_re]
1494-
exact div_nonneg (pow_nonneg hx _) (Nat.cast_nonneg _)⟩)
1479+
(∑ i in range n, x ^ i / i !) ≤ lim (⟨_, isCauSeq_re (exp' x)⟩ : CauSeq ℝ Abs.abs) := by
1480+
refine' le_lim (CauSeq.le_of_exists ⟨n, fun j hj => _⟩)
1481+
simp only [exp', const_apply, re_sum]
1482+
norm_cast
1483+
rw [← Nat.add_sub_of_le hj, Finset.sum_range_add]
1484+
refine' le_add_of_nonneg_right (sum_nonneg fun i _ => _)
1485+
positivity
14951486
_ = exp x := by rw [exp, Complex.exp, ← cauSeqRe, lim_re]
1487+
#align real.sum_le_exp_of_nonneg Real.sum_le_exp_of_nonneg
1488+
1489+
theorem quadratic_le_exp_of_nonneg {x : ℝ} (hx : 0 ≤ x) : 1 + x + x ^ 2 / 2 ≤ exp x :=
1490+
calc
1491+
1 + x + x ^ 2 / 2 = ∑ i in range 3, x ^ i / i ! := by simp [Finset.sum_range_succ]; ring_nf
1492+
_ ≤ exp x := sum_le_exp_of_nonneg hx 3
1493+
#align real.quadratic_le_exp_of_nonneg Real.quadratic_le_exp_of_nonneg
1494+
1495+
theorem add_one_lt_exp_of_pos {x : ℝ} (hx : 0 < x) : x + 1 < exp x :=
1496+
(by nlinarith : x + 1 < 1 + x + x ^ 2 / 2).trans_le (quadratic_le_exp_of_nonneg hx.le)
1497+
#align real.add_one_lt_exp_of_pos Real.add_one_lt_exp_of_pos
1498+
1499+
/-- This is an intermediate result that is later replaced by `Real.add_one_le_exp`; use that lemma
1500+
instead. -/
1501+
theorem add_one_le_exp_of_nonneg {x : ℝ} (hx : 0 ≤ x) : x + 1 ≤ exp x := by
1502+
rcases eq_or_lt_of_le hx with (rfl | h)
1503+
· simp
1504+
exact (add_one_lt_exp_of_pos h).le
14961505
#align real.add_one_le_exp_of_nonneg Real.add_one_le_exp_of_nonneg
14971506

14981507
theorem one_le_exp {x : ℝ} (hx : 0 ≤ x) : 1 ≤ exp x := by linarith [add_one_le_exp_of_nonneg hx]
@@ -1957,67 +1966,67 @@ theorem cos_two_neg : cos 2 < 0 :=
19571966
_ < 0 := by norm_num
19581967
#align real.cos_two_neg Real.cos_two_neg
19591968

1960-
--Porting note: removed `(h1 : 0 ≤ x)` because it is no longer used
1961-
theorem exp_bound_div_one_sub_of_interval_approx {x : ℝ} (h2 : x ≤ 1) :
1962-
(∑ j : ℕ in Finset.range 3, x ^ j / j.factorial) +
1963-
x ^ 3 * ((3 : ℕ) + 1) / ((3 : ℕ).factorial * (3 : ℕ)) ≤
1964-
∑ j in Finset.range 3, x ^ j :=
1969+
theorem exp_bound_div_one_sub_of_interval' {x : ℝ} (h1 : 0 < x) (h2 : x < 1) :
1970+
Real.exp x < 1 / (1 - x) := by
1971+
have H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
1972+
· calc
1973+
0 < x ^ 3 := by positivity
1974+
_ = 1 - (1 + x + x ^ 2) * (1 - x) := by ring
19651975
calc
1966-
(∑ j : ℕ in Finset.range 3, x ^ j / j.factorial) +
1967-
x ^ 3 * ((3 : ℕ) + 1) / ((3 : ℕ).factorial * (3 : ℕ))
1968-
= (2 / 9) * x ^ 3 + x ^ 2 / 2 + x + 1 := by simp [Finset.sum]; ring
1969-
_ ≤ x ^ 2 + x + 1 := sub_nonneg.1 <|
1970-
calc 0 ≤ x^2 * (2 / 9) * (9 / 4 - x) :=
1971-
mul_nonneg (mul_nonneg (pow_two_nonneg _) (by norm_num : (0 : ℝ) ≤ 2 / 9))
1972-
(sub_nonneg.2 (le_trans h2 (by norm_num)))
1973-
_ = _ := by ring
1974-
_ = _ := by simp [Finset.sum]; ring
1975-
#align real.exp_bound_div_one_sub_of_interval_approx Real.exp_bound_div_one_sub_of_interval_approxₓ
1976+
exp x ≤ _ := exp_bound' h1.le h2.le zero_lt_three
1977+
_ ≤ 1 + x + x ^ 2 := by
1978+
-- Porting note: was `norm_num [Finset.sum] <;> nlinarith`
1979+
-- This proof should be restored after the norm_num plugin for big operators is ported.
1980+
-- (It may also need the positivity extensions in #3907.)
1981+
rw [Finset.sum, range_val]
1982+
nth_rw 1 [← two_add_one_eq_three]
1983+
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
1984+
nth_rw 3 [← one_add_one_eq_two]
1985+
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
1986+
nth_rw 3 [← zero_add 1]
1987+
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
1988+
rw [Multiset.range_zero, Multiset.map_zero, Multiset.sum_zero]
1989+
norm_num
1990+
nlinarith
1991+
_ < 1 / (1 - x) := by rw [lt_div_iff] <;> nlinarith
1992+
#align real.exp_bound_div_one_sub_of_interval' Real.exp_bound_div_one_sub_of_interval'
19761993

19771994
theorem exp_bound_div_one_sub_of_interval {x : ℝ} (h1 : 0 ≤ x) (h2 : x < 1) :
1978-
Real.exp x ≤ 1 / (1 - x) :=
1979-
haveI h : (∑ j in Finset.range 3, x ^ j) ≤ 1 / (1 - x) := by
1980-
norm_num [Finset.sum]
1981-
have h1x : 0 < 1 - x := by simpa
1982-
rw [inv_eq_one_div, le_div_iff h1x]
1983-
norm_num [← add_assoc, mul_sub_left_distrib, mul_one, add_mul, sub_add_eq_sub_sub,
1984-
pow_succ' x 2]
1985-
have hx3 : 0 ≤ x ^ 3 := by
1986-
norm_num
1987-
simp [h1]
1988-
simp [Finset.sum]
1989-
linarith
1990-
(exp_bound' h1 h2.le <| by linarith).trans
1991-
((exp_bound_div_one_sub_of_interval_approx h2.le).trans h)
1995+
Real.exp x ≤ 1 / (1 - x) := by
1996+
rcases eq_or_lt_of_le h1 with (rfl | h1)
1997+
· simp
1998+
· exact (exp_bound_div_one_sub_of_interval' h1 h2).le
19921999
#align real.exp_bound_div_one_sub_of_interval Real.exp_bound_div_one_sub_of_interval
19932000

1994-
theorem one_sub_le_exp_minus_of_pos {y : ℝ} (h : 0 ≤ y) : 1 - y ≤ Real.exp (-y) := by
1995-
rw [Real.exp_neg]
1996-
have r1 : (1 - y) * Real.exp y ≤ 1 := by
1997-
cases le_or_lt (1 - y) 0
1998-
· have h'' : (1 - y) * y.exp ≤ 0 := by
1999-
rw [mul_nonpos_iff]
2000-
right
2001-
exact ⟨by assumption, y.exp_pos.le⟩
2002-
linarith
2003-
have hy1 : y < 1 := by linarith
2004-
rw [← le_div_iff' ‹0 < 1 - y›]
2005-
exact exp_bound_div_one_sub_of_interval h hy1
2006-
rw [inv_eq_one_div]
2007-
rw [le_div_iff' y.exp_pos]
2008-
rwa [mul_comm] at r1
2009-
#align real.one_sub_le_exp_minus_of_pos Real.one_sub_le_exp_minus_of_pos
2010-
2011-
theorem add_one_le_exp_of_nonpos {x : ℝ} (h : x ≤ 0) : x + 1 ≤ Real.exp x := by
2012-
rw [add_comm]
2013-
have h1 : 0 ≤ -x := by linarith
2014-
simpa using one_sub_le_exp_minus_of_pos h1
2015-
#align real.add_one_le_exp_of_nonpos Real.add_one_le_exp_of_nonpos
2001+
theorem one_sub_lt_exp_minus_of_pos {y : ℝ} (h : 0 < y) : 1 - y < Real.exp (-y) := by
2002+
cases' le_or_lt 1 y with h' h'
2003+
· linarith [(-y).exp_pos]
2004+
rw [exp_neg, lt_inv _ y.exp_pos, inv_eq_one_div]
2005+
· exact exp_bound_div_one_sub_of_interval' h h'
2006+
· linarith
2007+
#align real.one_sub_le_exp_minus_of_pos Real.one_sub_lt_exp_minus_of_pos
2008+
2009+
theorem one_sub_le_exp_minus_of_nonneg {y : ℝ} (h : 0 ≤ y) : 1 - y ≤ Real.exp (-y) := by
2010+
rcases eq_or_lt_of_le h with (rfl | h)
2011+
· simp
2012+
· exact (one_sub_lt_exp_minus_of_pos h).le
2013+
#align real.one_sub_le_exp_minus_of_nonneg Real.one_sub_le_exp_minus_of_nonneg
2014+
2015+
theorem add_one_lt_exp_of_neg {x : ℝ} (h : x < 0) : x + 1 < Real.exp x := by
2016+
have h1 : 0 < -x := by linarith
2017+
simpa [add_comm] using one_sub_lt_exp_minus_of_pos h1
2018+
#align real.add_one_lt_exp_of_neg Real.add_one_lt_exp_of_neg
2019+
2020+
theorem add_one_lt_exp_of_nonzero {x : ℝ} (hx : x ≠ 0) : x + 1 < Real.exp x := by
2021+
cases' lt_or_gt_of_ne hx with h h
2022+
· exact add_one_lt_exp_of_neg h
2023+
exact add_one_lt_exp_of_pos h
2024+
#align real.add_one_lt_exp_of_nonzero Real.add_one_lt_exp_of_nonzero
20162025

20172026
theorem add_one_le_exp (x : ℝ) : x + 1 ≤ Real.exp x := by
20182027
cases' le_or_lt 0 x with h h
20192028
· exact Real.add_one_le_exp_of_nonneg h
2020-
exact add_one_le_exp_of_nonpos h.le
2029+
exact (add_one_lt_exp_of_neg h).le
20212030
#align real.add_one_le_exp Real.add_one_le_exp
20222031

20232032
theorem one_sub_div_pow_le_exp_neg {n : ℕ} {t : ℝ} (ht' : t ≤ n) : (1 - t / n) ^ n ≤ exp (-t) := by

0 commit comments

Comments
 (0)