Skip to content
Open
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
2 changes: 1 addition & 1 deletion certificates/disjoint-tensor-compression.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
"docs/research/disjoint-tensor-compression.md": "d7d59f70653b8fbb3cb31fbe6466f73ae48a6b79852f2fe649a9d38e1b9763d1",
"notes/disjoint-tensor-compression.tex": "528cba56872313b8cd63ff11f523a399dfb3c85cae1a764110ae9d26ac9151ac",
"scripts/audit_disjoint_tensor.py": "477db540e972b82751fac6a3a6d6e38fb4141e967261b1f9c260e2c686479a78",
"scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7",
"scripts/binary_phase_frames.py": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563",
"scripts/complex_compression.py": "9b6f758a5985ba5d9fdd726fe6556b3d3b4bd9d98aaf8ba06a7bb58093c4c504",
"scripts/exclusion_circuit.py": "b253f9d7318becda1c1f3b24e2287ed44a9c27fcea00cf9d531afb950d0457a0",
"scripts/experiments/disjoint_tensor.py": "102dd59bf96033f96ba0dab4c2aba77b3a7a73b67b0f96929ff8b20a98b91cd8"
Expand Down
2 changes: 1 addition & 1 deletion certificates/dyadic-central-factor.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"notes/disjoint-tensor-compression.tex": "528cba56872313b8cd63ff11f523a399dfb3c85cae1a764110ae9d26ac9151ac",
"notes/dyadic-central-factor.tex": "24c0543fb2fd815f114021f929c3efefa1ae79f29c2f7968585bcd4595a96158",
"scripts/audit_complex_centers.py": "166b18f560cd0d520d23fa29ee8147e0ea056358c4268a466ec458195a97a960",
"scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7",
"scripts/binary_phase_frames.py": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563",
"scripts/complex_compression.py": "9b6f758a5985ba5d9fdd726fe6556b3d3b4bd9d98aaf8ba06a7bb58093c4c504",
"scripts/exclusion_circuit.py": "b253f9d7318becda1c1f3b24e2287ed44a9c27fcea00cf9d531afb950d0457a0",
"scripts/experiments/complex_centers.py": "3744396587d729253d80980f6310b56e7bf0ea21b165bd178d0d6d4c49faf2e2",
Expand Down
2 changes: 1 addition & 1 deletion certificates/parity-side.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"source_sha256": {
"docs/research/parity-side.md": "75de20f8dcd3d1a2e2d19bc087eda50a6cc77027651f48198868426a80cd12f2",
"scripts/audit_parity_side.py": "7cbdd405ce11fa6f7ffcbef3811174f8685ad4640e9330176601d3b3d3e95390",
"scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7",
"scripts/binary_phase_frames.py": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563",
"scripts/experiments/disjoint_tensor.py": "102dd59bf96033f96ba0dab4c2aba77b3a7a73b67b0f96929ff8b20a98b91cd8",
"scripts/experiments/mixed_point_circuit.py": "f509362b5031976a22af351fd158ae0b4520fa4f286a5176ec37023d672a7ddc",
"scripts/experiments/parity_phase_repair.py": "1f76f3b96ed556ed901835bd101d0e2588c997d2ed39bdfca097f0187aa86d40",
Expand Down
16 changes: 16 additions & 0 deletions research/parity-side-basis-cache/NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Parity-side basis/contains tooling package

This directory adds an equivalence-preserving speedup of
`scripts/binary_phase_frames.py` for the historical parity-side audit.

Predecessor attribution:

- Douglas R. Colkitt: `scripts/binary_phase_frames.py`,
`scripts/experiments/parity_side.py`,
`scripts/experiments/parity_phase_repair.py`,
`scripts/audit_parity_side.py`, `docs/research/parity-side.md`, and the
committed certificates that bind those sources.
- The selected-record and catalogue pins are provenance only; this package does
not alter the selected frontier.

Prepared by Wentao Li with substantial AI assistance. Apache-2.0.
84 changes: 84 additions & 0 deletions research/parity-side-basis-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Faster parity-side basis/contains with identical receipts

**Tooling improvement; no new kappa.** At base
`0b1cccf86e2f5132ed286a26ef0a681a495740ea`, the historical parity-side audit
(`scripts/audit_parity_side.py`) rejects a specified even-`h` signed
intersection-parity DAG and prices its deterministic frame-safe coarsening for
`h = 8, 10, 26`. Profiling shows most time in
`scripts/binary_phase_frames.py`: `basis` and `contains` are called millions of
times from `parity_phase_repair.coarsen`, and `contains` previously rebuilt
`basis(space)` twice per membership test.

This change memoizes `basis` on the row tuple and implements `contains` by
reducing the vector against one basis of the space. The highest-bit pivot rule,
elimination order, classify/nullspace/residual APIs and every Boolean result are
unchanged. Only the source pin for `scripts/binary_phase_frames.py` changes
inside the three certificates that bind that file.

## Reproduce

Python **3.12**, standard library only, from the repository root:

```sh
python3.12 -I -B research/parity-side-basis-cache/verify.py
python3.12 -I -O -B research/parity-side-basis-cache/verify.py
python3.12 -B scripts/research_package.py --package research/parity-side-basis-cache
python3.12 -I -B research/parity-side-basis-cache/benchmark.py --rounds 5
```

Expected:

```text
PASS_PARITY_SIDE_BASIS_CACHE h=[8, 10, 26] roles=[724, 2271, 82720] repaired=[938, 3283, 308336] ... no_new_kappa
PASS_REGISTERED_RESEARCH_PACKAGE research/parity-side-basis-cache outcome=completed
PASS_IDENTICAL_PARITY_SIDE_RECEIPTS
```

Default verify is read-only. Use `--write-certificate` only after editing the
production source. Full `make verify`, selected cold replay, Lean, and
multiplication-theorem obligations were not rerun for this isolated
historical-checker change.

## Result

On Linux / CPython 3.12.3, five alternating fresh-process pairs of the full
`h=8,10,26` parity-side experiment stream gave median wall time
**27.349 → 13.463 seconds (2.03×)**. Timing is host-descriptive and is not a
correctness gate; all samples and environment pins are in
[RESULT.json](RESULT.json). Every experiment receipt matches the baseline
checker fieldwise (`roles`, `repaired_roles`, `dag_sha256`, nested-edge counts
and obstruction fields). Restoring the old `binary_phase_frames.py` pin
recovers each base certificate byte-for-byte after that single substitution.

## Equivalence

- `basis` still inserts highest-bit pivots first and returns
`tuple(pivots[p] for p in sorted(pivots, reverse=True))`.
- Memoization keys the exact row tuple; list/generator inputs are converted with
`tuple(rows)` before the cache, matching the previous materialization.
- `contains(space, v)` is true iff reducing `v` against `basis(space)` yields
zero, which holds exactly when
`len(basis((*space, v))) == len(basis(space))`.
- `classify` still calls `basis` twice (once on the generators, once on the Gram
rows); only the cost of those calls changes.

## Overlap and credit

Closest priors (different objects):
[CrocSwap/integer-mult-bounds#756](https://github.com/CrocSwap/integer-mult-bounds/pull/756)
packed balanced-Fano replay;
[CrocSwap/integer-mult-bounds#1793](https://github.com/CrocSwap/integer-mult-bounds/pull/1793)
inplace-side prefix scan;
[CrocSwap/integer-mult-bounds#1217](https://github.com/CrocSwap/integer-mult-bounds/pull/1217)
ternary frame-pair memoization (h=8/9 frames only; not `binary_phase_frames`).
No competing open PR on this parity-side/`binary_phase_frames` object at refresh.

Douglas R. Colkitt authored the parity-side obstruction, repair and original
binary phase-frame checkers. Prepared by Wentao Li
([VictorLiwentao](https://github.com/VictorLiwentao),
[@Is__Victor](https://x.com/Is__Victor)) with substantial AI assistance, under
Apache-2.0.

## Open next questions

Structured entries are in [TASK.json](TASK.json).
207 changes: 207 additions & 0 deletions research/parity-side-basis-cache/RESULT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"baseline_sha256": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7",
"executable": "/usr/bin/python3.12",
"median_baseline_seconds": 27.349352475999694,
"median_optimized_seconds": 13.46312518700006,
"median_ratio": 2.031426737560765,
"no_new_kappa": true,
"note": "Wall times are host-descriptive; receipt equality is the correctness gate.",
"platform": "linux",
"production_sha256": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563",
"python": "3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0]",
"rounds": 5,
"samples": [
{
"baseline_elapsed": 27.963557779999974,
"optimized_elapsed": 13.411698463999983,
"order": [
"baseline",
"optimized"
],
"pair": 0,
"rows": [
{
"dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529",
"h": 8,
"local_obstructions": 66,
"nested_edges_checked": 1396,
"repaired_roles": 938,
"retained_nodes": 570,
"roles": 724
},
{
"dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e",
"h": 10,
"local_obstructions": 2,
"nested_edges_checked": 4506,
"repaired_roles": 3283,
"retained_nodes": 1463,
"roles": 2271
},
{
"dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78",
"h": 26,
"local_obstructions": 59,
"nested_edges_checked": 355600,
"repaired_roles": 308336,
"retained_nodes": 52464,
"roles": 82720
}
]
},
{
"baseline_elapsed": 27.587736632000087,
"optimized_elapsed": 13.387676265999744,
"order": [
"optimized",
"baseline"
],
"pair": 1,
"rows": [
{
"dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529",
"h": 8,
"local_obstructions": 66,
"nested_edges_checked": 1396,
"repaired_roles": 938,
"retained_nodes": 570,
"roles": 724
},
{
"dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e",
"h": 10,
"local_obstructions": 2,
"nested_edges_checked": 4506,
"repaired_roles": 3283,
"retained_nodes": 1463,
"roles": 2271
},
{
"dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78",
"h": 26,
"local_obstructions": 59,
"nested_edges_checked": 355600,
"repaired_roles": 308336,
"retained_nodes": 52464,
"roles": 82720
}
]
},
{
"baseline_elapsed": 27.166444544000115,
"optimized_elapsed": 13.668398991999766,
"order": [
"baseline",
"optimized"
],
"pair": 2,
"rows": [
{
"dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529",
"h": 8,
"local_obstructions": 66,
"nested_edges_checked": 1396,
"repaired_roles": 938,
"retained_nodes": 570,
"roles": 724
},
{
"dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e",
"h": 10,
"local_obstructions": 2,
"nested_edges_checked": 4506,
"repaired_roles": 3283,
"retained_nodes": 1463,
"roles": 2271
},
{
"dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78",
"h": 26,
"local_obstructions": 59,
"nested_edges_checked": 355600,
"repaired_roles": 308336,
"retained_nodes": 52464,
"roles": 82720
}
]
},
{
"baseline_elapsed": 27.14435987700017,
"optimized_elapsed": 13.46312518700006,
"order": [
"optimized",
"baseline"
],
"pair": 3,
"rows": [
{
"dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529",
"h": 8,
"local_obstructions": 66,
"nested_edges_checked": 1396,
"repaired_roles": 938,
"retained_nodes": 570,
"roles": 724
},
{
"dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e",
"h": 10,
"local_obstructions": 2,
"nested_edges_checked": 4506,
"repaired_roles": 3283,
"retained_nodes": 1463,
"roles": 2271
},
{
"dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78",
"h": 26,
"local_obstructions": 59,
"nested_edges_checked": 355600,
"repaired_roles": 308336,
"retained_nodes": 52464,
"roles": 82720
}
]
},
{
"baseline_elapsed": 27.349352475999694,
"optimized_elapsed": 13.492216302999623,
"order": [
"baseline",
"optimized"
],
"pair": 4,
"rows": [
{
"dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529",
"h": 8,
"local_obstructions": 66,
"nested_edges_checked": 1396,
"repaired_roles": 938,
"retained_nodes": 570,
"roles": 724
},
{
"dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e",
"h": 10,
"local_obstructions": 2,
"nested_edges_checked": 4506,
"repaired_roles": 3283,
"retained_nodes": 1463,
"roles": 2271
},
{
"dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78",
"h": 26,
"local_obstructions": 59,
"nested_edges_checked": 355600,
"repaired_roles": 308336,
"retained_nodes": 52464,
"roles": 82720
}
]
}
],
"status": "PASS_IDENTICAL_PARITY_SIDE_RECEIPTS",
"warmup": 1
}
Loading
Loading