Skip to content

Commit a59ff39

Browse files
committed
Use bound
1 parent c40edb3 commit a59ff39

File tree

5 files changed

+31
-22
lines changed

5 files changed

+31
-22
lines changed

LeanAPAP.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import LeanAPAP.Extras.BSG
22
import LeanAPAP.FiniteField
33
import LeanAPAP.Integer
4+
import LeanAPAP.Mathlib.Algebra.Order.GroupWithZero.Unbundled
45
import LeanAPAP.Mathlib.MeasureTheory.Function.LpSeminorm.Basic
56
import LeanAPAP.Mathlib.Order.LiminfLimsup
67
import LeanAPAP.Mathlib.Probability.ConditionalProbability

LeanAPAP/FiniteField.lean

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ local notation "𝓛" x:arg => 1 + log x⁻¹
2727
private lemma one_le_curlog (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : 1 ≤ 𝓛 x := by
2828
obtain rfl | hx₀ := hx₀.eq_or_lt
2929
· simp
30-
have : 0 ≤ log x⁻¹ := log_nonneg $ (one_le_inv₀ (by positivity)).2 hx₁
30+
have : 0 ≤ log x⁻¹ := by bound
3131
linarith
3232

3333
private lemma curlog_pos (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : 0 < 𝓛 x := by
3434
obtain rfl | hx₀ := hx₀.eq_or_lt
3535
· simp
36-
have : 0 ≤ log x⁻¹ := log_nonneg $ (one_le_inv₀ (by positivity)).2 hx₁
36+
have : 0 ≤ log x⁻¹ := by bound
3737
positivity
3838

3939
private lemma rpow_inv_neg_curlog_le (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : x⁻¹ ^ (𝓛 x)⁻¹ ≤ exp 1 := by
@@ -57,8 +57,7 @@ private lemma curlog_mul_le (hx₀ : 0 < x) (hx₁ : x ≤ 1) (hy₀ : 0 < y) (h
5757
exact h.trans_eq (by rw [mul_inv, log_mul]; ring; all_goals positivity)
5858
calc
5959
log x⁻¹ - (x⁻¹ - 1) ≤ 0 := sub_nonpos.2 $ log_le_sub_one_of_pos $ by positivity
60-
_ ≤ (x⁻¹ - 1) * log y⁻¹ :=
61-
mul_nonneg (sub_nonneg.2 $ (one_le_inv₀ hx₀).2 hx₁) $ log_nonneg $ (one_le_inv₀ hy₀).2 hy₁
60+
_ ≤ (x⁻¹ - 1) * log y⁻¹ := mul_nonneg (sub_nonneg.2 $ (one_le_inv₀ hx₀).2 hx₁) $ by bound
6261

6362
private lemma curlog_div_le (hx₀ : 0 < x) (hx₁ : x ≤ 1) (hy : 1 ≤ y) :
6463
𝓛 (x / y) ≤ y * 𝓛 x := by
@@ -71,9 +70,7 @@ private lemma curlog_rpow_le' (hx₀ : 0 < x) (hx₁ : x ≤ 1) (hy₀ : 0 < y)
7170
exact h.trans_eq (by rw [← inv_rpow, log_rpow]; ring; all_goals positivity)
7271
calc
7372
1 - y⁻¹ ≤ 0 := sub_nonpos.2 $ (one_le_inv₀ hy₀).2 hy₁
74-
_ ≤ (y⁻¹ - y) * log x⁻¹ :=
75-
mul_nonneg (sub_nonneg.2 $ hy₁.trans $ (one_le_inv₀ hy₀).2 hy₁) $
76-
log_nonneg $ (one_le_inv₀ hx₀).2 hx₁
73+
_ ≤ (y⁻¹ - y) * log x⁻¹ := mul_nonneg (sub_nonneg.2 $ hy₁.trans $ by bound) $ by bound
7774

7875
private lemma curlog_rpow_le (hx₀ : 0 < x) (hy : 1 ≤ y) : 𝓛 (x ^ y) ≤ y * 𝓛 x := by
7976
rw [← inv_rpow, log_rpow, mul_one_add]
@@ -116,7 +113,7 @@ lemma global_dichotomy [MeasurableSpace G] [DiscreteMeasurableSpace G] (hA : A.N
116113
any_goals positivity
117114
exact ENNReal.natCast_ne_top _
118115
· have : 1 ≤ γ⁻¹ := (one_le_inv₀ hγ).2 hγ₁
119-
have : 0 ≤ log γ⁻¹ := log_nonneg this
116+
have : 0 ≤ log γ⁻¹ := by bound
120117
calc
121118
γ ^ (-(↑p)⁻¹ : ℝ) = √(γ⁻¹ ^ ((↑⌈1 + log γ⁻¹⌉₊)⁻¹ : ℝ)) := by
122119
rw [rpow_neg hγ.le, inv_rpow hγ.le]
@@ -142,9 +139,8 @@ lemma ap_in_ff (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹) (hε₀ : 0 < ε) (hε
142139
have hA₁ : A₁.Nonempty := by simpa using hα₀.trans_le hαA₁
143140
have hA₂ : A₂.Nonempty := by simpa using hα₀.trans_le hαA₂
144141
have hα₁ : α ≤ 1 := hαA₁.trans $ mod_cast A₁.dens_le_one
145-
have : 0 ≤ log α⁻¹ := log_nonneg $ (one_le_inv₀ hα₀).2 hα₁
146-
have : 0 ≤ log (ε * α)⁻¹ :=
147-
log_nonneg $ (one_le_inv₀ (by positivity)).2 $ mul_le_one₀ hε₁ hα₀.le hα₁
142+
have : 0 ≤ log α⁻¹ := by bound
143+
have : 0 ≤ log (ε * α)⁻¹ := by bound
148144
obtain rfl | hS := S.eq_empty_or_nonempty
149145
· exact ⟨⊤, inferInstance, by simp [hε₀.le]; positivity⟩
150146
have hA₁ : σ[A₁, univ] ≤ α⁻¹ :=
@@ -362,13 +358,12 @@ lemma di_in_ff [MeasurableSpace G] [DiscreteMeasurableSpace G] (hq₃ : 3 ≤ q)
362358
𝓛 (ε / 32 * (4⁻¹ * α ^ (2 * q'))) ^ 2 * (ε / 32)⁻¹ ^ 2 := hVdim
363359
_ ≤ 2 ^ 32 * (8 * q' * 𝓛 α) ^ 2 *
364360
(2 ^ 8 * q' * 𝓛 α / ε) ^ 2 * (ε / 32)⁻¹ ^ 2 := by
365-
have : α ^ (2 * q') ≤ 1 := pow_le_one₀ hα₀.le hα₁
366-
have : 4⁻¹ * α ^ (2 * q') ≤ 1 := mul_le_one₀ (by norm_num) (by positivity) ‹_›
367-
have : ε / 32 * (4⁻¹ * α ^ (2 * q')) ≤ 1 := mul_le_one₀ (by linarith) (by positivity) ‹_›
368-
have : 0 ≤ log (ε / 32 * (4⁻¹ * α ^ (2 * q')))⁻¹ :=
369-
log_nonneg $ (one_le_inv₀ (by positivity)).2 ‹_›
370-
have : 0 ≤ log (4⁻¹ * α ^ (2 * q'))⁻¹ := log_nonneg $ (one_le_inv₀ (by positivity)).2 ‹_›
371-
have : 0 ≤ log (α ^ (2 * q'))⁻¹ := log_nonneg $ (one_le_inv₀ (by positivity)).2 ‹_›
361+
have : α ^ (2 * q') ≤ 1 := by bound
362+
have : 4⁻¹ * α ^ (2 * q') ≤ 1 := by bound
363+
have : ε / 32 * (4⁻¹ * α ^ (2 * q')) ≤ 1 := by bound
364+
have : 0 ≤ log (ε / 32 * (4⁻¹ * α ^ (2 * q')))⁻¹ := by bound
365+
have : 0 ≤ log (4⁻¹ * α ^ (2 * q'))⁻¹ := by bound
366+
have : 0 ≤ log (α ^ (2 * q'))⁻¹ := by bound
372367
have :=
373368
calc
374369
𝓛 (4⁻¹ * α ^ (2 * q')) ≤ 4⁻¹⁻¹ * 𝓛 (α ^ (2 * q')) :=
@@ -532,7 +527,7 @@ theorem ff (hq₃ : 3 ≤ q) (hq : q.Prime) (hA₀ : A.Nonempty) (hA : ThreeAPFr
532527
< ⌊log α⁻¹ / log (65 / 64)⌋₊ + 1 := Nat.lt_floor_add_one _
533528
_ = ⌊(log (65 / 64) + log α⁻¹) / log (65 / 64)⌋₊ := by
534529
rw [add_comm (log _), ← div_add_one aux.ne', Nat.floor_add_one, Nat.cast_succ]
535-
exact div_nonneg (log_nonneg $ (one_le_inv₀ (by positivity)).2 (by simp [α])) aux.le
530+
bound
536531
_ ≤ ⌊𝓛 α / log (65 / 64)⌋₊ := by
537532
gcongr
538533
calc
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Mathlib.Algebra.Order.GroupWithZero.Unbundled
2+
3+
@[bound] alias ⟨_, Bound.one_le_inv₀⟩ := one_le_inv₀
4+
5+
attribute [bound] mul_le_one₀
6+
7+
@[bound]
8+
protected lemma Bound.one_lt_mul {M₀ : Type*} [MonoidWithZero M₀] [Preorder M₀] [ZeroLEOneClass M₀]
9+
[PosMulMono M₀] [MulPosMono M₀] {a b : M₀} : 1 ≤ a ∧ 1 < b ∨ 1 < a ∧ 1 ≤ b → 1 < a * b := by
10+
rintro (⟨ha, hb⟩ | ⟨ha, hb⟩); exacts [one_lt_mul ha hb, one_lt_mul_of_lt_of_le ha hb]

LeanAPAP/Physics/AlmostPeriodicity.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Mathlib.Algebra.Order.Chebyshev
22
import Mathlib.Combinatorics.Additive.DoublingConst
33
import Mathlib.Data.Complex.ExponentialBounds
44
import Mathlib.Tactic.Bound
5+
import LeanAPAP.Mathlib.Algebra.Order.GroupWithZero.Unbundled
56
import LeanAPAP.Prereqs.Convolution.Discrete.Basic
67
import LeanAPAP.Prereqs.Convolution.Norm
78
import LeanAPAP.Prereqs.Inner.Hoelder.Discrete
@@ -91,7 +92,7 @@ variable {G : Type*} [Fintype G] {A S : Finset G} {f : G → ℂ} {x ε K : ℝ}
9192
local notation "𝓛" x => 1 + log (min 1 x)⁻¹
9293

9394
private lemma curlog_pos (hx₀ : 0 < x) : 0 < 𝓛 x := by
94-
have : 0 ≤ log (min 1 x)⁻¹ := log_nonneg $ (one_le_inv₀ (by positivity)).2 inf_le_left
95+
have : 0 ≤ log (min 1 x)⁻¹ := by bound
9596
positivity
9697

9798
section

LeanAPAP/Prereqs/Chang.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import Mathlib.Algebra.Order.Chebyshev
22
import Mathlib.Analysis.MeanInequalities
3+
import Mathlib.Tactic.Bound
4+
import LeanAPAP.Mathlib.Algebra.Order.GroupWithZero.Unbundled
35
import LeanAPAP.Prereqs.Energy
46
import LeanAPAP.Prereqs.LargeSpec
57
import LeanAPAP.Prereqs.Rudin
@@ -19,7 +21,7 @@ local notation "𝓛" x:arg => 1 + log x⁻¹
1921
private lemma curlog_pos (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : 0 < 𝓛 x := by
2022
obtain rfl | hx₀ := hx₀.eq_or_lt
2123
· simp
22-
have : 0 ≤ log x⁻¹ := log_nonneg $ (one_le_inv₀ (by positivity)).2 hx₁
24+
have : 0 ≤ log x⁻¹ := by bound
2325
positivity
2426

2527
private lemma rpow_inv_neg_curlog_le (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : x⁻¹ ^ (𝓛 x)⁻¹ ≤ exp 1 := by
@@ -38,7 +40,7 @@ private lemma rpow_inv_neg_curlog_le (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : x⁻
3840

3941
noncomputable def changConst : ℝ := 32 * exp 1
4042

41-
lemma one_lt_changConst : 1 < changConst := one_lt_mul (by norm_num) $ one_lt_exp_iff.2 one_pos
43+
lemma one_lt_changConst : 1 < changConst := by unfold changConst; bound
4244

4345
lemma changConst_pos : 0 < changConst := zero_lt_one.trans one_lt_changConst
4446

0 commit comments

Comments
 (0)