This journal is in preparation. Submissions are open as a pilot and the editorial board is being formed. Articles marked Demonstration show the format only.
Journal of Machine-Verified MathematicsPeer-reviewed mathematics with machine-checked proofs, for the age of AI

E424/DirichletError/Basic.lean

All files · 126 lines · source at the verified commit

1module
2
3public import E424.Setup
4
5@[expose] public section
6
7/-!
8# Section 7 of the outline: Basic
9-/
10
11set_option linter.style.header false
12open Finset MeasureTheory
13
14namespace E424
15
16theorem gw_nonneg (x : ℝ) : 0 ≤ gw x := by
17 unfold gw; split_ifs
18 · have := Real.smoothTransition.monotone (show Real.logb 2 x - 1 ≤ Real.logb 2 x by linarith)
19 linarith
20 · exact le_rfl
21
22theorem gw_le_one (x : ℝ) : gw x ≤ 1 := by
23 unfold gw; split_ifs
24 · have := Real.smoothTransition.le_one (Real.logb 2 x)
25 have := Real.smoothTransition.nonneg (Real.logb 2 x - 1)
26 linarith
27 · exact zero_le_one
28
29theorem gw_eq_zero {x : ℝ} (h : x ≤ 1 ∨ 4 ≤ x) : gw x = 0 := by
30 unfold gw; split_ifs with hx
31 · rcases h with h | h
32 · have : Real.logb 2 x ≤ 0 := Real.logb_nonpos (by norm_num) hx.le h
33 rw [Real.smoothTransition.zero_of_nonpos this,
34 Real.smoothTransition.zero_of_nonpos (by linarith), sub_zero]
35 · have : 2 ≤ Real.logb 2 x := by
36 rw [Real.le_logb_iff_rpow_le (by norm_num) hx]; norm_num; exact h
37 rw [Real.smoothTransition.one_of_one_le (by linarith),
38 Real.smoothTransition.one_of_one_le (by linarith), sub_self]
39 · rfl
40
41/-- `gw` is smooth: it vanishes on `(-∞, 1]`, and on `(0, ∞)` it is a difference of smooth
42transitions of `logb 2 x`, which is smooth away from `0`. -/
43theorem gw_contDiff : ContDiff ℝ 3 gw := by
44 rw [contDiff_iff_contDiffAt]
45 intro x
46 rcases lt_or_ge x 1 with hx | hx
47 · have hev : gw =ᶠ[nhds x] fun _ => (0 : ℝ) := by
48 filter_upwards [Iio_mem_nhds hx] with y hy
49 exact gw_eq_zero (Or.inl (le_of_lt hy))
50 exact contDiffAt_const.congr_of_eventuallyEq hev
51 · have hx0 : 0 < x := by linarith
52 have hev : gw =ᶠ[nhds x] fun y => Real.smoothTransition (Real.logb 2 y)
53 - Real.smoothTransition (Real.logb 2 y - 1) := by
54 filter_upwards [Ioi_mem_nhds hx0] with y hy
55 unfold gw
56 rw [if_pos (Set.mem_Ioi.1 hy)]
57 have hlog : ContDiffAt ℝ 3 (fun y : ℝ => Real.logb 2 y) x := by
58 have : (fun y : ℝ => Real.logb 2 y) = fun y => Real.log y / Real.log 2 := rfl
59 rw [this]
60 exact ((Real.contDiffAt_log.2 hx0.ne').div_const _)
61 refine ContDiffAt.congr_of_eventuallyEq ?_ hev
62 exact (Real.smoothTransition.contDiffAt.comp x hlog).sub
63 (Real.smoothTransition.contDiffAt.comp x (hlog.sub contDiffAt_const))
64
65/-- The partition of unity: for `x > 0`, `∑_{k<n} gw(x/2^k) = 1` as soon as `4 ≤ x ≤ 2^n`. -/
66theorem gw_sum (x : ℝ) (n : ℕ) (hx : 4 ≤ x) (hn : x ≤ 2 ^ n) : ∑ k ∈ range n, gw (x / 2 ^ k) = 1 := by
67 have hx0 : 0 < x := by linarith
68 have hL : 2 ≤ Real.logb 2 x := by
69 rw [Real.le_logb_iff_rpow_le (by norm_num) hx0]; norm_num; exact hx
70 have hLn : Real.logb 2 x ≤ n := by
71 rw [Real.logb_le_iff_le_rpow (by norm_num) hx0, Real.rpow_natCast]; exact hn
72 have hterm : ∀ k ∈ range n, gw (x / 2 ^ k) =
73 Real.smoothTransition (Real.logb 2 x - k) - Real.smoothTransition (Real.logb 2 x - (k + 1 : ℕ)) := by
74 intro k _
75 have : Real.logb 2 (x / 2 ^ k) = Real.logb 2 x - k := by
76 rw [Real.logb_div hx0.ne' (by positivity), Real.logb_pow, Real.logb_self_eq_one (by norm_num),
77 mul_one]
78 rw [gw, if_pos (by positivity), this]
79 push_cast
80 rw [sub_sub]
81 rw [sum_congr rfl hterm, sum_range_sub' (fun k : ℕ => Real.smoothTransition (Real.logb 2 x - k))]
82 rw [Nat.cast_zero, sub_zero, Real.smoothTransition.one_of_one_le (by linarith),
83 Real.smoothTransition.zero_of_nonpos (by linarith), sub_zero]
84
85theorem nit_mul (m n : ℕ) (hm : 1 ≤ m) (hn : 1 ≤ n) (t : ℝ) : nit (m * n) t = nit m t * nit n t := by
86 unfold nit
87 rw [← Complex.exp_add]
88 congr 1
89 have h1 : (m : ℝ) ≠ 0 := by positivity
90 have h2 : (n : ℝ) ≠ 0 := by positivity
91 push_cast
92 rw [← Complex.ofReal_natCast, ← Complex.ofReal_natCast]
93 rw [← Complex.ofReal_mul, Real.log_mul h1 h2]
94 push_cast; ring
95
96theorem norm_nit (n : ℕ) (t : ℝ) : ‖nit n t‖ = 1 := by
97 unfold nit
98 have : (-(t * Real.log n : ℝ) : ℂ) * Complex.I = ((-(t * Real.log n) : ℝ) : ℂ) * Complex.I := by
99 push_cast; ring
100 rw [this, Complex.norm_exp_ofReal_mul_I]
101
102theorem continuous_nit (n : ℕ) : Continuous (nit n) := by
103 unfold nit
104 fun_prop
105
106theorem continuous_Fp (N : ℝ) : Continuous (Fp N) := by
107 unfold Fp
108 exact continuous_finsetSum _ fun n _ => continuous_const.mul (continuous_nit n)
109
110theorem continuous_Err (S : Finset ℕ) (N : ℝ) : Continuous (Err S N) := by
111 unfold Err
112 refine (continuous_Fp N).sub (continuous_const.mul (continuous_finsetSum _ fun s _ => ?_))
113 exact (continuous_const.mul (continuous_nit s)).mul (continuous_Fp _)
114
115theorem continuous_Pv (lo : ℝ) (S : Finset ℕ) (v : ℕ) : Continuous (Pv lo S v) := by
116 unfold Pv
117 exact continuous_finsetSum _ fun s _ => continuous_const.mul (continuous_nit s)
118
119theorem isOpen_Ubad (lo : ℝ) (S : Finset ℕ) : IsOpen (Ubad lo S) := by
120 have : Ubad lo S = ⋃ v, {t | (Real.log lo ^ 200)⁻¹ < ‖Pv lo S v t‖} := by
121 ext t; simp [Ubad]
122 rw [this]
123 exact isOpen_iUnion fun v => isOpen_lt continuous_const (continuous_Pv lo S v).norm
124
125end E424
126