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
81 changes: 81 additions & 0 deletions research/crt-reservoir-length-hypothesis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Production address length against p

**Scoped comparison. No new κ.** The selected conditional exponent stays
60403/20000000. This does not accept PR #4100.

## Result

PR #4328 absorbs the sparse repair under the hypothesis `L ≤ p`. PR #4646
reuses it: with `r ≤ floor(L/(100G))` and `L ≤ p`, the batch bound becomes
`r ≤ p/19200`, and the sharp-window union bound is at most
`p 2^{-G}/6400`.

The production census in PR #4174 builds one layout and then its plans.
The caller is `Layout(6 * L, ell, widths)` with `d = 65536`, `ell = 24`,
and widths alternating `24, 23`. The first plan, at level 1, partition 0,
batch 0, has active axes `(1, 3, 5, 7, 9)`. Its address length is the
layout length:

```text
L = 1540096, p = 9240576, p = 6L.
```

So `L ≤ p` is true for this plan, and `r_max = 5` satisfies
`r_max ≤ p/19200`. These are the constants recorded in that package's
`RESULT.json`. PR #4329 already prints the same production row, including
`p = 6L`, while deciding the guard-coloring premise. The 104,864-plan
census is not replayed.

The same constructor does not require the inequality. It accepts

```text
p = 2, ell = 2, d = 65536, every width 1,
```

where `L = 65536 > p` and `r_max = 2 > p/19200`. On that layout the step
from `L ≤ p` to `r ≤ p/19200` fails. `L ≤ p` is a property of the
production choice `p = 6L`, and it remains a hypothesis for an arbitrary
#4174 layout.

## Scope

Card `formal-interface-lemma`, scope **refined**. This is the open
question left by the sharp-window two-target check. The density comparison
is PR #4646, and the placement audit is PR #4174.

No descriptor census, repair-tariff replay, `H`-bit exchange, or
multiplication theorem is claimed. The constant `1/6400` is not retuned.

Canonical main fetched 2026-10-22T23:43:14Z at
`624de9dc66858af0945e5f8a0942488d62280d43`, priority revision 7.

## Reproduce

Python 3.12, standard library only, from the repository root:

```sh
python3.12 -B research/crt-reservoir-length-hypothesis/verify.py
python3.12 -B scripts/research_package.py --package research/crt-reservoir-length-hypothesis
```

The direct command prints `PASS_CRT_RESERVOIR_LENGTH_HYPOTHESIS`.

## Open next questions

1. On the admitted layout `p = 2`, `ell = 2`, `L = 65536`, what constant
replaces `1/6400` in `r (2/B + β) ≤ C p 2^{-G}`? There `r_max = 2`
exceeds `p/19200`, so the production factor does not transfer. First
step: evaluate that one inequality at `r = r_max`. Blocker: the
104,864-plan census is not an input here.

## Credit

Hiroki KUMAZAKI, PR #4174, for the reservoir constructor and the recorded
production constants. PR #4329 for the same production row in the
guard-coloring audit. PR #4328 for the `L ≤ p` absorption hypothesis.
PR #4646 for the constant `1/6400`. Cinna Davis, PR #4100, for the CRT
parameters those packages read.

