Skip to content

Commit 9e7b1c1

Browse files
committed
feat(Analysis/Complex/Exponential): add new bounds on exponential (leanprover-community#39690)
We add new upper bounds on Real.exp in terms of 2x/(2+x), and use these to move some bounds on log higher in mathlib. We also add a lemma for the common bound (1+1/n)^n <= e, though this is a special-case of `one_sub_div_pow_le_exp_neg` (immediately before), but is added for convenience and discoverability, as this is a "well-known" bound.
1 parent dab4b77 commit 9e7b1c1

4 files changed

Lines changed: 36 additions & 11 deletions

File tree

Mathlib/Analysis/Complex/Exponential.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public import Mathlib.Algebra.Order.CauSeq.BigOperators
1111
public import Mathlib.Algebra.Order.Star.Basic
1212
public import Mathlib.Data.Complex.BigOperators
1313
public import Mathlib.Data.Nat.Choose.Sum
14+
public import Mathlib.Tactic.NormNum.BigOperators
15+
public import Mathlib.Tactic.NormNum.NatFactorial
1416

1517
/-!
1618
# Exponential Function
@@ -648,12 +650,35 @@ theorem one_sub_div_pow_le_exp_neg {n : ℕ} {t : ℝ} (ht' : t ≤ n) : (1 - t
648650
· exact one_sub_le_exp_neg _
649651
_ = rexp (-t) := by rw [← Real.exp_nat_mul, mul_neg, mul_comm, div_mul_cancel₀]; positivity
650652

653+
lemma one_add_inv_pow_le_exp {n : ℕ} : (1 + (n : ℝ)⁻¹) ^ n ≤ exp 1 := by
654+
convert one_sub_div_pow_le_exp_neg (n := n) (t := -1) (by grind) using 1
655+
· field
656+
· simp
657+
651658
lemma le_inv_mul_exp (x : ℝ) {c : ℝ} (hc : 0 < c) : x ≤ c⁻¹ * exp (c * x) := by
652659
rw [le_inv_mul_iff₀ hc]
653660
calc c * x
654661
_ ≤ c * x + 1 := le_add_of_nonneg_right zero_le_one
655662
_ ≤ _ := Real.add_one_le_exp (c * x)
656663

664+
lemma exp_lt_two_add_div_two_sub {x : ℝ} (hx : 0 < x) (hx' : x < 2) :
665+
exp x < (2 + x) / (2 - x) := by calc
666+
_ = exp (x / 2) ^ 2 := by grind [Real.exp_nat_mul (x / 2) 2]
667+
_ ≤ _ := by
668+
grw [Real.exp_bound' (x := x / 2) (by grind) (by grind) (n := 3) (by simp)]
669+
apply Real.exp_nonneg
670+
_ < (2 + x) / (2 - x) := by
671+
rw [lt_div_iff₀ (by linarith), ← sub_pos]
672+
simp only [Finset.sum_range_succ]
673+
ring_nf
674+
positivity
675+
676+
lemma exp_le_two_add_div_two_sub {x : ℝ} (hx : 0 ≤ x) (hx' : x < 2) :
677+
exp x ≤ (2 + x) / (2 - x) := by
678+
obtain rfl | hx₀ := hx.eq_or_lt
679+
· simp
680+
· exact (exp_lt_two_add_div_two_sub hx₀ hx').le
681+
657682
theorem prod_one_add_le_exp_sum {ι : Type*} (s : Finset ι) {f : ι → ℝ}
658683
(hf : ∀ i, 0 ≤ f i) : ∏ i ∈ s, (1 + f i) ≤ exp (∑ i ∈ s, f i) :=
659684
(Finset.prod_le_prod (fun i _ ↦ add_nonneg zero_le_one (hf i))

Mathlib/Analysis/Complex/ExponentialBounds.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ theorem log_two_near_10 : |log 2 - 287209 / 414355| ≤ 1 / 10 ^ 10 := by
7777
norm_num1 at z
7878
rw [one_div (2 : ℝ), log_inv, ← sub_eq_add_neg, _root_.abs_sub_comm] at z
7979
apply le_trans (_root_.abs_sub_le _ _ _) (add_le_add z _)
80-
norm_num [sum_range_succ]
80+
norm_num
8181

8282
theorem log_two_gt_d9 : 0.6931471803 < log 2 :=
8383
lt_of_lt_of_le (by norm_num1) (sub_le_comm.1 (abs_sub_le_iff.1 log_two_near_10).2)

Mathlib/Analysis/SpecialFunctions/Log/Basic.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ theorem abs_log_mul_self_lt (x : ℝ) (h1 : 0 < x) (h2 : x ≤ 1) : |log x * x|
336336
rw [← abs_of_nonneg aux, neg_mul, abs_neg] at this
337337
exact this
338338

339+
lemma le_log_one_add_of_nonneg {x : ℝ} (hx : 0 ≤ x) : 2 * x / (x + 2) ≤ log (1 + x) := by
340+
rw [le_log_iff_exp_le (by grind)]
341+
convert exp_le_two_add_div_two_sub (x := 2 * x / (x + 2)) (by positivity) _ using 1
342+
all_goals field_simp; grind
343+
344+
lemma lt_log_one_add_of_pos {x : ℝ} (hx : 0 < x) : 2 * x / (x + 2) < log (1 + x) := by
345+
rw [lt_log_iff_exp_lt (by grind)]
346+
convert exp_lt_two_add_div_two_sub (x := 2 * x / (x + 2)) (by positivity) _ using 1
347+
all_goals field_simp; grind
348+
339349
/-- The real logarithm function tends to `+∞` at `+∞`. -/
340350
theorem tendsto_log_atTop : Tendsto log atTop atTop :=
341351
tendsto_comp_exp_atTop.1 <| by simpa only [log_exp] using! tendsto_id

Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,4 @@ theorem hasSum_log_one_add {a : ℝ} (h : 0 ≤ a) :
423423
· convert! hasSum_log_one_add_inv (inv_pos.mpr (lt_of_le_of_ne h ha0.symm)) using 4
424424
all_goals simp [field, add_comm]
425425

426-
lemma le_log_one_add_of_nonneg {x : ℝ} (hx : 0 ≤ x) : 2 * x / (x + 2) ≤ log (1 + x) := by
427-
convert! le_hasSum (hasSum_log_one_add hx) 0 (by intros; positivity) using 1
428-
simp [field]
429-
430-
lemma lt_log_one_add_of_pos {x : ℝ} (hx : 0 < x) : 2 * x / (x + 2) < log (1 + x) := by
431-
convert!
432-
lt_hasSum (hasSum_log_one_add hx.le) 0 (by intros; positivity) 1 (by positivity)
433-
(by positivity) using 1
434-
simp [field]
435-
436426
end Real

0 commit comments

Comments
 (0)