"""New implementation validation; fixed seed, no original tile or earlier toy replay.""" import random,json,time,copy,itertools,resource from pathlib import Path from producer1123 import solve from checker1123 import verify,verify_sat,Invalid started=time.process_time();rng=random.Random(1123);cases=64;counts={'SAT':0,'UNSAT':0};branch_proof=None for case in range(cases): assert time.process_time()-started<34,'smoke budget' D=sorted(rng.sample(range(60),4+case%6));Q=[5,11] direct=any(all(any((s+b)%q in (0,q-2) for q,b in zip(Q,bs)) for s in D) for bs in itertools.product(range(5),range(11))) for hall in [False,True]: receipt,proof=solve(D,Q,hall,cpu_limit=.25,node_limit=10000,byte_limit=200000) assert receipt['status']==('SAT' if direct else 'UNSAT'),(case,receipt) if direct:verify_sat(D,Q,receipt['phases']) else: verify(proof,cpu_limit=.25) if branch_proof is None and any(row[0]=='b' for row in proof['nodes']):branch_proof=proof counts['SAT' if direct else 'UNSAT']+=1 assert branch_proof is not None,'no branch proof available for controls' controls={} branch_index=next(i for i,row in enumerate(branch_proof['nodes']) if row[0]=='b') # Four specific corruptions must fail in the independent checker. for kind in ['wrong_intersection','missing_branch','false_union','unsupported_deletion']: bad=copy.deepcopy(branch_proof) if kind=='wrong_intersection':bad['nodes'][branch_index][5].append([5,99]) elif kind=='missing_branch':bad['nodes'][branch_index][4]=bad['nodes'][branch_index][3] elif kind=='false_union': bad['nodes'][bad['root']]=['h',[0],[]] else: # Every root tuple initially has different-prime support in every # neighbour, so deleting one before any propagation is unsupported. s=bad['slots'][0];value=(-s)%5 bad['nodes'][bad['root']][-1].insert(0,[0,5,1<