From 040351abe1c0442acec4c985b074959420e42e51 Mon Sep 17 00:00:00 2001 From: conorholds Date: Wed, 14 Oct 2026 13:36:38 -0700 Subject: [PATCH] Research: prove fixed-z0 transfer optimum and two-root boundary --- .../scalable-dirty-connectors/CENSUS.json | 133 +++ .../scalable-dirty-connectors/EXPECTED.json | 1061 +++++++++++++++++ research/scalable-dirty-connectors/README.md | 472 ++++++++ .../scalable-dirty-connectors/SOURCES.json | 298 +++++ research/scalable-dirty-connectors/TASK.json | 315 +++++ .../scalable-dirty-connectors/VERIFY.json | 20 + .../scalable-dirty-connectors/backend.cpp | 902 ++++++++++++++ .../scalable-dirty-connectors/benchmark.py | 75 ++ .../scalable-dirty-connectors/connector.py | 154 +++ .../fixed_port_census.cpp | 389 ++++++ .../scalable-dirty-connectors/obstruction.py | 94 ++ research/scalable-dirty-connectors/verify.py | 306 +++++ 12 files changed, 4219 insertions(+) create mode 100644 research/scalable-dirty-connectors/CENSUS.json create mode 100644 research/scalable-dirty-connectors/EXPECTED.json create mode 100644 research/scalable-dirty-connectors/README.md create mode 100644 research/scalable-dirty-connectors/SOURCES.json create mode 100644 research/scalable-dirty-connectors/TASK.json create mode 100644 research/scalable-dirty-connectors/VERIFY.json create mode 100644 research/scalable-dirty-connectors/backend.cpp create mode 100644 research/scalable-dirty-connectors/benchmark.py create mode 100644 research/scalable-dirty-connectors/connector.py create mode 100644 research/scalable-dirty-connectors/fixed_port_census.cpp create mode 100644 research/scalable-dirty-connectors/obstruction.py create mode 100644 research/scalable-dirty-connectors/verify.py diff --git a/research/scalable-dirty-connectors/CENSUS.json b/research/scalable-dirty-connectors/CENSUS.json new file mode 100644 index 0000000000..71e70ab3b3 --- /dev/null +++ b/research/scalable-dirty-connectors/CENSUS.json @@ -0,0 +1,133 @@ +{ + "claim": "With all B and A child calls fixed at physical z0, six bidirectional root shears do not suffice for the universal five-source paired-readout connector; an explicit eight-shear fixed-port word covers all 31 nonzero masks.", + "model": { + "field": "F2", + "sources": 5, + "source_calls": 10, + "source_calls_per_label": 2, + "readout_labels": 31, + "readout_calls_per_label": 2, + "physical_B_port": "z0 for every call", + "physical_A_port": "z0 for every call", + "dirty_roots": 2, + "root_transfers": [ + "S01: z0 += z1", + "S10: z1 += z0" + ], + "readout_pair_condition": "The two A calls for one output must have the same current dirty-root covector; their source-coefficient difference is the XOR of projected source states at those boundaries." + }, + "six_transfer_census": { + "transfers": 6, + "identity_direction_words": 22, + "transfer_placements_per_direction_word": 8008, + "canonical_source_pairings_per_frame": 945, + "full_schedules": 166486320, + "legal_fixed_port_schedules": 34977960, + "maximum_covered_masks_including_zero": 31, + "universal_schedule_found": false, + "coverage_histogram": { + "8": 3872, + "9": 6800, + "10": 96944, + "11": 147136, + "12": 188768, + "13": 519200, + "14": 680400, + "15": 1081536, + "16": 2488152, + "17": 1994240, + "18": 1653088, + "19": 4298968, + "20": 2104216, + "21": 4848184, + "22": 2417920, + "23": 2271608, + "24": 4468720, + "25": 879248, + "26": 2250328, + "27": 297016, + "28": 1960400, + "29": 71600, + "30": 19280, + "31": 230336 + }, + "best_schedule": { + "directions": [0, 0, 0, 0, 0, 0], + "transfer_slots_zero_based_among_16_events": [0, 1, 2, 3, 4, 5], + "canonical_source_word": [0, 1, 2, 0, 3, 1, 4, 2, 3, 4], + "normalized_source_axes": [1, 1, 1, 1, 1], + "covered_mask_bitset_hex": "ffdfffff", + "missing_mask_decimal": 21 + } + }, + "eight_transfer_positive_control": { + "transfers": 8, + "directions": [1, 1, 0, 0, 1, 1, 0, 0], + "transfer_slots_zero_based_among_18_events": [0, 2, 3, 5, 8, 10, 11, 13], + "event_word": [ + "S10", "B0", "S10", "S01", "B1", "S01", "B2", "B3", + "S10", "B0", "S10", "S01", "B4", "S01", "B3", "B1", + "B4", "B2" + ], + "canonical_source_word": [0, 1, 2, 3, 0, 4, 3, 1, 4, 2], + "normalized_source_axes": [3, 1, 1, 1, 1], + "root_product_identity": true, + "every_source_restored": true, + "readout_pair_count": 31, + "readout_call_count": 62, + "boundary_convention": "Boundary 0 is before the first event; boundary k+1 is after event k.", + "readout_pairs": [ + {"mask": "00001", "boundaries": [0, 2], "row0": "01"}, + {"mask": "00010", "boundaries": [2, 6], "row0": "01"}, + {"mask": "00011", "boundaries": [0, 6], "row0": "01"}, + {"mask": "00100", "boundaries": [0, 17], "row0": "01"}, + {"mask": "00101", "boundaries": [2, 17], "row0": "01"}, + {"mask": "00110", "boundaries": [2, 7], "row0": "01"}, + {"mask": "00111", "boundaries": [0, 7], "row0": "01"}, + {"mask": "01000", "boundaries": [7, 8], "row0": "01"}, + {"mask": "01001", "boundaries": [7, 10], "row0": "01"}, + {"mask": "01010", "boundaries": [10, 17], "row0": "01"}, + {"mask": "01011", "boundaries": [8, 17], "row0": "01"}, + {"mask": "01100", "boundaries": [5, 12], "row0": "11"}, + {"mask": "01101", "boundaries": [6, 10], "row0": "01"}, + {"mask": "01110", "boundaries": [0, 10], "row0": "01"}, + {"mask": "01111", "boundaries": [0, 8], "row0": "01"}, + {"mask": "10000", "boundaries": [10, 14], "row0": "01"}, + {"mask": "10001", "boundaries": [7, 15], "row0": "01"}, + {"mask": "10010", "boundaries": [15, 17], "row0": "01"}, + {"mask": "10011", "boundaries": [7, 16], "row0": "01"}, + {"mask": "10100", "boundaries": [0, 16], "row0": "01"}, + {"mask": "10101", "boundaries": [2, 16], "row0": "01"}, + {"mask": "10110", "boundaries": [0, 15], "row0": "01"}, + {"mask": "10111", "boundaries": [2, 15], "row0": "01"}, + {"mask": "11000", "boundaries": [10, 15], "row0": "01"}, + {"mask": "11001", "boundaries": [7, 14], "row0": "01"}, + {"mask": "11010", "boundaries": [10, 16], "row0": "01"}, + {"mask": "11011", "boundaries": [8, 16], "row0": "01"}, + {"mask": "11100", "boundaries": [5, 13], "row0": "11"}, + {"mask": "11101", "boundaries": [6, 14], "row0": "01"}, + {"mask": "11110", "boundaries": [0, 14], "row0": "01"}, + {"mask": "11111", "boundaries": [2, 14], "row0": "01"} + ], + "engine_control": { + "frame_patterns": 1, + "legal_pairings": 105, + "universal_pairings": 1, + "method": "visit_frame -> pair_calls_by_axis -> evaluate_pair_word -> difference_cover; same engine as six-transfer enumeration", + "exhaustive_eight_transfer_domain": false + }, + "budget": { + "source_calls": 10, + "readout_calls": 62, + "total_child_calls": 72, + "paid_full_row_xors": 8, + "saving_vs_PR1887_pinned_schedule": 2, + "relative_transfer_count_reduction": "20%" + } + }, + "validation": { + "six_transfer_histogram_source": "Completed exact local census with 22 identity direction words, 8,008 transfer placements, and 945 canonical pairings per frame.", + "eight_transfer_source": "Literal witness replay plus the bounded actual census-engine path on its frame; every source/root restores,all31 equal-covector output pairs validate, and the core engine detects1 universal among105 legal pairings.", + "limits": "The eight-transfer search is a positive control, not an exhaustive eight-transfer census. No upstream submission or remote post is included." + } +} diff --git a/research/scalable-dirty-connectors/EXPECTED.json b/research/scalable-dirty-connectors/EXPECTED.json new file mode 100644 index 0000000000..3cd1c7637b --- /dev/null +++ b/research/scalable-dirty-connectors/EXPECTED.json @@ -0,0 +1,1061 @@ +{ + "star": [ + { + "sources": 4, + "roots": 1, + "source_calls": 8, + "readouts": 30, + "transfers": 0, + "instructions": 38, + "source_multiplicities": [ + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 15 + }, + "program_sha256": "bdc40946303e36148d688f4e4134d2b77964526ebb2e2dc4008ecd41be19801e" + }, + { + "sources": 5, + "roots": 2, + "source_calls": 10, + "readouts": 62, + "transfers": 8, + "instructions": 80, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ] + ], + "readout_multiplicity_histogram": { + "2": 31 + }, + "program_sha256": "04e36888712f9cb1b80d34196ed8153a30c92795fb01caedcaf4639e6af4010b" + }, + { + "sources": 6, + "roots": 3, + "source_calls": 12, + "readouts": 126, + "transfers": 24, + "instructions": 162, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ], + [ + 2 + ] + ], + "readout_multiplicity_histogram": { + "2": 63 + }, + "program_sha256": "836d70bdb7fa966a02fe44c4dfa13d1199dbd06acf1345d73296fb399c46c994" + }, + { + "sources": 7, + "roots": 4, + "source_calls": 14, + "readouts": 254, + "transfers": 56, + "instructions": 324, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ], + "readout_multiplicity_histogram": { + "2": 127 + }, + "program_sha256": "6af8b1c177c63f6f3148b814281bdbbfadc097cd9cef85e88d630434df1c3fa8" + }, + { + "sources": 8, + "roots": 5, + "source_calls": 16, + "readouts": 510, + "transfers": 120, + "instructions": 646, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ] + ], + "readout_multiplicity_histogram": { + "2": 255 + }, + "program_sha256": "d5383d4b9ae0290b47359fae81112ed01ccac41e38d40ba131bf30d519dd9109" + }, + { + "sources": 9, + "roots": 6, + "source_calls": 18, + "readouts": 1022, + "transfers": 248, + "instructions": 1288, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ], + [ + 5 + ] + ], + "readout_multiplicity_histogram": { + "2": 511 + }, + "program_sha256": "cb903e6412c31409a18a5efc1f7770df8d734817d323f3fc0db22ce9942c2016" + }, + { + "sources": 10, + "roots": 7, + "source_calls": 20, + "readouts": 2046, + "transfers": 504, + "instructions": 2570, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ], + [ + 5 + ], + [ + 6 + ] + ], + "readout_multiplicity_histogram": { + "2": 1023 + }, + "program_sha256": "3b085e2866e4fcd9b93761ccefa265ad4cac76ed73ee7448cb4442b30f80d90d" + } + ], + "gray": [ + { + "sources": 4, + "roots": 1, + "source_calls": 8, + "readouts": 30, + "transfers": 0, + "instructions": 38, + "source_multiplicities": [ + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 15 + }, + "program_sha256": "bdc40946303e36148d688f4e4134d2b77964526ebb2e2dc4008ecd41be19801e" + }, + { + "sources": 5, + "roots": 1, + "source_calls": 12, + "readouts": 62, + "transfers": 0, + "instructions": 74, + "source_multiplicities": [ + 2, + 2, + 4, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 31 + }, + "program_sha256": "1cf5ded5f8325c9e9448e429d8eb7d9e5a437980ede664bb5d54f93a70401539" + }, + { + "sources": 6, + "roots": 1, + "source_calls": 16, + "readouts": 126, + "transfers": 0, + "instructions": 142, + "source_multiplicities": [ + 4, + 2, + 2, + 4, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 63 + }, + "program_sha256": "7d843bada128f273f17a4519d648e5149d0158e2f44b1b193da416ad5594f5fe" + }, + { + "sources": 7, + "roots": 1, + "source_calls": 24, + "readouts": 254, + "transfers": 0, + "instructions": 278, + "source_multiplicities": [ + 4, + 2, + 2, + 8, + 4, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 127 + }, + "program_sha256": "eabaa6bd0c2e9148a5164102d869a4b7b47866468e94654e3ef84008f2251d56" + }, + { + "sources": 8, + "roots": 1, + "source_calls": 32, + "readouts": 510, + "transfers": 0, + "instructions": 542, + "source_multiplicities": [ + 8, + 4, + 2, + 2, + 8, + 4, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 255 + }, + "program_sha256": "8b8a2b6bdda3bf491cf4f633be9114a381dcd9181ad775fe1655ee7aedabfe82" + }, + { + "sources": 9, + "roots": 1, + "source_calls": 48, + "readouts": 1022, + "transfers": 0, + "instructions": 1070, + "source_multiplicities": [ + 8, + 4, + 2, + 2, + 16, + 8, + 4, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 511 + }, + "program_sha256": "330bc30a2ae9c743107cd0e91da467fa9cf7dbac926f7a4ffab8b7ced9bb7690" + }, + { + "sources": 10, + "roots": 1, + "source_calls": 64, + "readouts": 2046, + "transfers": 0, + "instructions": 2110, + "source_multiplicities": [ + 16, + 8, + 4, + 2, + 2, + 16, + 8, + 4, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 1023 + }, + "program_sha256": "378d2de3b63ca2aebcf33684eb84267f94a67b32e9f6d3361de524c5dacb2114" + } + ], + "extra_readout": [ + { + "sources": 4, + "roots": 1, + "source_calls": 8, + "readouts": 30, + "transfers": 0, + "instructions": 38, + "source_multiplicities": [ + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 15 + }, + "program_sha256": "5def7159a98d16ab5ef566aa2694f8ca6153e3dec7cf66162ba17ac6e8a1d544" + }, + { + "sources": 5, + "roots": 1, + "source_calls": 10, + "readouts": 64, + "transfers": 0, + "instructions": 74, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 30, + "4": 1 + }, + "program_sha256": "be5179e54bb37eaf8d7c7ad1d7009dffadb42f0527234b49803849fe604f329c" + }, + { + "sources": 6, + "roots": 1, + "source_calls": 12, + "readouts": 156, + "transfers": 0, + "instructions": 168, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 48, + "4": 15 + }, + "program_sha256": "13c90f7b99b4533f615bd22cf0ad335a7e3000d50ff1c51cf20bd67e69f424e5" + }, + { + "sources": 7, + "roots": 1, + "source_calls": 14, + "readouts": 368, + "transfers": 0, + "instructions": 382, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 70, + "4": 57 + }, + "program_sha256": "d0f3e76f23fb9c3fc5043939a2fb10c66394acfcb3992f8518a4fda00cb51da4" + }, + { + "sources": 8, + "roots": 1, + "source_calls": 16, + "readouts": 828, + "transfers": 0, + "instructions": 844, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 96, + "4": 159 + }, + "program_sha256": "fdacd332f19fdda91d2d5a468b150d4ad02d89a67e8763596c2f7e62c20269a3" + }, + { + "sources": 9, + "roots": 1, + "source_calls": 18, + "readouts": 1794, + "transfers": 0, + "instructions": 1812, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 126, + "4": 384, + "6": 1 + }, + "program_sha256": "2f299d0257d73d55aba8e8d25b456bbdf4945e644aab9854a6a144434b65e67c" + }, + { + "sources": 10, + "roots": 1, + "source_calls": 20, + "readouts": 3814, + "transfers": 0, + "instructions": 3834, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 160, + "4": 842, + "6": 21 + }, + "program_sha256": "6b7aaf2f56b7d2717408b329a63f4384fc009eaf9a52166759dca5a0f17f6ea0" + } + ], + "fixed_port_five": { + "sources": 5, + "roots": 2, + "source_calls": 10, + "readouts": 62, + "transfers": 8, + "instructions": 80, + "source_multiplicities": [ + 2, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ] + ], + "readout_multiplicity_histogram": { + "2": 31 + }, + "program_sha256": "b745e588ec6c46d59a469674c202bc1d9b7c0dc7296c04fd0457aedf625be351" + }, + "odd_source_positive_control": { + "sources": 5, + "roots": 2, + "source_calls": 13, + "readouts": 62, + "transfers": 14, + "instructions": 89, + "source_multiplicities": [ + 5, + 2, + 2, + 2, + 2 + ], + "source_ports": [ + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ] + ], + "readout_multiplicity_histogram": { + "2": 31 + }, + "program_sha256": "a34eb4480693be8bd9b5efcaf28f1548462daf1368c1bce259104f309367e5b8" + }, + "dense_cases": 460, + "rejected_mutations": 704, + "extra_readout_rejected_mutations": 336, + "readout_bound_controls": { + "n_min": 4, + "n_max": 64, + "exact_cases": 61 + }, + "closed_word_census": { + "5": { + "words": 945, + "max_coverage": 31, + "maximizers": 22, + "histogram": { + "16": 42, + "19": 120, + "21": 180, + "22": 56, + "23": 45, + "24": 220, + "26": 110, + "28": 150, + "31": 22 + } + }, + "6": { + "words": 10395, + "max_coverage": 49, + "maximizers": 186, + "histogram": { + "22": 132, + "26": 495, + "29": 880, + "31": 660, + "32": 79, + "33": 1452, + "35": 528, + "36": 840, + "37": 22, + "38": 1962, + "40": 414, + "41": 264, + "42": 807, + "44": 1146, + "47": 528, + "49": 186 + } + } + } +} diff --git a/research/scalable-dirty-connectors/README.md b/research/scalable-dirty-connectors/README.md new file mode 100644 index 0000000000..317b3d6cf6 --- /dev/null +++ b/research/scalable-dirty-connectors/README.md @@ -0,0 +1,472 @@ +# Sharp dirty-connector boundaries and a scalable attaining family + +This package establishes two optimality results for the universal arbitrary-dirty +F2 connector with **two calls to each source map and two calls to each output map**: + +- **Fixed-z0 five-source optimum:** eight paid bidirectional root transfers are + necessary and sufficient when every source and output call uses physical z0. + The attaining word improves PR1887's ten-transfer construction by 20% in + transfer count, changing the source word as well as its readout boundary pairs. +- **Two-root scalability boundary:** two roots cannot realize every nonzero + source mask for `n >= 6`, even with arbitrary invertible root-frame changes + and any physical port on each call. Three roots are optimal at six sources. + +An attaining family for every `n >= 4` uses `n-3` arbitrary dirty root rows and +pays `8(2^(n-4)-1)` full-row XORs. Each source keeps one physical port; every +output reads root zero. The source and output lower bounds are attained +**simultaneously**, with root rows and transfers explicitly added to the bill. +Root-count optimality for n>=7 remains open. + +A one-root construction already attains the minimum `2n` B calls by paying extra +output readouts. The [concrete backend comparison](#concrete-backend-and-scalable-cost-regime) +therefore measures a fully disclosed readout/shear/row tradeoff, not a new +source-call minimum or a general performance advantage. + +There is **no new integer-multiplication exponent or selected-supplier claim**. +The construction changes the interface by admitting more dirty roots and +paid star transfers. Its profitability depends on complete child, port, +transfer, hosting and preparation costs. + +## Exact interface and invoice + +The source rows `x_j`, target rows `y_m`, and roots `z_i` are distinct and +arbitrarily dirty arrays over `F2`. For every nonzero `n`-bit mask `m`, perform + +```text +y_m += A_m( XOR_{j: m_j=1} B_j(x_j) ). +``` + +Sources, coefficient tables and all roots must be unchanged afterward. +The maps are arbitrary compatible linear maps, including rectangular, +singular, nonsymmetric and noncommuting maps. The schedule depends on the +target masks, not data values. The only data operations are complete additive +calls `B_j: z_p += B_j(x_j)`, `A_m: y_m += A_m(z_p)`, and paid root shears +`z_p += z_q`. A complete child restores private scratch and any agreed frames +and head positions. Its private scratch excludes every data/root row. Targets +remain unobserved until the batch completes. No clean full row is supplied. + +The scalable family needs only shears `z_0 += z_i`, for `i > 0`. The separate +fixed-port five-source result below uses both shear directions. + +| Sources | Star roots | B, star / extra | B, Gray | A, star / Gray | A, extra | Star XORs | +|---:|---:|---:|---:|---:|---:|---:| +| 4 | 1 | 8 | 8 | 30 | 30 | 0 | +| 5 | 2 | 10 | 12 | 62 | 64 | 8 | +| 6 | 3 | 12 | 16 | 126 | 156 | 24 | +| 7 | 4 | 14 | 24 | 254 | 368 | 56 | +| 8 | 5 | 16 | 32 | 510 | 828 | 120 | +| 9 | 6 | 18 | 48 | 1,022 | 1,794 | 248 | +| 10 | 7 | 20 | 64 | 2,046 | 3,814 | 504 | + +Both one-root comparators use one dirty root and zero transfers. The extra- +readout family fixes a restored `2n`-call interleave source word and chooses a +minimum-cardinality **even** subset of source-prefix boundaries for each +output. A subset DP emits the calls; an independent pair-difference BFS checks +every output's minimum on that fixed word. PR943's five-source extra-readout +repair and PR1185's six-source `12+126+30=168` query floor already establish +this tradeoff. The later review supplies attaining interleave words at n=6..8; +we verify their invoices, not a new global word-optimality census. + +The n=4 core and n=5 one-way savings are prior work. The one-root six-source +value 16 is optimal **when every output is restricted to two readouts**; +it is not a lower bound when more A calls are allowed. Beyond n=6 the Gray +count is an achieving upper bound. All schedules have exponential instruction +counts because there are `2^n-1` distinct outputs. + +For complete prices, let `g_j` be the actual B multiplicity in the one-root +Gray word, and `r_m` the extra-readout multiplicity; `p_j=0` for `j<4`, otherwise `p_j=j-3`. Let `H` pay initial +admission/layout, root reservation, reusable coefficient preparation, schedule +generation, instruction storage/reads/dispatch, and all costs omitted from the +complete child and shear prices. Then + +```text +C_star = H_star + 2 sum_j c_Bj(p_j) + 2 sum_m c_Am(0) + + 8 sum_{i=1}^{n-4} 2^(n-4-i) c_X(0,i). +C_gray = H_gray + sum_j g_j c_Bj(0) + 2 sum_m c_Am(0). +C_extra = H_extra + 2 sum_j c_Bj(0) + sum_m r_m c_Am(0). +``` + +The adoption test against these comparators is `C_star < min(C_gray,C_extra)`. Port independence and equal B +prices are properties of the tested resident-memory backend, not hypotheses +to silently impose on a different caller. Against Gray, with equal B prices and equal shear prices it becomes +`(G(n)-2n)c_B > T(n)c_X + H_star-H_gray`, where +`G(n)=2^floor(n/2)+2^ceil(n/2)` and `T(n)=8(2^(n-4)-1)`. +Against the stronger minimum-B baseline with no port premium, adoption needs +`sum_m (r_m-2)c_Am > T(n)c_X + H_star-H_extra`; there is no B-call saving. +At n=6 this trades 30 A calls for 24 shears and two extra roots; at n=8, 318 A +calls for 120 shears and four extra roots. Other schedules may offer a better +weighted bill, so beating these two comparators is not a global cost optimum. +Recursive depth-five B calls use 28 dense leaves and three private dirty rows; +the star needs `n-3+3=n` borrowed rows versus four for either one-root baseline. +All input/output rows remain reserved too. + +## Construction and all-n proof + +Put `s=n-4`. Reserve center `z_0` and leaves `z_1,...,z_s`. Write +`h_j=B_j(x_j)` and initial dirty roots `d_i`. A frame indexed by +`u in F2^s` has center dirty covector + +```text +d_0 + sum_i u_i d_(i+1). +``` + +One Gray edge toggles one `u_i` by a paid `z_0 += z_(i+1)`. Other physical +roots are unchanged. Center injections have normalized axis `e_0` at every +frame. + +First run the closed two-source cycle `B0 B1 B0 B1`, whose prefix states are +`0,1,3,2,0`. At each of its four distinct prefix states, tour every `u` using +a reflected Gray path; alternate forward/reverse paths so consecutive tours +share endpoints. Four tours finish at `u=0`. Next inject each `B_j`, `j>=4`, +**once** into leaf `z_(j-3)` at that zero frame. Each leaf now contains +`d_(j-3)+h_j`. + +Run the second cycle `B2 B3 B2 B3` with the same four alternating frame tours. +It also finishes at `u=0`. Finally call each extra B again at its same leaf +port. Thus all bulk source responses and extra leaf responses cancel, and +all arbitrary dirty roots are restored. + +Write a requested mask uniquely as `m=a | (b<<2) | (c<<4)`, with `a,b` two-bit +masks and `c` an s-bit mask. Read `A_m` at first-phase bulk prefix `a`, frame +`u=c`, and at second-phase prefix `b`, the **same** frame. The two center rows +are respectively + +```text +d_0 + sum_i c_i d_(i+1) + sum_{j<2} a_j h_j, +d_0 + sum_i c_i d_(i+1) + sum_{2<=j<4} b_(j-2) h_j + + sum_{j>=4} c_(j-4) h_j. +``` + +Their XOR is exactly the desired source sum, and linearity of `A_m` cancels +all dirt. The variable `b` in the second expression is the two-bit mask; +`h_j` denotes the map response. Each requested mask is read once in each +phase. Skip mask zero. `connector.py` emits every readout as a paid operation. + +There are eight tours of `2^s-1` edges and no setup/teardown bridges, giving +exactly `T(n)`. Each source occurs twice; each of `2^n-1` outputs twice. +The proof uses no invertibility or commutativity of the maps. + +These map-call counts are optimal in this alphabet, independently of root +count. A generic active source needs a B call to affect its outputs. One B +call injects a nonzero root coefficient vector; later invertible root shears +cannot erase it, and A calls leave roots alone, so at least two are necessary. +One A call sees a nonzero dirty covector because the root frame is invertible; +it cannot cancel arbitrary dirt, so every active output also needs at least +two. **Even B multiplicity is not generally necessary with several roots**: +three distinct injection axes can sum to zero. The verifier includes a +restoring three-call excursion as a positive control for this distinction. +Adam Gall's [PR1915](https://github.com/CrocSwap/integer-mult-bounds/pull/1915) +already uses phase normalization and an order-three odd-parity control for +paid invertible frames on one connector. The new obstruction below extends +the normalized-axis argument to the two-root, n>=6 paired-call model. + +## Why two roots stop at five sources + +This obstruction assumes exactly two B calls per source, exactly two A calls +per output, arbitrary invertible root frame changes and restoration. It allows +any physical port on each occurrence and places no bound on frame-change cost. + +Normalize a source injection by the current root frame `R`: its nonzero axis +is `R^-1 e_p`. Restoration forces its two normalized axes to agree, say `v_j`. +For chronological source prefix parity `q_t`, a physical root with dirty +covector `r` has source coefficient `(r dot v_j)q_t[j]`. A paired output must +use equal dirty covectors, hence realizes + +```text +(r dot v_0,...,r dot v_(n-1)) AND (q_a XOR q_b). +``` + +The all-ones mask requires a covector responding to every occupied source +axis. In `F2^2`, any nonzero covector responds to only two of the three nonzero +axes. Thus a universal two-root schedule has at most two source-axis classes. +Let `D(w)` contain all differences of source prefixes, even at boundaries where +the favorable covector is not actually available. This gives an upper bound. + +The complete closed-word censuses give `max |D|=31` for five sources and 49 +for six. `obstruction.py` compares two independent word generators and two +difference engines **for every word**: 945 and 10,395 classes. These maxima +are already known from PR943/PR1185; the new step is applying them to arbitrary +two-root frame itineraries. + +At six sources, a one-axis schedule covers at most 49/64 masks. With two +classes of sizes `a,b`, one covector sees both classes and the other two see +one each. Their union covers at most +`|D| + (2^a+2^b-1) - 7`, since zero and all six unit masks lie in both sets. +The `2+4` and `3+3` splits therefore cover at most 61 and 57 masks. For `1+5`, +all 31 masks with the singleton and a nonzero five-bit bulk mask are mixed: +only the common covector can see them. Deleting singleton calls projects `D` +to a closed ten-call five-source word, whose maximum 31 includes zero, leaving +at most 30 nonzero bulk masks. Contradiction. + +For larger n, specialize other B maps to zero, discard their calls and unused +output targets, and obtain a forbidden six-source schedule. Hence **two roots +cannot attain the minimum map-call counts for n>=6**, however many frame +changes are allowed. The earlier six-transfer five-source witness establishes +the sharp attainability boundary at five. For six, the new star uses three +roots and therefore minimizes root count as well: a one-root schedule embeds +in the forbidden two-root model by leaving a second dirty root untouched. +Root-count optimality for +larger n is not established. + +## Concrete backend and scalable cost regime + +`backend.cpp` implements complete B calls as balanced dirty echoes of five +dense `L x L` binary factors. Every B uses 28 leaf calls and restores three +arbitrary dirty private rows. Every A row reads two supported input positions. +Matrices, sparse support tables, source rows and dirty buffers are identical +for both schedules. The checker compares each child and every final output +against direct composition, in addition to separate physical-row symbolic +replay. A clean CPU accumulator occupies one 64-bit word; no clean full row +is introduced into the connector. + +The primary comparator uses the **same** minimum B count. Both execute 336 +and 448 dense leaves respectively; their A/X/row bills differ. + +| Fixture | Star / extra A calls | Star / extra resident median | Time reduction | +|---|---:|---:|---:| +| n=6, L=256 | 126 / 156 | 159.5 / 167.0 microseconds | 4.5% | +| n=8, L=512 | 510 / 828 | 693.5 / 825.5 microseconds | 16.0% | + +These are Apple M3 Max measurements with five-factor B echoes, two-support A +maps, the disclosed seeds and Xcode Clang. Different B/A prices and factor +depths change the gain; the review's shallower-B fixtures produced smaller +savings against Gray. The optional Gray comparison retains the higher B-call +counts in the first table and is reported separately in TASK.json. +Seven trials alternate schedule order and print every raw per-stream time. +The timed interval includes root/echo dispatch, dense and sparse calls, and +all transfers. It excludes fixture/program preparation, input snapshots/resets, +the scalar checksum scan and research validation. Preparation, row layout and +validation are measured separately. These are resident execution comparisons, +not cold one-shot or tape results. The executable reports complete row/program +payloads, map accesses, container capacities and scratch; its comparison +harness holds two schedules and diagnostic snapshots, not production storage. + +### Corrected asymptotic comparison + +With `L=2^n`, complete `c_B=Theta(L^2)`, `c_A=c_X=Theta(L)`, and fully admitted +bit-RAM preparation/layout, **both** the star and the one-root extra-readout +family cost `Theta(L^2 log L)`. The former `Theta(sqrt(L)/log L)` advantage +was only against the weaker Gray comparator and is withdrawn as a headline. +There is no superconstant bit-RAM advantage over this stronger baseline. + +An elementary counting bound gives the correct scope. A one-root restored +`2n`-B-call word has at most `2n` distinct source prefixes. Repeated identical +A observations cancel, so an output with at most k reads is an XOR of at most +k distinct prefixes. At most `V=sum_{i=0}^k binom(2n,i)` masks have such a +representation, even before imposing the necessary even-readout constraint. +Take `k=floor(n/8)`. Using the binomial theorem with `x=1/16`, + +```text +V <= 16^k (17/16)^(2n) < 2^(3n/4) <= 2^(n-1), n>=4, +``` + +where `17^8 < 2*16^8` is an exact integer inequality. Thus at least half of +all masks need more than k reads, giving total `R > n*2^n/16`. +Conversely each unit source mask is a difference of adjacent prefixes, so +adding those pairs realizes mask m in at most `2*popcount(m)` calls and gives +`R <= n*2^n`. Hence **every one-root minimum-B word needs +Theta(n*2^n) total readouts** in the unframed B/A-only alphabet. These are +bounds on a common source word for the +entire all-mask batch, not on separate words chosen for individual outputs. +The subset DP and BFS verify finite invoices; the counting proof establishes +the general bound. Exact volume controls run at n=4..64. + +In the explicitly priced packed word-RAM with unit-cost popcount and +`w=Theta(log L)`, B costs `Theta(L^2/w)` and the sparse A kernel costs +`Theta(L)`. Including dense-word table writes, sparse-index preparation and +layout, the star costs `Theta(L^2)` and a one-root **2n-B-call** family costs +`Theta(L^2 log L)`: a `Theta(log L)` ratio in that restricted comparison. +Against the best one-root schedule when more B calls are allowed, this +achieving comparator implies only an **O(log L) upper bound** on the gain; +a matching lower bound in that larger family is not established here. +This does not bound one-root schedules that spend more B calls to reduce A +work, nor other kernels, preprocessing schemes, tape costs or integer +multiplication. The fixed-64-bit executable tests only n=6/8 and does not +measure an unbounded asymptotic family. No general advantage over every +one-root algorithm is claimed. + +## Fixed-z0 five-source endpoint + +The literal word below uses **every B and A at physical z0**, rather than just +one stable port per source: + +```text +S10 B0 S10 S01 B1 S01 B2 B3 S10 B0 S10 S01 B4 S01 B3 B1 B4 B2 +``` + +Here `S01` is `z0 += z1` and `S10` is `z1 += z0`. All roots and sources +restore. `fixed_port_five()` inserts all 62 paid readouts at literal boundary +pairs; polynomial/dense replay verifies them. It improves PR1887's pinned +ten-transfer schedule to eight (20% fewer transfers), with identical child +ports and the same 72 child calls. Its leaf count is shared prior work. This settles the broader fixed-port +improvement sought by PR1887's alternative-boundary-pair question. The witness +changes both the source word and readout table; it does not prove that +PR1887's original source word attains eight transfers. + +Eight is optimal in this fixed-port, paired-call model. The complete six-X +census has 22 identity direction words, 8,008 placements and 945 pairings per +frame: 166,486,320 skeletons, 34,977,960 legal schedules, maximum 31/32 masks. +Each shear permutes the three nonzero two-bit vectors by a transposition, so +odd-length words cannot restore. Pad a shorter even word with adjacent equal +shears at a boundary; restoration and all old readouts survive. Thus the +six-X exclusion covers every smaller count. The eight-X command replays the literal word and passes its frame through the +same census pairing/coverage engine: 105 legal pairings, one universal. It is +bounded to that frame, **not** an exhaustive eight-X search. The later review +independently reports an exhaustive eight-X physical census with 464,969,376 +legal schedules and 828 universal; that run is separate local evidence. + +`fixed_port_census.cpp` generates pairings of equal normalized axes; its domain +reduction is the restoration argument above. Its histogram agrees with the +earlier full-pairing search and a separate local physical-row review adapter +that enumerates all directions and filters restoration directly. The adapter +is extra local evidence, not a shipped third engine. `CENSUS.json` records the +complete six-X histogram and the positive fixture. + +## Reproduce and verification limits + +Standard-library Python 3.12; checks stay active under optimization: + +```sh +python3 -I -O -B research/scalable-dirty-connectors/verify.py +``` + +Expected: `PASS_SCALABLE_DIRTY_CONNECTORS n=4..10 dense=460 rejected=704 extra_rejected=336 fixed_port=8`. +This checks the literal programs and invoices through n=10, 460 rectangular/singular-map forward/inverse cases, all original 704 +omission/port/direction/label/schema controls, 336 additional extra-readout +omission/label controls, neutral-extra-pair and odd-source positive controls, +both closed-word censuses, and the independent subset-DP/BFS comparison. +The star/fixed-port paired checks remain strict; only the explicitly selected +extra-readout baseline admits larger even A multiplicities. +The all-n theorem is the proof above; finite replay is corroboration. +`EXPECTED.json` is generated by this checker and guards regressions rather +than furnishing independent mathematical evidence. It deliberately binds +exact serialization. `--write-expected` regenerates it after all actual checks. +The native fixed-port exclusion is separate from this bounded Python hook. + +From the upstream repository root, compile **one native command at a time**. +On Linux a configured C++20 `c++` works; this Mac's default linker rejects the +selected SDK, so use the tested Xcode compiler and SDK explicitly: + +```sh +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ \ + -target arm64-apple-macosx26.5 \ + -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \ + -O3 -std=c++20 -Wall -Wextra -Wpedantic \ + research/scalable-dirty-connectors/fixed_port_census.cpp -o /tmp/fixed-port-census +/tmp/fixed-port-census 6 +/tmp/fixed-port-census 8 +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ \ + -target arm64-apple-macosx26.5 \ + -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \ + -O3 -std=c++20 -Wall -Wextra -Wpedantic \ + research/scalable-dirty-connectors/backend.cpp -o /tmp/dirty-connector-backend +python3 -I -B research/scalable-dirty-connectors/benchmark.py \ + 6 256 /tmp/dirty-connector-backend --seed 4106 +python3 -I -B research/scalable-dirty-connectors/benchmark.py \ + 8 512 /tmp/dirty-connector-backend --seed 4108 +# Optional weaker paired-output comparator: +python3 -I -B research/scalable-dirty-connectors/benchmark.py \ + 6 256 /tmp/dirty-connector-backend --seed 4106 --baseline gray +``` + +In this math repository, prefix `research/` with `integer-mult-bounds/`. +macOS SDK/toolchain details and actual verification records are in TASK.json. +The opt-in upstream hook uses `scripts/research_package.py --package +research/scalable-dirty-connectors`. No dependencies or external replay inputs +are needed; source pins are historical provenance. No Lean proof, independent +human review, hosted CI, selected-supplier cold replay, caller admission or +head-return tape integration is claimed. + +## Open next questions + +The structured questions in TASK.json cover three useful next steps: +find a real recursive caller with these maps and stable ports and price its +full adoption inequality; reduce roots for n>=7 without losing the minimum +map-call count; and realize the paid frame/child program on a concrete tape +layout. The first is blocked by the absent caller contract, the second by the +lack of an attaining lower-root word, and the third by absent caller/head +layout. Each should start with a bounded positive fixture and full invoice. + +## Credit, sources and scope + +Ross Richardson's [PR934](https://github.com/CrocSwap/integer-mult-bounds/pull/934) +and [PR943](https://github.com/CrocSwap/integer-mult-bounds/pull/943) supply the +dirty query contract, complementary-subspace core, five-source obstruction, +extra-readout repair and balanced recursive echoes. Their retained NOTICE +credits the PR889 common-factor fanout and Chafik Boukhalfa's PR628 dirty +commutator lineage. Douglas Colkitt's +[PR1185](https://github.com/CrocSwap/integer-mult-bounds/pull/1185) supplies +the six-source one-root census, general Gray bound and extra-readout budget. +The later agent review supplied the attaining interleave extension and +identified the omitted stronger benchmark comparator; it is credited here +rather than treated as a new source-call discovery. + +Paid one-way two-root predecessors include woklerx's +[PR1438](https://github.com/CrocSwap/integer-mult-bounds/pull/1438), Gareth +Davidson's [PR1498](https://github.com/CrocSwap/integer-mult-bounds/pull/1498), +and Sagar Thakrar's [PR1767](https://github.com/CrocSwap/integer-mult-bounds/pull/1767). +Cinna Davis originated the eight-transfer word in +[Discussion1412](https://github.com/CrocSwap/integer-mult-bounds/discussions/1412). +Hanson Sun's [PR1615](https://github.com/CrocSwap/integer-mult-bounds/pull/1615) +proved the sharp one-way eight-transfer threshold before @nedveder's +[PR1812](https://github.com/CrocSwap/integer-mult-bounds/pull/1812), which also +verifies that threshold and asks the bidirectional question. Those +port/direction contracts differ from the fixed-z0 bidirectional optimum here. +Cinna Davis's [PR1887](https://github.com/CrocSwap/integer-mult-bounds/pull/1887) +already uses both directions at fixed z0 ports and publishes the shared +180-versus-182 leaf comparison. Our eight-X result supplies a lower-count fixed-port word in response to its +alternative-boundary-pair question, changing the source word as well. Cinna Davis's +[PR1675](https://github.com/CrocSwap/integer-mult-bounds/pull/1675) treats a +different signed target. Adam Gall's +[PR1915](https://github.com/CrocSwap/integer-mult-bounds/pull/1915) supplies +the one-connector phase-normalization and odd-parity framed control; these +techniques are inherited, while the two-root n>=6 obstruction is new. + +Our six-transfer predecessor is the reachable math main commit `e3a5f7b` +(PR #1); its reviewed corrections and this scalable package are in `df3b327` +(PR #2). The former unsquashed `0921877` reference has been replaced. + +Adam Gall's concurrent [PR2065](https://github.com/CrocSwap/integer-mult-bounds/pull/2065), +at `2721b1e31d718a6e70266a99521f629ce2e1d259`, independently publishes the same +six-transfer five-source endpoint as our earlier math package. It opened after +our previous overlap snapshot. That endpoint is overlapping prior/concurrent +evidence, not a new claim of this submission; our earlier package is linked +through its public math commit rather than submitted again. PR2065 does not +claim the all-n star, the n>=6 two-root obstruction, or the fixed-z0 optimum. +Adam Gall's [PR2063](https://github.com/CrocSwap/integer-mult-bounds/pull/2063) +prices all positive map tariffs for five sources and one root; Aaron Wang's +[PR2056](https://github.com/CrocSwap/integer-mult-bounds/pull/2056) adds combined +pair-source calls. Aaron Wang's subsequent +[PR2128](https://github.com/CrocSwap/integer-mult-bounds/pull/2128), at +`697369a971eed02c0fbcd75ebefec9f59945f08e`, extends that pair-source alphabet to +six sources with a fourteen-call source word. Pair-source calls are excluded +here, so its six-source construction has a different contract from our +ordinary-call two-root obstruction. These are different alphabets/domains +from the results here. +Cinna Davis's [PR2134](https://github.com/CrocSwap/integer-mult-bounds/pull/2134) +is a six-source one-TRIO census with sixteen source-map applications; its +combined call and nonminimal source multiplicities are likewise excluded here. + +New claims are the all-n star compiler/fully priced tradeoff, the unrestricted +frame two-root minimal-call boundary, and the eight-transfer fixed-z0 optimum. +Submission preparation refreshed canonical main to +`0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2`, priority revision 4, and read its +updated guidance. We retain this completed, explicitly changed-scope interface +result as a partial contribution; it does not resolve revision 4's central +supplier handoffs. Fresh overlap covers 392 open PRs, 804 discussion/comment +records and 1,931 all-state PR bodies. No exact overlap for these three claims +was found; this is a timestamped audit, not proof of novelty. SOURCES.json and +TASK.json pin the discovery base, concurrent heads, audit coverage and +local-session separation. Historical source pins remain unchanged; the catalogue, +AGENTS.md and autoresearch.md have since changed, while the pinned scientific +predecessors still match. Nearby local two-root extra-B/weighted searches were +deliberately avoided. + +Prepared by Conor Holdsworth with substantial OpenAI Codex assistance in +discovery, proofs, code, checking and writing, including three OpenAI +`gpt-6-luna` agents (tool name "Luna", xhigh reasoning) on separate interface, +obstruction and backend questions. Anthropic Claude supplied AI-assisted +independent review, the stronger extra-readout comparator, performance and +attribution corrections, and review memory notes; its exact model was not +recorded. Agent audits are AI-assisted checks, not independent human peer +review. New work is Apache-2.0 under the retained repository LICENSE. diff --git a/research/scalable-dirty-connectors/SOURCES.json b/research/scalable-dirty-connectors/SOURCES.json new file mode 100644 index 0000000000..a41d46df05 --- /dev/null +++ b/research/scalable-dirty-connectors/SOURCES.json @@ -0,0 +1,298 @@ +{ + "schema_version": 1, + "base_commit": "fe19567d22524eef6d3858c537aeed537ad5a7e6", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "AGENTS.md", + "usage": "provenance", + "git_blob": "860762e04e963e1b163b8fa5267854c0040a9e67", + "sha256": "5f29c7cbf0eb28f4e87f0affa9cffdaef4e39a630a5878c8fed02b544c894d2e" + }, + { + "path": "autoresearch.md", + "usage": "provenance", + "git_blob": "84c108dd0d650944066ee34796e733f2329acf28", + "sha256": "069a77b7999f9314def5cb7476ef379abed7af9a1064a71d3bbd8e3fbe220bc2" + }, + { + "path": "CONTRIBUTING.md", + "usage": "provenance", + "git_blob": "e51435543687f1bd88ab22248082dc689ce8b853", + "sha256": "df5b5646602f42cb5da5844f04ac925182ddcd0f627b9de1c96a5095bb7a277a" + }, + { + "path": "research/universal-connector-boundary/README.md", + "usage": "provenance", + "git_blob": "d277f7c5830b1f2bc42e1ff41ab86e7d7564929f", + "sha256": "23415f7829ab8d80a783142f10f7d31abbce84579362769984680af3df954476" + }, + { + "path": "research/universal-connector-boundary/NOTICE.md", + "usage": "provenance", + "git_blob": "d9afdf81f656278dab69239f0fd94924f97df87b", + "sha256": "1172648a1883827399d5103a9916deaa4314e4ee2c28653c183890f6bd5a7a17" + }, + { + "path": "research/universal-connector-six-source/README.md", + "usage": "provenance", + "git_blob": "c7123c3cfd7545deb6af607800df0d15c6e8c0d2", + "sha256": "ea9cca56d1547dcd984f5f99f6c6243c9417a7ede08f68782c7a6616aa6eb563" + }, + { + "path": "research/universal-connector-six-source/NOTICE.md", + "usage": "provenance", + "git_blob": "44201ca4626146a690fb5862eb2b6dddde611ce5", + "sha256": "a1c5b211f8e2357e145977be830493ec132ccaebcd7dfd35816cb527b3a196d6" + }, + { + "path": "research/two-connector-transfer-boundary/README.md", + "usage": "provenance", + "git_blob": "b02039847c7f878ba12fd95102c44672c8c321c9", + "sha256": "3057191382e0bb27d9b6125ea4a9a1878a5ea5b4b5bea84401a99b47598faa5c" + } + ], + "related_prs": [ + { + "number": 1915, + "author": "adamgall", + "author_name": "Adam Gall", + "head": "d30d64fea909219c364b11c2452f2207326e2b1f", + "state": "MERGED", + "merged_at": "2026-10-14T17:06:51Z", + "updated_at": "2026-10-14T17:10:16Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1915" + }, + { + "number": 1887, + "author": "1337isnot1337", + "author_name": "Cinna Davis", + "head": "025d4fcd87f1b6ea01aa1c52721f8f46389aacce", + "state": "MERGED", + "merged_at": "2026-10-14T16:57:12Z", + "updated_at": "2026-10-14T17:01:05Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1887" + }, + { + "number": 1812, + "author": "nedveder", + "author_name": "", + "head": "e43abcde1c98c718f5b4d0b25cf4cd9c04200bd8", + "state": "MERGED", + "merged_at": "2026-10-14T16:38:48Z", + "updated_at": "2026-10-14T16:41:53Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1812" + }, + { + "number": 1767, + "author": "thakrarsagar", + "author_name": "", + "head": "ce50fccd8086bfeb8a61cc9eded572fb4741c387", + "state": "MERGED", + "merged_at": "2026-10-14T16:16:41Z", + "updated_at": "2026-10-14T16:22:06Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1767" + }, + { + "number": 1675, + "author": "1337isnot1337", + "author_name": "Cinna Davis", + "head": "a8d459974abf7ba88316c87396565f7e5fc9656f", + "state": "MERGED", + "merged_at": "2026-10-14T15:44:16Z", + "updated_at": "2026-10-14T15:57:45Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1675" + }, + { + "number": 1615, + "author": "bbMisk", + "author_name": "", + "head": "96916897840829cc01b126f8f202a92d949d2bfc", + "state": "MERGED", + "merged_at": "2026-10-14T15:43:33Z", + "updated_at": "2026-10-14T15:55:55Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1615" + }, + { + "number": 1498, + "author": "bitplane", + "author_name": "Gareth Davidson", + "head": "b7baacc8048ab11d31751aee065206f2725a1a16", + "state": "MERGED", + "merged_at": "2026-10-14T15:14:11Z", + "updated_at": "2026-10-14T15:28:44Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1498" + }, + { + "number": 1438, + "author": "woklerx", + "author_name": "", + "head": "a61170c97c9ea2c396f6d76a953b0cf74a455cdd", + "state": "MERGED", + "merged_at": "2026-10-14T06:44:22Z", + "updated_at": "2026-10-14T06:48:35Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1438" + }, + { + "number": 1185, + "author": "Mister-Meeseeks", + "author_name": "Doug Colkitt", + "head": "4a60772285ce70f6414458f6d3a54948652bbed0", + "state": "MERGED", + "merged_at": "2026-10-14T05:19:17Z", + "updated_at": "2026-10-14T05:30:21Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/1185" + }, + { + "number": 943, + "author": "RossRichardson", + "author_name": "Ross Richardson", + "head": "cf360b4b09b7d0419decdd6ac85421fefed55bdd", + "state": "MERGED", + "merged_at": "2026-10-13T16:15:01Z", + "updated_at": "2026-10-13T16:15:01Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/943" + }, + { + "number": 934, + "author": "RossRichardson", + "author_name": "Ross Richardson", + "head": "f3100aec6ce6a7b061987875d5e9a8b93801ac0b", + "state": "MERGED", + "merged_at": "2026-10-13T16:15:01Z", + "updated_at": "2026-10-13T16:15:01Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/934" + } + ], + "local_predecessor": { + "repository": "https://github.com/conorholds/math", + "commit": "e3a5f7b110ac37be3d96cb147c026d18579193ba", + "package": "integer-mult-bounds/research/bidirectional-universal-five", + "reviewed_successor_commit": "df3b327cb588e33b987d677c33ab1d06b7908c78", + "status": "Reachable main commits from merged math PR1/PR2; replaces the unsquashed0921877 citation." + }, + "note": "All files are historical provenance, not replay imports; verification is self-contained. Preserve exact discovery pins. Related PR heads record attribution and overlap context.", + "upstream_recheck": { + "head": "e112d71c8d7bb32435debcc54df932593dd8223a", + "method": "Every historical file compared by Git blob and SHA256; original base/files pins preserved. Related PR states refreshed from all-state API snapshot.", + "unchanged_files": [ + "certificates/selected-result.json", + "docs/research/agent-task-catalog.json", + "AGENTS.md", + "autoresearch.md", + "CONTRIBUTING.md", + "research/universal-connector-boundary/README.md", + "research/universal-connector-boundary/NOTICE.md", + "research/universal-connector-six-source/README.md", + "research/universal-connector-six-source/NOTICE.md", + "research/two-connector-transfer-boundary/README.md" + ], + "changed_provenance_files": [], + "note": "All historical pinned bytes still match." + }, + "revision_sources": { + "base_commit": "e112d71c8d7bb32435debcc54df932593dd8223a", + "files": [ + { + "path": "research/connector-frame-rigidity/README.md", + "git_blob": "8f792e62700ec3809075b500f233cee00f3543fe", + "sha256": "d4c5aea3ecc0e988dfd01ee9e47381d813a736cf7eec96eb4f352ab4dc6f3872", + "usage": "revision provenance only; no replay import" + }, + { + "path": "research/two-projection-connector-seed51a5/README.md", + "git_blob": "4f342bd8d0ee1ea640e81e0670ac664e9a3e1be5", + "sha256": "f597abae5a974344fd9dcb60f5e3143dde29e2e1d35ceabd0829f21a4fadcfb1", + "usage": "revision provenance only; no replay import" + }, + { + "path": "research/two-connector-six-transfer/README.md", + "git_blob": "ab5d15be9f0706055a8931d34415577b855d9607", + "sha256": "824dd9a83950da3b5262b640ff1e1105888654f538532f1839787a8e1374ff90", + "usage": "revision provenance only; no replay import" + } + ] + }, + "discussion_1412": { + "title": "Read-only five-source connector: second dirty root and eight paid XORs (seed54)", + "author": { + "login": "1337isnot1337" + }, + "createdAt": "2026-10-14T00:27:57Z", + "updatedAt": "2026-10-14T00:27:57Z", + "url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1412", + "body_sha256": "2742742751dee3ff79c530e16b45afc1d36aa590596c4135ae8b233b9dee9463" + }, + "submission_sources": { + "upstream_head": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "priority_revision": 4, + "checked_at": "2026-10-14T20:34:59.184514+00:00", + "concurrent_prs": [ + { + "pr": 2065, + "head": "2721b1e31d718a6e70266a99521f629ce2e1d259", + "author": "Adam Gall", + "state": "OPEN", + "delta": "Same six-transfer five-source endpoint. Credit as independent concurrent work; exclude the earlier bidirectional-universal-five package from the submission." + }, + { + "pr": 2063, + "head": "4caa7660fa4a31c4cfeaf177fabc3b56549dd065", + "author": "Adam Gall", + "state": "OPEN", + "delta": "Five-source one-root all-positive-map-tariff optimum; not the scalable star, arbitrary-frame two-root boundary or fixed-z0 eight-transfer result." + }, + { + "pr": 2056, + "head": "c713ff9eff95446508aeb865a9f58b1758b2a00a", + "author": "Aaron Wang", + "state": "OPEN", + "delta": "Adds combined pair-source calls to a one-root alphabet; those calls are excluded here." + }, + { + "pr": 2128, + "head": "697369a971eed02c0fbcd75ebefec9f59945f08e", + "author": "Aaron Wang", + "state": "OPEN", + "delta": "Six-source fourteen-call construction in a pair-source DUO alphabet. Combined source calls are excluded by this package; not the ordinary-call arbitrary-frame two-root obstruction or fixed-z0 eight-transfer optimum." + }, + { + "pr": 2134, + "head": "388a63c83cf24c3355be9798bde5a381188dadb3", + "author": "Cinna Davis", + "state": "OPEN", + "delta": "Six-source one-TRIO census with sixteen source-map applications; combined call and nonminimal multiplicities are excluded here." + } + ], + "files": [ + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "2721b1e31d718a6e70266a99521f629ce2e1d259", + "path": "research/bidirectional-five-source-connector/README.md", + "git_blob": "715dd2e76f41e9ddee095ff2aa0196597f312db3", + "sha256": "14ef42c5688fce6f174c6a5be47ed1c0ca3a6ef7512346f57a4a8f222dd6458b", + "usage": "Concurrent attribution/overlap evidence only; not a replay import, dependency or claimed human review." + }, + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "697369a971eed02c0fbcd75ebefec9f59945f08e", + "path": "research/connector-six-source-duo/README.md", + "git_blob": "9855372446ed4ecd9d91c0f7afee1932e2c2d61a", + "sha256": "f338d940075ba3782da276abf69b9578d3b1a4daaa285960cf168480d8f7c486", + "usage": "Concurrent attribution/overlap evidence only; pair-source alphabet excluded here; not a replay import." + } + ], + "note": "Historical base/files and prior revision pins are preserved. This checkpoint records current guidance and the decision to exclude the overlapping six-transfer predecessor from upstream submission." + } +} diff --git a/research/scalable-dirty-connectors/TASK.json b/research/scalable-dirty-connectors/TASK.json new file mode 100644 index 0000000000..e112f7af49 --- /dev/null +++ b/research/scalable-dirty-connectors/TASK.json @@ -0,0 +1,315 @@ +{ + "schema_version": 1, + "task_id": "connector-alphabet-change", + "priority_revision": 3, + "base_commit": "fe19567d22524eef6d3858c537aeed537ad5a7e6", + "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": "Scalable minimum-map-call universal F2 dirty connector: n>=4, n-3 roots, paid one-way star shears, stable source ports and root-zero readouts; exact arbitrary-frame two-root boundary; fixed-z0 bidirectional five-source eight-transfer optimum.", + "scope_change_reason": "The user requested substantial expansion of the reviewed five-source result. More dirty roots and paid transfers attain minimum B and A counts simultaneously. The one-root extra-readout family already attains minimum B calls alone; this revised scope compares fully charged readout/shear/row tradeoffs rather than claiming a new minimum-source-call capability.", + "bottleneck_link": "The connector can replace extra complete output readouts with paid root transfers and hosting. The dense-B/sparse-A resident backend shows a scoped improvement against a one-root extra-readout comparator with the same B count; no selected-supplier caller or new kappa is established.", + "budget_minutes": 90, + "stop_rule": "Finish a constructive family, sharp scoped root obstruction, full invoices and meaningful replay/controls. Do not pursue sibling two-root extra-source/weighted searches, reframe a failed screen as a theorem, or post/push/submit without approval.", + "outcome": "completed", + "evidence": "All-n star and two-root boundary unchanged. EXPECTED.json now includes the one-root extra-readout family through n10, independent subset-DP/pair-BFS agreement,460 forward/inverse dense cases,all original704 controls plus336 new extra-readout controls,positive neutral readout/odd-source fixtures,and61 exact readout-volume checks. Native t8 control executes the census path on105 legal pairings and detects1 universal.", + "author": "Conor Holdsworth with OpenAI Codex and Anthropic Claude assistance", + "ai_assistance": "Substantial OpenAI Codex assistance in discovery, mathematics, implementation, verification and writing; three OpenAI gpt-6-luna agents (tool name Luna, xhigh reasoning) handled distinct interface, obstruction and backend questions. Anthropic Claude supplied AI-assisted independent review, the stronger extra-readout comparator, performance/attribution corrections and review memory notes; exact Claude model not recorded. No independent human review or proof-assistant verification claimed.", + "open_questions": [ + { + "question": "Can a real recursive caller expose this product batch with reservable dirty roots and stable complete ports?", + "why_it_matters": "Only an actual caller and fully paid adoption inequality can translate the local map-call gain into supplier progress.", + "first_step": "Pin one caller, extract exact B/A roles and ownership, then compare C_star with both C_extra and C_gray, including complete ports, preparation, control and rows.", + "blocked_by": "No selected-supplier caller with this universal product-mask interface has been identified." + }, + { + "question": "Can n>=7 attain minimum map calls with fewer than n-3 dirty roots?", + "why_it_matters": "A lower root requirement would reduce hosting and extend adoption; only the six-source minimum of three roots is settled.", + "first_step": "Seek a seven-source three-root word in an explicitly bounded axis/frame domain; synthesize and physically replay every priced transfer for a positive candidate.", + "blocked_by": "The bounded favorable screen found no universal word; this is not an exclusion." + }, + { + "question": "Does a concrete tape implementation retain the gain after head returns and program access?", + "why_it_matters": "Resident RAM counts and timings do not determine the project model tape cost.", + "first_step": "Choose the caller/head layout and emit complete child/frame traces including all source/target/coefficient accesses and returns.", + "blocked_by": "No concrete caller/head layout is pinned." + } + ], + "overlap": { + "checked_at": "2026-10-14T18:19:20.915925+00:00", + "coverage": { + "open_prs": { + "fetched_at": "2026-10-14T18:17:53.159956+00:00", + "complete_pagination": true, + "records": 331 + }, + "discussions": { + "fetched_at": "2026-10-14T18:19:20.869766+00:00", + "complete_pagination": true, + "records": 705 + } + }, + "terms": [ + "scalable dirty connector", + "fixed-z0 eight", + "two-root minimal" + ], + "warnings": [], + "remote_matches": [], + "limits": "Remote PR scope is open PRs including drafts. Closed work is searched through local READMEs, TASK metadata and ledger only. No code diffs or arbitrary package files are searched. Recheck relevant heads before submission.", + "all_state_pr_body_scan": { + "records": 1867, + "latest_creation": "2026-10-14T18:17:14Z", + "method": "Read-only all-state PR body scan; nearby1615/1887/1915 bodies and merged source files inspected. No exact overlap found; absence is not a novelty certificate." + }, + "exact_upstream_recheck": { + "head": "e112d71c8d7bb32435debcc54df932593dd8223a", + "method": "Fetched current main, compared every original source pin by Git blob/SHA256 and refreshed related PR states. Original discovery pins remain immutable." + }, + "local_sessions": "Read sibling task cards and caller screen; avoided tegucigalpa two-root n6/n7 extra-B/weighted work, complex-plane and packing sessions. No sibling file was edited.", + "posting_restriction": "No CrocSwap submissions or external communications without approval. This revision stays local; earlier math PR1/PR2 were explicitly authorized and merged.", + "local_matches": [ + { + "kind": "local-readme", + "path": "research/scalable-dirty-connectors/README.md", + "matched_terms": [ + "two-root minimal" + ] + }, + { + "kind": "local-task", + "path": "research/scalable-dirty-connectors/TASK.json", + "matched_terms": [ + "scalable dirty connector" + ] + } + ] + }, + "verification": { + "python": "Python3.14.3 isolated optimized replay and Python3.12.11 registered hook pass:460 dense forward/inverse cases,all original704 controls plus336 baseline controls,dual word censuses,per-mask DP/BFS agreement,and61 exact volume checks. Original paired-case RNG stream preserved; extra cases have a separate stream. Python3.12 no-Git export passes and a boolean receipt corruption rejects.", + "native_census": "Six-transfer enumeration unchanged; prior packaged and independent physical-row matching histograms reused. Revised8 command runs the actual pairing/coverage engine on1 frame,105 legal pairings and1 universal, then also validates the literal witness. The reviewer separately reported an exhaustive8 run with464969376 legal schedules and828 universal; not rerun here.", + "additional_review_adapter": { + "method": "Local adaptation of reviewer physical-row census: all64 direction words,8008 placements,945 canonical words, fixedB/Aport0, actual root/source restoration filter; identical legal count and all histogram bins. No normalized axes or predefined identity words.", + "source_sha256": "dc2cfa9a3a555e0f0554cdabb97e8aed17e26fba4a49a9536bdf20447eca419b", + "original_reviewer_file_unchanged": true, + "included_in_registered_hook": false + }, + "backend": { + "compiler": "Xcode clang++ -target arm64-apple-macosx26.5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -O3 -std=c++20 -Wall -Wextra -Wpedantic", + "backend_cpp_sha256": "2f6323d6e6883759dc26c207fd708d0db1c5e0338cd675ccc988e620a6c5ed11", + "fixture": "Five arbitrary dense F2 factors per B, each balanced dirty echo28 leaves/3 private rows; A has2 supports per output entry. Same dirty source/output/root/private rows and shared coefficient tables.", + "trials": 7, + "timing_order": "Alternate star/baseline and baseline/star, seven trials. The default comparator is extra; gray is secondary. Initialization, validation and resets are outside execution timing and reported separately.", + "failure_controls": "13 revised native cases reject: extra A/B omission and label changes,unknown opcode,bad/overflow index,unknown/misclassified/missing baseline mode,bad numeric n/width,and negative seed. Star/Gray retain exactly-two readout contracts; the extra comparator sums all even readouts with exact formal output checks.", + "machine": { + "cpu": "Apple M3 Max", + "os": "macOS27.0.1 build26A434", + "compiler_version": "Apple clang21.0.0 clang-2100.1.1.101" + }, + "measurement_guard": "A volatile checksum consumes timed row mutations outside the measured interval; one additional scalar diagnostic word, not a clean connector row.", + "historical_gray_measurements": [ + { + "sources": 6, + "row_width": 256, + "seed": 4106, + "star_median_us": 159.8, + "gray_median_us": 203.1, + "time_reduction_percent": 21.32, + "stdout": "PROGRAM_PREP n=6 elapsed_ms=2.288 star_ops=162 gray_ops=142 star_event_file_bytes=1080 gray_event_file_bytes=960\nFORMAL star PASS X=24 B=12 A=126\nFORMAL gray PASS X=0 B=16 A=126\nCOUNTS star dense_leaves=336 matrix_word_reads=344064 source_word_reads=344064 and_words=344064 popcounts=344064 parity_xors=344064 target_word_reads=1344 target_word_writes=1344 echo_internal_nodes=108 B_calls=12 A_calls=126 A_support_index_reads=64512 A_source_word_reads=64512 A_target_word_reads=504 A_target_word_writes=504 A_source_plus_target_xors=32760 shears=24 shear_word_reads=192 shear_word_writes=96 shear_xors=96\nCOUNTS gray dense_leaves=448 matrix_word_reads=458752 source_word_reads=458752 and_words=458752 popcounts=458752 parity_xors=458752 target_word_reads=1792 target_word_writes=1792 echo_internal_nodes=144 B_calls=16 A_calls=126 A_support_index_reads=64512 A_source_word_reads=64512 A_target_word_reads=504 A_target_word_writes=504 A_source_plus_target_xors=32760 shears=0 shear_word_reads=0 shear_word_writes=0 shear_xors=0\nRECEIPT n=6 L=256 roots=3 B_star=12 B_gray=16 source_saving_pct=25.0 A_calls_each=126 transfers=24 dense_leaves_star=336 dense_leaves_gray=448 checked_child_calls_star=138 checked_child_calls_gray=142 program_dispatches_star=162 program_dispatches_gray=142 matrix_vector_capacity_bytes_shared=245760 sparse_index_capacity_bytes=64512 map_container_capacity_bytes=4800 map_capacity_bytes_shared=315072 rows_star_bytes=2400 rows_gray_bytes=2336 row_snapshot_bytes_star=2400 row_snapshot_bytes_gray=2336 total_resident_row_payload_bytes=9472 total_resident_row_capacity_bytes=9600 program_star_used_bytes=972 program_gray_used_bytes=852 program_star_capacity_bytes=1536 program_gray_capacity_bytes=1536 total_program_capacity_bytes=3072 star_event_file_bytes=1080 gray_event_file_bytes=960 total_payload_capacity_bytes_estimate=327744 sizeof_op=6 fixture_generation_ms=0.2 program_compile_parse_ms=0.1 baseline_layout_ms=0.0 dense_cpu_clean_accumulator_words=1 B_depth=5 dense_leaves_per_B=28 echo_internal_nodes_per_B=9 private_scratch_rows_each=3 private_scratch_bits_each=768 private_scratch_words_each=12\nTIMING resident_cpu_median_us star=159.8 gray=203.1 ratio_gray_over_star=1.3 trials=7 star_repetitions=1575 gray_repetitions=1231 includes_program_dispatch=true includes_data_reset=false order=star,gray;gray,star;star,gray;gray,star;star,gray;gray,star;star,gray raw_trials star=[159.6,159.8,161.7,160.2,160.2,159.5,158.9] gray=[202.6,202.2,202.3,203.9,203.9,211.3,203.1] excludes_fixture_and_program_preparation=true\n" + }, + { + "sources": 8, + "row_width": 512, + "seed": 4108, + "star_median_us": 699.0, + "gray_median_us": 1180.1, + "time_reduction_percent": 40.77, + "stdout": "PROGRAM_PREP n=8 elapsed_ms=2.481 star_ops=646 gray_ops=542 star_event_file_bytes=4680 gray_event_file_bytes=4056\nFORMAL star PASS X=120 B=16 A=510\nFORMAL gray PASS X=0 B=32 A=510\nCOUNTS star dense_leaves=448 matrix_word_reads=1835008 source_word_reads=1835008 and_words=1835008 popcounts=1835008 parity_xors=1835008 target_word_reads=3584 target_word_writes=3584 echo_internal_nodes=144 B_calls=16 A_calls=510 A_support_index_reads=522240 A_source_word_reads=522240 A_target_word_reads=4080 A_target_word_writes=4080 A_source_plus_target_xors=265200 shears=120 shear_word_reads=1920 shear_word_writes=960 shear_xors=960\nCOUNTS gray dense_leaves=896 matrix_word_reads=3670016 source_word_reads=3670016 and_words=3670016 popcounts=3670016 parity_xors=3670016 target_word_reads=7168 target_word_writes=7168 echo_internal_nodes=288 B_calls=32 A_calls=510 A_support_index_reads=522240 A_source_word_reads=522240 A_target_word_reads=4080 A_target_word_writes=4080 A_source_plus_target_xors=265200 shears=0 shear_word_reads=0 shear_word_writes=0 shear_xors=0\nRECEIPT n=8 L=512 roots=5 B_star=16 B_gray=32 source_saving_pct=50.0 A_calls_each=510 transfers=120 dense_leaves_star=448 dense_leaves_gray=896 checked_child_calls_star=526 checked_child_calls_gray=542 program_dispatches_star=646 program_dispatches_gray=542 matrix_vector_capacity_bytes_shared=1310720 sparse_index_capacity_bytes=522240 map_container_capacity_bytes=14528 map_capacity_bytes_shared=1847488 rows_star_bytes=17344 rows_gray_bytes=17088 row_snapshot_bytes_star=17344 row_snapshot_bytes_gray=17088 total_resident_row_payload_bytes=68864 total_resident_row_capacity_bytes=69376 program_star_used_bytes=3876 program_gray_used_bytes=3252 program_star_capacity_bytes=6144 program_gray_capacity_bytes=6144 total_program_capacity_bytes=12288 star_event_file_bytes=4680 gray_event_file_bytes=4056 total_payload_capacity_bytes_estimate=1929152 sizeof_op=6 fixture_generation_ms=0.8 program_compile_parse_ms=0.3 baseline_layout_ms=0.0 dense_cpu_clean_accumulator_words=1 B_depth=5 dense_leaves_per_B=28 echo_internal_nodes_per_B=9 private_scratch_rows_each=3 private_scratch_bits_each=1536 private_scratch_words_each=24\nTIMING resident_cpu_median_us star=699.0 gray=1180.1 ratio_gray_over_star=1.7 trials=7 star_repetitions=355 gray_repetitions=212 includes_program_dispatch=true includes_data_reset=false order=star,gray;gray,star;star,gray;gray,star;star,gray;gray,star;star,gray raw_trials star=[698.4,766.2,699.0,704.3,697.7,707.8,692.8] gray=[1202.5,1180.1,1173.3,1173.6,1192.1,1191.4,1166.4] excludes_fixture_and_program_preparation=true\n" + } + ], + "historical_gray_measurements_note": "Original weaker-comparator results preserved as history; they do not establish gains against the stronger extra-readout comparator.", + "measurements": [ + { + "baseline": "extra", + "sources": 6, + "row_width": 256, + "seed": 4106, + "star_median_us": 159.5, + "baseline_median_us": 167.0, + "time_reduction_percent": 4.49, + "stdout": "PROGRAM_PREP n=6 elapsed_ms=2.662 baseline=extra star_ops=162 baseline_ops=168 star_event_file_bytes=1080 baseline_event_file_bytes=1146\nFORMAL star PASS X=24 B=12 A=126\nFORMAL extra PASS X=0 B=12 A=156\nCOUNTS star dense_leaves=336 matrix_word_reads=344064 source_word_reads=344064 and_words=344064 popcounts=344064 parity_xors=344064 target_word_reads=1344 target_word_writes=1344 echo_internal_nodes=108 B_calls=12 A_calls=126 A_support_index_reads=64512 A_source_word_reads=64512 A_target_word_reads=504 A_target_word_writes=504 A_source_plus_target_xors=32760 shears=24 shear_word_reads=192 shear_word_writes=96 shear_xors=96\nCOUNTS extra dense_leaves=336 matrix_word_reads=344064 source_word_reads=344064 and_words=344064 popcounts=344064 parity_xors=344064 target_word_reads=1344 target_word_writes=1344 echo_internal_nodes=108 B_calls=12 A_calls=156 A_support_index_reads=79872 A_source_word_reads=79872 A_target_word_reads=624 A_target_word_writes=624 A_source_plus_target_xors=40560 shears=0 shear_word_reads=0 shear_word_writes=0 shear_xors=0\nRECEIPT n=6 L=256 roots=3 B_star=12 B_baseline=12 source_saving_pct=0.0 baseline_kind=extra A_star=126 A_baseline=156 transfers=24 dense_leaves_star=336 dense_leaves_baseline=336 checked_child_calls_star=138 checked_child_calls_baseline=168 program_dispatches_star=162 program_dispatches_baseline=168 matrix_vector_capacity_bytes_shared=245760 sparse_index_capacity_bytes=64512 map_container_capacity_bytes=4800 map_capacity_bytes_shared=315072 rows_star_bytes=2400 rows_baseline_bytes=2336 row_snapshot_bytes_star=2400 row_snapshot_bytes_baseline=2336 total_resident_row_payload_bytes=9472 total_resident_row_capacity_bytes=9600 program_star_used_bytes=972 program_baseline_used_bytes=1008 program_star_capacity_bytes=1536 program_baseline_capacity_bytes=1536 total_program_capacity_bytes=3072 star_event_file_bytes=1080 baseline_event_file_bytes=1146 total_payload_capacity_bytes_estimate=327744 sizeof_op=6 fixture_generation_ms=0.1 program_compile_parse_ms=0.1 baseline_layout_ms=0.0 star_validation_ms=0.9 baseline_validation_ms=0.8 dense_cpu_clean_accumulator_words=1 B_depth=5 dense_leaves_per_B=28 echo_internal_nodes_per_B=9 private_scratch_rows_each=3 private_scratch_bits_each=768 private_scratch_words_each=12\nTIMING resident_cpu_median_us star=159.5 baseline=167.0 baseline_kind=extra ratio_baseline_over_star=1.046 trials=7 star_repetitions=1556 baseline_repetitions=1516 includes_program_dispatch=true includes_data_reset=false order=star,baseline;baseline,star;star,baseline;baseline,star;star,baseline;baseline,star;star,baseline raw_trials star=[158.5,158.9,159.5,160.0,159.7,172.0,158.2] baseline=[164.8,165.2,167.0,168.7,167.2,164.5,167.5] excludes_fixture_and_program_preparation=true\n" + }, + { + "baseline": "extra", + "sources": 8, + "row_width": 512, + "seed": 4108, + "star_median_us": 693.5, + "baseline_median_us": 825.5, + "time_reduction_percent": 15.99, + "stdout": "PROGRAM_PREP n=8 elapsed_ms=3.304 baseline=extra star_ops=646 baseline_ops=844 star_event_file_bytes=4680 baseline_event_file_bytes=6406\nFORMAL star PASS X=120 B=16 A=510\nFORMAL extra PASS X=0 B=16 A=828\nCOUNTS star dense_leaves=448 matrix_word_reads=1835008 source_word_reads=1835008 and_words=1835008 popcounts=1835008 parity_xors=1835008 target_word_reads=3584 target_word_writes=3584 echo_internal_nodes=144 B_calls=16 A_calls=510 A_support_index_reads=522240 A_source_word_reads=522240 A_target_word_reads=4080 A_target_word_writes=4080 A_source_plus_target_xors=265200 shears=120 shear_word_reads=1920 shear_word_writes=960 shear_xors=960\nCOUNTS extra dense_leaves=448 matrix_word_reads=1835008 source_word_reads=1835008 and_words=1835008 popcounts=1835008 parity_xors=1835008 target_word_reads=3584 target_word_writes=3584 echo_internal_nodes=144 B_calls=16 A_calls=828 A_support_index_reads=847872 A_source_word_reads=847872 A_target_word_reads=6624 A_target_word_writes=6624 A_source_plus_target_xors=430560 shears=0 shear_word_reads=0 shear_word_writes=0 shear_xors=0\nRECEIPT n=8 L=512 roots=5 B_star=16 B_baseline=16 source_saving_pct=0.0 baseline_kind=extra A_star=510 A_baseline=828 transfers=120 dense_leaves_star=448 dense_leaves_baseline=448 checked_child_calls_star=526 checked_child_calls_baseline=844 program_dispatches_star=646 program_dispatches_baseline=844 matrix_vector_capacity_bytes_shared=1310720 sparse_index_capacity_bytes=522240 map_container_capacity_bytes=14528 map_capacity_bytes_shared=1847488 rows_star_bytes=17344 rows_baseline_bytes=17088 row_snapshot_bytes_star=17344 row_snapshot_bytes_baseline=17088 total_resident_row_payload_bytes=68864 total_resident_row_capacity_bytes=69376 program_star_used_bytes=3876 program_baseline_used_bytes=5064 program_star_capacity_bytes=6144 program_baseline_capacity_bytes=6144 total_program_capacity_bytes=12288 star_event_file_bytes=4680 baseline_event_file_bytes=6406 total_payload_capacity_bytes_estimate=1929152 sizeof_op=6 fixture_generation_ms=0.7 program_compile_parse_ms=0.3 baseline_layout_ms=0.0 star_validation_ms=8.5 baseline_validation_ms=8.7 dense_cpu_clean_accumulator_words=1 B_depth=5 dense_leaves_per_B=28 echo_internal_nodes_per_B=9 private_scratch_rows_each=3 private_scratch_bits_each=1536 private_scratch_words_each=24\nTIMING resident_cpu_median_us star=693.5 baseline=825.5 baseline_kind=extra ratio_baseline_over_star=1.190 trials=7 star_repetitions=359 baseline_repetitions=302 includes_program_dispatch=true includes_data_reset=false order=star,baseline;baseline,star;star,baseline;baseline,star;star,baseline;baseline,star;star,baseline raw_trials star=[693.9,693.5,691.3,714.0,706.8,689.6,690.0] baseline=[821.3,824.3,825.5,827.1,829.9,822.9,926.3] excludes_fixture_and_program_preparation=true\n" + }, + { + "baseline": "gray", + "sources": 6, + "row_width": 256, + "seed": 4106, + "star_median_us": 161.4, + "baseline_median_us": 204.1, + "time_reduction_percent": 20.92, + "stdout": "PROGRAM_PREP n=6 elapsed_ms=2.847 baseline=gray star_ops=162 baseline_ops=142 star_event_file_bytes=1080 baseline_event_file_bytes=960\nFORMAL star PASS X=24 B=12 A=126\nFORMAL gray PASS X=0 B=16 A=126\nCOUNTS star dense_leaves=336 matrix_word_reads=344064 source_word_reads=344064 and_words=344064 popcounts=344064 parity_xors=344064 target_word_reads=1344 target_word_writes=1344 echo_internal_nodes=108 B_calls=12 A_calls=126 A_support_index_reads=64512 A_source_word_reads=64512 A_target_word_reads=504 A_target_word_writes=504 A_source_plus_target_xors=32760 shears=24 shear_word_reads=192 shear_word_writes=96 shear_xors=96\nCOUNTS gray dense_leaves=448 matrix_word_reads=458752 source_word_reads=458752 and_words=458752 popcounts=458752 parity_xors=458752 target_word_reads=1792 target_word_writes=1792 echo_internal_nodes=144 B_calls=16 A_calls=126 A_support_index_reads=64512 A_source_word_reads=64512 A_target_word_reads=504 A_target_word_writes=504 A_source_plus_target_xors=32760 shears=0 shear_word_reads=0 shear_word_writes=0 shear_xors=0\nRECEIPT n=6 L=256 roots=3 B_star=12 B_baseline=16 source_saving_pct=25.0 baseline_kind=gray A_star=126 A_baseline=126 transfers=24 dense_leaves_star=336 dense_leaves_baseline=448 checked_child_calls_star=138 checked_child_calls_baseline=142 program_dispatches_star=162 program_dispatches_baseline=142 matrix_vector_capacity_bytes_shared=245760 sparse_index_capacity_bytes=64512 map_container_capacity_bytes=4800 map_capacity_bytes_shared=315072 rows_star_bytes=2400 rows_baseline_bytes=2336 row_snapshot_bytes_star=2400 row_snapshot_bytes_baseline=2336 total_resident_row_payload_bytes=9472 total_resident_row_capacity_bytes=9600 program_star_used_bytes=972 program_baseline_used_bytes=852 program_star_capacity_bytes=1536 program_baseline_capacity_bytes=1536 total_program_capacity_bytes=3072 star_event_file_bytes=1080 baseline_event_file_bytes=960 total_payload_capacity_bytes_estimate=327744 sizeof_op=6 fixture_generation_ms=0.3 program_compile_parse_ms=0.2 baseline_layout_ms=0.0 dense_cpu_clean_accumulator_words=1 B_depth=5 dense_leaves_per_B=28 echo_internal_nodes_per_B=9 private_scratch_rows_each=3 private_scratch_bits_each=768 private_scratch_words_each=12\nTIMING resident_cpu_median_us star=161.4 baseline=204.1 baseline_kind=gray ratio_baseline_over_star=1.3 trials=7 star_repetitions=1572 baseline_repetitions=1236 includes_program_dispatch=true includes_data_reset=false order=star,baseline;baseline,star;star,baseline;baseline,star;star,baseline;baseline,star;star,baseline raw_trials star=[163.0,161.9,163.1,161.4,159.8,160.4,161.2] baseline=[203.6,202.6,204.6,203.8,212.8,207.6,204.1] excludes_fixture_and_program_preparation=true\n" + }, + { + "baseline": "gray", + "sources": 8, + "row_width": 512, + "seed": 4108, + "star_median_us": 703.6, + "baseline_median_us": 1182.3, + "time_reduction_percent": 40.49, + "stdout": "PROGRAM_PREP n=8 elapsed_ms=2.480 baseline=gray star_ops=646 baseline_ops=542 star_event_file_bytes=4680 baseline_event_file_bytes=4056\nFORMAL star PASS X=120 B=16 A=510\nFORMAL gray PASS X=0 B=32 A=510\nCOUNTS star dense_leaves=448 matrix_word_reads=1835008 source_word_reads=1835008 and_words=1835008 popcounts=1835008 parity_xors=1835008 target_word_reads=3584 target_word_writes=3584 echo_internal_nodes=144 B_calls=16 A_calls=510 A_support_index_reads=522240 A_source_word_reads=522240 A_target_word_reads=4080 A_target_word_writes=4080 A_source_plus_target_xors=265200 shears=120 shear_word_reads=1920 shear_word_writes=960 shear_xors=960\nCOUNTS gray dense_leaves=896 matrix_word_reads=3670016 source_word_reads=3670016 and_words=3670016 popcounts=3670016 parity_xors=3670016 target_word_reads=7168 target_word_writes=7168 echo_internal_nodes=288 B_calls=32 A_calls=510 A_support_index_reads=522240 A_source_word_reads=522240 A_target_word_reads=4080 A_target_word_writes=4080 A_source_plus_target_xors=265200 shears=0 shear_word_reads=0 shear_word_writes=0 shear_xors=0\nRECEIPT n=8 L=512 roots=5 B_star=16 B_baseline=32 source_saving_pct=50.0 baseline_kind=gray A_star=510 A_baseline=510 transfers=120 dense_leaves_star=448 dense_leaves_baseline=896 checked_child_calls_star=526 checked_child_calls_baseline=542 program_dispatches_star=646 program_dispatches_baseline=542 matrix_vector_capacity_bytes_shared=1310720 sparse_index_capacity_bytes=522240 map_container_capacity_bytes=14528 map_capacity_bytes_shared=1847488 rows_star_bytes=17344 rows_baseline_bytes=17088 row_snapshot_bytes_star=17344 row_snapshot_bytes_baseline=17088 total_resident_row_payload_bytes=68864 total_resident_row_capacity_bytes=69376 program_star_used_bytes=3876 program_baseline_used_bytes=3252 program_star_capacity_bytes=6144 program_baseline_capacity_bytes=6144 total_program_capacity_bytes=12288 star_event_file_bytes=4680 baseline_event_file_bytes=4056 total_payload_capacity_bytes_estimate=1929152 sizeof_op=6 fixture_generation_ms=0.8 program_compile_parse_ms=0.3 baseline_layout_ms=0.0 dense_cpu_clean_accumulator_words=1 B_depth=5 dense_leaves_per_B=28 echo_internal_nodes_per_B=9 private_scratch_rows_each=3 private_scratch_bits_each=1536 private_scratch_words_each=24\nTIMING resident_cpu_median_us star=703.6 baseline=1182.3 baseline_kind=gray ratio_baseline_over_star=1.7 trials=7 star_repetitions=358 baseline_repetitions=213 includes_program_dispatch=true includes_data_reset=false order=star,baseline;baseline,star;star,baseline;baseline,star;star,baseline;baseline,star;star,baseline raw_trials star=[695.6,710.8,701.2,698.5,706.4,770.8,703.6] baseline=[1224.0,1182.3,1180.2,1181.9,1182.2,1221.7,1182.6] excludes_fixture_and_program_preparation=true\n" + } + ], + "validation_timer_note": "star_validation_ms includes both common formal checks followed by star numeric validation; baseline_validation_ms is its numeric validation. Neither is batch execution time." + }, + "not_run": [ + "Hosted CI", + "Lean/human proof review", + "Selected-supplier cold replay (no supplier changes)", + "Caller/head-return tape integration" + ] + }, + "revision": { + "reason": "Apply second independent agent review: replace weak performance baseline, correct asymptotics and missing attribution, refresh current source states, and put a positive fixture through the census engine.", + "review_commit": "df3b327cb588e33b987d677c33ab1d06b7908c78", + "required_fixes": [ + "Implement one-root2n-B extra-readout comparator and benchmark it on identical fixtures.", + "Withdraw the bit-RAM superconstant claim; limit growing-word gains to the explicit2n-B family and prove its readout bound.", + "Credit PR934,1615,1915,Discussion1412 and named predecessor authors; replace squashed predecessor references.", + "Refresh metadata states/pins and use the tested Xcode compile commands." + ], + "review_evidence": "User-provided independent review at .context/review-scalable/RESULTS.md; no original review file was modified or imported. Its lower bounds and exhaustive8 results are separately attributed evidence.", + "attribution_heads": { + "1915": "d30d64fea909219c364b11c2452f2207326e2b1f", + "1887": "025d4fcd87f1b6ea01aa1c52721f8f46389aacce", + "1812": "e43abcde1c98c718f5b4d0b25cf4cd9c04200bd8", + "1767": "ce50fccd8086bfeb8a61cc9eded572fb4741c387", + "1675": "a8d459974abf7ba88316c87396565f7e5fc9656f", + "1615": "96916897840829cc01b126f8f202a92d949d2bfc", + "1498": "b7baacc8048ab11d31751aee065206f2725a1a16", + "1438": "a61170c97c9ea2c396f6d76a953b0cf74a455cdd", + "1185": "4a60772285ce70f6414458f6d3a54948652bbed0", + "943": "cf360b4b09b7d0419decdd6ac85421fefed55bdd", + "934": "f3100aec6ce6a7b061987875d5e9a8b93801ac0b" + } + }, + "submission_checkpoint": { + "checked_at": "2026-10-14T20:34:59.184514+00:00", + "upstream_head": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "priority_revision": 4, + "decision": "Continue the completed explicitly changed-scope interface result as a partial contribution. Submit only scalable-dirty-connectors; do not resubmit the overlapping six-transfer predecessor.", + "guidance_read": [ + "AGENTS.md", + "autoresearch.md", + "CONTRIBUTING.md", + ".github/pull_request_template.md", + "docs/research/research-package-guide.md", + "docs/research/research-priority-log.md", + "docs/research/bottleneck-brief.md", + "certificates/selected-result.json" + ], + "historical_pins": "Unchanged. Seven original scientific/contribution files and all three revision scientific README pins match current main; catalogue, AGENTS.md and autoresearch.md changed and were reread.", + "overlap_coverage": { + "open_prs": { + "fetched_at": "2026-10-14T20:32:01.482575+00:00", + "complete_pagination": true, + "records": 392 + }, + "discussions": { + "fetched_at": "2026-10-14T20:33:35.010224+00:00", + "complete_pagination": true, + "records": 804 + } + }, + "all_state_pr_body_scan": { + "records": 1931, + "latest_creation": "2026-10-14T20:30:59Z", + "complete_pagination": true, + "method": "Read all PR titles/bodies and inspect contemporary connector claims, including PR2065/2063/2056/2128/2134." + }, + "overlap_resolution": [ + { + "pr": 2065, + "head": "2721b1e31d718a6e70266a99521f629ce2e1d259", + "author": "Adam Gall", + "state": "OPEN", + "delta": "Same six-transfer five-source endpoint. Credit as independent concurrent work; exclude the earlier bidirectional-universal-five package from the submission." + }, + { + "pr": 2063, + "head": "4caa7660fa4a31c4cfeaf177fabc3b56549dd065", + "author": "Adam Gall", + "state": "OPEN", + "delta": "Five-source one-root all-positive-map-tariff optimum; not the scalable star, arbitrary-frame two-root boundary or fixed-z0 eight-transfer result." + }, + { + "pr": 2056, + "head": "c713ff9eff95446508aeb865a9f58b1758b2a00a", + "author": "Aaron Wang", + "state": "OPEN", + "delta": "Adds combined pair-source calls to a one-root alphabet; those calls are excluded here." + }, + { + "pr": 2128, + "head": "697369a971eed02c0fbcd75ebefec9f59945f08e", + "author": "Aaron Wang", + "state": "OPEN", + "delta": "Six-source fourteen-call construction in a pair-source DUO alphabet. Combined source calls are excluded by this package; not the ordinary-call arbitrary-frame two-root obstruction or fixed-z0 eight-transfer optimum." + }, + { + "pr": 2134, + "head": "388a63c83cf24c3355be9798bde5a381188dadb3", + "author": "Cinna Davis", + "state": "OPEN", + "delta": "Six-source one-TRIO census with sixteen source-map applications; combined call and nonminimal multiplicities are excluded here." + } + ], + "limits": "No exact overlap for the three remaining claims found in checked bodies/discussion records and local indexed notes; no search of every remote code diff, and no novelty guarantee.", + "compatibility": "Both Python3.12.11 registered replays passed in an isolated worktree at the upstream head above. The proposed PR includes only research/scalable-dirty-connectors. Native source and scientific receipts unchanged; reuse prior source-bound native results.", + "publication": "User approved upstream submission after two attribution fixes and an optimality-first reframing. Save revised work in conorholds/math before the focused upstream PR; no merge or selected-frontier change is authorized." + } +} diff --git a/research/scalable-dirty-connectors/VERIFY.json b/research/scalable-dirty-connectors/VERIFY.json new file mode 100644 index 0000000000..d7d399c77c --- /dev/null +++ b/research/scalable-dirty-connectors/VERIFY.json @@ -0,0 +1,20 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "All original paired star/fixed-port checks and704 controls,one-root even extra-readout identity/invoice,minima checked independently by subset DP and pair BFS,460 rectangular/singular forward/inverse cases,336 extra-baseline mutations,neutral-readout/odd-source positive controls,both closed-word censuses,and61 exact readout-volume controls. Native census/benchmarks remain separate." + } + ] +} diff --git a/research/scalable-dirty-connectors/backend.cpp b/research/scalable-dirty-connectors/backend.cpp new file mode 100644 index 0000000000..ec5b46871b --- /dev/null +++ b/research/scalable-dirty-connectors/backend.cpp @@ -0,0 +1,902 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using Word = std::uint64_t; +using Clock = std::chrono::steady_clock; +static volatile Word timing_guard = 0; + +template static T argument(const char *text) { + const std::string_view value(text); + T result{}; + const auto [end, error] = + std::from_chars(value.data(), value.data() + value.size(), result); + if (error != std::errc{} || end != value.data() + value.size()) + throw std::runtime_error("invalid numeric argument"); + return result; +} + +enum class Kind : std::uint8_t { X, B, A }; +struct Op { + Kind kind; + std::uint16_t a; + std::uint16_t b; +}; + +struct LoadedProgram { + std::vector operations; + std::uint64_t file_bytes = 0; +}; + +struct Programs { + std::vector star; + std::vector baseline; + std::uint64_t star_file_bytes = 0; + std::uint64_t baseline_file_bytes = 0; +}; + +struct Stats { + std::uint64_t dense_leaves = 0; + std::uint64_t matrix_word_reads = 0; + std::uint64_t source_word_reads = 0; + std::uint64_t and_words = 0; + std::uint64_t popcounts = 0; + std::uint64_t parity_xors = 0; + std::uint64_t dense_target_word_reads = 0; + std::uint64_t dense_target_word_writes = 0; + std::uint64_t echo_internal_nodes = 0; + std::uint64_t source_calls = 0; + std::uint64_t sparse_calls = 0; + std::uint64_t sparse_support_index_reads = 0; + std::uint64_t sparse_source_word_reads = 0; + std::uint64_t sparse_target_word_reads = 0; + std::uint64_t sparse_target_word_writes = 0; + std::uint64_t sparse_xors = 0; + std::uint64_t shears = 0; + std::uint64_t shear_word_reads = 0; + std::uint64_t shear_word_writes = 0; + std::uint64_t shear_xors = 0; +}; + +struct Matrix { + int n = 0; + int words = 0; + std::vector cells; +}; + +struct Support { + std::vector left; + std::vector right; +}; + +struct Fixture { + int n = 0; + int masks = 0; + int roots = 0; + int words = 0; + int scratch_count = 3; + int root_base = 0; + int scratch_base = 0; + std::vector> b_factors; + std::vector a_support; + const Fixture *maps_from = nullptr; + std::vector rows; + std::vector initial_rows; +}; + +static const std::vector> &b_maps(const Fixture &f) { + return f.maps_from ? b_maps(*f.maps_from) : f.b_factors; +} + +static const std::vector &a_maps(const Fixture &f) { + return f.maps_from ? a_maps(*f.maps_from) : f.a_support; +} + +static LoadedProgram read_program(const std::string &path) { + std::ifstream input(path); + if (!input) + throw std::runtime_error("cannot read " + path); + LoadedProgram result; + std::string line; + std::size_t line_number = 0; + while (std::getline(input, line)) { + ++line_number; + result.file_bytes += line.size() + 1; + std::istringstream row(line); + std::string tag; + std::string extra; + long long a = -1; + long long b = -1; + if (!(row >> tag >> a >> b) || (row >> extra)) { + throw std::runtime_error(path + ": malformed operation at line " + + std::to_string(line_number)); + } + if (a < 0 || a > 65535 || b < 0 || b > 65535) { + throw std::runtime_error( + path + ": operation argument out of uint16 range at line " + + std::to_string(line_number)); + } + Kind kind; + if (tag == "X") + kind = Kind::X; + else if (tag == "B") + kind = Kind::B; + else if (tag == "A") + kind = Kind::A; + else + throw std::runtime_error(path + ": unknown operation tag at line " + + std::to_string(line_number)); + result.operations.push_back( + Op{kind, static_cast(a), static_cast(b)}); + } + if (!input.eof()) + throw std::runtime_error("I/O error while reading " + path); + result.file_bytes = std::filesystem::file_size(path); + return result; +} + +static void count_program(const std::vector &p, std::uint64_t &xs, + std::uint64_t &bs, std::uint64_t &as) { + xs = bs = as = 0; + for (const Op &op : p) { + if (op.kind == Kind::X) + ++xs; + else if (op.kind == Kind::B) + ++bs; + else + ++as; + } +} + +static Word *row_ptr(Fixture &f, int row) { + return f.rows.data() + static_cast(row) * f.words; +} +static const Word *row_ptr(const Fixture &f, int row) { + return f.rows.data() + static_cast(row) * f.words; +} + +static void dense_add(const Matrix &matrix, const Word *src, Word *dst, + Stats *stats) { + const int L = matrix.n; + const int W = matrix.words; + const Word *mrow = matrix.cells.data(); + if (stats) + ++stats->dense_leaves; + for (int base = 0; base < L; base += 64) { + Word result_word = 0; + for (int bit = 0; bit < 64; ++bit) { + const int i = base + bit; + unsigned parity = 0; + for (int w = 0; w < W; ++w) { + const Word coefficient_word = mrow[static_cast(i) * W + w]; + const Word source_word = src[w]; + parity ^= static_cast( + std::popcount(coefficient_word & source_word) & 1u); + if (stats) { + ++stats->matrix_word_reads; + ++stats->source_word_reads; + ++stats->and_words; + ++stats->popcounts; + ++stats->parity_xors; + } + } + result_word |= static_cast(parity) << bit; + } + const int target_word = base / 64; + dst[target_word] ^= result_word; + if (stats) { + ++stats->dense_target_word_reads; + ++stats->dense_target_word_writes; + } + } +} + +static void echo(Fixture &f, int source_row, int target_row, int source, int lo, + int hi, int depth, Stats *stats) { + if (hi - lo == 1) { + dense_add(b_maps(f)[source][lo], row_ptr(f, source_row), + row_ptr(f, target_row), stats); + return; + } + if (stats) + ++stats->echo_internal_nodes; + const int mid = lo + (hi - lo) / 2; + const int scratch_row = f.scratch_base + depth; + // The left factor interval is applied first; the right interval follows it. + echo(f, source_row, scratch_row, source, lo, mid, depth + 1, stats); + echo(f, scratch_row, target_row, source, mid, hi, depth + 1, stats); + echo(f, source_row, scratch_row, source, lo, mid, depth + 1, stats); + echo(f, scratch_row, target_row, source, mid, hi, depth + 1, stats); +} + +static bool bit_at(const Word *row, int bit) { + return ((row[bit / 64] >> (bit % 64)) & 1u) != 0; +} + +static void sparse_add(const Support &support, const Word *src, Word *dst, + int L, Stats *stats) { + if (stats) + ++stats->sparse_calls; + for (int base = 0; base < L; base += 64) { + Word contribution = 0; + for (int bit = 0; bit < 64; ++bit) { + const int i = base + bit; + const int p = support.left[i]; + const int q = support.right[i]; + const bool value = bit_at(src, p) ^ bit_at(src, q); + contribution |= static_cast(value) << bit; + if (stats) { + stats->sparse_support_index_reads += 2; + stats->sparse_source_word_reads += 2; + ++stats->sparse_xors; + } + } + const int target_word = base / 64; + dst[target_word] ^= contribution; + if (stats) { + ++stats->sparse_target_word_reads; + ++stats->sparse_target_word_writes; + ++stats->sparse_xors; + } + } +} + +static void row_xor(Word *dst, const Word *src, int W, Stats *stats) { + if (stats) + ++stats->shears; + for (int w = 0; w < W; ++w) { + dst[w] ^= src[w]; + if (stats) { + stats->shear_word_reads += 2; + ++stats->shear_word_writes; + ++stats->shear_xors; + } + } +} + +static void run_program(Fixture &f, const std::vector &program, + Stats *stats) { + for (const Op &op : program) { + if (op.kind == Kind::X) { + if (op.a >= f.roots || op.b >= f.roots) + throw std::runtime_error("bad shear root index"); + row_xor(row_ptr(f, f.root_base + op.a), row_ptr(f, f.root_base + op.b), + f.words, stats); + } else if (op.kind == Kind::B) { + if (op.a >= f.n || op.b >= f.roots) + throw std::runtime_error("bad B source/root index"); + if (stats) + ++stats->source_calls; + echo(f, op.a, f.root_base + op.b, op.a, 0, 5, 0, stats); + } else { + if (op.a == 0 || op.a > f.masks || op.b >= f.roots) + throw std::runtime_error("bad A mask/root index"); + sparse_add(a_maps(f)[op.a], row_ptr(f, f.root_base + op.b), + row_ptr(f, f.n + (op.a - 1)), f.words * 64, stats); + } + } +} + +static Matrix random_matrix(int L, std::mt19937_64 &rng) { + Matrix m; + m.n = L; + m.words = L / 64; + m.cells.resize(static_cast(L) * m.words); + for (Word &w : m.cells) + w = rng(); + return m; +} + +static void randomize_row(Word *row, int W, std::mt19937_64 &rng) { + for (int i = 0; i < W; ++i) + row[i] = rng(); +} + +static std::vector direct_matvec(const Matrix &m, + const std::vector &src) { + std::vector dst(m.words, 0); + for (int i = 0; i < m.n; ++i) { + unsigned parity = 0; + for (int w = 0; w < m.words; ++w) { + parity ^= static_cast( + std::popcount(m.cells[static_cast(i) * m.words + w] & + src[w]) & + 1u); + } + dst[i / 64] ^= static_cast(parity) << (i % 64); + } + return dst; +} + +static std::vector direct_b(const Fixture &f, int source, + const std::vector &input) { + std::vector current = input; + for (const Matrix &factor : b_maps(f)[source]) + current = direct_matvec(factor, current); + return current; +} + +static std::vector direct_a(const Fixture &f, int mask, + const std::vector &input) { + std::vector result(f.words, 0); + const Support &support = a_maps(f)[mask]; + for (int i = 0; i < f.words * 64; ++i) { + const bool value = bit_at(input.data(), support.left[i]) ^ + bit_at(input.data(), support.right[i]); + result[i / 64] ^= static_cast(value) << (i % 64); + } + return result; +} + +static void xor_into(std::vector &dst, const std::vector &src) { + for (std::size_t i = 0; i < dst.size(); ++i) + dst[i] ^= src[i]; +} + +static std::vector copy_row(const Fixture &f, int row) { + const Word *ptr = row_ptr(f, row); + return std::vector(ptr, ptr + f.words); +} + +static bool equal_row(const Fixture &f, int row, + const std::vector &expected) { + const Word *ptr = row_ptr(f, row); + return std::equal(ptr, ptr + f.words, expected.begin(), expected.end()); +} + +static void check_b_call(Fixture &f, int source, int root, + std::uint64_t &checked) { + std::vector> roots_before; + for (int r = 0; r < f.roots; ++r) + roots_before.push_back(copy_row(f, f.root_base + r)); + std::vector> scratch_before; + for (int r = 0; r < f.scratch_count; ++r) + scratch_before.push_back(copy_row(f, f.scratch_base + r)); + const std::vector source_before = copy_row(f, source); + const std::vector contribution = direct_b(f, source, source_before); + std::vector target_expected = roots_before[root]; + xor_into(target_expected, contribution); + echo(f, source, f.root_base + root, source, 0, 5, 0, nullptr); + if (!equal_row(f, f.root_base + root, target_expected)) + throw std::runtime_error("B echo output mismatch"); + for (int r = 0; r < f.roots; ++r) { + if (r != root && !equal_row(f, f.root_base + r, roots_before[r])) + throw std::runtime_error("B echo changed another root"); + } + if (!equal_row(f, source, source_before)) + throw std::runtime_error("B echo changed source"); + for (int r = 0; r < f.scratch_count; ++r) { + if (!equal_row(f, f.scratch_base + r, scratch_before[r])) + throw std::runtime_error("B echo failed private scratch restoration"); + } + ++checked; +} + +static void check_a_call(Fixture &f, int mask, int root, + std::uint64_t &checked) { + const std::vector input = copy_row(f, f.root_base + root); + const std::vector output_before = copy_row(f, f.n + mask - 1); + std::vector expected = output_before; + xor_into(expected, direct_a(f, mask, input)); + std::vector> roots_before; + for (int r = 0; r < f.roots; ++r) + roots_before.push_back(copy_row(f, f.root_base + r)); + sparse_add(a_maps(f)[mask], row_ptr(f, f.root_base + root), + row_ptr(f, f.n + mask - 1), f.words * 64, nullptr); + if (!equal_row(f, f.n + mask - 1, expected)) + throw std::runtime_error("A sparse output mismatch"); + for (int r = 0; r < f.roots; ++r) { + if (!equal_row(f, f.root_base + r, roots_before[r])) + throw std::runtime_error("A changed connector roots"); + } + ++checked; +} + +static void validate_program(Fixture &f, const std::vector &program, + std::uint64_t &checked_calls) { + f.rows = f.initial_rows; + for (const Op &op : program) { + if (op.kind == Kind::X) { + row_xor(row_ptr(f, f.root_base + op.a), row_ptr(f, f.root_base + op.b), + f.words, nullptr); + } else if (op.kind == Kind::B) { + check_b_call(f, op.a, op.b, checked_calls); + } else { + check_a_call(f, op.a, op.b, checked_calls); + } + } + for (int r = 0; r < f.n; ++r) { + if (!std::equal(row_ptr(f, r), row_ptr(f, r) + f.words, + f.initial_rows.begin() + + static_cast(r) * f.words)) { + throw std::runtime_error("program changed source row"); + } + } + for (int r = 0; r < f.roots; ++r) { + if (!std::equal(row_ptr(f, f.root_base + r), + row_ptr(f, f.root_base + r) + f.words, + f.initial_rows.begin() + + static_cast(f.root_base + r) * f.words)) { + throw std::runtime_error("program failed dirty-root restoration"); + } + } + for (int r = 0; r < f.scratch_count; ++r) { + if (!std::equal(row_ptr(f, f.scratch_base + r), + row_ptr(f, f.scratch_base + r) + f.words, + f.initial_rows.begin() + + static_cast(f.scratch_base + r) * + f.words)) { + throw std::runtime_error( + "program failed dirty-private-scratch restoration"); + } + } + + std::vector> expected(f.masks + 1, + std::vector(f.words, 0)); + for (int mask = 1; mask <= f.masks; ++mask) { + std::vector sum(f.words, 0); + for (int j = 0; j < f.n; ++j) { + if ((mask >> j) & 1) { + const Word *source_ptr = + f.initial_rows.data() + static_cast(j) * f.words; + std::vector source(source_ptr, source_ptr + f.words); + xor_into(sum, direct_b(f, j, source)); + } + } + expected[mask] = direct_a(f, mask, sum); + xor_into(expected[mask], + std::vector( + f.initial_rows.begin() + + static_cast(f.n + mask - 1) * f.words, + f.initial_rows.begin() + + static_cast(f.n + mask) * f.words)); + } + for (int mask = 1; mask <= f.masks; ++mask) { + if (!equal_row(f, f.n + mask - 1, expected[mask])) { + throw std::runtime_error("complete program target mismatch at mask " + + std::to_string(mask)); + } + } +} + +static void validate_formal(const std::vector &program, int n, int roots, + const std::string &name, + bool exactly_twice_per_source, + bool paired_readouts = true) { + const int formal_bits = roots + n; + std::vector root_rows(roots); + for (int r = 0; r < roots; ++r) + root_rows[r] = 1u << r; + std::vector>> observations( + (1 << n)); + std::vector> source_ports(n); + std::uint64_t xs = 0, bs = 0, as = 0; + for (const Op &op : program) { + if (op.kind == Kind::X) { + if (op.a >= roots || op.b >= roots) + throw std::runtime_error(name + ": invalid X root"); + root_rows[op.a] ^= root_rows[op.b]; + ++xs; + } else if (op.kind == Kind::B) { + if (op.a >= n || op.b >= roots) + throw std::runtime_error(name + ": invalid B source/port"); + root_rows[op.b] ^= 1u << (roots + op.a); + source_ports[op.a].push_back(op.b); + ++bs; + } else { + if (op.a == 0 || op.a >= (1u << n) || op.b >= roots) + throw std::runtime_error(name + ": invalid A mask/port"); + observations[op.a].push_back( + {root_rows[op.b], static_cast(op.b)}); + ++as; + } + } + for (int r = 0; r < roots; ++r) { + if (root_rows[r] != (1u << r)) + throw std::runtime_error(name + ": formal dirty roots did not restore"); + } + for (int j = 0; j < n; ++j) { + if (source_ports[j].size() < 2 || + (exactly_twice_per_source && source_ports[j].size() != 2) || + !std::all_of(source_ports[j].begin(), source_ports[j].end(), + [&](int port) { return port == source_ports[j][0]; })) { + throw std::runtime_error( + name + ": source port schedule did not cancel the dirty root"); + } + } + for (int mask = 1; mask < (1 << n); ++mask) { + const auto &reads = observations[mask]; + if (reads.size() < 2 || reads.size() % 2 != 0 || + (paired_readouts && reads.size() != 2)) + throw std::runtime_error(name + ": invalid readout incidence"); + std::uint32_t contribution = 0; + for (const auto &[row, port] : reads) { + (void)port; + contribution ^= row; + } + if (contribution != (static_cast(mask) << roots)) + throw std::runtime_error(name + + ": dirty/readout source polynomial mismatch"); + } + if (formal_bits > 31) + throw std::runtime_error(name + ": formal basis too wide"); + std::cout << "FORMAL " << name << " PASS X=" << xs << " B=" << bs + << " A=" << as << '\n'; +} + +static Fixture make_fixture(int n, int L, std::uint64_t seed, + bool make_maps = true) { + if (L <= 0 || L % 64 != 0) + throw std::runtime_error("L must be a positive multiple of 64"); + Fixture f; + f.n = n; + f.masks = (1 << n) - 1; + f.roots = n - 3; + f.words = L / 64; + f.root_base = n + f.masks; + f.scratch_base = f.root_base + f.roots; + const int row_count = f.scratch_base + f.scratch_count; + f.rows.resize(static_cast(row_count) * f.words); + f.initial_rows.resize(f.rows.size()); + std::mt19937_64 rng(seed); + if (make_maps) { + for (int j = 0; j < n; ++j) { + std::vector factors; + for (int d = 0; d < 5; ++d) + factors.push_back(random_matrix(L, rng)); + f.b_factors.push_back(std::move(factors)); + } + f.a_support.resize(f.masks + 1); + for (int mask = 1; mask <= f.masks; ++mask) { + Support s; + s.left.resize(L); + s.right.resize(L); + for (int i = 0; i < L; ++i) { + s.left[i] = static_cast((i + mask) % L); + s.right[i] = static_cast((i + 7 * mask + 1) % L); + if (s.left[i] == s.right[i]) + throw std::runtime_error("sparse A support collision"); + } + f.a_support[mask] = std::move(s); + } + } + for (int r = 0; r < row_count; ++r) + randomize_row(row_ptr(f, r), f.words, rng); + f.initial_rows = f.rows; + return f; +} + +static std::uint64_t row_words_for(int rows, int L) { + return static_cast(rows) * (L / 64); +} + +static void print_stats(const std::string &name, const Stats &s) { + std::cout << "COUNTS " << name << " dense_leaves=" << s.dense_leaves + << " matrix_word_reads=" << s.matrix_word_reads + << " source_word_reads=" << s.source_word_reads + << " and_words=" << s.and_words << " popcounts=" << s.popcounts + << " parity_xors=" << s.parity_xors + << " target_word_reads=" << s.dense_target_word_reads + << " target_word_writes=" << s.dense_target_word_writes + << " echo_internal_nodes=" << s.echo_internal_nodes + << " B_calls=" << s.source_calls << " A_calls=" << s.sparse_calls + << " A_support_index_reads=" << s.sparse_support_index_reads + << " A_source_word_reads=" << s.sparse_source_word_reads + << " A_target_word_reads=" << s.sparse_target_word_reads + << " A_target_word_writes=" << s.sparse_target_word_writes + << " A_source_plus_target_xors=" << s.sparse_xors + << " shears=" << s.shears + << " shear_word_reads=" << s.shear_word_reads + << " shear_word_writes=" << s.shear_word_writes + << " shear_xors=" << s.shear_xors << '\n'; +} + +static double time_program(Fixture &f, const std::vector &program, + int repetitions) { + const auto start = Clock::now(); + for (int i = 0; i < repetitions; ++i) + run_program(f, program, nullptr); + const auto end = Clock::now(); + // Consume the timed mutations through an observable write. This diagnostic + // scan is outside the timed interval and needs one scalar CPU work word. + Word checksum = 0; + for (Word value : f.rows) + checksum ^= value; + timing_guard = checksum; + return std::chrono::duration(end - start).count() / + repetitions; +} + +static int choose_repetitions(Fixture &f, const std::vector &p) { + const auto start = Clock::now(); + for (int i = 0; i < 3; ++i) + run_program(f, p, nullptr); + const auto end = Clock::now(); + const double elapsed = std::chrono::duration(end - start).count(); + if (elapsed <= 0.0) + return 100; + const int reps = static_cast(0.25 / (elapsed / 3.0)); + return std::clamp(reps, 10, 10000); +} + +static void print_trials(const char *name, const std::vector ×) { + std::cout << name << "=["; + for (std::size_t i = 0; i < times.size(); ++i) { + if (i) + std::cout << ','; + std::cout << times[i]; + } + std::cout << ']'; +} + +int main(int argc, char **argv) { + try { + if (argc != 6 && argc != 7) { + std::cerr + << "usage: star_backend N L path/to/star.ops path/to/baseline.ops " + " [seed]\n"; + return 2; + } + const int n = argument(argv[1]); + const int L = argument(argv[2]); + const std::string star_path = argv[3]; + const std::string baseline_path = argv[4]; + const std::string baseline_kind = argv[5]; + if (baseline_kind != "extra" && baseline_kind != "gray") + throw std::runtime_error("baseline must be extra or gray"); + const std::uint64_t seed = argc == 7 ? argument(argv[6]) + : 0x535441520000ULL + n * 1009ULL + L; + if (n != 6 && n != 8) + throw std::runtime_error("benchmark supports n=6 and n=8 only"); + if (L > 65536) + throw std::runtime_error("sparse support uses uint16 indices"); + + const auto prep_start = Clock::now(); + Fixture candidate = make_fixture(n, L, seed); + const double fixture_ms = + std::chrono::duration(Clock::now() - prep_start) + .count(); + const auto program_start = Clock::now(); + Programs programs; + LoadedProgram star_file = read_program(star_path); + LoadedProgram baseline_file = read_program(baseline_path); + programs.star = std::move(star_file.operations); + programs.baseline = std::move(baseline_file.operations); + programs.star_file_bytes = star_file.file_bytes; + programs.baseline_file_bytes = baseline_file.file_bytes; + const double program_ms = + std::chrono::duration(Clock::now() - program_start) + .count(); + + std::uint64_t xstar, bstar, astar, xbaseline, bbaseline, abaseline; + count_program(programs.star, xstar, bstar, astar); + count_program(programs.baseline, xbaseline, bbaseline, abaseline); + const int expected_star_x = 8 * ((1 << (n - 4)) - 1); + if (bstar != static_cast(2 * n) || + astar != static_cast(2 * candidate.masks) || + xstar != static_cast(expected_star_x)) { + throw std::runtime_error( + "candidate operation counts differ from star receipt formula"); + } + const int expected_baseline_b = + baseline_kind == "extra" ? 2 * n : (1 << (n / 2)) + (1 << (n - n / 2)); + const int expected_baseline_a = + baseline_kind == "extra" ? (n == 6 ? 156 : 828) : 2 * candidate.masks; + if (bbaseline != static_cast(expected_baseline_b) || + abaseline != static_cast(expected_baseline_a) || + xbaseline != 0) { + throw std::runtime_error("baseline operation counts incorrect"); + } + const auto validation_start = Clock::now(); + validate_formal(programs.star, n, n - 3, "star", true); + validate_formal(programs.baseline, n, 1, baseline_kind, + baseline_kind == "extra", baseline_kind == "gray"); + + std::uint64_t checked_star = 0, checked_baseline = 0; + candidate.roots = n - 3; + candidate.root_base = n + candidate.masks; + candidate.scratch_base = candidate.root_base + candidate.roots; + validate_program(candidate, programs.star, checked_star); + const double star_validation_ms = std::chrono::duration( + Clock::now() - validation_start) + .count(); + const auto baseline_prep_start = Clock::now(); + Fixture baseline = make_fixture(n, L, seed, false); + // Both schedules use the same resident map tables; the baseline has its own + // root/output/scratch rows but does not duplicate the expensive matrices. + baseline.maps_from = &candidate; + baseline.roots = 1; + baseline.root_base = n + baseline.masks; + baseline.scratch_base = baseline.root_base + baseline.roots; + // Candidate has more roots, so use the same source/output rows and project + // the same root 0 plus three arbitrary dirty private rows into this layout. + baseline.rows.assign(static_cast(baseline.scratch_base + + baseline.scratch_count) * + baseline.words, + 0); + baseline.initial_rows = baseline.rows; + for (int r = 0; r < n + baseline.masks; ++r) { + const Word *initial = candidate.initial_rows.data() + + static_cast(r) * candidate.words; + std::copy(initial, initial + candidate.words, row_ptr(baseline, r)); + } + const Word *initial_root = + candidate.initial_rows.data() + + static_cast(candidate.root_base) * candidate.words; + std::copy(initial_root, initial_root + candidate.words, + row_ptr(baseline, baseline.root_base)); + for (int r = 0; r < baseline.scratch_count; ++r) { + const Word *initial_scratch = + candidate.initial_rows.data() + + static_cast(candidate.scratch_base + r) * + candidate.words; + std::copy(initial_scratch, initial_scratch + candidate.words, + row_ptr(baseline, baseline.scratch_base + r)); + } + baseline.initial_rows = baseline.rows; + const double baseline_layout_ms = std::chrono::duration( + Clock::now() - baseline_prep_start) + .count(); + const auto baseline_validation_start = Clock::now(); + validate_program(baseline, programs.baseline, checked_baseline); + const double baseline_validation_ms = + std::chrono::duration(Clock::now() - + baseline_validation_start) + .count(); + + Stats star_stats, baseline_stats; + candidate.rows = candidate.initial_rows; + run_program(candidate, programs.star, &star_stats); + baseline.rows = baseline.initial_rows; + run_program(baseline, programs.baseline, &baseline_stats); + print_stats("star", star_stats); + print_stats(baseline_kind, baseline_stats); + + std::uint64_t matrix_capacity_bytes = 0; + std::uint64_t map_container_bytes = + candidate.b_factors.capacity() * sizeof(std::vector); + for (const auto &factors : candidate.b_factors) { + map_container_bytes += factors.capacity() * sizeof(Matrix); + for (const Matrix &matrix : factors) { + matrix_capacity_bytes += matrix.cells.capacity() * sizeof(Word); + } + } + std::uint64_t support_capacity_bytes = 0; + map_container_bytes += candidate.a_support.capacity() * sizeof(Support); + for (const Support &support : candidate.a_support) { + support_capacity_bytes += + (support.left.capacity() + support.right.capacity()) * + sizeof(std::uint16_t); + } + const std::uint64_t candidate_row_count = + static_cast(n + candidate.masks + (n - 3) + 3); + const std::uint64_t baseline_row_count = + static_cast(n + candidate.masks + 1 + 3); + const std::uint64_t candidate_row_bytes = + row_words_for(candidate_row_count, L) * sizeof(Word); + const std::uint64_t baseline_row_bytes = + row_words_for(baseline_row_count, L) * sizeof(Word); + const std::uint64_t total_row_bytes = + 2 * (candidate_row_bytes + + baseline_row_bytes); // working rows plus dirty-input snapshots + const std::uint64_t row_capacity_bytes = + (candidate.rows.capacity() + candidate.initial_rows.capacity() + + baseline.rows.capacity() + baseline.initial_rows.capacity()) * + sizeof(Word); + const std::uint64_t candidate_program_used_bytes = + programs.star.size() * sizeof(Op); + const std::uint64_t baseline_program_used_bytes = + programs.baseline.size() * sizeof(Op); + const std::uint64_t candidate_program_bytes = + programs.star.capacity() * sizeof(Op); + const std::uint64_t baseline_program_bytes = + programs.baseline.capacity() * sizeof(Op); + std::cout << "RECEIPT n=" << n << " L=" << L << " roots=" << candidate.roots + << " B_star=" << bstar << " B_baseline=" << bbaseline + << " source_saving_pct=" << std::fixed << std::setprecision(1) + << (100.0 * (static_cast(bbaseline - bstar) / bbaseline)) + << " baseline_kind=" << baseline_kind << " A_star=" << astar + << " A_baseline=" << abaseline << " transfers=" << xstar + << " dense_leaves_star=" << star_stats.dense_leaves + << " dense_leaves_baseline=" << baseline_stats.dense_leaves + << " checked_child_calls_star=" << checked_star + << " checked_child_calls_baseline=" << checked_baseline + << " program_dispatches_star=" << programs.star.size() + << " program_dispatches_baseline=" << programs.baseline.size() + << " matrix_vector_capacity_bytes_shared=" + << matrix_capacity_bytes + << " sparse_index_capacity_bytes=" << support_capacity_bytes + << " map_container_capacity_bytes=" << map_container_bytes + << " map_capacity_bytes_shared=" + << (matrix_capacity_bytes + support_capacity_bytes + + map_container_bytes) + << " rows_star_bytes=" << candidate_row_bytes + << " rows_baseline_bytes=" << baseline_row_bytes + << " row_snapshot_bytes_star=" << candidate_row_bytes + << " row_snapshot_bytes_baseline=" << baseline_row_bytes + << " total_resident_row_payload_bytes=" << total_row_bytes + << " total_resident_row_capacity_bytes=" << row_capacity_bytes + << " program_star_used_bytes=" << candidate_program_used_bytes + << " program_baseline_used_bytes=" << baseline_program_used_bytes + << " program_star_capacity_bytes=" << candidate_program_bytes + << " program_baseline_capacity_bytes=" << baseline_program_bytes + << " total_program_capacity_bytes=" + << (candidate_program_bytes + baseline_program_bytes) + << " star_event_file_bytes=" << programs.star_file_bytes + << " baseline_event_file_bytes=" << programs.baseline_file_bytes + << " total_payload_capacity_bytes_estimate=" + << (matrix_capacity_bytes + support_capacity_bytes + + map_container_bytes + row_capacity_bytes + + candidate_program_bytes + baseline_program_bytes) + << " sizeof_op=" << sizeof(Op) + << " fixture_generation_ms=" << fixture_ms + << " program_compile_parse_ms=" << program_ms + << " baseline_layout_ms=" << baseline_layout_ms + << " star_validation_ms=" << star_validation_ms + << " baseline_validation_ms=" << baseline_validation_ms + << " dense_cpu_clean_accumulator_words=1" + << " B_depth=5 dense_leaves_per_B=28 echo_internal_nodes_per_B=9" + << " private_scratch_rows_each=3 private_scratch_bits_each=" + << (3 * L) + << " private_scratch_words_each=" << (3 * candidate.words) + << '\n'; + + // Warm each schedule once, then choose enough repetitions for a measurable + // resident-memory interval without turning this into a repository build. + candidate.rows = candidate.initial_rows; + baseline.rows = baseline.initial_rows; + const int star_reps = choose_repetitions(candidate, programs.star); + const int baseline_reps = choose_repetitions(baseline, programs.baseline); + std::vector star_times, baseline_times; + for (int trial = 0; trial < 7; ++trial) { + candidate.rows = candidate.initial_rows; + baseline.rows = baseline.initial_rows; + if ((trial & 1) == 0) { + star_times.push_back(time_program(candidate, programs.star, star_reps)); + baseline_times.push_back( + time_program(baseline, programs.baseline, baseline_reps)); + } else { + baseline_times.push_back( + time_program(baseline, programs.baseline, baseline_reps)); + star_times.push_back(time_program(candidate, programs.star, star_reps)); + } + } + std::vector star_sorted = star_times; + std::vector baseline_sorted = baseline_times; + std::sort(star_sorted.begin(), star_sorted.end()); + std::sort(baseline_sorted.begin(), baseline_sorted.end()); + const double star_us = star_sorted[star_sorted.size() / 2]; + const double baseline_us = baseline_sorted[baseline_sorted.size() / 2]; + std::cout << "TIMING resident_cpu_median_us star=" << star_us + << " baseline=" << baseline_us + << " baseline_kind=" << baseline_kind + << " ratio_baseline_over_star=" << std::setprecision(3) + << (baseline_us / star_us) << std::setprecision(1) + << " trials=7 star_repetitions=" << star_reps + << " baseline_repetitions=" << baseline_reps + << " includes_program_dispatch=true includes_data_reset=false" + << " order=star,baseline;baseline,star;star,baseline;baseline," + "star;star,baseline;" + "baseline,star;star,baseline raw_trials "; + print_trials("star", star_times); + std::cout << ' '; + print_trials("baseline", baseline_times); + std::cout << " excludes_fixture_and_program_preparation=true\n"; + return 0; + } catch (const std::exception &e) { + std::cerr << "FAIL " << e.what() << '\n'; + return 1; + } +} diff --git a/research/scalable-dirty-connectors/benchmark.py b/research/scalable-dirty-connectors/benchmark.py new file mode 100644 index 0000000000..b5a0d5804a --- /dev/null +++ b/research/scalable-dirty-connectors/benchmark.py @@ -0,0 +1,75 @@ +"""Generate connector programs and run them through the packed C++ backend.""" + +import argparse +import importlib.util +from pathlib import Path +import subprocess +import sys +import tempfile +from time import perf_counter + + +HERE = Path(__file__).resolve().parent +CONNECTOR = HERE / "connector.py" + + +def load_connector(): + if not CONNECTOR.is_file(): + raise FileNotFoundError(f"connector source not found: {CONNECTOR}") + spec = importlib.util.spec_from_file_location("scalable_dirty_connectors", CONNECTOR) + if spec is None or spec.loader is None: + raise RuntimeError(f"cannot load connector source: {CONNECTOR}") + module = importlib.util.module_from_spec(spec) + sys.modules[spec.name] = module + spec.loader.exec_module(module) + return module + + +def serialize(operations): + return "".join(f"{kind} {a} {b}\n" for kind, a, b in operations) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("n", type=int, choices=(6, 8), help="number of source rows") + parser.add_argument("length", type=int, help="row width in bits, a positive multiple of 64") + parser.add_argument("backend", type=Path, help="path to a compiled backend.cpp executable") + parser.add_argument("--seed", type=int, help="deterministic fixture seed") + parser.add_argument("--baseline", choices=("extra", "gray"), default="extra", + help="one-root comparator; extra keeps the same minimum B count") + args = parser.parse_args() + if args.length <= 0 or args.length % 64 or args.length > 65536: + parser.error("row width must be a positive multiple of 64, at most 65536") + backend = args.backend.expanduser().resolve() + if not backend.is_file(): + parser.error(f"backend executable does not exist: {backend}") + + started = perf_counter() + connector = load_connector() + star = connector.star(args.n) + baseline = (connector.extra_readout_baseline(args.n) if args.baseline == "extra" + else connector.gray_baseline(args.n)) + star_payload = serialize(star.operations) + baseline_payload = serialize(baseline.operations) + with tempfile.TemporaryDirectory(prefix="scalable-dirty-connectors-") as temp_dir: + temp = Path(temp_dir) + star_path = temp / f"star{args.n}.ops" + baseline_path = temp / f"{args.baseline}{args.n}.ops" + star_path.write_text(star_payload) + baseline_path.write_text(baseline_payload) + elapsed_ms = (perf_counter() - started) * 1000 + print( + f"PROGRAM_PREP n={args.n} elapsed_ms={elapsed_ms:.3f} " + f"baseline={args.baseline} star_ops={len(star.operations)} baseline_ops={len(baseline.operations)} " + f"star_event_file_bytes={len(star_payload)} " + f"baseline_event_file_bytes={len(baseline_payload)}", + flush=True, + ) + command = [str(backend), str(args.n), str(args.length), str(star_path), str(baseline_path), args.baseline] + if args.seed is not None: + command.append(str(args.seed)) + subprocess.run(command, check=True) + + +if __name__ == "__main__": + main() diff --git a/research/scalable-dirty-connectors/connector.py b/research/scalable-dirty-connectors/connector.py new file mode 100644 index 0000000000..a927f6978d --- /dev/null +++ b/research/scalable-dirty-connectors/connector.py @@ -0,0 +1,154 @@ +"""Literal universal dirty-row connectors. Apache-2.0; AI assistance disclosed. + +An operation (kind, label, port) is B_label into port, A_label from port, +or, for kind X, row[label] ^= row[port]. No observation or frame change is free. +""" + +from dataclasses import dataclass + + +@dataclass(frozen=True) +class Program: + sources: int + roots: int + operations: tuple[tuple[str, int, int], ...] + + +def _source_count(n): + if type(n) is not int or n < 4: + raise ValueError("source count must be an integer >= 4") + + +def star(n): + """Use n-3 dirty roots and exactly two calls to every B and A. + + The emitted program has exponential size because it has 2**n-1 outputs. + """ + _source_count(n) + dimensions = n - 4 + gray = tuple(i ^ (i >> 1) for i in range(1 << dimensions)) + operations = [] + frame = 0 + + def move(destination): + nonlocal frame + changed = frame ^ destination + for bit in range(dimensions): + if changed & (1 << bit): + operations.append(("X", 0, bit + 1)) + frame ^= 1 << bit + + def tour(reverse, phase, point): + for g in reversed(gray) if reverse else gray: + move(g) + extra = frame + for other in range(4): + first, second = (point, other) if phase == 0 else (other, point) + mask = first | (second << 2) | (extra << 4) + if mask: + operations.append(("A", mask, 0)) + + for t, point in enumerate((0, 1, 3, 2)): + tour(bool(t % 2), 0, point) + operations.append(("B", (0, 1, 0, 1)[t], 0)) + for j in range(4, n): + operations.append(("B", j, j - 3)) + for t, point in enumerate((0, 1, 3, 2)): + tour(bool(t % 2), 1, point) + operations.append(("B", (2, 3, 2, 3)[t], 0)) + for j in range(4, n): + operations.append(("B", j, j - 3)) + return Program(n, n - 3, tuple(operations)) + + +def gray_baseline(n): + """PR1185's two closed Gray cycles, with explicitly scheduled readouts.""" + _source_count(n) + split = n // 2 + sizes = (split, n - split) + operations = [] + for phase, size in enumerate(sizes): + gray = tuple(i ^ (i >> 1) for i in range(1 << size)) + for t, point in enumerate(gray): + for other in range(1 << sizes[1 - phase]): + first, second = (point, other) if phase == 0 else (other, point) + mask = first | (second << split) + if mask: + operations.append(("A", mask, 0)) + changed = point ^ gray[(t + 1) % len(gray)] + label = changed.bit_length() - 1 + (split if phase else 0) + operations.append(("B", label, 0)) + return Program(n, 1, tuple(operations)) + + +def extra_readout_baseline(n): + """One root, two B calls per source, minimum even readouts on this word. + + PR943/1185 permit extra readouts instead of extra B calls. The interleave + word was supplied by the subsequent independent review. No global word + optimality is assumed here. A 0/1 subset DP minimizes readout cardinality + for each target on this fixed word, including cancellation of dirty roots. + """ + _source_count(n) + word = [0, 1] + [j for i in range(2, n) for j in (i, i - 2)] + [n - 2, n - 1] + points = [0] + for j in word: + points.append(points[-1] ^ (1 << j)) + # State index is (source mask << 1) | readout-count parity. Each boundary + # can be selected once: selecting it twice cancels and cannot be minimal. + unreachable = len(points) + 1 + cost = [unreachable] * (1 << (n + 1)) + selected = [0] * len(cost) + cost[0] = 0 + for boundary, point in enumerate(points): + old_cost, old_selected = cost, selected + cost, selected = old_cost[:], old_selected[:] + offset = (point << 1) | 1 + for state, count in enumerate(old_cost): + destination = state ^ offset + if count + 1 < cost[destination]: + cost[destination] = count + 1 + selected[destination] = old_selected[state] | (1 << boundary) + reads = [[] for _ in points] + for mask in range(1, 1 << n): + if cost[mask << 1] == unreachable: + raise ValueError("source-prefix span does not cover target") + for boundary in range(len(points)): + if selected[mask << 1] & (1 << boundary): + reads[boundary].append(("A", mask, 0)) + operations = [] + for boundary, calls in enumerate(reads): + operations.extend(calls) + if boundary < len(word): + operations.append(("B", word[boundary], 0)) + return Program(n, 1, tuple(operations)) + + +def fixed_port_five(): + """Eight paid transfers; every B and A uses physical row zero.""" + skeleton = ( + ("X", 1, 0), ("B", 0, 0), ("X", 1, 0), ("X", 0, 1), + ("B", 1, 0), ("X", 0, 1), ("B", 2, 0), ("B", 3, 0), + ("X", 1, 0), ("B", 0, 0), ("X", 1, 0), ("X", 0, 1), + ("B", 4, 0), ("X", 0, 1), ("B", 3, 0), ("B", 1, 0), + ("B", 4, 0), ("B", 2, 0), + ) + # Literal boundary pairs from physical replay; they are not computed using + # the verifier and can be checked independently by its row interpreter. + pairs = ( + (0, 2), (2, 6), (0, 6), (0, 17), (2, 17), (2, 7), (0, 7), + (7, 8), (7, 10), (10, 17), (8, 17), (5, 12), (6, 10), + (0, 10), (0, 8), (10, 14), (7, 15), (15, 17), (7, 16), + (0, 16), (2, 16), (0, 15), (2, 15), (10, 15), (7, 14), + (10, 16), (8, 16), (5, 13), (6, 14), (0, 14), (2, 14), + ) + readouts = [[] for _ in range(len(skeleton) + 1)] + for mask, pair in enumerate(pairs, 1): + for boundary in pair: + readouts[boundary].append(("A", mask, 0)) + operations = [] + for boundary, calls in enumerate(readouts): + operations.extend(calls) + if boundary < len(skeleton): + operations.append(skeleton[boundary]) + return Program(5, 2, tuple(operations)) diff --git a/research/scalable-dirty-connectors/fixed_port_census.cpp b/research/scalable-dirty-connectors/fixed_port_census.cpp new file mode 100644 index 0000000000..3e9c982bd8 --- /dev/null +++ b/research/scalable-dirty-connectors/fixed_port_census.cpp @@ -0,0 +1,389 @@ +// Fixed-port two-root connector census. Apache-2.0. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +constexpr int kSources = 5; +constexpr int kBCalls = 2 * kSources; +constexpr int kMaxTransfers = 8; +constexpr int kCanonicalPairings = 945; + +struct Event { + int kind; // 0: B source call; 1: S01; 2: S10 +}; + +struct Boundary { + int row0; + int source_mask; +}; + +int transfers = 0; +int event_count = 0; +long long identity_words = 0; +long long frame_patterns = 0; +long long legal_schedules = 0; +array coverage_hist{}; +int best_coverage = -1; +uint32_t best_cover = 0; +vector best_directions; +vector best_slots; +array best_word{}; +array best_axes{}; +vector events; +array axes_by_call{}; +array pair_word{}; + +bool identity_word(const vector &directions) { + int row0 = 1, row1 = 2; + for (int direction : directions) { + if (direction == 0) + row0 ^= row1; // S01: z0 += z1 + else + row1 ^= row0; // S10: z1 += z0 + } + return row0 == 1 && row1 == 2; +} + +int fixed_port_axis(int row0, int row1) { + for (int axis = 1; axis <= 3; ++axis) { + const int first = popcount(static_cast(row0 & axis)) & 1; + const int second = popcount(static_cast(row1 & axis)) & 1; + if (first == 1 && second == 0) + return axis; + } + abort(); // The current two-row frame is invertible. +} + +int project_mask(int row0, const array &source_state) { + int mask = 0; + for (int source = 0; source < kSources; ++source) + if (popcount(static_cast(row0 & source_state[source])) & 1) + mask |= 1 << source; + return mask; +} + +uint32_t xor_translate(uint32_t points, int offset) { + static constexpr uint32_t zero_masks[5] = { + 0x55555555u, 0x33333333u, 0x0f0f0f0fu, 0x00ff00ffu, 0x0000ffffu}; + for (int bit = 0; bit < kSources; ++bit) { + if ((offset & (1 << bit)) == 0) + continue; + const int distance = 1 << bit; + const uint32_t low = zero_masks[bit]; + points = ((points & low) << distance) | ((points & ~low) >> distance); + } + return points; +} + +uint32_t difference_cover(const array &points) { + uint32_t cover = 0; + for (int row0 = 1; row0 <= 3; ++row0) { + uint32_t offsets = points[row0]; + while (offsets != 0) { + const int offset = countr_zero(offsets); + offsets &= offsets - 1; + cover |= xor_translate(points[row0], offset); + } + } + return cover; +} + +void evaluate_pair_word(const vector &directions, + const vector &slots) { + array source_axes{}; + array source_state{}; + for (int call = 0; call < kBCalls; ++call) { + const int label = pair_word[call]; + if (source_axes[label] == 0) + source_axes[label] = axes_by_call[call]; + else if (source_axes[label] != axes_by_call[call]) + abort(); // Pair generation only joins calls with equal axes. + } + + int row0 = 1, row1 = 2, source_call = 0; + array points{}; + auto record = [&]() { + points[row0] |= uint32_t{1} << project_mask(row0, source_state); + }; + record(); + for (const Event &event : events) { + if (event.kind == 0) { + const int label = pair_word[source_call]; + source_state[label] ^= source_axes[label]; + ++source_call; + } else if (event.kind == 1) { + row0 ^= row1; + } else { + row1 ^= row0; + } + record(); + } + if (source_call != kBCalls || row0 != 1 || row1 != 2 || + any_of(source_state.begin(), source_state.end(), + [](int value) { return value != 0; })) + abort(); + + const uint32_t cover = difference_cover(points); + const int size = popcount(cover); + ++coverage_hist[size]; + ++legal_schedules; + if (size > best_coverage) { + best_coverage = size; + best_cover = cover; + best_directions = directions; + best_slots = slots; + best_word = pair_word; + best_axes = source_axes; + } +} + +void pair_calls_by_axis(int first_unpaired, int next_label, + const vector &directions, + const vector &slots) { + int first = first_unpaired; + while (first < kBCalls && pair_word[first] != -1) + ++first; + if (first == kBCalls) { + evaluate_pair_word(directions, slots); + return; + } + + pair_word[first] = next_label; + for (int partner = first + 1; partner < kBCalls; ++partner) { + if (pair_word[partner] != -1 || + axes_by_call[first] != axes_by_call[partner]) + continue; + pair_word[partner] = next_label; + pair_calls_by_axis(first + 1, next_label + 1, directions, slots); + pair_word[partner] = -1; + } + pair_word[first] = -1; +} + +void visit_frame(const vector &directions, const vector &slots) { + ++frame_patterns; + events.clear(); + events.reserve(event_count); + int row0 = 1, row1 = 2, slot_index = 0, source_call = 0; + for (int time = 0; time < event_count; ++time) { + if (slot_index < transfers && slots[slot_index] == time) { + const int direction = directions[slot_index++]; + events.push_back({direction + 1}); + if (direction == 0) + row0 ^= row1; + else + row1 ^= row0; + } else { + axes_by_call[source_call++] = fixed_port_axis(row0, row1); + events.push_back({0}); + } + } + if (slot_index != transfers || source_call != kBCalls || row0 != 1 || + row1 != 2) + abort(); + + pair_word.fill(-1); + pair_calls_by_axis(0, 0, directions, slots); +} + +void choose_slots(int next, vector &slots, const vector &directions) { + if (static_cast(slots.size()) == transfers) { + visit_frame(directions, slots); + return; + } + const int have = static_cast(slots.size()); + for (int time = next; time <= event_count - (transfers - have); ++time) { + slots.push_back(time); + choose_slots(time + 1, slots, directions); + slots.pop_back(); + } +} + +void run_exact_census() { + event_count = kBCalls + transfers; + const int direction_words = 1 << transfers; + for (int code = 0; code < direction_words; ++code) { + vector directions(static_cast(transfers)); + for (int index = 0; index < transfers; ++index) + directions[index] = (code >> index) & 1; + if (!identity_word(directions)) + continue; + ++identity_words; + vector slots; + slots.reserve(static_cast(transfers)); + choose_slots(0, slots, directions); + } + + const unsigned long long full_schedules = + static_cast(frame_patterns) * kCanonicalPairings; + cout << "PASS_FIXED_PORT_CENSUS\n"; + cout << "transfers=" << transfers + << " identity_direction_words=" << identity_words + << " frame_patterns=" << frame_patterns + << " canonical_pairings_per_frame=" << kCanonicalPairings + << " full_schedules=" << full_schedules + << " legal_schedules=" << legal_schedules + << " max_coverage=" << best_coverage + << " universal=" << (best_coverage == 32) << "\n"; + cout << "coverage_hist"; + for (int size = 0; size <= 32; ++size) + if (coverage_hist[size] != 0) + cout << ' ' << size << ':' << coverage_hist[size]; + cout << "\n"; + cout << "best_directions"; + for (int direction : best_directions) + cout << ' ' << direction; + cout << " best_slots"; + for (int slot : best_slots) + cout << ' ' << slot; + cout << " best_word"; + for (int label : best_word) + cout << ' ' << label; + cout << " best_axes"; + for (int axis : best_axes) + cout << ' ' << axis; + cout << " best_cover=0x" << hex << best_cover << dec << "\n"; +} + +bool run_eight_transfer_positive_control() { + constexpr array directions{1, 1, 0, 0, 1, 1, 0, 0}; + constexpr array slots{0, 2, 3, 5, 8, 10, 11, 13}; + constexpr array word{0, 1, 2, 3, 0, 4, 3, 1, 4, 2}; + constexpr array expected_axes{3, 1, 1, 1, 1}; + + array source_axes{}; + array source_state{}; + vector witness_events; + witness_events.reserve(kBCalls + 8); + int row0 = 1, row1 = 2, slot_index = 0, source_call = 0; + for (int time = 0; time < kBCalls + 8; ++time) { + if (slot_index < 8 && slots[slot_index] == time) { + const int direction = directions[slot_index++]; + witness_events.push_back({direction + 1}); + if (direction == 0) + row0 ^= row1; + else + row1 ^= row0; + } else { + const int axis = fixed_port_axis(row0, row1); + const int label = word[source_call++]; + if (source_axes[label] == 0) + source_axes[label] = axis; + else if (source_axes[label] != axis) + return false; + witness_events.push_back({0}); + } + } + if (slot_index != 8 || source_call != kBCalls || row0 != 1 || row1 != 2 || + source_axes != expected_axes) + return false; + + vector boundaries; + boundaries.reserve(kBCalls + 9); + row0 = 1; + row1 = 2; + auto record = [&]() { + boundaries.push_back({row0, project_mask(row0, source_state)}); + }; + record(); + source_call = 0; + for (const Event &event : witness_events) { + if (event.kind == 0) { + const int label = word[source_call]; + source_state[label] ^= source_axes[label]; + ++source_call; + } else if (event.kind == 1) { + row0 ^= row1; + } else { + row1 ^= row0; + } + record(); + } + if (row0 != 1 || row1 != 2 || + any_of(source_state.begin(), source_state.end(), + [](int value) { return value != 0; })) + return false; + + array covered{}; + int readout_pairs = 0; + for (int target = 1; target < 32; ++target) { + bool found = false; + for (size_t first = 0; first < boundaries.size() && !found; ++first) { + for (size_t second = first + 1; second < boundaries.size(); ++second) { + if (boundaries[first].row0 == boundaries[second].row0 && + (boundaries[first].source_mask ^ boundaries[second].source_mask) == + target) { + covered[static_cast(target)] = true; + ++readout_pairs; + found = true; + break; + } + } + } + if (!found) + return false; + } + + // Exercise the actual census path, including compatible-pair generation + // and difference_cover, on this restoring eight-transfer frame. This is + // bounded to one frame, not an exhaustive eight-transfer census. + transfers = 8; + event_count = kBCalls + transfers; + visit_frame(vector(directions.begin(), directions.end()), + vector(slots.begin(), slots.end())); + if (frame_patterns != 1 || coverage_hist[32] == 0) + return false; + cout << "PASS_FIXED_PORT_EIGHT_TRANSFER_POSITIVE_CONTROL\n"; + cout << "engine_frame_patterns=" << frame_patterns + << " engine_legal_pairings=" << legal_schedules + << " engine_universal_pairings=" << coverage_hist[32] << "\n"; + cout << "transfers=8 source_calls=10 readout_pairs=" << readout_pairs + << " readout_calls=" << 2 * readout_pairs << " covered_nonzero_masks=" + << count(covered.begin() + 1, covered.end(), true) + << " roots_restored=1 sources_restored=1\n"; + cout << "directions"; + for (int direction : directions) + cout << ' ' << direction; + cout << " slots"; + for (int slot : slots) + cout << ' ' << slot; + cout << " source_word"; + for (int label : word) + cout << ' ' << label; + cout << " source_axes"; + for (int axis : source_axes) + cout << ' ' << axis; + cout << "\n"; + return true; +} + +int main(int argc, char **argv) { + if (argc != 2) { + cerr << "usage: fixed_port_census \n"; + return 2; + } + int requested = -1; + const string_view argument(argv[1]); + const auto [end, error] = + from_chars(argument.data(), argument.data() + argument.size(), requested); + if (error != errc{} || end != argument.data() + argument.size() || + requested < 0 || requested > kMaxTransfers) { + cerr << "usage: fixed_port_census \n"; + return 2; + } + + if (requested == 8) + return run_eight_transfer_positive_control() ? 0 : 1; + transfers = requested; + run_exact_census(); + return 0; +} diff --git a/research/scalable-dirty-connectors/obstruction.py b/research/scalable-dirty-connectors/obstruction.py new file mode 100644 index 0000000000..97f015e5ac --- /dev/null +++ b/research/scalable-dirty-connectors/obstruction.py @@ -0,0 +1,94 @@ +"""Exact finite facts for the two-dirty-root scalability obstruction. + +Two word generators and two difference-set implementations are compared per +word, not merely against a common histogram. Apache-2.0; AI-assisted. +""" + +from collections import Counter +from math import factorial + + +def growth_words(n): + word, counts = [], [] + + def visit(): + if len(word) == 2 * n: + yield tuple(word) + return + for label in range(len(counts) + (len(counts) < n)): + fresh = label == len(counts) + if fresh: + counts.append(0) + if counts[label] < 2: + counts[label] += 1 + word.append(label) + yield from visit() + word.pop() + counts[label] -= 1 + if fresh: + counts.pop() + + yield from visit() + + +def matching_words(n): + word = [-1] * (2 * n) + + def pair(remaining, label): + if not remaining: + yield tuple(word) + return + first = remaining[0] + for index in range(1, len(remaining)): + second = remaining[index] + word[first] = word[second] = label + yield from pair(remaining[1:index] + remaining[index + 1 :], label + 1) + word[first] = word[second] = -1 + + yield from pair(tuple(range(2 * n)), 0) + + +def differences(word): + points, state = [0], 0 + for label in word: + state ^= 1 << label + points.append(state) + covered = {a ^ b for a in points for b in points} + return sum(1 << mask for mask in covered) + + +def dual_differences(word, n): + # Compute every prefix parity directly from its substring, then use the + # dual membership criterion instead of pairwise-XOR construction. + points = { + sum((word[:boundary].count(j) % 2) << j for j in range(n)) + for boundary in range(len(word) + 1) + } + return sum( + 1 << mask for mask in range(1 << n) + if any(point ^ mask in points for point in points) + ) + + +def census(): + result = {} + for n, maximum in ((5, 31), (6, 49)): + primary = {word: differences(word) for word in growth_words(n)} + independent = {word: dual_differences(word, n) for word in matching_words(n)} + expected_count = factorial(2 * n) // (2**n * factorial(n)) + if len(primary) != expected_count or primary != independent: + raise ValueError("closed-word generators or difference engines disagree") + histogram = Counter(coverage.bit_count() for coverage in primary.values()) + if max(histogram) != maximum: + raise ValueError("closed-word maximum changed") + result[str(n)] = { + "words": len(primary), "max_coverage": max(histogram), + "maximizers": histogram[maximum], + "histogram": {str(size): count for size, count in sorted(histogram.items())}, + } + return result + + +if __name__ == "__main__": + import json + print(json.dumps(census(), indent=2)) diff --git a/research/scalable-dirty-connectors/verify.py b/research/scalable-dirty-connectors/verify.py new file mode 100644 index 0000000000..a7b3a8b335 --- /dev/null +++ b/research/scalable-dirty-connectors/verify.py @@ -0,0 +1,306 @@ +#!/usr/bin/env python3 +"""Physical-row polynomial replay, rectangular matrix oracle and controls. + +No normalized-axis or Gray-path identity is used by the replay interpreter. +All safety/correctness checks remain active under python -O. Apache-2.0. +""" + +from collections import Counter, deque +from dataclasses import replace +import hashlib +import json +from math import comb +from pathlib import Path +import random +import sys + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from connector import extra_readout_baseline, fixed_port_five, gray_baseline, star +from obstruction import census + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def replay(program, *, minimal_sources=False, paired_readouts=True): + """Root bits are independent dirt; upper bits are formal B_j(x_j). + + For each output m, applying the formal linear map A_m to these bits is + injective as a *formal expression*. This proves the identity for arbitrary + maps; no actual A or B needs to be injective, square, or invertible. + """ + n, k = program.sources, program.roots + require(type(n) is int and n >= 4, "invalid sources") + require(type(k) is int and k >= 1, "invalid roots") + require(paired_readouts or k == 1, "extra-readout contract is one-root only") + roots = [1 << i for i in range(k)] + outputs = [0] * (1 << n) + source_counts, output_counts, tags = Counter(), Counter(), Counter() + ports = {} + for operation in program.operations: + require(type(operation) is tuple and len(operation) == 3, "invalid operation") + tag, label, port = operation + require(tag in ("B", "A", "X"), "invalid opcode") + require(type(label) is int and type(port) is int, "noninteger operand") + require(0 <= port < k, "invalid port") + tags[tag] += 1 + if tag == "X": + require(0 <= label < k and label != port, "invalid transfer") + roots[label] ^= roots[port] + elif tag == "B": + require(0 <= label < n, "invalid source") + roots[port] ^= 1 << (k + label) + source_counts[label] += 1 + ports.setdefault(label, set()).add(port) + else: + require(1 <= label < (1 << n), "invalid target") + outputs[label] ^= roots[port] + output_counts[label] += 1 + require(roots == [1 << i for i in range(k)], "dirty roots or sources not restored") + require(all(outputs[m] == m << k for m in range(1, 1 << n)), "wrong output polynomial") + require(all(output_counts[m] >= 2 and output_counts[m] % 2 == 0 + for m in range(1, 1 << n)), "even readout bill") + if paired_readouts: + require(all(output_counts[m] == 2 for m in range(1, 1 << n)), "paired readout bill") + require(all(source_counts[j] >= 2 for j in range(n)), "source bill") + if minimal_sources: + require(all(source_counts[j] == 2 for j in range(n)), "nonminimal source calls") + require(all(len(ports[j]) == 1 for j in range(n)), "source port changed") + require(all(op[2] == 0 for op in program.operations if op[0] == "A"), "readout port changed") + encoded = json.dumps(program.operations, separators=(",", ":")).encode() + return { + "sources": n, "roots": k, "source_calls": tags["B"], + "readouts": tags["A"], "transfers": tags["X"], + "instructions": len(program.operations), + "source_multiplicities": [source_counts[j] for j in range(n)], + "source_ports": [sorted(ports[j]) for j in range(n)], + "readout_multiplicity_histogram": { + str(count): targets for count, targets in sorted(Counter(output_counts.values()).items()) + }, + "program_sha256": hashlib.sha256(encoded).hexdigest(), + } + + +def apply(matrix, vector): + return sum(((row & vector).bit_count() % 2) << i for i, row in enumerate(matrix)) + + +def check_extra_readout_minima(program): + """An independent pair-difference BFS checks the compiler's subset DP. + + Any even subset of t observations is t/2 pair differences. Conversely, + canceling duplicated endpoints in a shortest pair representation yields + an even subset of no larger size. Thus the two minima coincide. + """ + points, state = [0], 0 + for tag, label, port in program.operations: + if tag == "B": + state ^= 1 << label + points.append(state) + differences = sorted({a ^ b for a in points for b in points} - {0}) + distance = {0: 0} + todo = deque([0]) + while todo: + mask = todo.popleft() + for difference in differences: + target = mask ^ difference + if target not in distance: + distance[target] = distance[mask] + 1 + todo.append(target) + counts = Counter(label for tag, label, port in program.operations if tag == "A") + require(len(distance) == 1 << program.sources, "pair-difference span") + require(all(counts[m] == 2 * distance[m] for m in range(1, 1 << program.sources)), + "subset DP disagrees with shortest pair-difference BFS") + + +def dense_case(program, rng, trial): + n, k = program.sources, program.roots + root_width = 1 + trial % 7 + input_width = 1 + (trial * 3) % 9 + output_width = 1 + (trial * 5) % 8 + b = [[rng.getrandbits(input_width) for _ in range(root_width)] for _ in range(n)] + a = [[rng.getrandbits(root_width) for _ in range(output_width)] for _ in range(1 << n)] + # Include singular/zero maps deliberately; restoration cannot rely on them. + if trial % 3 == 0: + b[0] = [0] * root_width + if trial % 4 == 0: + a[-1] = [1] * output_width + x = [rng.getrandbits(input_width) for _ in range(n)] + roots = [rng.getrandbits(root_width) for _ in range(k)] + outputs = [rng.getrandbits(output_width) for _ in range(1 << n)] + old_roots, expected = roots[:], outputs[:] + responses = [apply(matrix, source) for matrix, source in zip(b, x)] + for mask in range(1, 1 << n): + summed = 0 + for j, response in enumerate(responses): + if mask & (1 << j): + summed ^= response + expected[mask] ^= apply(a[mask], summed) + for tag, label, port in program.operations: + if tag == "X": + roots[label] ^= roots[port] + elif tag == "B": + roots[port] ^= apply(b[label], x[label]) + else: + outputs[label] ^= apply(a[label], roots[port]) + require(roots == old_roots and outputs == expected, "matrix oracle mismatch") + # The additive batch is its own inverse, including all initially dirty rows. + for tag, label, port in reversed(program.operations): + if tag == "X": + roots[label] ^= roots[port] + elif tag == "B": + roots[port] ^= apply(b[label], x[label]) + else: + outputs[label] ^= apply(a[label], roots[port]) + require(roots == old_roots, "inverse root mismatch") + for mask in range(1, 1 << n): + summed = 0 + for j, response in enumerate(responses): + if mask & (1 << j): + summed ^= response + require(outputs[mask] == expected[mask] ^ apply(a[mask], summed), "inverse output mismatch") + + +def failure_controls(program): + controls = 0 + for tag in ("B", "A", "X"): + for at, op in enumerate(program.operations): + if op[0] != tag: + continue + edited = program.operations[:at] + program.operations[at + 1 :] + try: + replay(replace(program, operations=edited), minimal_sources=True) + except ValueError: + controls += 1 + else: + raise ValueError(f"accepted omitted {tag} at {at}") + for at, (tag, label, port) in enumerate(program.operations): + if tag == "X": + wrong = (tag, port, label) + else: + wrong = (tag, label, (port + 1) % program.roots) + edited = program.operations[:at] + (wrong,) + program.operations[at + 1 :] + try: + replay(replace(program, operations=edited), minimal_sources=True) + except ValueError: + controls += 1 + else: + raise ValueError(f"accepted wrong port/direction at {at}") + if tag in ("B", "A"): + wrong_label = (label + 1) % program.sources if tag == "B" else label % ((1 << program.sources) - 1) + 1 + wrong = (tag, wrong_label, port) + edited = program.operations[:at] + (wrong,) + program.operations[at + 1 :] + try: + replay(replace(program, operations=edited), minimal_sources=True) + except ValueError: + controls += 1 + else: + raise ValueError(f"accepted wrong label at {at}") + for wrong in (("B", True, 0), ("A", 0, 0), ("X", 0, 0), ("B", 0.0, 0), ("B", 0, program.roots)): + try: + replay(replace(program, operations=program.operations + (wrong,))) + except ValueError: + controls += 1 + else: + raise ValueError("accepted malformed operation") + return controls + + +def main(): + require(sys.argv[1:] in ([], ["--write-expected"]), "use --write-expected or no arguments") + receipt = {"star": [], "gray": [], "extra_readout": [], "fixed_port_five": None} + rng = random.Random(0x53474152) + extra_rng = random.Random(0x45585452) + dense_cases = 0 + for n in range(4, 11): + candidate, baseline = star(n), gray_baseline(n) + bill = replay(candidate, minimal_sources=True) + require(bill["source_calls"] == 2 * n, "star source formula") + require(bill["readouts"] == 2 * ((1 << n) - 1), "star output formula") + require(bill["transfers"] == 8 * ((1 << (n - 4)) - 1), "star transfer formula") + old = replay(baseline) + require(old["source_calls"] == (1 << (n // 2)) + (1 << (n - n // 2)), "Gray source formula") + receipt["star"].append(bill) + receipt["gray"].append(old) + extra = extra_readout_baseline(n) + check_extra_readout_minima(extra) + alternative = replay(extra, minimal_sources=True, paired_readouts=False) + require(alternative["source_calls"] == 2 * n and alternative["transfers"] == 0, + "extra-readout source/transfer bill") + require(alternative["readouts"] <= n * (1 << n), "extra-readout general bound") + if n in (5, 6, 7, 8): + require(alternative["readouts"] == {5: 64, 6: 156, 7: 368, 8: 828}[n], + "reviewed extra-readout invoice") + receipt["extra_readout"].append(alternative) + for program in (candidate, baseline, extra): + for trial in range(20): + dense_case(program, extra_rng if program is extra else rng, trial) + dense_cases += 1 + fixed = fixed_port_five() + receipt["fixed_port_five"] = replay(fixed, minimal_sources=True) + for trial in range(40): + dense_case(fixed, rng, trial) + dense_cases += 1 + controls = sum(failure_controls(program) for program in (star(6), fixed)) + # With several dirty roots, three distinct injection axes can sum to zero. + # Thus >=2 is necessary, but an even source-call count is NOT necessary. + excursion = ( + ("X", 0, 1), ("X", 1, 0), ("X", 0, 1), ("B", 0, 0), + ("X", 1, 0), ("X", 0, 1), ("B", 0, 0), ("X", 1, 0), ("B", 0, 0), + ) + positive = star(5) + odd = replace(positive, operations=excursion + positive.operations) + receipt["odd_source_positive_control"] = replay(odd) + require(receipt["odd_source_positive_control"]["source_multiplicities"][0] == 5, "odd source control") + receipt["dense_cases"] = dense_cases + receipt["rejected_mutations"] = controls + # Preserve every existing paired-call control. The additional one-root + # baseline has separate omission and valid-label controls under its wider + # even-readout contract, rather than disabling the star's paired checks. + extra = extra_readout_baseline(6) + extra_controls = 0 + for at, (tag, label, port) in enumerate(extra.operations): + wrong_label = (label + 1) % 6 if tag == "B" else label % 63 + 1 + for edited in ( + extra.operations[:at] + extra.operations[at + 1 :], + extra.operations[:at] + ((tag, wrong_label, port),) + extra.operations[at + 1 :], + ): + try: + replay(replace(extra, operations=edited), minimal_sources=True, paired_readouts=False) + except ValueError: + extra_controls += 1 + else: + raise ValueError("accepted corrupted extra-readout program") + receipt["extra_readout_rejected_mutations"] = extra_controls + # Exact finite corroboration of the all-n counting proof in the README. + # 17^8 < 2*16^8 bounds the binomial volume without floating-point entropy. + require(17**8 < 2 * 16**8, "binomial volume proof constant") + for n in range(4, 65): + volume = sum(comb(2 * n, i) for i in range(n // 8 + 1)) + require(volume < 1 << (n - 1), "low-readout subset volume") + receipt["readout_bound_controls"] = {"n_min": 4, "n_max": 64, "exact_cases": 61} + # A repeated pair at one boundary contributes zero, so this equivalent + # program must pass semantic replay even though its invoice is larger. + zero_pair = (("A", 1, 0), ("A", 1, 0)) + enlarged = replay(replace(extra, operations=zero_pair + extra.operations), + minimal_sources=True, paired_readouts=False) + require(enlarged["readouts"] == receipt["extra_readout"][2]["readouts"] + 2, + "neutral extra-readout pair positive control") + receipt["closed_word_census"] = census() + path = Path(__file__).with_name("EXPECTED.json") + if sys.argv[1:]: + path.write_text(json.dumps(receipt, indent=2) + "\n") + else: + # JSON encodings distinguish true/1 and 1.0/1; ordinary Python equality + # would accept these type corruptions in an otherwise identical bill. + stored = json.dumps(json.loads(path.read_text()), sort_keys=True, separators=(",", ":")) + actual = json.dumps(receipt, sort_keys=True, separators=(",", ":")) + require(stored == actual, "regression receipt mismatch") + print(f"PASS_SCALABLE_DIRTY_CONNECTORS n=4..10 dense={dense_cases} rejected={controls} " + f"extra_rejected={extra_controls} fixed_port=8") + + +if __name__ == "__main__": + main()