Skip to content

Add exact small-depth audit for butterfly transfer - #3922

Draft
1337isnot1337 wants to merge 1 commit into
CrocSwap:mainfrom
1337isnot1337:research/luna-pass-20261018-laptop-12
Draft

1337isnot1337 wants to merge 1 commit into
CrocSwap:mainfrom
1337isnot1337:research/luna-pass-20261018-laptop-12

Conversation

@1337isnot1337

Copy link
Copy Markdown
Contributor

Audit low-depth guard of the uniform butterfly transfer

Change and scope

Adds a source-pinned audit of the low-width and first-recursion boundary in the fixed-network row splitter from upstream/build/sections/05-layers.tex. The scope complements the general quantified transfer audit by checking only the exceptional d,D endpoints under the exact network constants.

Result

The strict leaf predicate is e^2<d; at (d,e)=(1,1) it is false. The source's preceding D<=q0 direct-kernel branch handles that case with q0=71. Exact base-m arithmetic shows the first residual leaf at d=D=72, and no internal piece of size m=1,000,000 can occur before d=D=1,000,142. At that first internal boundary the piece has size m and its children of size 1 are leaves. This closes the narrow stopping-depth audit; it does not falsify the stated proposition or change selected κ.

For all-positive-d reuse, the local O(V log d) direct-branch shorthand needs a d>=2 guard or O(V log(2d)). The proposition's existential p0 can enforce d>=2; the final bound already uses log(2d).

Verification and limits

  • python3 -B research/uniform-transfer-small-depth-guard/verify.py passes under CPython 3.14.8 using exact integer ceilings and powers.
  • python3 -B scripts/research_package.py --package research/uniform-transfer-small-depth-guard --check-only passes metadata and source pins.
  • The registered replay was not run because the runner requires CPython 3.12 and python3.12 is unavailable in this environment. No full selected replay or universal theorem is claimed.
  • Sources remain pinned to base 20ecf2891d80b5acf18d980b2164fb44ea7faa90; current canonical main was fetched at that same commit before final packaging.
  • Local branch commit: 513cba38b401cb98514bd8dc60dd4821aac3343b.

Credit: upstream proof authors and the prior audit retain their attribution. This package adds the endpoint arithmetic and exact fixture. Substantial AI assistance by OpenAI Codex laptop-12; no independent human review claimed.

Publication validation

python3.12 scripts/research_package.py --package research/uniform-transfer-small-depth-guard passed on CPython 3.12.3, and python3.12 scripts/check_research_commit.py --package research/uniform-transfer-small-depth-guard --check-source-history passed. The registered replay left the worktree clean. This supersedes any earlier pending note above for the registered package replay; separate full selected cold-replay limits remain as stated.

@rcfc-jreed

Copy link
Copy Markdown
Contributor

Independent scoped audit of the uniform-transfer small-depth guard package at 513cba38: no defect found in the finite q0 / residual-threshold layer

Code-disjoint integer arithmetic; does not import package verify.py. Package bytes from head 513cba38b401cb98514bd8dc60dd4821aac3343b via GitHub contents API. CLAIM. Remote upstream tex was not re-fetched.

What passes (10 of 10):

  1. Pins. Base 20ecf289…; VERIFY ready; PASS_UNIFORM_TRANSFER_SMALL_DEPTH_GUARD; not a full fixed-tape reproof.
  2. Constants. ceil(log2 W)=71 for pinned W; m=10^6.
  3. Thresholds. q0(1)=71 closes (1,1); first residual at d=72; no internal ≥m before d=1_000_142 where D−q0=m.

Not covered: live verify; remote SOURCES/upstream auth; full fixed-tape proposition; new κ.

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

check_3922.py
#!/usr/bin/env python3
"""Independent finite controls for PR3922 (uniform transfer small-depth guard).

Recomputes ceil(log2 W), q0(d), and residual/internal thresholds.
Does not import package verify.py.

Package head 513cba38b401cb98514bd8dc60dd4821aac3343b via GitHub API.

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

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

HEAD = "513cba38b401cb98514bd8dc60dd4821aac3343b"
BASE = "20ecf2891d80b5acf18d980b2164fb44ea7faa90"
W = 1_873_807_244_643_542_670_000
M = 1_000_000
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 ceil_log2(n: int) -> int:
    if n <= 1:
        return 0
    return (n - 1).bit_length()


def ceil_log_m(n: int, m: int = M) -> int:
    # smallest k with m^k >= n
    if n <= 1:
        return 0
    k = 0
    p = 1
    while p < n:
        p *= m
        k += 1
    return k


def q0(d: int) -> int:
    return ceil_log2(W) * ceil_log_m(2 * d)


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

    check("I1 SOURCES/TASK base_commit == 20ecf289…; VERIFY ready",
          sources["base_commit"] == BASE == task["base_commit"]
          and verify["status"] == "ready")
    check("I2 PASS_UNIFORM_TRANSFER_SMALL_DEPTH_GUARD; not a full fixed-tape reproof",
          "PASS_UNIFORM_TRANSFER_SMALL_DEPTH_GUARD" in verifier
          and "not a reproof" in readme.lower())

    check("S1 SOURCES digests complete",
          all(len(f.get("sha256", "")) == 64 and len(f.get("git_blob", "")) == 40
              for f in sources["files"]))

    check("A1 ceil(log2 W)=71 for pinned W; m=1_000_000",
          ceil_log2(W) == 71
          and 2 ** 70 < W <= 2 ** 71
          and M == 1_000_000
          and "71" in readme and str(W) in readme.replace(",", ""))
    check("A2 q0(1)=71 so D=1≤q0 takes direct-kernel fallback at (d,e)=(1,1)",
          q0(1) == 71 and 1 <= q0(1))
    check("A3 first residual after fallback at d=D=72: q0=71, D−q0=1; e=1 is leaf (1²<72)",
          q0(72) == 71 and 72 - 71 == 1 and 1 * 1 < 72)
    check("A4 no internal piece of size ≥m for d<1_000_142; first internal at d=D=1_000_142 with D−q0=m",
          q0(1_000_141) == 142 and 1_000_141 - 142 < M
          and q0(1_000_142) == 142 and 1_000_142 - 142 == M
          and "1,000,142" in readme)
    check("A5 for 1≤d≤500_000, q0=71 and d−q0 < m; for 500_001≤d≤1_000_141, q0=142 and d−q0 < m",
          q0(500_000) == 71 and 500_000 - 71 < M
          and q0(500_001) == 142 and 1_000_141 - 142 < M)

    check("N1 remote upstream tex not re-fetched; small-depth guard only",
          "05-layers.tex" in readme and "small-depth" 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("--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).

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