Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 158 additions & 0 deletions research/four-flat-maximal-masks/README.md
Original file line number Diff line number Diff line change
@@ -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).
126 changes: 126 additions & 0 deletions research/four-flat-maximal-masks/RESULT.json
Original file line number Diff line number Diff line change
@@ -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
}
}
112 changes: 112 additions & 0 deletions research/four-flat-maximal-masks/SOURCES.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading