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
101 changes: 101 additions & 0 deletions research/ternary-frame-cache/CLAIM.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"track": "verification engineering",
"assignment_seed": 93,
"seed_source": "secrets.randbelow(100), OS randomness",
"base_commit": "1b59b624d21924f8e3537cdc1ac52d3be6eda2fe",
"selected_kappa": "836330098538459/500000000000000000",
"candidate_tasks": [
{
"object": "historical ternary_side.verify_invocation_frames",
"method": "exact interned frame-pair reuse, complete h=8,9 signed edge traversals",
"choice": "selected, seed modulo 3 = 0"
},
{
"object": "prime_field_checks.frame_control",
"method": "exact rational span reuse",
"choice": "not selected"
},
{
"object": "verify_selected_result.check",
"method": "streaming source inventory hashing",
"choice": "not selected; fast check already, lower expected benefit"
}
],
"scope_key": "ternary-h8-h9-physical-edge-pair-memoization",
"object": "scripts/experiments/ternary_side.py::verify_invocation_frames",
"hypothesis": "Local exact frame and ordered transition caches reduce repeated rational work without dropping any physical edge, positivity, idempotence, nesting, or ledger check.",
"domain": {
"h": [
8,
9
],
"orientations": [
false,
true
],
"complete_physical_edges": 84672
},
"expected_deliverable": "Opt-in source-pinned checker, full before/after benchmarks, ordered edge equality, semantic failure controls; no source or certificate repins.",
"stop_rule": "One implementation, at most one evidence-driven pivot; stop optimization if no measured benefit or coverage cannot be shown.",
"budget_minutes": 50,
"verification_reserved_minutes": 12.5,
"started_utc": "2026-10-13T19:56:02Z",
"expected_finish_utc": "2026-10-13T20:46:02Z",
"coordination": {
"pinned_issue": null,
"local_claim_reason": "No pinned coordination issue; explicit posting request concerns such an issue. Read discussions 1163,1166,1167; no active matching claim found.",
"open_pr_count_at_entry": 810
},
"overlap": [
{
"pr": 154,
"head": "f571bcbd6e06618aeae0b8279da48060032dc74b",
"difference": "Scheduling and paired-cube frame changes; mentions ternary build hot spot but does not edit ternary physical-frame checker."
},
{
"pr": 367,
"head": "522285db971642c2d744cc8d45f2a5ade3a55e19",
"difference": "PR364 integer elimination adapter; no code reuse, this task preserves rational routines and reuses identical frame pairs in historical ternary controls."
},
{
"pr": 1184,
"difference": "Emitted local audit for a different complex supplier.",
"head": "2f1c9e0e671bb10aecd452e18449130b0601932d"
}
],
"predecessor_credit": [
"Douglas R. Colkitt: retained historical ternary checker and exact rational frame implementation",
"Zhihao Chen (jacklightChen), PR7: earlier F3 five-subset motif and common-pair geometry, acknowledged by the retained review"
],
"contributor": "Hanson Sun (bbMisk)",
"assistance": "Substantial OpenAI Codex assistance",
"license": "Apache-2.0",
"unrun_obligations": [
"Large h=29 DAG and full ternary assembly",
"Selected frontier1094 cold replay",
"All-size multiplication theorem and inherited compiler/precision/analytic interfaces"
],
"completion": {
"completed_utc": "2026-10-13T20:17:27.383097+00:00",
"status": "Completed tooling contribution; submitted source link below, PR link in handoff",
"result": "PASS_IDENTICAL_TERNARY_FRAME_REPLAY",
"result_source_url": "https://github.com/bbMisk/integer-mult-bounds/tree/hanson/ternary-frame-cache93-1b59b624-2000/research/ternary-frame-cache",
"physical_edges": 84672,
"python_versions": [
"3.11",
"3.14"
],
"python314_timing_pairs": 3,
"python314_ratio_of_medians": 1.7010109761129673,
"python311_timing_pairs": 1,
"python311_ratio": 1.9187589682912383,
"targeted_tests_per_python": 18,
"original_ternary_tests": 5,
"source_pins_and_selected_binding": "PASS",
"new_kappa": false,
"last_overlap_open_pr_count": 820,
"overlapping_ternary_frame_optimization_found": false,
"last_upstream_main": "1b59b624d21924f8e3537cdc1ac52d3be6eda2fe",
"coordination_update": "One local completion update; no pinned sprint issue existed."
}
}
59 changes: 59 additions & 0 deletions research/ternary-frame-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
This opt-in tool speeds up the historical ternary frame checker by caching results for exact ordered frame pairs. It retains both orientations, every physical edge, and the existing rational arithmetic. Complete matrix-and-edge transcripts and published small-control fields for h=8 and h=9 match the retained checker. Timings use alternating fresh processes. The h=29 construction is not replayed, and kappa is unchanged.