Prepared by James Reed with substantial Cursor Grok 4.7 assistance.
Apache-2.0. No independent human review and no formal-kernel acceptance
are claimed.
42 changes: 42 additions & 0 deletions research/crt-reservoir-length-hypothesis/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"schema_version": 1,
"base_commit": "624de9dc66858af0945e5f8a0942488d62280d43",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395",
"sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602",
"sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72"
},
{
"path": "research/crt-reservoir-placement/README.md",
"usage": "input",
"git_blob": "2b6e7313b75bca33d8c72ccbd5b373d47eeeef42",
"sha256": "53bc3330c70b263784b9e28d3a059fb2e9b737683a1c5b6bad41513dbb5da89a"
},
{
"path": "research/crt-reservoir-placement/RESULT.json",
"usage": "input",
"git_blob": "8100592f75b75c8dcea5905c5c44100b7e5b9ae3",
"sha256": "decd5b0d1b766c30a66767013c2ffc5f410f029c6b6150150fa448cbcb10ac18"
},
{
"path": "research/crt-reservoir-placement/allocator.py",
"usage": "input",
"git_blob": "4b3ad89652a28f7d142248d1b5747272e696493c",
"sha256": "b764195fc6291e3c8fa8297b1f4ceaefc119d5664d8ff348b49eac8a2e79c688"
},
{
"path": "research/pr4100-crt-repair-tariff/README.md",
"usage": "input",
"git_blob": "1eba9122777570041acbd5ddcfee22ceb0e60703",
"sha256": "5953ed2ae02a609744df2274810d7016cd766f2e43bdf8f79047084ae55a0513"
}
]
}
95 changes: 95 additions & 0 deletions research/crt-reservoir-length-hypothesis/TASK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"schema_version": 1,
"task_id": "formal-interface-lemma",
"priority_revision": 7,
"base_commit": "624de9dc66858af0945e5f8a0942488d62280d43",
"original_card": {
"id": "formal-interface-lemma",
"question": "Can one uncovered interface implication be formalized with exact caller and certificate bindings?",
"starting_points": [
"docs/research/research-family-status.md",
"certificates/selected-result.json",
"research/gate-operand-parity-lean/README.md",
"research/staged544-certified-endpoint/README.md",
"research/unconditional-batched-crt/README.md"
],
"methods": [
"Formalize a missing boundary lemma identified by the selected review.",
"Audit a formal theorem-to-certificate binding independently."
],
"acceptance_gate": "State the exact formalized proposition and remaining assumptions; avoid duplicate arithmetic formalizations already present.",
"first_step": {
"command": [
"python3",
"-B",
"scripts/research_baseline.py"
],
"expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY",
"inspect": "Inventory the gate-operand parity lemma (#3807) and certified endpoint arithmetic (#3857). Neither is a full multiplication proof. For #4100, audit the compact-switch statement and its hypotheses before formalizing it.",
"scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately."
},
"first_experiment": "Write one missing statement with quantified hypotheses, actual caller and existing coverage. A compact-switch lemma is a candidate only after its mathematical contract is reviewed. Establish a bounded proof plan before a separately budgeted proof-assistant build; do not rerun large Lean jobs as orientation.",
"bottleneck_link": "A missing interface proof can reduce the conditional gap even if it does not change kappa.",
"allowed_variations": [
"Narrow to one formal lemma or one theorem-to-certificate binding."
],
"scope_change_triggers": [
"Formalizing already-covered arithmetic and claiming the full multiplication theorem."
],
"overlap_terms": [
"hyperplane end",
"formal interface",
"Lean binding",
"3807",
"3857",
"4100",
"gate-operand-parity-lean",
"staged544-certified-endpoint",
"unconditional-batched-crt"
],
"existing_checks": [
{
"scope": "PR #3807: scoped gate-operand parity formalization.",
"evidence": "research/gate-operand-parity-lean/README.md",
"remaining": "Exact theorem-to-caller binding and genuinely uncovered interface lemmas.",
"status": "author-checked",
"source_commit": "4c3530f42a6abcc48e7a6bcffd6c901911dc8269",
"selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129"
},
{
"scope": "PR #3857: certified real-power moment/endpoint arithmetic.",
"evidence": "research/staged544-certified-endpoint/README.md",
"remaining": "Uniform algorithmic implications, not another endpoint digit.",
"status": "author-checked",
"source_commit": "ef4315b8caa605e47a2515004845eb2d2ed71a86",
"selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129"
},
{
"scope": "PR #4100: compact-switch formalization proposed as future validation.",
"evidence": "research/unconditional-batched-crt/README.md",
"remaining": "Audit the statement and assumptions before a formal proof campaign.",
"status": "author-checked",
"source_commit": "337d04939571a637aeab54a0f58f54fde811663a",
"selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129"
}
]
},
"scope_status": "refined",
"actual_scope": "Compare the address length L of one #4174 production plan with that plan's p, and record whether L <= p is true there or only a hypothesis the constructor does not enforce.",
"scope_change_reason": "PR #4904 left open whether L <= p holds for a real #4174 placement. The successive sixteenth walks are closed, and the sharp-window pair check is recorded. This package reads that one plan. It does not rerun the descriptor census, does not retune 1/6400, and does not claim a new kappa.",
"bottleneck_link": "The sharp-density absorption r <= p/19200 uses L <= p. On the recorded production plan the inequality holds because the caller sets p = 6L. The same constructor accepts a layout with L > p, so the constant is not an invariant of every #4174 layout. The selected frontier is unchanged.",
"budget_minutes": 60,
"stop_rule": "Stop after one production plan and one admitted layout with L > p. Do not iterate the 104864 batches, replay the repair tariff, or spend p^100.",
"outcome": "completed",
"evidence": "python3.12 -B scripts/research_package.py --package research/crt-reservoir-length-hypothesis",
"author": "James Reed",
"ai_assistance": "Substantial assistance from Cursor Grok 4.7.",
"open_questions": [
{
"question": "On the admitted #4174 layout with p=2, ell=2 and L=65536, what constant replaces 1/6400 in the comparison r(2/B+beta) <= C p 2^{-G}?",
"why_it_matters": "There r_max=2 exceeds p/19200, so the production factor 1/6400 does not transfer.",
"first_step": "Evaluate that one inequality at r = r_max for this layout only.",
"blocked_by": "The 104864-plan census is not an input to this package."
}
]
}
23 changes: 23 additions & 0 deletions research/crt-reservoir-length-hypothesis/VERIFY.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"schema_version": 1,
"status": "ready",
"python": "3.12",
"requirements": [],
"inputs": [
"research/crt-reservoir-placement/README.md",
"research/crt-reservoir-placement/RESULT.json",
"research/crt-reservoir-placement/allocator.py",
"research/pr4100-crt-repair-tariff/README.md"
],
"commands": [
{
"argv": [
"{python}",
"-B",
"{package}/verify.py"
],
"timeout_seconds": 60,
"checks": "The first #4174 production plan has address length 1540096 and p=9240576, so L=p/6. The same constructor accepts p=2, ell=2, L=65536 with L>p. A control rejects treating L<=p as a constructor invariant."
}
]
}
97 changes: 97 additions & 0 deletions research/crt-reservoir-length-hypothesis/verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env python3
"""Compare one #4174 production plan's address length with its p.

PR #4328 absorbs the sparse repair when L <= p. PR #4646 reuses that
hypothesis for the constant 1/6400. This verifier reads the production
layout from PR #4174 and one plan, then one other layout the same
constructor accepts. It does not rerun the descriptor census, and it
claims no new kappa.
"""

