"""Pinpoint the reported s=7 counterexample and the changed boundary contract.""" import hashlib,importlib.util,itertools,json,math,pathlib p=pathlib.Path(__file__).parent source=p/'verify_phase_collapse.py' assert hashlib.sha256(source.read_bytes()).hexdigest()=='36d75a08244a29663aa3e96f493659b9673ca1782e359de31bc0753e41ddbc6a' spec=importlib.util.spec_from_file_location('claim',source);claim=importlib.util.module_from_spec(spec);spec.loader.exec_module(claim) P=210;Q=(11,13) R=[v for v in range(P) if math.gcd(v*(v+2),P)==1] def phase_cover(values): for phases in itertools.product(*[range(q) for q in Q]): if all(any(v%q in (a,(a-2)%q) for q,a in zip(Q,phases)) for v in values):return phases return None flat=[197,209,11,17];lifted=[197,209,221,227] assert all(math.gcd(v*(v+2),P)==1 for v in lifted) assert [v for v in range(197,228) if math.gcd(v*(v+2),P)==1]==lifted flat_phases=phase_cover(flat);lifted_phases=phase_cover(lifted) assert flat_phases is not None and lifted_phases is None cover3=[];cover4=[] for i in range(len(R)): w=[R[(i+j)%len(R)]+((i+j)//len(R))*P for j in range(4)] a3=phase_cover(w[:3]);a4=phase_cover(w) if a3 is not None:cover3.append({'positions':w[:3],'phases':a3}) if a4 is not None:cover4.append({'positions':w,'phases':a4}) assert cover3 and not cover4 period=P*math.prod(Q);run=best=0 for v in range(2*period): if math.gcd(v*(v+2),P)!=1:continue run=run+1 if any(v%q in (0,q-2) for q in Q) else 0 best=max(best,run) assert best==3 and claim.reduced_Kstar(7)==4 and claim.true_and_cross(7)[0]==3 result={'passed':True,'s':7,'P':P,'Q':Q,'base_slot_count':len(R),'flattened_counterexample':{'positions':flat,'covering_phases':flat_phases},'properly_lifted_window':{'positions':lifted,'covering_phases':lifted_phases},'direct_full_period_K':best,'all_lifted_starts_length3_covers':len(cover3),'all_lifted_starts_length4_covers':len(cover4),'author_reduced_K':4,'conclusion':'The author test drops the period increment. Its mismatch is real for that mutant, but does not test the original engine which keeps actual positions beyond P.'} (p/'spot-results.json').write_text(json.dumps(result,indent=2),encoding='utf-8');print(json.dumps(result))