Douglas Colkitt wrote the retained checker. Zhihao Chen's PR7 supplied the earlier five-subset motif and common-pair geometry. Hanson Sun prepared this contribution with substantial OpenAI Codex assistance. See CLAIM.json for scope, SOURCES.json for pins, and evidence/ for checks and measurements.

```sh
python3 -B research/ternary-frame-cache/verify.py --out /tmp/ternary-frame-cache-93 --pairs 3
```

Expected: `PASS_IDENTICAL_TERNARY_FRAME_REPLAY 84672 edges; ... ratio of medians`.
Output directory: fresh. Dependencies: Python 3.11+ standard library on macOS or Linux.

| Input | Orientations | Physical edges | Rank sum per orientation | Decreasing dimensions per orientation |
|---|---:|---:|---:|---:|
| h=8 | 2 | 9,464 | 5,936 | 224 |
| h=9 | 2 | 75,208 | 33,084 | 324 |

```text
intern(A) = intern(B) iff A == B entrywise over Q
key(old, new) = (intern(old), intern(new))
value(old, new) = (rank(new-old), rank(new)-rank(old))
cache lifetime = one verify_invocation_frames call
per-edge predicate = rank(new-old) == abs(rank(new)-rank(old))
projection key = immutable rational row tuple U; ambient H fixed within the call
```

[Adaptation diff](evidence/ADAPTATION.diff) · [Source pins](SOURCES.json) · [Task card](CLAIM.json)

| Verification | Reproduction |
|---|---|
| Semantic controls, exact traces, alternating timing pairs | Command above |
| Controls only | `python3 -B research/ternary-frame-cache/test_package.py` |
| Original ternary tests | `python3 -B -m unittest discover -s tests -p test_ternary_side.py -v` |
| Source selection binding | `python3 -B scripts/verify_selected_result.py` |

| Boundary | Status |
|---|---|
| h=8,9 graph receipts and arbitrary-input scalar controls | Replayed in both engines |
| Both full physical-frame edge streams | Compared entry by entry, including every rational numerator and denominator |
| Missing common pair, singular Gram, non-idempotence, wrong target, wrong role count | Rejected by both engines |
| Same-rank unequal frames, reversed transitions, exact hash collisions, identity reuse | Targeted cache controls |
| Source mutations | All 20 pinned dependencies individually rejected |
| Omitted, duplicated, reordered or changed edge/matrix records | Comparator controls |
| Python `-O`, existing output directory | Refused |
| h=29 DAG and complete historical ternary assembly | Not replayed |
| Selected frontier1094 construction and all-size theorem | Not replayed or proved |
| Upstream, frozen source, selected certificate, default checker | Unchanged |

