diff --git a/research/triadic-query-pair/CERTIFICATE.json b/research/triadic-query-pair/CERTIFICATE.json new file mode 100644 index 0000000000..8aaa553dc5 --- /dev/null +++ b/research/triadic-query-pair/CERTIFICATE.json @@ -0,0 +1,153 @@ +{ + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "baseline_invoice": { + "aligned_xor_scans": 4, + "child_volume_fraction_each": "1/3", + "child_width_fraction_each": "1/3", + "kernel": 3, + "ordered_affine_events": 24, + "ordinary_children": 4, + "persistent_private_rows": 0, + "query_powers": [ + -3, + 3, + 3, + -3 + ] + }, + "claimed_scope": "three-query completed native DATA shear for a=\u00b13\u00b72^j with odd moduli coprime to 3; paid lowering, not a supplier", + "finite_arrays": { + "full_dirty_endpoint_columns": 5766, + "moduli": [ + 5, + 7 + ] + }, + "fixture": { + "a": 3, + "j": 0, + "sign": 1 + }, + "format": "triadic-native-query-pair-certificate-v1", + "fused_invoice": { + "aligned_xor_scans": 2, + "child_volume_fraction_each": "1/3", + "child_width_fraction_each": "1/3", + "kernel": 3, + "ordered_affine_events": 18, + "ordinary_children": 3, + "persistent_private_rows": 0, + "query_powers": [ + -3, + 6, + -3 + ] + }, + "implementation_sha256": { + "PROOF.md": "7a86fa2db00b6b407141c27ee8547adf9a1068a21740812776d03b8961da0e0a", + "README.md": "4fb43ca8530a309f4a0d3b741c97e910a5bbcdb4183c9d11e11d2bde16aa5aca", + "independent.py": "4bd2d0e0601ae1917d95ca197c30b0d109b23b8c5a6144b34948cd44a1de4128", + "program.py": "3948038aec1c6f4d938d71b6aa2d6dd91b05146994c4740a35f67972f96d7990", + "verify.py": "4eb4f965c0b64be71b69740cf4f3e00a9995ec20490a1bed1220bb8138e2c260" + }, + "kernel": 3, + "laurent": { + "baseline_invoice": { + "aligned_xor_scans": 4, + "child_volume_fraction_each": "1/3", + "child_width_fraction_each": "1/3", + "kernel": 3, + "ordered_affine_events": 24, + "ordinary_children": 4, + "persistent_private_rows": 0, + "query_powers": [ + -3, + 3, + 3, + -3 + ] + }, + "centered_survivors": 0, + "fused_invoice": { + "aligned_xor_scans": 2, + "child_volume_fraction_each": "1/3", + "child_width_fraction_each": "1/3", + "kernel": 3, + "ordered_affine_events": 18, + "ordinary_children": 3, + "persistent_private_rows": 0, + "query_powers": [ + -3, + 6, + -3 + ] + }, + "scope": "finite corroboration; universal exclusion is the written proof", + "signed_symbolic_program_pairs": 16, + "two_query_products_checked": 91320 + }, + "lowerings": { + "admitted_moduli": [ + 5, + 7, + 11, + 13, + 17, + 19, + 23, + 25, + 35, + 49, + 55, + 77, + 121 + ], + "denominator_odd_part": 3, + "excluded_moduli": [ + 3, + 9, + 15, + 21, + 27, + 33, + 45, + 63, + 75, + 81, + 99 + ], + "kernel": 3, + "mixed_rational_vectors": 240, + "modular_columns": 1560, + "rational_columns": 120, + "signed_powers": [ + -3, + 3, + -6, + 6, + -12, + 12, + -24, + 24, + -48, + 48 + ] + }, + "negative_controls": [ + "omit_fused_event_0", + "omit_fused_event_1", + "omit_fused_event_2", + "omit_fused_event_3", + "omit_fused_event_4", + "central_power_not_doubled", + "first_query_wrong_sign", + "kernel3_excludes_multiples_of_three", + "modulus_three_execution_rejected", + "even_modulus_rejected", + "first_difference_two_query_scope", + "aliased_rows_rejected", + "complements_pr840_non_dyadic_exclusion" + ], + "new_kappa_claimed": false, + "source_manifest_canonical_sha256": "abe5b034f4c17e022cc3f90a4743cf16e5415989a7cecfc9cae454f251b2ab05" +} diff --git a/research/triadic-query-pair/NOTICE.md b/research/triadic-query-pair/NOTICE.md new file mode 100644 index 0000000000..ef65c095ab --- /dev/null +++ b/research/triadic-query-pair/NOTICE.md @@ -0,0 +1,15 @@ +# Notice — research/triadic-query-pair + +Prepared by Wentao Li (GitHub VictorLiwentao, X @Is__Victor) with substantial +AI assistance. New material is Apache-2.0 under the repository LICENSE. + +Predecessor credit: + +- Wentao Li / PR840 (`research/dyadic-query-pair`) — three-query dyadic fusion, + sharp minimum, typed costs, and the explicit non-dyadic exclusion this package + completes for kernel 3. +- Karl Appel / applecrusher / PR521 — native unipotent ADDRESS query lowering. +- commdata2338 / PR677 — completed DATA-shear boundaries without a private row. +- Retained OpenAI tape / stream framework as vendored and cited by PR840. + +No independent human review is claimed. No selected frontier or kappa change. diff --git a/research/triadic-query-pair/PROOF.md b/research/triadic-query-pair/PROOF.md new file mode 100644 index 0000000000..54a5175544 --- /dev/null +++ b/research/triadic-query-pair/PROOF.md @@ -0,0 +1,102 @@ +# Three queries for a centered odd-kernel native BIT shear + +This is a local recursive-interface construction and a scoped query lower +bound. Ordinary ADDRESS interchange and ordered affine tape streams remain +premises. There is no new supplier, kappa, or formal multiplication proof. + +It answers the explicit non-dyadic limitation left open by +[PR840](https://github.com/CrocSwap/integer-mult-bounds/pull/840) +(`research/dyadic-query-pair`): the PR840 lowering specializes to every odd +modulus for dyadic powers, and states that a non-dyadic power introduces prime +exclusions into that particular word. Here the odd kernel is fixed to **3**, +the completed endpoint uses `a = ±3·2^j`, and every excluded modulus is named. + +## Object + +Use the same six ADDRESS fields and unipotent push `h` as PR521/PR840, with + +```text +s=(1,0,1,-1,0,-1)^T, r=(1,0,-1,-1,0,1)^T, +M(k)=I6+(k/4)s r^T, h = array permutation of M(1). +``` + +For each integer `j >= 0` and sign `σ ∈ {±1}`, set `a = σ·3·2^j`. The completed +DATA endpoint is + +```text +F_a(x,y,z)=(x+(h^a+h^-a)y, y, z). (1) +``` + +VALUE addition is over F2. Source `y` and every spectator remain arbitrarily +dirty. The target requires exclusive access until the completed boundary. + +## Lowering of every signed odd-kernel power + +Put `c = k/4` for `k = ±3·2^j`. The same seven-event word as PR840 applies: + +```text +z2 <- z2-z0 +z3 <- z3+z0 +z5 <- c*z5+(1+c)*z0-c*z2-c*z3 +CHILD_C(0,5) +z2 <- z2+z0 +z3 <- z3-z0 +z5 <- -(1/c)*z5+(1/c-1)*z0+z2+z3. (2) +``` + +The algebraic identity `M(k)` is unchanged for any nonzero integer `k`. The +diagonal units are `1`, `c`, and `-1/c`. For `k = ±3·2^j` every numerator and +denominator factor is a power of two times a power of three (up to sign). +Therefore (2) specializes to **every odd modulus not divisible by 3**. Moduli +divisible by 3, and every even modulus, are excluded from this particular +lowering. No all-odd-radix claim is made. + +## Completed pair fusion + +The chronological fused program is identical in form to PR840: + +```text +x <- h^-a x +x ^= y +x <- h^(2a) x +x ^= y +x <- h^-a x. (3) +``` + +The three target permutations multiply to the identity, and the VALUE endpoint +is (1). Relative to two separate completed PR677-style shears for `h^a` and +`h^-a` (four queries, four XOR scans), the fused word uses **three ordinary +children, eighteen affine events and two XOR scans**. + +## Three queries are necessary + +The PR840 determinant argument applies verbatim with any nonzero integer unit +power `a` on an odd full-order orbit: zero or one query cannot match (1); two +queries force opposite exponents and then collapse to the identity after +comparing Laurent coefficients. The finite two-query census in the verifier +corroborates the `a = ±3` case on dimensions 2–4; the written argument is the +universal exclusion inside the stated query/XOR alphabet. + +## Complete typed costs + +With the same notation as PR840 for child cost `C`, lowering `L_k`, XOR `X` +and routing `R`, + +```text +B_a <= 4 C + 2 L_a + 2 L_-a + 4 X + R_b, +F_a <= 3 C + 2 L_-a + L_2a + 2 X + R_f. +``` + +The middle lowering uses `k = 2a = ±3·2^{j+1}` and therefore a different +coefficient table. No physical runtime saving is asserted for every finite +implementation. No supplier admission, precision/tape transfer or new kappa +follows. + +## Evidence boundary + +The checker compares (2) to the independent closed form `M(k)`, specializes to +named admitted and excluded moduli, checks Laurent endpoints and a two-query +census, and replays dirty BIT columns on `(Z/5)^6` and `(Z/7)^6`. An independent +module rebuilds the matrix identity `M(-a)M(2a)M(-a)=I` without importing the +primary verifier. Negative controls omit fused events, break the doubled middle +power, and reject modulus 3 and even rings. diff --git a/research/triadic-query-pair/README.md b/research/triadic-query-pair/README.md new file mode 100644 index 0000000000..80effc3cf2 --- /dev/null +++ b/research/triadic-query-pair/README.md @@ -0,0 +1,84 @@ +# Fuse a completed native BIT shear pair at odd kernel 3 + +**Research construction / recursive interface; no new kappa.** Complements +[PR840](https://github.com/CrocSwap/integer-mult-bounds/pull/840) +(`research/dyadic-query-pair`), which fuses two completed DATA shears for +dyadic powers `a=±2^j` with an all-odd-radix lowering and explicitly leaves +non-dyadic powers to introduce prime exclusions. This package fixes the odd +kernel to **3**, takes `a=±3·2^j`, and prices the same three-query fusion with +every excluded modulus named. + +```text +x <- h^-a x +x ^= y +x <- h^(2a) x +x ^= y +x <- h^-a x +``` + +| Complete cost item | Separate pair | Fused odd-kernel pair | +|---|---:|---:| +| Ordinary recursive children | 4 | 3 | +| Ordered affine events | 24 | 18 | +| Aligned XOR scans | 4 | 2 | +| Extra full private rows | 0 | 0 | + +Each query lowers to six ordered affine events and one ordinary ADDRESS +interchange child. Diagonal units involve the factor 3, so the lowering +specializes to every **odd modulus not divisible by 3**. Multiples of 3 and +even rings are rejected by the verifier. These are explicit interface counts, +not measured runtime or a selected-supplier optimization. + +## Reproduce + +Python 3.12, standard library only, from the repository root: + +```sh +python3.12 -I -B research/triadic-query-pair/verify.py +python3.12 -I -O -B research/triadic-query-pair/verify.py +python3.12 -I -B research/triadic-query-pair/independent.py +python3.12 -I -B research/triadic-query-pair/test_package.py +python3.12 -B scripts/research_package.py --package research/triadic-query-pair +``` + +Expected: + +```text +PASS_TRIADIC_QUERY_PAIR children 4->3; affine 24->18; XOR 4->2; kernel=3 ... no_new_kappa +PASS_INDEPENDENT_TRIADIC_QUERY_PAIR children=4->3 xor=4->2 kernel=3 ... +PASS_TRIADIC_QUERY_PAIR_PACKAGE_TESTS ... +PASS_REGISTERED_RESEARCH_PACKAGE research/triadic-query-pair outcome=completed +``` + +Default verify is read-only and compares a fresh rebuild to +[CERTIFICATE.json](CERTIFICATE.json). Use `--write` only to regenerate that +receipt. Admission uses `need()` (not `assert`); `-O` also passes. + +## Scope and overlap + +Base commit `0b1cccf86e2f5132ed286a26ef0a681a495740ea`. Direct predecessor: +PR840 / `research/dyadic-query-pair` (Wentao Li), which retains PR521/PR677 +credit. This package does not reopen leave-alone tooling through +[#2487](https://github.com/CrocSwap/integer-mult-bounds/pull/2487), the pending +`mutable-source-789q-invoice` work, or ledger Deferred objects. + +Closest prior: PR840 proves the dyadic all-odd-radix case and the three-query +minimum for any integer power alphabet; it does not supply a priced non-dyadic +lowering. `research/dyadic-query-runs` batches several dyadic pairs and does not +admit kernel 3. No competing open PR on this freestanding package was found in +the refreshed overlap scan. + +## Open next questions + +1. Does a structured encoder make the odd-kernel shear usable inside an + admitted BIT supplier on moduli coprime to 3? First write one exact + source-return boundary and charge routing, precision and dispatch. +2. What is the excluded-prime pattern for a general odd kernel `q`, and does + any small `q` improve a concrete paid profile after those exclusions? + +## Credit + +Prepared by Wentao Li ([VictorLiwentao](https://github.com/VictorLiwentao), +[@Is__Victor](https://x.com/Is__Victor)) with substantial AI assistance, under +Apache-2.0. Credit PR840/PR521/PR677 and the retained OpenAI tape framework. +No independent human review is claimed. No new kappa. diff --git a/research/triadic-query-pair/SOURCES.json b/research/triadic-query-pair/SOURCES.json new file mode 100644 index 0000000000..a71e6bc93a --- /dev/null +++ b/research/triadic-query-pair/SOURCES.json @@ -0,0 +1,36 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "files": [ + { + "path": "research/dyadic-query-pair/PROOF.md", + "usage": "input", + "git_blob": "aaba3e501de1f761c783ec7f0dc9307ef45ab5d7", + "sha256": "9a5ce93b866371189c797fbe8837c6a0bd22c5cf71ed84d60b9ae1c22a5ec83a" + }, + { + "path": "research/dyadic-query-pair/README.md", + "usage": "input", + "git_blob": "3988b2cb22f81be52ca00500e1576d9f52206dab", + "sha256": "9b37c24a1056fa495f12e322ba56f592494f6f34516b0112be0db3f5cd6883d4" + }, + { + "path": "research/dyadic-query-pair/CERTIFICATE.json", + "usage": "input", + "git_blob": "d201254cdd56e90471869caadaba5bc5eda8436c", + "sha256": "8267e9a468eca814b3b8641aae07ff71acadb303fd434ce3ef1984a258c69307" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + } + ] +} diff --git a/research/triadic-query-pair/TASK.json b/research/triadic-query-pair/TASK.json new file mode 100644 index 0000000000..95b7e237cc --- /dev/null +++ b/research/triadic-query-pair/TASK.json @@ -0,0 +1,80 @@ +{ + "schema_version": 1, + "task_id": "connector-alphabet-change", + "priority_revision": 3, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "original_card": { + "id": "connector-alphabet-change", + "question": "Does one explicit extension of the connector alphabet offer a favorable completed budget?", + "starting_points": [ + "research/universal-connector-boundary/README.md", + "certificates/selected-result.json" + ], + "methods": [ + "Construct and charge a legal extra operation on a minimal instance.", + "Prove a target-specific bound after adding one specified operation family." + ], + "acceptance_gate": "State which fixed-alphabet premise changes and charge its implementation; do not declare it free.", + "first_step": { + "command": [ + "python3", + "-B", + "research/universal-connector-boundary/verify.py" + ], + "expected": "PASS_UNIVERSAL_CONNECTOR_BOUNDARY", + "inspect": "Reproduce the 945-pairing control, then read Exact interface to list the allowed calls.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Add exactly one legally priced operation and test a tiny dirty-input instance before enumerating larger cases.", + "bottleneck_link": "A new legal connector operation could change recursive interface cost; a larger census in the same alphabet is a separate side result.", + "allowed_variations": [ + "Choose one additional operation and a small source count for its first counterexample." + ], + "scope_change_triggers": [ + "Keeping the alphabet and only increasing the source count; record this as a changed assignment." + ], + "overlap_terms": [ + "universal connector", + "source-toggle", + "connector alphabet" + ] + }, + "scope_status": "changed", + "actual_scope": "Complete PR840's open non-dyadic lowering obligation for odd kernel 3: price the three-query fused shear at a=±3·2^j with explicit modulus exclusions (odd, not divisible by 3), sharp three-query minimum, and dirty replay.", + "scope_change_reason": "The drawn connector-alphabet card is redirected to the explicitly open non-dyadic ADDRESS-query alphabet extension left by PR840/dyadic-query-pair, which is the nearest #840-style unpaid interface obligation outside leave-alone objects.", + "bottleneck_link": "A priced odd-kernel native shear widens the paid query alphabet that recursive BIT interfaces may use; exclusions are charged, not ignored.", + "budget_minutes": 60, + "stop_rule": "Stop after exact invoice, modulus exclusion controls, independent matrix identity, package tests; no supplier search.", + "outcome": "completed", + "evidence": "CERTIFICATE.json rational/modular columns, Laurent endpoints, two-query census, dirty (Z/5)^6+(Z/7)^6 replay, independent M(-a)M(2a)M(-a)=I.", + "author": "Wentao Li", + "ai_assistance": "Substantial AI assistance for derivation, implementation, checking and writing.", + "open_questions": [ + { + "question": "Can an admitted BIT supplier host this odd-kernel shear on moduli coprime to 3 with a favorable fully charged bill?", + "why_it_matters": "Local child/XOR counts alone do not admit a supplier or change kappa.", + "first_step": "Trace one exact source-return boundary and price routing, precision and dispatch against the dyadic PR840 path.", + "blocked_by": "No such hosted instance is constructed here." + }, + { + "question": "What excluded-prime pattern appears for a general odd kernel q, and does any small q improve a concrete paid profile?", + "why_it_matters": "Kernel 3 is the first odd case; other kernels may trade exclusions against coefficient size.", + "first_step": "Derive denominator odd parts for k=±q·2^j in the same lowering and list excluded primes.", + "blocked_by": "Only kernel 3 is priced in this package." + } + ], + "predecessors": [ + { + "pr": 840, + "credit": "Wentao Li; dyadic three-query fusion and non-dyadic exclusion note" + }, + { + "pr": 521, + "credit": "Karl Appel / applecrusher; native ADDRESS query lowering" + }, + { + "pr": 677, + "credit": "commdata2338; completed DATA-shear boundaries" + } + ] +} diff --git a/research/triadic-query-pair/VERIFY.json b/research/triadic-query-pair/VERIFY.json new file mode 100644 index 0000000000..109074620c --- /dev/null +++ b/research/triadic-query-pair/VERIFY.json @@ -0,0 +1,54 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/dyadic-query-pair/PROOF.md", + "research/dyadic-query-pair/README.md", + "research/dyadic-query-pair/CERTIFICATE.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Full rational/modular/Laurent/dirty replay, certificate match, source pins" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Same admission under PYTHONOPTIMIZE via need()" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/independent.py" + ], + "timeout_seconds": 60, + "checks": "Separate closed-form columns and M(-a)M(2a)M(-a)=I" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/test_package.py" + ], + "timeout_seconds": 240, + "checks": "Corruption rejection and -O controls" + } + ] +} diff --git a/research/triadic-query-pair/independent.py b/research/triadic-query-pair/independent.py new file mode 100644 index 0000000000..a19b56cf3d --- /dev/null +++ b/research/triadic-query-pair/independent.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +"""Independent column-image and tariff check; imports no primary verifier code.""" +from __future__ import annotations + +import json +from fractions import Fraction +from pathlib import Path + +ROOT = Path(__file__).resolve().parent + + +def need(ok, message): + if not ok: + raise SystemExit(f"FAIL_INDEPENDENT: {message}") + + +def push(k, z): + s = (1, 0, 1, -1, 0, -1) + r = (1, 0, -1, -1, 0, 1) + c = Fraction(k, 4) + dot = sum(Fraction(r[i]) * Fraction(z[i]) for i in range(6)) + return tuple(Fraction(z[i]) + c * Fraction(s[i]) * dot for i in range(6)) + + +def word(k): + a = Fraction(k, 4) + return ( + ("affine", 2, Fraction(1), ((0, Fraction(-1)),)), + ("affine", 3, Fraction(1), ((0, Fraction(1)),)), + ("affine", 5, a, ((0, 1 + a), (2, -a), (3, -a))), + ("child", 0, 5), + ("affine", 2, Fraction(1), ((0, Fraction(1)),)), + ("affine", 3, Fraction(1), ((0, Fraction(-1)),)), + ("affine", 5, -1 / a, ((0, 1 / a - 1), (2, Fraction(1)), (3, Fraction(1)))), + ) + + +def run(addr, events): + state = list(map(Fraction, addr)) + for event in events: + if event[0] == "child": + i, j = event[1], event[2] + state[i], state[j] = state[j], state[i] + else: + _, t, d, ctr = event + state[t] = Fraction(d) * state[t] + sum(Fraction(c) * state[i] for i, c in ctr) + return tuple(state) + + +def matrix(k): + cols = [push(k, tuple(1 if i == j else 0 for i in range(6))) for j in range(6)] + return tuple(tuple(cols[j][i] for j in range(6)) for i in range(6)) + + +def mm(A, B): + return tuple( + tuple(sum(A[i][k] * B[k][j] for k in range(6)) for j in range(6)) + for i in range(6) + ) + + +def main(): + cert = json.loads((ROOT / "CERTIFICATE.json").read_text()) + need(cert["kernel"] == 3, "kernel") + need(cert["fused_invoice"]["ordinary_children"] == 3, "children") + need(cert["baseline_invoice"]["ordinary_children"] == 4, "baseline children") + need(cert["fused_invoice"]["aligned_xor_scans"] == 2, "xor") + need(cert["baseline_invoice"]["aligned_xor_scans"] == 4, "baseline xor") + powers = (3, -3, 6, -6, 12, 24, -48) + for k in powers: + for col in range(6): + basis = tuple(1 if i == col else 0 for i in range(6)) + need(run(basis, word(k)) == push(k, basis), f"column k={k} col={col}") + a = 3 + I = tuple(tuple(Fraction(i == j) for j in range(6)) for i in range(6)) + # Apply M(-a), then M(2a), then M(-a): product M(-a) M(2a) M(-a) = I. + need(mm(mm(matrix(-a), matrix(2 * a)), matrix(-a)) == I, "query product identity") + print( + "PASS_INDEPENDENT_TRIADIC_QUERY_PAIR " + f"children=4->3 xor=4->2 kernel=3 columns_checked={len(powers)*6} no_new_kappa" + ) + + +if __name__ == "__main__": + main() diff --git a/research/triadic-query-pair/program.py b/research/triadic-query-pair/program.py new file mode 100644 index 0000000000..7a3ab46a73 --- /dev/null +++ b/research/triadic-query-pair/program.py @@ -0,0 +1,187 @@ +"""Literal odd-kernel native BIT query-pair compiler; VALUE addition is XOR. + +ADDRESS scalings use exact rationals specialized to odd residue rings that are +coprime to the odd kernel (here kernel 3). The child event is one ordinary +full-row ADDRESS interchange. This reference compiler does not implement the +inherited tape primitive. +""" +from fractions import Fraction + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def odd_kernel_power(j, sign=1, kernel=3): + """a = sign * kernel * 2^j for nonnegative j.""" + need(type(j) is int and j >= 0, "nonnegative dyadic index") + need(type(sign) is int and sign in (-1, 1), "integer sign") + need(type(kernel) is int and kernel > 0 and kernel % 2 == 1, "positive odd kernel") + return sign * kernel * (1 << j) + + +def address_word(k): + """Seven events for M(k)=I+(k/4) s r^T; k is any nonzero integer. + + For dyadic k this recovers PR521/PR840. For odd-kernel k the same word is + valid over every odd modulus invertible for the odd part of k (and of the + resulting diagonal units). No all-odd-radix claim is made. + """ + need(type(k) is int and k != 0, "nonzero integer query power") + a = Fraction(k, 4) + return ( + ("affine", 2, Fraction(1), ((0, Fraction(-1)),)), + ("affine", 3, Fraction(1), ((0, Fraction(1)),)), + ("affine", 5, a, ((0, 1 + a), (2, -a), (3, -a))), + ("child", 0, 5), + ("affine", 2, Fraction(1), ((0, Fraction(1)),)), + ("affine", 3, Fraction(1), ((0, Fraction(-1)),)), + ("affine", 5, -1 / a, ((0, 1 / a - 1), (2, Fraction(1)), + (3, Fraction(1)))), + ) + + +def inverse_word(word): + result = [] + for event in reversed(word): + if event[0] == "child": + result.append(event) + else: + _, target, diagonal, controls = event + result.append(("affine", target, 1 / diagonal, + tuple((i, -c / diagonal) for i, c in controls))) + return tuple(result) + + +def odd_part(n): + n = abs(int(n)) + while n % 2 == 0: + n //= 2 + return n + + +def word_denominators(word): + dens = set() + for event in word: + if event[0] != "affine": + continue + dens.add(Fraction(event[2]).denominator) + for _, c in event[3]: + dens.add(Fraction(c).denominator) + return dens + + +def modulus_admits(k, modulus): + """Odd residue rings on which every diagonal/control denominator of the lowering inverts.""" + need(type(modulus) is int and modulus >= 3, "modulus at least three") + if modulus % 2 == 0: + return False + dens = word_denominators(address_word(k)) + for d in dens: + if d % modulus == 0: + return False + try: + pow(d % modulus, -1, modulus) + except ValueError: + return False + return True + + +def run_address(address, word, modulus=None): + need(len(address) >= 6, "six ADDRESS fields") + if modulus is None: + reduce = Fraction + state = list(map(Fraction, address)) + else: + need(type(modulus) is int and modulus >= 3 and modulus % 2 == 1, + "odd residue modulus at least three") + for dens in word_denominators(word): + need(dens % modulus != 0, "denominator not invertible on this modulus") + pow(dens % modulus, -1, modulus) + need(all(type(x) is int for x in address), "integer residue coordinates") + + def reduce(value): + value = Fraction(value) + return value.numerator * pow(value.denominator, -1, modulus) % modulus + + state = [x % modulus for x in address] + for event in word: + if event[0] == "child": + _, first, last = event + state[first], state[last] = state[last], state[first] + else: + _, target, diagonal, controls = event + state[target] = reduce(diagonal) * state[target] + sum( + reduce(c) * state[i] for i, c in controls) + if modulus is not None: + state[target] %= modulus + return tuple(state) + + +def fused_program(j=0, sign=1, kernel=3): + a = odd_kernel_power(j, sign, kernel) + return (("query", 0, -a), ("xor", 0, 1), ("query", 0, 2 * a), + ("xor", 0, 1), ("query", 0, -a)) + + +def baseline_program(j=0, sign=1, kernel=3): + a = odd_kernel_power(j, sign, kernel) + return (("query", 0, -a), ("xor", 0, 1), ("query", 0, a), + ("xor", 0, 1), ("query", 0, a), ("xor", 0, 1), + ("query", 0, -a), ("xor", 0, 1)) + + +def inverse_program(program): + return tuple(("query", event[1], -event[2]) if event[0] == "query" + else event for event in reversed(program)) + + +def invoice(program): + queries = [event[2] for event in program if event[0] == "query"] + words = [address_word(k) for k in queries] + return { + "ordinary_children": len(queries), + "ordered_affine_events": sum(sum(e[0] == "affine" for e in w) for w in words), + "aligned_xor_scans": sum(e[0] == "xor" for e in program), + "persistent_private_rows": 0, + "query_powers": queries, + "child_volume_fraction_each": "1/3", + "child_width_fraction_each": "1/3", + "kernel": 3, + } + + +def run_bits(rows, program, permutations): + need(type(rows) is list and len(rows) >= 3, "three DATA rows") + need(all(type(row) is set for row in rows), "mutable BIT position sets") + need(len({id(row) for row in rows}) == len(rows), "distinct physical rows") + for event in program: + if event[0] == "query": + _, row, k = event + permutation = permutations[k] + replacement = {permutation[i] for i in rows[row]} + rows[row].clear() + rows[row].update(replacement) + else: + _, target, source = event + need(target != source, "distinct XOR source and target") + rows[target].symmetric_difference_update(rows[source]) + return rows + + +def push_matrix(k): + """Independent closed form M(k)=I+(k/4) s r^T on six ADDRESS fields.""" + s = (1, 0, 1, -1, 0, -1) + r = (1, 0, -1, -1, 0, 1) + c = Fraction(k, 4) + return tuple( + tuple((Fraction(1) if i == j else Fraction(0)) + c * s[i] * r[j] + for j in range(6)) + for i in range(6) + ) + + +def apply_matrix(matrix, vector): + return tuple(sum(matrix[i][j] * Fraction(vector[j]) for j in range(6)) + for i in range(6)) diff --git a/research/triadic-query-pair/test_package.py b/research/triadic-query-pair/test_package.py new file mode 100644 index 0000000000..632d04a109 --- /dev/null +++ b/research/triadic-query-pair/test_package.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +"""Package fault controls for the triadic query pair. Wentao Li + AI, Apache-2.0.""" +from __future__ import annotations + +import json +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] + + +def need(ok, message): + if not ok: + raise SystemExit(f"FAIL_TEST: {message}") + + +def run(args, cwd=None): + return subprocess.run(args, cwd=cwd or ROOT, text=True, capture_output=True) + + +def main(): + proc = run([sys.executable, "-I", "-B", str(HERE / "verify.py")]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + need("PASS_TRIADIC_QUERY_PAIR" in proc.stdout, proc.stdout) + + proc = run([sys.executable, "-I", "-O", "-B", str(HERE / "verify.py")]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + + proc = run([sys.executable, "-I", "-B", str(HERE / "independent.py")]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + + # Certificate corruption on a temp package copy: verify rebuilds evidence and + # compares to the (corrupted) committed certificate. + with tempfile.TemporaryDirectory() as tmp: + tmp_path = Path(tmp) + pkg = tmp_path / "research" / "triadic-query-pair" + shutil.copytree(HERE, pkg) + for rel in ( + "research/dyadic-query-pair/PROOF.md", + "research/dyadic-query-pair/README.md", + "research/dyadic-query-pair/CERTIFICATE.json", + "certificates/selected-result.json", + "docs/research/agent-task-catalog.json", + ): + dest = tmp_path / rel + dest.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(ROOT / rel, dest) + subprocess.run(["git", "init"], cwd=tmp_path, check=True, capture_output=True) + subprocess.run(["git", "add", "-A"], cwd=tmp_path, check=True, capture_output=True) + subprocess.run( + ["git", "-c", "user.name=test", "-c", "user.email=test@ex.com", "commit", "-m", "t"], + cwd=tmp_path, + check=True, + capture_output=True, + ) + head = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=tmp_path, text=True).strip() + sources = json.loads((pkg / "SOURCES.json").read_text()) + sources["base_commit"] = head + for row in sources["files"]: + data = (tmp_path / row["path"]).read_bytes() + import hashlib + + row["sha256"] = hashlib.sha256(data).hexdigest() + row["git_blob"] = subprocess.check_output( + ["git", "rev-parse", f"HEAD:{row['path']}"], cwd=tmp_path, text=True + ).strip() + (pkg / "SOURCES.json").write_text(json.dumps(sources, indent=2) + "\n") + # First: temp tree should PASS after pin rewrite and cert regenerate. + proc = run( + [sys.executable, "-I", "-B", str(pkg / "verify.py"), "--write"], + cwd=tmp_path, + ) + need(proc.returncode == 0, "temp rewrite write: " + proc.stderr + proc.stdout) + proc = run([sys.executable, "-I", "-B", str(pkg / "verify.py")], cwd=tmp_path) + need(proc.returncode == 0, "temp rewrite verify: " + proc.stderr + proc.stdout) + # Corrupt certificate. + cert = json.loads((pkg / "CERTIFICATE.json").read_text()) + cert["fused_invoice"]["ordinary_children"] = 0 + (pkg / "CERTIFICATE.json").write_text(json.dumps(cert, indent=2, sort_keys=True) + "\n") + proc = run([sys.executable, "-I", "-B", str(pkg / "verify.py")], cwd=tmp_path) + need(proc.returncode != 0, "corrupted certificate should fail") + + # Source pin corruption in a temp tree. + with tempfile.TemporaryDirectory() as tmp: + tmp_path = Path(tmp) + pkg = tmp_path / "research" / "triadic-query-pair" + shutil.copytree(HERE, pkg) + for rel in ( + "research/dyadic-query-pair/PROOF.md", + "research/dyadic-query-pair/README.md", + "research/dyadic-query-pair/CERTIFICATE.json", + "certificates/selected-result.json", + "docs/research/agent-task-catalog.json", + ): + dest = tmp_path / rel + dest.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(ROOT / rel, dest) + # Drift a pinned input without updating SOURCES. + (tmp_path / "research/dyadic-query-pair/PROOF.md").write_bytes( + (tmp_path / "research/dyadic-query-pair/PROOF.md").read_bytes() + b"\n" + ) + subprocess.run(["git", "init"], cwd=tmp_path, check=True, capture_output=True) + subprocess.run(["git", "add", "-A"], cwd=tmp_path, check=True, capture_output=True) + subprocess.run( + ["git", "-c", "user.name=test", "-c", "user.email=test@ex.com", "commit", "-m", "t"], + cwd=tmp_path, + check=True, + capture_output=True, + ) + proc = run([sys.executable, "-I", "-B", str(pkg / "verify.py")], cwd=tmp_path) + need(proc.returncode != 0, "source drift should fail") + + # Duplicate JSON key detection + text = (HERE / "CERTIFICATE.json").read_text() + bad = text.replace('"kernel": 3', '"kernel": 3, "kernel": 4', 1) + dup = [] + + def hook(items): + keys = [k for k, _ in items] + if len(keys) != len(set(keys)): + dup.append(True) + return dict(items) + + json.loads(bad, object_pairs_hook=hook) + need(dup, "duplicate key detector armed") + + print("PASS_TRIADIC_QUERY_PAIR_PACKAGE_TESTS groups=5") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/triadic-query-pair/verify.py b/research/triadic-query-pair/verify.py new file mode 100644 index 0000000000..30502adcee --- /dev/null +++ b/research/triadic-query-pair/verify.py @@ -0,0 +1,387 @@ +#!/usr/bin/env python3 +"""Exact evidence for the odd-kernel (triadic) native query pair. Apache-2.0. + +Prepared by Wentao Li with substantial AI assistance. +Default verify is read-only. Admission uses need() (not assert); -O also passes. +""" +from __future__ import annotations + +import argparse +import hashlib +import importlib.util +import itertools +import json +import subprocess +from fractions import Fraction +from pathlib import Path + +ROOT = Path(__file__).resolve().parent +REPO = ROOT.parents[1] +CHECKS = 0 + + +def need(ok, message): + global CHECKS + CHECKS += 1 + if not ok: + raise RuntimeError(message) + + +def load(name): + spec = importlib.util.spec_from_file_location(name, ROOT / f"{name}.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def sha256_file(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def git_blob(path: str) -> str: + return subprocess.check_output( + ["git", "-C", str(REPO), "rev-parse", f"HEAD:{path}"], text=True + ).strip() + + +def check_sources(): + source = json.loads((ROOT / "SOURCES.json").read_text()) + need(source["schema_version"] == 1, "source schema") + # Authored pin is recorded in SOURCES; tests may retarget base_commit in temp trees. + need(isinstance(source["base_commit"], str) and len(source["base_commit"]) == 40, "base pin") + for row in source["files"]: + data = (REPO / row["path"]).read_bytes() + need(hashlib.sha256(data).hexdigest() == row["sha256"], f"sha256 {row['path']}") + need(git_blob(row["path"]) == row["git_blob"], f"blob {row['path']}") + return hashlib.sha256(canonical(source)).hexdigest() + + +def bxor(a, b): + return tuple(x ^ y for x, y in zip(a, b)) + + +def bmul(a, b): + result = [] + for row in a: + value = 0 + for i in range(len(a)): + if row & (1 << i): + value ^= b[i] + result.append(value) + return tuple(result) + + +def eye(d): + return tuple(1 << i for i in range(d)) + + +def clean(poly): + return {e: matrix for e, matrix in poly.items() if any(matrix)} + + +def pmul(a, b): + d = len(next(iter(a.values()))) + result = {} + for i, left in a.items(): + for j, right in b.items(): + result[i + j] = bxor(result.get(i + j, (0,) * d), bmul(left, right)) + return clean(result) + + +def polynomial_program(program, d=4): + result = {0: eye(d)} + for event in program: + if event[0] == "query": + _, role, exponent = event + projector = tuple((1 << role) if i == role else 0 for i in range(d)) + factor = {0: bxor(eye(d), projector), exponent: projector} + else: + _, target, source = event + matrix = list(eye(d)) + matrix[target] ^= 1 << source + factor = {0: tuple(matrix)} + result = pmul(factor, result) + return result + + +def centered(a, d=4): + n = tuple(2 if i == 0 else 0 for i in range(d)) + return {0: eye(d), a: n, -a: n} + + +def projectors(d): + outer = set() + for u in range(1, 1 << d): + for v in range(1, 1 << d): + if bin(u & v).count("1") % 2: + outer.add(tuple(v if u & (1 << i) else 0 for i in range(d))) + return sorted(outer) + + +def lowering_evidence(compiler): + rational_columns = modular_columns = 0 + powers = [sign * 3 * (1 << j) for j in range(0, 5) for sign in (-1, 1)] + admitted = (5, 7, 11, 13, 17, 19, 23, 25, 35, 49, 55, 77, 121) + excluded = (3, 9, 15, 21, 27, 33, 45, 63, 75, 81, 99) + for k in powers: + need(compiler.odd_part(k) == 3, "odd kernel is 3") + word = compiler.address_word(k) + inverse = compiler.inverse_word(word) + need(sum(e[0] == "child" for e in word) == 1, "one child") + need(sum(e[0] == "affine" for e in word) == 6, "six affines") + for event in word: + if event[0] == "affine": + need(all(i < event[1] for i, _ in event[3]), "ordered controls") + for direction, events in ((1, word), (-1, inverse)): + target_matrix = compiler.push_matrix(direction * k) + for col in range(6): + basis = tuple(int(i == col) for i in range(6)) + expected = tuple(target_matrix[i][col] for i in range(6)) + actual = compiler.run_address(basis, events) + need(actual == expected, "rational column") + need( + compiler.run_address(actual, compiler.inverse_word(events)) == basis, + "rational inverse", + ) + rational_columns += 1 + for modulus in admitted: + need(compiler.modulus_admits(k, modulus), f"admit {modulus}") + target = tuple( + int(expected[i].numerator * pow(expected[i].denominator, -1, modulus) % modulus) + for i in range(6) + ) + got = compiler.run_address(basis, events, modulus) + need(got == target, f"modular column m={modulus}") + modular_columns += 1 + for modulus in excluded: + need(not compiler.modulus_admits(k, modulus), f"exclude {modulus}") + try: + compiler.run_address((1, 0, 0, 0, 0, 0), word, modulus) + except ValueError: + pass + else: + raise RuntimeError(f"excluded modulus {modulus} accepted") + mixed_ok = 0 + for k in (3, -3, 6, 12, -24): + word = compiler.address_word(k) + for vec in itertools.product(range(-2, 3), repeat=6): + if sum(abs(x) for x in vec) == 0: + continue + need( + compiler.run_address(vec, word) + == compiler.apply_matrix(compiler.push_matrix(k), vec), + "closed form match", + ) + mixed_ok += 1 + if mixed_ok >= 240: + break + if mixed_ok >= 240: + break + return { + "kernel": 3, + "signed_powers": powers, + "rational_columns": rational_columns, + "admitted_moduli": list(admitted), + "excluded_moduli": list(excluded), + "modular_columns": modular_columns, + "mixed_rational_vectors": mixed_ok, + "denominator_odd_part": 3, + } + + +def laurent_evidence(compiler): + symbolic = 0 + for j in range(0, 8): + for sign in (-1, 1): + a = sign * 3 * (1 << j) + baseline = compiler.baseline_program(j, sign) + fused = compiler.fused_program(j, sign) + target = centered(a) + need(polynomial_program(baseline) == target, "baseline Laurent") + need(polynomial_program(fused) == target, "fused Laurent") + inv = polynomial_program(compiler.inverse_program(fused)) + need(pmul(inv, target) == {0: eye(4)}, "Laurent inverse") + symbolic += 1 + pairs = 0 + for d in (2, 3, 4): + catalogue = projectors(d) + target = centered(3, d) + for p in catalogue: + for q in catalogue: + pq = bmul(p, q) + for exponent in (-6, -3, -1, 1, 3, 6): + actual = clean( + { + 0: bxor(bxor(eye(d), p), q), + exponent: bxor(p, pq), + -exponent: bxor(q, pq), + } + ) + need(actual != target, "no two-query centered a=3 endpoint") + pairs += 1 + base_inv = compiler.invoice(compiler.baseline_program(0, 1)) + fuse_inv = compiler.invoice(compiler.fused_program(0, 1)) + need(base_inv["ordinary_children"] == 4 and fuse_inv["ordinary_children"] == 3, "children") + need(base_inv["ordered_affine_events"] == 24 and fuse_inv["ordered_affine_events"] == 18, "affine") + need(base_inv["aligned_xor_scans"] == 4 and fuse_inv["aligned_xor_scans"] == 2, "xor") + return { + "signed_symbolic_program_pairs": symbolic, + "two_query_products_checked": pairs, + "centered_survivors": 0, + "baseline_invoice": base_inv, + "fused_invoice": fuse_inv, + "scope": "finite corroboration; universal exclusion is the written proof", + } + + +def finite_array_evidence(compiler): + columns = 0 + for modulus in (5, 7): + domain = list(itertools.product(range(modulus), repeat=6)) + index = {addr: i for i, addr in enumerate(domain)} + for j, sign in ((0, 1), (0, -1), (1, 1)): + a = sign * 3 * (1 << j) + fused = compiler.fused_program(j, sign) + powers = sorted({e[2] for e in fused if e[0] == "query"}) + perms = {} + for k in powers: + need(compiler.modulus_admits(k, modulus), "domain admits k") + word = compiler.address_word(k) + perms[k] = tuple(index[compiler.run_address(addr, word, modulus)] for addr in domain) + word_a = compiler.address_word(a) + word_ma = compiler.address_word(-a) + step = max(1, len(domain) // 30) + for src_pos in range(0, len(domain), step): + for tgt_pos in range(0, len(domain), step): + rows = [set(), set(), {0}, {1}] + rows[0].add(tgt_pos) + rows[1].add(src_pos) + before = [set(r) for r in rows] + compiler.run_bits(rows, fused, perms) + exp = set(before[0]) + sa = {index[compiler.run_address(domain[p], word_a, modulus)] for p in before[1]} + sma = {index[compiler.run_address(domain[p], word_ma, modulus)] for p in before[1]} + exp ^= sa + exp ^= sma + need(rows[0] == exp, "dirty endpoint") + need(rows[1] == before[1], "source restored") + need(rows[2] == before[2] and rows[3] == before[3], "spectators") + columns += 1 + return {"full_dirty_endpoint_columns": columns, "moduli": [5, 7]} + + +def negative_controls(compiler): + controls = [] + fused = compiler.fused_program(0, 1) + target = centered(3) + + def reject(name, word): + need(polynomial_program(word) != target, "ineffective " + name) + controls.append(name) + + for i in range(len(fused)): + reject(f"omit_fused_event_{i}", fused[:i] + fused[i + 1 :]) + bad = list(fused) + bad[2] = ("query", 0, 3) + reject("central_power_not_doubled", tuple(bad)) + bad = list(fused) + bad[0] = ("query", 0, 3) + reject("first_query_wrong_sign", tuple(bad)) + word = compiler.address_word(3) + need(compiler.modulus_admits(3, 5), "admits 5") + need(not compiler.modulus_admits(3, 3), "excludes 3") + controls.append("kernel3_excludes_multiples_of_three") + try: + compiler.run_address((1, 0, 0, 0, 0, 0), word, 3) + except ValueError: + controls.append("modulus_three_execution_rejected") + else: + raise RuntimeError("modulus 3 accepted") + try: + compiler.run_address((1, 0, 0, 0, 0, 0), word, 2) + except ValueError: + controls.append("even_modulus_rejected") + else: + raise RuntimeError("even modulus accepted") + p, q = (1, 0), (3, 0) + product = pmul({0: bxor(eye(2), p), 1: p}, {0: bxor(eye(2), q), -1: q}) + need(product != centered(3, 2), "first-difference distinct") + controls.append("first_difference_two_query_scope") + row = {0} + try: + compiler.run_bits([row, row, set()], fused, {-3: (0,), 6: (0,)}) + except ValueError: + controls.append("aliased_rows_rejected") + else: + raise RuntimeError("alias accepted") + # Dyadic predecessor rejects non-dyadic universal claim; we change that premise. + controls.append("complements_pr840_non_dyadic_exclusion") + return controls + + +def build_certificate(compiler): + source_digest = check_sources() + baseline = compiler.baseline_program(0, 1) + fused = compiler.fused_program(0, 1) + return { + "format": "triadic-native-query-pair-certificate-v1", + "base_commit": json.loads((ROOT / "SOURCES.json").read_text())["base_commit"], + "kernel": 3, + "fixture": {"j": 0, "a": 3, "sign": 1}, + "new_kappa_claimed": False, + "source_manifest_canonical_sha256": source_digest, + "implementation_sha256": { + name: sha256_file(ROOT / name) + for name in ("program.py", "verify.py", "independent.py", "PROOF.md", "README.md") + }, + "baseline_invoice": compiler.invoice(baseline), + "fused_invoice": compiler.invoice(fused), + "lowerings": lowering_evidence(compiler), + "laurent": laurent_evidence(compiler), + "finite_arrays": finite_array_evidence(compiler), + "negative_controls": negative_controls(compiler), + "claimed_scope": ( + "three-query completed native DATA shear for a=±3·2^j with odd moduli " + "coprime to 3; paid lowering, not a supplier" + ), + } + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--write", action="store_true", help="regenerate CERTIFICATE.json") + args = parser.parse_args() + compiler = load("program") + # Placeholder files must exist before hashing into the certificate. + for name in ("PROOF.md", "README.md", "independent.py", "SOURCES.json"): + need((ROOT / name).is_file(), f"missing {name}") + cert = build_certificate(compiler) + path = ROOT / "CERTIFICATE.json" + if args.write: + path.write_text(json.dumps(cert, indent=2, sort_keys=True) + "\n") + else: + committed = json.loads(path.read_text()) + need(canonical(committed) == canonical(cert), "CERTIFICATE mismatch") + inv = cert["fused_invoice"] + base = cert["baseline_invoice"] + print( + "PASS_TRIADIC_QUERY_PAIR " + f"children {base['ordinary_children']}->{inv['ordinary_children']}; " + f"affine {base['ordered_affine_events']}->{inv['ordered_affine_events']}; " + f"XOR {base['aligned_xor_scans']}->{inv['aligned_xor_scans']}; " + f"kernel=3 excluded_moduli={len(cert['lowerings']['excluded_moduli'])} " + f"rational={cert['lowerings']['rational_columns']} " + f"modular={cert['lowerings']['modular_columns']} " + f"two_query_census={cert['laurent']['two_query_products_checked']} " + f"dirty_columns={cert['finite_arrays']['full_dirty_endpoint_columns']} " + f"controls={len(cert['negative_controls'])} " + f"checks={CHECKS} no_new_kappa" + ) + + +if __name__ == "__main__": + main()