diff --git a/research/nine-query-fixed-tariff/CASES.json b/research/nine-query-fixed-tariff/CASES.json new file mode 100644 index 0000000000..11a82f0f08 --- /dev/null +++ b/research/nine-query-fixed-tariff/CASES.json @@ -0,0 +1,34 @@ +{ + "schema_version": 1, + "queries": 9, + "sources": 5, + "closed": [ + 0, + 1, + 3, + 2, + 6, + 14, + 10, + 26, + 16, + 0 + ], + "prices": { + "b": 38, + "a": 2, + "x": 2 + }, + "limits": { + "records": 4000, + "oracle_candidates": 400000, + "artifact_bytes": 8388608, + "command_seconds": 180 + }, + "credited_premises": { + "unrestricted_R_lower_bound": 68, + "X2_minimum_R": 70, + "fixed_price_optimum": 486 + }, + "scope": "Fixed-price path-lowered even-subset9query invoice only. Geometry6059Lemma2/1340table,6696X2floor/labeledcount/attainingpath remain prior. No pointcensus/newgeometry/newwitness/allpricefrontier/physicalbackend. Repeated prefixvalues allowed withoutfilter." +} diff --git a/research/nine-query-fixed-tariff/FLOOR.json.gz b/research/nine-query-fixed-tariff/FLOOR.json.gz new file mode 100644 index 0000000000..d99b3c3f5a Binary files /dev/null and b/research/nine-query-fixed-tariff/FLOOR.json.gz differ diff --git a/research/nine-query-fixed-tariff/NOTICE b/research/nine-query-fixed-tariff/NOTICE new file mode 100644 index 0000000000..c379eb2ca5 --- /dev/null +++ b/research/nine-query-fixed-tariff/NOTICE @@ -0,0 +1,24 @@ +Nine-query fixed-tariff closure and independent premise/ABI verification +Prepared for ToikY with substantial OpenAI Codex assistance; Apache-2.0. +Separate AI primary/oracle/static review is not independent human or proof-kernel +acceptance. Original source notices and licences remain exact in inputs/. + +apoursh PR6059: unrestricted nine-point difference bound, with its independent +geometry proof; Arham Tahir PR1340: prior normalized table and mutable-source +interface. The R68 consequence is prior geometry, not a new theorem here. +Nick Petalas PR6696: released nine-query question, X2minimumR70, labeledcount453600 +and attaining path; PR6695/5935 retain adjacent support/XOR context. No new floor, +forest counting law, point normalization/census or witness is claimed. +Wentao Li PR2677/2686/2643: path-lowered model/invoice and related questions; +Arham Tahir PR1898: abstract alphabet and six-query word; +ywz65 PR2455: component inequality; Ross Richardson PR943 and retained PR1370 +lineage: connector and ten-query context. + +Classical incidence rank, forests, subset dynamic programming, parity-state +shortest paths and reversible linear updates retain their usual credit. +Repository task/replay/export tooling retains Douglas Colkitt and other +contributors' attribution. Gzip payload equality follows Maxime Fleury's +reproducibility convention after Antoine Olivier's independent replay findings. +No predecessor program is imported or executed; model.py is inert text only. +This is a modest fixed-price corollary plus independent checks, not a new physical +backend, supplier admission, kappa improvement or selected-frontier update. diff --git a/research/nine-query-fixed-tariff/ORACLE.json b/research/nine-query-fixed-tariff/ORACLE.json new file mode 100644 index 0000000000..b2d33ab004 --- /dev/null +++ b/research/nine-query-fixed-tariff/ORACLE.json @@ -0,0 +1,72 @@ +{ + "case_manifest_sha256": "fc2c9be60d410124b45da970af462acc749275a35e20a16969527dca5b56f4ea", + "floor": { + "classes": 3780, + "coordinate_labelings": 120, + "histogram": [ + [ + 70, + 234 + ], + [ + 74, + 432 + ], + [ + 78, + 594 + ], + [ + 80, + 513 + ], + [ + 82, + 135 + ], + [ + 84, + 864 + ], + [ + 88, + 756 + ], + [ + 96, + 252 + ] + ], + "labeled_walks": 453600, + "minimum_R": 70, + "records_sha256": "652136f7b89793acfe5c437a939953bb06ddfbca2cf04f142b529e331aa849f2" + }, + "schema_version": 1, + "source_manifest_sha256": "0d1cbe7daa2cd1092c1a64a3615521b651faf8f83102b7db03896c17a0a09a1a", + "witness": { + "Q": 9, + "R": 70, + "X": 2, + "closed": [ + 0, + 1, + 3, + 2, + 6, + 14, + 10, + 26, + 16, + 0 + ], + "invoice": { + "borrowed_dirty_rows": 4, + "echo_nodes": 81, + "map_leaves": 322, + "root_dispatches": 81, + "source_XORs": 2, + "total": 486 + }, + "tariff": 486 + } +} diff --git a/research/nine-query-fixed-tariff/PROOF.md b/research/nine-query-fixed-tariff/PROOF.md new file mode 100644 index 0000000000..d6ef386e17 --- /dev/null +++ b/research/nine-query-fixed-tariff/PROOF.md @@ -0,0 +1,150 @@ +# The fixed nine-query tariff is486 + +This is a modest fixed-price corollary closing Nick Petalas's PR6696 README +question1, with independent premise/ABI verification. The geometry, unrestricted +readout consequence, X2minimum, forest count and attaining path retain predecessor +credit. No new point census, geometry law, witness or all-price frontier is claimed. + +## Exact inherited interface + +Use the five-source common-B, path-lowered even-subset model of Wentao Li2677, +built on Arham Tahir1898/1340. Five source rows,31output rows, connectorz and +private scratch are distinct and arbitrarily dirty. B and the31mapsA_m are +read-only exact linear maps; they need not be invertible or commute. The output +adds A_m B(sum_{j in m} x_j), restoring sources, connector and private rows. +Queries Q_j add Bx_j toz. Readouts R_m add A_m z toy_m. Source shears X_{p,j} +addx_j tox_p, and must be undone as prescribed by each path-local query lowering. +These are credited complete calls, not newly supplied physical implementations. + +Fix exactlyQ=9 queries and a restored closed nonzero-edge prefix path + + 0=w_0,w_1,...,w_9=0 inF2^5. + +Time slots arew_0,...,w_8; the final zero is identified with the initial slot. +Labels and zero revisits may repeat. The minimum readout for a nonzero maskm +is the least even subset of these nine slots whose XOR ism. All31masks must +be available. WithS=sum_t weight(w_t+w_(t+1)), the path-local source-shear count +isX=2(S-9). The fixed inherited tariff is + + T=38Q+2R+2X. + +We prove its exact minimum atQ=9 is486. The six-query tariff436 remains better; +this is completion of one existing invoice row, not a new supplier improvement. + +## Credited unrestricted readout bound + +Every nonzero mask needs at least two readouts. It has cost two exactly when +it is a difference of two distinct support values. IfD(A) denotes the nonzero +pair differences of the at-most-nine-point slot support, apoursh6059 Lemma2 +proves |D(A)|<=28 without restricting the point set to a particular walk. +Although that package's main theorem concerns partitioned independent walks, +this lemma is an unrestricted finite-geometry statement and applies here. +The package's partitioned Q=9 readout row must not be transferred to this model. + +Thus at least three of the31masks cost at least four and + + R>=28*2+3*4=68. (1) + +Smaller supports and repeated slot labels are included; duplicates create no +new nonzero pair difference. Arham Tahir1340's prior normalized table also has +maximum coverage29 INCLUDING zero, hence28nonzero differences. This immediate +R68consequence is prior geometry, not a new floor here. No2600-support census +is executed by this package. Other masks might cost more than four, so(1)is +only a lower bound, not an attainment assertion. + +## The source-XOR gap and fixed price + +Coverage requires the query increments to spanF2^5. Each coordinate therefore +appears in at least one increment; closure makes its occurrence count positive +even, hence at least two. ConsequentlyS is even andS>=10, giving + + X=2(S-9) in{2,6,10,...}. (2) + +IfX>=6, (1) gives + + T>=38*9+2*68+2*6=490. (3) + +IfX=2, Nick Petalas6696 already establishes minimumR=70 in this floor layer, +and supplies the attaining closed path + + (0,1,3,2,6,14,10,26,16,0). (4) + +So that layer hasT>=342+140+4=486, attained by(4). Combining it with(3) +proves the exact fixed-price optimum486. Neither the witness nor the X2floor +is new here. The useful added result is this explicit priced closure plus an +independent full-data check of the premise and the credited word's actual ABI. +No claim is made about all positive prices or arbitrary non-path source shears. + +## Independent finite control of the X2 premise + +AtX=2, S=10, so every source coordinate occurs in exactly two of the nine +query increments. Represent each coordinate by an edge joining its two query +positions. Full rank forbids parallel edges and cycles, because either would +make these incidence columns linearly dependent overF2. Nonzero increments +forbid isolated query vertices. Thus there is a simple forest with nine labeled +vertices and five edges, no isolates, and four components. Each component has +at least two vertices. The only component sizes are3+2+2+2, giving one three- +vertex path and three separate edges. + +Choose the three-vertex center in9ways, its two leaves inC(8,2)=28ways, and a +perfect matching of the remaining six vertices in15ways. This gives3780graphs. +Coordinate labels may be assigned to their five edges in5!=120ways, giving +453600labeled walks, the count already recorded by6696. Coordinate permutations +preserve the sum over ALL31readout demands and the uniform source-XOR/query +prices. They do not quotient query-position rotations or reversals. Assigning +bits0..4to lexicographically sorted edges gives one exact representative per +coordinate-label class. Repeated prefix values remain allowed; none are filtered. + +The primary enumerates these center/leaves/matching graphs, reconstructs all +nine slots and enumerates all512subsets for each even-subset minimum. The +independent engine instead scans allC(36,5)five-edge subsets and uses a64-state +(mask,parity) BFS. They retain and compare every actual graph-code/slot/minimum +row, not merely a common minimum or histogram. This corroborates the credited +X2premise without importing its checker. The forest classification/count is +not presented as a new counting theorem. + +## Actual word and complete abstract invoice + +For the credited path(4), the primary chooses one minimum even subset per output +mask. At each query edge, it shears all other active sources into the least-bit +pivot, callsQ on that pivot, and undoes shears in reverse order. Readouts occur +at the selected prefix slots. Own tie choices are not a new witness claim. +The submitted data must bind the literal query prefixes to(4), each readout's +minimum even subset/XOR, and the full dirty endpoint. + +The literal interpreter retains distinct noncommuting operator words. A readout +of a query contribution isA_m B x_j in that order; no commutation is used. +Every old dirtyy_m is preserved, dirtyz cancels, and every source/private row +returns. Reversing the complete literal instruction list is its inverse because +each elementary update is self-inverse overF2. This proves the formal ABI rather +than just testing zero inputs or commuting scalar operators. + +The inherited complete-call fixture decomposes the actual countsQ9,R70,X2 as + + map leaves=28Q+R=322, + echo nodes=9Q=81, + source XORs=2, + root dispatches=Q+R+X=81, + borrowed dirty rows=4, + total=322+81+2+81=486. + +These are the source2677abstract prices and resource accounting, not a new +physical backend, recursive implementation or primitive tariff. Actual serialized +word data and all floor records are retained inFLOOR.json.gz and independently +checked after blind first seals. The source model itself stays inert text. + +## Limits and predecessor credit + +The exact scope is path-lowered restored single-walk nine-query programs with +all31even-subset readouts and uniform fixed prices(38,2,2). It does not price +physical source access, map delivery, routing, admission, stock, precision, +restoration implementations or a complete supplier/outer caller. No newkappa, +selected-frontier change, human acceptance or formal proof-kernel result follows. + +Credit apoursh6059 for unrestricted nine-point geometry; Arham Tahir1340 for +its prior table and mutable-source contract; Nick Petalas6696 for the released +question, X2minimum/count and path,6695/5935 for adjacent support/XOR context; +Wentao Li2677/2686/2643, Arham Tahir1898, ywz652455, Ross Richardson943 and the +retained1370lineage. The new work is the modest fixed-price closure and separate +premise/data/ABI verification. Classical incidence rank, forest counting, +subset dynamic programming and shortest paths retain their usual credit. diff --git a/research/nine-query-fixed-tariff/README.md b/research/nine-query-fixed-tariff/README.md new file mode 100644 index 0000000000..bd677be676 --- /dev/null +++ b/research/nine-query-fixed-tariff/README.md @@ -0,0 +1,82 @@ +# Exact fixed-price nine-query tariff486 + +Close Nick Petalas's [PR6696 question1](https://github.com/CrocSwap/integer-mult-bounds/pull/6696): +in the five-source path-lowered even-subset class at prices(b,a,x)=(38,2,2), +the minimum at exactly nine queries is486. This is a modest corollary with +independent premise/ABI verification, not a new geometry or counting law. + +The credited unrestricted nine-point geometry of apoursh6059 Lemma2 (also +Arham Tahir1340's prior table) givesR>=68. Path-local closure forcesX in +{2,6,10,...}; thereforeX>=6 costs at least490. PR6696's knownX2minimumR70 +and credited path(0,1,3,2,6,14,10,26,16,0) attain486. No new witness, +2600-point normalization/census, all-price frontier or physical supplier is claimed. +The six-query tariff436 remains better. See [PROOF.md](PROOF.md). + +## Evidence and reproduction + +The primary independently enumerates3780coordinate-unlabeled X2forest graphs, +using one three-vertex path plus three paired edges on the nine query positions. +Every graph's actual code, nine prefix slots and31even-subset minima are retained +in [FLOOR.json.gz](FLOOR.json.gz). Repeated prefix values are allowed, not filtered. +All120coordinate labelings preserveR/X, recovering the credited453600walks. +The primary uses512subset states. The independent engine scans five-edge subsets +and uses64(mask,parity) BFS states; actual complete rows are compared after blind +first seals. MinimumR70/classification/count remain credited premises checked +independently, not newly claimed floor or enumeration results. + +The submitted actual witness word has9queries,70readouts,2sourceXORs,81root +dispatches and fixture invoice322map leaves+81echo nodes+2XORs+81dispatches=486, +with4borrowed dirty rows. A free noncommuting operator-word interpreter checks +its actual query prefixes, minimum even readout slots, every dirty output/source/ +connector/private row, full map and literal inverse. The old model remains inert +text. This checks the abstract ABI and inherited complete-call price fixture; +no physical backend, native multiplier, stock or precision claim follows. + +From the repository root, CPython3.12, standard library only: + +```sh +python3.12 -I -W error -B research/nine-query-fixed-tariff/verify.py +python3.12 -I -W error -B research/nine-query-fixed-tariff/oracle.py --check-primary research/nine-query-fixed-tariff/RESULT.json +python3.12 -W error -B scripts/research_package.py --package research/nine-query-fixed-tariff +``` + +[VERIFY.json](VERIFY.json) adds both optimized modes and declaresFLOOR.json.gz as +a runtime input. Direct commands are read-only and need noGit/network/compiler/ +Lean/Docker. Source/cases/schema authenticate before computation. Exact typed +retained values, duplicate/nonfinite/float/boolean-alias guards and ten primary +parser/ABI/omission negative controls remain active under-O. Proof artifacts are +bounded at8MiB,4000records and180s per command. New functions stay below50physical +lines. CPython dynamic allocation, arbitrary-precision integers and bounded +recursive JSON comparison are declared managed-runtime deviations. Regenerated +gzip equality compares complete canonical payloads, not container bytes. + +[RUN-RECORDS.json](RUN-RECORDS.json) and [VALIDATION.md](VALIDATION.md) retain exact +first timings, subsequent checks, corrections and pending transport stages. +Formal-kernel and independent human acceptance are unclaimed. + +## Open next questions + +Structured copies are in [TASK.json](TASK.json). + +1. What is the full nine-query frontier for arbitrary positive prices? This + fixed-price closure does not classify the higher-X tradeoffs. First define + one source-bound price region and its relevant layers before a wider census. +2. Does the fixed nine-query486 tariff extend to non-path restored source-XOR + programs? Prior projection/geometry already gives the genericR68bound. First + classify their actualX2source cost; the path-localX=2(S-9)/forest reduction + does not establish a non-pathX2minimum or fixed486tariff. +3. Can one physical caller implement the inherited price fixture profitably? + Specify complete calls, access, dirty restoration, routing, coefficient/ + precision/stock and all extra caller charges. None is supplied by this invoice. + +## Credit + +apoursh6059 supplies the unrestricted geometry; Arham Tahir1340 its prior table +and mutable-source contract. Nick Petalas6696 supplies the question, floor count, +X2minimum and attaining path;6695/5935 retain adjacent support/XOR context. +Wentao Li2677/2686/2643, Arham Tahir1898, ywz652455, Ross Richardson943 and the +retained1370lineage keep predecessor credit. Exact original notices remain in +inputs/ with [SOURCE-PINS.json](SOURCE-PINS.json). Classical incidence rank, +forest counting, subset DP and shortest paths are used. Prepared for ToikY with +substantial OpenAI Codex assistance and separate AI primary/oracle/static review, +Apache-2.0. No predecessor source, κ or selected frontier changes. diff --git a/research/nine-query-fixed-tariff/RESULT.json b/research/nine-query-fixed-tariff/RESULT.json new file mode 100644 index 0000000000..fe9ffc37eb --- /dev/null +++ b/research/nine-query-fixed-tariff/RESULT.json @@ -0,0 +1 @@ +{"case_manifest_sha256":"fc2c9be60d410124b45da970af462acc749275a35e20a16969527dca5b56f4ea","floor":{"classes":3780,"coordinate_labelings":120,"histogram":[[70,234],[74,432],[78,594],[80,513],[82,135],[84,864],[88,756],[96,252]],"labeled_walks":453600,"minimum_R":70,"records_sha256":"652136f7b89793acfe5c437a939953bb06ddfbca2cf04f142b529e331aa849f2"},"schema_version":1,"source_manifest_sha256":"0d1cbe7daa2cd1092c1a64a3615521b651faf8f83102b7db03896c17a0a09a1a","witness":{"Q":9,"R":70,"X":2,"closed":[0,1,3,2,6,14,10,26,16,0],"invoice":{"borrowed_dirty_rows":4,"echo_nodes":81,"map_leaves":322,"root_dispatches":81,"source_XORs":2,"total":486},"tariff":486}} diff --git a/research/nine-query-fixed-tariff/RUN-RECORDS.json b/research/nine-query-fixed-tariff/RUN-RECORDS.json new file mode 100644 index 0000000000..6fb8ac74e0 --- /dev/null +++ b/research/nine-query-fixed-tariff/RUN-RECORDS.json @@ -0,0 +1,530 @@ +{ + "schema_version": 1, + "environment": { + "python_executable": "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "python_version": "3.12.14", + "platform": "macOS26.5.2arm64", + "dependencies": "stdlib only", + "concurrency": "One scientific child at a time; other work static review/metadata only." + }, + "advance_claim": { + "url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19386799", + "status": "Rendered before candidate execution." + }, + "immutable_inputs": { + "SOURCE-PINS.json": "0d1cbe7daa2cd1092c1a64a3615521b651faf8f83102b7db03896c17a0a09a1a", + "CASES.json": "fc2c9be60d410124b45da970af462acc749275a35e20a16969527dca5b56f4ea", + "SCHEMA.json": "0d5089118230203c2f689e2084292997f1c6d07a735f9c3641fc788cb03f99c1" + }, + "primary_first": { + "utc_after_first": "2026-11-04T00:51:34.009186+00:00", + "elapsed_seconds": 0.298162, + "returncode": 0, + "child_maxrss_bytes_darwin": 33062912, + "command": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/verify.py", + "--emit", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/RESULT.json", + "--write-floor", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/FLOOR.json.gz" + ], + "code_unchanged": true, + "RESULT.json": { + "bytes": 660, + "sha256": "8b98751237f50460314b1493c9f9b3a6a0fcc893c221c52177bc1d52035b70e3" + }, + "FLOOR.json.gz": { + "bytes": 44055, + "sha256": "451c9800bfbeffec9ebe4110262bbc2458d34a3c848ded9ad3f6c12a61db60cc" + }, + "utc_before_first": "2026-11-04T00:51:33.689132+00:00", + "source_code_sha256": "6c9223a36f1e8e235467808ea6a4464cc5c799cd0fde1a2da3c1b8fd7586b5de" + }, + "primary_strict_modes": [ + { + "label": "RETAINED", + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/verify.py" + ], + "returncode": 0, + "elapsed_seconds": 0.260588, + "utc_finished": "2026-11-04T00:53:55.661171+00:00", + "cumulative_child_maxrss_bytes_darwin": 32276480 + }, + { + "label": "OPTIMIZED-RETAINED", + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "-O", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/verify.py" + ], + "returncode": 0, + "elapsed_seconds": 0.314879, + "utc_finished": "2026-11-04T00:53:55.976461+00:00", + "cumulative_child_maxrss_bytes_darwin": 33832960 + }, + { + "label": "EMIT", + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/verify.py", + "--emit", + "/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/EMIT.json", + "--write-floor", + "/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/EMIT-FLOOR.json.gz" + ], + "returncode": 0, + "elapsed_seconds": 0.328168, + "utc_finished": "2026-11-04T00:53:56.304844+00:00", + "cumulative_child_maxrss_bytes_darwin": 33832960 + }, + { + "label": "OPTIMIZED-EMIT", + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "-O", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/verify.py", + "--emit", + "/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/OPTIMIZED-EMIT.json", + "--write-floor", + "/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/OPTIMIZED-EMIT-FLOOR.json.gz" + ], + "returncode": 0, + "elapsed_seconds": 0.363255, + "utc_finished": "2026-11-04T00:53:56.668963+00:00", + "cumulative_child_maxrss_bytes_darwin": 33832960 + } + ], + "primary_canonical_regeneration": { + "code_unchanged_since_first": true, + "receipt_unchanged_since_first": true, + "original_floor_container_unchanged": true, + "separate_canonical_results_equal": true, + "all_decompressed_artifact_values_equal": true, + "decompressed_artifact_bytes": 379624, + "canonical_artifact_sha256": "725dd3b22d137b5e4c7d8f1571b2b5fad4ca8aedc32a03b837dba771fee6ed87", + "result_sha256": "8b98751237f50460314b1493c9f9b3a6a0fcc893c221c52177bc1d52035b70e3", + "gzip_container_equality_required_for_regeneration": false, + "utc": "2026-11-04T00:53:56.670183+00:00" + }, + "oracle_blind_first": { + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/oracle.py", + "--emit", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/ORACLE.json", + "--first-evidence", + "/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/ORACLE-FIRST-FOREST.json.gz" + ], + "canonical_receipt_sha256": "8b98751237f50460314b1493c9f9b3a6a0fcc893c221c52177bc1d52035b70e3", + "code_after_sha256": "c613c593f1361255d12234a292ac29cceacf5063a2a400c079ce56a6c8964b8d", + "code_before_sha256": "c613c593f1361255d12234a292ac29cceacf5063a2a400c079ce56a6c8964b8d", + "elapsed_seconds": 0.32027870789170265, + "exit_code": 0, + "own_forest_compressed_bytes": 44045, + "own_forest_sha256": "9929751ad1779a5cc59361254a2de5e8f090c2d91762ef5a810fb8fefaa700b7", + "peak_rss_bytes_macos": 31817728, + "primary_data_read": false, + "python": "3.12.14 (main, Aug 25 2026, 13:50:33) [Clang 22.1.3 ]", + "receipt_sha256": "d89a83987bc51dbdf38e83f59562781db1a5da3840722794a7fb0310a314b3cb", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_sha256": "a38e6884fff2be066a3cc37b55b79d8615d3f4a7da7d6ffb0cfd148bc6c4b7d6", + "utc_finished": "2026-11-04T00:52:34.901117+00:00", + "utc_started": "2026-11-04T00:52:34.580703+00:00" + }, + "oracle_actual_modes": [ + { + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/oracle.py", + "--check-primary", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/RESULT.json" + ], + "code_sha256": "c613c593f1361255d12234a292ac29cceacf5063a2a400c079ce56a6c8964b8d", + "elapsed_seconds": 0.26709595788270235, + "exit_code": 0, + "peak_rss_bytes_macos": 35536896, + "python": "3.12.14 (main, Aug 25 2026, 13:50:33) [Clang 22.1.3 ]", + "source_cases_schema": { + "CASES.json": "fc2c9be60d410124b45da970af462acc749275a35e20a16969527dca5b56f4ea", + "SCHEMA.json": "0d5089118230203c2f689e2084292997f1c6d07a735f9c3641fc788cb03f99c1", + "SOURCE-PINS.json": "0d1cbe7daa2cd1092c1a64a3615521b651faf8f83102b7db03896c17a0a09a1a" + }, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_sha256": "6123850a5c6dd3515340ab996d8e99ad853d85aa8ff4ae3277f956b299dad946", + "utc_finished": "2026-11-04T00:54:34.614937+00:00", + "utc_started": "2026-11-04T00:54:34.348063+00:00" + }, + { + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-W", + "error", + "-B", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/oracle.py", + "--check-primary", + "/private/tmp/crocswap-b9/research/nine-query-fixed-tariff/RESULT.json" + ], + "code_sha256": "c613c593f1361255d12234a292ac29cceacf5063a2a400c079ce56a6c8964b8d", + "elapsed_seconds": 0.30417354218661785, + "exit_code": 0, + "peak_rss_bytes_macos": 36241408, + "python": "3.12.14 (main, Aug 25 2026, 13:50:33) [Clang 22.1.3 ]", + "source_cases_schema": { + "CASES.json": "fc2c9be60d410124b45da970af462acc749275a35e20a16969527dca5b56f4ea", + "SCHEMA.json": "0d5089118230203c2f689e2084292997f1c6d07a735f9c3641fc788cb03f99c1", + "SOURCE-PINS.json": "0d1cbe7daa2cd1092c1a64a3615521b651faf8f83102b7db03896c17a0a09a1a" + }, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_sha256": "6123850a5c6dd3515340ab996d8e99ad853d85aa8ff4ae3277f956b299dad946", + "utc_finished": "2026-11-04T00:54:34.919589+00:00", + "utc_started": "2026-11-04T00:54:34.615685+00:00" + } + ], + "independence": "Neitherengine readpeer scientificdata/code before blindfirst; no predecessorexecutable or peercode imported/executed. Afterbothfirsts actualsubmittedrecord+worddata checked semantically, not justhashes.", + "common_canonical_sha256": "8b98751237f50460314b1493c9f9b3a6a0fcc893c221c52177bc1d52035b70e3", + "primary_full_artifact_canonical_sha256": "725dd3b22d137b5e4c7d8f1571b2b5fad4ca8aedc32a03b837dba771fee6ed87", + "artifact_ties": "Oracleown firstword/artifact maydiffer in validminimumties/format; wholeprimary artifact independentlyvalidated, no raw/canonicalpeerartifact equalityclaimed. Primaryregeneration compares its own completecanonicalvalues.", + "primary_internal_negative_controls": 10, + "oracle_internal_controls": 16, + "scientific_failures": [], + "corrections": [], + "static_review": "pending final proof/metadata review", + "root_external_controls": "pending root evidence", + "registered_history_export_cold": "pending root evidence", + "publication_ci": "pending", + "root_external_rejections": { + "runs": [ + { + "name": "source-verify.py", + "engine": "verify.py", + "started_at": "2026-11-04T00:58:09.492071+00:00", + "seconds": 0.0834295004606247, + "exit": 1, + "expected_fragment": "source", + "diagnostic": "FAIL: source bytes/SHA256", + "intended": true + }, + { + "name": "source-oracle.py", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:09.576872+00:00", + "seconds": 0.07549379114061594, + "exit": 1, + "expected_fragment": "source", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: source bytes changed", + "intended": true + }, + { + "name": "cases-verify.py", + "engine": "verify.py", + "started_at": "2026-11-04T00:58:09.653334+00:00", + "seconds": 0.07210233435034752, + "exit": 1, + "expected_fragment": "case", + "diagnostic": "FAIL: immutable CASES.json", + "intended": true + }, + { + "name": "cases-oracle.py", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:09.726405+00:00", + "seconds": 0.07317341584712267, + "exit": 1, + "expected_fragment": "case", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: source/case/schema digest changed", + "intended": true + }, + { + "name": "schema-verify.py", + "engine": "verify.py", + "started_at": "2026-11-04T00:58:09.800719+00:00", + "seconds": 0.07226629089564085, + "exit": 1, + "expected_fragment": "schema", + "diagnostic": "FAIL: immutable SCHEMA.json", + "intended": true + }, + { + "name": "schema-oracle.py", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:09.873977+00:00", + "seconds": 0.07238016743212938, + "exit": 1, + "expected_fragment": "schema", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: source/case/schema digest changed", + "intended": true + }, + { + "name": "missing-primary", + "engine": "verify.py", + "started_at": "2026-11-04T00:58:09.947550+00:00", + "seconds": 0.2604710003361106, + "exit": 1, + "expected_fragment": "no such file", + "diagnostic": "FAIL: [Errno 2] No such file or directory: '/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/MUTANT/RESULT.json'", + "intended": true + }, + { + "name": "missing-floor", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:10.209818+00:00", + "seconds": 0.2800471670925617, + "exit": 1, + "expected_fragment": "no such file", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: [Errno 2] No such file or directory: '/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/MUTANT/FLOOR.json.gz'", + "intended": true + }, + { + "name": "bool-primary-version", + "engine": "verify.py", + "started_at": "2026-11-04T00:58:10.491363+00:00", + "seconds": 0.2601747503504157, + "exit": 1, + "expected_fragment": "retained result", + "diagnostic": "FAIL: actual complete retained result differs", + "intended": true + }, + { + "name": "bool-peer-version", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:10.752711+00:00", + "seconds": 0.2782533336430788, + "exit": 1, + "expected_fragment": "version", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: receipt version must be integer1", + "intended": true + }, + { + "name": "duplicate-peer", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:11.032128+00:00", + "seconds": 0.27526712510734797, + "exit": 1, + "expected_fragment": "duplicate", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: duplicate JSON key: schema_version", + "intended": true + }, + { + "name": "nonfinite-peer", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:11.308473+00:00", + "seconds": 0.2769662905484438, + "exit": 1, + "expected_fragment": "noninteger", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: noninteger JSON number forbidden: NaN", + "intended": true + }, + { + "name": "wrong-complete-invoice", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:11.586627+00:00", + "seconds": 0.2789960000663996, + "exit": 1, + "expected_fragment": "receipt differs", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: actual complete primary receipt differs", + "intended": true + }, + { + "name": "bool-artifact-version", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:11.952409+00:00", + "seconds": 0.28138583432883024, + "exit": 1, + "expected_fragment": "artifact version", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: FLOOR artifact version invalid", + "intended": true + }, + { + "name": "missing-actual-record", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:12.319603+00:00", + "seconds": 0.2828799160197377, + "exit": 1, + "expected_fragment": "record count", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: actual forest record count invalid", + "intended": true + }, + { + "name": "duplicate-graph-record", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:12.688850+00:00", + "seconds": 0.27906000055372715, + "exit": 1, + "expected_fragment": "graph/slot order", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: actual graph/slot order differs", + "intended": true + }, + { + "name": "odd-minimum-parity", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:13.054709+00:00", + "seconds": 0.2816545832902193, + "exit": 1, + "expected_fragment": "positive even", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: minimum table requires31 positive even integer entries", + "intended": true + }, + { + "name": "wrong-even-minimum", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:13.422942+00:00", + "seconds": 0.2810514997690916, + "exit": 1, + "expected_fragment": "minimum table differs", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: actual minimum table differs from independent parity BFS", + "intended": true + }, + { + "name": "extra-closing-zero-read", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:13.790882+00:00", + "seconds": 0.29949095752090216, + "exit": 1, + "expected_fragment": "final closing", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: final closing zero is not an extra readout slot", + "intended": true + }, + { + "name": "omitted-source-undo", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:14.180389+00:00", + "seconds": 0.3220097925513983, + "exit": 1, + "expected_fragment": "query", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: query/source restoration failed", + "intended": true + }, + { + "name": "source-port-alias", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:14.594728+00:00", + "seconds": 0.3248987905681133, + "exit": 1, + "expected_fragment": "alias", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: source shear may not alias", + "intended": true + }, + { + "name": "boolean-word-port", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:15.014439+00:00", + "seconds": 0.33464616630226374, + "exit": 1, + "expected_fragment": "not bool", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: word arguments must be integers, not bool", + "intended": true + }, + { + "name": "wrong-demand-readout", + "engine": "oracle.py", + "started_at": "2026-11-04T00:58:15.441908+00:00", + "seconds": 0.32192504219710827, + "exit": 1, + "expected_fragment": "readout", + "diagnostic": "FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: readout must use one minimum even subset of the nine slots", + "intended": true + } + ], + "all_intended": true, + "mutant_restored": true + }, + "root_harness_draft_preseal": { + "at": "2026-11-04T00:56:10.300322+00:00", + "harness_sha256": "4a67432ee751a9f9d377934b178444470a2fa9cb1f34a4f936095e282a2e2804", + "scope": "23 actualCLI source/profile/actualfloor/dirtyword/invoice mutations, intendedguardstrings inspected from code; no execution yet" + }, + "root_harness_executed_preseal": { + "at": "2026-11-04T00:58:09.366276+00:00", + "harness_sha256": "aab5462f0acf58306e862f1e24c8f4f42ffe13ea6d5e6fb18a30def9d6f694be", + "static_review": "B7 confirmed all23 mutations/expected guards effective. Root targeted lastX undo ratherthan firstX compute before ANY execution; initialdraft retained.", + "cases": 23 + }, + "root_registered_commit_export": [ + { + "name": "REGISTERED", + "exit": 0, + "seconds": 1.4635152081027627, + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "scripts/research_package.py", + "--package", + "research/nine-query-fixed-tariff" + ] + }, + { + "name": "COMMIT-CHECK", + "exit": 0, + "seconds": 0.1314303744584322, + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "scripts/check_research_commit.py", + "--package", + "research/nine-query-fixed-tariff", + "--check-source-history", + "--check-modes" + ] + }, + { + "name": "INITIAL-EXPORT", + "exit": 0, + "seconds": 0.08649512473493814, + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "scripts/export_research_package.py", + "export", + "--package", + "research/nine-query-fixed-tariff", + "--ref", + "HEAD", + "--output", + "/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/INITIAL-PACKAGE.tar" + ] + }, + { + "name": "INITIAL-EXPORT-CHECK", + "exit": 0, + "seconds": 0.04365691635757685, + "argv": [ + "/Users/evaayala/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "scripts/export_research_package.py", + "check", + "/private/tmp/contribution-batch-b10-20261103T1814Z/session-10/INITIAL-PACKAGE.tar", + "--check-inputs" + ] + } + ], + "science_freeze_utc": "2026-11-04T01:01:31.540618+00:00" +} diff --git a/research/nine-query-fixed-tariff/SCHEMA.json b/research/nine-query-fixed-tariff/SCHEMA.json new file mode 100644 index 0000000000..a01717b3b2 --- /dev/null +++ b/research/nine-query-fixed-tariff/SCHEMA.json @@ -0,0 +1,17 @@ +{ + "schema_version": 1, + "common_keys": [ + "schema_version", + "source_manifest_sha256", + "case_manifest_sha256", + "floor", + "witness" + ], + "floor": "Exactkeys classes,labeled_walks,coordinate_labelings,minimum_R,histogram,records_sha256. Histogram sorted[R,count]. recordsSHA256 canonical complete sorted[graph_code,slots9,minimum31]rows, not justaggregate.", + "witness": "Exactkeys closed,Q,R,X,tariff,invoice. Invoiceexact map_leaves,echo_nodes,source_XORs,root_dispatches,borrowed_dirty_rows,total. Closed sourcepath bindsCASES. Tiewordhash excluded fromcommon.", + "artifact": "FLOOR.json.gz exactschema_version,records,witness_word. Recordsascending distinctstrictint graphcodes:36bitbitsetoverlexcombinations(range(9),2);fiveedges sortedlex assigncoordinatebits0..4. Slots9 includeinitial0 and excludeclosing0; repeatedvaluesallowed. Minimum31positiveevenint values inmask1..31order. Fullactualrows compared toindependentoracle afterbothfirsts.", + "word": "Actualwitness_word instructionarrays R=[R,mask1..31],Q=[Q,source0..4],X=[X,donor,target],donor!=target; strictintegers excludingbool. Buildfromminimumevenreadoutsubsets onactualclosedsourcepath, leastsetbitquerypivot and reverseundosourceXORs. Rtime slots0..8, onepermask/slot; no finalclosing slotread. Actualwordbinding/dirtyfree-noncommutingrootmap/restoration/literalreverse/fullinvoice MUSTvalidated afterbothfirsts.", + "canonical": "jsonsort_keys=True,separators=(comma,colon),UTF8+LF. Compressioncontainerdiagnostic only; regeneratedcompletecanonicalvalues required.", + "admission": "Authenticate4inertsources/source manifest+CASES+SCHEMA beforecandidatework; exacttypedkeys/numbers/booleanguards and duplicate/nonfinite/floatrejection. PrimaryRESULTcommon5only. No sourceprogramimport/execution or peerprogramread/import.", + "price_proof": "ForX2 independentlyverifyall3780forestclasses(minR70) andcredited453600labeledwalks. ForX>=6 useCREDITEDR>=68=>price>=490;priorwitnessX2R70price486. No newunrestrictedR68geometryclaim." +} diff --git a/research/nine-query-fixed-tariff/SOURCE-PINS.json b/research/nine-query-fixed-tariff/SOURCE-PINS.json new file mode 100644 index 0000000000..0f8965e8e0 --- /dev/null +++ b/research/nine-query-fixed-tariff/SOURCE-PINS.json @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "scope": "Four immutable inert source inputs only; no predecessor executable imported/run. Geometry/floor/classification/witness credit remains prior; new fixed-price closure and independent X2 premise/ABI verification only.", + "files": [ + { + "repository": "apoursh/integer-mult-bounds", + "commit": "fc3647b48d02bb8aab2d2f9460db39d276497ed1", + "source_path": "research/partitioned-walk-exact-frontier/PROOF.md", + "local_path": "inputs/6059-PROOF.md", + "git_blob": "3c3f30af7d0df99b66d4d5ab1741169ac73a15ae", + "sha256": "19485bcd570dc3e59e1a41cb90af444523466f54073b476ce1f8d5a4d2006766", + "bytes": 12173 + }, + { + "repository": "Arham-Tahir64/integer-mult-bounds", + "commit": "f1dcab36fa63f8226f70dd07e26f44afb9d39b51", + "source_path": "research/mutable-source-connector/PROOF.md", + "local_path": "inputs/1340-PROOF.md", + "git_blob": "4d6106417cf3ebf69c43b18dbb3e3da18b870efd", + "sha256": "f6a43a3e2047b33e39d729c872b23428989c6443e21c9394c2add7aa86997782", + "bytes": 9525 + }, + { + "repository": "petalas/integer-mult-bounds", + "commit": "2f4add4b548b7eb0ae38abb61fa5dc15d5a2a857", + "source_path": "research/eight-query-path-lowered-tariff/README.md", + "local_path": "inputs/6696-README.md", + "git_blob": "8929afca2db3ac6f72d96f06e9f1c4e4e908de7d", + "sha256": "3766877a916f7419bc21b487d1a0c47e37ad8dff641c01c05ad108aa25d96243", + "bytes": 10056 + }, + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "source_path": "research/mutable-source-789q-invoice/model.py", + "local_path": "inputs/MODEL2677.py.txt", + "git_blob": "8ce90c48df0a2f9eba9847f3dfe71ce6677897d1", + "sha256": "6696b01837e526f365576c6e35367fa8a1494f5bd3f49af7fe38c52366668c13", + "bytes": 7403 + } + ] +} diff --git a/research/nine-query-fixed-tariff/SOURCES.json b/research/nine-query-fixed-tariff/SOURCES.json new file mode 100644 index 0000000000..ff4dd00782 --- /dev/null +++ b/research/nine-query-fixed-tariff/SOURCES.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a", + "sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa" + }, + { + "path": "research/mutable-source-789q-invoice/model.py", + "usage": "provenance", + "git_blob": "8ce90c48df0a2f9eba9847f3dfe71ce6677897d1", + "sha256": "6696b01837e526f365576c6e35367fa8a1494f5bd3f49af7fe38c52366668c13" + } + ] +} diff --git a/research/nine-query-fixed-tariff/SOURCES.md b/research/nine-query-fixed-tariff/SOURCES.md new file mode 100644 index 0000000000..a6fc041db4 --- /dev/null +++ b/research/nine-query-fixed-tariff/SOURCES.md @@ -0,0 +1,14 @@ +# Frozen source and inherited coverage + +SOURCES.json binds canonical catalogue/selected record/model as historical Git provenance at7c49fe32c55de02c2c873655c804b16e4c3fef0a. Runtime uses four exact vendored inert inputs, authenticated by source manifest/bytes/SHA256/originalGitblobs before computation. Pending fork ancestry is not claimed. No external runtime/Git/network dependency or sourceprogram import/execution. + +- `inputs/6059-PROOF.md`: `apoursh/integer-mult-bounds@fc3647b48d02bb8aab2d2f9460db39d276497ed1` / `research/partitioned-walk-exact-frontier/PROOF.md`; Gitblob `3c3f30af7d0df99b66d4d5ab1741169ac73a15ae`, SHA256 `19485bcd570dc3e59e1a41cb90af444523466f54073b476ce1f8d5a4d2006766`. + +- `inputs/1340-PROOF.md`: `Arham-Tahir64/integer-mult-bounds@f1dcab36fa63f8226f70dd07e26f44afb9d39b51` / `research/mutable-source-connector/PROOF.md`; Gitblob `4d6106417cf3ebf69c43b18dbb3e3da18b870efd`, SHA256 `f6a43a3e2047b33e39d729c872b23428989c6443e21c9394c2add7aa86997782`. + +- `inputs/6696-README.md`: `petalas/integer-mult-bounds@2f4add4b548b7eb0ae38abb61fa5dc15d5a2a857` / `research/eight-query-path-lowered-tariff/README.md`; Gitblob `8929afca2db3ac6f72d96f06e9f1c4e4e908de7d`, SHA256 `3766877a916f7419bc21b487d1a0c47e37ad8dff641c01c05ad108aa25d96243`. + +- `inputs/MODEL2677.py.txt`: `CrocSwap/integer-mult-bounds@7c49fe32c55de02c2c873655c804b16e4c3fef0a` / `research/mutable-source-789q-invoice/model.py`; Gitblob `8ce90c48df0a2f9eba9847f3dfe71ce6677897d1`, SHA256 `6696b01837e526f365576c6e35367fa8a1494f5bd3f49af7fe38c52366668c13`. + + +apoursh6059Lemma2 is an unrestricted<=9point-set difference bound despite that package main theorem using independent partitioned walks. Its Q9partitioned readout value must not be transferred here. ArhamTahir1340table coverage includeszero, so maximum29means28nonzero differences. R68 is an immediate priorgeometry consequence. NickPetalas6696 supplies X2minimumR70/count453600/attainingpath and explicitfixedpricequestion. The only new claim is the priced486closure plus independentpremise/actualABI checks. Old model source is inert text; all original notices remain intact. diff --git a/research/nine-query-fixed-tariff/TASK.json b/research/nine-query-fixed-tariff/TASK.json new file mode 100644 index 0000000000..050e9e34f9 --- /dev/null +++ b/research/nine-query-fixed-tariff/TASK.json @@ -0,0 +1,111 @@ +{ + "schema_version": 1, + "task_id": "independent-moment", + "priority_revision": 8, + "base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "original_card": { + "id": "independent-moment", + "question": "Does a changed construction's serialized target/paid invoice independently support its claimed improvement?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "docs/research/recursive-invoice-preflight.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Demonstrate independence, source binding, positive cases and semantic failure controls. Name the existing checks and the missing coverage. More digits or another equivalent evaluation of an unchanged root is not by itself new verification coverage.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Independently recount one changed emitted word and its complete caller, importing no constructor or pricing engine. Include target losses, owned lifetimes, native orientation and extra charges. Check existing #5633/#5708/#5717/#5719 coverage to avoid duplicate audits and preserve its exact head. Stop after the chosen missing implication; a correct root alone is not supplier admission.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "invoice", + "signed moment", + "productive target", + "independent recount" + ], + "existing_checks": [ + { + "scope": "PR #4088: mixed local/owner/phase ledger and moment reported.", + "evidence": "research/staged544-mixed-fourth-entry/README.md", + "remaining": "Independent binding of changed construction to paid histogram, distinct from full admission.", + "status": "author-checked", + "source_commit": "72d7efc181edb21806a878f174847c96dd410ab0", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4091: sharp pooled ceiling proposed for fixed THREE/FOUR words and inventory.", + "evidence": "research/staged-fourth-mixture-ceiling/README.md", + "remaining": "Validate dual, exhaustive pattern scope and exact source equivalence before applying to newer fills.", + "status": "author-checked", + "source_commit": "a29bdd8f56cd18b805917775cdec09ff935eddc4", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4067: paid (2,2) to (1,3) exchange and fixed OQ4 host reported.", + "evidence": "research/r437-two-window-carrier/README.md", + "remaining": "Independent full cost delta; remaining caller/precision/stock obligations are separate.", + "status": "author-checked", + "source_commit": "a95f11c52e3ca1e4c5171b3c20d8f4b0815aee2e", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Close6696Q1 fixed nine-query tariff at486 using credited geometry/X2premises/witness, with independent full forest-record and actual dirty-word ABI/invoice verification.", + "scope_change_reason": "A modest fixed-alphabet side corollary and independent premise/interface check, not a new geometry/counting law/witness or original complete supplier paid/target acceptance.", + "bottleneck_link": "Completes one exact row in an existing abstract invoice; distinguishes proved abstract cost from unprovided physical implementation.", + "budget_minutes": 60, + "stop_rule": "Fixed9query/5source/(38,2,2)class only.3780canonicalforestclasses/4000recordcap,400kcombinationcandidatecap,8MiBartifact/180scommand; no pointcensus or higher-X sweep. Preserve first failures. Sciencecutoff01:22:33UTC, final15minutes verification/handoff.", + "outcome": "completed", + "evidence": "Fixed-price proof: priorR68 andX>=6 imply>=490; priorX2R70/witness attain486. Independent primarysubset and oracleparity-BFS agree all3780records/117180minima, labeled453600priorcount, and actualsubmitted81instruction dirtyfreeword/inverse/fullfixtureinvoice. Both firsts/fourprimarystrict/actualoracle normalO pass; scientific code/input/first receipts unchanged. Root transport/publication gates separate.", + "author": "ToikY", + "ai_assistance": "Substantial OpenAI Codex assistance, separate AI primary/independentoracle/static reviewer; no independenthuman or formal-kernel acceptance.", + "open_questions": [ + { + "question": "What is the full nine-query frontier at arbitrary positive prices?", + "why_it_matters": "This result closes only the fixed inherited(38,2,2)invoice; higher-X tradeoffs may matter elsewhere.", + "first_step": "Name a source-bound price region and its relevant layers before choosing a bounded census.", + "blocked_by": "No all-price frontier or newly priced primitive is supplied." + }, + { + "question": "Does the fixed nine-query486 tariff extend to non-path restored source-XOR programs?", + "why_it_matters": "Prior1340projection and6059geometry already cover the genericR68point bound; X2/source-cost classification and non-path tariff closure are unproved.", + "first_step": "Bind one non-path restored nine-query program actual source-XOR bill and X2 behavior, retaining the generic connector projection.", + "blocked_by": "X=2(S-9) and the incidence-forest reduction are path-local; no non-path X2minimum or fixed486tariff is proved here." + }, + { + "question": "Can a physical caller implement the inherited complete-call fixture favorably?", + "why_it_matters": "An exact abstract tariff does not price physical admission, routing or native work.", + "first_step": "Specify complete calls, source/map access, dirty restoration, routing, coefficient/precision/stock and all additional caller charges.", + "blocked_by": "No physical backend, full supplier or complete outer invoice is supplied." + } + ] +} diff --git a/research/nine-query-fixed-tariff/VALIDATION.md b/research/nine-query-fixed-tariff/VALIDATION.md new file mode 100644 index 0000000000..f3238d2302 --- /dev/null +++ b/research/nine-query-fixed-tariff/VALIDATION.md @@ -0,0 +1,46 @@ +# Validation and limits + +Rendered advanceCLAIM19386799 preceded candidate execution. Four inert source +objects/source manifest, CASES, SCHEMA and code copies were frozen before first. +Primary FIRST2026-11-04T00:51:33.689132+00:00→00:51:34.009186UTC passed, +0.298162s and33,062,912B directchild peakRSS. Oracle FIRST00:52:34.580703→ +00:52:34.901117UTC passed,0.320279s and31,817,728B peakRSS. Neither engine +read peer data/code before its own blind first seal; no predecessor program or +peer code was imported/executed. No first scientific failure/correction occurred. + +Primary6c9223a36f1e8e235467808ea6a4464cc5c799cd0fde1a2da3c1b8fd7586b5de +and oraclec613c593f1361255d12234a292ac29cceacf5063a2a400c079ce56a6c8964b8d +remain unchanged. Whole canonical common profileSHA256 is +8b98751237f50460314b1493c9f9b3a6a0fcc893c221c52177bc1d52035b70e3. +Primary four normal/optimized retained/emission modes passed by00:53:56.668963UTC, +0.261–0.363s each. The complete379624B canonical FLOOR payload regenerates exactly, +SHA256725dd3b22d137b5e4c7d8f1571b2b5fad4ca8aedc32a03b837dba771fee6ed87. +First source/code/result/FLOORcontainer bytes remain unchanged. Gzipcontainer bytes +are immutable first evidence, not the regeneration equality condition. + +Independent actual-data normal/optimized modes passed by00:54:34.919589UTC, +0.267/0.304s with35,536,896/36,241,408B peakRSS. They check all3780submitted +records/117180minima and the actual tied witnessword, including exact path-local +lowering, query prefixes, minimum even readouts, dirty free-noncommuting map, +restoration, literal inverse and full486fixtureinvoice. The primary uses512subset +states; the oracle scans376992five-edge candidates and uses64parity states. +Its own first witness tiechoices/container may differ; full peer-artifact byte +identity is not claimed. All primary actualdata is independently validated. + +Primary ten intended parser/ABI/omission controls pass; oracle16internal controls +are distinct. Root external controls remain separate. RUN-RECORDS.json preserves +actual argv/status/UTC/hashes/resources. Later primaryRSS labels are cumulative +child maxima, not a per-run sampled aggregate memory claim. + +The new claim is a modest fixed-price corollary and independent premise/ABI +verification. Geometry/R68, X2minimumR70, labeled453600count and attainingpath +retain sourcecredit. No2600pointcensus or newgeometry/witness/floor law is claimed. +The actual invoice hasQ9,R70,X2,322leaves,81nodes,81dispatches,4borroweddirtyrows, +total486. These are source2677abstract complete-call prices, not a physical +backend. Full physical/source-map delivery/routing/restoration/stock/precision/ +compiler/supplier/outer obligations remain unknown and unpriced. + +Final AI static review and23root external rejections pass. On local commit31566f58, all four registered commands, committed-byte/declared-source-history/mode checks, initial official export and declared-input check passed. The final archive and read-only Git-free empty-PATH cold replay follow this documentation commit and are not yet claimed here. PublicPR/hostedCI remain pending. These gates will not establish +human/formal-kernel acceptance, complete multiplication or a frontier change. + +Root external verification: all23 actualCLI mutations rejected at intended guards on the first execution, including full-row/minimum data, omitted source undo, extra closing-zero read, wrong demand/readout, source aliases and the complete invoice. Before execution, static review refined the harness to remove the LAST source-XOR undo rather than the first compute; both initial draft and executed-code seals are retained. This was a pre-execution test refinement, not a failed scientific run or engine change. Original code, source/cases/schema, first receipts and FLOOR remain unchanged. diff --git a/research/nine-query-fixed-tariff/VERIFY.json b/research/nine-query-fixed-tariff/VERIFY.json new file mode 100644 index 0000000000..f10eff5690 --- /dev/null +++ b/research/nine-query-fixed-tariff/VERIFY.json @@ -0,0 +1,65 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/nine-query-fixed-tariff/FLOOR.json.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "All3780actualforest records/117180even-subset minima, literal dirty-noncommuting witness map/inverse/prefixes/full486fixtureinvoice,10negativecontrols and actualretainedFLOOR" + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "-O", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "All3780actualforest records/117180even-subset minima, literal dirty-noncommuting witness map/inverse/prefixes/full486fixtureinvoice,10negativecontrols and actualretainedFLOOR" + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/oracle.py", + "--check-primary", + "{package}/RESULT.json" + ], + "timeout_seconds": 180, + "checks": "Independent combination-scan/parityBFS plus actualsubmitted completeFLOORrecords and actualtiedword path-local lowering/free-dirtymap/restoration/inverse/fullinvoice" + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "-O", + "{package}/oracle.py", + "--check-primary", + "{package}/RESULT.json" + ], + "timeout_seconds": 180, + "checks": "Independent combination-scan/parityBFS plus actualsubmitted completeFLOORrecords and actualtiedword path-local lowering/free-dirtymap/restoration/inverse/fullinvoice" + } + ] +} diff --git a/research/nine-query-fixed-tariff/inputs/1340-PROOF.md b/research/nine-query-fixed-tariff/inputs/1340-PROOF.md new file mode 100644 index 0000000000..4d6106417c --- /dev/null +++ b/research/nine-query-fixed-tariff/inputs/1340-PROOF.md @@ -0,0 +1,175 @@ +# Mutable-source five-column connector interface + +## Contract and changed hypothesis + +Work over F2. The five source rows x_j, 31 output rows y_m (1 <= m < 32), +connector z and every private scratch row are distinct, arbitrarily dirty +length-L vectors. A common exact linear map B and fixed exact linear maps A_m +are read-only. None need be invertible or commute. The requested map is + + y_m += A_m B (sum_{j: bit_j(m)=1} x_j), + +with every source, connector and private scratch row restored. + +The inherited complete calls are Q_j: z += B x_j and R_m: y_m += A_m z. +Each call is additive, preserves its source and other rows, restores its private +scratch, returns its tape heads to declared positions, and has no dependence on +the old target value. No data row or z is private scratch. A call may depend on +its source port; any differing admission/routing prices must be charged. + +The **added operation** is the complete elementary source shear +X_{p,j}: x_p += x_j, p != j. It is paid, and all sources must be restored before +return. They cannot be observed externally during the batch. Outputs likewise +cannot be observed until completion. There are no other source/output updates, +combined queries, copies, clean full rows, or direct A_m B calls. This changes +PR943's read-only-source premise and restricts its B_j maps to one common B. +Distinct B_j maps do not satisfy the new implementation identity in general. + +## Construction + +Use the following closed list of source-coefficient boundary points: + + 0, 16, 8, 31, 5, 4, 6, 2, 3, 1, 0. + +Every mask in F2^5 is a difference of two listed points. The literal readout +pairs for masks 1..31 are in CERTIFICATE.json. At an edge with nonzero +delta=q_s XOR q_{s+1}, let p be its least set bit. XOR every other active source +into x_p, call Q_p, then undo those source shears in reverse order. Linearity +gives exactly z += B(sum_{j in delta} x_j). Sources restore on every edge, +so subsequent edges and readouts use the original inputs. The ten edge masks are + + 16, 24, 23, 26, 1, 2, 4, 1, 2, 1. + +The source-shear count is 2*sum(popcount(delta)-1)=12. At boundary s, +z=z_in+B(sum_j bit_j(q_s)*x_j). Reading output m at its two chosen boundaries +cancels A_m z_in and yields the requested row. Readouts commute because their +destinations are distinct and they preserve z. The path closes, restoring z. +This proves the map for every L and all admissible operators and dirty states. + +## Sharp ten-query lower bound with paired readouts + +Allow **any number** of elementary source shears, with any straight-line order; +keep exactly two R_m calls per output. Sources are always F2-linear combinations +of their original values, so the source projection is still a closed walk q +in F2^5. Source shears do not change z and therefore introduce no new boundary +point. A t-query restored walk has at most t distinct points, including zero. + +Necessity of the full difference cover follows by specializing B and every A_m +to identity at L=1 with the five input bits and z_in independent. Each paired +readout has mask q_s XOR q_t, so all 31 nonzero masks must occur. Eight points +have at most 1+binomial(8,2)=29 differences and cannot suffice. + +For nine points, their span must have dimension five. Select five independent +members, and apply an invertible linear coordinate change sending those members +to 1,2,4,8,16. Difference-cover size is invariant under that change. Together +with zero, these are six fixed members, and the other three are a subset of +the remaining 26 points. Thus **all** nine-point covers are represented by the +26-choose-3 = 2,600 sets checked here; repetitions between equivalent normalized +sets are harmless. The exact coverage histogram is + +| Coverage | 22 | 23 | 24 | 26 | 28 | 29 | +|---|---:|---:|---:|---:|---:|---:| +| Normalized sets | 60 | 60 | 810 | 660 | 750 | 260 | + +None covers 32. Hence t>=10, attained above. This finite exclusion plus the +written normalization argument establishes the stated query minimum. It does +not minimize source shears or prove a weighted optimum when outputs may be read +four or more times. The separate census computes autocorrelations by integer +Walsh transforms rather than pair-set enumeration. No proof assistant is used. + +## Completed price and recursive implementation + +Let b and a be uniform complete Q and R call prices, x a complete source-shear +price, and I+P the shared admission and coefficient-preparation bill. Let D_old +and D_new pay actual program construction, storage, control and dispatch not +already included in those complete call prices. These must be evaluated for the +actual schedules, including their different instruction counts. Our bill is + + C_new = I + P + D_new + 10b + 62a + 12x. + +In the old read-only-source alphabet, the Q/R portion has exact minimum + + 10b + 62a + 2 min(a,b). + +Every active Q and R must occur an even number of times, at least twice, by +specializing to identity on independent dirty data. PR943's 945-pairing +exclusion rules out achieving all those minimum counts. At least two additional +calls are needed, and its two repairs attain them (12 Q/62 R or 10 Q/64 R). +Here both literal repairs are replayed with the **same common B and A maps**; +they are not compared using PR943's different heterogeneous factor fixture. +Let D_src and D_out be the extra actual program bills of the two old repairs. +The new construction beats both repairs exactly when + + 12x + D_new - D_src < 2b, and + 12x + D_new - D_out < 2a. + +When D_src=D_out=D_old, this reduces to +12x+D_new-D_old < 2min(a,b). Arbitrary word-dependent routing or preparation +does not inherit a global optimum from the Q/R-only lower bound. + +This criterion, not a free source change, is the useful mechanism. Prices may +depend on precision, ports or routing; in that case sum actual per-call bills +instead of assuming this uniform inequality. + +For an explicit recursive word, factor B and each A_m into five independent +noncommuting leaves, in application order f0..f4. Split contiguously into R +(first floor(d/2) factors) and L (remaining factors). With a distinct dirty row w, +emit R(source,w), L(w,target), inverse R, inverse L. Every inverse includes its +complete reversed child word. Both linearity and scratch restoration are used: +no rounded or dirt-dependent child is admitted. The exact recurrences are + + ell(1)=1; ell(d)=2ell(floor(d/2))+2ell(ceil(d/2)); + n(1)=0; n(d)=1+2n(floor(d/2))+2n(ceil(d/2)); + h(1)=0; h(d)=1+max(h(floor(d/2)),h(ceil(d/2))); + C(d)=2C(R)+2C(L)+complete node dispatch/preparation charge. + +For d=5: ell=28, n=9, h=3. There are 160 distinct primitive map descriptors +(five for B, and five for each A_m); B descriptors are reused across sources. +Preparation is paid once, with all extra port/frame preparation charged if +required. There are 36 data rows and four borrowed dirty rows including z, +40 rows total; source shears need no extra full row. + +| Quantity | Each old repair | New word | +|---|---:|---:| +| Compound Q/R calls | 74 | 72 | +| Primitive arbitrary-map ADD calls | 2072 | 2016 | +| Primitive identity-row XORs | 0 | 12 | +| Executed internal echo nodes | 666 | 648 | +| Root instructions including source XORs | 74 | 84 | +| Borrowed dirty rows | 4 | 4 | + +Identity-row XORs and arbitrary-map calls have different implementations; adding +their counts does not assert equal scalar work. As one explicit **abstract +complete tariff fixture**, assign one unit to each completed primitive map +call, one to each completed identity-row XOR, one to each internal node, and +one to each root instruction, in addition to common I+P. Then the bills are +**2812 versus 2760**, a saving of 52. This is a model price comparison, not +measured execution or admission of those prices on a physical supplier. + +A complete source XOR on a dense row needs L XORs, 2L bit reads and L writes, +plus loop/index work, instruction access and head travel/return. Every child +price must likewise include its coefficient/source access, arithmetic, scratch +cleanup, precision, frames and head returns. A concrete deliberately slow +realization uses 160 dense L-by-L bit matrices and 40 mutable rows, with +S=160L^2+40L data cells. For a map leaf, compute each target dot product in +one admitted clean scalar bit, update the target, and recompute to clear that +bit. This pays 2L^2 coefficient reads, 2L^2 source reads, L target updates, +and at most S*(4L^2+L+1) data-head travel before return. Source XORs pay at +most S*(3L+1) travel. Scalar bit admission/cleanup, counters, preparation and +instruction tapes must also be paid; O(log(L+2)) arithmetic/control overhead +per access gives a loose finite implementation bound. No clean full row is +assumed. These bounds establish implementability, not that either dense tape +realization satisfies the favorable tariff inequality. + +## Limits + +This is a changed abstract connector contract, not a selected-supplier boundary +instance. It requires common B, exact F2 linearity, temporary source ownership, +and unobserved batch outputs. It does not permit other source-dependent B_j +maps, nonlinear/rounded leaves, observers during temporary source changes, +unpriced layout transformations, or scratch aliasing. The sharp result concerns +the number of common-map queries with paired readouts only. No global scalar +circuit optimum, optimal source-shear count, favorable physical runtime, +complete supplier invoice, new moment or new kappa follows. The inherited +compiler/all-size, hosting, frame, precision/tape and analytic obligations are +not discharged. diff --git a/research/nine-query-fixed-tariff/inputs/6059-PROOF.md b/research/nine-query-fixed-tariff/inputs/6059-PROOF.md new file mode 100644 index 0000000000..3c3f30af7d --- /dev/null +++ b/research/nine-query-fixed-tariff/inputs/6059-PROOF.md @@ -0,0 +1,304 @@ +# Exact readout frontier for partitioned independent walks + +The result is a scoped theorem in the five-source abstract model of Wentao Li's +[PR #2779](https://github.com/CrocSwap/integer-mult-bounds/pull/2779), using +Nick Petalas's extension to arbitrary labels and any number of walks in +[PR #6036](https://github.com/CrocSwap/integer-mult-bounds/pull/6036). +It supplies no physical supplier or new kappa. The proof is elementary counting; +the bounded finite checks corroborate it rather than replace an unbounded step. + +## 1. Model and theorem + +A restored walk is a slot list + +``` +w = (s_0, ..., s_(n-1)), s_0 = 0, s_i in F2^5, +``` + +whose closed completion has no zero edge: consecutive labels differ, including +the last label and the initial zero. Labels may repeat at nonadjacent slots, +and zero may be revisited. Necessarily n >= 2. Its even-subset table e_w(x) +is the minimum cardinality of a subset of slots whose XOR is x and whose +cardinality is even, or infinity if there is no such subset. In particular +e_w(0)=0 by the empty subset. + +For k >= 2 independent walks of lengths n_1,...,n_k, let Q=sum_i n_i and +define the cost of a mask x by the min-plus XOR convolution + +``` +c(x) = min { sum_i e_(w_i)(x_i) : x_1 XOR ... XOR x_k = x }. +``` + +A family covers if every x in F2^5 has finite cost. Its readout is +R=sum_(x != 0) c(x). For k=2 this is PR #2779's two-port model; the k>=3 +extension is the one explicitly defined in PR #6036. + +**Theorem.** No covering family exists at Q<7. For every integer Q>=7 the +minimum readout over all covering families, all walk counts k>=2 and all +permitted label repetitions is + +| Q | Minimum R | +|---:|---:| +| 7 | 112 | +| 8 | 92 | +| 9 | 80 | +| 10 | 72 | +| 11 | 66 | +| >=12 | 62 | + +The first three values are retained predecessor results. The new ingredients +are sharp pair-difference bounds for eight and nine points in F2^5, which +settle the open Q=10 and Q=11 cases, and an explicit saturation construction +with a valid padding rule for every Q>=12. + +## 2. Even-subset costs and difference sets + +For a support set A in F2^5 write + +``` +D(A) = { a XOR b : a,b in A, a != b }. +``` + +The table lemma of PR #6036 also follows directly from the definition. +An arbitrary subset of slots has the same XOR after toggling slot 0, so an +even subset exists precisely for the masks in the span of the walk labels. +For a nonzero mask every finite cost is an even integer at least two, and +cost two is equivalent to membership in D(A). Repeated labels do not change +this equivalence: two equal labels produce zero, not a new nonzero difference. + +Consequently, if P is the union of all walk difference sets, exactly the masks +in P have combined cost two. Every other nonzero mask of a covering family +costs at least four. Thus + +``` +R >= 124 - 2|P|, R >= 62. (1) +``` + +These are lower bounds: the masks outside P need not all have cost four. +Attaining families below are checked with their full even-subset tables. + +Coverage is equivalent to the sum of the walk spans being F2^5. Since each +walk starts with zero, its span has dimension at most n_i-1. Therefore + +``` +5 <= sum_i (n_i-1) = Q-k <= Q-2, (2) +``` + +which proves the nonexistence statement for Q<7. + +## 3. Two sharp finite-geometry bounds, proved without a census + +**Lemma 1.** If A is a subset of F2^5 with at most eight points, then +|D(A)|<=25. + +**Proof.** It suffices to consider eight distinct points: smaller sets can +be enlarged to size eight, and enlargement cannot remove a difference. +Write A={a_1,...,a_8}. The kernel over F2 of the matrix whose columns are +(1,a_i) in F2^6 has dimension at least two. Choose a two-dimensional subspace +C of this kernel. Every nonzero vector of C has even weight, and its weight +cannot be two because the points a_i are distinct. Thus its three nonzero +vectors have weights at least four. + +At each coordinate, either every vector of C is zero or exactly two vectors +are one. The sum of the three nonzero weights is therefore at most 2*8=16. +They cannot all have weight at least six. There is a weight-four vector, or +four distinct points whose XOR is zero. + +Those four points produce three different pairings into equal-difference +pairs. The three corresponding nonzero differences are distinct. Among the +C(8,2)=28 unordered pairs, there are therefore at least three excess +occurrences beyond the first occurrence of each difference. Hence +|D(A)|<=28-3=25. QED. + +**Lemma 2.** If A is a subset of F2^5 with at most nine points, then +|D(A)|<=28. + +**Proof.** Again enlarge to nine distinct points if needed. The same +six-row matrix now has a kernel of dimension at least three. Choose a +three-dimensional subspace C of the kernel. Its seven nonzero vectors +have even weights at least four, and their total weight is at most 4*9=36. +If at most two had weight four, the total would be at least +2*4+5*6=38. Thus A has at least three distinct four-point subsets with +zero XOR. + +For each nonzero d let m_d be the number of unordered pairs from A with +difference d. Two distinct pairs with the same difference cannot share a +point. If N_4 is the number of zero-XOR four-point subsets, double counting +the three pairings of each such subset gives + +``` +sum_(d != 0) C(m_d,2) = 3 N_4 >= 9. (3) +``` + +If every m_d<=2, then C(m_d,2)=max(m_d-1,0). Since sum_d m_d=36, +equation (3) gives 36-|D(A)|>=9, and in fact |D(A)|<=27. + +Otherwise one difference b occurs in at least three pairs. Take six points +B from three of these disjoint pairs. They form three cosets of the +two-element subgroup {0,b}. Their internal differences consist of b and +at most two differences for each pair of distinct cosets. Hence + +``` +|D(B)| <= 1 + 2*C(3,2) = 7. +``` + +The remaining set C=A\B has three points. There are at most 6*3=18 +cross differences and at most C(3,2)=3 differences inside C. Every +difference of A belongs to one of these three classes, so +|D(A)|<=7+18+3=28. QED. + +Both bounds are sharp. The supports + +``` +A8 = {0,1,2,4,8,16,30,31}, +A9 = {0,1,2,4,8,16,29,30,31} +``` + +have respectively 25 and 28 differences, with integers denoting their +five-bit vectors. These claims are small direct XOR checks. The verifier +also corroborates the bounds by normalizing a full-rank support to contain +{0,1,2,4,8,16} and enumerating the C(26,2)=325 or C(26,3)=2600 possible +extra-point sets. Supports of rank at most four have at most 15 nonzero +differences. This normalization is independent of the kernel-weight proof. + +## 4. The Q=7,8,9 predecessor cases + +At Q=7, (2) forces k=2, with lengths (2,5) or (3,4), up to interchange. +The five noninitial slot labels must be linearly independent. Thus their +two walk spans form a direct sum of dimensions d_1=n_1-1 and d_2=n_2-1, +with d_1+d_2=5 and each d_i>=1. Every mask has a unique expression using +these five labels. In a given walk, if that expression uses h noninitial +slots, the even-subset cost is h when h is even and h+1 when h is odd, +because the only possible adjustment is to include slot 0. + +Summed over all 32 masks, the selected-label contribution is 32*5/2=80. +For each of the two nonempty blocks, exactly half of its coefficient vectors +have odd weight, contributing 16 more. The zero mask contributes zero. +Therefore every covering Q=7 family has R=80+16+16=112. Independent basis +labels give valid restored walks, so the bound is attained. This rederives +the PR #2779 value in the arbitrary-label scope of PR #6036. + +For general lengths, |D(A_i)|<=C(n_i,2), so (1) implies + +``` +R >= 124 - 2 sum_i C(n_i,2). +``` + +For fixed Q with n_i>=2 and k>=2, moving slots from a smaller part to a +largest part can only increase the sum of these binomial coefficients. +Its maximum is 1+C(Q-2,2), at the two-part partition (2,Q-2). +This is PR #6036's pair-sum bound. It gives R>=92 at Q=8 and R>=80 at Q=9. +The same predecessor supplies attaining valid walks: + +``` +Q=8: (0,10), (0,22,5,31,24,20), +Q=9: (0,3), (0,18,1,5,11,20,27). +``` + +The present verifier recomputes their complete readout tables as calibration +fixtures. Their origin and the established values remain credited to PR #6036. + +## 5. The exact Q=10 and Q=11 minima + +The preceding geometry bounds apply to supports of walks, regardless of +repetition or slot order. The union of difference sets is bounded by the +sum of their sizes; overlap can only make the union smaller. + +For two walks the complete lists of length partitions and resulting bounds +on |P| are: + +| Q | Lengths | Bound on size of P | +|---:|:---|---:| +| 10 | (2,8) | 1+25=26 | +| 10 | (3,7) | 3+21=24 | +| 10 | (4,6) | 6+15=21 | +| 10 | (5,5) | 10+10=20 | +| 11 | (2,9) | 1+28=29 | +| 11 | (3,8) | 3+25=28 | +| 11 | (4,7) | 6+21=27 | +| 11 | (5,6) | 10+15=25 | + +For k>=3, convexity bounds sum_i C(n_i,2) by +C(Q-2k+2,2)+(k-1). For feasible k>=3 this is at most its k=3 value: +17 at Q=10 and 23 at Q=11. These are smaller than 26 and 29 respectively. +This treats every walk count and every permitted repetition pattern. + +Equation (1) therefore gives + +``` +Q=10: R >= 124-2*26 = 72, +Q=11: R >= 124-2*29 = 66. +``` + +The following explicit families attain these bounds: + +``` +Q=10: (0,7), (0,1,2,4,8,16,30,31), +Q=11: (0,7), (0,1,2,4,8,16,29,30,31). +``` + +Each closed walk has nonzero edges because its slots are distinct. Their +long walks contain all five basis vectors, so both families cover. +Direct enumeration of their even subsets and XOR convolution gives +26 masks of cost two and five of cost four at Q=10, and 29 masks of +cost two and two of cost four at Q=11. Thus R=72 and R=66 respectively. + +## 6. Saturation at every Q>=12 + +At Q=12 take + +``` +(0,1), (0,1,2,4,8,16,3,5,6,31). +``` + +The ten-point long support has all 31 nonzero differences. This finite +identity is checked by direct XOR enumeration. Thus every nonzero mask +can be read with cost two, attaining the universal floor R=62. + +To increase Q by one, choose any edge (a,b) of the long walk and insert +an existing support label c distinct from both a and b. There is such a +label because the support has ten points. Both new edges (a,c),(c,b) +are nonzero. The initial zero and the closed completion are retained, +and the support is unchanged. In particular its 31 differences remain. +Repeat this operation for any desired number of added slots. This proves +attainment at every integer Q>=12, including both parities. Adjacent +duplication of a label would create a zero edge and is not the padding rule. + +## 7. Tariff consequence and scope + +In the retained abstract tariff T=38Q+2R+2X with X>=0, the exact readout +frontier gives the following lower bounds, without claiming that X=0 is +attainable together with the readout minimum: + +| Q | Lower bound on T | +|---:|---:| +| 7 | 490 | +| 8 | 488 | +| 9 | 502 | +| 10 | 524 | +| 11 | 550 | +| >=12 | 38Q+124>=580 | + +Hence every covering partitioned independent-walk family in this model has +T>=488, strictly above the six-query endpoint tariff 436. This is a consistency +corollary, not a new tariff obstruction: it already follows by combining +PR #6036's exact Q=7 value with its older readout floors. It does not identify +the exact minimum of T: path cost X and its possible tradeoff with readout remain. + +The theorem concerns the five-source alphabet, independent restored walks, +and the stated even-subset/min-plus billing rule. It does not cover same-walk, +transfer-coupled, shared-dirt or changed-output contracts. No native supplier, +compiler, precision, stock, restoration implementation or outer multiplication +transfer is supplied or priced by this abstract result. No selected-frontier +change, proof-kernel acceptance or independent human review is claimed. + +## Credit + +The model and two-port readout rule are due to Wentao Li, PR #2779, building +on Arham Tahir's PR1898 and the lineage retained in those packages. Nick +Petalas, PR #6036, supplies the arbitrary-label and multiple-walk scope, +pair-sum floor, prior exact Q=7,8,9 conclusions and Q=8,9 witnesses, and +the open questions resolved here. New geometry proof, exact frontier completion +and verification were prepared by **apoursh**, with substantial OpenAI Codex +assistance, including independent subagent derivation and checking. +Apache-2.0. diff --git a/research/nine-query-fixed-tariff/inputs/6696-README.md b/research/nine-query-fixed-tariff/inputs/6696-README.md new file mode 100644 index 0000000000..8929afca2d --- /dev/null +++ b/research/nine-query-fixed-tariff/inputs/6696-README.md @@ -0,0 +1,198 @@ +# Eight-query path-lowered words: readouts 74 and source XORs 4 are attained together + +**Scoped exact finite computation, in the PR1898 abstract tariff. No new κ.** In the +path-lowered even-subset class of +[PR2677](https://github.com/CrocSwap/integer-mult-bounds/pull/2677) +(`research/mutable-source-789q-invoice`), every eight-query word needs at least +74 readouts `R` and at least 4 source XORs `X`, and one closed walk attains both. +Both floors are known. The new fact is that they are attained together. The +eight-query row of PR2677's table was a lower bound (`R >= 74`, `X >= 0`, tariff +`>= 452`). It is now exact: + +```text +min over eight-query words of b*Q + a*R + x*X = 8b + 74a + 4x for all b, a, x > 0 +tariff at (b, a, x) = (38, 2, 2): 38*8 + 2*74 + 2*4 = 460 (24 above the six-query endpoint 436) +``` + +Witness, a closed prefix walk with 74 readouts and 4 source XORs (replayed on +arbitrary dirty formal rows by the pinned model): + +```text +(0, 1, 3, 2, 6, 14, 30, 20, 0) also (0, 4, 20, 24, 9, 1, 3, 2, 0) +``` + +| Q | readout floor | XOR floor | attained together | tariff at (38,2,2) | vs 436 | +|--:|--:|--:|---|--:|--:| +| 6 | 96 | 8 | yes (PR1898 word) | **436** exact | 0 | +| 7 | 82 | 6 | yes (PR2677 champion) | **442** exact | +6 | +| 8 | 74 | 4 | **yes (this package)** | **460** exact | +24 | +| 9 | 62 | 2 | open; best found `R=70` at `X=2` | between 470 and 486 | at least +34 | +| >= 10 | 62 | 0 | not claimed | above 460 from `38Q` and `R >= 62` | | + +The Q = 6 and Q = 7 rows are the existing values; the census and replays here +reproduce them. New here: the attaining Q = 8 word, which makes that row exact and +price-independent; the exact walk spectra; the attained Q = 9 value 486; and the +sharpness of the XOR floor at eight queries (below). The XOR floor itself is not +claimed: it is the connector consequence recorded in PR5935 (below). + +## Model + +The model, cost formulas and word builder are those of PR2677's `model.py`, which +the verifier imports as a pinned live input after a SHA256 check. A path-lowered +word is a closed connector walk `0 = w_0, w_1, ..., w_Q = 0` in `F2^5` with every +edge `w_i xor w_(i+1)` nonzero. Values and zero revisits may repeat. Then + +- `X = sum over edges of 2*(weight(edge) - 1)`, the path-local compute and uncompute + source XORs; +- `R` is the total even-subset readout count over the slot values: mask `m` costs + the least even number of slots whose XOR is `m`; +- the tariff is `38Q + 2R + 2X`, the PR1898 fixture. + +A walk covers when every nonzero mask is read, which forces its visited values to +span `F2^5`. Only covering walks are words. + +## Source-XOR floor + +For arbitrary restored source-XOR words, PR5935 +(`research/connected-xor-word-floor`, this author's earlier package) proves +`X >= 2(n - c)` for an interaction graph with `c` components. With the component +inequality `Q >= n + c` of PR2455 this gives `X >= 2(2n - Q)`, so at five sources +`X >= 2(10 - Q)` for `Q <= 10`. PR5935 records this: `X >= 4` at `Q = 8` and +`X >= 2` at `Q = 9`. This package does not re-prove it. + +For self-containment, here is a direct proof in the path-local cost model. A +covering closed walk with `Q` edges has `X >= 2*max(0, 10 - Q)`, `X = 2Q mod 4`, and +equality at the floor holds exactly when every coordinate lies in exactly two edges. + +*Proof.* The visited values are partial sums of the edges, so the edges span +`F2^5` and every coordinate occurs in some edge. The edges sum to zero, so each +coordinate occurs in an even number of edges, at least two. The weight total is the +sum of these five counts: even and at least 10. Then +`X = 2*(total - Q) >= 2*(10 - Q)`, with equality iff the counts are `2,2,2,2,2`. +For `Q <= 5` no covering walk exists, since six edges are needed to span `F2^5`. ∎ + +**Sharpness.** Each X-floor layer below contains covering walks for `Q = 6..10`, so +the floor `2(10 - Q)` is attained there by a path-lowered word, which is a restored +word. At `Q = 8` this makes the XOR floor 4 sharp for arbitrary restored words, given +PR5935's lower bound. That is the sharp eight-query XOR floor asked for in Open next +question 2 of `research/seven-query-xor-floor`. + +## Eight queries + +1. **Readout floor, repeats allowed.** A walk with eight edges visits at most seven + distinct nonzero values. The census over every set of five, six or seven values + (3,535,767 sets, 3,097,024 covering) gives the spectra + + | distinct nonzero values | `R` values (number of sets) | + |--:|---| + | 5 | 96 (83,328) | + | 6 | 82 (97,216), 88 (486,080) | + | 7 | 74 (416,640), 80 (1,180,480), 84 (833,280) | + + So `R >= 74` for every eight-query word. Repeated prefix values or zero revisits + leave at most six distinct values and force `R >= 82`. This answers Open next + question 2 of PR2677 inside the class: the exact minimum is 74, attained only + with seven distinct nonzero values. This is also the readout half of Open next + question 2 of PR2686, repeats included. Its XOR half is the sharp floor 4 above. +2. **XOR floor.** `X >= 4`, from PR5935 for every restored word and from the parity proof above in this class. +3. **Attainment.** The exhaustive layer of closed eight-edge walks with every + coordinate in exactly two edges has 730,800 walks, the count given by + inclusion-exclusion. Of these, 30,240 cover with `R = 74` and `X = 4`. Its full + spectrum is `74: 30,240`, `80: 172,800`, `82: 8,640`, `84: 161,280`, + `88: 248,640`, `96: 84,000` and 25,200 non-covering walks. + +Both floors hold for every word and one walk attains both. The Pareto frontier at +`Q = 8` is the single point `(R, X) = (74, 4)`, so the optimum does not depend on +the prices. The same argument gives single-point frontiers `(96, 8)` at `Q = 6` +and `(82, 6)` at `Q = 7`. + +## Price crossovers among Q = 6, 7, 8 + +With the three exact rows `f6 = 6b + 96a + 8x`, `f7 = 7b + 82a + 6x` and +`f8 = 8b + 74a + 4x`: + +```text +f8 < f7 iff b < 8a + 2x f7 < f6 iff b < 14a + 2x f8 < f6 iff b < 11a + 2x +``` + +At `(38, 2, 2)` all three fail, so the six-query endpoint stays optimal among +`Q <= 8`. The verifier checks the equivalences on a grid of prices. + +## Nine and ten queries + +At `Q = 9` the XOR floor is 2 and the readout floor is at least 62. The X-floor +layer has 453,600 walks and its least readout count is 70, so tariff 486 is +attained. The exact minimum lies between 470 and 486. The next layer (weight total +12, `X = 6`) is not enumerated. + +At `Q = 10` the `X = 0` layer has 113,400 walks and least `R = 64`, with no +`R = 62` walk. That reproduces the read-only ten-query repair with 64 readouts and +no source XOR recorded in `research/mutable-source-connector`, and it agrees with +the four-XOR requirement of `research/mutable-source-shear-cost` for 62 readouts. +No Q = 10 claim is made. + +## Reproduce + +Python 3.12, standard library only, from the repository root: + +```sh +python3.12 -B research/eight-query-path-lowered-tariff/verify.py +python3.12 -B scripts/research_package.py --package research/eight-query-path-lowered-tariff +``` + +Expected marker: + +```text +PASS_EIGHT_QUERY_PATH_LOWERED_TARIFF Q8=(R74,X4) tariff=460 floors_attained_Q6_Q7_Q8 Q9_in_470_486 no_new_kappa +``` + +The verifier takes about a minute. It checks: + +- the readout census above and its set counts; +- the path-local XOR floor exhaustively on 638,832 covering walks in `F2^2`, `F2^3` and + `F2^4`, including attainment of the floor at every `Q` from `n + 1` to `2n`; +- every X-floor layer at `Q = 6..10`, with walk counts equal to the closed-form + count `sum_i (-1)^i C(Q,i) C(Q-i,2)^5` and the spectra quoted here; +- literal dirty-row replays with the pinned model of the two `Q = 8` witnesses, + the `Q = 7` champion `(0,1,2,6,12,24,16,0)`, the six-query word, the `Q = 9` + witness `(0,1,3,2,6,14,10,26,16,0)` and the ten-query paths; +- the three crossover equivalences on prices `b` in 1..39 and `a`, `x` in 1..7; +- 6,000 seeded random walks, repeats and zero revisits included, comparing the + set-based readout and edge-cost formulas with the pinned model. + +[SOURCES.json](SOURCES.json) pins the model. The exhaustive search that found the +witnesses was a separate, unpackaged program. Every number above is recomputed by +`verify.py` itself. + +## Scope and limits + +- The exact row is for path-lowered even-subset words: one closed connector walk, + path-local compute and uncompute source XORs, and PR2677's tariff. The readout and + walk-spectrum claims are not checked for arbitrary XOR-interleaved restored words. + Only the XOR floor, and its sharpness at eight queries, is stated for those, and + its lower bound is PR5935's, not re-proved here. +- The tariff is the abstract complete-call fixture. No physical supplier, hosting, + precision or kappa claim is made. Independent human and formal proof-kernel review + are unclaimed. +- Nine queries are not settled. Ten queries are cross-checked only. + +## Open next questions + +1. What is the exact tariff at nine queries (between 470 and 486)? Enumerate the + `X = 6` layer at `Q = 9` and compare its least readout count with 70. The layer is + larger than the ones here. No obstruction is known. +2. Does the readout floor 74 hold for arbitrary XOR-interleaved restored words at + eight queries, with non-path source XORs? The census uses only the set of + connector values, so the first step is to check that a restored word's connector + values obey the same even-subset readout constraint. + +## Credit + +This contribution was produced by Nick Petalas. It builds on Wentao Li's PR2677 +(`research/mutable-source-789q-invoice`: model, invoice table and the open +question), PR2686 (`research/seven-query-r-floor`) and PR2643 +(`research/seven-query-xor-floor`); on Arham Tahir's PR1898 (the alphabet and the +six-query word); and on PR1370 and Ross Richardson's PR943 for the ten-query +cross-check. The XOR floor `2(10 - Q)` is the connector consequence of PR5935 +(Nick Petalas) with ywz65's PR2455 component inequality; PR2455 also proves the +six-query XOR bound. Predecessor files and notices are unchanged. Apache-2.0. diff --git a/research/nine-query-fixed-tariff/inputs/MODEL2677.py.txt b/research/nine-query-fixed-tariff/inputs/MODEL2677.py.txt new file mode 100644 index 0000000000..8ce90c48df --- /dev/null +++ b/research/nine-query-fixed-tariff/inputs/MODEL2677.py.txt @@ -0,0 +1,221 @@ +"""Path-lowered even-subset schedules and abstract invoices. Wentao Li + AI, Apache-2.0. + +The complete-call tariff (b,a,x)=(38,2,2) and path-local shear lowering match +Arham Tahir's PR1898 `research/mutable-source-minimum-queries/model.py` on +CrocSwap main `0fdd7d82`. This file is self-contained for fork bases that lack +that package; it does not import predecessor executables. +""" +from collections import Counter +from itertools import combinations + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def min_even_subset_R(slots): + """Minimum total even-subset readout count on connector prefix slots. + + ``slots[0]`` must be 0. The final restored 0 is identified with slot 0, so + ``slots`` lists the Q distinct time values before the closing query edge. + """ + need(type(slots) is tuple and slots and slots[0] == 0, "slots must start at 0") + n = len(slots) + best = [99] * 32 + for bits in range(1 << n): + if bits.bit_count() % 2: + continue + value = 0 + for i in range(n): + if bits >> i & 1: + value ^= slots[i] + size = bits.bit_count() + if size < best[value]: + best[value] = size + if any(best[mask] >= 99 for mask in range(1, 32)): + return None + return sum(best[1:]) + + +def even_subset_reads(slots): + """One minimum even subset of slot indices per nonzero mask.""" + n = len(slots) + reads = {} + for mask in range(1, 32): + found = None + for size in range(2, n + 1, 2): + for subset in combinations(range(n), size): + value = 0 + for i in subset: + value ^= slots[i] + if value == mask: + found = subset + break + if found is not None: + break + need(found is not None, f"mask {mask} uncovered") + reads[mask] = found + return reads + + +def path_X(closed): + """Paid source-XOR count under path-local compute/uncompute lowering.""" + total = 0 + for a, b in zip(closed, closed[1:]): + delta = a ^ b + need(delta != 0, "zero query edge") + total += 2 * (delta.bit_count() - 1) + return total + + +def rank_increments(closed): + rows = [closed[i] ^ closed[i + 1] for i in range(len(closed) - 1)] + rank = 0 + for bit in range(5): + pivot = next((i for i in range(rank, len(rows)) if rows[i] >> bit & 1), None) + if pivot is None: + continue + rows[rank], rows[pivot] = rows[pivot], rows[rank] + for i in range(len(rows)): + if i != rank and rows[i] >> bit & 1: + rows[i] ^= rows[rank] + rank += 1 + return rank + + +def path_word(closed): + """Literal Q/R/X word for a closed prefix path with even-subset readouts.""" + need(closed[0] == closed[-1] == 0, "path is not closed") + slots = tuple(closed[:-1]) + reads = even_subset_reads(slots) + word = [] + for step, point in enumerate(closed): + word += [["R", mask] for mask, subset in reads.items() if step in subset] + if step + 1 >= len(closed): + break + delta = point ^ closed[step + 1] + need(delta != 0, "zero query edge") + target = (delta & -delta).bit_length() - 1 + donors = [j for j in range(5) if j != target and delta >> j & 1] + word += [["X", j, target] for j in donors] + word.append(["Q", target]) + word += [["X", j, target] for j in reversed(donors)] + return word + + +def root_ops(word, n=5): + out = [] + for event in word: + kind = event[0] + if kind == "Q": + out.append(["B", f"x{event[1]}", "z"]) + elif kind == "R": + out.append([f"A{event[1]}", "z", f"y{event[1]}"]) + elif kind == "X": + out.append(["", f"x{event[1]}", f"x{event[2]}"]) + else: + raise ValueError("unknown root operation") + return out + + +def roles(n=5): + return [f"x{j}" for j in range(n)] + [f"y{m}" for m in range(1, 1 << n)] + ["z"] + [ + f"w{j}" for j in range(3) + ] + + +def interpret(operations, names, initial=None): + state = {r: {(r,)} for r in names} if initial is None else {r: set(p) for r, p in initial.items()} + for coefficient, source, target in operations: + need(source in state and target in state and source != target, "invalid port") + terms = state[source] if coefficient == "" else {(coefficient,) + term for term in state[source]} + state[target].symmetric_difference_update(terms) + return state + + +def expected(n=5): + state = {r: {(r,)} for r in roles(n)} + for mask in range(1, 1 << n): + for j in range(n): + if mask >> j & 1: + state[f"y{mask}"].symmetric_difference_update({(f"A{mask}", "B", f"x{j}")}) + return state + + +def check_identity(word, n=5): + ops = root_ops(word, n) + result = interpret(ops, roles(n)) + need(result == expected(n), "dirty root map or restoration failed") + need( + interpret(ops[::-1], roles(n), result) == {r: {(r,)} for r in roles(n)}, + "root inverse failed", + ) + return Counter(event[0] for event in word) + + +def invoice(word): + counts = Counter(event[0] for event in word) + leaves = 28 * counts["Q"] + counts["R"] + nodes = 9 * counts["Q"] + dispatch = len(word) + return { + "Q": counts["Q"], + "R": counts["R"], + "X": counts["X"], + "map_leaves": leaves, + "echo_nodes": nodes, + "root_dispatches": dispatch, + "borrowed_dirty_rows": 4, + "tariff": leaves + nodes + counts["X"] + dispatch, + "complete_prices": {"b": 38, "a": 2, "x": 2}, + } + + +def minimum_word_6q(): + """PR1898 minimum-query word for n=5 (credited; used as comparator).""" + reads = {} + for mask in range(1, 32): + coefficients = [mask & 1] + coefficients += [((mask >> (t - 1)) ^ (mask >> t)) & 1 for t in range(1, 6)] + reads[mask] = [t for t, bit in enumerate(coefficients) if bit] + word = [] + for t in range(6): + word += [["R", mask] for mask, positions in reads.items() if t in positions] + if t < 5: + word.append(["Q", t]) + word += [["X", j, 0] for j in range(1, 5)] + word.append(["Q", 0]) + word += [["X", j, 0] for j in reversed(range(1, 5))] + return word + + +def four_x_ten_q(): + """PR1370/PR1898 attributed closed path (credited comparator).""" + points = [0, 4, 5, 1, 3, 7, 6, 14, 28, 16, 0] + # Paired readouts as in predecessor path_word. + readouts = {} + for mask in range(1, 32): + pair = next( + ( + (s, t) + for s in range(len(points)) + for t in range(s + 1, len(points)) + if points[s] ^ points[t] == mask + ), + None, + ) + need(pair is not None, "ten-query path incomplete") + readouts[mask] = pair + word = [] + for s, point in enumerate(points): + word += [["R", mask] for mask, pair in readouts.items() if s in pair] + if s + 1 >= len(points): + break + delta = point ^ points[s + 1] + target = (delta & -delta).bit_length() - 1 + donors = [j for j in range(5) if j != target and delta >> j & 1] + word += [["X", j, target] for j in donors] + word.append(["Q", target]) + word += [["X", j, target] for j in reversed(donors)] + return word diff --git a/research/nine-query-fixed-tariff/oracle.py b/research/nine-query-fixed-tariff/oracle.py new file mode 100644 index 0000000000..f4cb309ce1 --- /dev/null +++ b/research/nine-query-fixed-tariff/oracle.py @@ -0,0 +1,442 @@ +#!/usr/bin/env python3 +"""Independent forest scan, parity BFS and dirty free-map word oracle. + +Credit6059/1340 for the prior nine-point geometry, Nick Petalas6696/5935 +for the prior floor/witness and source XOR results, Wentao Li2677/2686/2643, +Arham Tahir1898, ywz65/2455, Ross Richardson943 and retained1370 lineage. +Only the fixed-price corollary is new here. Substantial OpenAI Codex +assistance. Apache-2.0. No predecessor/primary implementation is imported. +""" +import argparse +from collections import Counter, deque +import gzip +import hashlib +import itertools +import json +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parent +PIN_SHA = "0d1cbe7daa2cd1092c1a64a3615521b651faf8f83102b7db03896c17a0a09a1a" +CASE_SHA = "fc2c9be60d410124b45da970af462acc749275a35e20a16969527dca5b56f4ea" +SCHEMA_SHA = "0d5089118230203c2f689e2084292997f1c6d07a735f9c3641fc788cb03f99c1" +PAIRS = tuple(itertools.combinations(range(9), 2)) +COMMON = {"schema_version", "source_manifest_sha256", "case_manifest_sha256", "floor", "witness"} +FLOOR_KEYS = {"classes", "labeled_walks", "coordinate_labelings", "minimum_R", "histogram", "records_sha256"} +WITNESS_KEYS = {"closed", "Q", "R", "X", "tariff", "invoice"} +INVOICE_KEYS = {"map_leaves", "echo_nodes", "source_XORs", "root_dispatches", "borrowed_dirty_rows", "total"} + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":"), allow_nan=False) + + +def sha(raw): + return hashlib.sha256(raw).hexdigest() + + +def digest(value): + return sha((canonical(value) + "\n").encode()) + + +def unique(pairs): + result = {} + for key, value in pairs: + need(key not in result, "duplicate JSON key: " + key) + result[key] = value + return result + + +def bad_number(value): + raise ValueError("noninteger JSON number forbidden: " + value) + + +def parse(raw): + return json.loads(raw, object_pairs_hook=unique, parse_float=bad_number, parse_constant=bad_number) + + +def authenticate(): + for name, expected in (("SOURCE-PINS.json", PIN_SHA), ("CASES.json", CASE_SHA), ("SCHEMA.json", SCHEMA_SHA)): + need(sha((ROOT / name).read_bytes()) == expected, "source/case/schema digest changed") + source = parse((ROOT / "SOURCE-PINS.json").read_bytes()) + need(len(source["files"]) == 4, "four inert source objects required") + for row in source["files"]: + raw = (ROOT / row["local_path"]).read_bytes() + need(len(raw) == row["bytes"] and sha(raw) == row["sha256"], "source bytes changed") + blob = b"blob " + str(len(raw)).encode() + b"\0" + raw + need(hashlib.sha1(blob).hexdigest() == row["git_blob"], "source Git blob changed") + parse((ROOT / "SCHEMA.json").read_bytes()) + return parse((ROOT / "CASES.json").read_bytes()) + + +def rank(rows): + basis = {} + for row in rows: + while row: + pivot = row.bit_length() - 1 + if pivot in basis: + row ^= basis[pivot] + else: + basis[pivot] = row + break + return len(basis) + + +def graph_increments(code): + need(type(code) is int and 0 <= code < (1 << 36) and code.bit_count() == 5, "graph code must encode five edges") + edges = [pair for index, pair in enumerate(PAIRS) if code >> index & 1] + increments = [0] * 9 + for coordinate, (left, right) in enumerate(edges): + increments[left] ^= 1 << coordinate + increments[right] ^= 1 << coordinate + need(all(increments) and rank(increments) == 5, "incidence graph has isolated position or deficient rank") + return increments + + +def all_graph_codes(): + result, candidates = [], 0 + for indices in itertools.combinations(range(36), 5): + candidates += 1 + need(candidates <= 400000, "combination scan capacity exceeded") + covered = 0 + for index in indices: + left, right = PAIRS[index] + covered |= (1 << left) | (1 << right) + if covered != 511: + continue + code = sum(1 << index for index in indices) + graph_increments(code) + result.append(code) + need(candidates == 376992 and len(result) == len(set(result)), "complete graph-scan domain changed") + return sorted(result), candidates + + +def closed_from_code(code): + closed = [0] + for increment in graph_increments(code): + closed.append(closed[-1] ^ increment) + need(closed[-1] == 0 and len(closed) == 10, "incidence path closure failed") + return closed + + +def distances(slots): + need(type(slots) in (list, tuple) and slots and all(type(v) is int and 0 <= v < 32 for v in slots), "slot labels invalid") + distance, parents = [-1] * 64, [None] * 64 + distance[0] = 0 + pending = deque([0]) + while pending: + state = pending.popleft() + for index, point in enumerate(slots): + following = state ^ ((point << 1) | 1) + if distance[following] == -1: + distance[following] = distance[state] + 1 + parents[following] = state, index + pending.append(following) + return distance, parents + + +def even_minima(slots): + distance, unused = distances(slots) + result = [distance[2 * mask] for mask in range(1, 32)] + need(all(value > 0 and value % 2 == 0 for value in result), "readout coverage/parity failed") + return result + + +def record_for_code(code): + slots = closed_from_code(code)[:-1] + return [code, slots, even_minima(slots)] + + +def minimum_readouts(slots): + distance, parents = distances(slots) + result = {} + for mask in range(1, 32): + state, indices = 2 * mask, [] + need(distance[state] > 0, "readout coverage failed") + while state: + state, index = parents[state] + indices.append(index) + need(len(indices) == len(set(indices)) and len(indices) % 2 == 0, "shortest parity path repeats a generator") + result[mask] = sorted(indices) + return result + + +def witness_word(closed): + need(type(closed) is list and len(closed) == 10 and closed[0] == closed[-1] == 0, "nine-query path shape invalid") + reads, result = minimum_readouts(closed[:-1]), [] + for position in range(9): + for mask, subset in reads.items(): + if position in subset: + result.append(["R", mask]) + delta = closed[position] ^ closed[position + 1] + need(delta != 0, "zero query edge forbidden") + target = (delta & -delta).bit_length() - 1 + donors = [j for j in range(5) if j != target and delta >> j & 1] + result.extend(["X", source, target] for source in donors) + result.append(["Q", target]) + result.extend(["X", source, target] for source in reversed(donors)) + return result + + +def typed_word(word): + need(type(word) is list and len(word) <= 4096, "word size/type invalid") + for row in word: + need(type(row) is list and row and type(row[0]) is str, "word instruction shape invalid") + op = row[0] + need(op in ("Q", "R", "X") and len(row) == (3 if op == "X" else 2), "word instruction domain invalid") + need(all(type(value) is int for value in row[1:]), "word arguments must be integers, not bool") + if op == "R": + need(1 <= row[1] < 32, "readout mask invalid") + else: + need(all(0 <= value < 5 for value in row[1:]), "source port invalid") + need(op != "X" or row[1] != row[2], "source shear may not alias") + + +def bind_word(word, closed): + typed_word(word) + sources, point, queries = [1 << j for j in range(5)], 0, 0 + reads = {mask: [] for mask in range(1, 32)} + for row in word: + if row[0] == "X": + sources[row[2]] ^= sources[row[1]] + elif row[0] == "Q": + need(queries < 9 and point == closed[queries], "query prefix differs from credited path") + point ^= sources[row[1]] + queries += 1 + need(point == closed[queries], "query increment differs from credited path") + else: + need(queries < 9, "final closing zero is not an extra readout slot") + reads[row[1]].append(queries) + need(queries == 9 and point == 0 and sources == [1 << j for j in range(5)], "query/source restoration failed") + minima = even_minima(closed[:-1]) + for mask, positions in reads.items(): + need(len(positions) == len(set(positions)) and len(positions) == minima[mask - 1] and len(positions) % 2 == 0, + "readout must use one minimum even subset of the nine slots") + value = 0 + for position in positions: + value ^= closed[position] + need(value == mask, "readout subset XOR differs from demanded mask") + + +def path_shape(word, closed): + cursor = 0 + for position in range(9): + while cursor < len(word) and word[cursor][0] == "R": + cursor += 1 + delta = closed[position] ^ closed[position + 1] + need(delta != 0, "zero query edge forbidden") + target = (delta & -delta).bit_length() - 1 + donors = [j for j in range(5) if j != target and delta >> j & 1] + segment = [["X", donor, target] for donor in donors] + [["Q", target]] + segment += [["X", donor, target] for donor in reversed(donors)] + need(word[cursor:cursor + len(segment)] == segment, "literal path-local source lowering differs") + cursor += len(segment) + need(cursor == len(word), "extra operations after final closing query") + + +def initial_state(): + roles = ["x" + str(j) for j in range(5)] + ["y" + str(m) for m in range(1, 32)] + ["z", "w0", "w1", "w2"] + return {role: {(role,)} for role in roles} + + +def formal_execute(word, initial=None): + typed_word(word) + state = initial_state() if initial is None else {role: set(terms) for role, terms in initial.items()} + for row in word: + if row[0] == "X": + source, target, prefix = "x" + str(row[1]), "x" + str(row[2]), () + elif row[0] == "Q": + source, target, prefix = "x" + str(row[1]), "z", ("B",) + else: + source, target, prefix = "z", "y" + str(row[1]), ("A" + str(row[1]),) + state[target].symmetric_difference_update({prefix + term for term in state[source]}) + return state + + +def formal_check(word): + expected = initial_state() + for mask in range(1, 32): + expected["y" + str(mask)].symmetric_difference_update( + {("A" + str(mask), "B", "x" + str(j)) for j in range(5) if mask >> j & 1}) + actual = formal_execute(word) + need(actual == expected, "free noncommuting dirty endpoint differs") + need(formal_execute(list(reversed(word)), actual) == initial_state(), "literal dirty inverse failed") + return digest({role: [list(term) for term in sorted(terms)] for role, terms in actual.items()}) + + +def invoice(word): + typed_word(word) + counts = Counter(row[0] for row in word) + leaves, nodes = 28 * counts["Q"] + counts["R"], 9 * counts["Q"] + total = leaves + nodes + counts["X"] + len(word) + return {"map_leaves": leaves, "echo_nodes": nodes, "source_XORs": counts["X"], + "root_dispatches": len(word), "borrowed_dirty_rows": 4, "total": total} + + +def admit_prices(prices): + need(type(prices) is dict and set(prices) == {"b", "a", "x"}, "fixed price keys invalid") + need(all(type(value) is int for value in prices.values()) and prices == {"b": 38, "a": 2, "x": 2}, "only fixed prices38,2,2 are admitted") + + +def verify_witness(word, closed): + bind_word(word, closed) + path_shape(word, closed) + endpoint = formal_check(word) + bill = invoice(word) + counts = Counter(row[0] for row in word) + need((counts["Q"], counts["R"], counts["X"], bill["total"]) == (9, 70, 2, 486), "credited witness Q/R/X invoice differs") + return {"closed": closed, "Q": counts["Q"], "R": counts["R"], "X": counts["X"], + "tariff": bill["total"], "invoice": bill}, endpoint + + +def validate_record(value): + need(type(value) is list and len(value) == 3, "forest record shape invalid") + code, slots, minima = value + need(type(code) is int, "graph code must be integer, not bool") + need(type(slots) is list and len(slots) == 9 and slots[0] == 0, "exactly nine slots before closing zero required") + need(all(type(v) is int and 0 <= v < 32 for v in slots), "slot labels must be five-bit integers") + need(type(minima) is list and len(minima) == 31 and all(type(v) is int and 2 <= v <= 8 and v % 2 == 0 for v in minima), + "minimum table requires31 positive even integer entries") + need(slots == closed_from_code(code)[:-1], "record slots do not bind the incidence graph") + + +def record_equal(actual, expected): + validate_record(actual) + need(actual[0] == expected[0] and actual[1] == expected[1], "actual graph/slot order differs") + need(actual[2] == expected[2], "actual minimum table differs from independent parity BFS") + + +def validate_common(value): + need(type(value) is dict and set(value) == COMMON, "receipt top keys invalid") + need(type(value["schema_version"]) is int and value["schema_version"] == 1, "receipt version must be integer1") + need(value["source_manifest_sha256"] == PIN_SHA and value["case_manifest_sha256"] == CASE_SHA, "receipt source/case binding differs") + floor = value["floor"] + need(type(floor) is dict and set(floor) == FLOOR_KEYS, "floor profile keys invalid") + for key in ("classes", "labeled_walks", "coordinate_labelings", "minimum_R"): + need(type(floor[key]) is int and floor[key] > 0, "floor counts must be positive integers") + need(type(floor["histogram"]) is list, "floor histogram must be list") + for row in floor["histogram"]: + need(type(row) is list and len(row) == 2 and all(type(v) is int and v > 0 for v in row), "histogram must contain positive integer pairs") + need(floor["histogram"] == sorted(floor["histogram"]) and len({r[0] for r in floor["histogram"]}) == len(floor["histogram"]), "histogram not unique/sorted") + need(sum(r[1] for r in floor["histogram"]) == floor["classes"], "histogram count differs") + need(type(floor["records_sha256"]) is str and len(floor["records_sha256"]) == 64 + and all(c in "0123456789abcdef" for c in floor["records_sha256"]), "record digest invalid") + witness = value["witness"] + need(type(witness) is dict and set(witness) == WITNESS_KEYS, "witness profile keys invalid") + need(type(witness["closed"]) is list and len(witness["closed"]) == 10 and all(type(v) is int and 0 <= v < 32 for v in witness["closed"]), "witness path types invalid") + need(all(type(witness[k]) is int and witness[k] > 0 for k in ("Q", "R", "X", "tariff")), "witness counts invalid") + bill = witness["invoice"] + need(type(bill) is dict and set(bill) == INVOICE_KEYS and all(type(v) is int and v > 0 for v in bill.values()), "invoice keys/counts invalid") + + +def rejected(function, value, phrase): + try: + function(value) + except ValueError as error: + need(phrase in str(error), "negative control failed at unintended guard: " + str(error)) + return True + return False + + +def controls(receipt, record, word, closed): + version = parse(canonical(receipt)); version["schema_version"] = True + extra_slot = parse(canonical(record)); extra_slot[1].append(0) + no_parity = parse(canonical(record)); no_parity[2][0] = 1 + wrong_min = parse(canonical(record)); wrong_min[2][0] = 8 if wrong_min[2][0] != 8 else 6 + omitted_q = list(word); del omitted_q[next(i for i, row in enumerate(word) if row[0] == "Q")] + omitted_x = list(word); del omitted_x[next(i for i, row in enumerate(word) if row[0] == "X")] + wrong_r = parse(canonical(word)); r = next(row for row in wrong_r if row[0] == "R"); r[1] = 1 if r[1] != 1 else 2 + final_read = list(word) + [["R", 1]] + distances_basis, unused = distances([0, 1, 2, 4, 8, 16]) + need(distances_basis[2] == 2 and distances_basis[3] == 1, "missing parity distinction failed") + result = {"boolean_schema_rejected": rejected(validate_common, version, "version"), + "duplicate_json_rejected": rejected(parse, '{"x":1,"x":2}', "duplicate"), + "nonfinite_json_rejected": rejected(parse, '{"x":NaN}', "noninteger"), + "float_json_rejected": rejected(parse, '{"x":1.0}', "noninteger"), + "extra_closing_slot_rejected": rejected(validate_record, extra_slot, "nine slots"), + "missing_parity_rejected": rejected(validate_record, no_parity, "positive even"), + "wrong_minimum_rejected": rejected(lambda r: record_equal(r, record), wrong_min, "minimum table differs"), + "wrong_price_rejected": rejected(admit_prices, {"b": 37, "a": 2, "x": 2}, "fixed prices"), + "alias_source_rejected": rejected(typed_word, [["X", 1, 1]], "alias"), + "boolean_source_rejected": rejected(typed_word, [["Q", True]], "not bool"), + "omitted_query_rejected": rejected(lambda w: bind_word(w, closed), omitted_q, "query"), + "omitted_source_XOR_rejected": rejected(lambda w: bind_word(w, closed), omitted_x, "query"), + "final_zero_read_rejected": rejected(lambda w: bind_word(w, closed), final_read, "final closing"), + "dirty_endpoint_rejected": rejected(formal_check, wrong_r, "free noncommuting"), + "uncovered_slots_rejected": rejected(even_minima, [0] * 9, "coverage")} + actual = formal_execute(word) + need(formal_execute(list(reversed(word))[:-1], actual) != initial_state(), "omitted literal inverse control failed") + result["omitted_literal_inverse_detected"] = True + need(all(result.values()), "oracle control failed") + return result + + +def actual_artifact(path, expected_records, expected_witness, closed): + with gzip.open(path, "rb") as stream: + raw = stream.read(8388609) + need(len(raw) <= 8388608, "actual FLOOR artifact exceeds8MiB") + value = parse(raw) + need(type(value) is dict and set(value) == {"schema_version", "records", "witness_word"}, "FLOOR artifact keys invalid") + need(type(value["schema_version"]) is int and value["schema_version"] == 1, "FLOOR artifact version invalid") + need(type(value["records"]) is list and len(value["records"]) == len(expected_records), "actual forest record count invalid") + for actual, expected in zip(value["records"], expected_records): + record_equal(actual, expected) + witness, endpoint = verify_witness(value["witness_word"], closed) + need(witness == expected_witness, "actual credited witness invoice differs") + return {"actual_records_compared": len(value["records"]), "actual_minimum_entries_compared": 31 * len(value["records"]), + "actual_artifact_canonical_sha256": digest(value), "actual_word_sha256": digest(value["witness_word"]), + "free_dirty_endpoint_sha256": endpoint} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--emit", type=Path) + parser.add_argument("--first-evidence", type=Path) + parser.add_argument("--check-primary", type=Path) + args = parser.parse_args() + need(not (args.emit and args.check_primary), "blind emission cannot read primary data") + cases = authenticate() + admit_prices(cases["prices"]) + codes, candidates = all_graph_codes() + records = [record_for_code(code) for code in codes] + word = witness_word(cases["closed"]) + if args.first_evidence: + with args.first_evidence.open("xb") as stream: + stream.write(gzip.compress((canonical({"schema_version": 1, "records": records, "witness_word": word}) + "\n").encode(), mtime=0)) + histogram = Counter(sum(record[2]) for record in records) + need(len(records) == 3780 and min(histogram) == 70, "credited X2 floor/control domain differs") + witness, endpoint = verify_witness(word, cases["closed"]) + floor = {"classes": len(records), "labeled_walks": len(records) * 120, "coordinate_labelings": 120, + "minimum_R": min(histogram), "histogram": [list(row) for row in sorted(histogram.items())], "records_sha256": digest(records)} + need(38 * 9 + 2 * 70 + 2 * 2 == 486 and 38 * 9 + 2 * 68 + 2 * 6 == 490, "fixed-price corollary branches fail") + value = {"schema_version": 1, "source_manifest_sha256": PIN_SHA, "case_manifest_sha256": CASE_SHA, "floor": floor, "witness": witness} + validate_common(value) + diagnostic = {"candidate_graphs_scanned": candidates, "controls": controls(value, records[0], word, cases["closed"]), + "free_dirty_endpoint_sha256": endpoint, "code_sha256": sha(Path(__file__).read_bytes()), + "scope": "Fixed-price corollary only; geometry, X2 floor and witness remain prior"} + if args.emit: + with args.emit.open("x") as stream: + stream.write(json.dumps(value, indent=2, sort_keys=True) + "\n") + else: + retained = parse((ROOT / "ORACLE.json").read_bytes()) + validate_common(retained) + need(canonical(retained) == canonical(value), "retained oracle receipt differs") + if args.check_primary: + peer = parse(args.check_primary.read_bytes()) + validate_common(peer) + need(canonical(peer) == canonical(value), "actual complete primary receipt differs") + diagnostic["actual_primary"] = actual_artifact(args.check_primary.parent / "FLOOR.json.gz", records, witness, cases["closed"]) + print("PASS_NINE_QUERY_FIXED_TARIFF_ORACLE " + canonical(diagnostic)) + + +if __name__ == "__main__": + try: + main() + except (ValueError, KeyError, TypeError, OSError) as error: + print("FAIL_NINE_QUERY_FIXED_TARIFF_ORACLE: " + str(error), file=sys.stderr) + sys.exit(1) diff --git a/research/nine-query-fixed-tariff/verify.py b/research/nine-query-fixed-tariff/verify.py new file mode 100644 index 0000000000..54fb6bef2f --- /dev/null +++ b/research/nine-query-fixed-tariff/verify.py @@ -0,0 +1,294 @@ +#!/usr/bin/env python3 +"""Fixed nine-query tariff closure and independent X2 premise/word evidence.""" +from collections import Counter +from itertools import combinations +import argparse +import gzip +import hashlib +import io +import json +import math +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parent +SOURCE_HASH = '0d1cbe7daa2cd1092c1a64a3615521b651faf8f83102b7db03896c17a0a09a1a' +CASE_HASH = 'fc2c9be60d410124b45da970af462acc749275a35e20a16969527dca5b56f4ea' +SCHEMA_HASH = '0d5089118230203c2f689e2084292997f1c6d07a735f9c3641fc788cb03f99c1' +PAIRS = list(combinations(range(9), 2)) +PAIR_INDEX = {edge: index for index, edge in enumerate(PAIRS)} +XS = ['x' + str(i) for i in range(5)] + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def sha(raw): + return hashlib.sha256(raw).hexdigest() + + +def canonical(value): + return (json.dumps(value, sort_keys=True, separators=(',', ':')) + '\n').encode() + + +def unique(pairs): + result = {} + for key, value in pairs: + require(key not in result, 'duplicate JSON key') + result[key] = value + return result + + +def bad_number(value): + raise ValueError('noninteger JSON number: ' + value) + + +def parse(raw): + return json.loads(raw, object_pairs_hook=unique, parse_float=bad_number, parse_constant=bad_number) + + +def typed_equal(a, b): + if type(a) is not type(b): + return False + if isinstance(a, dict): + return a.keys() == b.keys() and all(typed_equal(a[k], b[k]) for k in a) + if isinstance(a, list): + return len(a) == len(b) and all(typed_equal(x, y) for x, y in zip(a, b)) + return a == b + + +def authenticate(): + for name, expected in [('SOURCE-PINS.json', SOURCE_HASH), ('CASES.json', CASE_HASH), + ('SCHEMA.json', SCHEMA_HASH)]: + require(sha((ROOT / name).read_bytes()) == expected, 'immutable ' + name) + manifest = parse((ROOT / 'SOURCE-PINS.json').read_bytes()) + require(len(manifest['files']) == 4, 'four inert sources') + for row in manifest['files']: + path = (ROOT / row['local_path']).resolve() + require(path.parent == (ROOT / 'inputs').resolve(), 'source containment') + raw = path.read_bytes() + require(len(raw) == row['bytes'] and sha(raw) == row['sha256'], 'source bytes/SHA256') + require(hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() == row['git_blob'], 'source Git blob') + return parse((ROOT / 'CASES.json').read_bytes()) + + +def matchings(vertices): + first = vertices[0] + for second in vertices[1:]: + rest = [v for v in vertices if v not in (first, second)] + for partner in rest[1:]: + last = [v for v in rest if v not in (rest[0], partner)] + yield [(first, second), (rest[0], partner), tuple(last)] + + +def forest_classes(): + graphs = {} + for center in range(9): + for leaves in combinations([v for v in range(9) if v != center], 2): + rest = [v for v in range(9) if v not in (center, *leaves)] + for matching in matchings(rest): + edges = sorted([tuple(sorted((center, v))) for v in leaves] + matching) + code = sum(1 << PAIR_INDEX[edge] for edge in edges) + require(code not in graphs and len(set(edges)) == 5, 'unique forest class') + graphs[code] = edges + return sorted(graphs.items()) + + +def rank5(rows): + basis = [0] * 5 + for row in rows: + for bit in range(4, -1, -1): + if row >> bit & 1: + if basis[bit]: + row ^= basis[bit] + else: + basis[bit] = row + break + return sum(value != 0 for value in basis) + + +def graph_slots(edges): + increments = [sum(1 << j for j, edge in enumerate(edges) if vertex in edge) for vertex in range(9)] + require(all(increments) and rank5(increments) == 5, 'nonzero covering increments') + points = [0] + for delta in increments: + points.append(points[-1] ^ delta) + require(points[-1] == 0, 'closed forest path') + require(sum(2 * (x.bit_count() - 1) for x in increments) == 2, 'actual X2 forest layer') + return points[:-1] + + +def even_minima(slots): + require(len(slots) == 9 and slots[0] == 0, 'nine prefix slots') + values, best, chosen = [0] * 512, [99] * 32, [None] * 32 + for subset in range(512): + if subset: + bit = subset & -subset + values[subset] = values[subset ^ bit] ^ slots[bit.bit_length() - 1] + weight = subset.bit_count() + value = values[subset] + if weight % 2 == 0 and weight < best[value]: + best[value], chosen[value] = weight, subset + require(all(0 < x < 99 and x % 2 == 0 for x in best[1:]), 'complete even-subset coverage') + return best[1:], chosen[1:] + + +def records(limit): + result = [] + for code, edges in forest_classes(): + slots = graph_slots(edges); minima, _ = even_minima(slots) + result.append([code, slots, minima]) + require(len(result) <= limit, 'record cap without pruning') + return result + + +def witness_word(closed): + minima, chosen = even_minima(closed[:-1]); word = [] + for position in range(9): + for mask, subset in enumerate(chosen, 1): + if subset >> position & 1: + word.append(['R', mask]) + delta = closed[position] ^ closed[position + 1] + require(delta != 0, 'nonzero query edge') + target = (delta & -delta).bit_length() - 1 + donors = [j for j in range(5) if j != target and delta >> j & 1] + word.extend([['X', donor, target] for donor in donors]) + word.append(['Q', target]) + word.extend([['X', donor, target] for donor in reversed(donors)]) + return word, minima + + +def initial_state(): + names = XS + ['y' + str(m) for m in range(1, 32)] + ['z', 'w0', 'w1', 'w2'] + return {name: {(name,)} for name in names} + + +def apply_event(state, event): + require(type(event) is list and event and type(event[0]) is str, 'instruction array') + kind = event[0] + if kind == 'X': + require(len(event) == 3 and all(type(x) is int and 0 <= x < 5 for x in event[1:]) + and event[1] != event[2], 'source XOR distinct integer ports') + source, target, prefix = XS[event[1]], XS[event[2]], () + elif kind == 'Q': + require(len(event) == 2 and type(event[1]) is int and 0 <= event[1] < 5, 'query integer port') + source, target, prefix = XS[event[1]], 'z', ('B',) + elif kind == 'R': + require(len(event) == 2 and type(event[1]) is int and 1 <= event[1] < 32, 'readout integer mask') + source, target, prefix = 'z', 'y' + str(event[1]), ('A' + str(event[1]),) + else: + raise ValueError('instruction alphabet') + state[target].symmetric_difference_update({prefix + term for term in state[source]}) + + +def connector_point(polynomial): + require(('z',) in polynomial, 'dirty connector retained') + point = 0 + for term in polynomial - {('z',)}: + require(len(term) == 2 and term[0] == 'B' and term[1] in XS, 'literal common-B connector projection') + point ^= 1 << XS.index(term[1]) + return point + + +def expected_state(): + state = initial_state() + for mask in range(1, 32): + state['y' + str(mask)] |= {('A' + str(mask), 'B', XS[j]) for j in range(5) if mask >> j & 1} + return state + + +def check_word(word, closed): + state = initial_state(); prefixes = [0]; reads = {m: [] for m in range(1, 32)}; q = 0 + counts = Counter() + for event in word: + apply_event(state, event); counts[event[0]] += 1 + if event[0] == 'R': + reads[event[1]].append(q) + elif event[0] == 'Q': + q += 1; prefixes.append(connector_point(state['z'])) + require(prefixes == closed, 'actual query prefix/path binding') + minima, _ = even_minima(closed[:-1]) + for mask, slots in reads.items(): + require(len(slots) == minima[mask - 1] and len(set(slots)) == len(slots) + and all(0 <= x < 9 for x in slots), 'actual minimum even readouts') + value = 0 + for slot in slots: + value ^= closed[slot] + require(len(slots) % 2 == 0 and value == mask, 'actual even subset XOR') + require(state == expected_state(), 'free noncommuting dirty root map/restoration') + for event in reversed(word): + apply_event(state, event) + require(state == initial_state(), 'literal full-word inverse') + Q, R, X = counts['Q'], counts['R'], counts['X'] + invoice = {'map_leaves': 28 * Q + R, 'echo_nodes': 9 * Q, 'source_XORs': X, + 'root_dispatches': len(word), 'borrowed_dirty_rows': 4, + 'total': 38 * Q + 2 * R + 2 * X} + require(invoice['total'] == invoice['map_leaves'] + invoice['echo_nodes'] + X + len(word), 'complete fixture invoice') + return {'closed': closed, 'Q': Q, 'R': R, 'X': X, 'tariff': invoice['total'], 'invoice': invoice} + + +def reject(call, fragment): + try: + call() + except ValueError as error: + require(fragment in str(error), 'intended rejection diagnostic') + return + raise ValueError('negative control accepted') + + +def controls(word, closed): + reject(lambda: parse(b'{"x":1,"x":2}'), 'duplicate') + reject(lambda: parse(b'{"x":NaN}'), 'noninteger') + reject(lambda: parse(b'{"x":1.0}'), 'noninteger') + for event, fragment in [(['Q', True], 'query'), (['R', 32], 'readout'), + (['X', 0, 0], 'XOR'), (['bad', 0], 'alphabet')]: + reject(lambda: apply_event(initial_state(), event), fragment) + for kind, fragment in [('Q', 'prefix/path'), ('R', 'minimum even'), ('X', 'prefix/path')]: + index = next(i for i, event in enumerate(word) if event[0] == kind) + changed = word[:index] + word[index + 1:] + reject(lambda: check_word(changed, closed), fragment) + return 10 + + +def read_artifact(path, cap): + with gzip.GzipFile(fileobj=io.BytesIO(path.read_bytes())) as stream: + raw = stream.read(cap + 1) + require(len(raw) <= cap, 'artifact byte cap') + return parse(raw) + + +def main(): + parser = argparse.ArgumentParser(); parser.add_argument('--emit', type=Path) + parser.add_argument('--write-floor', type=Path); args = parser.parse_args() + cases = authenticate(); rows = records(cases['limits']['records']) + word, _ = witness_word(cases['closed']) + artifact = {'schema_version': 1, 'records': rows, 'witness_word': word} + raw = canonical(artifact); require(len(raw) <= cases['limits']['artifact_bytes'], 'artifact byte cap') + if args.write_floor: + with gzip.open(args.write_floor, 'wb') as stream: + stream.write(raw) + histogram = Counter(sum(row[2]) for row in rows) + require(len(rows) == 3780 and min(histogram) == 70, 'credited X2 premise independently checked') + witness = check_word(word, cases['closed']); control_count = controls(word, cases['closed']) + require([witness[k] for k in ['Q', 'R', 'X', 'tariff']] == [9, 70, 2, 486], 'credited witness full fixed invoice') + require(38 * 9 + 2 * cases['credited_premises']['unrestricted_R_lower_bound'] + 2 * 6 == 490, 'credited higher-X fixed-price bound') + floor = {'classes': len(rows), 'labeled_walks': len(rows) * math.factorial(5), + 'coordinate_labelings': math.factorial(5), 'minimum_R': min(histogram), + 'histogram': [list(x) for x in sorted(histogram.items())], 'records_sha256': sha(canonical(rows))} + result = {'schema_version': 1, 'source_manifest_sha256': SOURCE_HASH, + 'case_manifest_sha256': CASE_HASH, 'floor': floor, 'witness': witness} + if args.emit: + args.emit.write_bytes(canonical(result)) + else: + require(typed_equal(parse((ROOT / 'RESULT.json').read_bytes()), result), 'actual complete retained result differs') + require(typed_equal(read_artifact(ROOT / 'FLOOR.json.gz', cases['limits']['artifact_bytes']), artifact), 'actual complete retained FLOOR differs') + print('PASS_NINE_QUERY_FIXED_TARIFF classes=3780 fixed_tariff=486 controls=' + str(control_count)) + + +if __name__ == '__main__': + try: + main() + except (OSError, ValueError, KeyError, TypeError) as error: + print('FAIL: ' + str(error), file=sys.stderr); sys.exit(1)