from __future__ import annotations

import hashlib
import importlib.util
import json
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[2]
PACKAGE = ROOT / "research" / "crt-reservoir-length-hypothesis"
ALLOCATOR = ROOT / "research/crt-reservoir-placement/allocator.py"
RESULT = ROOT / "research/crt-reservoir-placement/RESULT.json"

PRODUCTION_PHRASE = "`p=9240576`, `L=1540096`, `G=3072`, `r_max=5`, `H=15360`"
HYPOTHESIS_PHRASE = "for `L ≤ p` and"


def need(condition: bool, message: str) -> None:
if not condition:
raise SystemExit("FAIL: " + message)


def pins_and_phrases() -> None:
sources = json.loads((PACKAGE / "SOURCES.json").read_text(encoding="utf-8"))
for row in sources["files"]:
if row["usage"] == "input":
digest = hashlib.sha256((ROOT / row["path"]).read_bytes()).hexdigest()
need(digest == row["sha256"], row["path"])
placement = (ROOT / "research/crt-reservoir-placement/README.md").read_text(encoding="utf-8")
tariff = (ROOT / "research/pr4100-crt-repair-tariff/README.md").read_text(encoding="utf-8")
need(PRODUCTION_PHRASE in placement, "production constants")
need(HYPOTHESIS_PHRASE in tariff, "L <= p hypothesis")
selected = json.loads(
(ROOT / "certificates/selected-result.json").read_text(encoding="utf-8")
)
need(selected["kappa"] == "60403/20000000", "selected kappa")


def load_allocator():
spec = importlib.util.spec_from_file_location("crt_reservoir_allocator", ALLOCATOR)
module = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = module
spec.loader.exec_module(module)
return module


def production_plan(allocator) -> None:
recorded = json.loads(RESULT.read_text(encoding="utf-8"))["production"]
d, ell = 65536, 24
widths = tuple(ell - (i % 2) for i in range(d))
length = sum(widths)
layout = allocator.Layout(6 * length, ell, widths)
plan = next(allocator.iter_plans(layout, level=1))
need(layout.L == length == 1540096, "production address length")
need(layout.p == 6 * length == 9240576, "production p is six times L")
need(layout.L <= layout.p, "production plan satisfies L <= p")
need(layout.G == 3072 and layout.r_max == 5 and layout.H == 15360, "production guard constants")
need(plan.level == 1 and plan.partition == 0 and plan.batch_index == 0, "first plan index")
need(plan.active_axes == (1, 3, 5, 7, 9), "first plan axes")
need(plan.placement.length == layout.L, "plan address length is L")
need(layout.r_max * 19200 <= layout.p, "production r_max is at most p/19200")
for key in ("d", "ell", "p", "L", "G", "r_max", "H"):
need(recorded[key] == getattr(layout, key), "recorded " + key)


def longer_address(allocator) -> None:
"""The constructor does not require L <= p."""
layout = allocator.Layout(2, 2, (1,) * 65536)
need(layout.p == 2 and layout.L == 65536 and layout.G == 256, "longer layout constants")
need(layout.r_max == 2, "longer layout batch size")
need(layout.L > layout.p, "admitted layout has L > p")
need(layout.r_max * 19200 > layout.p, "r_max exceeds p/19200")


def main() -> None:
pins_and_phrases()
allocator = load_allocator()
production_plan(allocator)
longer_address(allocator)
print(
"PASS_CRT_RESERVOIR_LENGTH_HYPOTHESIS "
"production_L=1540096 production_p=9240576 longer_L=65536 longer_p=2"
)


if __name__ == "__main__":
main()