diff --git a/research/six-source-trio-path-seed87a169/CERTIFICATE.json b/research/six-source-trio-path-seed87a169/CERTIFICATE.json new file mode 100644 index 0000000000..c9a64690c7 --- /dev/null +++ b/research/six-source-trio-path-seed87a169/CERTIFICATE.json @@ -0,0 +1,202 @@ +{ + "cost": { + "best_one_trio_with_four_readout_repairs": { + "output_readouts": 130, + "root_calls": 144, + "source_calls": 14, + "source_map_applications": 16 + }, + "delta_formula": "-2*f + 4*g + rho; f=source-call frame/dispatch cost, g=one output readout cost, rho=all additional TRIO-specific expense", + "incumbent": { + "output_readouts": 126, + "root_calls": 142, + "source_calls": 16, + "source_map_applications": 16 + }, + "scope_note": "The source-map multiplicity multiset matches the incumbent's (2,2,2,2,4,4); at unit call prices the completed one-TRIO path loses by 2 before rho.", + "unit_call_delta": 2 + }, + "domain": { + "allowed_sorted_singleton_count_profiles": [ + [ + 1, + 1, + 2, + 2, + 2, + 5 + ], + [ + 1, + 2, + 2, + 2, + 3, + 3 + ] + ], + "canonicalization": "restricted-growth strings over six labels", + "coverage_rule": "pairwise XOR differences of p0..p13", + "prefixes_tested": "p0 through p13; p14=p0 after closing TRIO", + "repeated_prefixes_allowed": true, + "singleton_calls": 13, + "sources": 6, + "trio_calls": 1, + "trio_position": "last, by commuting source updates" + }, + "enumeration": { + "complete_six_label_words": 9321312, + "histogram_nonzero_pair_masks": { + "21": 1664, + "25": 20540, + "28": 55172, + "30": 64289, + "31": 25951, + "32": 107378, + "34": 184292, + "35": 70556, + "36": 85285, + "37": 153379, + "38": 135440, + "39": 133446, + "40": 100656, + "41": 200662, + "42": 98597, + "43": 182548, + "44": 18618, + "45": 178451, + "46": 57990, + "47": 105048, + "48": 101552, + "49": 67678, + "50": 47136, + "51": 54830, + "52": 31678, + "53": 24144, + "54": 17780, + "55": 9736, + "56": 4284, + "57": 2548, + "58": 660, + "59": 176, + "60": 88, + "61": 88 + }, + "maximum_coverage": 61, + "number_at_maximum": 88, + "records_sha256": "9e212480bdcbb7d7d70ce175ce7febbcdff759fb1ad640a2daf49036758a93e8", + "rgs_nodes_including_root": 23767896, + "words_in_allowed_profiles": 2342340 + }, + "maximum_witness": { + "closing_trio_mask": 21, + "covered_nonzero_masks": 61, + "four_readout_indices_for_missing_masks": { + "11": [ + 0, + 1, + 7, + 13 + ], + "40": [ + 0, + 1, + 4, + 9 + ] + }, + "missing_masks": [ + 11, + 40 + ], + "prefixes": [ + 0, + 1, + 3, + 2, + 6, + 14, + 15, + 31, + 63, + 47, + 45, + 37, + 53, + 21 + ], + "singleton_counts": [ + 3, + 2, + 1, + 2, + 3, + 2 + ], + "singleton_word": [ + 0, + 1, + 0, + 2, + 3, + 0, + 4, + 5, + 4, + 1, + 3, + 4, + 5 + ], + "total_source_map_counts": [ + 4, + 2, + 2, + 2, + 4, + 2 + ] + }, + "positive_control": { + "incumbent_singleton_word": [ + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 2, + 3, + 4, + 3, + 5, + 3, + 4, + 3, + 5 + ], + "nonzero_masks_covered": 63, + "prefixes": [ + 0, + 1, + 3, + 2, + 6, + 7, + 5, + 4, + 0, + 8, + 24, + 16, + 48, + 56, + 40, + 32, + 0 + ], + "root_calls": 142 + }, + "schema": "six-source-single-trio-path-census-v1" +} diff --git a/research/six-source-trio-path-seed87a169/CLAIM.md b/research/six-source-trio-path-seed87a169/CLAIM.md new file mode 100644 index 0000000000..69ee406562 --- /dev/null +++ b/research/six-source-trio-path-seed87a169/CLAIM.md @@ -0,0 +1,61 @@ +# Claim and handoff — six-source atomic TRIO + +**Track / assignment:** `recursive-interfaces`, OS seed +`87a1691b537e8b9bdc20798d6f9f341d`, task `connector-alphabet-change`, priority +revision 4, scope key `0c9f43f3c7d61edb36fe`. + +**Pins:** base `0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2`; selected-record +SHA-256 `10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32`; +catalogue SHA-256 `d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7`. + +**Question / changed expense:** With six read-only sources, can one atomic +three-source operation `TRIO_{j,k,l}` plus thirteen singleton operations +produce a closed 14-call path whose paired boundary differences cover all 63 +nonzero masks, while keeping each total source-map count even and at least two? +The TRIO combines three source-map applications in one root source call; it is +charged for every added access, arithmetic, frame, precision, restoration, +copying, and routing expense. No map application is treated as free. + +**Completed domain:** The initial candidate was limited to distinct prefixes. +One bounded pivot removed that simple-path restriction and included both +possible restored 16-map multiplicity profiles. The exact search exhausts all +13-letter restricted-growth words on six labels with singleton profiles +`(1,2,2,2,3,3)` or `(1,1,2,2,2,5)`, including repeated prefix states. It checks +all pairwise XORs of `p0..p13`; the final TRIO closes at `p14=p0`. + +**Result:** 2,342,340 profile words among 9,321,312 complete six-label RGS +words. Python incremental coverage and independent C++ direct pairwise XOR +coverage agree on the full histogram. Maximum coverage is 61/63, attained by +88 words; none covers 62 or 63. The exhibited maximum has missing masks 11 and +40, each repairable with four readouts. It costs 144 root calls versus the +incumbent's 142 at unit prices; the source-map multiplicity multiset matches +the incumbent. In general, candidate minus incumbent is `-2*f + 4*g + rho`. +This is a scoped construction negative, not a universal obstruction or a new +kappa. + +**Predecessors / overlap:** The pinned six-source singleton result gives the +142-query incumbent. The local review of PR #1518 describes its proved domain +as a ten-call, one-TRIO, twelve-map census, distinct from this fourteen-call, +sixteen-map domain. The nearest active connector claim in the 2026-10-14 +19:58 UTC complete snapshot was a six-source DUO search (Discussion #1166, +comment `18932952`); it changes a different call family. A full paginated +refresh completed at 2026-10-14 20:22:44 UTC and the exact terms were searched +again at 20:23 UTC; no same-domain claim appeared. The original comment could +not be posted when first claimed because GitHub GraphQL was rate-limited. The +completed claim/result update was posted afterward to Discussion #1163, +comment `18933586`: +https://github.com/CrocSwap/integer-mult-bounds/discussions/1163#discussioncomment-18933586 + +**Reproduction:** From repository root, run +`python3 -B research/six-source-trio-path-seed87a169/verify.py` and the +independent C++ command in the package README. The certificate records the +histogram, witness, missing-mask repair indices, and exact-record digest. + +**Claim expiry:** `2026-10-14T21:23:00Z`. The post was made at 20:23 UTC with +the completed evidence because the initial API attempt failed. The Discussion +comment has since been updated with the PR link. + +**Submission:** [PR #2134](https://github.com/CrocSwap/integer-mult-bounds/pull/2134) +was opened after the fresh overlap check. At initial status inspection it was +open and mergeable; repository checks were queued. The Discussion comment was +updated with the PR link. diff --git a/research/six-source-trio-path-seed87a169/README.md b/research/six-source-trio-path-seed87a169/README.md new file mode 100644 index 0000000000..7c01fdc4df --- /dev/null +++ b/research/six-source-trio-path-seed87a169/README.md @@ -0,0 +1,128 @@ +# Six-source path with one atomic TRIO + +**Scoped exact negative result.** A six-source closed connector path containing +thirteen singleton source calls and one atomic three-source call cannot cover +all 63 nonzero output masks using paired readouts when the total of 16 source +map applications is restored at minimum multiplicity. The best coverage in +that exact domain is 61/63. One maximum path repairs its two missing masks with +four readouts apiece, for a completed total of 144 root calls. The incumbent +singleton construction uses 142. At equal unit call prices, this TRIO path +loses by two calls before any TRIO-specific overhead. This is not a result +about paths with two or more TRIO calls, other operation alphabets, or changes +to the readout/restoration model, and it gives no new kappa. + +## Exact domain and census + +The path has six source labels, thirteen singleton steps, and one TRIO step +`TRIO_{j,k,l}: z += B_j x_j + B_k x_k + B_l x_l`, with three distinct labels. +The sources are read-only and the connector may start dirty. Source updates +commute, so moving the TRIO to the end preserves all pairwise differences +between boundary states. The final TRIO must toggle exactly the three labels +whose singleton counts are odd. + +There are 16 source-map applications altogether. Restoring every source +requires an even count of at least two, so the only possible sorted total +source-map profiles are `(2,2,2,2,4,4)` and `(2,2,2,2,2,6)`. Subtracting the +three final TRIO applications yields the two enumerated sorted singleton +profiles `(1,2,2,2,3,3)` and `(1,1,2,2,2,5)`. + +`search.py` exhausts every restricted-growth string (RGS) of length 13 using +all six labels. RGS canonicalization quotients coordinate relabeling, which +preserves XOR coverage. Repeated prefix states are allowed. For each word the +search incrementally accumulates all pairwise XORs of `p0..p13`; `p14=p0` +after the closing TRIO. It counts 9,321,312 complete six-label RGS words and +2,342,340 words in the two charged profiles. None covers 62 or 63 nonzero +masks; 88 paths attain 61. The complete coverage histogram and a fixed-width +SHA-256 digest of every eligible word/coverage record are in +[CERTIFICATE.json](CERTIFICATE.json). + +The maximum witness is singleton labels +`0,1,0,2,3,0,4,5,4,1,3,4,5`, followed by `TRIO_{0,2,4}`. Its source-map counts +are `(4,2,2,2,4,2)`. Prefixes are +`0,1,3,2,6,14,15,31,63,47,45,37,53,21`. Its paired-readout set misses masks +11 and 40. Boundary indices `(0,1,7,13)` XOR to 11; `(0,1,4,9)` XOR to 40, +so each can be emitted with four readouts while restoring the output. + +## Completed cost + +Let `f` be the complete per-source-call frame and dispatch tariff, `g` the +price of one output readout, and `rho` all incremental TRIO expenses. The +source-map application multiset matches the incumbent and can be assigned to +the same source tariffs. Its 16 singleton calls emit 63 rows twice each: +142 root calls total. The best one-TRIO path uses 14 source calls. Since it +misses two rows under paired readout, completing those rows with four +readouts each adds four output calls, giving 130 output readouts and 144 root +calls. Thus + +```text +candidate - incumbent = -2*f + 4*g + rho. +``` + +Here `rho` includes any extra TRIO arithmetic, source access, descriptors, +precision, copied information, hosting, restoration, and interface-routing +cost beyond the same 16 source-map applications and common work. At unit call +prices `f=g=1`, the candidate costs `2+rho` more. A different tariff model can +be assessed from the displayed equation; no unpriced TRIO operation or +supplier improvement is assumed. + +## Reproduction + +From the repository root, the registered replay recomputes the full Python +census and checks the certificate, witness, positive control, negative +controls, and bill: + +```sh +python3 -B research/six-source-trio-path-seed87a169/verify.py +``` + +Expected final line: +`PASS_SINGLE_TRIO_CENSUS eligible=2342340 max=61/63 at_max=88 completed_queries=144 incumbent=142`. + +An independent C++ implementation recomputes the pairwise differences directly +at each eligible leaf (rather than incrementally maintaining coverage): + +```sh +g++ -O3 -std=c++17 research/six-source-trio-path-seed87a169/independent.cpp -o /tmp/six-trio-independent +/tmp/six-trio-independent +``` + +It reports the same node count, profile count, maximum, and complete histogram. +The repository positive control is the known 16-singleton six-source word, +which covers all 63 nonzero masks. Negative controls reject an invalid source +profile and an out-of-alphabet label. + +The original boundary-model control is also reproduced by +`python3 -B research/universal-connector-boundary/verify.py`. + +## Provenance and limits + +The source manifest pins the selected record, task catalogue, and model +predecessors to base `0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2`. The six-source +singleton result is in `research/universal-connector-six-source/`; the +unchanged boundary model is in `research/universal-connector-boundary/`. +PR #1518's reviewed scope is a ten-call, one-TRIO, twelve-source-map census; +this package instead covers fourteen source calls and sixteen map applications. +The nearest active connector claim in the fresh snapshot concerned six-source +DUO paths, a different operation. + +This result is restricted to one TRIO, thirteen singleton calls, six sources, +16 source-map applications, the restored even-count profiles above, and the +paired-readout model with four-readout repairs. It does not rule out another +alphabet, a longer source path, multiple TRIO calls, a changed restoration +contract, or a different weighting of frames and readouts. + +## Open next questions + +Can two or more atomic TRIO calls reduce the completed six-source bill? This +changes the call-count frontier and the attainable prefix-difference set. A +bounded first step is to derive the optimistic source-map profiles for twelve +singleton calls plus two TRIO calls and test whether all 63 rows can be paired +with fewer than 126 readouts. It is outside this cycle's one-TRIO census and +has no known blocker. + +## Credit + +Prepared by OpenAI Codex with substantial AI assistance in the mathematical +search design, implementation, cost accounting, and write-up. No predecessor +code is imported; model and incumbent claims are attributed to the pinned +repository sources above. diff --git a/research/six-source-trio-path-seed87a169/SOURCES.json b/research/six-source-trio-path-seed87a169/SOURCES.json new file mode 100644 index 0000000000..decd571d4a --- /dev/null +++ b/research/six-source-trio-path-seed87a169/SOURCES.json @@ -0,0 +1,48 @@ +{ + "schema_version": 1, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "e8870e5917057d59b730eb14721a778639eca050", + "sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7" + }, + { + "path": "docs/research/community-efficient600-review.md", + "usage": "provenance", + "git_blob": "efcc19abfddecfe9b85a83facd1741f7beb0981f", + "sha256": "d11aae08ba620ccea3b826ae507dd0fd45a5ead19b2571f4ceede9602259a1a4" + }, + { + "path": "research/universal-connector-boundary/README.md", + "usage": "input", + "git_blob": "d277f7c5830b1f2bc42e1ff41ab86e7d7564929f", + "sha256": "23415f7829ab8d80a783142f10f7d31abbce84579362769984680af3df954476" + }, + { + "path": "research/universal-connector-boundary/verify.py", + "usage": "input", + "git_blob": "de6483bb7ff51940dbbb76c18f91af4c907e07da", + "sha256": "e4fa4700f9e1ae6ca09c3c76ebc569e8361b89b699425a67839d999d8812e42d" + }, + { + "path": "research/universal-connector-six-source/README.md", + "usage": "input", + "git_blob": "c7123c3cfd7545deb6af607800df0d15c6e8c0d2", + "sha256": "ea9cca56d1547dcd984f5f99f6c6243c9417a7ede08f68782c7a6616aa6eb563" + }, + { + "path": "research/universal-connector-six-source/verify.py", + "usage": "input", + "git_blob": "069d299dfd206697d073d731a86e5b5079558331", + "sha256": "930c3c2135c28192a907b88cce9cc07ab2fdf1e36f263249cd3bf38d4a3aed5b" + } + ] +} diff --git a/research/six-source-trio-path-seed87a169/TASK.json b/research/six-source-trio-path-seed87a169/TASK.json new file mode 100644 index 0000000000..3de58e38f3 --- /dev/null +++ b/research/six-source-trio-path-seed87a169/TASK.json @@ -0,0 +1,65 @@ +{ + "schema_version": 1, + "task_id": "connector-alphabet-change", + "priority_revision": 4, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "original_card": { + "id": "connector-alphabet-change", + "question": "Does one explicit extension of the connector alphabet offer a favorable completed budget?", + "starting_points": [ + "research/universal-connector-boundary/README.md", + "certificates/selected-result.json" + ], + "methods": [ + "Construct and charge a legal extra operation on a minimal instance.", + "Prove a target-specific bound after adding one specified operation family." + ], + "acceptance_gate": "State which fixed-alphabet premise changes and charge its implementation; do not declare it free.", + "first_step": { + "command": [ + "python3", + "-B", + "research/universal-connector-boundary/verify.py" + ], + "expected": "PASS_UNIVERSAL_CONNECTOR_BOUNDARY", + "inspect": "Reproduce the 945-pairing control, then read Exact interface to list the allowed calls.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Add exactly one legally priced operation and test a tiny dirty-input instance before enumerating larger cases.", + "bottleneck_link": "A new legal connector operation could change recursive interface cost; a larger census in the same alphabet is a separate side result.", + "allowed_variations": [ + "Choose one additional operation and a small source count for its first counterexample." + ], + "scope_change_triggers": [ + "Keeping the alphabet and only increasing the source count; record this as a changed assignment." + ], + "overlap_terms": [ + "universal connector", + "source-toggle", + "connector alphabet" + ] + }, + "scope_status": "changed", + "actual_scope": "For six sources, exhaust all canonical thirteen-singleton words plus one final atomic TRIO whose total source-map counts are even and at least two; determine maximum paired-readout coverage among both possible 16-map profiles and price the best completion.", + "scope_change_reason": "The initial simple-path-only search was widened once to include repeated prefix states and both possible restored 16-map multiplicity profiles. This makes the finite census complete for the selected one-TRIO, fourteen-source-call objective rather than excluding paths by a simplicity assumption.", + "bottleneck_link": "The proposed operation could reduce recursive source-call/frame overhead while preserving the incumbent source-map application profile. The exact six-source census finds a two-readout deficit, so standard four-readout repairs make the completed unit-price bill worse than the incumbent.", + "budget_minutes": 60, + "stop_rule": "Exhaust every length-13 restricted-growth word using all six labels whose sorted singleton counts are (1,2,2,2,3,3) or (1,1,2,2,2,5); allow repeated prefixes; stop after all leaves and direct-difference cross-check complete.", + "outcome": "negative-result", + "evidence": "The full domain has 9,321,312 complete six-label RGS words, of which 2,342,340 match the two restored 16-map profiles. Incremental Python coverage and an independent direct-pair-difference C++ implementation agree on the complete histogram. Maximum paired coverage is 61/63 (88 words); no candidate covers 62 or 63. The exhibited maximum path repairs masks 11 and 40 with four readouts each, yielding 144 root calls versus the incumbent 142 at unit prices. No new kappa is claimed.", + "assignment_seed": "87a1691b537e8b9bdc20798d6f9f341d", + "selector_scope_key": "0c9f43f3c7d61edb36fe", + "catalogue_sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7", + "selected_record_sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32", + "accepted_track": "recursive-interfaces", + "author": "OpenAI Codex", + "ai_assistance": "Substantial AI assistance in choosing the bounded construction hypothesis, writing and independently cross-checking the exact census implementations, deriving the completed cost equation, and preparing the report. No predecessor implementation was copied.", + "open_questions": [ + { + "question": "Can two or more atomic TRIO calls reduce the completed six-source bill?", + "why_it_matters": "The one-TRIO path is exactly priced and does not improve at unit call costs; a second TRIO changes both the call-count frontier and the attainable prefix-difference set.", + "first_step": "Before enumerating, derive the optimistic fully charged source-map profiles for 12 singleton calls plus two TRIO calls and identify whether at least 63 masks can be paired with fewer than 126 output readouts.", + "blocked_by": "No blocker; it is a distinct future construction task and was outside this cycle's one bounded experiment." + } + ] +} diff --git a/research/six-source-trio-path-seed87a169/VERIFY.json b/research/six-source-trio-path-seed87a169/VERIFY.json new file mode 100644 index 0000000000..6d28920424 --- /dev/null +++ b/research/six-source-trio-path-seed87a169/VERIFY.json @@ -0,0 +1,23 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/universal-connector-boundary/README.md", + "research/universal-connector-boundary/verify.py", + "research/universal-connector-six-source/README.md", + "research/universal-connector-six-source/verify.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Recompute all 2,342,340 charged RGS words; compare the complete histogram and digest; validate the 61-mask witness, four-readout repairs, incumbent full-cover positive control, invalid-profile and out-of-alphabet negative controls, and the 144 versus 142 unit-price cost." + } + ] +} diff --git a/research/six-source-trio-path-seed87a169/independent.cpp b/research/six-source-trio-path-seed87a169/independent.cpp new file mode 100644 index 0000000000..6a35f37a83 --- /dev/null +++ b/research/six-source-trio-path-seed87a169/independent.cpp @@ -0,0 +1,64 @@ +// Independent direct-pair-difference census for the registered Python result. +// Build: g++ -O3 -std=c++17 independent.cpp -o /tmp/trio-census +// Run: /tmp/trio-census +#include +#include +#include +#include +#include + +static constexpr int N = 13; +std::array counts{}; +std::array word{}; +std::uint64_t nodes = 0, complete = 0, eligible = 0; +std::array histogram{}; + +bool allowed_profile() { + auto c = counts; + std::sort(c.begin(), c.end()); + return c == std::array{1, 2, 2, 2, 3, 3} + || c == std::array{1, 1, 2, 2, 2, 5}; +} + +void visit(int depth, int used) { + ++nodes; + if (depth == N) { + if (used != 6) return; + ++complete; + if (!allowed_profile()) return; + ++eligible; + std::array prefix{}; + for (int i = 0; i < N; ++i) prefix[i + 1] = prefix[i] ^ (1 << word[i]); + std::array covered{}; + for (int i = 0; i <= N; ++i) + for (int j = i + 1; j <= N; ++j) + covered[prefix[i] ^ prefix[j]] = true; + int size = 0; + for (int mask = 1; mask < 64; ++mask) size += covered[mask]; + ++histogram[size]; + return; + } + const int limit = std::min(used, 5); + for (int label = 0; label <= limit; ++label) { + word[depth] = label; + ++counts[label]; + visit(depth + 1, std::max(used, label + 1)); + --counts[label]; + } +} + +int main() { + visit(0, 0); + int maximum = 0; + for (int k = 1; k < 64; ++k) if (histogram[k]) maximum = k; + std::cout << "CPP nodes=" << nodes << " complete=" << complete + << " eligible=" << eligible << " max=" << maximum + << " at_max=" << histogram[maximum] << " histogram={"; + bool first = true; + for (int k = 1; k < 64; ++k) if (histogram[k]) { + if (!first) std::cout << ','; + first = false; + std::cout << '"' << k << "\":" << histogram[k]; + } + std::cout << "}\n"; +} diff --git a/research/six-source-trio-path-seed87a169/search.py b/research/six-source-trio-path-seed87a169/search.py new file mode 100644 index 0000000000..c16f1f1189 --- /dev/null +++ b/research/six-source-trio-path-seed87a169/search.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python3 +"""Exhaust the six-label, one-TRIO, thirteen-singleton closed-path class.""" +from collections import Counter +import hashlib +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +N = 13 +PROFILES = {(1, 2, 2, 2, 3, 3), (1, 1, 2, 2, 2, 5)} + + +def differences(prefixes): + result = 0 + for i, left in enumerate(prefixes): + for right in prefixes[i + 1:]: + result |= 1 << (left ^ right) + return result & ~1 + + +def analyze_word(word): + if len(word) != N or any(type(x) is not int or not 0 <= x < 6 for x in word): + raise ValueError("word must contain thirteen labels from 0..5") + seen = set() + next_label = 0 + counts = [0] * 6 + prefixes = [0] + state = 0 + for label in word: + if label > next_label or (label == next_label and next_label >= 6): + raise ValueError("word is not a restricted-growth string") + if label == next_label: + next_label += 1 + seen.add(label) + counts[label] += 1 + state ^= 1 << label + prefixes.append(state) + if len(seen) != 6 or tuple(sorted(counts)) not in PROFILES: + raise ValueError("word is outside the two charged source-map profiles") + trio = state + if trio.bit_count() != 3: + raise ValueError("closing TRIO must toggle exactly three odd-count labels") + return counts, trio, prefixes, differences(prefixes) + + +def four_readout_representations(prefixes, target): + # Return lexicographically first four distinct boundary indices whose + # prefix values XOR to target. The path certificate has distinct states. + for a in range(len(prefixes)): + for b in range(a + 1, len(prefixes)): + for c in range(b + 1, len(prefixes)): + for d in range(c + 1, len(prefixes)): + if prefixes[a] ^ prefixes[b] ^ prefixes[c] ^ prefixes[d] == target: + return [a, b, c, d] + return None + + +def singleton_positive_control(): + # The incumbent six-source word from universal-connector-six-source. + word = [0, 1, 0, 2, 0, 1, 0, 2, 3, 4, 3, 5, 3, 4, 3, 5] + prefixes = [0] + state = 0 + for label in word: + state ^= 1 << label + prefixes.append(state) + if state != 0 or differences(prefixes) != (1 << 64) - 2: + raise ValueError("positive control failed to cover all 63 nonzero masks") + return word, prefixes + + +def enumerate_class(): + histogram = Counter() + nodes = complete = eligible = 0 + record_hash = hashlib.sha256() + best_size = -1 + best_word = best_prefixes = best_counts = best_trio = None + counts = [0] * 6 + word = [0] * N + prefixes = [0] + + def visit(depth, used, cover): + nonlocal nodes, complete, eligible + nonlocal best_size, best_word, best_prefixes, best_counts, best_trio + nodes += 1 + if depth == N: + if used != 6: + return + complete += 1 + profile = tuple(sorted(counts)) + if profile not in PROFILES: + return + eligible += 1 + size = (cover & ~1).bit_count() + histogram[size] += 1 + # Fixed-width records make the full exact census auditable. + record_hash.update(bytes(word)) + record_hash.update(cover.to_bytes(8, "big")) + if size > best_size: + best_size = size + best_word = word.copy() + best_prefixes = prefixes.copy() + best_counts = counts.copy() + best_trio = prefixes[-1] + return + + for label in range(min(used + 1, 6)): + word[depth] = label + counts[label] += 1 + new_state = prefixes[-1] ^ (1 << label) + new_cover = cover + for old_state in prefixes: + new_cover |= 1 << (new_state ^ old_state) + prefixes.append(new_state) + visit(depth + 1, max(used, label + 1), new_cover) + prefixes.pop() + counts[label] -= 1 + + visit(0, 0, 0) + if sum(histogram.values()) != eligible or best_size != max(histogram): + raise ValueError("internal enumeration accounting failure") + covered = differences(best_prefixes) + missing = [mask for mask in range(1, 64) if not (covered >> mask & 1)] + reps = {str(mask): four_readout_representations(best_prefixes, mask) for mask in missing} + singleton_word, singleton_prefixes = singleton_positive_control() + return { + "schema": "six-source-single-trio-path-census-v1", + "domain": { + "sources": 6, + "singleton_calls": 13, + "trio_calls": 1, + "trio_position": "last, by commuting source updates", + "canonicalization": "restricted-growth strings over six labels", + "allowed_sorted_singleton_count_profiles": [list(x) for x in sorted(PROFILES)], + "prefixes_tested": "p0 through p13; p14=p0 after closing TRIO", + "coverage_rule": "pairwise XOR differences of p0..p13", + "repeated_prefixes_allowed": True, + }, + "enumeration": { + "rgs_nodes_including_root": nodes, + "complete_six_label_words": complete, + "words_in_allowed_profiles": eligible, + "records_sha256": record_hash.hexdigest(), + "histogram_nonzero_pair_masks": {str(k): histogram[k] for k in sorted(histogram)}, + "maximum_coverage": best_size, + "number_at_maximum": histogram[best_size], + }, + "maximum_witness": { + "singleton_word": best_word, + "singleton_counts": best_counts, + "closing_trio_mask": best_trio, + "total_source_map_counts": [best_counts[j] + ((best_trio >> j) & 1) for j in range(6)], + "prefixes": best_prefixes, + "covered_nonzero_masks": best_size, + "missing_masks": missing, + "four_readout_indices_for_missing_masks": reps, + }, + "positive_control": { + "incumbent_singleton_word": singleton_word, + "prefixes": singleton_prefixes, + "nonzero_masks_covered": 63, + "root_calls": 142, + }, + "cost": { + "incumbent": {"source_map_applications": 16, "source_calls": 16, "output_readouts": 126, "root_calls": 142}, + "best_one_trio_with_four_readout_repairs": {"source_map_applications": 16, "source_calls": 14, "output_readouts": 130, "root_calls": 144}, + "delta_formula": "-2*f + 4*g + rho; f=source-call frame/dispatch cost, g=one output readout cost, rho=all additional TRIO-specific expense", + "unit_call_delta": 2, + "scope_note": "The source-map multiplicity multiset matches the incumbent's (2,2,2,2,4,4); at unit call prices the completed one-TRIO path loses by 2 before rho.", + }, + } + + +def main(): + if len(sys.argv) != 2 or sys.argv[1] not in ("--write", "--check"): + print("usage: search.py --write|--check", file=sys.stderr) + return 2 + result = enumerate_class() + path = HERE / "CERTIFICATE.json" + encoded = json.dumps(result, indent=2, sort_keys=True) + "\n" + if sys.argv[1] == "--write": + path.write_text(encoded, encoding="utf-8") + elif not path.is_file() or path.read_text(encoding="utf-8") != encoded: + print("FAIL_CERTIFICATE_MISMATCH", file=sys.stderr) + return 1 + print("PASS_SINGLE_TRIO_CENSUS nodes=%d eligible=%d max=%d/%d at_max=%d" % ( + result["enumeration"]["rgs_nodes_including_root"], + result["enumeration"]["words_in_allowed_profiles"], + result["enumeration"]["maximum_coverage"], 63, + result["enumeration"]["number_at_maximum"])) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/six-source-trio-path-seed87a169/verify.py b/research/six-source-trio-path-seed87a169/verify.py new file mode 100644 index 0000000000..2ece72afc1 --- /dev/null +++ b/research/six-source-trio-path-seed87a169/verify.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +"""Replay the complete census and check its witness, controls, and cost.""" +import json +from pathlib import Path + +import search + +HERE = Path(__file__).resolve().parent + + +def need(value, message): + if not value: + raise ValueError(message) + + +def main(): + cert = json.loads((HERE / "CERTIFICATE.json").read_text(encoding="utf-8")) + expected = search.enumerate_class() + need(cert == expected, "complete census differs from certificate") + enum = cert["enumeration"] + need(enum["complete_six_label_words"] == 9_321_312, "RGS domain count") + need(enum["words_in_allowed_profiles"] == 2_342_340, "profile domain count") + need(enum["maximum_coverage"] == 61 and enum["number_at_maximum"] == 88, + "coverage maximum or multiplicity") + need("62" not in enum["histogram_nonzero_pair_masks"] and + "63" not in enum["histogram_nonzero_pair_masks"], "unexpected near/full cover") + + witness = cert["maximum_witness"] + counts, trio, prefixes, cover = search.analyze_word(witness["singleton_word"]) + need(counts == witness["singleton_counts"], "witness singleton counts") + need(trio == witness["closing_trio_mask"], "closing TRIO parity") + need(prefixes == witness["prefixes"], "witness prefixes") + need((cover & ~1).bit_count() == 61, "witness coverage") + need(witness["missing_masks"] == [11, 40], "witness missing rows") + for mask in witness["missing_masks"]: + indices = witness["four_readout_indices_for_missing_masks"][str(mask)] + need(indices is not None and len(indices) == 4, "missing row has no four-readout realization") + realized = 0 + for index in indices: + realized ^= prefixes[index] + need(realized == mask, "four-readout realization is wrong") + + # The source-map multiset matches the incumbent; query costs are 144 vs 142. + total_maps = witness["total_source_map_counts"] + need(sorted(total_maps) == [2, 2, 2, 2, 4, 4], "source-map profile") + cost = cert["cost"] + need(cost["incumbent"]["root_calls"] == 16 + 126 == 142, "incumbent bill") + need(cost["best_one_trio_with_four_readout_repairs"]["root_calls"] == 14 + 130 == 144, + "completed TRIO bill") + need(cost["unit_call_delta"] == 2, "unit-price comparison") + + # Positive control: the incumbent singleton word covers all 63 nonzero masks. + word, baseline_prefixes = search.singleton_positive_control() + need(word == cert["positive_control"]["incumbent_singleton_word"], "positive word") + need(search.differences(baseline_prefixes) == (1 << 64) - 2, "positive coverage") + + # Negative controls: wrong profile and deleted edge cannot enter the census. + bad_profile = [0] * 13 + try: + search.analyze_word(bad_profile) + except ValueError: + pass + else: + raise ValueError("negative control accepted an invalid profile") + altered = witness["singleton_word"].copy() + altered[-1] = 6 + try: + search.analyze_word(altered) + except ValueError: + pass + else: + raise ValueError("negative control accepted an out-of-alphabet label") + + print("PASS_SINGLE_TRIO_CENSUS eligible=%d max=61/63 at_max=88 completed_queries=144 incumbent=142" % + enum["words_in_allowed_profiles"]) + print("CONTROLS positive=singleton_full_cover negative=profile,alphabet") + + +if __name__ == "__main__": + main()