Repository navigation
Conversation
Contributor
|
Independent scoped audit of the CRT reservoir placement package at Code-disjoint reimplementation; does not import package What passes (13 of 13):
Not covered: live This is a finite replay of committed receipts, not a formal proof. check_4174.py#!/usr/bin/env python3
"""Independent finite controls for PR4174 (CRT reservoir placement).
Recomputes production layout constants and RESULT census arithmetic; authenticates
SOURCES inputs. Does not import package verify.py / allocator.py.
Package head 5fec853f0c048871de3b8098d1e30d4ee19cda23; deps at base 12fa8c5c….
James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor).
Apache-2.0.
"""
from __future__ import annotations
import argparse, hashlib, json, math, sys
from pathlib import Path
HEAD = "5fec853f0c048871de3b8098d1e30d4ee19cda23"
BASE = "12fa8c5c844be21bfefb38a19503fbd867a11244"
results = []
def check(name, ok, detail=""):
results.append((name, bool(ok), detail))
print(("PASS " if ok else "FAIL ") + name + ((": " + str(detail)) if detail else ""), flush=True)
return bool(ok)
def ceil_log2(n: int) -> int:
return (n - 1).bit_length()
def auth_sources(sources, deps: Path):
bad = []
count = 0
for row in sources["files"]:
if row["usage"] != "input":
continue
data = (deps / row["path"]).read_bytes()
if hashlib.sha256(data).hexdigest() != row["sha256"]:
bad.append(row["path"])
continue
blob = b"blob " + str(len(data)).encode() + b"\0" + data
if hashlib.sha1(blob).hexdigest() != row["git_blob"]:
bad.append(row["path"] + ":blob")
continue
count += 1
return count, bad
def run(pkg: Path, deps: Path):
sources = json.loads((pkg / "SOURCES.json").read_text())
task = json.loads((pkg / "TASK.json").read_text())
verify = json.loads((pkg / "VERIFY.json").read_text())
result = json.loads((pkg / "RESULT.json").read_text())
check("I1 SOURCES/TASK/RESULT base_commit == 12fa8c5c…",
sources["base_commit"] == BASE == task["base_commit"] == result["base_commit"])
check("I2 RESULT PASS_CRT_RESERVOIR_PLACEMENT; VERIFY ready",
result["result"] == "PASS_CRT_RESERVOIR_PLACEMENT"
and verify["status"] == "ready")
n_in, bad = auth_sources(sources, deps)
check("S1 SOURCES input files authenticate (sha256 + git blob)",
not bad and n_in == result["source_inputs_checked"] == 5, bad)
prod = result["production"]
d, ell, p, L = prod["d"], prod["ell"], prod["p"], prod["L"]
# alternating 24,23 widths
widths_sum = (d // 2) * (ell + (ell - 1))
G = 64 * (ell + ceil_log2(p + 2))
r_max = L // (100 * G)
H = r_max * G
levels = int(math.log2(d))
per_level = -(-d // 10) # ceil(d/10)
total_batches = levels * per_level
check("P1 production L = (d/2)*(24+23) for alternating widths; d=65536 power of two ≥51200",
L == widths_sum == 1540096
and d == 65536 and (d & (d - 1)) == 0 and d >= 51200
and prod["width_pattern"] == "24,23 repeated")
check("P2 G=64(ell+ceil(log2(p+2)))=3072; r_max=floor(L/(100G))=5; H=15360",
G == prod["G"] == 3072
and r_max == prod["r_max"] == 5
and H == prod["H"] == 15360
and ell == 24 and p == 9240576)
check("P3 tree_levels=log2(d)=16; batches/level=ceil(d/10)=6554; total_batches=104864",
prod["tree_levels"] == levels == 16
and prod["batches_per_level"] == [per_level] * levels
and per_level == 6554
and prod["total_batches"] == total_batches == 104864)
check("P4 active_axis_visits == d * tree_levels / 2 == 524288",
prod["active_axis_visits"] == d * levels // 2 == 524288)
check("P5 max_extra_descriptor_fragments == 7; schedule_sha256 is 64 hex chars",
prod["max_extra_descriptor_fragments"] == 7
and len(prod["schedule_sha256"]) == 64
and all(c in "0123456789abcdef" for c in prod["schedule_sha256"]))
call = result["finite_caller"]
check("C1 finite_caller: L=12, H=1, 4096 addresses; conjugations=7*4096; borrowed=3*conjugations",
call["L"] == 12 and call["H"] == 1
and call["all_dirty_addresses"] == 4096
and call["layers"] == 7
and call["single_layer_conjugations"] == 7 * 4096 == 28672
and call["borrowed_field_omission_checks"] == 3 * 28672 == 86016
and call["forward_steps"] == call["inverse_steps"] == 28672
and call["moduli"] == [3, 5, 7, 11]
and call["widths"] == [2, 3, 3, 4]
and call["root_target_axis"] == 3
and call["reservoir_axis"] == 2)
check("C2 payload_permutation_sha256 present; six semantic failure controls named",
len(call["payload_permutation_sha256"]) == 64
and len(call["semantic_failure_controls"]) == 6
and {c["name"] for c in call["semantic_failure_controls"]} >= {
"root reservoir intersects full left-child dependency",
"overlapping source/destination rejected",
"stale coordinate descriptors",
"global bit used as middle-field bit",
"split axis read as one contiguous slice",
"third inverse exchange omitted",
})
check("C3 four input_rejections present (small geometry / non-power-of-two / width / ell)",
len(result["input_rejections"]) == 4
and any("small geometry" in x for x in result["input_rejections"]))
check("NEG1 limitations exclude full CRT / multiplication theorem / new kappa",
any("new kappa" in x.lower() for x in result["limitations"])
and any("multiplication theorem" in x.lower() for x in result["limitations"]))
failed = [name for name, ok, _ in results if not ok]
print(f"\n{len(results) - len(failed)}/{len(results)} PASS", flush=True)
if failed:
print("FAILED:", ", ".join(failed), flush=True)
return 1
return 0
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--pkg", required=True)
ap.add_argument("--deps", required=True)
ap.add_argument("--expect-head", default=HEAD)
args = ap.parse_args()
check("HEAD pin recorded (API fetch)", args.expect_head == HEAD, args.expect_head)
return run(Path(args.pkg), Path(args.deps))
if __name__ == "__main__":
sys.exit(main())James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor). |
This was referenced Oct 21, 2026
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR4100's CRT switch controls can read an entire left child. Its borrowed-field placement therefore needs more than avoidance of the target axes: it must preserve those dense dependencies after coordinate exchanges. This adds a constructive audit of CRT.md §3, including the root's inactive-quarter choice and axes split by placement.
The quantified proof covers the original mixed-width domain and constants. It gives at most 25,600 batches per synchronized switch layer, three mutually disjoint field exchanges plus their inverses, and at most d+12 coordinate fragments. Full dirty-state restoration is conditional on the completed repaired switch's all-address contract. The allocator and verifier make the coordinates and counterexamples independently inspectable.
Validation on Python 3.12.13:
The large run is a descriptor census. The finite caller is a root-axis projection using ideal completed-switch endpoints, not a raw compact-macro replay. No complete control evaluator, ordinary-callee implementation, last-K tail, sorting tariff, numerical claim, full CRT/multiplication theorem, or new κ is asserted. The selected frontier is unchanged.
Starts independently from canonical main
12fa8c5c844be21bfefb38a19503fbd867a11244under priority revision 7. PR4169's repair result is complementary context, not an executable dependency. Canonical coordination: Discussion #4173. Open next question: bind split-axis descriptors to the actual fixed-tape E(p,ell) evaluator and account for scans, exchanges, erasure and head returns.Credit: Cinna Davis's PR4100 supplies the audited construction; Vlado Vojdanovski's PR1673 and Jose Manuel's physical support router supply the predecessor exchange/recoloring methods. Retained compact/routing lineage is credited in the package. Prepared by Hiroki KUMAZAKI (@kumagi) with substantial OpenAI Codex assistance; new work Apache-2.0. This is not independent human review or formal proof-assistant verification.