Skip to content

Produce a one-target CRT guard stencil from paid unary geometry - #4208

Merged
Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
ToikY:codex/crt-unary-stencil-producer
Oct 21, 2026
Merged

Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
ToikY:codex/crt-unary-stencil-producer

Conversation

@ToikY

@ToikY ToikY commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

PR4201’s guard scanner left geometry/threshold construction and admission as unpriced host adapters. This adds an actual marker-driven producer for one target from six protected unary fields G,H,K,Y,J,B_back, then consumes its output with the unchanged scanner. Admission requires G>=1,H>=G,K>=G+4,Y>=J+K, nonnegative J,B_back. Binary/global/transported descriptor production and many-target integration remain open.

For every admitted unary input, the written proof gives the exact predecessor stencil, preserved inputs, eight erased private words/markers and returned heads. The producer uses only current-cell read/write/one-cell move and fixed finite control/alphabet. With L=2H+Y+B_back, M=2^L, setup is exactly 33H+25K+38Y-6G-J+12B_back+335 <= 63L+335. Adding the retained scanner gives at most 8ML+15M+76L+353 actions on seventeen fixed roles and at most M+7L+42 visited cells. Exact coefficients concern this cell/head model; fixed bit encoding introduces a constant factor. Stencil and mask are owned outputs; consuming/clearing old outputs before role reuse remains a caller duty.

Evidence:

  • Primary:145 produced stencils /138,792 literal setup actions; four scanner compositions /5,760 addresses; seven clean grammar/arithmetic rejections, five executed semantic/ownership faults and two pre-execution source-authentication controls.
  • Independently frozen pre-code oracle:83 geometries /433,280 addresses and360 larger boundary/parity/spectator cases. Root composition executes all433,280 addresses through the unchanged scanner and matches frozen masks plus both original CRT predicates; 67,748 setup actions and51,658,145 scanner actions, with three actual producer/consumer semantic faults.
  • Separate macro-derived exact invoice and14 primitive-instrumented cases. One underbilled READ preserves final values/ownership but is detected:677 actual actions versus676 billed.
  • Eight ordinary/strict-optimized registered commands pass locally and from exact committed Git-free bytes at fb1f3c84535f3e5138bd07e7ed2f211f08fc296d; all26 package/input files remain unchanged. Source history/bytes pass; all23 public package blobs match the frozen tree. Separate agent proof/contract/cost/package review passes, not human/formal-kernel acceptance.
python3.12 -B scripts/research_package.py --package research/crt-unary-stencil-producer
python3.12 -B scripts/check_research_commit.py --package research/crt-unary-stencil-producer --check-source-history

Handoff-first uniform-transfer-audit, refined scope; canonical claim. Canonical main refreshed unchanged at 12fa8c5c844be21bfefb38a19503fbd867a11244, priority7. Submission overlap:322 open/draft bodies, current1166/4173; broader closed/code/Discussion coverage partial. The four minimal unchanged PR4201 exports are retained in public own ancestor 5a41fea466cbeb7839bde864e563e191de47a0f7, preserving source availability and credit.

Remaining: actual unary input production/conversion; many-target admission/order; complete E/arithmetic, extraction/keys/sorting/repair/reinsertion; ordinary callees, precision, physical/native/outer composition and human/formal acceptance. This predicate projection is not a full production reservoir or CRT/multiplication theorem. Concrete open questions are in README/TASK.json.

Cinna Davis/PR4100 retains predicate/ordered-scan credit; Hiroki KUMAZAKI (kumagi)/PR4169/4174 retains repair/placement context; PR4201 at 4f49743a9df0cf7501cdc62bd5707a122fa071e9 retains scanner/atom/adapter/census credit; Douglas Colkitt/OpenAI and the retained NOTICE lineage remain credited. Prepared for ToikY with substantial OpenAI Codex assistance, including separate producer/proof, oracle and cost-review contexts. Apache-2.0. No new κ, merge or selected-frontier change. Maintainer edits disabled.

