diff --git a/research/four-flat-maximal-masks/README.md b/research/four-flat-maximal-masks/README.md new file mode 100644 index 0000000000..b87ab30ea5 --- /dev/null +++ b/research/four-flat-maximal-masks/README.md @@ -0,0 +1,158 @@ +# Exact maximal-mask setup for the four-flat decoder checker + +**Tooling improvement with a scoped equivalence proof.** The four-flat search +constructs, for each active direction and first flat, the inclusion-maximal +masks `Off(h) \ X1` intersected with candidate 7-flats. Its original setup tests +every candidate against every other candidate. This adapter uses cardinality +buckets and compares only against already retained, strictly larger maxima. +It restores the original ascending mask order before the search resumes. + +This answers a separate setup bottleneck in +[Discussion2954](https://github.com/CrocSwap/integer-mult-bounds/discussions/2954#discussioncomment-18977655). +It composes with PR2975's faster requirement enumeration. Both benchmark builds +use that same predecessor option generator; the only mathematical computation +changed here is maximal-mask filtering. No new pruning of pairs or directions, +new decoder exclusion, supplier, or kappa is claimed. + +## Result and evidence + +| Same-input workload | Reference | Accelerated | Speedup | +| --- | ---: | ---: | ---: | +| Maximal-mask filtering, both representatives | 104.85 s | 11.26 s | 9.31x | +| Complete per-representative setup | 107.28 s | 13.55 s | 7.92x | +| Full bounded run, shared catalogue/orbits included | 156.74 s | 61.42 s | 2.55x | + +Final registered Python 3.12 replay passes. The earlier complete serial trial +measured 9.14x filtering and 2.58x total speedup, with identical exact outputs. + +See [RESULT.json](RESULT.json) for the serial same-input measurements and exact +receipt hashes. The benchmark runs complete setup for representatives **46 and +94** of the source's `a=4,b=6,c=4,d=5` configuration, and the predecessor's fixed +12 pairs for representative 46. The second representative is selected by OS +assignment seed 94. An additional `a=b=6,c=4,d=0` case preserves the known relaxed +span-five witness at representative 82, V2 index 103676. + +The comparisons cover every active-direction index, residual mask, cap, maximal +mask and its order, all eleven downstream requirement records, the complete output/histogram +reporting 5,509 closure leaves, and the positive witness. +Temporary binary setup records contain the complete arrays, not a sampled +checksum. The verifier compares their bytes; only compact hashes/counts are +committed. The timings measure this verifier on the recorded host, not integer +multiplication or the entire class-C campaign. Benchmark wall time includes +setup-state serialization and requirement exports, excludes compilation and +additional controls. Filter/setup phase times use process CPU time and exclude +setup-state serialization. A speed threshold is deliberately not a correctness +predicate. + +Independent explicit-set controls cover all **65,536** families of subsets of a +four-point universe, 2,000 deterministic wide-mask families, and 128 cases covering +every bit position. Six implementation mutants must fail, including wrong bucket +order, reversed containment, omitted high bits and lost canonical order. The +same cases run under undefined-behavior/bounds sanitizer traps. Source-byte and +missing/ambiguous adapter controls fail closed. This is a representation-level +argument and finite replay, not a second independent proof of the outer decoder +search or a formal multiplication theorem. + +## Reproduce + +From a checkout containing the seven declared predecessor files: + +```sh +python3 -I -B research/four-flat-maximal-masks/verify.py --work /tmp/four-flat-masks +``` + +Use a fresh output directory, Python 3.12+ and a `cc` supporting GNU C11, +unsigned 128-bit integers, `-fsanitize=undefined,bounds` and +`-fsanitize-undefined-trap-on-error`. No Python third-party dependencies, network, +Git metadata or cached scientific results are needed by this command. +Expected: `PASS_MAXIMAL_MASK_CONTROLS` and `PASS_MAXIMAL_MASK_FULL`. +`--controls-only` and `--full-only` select the separately bounded obligations. +The registered command is: + +```sh +python3.12 scripts/research_package.py --package research/four-flat-maximal-masks +``` + +Both builds authenticate all external inputs by SHA256. Source adapter anchors +must occur exactly once. Source files and the inherited circuit/checker remain +unchanged; generated C, executables and large records live only in the work +directory. `SOURCES.json` pins the baseline main commit, exact predecessor and +all live bytes; `VERIFY.json` declares those inputs for CI selection. + +## Equivalence proof + +Let `F` be a finite collection of **distinct** bit masks, ordered by set +inclusion. The frozen source sorts and deduplicates `tmp` immediately before +the replaced block. Its output is the ascending list + +`Max(F) = {x in F : there is no y != x in F with x subset y}`. + +Process masks in descending cardinality, with an arbitrary order within each +bucket. Maintain the retained maxima of the already processed, larger buckets. +For a candidate `x`, any proper superset has strictly larger cardinality and has +already been processed. If such a superset was discarded, it was contained in +an earlier retained mask. By transitivity that retained mask also contains `x`. +Consequently `x` is nonmaximal if and only if a retained larger mask contains it. +Distinct masks of equal cardinality cannot contain one another, so comparisons +within a bucket are unnecessary. No future smaller mask can invalidate an +accepted maximum. This proves the invariant and exact maximal-set equality by +induction over the buckets. Empty input returns the empty list; the zero mask +is handled by the same argument. Sorting the retained masks with the original +integer comparator gives the **same ordered array** as the predecessor. + +The C implementation uses all 128 bits for cardinality and containment. Bucket +indices lie in 0..128, their sizes sum to the input count, and the permutation +contains each input index exactly once. At the start of a bucket, `larger` fixes +the count of earlier maxima; newly appended equal-size masks are intentionally +not tested. Input and output buffers are distinct and each holds at least the +input count, as provided by the original `tmp`/`mx` allocation. Additional space +is one integer index per input mask and three 129-element arrays. Worst-case +containment work remains quadratic; the claim is the measured reduction on the +named workload, not a universal subquadratic bound. + +Every other setup calculation is unchanged. Thus identical `mx` implies +identical `LG`, `LGn`, `capr`, `act` and `R1` for each direction. The unchanged +outer search receives exactly the same arrays and order; its branch sequence, +requirements, closure and reports are preserved, conditional on the inherited +implementation. Source authentication and exact-once replacement prevent silently +applying this argument to an unrelated future source version. + +## Scope, provenance and credit + +Scientific base: `b3f3ee0392b71b118fd086a6eaf6b4cab54ef455` (priority revision 5). +Submission refresh: `836b19bfa309ceafbc8ee32a15e8c4b10dde7e11` (revision 6). +The revised guidance, family record and priority log were read; the replay-runtime +card, selected record and all runtime inputs are unchanged. This is bounded +replay acceleration, not a larger static-cover census. +Predecessor PR2975: `1d7b491c9efad451d49dbfd36a3be7443999bf17`. +Original DreamingOfClouds help package: +`1b25759bff5486293a9083ebbe0097b5f6642e08`, `research/k2-class-c-help`. +The selected maintainer-reviewed conditional kappa remains +`0.001672660197076918`; merged archive status does not certify newer claims. + +Credit **DreamingOfClouds** for the four-flat engine, original maximal-mask +construction, help request and #2816/#2826/#2862 lineage, and Tekalign's PR2975 for +the separately retained requirement-enumeration improvement. PR2985's newer +residue-closure work is complementary; its claims are not prerequisites of this +filter equivalence. Prepared by **Tekalign (@tekuuu)** with substantial **OpenAI +Codex assistance** in analysis, implementation, checking and writing. +Apache-2.0, as the repository and predecessors. No independent human review is +claimed. + +The direction catalogue, group/orbit reduction, real-rank arithmetic, RRC, +complete decoder floor, native/supplier admission and all-size multiplication +interfaces remain inherited or unresolved. This package does not audit or +silently accept those obligations. The seeded finite fixtures are performance +measurements, not a new impossibility theorem. It does not launch a larger +construction/search campaign or alter the selected frontier. + +## Open next questions + +- A stronger common-flat gate or exact orbit reduction is still needed before + the full campaign is affordable. First profile the transformed search, then + prove any proposed reduction cannot discard a possible span witness. +- Measure other representatives/configurations with the same complete setup + comparison. The present timing evidence covers only the named inputs and host. + +Structured questions, stopping rule and the three candidate tasks considered +are retained in [TASK.json](TASK.json). diff --git a/research/four-flat-maximal-masks/RESULT.json b/research/four-flat-maximal-masks/RESULT.json new file mode 100644 index 0000000000..b3fecbe81b --- /dev/null +++ b/research/four-flat-maximal-masks/RESULT.json @@ -0,0 +1,126 @@ +{ + "status": "PASS_FOUR_FLAT_MAXIMAL_MASKS", + "registered_python": "3.12.14 (main, Sep 1 2026, 14:16:52) [Clang 22.1.3 ]", + "platform": "Linux-7.2.8-200.fc44.x86_64-x86_64-with-glibc2.43", + "compiler": "cc (GCC) 16.2.1 20260819 (Red Hat 16.2.1-2)", + "controls": { + "status": "PASS_MAXIMAL_MASK_CONTROLS", + "explicit_set_cases": 67664, + "all_four_point_families": 65536, + "seeded_wide_families": 2000, + "all_bit_position_cases": 128, + "oracle_sha256": "eb9522da30e3696e33249b9cd9ba8f363538149ad65e1eb1bf44e24a71887280", + "implementation_mutants": [ + "reverse_bucket_order", + "skip_larger_masks", + "reverse_containment", + "discard_high_word", + "drop_last_maximum", + "omit_canonical_order" + ], + "invalid_inputs_rejected": 6, + "adapter_anchor_controls": 2, + "source_byte_control": "PASS", + "setup_export_controls": 6 + }, + "full": { + "status": "PASS_MAXIMAL_MASK_FULL", + "benchmark": { + "reference": { + "wall_seconds": 156.7442173870004, + "representatives": [ + { + "rep": 46, + "calls": 1332, + "input_masks": 2206610, + "maximal_masks": 1191638, + "filter_cpu_seconds": 52.570777, + "setup_cpu_seconds": 53.788808 + }, + { + "rep": 94, + "calls": 1240, + "input_masks": 2200160, + "maximal_masks": 1188546, + "filter_cpu_seconds": 52.275135, + "setup_cpu_seconds": 53.486273 + } + ] + }, + "accelerated": { + "wall_seconds": 61.422050555998794, + "representatives": [ + { + "rep": 46, + "calls": 1332, + "input_masks": 2206610, + "maximal_masks": 1191638, + "filter_cpu_seconds": 5.61673, + "setup_cpu_seconds": 6.758153 + }, + { + "rep": 94, + "calls": 1240, + "input_masks": 2200160, + "maximal_masks": 1188546, + "filter_cpu_seconds": 5.640199, + "setup_cpu_seconds": 6.787094 + } + ] + } + }, + "filter_speedup": 9.313900087670447, + "setup_speedup": 7.9197582000534945, + "wall_speedup": 2.5519209464375647, + "setup_state": { + "94.bin": { + "bytes": 19096128, + "sha256": "901274e1219320e0d51c13e3e384b5113f1e45c0df3c709947354149355b1991", + "active_directions": 1240, + "maximal_masks": 1188546 + }, + "46.bin": { + "bytes": 19151488, + "sha256": "782b01ea2e1c10760c6a714782adf7838ddfff5ce99991e408c783d744ee9748", + "active_directions": 1332, + "maximal_masks": 1191638 + } + }, + "requirements": { + "46-665349.json": "6638f0545d6043e38caa3fc23edc2b8e517daeaedfa4bfeec4a64d020cf4235d", + "46-617212.json": "65ce860233c3a5f8fb85fd50c15bbf2e702c8abd8270404d16e784774195d642", + "46-615411.json": "e4bab2c34a2f9333ffb6714fb6e926efeb203ab6e70b5bb7bb82d1a77cf45432", + "46-612085.json": "c53fdbbabb7321634fdf3f12b36b705f6bfd6af91469d88b70073b5fa4c9fad7", + "46-564161.json": "6e8987f7fc6774d855181e613a1de9cfe8b951cb6447d85de3caa818cc16eaa3", + "46-540768.json": "427b5673f331c41e174aebe5fba6153bb91d31300450bc2f4422c0f1df3aa7df", + "46-419424.json": "b42ff5dc2d2fe04b397e39473eecb25962c6b337741bc1851aee5fa0491ec2b0", + "46-239640.json": "7908839d33ed18e511d67b4bdaa96dd3c50067cc3ed9bb50d08d02b7905237ce", + "46-80093.json": "d3b40be9d5f4c2d99b46e3f2e82ae4c4375e0d24e3d117b07e14f8d02a57fa6f", + "46-41902.json": "4fa61da62bbb7aca14f05838bc641cd587fad51259ac072216162af362e2cd74", + "46-33744.json": "d1e6e3e91b833659441eb33e24121cf7a6440a0cf768cb345cd1296104380706" + }, + "full_stdout_sha256": "c1b8262e2b6d2a1b3d8b51385b2a3ba6fba86f99a1b0f0b662f46c3bb22c319b", + "positive_stdout_sha256": "b4e8d1be287caf288022c2facbd43aa9755bd5c84529dc8aba505fceaca4dbea", + "positive_setup_sha256": "cae33d73c21527f325275578e3606520d7b29866fd9accfb2c69e89143a5eda3", + "pairs": 12, + "closure_leaves": 5509, + "positive_span_five": "PASS", + "generated_c_sha256": { + "reference": "e826f1bd11457d348245c7e26702af1f30fee977be9f385ca5d14dc66cddf05e", + "accelerated": "cb8856adc6e121120fc319ecce77d97d1992b5fea318db00457cdb72267d43c3" + } + }, + "earlier_serial_measurement": { + "reference_wall_seconds": 150.30526392699903, + "accelerated_wall_seconds": 58.26836285900026, + "filter_speedup": 9.139422924950882, + "wall_speedup": 2.579534700343525, + "note": "Same final C filter; preliminary Python3.14 harness, before extra export-parser controls." + }, + "portability": { + "status": "PASS", + "mode": "read-only Git-free source export, optimized (-OO) interpreter", + "python": "3.14.7 (main, Aug 10 2026, 00:00:00) [GCC 16.1.1 20260515 (Red Hat 16.1.1-2)]", + "controls_equal": true + } +} diff --git a/research/four-flat-maximal-masks/SOURCES.json b/research/four-flat-maximal-masks/SOURCES.json new file mode 100644 index 0000000000..f4b72c94b8 --- /dev/null +++ b/research/four-flat-maximal-masks/SOURCES.json @@ -0,0 +1,112 @@ +{ + "base_commit": "b3f3ee0392b71b118fd086a6eaf6b4cab54ef455", + "predecessor_pr": 2975, + "predecessor_commit": "1d7b491c9efad451d49dbfd36a3be7443999bf17", + "original_source_repository": "https://github.com/DreamingOfClouds/integer-mult-bounds", + "original_source_commit": "1b25759bff5486293a9083ebbe0097b5f6642e08", + "inputs": [ + { + "path": "research/two-flat-cover-branching/build.py", + "sha256": "21a0598ea691dc60ce5a2b466305cac1b0f92ee976a5554a674eddde85ab0f7b", + "git_blob": "8b6040d7bf81af3512dd97718aaa56387602413d" + }, + { + "path": "research/two-flat-cover-branching/cover.c.inc", + "sha256": "2c081a966191596bb75c4cf55e99f8c985975f56d918ea71b295061ce947bfdf", + "git_blob": "bba3f1fe9b80f13f26a19e870aa851ae608c0f9b" + }, + { + "path": "research/two-flat-cover-branching/export.c.inc", + "sha256": "d6ae0dec70ce5f1165bc31c98709b89b753a8d04e2be29f7f36cb66edcfd35d7", + "git_blob": "86b03243ee49d53ed6f8c917d324bcb803796d4e" + }, + { + "path": "research/two-flat-cover-branching/vendor/s4z.c", + "sha256": "3e3de7ac902d8bebc80e22a513fbfc5b5959417ea34d1d64b487909068115357", + "git_blob": "01b0e94c0f93a6de65772c764841bd7da82804ae" + }, + { + "path": "research/two-flat-cover-branching/vendor/gens.txt", + "sha256": "0679ba17f68761c9aea31230df8a7ac4a86533b24ee53d786dd1afa216a4b2c9", + "git_blob": "ba27ea667b9d00e6976c11d349fa84d959b78253" + }, + { + "path": "research/two-flat-cover-branching/data/data88.txt.gz", + "sha256": "f7d9992d0b8c84884ba56d7105b355023620557d864011cacd04b07f8ba009de", + "git_blob": "5752539ec7c1f82ad6e4c30f5954c2f4c6c2be9f" + }, + { + "path": "research/two-flat-cover-branching/data/pairs.txt", + "sha256": "7df8c84c619e08f086880f068b7d75723e1d374ce04c1b730932adb654529a9c", + "git_blob": "b96d8b329f5a52c1e4f3a2adc1ca8eda6cc0e410" + } + ], + "schema_version": 1, + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "commit": "b3f3ee0392b71b118fd086a6eaf6b4cab54ef455", + "git_blob": "889b95d936746df124872133ae1e7cc339adcb92", + "sha256": "7d185cd8c2af35988d638d969748ad7b670f902606444dbfc748e4402c340df6", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:docs/research/agent-task-catalog.json" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "commit": "b3f3ee0392b71b118fd086a6eaf6b4cab54ef455", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:certificates/selected-result.json" + }, + { + "path": "research/two-flat-cover-branching/build.py", + "sha256": "21a0598ea691dc60ce5a2b466305cac1b0f92ee976a5554a674eddde85ab0f7b", + "git_blob": "8b6040d7bf81af3512dd97718aaa56387602413d", + "usage": "input", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:research/two-flat-cover-branching/build.py" + }, + { + "path": "research/two-flat-cover-branching/cover.c.inc", + "sha256": "2c081a966191596bb75c4cf55e99f8c985975f56d918ea71b295061ce947bfdf", + "git_blob": "bba3f1fe9b80f13f26a19e870aa851ae608c0f9b", + "usage": "input", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:research/two-flat-cover-branching/cover.c.inc" + }, + { + "path": "research/two-flat-cover-branching/export.c.inc", + "sha256": "d6ae0dec70ce5f1165bc31c98709b89b753a8d04e2be29f7f36cb66edcfd35d7", + "git_blob": "86b03243ee49d53ed6f8c917d324bcb803796d4e", + "usage": "input", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:research/two-flat-cover-branching/export.c.inc" + }, + { + "path": "research/two-flat-cover-branching/vendor/s4z.c", + "sha256": "3e3de7ac902d8bebc80e22a513fbfc5b5959417ea34d1d64b487909068115357", + "git_blob": "01b0e94c0f93a6de65772c764841bd7da82804ae", + "usage": "input", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:research/two-flat-cover-branching/vendor/s4z.c" + }, + { + "path": "research/two-flat-cover-branching/vendor/gens.txt", + "sha256": "0679ba17f68761c9aea31230df8a7ac4a86533b24ee53d786dd1afa216a4b2c9", + "git_blob": "ba27ea667b9d00e6976c11d349fa84d959b78253", + "usage": "input", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:research/two-flat-cover-branching/vendor/gens.txt" + }, + { + "path": "research/two-flat-cover-branching/data/data88.txt.gz", + "sha256": "f7d9992d0b8c84884ba56d7105b355023620557d864011cacd04b07f8ba009de", + "git_blob": "5752539ec7c1f82ad6e4c30f5954c2f4c6c2be9f", + "usage": "input", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:research/two-flat-cover-branching/data/data88.txt.gz" + }, + { + "path": "research/two-flat-cover-branching/data/pairs.txt", + "sha256": "7df8c84c619e08f086880f068b7d75723e1d374ce04c1b730932adb654529a9c", + "git_blob": "b96d8b329f5a52c1e4f3a2adc1ca8eda6cc0e410", + "usage": "input", + "pin": "head:b3f3ee0392b71b118fd086a6eaf6b4cab54ef455:research/two-flat-cover-branching/data/pairs.txt" + } + ] +} diff --git a/research/four-flat-maximal-masks/TASK.json b/research/four-flat-maximal-masks/TASK.json new file mode 100644 index 0000000000..fa139e8e11 --- /dev/null +++ b/research/four-flat-maximal-masks/TASK.json @@ -0,0 +1,96 @@ +{ + "schema_version": 1, + "task_id": "replay-runtime", + "priority_revision": 5, + "base_commit": "b3f3ee0392b71b118fd086a6eaf6b4cab54ef455", + "original_card": { + "id": "replay-runtime", + "question": "Can one measured replay bottleneck be sped up without dropping coverage?", + "starting_points": [ + "scripts/run_isolated_tests.py", + "scripts/verify_replay_coverage.py", + "certificates/selected-result.json" + ], + "methods": [ + "Profile one isolated replay and optimize the measured bottleneck.", + "Design source-bound reuse with explicit dependency invalidation and negative controls." + ], + "acceptance_gate": "Report before/after wall time on the same fixture, retained checks and invalidation behavior.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the selected reproduction command and choose a single replay stage for profiling.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Measure one unchanged fixture, preserve check coverage, and test one optimization with invalidation controls.", + "bottleneck_link": "Faster trustworthy replays increase review throughput and let mechanism candidates be checked sooner.", + "allowed_variations": [ + "Profile one stage or design one source-bound cache boundary." + ], + "scope_change_triggers": [ + "Skipping coverage or comparing different fixtures to claim speedup." + ], + "overlap_terms": [ + "replay runtime", + "cache invalidation", + "isolated tests" + ] + }, + "scope_status": "refined", + "actual_scope": "Exact maximal-mask antichain filtering in the per-representative setup of the pinned four-flat decoder checker.", + "scope_change_reason": "Seed94 assigns verification engineering; live Discussion2954 routeB and the previous setup profile identify a separate costly phase after PR2975.", + "bottleneck_link": "Faster trustworthy replays increase review throughput and let mechanism candidates be checked sooner.", + "assignment_seed": 94, + "track": "verification engineering", + "budget_minutes": 60, + "verification_reserved_minutes": 15, + "candidates": [ + "Maximal-mask setup filtering in s4z: all-pairs containment is costly and no matching active claim was found.", + "PR2981 joint-unit-flag incidence replay: fresh matching certificate already has a separate bitmap checker; less evidence of a costly uncovered step.", + "PR2977 scatter multiplicity schema: useful correctness boundary, but no measured expensive replay and the repair needs a production-schema scope." + ], + "outcome": "completed", + "evidence": "RESULT.json, exact differential setup/requirement replay and independent explicit-set controls.", + "stop_rule": "Two complete representative setups (46,94), fixed twelve-pair sample and known span-five positive control. No full class-C census.", + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2954#discussioncomment-18977655", + "author": "Tekalign (@tekuuu)", + "ai_assistance": "Substantial OpenAI Codex assistance in analysis, implementation, checking and writing.", + "open_questions": [ + { + "question": "Can orbit reduction or a stronger common-flat gate reduce the full campaign?", + "why_it_matters": "Setup acceleration does not remove hundreds of millions of outer pairs.", + "first_step": "Profile the now cheaper setup and compare an exact orbit reduction on a source-pinned pair slice.", + "blocked_by": "A sound argument preserving the possible span witnesses is required." + }, + { + "question": "Does this speedup persist across the other representative/configuration choices?", + "why_it_matters": "The benchmark covers the named fixtures only.", + "first_step": "Reuse the full setup-state comparison on additional fixed representatives.", + "blocked_by": "No correctness blocker; requires additional bounded measurements." + } + ], + "upstream_refresh": { + "commit": "836b19bfa309ceafbc8ee32a15e8c4b10dde7e11", + "priority_revision": 6, + "utc": "2026-10-16T16:41:00Z", + "guidance_changes": "Read revised autoresearch, family status, catalogue, bottleneck brief and priority log. Replay-runtime card, all runtime inputs and selected record unchanged.", + "decision": "Continue the bounded exact-replay acceleration. It changes the cost of checking the existing four-flat fixtures; it neither extends a static-cover census nor relies on the new RRC/input-landscape claims." + }, + "submission_base": "836b19bfa309ceafbc8ee32a15e8c4b10dde7e11", + "overlap": { + "initial_complete_pr_inventory": "round55 snapshot of 2663 PRs, all states, refreshed by the 100 most recently updated PRs through 2026-10-16T16:18:46Z; oldest update in refresh 14:06:50Z precedes complete snapshot", + "relevant_discussions": [ + 1163, + 1166, + 1167, + 2954 + ], + "nearest_work": "PR2975 changes option enumeration, not maximal-mask setup; PR2985 concerns residue lemmas and does not modify s4z; its input-landscape audit remains independent.", + "coverage_limit": "Metadata and named source files/comments; not every code diff or unpublished result. No matching active claim found.", + "submission_refresh": "Last20 updated PRs and canonical Discussion2954 refreshed at16:41UTC; new PR2991-2998 target different precision, frame, flow, scatter and mixed-target questions. No duplicate maximal-mask filtering claim found." + } +} diff --git a/research/four-flat-maximal-masks/VERIFY.json b/research/four-flat-maximal-masks/VERIFY.json new file mode 100644 index 0000000000..b340d5ad0f --- /dev/null +++ b/research/four-flat-maximal-masks/VERIFY.json @@ -0,0 +1,39 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/two-flat-cover-branching/build.py", + "research/two-flat-cover-branching/cover.c.inc", + "research/two-flat-cover-branching/export.c.inc", + "research/two-flat-cover-branching/vendor/s4z.c", + "research/two-flat-cover-branching/vendor/gens.txt", + "research/two-flat-cover-branching/data/data88.txt.gz", + "research/two-flat-cover-branching/data/pairs.txt" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "--controls-only" + ], + "timeout_seconds": 180, + "checks": "Exhaustive four-point families, explicit-set wide oracle, six rejecting mutants, sanitizer-trap and source/anchor invalidation controls." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "--full-only" + ], + "timeout_seconds": 600, + "checks": "Serial same-input original/accelerated setups for representatives46/94, all twelve fixed pairs, eleven requirement records and positive span-five control. Requires cc." + } + ] +} diff --git a/research/four-flat-maximal-masks/build.py b/research/four-flat-maximal-masks/build.py new file mode 100644 index 0000000000..540232c2a6 --- /dev/null +++ b/research/four-flat-maximal-masks/build.py @@ -0,0 +1,62 @@ +"""Authenticate and adapt a frozen predecessor without changing its files.""" +from pathlib import Path +import hashlib +import json +import runpy +import subprocess + +ROOT = Path(__file__).resolve().parent +REPO = ROOT.parent.parent +OLD = 'int nm=0; for(int i=0;i>(8*i)); + if (fwrite(bytes,1,16,f)!=16) { perror("setup write"); exit(2); } +} +static void export_setup(int ri,int na,int *act,u128 *R1,int *capr,u128 **LG,int *LGn) { + const char *base=getenv("MASK_SETUP"); + if (!base) return; + char path[4096]; + int size=snprintf(path,sizeof(path),"%s-%d.bin",base,ri); + if (size<0 || size>=(int)sizeof(path)) { fprintf(stderr,"setup path too long\n");exit(2); } + FILE *f=fopen(path,"wb"); + if (!f) { perror("setup open"); exit(2); } + put128(f,(u128)ri);put128(f,(u128)na); + for (int i=0;i44000) return 2; + u128 *input=malloc(sizeof(u128)*(size_t)(count+1)); + u128 *output=malloc(sizeof(u128)*(size_t)(count+1)); + if(!input || !output) return 2; + for(int i=0;i>64),(u64)output[i]); + printf("\n");free(input);free(output); + } + if(!feof(stdin)) return 2; + return ferror(stdout)?2:0; +} diff --git a/research/four-flat-maximal-masks/maximal.c.inc b/research/four-flat-maximal-masks/maximal.c.inc new file mode 100644 index 0000000000..9342080acd --- /dev/null +++ b/research/four-flat-maximal-masks/maximal.c.inc @@ -0,0 +1,38 @@ +/* Apache-2.0. Tekalign, substantial OpenAI Codex assistance. + * Input: distinct masks. Output: all inclusion-maximal masks, integer-sorted. + * The caller retains its original sorted-deduplicated input construction. + */ +static int maximal_masks(const u128 *input, int count, u128 *output) { + int sizes[129] = {0}, offsets[129], used[129] = {0}; + if (count < 0) { fprintf(stderr, "negative mask count\n"); exit(2); } + if (!count) return 0; + int *order = malloc(sizeof(*order) * (size_t)count); + if (!order) { fprintf(stderr, "mask allocation failed\n"); exit(2); } + for (int i = 0; i < count; i++) sizes[pc(input[i])]++; + int pos = 0; + for (int weight = 128; weight >= 0; weight--) { + offsets[weight] = pos; + pos += sizes[weight]; + } + for (int i = 0; i < count; i++) { + int weight = pc(input[i]); + order[offsets[weight] + used[weight]++] = i; + } + int kept = 0; + for (int weight = 128; weight >= 0; weight--) { + /* Distinct masks of the same cardinality cannot strictly contain one + another. Only maxima retained from larger-cardinality buckets matter. */ + int larger = kept; + for (int j = 0; j < sizes[weight]; j++) { + u128 mask = input[order[offsets[weight] + j]]; + int contained = 0; + for (int k = 0; k < larger; k++) { + if ((mask & output[k]) == mask) { contained = 1; break; } + } + if (!contained) output[kept++] = mask; + } + } + free(order); + qsort(output, (size_t)kept, sizeof(u128), cmp128); + return kept; +} diff --git a/research/four-flat-maximal-masks/verify.py b/research/four-flat-maximal-masks/verify.py new file mode 100644 index 0000000000..92bb1a5f00 --- /dev/null +++ b/research/four-flat-maximal-masks/verify.py @@ -0,0 +1,226 @@ +#!/usr/bin/env python3 +"""Exact controls and serial same-input differential benchmark. Stdlib only.""" +from pathlib import Path +import argparse +import gzip +import hashlib +import json +import os +import platform +import random +import re +import runpy +import shutil +import subprocess +import sys +import tempfile +import time + +ROOT = Path(__file__).resolve().parent +build = runpy.run_path(str(ROOT / 'build.py')) +need, source, compile_c = (build[k] for k in ['need', 'source', 'compile_c']) +REPO = ROOT.parent.parent +PARENT = REPO / 'research/two-flat-cover-branching' +ENV_KEYS = ['FREES','NOSYM','ONLY','JMOD','JREM','NEWLO','PASS1','PAIRS','EXITCRACK','EXPORT_ONLY','EXPORT','PAIRLOG','DBG','TRACE','MASK_SETUP'] + + +def sha(data): + return hashlib.sha256(data).hexdigest() + + +def run(exe, request): + return subprocess.run([str(exe)], input=request, text=True, capture_output=True, timeout=180) + + +def controls(work): + rng = random.Random(94) + cases = [[i for i in range(16) if (family >> i) & 1] for family in range(1 << 16)] + # Exercise all 128 positions, including cardinalities 0 and 128, and + # incomparable equal-cardinality masks with nontrivial low/high words. + for bit in range(128): + cases.append(sorted({0, 1 << bit, (1 << 128)-1, ((1 << 128)-1) ^ (1 << bit)})) + for _ in range(2000): + base = rng.getrandbits(128) + family = {rng.getrandbits(128) for _ in range(rng.randrange(1, 40))} + family.update([0,base,base & rng.getrandbits(128),base | rng.getrandbits(128)]) + cases.append(sorted(family)) + request = ''.join(str(len(c))+'\n'+''.join(f'{x>>64:x} {x&((1<<64)-1):x}\n' for x in c) for c in cases) + # Independent explicit sets, rather than C bit-mask containment or buckets. + oracle=[] + for c in cases: + sets=[frozenset(i for i in range(128) if (v>>i)&1) for v in c] + maxima=[v for j,v in enumerate(c) if not any(sets[j] < other for other in sets)] + oracle.append(str(len(maxima))+''.join(f' {x:032x}' for x in maxima)) + expected='\n'.join(oracle)+'\n' + for name,fast in [('reference',False),('accelerated',True)]: + exe=compile_c(source(fast,kernel=True),work/name) + p=run(exe,request) + need(p.returncode==0 and p.stdout==expected,name+' differs from explicit-set oracle') + fast_text=source(True,kernel=True) + sanitized=compile_c(fast_text,work/'sanitized',('-fsanitize=undefined,bounds','-fsanitize-undefined-trap-on-error')) + p=run(sanitized,request) + need(p.returncode==0 and p.stdout==expected,'sanitized oracle comparison failed') + mutations={ + 'reverse_bucket_order': ('int weight = 128; weight >= 0; weight--','int weight = 0; weight <= 128; weight++'), + 'skip_larger_masks': ('int larger = kept;', 'int larger = 0;'), + 'reverse_containment': ('(mask & output[k]) == mask','(mask & output[k]) == output[k]'), + 'discard_high_word': ('(mask & output[k]) == mask','((u64)mask & (u64)output[k]) == (u64)mask'), + 'drop_last_maximum': ('return kept;','return kept ? kept-1 : 0;'), + 'omit_canonical_order': ('qsort(output, (size_t)kept, sizeof(u128), cmp128);','/* deliberately omit sort */'), + } + for name,(old,new) in mutations.items(): + need(old in fast_text,'missing mutant anchor') + exe=compile_c(fast_text.replace(old,new),work/name) + p=run(exe,request) + need(p.returncode!=0 or p.stdout!=expected,'undetected mutant: '+name) + for malformed in ['2\n0 1\n0 1\n','2\n0 2\n0 1\n','1\n0\n','-1\n','44001\n','no\n']: + need(run(work/'accelerated',malformed).returncode!=0,'malformed kernel input accepted') + try: + build['once']('absent','required','replacement') + except ValueError: + pass + else: + raise ValueError('missing adapter anchor accepted') + try: + build['once']('twice twice','twice','replacement') + except ValueError: + pass + else: + raise ValueError('ambiguous adapter anchor accepted') + # Authenticate the same declared inputs in a clean export, then alter one. + export=work/'source-control';(export/'research').mkdir(parents=True) + package=export/'research'/ROOT.name;shutil.copytree(ROOT,package,ignore=shutil.ignore_patterns('__pycache__')) + for item in build['authenticate']()['inputs']: + dst=export/item['path'];dst.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(REPO/item['path'],dst) + code='import runpy;runpy.run_path('+repr(str(package/'build.py'))+')["authenticate"]()' + def authenticate_export(): + return subprocess.run([sys.executable,'-I','-B','-c',code],text=True,capture_output=True) + need(authenticate_export().returncode==0,'clean source export rejected') + target=export/'research/two-flat-cover-branching/vendor/s4z.c' + target.write_bytes(target.read_bytes()+b'\n/* mutation */\n') + p=authenticate_export();need(p.returncode!=0 and 'source mismatch' in p.stderr,'modified source accepted') + good=[94,1,0,3,1,2,1,2] + encode=lambda words:b''.join(x.to_bytes(16,'little') for x in words) + need(inspect_setup(encode(good),94,1,2)=={'active_directions':1,'maximal_masks':2},'setup oracle failed') + bad=[good[:-1],good+[0],good[:4]+[2]+good[5:],good[:-1]+[4],good[:-2]+[2,1],good[:1]+[0]+good[2:]] + for words in bad: + try:inspect_setup(encode(words),94,1,2) + except ValueError:pass + else:raise ValueError('malformed setup export accepted') + return {'status':'PASS_MAXIMAL_MASK_CONTROLS','explicit_set_cases':len(cases),'all_four_point_families':65536, + 'seeded_wide_families':2000,'all_bit_position_cases':128,'oracle_sha256':sha(expected.encode()), + 'implementation_mutants':list(mutations),'invalid_inputs_rejected':6,'adapter_anchor_controls':2,'source_byte_control':'PASS','setup_export_controls':6} + + +def clean_env(**updates): + env={k:v for k,v in os.environ.items() if k not in ENV_KEYS} + env.update(updates) + return env + + +def invoke(exe,work,args,env): + start=time.perf_counter() + p=subprocess.run([str(exe),*args],cwd=work,env=env,text=True,capture_output=True,timeout=300) + elapsed=time.perf_counter()-start + need(p.returncode==0,'engine failed: '+p.stderr[-3000:]) + return p,elapsed + + + +def inspect_setup(data, expected_rep, expected_calls=None, expected_masks=None): + need(len(data)%16==0,'partial setup word') + pos=0 + def word(): + nonlocal pos + need(pos+16<=len(data),'truncated setup') + value=int.from_bytes(data[pos:pos+16],'little');pos+=16 + return value + need(word()==expected_rep,'setup representative differs') + count=word();total=0;previous_direction=-1 + need(0<=count<=18100,'invalid active count') + for _ in range(count): + direction,residual,cap,n=(word() for _ in range(4)) + need(previous_direction