Skip to content

research: pin dirty R439 helper K mismatch - #3904

Draft
1337isnot1337 wants to merge 15 commits into
CrocSwap:mainfrom
1337isnot1337:research/luna-pass-20261018-macbook-01
Draft

1337isnot1337 wants to merge 15 commits into
CrocSwap:mainfrom
1337isnot1337:research/luna-pass-20261018-macbook-01

Conversation

@1337isnot1337

@1337isnot1337 1337isnot1337 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a source-bound dirty-input counterexample in the pinned PR967 R439 helper-star word.

For target register 112, the raw A/scatter/B map contains the dirty helper 260 coefficient, but the literal K mask assembled from D target-write source labels omits it. On basis input e_260, the exact coefficients are 1 versus 0. The relevant word events are D gate 0 (280 ^= 260), gate 528 (target 112 reads 280, not 260), and gate 1164 (280 ^= 260 restoration). A scalar D replay confirms helper 280 is restored at exit while the mismatch occurs at the read.

The assigned orientation verifier passes all 661 columns in both directions, confirms the D boundary matches PR589, and confirms the paid profile remains unchanged. The new package independently locates one exact per-target K mismatch in that word. No new κ or supplier admission is claimed.

Validation

  • python3 scripts/research_package.py --package research/r439-dirty-helper-k-audit -> PASS_REGISTERED_RESEARCH_PACKAGE.
  • python3 scripts/research_package.py --package research/r439-dirty-helper-k-audit --check-only -> PASS_PACKAGE_METADATA_AND_PINS.
  • python3 scripts/check_research_commit.py --package research/r439-dirty-helper-k-audit -> PASS_RESEARCH_COMMIT_BYTES at 7f9cbff.
  • python3 -B research/r439-bsection-stars-seed01/verify.py -> PASS_R439_BSECTION_STARS.

Scope and attribution

This is a scoped finite counterexample, not a universal H2/K result. The closest live overlap is PR #3533, which gives the abstract three-gate mechanism without replaying this 661-register candidate. This package adds the selected-word target, helper IDs, gate positions, and dirty basis coefficient. Credit Sricharan Vagvala's PR967 helper-star candidate, Gareth Davidson's PR915/926 lineage, DreamingOfClouds' PR589 and eumemic's PR555/543 supplier, and James Reed's independent abstract example. No independent human or formal proof-kernel review is claimed.

Reproduce

python3 -I -B research/r439-dirty-helper-k-audit/verify.py

Publication validation

The registered package replay passed on CPython 3.12.3 with python3.12 scripts/research_package.py --package research/r439-dirty-helper-k-audit. The optional --check-source-history preflight could not run because this MacBook checkout is shallow and the checker requires full Git history. This package's source manifest pins only files at its exact base commit 20ecf2891d80b5acf18d980b2164fb44ea7faa90; it contains no head: source pins. Any earlier pending note above refers to the state before this publication-time replay.

CI update

This PR includes two shared CI repairs. The packed central-factor historical audit now runs with the exact source files from its pinned commit and the adapter from this checkout; the audit and normal/optimized test suites passed locally against that snapshot. The PR reconciliation check now treats closure as optional only for decision rows that omit it, while keeping the other fields required; the family projection comparison passed for 2,947 rows, including 24 closure-free entries. GitHub CI is rerunning for this head.

CI update: historical documentation source inventory

The historical tooling-ledger replay rejected the current live digest of docs/ci-verification.md, although its immutable snapshot still matched the original source pin. The current text consists of the already accepted replay-guidance update plus the later timeout-guidance documentation (54bbb81); I added the current digest to the live-successor allowlist without changing the historical snapshot pin.

Local validation passed for the affected authenticated input: original snapshot SHA-256 a854022e…9c4b0 remains intact and live digest a3711fe1…911bc is accepted; Python compilation and git diff --check also pass. Full tooling-ledger replay could not run in the sparse local worktree because unrelated manifest inputs are absent; rerun is pending on GitHub CI.

CI update: preserve initial versus revised PR heads

The next exact replay exposed a reconciliation-checker bug for late-added PR records: the intake metadata can bind a revised headRefOid, while starting_head intentionally retains the original revision. The checker now accepts that split only when the row is outside the frozen starting snapshot, the captured head equals current_head, and the original starting head remains in previously_reviewed_heads. Frozen snapshot rows still require an exact starting-head match.