@rcfc-jreed

Copy link
Copy Markdown
Contributor

Independent scoped audit of the unary CRT guard-stencil producer at fb1f3c84: no defect found in the finite formula / seal / cross-receipt layer

Code-disjoint reimplementation; does not import package producer.py / primary_verify.py / cost_check.py / independent_oracle.py / cross_check.py. Package bytes from head fb1f3c84535f3e5138bd07e7ed2f211f08fc296d via GitHub contents API. CLAIM.

What passes (21 of 21):

  1. Pins. Base 12fa8c5c…; predecessor 4f49743a… (Lower admitted-stencil CRT guard scan to a literal three-tape program #4201). Status PASS_LITERAL_UNARY_ONE_TARGET_STENCIL_PRODUCER_NO_NEW_KAPPA; no_new_kappa.
  2. Seals. Four SOURCE-PINS predecessor exports match; producer.py / cost_check.py / predecessor_machine.py bind RESULT/COST digests; PRIMARY snapshot + files seals hold; oracle provenance normal≡O.
  3. Formulas. All 145 RESULT cases and 14 COST cases match 33H+25K+38Y−6G−J+12B+335 and visited 4H+2K+4Y−G+2B+38. Total producer actions 138792. Underbilled READ control rejects 676 vs 677.
  4. Cross / oracle. 83 geometries; CROSS setup/scanner/address totals match row sums; every setup matches the action formula; ORACLE address/good totals 433280 / 129600; CROSS≡ORACLE geometry sets.

Not covered: full E evaluator; binary/global descriptor production; many-target composition; live producer/oracle re-execution; new κ.

This is a finite replay of committed receipts, not a formal proof.

check_4208.py
#!/usr/bin/env python3
"""Independent finite controls for PR4208 (unary CRT guard stencil producer).

Recomputes action/visited affine formulas, cross-receipt totals, SOURCE-PINS,
and PRIMARY/oracle seals. Does not import package producer.py / primary_verify.py
/ cost_check.py / independent_oracle.py / cross_check.py.

Package head fb1f3c84535f3e5138bd07e7ed2f211f08fc296d via GitHub API.

James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor).
Apache-2.0.
"""
from __future__ import annotations

import argparse, hashlib, json, sys
from pathlib import Path

HEAD = "fb1f3c84535f3e5138bd07e7ed2f211f08fc296d"
BASE = "12fa8c5c844be21bfefb38a19503fbd867a11244"
PRED = "4f49743a9df0cf7501cdc62bd5707a122fa071e9"
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 load(pkg, name):
    return json.loads((pkg / name).read_text(encoding="utf-8"))


def sha(path: Path):
    return hashlib.sha256(path.read_bytes()).hexdigest()


def action_formula(G, H, K, Y, J, B):
    return 33 * H + 25 * K + 38 * Y - 6 * G - J + 12 * B + 335


def visited_formula(G, H, K, Y, J, B):
    return 4 * H + 2 * K + 4 * Y - G + 2 * B + 38


def run(pkg: Path):
    sources = load(pkg, "SOURCES.json")
    task = load(pkg, "TASK.json")
    verify = load(pkg, "VERIFY.json")
    pins = load(pkg, "SOURCE-PINS.json")
    result = load(pkg, "RESULT.json")
    cost = load(pkg, "COST-RESULT.json")
    cross = load(pkg, "CROSS-REPLAY.json")
    oracle = load(pkg, "ORACLE-RESULT.json")
    oprov = load(pkg, "ORACLE-PROVENANCE.json")
    primary = load(pkg, "PRIMARY-REVIEW.json")

    check("I1 SOURCES/TASK base_commit == 12fa8c5c…",
          sources["base_commit"] == BASE == task["base_commit"])
    check("I2 predecessor_head == 4f49743a… (#4201); RESULT/TASK/PRIMARY agree",
          result["predecessor_head"] == PRED == task["predecessor_head"]
          == primary["source_head"])
    check("I3 RESULT status PASS_…_NO_NEW_KAPPA; PRIMARY no_new_kappa; findings empty",
          result["status"] == "PASS_LITERAL_UNARY_ONE_TARGET_STENCIL_PRODUCER_NO_NEW_KAPPA"
          and primary["no_new_kappa"] is True
          and primary["findings"] == [])
    check("I4 VERIFY ready; TASK outcome completed",
          verify["status"] == "ready" and task["outcome"] == "completed")

    # Source pins (paths are repo-relative; local pkg uses source/…)
    bad_pin = []
    for e in pins:
        local = e["path"].split("/source/", 1)[-1]
        local = "source/" + local if not local.startswith("source/") else local
        # pins path is research/.../source/foo -> source/foo
        rel = "source/" + e["path"].rsplit("/", 1)[-1] if "/source/" in e["path"] else e["path"]
        # better: map by filename under source/
        name = Path(e["path"]).name
        p = pkg / "source" / name
        if not p.exists() or sha(p) != e["sha256"] or p.stat().st_size != e["size"]:
            bad_pin.append(e["path"])
    check("P1 SOURCE-PINS (4 predecessor exports) match source/* bytes",
          not bad_pin and len(pins) == 4, bad_pin)

    check("P2 RESULT.producer_sha256 / COST.producer_sha256 == producer.py",
          result["producer_sha256"] == sha(pkg / "producer.py")
          == cost["producer_sha256"])
    check("P3 COST.code_sha256 == cost_check.py; consumer_sha256 == predecessor_machine.py",
          cost["code_sha256"] == sha(pkg / "cost_check.py")
          and cost["consumer_sha256"] == sha(pkg / "source/predecessor_machine.py"))

    # Action / visited formulas
    bad_r = []
    for c in result["cases"]:
        g = c["geometry_G_H_K_Y_J_B"]
        if c["actions"] != action_formula(*g):
            bad_r.append(g)
    check("F1 all 145 RESULT cases: actions == 33H+25K+38Y−6G−J+12B+335",
          not bad_r and len(result["cases"]) == result["producer_cases"] == 145, bad_r[:3])
    check("F2 RESULT.total_producer_actions == sum(case.actions) == 138792",
          result["total_producer_actions"] == sum(c["actions"] for c in result["cases"]) == 138792)

    bad_c = []
    for c in cost["cases"]:
        g = c["geometry_G_H_K_Y_J_B"]
        if (c["reported_actions"] != action_formula(*g)
                or c["primitive_actions"] != action_formula(*g)
                or c["visited_cells"] != visited_formula(*g)):
            bad_c.append(g)
    check("F3 all 14 COST cases match action + visited formulas",
          not bad_c and len(cost["cases"]) == 14
          and cost["status"] == "PASS_INDEPENDENT_PRODUCER_ACTION_AND_OWNERSHIP_CENSUS", bad_c)
    ub = cost["underbilled_READ_control"]
    check("F4 underbilled READ control: invoice rejected; 676 reported vs 677 primitive",
          ub["invoice_rejected"] is True
          and ub["reported_actions"] == 676
          and ub["primitive_actions"] == 677
          and ub["omitted_READ_actions"] == 1)

    # Cross-replay totals
    check("X1 CROSS-REPLAY status PASS; 83 geometries; sums match declared totals",
          cross["status"] == "PASS_UNARY_STENCIL_CALLER_CROSSCHECK"
          and cross["geometries"] == len(cross["rows"]) == 83
          and sum(r["setup_actions"] for r in cross["rows"]) == cross["setup_actions"] == 67748
          and sum(r["scanner_actions"] for r in cross["rows"]) == cross["scanner_actions"] == 51658145
          and sum(r["addresses"] for r in cross["rows"]) == cross["addresses"] == 433280)
    bad_x = [r["geometry"] for r in cross["rows"]
             if r["setup_actions"] != action_formula(*r["geometry"])]
    check("X2 every CROSS row setup_actions matches action formula", not bad_x, bad_x[:3])

    # Oracle
    check("O1 ORACLE PASS; 83 rows; address/good totals match row sums",
          oracle["status"] == "PASS"
          and oracle["geometry_count"] == len(oracle["rows"]) == 83
          and sum(r["addresses"] for r in oracle["rows"]) == oracle["address_count"] == 433280
          and sum(r["good_addresses"] for r in oracle["rows"]) == oracle["good_address_count"] == 129600)
    omap = {
        "NOTES.txt": "ORACLE-NOTES.txt",
        "ORACLE.json": "ORACLE-RESULT.json",
        "ORACLE-O.json": "ORACLE-RESULT.json",
        "oracle.py": "independent_oracle.py",
    }
    bad_o = [k for k, rel in omap.items() if sha(pkg / rel) != oprov["files"][k]]
    check("O2 ORACLE-PROVENANCE file digests match packaged oracle artifacts; normal≡O",
          not bad_o and oprov["result_normal_O_identical"] is True
          and oprov["status"] == "FROZEN_BEFORE_PRIMARY_PRODUCER_VIEW", bad_o)

    # PRIMARY snapshot seals
    bad_s = []
    for rel, meta in primary["package_file_snapshot"].items():
        dig = meta["sha256"] if isinstance(meta, dict) else meta
        nbytes = meta.get("bytes") if isinstance(meta, dict) else None
        p = pkg / rel
        if sha(p) != dig or (nbytes is not None and p.stat().st_size != nbytes):
            bad_s.append(rel)
    check("S1 PRIMARY package_file_snapshot matches all listed package files",
          not bad_s, bad_s)
    # also files dict for core scripts
    bad_f = []
    for rel, meta in primary["files"].items():
        dig = meta["sha256"] if isinstance(meta, dict) else meta
        if sha(pkg / rel) != dig:
            bad_f.append(rel)
    check("S2 PRIMARY.files digests match core scripts/receipts", not bad_f, bad_f)

    # Cross geometry set vs oracle
    cross_geoms = {tuple(r["geometry"]) for r in cross["rows"]}
    ora_geoms = {(r["G"], r["H"], r["K"], r["Y"], r["J"], r["B"]) for r in oracle["rows"]}
    check("X3 CROSS and ORACLE geometry sets identical (83)",
          cross_geoms == ora_geoms and len(cross_geoms) == 83)

    check("NEG1 claiming new κ contradicts RESULT status tag and PRIMARY.no_new_kappa",
          primary["no_new_kappa"] is True and "NO_NEW_KAPPA" in result["status"])
    check("NEG2 RESULT scope excludes complete E / CRT supplier / kappa claim",
          "no complete E" in result["scope"].lower() or "no complete E evaluator" in result["scope"])

    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("--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))


if __name__ == "__main__":
    sys.exit(main())

James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor).

@rcfc-jreed

Copy link
Copy Markdown
Contributor

Independent scoped audit of #4208 CRT unary one-target stencil producer at fb1f3c84: 16/16

Code-disjoint checks; nested forks of primary_verify.py, independent_oracle.py, cross_check.py, and cost_check.py. Head fb1f3c84535f3e5138bd07e7ed2f211f08fc296d. CLAIM.

No packaging defect in SOURCES scope. All 9 digests match (package-local pins at HEAD).

What passes: sealed RESULT / ORACLE-RESULT / COST-RESULT / CROSS-REPLAY statuses; fresh forks regenerate matching PASS tokens for all four VERIFY entrypoints.

Not covered here: Lean; new κ; merge/close; treating finite producer/oracle replay as an all-size CRT admission proof.

Finite pin/seal/arithmetic replay ≠ formal proof.

James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants