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
2 changes: 1 addition & 1 deletion certificates/mixed-point-audit.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
],
"source_sha256": {
"docs/research/mixed-point-audit.md": "c80527f9e98c27bd7f5858a06c7273f84c40e0c41505eb4d16029b61f80fb968",
"scripts/experiments/mixed_point_circuit.py": "f509362b5031976a22af351fd158ae0b4520fa4f286a5176ec37023d672a7ddc",
"scripts/experiments/mixed_point_circuit.py": "cc98eeada267814fa2c0bc5f3ebb844f614d667c74d16d80d7ef29b1f90e0aa5",
"scripts/rational_span_frames.py": "7386947406d5dc4322a39fb7ccd886876a2fa1d163e823f0f231e11cf9ca0cec"
},
"status": "BOUNDED MIXED-POINT RESEARCH; NO NEW KAPPA",
Expand Down
2 changes: 1 addition & 1 deletion certificates/parity-side.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"scripts/audit_parity_side.py": "7cbdd405ce11fa6f7ffcbef3811174f8685ad4640e9330176601d3b3d3e95390",
"scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7",
"scripts/experiments/disjoint_tensor.py": "085600fc922ae167b5981505e1a5caba4d1c1df15482f61d83d2c086fa89eac1",
"scripts/experiments/mixed_point_circuit.py": "f509362b5031976a22af351fd158ae0b4520fa4f286a5176ec37023d672a7ddc",
"scripts/experiments/mixed_point_circuit.py": "cc98eeada267814fa2c0bc5f3ebb844f614d667c74d16d80d7ef29b1f90e0aa5",
"scripts/experiments/parity_phase_repair.py": "1f76f3b96ed556ed901835bd101d0e2588c997d2ed39bdfca097f0187aa86d40",
"scripts/experiments/parity_side.py": "1363ebf82d4c39e458e7bede8253688271008374db70ed4284df84253c8d092b"
},
Expand Down
12 changes: 12 additions & 0 deletions research/mixed-point-verify-masks/NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Notice — mixed-point verify masks

Douglas R. Colkitt authored the mixed-point / early-sharing screens, the
`Circuit` recurrence and interning, and the original exact-intersection
support checks consumed by this tooling package.

This package adds an equivalence-preserving closed-form rewrite of the
historical `|source ∩ target| = r` expected-support genexpr inside
`Circuit.verify`, with identical True receipts, matching output supports,
and updated source pins only.

Prepared by Wentao Li with substantial AI assistance, under Apache-2.0.
112 changes: 112 additions & 0 deletions research/mixed-point-verify-masks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Faster mixed-point Circuit.verify supports with identical receipts

