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/Setup.lean

All files · 101 lines · source at the verified commit

1module
2
3public import E424.Defs
4
5@[expose] public section
6
7/-!
8# Section 2: the input, Lemmas 2-4
9
10Everything here is proved; the logarithmic form of Lemma 3 is in `E424/Setup/L3log.lean`.
11-/
12
13set_option linter.style.header false
14open Finset
15
16namespace E424
17
18/-- **Lemma 2.** Words map `A ∩ (14, ∞)` into `A`. -/
19theorem L2 {x : ℕ} (hx : x ∈ A) (h14 : 14 < x) (w : List ℕ)
20 (hw : ∀ a ∈ w, Inp.Letter a) : Inp.eval w x ∈ A := by
21 rw [mem_A_iff] at *
22 exact Inp.eval_gen hx h14 w hw
23
24/-- **Input K** in the form used: in every `K + 1` consecutive exponents there is a *good* one. -/
25theorem inputK : ∃ κ > (0 : ℝ), κ ≤ 1 ∧ ∃ K : ℕ, ∀ M : ℕ, 0 < M → ∃ n, M ≤ n ∧ n ≤ M + K ∧
26 ∃ 𝒞 : Finset ℕ, κ * (Inp.q ^ n : ℕ) ≤ 𝒞.card ∧ ∀ c ∈ 𝒞, 0 < c ∧ c < Inp.q ^ n ∧
27 ∀ x ∈ A, 14 < x → Inp.q ^ n * x - c ∈ A :=
28 Inp.inputK
29
30/-- The elements of `A` in `(u, v]`. -/
31noncomputable def AIoc (u v : ℝ) : Finset ℕ :=
32 open Classical in (Ioc ⌊u⌋₊ ⌊v⌋₊).filter (· ∈ A)
33
34/-- **Lemma 3**, counting form. -/
35theorem L3 : ∃ α > (0 : ℝ), α ≤ 1 ∧ ∃ x0 ≥ (1 : ℝ), ∀ x ≥ x0, α * x ≤ (AIoc 0 x).card :=
36 Inp.lower_density
37
38/-- **Lemma 3**, positive proportion in `(αx/2, x]`. -/
39theorem L3_top : ∃ α > (0 : ℝ), α ≤ 1 ∧ ∃ x0 ≥ (1 : ℝ), ∀ x ≥ x0,
40 α * x / 2 ≤ (AIoc (α * x / 2) x).card := by
41 classical
42 obtain ⟨α, hα, hα1, x0, hx0, h⟩ := L3
43 refine ⟨α, hα, hα1, x0, hx0, fun x hx => ?_⟩
44 have hxp : 0 < x := by linarith
45 have hsub : AIoc 0 x ⊆ Ioc 0 ⌊α * x / 2⌋₊ ∪ AIoc (α * x / 2) x := by
46 intro n hn
47 simp only [AIoc, mem_filter, mem_Ioc, Nat.floor_zero, mem_union] at hn ⊢
48 by_cases hle : n ≤ ⌊α * x / 2⌋₊
49 · exact Or.inl ⟨hn.1.1, hle⟩
50 · exact Or.inr ⟨⟨by omega, hn.1.2⟩, hn.2⟩
51 have hc := (card_le_card hsub).trans (card_union_le _ _)
52 rw [Nat.card_Ioc, Nat.sub_zero] at hc
53 have hc' : ((AIoc 0 x).card : ℝ) ≤ ⌊α * x / 2⌋₊ + (AIoc (α * x / 2) x).card := by exact_mod_cast hc
54 have hfl : (⌊α * x / 2⌋₊ : ℝ) ≤ α * x / 2 := Nat.floor_le (by positivity)
55 have := h x hx
56 linarith
57
58/-- **Lemma 4**, `A ⊂ U`. -/
59theorem A_subset_U : A ⊆ U := by
60 intro n hn
61 rw [mem_A_iff] at hn
62 induction hn with
63 | two => exact ⟨by norm_num, by norm_num⟩
64 | three => exact ⟨by norm_num, by norm_num⟩
65 | @mul_sub_one a b _ _ hab iha ihb =>
66 obtain ⟨ha1, ha⟩ := iha
67 obtain ⟨hb1, hb⟩ := ihb
68 have h2 : 2 ≤ a * b := by
69 rcases Nat.lt_or_gt_of_ne hab with h | h <;> nlinarith
70 refine ⟨by omega, fun h => ?_⟩
71 have h3 : a * b % 3 = 2 := by omega
72 rw [Nat.mul_mod] at h3
73 have : a % 3 = 0 ∨ a % 3 = 2 := by omega
74 have : b % 3 = 0 ∨ b % 3 = 2 := by omega
75 rcases ‹a % 3 = 0 ∨ a % 3 = 2› with h | h <;> rcases ‹b % 3 = 0 ∨ b % 3 = 2› with h' | h' <;>
76 simp [h, h'] at h3
77
78/-- **Lemma 4**, `f (s y - 1) ≤ f y`. -/
79theorem L4 {s y : ℕ} (hs : s ∈ A) (hy : y ∈ U) (hne : s ≠ y) : f (s * y - 1) ≤ f y := by
80 refine ind_mono fun h => ⟨hy, fun hyA => h.2 (mul_sub_one_mem_A hs hyA hne)⟩
81
82theorem f_eq_zero_of_not_U {n : ℕ} (h : n ∉ U) : f n = 0 := ind_false fun hB => h hB.1
83theorem f_eq_zero_of_mem_A {n : ℕ} (h : n ∈ A) : f n = 0 := ind_false fun hB => hB.2 h
84
85theorem two_mem : 2 ∈ A := (mem_A_iff 2).mpr .two
86theorem three_mem : 3 ∈ A := (mem_A_iff 3).mpr .three
87theorem nine_mem : 9 ∈ A := (mem_A_iff 9).mpr Inp.Gen.nine
88theorem mem_84 : 84 ∈ A := mul_sub_one_mem_A (a := 5) (b := 17)
89 ((mem_A_iff 5).mpr Inp.Gen.five) ((mem_A_iff 17).mpr Inp.Gen.seventeen)
90 (by norm_num)
91
92/-- For `s ≡ 2 mod 3` the map `y ↦ s y - 1` preserves membership in `U` both ways. -/
93theorem mem_U_iff_of_mod {s y : ℕ} (hs : s % 3 = 2) (hy : 1 ≤ y) : s * y - 1 ∈ U ↔ y ∈ U := by
94 have h : s * y % 3 = 2 * (y % 3) % 3 := by rw [Nat.mul_mod, hs]
95 have h1 : 2 ≤ s := by omega
96 have h2 : 2 ≤ s * y := by nlinarith
97 simp only [U, Set.mem_ofPred_eq]
98 omega
99
100end E424
101