mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-08-08 21:25:46 +00:00
Replace the TODO(lean-port) sorry with a complete proof of the
projectionOrdering theorem: for positive SourceValue pairs s1 < s2
with s2 ≤ maxExpected, projectToCoding preserves strict ordering
of the Q0_64 values.
The proof uses Nat-only arithmetic (no Float) and handles two cases:
- a2 < d: both values fit in Q0_64 range, ordering follows from
monotonicity of integer division
- a2 = d: a2*s/d = s clamped to q0_64MaxRaw; a1*s/d < q0_64MaxRaw
via the key inequality (d-1)*s < (s-1)*d
Build: 8598 jobs, 0 errors (lake build)
877 lines
38 KiB
Text
877 lines
38 KiB
Text
/-
|
||
SpherionTwinPrime.lean — Balestrieri Twin-Prime Sieve as Discrete Scar Module
|
||
|
||
Formalizes the Balestrieri characterization:
|
||
w ∈ ℕ (≥1) is a twin-prime witness (6w-1 and 6w+1 both prime) iff w cannot be
|
||
expressed as 6ab + σ₁a + σ₂b for any a,b ≥ 1, σ₁,σ₂ ∈ {+1,-1}.
|
||
|
||
Structural isomorphism to the NK-Hodge-FAMM scar persistence:
|
||
The 4 obstruction sheets define a coverage density on ℕ.
|
||
Witnesses (uncovered integers) are the scar support where μ = 0,
|
||
and β₀(scar) > 0 is the persistence condition for infinitely many twin primes.
|
||
|
||
References:
|
||
- Balestrieri 2012: "An equivalent form of the twin prime conjecture"
|
||
(arXiv:1106.3648v2)
|
||
- NK-Hodge-FAMM framework (see Semantics.NKHodgeFAMM)
|
||
- Lonely Runner Betti mapping (see Semantics.LonelyRunner)
|
||
-/
|
||
import Mathlib
|
||
import Semantics.NKHodgeFAMM
|
||
import Semantics.FixedPoint
|
||
|
||
open Semantics.FixedPoint
|
||
open Semantics.FixedPoint.Q16_16
|
||
open Set
|
||
open Finset
|
||
|
||
namespace Semantics.SpherionTwinPrime
|
||
|
||
set_option linter.unusedVariables false
|
||
set_option linter.unusedSimpArgs false
|
||
set_option maxHeartbeats 0
|
||
|
||
/-! ## 1. Sheet signatures and obstruction forms -/
|
||
|
||
/-- The four sign signatures (σ₁,σ₂) ∈ {+1,-1}² defining the four obstruction sheets. -/
|
||
inductive SheetSignature : Type where
|
||
| pp : SheetSignature -- (+,+): 6ab + a + b
|
||
| pm : SheetSignature -- (+,-): 6ab + a - b
|
||
| mp : SheetSignature -- (-,+): 6ab - a + b
|
||
| mm : SheetSignature -- (-,-): 6ab - a - b
|
||
deriving DecidableEq, Repr, Fintype
|
||
|
||
instance : Fintype SheetSignature :=
|
||
{ elems := {.pp, .pm, .mp, .mm}
|
||
complete := by
|
||
intro s
|
||
cases s <;> simp }
|
||
|
||
/--
|
||
The obstruction value at (a,b) on a given sheet.
|
||
Returns ℤ because the pm/mp/mm sheets can produce negative values for small a,b.
|
||
|
||
Following Balestrieri: a,b ≥ 1 (positive integers only).
|
||
-/
|
||
def obstruction (a b : ℕ) (s : SheetSignature) : ℤ :=
|
||
match s with
|
||
| .pp => 6*a*b + a + b
|
||
| .pm => 6*a*b + a - b
|
||
| .mp => 6*a*b - a + b
|
||
| .mm => 6*a*b - a - b
|
||
|
||
@[simp] lemma obstruction_pp (a b : ℕ) : obstruction a b .pp = (6*a*b + a + b : ℤ) := rfl
|
||
@[simp] lemma obstruction_pm (a b : ℕ) : obstruction a b .pm = (6*a*b + a - b : ℤ) := rfl
|
||
@[simp] lemma obstruction_mp (a b : ℕ) : obstruction a b .mp = (6*a*b - a + b : ℤ) := rfl
|
||
@[simp] lemma obstruction_mm (a b : ℕ) : obstruction a b .mm = (6*a*b - a - b : ℤ) := rfl
|
||
|
||
/-! ## 2. Coverage density on ℕ
|
||
|
||
Balestrieri uses a,b ≥ 1. The finite bound a,b ≤ w+1 is sufficient because
|
||
any a > w makes 6ab + σ₁a + σ₂b > w (all terms are positive or near-zero). -/
|
||
|
||
/--
|
||
Coverage density at w: number of (a,b,sheet) triples with obstruction = w,
|
||
where a,b ∈ {1,…,w+1}.
|
||
-/
|
||
def coverageDensity (w : ℕ) : ℕ :=
|
||
let domain : Finset ℕ := Finset.Icc 1 (w+1)
|
||
Finset.card (Finset.filter (fun ((a,b,s) : ℕ × ℕ × SheetSignature) =>
|
||
obstruction a b s = (w : ℤ))
|
||
(domain.product (domain.product (Finset.univ : Finset SheetSignature))))
|
||
|
||
/-- Minimum obstruction is 4 (from mm sheet at a=b=1), so w < 4 are never covered. -/
|
||
lemma coverageDensity_zero_of_small : ∀ w, w < 4 → coverageDensity w = 0 := by
|
||
decide
|
||
|
||
/-- Coverage density at 4: the mm sheet with (a,b)=(1,1) gives 4. -/
|
||
lemma coverageDensity_four_nonzero : coverageDensity 4 > 0 := by
|
||
native_decide
|
||
|
||
/-- Coverage density at 6: pm and mp sheets with (a,b)=(1,1) give 6. -/
|
||
lemma coverageDensity_six_nonzero : coverageDensity 6 > 0 := by
|
||
native_decide
|
||
|
||
/-- Coverage density at 8: the pp sheet with (a,b)=(1,1) gives 8. -/
|
||
lemma coverageDensity_eight_nonzero : coverageDensity 8 > 0 := by
|
||
native_decide
|
||
|
||
/-! ## 3. Scar (witness) region -/
|
||
|
||
/--
|
||
Witness predicate: coverageDensity is ℕ-valued so equality is decidable,
|
||
making this suitable for Finset.filter.
|
||
-/
|
||
def isWitness (w : ℕ) : Prop := coverageDensity w = 0
|
||
|
||
instance (w : ℕ) : Decidable (isWitness w) :=
|
||
inferInstanceAs (Decidable (coverageDensity w = 0))
|
||
|
||
/--
|
||
Scar region: integers that are NOT covered by any obstruction.
|
||
These are precisely the twin-prime witnesses (Balestrieri characterization)
|
||
for w ≥ 1. The case w = 0 is a degenerate witness (0 satisfies the
|
||
no-obstruction condition but 6·0-1 = -1 is not prime).
|
||
|
||
Note: `w ∈ witnessRegion` is definitionally `coverageDensity w = 0`.
|
||
-/
|
||
def witnessRegion : Set ℕ := {w | isWitness w}
|
||
|
||
/-! ## 4. Scar complex (bridging to NKHodgeFAMM) -/
|
||
|
||
/--
|
||
A discrete scar complex on ℕ: the set of witness points up to a threshold N.
|
||
This mirrors NKHodgeFAMM.ScarComplex but on the discrete ℕ domain instead of ℝ³.
|
||
-/
|
||
structure ScarComplex where
|
||
threshold : ℕ
|
||
witnesses : Finset ℕ
|
||
witnesses_subset : witnesses ⊆ Finset.range (threshold + 1)
|
||
all_witnesses : ∀ w ∈ Finset.range (threshold + 1), isWitness w → w ∈ witnesses
|
||
|
||
/-- The canonical scar complex at threshold N: all witnesses ≤ N. -/
|
||
def witnessScarComplex (N : ℕ) : ScarComplex :=
|
||
{ threshold := N
|
||
witnesses := Finset.filter isWitness (Finset.range (N+1))
|
||
witnesses_subset := Finset.filter_subset _ _
|
||
all_witnesses := by
|
||
intro w hw_range hw_witness
|
||
apply Finset.mem_filter.mpr
|
||
exact ⟨hw_range, hw_witness⟩ }
|
||
|
||
/-- Count of witness points (0-simplices) in the scar complex at N. -/
|
||
def witnessCount (sc : ScarComplex) : ℕ :=
|
||
sc.witnesses.card
|
||
|
||
/--
|
||
The 0th Betti number β₀ of the witness set.
|
||
For a discrete set on ℕ, each isolated point is a connected component,
|
||
so β₀ = cardinality. This mirrors `beta0Circular` in LonelyRunner.
|
||
-/
|
||
def beta0 (sc : ScarComplex) : ℕ :=
|
||
witnessCount sc
|
||
|
||
/-- β₀(scar) > 0 means there is at least one witness ≤ N. -/
|
||
def bettiPositive (N : ℕ) : Prop :=
|
||
beta0 (witnessScarComplex N) > 0
|
||
|
||
lemma bettiPositive_iff_card_pos (N : ℕ) :
|
||
bettiPositive N ↔ (Finset.filter isWitness (Finset.range (N+1))).card > 0 := by
|
||
rfl
|
||
|
||
/--
|
||
The witnesses are unbounded: for every N, there exists a witness > N.
|
||
This is the correct Betti persistence condition for infinitely many twin primes
|
||
(as opposed to `∀ N, bettiPositive N` which could hold with finitely many witnesses
|
||
if one witness is ≤ N for all N).
|
||
-/
|
||
def unboundedWitnesses : Prop := ∀ N : ℕ, ∃ w : ℕ, isWitness w ∧ w > N
|
||
|
||
/-! ## 5. Ghost obstruction energy
|
||
The obstruction value, interpreted in Q16_16, serves as a discrete "energy
|
||
barrier". The polarity parameter tunes the height of the barrier, analogous
|
||
to the FAMM scar density threshold. No Float in this compute path. -/
|
||
|
||
/-- Ghost obstruction at (a,b,s) as a Q16_16 energy. -/
|
||
def ghostObstruction (a b : ℕ) (s : SheetSignature) : Q16_16 :=
|
||
Q16_16.ofNat ((obstruction a b s).toNat)
|
||
|
||
/--
|
||
Polarity-tuned obstruction: energy = polarity · raw obstruction.
|
||
Higher polarity → higher energy barriers → fewer obstructions → more witnesses.
|
||
The polarity acts as a threshold multiplier: obstruction values below
|
||
1/polarity become irrelevant.
|
||
-/
|
||
def tunedObstruction (a b : ℕ) (s : SheetSignature) (polarity : Q16_16) : Q16_16 :=
|
||
Q16_16.mul (ghostObstruction a b s) polarity
|
||
|
||
/--
|
||
The witness region under polarity tuning: w is a witness iff no tuned obstruction
|
||
collides with w. Since tuning is a multiplicative scaling, only obstruction values
|
||
that remain positive integers after tuning count.
|
||
-/
|
||
def tunedWitnessRegion (polarity : Q16_16) : Set ℕ :=
|
||
{w | ∀ (a b : ℕ) (s : SheetSignature),
|
||
(tunedObstruction a b s polarity).toInt ≠ (Q16_16.ofNat w).toInt}
|
||
|
||
/-! ## 6. Priority queue ordering (the merge of the 4 sheets)
|
||
|
||
The 4 obstruction sheets each produce an infinite increasing sequence
|
||
of obstruction values (e.g. pp: a=b gives 6a²+2a, a=1,b=k gives 6k+1+k, etc.).
|
||
The merged, deduplicated sequence of all obstruction values is the algorithmic
|
||
core of the sieve. -/
|
||
|
||
/-- Every integer n has some covered integer ≥ n (the 4 sheets produce
|
||
infinitely many distinct values). Proof: (a,b) = (n+1,1) on sheet (+,+)
|
||
gives obstruction 6·(n+1)·1 + (n+1) + 1 = 7n + 8, which is ≥ n and covered. -/
|
||
lemma exists_covered_ge (n : ℕ) : ∃ k ≥ n, coverageDensity k > 0 := by
|
||
set k := 7*n + 8 with hk
|
||
have hk_ge_n : k ≥ n := by omega
|
||
have h_covered : coverageDensity k > 0 := by
|
||
unfold coverageDensity
|
||
-- (a,b) = (n+1,1) on SheetSignature.pp gives obstruction = 6·(n+1)·1 + (n+1) + 1 = 7n + 8 = k
|
||
set a := n + 1 with ha
|
||
have ha1 : a ≥ 1 := by omega
|
||
have ha_k1 : a ≤ k + 1 := by
|
||
have : 7*n + 8 ≥ n + 1 := by omega
|
||
omega
|
||
have h_obstruction : obstruction a 1 SheetSignature.pp = k := by
|
||
unfold obstruction; dsimp [a, k]; ring
|
||
-- Use nested Finset.product for the 3D search space
|
||
let sheetSet : Finset SheetSignature := {SheetSignature.pp, SheetSignature.pm, SheetSignature.mp, SheetSignature.mm}
|
||
let searchSpace : Finset (ℕ × ℕ × SheetSignature) :=
|
||
(Finset.Icc 1 (k+1)).product ((Finset.Icc 1 (k+1)).product sheetSet)
|
||
have h_mem : (a, 1, SheetSignature.pp) ∈ searchSpace := by
|
||
dsimp [searchSpace, sheetSet]
|
||
refine Finset.mem_product.mpr ⟨Finset.mem_Icc.mpr ⟨ha1, ha_k1⟩, ?_⟩
|
||
have h1_ge_1 : (1 : ℕ) ≥ 1 := by omega
|
||
have h1_le_k1 : (1 : ℕ) ≤ k + 1 := by
|
||
dsimp [k]
|
||
omega
|
||
refine Finset.mem_product.mpr ⟨Finset.mem_Icc.mpr ⟨h1_ge_1, h1_le_k1⟩, ?_⟩
|
||
simp
|
||
have h_filter : (a, 1, SheetSignature.pp) ∈
|
||
Finset.filter (fun ((a',b',s) : ℕ × ℕ × SheetSignature) => obstruction a' b' s = k) searchSpace :=
|
||
Finset.mem_filter.mpr ⟨h_mem, h_obstruction⟩
|
||
have h_card_pos : (Finset.filter (fun ((a',b',s) : ℕ × ℕ × SheetSignature) => obstruction a' b' s = k)
|
||
searchSpace).card > 0 :=
|
||
Finset.card_pos.mpr ⟨(a,1,SheetSignature.pp), h_filter⟩
|
||
exact h_card_pos
|
||
exact ⟨k, hk_ge_n, h_covered⟩
|
||
|
||
/--
|
||
The merged obstruction sequence: all covered integers in increasing order,
|
||
deduplicated. `obstructionSeq n` returns the smallest covered integer ≥ n.
|
||
This is the conceptual priority-queue merge of the 4 sheets.
|
||
-/
|
||
noncomputable def obstructionSeq (n : ℕ) : ℕ :=
|
||
Nat.find (exists_covered_ge n)
|
||
|
||
lemma obstructionSeq_spec (n : ℕ) :
|
||
obstructionSeq n ≥ n ∧ coverageDensity (obstructionSeq n) > 0 :=
|
||
Nat.find_spec (exists_covered_ge n)
|
||
|
||
/-! ## 7. Betti bridge to NK-Hodge-FAMM -/
|
||
|
||
open Classical
|
||
|
||
/-- Embed a natural number as a constant function in (Fin 3 → ℝ). -/
|
||
def embedNat (w : ℕ) : Fin 3 → ℝ := fun _ => (w : ℝ)
|
||
|
||
lemma embedNat_injective : Function.Injective embedNat := by
|
||
intro x y h
|
||
have h0 : (x : ℝ) = (y : ℝ) := congr_fun h 0
|
||
exact_mod_cast h0
|
||
|
||
/--
|
||
FAMM scar density derived from coverage density, via the ℕ → (Fin 3 → ℝ) embedding.
|
||
|
||
The polarity is inverted: μ = 1 − density, so that witnesses (density = 0)
|
||
map to μ = 1 > 0 (IN the scar support). This mirrors the LonelyRunner
|
||
`scarDensity = 1 − min(Φ,1)` construction.
|
||
-/
|
||
noncomputable def fammScarDensity (μ : ℕ → ℕ) (x : Fin 3 → ℝ) (t : ℝ) : ℝ :=
|
||
if h : ∃ (w : ℕ), x = embedNat w then
|
||
(1 : ℝ) - (μ (Classical.choose h) : ℝ)
|
||
else
|
||
0
|
||
|
||
/--
|
||
The embedded witness region equals the FAMM scar support at threshold 0.
|
||
This proves the Balestrieri sieve is isomorphic to a special case of the
|
||
NK-Hodge-FAMM scar persistence framework.
|
||
|
||
Proof sketch:
|
||
→ If w ∈ witnessRegion (coverageDensity w = 0), then
|
||
fammScarDensity(embedNat w) = 1 − 0 = 1 > 0, so embedNat w ∈ scarSupport.
|
||
← If x ∈ scarSupport (μ(x) > 0), then fammScarDensity(x) > 0 forces x = embedNat w
|
||
for some w with coverageDensity w = 0, so w ∈ witnessRegion.
|
||
-/
|
||
theorem sieve_is_nk_hodge_famm_scar (t : ℝ) :
|
||
embedNat '' witnessRegion = NKHodgeFAMM.scarSupport (fammScarDensity coverageDensity) 0 t := by
|
||
ext x
|
||
constructor
|
||
· intro hx
|
||
rcases hx with ⟨w, hw, rfl⟩
|
||
rw [NKHodgeFAMM.scarSupport, Set.mem_setOf_eq]
|
||
unfold fammScarDensity
|
||
have h_exists : ∃ (w' : ℕ), embedNat w = embedNat w' := ⟨w, rfl⟩
|
||
rw [dif_pos h_exists]
|
||
have h_choice_eq : Classical.choose h_exists = w :=
|
||
embedNat_injective (by
|
||
have hspec := Classical.choose_spec h_exists
|
||
-- hspec : embedNat w = embedNat (Classical.choose h_exists)
|
||
simpa using hspec.symm)
|
||
rw [h_choice_eq]
|
||
have hw_val : coverageDensity w = 0 := hw
|
||
simp [hw_val]
|
||
· intro hx
|
||
rw [NKHodgeFAMM.scarSupport, Set.mem_setOf_eq] at hx
|
||
unfold fammScarDensity at hx
|
||
by_cases h : ∃ (w' : ℕ), x = embedNat w'
|
||
· rcases h with ⟨w, hw_eq⟩
|
||
subst hw_eq
|
||
rw [dif_pos ⟨w, rfl⟩] at hx
|
||
have h_choice_eq : Classical.choose (⟨w, rfl⟩ : ∃ (w' : ℕ), embedNat w = embedNat w') = w :=
|
||
embedNat_injective (by
|
||
have hspec := Classical.choose_spec (⟨w, rfl⟩ : ∃ (w' : ℕ), embedNat w = embedNat w')
|
||
-- hspec : embedNat w = embedNat (Classical.choose ...)
|
||
simpa using hspec.symm)
|
||
rw [h_choice_eq] at hx
|
||
have h_cov : coverageDensity w = 0 := by
|
||
by_contra h_nonzero
|
||
have h_ge_one : (1 : ℝ) ≤ (coverageDensity w : ℝ) := by
|
||
have h_nat_ge_one : coverageDensity w ≥ 1 :=
|
||
Nat.one_le_of_lt (Nat.pos_of_ne_zero h_nonzero)
|
||
exact_mod_cast h_nat_ge_one
|
||
linarith
|
||
have h_mem : w ∈ witnessRegion := by
|
||
simp [witnessRegion, isWitness, h_cov]
|
||
exact ⟨w, h_mem, rfl⟩
|
||
· exfalso
|
||
rw [dif_neg h] at hx
|
||
linarith
|
||
|
||
/-! ## 8. Computational witnesses -/
|
||
|
||
-- Obstruction values for selected (a,b,sheet) triples
|
||
#eval obstruction 1 1 SheetSignature.pp -- 8
|
||
#eval obstruction 1 1 SheetSignature.pm -- 6
|
||
#eval obstruction 1 1 SheetSignature.mp -- 6
|
||
#eval obstruction 1 1 SheetSignature.mm -- 4
|
||
#eval obstruction 1 2 SheetSignature.pp -- 15 (6*1*2 + 1 + 2 = 15)
|
||
#eval obstruction 2 1 SheetSignature.pp -- 15 (6*2*1 + 2 + 1 = 15)
|
||
|
||
-- Coverage density for small w (with a,b ≥ 1)
|
||
#eval coverageDensity 0 -- 0 (no (a≥1,b≥1) can produce 0)
|
||
#eval coverageDensity 1 -- 0
|
||
#eval coverageDensity 2 -- 0
|
||
#eval coverageDensity 3 -- 0
|
||
#eval coverageDensity 4 -- >0: (1,1) on mm gives 4
|
||
#eval coverageDensity 5 -- 0 (witness: 6·5-1=29, 6·5+1=31 both prime)
|
||
#eval coverageDensity 6 -- >0: (1,1) on pm and mp both give 6
|
||
#eval coverageDensity 7 -- 0 (witness: 6·7-1=41, 6·7+1=43 both prime)
|
||
#eval coverageDensity 8 -- >0: (1,1) on pp gives 8
|
||
#eval coverageDensity 9
|
||
#eval coverageDensity 10
|
||
|
||
/-- Query: list the witness integers w < 25 (with a,b ≥ 1). -/
|
||
def firstWitnesses : Finset ℕ :=
|
||
Finset.filter isWitness (Finset.range 25)
|
||
|
||
#eval firstWitnesses
|
||
|
||
/-- Query: list the covered integers w < 25 (complement of witnesses). -/
|
||
def firstCovered : Finset ℕ :=
|
||
Finset.filter (fun w => ¬ isWitness w) (Finset.range 25)
|
||
|
||
#eval firstCovered
|
||
|
||
-- Small theorems about known obstructions
|
||
/-- (a,b) = (1,1) on pp produces obstruction 8. -/
|
||
theorem obstruction_1_1_pp : obstruction 1 1 SheetSignature.pp = (8 : ℤ) := by
|
||
native_decide
|
||
|
||
/-- (a,b) = (1,1) on mm produces obstruction 4. -/
|
||
theorem obstruction_1_1_mm : obstruction 1 1 SheetSignature.mm = (4 : ℤ) := by
|
||
native_decide
|
||
|
||
/--
|
||
Known twin-prime witnesses (OEIS A002822): 1, 2, 3, 5, 7, 10, 12, 13, 17, 18, 23, ...
|
||
Our witness region for w < 25 matches exactly, with the addition of w = 0
|
||
(a degenerate witness: 0 satisfies the no-obstruction condition but is not
|
||
a true twin-prime witness since 6·0-1 = -1 is not prime).
|
||
-/
|
||
theorem witness_5 : (5 : ℕ) ∈ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
theorem witness_7 : (7 : ℕ) ∈ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
theorem witness_10 : (10 : ℕ) ∈ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
theorem witness_12 : (12 : ℕ) ∈ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
theorem witness_1 : (1 : ℕ) ∈ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
theorem witness_2 : (2 : ℕ) ∈ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
theorem witness_3 : (3 : ℕ) ∈ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
/-- 4 is covered (by (1,1) on mm). -/
|
||
theorem covered_4 : (4 : ℕ) ∉ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
/-- 8 is covered (by (1,1) on pp). -/
|
||
theorem covered_8 : (8 : ℕ) ∉ witnessRegion := by
|
||
unfold witnessRegion isWitness; native_decide
|
||
|
||
/-!
|
||
## 9. Persistent Betti condition
|
||
|
||
Unbounded witnesses is equivalent to infinitely many witnesses.
|
||
-/
|
||
lemma unbounded_iff_infinite : unboundedWitnesses ↔ Set.Infinite witnessRegion := by
|
||
constructor
|
||
· intro hunb
|
||
intro hfin
|
||
have ⟨fs, hfs⟩ := hfin.exists_finset
|
||
-- fs : Finset ℕ, hfs : ∀ a, a ∈ fs ↔ a ∈ witnessRegion
|
||
have hmax : ∃ (M : ℕ), ∀ w, w ∈ witnessRegion → w ≤ M := by
|
||
by_cases h_empty : fs = ∅
|
||
· refine ⟨0, λ w hw => ?_⟩
|
||
have : w ∈ fs := (hfs w).mpr hw
|
||
rw [h_empty] at this
|
||
simp at this
|
||
· have h_nonempty : fs.Nonempty := Finset.nonempty_iff_ne_empty.mpr h_empty
|
||
refine ⟨fs.max' h_nonempty, λ w hw => ?_⟩
|
||
have hw_fs : w ∈ fs := (hfs w).mpr hw
|
||
exact Finset.le_max' fs w hw_fs
|
||
rcases hmax with ⟨M, hM⟩
|
||
rcases hunb M with ⟨w, hw, hw_gt⟩
|
||
have hw_le_M := hM w hw
|
||
omega
|
||
· intro hinf
|
||
intro N
|
||
by_cases h : ∀ w, w ∈ witnessRegion → w ≤ N
|
||
· have h_finite : Set.Finite witnessRegion := by
|
||
have h_sub : witnessRegion ⊆ (Finset.range (N+1) : Set ℕ) :=
|
||
λ w hw => Finset.mem_coe.mpr (Finset.mem_range.mpr (by
|
||
have hw_le_N := h w hw
|
||
omega))
|
||
have h_fin_range : Set.Finite (Finset.range (N+1) : Set ℕ) :=
|
||
Finset.finite_toSet _
|
||
exact Set.Finite.subset h_fin_range h_sub
|
||
exact absurd h_finite hinf
|
||
· push_neg at h
|
||
rcases h with ⟨w, hw, hw_gt⟩
|
||
exact ⟨w, hw, hw_gt⟩
|
||
|
||
/-! ## 10. Goormaghtigh Exponential Sheets
|
||
|
||
Goormaghtigh's Conjecture: The only solutions to
|
||
`(x^m - 1)/(x - 1) = (y^n - 1)/(y - 1)` for integers x,y,m,n > 1 are
|
||
(x,m,y,n) = (5,3,2,5) and (90,3,2,13).
|
||
|
||
Repunit: `R(x,m) = (x^m - 1)/(x - 1) = 1 + x + x² + ... + x^(m-1)`
|
||
|
||
The Spherion 16D framework defines transition operators T (increment first param),
|
||
U (increment second), S (switch sheet), P (toggle polarity) that govern the
|
||
covering dynamics. The Goormaghtigh sheets add exponential fibers to this bundle.
|
||
-/
|
||
|
||
/-- Goormaghtigh exponential obstruction: R(x,n) = (x^n - 1)/(x - 1) = sum_{i=0}^{n-1} x^i -/
|
||
def repunit (x n : ℕ) : ℕ :=
|
||
(Finset.range n).sum (fun i => x ^ i)
|
||
|
||
/-- The repunit as an exponential obstruction sheet.
|
||
Maps the Spherion parameters (a,b,sheet) to Goormaghtigh's (x,m) and (y,n). -/
|
||
structure ExponentialSheet where
|
||
base : ℕ -- x or y (base of the repunit)
|
||
length : ℕ -- m or n (number of digits)
|
||
value : ℕ -- R(base, length)
|
||
signature : SheetSignature -- which sheet this belongs to (for operator compatibility)
|
||
|
||
/-- Transition: T increments the length (adds one more digit). -/
|
||
def expT (s : ExponentialSheet) : ExponentialSheet :=
|
||
{ s with length := s.length + 1,
|
||
value := s.value + s.base ^ s.length }
|
||
|
||
/-- Transition: U increments the base (changes base). -/
|
||
def expU (s : ExponentialSheet) : ExponentialSheet :=
|
||
{ s with base := s.base + 1,
|
||
value := repunit (s.base + 1) s.length }
|
||
|
||
/-- Switch sheet: maps between the two known solution configurations. -/
|
||
def expS (s : ExponentialSheet) : ExponentialSheet :=
|
||
match s.signature with
|
||
| .pp => { s with signature := .pm }
|
||
| .pm => { s with signature := .pp }
|
||
| .mp => { s with signature := .mm }
|
||
| .mm => { s with signature := .mp }
|
||
|
||
/-- Polarity toggle: modulates the energy level (analogous to tunedObstruction). -/
|
||
def expP (s : ExponentialSheet) (polarity : Q16_16) : ExponentialSheet :=
|
||
s -- polarity tuning at the energy level, not the structure level
|
||
|
||
set_option maxRecDepth 2000000
|
||
set_option maxHeartbeats 400000
|
||
|
||
/-- Verified: among the 979 repunit pairs for x ∈ [2,90], m ∈ [3,13],
|
||
only 2 values (31 and 8191) appear more than once. Uses native_decide
|
||
on a 979-element Finset. -/
|
||
lemma repunit_collisions_unique : Finset.card (Finset.filter (fun (v : ℕ) =>
|
||
(Finset.filter (fun (p : ℕ × ℕ) => repunit p.1 p.2 = v)
|
||
((Finset.Icc 2 90).product (Finset.Icc 3 13))).card > 1)
|
||
(Finset.image (fun (p : ℕ × ℕ) => repunit p.1 p.2)
|
||
((Finset.Icc 2 90).product (Finset.Icc 3 13)))) = 2 := by
|
||
native_decide
|
||
|
||
/-! ## §10.5. Goormaghtigh Modular Constraints
|
||
|
||
Borrowed from the PolyFactorIdentity / limbDecompose framework: repunits
|
||
are polynomial evaluations with all-1s coefficients, so they obey a
|
||
universal congruence. This gives a provable necessary condition on
|
||
collision pairs that acts as an algebraic sieve — strengthening the
|
||
evidence for goormaghtigh_boundedness without assuming it. -/
|
||
|
||
/-- x ≡ 1 (mod x-1): the base is congruent to 1 modulo its predecessor.
|
||
Proof: x = (x-1)+1, so x%(x-1) = ((x-1)+1)%(x-1) = 1%(x-1) by Nat.add_mod_right. -/
|
||
private lemma x_ModEq_one_pred (x : ℕ) (hx : x ≥ 2) : x ≡ 1 [MOD (x - 1)] := by
|
||
simp only [Nat.ModEq]
|
||
have h := @Nat.add_mod_right 1 (x - 1)
|
||
-- h : (1 + (x-1)) % (x-1) = 1 % (x-1)
|
||
rwa [Nat.add_comm 1 (x - 1), Nat.sub_add_cancel (show 1 ≤ x by omega)] at h
|
||
|
||
/-- R(x,m) ≡ m (mod x-1).
|
||
Each summand x^i ≡ 1^i = 1 (mod x-1), so the m-term sum ≡ m.
|
||
Proved by induction using Nat.ModEq.pow. -/
|
||
lemma repunit_mod_pred (x m : ℕ) (hx : x ≥ 2) :
|
||
repunit x m % (x - 1) = m % (x - 1) := by
|
||
have hmod : x ≡ 1 [MOD (x - 1)] := x_ModEq_one_pred x hx
|
||
simp only [repunit]
|
||
induction m with
|
||
| zero => simp
|
||
| succ k ih =>
|
||
rw [Finset.sum_range_succ, Nat.add_mod, ih]
|
||
have hpow : x ^ k % (x - 1) = 1 % (x - 1) := by
|
||
have h := Nat.ModEq.pow k hmod
|
||
simpa [Nat.ModEq, Nat.one_pow] using h
|
||
rw [hpow, ← Nat.add_mod]
|
||
|
||
/-- A Goormaghtigh collision R(x,m) = R(y,n) forces both cross-residue conditions:
|
||
· R(y,n) ≡ m (mod x-1) [from R(x,m) ≡ m, substituting the collision]
|
||
· R(x,m) ≡ n (mod y-1) [from R(y,n) ≡ n, substituting the collision]
|
||
This algebraic sieve rules out the vast majority of candidate collision pairs. -/
|
||
lemma goormaghtigh_collision_mod (x m y n : ℕ) (hx : x ≥ 2) (hy : y ≥ 2)
|
||
(h : repunit x m = repunit y n) :
|
||
repunit y n % (x - 1) = m % (x - 1) ∧
|
||
repunit x m % (y - 1) = n % (y - 1) := by
|
||
exact ⟨by rw [← h]; exact repunit_mod_pred x m hx,
|
||
by rw [h]; exact repunit_mod_pred y n hy⟩
|
||
|
||
/-- Verify the mod constraints hold for both known solutions (native_decide). -/
|
||
example : repunit 2 5 % (5 - 1) = 3 % (5 - 1) := by native_decide -- 31 % 4 = 3
|
||
example : repunit 5 3 % (2 - 1) = 5 % (2 - 1) := by native_decide -- 31 % 1 = 0
|
||
example : repunit 2 13 % (90 - 1) = 3 % (90 - 1) := by native_decide -- 8191 % 89 = 3
|
||
example : repunit 90 3 % (2 - 1) = 13 % (2 - 1) := by native_decide -- 8191 % 1 = 0
|
||
|
||
/-- Finite search: for distinct (x,m) ≠ (y,n) in [2,90]×[3,13],
|
||
if R(x,m) = R(y,n) then it is one of the 4 ordered forms of the 2 known solutions.
|
||
(The prior axiom omitted the symmetric cases (2,5,5,3) and (2,13,90,3) — corrected here.)
|
||
Closed by native_decide on 89×11×89×11 = 958K bounded universal quantifiers. -/
|
||
lemma goormaghtigh_finite_search (x m y n : ℕ) (h : repunit x m = repunit y n)
|
||
(hx : x ≥ 2) (hm : m ≥ 3) (hy : y ≥ 2) (hn : n ≥ 3)
|
||
(hx_bound : x ≤ 90) (hm_bound : m ≤ 13)
|
||
(hy_bound : y ≤ 90) (hn_bound : n ≤ 13) (h_distinct : (x, m) ≠ (y, n)) :
|
||
(x, m, y, n) = (5, 3, 2, 5) ∨ (x, m, y, n) = (2, 5, 5, 3) ∨
|
||
(x, m, y, n) = (90, 3, 2, 13) ∨ (x, m, y, n) = (2, 13, 90, 3) := by
|
||
have key : ∀ x ∈ Finset.Icc 2 90, ∀ m ∈ Finset.Icc 3 13,
|
||
∀ y ∈ Finset.Icc 2 90, ∀ n ∈ Finset.Icc 3 13,
|
||
repunit x m = repunit y n → (x, m) ≠ (y, n) →
|
||
(x, m, y, n) = (5, 3, 2, 5) ∨ (x, m, y, n) = (2, 5, 5, 3) ∨
|
||
(x, m, y, n) = (90, 3, 2, 13) ∨ (x, m, y, n) = (2, 13, 90, 3) := by
|
||
native_decide
|
||
exact key x (Finset.mem_Icc.mpr ⟨hx, hx_bound⟩)
|
||
m (Finset.mem_Icc.mpr ⟨hm, hm_bound⟩)
|
||
y (Finset.mem_Icc.mpr ⟨hy, hy_bound⟩)
|
||
n (Finset.mem_Icc.mpr ⟨hn, hn_bound⟩)
|
||
h h_distinct
|
||
|
||
/-- Lower bound: R(x,m) > x^(m-1) for x > 1, m > 1. -/
|
||
lemma repunit_gt_pow_pred (x m : ℕ) (hx : x > 1) (hm : m > 1) : x^(m-1) < repunit x m := by
|
||
have hxpos : x > 0 := by omega
|
||
have hsum_pos : (Finset.range (m-1)).sum (fun i => x ^ i) > 0 := by
|
||
have hzero : 0 < x ^ 0 := by simp
|
||
refine Finset.sum_pos (fun i hi => pow_pos hxpos _) ?_
|
||
exact ⟨0, Finset.mem_range.mpr (by
|
||
have hm' : m-1 > 0 := by omega
|
||
omega)⟩
|
||
calc
|
||
x^(m-1) < x^(m-1) + (Finset.range (m-1)).sum (fun i => x ^ i) := by omega
|
||
_ = ((Finset.range (m-1)).sum (fun i => x ^ i) + x^(m-1)) := by omega
|
||
_ = repunit x m := by
|
||
rw [repunit, ← Finset.sum_range_succ, show (m-1) + 1 = m by omega]
|
||
|
||
/-- Geometric series identity: (x-1) * (1 + x + ... + x^(m-1)) = x^m - 1.
|
||
Valid for all x,m ≥ 0. Proof splits into x = 0, x = 1, x ≥ 2. -/
|
||
lemma geom_series_mul_pred (x m : ℕ) : (x-1) * repunit x m = x^m - 1 := by
|
||
by_cases hx0 : x = 0
|
||
· subst hx0
|
||
by_cases hm : m = 0
|
||
· subst hm; simp [repunit]
|
||
· have hm_pos : m ≥ 1 := by omega
|
||
have h0pow : (0 : ℕ)^m = 0 := Nat.zero_pow (by omega : 0 < m)
|
||
simp [repunit, hm_pos, h0pow]
|
||
· by_cases hx1 : x = 1
|
||
· subst hx1; simp [repunit]
|
||
· have hx2 : x ≥ 2 := by omega
|
||
induction m with
|
||
| zero => simp [repunit]
|
||
| succ k ih =>
|
||
rw [repunit, Finset.sum_range_succ]
|
||
have h_mul : (x-1)*x^k = x^(k+1) - x^k := by
|
||
have h_eq : (x-1)*x^k + x^k = x^(k+1) := by
|
||
have hxpos : x > 0 := by omega
|
||
calc
|
||
(x-1)*x^k + x^k = x*x^k := by
|
||
have : (x-1)*x^k + x^k = ((x-1)+1)*x^k := by
|
||
calc
|
||
(x-1)*x^k + x^k = (x-1)*x^k + 1*x^k := by simp
|
||
_ = ((x-1)+1)*x^k := by rw [Nat.add_mul]
|
||
rw [this]
|
||
have : (x-1)+1 = x := by omega
|
||
rw [this]
|
||
_ = x^(k+1) := by simp [pow_succ, mul_comm]
|
||
calc
|
||
(x-1)*x^k = ((x-1)*x^k + x^k) - x^k := by rw [Nat.add_sub_cancel]
|
||
_ = x^(k+1) - x^k := by rw [h_eq]
|
||
have hx_pos : x > 0 := by omega
|
||
have hx_pow_le : x^k ≤ x^(k+1) :=
|
||
Nat.pow_le_pow_right hx_pos (by omega)
|
||
have hx_pow_nonneg : 1 ≤ x^k :=
|
||
Nat.one_le_pow k x hx_pos
|
||
have h_target : (x^k - 1) + (x^(k+1) - x^k) = x^(k+1) - 1 := by
|
||
have h_sum : (x^k - 1) + (x^(k+1) - x^k) + 1 = x^(k+1) := by
|
||
calc
|
||
(x^k - 1) + (x^(k+1) - x^k) + 1 = ((x^k - 1) + 1) + (x^(k+1) - x^k) := by omega
|
||
_ = x^k + (x^(k+1) - x^k) := by omega
|
||
_ = x^(k+1) := by
|
||
rw [add_comm, Nat.sub_add_cancel hx_pow_le]
|
||
have h_xk1_ge_1 : 1 ≤ x^(k+1) := le_trans hx_pow_nonneg hx_pow_le
|
||
omega
|
||
rw [mul_add, h_mul]
|
||
calc
|
||
((x-1)*repunit x k) + (x^(k+1) - x^k) = (x^k - 1) + (x^(k+1) - x^k) := by
|
||
exact congrArg (· + (x^(k+1) - x^k)) ih
|
||
_ = x^(k+1) - 1 := h_target
|
||
/-- Upper bound: R(x,m) < x^m for x ≥ 2, m ≥ 1.
|
||
Proof: (x-1)*R = x^m - 1 < x^m, so R < x^m/(x-1) ≤ x^m. -/
|
||
lemma repunit_lt_x_pow_m (x m : ℕ) (hx : x ≥ 2) (hm : m ≥ 1) : repunit x m < x ^ m := by
|
||
have h_geom := geom_series_mul_pred x m
|
||
have h_mul : (x-1) * repunit x m = x^m - 1 := h_geom
|
||
have h_pos : x-1 > 0 := by omega
|
||
have h_lt : x^m - 1 < x^m := by
|
||
have h_pos : x^m > 0 := pow_pos (by omega) m
|
||
omega
|
||
have : (x-1) * repunit x m < x^m := by
|
||
rw [h_mul]
|
||
exact h_lt
|
||
have h_nonzero : x-1 > 0 := by omega
|
||
-- If a*b < c and a ≥ 1, then b < c.
|
||
-- Here a = x-1 ≥ 1, b = repunit, c = x^m.
|
||
-- Since ℕ, we use the bound directly.
|
||
by_contra! hge
|
||
have h_mul_ge : (x-1) * repunit x m ≥ (x-1) * x^m := Nat.mul_le_mul_left (x-1) hge
|
||
have h_mul_lt : (x-1) * repunit x m < x^m := this
|
||
have h_xm1_ge_1 : x-1 ≥ 1 := by omega
|
||
have : repunit x m ≤ (x-1) * repunit x m := by
|
||
calc
|
||
repunit x m = 1 * repunit x m := by simp
|
||
_ ≤ (x-1) * repunit x m := Nat.mul_le_mul_right (repunit x m) h_xm1_ge_1
|
||
have h_contra : repunit x m < x^m := lt_of_le_of_lt this h_mul_lt
|
||
have h_ineq : x^m ≤ repunit x m := hge
|
||
have : x^m < x^m := lt_of_le_of_lt h_ineq h_contra
|
||
exact lt_irrefl _ this
|
||
|
||
/-- Energy increase under T (expT): incrementing length strictly increases the repunit. -/
|
||
lemma expT_increases_energy (s : ExponentialSheet) (hbase : s.base > 1) (hlen : s.length > 1) :
|
||
repunit (expT s).base (expT s).length > repunit s.base s.length := by
|
||
dsimp [expT]
|
||
have h_new : repunit s.base (s.length + 1) = repunit s.base s.length + s.base ^ s.length := by
|
||
simp [repunit, Finset.sum_range_succ]
|
||
rw [h_new]
|
||
have hpos : s.base ^ s.length ≥ 1 :=
|
||
Nat.one_le_pow s.length s.base (by
|
||
have hbpos : s.base > 0 := by omega
|
||
exact hbpos)
|
||
omega
|
||
|
||
/-- For fixed length m > 1, repunit x m is strictly increasing in the base x.
|
||
Proof: each term x^i (i ≥ 1) strictly increases with x (Nat.pow_lt_pow_left);
|
||
the i=0 term is 1 in both sums. -/
|
||
lemma repunit_mono_base {x y : ℕ} (hx : x > y) (hm : m > 1) : repunit x m > repunit y m := by
|
||
have h_nonzero_terms : ∀ i, 1 ≤ i → x^i > y^i := by
|
||
intro i hi
|
||
exact Nat.pow_lt_pow_left hx (by omega : i ≠ 0)
|
||
have h_exists_gt : ∃ i ∈ Finset.range m, x^i > y^i := by
|
||
refine ⟨1, Finset.mem_range.mpr (by omega), ?_⟩
|
||
exact Nat.pow_lt_pow_left hx (by norm_num : 1 ≠ 0)
|
||
dsimp [repunit]
|
||
refine Finset.sum_lt_sum (fun i hi => ?_) h_exists_gt
|
||
by_cases hi0 : i = 0
|
||
· subst hi0; simp
|
||
· have hi1 : 1 ≤ i := by omega
|
||
exact le_of_lt (h_nonzero_terms i hi1)
|
||
|
||
/-- For fixed base x ≥ 1, repunit x m is strictly increasing in the length m.
|
||
Proof: repunit x (k+1) = repunit x k + x^k > repunit x k. -/
|
||
lemma repunit_mono_length {x : ℕ} (hx : x ≥ 1) {m n : ℕ} (hmn : m > n) :
|
||
repunit x m > repunit x n := by
|
||
have hxpos : x > 0 := by omega
|
||
have h_succ_gt : ∀ a, repunit x (a+1) > repunit x a := by
|
||
intro a
|
||
calc
|
||
repunit x (a+1) = repunit x a + x^a := by simp [repunit, Finset.sum_range_succ]
|
||
_ > repunit x a := by
|
||
have hpos : x^a > 0 := pow_pos hxpos a
|
||
omega
|
||
rcases Nat.exists_eq_add_of_lt hmn with ⟨k, hk⟩
|
||
subst hk
|
||
clear hmn
|
||
induction k with
|
||
| zero => exact h_succ_gt n
|
||
| succ k ih =>
|
||
have h_next : repunit x (n + k + 2) > repunit x (n + k + 1) := h_succ_gt (n + k + 1)
|
||
exact gt_trans h_next ih
|
||
|
||
/-- Ordering lemma: if the larger base has a repunit collision with the smaller base,
|
||
then its exponent must be strictly smaller.
|
||
Proof: if x > y and m ≥ n, then repunit x m ≥ repunit x n > repunit y n. -/
|
||
lemma goormaghtigh_ordering {x m y n : ℕ} (h_coll : repunit x m = repunit y n)
|
||
(hx : x > 1) (hm : m > 2) (hy : y > 1) (hn : n > 2)
|
||
(h_xy : x > y) : m < n := by
|
||
by_contra! hm_ge
|
||
have h_lt : repunit x n > repunit y n :=
|
||
repunit_mono_base h_xy (by omega : n > 1)
|
||
have h_ge : repunit x m ≥ repunit x n :=
|
||
if hm_eq : m = n then by
|
||
subst hm_eq; rfl
|
||
else
|
||
have hm_gt : m > n := by omega
|
||
have hx1 : x ≥ 1 := by omega
|
||
le_of_lt (repunit_mono_length hx1 hm_gt)
|
||
have h_contra : repunit x m > repunit y n := lt_of_lt_of_le h_lt h_ge
|
||
rw [h_coll] at h_contra
|
||
exact lt_irrefl _ h_contra
|
||
|
||
/-- The Spherion 16D→0D projection: the transition algebra (T,U,S,P) on
|
||
ExponentialSheet is energy-dissipating. Any non-trivial (non-identical)
|
||
solution R(x,m) = R(y,n) must lie in the basin bounded by [2,90]×[3,13].
|
||
|
||
This is an **axiom** — it is equivalent to a bounded form of the (still open)
|
||
Goormaghtigh Conjecture. The full conjecture further says only 4 ordered
|
||
solutions exist in this box (proved by `goormaghtigh_finite_search` via
|
||
`native_decide`). Together, the axiom + finite search imply the full
|
||
Goormaghtigh Conjecture for m,n > 2, which is `goormaghtigh_collapse`.
|
||
|
||
TODO(lean-port): Convert this axiom to a theorem via linear forms in logarithms.
|
||
|
||
## Baker-bounding strategy (Bugeaud–Mignotte–Siksek 2008)
|
||
|
||
1. **Take logarithms.** From `(x^m - 1)/(x-1) = (y^n - 1)/(y-1)`, take
|
||
absolute values and bound using the triangle inequality. For large
|
||
x,y, the leading terms dominate, giving `|m·log x - n·log y|` very
|
||
small relative to the magnitudes.
|
||
|
||
2. **Linear form in logarithms.** The expression
|
||
`Λ = m·log x - n·log y`
|
||
is a non-zero (by h_distinct, via the ordering lemma) linear form
|
||
in two logarithms of algebraic numbers (the integers x,y). Apply
|
||
Baker's theorem (or the Matveev bound) to get a lower bound:
|
||
`|Λ| > exp(−C·log m·log n·log x·log y)`
|
||
where C is an absolute constant depending only on the number of
|
||
logarithms (here 2).
|
||
|
||
3. **Upper bound from the equation.** From the repunit equality,
|
||
the relative error satisfies
|
||
`|Λ| < (x^(m-1))⁻¹ + (y^(n-1))⁻¹ < 2·x^(1-m)` (WLOG x ≥ y).
|
||
This is exponentially small in m.
|
||
|
||
4. **Compare bounds.** The lower bound from Baker decays slower than
|
||
the upper bound from the series expansion. The inequality
|
||
`exp(−C·log m·log n·log x·log y) < 2·x^(1-m)`
|
||
forces m,n,x,y to be small. Solving this inequality (via
|
||
elementary calculus) yields explicit numerical bounds.
|
||
|
||
5. **Refine to 90/13.** The generic Baker bound is ~10^10. Run a
|
||
targeted computation up to that bound (using native_decide on the
|
||
finite rectangle) and filter to the known solutions. The 90/13
|
||
constants fall out of the extremal known pair (90,3,2,13).
|
||
|
||
## Dependencies to add
|
||
|
||
- `Mathlib.NumberTheory.Transcendental.Baker` — does not yet exist.
|
||
Formalizing Baker's theorem in Lean is an active research project
|
||
(roughly 10^4–10^5 lines of proof). Until then, the axiom is the
|
||
correct boundary.
|
||
- `Analysis/SpecialFunctions/Pow.Real` — for the logarithms in step 1.
|
||
Partially available; the real-pow interface is usable.
|
||
- `Mathlib/NumberTheory/ArithmeticFunction` — for the numeric bound
|
||
calculations in step 5.
|
||
|
||
## Partial progress possible now
|
||
|
||
- The ordering lemma (`x > y → m < n`) and base/length monotonicity
|
||
(`repunit x m` strictly increasing in both arguments) can be proved
|
||
immediately — these are purely combinatorial.
|
||
- The congruence sieve `goormaghtigh_collision_mod` is already proved
|
||
and rules out most candidate pairs in the bounded box. -/
|
||
axiom goormaghtigh_boundedness (x m y n : ℕ) (h : repunit x m = repunit y n)
|
||
(hx : x > 1) (hm : m > 2) (hy : y > 1) (hn : n > 2) (h_distinct : (x, m) ≠ (y, n)) :
|
||
x ≤ 90 ∧ m ≤ 13 ∧ y ≤ 90 ∧ n ≤ 13
|
||
|
||
/-- The 16D→0D projection: all exponential sheets collapse to the same
|
||
DualQuaternion energy spectrum as the quadratic sheets.
|
||
|
||
The only surviving fixed points under the transition algebra
|
||
(T, U, S, P) are the two known Goormaghtigh solutions (4 ordered forms).
|
||
|
||
Proof: By `goormaghtigh_boundedness`, any solution lies in the
|
||
finite search space [2,90]×[3,13]×[2,90]×[3,13].
|
||
By `goormaghtigh_finite_search` (native_decide on 958K-element product),
|
||
only the 4 ordered forms of the 2 known solutions exist in this space. -/
|
||
theorem goormaghtigh_collapse (x m y n : ℕ) (h : repunit x m = repunit y n)
|
||
(hx : x > 1) (hm : m > 2) (hy : y > 1) (hn : n > 2) (h_distinct : (x, m) ≠ (y, n)) :
|
||
(x, m, y, n) = (5, 3, 2, 5) ∨ (x, m, y, n) = (2, 5, 5, 3) ∨
|
||
(x, m, y, n) = (90, 3, 2, 13) ∨ (x, m, y, n) = (2, 13, 90, 3) := by
|
||
have hb := goormaghtigh_boundedness x m y n h hx hm hy hn h_distinct
|
||
rcases hb with ⟨hx90, hm13, hy90, hn13⟩
|
||
exact goormaghtigh_finite_search x m y n h (by omega) hm (by omega) hn
|
||
hx90 hm13 hy90 hn13 h_distinct
|
||
|
||
/-! ## 11. Goormaghtigh Computational Witnesses -/
|
||
|
||
/-- Verify the two known solutions via native_decide. -/
|
||
example : repunit 5 3 = 31 := by native_decide
|
||
example : repunit 2 5 = 31 := by native_decide
|
||
example : repunit 90 3 = 8191 := by native_decide
|
||
example : repunit 2 13 = 8191 := by native_decide
|
||
example : repunit 5 3 = repunit 2 5 := by native_decide
|
||
example : repunit 90 3 = repunit 2 13 := by native_decide
|
||
|
||
/-! ## 12. Receipt -/
|
||
|
||
/-- Receipt attesting to the Balestrieri sieve formulation,
|
||
the scar complex bridge, the Betti persistence condition,
|
||
and the Goormaghtigh exponential sheet extension. -/
|
||
def spherionTwinPrimeReceipt : String :=
|
||
"balestrieri_sieve:formalized\n" ++
|
||
"sheet_signatures:4_sheets_defined\n" ++
|
||
"coverage_density:computable,a_b_ge_1\n" ++
|
||
"witness_region:defined_as_set_n\n" ++
|
||
"scar_complex_bridge:connected_to_nk_hodge_famm\n" ++
|
||
"betti_persistence:unbounded_witnesses_iff_infinite\n" ++
|
||
"polarity_tuning:q16_16_integer_only\n" ++
|
||
"embedding:nat_to_fin3_to_real_defined\n" ++
|
||
"sieve_is_nk_hodge_famm_scar:proved\n" ++
|
||
"witnesses_0_1_2_3_5_7_10_12_17_18_23:computed_via_native_decide\n" ++
|
||
"goormaghtigh_exponential_sheets:added\n" ++
|
||
"repunit:defined_as_range_sum\n" ++
|
||
"exponential_sheet_structure:defined_with_T_U_S_P_operators\n" ++
|
||
"goormaghtigh_solutions_5_3_2_5_and_90_3_2_13:verified_via_native_decide\n" ++
|
||
"repunit_collisions_unique:native_decide_979_pairs\n" ++
|
||
"repunit_mod_pred:proved_R_x_m_equiv_m_mod_x-1\n" ++
|
||
"goormaghtigh_collision_mod:proved_cross_residue_sieve\n" ++
|
||
"goormaghtigh_finite_search:proved_4_ordered_cases_native_decide_958K\n" ++
|
||
"goormaghtigh_boundedness:axiom_bounded_form_of_open_conjecture\n" ++
|
||
"goormaghtigh_collapse:proved_4_ordered_cases_via_finite_search_and_boundedness"
|
||
|
||
#eval! spherionTwinPrimeReceipt
|
||
|
||
end Semantics.SpherionTwinPrime
|