pith. machine review for the scientific record. sign in

IndisputableMonolith.NumberTheory.ErdosStrausRotationHierarchy

IndisputableMonolith/NumberTheory/ErdosStrausRotationHierarchy.lean · 264 lines · 23 declarations

show as:
view math explainer →

open module explainer GitHub source

Explainer status: ready · generated 2026-05-13 14:05:34.242448+00:00

   1import Mathlib
   2import IndisputableMonolith.NumberTheory.ErdosStrausRCL
   3
   4/-!
   5# Erdős-Straus Recognition Rotation Hierarchy
   6
   7This module turns the current RCL attack into a theorem-shaped proof skeleton.
   8
   9It proves the finite/gate pieces and isolates the two genuinely missing
  10number-theoretic engines:
  11
  121. prime phase separation across admissible residual quotients;
  132. reciprocal pair closure once enough phase support appears.
  14
  15No new axiom is introduced here.  The missing engines are structure fields:
  16explicit assumptions that a future proof must supply.
  17-/
  18
  19namespace IndisputableMonolith
  20namespace NumberTheory
  21namespace ErdosStrausRotationHierarchy
  22
  23open ErdosStrausRCL
  24
  25/-! ## 1. Finite quotient necessity -/
  26
  27/-- A nonzero residual `c/N` has a positive finite modulus `c`. -/
  28def NonzeroResidual (c N : ℕ) : Prop :=
  29  0 < c ∧ 0 < N
  30
  31/-- The finite cyclic phase quotient induced by a residual gate. -/
  32abbrev ResidualPhaseQuotient (c : ℕ) := ZMod c
  33
  34/-- Every nonzero residual gate induces a finite cyclic quotient `Z/cZ`. -/
  35theorem finite_quotient_necessity {c N : ℕ}
  36    (h : NonzeroResidual c N) :
  37    Nonempty (Fintype (ResidualPhaseQuotient c)) := by
  38  have hcne : c ≠ 0 := Nat.ne_of_gt h.1
  39  letI : NeZero c := ⟨hcne⟩
  40  exact ⟨inferInstance⟩
  41
  42/-! ## 2. Gate ladder forcing -/
  43
  44/-- For the hard class `n ≡ 1 mod 4`, admissible residual gates are `3 mod 4`. -/
  45def AdmissibleHardGate (c : ℕ) : Prop :=
  46  c % 4 = 3
  47
  48/-- If `n ≡ 1 mod 4` and `x = (n+c)/4` is an integer posting, then
  49the residual gate satisfies `c ≡ 3 mod 4`. -/
  50theorem gate_ladder_forced {n c x : ℕ}
  51    (hn : n % 4 = 1)
  52    (hx : 4 * x = n + c) :
  53    AdmissibleHardGate c := by
  54  unfold AdmissibleHardGate
  55  omega
  56
  57/-- Conversely, `c ≡ 3 mod 4` is exactly the condition making `n+c`
  58divisible by 4 in the hard class. -/
  59theorem admissible_gate_posts {n c : ℕ}
  60    (hn : n % 4 = 1)
  61    (hc : AdmissibleHardGate c) :
  62    4 ∣ n + c := by
  63  unfold AdmissibleHardGate at hc
  64  exact Nat.dvd_of_mod_eq_zero (by omega)
  65
  66/-! ## 3. Defect-pair equivalence -/
  67
  68/-- A rational closure witness for a gate `c`: the data needed by
  69`repr_of_gate_divisor_pair`. -/
  70def GateClosureWitness (n c : ℕ) : Prop :=
  71  ∃ x N d q : ℚ,
  72    (n : ℚ) ≠ 0 ∧
  73    x ≠ 0 ∧
  74    (c : ℚ) ≠ 0 ∧
  75    N = (n : ℚ) * x ∧
  76    x = ((n : ℚ) + (c : ℚ)) / 4 ∧
  77    d * q = N ∧
  78    (N + d) / (c : ℚ) ≠ 0 ∧
  79    (N + N * q) / (c : ℚ) ≠ 0
  80
  81/-- The RCL divisor-pair bridge: a gate closure witness gives a rational
  82Erdős-Straus representation. -/
  83theorem gate_closure_witness_gives_repr {n c : ℕ}
  84    (h : GateClosureWitness n c) :
  85    HasRationalErdosStrausRepr (n : ℚ) := by
  86  rcases h with ⟨x, N, d, q, hn, hx, hc, hN, hxdef, hdq, hy, hz⟩
  87  exact repr_of_gate_divisor_pair
  88    (n := (n : ℚ)) (x := x) (c := (c : ℚ)) (N := N) (d := d) (q := q)
  89    hn hx hc hN hxdef hdq hy hz
  90
  91/-- A direct balanced-pair phase support witness in the square budget `N^2`.
  92This is the exact finite-quotient condition:
  93
  94* `x` is the first denominator, so `N = n*x` and `c = 4*x - n`;
  95* `d*e = N^2`;
  96* both defects land in phase `-N mod c`, expressed as divisibility of
  97  `N+d` and `N+e`.
  98
  99The positivity fields keep the rational denominators nonzero. -/
 100def BalancedPairPhaseSupport (n c : ℕ) : Prop :=
 101  ∃ x N d e : ℕ,
 102    0 < n ∧ 0 < c ∧ 0 < x ∧ 0 < N ∧ 0 < d ∧ 0 < e ∧
 103    N = n * x ∧
 104    c = 4 * x - n ∧
 105    d * e = N ^ 2 ∧
 106    c ∣ N + d ∧
 107    c ∣ N + e
 108
 109/-- A balanced-pair phase support witness gives an Erdős-Straus
 110representation.  This is the finite reciprocal-pair closure theorem. -/
 111theorem balanced_pair_phase_support_gives_repr {n c : ℕ}
 112    (h : BalancedPairPhaseSupport n c) :
 113    HasRationalErdosStrausRepr (n : ℚ) := by
 114  rcases h with ⟨x, N, d, e, hnpos, hcpos, hxpos, hNpos, hdpos, hepos,
 115    hN, hcdefNat, hde, _hcd, _hce⟩
 116  have hn : (n : ℚ) ≠ 0 := by exact_mod_cast hnpos.ne'
 117  have hx : (x : ℚ) ≠ 0 := by exact_mod_cast hxpos.ne'
 118  have hc : (c : ℚ) ≠ 0 := by exact_mod_cast hcpos.ne'
 119  have hy : (((N : ℚ) + (d : ℚ)) / (c : ℚ)) ≠ 0 := by
 120    have hnum : ((N : ℚ) + (d : ℚ)) ≠ 0 := by
 121      have hpos : (0 : ℚ) < (N : ℚ) + (d : ℚ) := by
 122        exact add_pos (by exact_mod_cast hNpos) (by exact_mod_cast hdpos)
 123      exact ne_of_gt hpos
 124    exact div_ne_zero hnum hc
 125  have hz : (((N : ℚ) + (e : ℚ)) / (c : ℚ)) ≠ 0 := by
 126    have hnum : ((N : ℚ) + (e : ℚ)) ≠ 0 := by
 127      have hpos : (0 : ℚ) < (N : ℚ) + (e : ℚ) := by
 128        exact add_pos (by exact_mod_cast hNpos) (by exact_mod_cast hepos)
 129      exact ne_of_gt hpos
 130    exact div_ne_zero hnum hc
 131  have hNQ : (N : ℚ) = (n : ℚ) * (x : ℚ) := by
 132    exact_mod_cast hN
 133  have hcdefQ : (c : ℚ) = 4 * (x : ℚ) - (n : ℚ) := by
 134    have hcadd : c + n = 4 * x := by omega
 135    have hcaddQ : (c : ℚ) + (n : ℚ) = 4 * (x : ℚ) := by
 136      exact_mod_cast hcadd
 137    linarith
 138  have hdeQ : (d : ℚ) * (e : ℚ) = (N : ℚ) ^ 2 := by
 139    exact_mod_cast hde
 140  refine repr_of_balanced_factor_pair
 141    (n := (n : ℚ)) (x := (x : ℚ)) (c := (c : ℚ)) (N := (N : ℚ))
 142    (d := (d : ℚ)) (e := (e : ℚ))
 143    (y := ((N : ℚ) + (d : ℚ)) / (c : ℚ))
 144    (z := ((N : ℚ) + (e : ℚ)) / (c : ℚ))
 145    hn hx hc hy hz hNQ hcdefQ hdeQ ?_ ?_
 146  · field_simp [hc]
 147  · field_simp [hc]
 148
 149/-! ## 4. Trap characterization -/
 150
 151/-- Every prime divisor of `m` lies in residue class `1 mod 3`. -/
 152def AllPrimeFactorsOneModThree (m : ℕ) : Prop :=
 153  ∀ p : ℕ, Nat.Prime p → p ∣ m → p % 3 = 1
 154
 155/-- The residual trapped class after the explicit formulas:
 156`n ≡ 1 mod 24`, and both ledger sources are built only from primes
 157`1 mod 3`. -/
 158def ResidualTrap (n : ℕ) : Prop :=
 159  1 < n ∧
 160  n % 24 = 1 ∧
 161  AllPrimeFactorsOneModThree n ∧
 162  AllPrimeFactorsOneModThree ((n + 3) / 4)
 163
 164/-! ## 5-10. Missing engines as explicit first-principles targets -/
 165
 166/-- A gate has enough phase support if its finite quotient sees a
 167non-identity phase in the divisor ledger.  This is intentionally abstract:
 168the next proof must instantiate it from prime phase distribution. -/
 169def GateHasPhaseSupport (n c : ℕ) : Prop :=
 170  ∃ _ : ResidualPhaseQuotient c, n = n
 171
 172/-- Prime phase equidistribution: trapped ledgers are eventually separated
 173by an admissible finite quotient. -/
 174structure PrimePhaseEquidistributionEngine : Prop where
 175  phase_support :
 176    ∀ n : ℕ, ResidualTrap n →
 177      ∃ c : ℕ, AdmissibleHardGate c ∧ GateHasPhaseSupport n c
 178
 179/-- Effective bounded search: the separating gate can be chosen below a
 180specific bound. -/
 181structure BoundedSearchEngine : Type where
 182  bound : ℕ → ℕ
 183  bound_ok :
 184    ∀ n : ℕ, ResidualTrap n →
 185      ∃ c : ℕ, c ≤ bound n ∧ AdmissibleHardGate c ∧ GateHasPhaseSupport n c
 186
 187/-- Reciprocal pair closure: once a gate has enough phase support, it yields
 188the actual reciprocal divisor-pair witness required by RCL. -/
 189structure ReciprocalPairClosureEngine : Prop where
 190  close :
 191    ∀ n c : ℕ, ResidualTrap n → AdmissibleHardGate c → GateHasPhaseSupport n c →
 192      GateClosureWitness n c
 193
 194/-- Stronger, fully arithmetic bounded search: the search returns the actual
 195balanced phase pair, not merely abstract phase support. -/
 196structure BoundedBalancedSearchEngine : Type where
 197  bound : ℕ → ℕ
 198  bound_ok :
 199    ∀ n : ℕ, ResidualTrap n →
 200      ∃ c : ℕ, c ≤ bound n ∧ AdmissibleHardGate c ∧ BalancedPairPhaseSupport n c
 201
 202/-- A finite-range bounded balanced-search certificate.  This is the form
 203that computation can honestly certify: all trapped `n ≤ maxN` have a gate
 204`c ≤ bound`. -/
 205structure FiniteBoundedBalancedSearchCert where
 206  maxN : ℕ
 207  bound : ℕ
 208  verified :
 209    ∀ n : ℕ, n ≤ maxN → ResidualTrap n →
 210      ∃ c : ℕ, c ≤ bound ∧ AdmissibleHardGate c ∧ BalancedPairPhaseSupport n c
 211
 212/-- A global engine implies every finite-range certificate. -/
 213theorem finite_cert_of_global_engine
 214    (engine : BoundedBalancedSearchEngine)
 215    (maxN : ℕ) :
 216    ∃ B : ℕ, ∀ n : ℕ, n ≤ maxN → ResidualTrap n →
 217      ∃ c : ℕ, c ≤ B ∧ AdmissibleHardGate c ∧ BalancedPairPhaseSupport n c := by
 218  classical
 219  let B : ℕ := (Finset.range (maxN + 1)).sup engine.bound
 220  refine ⟨B, ?_⟩
 221  intro n hnmax hntrap
 222  rcases engine.bound_ok n hntrap with ⟨c, hcbound, hc, hpair⟩
 223  refine ⟨c, ?_, hc, hpair⟩
 224  exact le_trans hcbound (Finset.le_sup (Finset.mem_range.mpr (Nat.lt_succ_of_le hnmax)))
 225
 226/-- Rotation separation + reciprocal closure solve the residual class. -/
 227theorem residual_trap_solved
 228    (phase : PrimePhaseEquidistributionEngine)
 229    (pair : ReciprocalPairClosureEngine)
 230    {n : ℕ} (hn : ResidualTrap n) :
 231    HasRationalErdosStrausRepr (n : ℚ) := by
 232  rcases phase.phase_support n hn with ⟨c, hc, hsupport⟩
 233  exact gate_closure_witness_gives_repr (pair.close n c hn hc hsupport)
 234
 235/-- A bounded search engine is a stronger form of prime phase separation. -/
 236theorem bounded_search_implies_phase_equidistribution
 237    (bounded : BoundedSearchEngine) :
 238    PrimePhaseEquidistributionEngine := by
 239  refine ⟨?_⟩
 240  intro n hn
 241  rcases bounded.bound_ok n hn with ⟨c, _hcbound, hc, hsupport⟩
 242  exact ⟨c, hc, hsupport⟩
 243
 244/-- Bounded search + reciprocal closure solve the residual class. -/
 245theorem bounded_residual_trap_solved
 246    (bounded : BoundedSearchEngine)
 247    (pair : ReciprocalPairClosureEngine)
 248    {n : ℕ} (hn : ResidualTrap n) :
 249    HasRationalErdosStrausRepr (n : ℚ) :=
 250  residual_trap_solved (bounded_search_implies_phase_equidistribution bounded) pair hn
 251
 252/-- A bounded balanced-search engine alone solves the residual class.  This is
 253the most concrete remaining target: find the gate and the reciprocal pair. -/
 254theorem bounded_balanced_search_solved
 255    (bounded : BoundedBalancedSearchEngine)
 256    {n : ℕ} (hn : ResidualTrap n) :
 257    HasRationalErdosStrausRepr (n : ℚ) := by
 258  rcases bounded.bound_ok n hn with ⟨c, _hcbound, _hc, hpair⟩
 259  exact balanced_pair_phase_support_gives_repr hpair
 260
 261end ErdosStrausRotationHierarchy
 262end NumberTheory
 263end IndisputableMonolith
 264

source mirrored from github.com/jonwashburn/shape-of-logic