diff --git a/OutcastsMathLab.lean b/OutcastsMathLab.lean index 9c586f9..dfe4e8a 100644 --- a/OutcastsMathLab.lean +++ b/OutcastsMathLab.lean @@ -1 +1,6 @@ import OutcastsMathLab.Problems.P000_VerifierSmoke.Proof +import OutcastsMathLab.Research.JacobiObstruction +import OutcastsMathLab.Research.PsiObstruction +import OutcastsMathLab.Research.InvolutionBound +import OutcastsMathLab.Research.DeterministicFailure +import OutcastsMathLab.Research.HardPrimes20261005 diff --git a/OutcastsMathLab/Research/DeterministicFailure.lean b/OutcastsMathLab/Research/DeterministicFailure.lean new file mode 100644 index 0000000..0a83209 --- /dev/null +++ b/OutcastsMathLab/Research/DeterministicFailure.lean @@ -0,0 +1,106 @@ +import Mathlib.Data.Nat.Prime.Basic +import Mathlib.Data.Nat.GCD.Basic +import Mathlib.Tactic.NormNum.Prime + +/-! +# Finite negative certificates for Dahan's divisor criterion + +This module provides the general lemmas behind a *finite negative certificate*: +given the prime factorization `a p + u = ∏ qᵢ^{eᵢ}`, every divisor is a sub-product +`∏ qᵢ^{fᵢ}` with `fᵢ ≤ eᵢ`, so "no divisor `s` has `4au ∣ s + 1`" reduces to a finite +check over the sub-products, decided by `decide`. Primality of the factors is +discharged by `norm_num`. + +Nothing here is a new mathematical result; it is the Lean form of the "deterministic +failure" rows of the Outcasts failure atlas (a pair `(a, u)` whose `a p + u` is +small primes times at most one large prime fails for a reason that is fully +visible in the factorization). The concrete certificates live in +`HardPrimes20261005.lean`, generated by `Research/DeterministicFailure/gen_certificates.py`. +-/ + +namespace OutcastsMathLab.Research.DeterministicFailure + +/-- Dahan v1 Theorem 3.9(ii): `s ∣ a p + u` and `s ≡ -1 (mod 4 a u)`. -/ +def DivisorWitness (p a u s : ℕ) : Prop := + s ∣ a * p + u ∧ 4 * a * u ∣ s + 1 + +/-- `∏ qᵢ^{eᵢ}` for a list of `(qᵢ, eᵢ)`. -/ +def prodPow (L : List (ℕ × ℕ)) : ℕ := (L.map fun qe => qe.1 ^ qe.2).prod + +/-- All sub-products `∏ qᵢ^{fᵢ}` with `fᵢ ≤ eᵢ`. -/ +def subProducts : List (ℕ × ℕ) → List ℕ + | [] => [1] + | (q, e) :: L => (subProducts L).flatMap fun d => (List.range (e + 1)).map fun f => d * q ^ f + +/-- The certificate check: no sub-product `d` has `m ∣ d + 1`. -/ +def noWitnessCert (L : List (ℕ × ℕ)) (m : ℕ) : Bool := + (subProducts L).all fun d => (d + 1) % m != 0 + +theorem prodPow_nil : prodPow [] = 1 := rfl + +theorem prodPow_cons (q e : ℕ) (L : List (ℕ × ℕ)) : + prodPow ((q, e) :: L) = q ^ e * prodPow L := by + simp [prodPow] + +/-- Splitting a divisor of a product in `ℕ`: `s ∣ m n → s = y z` with `y ∣ m`, `z ∣ n`. -/ +theorem dvd_mul_split {s m n : ℕ} (h : s ∣ m * n) : ∃ y z, y ∣ m ∧ z ∣ n ∧ s = y * z := by + rcases Nat.eq_zero_or_pos m with rfl | hm + · exact ⟨s, 1, dvd_zero s, one_dvd n, (mul_one s).symm⟩ + · obtain ⟨z, hz⟩ := Nat.gcd_dvd_left s m + obtain ⟨m', hm'⟩ := Nat.gcd_dvd_right s m + have hy : 0 < Nat.gcd s m := Nat.gcd_pos_of_pos_right s hm + refine ⟨Nat.gcd s m, z, Nat.gcd_dvd_right s m, ?_, hz⟩ + have h1 : Nat.gcd s m * z ∣ Nat.gcd s m * (m' * n) := by + rw [← hz, ← mul_assoc, ← hm'] + exact h + have h2 : z ∣ m' * n := Nat.dvd_of_mul_dvd_mul_left hy h1 + have h3 : Nat.Coprime z m' := by + have := Nat.gcd_mul_left (Nat.gcd s m) z m' + rw [← hz, ← hm'] at this + exact Nat.eq_of_mul_eq_mul_left hy (by rw [mul_one]; exact this.symm) + exact (Nat.Coprime.dvd_mul_left h3).mp h2 + +/-- Every divisor of `∏ qᵢ^{eᵢ}` (all `qᵢ` prime) is one of the sub-products. -/ +theorem mem_subProducts_of_dvd : + ∀ (L : List (ℕ × ℕ)), (∀ qe ∈ L, Nat.Prime qe.1) → + ∀ s, s ∣ prodPow L → s ∈ subProducts L + | [], _, s, hs => by + rw [prodPow_nil] at hs + simp [subProducts, Nat.dvd_one.mp hs] + | (q, e) :: L, hL, s, hs => by + rw [prodPow_cons] at hs + obtain ⟨y, z, hy, hz, rfl⟩ := dvd_mul_split hs + have hq : Nat.Prime q := hL (q, e) (by simp) + obtain ⟨f, hf, rfl⟩ := (Nat.dvd_prime_pow hq).mp hy + have hz' := mem_subProducts_of_dvd L (fun qe h => hL qe (by simp [h])) z hz + simp only [subProducts, List.mem_flatMap, List.mem_map, List.mem_range] + exact ⟨z, hz', f, Nat.lt_succ_of_le hf, mul_comm _ _⟩ + +/-- Soundness of the certificate. -/ +theorem no_witness_of_cert {L : List (ℕ × ℕ)} (hL : ∀ qe ∈ L, Nat.Prime qe.1) {m : ℕ} + (hc : noWitnessCert L m = true) : ∀ s, s ∣ prodPow L → ¬ m ∣ s + 1 := by + intro s hs hdvd + have hmem := mem_subProducts_of_dvd L hL s hs + have h := List.all_eq_true.mp hc s hmem + rw [Nat.mod_eq_zero_of_dvd hdvd] at h + simp at h + +/-- The form used by the generated certificates: factorization + primality + check + give "no Dahan witness at `(a, u)` for `p`". -/ +theorem no_divisorWitness_of_cert {p a u : ℕ} {L : List (ℕ × ℕ)} + (hL : ∀ qe ∈ L, Nat.Prime qe.1) (hfac : a * p + u = prodPow L) + (hc : noWitnessCert L (4 * a * u) = true) : ∀ s, ¬ DivisorWitness p a u s := by + rintro s ⟨hs, hdvd⟩ + rw [hfac] at hs + exact no_witness_of_cert hL hc s hs hdvd + +/-- Sanity check on a positive case (Dahan Prop 3.13): `2 · 409 + 1 = 819 = 3² · 7 · 13` has + the witness `s = 7` (`8 ∣ 7 + 1`), so the check must reject this factorization. -/ +example : noWitnessCert [(3, 2), (7, 1), (13, 1)] 8 = false := by decide + +#print axioms dvd_mul_split +#print axioms mem_subProducts_of_dvd +#print axioms no_witness_of_cert +#print axioms no_divisorWitness_of_cert + +end OutcastsMathLab.Research.DeterministicFailure diff --git a/OutcastsMathLab/Research/HardPrimes20261005.lean b/OutcastsMathLab/Research/HardPrimes20261005.lean new file mode 100644 index 0000000..819f6fc --- /dev/null +++ b/OutcastsMathLab/Research/HardPrimes20261005.lean @@ -0,0 +1,560 @@ +import OutcastsMathLab.Research.DeterministicFailure + +/-! Generated by `Research/DeterministicFailure/gen_certificates.py`. Do not edit by hand. +Finite negative certificates: the two primes below have no Dahan witness at any pair of the +53-pair box used in the Outcasts failure atlas. Known criterion, not a new existence result. -/ + +namespace OutcastsMathLab.Research.HardPrimes20261005 + +open OutcastsMathLab.Research.DeterministicFailure + +/-- The 53 pairs `(a, u)`: coprime `a, u ≤ 6`, and `u ∈ {11, 13, 17, 19, 23}`, `a ≤ 6`. -/ +def box53 : List (ℕ × ℕ) := [(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 1), (2, 3), (2, 5), (3, 1), (3, 2), (3, 4), (3, 5), (4, 1), (4, 3), (4, 5), (5, 1), (5, 2), (5, 3), (5, 4), (5, 6), (6, 1), (6, 5), (1, 11), (2, 11), (3, 11), (4, 11), (5, 11), (6, 11), (1, 13), (2, 13), (3, 13), (4, 13), (5, 13), (6, 13), (1, 17), (2, 17), (3, 17), (4, 17), (5, 17), (6, 17), (1, 19), (2, 19), (3, 19), (4, 19), (5, 19), (6, 19), (1, 23), (2, 23), (3, 23), (4, 23), (5, 23), (6, 23)] + +theorem p345601_a1_u1 : ∀ s, ¬ DivisorWitness 345601 1 1 s := + no_divisorWitness_of_cert (L := [(2, 1), (172801, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u2 : ∀ s, ¬ DivisorWitness 345601 1 2 s := + no_divisorWitness_of_cert (L := [(3, 1), (115201, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u3 : ∀ s, ¬ DivisorWitness 345601 1 3 s := + no_divisorWitness_of_cert (L := [(2, 2), (7, 1), (12343, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u4 : ∀ s, ¬ DivisorWitness 345601 1 4 s := + no_divisorWitness_of_cert (L := [(5, 1), (13, 2), (409, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u5 : ∀ s, ¬ DivisorWitness 345601 1 5 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 1), (57601, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u6 : ∀ s, ¬ DivisorWitness 345601 1 6 s := + no_divisorWitness_of_cert (L := [(345607, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u1 : ∀ s, ¬ DivisorWitness 345601 2 1 s := + no_divisorWitness_of_cert (L := [(3, 1), (17, 1), (13553, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u3 : ∀ s, ¬ DivisorWitness 345601 2 3 s := + no_divisorWitness_of_cert (L := [(5, 1), (138241, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u5 : ∀ s, ¬ DivisorWitness 345601 2 5 s := + no_divisorWitness_of_cert (L := [(11, 1), (31, 1), (2027, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u1 : ∀ s, ¬ DivisorWitness 345601 3 1 s := + no_divisorWitness_of_cert (L := [(2, 2), (259201, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u2 : ∀ s, ¬ DivisorWitness 345601 3 2 s := + no_divisorWitness_of_cert (L := [(5, 1), (7, 1), (11, 1), (2693, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u4 : ∀ s, ¬ DivisorWitness 345601 3 4 s := + no_divisorWitness_of_cert (L := [(59, 1), (17573, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u5 : ∀ s, ¬ DivisorWitness 345601 3 5 s := + no_divisorWitness_of_cert (L := [(2, 3), (29, 1), (41, 1), (109, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u1 : ∀ s, ¬ DivisorWitness 345601 4 1 s := + no_divisorWitness_of_cert (L := [(5, 1), (151, 1), (1831, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u3 : ∀ s, ¬ DivisorWitness 345601 4 3 s := + no_divisorWitness_of_cert (L := [(13, 1), (43, 1), (2473, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u5 : ∀ s, ¬ DivisorWitness 345601 4 5 s := + no_divisorWitness_of_cert (L := [(3, 2), (7, 1), (21943, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u1 : ∀ s, ¬ DivisorWitness 345601 5 1 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 1), (7, 1), (41143, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u2 : ∀ s, ¬ DivisorWitness 345601 5 2 s := + no_divisorWitness_of_cert (L := [(181, 1), (9547, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u3 : ∀ s, ¬ DivisorWitness 345601 5 3 s := + no_divisorWitness_of_cert (L := [(2, 3), (61, 1), (3541, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u4 : ∀ s, ¬ DivisorWitness 345601 5 4 s := + no_divisorWitness_of_cert (L := [(3, 2), (101, 1), (1901, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u6 : ∀ s, ¬ DivisorWitness 345601 5 6 s := + no_divisorWitness_of_cert (L := [(37, 1), (46703, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a6_u1 : ∀ s, ¬ DivisorWitness 345601 6 1 s := + no_divisorWitness_of_cert (L := [(2073607, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a6_u5 : ∀ s, ¬ DivisorWitness 345601 6 5 s := + no_divisorWitness_of_cert (L := [(23, 1), (89, 1), (1013, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u11 : ∀ s, ¬ DivisorWitness 345601 1 11 s := + no_divisorWitness_of_cert (L := [(2, 2), (3, 1), (83, 1), (347, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u11 : ∀ s, ¬ DivisorWitness 345601 2 11 s := + no_divisorWitness_of_cert (L := [(167, 1), (4139, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u11 : ∀ s, ¬ DivisorWitness 345601 3 11 s := + no_divisorWitness_of_cert (L := [(2, 1), (37, 1), (14011, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u11 : ∀ s, ¬ DivisorWitness 345601 4 11 s := + no_divisorWitness_of_cert (L := [(3, 1), (5, 1), (23, 1), (4007, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u11 : ∀ s, ¬ DivisorWitness 345601 5 11 s := + no_divisorWitness_of_cert (L := [(2, 4), (17, 1), (6353, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a6_u11 : ∀ s, ¬ DivisorWitness 345601 6 11 s := + no_divisorWitness_of_cert (L := [(7, 1), (13, 1), (22787, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u13 : ∀ s, ¬ DivisorWitness 345601 1 13 s := + no_divisorWitness_of_cert (L := [(2, 1), (172807, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u13 : ∀ s, ¬ DivisorWitness 345601 2 13 s := + no_divisorWitness_of_cert (L := [(3, 1), (5, 1), (7, 1), (29, 1), (227, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u13 : ∀ s, ¬ DivisorWitness 345601 3 13 s := + no_divisorWitness_of_cert (L := [(2, 4), (11, 1), (43, 1), (137, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u13 : ∀ s, ¬ DivisorWitness 345601 4 13 s := + no_divisorWitness_of_cert (L := [(179, 1), (7723, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u13 : ∀ s, ¬ DivisorWitness 345601 5 13 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 2), (96001, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a6_u13 : ∀ s, ¬ DivisorWitness 345601 6 13 s := + no_divisorWitness_of_cert (L := [(2073619, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u17 : ∀ s, ¬ DivisorWitness 345601 1 17 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 2), (7, 1), (13, 1), (211, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u17 : ∀ s, ¬ DivisorWitness 345601 2 17 s := + no_divisorWitness_of_cert (L := [(23, 1), (41, 1), (733, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u17 : ∀ s, ¬ DivisorWitness 345601 3 17 s := + no_divisorWitness_of_cert (L := [(2, 2), (5, 1), (47, 1), (1103, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u17 : ∀ s, ¬ DivisorWitness 345601 4 17 s := + no_divisorWitness_of_cert (L := [(3, 1), (19, 1), (79, 1), (307, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u17 : ∀ s, ¬ DivisorWitness 345601 5 17 s := + no_divisorWitness_of_cert (L := [(2, 1), (864011, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a6_u17 : ∀ s, ¬ DivisorWitness 345601 6 17 s := + no_divisorWitness_of_cert (L := [(1051, 1), (1973, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u19 : ∀ s, ¬ DivisorWitness 345601 1 19 s := + no_divisorWitness_of_cert (L := [(2, 2), (5, 1), (11, 1), (1571, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u19 : ∀ s, ¬ DivisorWitness 345601 2 19 s := + no_divisorWitness_of_cert (L := [(3, 1), (113, 1), (2039, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u19 : ∀ s, ¬ DivisorWitness 345601 3 19 s := + no_divisorWitness_of_cert (L := [(2, 1), (518411, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u19 : ∀ s, ¬ DivisorWitness 345601 4 19 s := + no_divisorWitness_of_cert (L := [(7, 1), (17, 1), (11617, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u19 : ∀ s, ¬ DivisorWitness 345601 5 19 s := + no_divisorWitness_of_cert (L := [(2, 3), (3, 1), (89, 1), (809, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a6_u19 : ∀ s, ¬ DivisorWitness 345601 6 19 s := + no_divisorWitness_of_cert (L := [(5, 3), (53, 1), (313, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a1_u23 : ∀ s, ¬ DivisorWitness 345601 1 23 s := + no_divisorWitness_of_cert (L := [(2, 3), (3, 1), (14401, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a2_u23 : ∀ s, ¬ DivisorWitness 345601 2 23 s := + no_divisorWitness_of_cert (L := [(5, 2), (43, 1), (643, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a3_u23 : ∀ s, ¬ DivisorWitness 345601 3 23 s := + no_divisorWitness_of_cert (L := [(2, 1), (7, 1), (31, 1), (2389, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a4_u23 : ∀ s, ¬ DivisorWitness 345601 4 23 s := + no_divisorWitness_of_cert (L := [(3, 5), (5689, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a5_u23 : ∀ s, ¬ DivisorWitness 345601 5 23 s := + no_divisorWitness_of_cert (L := [(2, 2), (432007, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p345601_a6_u23 : ∀ s, ¬ DivisorWitness 345601 6 23 s := + no_divisorWitness_of_cert (L := [(1163, 1), (1783, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +/-- `p = 345601` has no Dahan witness at any pair of the 53-pair box. -/ +theorem no_witness_345601_box : ∀ au ∈ box53, ∀ s, ¬ DivisorWitness 345601 au.1 au.2 s := by + intro au hau + simp only [box53, List.mem_cons, List.not_mem_nil, or_false] at hau + rcases hau with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact p345601_a1_u1 + · exact p345601_a1_u2 + · exact p345601_a1_u3 + · exact p345601_a1_u4 + · exact p345601_a1_u5 + · exact p345601_a1_u6 + · exact p345601_a2_u1 + · exact p345601_a2_u3 + · exact p345601_a2_u5 + · exact p345601_a3_u1 + · exact p345601_a3_u2 + · exact p345601_a3_u4 + · exact p345601_a3_u5 + · exact p345601_a4_u1 + · exact p345601_a4_u3 + · exact p345601_a4_u5 + · exact p345601_a5_u1 + · exact p345601_a5_u2 + · exact p345601_a5_u3 + · exact p345601_a5_u4 + · exact p345601_a5_u6 + · exact p345601_a6_u1 + · exact p345601_a6_u5 + · exact p345601_a1_u11 + · exact p345601_a2_u11 + · exact p345601_a3_u11 + · exact p345601_a4_u11 + · exact p345601_a5_u11 + · exact p345601_a6_u11 + · exact p345601_a1_u13 + · exact p345601_a2_u13 + · exact p345601_a3_u13 + · exact p345601_a4_u13 + · exact p345601_a5_u13 + · exact p345601_a6_u13 + · exact p345601_a1_u17 + · exact p345601_a2_u17 + · exact p345601_a3_u17 + · exact p345601_a4_u17 + · exact p345601_a5_u17 + · exact p345601_a6_u17 + · exact p345601_a1_u19 + · exact p345601_a2_u19 + · exact p345601_a3_u19 + · exact p345601_a4_u19 + · exact p345601_a5_u19 + · exact p345601_a6_u19 + · exact p345601_a1_u23 + · exact p345601_a2_u23 + · exact p345601_a3_u23 + · exact p345601_a4_u23 + · exact p345601_a5_u23 + · exact p345601_a6_u23 + +#print axioms no_witness_345601_box + +theorem p670849_a1_u1 : ∀ s, ¬ DivisorWitness 670849 1 1 s := + no_divisorWitness_of_cert (L := [(2, 1), (5, 2), (13417, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u2 : ∀ s, ¬ DivisorWitness 670849 1 2 s := + no_divisorWitness_of_cert (L := [(3, 2), (131, 1), (569, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u3 : ∀ s, ¬ DivisorWitness 670849 1 3 s := + no_divisorWitness_of_cert (L := [(2, 2), (7, 1), (13, 1), (19, 1), (97, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u4 : ∀ s, ¬ DivisorWitness 670849 1 4 s := + no_divisorWitness_of_cert (L := [(670853, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u5 : ∀ s, ¬ DivisorWitness 670849 1 5 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 1), (17, 1), (6577, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u6 : ∀ s, ¬ DivisorWitness 670849 1 6 s := + no_divisorWitness_of_cert (L := [(5, 1), (134171, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u1 : ∀ s, ¬ DivisorWitness 670849 2 1 s := + no_divisorWitness_of_cert (L := [(3, 1), (447233, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u3 : ∀ s, ¬ DivisorWitness 670849 2 3 s := + no_divisorWitness_of_cert (L := [(1341701, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u5 : ∀ s, ¬ DivisorWitness 670849 2 5 s := + no_divisorWitness_of_cert (L := [(11, 1), (283, 1), (431, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u1 : ∀ s, ¬ DivisorWitness 670849 3 1 s := + no_divisorWitness_of_cert (L := [(2, 2), (503137, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u2 : ∀ s, ¬ DivisorWitness 670849 3 2 s := + no_divisorWitness_of_cert (L := [(7, 1), (11, 1), (59, 1), (443, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u4 : ∀ s, ¬ DivisorWitness 670849 3 4 s := + no_divisorWitness_of_cert (L := [(31, 1), (64921, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u5 : ∀ s, ¬ DivisorWitness 670849 3 5 s := + no_divisorWitness_of_cert (L := [(2, 3), (197, 1), (1277, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u1 : ∀ s, ¬ DivisorWitness 670849 4 1 s := + no_divisorWitness_of_cert (L := [(2683397, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u3 : ∀ s, ¬ DivisorWitness 670849 4 3 s := + no_divisorWitness_of_cert (L := [(17, 1), (29, 1), (5443, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u5 : ∀ s, ¬ DivisorWitness 670849 4 5 s := + no_divisorWitness_of_cert (L := [(3, 1), (7, 1), (127781, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u1 : ∀ s, ¬ DivisorWitness 670849 5 1 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 2), (7, 2), (3803, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u2 : ∀ s, ¬ DivisorWitness 670849 5 2 s := + no_divisorWitness_of_cert (L := [(13, 1), (258019, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u3 : ∀ s, ¬ DivisorWitness 670849 5 3 s := + no_divisorWitness_of_cert (L := [(2, 3), (419281, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u4 : ∀ s, ¬ DivisorWitness 670849 5 4 s := + no_divisorWitness_of_cert (L := [(3, 1), (47, 1), (23789, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u6 : ∀ s, ¬ DivisorWitness 670849 5 6 s := + no_divisorWitness_of_cert (L := [(23, 1), (41, 1), (3557, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a6_u1 : ∀ s, ¬ DivisorWitness 670849 6 1 s := + no_divisorWitness_of_cert (L := [(5, 1), (805019, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a6_u5 : ∀ s, ¬ DivisorWitness 670849 6 5 s := + no_divisorWitness_of_cert (L := [(13, 1), (309623, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u11 : ∀ s, ¬ DivisorWitness 670849 1 11 s := + no_divisorWitness_of_cert (L := [(2, 2), (3, 2), (5, 1), (3727, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u11 : ∀ s, ¬ DivisorWitness 670849 2 11 s := + no_divisorWitness_of_cert (L := [(47, 1), (28547, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u11 : ∀ s, ¬ DivisorWitness 670849 3 11 s := + no_divisorWitness_of_cert (L := [(2, 1), (1006279, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u11 : ∀ s, ¬ DivisorWitness 670849 4 11 s := + no_divisorWitness_of_cert (L := [(3, 1), (73, 1), (12253, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u11 : ∀ s, ¬ DivisorWitness 670849 5 11 s := + no_divisorWitness_of_cert (L := [(2, 4), (29, 1), (7229, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a6_u11 : ∀ s, ¬ DivisorWitness 670849 6 11 s := + no_divisorWitness_of_cert (L := [(5, 1), (7, 3), (2347, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u13 : ∀ s, ¬ DivisorWitness 670849 1 13 s := + no_divisorWitness_of_cert (L := [(2, 1), (509, 1), (659, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u13 : ∀ s, ¬ DivisorWitness 670849 2 13 s := + no_divisorWitness_of_cert (L := [(3, 3), (7, 1), (31, 1), (229, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u13 : ∀ s, ¬ DivisorWitness 670849 3 13 s := + no_divisorWitness_of_cert (L := [(2, 4), (5, 1), (11, 1), (2287, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u13 : ∀ s, ¬ DivisorWitness 670849 4 13 s := + no_divisorWitness_of_cert (L := [(41, 1), (65449, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u13 : ∀ s, ¬ DivisorWitness 670849 5 13 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 1), (43, 1), (13001, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a6_u13 : ∀ s, ¬ DivisorWitness 670849 6 13 s := + no_divisorWitness_of_cert (L := [(17, 1), (236771, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u17 : ∀ s, ¬ DivisorWitness 670849 1 17 s := + no_divisorWitness_of_cert (L := [(2, 1), (3, 1), (7, 1), (15973, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u17 : ∀ s, ¬ DivisorWitness 670849 2 17 s := + no_divisorWitness_of_cert (L := [(5, 1), (268343, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u17 : ∀ s, ¬ DivisorWitness 670849 3 17 s := + no_divisorWitness_of_cert (L := [(2, 2), (337, 1), (1493, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u17 : ∀ s, ¬ DivisorWitness 670849 4 17 s := + no_divisorWitness_of_cert (L := [(3, 2), (298157, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u17 : ∀ s, ¬ DivisorWitness 670849 5 17 s := + no_divisorWitness_of_cert (L := [(2, 1), (31, 1), (54101, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a6_u17 : ∀ s, ¬ DivisorWitness 670849 6 17 s := + no_divisorWitness_of_cert (L := [(4025111, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u19 : ∀ s, ¬ DivisorWitness 670849 1 19 s := + no_divisorWitness_of_cert (L := [(2, 2), (11, 1), (79, 1), (193, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u19 : ∀ s, ¬ DivisorWitness 670849 2 19 s := + no_divisorWitness_of_cert (L := [(3, 1), (13, 1), (34403, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u19 : ∀ s, ¬ DivisorWitness 670849 3 19 s := + no_divisorWitness_of_cert (L := [(2, 1), (71, 1), (14173, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u19 : ∀ s, ¬ DivisorWitness 670849 4 19 s := + no_divisorWitness_of_cert (L := [(5, 1), (7, 1), (43, 1), (1783, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u19 : ∀ s, ¬ DivisorWitness 670849 5 19 s := + no_divisorWitness_of_cert (L := [(2, 3), (3, 3), (53, 1), (293, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a6_u19 : ∀ s, ¬ DivisorWitness 670849 6 19 s := + no_divisorWitness_of_cert (L := [(29, 1), (138797, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a1_u23 : ∀ s, ¬ DivisorWitness 670849 1 23 s := + no_divisorWitness_of_cert (L := [(2, 3), (3, 1), (27953, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a2_u23 : ∀ s, ¬ DivisorWitness 670849 2 23 s := + no_divisorWitness_of_cert (L := [(271, 1), (4951, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a3_u23 : ∀ s, ¬ DivisorWitness 670849 3 23 s := + no_divisorWitness_of_cert (L := [(2, 1), (5, 1), (7, 1), (28751, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a4_u23 : ∀ s, ¬ DivisorWitness 670849 4 23 s := + no_divisorWitness_of_cert (L := [(3, 1), (137, 1), (6529, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a5_u23 : ∀ s, ¬ DivisorWitness 670849 5 23 s := + no_divisorWitness_of_cert (L := [(2, 2), (59, 1), (61, 1), (233, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +theorem p670849_a6_u23 : ∀ s, ¬ DivisorWitness 670849 6 23 s := + no_divisorWitness_of_cert (L := [(1187, 1), (3391, 1)]) + (by norm_num [List.forall_mem_cons]) (by decide) (by decide) + +/-- `p = 670849` has no Dahan witness at any pair of the 53-pair box. -/ +theorem no_witness_670849_box : ∀ au ∈ box53, ∀ s, ¬ DivisorWitness 670849 au.1 au.2 s := by + intro au hau + simp only [box53, List.mem_cons, List.not_mem_nil, or_false] at hau + rcases hau with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact p670849_a1_u1 + · exact p670849_a1_u2 + · exact p670849_a1_u3 + · exact p670849_a1_u4 + · exact p670849_a1_u5 + · exact p670849_a1_u6 + · exact p670849_a2_u1 + · exact p670849_a2_u3 + · exact p670849_a2_u5 + · exact p670849_a3_u1 + · exact p670849_a3_u2 + · exact p670849_a3_u4 + · exact p670849_a3_u5 + · exact p670849_a4_u1 + · exact p670849_a4_u3 + · exact p670849_a4_u5 + · exact p670849_a5_u1 + · exact p670849_a5_u2 + · exact p670849_a5_u3 + · exact p670849_a5_u4 + · exact p670849_a5_u6 + · exact p670849_a6_u1 + · exact p670849_a6_u5 + · exact p670849_a1_u11 + · exact p670849_a2_u11 + · exact p670849_a3_u11 + · exact p670849_a4_u11 + · exact p670849_a5_u11 + · exact p670849_a6_u11 + · exact p670849_a1_u13 + · exact p670849_a2_u13 + · exact p670849_a3_u13 + · exact p670849_a4_u13 + · exact p670849_a5_u13 + · exact p670849_a6_u13 + · exact p670849_a1_u17 + · exact p670849_a2_u17 + · exact p670849_a3_u17 + · exact p670849_a4_u17 + · exact p670849_a5_u17 + · exact p670849_a6_u17 + · exact p670849_a1_u19 + · exact p670849_a2_u19 + · exact p670849_a3_u19 + · exact p670849_a4_u19 + · exact p670849_a5_u19 + · exact p670849_a6_u19 + · exact p670849_a1_u23 + · exact p670849_a2_u23 + · exact p670849_a3_u23 + · exact p670849_a4_u23 + · exact p670849_a5_u23 + · exact p670849_a6_u23 + +#print axioms no_witness_670849_box + +end OutcastsMathLab.Research.HardPrimes20261005 diff --git a/OutcastsMathLab/Research/InvolutionBound.lean b/OutcastsMathLab/Research/InvolutionBound.lean new file mode 100644 index 0000000..2f420c4 --- /dev/null +++ b/OutcastsMathLab/Research/InvolutionBound.lean @@ -0,0 +1,144 @@ +import Mathlib.Data.ZMod.Basic +import Mathlib.Data.Nat.Totient +import Mathlib.Data.Nat.PrimeFin +import Mathlib.Data.Nat.GCD.Basic + +/-! +# Dahan's involution bound (Lemma 4.2 of arXiv:2608.24035) + +This module formalizes a KNOWN lemma; it is not a new result. + +Dahan, Lemma 4.2: let `m ≥ 1` and let `T ⊆ (ℤ/4m)ˣ` be the set of residues of the +prime factors of `M` coprime to `4m`. If `M` has no divisor `≡ -1 (mod 4m)`, then +`|T| ≤ φ(4m)/2`. The proof uses the involution `ι(x) = -x⁻¹`, which has no fixed +point because `-1` is not a square modulo `4m` (reduce modulo 4). + +The lemma is a necessary condition for the FAILURE of the Type II divisor criterion +(Dahan Theorem 3.9(ii), `s ∣ a p + u`, `s ≡ -1 (mod 4 a u)`) at a pair `(a, u)`, +with `M = a p + u` and `m = a u`. It says nothing about existence. + +Main statements: +* `neg_one_ne_sq`: `-1` is not a square in `ZMod (4 * m)`. +* `card_le_half_of_fixedPointFree_involution`: pure counting, for any fixed-point-free + involution-like injection `ι` with `T ∩ ι(T) = ∅`. +* `card_le_half_totient_of_no_neg_one_divisor`: the bound for any finite set `T` of + unit residues each represented by a prime factor of `M`. +* `dahan_involution_bound`: the bound for Dahan's `T` (`primeResidues M (4 * m)`). +-/ + +namespace OutcastsMathLab.Research.InvolutionBound + +/-- `-1` is not a square modulo `4 m`: reduce modulo `4`, where the squares are `0, 1`. -/ +theorem neg_one_ne_sq (m : ℕ) (x : ZMod (4 * m)) : x ^ 2 ≠ -1 := by + intro h + have h4 : (4 : ℕ) ∣ 4 * m := dvd_mul_right 4 m + have := congrArg (ZMod.castHom h4 (ZMod 4)) h + rw [map_pow, map_neg, map_one] at this + revert this + generalize (ZMod.castHom h4 (ZMod 4)) x = y + revert y + decide + +/-- Pure counting: if `ι` is injective and `T` is disjoint from its image, then + `2 |T| ≤ |α|`. -/ +theorem card_le_half_of_fixedPointFree_involution {α : Type*} [Fintype α] [DecidableEq α] + (ι : α → α) (hι : Function.Injective ι) (T : Finset α) + (hdisj : ∀ x ∈ T, ι x ∉ T) : 2 * T.card ≤ Fintype.card α := by + have hd : Disjoint T (T.image ι) := by + rw [Finset.disjoint_left] + intro x hx hx' + obtain ⟨y, hy, rfl⟩ := Finset.mem_image.mp hx' + exact hdisj y hy hx + have h1 := Finset.card_le_univ (T.disjUnion (T.image ι) hd) + rw [Finset.card_disjUnion, Finset.card_image_of_injective _ hι] at h1 + omega + +/-- The involution `ι x = -x⁻¹` on the units of `ZMod (4 m)`. -/ +def iota (m : ℕ) (x : (ZMod (4 * m))ˣ) : (ZMod (4 * m))ˣ := -x⁻¹ + +theorem iota_injective (m : ℕ) : Function.Injective (iota m) := by + intro x y h + unfold iota at h + exact inv_injective (neg_injective h) + +/-- `ι` has no fixed point, because a fixed point would be a square root of `-1`. -/ +theorem iota_ne_self (m : ℕ) (x : (ZMod (4 * m))ˣ) : iota m x ≠ x := by + intro h + unfold iota at h + have hv := congrArg Units.val h + rw [Units.val_neg] at hv + -- hv : -(↑x⁻¹) = ↑x + have hsq : ((x : ZMod (4 * m))) ^ 2 = -1 := by + have hmul := congrArg (fun z => (x : ZMod (4 * m)) * z) hv + simp only [mul_neg, Units.mul_inv] at hmul + rw [sq] + exact hmul.symm + exact neg_one_ne_sq m _ hsq + +/-- The bound for any finite set `T` of unit residues, each the residue of some prime + factor of `M`, when `M` has no divisor `≡ -1 (mod 4 m)`. -/ +theorem card_le_half_totient_of_no_neg_one_divisor {m M : ℕ} (hm : 0 < m) + (T : Finset (ZMod (4 * m))ˣ) + (hT : ∀ x ∈ T, ∃ q : ℕ, q.Prime ∧ q ∣ M ∧ ((q : ZMod (4 * m)) = (x : ZMod (4 * m)))) + (h : ∀ d, d ∣ M → ¬ 4 * m ∣ d + 1) : + 2 * T.card ≤ Nat.totient (4 * m) := by + have : NeZero (4 * m) := ⟨by omega⟩ + rw [← ZMod.card_units_eq_totient (4 * m)] + apply card_le_half_of_fixedPointFree_involution (iota m) (iota_injective m) T + intro x hx hιx + obtain ⟨q₁, hq₁, hq₁M, hq₁x⟩ := hT x hx + obtain ⟨q₂, hq₂, hq₂M, hq₂x⟩ := hT _ hιx + -- the two primes are distinct, since their residues differ + have hne : q₁ ≠ q₂ := by + rintro rfl + exact iota_ne_self m x (Units.ext (hq₂x.symm.trans hq₁x)) + have hdvd : q₁ * q₂ ∣ M := + Nat.Coprime.mul_dvd_of_dvd_of_dvd ((Nat.coprime_primes hq₁ hq₂).mpr hne) hq₁M hq₂M + -- and their product is `≡ -1` + have hprod : ((q₁ * q₂ + 1 : ℕ) : ZMod (4 * m)) = 0 := by + push_cast + rw [hq₁x, hq₂x] + unfold iota + rw [Units.val_neg, mul_neg, Units.mul_inv] + ring + exact h _ hdvd ((ZMod.natCast_eq_zero_iff _ _).mp hprod) + +theorem coprime_of_mem_filter {M n q : ℕ} + (hq : q ∈ M.primeFactors.filter (fun q => Nat.Coprime q n)) : Nat.Coprime q n := by + have h := Finset.mem_filter.mp hq + exact h.2 + +/-- Dahan's `T`: the residues modulo `n` of the prime factors of `M` coprime to `n`, + as units of `ZMod n`. -/ +def primeResidues (M n : ℕ) : Finset (ZMod n)ˣ := + ((M.primeFactors.filter (fun q => Nat.Coprime q n)).attach).image + (fun q => ZMod.unitOfCoprime q.1 (coprime_of_mem_filter q.2)) + +/-- Dahan Lemma 4.2: if `M` has no divisor `≡ -1 (mod 4 m)`, then + `2 |T| ≤ φ(4 m)` for `T = primeResidues M (4 m)`. -/ +theorem dahan_involution_bound {m M : ℕ} (hm : 0 < m) + (h : ∀ d, d ∣ M → ¬ 4 * m ∣ d + 1) : + 2 * (primeResidues M (4 * m)).card ≤ Nat.totient (4 * m) := by + apply card_le_half_totient_of_no_neg_one_divisor hm _ _ h + intro x hx + unfold primeResidues at hx + obtain ⟨⟨q, hq⟩, -, rfl⟩ := Finset.mem_image.mp hx + have hq' := Finset.mem_filter.mp hq + obtain ⟨hprime, hdvd, -⟩ := Nat.mem_primeFactors.mp hq'.1 + exact ⟨q, hprime, hdvd, ZMod.coe_unitOfCoprime q hq'.2⟩ + +/-- Specialisation to Dahan's divisor criterion: if the pair `(a, u)` has no witness + for `p`, the prime residues of `a p + u` modulo `4 a u` fill at most half of the units. -/ +theorem no_witness_bound {p a u : ℕ} (ha : 0 < a) (hu : 0 < u) + (h : ∀ s, s ∣ a * p + u → ¬ 4 * (a * u) ∣ s + 1) : + 2 * (primeResidues (a * p + u) (4 * (a * u))).card ≤ Nat.totient (4 * (a * u)) := + dahan_involution_bound (Nat.mul_pos ha hu) h + +#print axioms neg_one_ne_sq +#print axioms card_le_half_of_fixedPointFree_involution +#print axioms iota_ne_self +#print axioms card_le_half_totient_of_no_neg_one_divisor +#print axioms dahan_involution_bound +#print axioms no_witness_bound + +end OutcastsMathLab.Research.InvolutionBound diff --git a/OutcastsMathLab/Research/JacobiObstruction.lean b/OutcastsMathLab/Research/JacobiObstruction.lean new file mode 100644 index 0000000..9e12422 --- /dev/null +++ b/OutcastsMathLab/Research/JacobiObstruction.lean @@ -0,0 +1,261 @@ +import Mathlib.NumberTheory.LegendreSymbol.JacobiSymbol +import Mathlib.NumberTheory.LSeries.PrimesInAP +import Mathlib.Tactic.NormNum.LegendreSymbol + +/-! +# The quadratic-residue obstruction in Dahan's divisor normal form + +This module formalizes a KNOWN obstruction; it is not a new result. +The obstruction goes back to Schinzel and Yamamoto (1965) and appears as +Elsholtz–Tao, arXiv:1107.1010, Proposition 1.6 (no Type I/II solutions for +odd squares). Here it is restated for the Type II criterion in the normal form +of Dahan, arXiv:2608.24035, Theorem 3.9(ii): a witness is a divisor `s` of +`a p + u` with `s ≡ -1 (mod 4 a u)`. + +Main statements: +* `witness_jacobi_eq_neg_one`: every witness satisfies `J(p | s) = -1`. +* `no_witness_of_square`: a perfect square has no witness at all. +* `no_witness_of_mod_eq_one`: `p ≡ 1 (mod s)` rules out the divisor `s`. +* `finite_witnesses_miss_infinitely_many_primes`: no finite list of witnesses + `(a, u, s)` covers all primes (via Dirichlet's theorem in Mathlib). + +None of these is an existence statement for the Erdős–Straus equation. +-/ + +namespace OutcastsMathLab.Research.JacobiObstruction + +/-- Dahan v1 Theorem 3.9(ii): `s ∣ a p + u` and `s ≡ -1 (mod 4 a u)`. + Same shape as `DivisorWitness` in the witness-budget research modules. -/ +def DivisorWitness (p a u s : ℕ) : Prop := + s ∣ a * p + u ∧ 4 * a * u ∣ s + 1 + +/-- If `s ≡ -1 (mod 4 a)` with `a > 0`, then `J(a | s) = 1`. -/ +theorem jacobi_eq_one_of_dvd_succ : + ∀ (a s : ℕ), 0 < a → 4 * a ∣ s + 1 → jacobiSym a s = 1 := by + intro a + induction a using Nat.strong_induction_on with + | _ a ih => + intro s ha hs + have h4 : 4 ∣ s + 1 := dvd_trans (Dvd.intro a rfl) hs + have hs4 : s % 4 = 3 := by omega + have hsodd : Odd s := Nat.odd_iff.mpr (by omega) + rcases Nat.even_or_odd a with ⟨b, rfl⟩ | hodd + · have hb : 0 < b := by omega + have h8 : 8 ∣ s + 1 := dvd_trans ⟨b, by ring⟩ hs + have hb4 : 4 * b ∣ s + 1 := dvd_trans ⟨2, by ring⟩ hs + have hcast : ((b + b : ℕ) : ℤ) = 2 * (b : ℤ) := by push_cast; ring + have hs8 : s % 8 = 7 := by omega + rw [hcast, jacobiSym.mul_left, jacobiSym.at_two hsodd, ih b (by omega) s hb hb4, + ZMod.χ₈_nat_eq_if_mod_eight] + simp [hs8, show s % 2 = 1 by omega] + · have hda : (a : ℤ) ∣ (s : ℤ) + 1 := by + exact_mod_cast dvd_trans (Dvd.intro_left 4 rfl) hs + have hmod : (s : ℤ) % (a : ℤ) = (-1 : ℤ) % (a : ℤ) := by + have h' : (a : ℤ) ∣ (-1 : ℤ) - (s : ℤ) := by + rw [show (-1 : ℤ) - (s : ℤ) = -((s : ℤ) + 1) by ring] + exact (dvd_neg).mpr hda + exact Int.modEq_iff_dvd.mpr h' + have hJ : jacobiSym s a = ZMod.χ₄ a := by + rw [jacobiSym.mod_left' hmod, jacobiSym.at_neg_one hodd] + rcases Nat.odd_mod_four_iff.mp (Nat.odd_iff.mp hodd) with ha1 | ha3 + · rw [jacobiSym.quadratic_reciprocity_one_mod_four ha1 hsodd, hJ, + ZMod.χ₄_nat_one_mod_four ha1] + · rw [jacobiSym.quadratic_reciprocity_three_mod_four ha3 hs4, hJ, + ZMod.χ₄_nat_three_mod_four ha3] + norm_num + +/-- Every Dahan witness forces `p` to be a Jacobi non-residue modulo `s`. -/ +theorem witness_jacobi_eq_neg_one {p a u s : ℕ} (ha : 0 < a) (hu : 0 < u) + (hw : DivisorWitness p a u s) : jacobiSym p s = -1 := by + obtain ⟨hdvd, hcong⟩ := hw + have hsa : 4 * a ∣ s + 1 := dvd_trans ⟨u, by ring⟩ hcong + have hsu : 4 * u ∣ s + 1 := dvd_trans ⟨a, by ring⟩ hcong + have h4 : 4 ∣ s + 1 := dvd_trans (Dvd.intro a rfl) hsa + have hs4 : s % 4 = 3 := by omega + have hsodd : Odd s := Nat.odd_iff.mpr (by omega) + have hmod : ((a : ℤ) * p) % (s : ℤ) = (-(u : ℤ)) % (s : ℤ) := by + have hd : (s : ℤ) ∣ (a : ℤ) * p + u := by exact_mod_cast hdvd + have h' : (s : ℤ) ∣ -(u : ℤ) - (a : ℤ) * p := by + rw [show -(u : ℤ) - (a : ℤ) * p = -((a : ℤ) * p + u) by ring] + exact (dvd_neg).mpr hd + exact Int.modEq_iff_dvd.mpr h' + have key := jacobiSym.mod_left' hmod + rw [jacobiSym.mul_left, jacobi_eq_one_of_dvd_succ a s ha hsa, one_mul, + jacobiSym.neg _ hsodd, jacobi_eq_one_of_dvd_succ u s hu hsu, + ZMod.χ₄_nat_three_mod_four hs4] at key + simpa using key + +/-- A perfect square has no Dahan witness (Type II case of Elsholtz–Tao + Proposition 1.6, in Dahan's normal form). -/ +theorem no_witness_of_square (m a u s : ℕ) (ha : 0 < a) (hu : 0 < u) : + ¬ DivisorWitness (m ^ 2) a u s := by + intro hw + have h := witness_jacobi_eq_neg_one ha hu hw + push_cast at h + rw [jacobiSym.pow_left] at h + nlinarith [sq_nonneg (jacobiSym (m : ℤ) s)] + +/-- If `p ≡ 1 (mod s)`, then `s` is not a witness for `p` at any `(a, u)`. -/ +theorem no_witness_of_mod_eq_one {p a u s : ℕ} (ha : 0 < a) (hu : 0 < u) + (h : p % s = 1) : ¬ DivisorWitness p a u s := by + intro hw + have hs0 : s ≠ 0 := by + rintro rfl + have := hw.1 + rw [zero_dvd_iff] at this + omega + have hs1 : s ≠ 1 := by + rintro rfl + omega + have hJ := witness_jacobi_eq_neg_one ha hu hw + have hmod : (p : ℤ) % (s : ℤ) = (1 : ℤ) % (s : ℤ) := by + rw [← Int.natCast_mod, h, Int.emod_eq_of_lt (by norm_num) (by omega)] + rfl + rw [jacobiSym.mod_left' hmod, jacobiSym.one_left] at hJ + norm_num at hJ + +/-- No finite list of witnesses `(a, u, s)` covers all primes: for every bound `N` + there is a prime `p > N` with `p ≡ 1 (mod ∏ s)`, and no listed witness works for it. + This is the covering-congruence obstruction; it says nothing about witnesses + whose `s` grows with `p`. -/ +theorem finite_witnesses_miss_infinitely_many_primes (S : Finset (ℕ × ℕ × ℕ)) + (hpos : ∀ w ∈ S, 0 < w.1 ∧ 0 < w.2.1 ∧ 0 < w.2.2) (N : ℕ) : + ∃ p > N, p.Prime ∧ ∀ w ∈ S, ¬ DivisorWitness p w.1 w.2.1 w.2.2 := by + have hL : (∏ w ∈ S, w.2.2) ≠ 0 := + Finset.prod_ne_zero_iff.mpr fun w hw => (Nat.pos_iff_ne_zero.mp (hpos w hw).2.2) + obtain ⟨p, hpN, hp, hmod⟩ := + Nat.forall_exists_prime_gt_and_modEq N hL (Nat.coprime_one_left _) + refine ⟨p, hpN, hp, fun w hw hwit => ?_⟩ + obtain ⟨ha, hu, hs⟩ := hpos w hw + have hps : p ≡ 1 [MOD w.2.2] := Nat.ModEq.of_dvd (Finset.dvd_prod_of_mem (fun w : ℕ × ℕ × ℕ => w.2.2) hw) hmod + by_cases hs1 : w.2.2 = 1 + · have hc := hwit.2 + rw [hs1] at hc + have hle := Nat.le_of_dvd (by norm_num) hc + have : 4 ≤ 4 * w.1 * w.2.1 := by + have : 1 ≤ w.1 * w.2.1 := Nat.one_le_iff_ne_zero.mpr (by positivity) + nlinarith + omega + · have h1 : p % w.2.2 = 1 := by + rw [hps] + exact Nat.mod_eq_of_lt (by omega) + exact no_witness_of_mod_eq_one ha hu h1 hwit + +/-- Non-vacuity: Dahan Proposition 3.13, `n = 409` with `(u, a) = (1, 2)`, `s = 7`. -/ +theorem witness_409 : DivisorWitness 409 2 1 7 := by + unfold DivisorWitness + norm_num + +/-! ## Proposition N: a witness has a non-residue prime factor + +(Outcasts, 2026-10-10, conditional-independence note.) `witness_jacobi_eq_neg_one` and the +multiplicativity of the Jacobi symbol give a prime factor `q` of `s` with `J(p | q) = -1`. +Consequences: a prime `p` that is a quadratic residue modulo every prime `q ≤ T` has no witness +built from primes `≤ T` alone, so conditioning on small prime factors cannot by itself decide the +existence of a witness; and `s = 11` can be a witness only when `p` is a non-residue modulo `11` +(the S test of the fork, `Research/Simultaneity20261010/`). -/ + +/-- If `J(a | s) = -1`, some prime factor `q` of `s` has `J(a | q) = -1`. -/ +theorem exists_prime_dvd_jacobiSym_eq_neg_one {a : ℤ} : + ∀ s : ℕ, jacobiSym a s = -1 → ∃ q, q.Prime ∧ q ∣ s ∧ jacobiSym a q = -1 := by + intro s + induction s using Nat.strong_induction_on with + | _ s ih => + intro h + have hs0 : s ≠ 0 := by + rintro rfl + rw [jacobiSym.zero_right] at h + norm_num at h + have hs1 : s ≠ 1 := by + rintro rfl + rw [jacobiSym.one_right] at h + norm_num at h + have hqp : (Nat.minFac s).Prime := Nat.minFac_prime hs1 + obtain ⟨t, ht⟩ := Nat.minFac_dvd s + have ht0 : t ≠ 0 := by + rintro rfl + rw [mul_zero] at ht + exact hs0 ht + have : NeZero (Nat.minFac s) := ⟨hqp.ne_zero⟩ + have : NeZero t := ⟨ht0⟩ + have hmul : jacobiSym a s = jacobiSym a (Nat.minFac s) * jacobiSym a t := by + conv_lhs => rw [ht] + exact jacobiSym.mul_right a _ t + rcases jacobiSym.trichotomy a (Nat.minFac s) with h0 | h1 | hm + · rw [hmul, h0, zero_mul] at h + norm_num at h + · rw [hmul, h1, one_mul] at h + have htlt : t < s := by + have h2 := hqp.two_le + have htpos := Nat.pos_of_ne_zero ht0 + rw [ht] + nlinarith + obtain ⟨r, hr, hrt, hrj⟩ := ih t htlt h + exact ⟨r, hr, ht ▸ Dvd.dvd.mul_left hrt _, hrj⟩ + · exact ⟨Nat.minFac s, hqp, Nat.minFac_dvd s, hm⟩ + +/-- **Proposition N.** Every Dahan witness `s` has a prime factor `q` with `J(p | q) = -1`. -/ +theorem witness_has_nonresidue_prime_factor {p a u s : ℕ} (ha : 0 < a) (hu : 0 < u) + (hw : DivisorWitness p a u s) : ∃ q, q.Prime ∧ q ∣ s ∧ jacobiSym p q = -1 := + exists_prime_dvd_jacobiSym_eq_neg_one s (witness_jacobi_eq_neg_one ha hu hw) + +/-- If `p` is not a non-residue modulo any prime `q ≤ T`, there is no witness all of whose prime +factors are `≤ T`. -/ +theorem no_smooth_witness {p a u s T : ℕ} (ha : 0 < a) (hu : 0 < u) + (hres : ∀ q, q.Prime → q ≤ T → jacobiSym p q ≠ -1) + (hsmooth : ∀ q, q.Prime → q ∣ s → q ≤ T) : ¬ DivisorWitness p a u s := by + intro hw + obtain ⟨q, hq, hqs, hj⟩ := witness_has_nonresidue_prime_factor ha hu hw + exact hres q hq (hsmooth q hq hqs) hj + +/-- For a prime `p ≡ 1 (mod 4)`, the prime factor of Proposition N is a quadratic non-residue +modulo `p` (quadratic reciprocity); in particular it is at least the least non-residue of `p`. -/ +theorem witness_prime_factor_nonsquare {p a u s : ℕ} [Fact p.Prime] (hp4 : p % 4 = 1) + (ha : 0 < a) (hu : 0 < u) (hw : DivisorWitness p a u s) : + ∃ q, q.Prime ∧ q ∣ s ∧ ¬ IsSquare ((q : ℤ) : ZMod p) := by + obtain ⟨q, hq, hqs, hj⟩ := witness_has_nonresidue_prime_factor ha hu hw + have hs4 : s % 4 = 3 := by + have h4 : 4 ∣ s + 1 := dvd_trans ⟨a * u, by ring⟩ hw.2 + omega + have hqodd : Odd q := by + rcases hq.eq_two_or_odd' with h2 | hodd + · subst h2 + obtain ⟨k, hk⟩ := hqs + omega + · exact hodd + rw [jacobiSym.quadratic_reciprocity_one_mod_four hp4 hqodd, + ← jacobiSym.legendreSym.to_jacobiSym] at hj + exact ⟨q, hq, hqs, (legendreSym.eq_neg_one_iff p).mp hj⟩ + +/-- `s = 11` is a witness only when `p ≡ 2, 6, 7, 8, 10 (mod 11)`, the non-residues modulo `11`. -/ +theorem witness_eleven_nonresidue {p a u : ℕ} (ha : 0 < a) (hu : 0 < u) + (hw : DivisorWitness p a u 11) : + p % 11 = 2 ∨ p % 11 = 6 ∨ p % 11 = 7 ∨ p % 11 = 8 ∨ p % 11 = 10 := by + have h := witness_jacobi_eq_neg_one ha hu hw + rw [jacobiSym.mod_left] at h + have hr : ((p : ℤ) % ((11 : ℕ) : ℤ)) = ((p % 11 : ℕ) : ℤ) := by push_cast; rfl + rw [hr] at h + have hlt : p % 11 < 11 := Nat.mod_lt _ (by norm_num) + generalize p % 11 = r at h hlt ⊢ + interval_cases r <;> first | omega | (norm_num at h) + +/-- Non-vacuity: `p = 1009` (hard class `169 mod 840`, `1009 ≡ 8 mod 11`) has the witness +`s = 11` at `(a, u) = (1, 3)`. -/ +theorem witness_1009_eleven : DivisorWitness 1009 1 3 11 := by + unfold DivisorWitness + norm_num + +#print axioms jacobi_eq_one_of_dvd_succ +#print axioms witness_jacobi_eq_neg_one +#print axioms no_witness_of_square +#print axioms no_witness_of_mod_eq_one +#print axioms finite_witnesses_miss_infinitely_many_primes +#print axioms witness_409 +#print axioms exists_prime_dvd_jacobiSym_eq_neg_one +#print axioms witness_has_nonresidue_prime_factor +#print axioms no_smooth_witness +#print axioms witness_prime_factor_nonsquare +#print axioms witness_eleven_nonresidue +#print axioms witness_1009_eleven + +end OutcastsMathLab.Research.JacobiObstruction diff --git a/OutcastsMathLab/Research/PsiObstruction.lean b/OutcastsMathLab/Research/PsiObstruction.lean new file mode 100644 index 0000000..8cfb2de --- /dev/null +++ b/OutcastsMathLab/Research/PsiObstruction.lean @@ -0,0 +1,106 @@ +import Mathlib.NumberTheory.LegendreSymbol.JacobiSymbol +import Mathlib.Data.Nat.Factorization.Induction + +/-! +# The ψ-type obstruction forces `u` to be a residue + +For a Dahan pair `(a, u)` at the prime `p`, let `ψ(q) = J(-(a u) | q)`. +The finite failure atlas (Outcasts P1) classified most failures as +"every odd prime factor `q` of `a p + u` lies in `ker ψ`". This module proves +the elementary consequence that was predicted and checked numerically (H2'): +if `p ≡ 1 (mod 8)` and the ψ-type obstruction holds, then `J(u | p) = 1`. +Contrapositively, a shift `u` with `J(u | p) = -1` can never fail by the +ψ-type obstruction. + +This is a consequence of quadratic reciprocity, not a new theorem about the +Erdős–Straus equation; in particular it does NOT assert that a witness exists +when `J(u | p) = -1` (other characters, and exponent obstructions, remain). +-/ + +namespace OutcastsMathLab.Research.PsiObstruction + +/-- If `J(p | q) = 1` for every odd prime factor `q` of `n ≠ 0`, then + `J(p | m) = 1` for every odd divisor `m` of `n`. -/ +theorem jacobi_eq_one_of_prime_factors (p n : ℕ) (hn : n ≠ 0) + (h : ∀ q, q.Prime → q ∣ n → Odd q → jacobiSym p q = 1) : + ∀ m, m ∣ n → Odd m → jacobiSym p m = 1 := by + intro m + induction m using Nat.recOnMul with + | zero => intro h0 _; exact absurd (zero_dvd_iff.mp h0) hn + | one => intro _ _; exact jacobiSym.one_right _ + | prime q hq => intro hqn hodd; exact h q hq hqn hodd + | mul x y ihx ihy => + intro hxy hodd + obtain ⟨hxo, hyo⟩ := Nat.odd_mul.mp hodd + have hx0 : x ≠ 0 := by rintro rfl; simp at hxo + have hy0 : y ≠ 0 := by rintro rfl; simp at hyo + rw [jacobiSym.mul_right' _ hx0 hy0, ihx (dvd_trans (Dvd.intro y rfl) hxy) hxo, + ihy (dvd_trans (Dvd.intro_left x rfl) hxy) hyo, one_mul] + +/-- L2: if `p ≡ 1 (mod 8)` and every odd prime factor `q` of `a p + u` has + `J(p | q) = 1`, then `J(u | p) = 1`. -/ +theorem psi_obstruction_forces_residue {p a u : ℕ} (hp8 : p % 8 = 1) (hu : 0 < u) + (h : ∀ q, q.Prime → q ∣ a * p + u → Odd q → jacobiSym p q = 1) : + jacobiSym u p = 1 := by + have hM : a * p + u ≠ 0 := by omega + obtain ⟨k, m, hm, hkm⟩ := Nat.exists_eq_two_pow_mul_odd hM + have hmdvd : m ∣ a * p + u := ⟨2 ^ k, by rw [hkm]; ring⟩ + have hJm := jacobi_eq_one_of_prime_factors p _ hM h m hmdvd hm + have hp4 : p % 4 = 1 := by omega + have hpodd : Odd p := Nat.odd_iff.mpr (by omega) + rw [jacobiSym.quadratic_reciprocity_one_mod_four hp4 hm] at hJm + have hmod : ((a * p + u : ℕ) : ℤ) % (p : ℤ) = (u : ℤ) % (p : ℤ) := by + push_cast + exact Int.modEq_iff_dvd.mpr ⟨-(a : ℤ), by ring⟩ + rw [← jacobiSym.mod_left' hmod, hkm] + push_cast + rw [jacobiSym.mul_left, jacobiSym.pow_left, jacobiSym.at_two hpodd, hJm, + ZMod.χ₈_nat_eq_if_mod_eight] + simp [hp8, show p % 2 = 1 by omega] + +/-- For a prime `q ∣ a p + u` with `gcd(a, u) = 1`: `ψ(q) = J(-(a u) | q) = J(p | q)`. -/ +theorem psi_eq_jacobi {p a u q : ℕ} (hq : q.Prime) (hcop : Nat.Coprime a u) + (hdvd : q ∣ a * p + u) : jacobiSym (-((a : ℤ) * u)) q = jacobiSym p q := by + have hqa : ¬ q ∣ a := by + intro hqa + have hqu : q ∣ u := (Nat.dvd_add_right (dvd_mul_of_dvd_left hqa p)).mp hdvd + have h1 : q ∣ 1 := hcop ▸ Nat.dvd_gcd hqa hqu + exact hq.one_lt.ne' (Nat.dvd_one.mp h1) + have hgcd : Int.gcd (a : ℤ) q = 1 := by + rw [Int.gcd_natCast_natCast] + exact (Nat.Coprime.symm ((Nat.Prime.coprime_iff_not_dvd hq).mpr hqa)) + have hmod : (-((a : ℤ) * u)) % (q : ℤ) = ((a : ℤ) ^ 2 * p) % (q : ℤ) := by + have hd : (q : ℤ) ∣ (a : ℤ) * p + u := by exact_mod_cast hdvd + exact Int.modEq_iff_dvd.mpr (by + rw [show (a : ℤ) ^ 2 * p - -((a : ℤ) * u) = (a : ℤ) * ((a : ℤ) * p + u) by ring] + exact Dvd.dvd.mul_left hd _) + rw [jacobiSym.mod_left' hmod, jacobiSym.mul_left, jacobiSym.sq_one' hgcd, one_mul] + +/-- L2 in ψ form: if `p ≡ 1 (mod 8)`, `gcd(a, u) = 1`, and every odd prime factor of + `a p + u` lies in `ker ψ`, then `J(u | p) = 1`. -/ +theorem psi_kernel_forces_residue {p a u : ℕ} (hp8 : p % 8 = 1) (hu : 0 < u) + (hcop : Nat.Coprime a u) + (h : ∀ q, q.Prime → q ∣ a * p + u → Odd q → jacobiSym (-((a : ℤ) * u)) q = 1) : + jacobiSym u p = 1 := + psi_obstruction_forces_residue hp8 hu fun q hq hd ho => by + rw [← psi_eq_jacobi hq hcop hd] + exact h q hq hd ho + +/-- Contrapositive: a non-residue shift `u` always has an odd prime factor `q` of + `a p + u` outside `ker ψ`. (This is necessary, not sufficient, for a witness.) -/ +theorem nonresidue_shift_escapes_psi {p a u : ℕ} (hp8 : p % 8 = 1) (hu : 0 < u) + (hcop : Nat.Coprime a u) (hJ : jacobiSym u p = -1) : + ∃ q, q.Prime ∧ q ∣ a * p + u ∧ Odd q ∧ jacobiSym (-((a : ℤ) * u)) q ≠ 1 := by + by_contra hne + push Not at hne + have := psi_kernel_forces_residue hp8 hu hcop hne + rw [hJ] at this + norm_num at this + +#print axioms jacobi_eq_one_of_prime_factors +#print axioms psi_obstruction_forces_residue +#print axioms psi_eq_jacobi +#print axioms psi_kernel_forces_residue +#print axioms nonresidue_shift_escapes_psi + +end OutcastsMathLab.Research.PsiObstruction diff --git a/Research/DeterministicFailure/README.md b/Research/DeterministicFailure/README.md new file mode 100644 index 0000000..87a5f49 --- /dev/null +++ b/Research/DeterministicFailure/README.md @@ -0,0 +1,48 @@ +# 決定的失敗の有限証明書(Dahan の判定条件の有限否定を Lean で) + +- 一般補題: `OutcastsMathLab/Research/DeterministicFailure.lean` +- 生成された証明書: `OutcastsMathLab/Research/HardPrimes20261005.lean`(生成スクリプト `gen_certificates.py`、手で編集しない) + +**新しい数学ではない。** 判定条件(Dahan v1 Theorem 3.9(ii): `s ∣ ap+u`、`s ≡ −1 (mod 4au)`。Dahan は査読前のプレプリントで、ここでは判定式の形だけを使う。2026-10-10 に「既知の判定条件」から書き直した)について、 +特定の素数 `p` と有限個の pair `(a, u)` に証人が**無い**ことを、Lean の定理として検証する部品。 + +## 仕組み + +1. `a p + u = ∏ qᵢ^{eᵢ}` の因数分解を証明書として与える(`prodPow L`、等式は `decide` で検査)。 +2. 各 `qᵢ` の素数性は `norm_num` で証明する。 +3. **一般補題** `mem_subProducts_of_dvd`: `∏ qᵢ^{eᵢ}`(`qᵢ` 素数)の約数は、すべて部分積 `∏ qᵢ^{fᵢ}`(`fᵢ ≤ eᵢ`)である。 + 核は `dvd_mul_split`(ℕ で `s ∣ mn` なら `s = yz`、`y ∣ m`、`z ∣ n`。gcd で自前に証明)と `Nat.dvd_prime_pow`。 +4. 部分積の有限集合(`subProducts L`、`∏(eᵢ+1)` 個)について `(d+1) % 4au ≠ 0` を `decide` で確かめる(`noWitnessCert`)。 +5. `no_divisorWitness_of_cert`: 1〜4 を合わせて `∀ s, ¬ DivisorWitness p a u s`。 + +これは失敗の地図で「決定的失敗」と呼んだ型(`ap+u` が小さい素因数 × 高々 1 つの大きい素数で、失敗の理由が因数分解に書いてある)を +Lean の命題にしたもの。大きい素因数が 2 つ以上あっても同じ仕組みで動く(素数性の証明が増えるだけ)。 + +## 証明書の対象 + +840 の平方類の素数 `p < 10⁶`(2,370 個)と 53 pair の箱(`a, u ≤ 6` 互いに素の 23 組 + `u ∈ {11, 13, 17, 19, 23}`、`a ≤ 6` の 30 組)で、 +**箱の全 pair で証人が無かった 2 つの素数** `345601`(≡ 361 mod 840)と `670849`(≡ 529 mod 840)。 + +| 定理 | 内容 | +|---|---| +| `p345601_a{a}_u{u}`(53 個) | 各 pair で `∀ s, ¬ DivisorWitness 345601 a u s` | +| `no_witness_345601_box` | 箱の全 53 pair で証人なし | +| `p670849_a{a}_u{u}`(53 個)、`no_witness_670849_box` | 同じ | + +素因数 > 7 の個数は 78 / 77、最大は 2,073,619 / 4,025,111。 + +帰無モデル(`briefs/p1-failure-atlas-results.md` の H11)では、100 以下の素因数を与件にするとこの 2 素数は 2,370 個中で最も難しい 1 位・2 位になる。 +この証明書は、その「難しさが小さい素因数の剰余に書いてある」ことの Lean 版でもある。 + +## 主張しないこと + +- この箱の外(大きい `a`, `u`)に証人が無いとは言わない。実際にはある(研究の本題は、箱を `p` とともに広げたときに必ず見つかるか)。 +- 最小性や、箱の選び方の正当性。 +- 存在補題、新しい族。 + +## 検証 + +ローカル(Windows、Lean 4.34.0 / mathlib v4.34.0)で生成物を削除して `lake build`: +`DeterministicFailure` Built(10s)、`HardPrimes20261005` Built(12s)、3769 jobs、終了コード 0。 +`#print axioms`: 一般補題 4 定理と箱の定理 2 つはすべて `propext` / `Classical.choice` / `Quot.sound` の範囲。`scripts/check_policy.py` は 7 files 通過。 +生成スクリプトは Python 側でも各 pair の全約数を走査して証人が無いことを `assert` している(Lean とは独立の検査)。 diff --git a/Research/DeterministicFailure/gen_certificates.py b/Research/DeterministicFailure/gen_certificates.py new file mode 100644 index 0000000..692fcf9 --- /dev/null +++ b/Research/DeterministicFailure/gen_certificates.py @@ -0,0 +1,74 @@ +"""Generate OutcastsMathLab/Research/HardPrimes20261005.lean. + +For each hard prime p and each pair (a, u) of the 53-pair box, factor a*p+u by trial +division, check (independently of the Lean side) that no divisor s has 4au | s+1, and +emit a Lean theorem whose proof is: factorization certificate (checked by `decide`), +primality of each factor (`norm_num`), and the sub-product check (`decide`). +Exact integer arithmetic only; no external libraries.""" +import sys +from math import gcd, isqrt + +HARD = [345601, 670849] +BOX = [(a, u) for a in range(1, 7) for u in range(1, 7) if gcd(a, u) == 1] + \ + [(a, u) for u in (11, 13, 17, 19, 23) for a in range(1, 7)] + +def factor(n): + f = []; d = 2 + while d * d <= n: + e = 0 + while n % d == 0: n //= d; e += 1 + if e: f.append((d, e)) + d += 1 if d == 2 else 2 + if n > 1: f.append((n, 1)) + return f + +def divisors(n): + ds = [] + for d in range(1, isqrt(n) + 1): + if n % d == 0: + ds.append(d) + if d * d != n: ds.append(n // d) + return ds + +def lean_list(f): + return "[" + ", ".join(f"({q}, {e})" for q, e in f) + "]" + +out = [] +out.append("import OutcastsMathLab.Research.DeterministicFailure\n") +out.append("/-! Generated by `Research/DeterministicFailure/gen_certificates.py`. Do not edit by hand.\n" + "Finite negative certificates: the two primes below have no Dahan witness at any pair of the\n" + "53-pair box used in the Outcasts failure atlas. Known criterion, not a new existence result. -/\n") +out.append("namespace OutcastsMathLab.Research.HardPrimes20261005\n") +out.append("open OutcastsMathLab.Research.DeterministicFailure\n") +out.append("/-- The 53 pairs `(a, u)`: coprime `a, u ≤ 6`, and `u ∈ {11, 13, 17, 19, 23}`, `a ≤ 6`. -/") +out.append("def box53 : List (ℕ × ℕ) := " + "[" + ", ".join(f"({a}, {u})" for a, u in BOX) + "]\n") +stats = {} +for p in HARD: + names = [] + large = set(); maxq = 0 + for a, u in BOX: + M = a * p + u; m = 4 * a * u + f = factor(M) + assert all(q ** e for q, e in f) and eval("*".join(f"{q}**{e}" for q, e in f)) == M + # independent check of the claim + assert not any((s + 1) % m == 0 for s in divisors(M)), (p, a, u) + for q, _ in f: + if q > 7: large.add(q); maxq = max(maxq, q) + name = f"p{p}_a{a}_u{u}" + names.append(name) + out.append(f"theorem {name} : ∀ s, ¬ DivisorWitness {p} {a} {u} s :=\n" + f" no_divisorWitness_of_cert (L := {lean_list(f)})\n" + f" (by norm_num [List.forall_mem_cons]) (by decide) (by decide)\n") + out.append(f"/-- `p = {p}` has no Dahan witness at any pair of the 53-pair box. -/") + out.append(f"theorem no_witness_{p}_box : ∀ au ∈ box53, ∀ s, ¬ DivisorWitness {p} au.1 au.2 s := by") + out.append(" intro au hau") + out.append(" simp only [box53, List.mem_cons, List.not_mem_nil, or_false] at hau") + out.append(" rcases hau with " + " | ".join(["rfl"] * len(BOX))) + for name in names: + out.append(f" · exact {name}") + out.append("") + out.append(f"#print axioms no_witness_{p}_box\n") + stats[p] = (len(large), maxq) +out.append("end OutcastsMathLab.Research.HardPrimes20261005") +open("OutcastsMathLab/Research/HardPrimes20261005.lean", "w", encoding="utf-8", newline="\n").write("\n".join(out) + "\n") +print("pairs per prime:", len(BOX), "| distinct primes > 7 and max:", stats, file=sys.stderr) diff --git a/Research/InvolutionBound/README.md b/Research/InvolutionBound/README.md new file mode 100644 index 0000000..15dd082 --- /dev/null +++ b/Research/InvolutionBound/README.md @@ -0,0 +1,42 @@ +# Dahan の対合による上限(Lemma 4.2 の形式化) + +`OutcastsMathLab/Research/InvolutionBound.lean` + +**これは文献の補題の形式化であり、新しい結果ではない。**(2026-10-10 に「既知の補題」から書き直した。Dahan arXiv:2608.24035v1 は査読前のプレプリント。 +補題はここで Lean で独立に証明したので、補題そのものの正しさは Dahan の査読に依存しない。) +Dahan(arXiv:2608.24035)Lemma 4.2: `m ≥ 1`、`M` の `4m` と互いに素な素因数の剰余の集合を `T ⊆ (ℤ/4m)^×` とする。 +`M` に `≡ −1 (mod 4m)` の約数がなければ `|T| ≤ φ(4m)/2`。 + +証明の要点は対合 `ι(x) = −x⁻¹`。`−1` は `4m` を法として平方でない(4 で割った剰余を見る)ので `ι` に固定点はなく、 +`(ℤ/4m)^×` を大きさ 2 の軌道 `φ(4m)/2` 個に分ける。`x` と `ι(x)` が両方 `T` にあれば、対応する相異なる素数 +`q₁ ≡ x`、`q₂ ≡ ι(x)` の積が `M` を割り、`q₁q₂ ≡ −1` となって仮定に反する。よって `T` は各軌道と高々 1 点で交わる。 + +Dahan が指摘するとおり、素因数の生成する部分群で議論する方法は `(ℤ/4m)^×` の指数が 2 を超えると破綻する +(16 を法として 3 と 7 の約数剰余は −1 を避けるが、⟨3, 7⟩ は −1 を含む)。対合の議論は法を問わず無条件に成り立つ。 + +## 定理 + +| 名前 | 内容 | +|---|---| +| `neg_one_ne_sq` | `ZMod (4m)` で `x² ≠ −1`(`ZMod 4` に写すと平方は 0, 1 のみ) | +| `card_le_half_of_fixedPointFree_involution` | 数え上げの核: 単射 `ι` と、`ι` の像と交わらない有限集合 `T` について `2|T| ≤ |α|` | +| `iota` / `iota_injective` / `iota_ne_self` | `ι(x) = −x⁻¹` は単射で固定点がない | +| `card_le_half_totient_of_no_neg_one_divisor` | 各元が `M` の素因数の剰余である任意の `T ⊆ (ZMod (4m))ˣ` について、`M` に `4m ∣ d+1` の約数がなければ `2|T| ≤ φ(4m)` | +| `primeResidues M n` | Dahan の `T`: `M` の `n` と互いに素な素因数の剰余を `(ZMod n)ˣ` の有限集合として定義 | +| `dahan_involution_bound` | Lemma 4.2 そのもの: `2 · |primeResidues M (4m)| ≤ φ(4m)` | +| `no_witness_bound` | 証人条件への特殊化: pair `(a, u)` に `p` の証人(`s ∣ ap+u`、`4au ∣ s+1`)がなければ、`ap+u` の素因数の剰余は `(ℤ/4au)^×` の高々半分 | + +`M = 0` や `m = 0` は仮定から除外される(`M = 0` なら `d = 4m−1` が仮定に反し、`m` は `0 < m` を仮定)。 + +## 主張しないこと + +- 等号の達成(`T = ker χ`、`χ(−1) = −1` の二次指標)は形式化していない。 +- これは証人が**無い**ことの必要条件で、存在については何も言わない。 +- 有限の失敗の地図(840 の平方類、`p < 10⁶`、53 pair)では、失敗 107,627 行すべてがこの条件を満たしていた(Lean の外の観察)。 + 指数型の失敗の 92% は `|T|` が上限の 0.2 倍以下で、上限が効くのは `ker χ` に収まる QR 型。 + +## 検証 + +ローカル(Windows、Lean 4.34.0 / mathlib v4.34.0)で生成物を削除して `lake build`: +`InvolutionBound` Built(24s)、3766 jobs、終了コード 0。 +6 定理の公理はすべて `propext` / `Classical.choice` / `Quot.sound`。`scripts/check_policy.py` は 5 files 通過。 diff --git a/Research/JacobiObstruction/README.md b/Research/JacobiObstruction/README.md new file mode 100644 index 0000000..9fc9642 --- /dev/null +++ b/Research/JacobiObstruction/README.md @@ -0,0 +1,75 @@ +# 平方剰余の障害(Dahan の正規形での形式化) + +`OutcastsMathLab/Research/JacobiObstruction.lean` + +**これは既知の障害の形式化であり、新しい結果ではない。** +起源は Schinzel・Yamamoto(1965)。Elsholtz–Tao(arXiv:1107.1010)Proposition 1.6 +「奇数の平方数には Type I / II の解がない」の Type II の場合を、 +Dahan(arXiv:2608.24035)Theorem 3.9(ii) の正規形に書き直したもの。 + +**出典の状態**(2026-10-10 追記): Elsholtz–Tao は査読済み(J. Aust. Math. Soc. 94 (2013) 50–105)。Dahan(arXiv:2608.24035v1、2026-08)は査読前のプレプリントで、 +ここで使うのは判定式の形(`s ∣ ap+u`、`s ≡ −1 (mod 4au)`)と Prop 3.13 の数値例だけです。定理はすべてこの形から Lean で証明しているので、Dahan の検証されていない結果には依存しません。 + +## 対象 + +Dahan の証人: 正の整数 `a, u, s` で + +- `s ∣ a p + u` +- `4 a u ∣ s + 1`(つまり `s ≡ −1 (mod 4au)`) + +定義 `DivisorWitness p a u s` は、研究ブランチの同名の定義と同じ形。 + +## 定理 + +| 名前 | 内容 | +|---|---| +| `jacobi_eq_one_of_dvd_succ` | `a > 0` かつ `4a ∣ s+1` なら `J(a \| s) = 1` | +| `witness_jacobi_eq_neg_one` | 証人があれば `J(p \| s) = −1` | +| `no_witness_of_square` | 平方数 `m²` には、どの `(a, u, s)` でも証人がない | +| `no_witness_of_mod_eq_one` | `p ≡ 1 (mod s)` なら、`s` はどの `(a, u)` でも証人にならない | +| `finite_witnesses_miss_infinitely_many_primes` | 有限個の証人 `(a, u, s)` の集合 `S` に対し、どの `N` についても、`S` のどれも使えない素数 `p > N` がある(`p ≡ 1 (mod ∏ s)`、Mathlib の Dirichlet の定理を使う) | +| `witness_409` | 非空虚性: Dahan Proposition 3.13 の `n = 409`、`(u, a) = (1, 2)`、`s = 7` | + +証明の要点: `a p ≡ −u (mod s)` から `J(p|s) = J(−1|s) J(u|s) / J(a|s)`。 +`s ≡ 3 (mod 4)` で `J(−1|s) = −1`。`s ≡ −1 (mod 4a)` から、`a` の 2 冪部分は +`J(2|s) = χ₈(s) = 1`、奇数部分は相互法則で `J(a|s) = 1`。`u` も同じ。 + +## 追加: 命題 N(2026-10-10、6 定理) + +証人は、p が平方非剰余になる素因数を必ず持つ、という `witness_jacobi_eq_neg_one` の系です。 +Outcasts の「小さい素因数を与件にした条件つき独立」の整理で使いました(fork の S 検査 `Research/Simultaneity20261010/` と関係)。 + +| 名前 | 内容 | +|---|---| +| `exists_prime_dvd_jacobiSym_eq_neg_one` | `J(a \| s) = −1` なら、`s` の素因数 `q` で `J(a \| q) = −1` となるものがある(Jacobi 記号の乗法性と最小素因数での帰納法) | +| `witness_has_nonresidue_prime_factor` | **命題 N**: 証人 `s` は `J(p \| q) = −1` の素因数 `q` を持つ | +| `no_smooth_witness` | `p` が `T` 以下のどの素数を法としても非剰余でないなら、`T` 以下の素因数だけからなる証人はない | +| `witness_prime_factor_nonsquare` | `p` が素数で `p ≡ 1 (mod 4)` なら、その `q` は `p` を法とする平方非剰余(相互法則)。したがって `q` は `p` の最小の平方非剰余以上 | +| `witness_eleven_nonresidue` | `s = 11` が証人なら `p mod 11 ∈ {2, 6, 7, 8, 10}`(11 を法とする非剰余) | +| `witness_1009_eleven` | 非空虚性: `p = 1009`(法 840 で 169、`≡ 8 mod 11`)、`(a, u) = (1, 3)`、`s = 11` | + +意味: 小さい素数をすべて平方剰余にもつ素数 `p` では、証人に必ず大きい素因数が入るので、小さい素因数の情報だけで証人の存在を決める論法は成り立ちません +(Vanishing と同じ理由)。存在補題の難しさは、各 `p` の大きい非剰余の素因数の側にあります。 +`jacobiSym` の数値計算のために `import Mathlib.Tactic.NormNum.LegendreSymbol` を足しました。 + +## 主張しないこと + +- エルデシュ=シュトラウス方程式の解の**存在**については何も言わない。 +- 最後の定理は「固定した `s` の有限集合では覆えない」という被覆合同式の障害で、 + **`s` が `p` とともに大きくなる証人**については何も言わない。研究の本題はそちら側にある。 +- Type I の場合は形式化していない。 + +## 数値の照合(Lean の外) + +素数 `p < 20000`、`a, u ≤ 8` で見つかった証人 41,390 件すべてで `J(p|s) = −1` +(ルナ側の Python、整数の約数走査)。 + +## 検証 + +ローカル(Windows、Lean 4.34.0 / mathlib v4.34.0)で生成物を削除して `lake build`: +`JacobiObstruction` Built(164s)、3764 jobs、終了コード 0。 +6 定理の公理は `propext` / `Classical.choice` / `Quot.sound` の部分集合(`witness_409` は `propext` のみ)。 +`scripts/check_policy.py` は 3 files 通過。 + +命題 N の追加後(2026-10-10): PR #6 の 5 モジュールの生成物を削除して `lake build`、`JacobiObstruction` Built(28s)、3770 jobs、終了コード 0、警告なし。 +`JacobiObstruction` の 12 定理の公理は標準の部分集合(`witness_1009_eleven` は `propext` のみ)。`scripts/check_policy.py` は 7 files 通過。 diff --git a/Research/PsiObstruction/README.md b/Research/PsiObstruction/README.md new file mode 100644 index 0000000..901fa87 --- /dev/null +++ b/Research/PsiObstruction/README.md @@ -0,0 +1,43 @@ +# ψ 型の障害は u を平方剰余に強制する + +`OutcastsMathLab/Research/PsiObstruction.lean` + +相互法則からすぐに出る帰結で、エルデシュ=シュトラウス方程式についての新しい定理ではない。 +有限の「失敗の地図」で事前に登録して数値で確かめた予測(H2')を、Lean で証明したもの。 + +## 背景 + +Dahan の対 `(a, u)` と素数 `p` について、`ψ(q) = J(−au | q)` と置く(Dahan arXiv:2608.24035v1 は査読前のプレプリント。ここでは判定式の形だけを使う。2026-10-10 追記)。 +`ap + u` の奇素因数がすべて `ker ψ` に入るとき(ψ 型の障害)、ψ(−1) = −1 なので +`ap + u` に `s ≡ −1 (mod 4au)` の約数はない。840 の平方類の素数で調べた失敗のうち、 +`u ≤ 6` では 86%(QR 型のうち)がこの型だった。 + +## 定理 + +| 名前 | 内容 | +|---|---| +| `jacobi_eq_one_of_prime_factors` | `n ≠ 0` の奇素因数 `q` がすべて `J(p\|q) = 1` なら、`n` の奇数の約数 `m` すべてで `J(p\|m) = 1` | +| `psi_obstruction_forces_residue` | `p ≡ 1 (mod 8)`、`u > 0`、`ap+u` の奇素因数がすべて `J(p\|q) = 1` なら `J(u\|p) = 1` | +| `psi_eq_jacobi` | 素数 `q ∣ ap+u`、`gcd(a,u) = 1` なら `J(−au\|q) = J(p\|q)` | +| `psi_kernel_forces_residue` | 上の 2 つを合わせた ψ の形: ψ 型の障害なら `J(u\|p) = 1` | +| `nonresidue_shift_escapes_psi` | 対偶: `J(u\|p) = −1` なら、`ap+u` に `ψ(q) ≠ 1` の奇素因数 `q` がある | + +`p` は素数である必要がない(`p ≡ 1 (mod 8)` だけを使う)。 + +## 主張しないこと + +- `J(u|p) = −1` のとき証人が**ある**とは言わない。ψ 以外の二次指標(`d ∣ 2au` の Kronecker 指標)、 + 部分群型・指数型の失敗は残る。実際、H2' の計算では `J(u|p) = −1` の行の 89.7% が失敗し、 + その内訳は指数型 16,976 / QR 型(ψ 以外)13,070 / 部分群型 2,915 だった。 + +## 数値の照合(Lean の外、事前登録済み) + +840 の平方類の素数 `p < 10⁶`(2,370 個)、`u ∈ {11,13,17,19,23}`、`a ≤ 6` の 71,100 行: +`J(u|p) = −1` の 36,750 行で ψ 型の失敗 0 件。`J(u|p) = +1` の 34,350 行では 22,370 件 +(検査に判別力があることの確認)。素因数分解と整数の約数走査の二方式で成否が全行一致。 + +## 検証 + +ローカル(Windows、Lean 4.34.0 / mathlib v4.34.0)で生成物を削除して `lake build`: +`PsiObstruction` Built(25s)、3765 jobs、終了コード 0。5 定理の公理は +`propext` / `Classical.choice` / `Quot.sound`。`scripts/check_policy.py` は 4 files 通過。