"""Read-only checks of captured evidence; does not execute the census or gcd certificates. Usage: python3 audit_inputs.py INPUT_ROOT OUTPUT_JSON Stage return #2061's 12 original files in INPUT_ROOT/2061 and the three #2006 dependencies named in EXPECTED in INPUT_ROOT/2006. Preserve raw bytes. """ import hashlib, json, pathlib, sys EXPECTED = [{'path': '2061/census4495.py', 'sha256': '1bc6f4986208470f9751ecc2b4cf07a49318eb2ceb0e0fbaaa7cdc450b067eb8', 'bytes': 6619}, {'path': '2061/fresh4495.py', 'sha256': '4ce18ceda0c468ee98f06abef4bf55372df9b0f3f15546efdb76a514295e0008', 'bytes': 12887}, {'path': '2061/fresh4495.out', 'sha256': 'b022b4bb74b9005677472643baa3b697c845d7e00febe6af064556c7d490f87e', 'bytes': 6847}, {'path': '2061/fresh4495.run1.out', 'sha256': '412ca3233f91a4ba3c205de025b6534ab31bc71e9e890c9b050261d43c784880', 'bytes': 6147}, {'path': '2061/fresh4495.json', 'sha256': '5b5c927af472fc827fc5c7070ec8d23785d4cd9543c3a9bc31f21f38d274871c', 'bytes': 8115}, {'path': '2061/ext4495.py', 'sha256': 'c6075d91d1087bde2d2c7e5a84e2b6c2a45d11becabba1699258d61506962243', 'bytes': 4806}, {'path': '2061/ext4495.out', 'sha256': '85bc59345e1580496f98aec499f8eccc34c6b9306061e7eb65ed05ebb3ddf850', 'bytes': 972}, {'path': '2061/ext4495.json', 'sha256': '3fe204be7296743a5a0cfb49c539dc7ce2404421e16ab2382bab864040ffc104', 'bytes': 17815}, {'path': '2061/split4495.py', 'sha256': 'bf9e6b51347f626573096e91fa48bbd1beb12f38fd34244e4789569f877ee96b', 'bytes': 2151}, {'path': '2061/split4495.out', 'sha256': '1143e31b35994d40c89169abd0a4794790335263382ad0f508c2d00069353db5', 'bytes': 930}, {'path': '2061/prior_art4495.md', 'sha256': 'c8bac854784bf6726c785e4fe93a31f5d6c11073a9aa2ee6a2e567ab9b30e352', 'bytes': 1227}, {'path': '2061/evidence4495.md', 'sha256': '4fa9672288dbe2da2518c761910ba00634043ddc92a483f92dfcbeac51210678', 'bytes': 3456}, {'path': '2006/crtmodel.py', 'sha256': 'b517d40f8885f61ce520c772c40228ca211c1d4b54c50e1d96e2b3a0df5c7290', 'bytes': 6797}, {'path': '2006/classifier.py', 'sha256': '45442f7d2d642ace3bddf061fc85f9e604f9adfc4d7e206ac7644be060a5df8c', 'bytes': 2733}, {'path': '2006/classifier.json', 'sha256': '97769942f47e0a653e0654454aca25c3f299406f1e4a89b786c1aef4424786cc', 'bytes': 6953}] root = pathlib.Path(sys.argv[1]) checks = [] for f in EXPECTED: b = (root / f['path']).read_bytes() h = hashlib.sha256(b).hexdigest() assert h == f['sha256'] and len(b) == f['bytes'], f['path'] checks.append({**f, 'hash_matches': True, 'bytes_match': True}) fresh = json.loads((root / '2061/fresh4495.json').read_text()) ext = json.loads((root / '2061/ext4495.json').read_text()) def verdict(name): lines = (root / ('2061/' + name)).read_text().splitlines() return json.loads(next(s[8:] for s in lines if s.startswith('VERDICT '))) fv = verdict('fresh4495.out') ev = verdict('ext4495.out') assert fv['G1'] is False and all(fv[k] is True for k in ['G1a','G1b_posthoc','G2','G3','G4']) assert len(fresh['g2']) == 20 and all(r['ok'] is True for r in fresh['g2']) levels = [23,29,31,37,41,43] assert [(r['x'],r['G'],r['sum_count']) for r in fresh['g3']] == list(zip(levels,[204,258,348,528,546,618],[4,2,4,2,4,8])) assert all(r['cert_G_nonzero'] == 0 and r['sum_cert_Gm6'] == r['sum_count'] and r['ok'] is True for r in fresh['g3']) assert sum(len(r['positions']) for r in fresh['positions'].values()) == 24 assert all(r['direct_gcd_ok'] is True and r['sigma_closed'] is True for r in fresh['positions'].values()) assert ev['G5a'] is True and ev['G5b'] is True and ev['G2_47'] == ext['G2_47'] == 708 assert ev['nmax_47'] == sum(ext['count'].values()) == len(ext['positions']) == 4 assert ev['positions'] == ext['positions'] and ev['residues19'] == sorted(map(int,ext['count'])) assert len(ext['cert666_copies']) == 586 assert len(ext['orbits']) == 2 result = {'schema':'captured-evidence-audit-v1','inputs':checks, 'checks_passed':True,'fresh_verdict':fv,'extension_verdict':ev, 'g2_pairs':20,'earlier_positions':24,'extension_positions':4, 'g1_original_equality_matches':sum(r['crt_count_equals_shorter_window_count'] for r in fresh['g1']), 'g1_extras':sum(r['extras'] for r in fresh['g1']), 'g1b_posthoc_matches':sum(r[3] for r in fresh['g1b_posthoc']), 'cert666_captured_copies':586, 'limits':'Hash and captured-data consistency only; no census, sieve or gcd execution by this reviewer.'} pathlib.Path(sys.argv[2]).write_text(json.dumps(result,indent=2,sort_keys=True)+'\n') print('PASS: 15 original-file hashes and byte lengths; captured gates and JSON agree. No scientific rerun.')