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/RoughElements/L7.lean

All files · 73 lines · source at the verified commit

1module
2
3public import E424.RoughElements.L6
4
5@[expose] public section
6
7/-!
8# Section 3 of the outline: L7
9-/
10
11set_option linter.style.header false
12open Finset
13
14namespace E424
15
16/-- `s(x) = 84 (6^k x - o(x mod P)) - 1`. -/
17def sfun (P k : ℕ) (o : ℕ → ℕ) (x : ℕ) : ℕ := 84 * (6 ^ k * x - o (x % P)) - 1
18
19/-- **Lemma 7**, size. -/
20theorem sfun_bounds {P k : ℕ} {o : ℕ → ℕ} (ho : ∀ i, o i < 6 ^ k) {x : ℕ} (hx : 1 ≤ x) :
21 84 * (6 ^ k * (x - 1)) ≤ sfun P k o x ∧ sfun P k o x < 84 * (6 ^ k * x) := by
22 have h := ho (x % P)
23 obtain ⟨y, rfl⟩ : ∃ y, x = y + 1 := ⟨x - 1, by omega⟩
24 have h1 : 6 ^ k * (y + 1) = 6 ^ k * y + 6 ^ k := by ring
25 unfold sfun
26 rw [Nat.add_sub_cancel, h1]
27 omega
28
29/-- **Lemma 7**, injectivity. -/
30theorem sfun_injOn {P k : ℕ} {o : ℕ → ℕ} (ho : ∀ i, o i < 6 ^ k) :
31 Set.InjOn (sfun P k o) (Set.Ici 1) := by
32 have key : ∀ x y : ℕ, 1 ≤ x → x < y → sfun P k o x < sfun P k o y := by
33 intro x y hx hxy
34 have h1 := (sfun_bounds (P := P) ho hx).2
35 have h2 := (sfun_bounds (P := P) ho (hx.trans hxy.le)).1
36 have h3 : 6 ^ k * x ≤ 6 ^ k * (y - 1) := Nat.mul_le_mul_left _ (by omega)
37 omega
38 intro x hx y hy hxy
39 rcases lt_trichotomy x y with h | h | h
40 · exact absurd hxy (key x y hx h).ne
41 · exact h
42 · exact absurd hxy (key y x hy h).ne'
43
44/-- **Lemma 7.** -/
45theorem L7 (P : ℕ) (hP : P.Coprime 6) (hP0 : 0 < P) : ∃ k ≥ 2, ∀ ρ : ℕ, ρ = 53 ∨ ρ = 23 →
46 ∃ o : ℕ → ℕ, (∀ i, o i < 6 ^ k) ∧ (∀ x ∈ A, 14 < x → sfun P k o x ∈ A) ∧
47 ∀ x, 1 ≤ x → sfun P k o x % 54 = ρ ∧ 84 * P ∣ sfun P k o x + 1 := by
48 obtain ⟨k, hk, h⟩ := L6 P hP hP0
49 refine ⟨k, hk, fun ρ hρ => ?_⟩
50 obtain ⟨o, ho, hA, hmod⟩ := h (if ρ = 53 then 0 else 8) (by split_ifs <;> simp)
51 have hbig : ∀ x, 1 ≤ x → 1 ≤ 6 ^ k * x - o (x % P) := fun x hx => by
52 have := ho (x % P)
53 have : 6 ^ k * 1 ≤ 6 ^ k * x := Nat.mul_le_mul_left _ hx
54 omega
55 refine ⟨o, ho, fun x hx h14 => ?_, fun x hx => ⟨?_, ?_⟩⟩
56 · refine mul_sub_one_mem_A mem_84 (hA x hx h14) ?_
57 have h1 := ho (x % P)
58 have h2 : 6 ^ 2 ≤ 6 ^ k := Nat.pow_le_pow_right (by norm_num) hk
59 have h3 : 6 ^ k * 15 ≤ 6 ^ k * x := Nat.mul_le_mul_left _ (by omega)
60 omega
61 · have h9 := (hmod x hx).2
62 have h1 := hbig x hx
63 unfold sfun
64 rcases hρ with rfl | rfl
65 · simp only [if_true] at h9; omega
66 · simp only [show (23 : ℕ) ≠ 53 by norm_num, if_false] at h9; omega
67 · have h1 := hbig x hx
68 have : sfun P k o x + 1 = 84 * (6 ^ k * x - o (x % P)) := by unfold sfun; omega
69 rw [this]
70 exact Nat.mul_dvd_mul_left 84 (hmod x hx).1
71
72end E424
73