**Tooling improvement; no new kappa.** At base
`0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2`, merged
[CrocSwap/integer-mult-bounds#1984](https://github.com/CrocSwap/integer-mult-bounds/pull/1984)
sped up mixed-point `scalar_check` digests but left the general
`Circuit.verify` path on `scripts/experiments/mixed_point_circuit.py` on the
historical set-intersection genexpr

```text
sum(1<<i for i,source in enumerate(inputs) if len(set(source)&set(target))==r)
```

Profiling on `build(30,3,3,1)` shows that genexpr dominates `Circuit.verify`
wall time (seconds per call; tens of seconds at h≈40). Open SharedPoint
construction PRs (#2039/#2054) and DisjointTensor `frame_data` (#2117) leave
this object free.

This change replaces the genexpr with an equivalent closed-form point-incidence
mask: precompute `vertex[p]`, then for each r-subset `U` of the target keep
inputs that contain every point of `U` and avoid every other target point. Every
output support still matches the historical checker, `verify` still returns
`True`, and support admission uses `require` so it stays enforced under `-O`.
Only the source pin for `scripts/experiments/mixed_point_circuit.py` changes
inside the two certificates that bind that file.

## Reproduce

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

```sh
python3.12 -I -B research/mixed-point-verify-masks/verify.py
python3.12 -I -O -B research/mixed-point-verify-masks/verify.py
python3.12 -B scripts/research_package.py --package research/mixed-point-verify-masks
python3.12 -I -B research/mixed-point-verify-masks/benchmark.py --rounds 5
```

Expected:

```text
PASS_MIXED_POINT_VERIFY_MASKS verify_cases=11 mask_cases=3994 certs=2 no_new_kappa
PASS_REGISTERED_RESEARCH_PACKAGE research/mixed-point-verify-masks outcome=completed
PASS_IDENTICAL_MIXED_POINT_VERIFY_MASK_RECEIPTS
```

Default verify is read-only. 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 (Linux-6.12.94+-x86_64-with-glibc2.39), five
alternating fresh-process pairs timing only `Circuit.verify` on the fixed
fixture set `build(20,3,3,{0,1})`, `build(26,3,3,{0,1})`, `build(30,3,3,1)`
(construction excluded) gave median wall time
**8.331 → 0.121 seconds (69.03×)**.
Timing is host-descriptive and is not a correctness gate; all samples and
environment pins are in [RESULT.json](RESULT.json). Every verify receipt matches
the baseline checker (`True` return and identical output-support fingerprints).

## Equivalence

For inputs indexed `0..p-1` and target point set `T` with `|T|=l`,

- historical: bits of inputs `S` with `|S ∩ T| = r`
- closed form: `OR_{U ⊆ T, |U|=r} ( (AND_{p in U} vertex[p]) & (AND_{p in T\U} (full ^ vertex[p])) )`

where `vertex[p] = OR {1<<i : input i contains point p}` and
`full = (1<<len(inputs))-1`. An XOR-of-vertex mutant (r=0) or OR-of-vertex
mutant (r>0) differs and is rejected by the package controls. Topology of the
constructed DAG is untouched; only the expected-support check is rewritten.

## Open next questions

1. **Question:** Is mixed-point `Circuit.add` / `build` construction worth a
separate identical-structure rewrite after this verify-path change?
**Why it matters:** On `build(50,3,3,1)`, `add()` is ~37% of wall time via
huge-int dict lookups; local binding alone was only ~1.09× in this session.
**First step:** Profile `Circuit.add` on the hybrid h=50 build with a
structure-identity oracle and prototype a faster intern path only if ≥~1.5×
with identical DAGs.
**Blocked by:** Out of this session’s stop rule.

2. **Question:** Should `DisjointTensor.verify`'s `dag_sha256` `json.dumps` path
still get a hand-rolled formatter after #2117 `frame_data` lands?
**Why it matters:** Post-mask verify residual is mostly json/sha of huge
support strings; a streaming hand-roll was only ~1.22× on full verify here.
**First step:** Re-profile on a tip that includes #2117.
**Blocked by:** Micro-opt under the session bar; pin conflict with open #2117.

## Overlap and credit

Closest priors (different objects):
[CrocSwap/integer-mult-bounds#756](https://github.com/CrocSwap/integer-mult-bounds/pull/756),
[CrocSwap/integer-mult-bounds#1793](https://github.com/CrocSwap/integer-mult-bounds/pull/1793),
[CrocSwap/integer-mult-bounds#1861](https://github.com/CrocSwap/integer-mult-bounds/pull/1861)
(open; primary pin `binary_phase_frames.py` — same `parity-side.json` file,
different key),
[CrocSwap/integer-mult-bounds#1984](https://github.com/CrocSwap/integer-mult-bounds/pull/1984)
(mixed-point `scalar_check` digests; this package answers the remaining general
`Circuit.verify` support-genexpr object),
[CrocSwap/integer-mult-bounds#1994](https://github.com/CrocSwap/integer-mult-bounds/pull/1994),
[CrocSwap/integer-mult-bounds#2001](https://github.com/CrocSwap/integer-mult-bounds/pull/2001),
[CrocSwap/integer-mult-bounds#2117](https://github.com/CrocSwap/integer-mult-bounds/pull/2117)
(DisjointTensor `frame_data`; different file). No competing open PR on
`Circuit.verify` at refresh.

Douglas R. Colkitt authored the mixed-point and early-sharing screens and
original 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.
50 changes: 50 additions & 0 deletions research/mixed-point-verify-masks/RESULT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"environment": {
"executable": "/usr/bin/python3.12",
"platform": "Linux-6.12.94+-x86_64-with-glibc2.39",
"python": "3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0]"
},
"fixture": "Circuit.verify on build(20/26/30,*,*,*) set (construction excluded)",
"median_baseline_seconds": 8.33077911800001,
"median_optimized_seconds": 0.12068828400003895,
"median_ratio": 69.0272397774528,
"no_new_kappa": true,
"rounds": 5,
"samples": [
{
"baseline_seconds": 8.394247341999971,
"optimized_seconds": 0.12226998500000263,
"ratio": 68.65337672201228,
"round": 0
},
{
"baseline_seconds": 8.326817022,
"optimized_seconds": 0.12068828400003895,
"ratio": 68.99441060904729,
"round": 1
},
{
"baseline_seconds": 8.33077911800001,
"optimized_seconds": 0.1204055650000555,
"ratio": 69.1893195966164,
"round": 2
},
{
"baseline_seconds": 8.44291771799999,
"optimized_seconds": 0.11961175099997945,
"ratio": 70.58602225463149,
"round": 3
},
{
"baseline_seconds": 8.279030670999987,
"optimized_seconds": 0.12259075400004349,
"ratio": 67.53389143031985,
"round": 4
}
],
"source_sha256": {
"baseline": "f509362b5031976a22af351fd158ae0b4520fa4f286a5176ec37023d672a7ddc",
"production": "cc98eeada267814fa2c0bc5f3ebb844f614d667c74d16d80d7ef29b1f90e0aa5"
},
"status": "PASS_IDENTICAL_MIXED_POINT_VERIFY_MASK_RECEIPTS"
}
54 changes: 54 additions & 0 deletions research/mixed-point-verify-masks/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"schema_version": 1,
"base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2",
"files": [
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "e8870e5917057d59b730eb14721a778639eca050",
"sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7"
},
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11",
"sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32"
},
{
"path": "certificates/mixed-point-audit.json",
"usage": "provenance",
"git_blob": "e97c2e4e24a5e3f92bd9db6abc8e890e0417b3f6",
"sha256": "54659a3844c6f233b1d5b9f30ffab65742a5b2fe4a4b510dc809253b1180e95c"
},
{
"path": "certificates/parity-side.json",
"usage": "provenance",
"git_blob": "bcc1a78412d297424db1727f49636598206b9392",
"sha256": "44ab9d7b781a28228498aa0e73229c700eac4a3a3cf93ffe8f82f52f8c52226c"
},
{
"path": "docs/research/mixed-point-audit.md",
"usage": "provenance",
"git_blob": "31f712b8f78cee8a05b8cb490c8c979c79265ee2",
"sha256": "c80527f9e98c27bd7f5858a06c7273f84c40e0c41505eb4d16029b61f80fb968"
},
{
"path": "scripts/audit_mixed_point.py",
"usage": "provenance",
"git_blob": "53a2e05d0e82df7feb18eed271264f060874335d",
"sha256": "fc7ca3e07d8a3ad54e894c387a89b310ae0b7048763cd48bb27f5daeb0d73dba"
},
{
"path": "scripts/experiments/mixed_point_circuit.py",
"usage": "provenance",
"git_blob": "b7f561f416f815d0fd135f0a0464c291a9a68468",
"sha256": "f509362b5031976a22af351fd158ae0b4520fa4f286a5176ec37023d672a7ddc"
},
{
"path": "tests/test_mixed_point.py",
"usage": "provenance",
"git_blob": "1d97e9f9bbcd4d61f618fc562a0e22b58af59ad5",
"sha256": "bb279af4bf072e9709d70cefe0cdf0230688d865f9c5e902350c4aade9218452"
}
]
}
70 changes: 70 additions & 0 deletions research/mixed-point-verify-masks/TASK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"schema_version": 1,
"task_id": "replay-runtime",
"priority_revision": 4,
"base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2",
"chooser_seed": "a41c9e7b2d805f63e0b1c7489a6d5e20",
"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": "Can scripts/experiments/mixed_point_circuit.py:Circuit.verify replace its exact-|source∩target|=r expected-support genexpr with an equivalent closed-form point-incidence mask (OR over r-subsets U of the target of inputs that contain every point of U and avoid every other target point) so verify still returns True, every output support matches the historical checker, and support require() rejection is preserved on mixed-point and early-sharing replay sizes?",
"scope_change_reason": "The catalogue card asks for one measured replay bottleneck with before/after wall time and retained checks. Expertise override selected verifier-engineering after mixed-point scalar_check digests (#1984), SharedPoint digests (#1994), ExclusionCircuit/DisjointTensor support masks (#2001), and open leave-alone construction PRs (#2039/#2054). Profiling named Circuit.verify's set-intersection genexpr (tens of seconds on h≈40) as the next unclaimed mixed-point hot path; DisjointTensor.dag_sha256 hand-roll was measured at only ~1.22× on full verify and deferred.",
"bottleneck_link": "Side result on review throughput: tests/test_mixed_point.py and any caller of Circuit.verify pay the historical genexpr. A faster identical support check does not change kappa, scalar_check digests, or the binding complex supplier.",
"budget_minutes": 60,
"stop_rule": "Ship an equivalence-preserving Circuit.verify support-mask change with frozen baseline, identical True receipts plus matching output supports on historical sizes through h=30, updated source pins only on the two binding certificates, registered replay and a measured before/after median. Do not touch audit_mixed_point.scalar_check, SharedPoint, DisjointTensor.frame_data, or run the selected cold frontier replay.",
"outcome": "completed",
"evidence": "PASS_MIXED_POINT_VERIFY_MASKS via research/mixed-point-verify-masks/verify.py (also under -O); PASS_IDENTICAL_MIXED_POINT_VERIFY_MASK_RECEIPTS via benchmark.py; two certificates differ from base only in the scripts/experiments/mixed_point_circuit.py source pin.",
"author": "Wentao Li",
"github": "VictorLiwentao",
"email": "wentaol4@illinois.edu",
"ai_assistance": "Substantial AI assistance for orientation, overlap search, profiling, implementation, packaging, benchmarking and writing. Not independent human peer review.",
"open_questions": [
{
"question": "Is mixed-point Circuit.add / build construction worth a separate identical-structure rewrite after this verify-path change?",
"why_it_matters": "On build(50,3,3,1), add() is ~37% of wall time via huge-int dict lookups; local binding alone was only ~1.09× in this session.",
"first_step": "Profile Circuit.add on the hybrid h=50 build with a structure-identity oracle (args/support/lookup order) and prototype a faster intern path only if ≥~1.5× with identical DAGs.",
"blocked_by": "Out of this session's stop rule; Circuit.verify support masks were the measured bottleneck."
},
{
"question": "Should DisjointTensor.verify's dag_sha256 json.dumps path still get a hand-rolled formatter after #2117 frame_data lands?",
"why_it_matters": "Post-mask verify residual is ~69% json/sha of huge support strings; a streaming hand-roll was only ~1.22× on full verify here because bigint str() dominates.",
"first_step": "Re-profile on a tip that includes #2117 and decide whether a ≥1.5× identical-receipt residual remains.",
"blocked_by": "Micro-opt under the session bar; leave-alone pin conflict with open #2117 until that PR merges or a fold tip is chosen."
}
]
}
55 changes: 55 additions & 0 deletions research/mixed-point-verify-masks/VERIFY.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"schema_version": 1,
"status": "ready",
"python": "3.12",
"requirements": [],
"inputs": [
"scripts/experiments/mixed_point_circuit.py",
"scripts/audit_mixed_point.py",
"certificates/mixed-point-audit.json",
"certificates/parity-side.json",
"docs/research/mixed-point-audit.md",
"tests/test_mixed_point.py",
"tests/test_mixed_point_verify_masks.py"
],
"commands": [
{
"argv": [
"{python}",
"-I",
"-B",
"{package}/verify.py"
],
"timeout_seconds": 480,
"checks": "Exact baseline copy of the base-commit mixed_point_circuit.py; closed-form exact-r masks match the historical genexpr with a mutant rejected; Circuit.verify returns True with identical output supports through h=30; two certificates differ from base only in the mixed_point_circuit.py source pin; duplicate JSON keys rejected."
},
{
"argv": [
"{python}",
"-I",
"-O",
"-B",
"{package}/verify.py"
],
"timeout_seconds": 480,
"checks": "Same equivalence and certificate pin discipline under -O (require() gates, not assert)."
},
{
"argv": [
"{python}",
"-I",
"-B",
"-m",
"unittest",
"discover",
"-s",
"tests",
"-p",
"test_mixed_point_verify_masks.py",
"-v"
],
"timeout_seconds": 180,
"checks": "Focused mixed-point verify-mask package controls."
}
]
}
Loading
Loading