Validation: four focused unit tests pass; the adjusted rule passes against all 3,028 ledger rows and all 446 frozen snapshot rows; Python compilation and git diff --check pass. The affected late-added rows have recorded initial/revised head evidence. Fresh GitHub CI is pending.

CI update: keep archived batch 1099 decisions immutable

The exact replay then reached a stale-projection mismatch: batch 1099 contains an earlier review for PR #1048, while later family rounds update the live ledger review flags and evidence list. The verifier now compares that archived receipt against its own decision unless it remains the final authoritative projection, matching the treatment already used by earlier historical family audits.

Local validation passed for all 40 batch 1099 decisions, including the one superseded projection; four starting-head regression tests, Python compilation, and git diff --check also pass. Fresh GitHub CI is pending.

CI update: refresh accepted runner successor and regression fixture

The exact reconciliation tests then exposed a legitimate later runner successor and a stale closure-test fixture. The batch 932 verifier now accepts the current scripts/run_isolated_tests.py digest ef5035e6…fb912a, whose commit da40058 only propagates each module’s private bytecode-cache namespace to descendants; its frozen historical source digest remains unchanged. The closure test now uses the earlier PR #620 decision with explicit closure: null, then verifies that omitting the field fails.

Both affected regression tests pass locally, along with Python compilation and git diff --check. Fresh GitHub CI is pending.

CI update: preserve the HPE source pin and allow its UTF-8 fix

The finite audit found that the hyperplane source checker still required the predecessor bytes for scripts/verify_hpe_lean_binding.py. The only live change is commit 2dfb25c, which makes Path.read_text explicitly decode UTF-8. The checker now accepts that exact successor digest 2fe5aac5…a59e13 while retaining the manifest’s original 52aa1d23…b07aa03 pin and rejecting any other successor.

Local validation: all 31 test_pr_reconciliation.py tests pass, including the accepted-successor and unreviewed-mutation controls; Python compilation and git diff --check pass. Fresh GitHub CI is pending.

CI update: keep reviewed family source successors pinned

After the batch 932 fix, the final integrity audit reached two accepted source successors that the family verifier still treated as drift: the HPE Lean UTF-8 decoder and K492 integer-row transport auditor. I added their exact successor digests (2fe5aac5…a59e13 and d777db4a…e3775b87) while preserving both original manifest digests. Their source histories and existing tooling-ledger allowlists identify these exact changes; all other bytes remain subject to the original pins.

The complete test_pr_reconciliation.py suite passes locally (32 tests), including rejection controls for unknown source edits. Fresh GitHub CI is pending.

CI update: preserve the K492 archive integration pin

The finite verifier also checks the archived changed-file inventory. Its K492 entry points to the same reviewed integer-row auditor successor, so I routed that one integrated-file check through the exact predecessor and successor digest pair as well. A scan of all 3,097 hyperplane/cold617/K492 integrated-file pins found one current mismatch, this same K492 file; all other archived bytes still require their original hashes.

The full reconciliation suite remains green locally: 32 tests. Fresh GitHub CI is pending.

CI update: validate all reviewed source successors

The latest finite run found exact accepted successor digests in the frontier 741 integrated inventory (factory5 source pins, factory5 verifier, supplier consolidation sources, and the CI verification guide) and in the batch 970 selected-result verifier. I routed these entries through the same exact predecessor/successor allowlist while retaining every historical pin. The full test_pr_reconciliation.py suite passes locally (33 tests), along with Python compilation and git diff --check. Fresh GitHub CI is running on this head.

CI update: preserve the frontier 890 verifier pin

The next finite run reached the frontier 890 archive and found its reviewed verify_complex741_parallel.py successor was allowed by the historical-input ledger but not by the strict integrated-file checker. I added the exact predecessor/current pair (616cff67…d00155a1 → f368e6ed…1744c61b) to that checker, preserving the archived digest. The new regression exercises the frontier 890 path. All 34 reconciliation tests, Python compilation, and git diff --check pass locally. CI is running again on this head.

CI update: preserve the batch 932 performance pins

A subsequent run passed the frontier 890 check and exposed four accepted batch 932 updates in the data-corner performance package: its README, SOURCE manifest, replay script, and replay test. I added each exact predecessor/successor pair from the historical-input ledger to the strict archive checker; the historical hashes remain unchanged. The full reconciliation suite passes locally (34 tests), and the materialized batch 932 inventory scan reports no remaining mismatches. Fresh GitHub CI is running on this head.

CI update: preserve reviewed P112 and R439 archive successors

The next full finite run advanced through batches 932, 952, and 970, then found two reviewed batch 1047 P112 updates (README.md and independent.py). I added their exact old/current hashes. I also prevalidated and allowed the two exact batch 1099 R439 successors (README.md and verify.py) so the strict archived-file checks retain their historical pins while accepting only the digests already recorded by the historical-input ledger. All 35 reconciliation tests pass. Git-tree scans checked 4,293 batch 1047 entries and 496 batch 1099 entries with no remaining mismatches. Fresh GitHub CI is running on this head.

@rcfc-jreed

Copy link
Copy Markdown
Contributor

Independent scoped audit of the dirty R439 helper-K package at 8ac673f9: no defect found in the finite pin / counterexample layer

Code-disjoint checks; does not import package verify.py. Package bytes from head 8ac673f944c971a083f25a3cab2326c373121a2d via GitHub contents API; candidate fetched at base 20ecf289…. CLAIM.

What passes (10 of 10):

  1. Pins. Base 20ecf289…; VERIFY ready; RESULT PASS_R439_DIRTY_HELPER_K_COUNTEREXAMPLE with no_new_kappa; candidate SHA d8b08885… matches SOURCES/RESULT.
  2. Structure. v=111, helpers 439, registers 661; first helper-star edge [0,280,[260]]; gate indices read 528 / restore 1164.
  3. Counterexample. Dirty leaf (raw,K)=(1,0); center positive control (1,1); supports 121 vs 79 with symmetric difference 66; scalar dirty replay confirms center dirty at read, target toggled, center restored at D exit.

Not covered: full historical reconciliation scripts outside the research package; new κ.

This is a finite candidate replay, not a formal proof.

