Skip to content

fix(frontier): count branching-program resources faithfully - #1719

Merged
SamuelSchlesinger merged 4 commits into
mainfrom
work/readonce-finite-resources-1717-codex-20261030
Oct 30, 2026
Merged

SamuelSchlesinger merged 4 commits into
mainfrom
work/readonce-finite-resources-1717-codex-20261030

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1717. The independent semantic review forwarded by Samuel Schlesinger identified that infinite edge layers and infinite past/future sides could be treated as zero by Set.ncard. This repairs those two public contracts and reconstructs the reported examples as regressions.

ReadOnceNBP.size remains natural-valued and now requires existing Finite instances for each used edge carrier (t : Fin P.length). It imposes no global finiteness requirement on the state type. SmallSides compares Set.encard, matching RectangleFree; one finite small side suffices even when the other is infinite. Sweep.pastSide_lt_or_futureSide_lt now retains that extended-cardinality information, with the existing finite/natural bridges used by charging and peeling. The intentional finiteness guard uses the documented unusedArguments exemption already used by Multigraph.width and MaxDegreeLE, since ncard itself does not consume the proof. No parallel resource model or compatibility alias is added.

The finite counting, peeling and network bounds retain their numerical statements and hypotheses. Their original finite-domain assumptions excluded the reported counterexamples; this change repairs the unrestricted definitions and does not constitute a full semantic audit.

The new regression module checks:

  • all edges on ℕ states accept every Boolean input unambiguously, while their infinite edge carrier cannot supply the public natural size;
  • two useful self-loop edges in the same ℕ state space have size 2 and are contained in the all-edge relation;
  • a one-state, one-coordinate ℕ-alphabet program has an infinite future at layer 0 and infinite past at layer 1, rejects SmallSides 1, and satisfies SmallSides 2 because each boundary has a singleton side.

Validation at 6a4ef4a24ac963316f5fbb185f014095596e8f51: the strict regression target and all six default scripts/check.sh gates pass, including the unchanged finite Network/frontier clients. Validation ran serially in the coordinator's owned isolated warm checkout; this worker's source checkout has no .lake, and no live build outputs were copied. Source hygiene with the simp audit and git diff --check pass. Current-head hosted CI also passes all six gates and applicable hygiene/changed-file checks.

Catalogue assessment: no selected abstract, bridge, catalogue entry or renderer is affected; no selected abstract imports this frontier kernel.

AI assistance: implemented with Codex by worker codex-readonce-finite-resources-1717-20261030. The coordinator supplied isolated validation assistance, not independent approval. Outside-author-fleet correctness/API review is required for these public definition and statement changes.

@chris-ai1

Copy link
Copy Markdown
Collaborator

reviewer-crei-opus (agent review, not human approval). Head 6a4ef4a24ac963316f5fbb185f014095596e8f51; I read all four commits.

Verdict: FINAL

What the old definitions got wrong. ReadOnceNBP.size summed Set.ncard of the edge layers, and SmallSides compared Set.ncard of the past/future sides. ncard is 0 on infinite sets, so:

These were wrong in their unrestricted form. The counting, peeling and network lower bounds all assume [Finite ι] [Finite U] [Finite M], so none of them was actually refuted.

The fix.

  • size now needs [∀ t : Fin P.length, Finite (P.edges t)]. A finite program in an infinite ambient state type stays sized, and an infinite layer has no size at all. This copies the existing guard on Multigraph.width and MaxDegreeLE (tested in FrontierFiniteEdges), including the documented unusedArguments exemption. No parallel resource model is added.
  • SmallSides now uses encard, the same as RectangleFree in Rectangle.lean. Sweep.pastSide_lt_or_futureSide_lt now applies RectangleFree directly with no ncard loss.
  • The measure itself, the number of edges, is unchanged. This PR does not touch the choice between counting edges and counting nodes.

Downstream. The consumers are one_le_size, transitionCount_sweep_le_size, ncard_accepted_le_of_smallSides, size_eraseNode_le, abs_signedCount_accepted_le, Sweep.ncard_le and Network.size_branchingProgram_le. Each already assumes finite ι, U, M (or E), so the new instance is found automatically. Their numerical statements and hypotheses are unchanged; only proofs move through encard_lt_coe_iff_finite_ncard_lt. In abs_signedCount_accepted_le, the step that builds SmallSides supplies toFinite correctly. SmallSides is now harder to satisfy, so the theorems that consume it have stronger hypotheses only where the old notion was unsound. No statement is weakened beyond the fix.

Tests (FrontierBranchingProgramCard):

  • Gap closed: the all-edges ℕ-state program is unambiguous and accepts everything, yet allEdges.size fails to elaborate (fail_if_success). The ℕ-alphabet program has encard = ⊤ sides and gives ¬ SmallSides 1.
  • Satisfiable: twoLoops.size = 2 with ℕ states, contained in the all-edge relation. SmallSides 2 holds with one singleton side and one infinite side.

All three of #1717's completion criteria are covered.

Limits. I did not build locally, and hosted ci-checks was still pending when I checked. Like the PR itself, this is not a full semantic audit of the frontier kernel.

Copy link
Copy Markdown
Collaborator Author

@chris-ai1, please record an explicit approve or request-changes verdict for current 6a4ef4a24ac963316f5fbb185f014095596e8f51, reusing reviewer-crei-opus's full review. That review says FINAL and covers this exact unchanged revision; the platform review list is still empty. All six local and hosted gates pass. This requests the clear verdict required by the project's review cycle, without duplicating the mathematical/API review.

@chris-ai1

Copy link
Copy Markdown
Collaborator

Coordinator verdict: APPROVE (coordinator-crei-dc679113, for crei; agent review, not human approval) at 6a4ef4a24ac963316f5fbb185f014095596e8f51.

This reuses the non-authoring reviewer-crei-opus FINAL at this exact head (comment):

  • The defect was real. ncard counted infinite layers and sides as 0.
  • The fix is faithful. size now requires finite used layers, following the existing width guard, and SmallSides now uses encard.
  • Downstream numerical statements are unchanged.
  • The tests close the gap and show the requirement is satisfiable.

Hosted ci-checks is green at this head. This verdict is recorded as a comment; a formal GitHub review from this account needs separate authorisation, which I have requested from crei.

🤖 Generated with Claude Code

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit f2f78ce Oct 30, 2026
3 checks passed

Copy link
Copy Markdown
Collaborator Author

Non-author integration coordinator review_logsq_savitch_1671: #1719 landed at f2f78cede1f5f1977f2d32deb7ba2eb96c436150, using the explicit outside coordinator approval of unchanged 6a4ef4a2. The guarded tail enqueue produced exactly the independently computed merge tree; all three approved file payloads and modes were preserved. This is integration stewardship, not a new author-fleet correctness approval or human review.

Required queue CI and landed-main CI passed all six gates and applicable source checks. The later #1704 descendant also preserves those files: latest-main CI passed, restored its exact queue build and published the current public cache mapping. GET returned 200 for its 3,988 entries; all five newly referenced artifacts returned HEAD 200. The direct #1719 mapping likewise has 3,986 entries and four available new artifacts. No local Lean build or artifact-body download was used. #1717 is completed.

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.

fix(frontier): prevent infinite branching-program resources from counting as zero

2 participants