Skip to content

Commit c316eae

Browse files
committed
feat: add a version of Bernoulli's inequality (#31502)
Motivated by #31492
1 parent 50b21b3 commit c316eae

File tree

2 files changed

+82
-21
lines changed

2 files changed

+82
-21
lines changed

Mathlib/Algebra/Order/Archimedean/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ theorem add_one_pow_unbounded_of_pos (x : R) (hy : 0 < y) : ∃ n : ℕ, x < (y
183183
_ = n * y := nsmul_eq_mul _ _
184184
_ < 1 + n * y := lt_one_add _
185185
_ ≤ (1 + y) ^ n :=
186-
one_add_mul_le_pow' (mul_nonneg hy.le hy.le) (mul_nonneg this this)
186+
one_add_mul_le_pow_of_sq_nonneg (pow_nonneg hy.le _) (pow_nonneg this _)
187187
(add_nonneg zero_le_two hy.le) _
188188
_ = (y + 1) ^ n := by rw [add_comm]
189189

Mathlib/Algebra/Order/Ring/Pow.lean

Lines changed: 81 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,104 @@ Authors: Yury Kudryashov
55
-/
66
import Mathlib.Data.Nat.Cast.Commute
77
import Mathlib.Data.Nat.Cast.Order.Ring
8+
import Mathlib.Tactic.Abel
89

9-
/-! # Bernoulli's inequality -/
10+
/-! # Bernoulli's inequality
11+
12+
In this file we prove several versions of Bernoulli's inequality.
13+
Besides the standard version `1 + n * a ≤ (1 + a) ^ n`,
14+
we also prove `a ^ n + n * a ^ (n - 1) * b ≤ (a + b) ^ n`,
15+
which can be regarded as Bernoulli's inequality for `b / a` multiplied by `a ^ n`.
16+
17+
Also, we prove versions for different typeclass assumptions on the (semi)ring.
18+
-/
1019

1120
variable {R : Type*}
1221

1322
section OrderedSemiring
14-
variable [Semiring R] [PartialOrder R] [IsOrderedRing R] {a : R}
23+
variable [Semiring R] [PartialOrder R] [IsOrderedRing R] {a b : R}
1524

16-
/-- **Bernoulli's inequality**. This version works for semirings but requires
17-
additional hypotheses `0 ≤ a * a` and `0 ≤ (1 + a) * (1 + a)`. -/
18-
lemma one_add_mul_le_pow' (Hsq : 0a * a) (Hsq' : 0 ≤ (1 + a) * (1 + a)) (H : 02 + a) :
19-
∀ n : ℕ, 1 + n * a ≤ (1 + a) ^ n
25+
/-- Bernoulli's inequality for `b / a`, written after multiplication by the denominators. -/
26+
lemma Commute.pow_add_mul_le_add_pow_of_sq_nonneg (Hcomm : Commute a b) (ha : 0a)
27+
(Hsq : 0b ^ 2) (Hsq' : 0 ≤ (a + b) ^ 2) (H : 02 * a + b) :
28+
∀ n : ℕ, a ^ n + n * a ^ (n - 1) * b ≤ (a + b) ^ n
2029
| 0 => by simp
2130
| 1 => by simp
22-
| n + 2 =>
23-
have : 0 ≤ n * (a * a * (2 + a)) + a * a :=
24-
add_nonneg (mul_nonneg n.cast_nonneg (mul_nonneg Hsq H)) Hsq
31+
| 2 =>
2532
calc
26-
_ ≤ 1 + ↑(n + 2) * a + (n * (a * a * (2 + a)) + a * a) := le_add_of_nonneg_right this
27-
_ = (1 + a) * (1 + a) * (1 + n * a) := by
28-
simp only [Nat.cast_add, add_mul, mul_add, one_mul, mul_one, ← one_add_one_eq_two,
29-
Nat.cast_one, add_assoc]
30-
simp only [← add_assoc, add_comm _ (↑n * a)]
31-
simp only [add_assoc, (n.cast_commute (_ : R)).left_comm]
32-
simp only [add_comm, add_left_comm]
33-
_ ≤ (1 + a) * (1 + a) * (1 + a) ^ n :=
34-
mul_le_mul_of_nonneg_left (one_add_mul_le_pow' Hsq Hsq' H _) Hsq'
35-
_ = (1 + a) ^ (n + 2) := by simp only [pow_succ', mul_assoc]
33+
a ^ 2 + (2 : ℕ) * a ^ 1 * b ≤ a ^ 2 + (2 : ℕ) * a ^ 1 * b + b ^ 2 :=
34+
le_add_of_nonneg_right Hsq
35+
_ = (a + b) ^ 2 := by simp [sq, add_mul, mul_add, two_mul, Hcomm.eq, add_assoc]
36+
| n + 3 => by
37+
calc
38+
_ ≤ a ^ (n + 3) + ↑(n + 3) * a ^ (n + 2) * b +
39+
((n + 1) * (b ^ 2 * (2 * a + b) * a ^ n) + a ^ (n + 1) * b ^ 2) :=
40+
le_add_of_nonneg_right <| by
41+
apply_rules [add_nonneg, mul_nonneg, Nat.cast_nonneg, pow_nonneg, zero_le_one]
42+
_ = (a + b) ^ 2 * (a ^ (n + 1) + ↑(n + 1) * a ^ n * b) := by
43+
simp only [Nat.cast_add, Nat.cast_one, Nat.cast_ofNat, pow_succ', add_mul, mul_add,
44+
two_mul, pow_zero, mul_one,
45+
Hcomm.eq, (n.cast_commute (_ : R)).symm.left_comm, mul_assoc, (Hcomm.pow_left _).eq,
46+
(Hcomm.pow_left _).left_comm, Hcomm.left_comm, ← @two_add_one_eq_three R, one_mul]
47+
abel
48+
_ ≤ (a + b) ^ 2 * (a + b) ^ (n + 1) := by
49+
gcongr
50+
· assumption
51+
· apply Commute.pow_add_mul_le_add_pow_of_sq_nonneg <;> assumption
52+
_ = (a + b) ^ (n + 3) := by simp [pow_succ', mul_assoc]
53+
54+
/-- **Bernoulli's inequality**. This version works for semirings but requires
55+
additional hypotheses `0 ≤ a ^ 2` and `0 ≤ (1 + a) ^ 2`. -/
56+
lemma one_add_mul_le_pow_of_sq_nonneg (Hsq : 0 ≤ a ^ 2) (Hsq' : 0 ≤ (1 + a) ^ 2) (H : 02 + a)
57+
(n : ℕ) : 1 + n * a ≤ (1 + a) ^ n := by
58+
simpa using (Commute.one_left a).pow_add_mul_le_add_pow_of_sq_nonneg zero_le_one Hsq Hsq'
59+
(by simpa using H) n
60+
61+
/-- **Bernoulli's inequality**. This version works for semirings but requires
62+
additional hypotheses `0 ≤ a * a` and `0 ≤ (1 + a) * (1 + a)`. -/
63+
@[deprecated one_add_mul_le_pow_of_sq_nonneg (since := "2025-11-11")]
64+
lemma one_add_mul_le_pow' (Hsq : 0 ≤ a * a) (Hsq' : 0 ≤ (1 + a) * (1 + a)) (H : 02 + a) (n : ℕ) :
65+
1 + n * a ≤ (1 + a) ^ n :=
66+
one_add_mul_le_pow_of_sq_nonneg (by rwa [sq]) (by rwa [sq]) H n
3667

3768
end OrderedSemiring
3869

70+
/-- Bernoulli's inequality for `b / a`, written after multiplication by the denominators.
71+
72+
This version works for partially ordered commutative semirings,
73+
but explicitly assumes that `b ^ 2` and `(a + b) ^ 2` are nonnegative. -/
74+
lemma pow_add_mul_le_add_pow_of_sq_nonneg [CommSemiring R] [PartialOrder R] [IsOrderedRing R]
75+
{a b : R} (ha : 0 ≤ a) (Hsq : 0 ≤ b ^ 2) (Hsq' : 0 ≤ (a + b) ^ 2) (H : 02 * a + b)
76+
(n : ℕ) : a ^ n + n * a ^ (n - 1) * b ≤ (a + b) ^ n :=
77+
(Commute.all a b).pow_add_mul_le_add_pow_of_sq_nonneg ha Hsq Hsq' H n
78+
79+
/-- Bernoulli's inequality for `b / a`, written after multiplication by the denominators.
80+
81+
This is a version for a linear ordered semiring. -/
82+
lemma Commute.pow_add_mul_le_add_pow [Semiring R] [LinearOrder R] [IsOrderedRing R]
83+
[ExistsAddOfLE R] {a b : R} (Hcomm : Commute a b) (ha : 0 ≤ a) (H : 02 * a + b)
84+
(n : ℕ) : a ^ n + n * a ^ (n - 1) * b ≤ (a + b) ^ n :=
85+
Hcomm.pow_add_mul_le_add_pow_of_sq_nonneg ha (sq_nonneg _) (sq_nonneg _) H n
86+
87+
/-- Bernoulli's inequality for `b / a`, written after multiplication by the denominators.
88+
89+
This is a version for a linear ordered semiring. -/
90+
lemma pow_add_mul_le_add_pow [CommSemiring R] [LinearOrder R] [IsOrderedRing R] [ExistsAddOfLE R]
91+
{a b : R} (ha : 0 ≤ a) (H : 02 * a + b) (n : ℕ) :
92+
a ^ n + n * a ^ (n - 1) * b ≤ (a + b) ^ n :=
93+
(Commute.all a b).pow_add_mul_le_add_pow ha H n
94+
95+
/-- Bernoulli's inequality for linear ordered semirings. -/
96+
lemma one_add_le_pow_of_two_add_nonneg [Semiring R] [LinearOrder R] [IsOrderedRing R]
97+
[ExistsAddOfLE R] {a : R} (H : 02 + a) (n : ℕ) : 1 + n * a ≤ (1 + a) ^ n :=
98+
one_add_mul_le_pow_of_sq_nonneg (sq_nonneg _) (sq_nonneg _) H _
99+
39100
section LinearOrderedRing
40101
variable [Ring R] [LinearOrder R] [IsStrictOrderedRing R] {a : R} {n : ℕ}
41102

42103
/-- **Bernoulli's inequality** for `n : ℕ`, `-2 ≤ a`. -/
43104
lemma one_add_mul_le_pow (H : -2 ≤ a) (n : ℕ) : 1 + n * a ≤ (1 + a) ^ n :=
44-
one_add_mul_le_pow' (mul_self_nonneg _) (mul_self_nonneg _) (neg_le_iff_add_nonneg'.1 H) _
105+
one_add_le_pow_of_two_add_nonneg (neg_le_iff_add_nonneg'.mp H) n
45106

46107
/-- **Bernoulli's inequality** reformulated to estimate `a^n`. -/
47108
lemma one_add_mul_sub_le_pow (H : -1 ≤ a) (n : ℕ) : 1 + n * (a - 1) ≤ a ^ n := by

0 commit comments

Comments
 (0)