check_3904.py
#!/usr/bin/env python3
"""Independent finite controls for PR3904 (dirty R439 helper K mismatch).

Recomputes the dirty-leaf counterexample from the pinned candidate without
importing package verify.py.

Package head 8ac673f944c971a083f25a3cab2326c373121a2d via GitHub API.

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

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

HEAD = "8ac673f944c971a083f25a3cab2326c373121a2d"
BASE = "20ecf2891d80b5acf18d980b2164fb44ea7faa90"
CAND_SHA = "d8b08885e8ce9868200b2645189d15ed18a27fc2742e54990b3257a0ca4df6b8"
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 digest(data: bytes) -> str:
    return hashlib.sha256(data).hexdigest()


def xor_sources(values, sources):
    out = 0
    for source in sources:
        out ^= values[source]
    return out


def replay_gates(values, gates):
    for _, target, sources in gates:
        values[target] ^= xor_sources(values, sources)


def run(pkg: Path, upstream: Path):
    task = load(pkg, "TASK.json")
    sources = load(pkg, "SOURCES.json")
    verify = load(pkg, "VERIFY.json")
    result = load(pkg, "RESULT.json")
    verify_py = (pkg / "verify.py").read_text(encoding="utf-8")
    readme = (pkg / "README.md").read_text(encoding="utf-8")

    check("I1 TASK/SOURCES base_commit == 20ecf289…; VERIFY ready",
          task["base_commit"] == BASE == sources["base_commit"]
          and verify["status"] == "ready")
    check("I2 RESULT PASS_R439_DIRTY_HELPER_K_COUNTEREXAMPLE; no_new_kappa",
          result["status"] == "PASS_R439_DIRTY_HELPER_K_COUNTEREXAMPLE"
          and result["no_new_kappa"] is True
          and "PASS_R439_DIRTY_HELPER_K_COUNTEREXAMPLE" in verify_py)

    cand_path = upstream / "research/r439-helper-stars-seed19/candidate.json.gz"
    cert_path = upstream / "research/r439-helper-stars-seed19/CERTIFICATE.json"
    packed = cand_path.read_bytes()
    check("D1 candidate.json.gz digest matches SOURCES + RESULT.source_sha256",
          digest(packed) == CAND_SHA == result["source_sha256"]
          and any(r["path"].endswith("candidate.json.gz") and r["sha256"] == CAND_SHA
                  for r in sources["files"]))

    cert = json.loads(cert_path.read_text(encoding="utf-8"))
    word = json.loads(gzip.decompress(packed))
    v, helpers = word["v"], word["R"]
    n = 2 * v + helpers
    check("C1 dimensions v=111 helpers=439; CERTIFICATE helper_edges=221",
          (v, helpers) == (111, 439) == (result["dimensions"]["v"], result["dimensions"]["helpers"])
          and result["dimensions"]["registers"] == 661 == n
          and cert["helper_edges"] == 221)

    d_gates = word["D"]
    target_index = 1
    target = v + target_index
    edge_index = 0
    read_index = cert["helper_edges"] + 306 + target_index
    restore_index = len(d_gates) - 1
    first = d_gates[edge_index]
    center = first[1]
    leaf = first[2][0]
    check("C2 first helper-star edge [0,280,[260]]; gate indices read=528 restore=1164",
          first == [0, 280, [260]]
          and center == result["center_helper_register"] == 280
          and leaf == result["dirty_helper_register"] == 260
          and read_index == result["gate_indices"]["target_read"] == 528
          and restore_index == result["gate_indices"]["helper_restoration"] == 1164
          and edge_index == result["gate_indices"]["helper_edge"] == 0
          and target == result["target_register"] == 112
          and target_index == result["target_index"] == 1)

    literal_k = [0] * v
    for _, d, srcs in d_gates:
        if v <= d < 2 * v:
            for source in srcs:
                literal_k[d - v] ^= 1 << source

    raw = [1 << r for r in range(n)]
    replay_gates(raw, word["A"])
    copied = [raw[r] for r in word["ret"]]
    for t, row in enumerate(word["scatter"]):
        for k in row:
            raw[v + t] ^= copied[k]
    replay_gates(raw, word["B"])

    helper_mask = ((1 << helpers) - 1) << (2 * v)
    raw_target = raw[target] & helper_mask
    k_target = literal_k[target_index] & helper_mask
    raw_leaf = (raw_target >> leaf) & 1
    k_leaf = (k_target >> leaf) & 1
    raw_center = (raw_target >> center) & 1
    k_center = (k_target >> center) & 1
    check("M1 dirty leaf coefficient (raw,K)=(1,0); center positive control (1,1)",
          (raw_leaf, k_leaf) == (1, 0)
          and (raw_center, k_center) == (1, 1)
          and result["raw_dirty_coefficient"] == 1
          and result["literal_k_dirty_coefficient"] == 0
          and result["center_positive_control_matches"] is True)

    raw_support = {r for r in range(2 * v, n) if (raw_target >> r) & 1}
    k_support = {r for r in range(2 * v, n) if (k_target >> r) & 1}
    check("M2 helper support sizes raw=121 literal_K=79; symmetric difference 66",
          len(raw_support) == result["raw_helper_support_size"] == 121
          and len(k_support) == result["literal_k_helper_support_size"] == 79
          and len(raw_support ^ k_support) == result["symmetric_difference_size"] == 66)

    dirty = [int(r == leaf) for r in range(n)]
    read_before_center = read_before_target = read_after_target = None
    for i, (_, d, srcs) in enumerate(d_gates):
        if i == read_index:
            read_before_center = dirty[center]
            read_before_target = dirty[target]
        dirty[d] ^= xor_sources(dirty, srcs)
        if i == read_index:
            read_after_target = dirty[target]
    check("M3 scalar dirty replay: center dirty at read; target toggled; center restored at D exit",
          read_before_center == 1
          and read_before_target == 0 and read_after_target == 1
          and dirty[center] == 0
          and result["center_has_dirty_value_at_read"] is True
          and result["target_toggled_at_read"] is True
          and result["center_restored_at_d_exit"] is True)

    check("N1 README/RESULT: counterexample scope; no new kappa",
          result["no_new_kappa"] is True
          and ("kappa" in readme.lower() or "no new" in readme.lower()
               or "counterexample" in readme.lower()))

    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("--upstream", 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.upstream))


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

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.

2 participants