License: Apache-2.0. Source arithmetic and construction credit: Douglas R. Colkitt; prior F3 motif: Zhihao Chen, [PR7](https://github.com/CrocSwap/integer-mult-bounds/pull/7). Related tooling: [PR154](https://github.com/CrocSwap/integer-mult-bounds/pull/154) (scheduling and paired-cube frames), [PR367](https://github.com/CrocSwap/integer-mult-bounds/pull/367) (PR364 integer elimination). Exact heads and scope differences: [CLAIM.json](CLAIM.json).

| Python 3.14.6, macOS arm64; three alternating pairs | Reference | Cached |
|---|---:|---:|
| Median wall seconds | 11.525 | 6.775 |
| Maximum observed RSS, MiB | 96.297 | 105.172 |

Ratio of medians: **1.70**. [Timing and exact receipts](evidence/benchmark-python314.json) · [18 control tests](evidence/controls-python314.log) · [Initial bottleneck profile](evidence/profile-python314.txt).

Measurement boundary: complete small-control worker processes, including source admission, DAG construction, scalar checks and result writing; no tracing in timed runs. Shared host; OS caches not flushed. No speed threshold. Peak memory includes the complete worker, not only the caches.

Python 3.11: **18/18** controls; **84,672/84,672** edge records; exact transcripts equal across Python versions. [Complete replay receipt](evidence/benchmark-python311.json) · [Controls](evidence/controls-python311.log) · [Original tests and source binding](evidence/validation.json).
26 changes: 26 additions & 0 deletions research/ternary-frame-cache/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"base_commit": "1b59b624d21924f8e3537cdc1ac52d3be6eda2fe",
"historical_source_commit": "1a74950ce5074b848243ba89d8022fbadba66105",
"files": {
"certificates/ternary-side.json": "a01961cf95a3da641302bce643bdb9f2bfbff5094358c7029e0104a90d8a374f",
"scripts/audit_cancellation.py": "508934ee4d9514a5519813603b6192a0d53103b6e30d65b8d53a1a774de244b6",
"scripts/audit_fused_block.py": "2afb83ca8e5f193ca8a4c242becf267ad1d9dc2578ba238b820e98d5185f6288",
"scripts/audit_joint_frames.py": "3df8061392ce0ba42bbde8c02f2a30c8141145e70e9a48c18da73d3aafb14423",
"scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7",
"scripts/certify.py": "2348d95008276c5d5764f7e028c3918e484582cd589bd4d9b82919161745e53e",
"scripts/complex_compression.py": "9b6f758a5985ba5d9fdd726fe6556b3d3b4bd9d98aaf8ba06a7bb58093c4c504",
"scripts/exclusion_circuit.py": "b253f9d7318becda1c1f3b24e2287ed44a9c27fcea00cf9d531afb950d0457a0",
"scripts/experiments/disjoint_tensor.py": "102dd59bf96033f96ba0dab4c2aba77b3a7a73b67b0f96929ff8b20a98b91cd8",
"scripts/experiments/rank_product_core.py": "7a91c1188c5d42e864a5d2e42397b09c435b526ae4f4210c44bf615de488708e",
"scripts/experiments/shared_core.py": "d3c59b61229956cb54ae1ef9145ed213abdf1ae743929de145a77c43656f01a8",
"scripts/experiments/ternary_side.py": "93379b6e70cf58bb55432d9f2d1c0e0305c20a075bfe3cc219deabd927afd375",
"scripts/incidence_rectangles.py": "5240fd33dcc3096f5685d10ca360186cad36b355a00d55686a4ea4449417d00e",
"scripts/paired_exclusion_circuit.py": "8f05f04cf06217befd6d0ee0f2d7d0c5c5eb32cfab8c9a8ca7917fd6d620b7d2",
"scripts/paired_network.py": "991223dc3c1374284c361ed017e42bf732dd971fa0bea2be2282cfb18257b3f7",
"scripts/prepare_layers.py": "a6e2adc612f264b1c0e51d18ce6315de9ae5e2ae2420aa22e99a22d8bf304947",
"scripts/rational_tensor.py": "629b3f00a1aaab32fe908a73ca8f8412918209a300e6b1e5afe6325b9cfed3c3",
"scripts/search_network.py": "3a4faa5037d9b8e7ca5828afac193a96b6966a8b114f14937921795b24ec4f6a",
"scripts/shared_point_circuit.py": "c9bb7a5df92d260a4e3ad532b53e26936730d7c93f7facfb0784957c1e81c8ba",
"scripts/shared_point_network.py": "a85e7f0d8c42d6a27e3846308571ca324a1824ac5c2d59e4daa5c7673c33c697"
}
}
37 changes: 37 additions & 0 deletions research/ternary-frame-cache/evidence/ADAPTATION.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--- scripts/experiments/ternary_side.py::verify_invocation_frames
+++ research/ternary-frame-cache/fast.py::verify_invocation_frames
@@ -1,12 +1,14 @@
-def verify_invocation_frames(result):
+def verify_invocation_frames(result, *, observe=None, statistics=None):
"""Every physical rational edge of both signed invocation directions."""
from audit_joint_frames import eye,zero,matrix,row_basis,product,inverse,sub,rank
+ cache = FrameCache(rank, sub)
code=small_program(result);g=result['_graph'];n=result['n'];h=result['h']
S=code['roles'];r=comb(h,2);W=2*n+S+r
H=matrix([[Q(int(i==j))-Q(2,25) for j in range(h)] for i in range(h)])
I,Z=eye(h),zero(h)
require(rank(H)==h,'Degenerate ambient form')
lines=[(tuple(Q(int(t>>i&1)) for i in range(h)),) for t in g['labels']]
+ @lru_cache(maxsize=None)
def projection(U):
Ut=matrix(zip(*U));UH=product(U,H)
P=product(product(Ut,inverse(product(UH,Ut))),UH)
@@ -31,7 +33,8 @@
def touch(ports,F):
nonlocal cost,lost,edges
for slot in set(ports):
- old=physical[slot];a=rank(sub(F,old));change=rank(F)-rank(old)
+ old=physical[slot];a,change=cache.transition(old,F)
+ if observe is not None: observe(reverse,slot,old,F,a,change)
require(a==abs(change),'A physical edge has a non-nested rank charge')
cost+=a;lost+=max(0,-change);edges+=1;physical[slot]=F
program=('L','J','l','R','V','G','R','L','J','l','G','V')
@@ -57,5 +60,8 @@
require(lost==r*h and cost==W*h-2*n+2*r*h,'Invocation rank ledger failed')
evidence.append(dict(reverse=reverse,physical_edges=edges,rank_sum=cost,
decreasing_dimensions=lost,expected=W*h-2*n+2*r*h))
+ if statistics is not None:
+ statistics.update(cache.statistics())
+ statistics['projection_cache'] = projection.cache_info()._asdict()
return dict(h=h,ordinary_rational_frame_edges_checked=True,
common_pair_source_spans_checked=True,orientations=evidence)
Loading
Loading