diff --git a/research/complex-ck-b-frame-seed20/CERTIFICATE.json b/research/complex-ck-b-frame-seed20/CERTIFICATE.json new file mode 100644 index 0000000000..65ae8dc75a --- /dev/null +++ b/research/complex-ck-b-frame-seed20/CERTIFICATE.json @@ -0,0 +1,156 @@ +{ + "complete_local_histogram": [0,2596,552,304,160,70,8,0,8,0], + "fixed_outside_histogram": [0,1360,56,104,64,70,8,0,8,0], + "baseline_histogram": [ + 0, + 1236, + 496, + 200, + 96, + 0, + 0, + 0, + 0, + 0 + ], + "conditional_profiles": 2641, + "domain_sizes": { + "2": 418, + "5": 56 + }, + "evaluated": 4724, + "flexible_gates": 474, + "gates": 1930, + "induced_width": 5, + "max_conditional_frontier": 5, + "pinned_gates": 492, + "power_certificate": { + "baseline_power_optimal": true, + "exponent_interval": "0 < p < 1", + "largest_derivative_upper": "-21/25", + "strict_alternatives": 118 + }, + "registers": 716, + "source_sha256": "ae3018c0646be06f47d345bb8baf0e6ea9220096a949fa30a8f7656aa4ad6f45", + "final_frontier": [ + [0,1236,496,200,96,0,0,0,0,0], + [0,1239,493,201,96,0,0,0,0,0], + [0,1242,490,202,96,0,0,0,0,0], + [0,1243,492,199,97,0,0,0,0,0], + [0,1245,487,203,96,0,0,0,0,0], + [0,1248,488,196,100,0,0,0,0,0], + [0,1251,485,197,100,0,0,0,0,0], + [0,1254,482,198,100,0,0,0,0,0], + [0,1255,484,195,101,0,0,0,0,0], + [0,1257,479,199,100,0,0,0,0,0], + [0,1260,480,192,104,0,0,0,0,0], + [0,1263,477,193,104,0,0,0,0,0], + [0,1266,474,194,104,0,0,0,0,0], + [0,1267,476,191,105,0,0,0,0,0], + [0,1269,471,195,104,0,0,0,0,0], + [0,1272,472,188,108,0,0,0,0,0], + [0,1275,469,189,108,0,0,0,0,0], + [0,1278,466,190,108,0,0,0,0,0], + [0,1279,468,187,109,0,0,0,0,0], + [0,1281,463,191,108,0,0,0,0,0], + [0,1284,464,184,112,0,0,0,0,0], + [0,1287,461,185,112,0,0,0,0,0], + [0,1290,458,186,112,0,0,0,0,0], + [0,1291,460,183,113,0,0,0,0,0], + [0,1293,455,187,112,0,0,0,0,0], + [0,1296,456,180,116,0,0,0,0,0], + [0,1299,453,181,116,0,0,0,0,0], + [0,1302,450,182,116,0,0,0,0,0], + [0,1303,452,179,117,0,0,0,0,0], + [0,1305,447,183,116,0,0,0,0,0], + [0,1308,448,176,120,0,0,0,0,0], + [0,1311,445,177,120,0,0,0,0,0], + [0,1314,442,178,120,0,0,0,0,0], + [0,1315,444,175,121,0,0,0,0,0], + [0,1317,439,179,120,0,0,0,0,0], + [0,1320,440,172,124,0,0,0,0,0], + [0,1323,437,173,124,0,0,0,0,0], + [0,1326,434,174,124,0,0,0,0,0], + [0,1327,436,171,125,0,0,0,0,0], + [0,1329,431,175,124,0,0,0,0,0], + [0,1332,432,168,128,0,0,0,0,0], + [0,1335,429,169,128,0,0,0,0,0], + [0,1338,426,170,128,0,0,0,0,0], + [0,1339,428,167,129,0,0,0,0,0], + [0,1341,423,171,128,0,0,0,0,0], + [0,1344,424,164,132,0,0,0,0,0], + [0,1347,421,165,132,0,0,0,0,0], + [0,1350,418,166,132,0,0,0,0,0], + [0,1351,420,163,133,0,0,0,0,0], + [0,1353,415,167,132,0,0,0,0,0], + [0,1356,416,160,136,0,0,0,0,0], + [0,1359,413,161,136,0,0,0,0,0], + [0,1362,410,162,136,0,0,0,0,0], + [0,1365,407,163,136,0,0,0,0,0], + [0,1368,404,164,136,0,0,0,0,0], + [0,1371,401,165,136,0,0,0,0,0], + [0,1371,408,159,137,0,0,0,0,0], + [0,1374,398,166,136,0,0,0,0,0], + [0,1374,405,160,137,0,0,0,0,0], + [0,1377,395,167,136,0,0,0,0,0], + [0,1377,402,161,137,0,0,0,0,0], + [0,1378,404,158,138,0,0,0,0,0], + [0,1380,392,168,136,0,0,0,0,0], + [0,1380,399,162,137,0,0,0,0,0], + [0,1381,402,157,139,0,0,0,0,0], + [0,1383,389,169,136,0,0,0,0,0], + [0,1383,396,163,137,0,0,0,0,0], + [0,1384,400,156,140,0,0,0,0,0], + [0,1386,386,170,136,0,0,0,0,0], + [0,1386,393,164,137,0,0,0,0,0], + [0,1387,397,157,140,0,0,0,0,0], + [0,1389,383,171,136,0,0,0,0,0], + [0,1389,390,165,137,0,0,0,0,0], + [0,1390,394,158,140,0,0,0,0,0], + [0,1392,380,172,136,0,0,0,0,0], + [0,1392,387,166,137,0,0,0,0,0], + [0,1393,391,159,140,0,0,0,0,0], + [0,1395,384,167,137,0,0,0,0,0], + [0,1396,388,160,140,0,0,0,0,0], + [0,1398,381,168,137,0,0,0,0,0], + [0,1399,385,161,140,0,0,0,0,0], + [0,1399,392,155,141,0,0,0,0,0], + [0,1401,378,169,137,0,0,0,0,0], + [0,1402,382,162,140,0,0,0,0,0], + [0,1402,389,156,141,0,0,0,0,0], + [0,1404,375,170,137,0,0,0,0,0], + [0,1405,379,163,140,0,0,0,0,0], + [0,1405,386,157,141,0,0,0,0,0], + [0,1406,388,154,142,0,0,0,0,0], + [0,1407,372,171,137,0,0,0,0,0], + [0,1408,376,164,140,0,0,0,0,0], + [0,1408,383,158,141,0,0,0,0,0], + [0,1409,386,153,143,0,0,0,0,0], + [0,1411,373,165,140,0,0,0,0,0], + [0,1411,380,159,141,0,0,0,0,0], + [0,1412,384,152,144,0,0,0,0,0], + [0,1414,370,166,140,0,0,0,0,0], + [0,1414,377,160,141,0,0,0,0,0], + [0,1415,381,153,144,0,0,0,0,0], + [0,1417,367,167,140,0,0,0,0,0], + [0,1417,374,161,141,0,0,0,0,0], + [0,1418,378,154,144,0,0,0,0,0], + [0,1420,364,168,140,0,0,0,0,0], + [0,1420,371,162,141,0,0,0,0,0], + [0,1421,375,155,144,0,0,0,0,0], + [0,1423,368,163,141,0,0,0,0,0], + [0,1424,372,156,144,0,0,0,0,0], + [0,1426,365,164,141,0,0,0,0,0], + [0,1427,369,157,144,0,0,0,0,0], + [0,1429,362,165,141,0,0,0,0,0], + [0,1430,366,158,144,0,0,0,0,0], + [0,1432,359,166,141,0,0,0,0,0], + [0,1433,363,159,144,0,0,0,0,0], + [0,1435,356,167,141,0,0,0,0,0], + [0,1436,360,160,144,0,0,0,0,0], + [0,1439,357,161,144,0,0,0,0,0], + [0,1442,354,162,144,0,0,0,0,0], + [0,1445,351,163,144,0,0,0,0,0], + [0,1448,348,164,144,0,0,0,0,0] + ] +} diff --git a/research/complex-ck-b-frame-seed20/CLAIM.json b/research/complex-ck-b-frame-seed20/CLAIM.json new file mode 100644 index 0000000000..0aeebb54dc --- /dev/null +++ b/research/complex-ck-b-frame-seed20/CLAIM.json @@ -0,0 +1,23 @@ +{ + "track": "complex supplier", + "assignment_seed": 20, + "random_source": "Python secrets.randbelow(100), operating-system randomness", + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "object": "Selected PR626 CK provider, retained PR622 canonical word, simultaneous B-phase frame reassignment at fixed scalar gate order", + "method": "Exact F2 subspace lower/upper propagation and per-register rank-partition bounds on the paid recursive moment; preserve A, cut, tail, cleanup, boundaries and ownership", + "candidate_tasks": [ + "Additional signed K-triangles: covered by PR646", + "Coordinate-total factory resynthesis: overlaps PR681 and changed-dirt factory PR645", + "Fixed-order CK B-phase frame retiming: selected; seed 20 modulo 2 selects CK rather than JP8" + ], + "expected_deliverable": "One finite improving frame witness or a scoped negative certificate with a reproducible checker and controls; no unsupported kappa claim", + "expected_finish_utc": "2026-10-13T04:33:00Z", + "coordination": "No pinned issues and no open sprint/coordination issue found. Local claim, with open PR overlap checks.", + "overlap_snapshot": "501 open PRs through #681; PR661 supplies a related bit-frame barrier, while this object has complex F2-labelled frames and fixed CK tail interfaces", + "status": "completed: scoped negative result, no new kappa", + "result": "All 474 flexible gates in the selected CK B phase were eliminated over their complete F2 subspace domains. The baseline paid histogram is optimal for every 0 < p < 1 at fixed scalar order and exact end-of-B frames. All 118 distinct retained alternatives are strictly worse.", + "result_link": "https://github.com/CrocSwap/integer-mult-bounds/pull/698", + "evidence": "README.md and CERTIFICATE.json; reproduce with python3 -B research/complex-ck-b-frame-seed20/check.py", + "final_overlap": "513 open PRs through #693, followed immediately by review of #694-#697. #696 lowers scalar primitives with unchanged frames; #697 changes source access and helper count. Neither overlaps this fixed-circuit frame barrier.", + "completed_utc": "2026-10-13T04:22:26Z" +} diff --git a/research/complex-ck-b-frame-seed20/README.md b/research/complex-ck-b-frame-seed20/README.md new file mode 100644 index 0000000000..c3d9adf6e9 --- /dev/null +++ b/research/complex-ck-b-frame-seed20/README.md @@ -0,0 +1,213 @@ +# A fixed-boundary frame barrier for the selected CK supplier + +**Scoped negative result. No new kappa.** The selected CK complex supplier's +1,930 B-phase scalar gates already minimize their paid recursive moment among +all simultaneous frame reassignments that preserve their order, operands and +exact end-of-B register frames. This holds for every power `0 < p < 1`, with +cost `sum H[r] * r**p`. The allowed frames are all subspaces of `F_2^9`, including +ones absent from the retained frame catalogue. + +This closes a specific optimization class. It does not claim unique frames, +optimality after reordering or resynthesis, optimality with changed B boundaries, +or optimality of the JP8 provider. The scalar word and every existing repository +file remain unchanged. + +## Reproduce + +From the repository root, using Python 3.11 or later and its standard library: + +```sh +python3 -B research/complex-ck-b-frame-seed20/check.py +``` + +The command checks the source pins, reconstructs the complete frame domains, +recomputes [CERTIFICATE.json](CERTIFICATE.json), and runs the independent +enumeration checks and negative controls. The core receipt prints: + +```text +PASS_CK_FIXED_END_B_FRAME_BOUND gates=1930 flexible=474 profiles=119 exponent=0
=0` and `a+2*b+3*c+4*d=0` for all 118 +alternatives. Thus `D(1)=0`. It also certifies `D'(1)<0` exactly: + +```text +D'(1) = (2*b+8*d)*log(2) + 3*c*log(3). +``` + +Eight terms of the rational atanh series, with its geometric remainder, prove +`69/100 < log(2) < 7/10` and `109/100 < log(3) < 11/10`. Substituting the +appropriate endpoint for each coefficient gives a strictly negative upper +bound in every case. The largest is `-21/25`. + +If `c>=0`, then `D'(p)/2**p` is nondecreasing in `p`, because its nonconstant +terms have nonnegative coefficients and bases greater than one. If `c<0`, use +`D'(p)/3**p`: the term with coefficient `b*log(2)` has base `2/3`, so it is +nondecreasing because `b<=0`; the `d*log(4)` term has base `4/3` and is also +nondecreasing. The remaining term is constant. In either case `D'(1)<0` implies +`D'(p)<0` for `p<1`. Integrating to `D(1)=0` gives `D(p)>0` for `0
0 and n & (n - 1) == 0 + return n.bit_length() - 1 + + +def operands(gate): + assert gate[0] in ('add', 'scale') + return gate[1:3] if gate[0] == 'add' else gate[1:2] + + +def interval(lower, upper): + """Enumerate the entire subspace interval, including uncatalogued frames.""" + assert lower <= upper + found = {lower} + todo = [lower] + while todo: + frame = todo.pop() + for vector in sorted(upper - frame): + enlarged = frame | frozenset(x ^ vector for x in frame) + if enlarged not in found: + found.add(enlarged) + todo.append(enlarged) + return sorted(found, key=lambda x: (rank(x), tuple(sorted(x)))) + + +def histogram(ranks): + counts = Counter(r for r in ranks if r) + assert all(0 < r <= 9 for r in counts) + return tuple(counts[r] for r in range(10)) + + +ZERO = (0,) * 10 + + +def plus(left, right): + return tuple(a + b for a, b in zip(left, right)) + + +def dominates(left, right): + """Sufficient exact order for every concave power r**p, 0 < p < 1.""" + if sum(r * n for r, n in enumerate(left)) != sum(r * n for r, n in enumerate(right)): + return False + return all(sum(min(r, k) * (a - b) for r, (a, b) in enumerate(zip(left, right))) <= 0 + for k in range(1, 10)) + + +def problem(word): + frames = list(map(span, word['frames'])) + gates = word['B'] + start = [frames[f] for f in word['start']] + for gate in word['A']: + for register in operands(gate): + assert start[register] <= frames[gate[-1]] + start[register] = frames[gate[-1]] + end = start.copy() + last = {} + for i, gate in enumerate(gates): + for register in operands(gate): + assert end[register] <= frames[gate[-1]] + end[register] = frames[gate[-1]] + last[register] = i + pinned = set(last.values()) + current = start.copy() + lower = [] + for i, gate in enumerate(gates): + frame = frames[gate[-1]] if i in pinned else span( + x for register in operands(gate) for x in current[register]) + lower.append(frame) + for register in operands(gate): + assert current[register] <= frame + current[register] = frame + current = end.copy() + upper = [None] * len(gates) + for i in reversed(range(len(gates))): + gate = gates[i] + frame = frames[gate[-1]] if i in pinned else frozenset.intersection( + *(current[register] for register in operands(gate))) + upper[i] = frame + for register in operands(gate): + assert frame <= current[register] + current[register] = frame + domains = {} + for i, (lo, hi) in enumerate(zip(lower, upper)): + assert lo <= frames[gates[i][-1]] <= hi + if lo != hi: + domains[i] = interval(lo, hi) + # A factor charges one register transition, with exact inclusion enforced. + factors = [] + previous = [None] * len(start) + for i, gate in enumerate(gates): + for register in operands(gate): + j = previous[register] + keys = tuple(x for x in (j, i) if x in domains) + table = {} + for values in itertools.product(*(range(len(domains[x])) for x in keys)): + assignment = dict(zip(keys, values)) + before = domains[j][assignment[j]] if j in domains else ( + frames[gates[j][-1]] if j is not None else start[register]) + after = domains[i][assignment[i]] if i in domains else frames[gate[-1]] + if before <= after: + table[values] = histogram([rank(after) - rank(before)]) + assert table + factors.append((keys, table)) + previous[register] = i + return frames, start, end, pinned, domains, factors + + +def pareto(histograms): + """Keep every profile not excluded by exact concave dominance.""" + kept = [] + for candidate in sorted(set(histograms)): + if any(dominates(old, candidate) for old in kept): + continue + kept = [old for old in kept if not dominates(candidate, old)] + kept.append(candidate) + return tuple(kept) + + +def combine(left, right): + return pareto(plus(a, b) for a in left for b in right) + + +def eliminate(domains, initial_factors): + """Exact min-fill elimination retaining all incomparable paid profiles.""" + factors = [(keys, {values: (profile,) for values, profile in table.items()}) + for keys, table in initial_factors] + remaining = set(domains) + evaluated = width = max_frontier = 0 + conditional_profiles = 0 + while remaining: + graph = {x: set() for x in remaining} + for keys, table in factors: + for x in keys: + graph[x].update(set(keys) - {x}) + def priority(x): + neighbors = graph[x] + missing = sum(b not in graph[a] for a in neighbors for b in neighbors if a < b) + return missing, len(neighbors), x + selected = min(remaining, key=priority) + bucket = [(keys, table) for keys, table in factors if selected in keys] + factors = [(keys, table) for keys, table in factors if selected not in keys] + separator = tuple(sorted(set().union(*(set(keys) for keys, table in bucket)) - {selected})) + width = max(width, len(separator)) + reduced = {} + for values in itertools.product(*(range(len(domains[x])) for x in separator)): + assignment = dict(zip(separator, values)) + candidates = [] + for value in range(len(domains[selected])): + evaluated += 1 + assignment[selected] = value + total = (ZERO,) + for keys, table in bucket: + contribution = table.get(tuple(assignment[x] for x in keys)) + if contribution is None: + break + total = combine(total, contribution) + else: + candidates.extend(total) + if not candidates: + continue + # Eliminated register ranks telescope; separators fix the mass. + assert len({sum(r * n for r, n in enumerate(h)) for h in candidates}) == 1 + frontier = pareto(candidates) + max_frontier = max(max_frontier, len(frontier)) + conditional_profiles += len(frontier) + reduced[values] = frontier + assert reduced + factors.append((separator, reduced)) + remaining.remove(selected) + result = (ZERO,) + for keys, table in factors: + assert keys == () and set(table) == {()} + result = combine(result, table[()]) + return result, dict(evaluated=evaluated, induced_width=width, + max_conditional_frontier=max_frontier, + conditional_profiles=conditional_profiles) + + +def recount(word, frames, start, end, assigned): + current = start.copy() + increments = [] + for i, gate in enumerate(word['B']): + frame = assigned.get(i, frames[gate[-1]]) + for register in operands(gate): + assert current[register] <= frame + increments.append(rank(frame) - rank(current[register])) + current[register] = frame + assert current == end + return histogram(increments) + + +def outside_profile(word, frames, end): + current = [frames[f] for f in word['start']] + increments = [] + def climb(register, frame): + assert current[register] <= frame + increments.append(rank(frame) - rank(current[register])) + current[register] = frame + for gate in word['A']: + for register in operands(gate): + climb(register, frames[gate[-1]]) + for register, frame_id in zip(word['centers'], word['center_frames']): + previous = frames[frame_id] + assert current[register] == previous + served = {word['target_levels'].get(str(gate[1] - word['v']), 0) + for gate in word['cut'] if gate[2] == register} + for frame_id in sorted(served, key=lambda f: -rank(frames[f])): + frame = frames[frame_id] + assert frame <= previous + increments.append(rank(previous) - rank(frame)) + previous = frame + current = end.copy() + for gate in word['tail']: + for register in operands(gate): + climb(register, frames[gate[-1]]) + for register, frame_id in enumerate(word['final']): + climb(register, frames[frame_id]) + return histogram(increments) + + +def log_bounds(value): + """Eight terms of log(x)=2*atanh((x-1)/(x+1)), with geometric tail.""" + z = Fraction(value - 1, value + 1) + lower = 2 * sum((z ** (2 * k + 1) / (2 * k + 1) for k in range(8)), Fraction(0)) + upper = lower + 2 * z ** 17 / (17 * (1 - z * z)) + return lower, upper + + +def power_certificate(baseline, frontier): + """Certify every retained alternative is worse for all 0 < p < 1.""" + for value, lower, upper in [(2, Fraction(69, 100), Fraction(7, 10)), + (3, Fraction(109, 100), Fraction(11, 10))]: + lo, hi = log_bounds(value) + assert lower < lo < hi < upper + bounds = [] + assert baseline in frontier + for alternative in frontier: + delta = tuple(a - b for a, b in zip(alternative, baseline)) + if not any(delta): + continue + assert delta[0] == 0 and not any(delta[5:]) + a, b, c, d = delta[1:5] + assert b <= 0 and d >= 0 and a + 2*b + 3*c + 4*d == 0 + # D'(1)=(2b+8d)log(2)+3c*log(3); README proves why its sign suffices. + x, y = 2*b + 8*d, 3*c + upper = x * (Fraction(7, 10) if x > 0 else Fraction(69, 100)) + upper += y * (Fraction(11, 10) if y > 0 else Fraction(109, 100)) + assert upper < 0 + bounds.append(upper) + return dict(strict_alternatives=len(bounds), + largest_derivative_upper=str(max(bounds)), + exponent_interval='0 < p < 1', baseline_power_optimal=True) + + +def analyze(word): + frames, start, end, pinned, domains, factors = problem(word) + frontier, stats = eliminate(domains, factors) + baseline = recount(word, frames, start, end, {}) + outside = outside_profile(word, frames, end) + full = tuple(int(word['local_profile'].get(str(r), 0)) for r in range(10)) + assert plus(baseline, outside) == full + return dict(gates=len(word['B']), registers=len(start), pinned_gates=len(pinned), + flexible_gates=len(domains), domain_sizes=dict(sorted(Counter(map(len, domains.values())).items())), + baseline_histogram=baseline, final_frontier=frontier, + fixed_outside_histogram=outside, complete_local_histogram=full, + power_certificate=power_certificate(baseline, frontier), + **stats) + + +if __name__ == '__main__': + pins = json.loads((HERE / 'SOURCES.json').read_text()) + for path, expected_hash in pins['files'].items(): + assert hashlib.sha256((ROOT / path).read_bytes()).hexdigest() == expected_hash, path + assert hashlib.sha256(SOURCE.read_bytes()).hexdigest() == SOURCE_SHA256, 'source pin mismatch' + word = json.loads(gzip.decompress(SOURCE.read_bytes())) + result = analyze(word) + result['source_sha256'] = SOURCE_SHA256 + expected = json.loads((HERE / 'CERTIFICATE.json').read_text()) + assert json.loads(json.dumps(result)) == expected, 'certificate mismatch' + print('PASS_CK_FIXED_END_B_FRAME_BOUND gates=1930 flexible=474 profiles=119 exponent=0