Skip to content

Commit d43e294

Browse files
committed
feat: FloorSemiring.tendsto_pow_div_factorial (#17119)
#12191 added some technical lemmas for #6718, but eventually they were not needed. This PR deprecates them and adds generalized lemmas.
1 parent 3e10c4b commit d43e294

File tree

9 files changed

+129
-54
lines changed

9 files changed

+129
-54
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,6 +3613,7 @@ import Mathlib.Order.Filter.AtTopBot
36133613
import Mathlib.Order.Filter.AtTopBot.Archimedean
36143614
import Mathlib.Order.Filter.AtTopBot.BigOperators
36153615
import Mathlib.Order.Filter.AtTopBot.Field
3616+
import Mathlib.Order.Filter.AtTopBot.Floor
36163617
import Mathlib.Order.Filter.AtTopBot.Group
36173618
import Mathlib.Order.Filter.AtTopBot.ModEq
36183619
import Mathlib.Order.Filter.AtTopBot.Monoid

Mathlib/Algebra/Order/Floor/Prime.lean

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,44 @@ Copyright (c) 2022 Yuyang Zhao. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yuyang Zhao
55
-/
6-
7-
import Mathlib.Algebra.Order.Floor
86
import Mathlib.Data.Nat.Prime.Basic
7+
import Mathlib.Topology.Algebra.Order.Floor
98

109
/-!
1110
# Existence of a sufficiently large prime for which `a * c ^ p / (p - 1)! < 1`
1211
1312
This is a technical result used in the proof of the Lindemann-Weierstrass theorem.
14-
-/
1513
16-
namespace FloorRing
14+
TODO: delete this file, as all its lemmas have been deprecated.
15+
-/
1716

1817
open scoped Nat
1918

19+
@[deprecated eventually_mul_pow_lt_factorial_sub (since := "2024-09-25")]
20+
theorem Nat.exists_prime_mul_pow_lt_factorial (n a c : ℕ) :
21+
∃ p > n, p.Prime ∧ a * c ^ p < (p - 1)! :=
22+
((Filter.frequently_atTop.mpr Nat.exists_infinite_primes).and_eventually
23+
(eventually_mul_pow_lt_factorial_sub a c 1)).forall_exists_of_atTop (n + 1)
24+
25+
namespace FloorRing
26+
2027
variable {K : Type*}
2128

29+
@[deprecated FloorSemiring.eventually_mul_pow_lt_factorial_sub (since := "2024-09-25")]
2230
theorem exists_prime_mul_pow_lt_factorial [LinearOrderedRing K] [FloorRing K] (n : ℕ) (a c : K) :
23-
∃ p > n, p.Prime ∧ a * c ^ p < (p - 1)! := by
24-
obtain ⟨p, pn, pp, h⟩ := n.exists_prime_mul_pow_lt_factorial ⌈|a|⌉.natAbs ⌈|c|⌉.natAbs
25-
use p, pn, pp
26-
calc a * c ^ p
27-
_ ≤ |a * c ^ p| := le_abs_self _
28-
_ ≤ ⌈|a|⌉ * (⌈|c|⌉ : K) ^ p := ?_
29-
_ = ↑(Int.natAbs ⌈|a|⌉ * Int.natAbs ⌈|c|⌉ ^ p) := ?_
30-
_ < ↑(p - 1)! := Nat.cast_lt.mpr h
31-
· rw [abs_mul, abs_pow]
32-
gcongr <;> try first | positivity | apply Int.le_ceil
33-
· simp_rw [Nat.cast_mul, Nat.cast_pow, Int.cast_natAbs,
34-
abs_eq_self.mpr (Int.ceil_nonneg (abs_nonneg (_ : K)))]
31+
∃ p > n, p.Prime ∧ a * c ^ p < (p - 1)! :=
32+
((Filter.frequently_atTop.mpr Nat.exists_infinite_primes).and_eventually
33+
(FloorSemiring.eventually_mul_pow_lt_factorial_sub a c 1)).forall_exists_of_atTop (n + 1)
3534

35+
@[deprecated FloorSemiring.tendsto_mul_pow_div_factorial_sub_atTop (since := "2024-09-25")]
3636
theorem exists_prime_mul_pow_div_factorial_lt_one [LinearOrderedField K] [FloorRing K]
3737
(n : ℕ) (a c : K) :
38-
∃ p > n, p.Prime ∧ a * c ^ p / (p - 1)! < 1 := by
39-
simp_rw [div_lt_one (α := K) (Nat.cast_pos.mpr (Nat.factorial_pos _))]
40-
exact exists_prime_mul_pow_lt_factorial ..
38+
∃ p > n, p.Prime ∧ a * c ^ p / (p - 1)! < 1 :=
39+
letI := Preorder.topology K
40+
haveI : OrderTopology K := ⟨rfl⟩
41+
((Filter.frequently_atTop.mpr Nat.exists_infinite_primes).and_eventually
42+
(eventually_lt_of_tendsto_lt zero_lt_one
43+
(FloorSemiring.tendsto_mul_pow_div_factorial_sub_atTop a c 1))).forall_exists_of_atTop
44+
(n + 1)
4145

4246
end FloorRing

Mathlib/Analysis/ODE/PicardLindelof.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yury Kudryashov, Winston Yin
55
-/
66
import Mathlib.Analysis.SpecialFunctions.Integrals
7+
import Mathlib.Topology.Algebra.Order.Floor
78
import Mathlib.Topology.MetricSpace.Contracting
89

910
/-!
@@ -301,7 +302,7 @@ section
301302

302303
theorem exists_contracting_iterate :
303304
∃ (N : ℕ) (K : _), ContractingWith K (FunSpace.next : v.FunSpace → v.FunSpace)^[N] := by
304-
rcases ((Real.tendsto_pow_div_factorial_atTop (v.L * v.tDist)).eventually
305+
rcases ((FloorSemiring.tendsto_pow_div_factorial_atTop (v.L * v.tDist)).eventually
305306
(gt_mem_nhds zero_lt_one)).exists with ⟨N, hN⟩
306307
have : (0 : ℝ) ≤ (v.L * v.tDist) ^ N / N ! :=
307308
div_nonneg (pow_nonneg (mul_nonneg v.L.2 v.tDist_nonneg) _) (Nat.cast_nonneg _)

Mathlib/Analysis/SpecificLimits/Normed.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,8 @@ theorem Real.summable_pow_div_factorial (x : ℝ) : Summable (fun n ↦ x ^ n /
908908
norm_div, Real.norm_natCast, Nat.cast_succ]
909909
_ ≤ ‖x‖ / (⌊‖x‖⌋₊ + 1) * ‖x ^ n / (n !)‖ := by gcongr
910910

911+
@[deprecated "`Real.tendsto_pow_div_factorial_atTop` has been deprecated, use
912+
`FloorSemiring.tendsto_pow_div_factorial_atTop` instead" (since := "2024-10-05")]
911913
theorem Real.tendsto_pow_div_factorial_atTop (x : ℝ) :
912914
Tendsto (fun n ↦ x ^ n / n ! : ℕ → ℝ) atTop (𝓝 0) :=
913915
(Real.summable_pow_div_factorial x).tendsto_atTop_zero

Mathlib/Data/Nat/Prime/Basic.lean

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -287,37 +287,6 @@ lemma Prime.pow_inj {p q m n : ℕ} (hp : p.Prime) (hq : q.Prime)
287287
(Prime.dvd_of_dvd_pow hq <| h.symm ▸ dvd_pow_self q (succ_ne_zero n))
288288
exact ⟨H, succ_inj'.mp <| Nat.pow_right_injective hq.two_le (H ▸ h)⟩
289289

290-
theorem exists_pow_lt_factorial (c : ℕ) : ∃ n0 > 1, ∀ n ≥ n0, c ^ n < (n - 1)! := by
291-
refine ⟨2 * (c ^ 2 + 1), ?_, ?_⟩
292-
· omega
293-
intro n hn
294-
obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_le hn
295-
obtain (rfl | c0) := c.eq_zero_or_pos
296-
· simp [Nat.factorial_pos]
297-
refine (Nat.le_mul_of_pos_right _ (Nat.pow_pos (n := d) c0)).trans_lt ?_
298-
convert_to (c ^ 2) ^ (c ^ 2 + d + 1) < (c ^ 2 + (c ^ 2 + d + 1))!
299-
· rw [← pow_mul, ← pow_add]
300-
congr 1
301-
omega
302-
· congr
303-
omega
304-
refine lt_of_lt_of_le ?_ Nat.factorial_mul_pow_le_factorial
305-
rw [← one_mul (_ ^ _ : ℕ)]
306-
exact Nat.mul_lt_mul_of_le_of_lt (Nat.one_le_of_lt (Nat.factorial_pos _))
307-
(Nat.pow_lt_pow_left (Nat.lt_succ_self _) (Nat.succ_ne_zero _)) (Nat.factorial_pos _)
308-
309-
theorem exists_mul_pow_lt_factorial (a : ℕ) (c : ℕ) : ∃ n0, ∀ n ≥ n0, a * c ^ n < (n - 1)! := by
310-
obtain ⟨n0, hn, h⟩ := Nat.exists_pow_lt_factorial (a * c)
311-
refine ⟨n0, fun n hn => lt_of_le_of_lt ?_ (h n hn)⟩
312-
rw [mul_pow]
313-
refine Nat.mul_le_mul_right _ (Nat.le_self_pow ?_ _)
314-
omega
315-
316-
theorem exists_prime_mul_pow_lt_factorial (n a c : ℕ) : ∃ p > n, p.Prime ∧ a * c ^ p < (p - 1)! :=
317-
have ⟨n0, h⟩ := Nat.exists_mul_pow_lt_factorial a c
318-
have ⟨p, hp, prime_p⟩ := (max (n + 1) n0).exists_infinite_primes
319-
⟨p, (le_max_left _ _).trans hp, prime_p, h _ <| le_of_max_le_right hp⟩
320-
321290
end Nat
322291

323292
namespace Int

Mathlib/Data/Real/Pi/Irrational.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Authors: Bhavik Mehta
55
-/
66
import Mathlib.Analysis.SpecialFunctions.Integrals
77
import Mathlib.Data.Real.Irrational
8+
import Mathlib.Topology.Algebra.Order.Floor
89

910
/-!
1011
# `Real.pi` is irrational
@@ -262,7 +263,7 @@ reformulation of tendsto_pow_div_factorial_atTop, which asserts the same for `a
262263
private lemma tendsto_pow_div_factorial_at_top_aux (a : ℝ) :
263264
Tendsto (fun n => (a : ℝ) ^ (2 * n + 1) / n !) atTop (nhds 0) := by
264265
rw [← mul_zero a]
265-
refine ((tendsto_pow_div_factorial_atTop (a ^ 2)).const_mul a).congr (fun x => ?_)
266+
refine ((FloorSemiring.tendsto_pow_div_factorial_atTop (a ^ 2)).const_mul a).congr (fun x => ?_)
266267
rw [← pow_mul, mul_div_assoc', _root_.pow_succ']
267268

268269
/-- If `x` is rational, it can be written as `a / b` with `a : ℤ` and `b : ℕ` satisfying `b > 0`. -/

Mathlib/Order/Filter/AtTopBot.lean

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,3 +1224,45 @@ theorem Antitone.piecewise_eventually_eq_iInter {β : α → Type*} [Preorder ι
12241224
convert ← (compl_anti.comp hs).piecewise_eventually_eq_iUnion g f a using 3
12251225
· convert congr_fun (Set.piecewise_compl (s _) g f) a
12261226
· simp only [(· ∘ ·), ← compl_iInter, Set.piecewise_compl]
1227+
1228+
namespace Nat
1229+
1230+
theorem eventually_pow_lt_factorial_sub (c d : ℕ) : ∀ᶠ n in atTop, c ^ n < (n - d)! := by
1231+
rw [eventually_atTop]
1232+
refine ⟨2 * (c ^ 2 + d + 1), ?_⟩
1233+
intro n hn
1234+
obtain ⟨d', rfl⟩ := Nat.exists_eq_add_of_le hn
1235+
obtain (rfl | c0) := c.eq_zero_or_pos
1236+
· simp [Nat.two_mul, ← Nat.add_assoc, Nat.add_right_comm _ 1, Nat.factorial_pos]
1237+
refine (Nat.le_mul_of_pos_right _ (Nat.pow_pos (n := d') c0)).trans_lt ?_
1238+
convert_to (c ^ 2) ^ (c ^ 2 + d' + d + 1) < (c ^ 2 + (c ^ 2 + d' + d + 1) + 1)!
1239+
· rw [← pow_mul, ← pow_add]
1240+
congr 1
1241+
omega
1242+
· congr 1
1243+
omega
1244+
refine (lt_of_lt_of_le ?_ Nat.factorial_mul_pow_le_factorial).trans_le <|
1245+
(factorial_le (Nat.le_succ _))
1246+
rw [← one_mul (_ ^ _ : ℕ)]
1247+
apply Nat.mul_lt_mul_of_le_of_lt
1248+
· exact Nat.one_le_of_lt (Nat.factorial_pos _)
1249+
· exact Nat.pow_lt_pow_left (Nat.lt_succ_self _) (Nat.succ_ne_zero _)
1250+
· exact (Nat.factorial_pos _)
1251+
1252+
theorem eventually_mul_pow_lt_factorial_sub (a c d : ℕ) :
1253+
∀ᶠ n in atTop, a * c ^ n < (n - d)! := by
1254+
filter_upwards [Nat.eventually_pow_lt_factorial_sub (a * c) d, Filter.eventually_gt_atTop 0]
1255+
with n hn hn0
1256+
rw [mul_pow] at hn
1257+
exact (Nat.mul_le_mul_right _ (Nat.le_self_pow hn0.ne' _)).trans_lt hn
1258+
1259+
@[deprecated eventually_pow_lt_factorial_sub (since := "2024-09-25")]
1260+
theorem exists_pow_lt_factorial (c : ℕ) : ∃ n0 > 1, ∀ n ≥ n0, c ^ n < (n - 1)! :=
1261+
let ⟨n0, h⟩ := (eventually_pow_lt_factorial_sub c 1).exists_forall_of_atTop
1262+
⟨max n0 2, by omega, fun n hn ↦ h n (by omega)⟩
1263+
1264+
@[deprecated eventually_mul_pow_lt_factorial_sub (since := "2024-09-25")]
1265+
theorem exists_mul_pow_lt_factorial (a : ℕ) (c : ℕ) : ∃ n0, ∀ n ≥ n0, a * c ^ n < (n - 1)! :=
1266+
(eventually_mul_pow_lt_factorial_sub a c 1).exists_forall_of_atTop
1267+
1268+
end Nat
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/-
2+
Copyright (c) 2022 Yuyang Zhao. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Yuyang Zhao
5+
-/
6+
import Mathlib.Algebra.Order.Floor
7+
import Mathlib.Order.Filter.AtTopBot
8+
9+
/-!
10+
# `a * c ^ n < (n - d)!` holds true for sufficiently large `n`.
11+
-/
12+
13+
open Filter
14+
open scoped Nat
15+
16+
variable {K : Type*} [LinearOrderedRing K] [FloorSemiring K]
17+
18+
theorem FloorSemiring.eventually_mul_pow_lt_factorial_sub (a c : K) (d : ℕ) :
19+
∀ᶠ n in atTop, a * c ^ n < (n - d)! := by
20+
filter_upwards [Nat.eventually_mul_pow_lt_factorial_sub ⌈|a|⌉₊ ⌈|c|⌉₊ d] with n h
21+
calc a * c ^ n
22+
_ ≤ |a * c ^ n| := le_abs_self _
23+
_ ≤ ⌈|a|⌉₊ * (⌈|c|⌉₊ : K) ^ n := ?_
24+
_ = ↑(⌈|a|⌉₊ * ⌈|c|⌉₊ ^ n) := ?_
25+
_ < (n - d)! := Nat.cast_lt.mpr h
26+
· rw [abs_mul, abs_pow]
27+
gcongr <;> try first | positivity | apply Nat.le_ceil
28+
· simp_rw [Nat.cast_mul, Nat.cast_pow]

Mathlib/Topology/Algebra/Order/Floor.lean

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ Copyright (c) 2020 Anatole Dedecker. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Anatole Dedecker
55
-/
6-
import Mathlib.Algebra.Order.Floor
6+
import Mathlib.Order.Filter.AtTopBot.Floor
77
import Mathlib.Topology.Algebra.Order.Group
8-
import Mathlib.Topology.Order.Basic
98

109
/-!
1110
# Topological facts about `Int.floor`, `Int.ceil` and `Int.fract`
@@ -27,8 +26,36 @@ This file proves statements about limits and continuity of functions involving `
2726

2827
open Filter Function Int Set Topology
2928

29+
namespace FloorSemiring
30+
31+
open scoped Nat
32+
33+
variable {K : Type*} [LinearOrderedField K] [FloorSemiring K] [TopologicalSpace K] [OrderTopology K]
34+
35+
theorem tendsto_mul_pow_div_factorial_sub_atTop (a c : K) (d : ℕ) :
36+
Tendsto (fun n ↦ a * c ^ n / (n - d)!) atTop (𝓝 0) := by
37+
rw [tendsto_order]
38+
constructor
39+
all_goals
40+
intro ε hε
41+
filter_upwards [eventually_mul_pow_lt_factorial_sub (a * ε⁻¹) c d] with n h
42+
rw [mul_right_comm, ← div_eq_mul_inv] at h
43+
· rw [div_lt_iff_of_neg hε] at h
44+
rwa [lt_div_iff₀' (Nat.cast_pos.mpr (Nat.factorial_pos _))]
45+
· rw [div_lt_iff₀ hε] at h
46+
rwa [div_lt_iff₀' (Nat.cast_pos.mpr (Nat.factorial_pos _))]
47+
48+
theorem tendsto_pow_div_factorial_atTop (c : K) :
49+
Tendsto (fun n ↦ c ^ n / n !) atTop (𝓝 0) := by
50+
convert tendsto_mul_pow_div_factorial_sub_atTop 1 c 0
51+
rw [one_mul]
52+
53+
end FloorSemiring
54+
3055
variable {α β γ : Type*} [LinearOrderedRing α] [FloorRing α]
3156

57+
-- TODO: move to `Mathlib.Order.Filter.AtTopBot.Floor`
58+
3259
theorem tendsto_floor_atTop : Tendsto (floor : α → ℤ) atTop atTop :=
3360
floor_mono.tendsto_atTop_atTop fun b =>
3461
⟨(b + 1 : ℤ), by rw [floor_intCast]; exact (lt_add_one _).le⟩

0 commit comments

Comments
 (0)