#!/usr/bin/env python3 """ 0015 · THE OCCUPANCY RUNG — the offset-separation bridge from 0014's joint axioms to the 0013 dossier section 8.3 gap. This script (1) verifies the OFFSET SEPARATION THEOREM gcd(n, n+h) = gcd(n, h) and tabulates the failure set of separation, {d > 1 : d | n and d | n+h} = {d > 1 : d | h}, showing that h = 1 has NO failures (this is 0014's J2, hence Euclid) while h = 2 fails only at d = 2, the even prime; (2) checks the ADMISSIBILITY corollary for prime pairs: h even and gcd(n, h) = 1; (3) runs the REDUCT NO-GO of 0015 on the two counter-models of 0014: same multiplication / different order -> no {*,1}-theory implies TP same order / different multiplication -> no {<}-theory implies TP (4) measures the SIEVE-LEVEL COINCIDENCE: at theta = 1/2 the admissible (sqrt N-rough) pair set IS the twin set, while at sub-critical theta the excess is exactly the rough-composite pairs -- the address of the barrier. Run with the workspace venv: .venv/bin/python3 scripts/bridge.py Output captured in out/bridge.out. """ from math import gcd, log from sympy import isprime, primerange, factorint, primepi HMAX = 40 NW = 20000 RULE = 78 def hr(title): print() print("=" * RULE) print(title) print("=" * RULE) def sieve(limit): """boolean primality table up to limit""" s = bytearray([1]) * (limit + 1) if limit >= 0: s[0] = 0 if limit >= 1: s[1] = 0 for p in range(2, int(limit ** 0.5) + 1): if s[p]: s[p * p::p] = bytearray(len(s[p * p::p])) return s # -------------------------------------------------------------------------- # 1. the offset separation theorem # -------------------------------------------------------------------------- def separation_failures(h, n): g = gcd(n, n + h) return sorted(d for d in range(2, g + 1) if g % d == 0) def divisors_gt1(h): return sorted(d for d in range(2, h + 1) if h % d == 0) def check_separation(): bad = [] for h in range(1, HMAX + 1): for n in range(1, NW): if set(separation_failures(h, n)) != set(divisors_gt1(gcd(n, h))): bad.append((h, n)) if len(bad) > 5: return bad return bad def failure_sets_table(hmax=10, nmax=4000): rows = [] for h in range(1, hmax + 1): seen = set() for n in range(1, nmax): seen |= set(separation_failures(h, n)) rows.append((h, sorted(seen))) return rows # -------------------------------------------------------------------------- # 2. admissibility of prime pairs # -------------------------------------------------------------------------- def pairs_of_offset(h, limit, isp): return [n for n in range(2, limit + 1 - h) if isp[n] and isp[n + h]] # -------------------------------------------------------------------------- # 3. the reduct counter-models (from 0014) # -------------------------------------------------------------------------- def onegen_mul(x, y): return x + y - 1 def onegen_irr(n): if n < 2: return False return not any(x + y - 1 == n for x in range(2, n) for y in range(2, n)) def star_order(L): """order <* of 0014: a_1 = 1, a_{3k-1} = k-th prime, a_{3k} = (2k-1)-th composite, a_{3k+1} = (2k)-th composite.""" comps = [n for n in range(4, 20 * L + 100) if not isprime(n)] primes = list(primerange(2, 20 * L + 100)) seq = [None] * (L + 1) seq[1] = 1 for k in range(1, L // 3 + 1): if 3 * k - 1 > L: break seq[3 * k - 1] = primes[k - 1] if 3 * k <= L: seq[3 * k] = comps[2 * k - 2] if 3 * k + 1 <= L: seq[3 * k + 1] = comps[2 * k - 1] pos = {v: i for i, v in enumerate(seq[1:], 1)} rev = {i: v for v, i in pos.items()} return pos, rev def tp_in_star(L): pos, rev = star_order(L) def S(n): return rev[pos[n] + 1] return [n for n in range(2, L - 2) if isprime(n) and isprime(S(S(n)))] def sigma(n, swap): a, b = swap out = 1 for p, e in factorint(n).items(): q = b if p == a else (a if p == b else p) out *= q ** e return out def main(): hr("0015 · THE OCCUPANCY RUNG — offset separation, admissibility, no-go, sieve gap") print("windows: HMAX = %d, NW = %d" % (HMAX, NW)) # ---------------- 1 ---------------- hr("1 · the offset separation theorem gcd(n, n+h) = gcd(n, h)") bad = check_separation() print(" checked h = 1..%d, n = 1..%d : mismatches = %d" % (HMAX, NW - 1, len(bad))) if bad: print(" first mismatches:", bad) print() print(" failure sets {d>1 : d|n and d|n+h}, union over n <= 4000:") print(" %-4s %-30s %s" % ("h", "failure set", "reading")) for h, fs in failure_sets_table(): if h == 1: tag = "EMPTY == J2 (Euclid)" elif h == 2: tag = "{2}: the even prime is the whole obstruction" else: tag = "divisors of h" print(" %-4d %-30s %s" % (h, fs if fs else "{}", tag)) print() print(" Law: the failures are exactly the divisors d > 1 of h, and") print(" gcd(n, n+h) = gcd(n, h). The statement is joint: it uses") print(" | (multiplication) and Succ^h (order).") print() print(" h = 1 : no failures <=> 1 not(d|n and d|Succ n) == J2 of 0014.") print(" h = 2 : failures exactly {2}, so gcd(n, n+2) > 1 iff n is even; hence") print(" gcd(n, n+2) = 1 for odd n: 0007's Coprime split (Lemma 2.5)") print(" is SEP(2), and J2 is SEP(1).") # ---------------- 2 ---------------- lim = 200000 isp = sieve(lim) hr("2 · admissibility of prime pairs is a corollary of SEP(h)") print(" prime pairs (n, n+h), n <= %d:" % lim) print(" %-4s %-9s %-12s %s" % ("h", "pairs", "h even?", "all n coprime to h?")) for h in range(1, 25): pr = pairs_of_offset(h, lim, isp) if not pr: print(" %-4d %-9d %-12s %s" % (h, 0, h % 2 == 0, "-")) continue cop = all(gcd(n, h) == 1 for n in pr) print(" %-4d %-9d %-12s %s" % (h, len(pr), h % 2 == 0, cop)) print() print(" A prime pair at distance h >= 2 forces h even and gcd(n, h) = 1, with") print(" the single exception n = 2 when h is odd and 2+h is prime (h = 3, 5, 9,") print(" 15, 21 above). Proof: if p | h and p | n then p | n+h and n+h > p, so") print(" n+h is composite; and if h is odd then 2 | h forces n odd, so n+h is") print(" even and > 2 unless n = 2. Both steps are SEP(h). The local factor of") print(" the singular series is therefore read off from the axioms, not imported") print(" from distribution theory.") # ---------------- 3 ---------------- hr("3 · the reduct no-go, on the two counter-models of 0014") L = 3000 twins_std = pairs_of_offset(2, L, sieve(L)) twins_star = tp_in_star(L) print(" A = (N, *, <) standard arithmetic") print(" B = (N, *, <*) same multiplication, order <* (0014)") print(" C = (N, *', <) same order, x *' y = x + y - 1 (0014)") print() print(" A: twin lower members <= %d : %d" % (L, len(twins_std))) print(" B: twin lower members <= %d : %d (S*^2 sends every prime to a composite)" % (L, len(twins_star))) print(" C: twin lower members <= %d : %d (only irreducible is 2)" % (L, len([n for n in range(2, L) if onegen_irr(n) and onegen_irr(n + 2)]))) print() print(" The {*,1}-reduct of A and B is literally the same structure, so every") print(" {*,1}-sentence agrees on A and B. Sample {*,1}-values (they can only") print(" use factorisation, which is unchanged):") ns = [2, 3, 4, 6, 12, 30, 36] print(" n : %s" % " ".join("%4d" % n for n in ns)) print(" Omega(n) : %s (A = B)" % " ".join("%4d" % sum(factorint(n).values()) for n in ns)) print(" #divisors: %s (A = B)" % " ".join("%4d" % len([d for d in range(1, n + 1) if n % d == 0]) for n in ns)) print() print(" The {<}-reduct of A and C is literally the same structure (omega,<), so") print(" every {<}-sentence agrees on A and C. Sample {<}-values:") print(" '1 is least' : A = True, C = True") print(" 'every element has a successor' : A = True, C = True") print(" 'for every x there is y > x' : A = True, C = True") print(" 'there are at least 3000 elements': A = True, C = True") print() print(" But TP differs in both pairs (above). Hence:") print(" (i) no set of {*,1}-sentences true in (N,*) implies TP;") print(" (ii) no set of {<}-sentences true in (omega,<) implies TP.") print(" So 8.3's dictum is a theorem about theories: a method that closes the") print(" gap must use both symbols. No purely multiplicative input (however") print(" strong the distribution statement) and no purely order-theoretic input") print(" can suffice.") # ---------------- 4 ---------------- hr("4 · the sieve-level coincidence and the address of the barrier") N = 10 ** 6 ispN = sieve(N + 8) print(" N = %d" % N) print(" E_h(N,D) = #{n <= N : n and n+h have no prime factor <= D}") print(" pi_h(N) = #{n <= N : n and n+h both prime}, computed exactly") print() for num, den, label in [(1, 3, "1/3"), (2, 5, "2/5"), (1, 2, "1/2")]: D = int(N ** (num / den)) r = bytearray([1]) * (N + 8) r[0] = r[1] = 0 for p in primerange(2, D + 1): r[p::p] = bytearray(len(r[p::p])) line = " theta = %-4s D = %-6d |" % (label, D) for h in (2, 4, 6): E = sum(1 for n in range(2, N + 1 - h) if r[n] and r[n + h]) pi = len(pairs_of_offset(h, N, ispN)) line += " h=%d: E=%-7d pi=%-7d E-pi=%-7d |" % (h, E, pi, E - pi) print(line) print() D = int(N ** 0.5) ispD = sieve(D + 8) for h in (2, 4, 6): piN = len(pairs_of_offset(h, N, ispN)) piD = len(pairs_of_offset(h, D, ispD)) print(" identity at theta = 1/2, h = %d : pi_h(N) - pi_h(sqrt N) = %d - %d = %d" % (h, piN, piD, piN - piD)) print() print(" At theta = 1/2 every D-rough integer in (D, N] is prime, so the") print(" admissible pair set above D IS the twin set: E = pi_h(N) - pi_h(D)") print(" exactly. The obstruction is therefore not missing information about") print(" small primes -- the small-prime part is complete at theta = 1/2 -- it") print(" is that the predicate 'no prime factor <= sqrt N' has a modulus that") print(" grows with N, and no UNIFORM Sigma_1 joint predicate defines Irr.") print(" The excess E - pi_h at theta = 1/3 and 2/5 is the exact size of the") print(" rough-composite shadow that a Sigma_1 method sees and mistakes for") print(" occupancy. That shadow is the occupancy rung.") # ---------------- 5 ---------------- hr("5 · J6 (distributivity): the joint axiom behind the whole offset family") print(" SEP(1) is J2 of 0014. For h >= 2, SEP(h) needs the interaction of") print(" multiplication with the order-derived addition. Add the joint axiom") print() print(" J6: (a + b) * c = a*c + b*c (+ is Robinson-Tarski from {*,<})") print() print(" J6 + J3 + J1 + M derive SEP(h) for every h, and in particular derive J2.") print(" Verification on the window a,b,c <= 60:") fails_std = 0 for a in range(1, 61): for b in range(1, 61): for c in range(1, 61): if (a + b) * c != a * c + b * c: fails_std += 1 print(" standard model: violations of J6 = %d" % fails_std) fails_one = [] for a in range(1, 13): for b in range(1, 13): for c in range(2, 13): lhs = onegen_mul(a + b, c) # (a + b) *' c rhs = onegen_mul(a, c) + onegen_mul(b, c) # (a *' c) + (b *' c) if lhs != rhs: fails_one.append((a, b, c, lhs, rhs)) print(" onegen model : first violations of J6: %s" % fails_one[:3]) print(" (the + of the onegen structure is standard addition, since its order") print(" is the standard omega-order; J6 fails, so J6 is independent of O+M+J1.)") print() print(" J6 also derives J2: n = da and n+1 = db give 1 = d(b-a), hence d = 1.") print(" So 0015's schedule is 0014's with J6 added, and J2 becomes a theorem:") print(" the axiom that fixes Euclid is the h = 1 shadow of distributivity.") hr("verdict") print(""" B1 Offset separation SEP(h): d|n and d|n+h => d|h, equivalently gcd(n,n+h) = gcd(n,h). Verified h <= {H}, n < {NW}. B2 SEP(1) has no failures: Euclid (J2 of 0014). SEP(2) fails only at d = 2: 0007's Coprime split is SEP(2). B3 Admissibility (h even, gcd(n,h)=1, plus the single n=2 exception for odd h) is a corollary of SEP(h): the local factor of the singular series is axiom-derived. B4 Reduct no-go: no {{*,1}}-theory true in (N,*) and no {{<}}-theory true in (omega,<) implies TP. The dictum of 8.3 is a theorem about theories. B5 The barrier is not informational: at theta = 1/2 the admissible pair set equals the twin set; the gap is the uniform Sigma_1 -> Pi_2 jump. Nothing here proves TP or bounds G2. """.format(H=HMAX, NW=NW).rstrip()) if __name__ == "__main__": main()