Skip to content

#91 stage 4, PR 4: the width families of the core runtime as source (RB-16, SP-22) - #248

Merged
afflom merged 83 commits into
release/v0.4from
claude/issue-91-stage4-widths-2
Oct 22, 2026
Merged

afflom merged 83 commits into
release/v0.4from
claude/issue-91-stage4-widths-2

Conversation

@afflom

@afflom afflom commented Oct 21, 2026

Copy link
Copy Markdown
Member

Stacked on #243 (claude/issue-91-stage4-runtime-core at f04907d); draft. No register row of its own: RB-16 and SP-22 cover every function the module defines.

What

The 92 functions of the eight widths are source, written out one per function and width (no ItemDef family): fixed_<w>::checked_add, checked_sub, checked_mul, checked_quot, bit_and, bit_or, bit_xor, bit_not, shift_left, shift_right, convert (88) and checked_neg_<w> for the four signed widths (4), each a call of a machine primitive, with a refines_<path with _> theorem each. The runtime module is then 110 functions and 110 theorems.

  • Modules by path. An exported name that is a path (fixed_u8::checked_add) prints inside pub mod fixed_u8 { … } under its last segment, the consecutive functions of a module in one block. The path is the runtime item's path; RustSyntax gains no construct for it. The fixed! macro, the macro rows and the method rows nothing uses are gone from the base text and the library table, which lists the path forms the generated text uses.
  • convert and RustType.i128. convert(a: i128) takes the node RustType.i128 (the AST, the decoder, the Lean constructor appended after overflow, the certificate B encoder, the leaf LkI128 of RustValidate, one more hand-built crate: BS-05 counts 443/195/306/82, 749 in all); its body is the machine primitive tryFrom, so no new machine constructor.
  • RB-16. rb_16 compiles the handwritten oracle and the generated runtime together and runs all 110 functions on 9 boundary values of the width (pairs, six shift amounts, nine conversion inputs) and 200 seeded calls each: 27 s; three width plants (checked_add of u8 for checked_sub, shift_left of i32 for shift_right, bit_xor of u16 for bit_or) fail at their function.
  • SP-22. The 110 theorems verify in 8 min 1 s (13 min 51 s of CPU), about 4 s a theorem, on this host; sp_22 is 566 s with rb_16 and rb_09, its plant runs on one theorem, and its project allows an hour. SP-22 is the one case of a new bdd part, preservation-runtime (.github/bdd-parts.json, a row in .github/vv-rows.json). The proofs need allWidth and hasWidth among their definitions; a head without them did not terminate.
  • Reader stack, measured. The runtime module reads to 1.14 MB of data nested 119 levels (a list of n elements nests n levels), and the reader recurses once per level in frames of about 17 KB in a debug build. Run on threads of 2 to 64 MiB, the read overflows at 2 MiB, which is what a default or test thread has, and succeeds at 4 MiB. So sp_22 (before it had a thread of its own), rp_10 (which recomputes the compiler-semantics ID through identity_bytes) and the decoder in runtime::core each spawn a thread of lexlean::READER_STACK. You wrote 256 MiB; I set 64 MiB, sixteen times the measured need, because it is virtual memory touched only as deep as the recursion goes. The measurement, the three places and the reason are in VERIFICATION.md's SP-22 section.

Results

Pass: rb_01 … rb_06 rb_08 rb_09 rb_15 rb_16 tc_07 sp_12 sp_13 sp_18 sp_21 sp_22 sp_23 sm_35 sm_36 rp_* but rp_10, fmt, clippy -D warnings, validate-model, validate-spec-links. conformance_bs_05 passes every leg through the certified export (1,959 s, with bootstrap/lexlean.lock relocked locally, not committed) and fails only at the comparison with the committed packages.

Fail only on records bound to the compiler-semantics ID, which the regeneration at the end of the stack rewrites once: rb_07, rp_10 (the example lock's 1.0 ID), the lexlean digest unit tests, bs_05's last leg. This PR moves the compiler-semantics ID again on top of #243's move (RustSyntax gains RustType.i128) and leaves every such record as it found it. Not run: just vv, other hosts, repro, honesty, the production export.

Next

equal/compare (traits, PR for the item kinds), then the heap items and the memory model.


Generated by Claude Code

claude added 30 commits October 19, 2026 22:04
…he machine callee (#91 stage 4, PR 1)

R3: register rows, SPEC.md section 31 rows, scenarios and the named tests
come first; the cases are not wired, so conformance_sp_21 and
conformance_rb_15 fail. The count moves 426 to 428.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
RustSyntax.Machine gains bitAnd, bitOr, bitXor, bitNot (a width), natEq,
natLe, natLt, natRem and intRem; RustSemantics evaluates each as the
TargetSyntax primitive of the same name (machinePrimitive, machineWidth,
machineShifts). The shipped copies of the two modules are regenerated from
compiler/src; the library compiles against them unchanged (conformance_sp_13).
Records bound to the compiler-semantics ID are not regenerated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…flow literal; conformance_sp_21

rust::ast gains Callee::Machine over a Machine enum that mirrors RustSyntax.Machine
(print, arity, width, the calculus primitive it realizes) and Lit::Overflow; the
validator checks a machine call's arity and refuses an overflow value outside an
Err; the certificate-B term builder writes both. SP-21 evaluates the nine new
primitives under the pinned Lean; SP-18 now checks the first eight.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
… rustc, and computed on boundary values

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
….17 states the seventeen machine primitives

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…a construct with no row

The absence of a CORRESPONDENCE row for machine calls is the gate: the validator
records the call as the construct call:machine, the closed table has no row for it,
and a lowered crate holding one is refused. SPEC.md 17.16 states the rule; the case
plants it and VERIFICATION.md records the plant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…observable overflow (#91 stage 4, PR 2)

R3: row, SPEC.md section 31 row, scenario and the named test first; the case is
not wired, so conformance_sp_23 fails. Count 428 to 429 on this draft; the
maintainer assigns the final count at landing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…overflow; the Rust mirror and the RB-15 harness cover them

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…th families decision

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…t term (#91 stage 4)

R3: row, SPEC.md section 31 row, scenario and the named test first; the case is
not wired, so conformance_sm_35 fails. Count 429 to 430 on this draft.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…ment term

SemanticProof gains TermCases { scrutinee, definitions }: checked in language 1.2
only, over a nonempty sorted unique list of prior document definitions and a term
of a document inductive type, with the hypothesis name llCase reserved; the Lean
backend lowers it to cases llCase : term <;> simp (config := {decide := true}) only
[definitions, llCase]. Both v2 schemas accept it. The case links, formats, verifies
under the pinned Lean with exactly the stated axioms, and refuses seven misuses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…md record and plants

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…in EX-07

Seven fixtures under tests/negative/, each LLT4001 with its expected diagnostic;
their locks are current for this head and are relocked with the rest by the
regeneration wave.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…e line's 430 and SP-21, RB-15)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…core branch; register 433

The bootstrap validator encoder (BS-05) meets the machine callee and the overflow
value: its program has no node for either, and the corpus holds neither, so the
encoder refuses them by name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…d the overflow value by name

The validator program has no node for either and the corpus holds neither.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…branch; register 434

The release line changed semantic-module-v2.schema.json; the term_cases entry is
re-applied to the line's schema.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…e overflow literal and their rules (BS-05)

LexLeanBoot.RustValidate: Lit.LitOverflow, Callee.CalMachine (a family index),
the machine table (name, arity) of the 17 families, machineCallC (arity then
callOk), the overflow value refused outside an Err, and the construct
call:machine. The encoder encodes both; machine_crates() adds the hand-built
corpus. The BS-05 counts are not yet calibrated and the case has not passed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…e machine crates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…rsive arms do

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…flow in an Err, call:machine)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…e the machine crates, the twenty plants, and the counts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…ap validator's tables, the family index, and the machine crates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vK7Tm6xHF5etAwKM6r9HG
…he rows it names, so a forward reference inside a mutual group pins what Lean prints
…ject but the Atlas

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QppGKetUURseXowZun9KY
@afflom
afflom changed the base branch from claude/issue-91-stage4-runtime-core to release/v0.4 October 21, 2026 17:43
@afflom
afflom marked this pull request as ready for review October 21, 2026 17:43
@afflom
afflom marked this pull request as draft October 21, 2026 17:49
@afflom
afflom marked this pull request as ready for review October 21, 2026 17:49
claude and others added 2 commits October 21, 2026 17:59
The runtime module reads to data nested over a hundred levels; a debug
build overflows a test thread's two megabytes on the round trip, so the
corpus loop of conformance_au_01 runs on a thread sized by
lexlean::READER_STACK, as identity_bytes reads the same module.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QppGKetUURseXowZun9KY
afflom pushed a commit that referenced this pull request Oct 21, 2026
…untime header

The header before the items is the runtime of the committed export, which the
regeneration of the records moves with the runtime (#248); the items are what
the printer decides, so the case holds the committed libraries to them and
holds the header to the vectors that give the roots the oracle's own header.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0163mCfJeketviuEBiXJ1sQY

afflom commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Maintainer: 526caf7 is the right fix for the examples failure. The sweep had verified std-models and std-reasoning on the new identity, but my copy-back carried only compiler, stdlib, bootstrap and the examples, so the committed records were release/v0.4's; the audit prefixes in 526caf7 (Ae8004bb2…, Aead6f803…) are what the binary of this tree computes for the two packages, and the commit touches nothing else. The copy list in the landing scripts is corrected for the next landings.

Plan from here, so pushes do not cancel each other's gate: the full gate on 526caf7 runs now (run 39657091738). When it is green bar the Atlas, I join the Atlas records from its thirteen shard artifacts and push that join together with one more harness change (every conformance case runs on the compiler's reader stack, the general form of 497bb77, validated locally on the verification part), then the final gate and the merge by merge commit. Please hold further pushes to this branch until that final gate is up.


Generated by Claude Code

afflom commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Maintainer: the rest part of run 39657091738 is red on two cases, both fallout of my regeneration, and I have the fixes in hand; please leave them to me so the pushes do not collide again.

  • conformance_rb_16: the shipped copy language/rust-runtime-1.2/RustRuntime.lex.tex was left in its pre-canonical form when the compiler project was canonicalized in the landing (a0e9447), so it no longer equals compiler/src/RustRuntime.lex.tex byte for byte. Fix: the canonical text at the shipped path. The compiler-semantics ID does not move, because a notation module contributes its data form to the identity (identity_bytes); confirmed on the rebuilt binary: the compiler project's lock is current and its semantic ID is unchanged.
  • conformance_rb_06: the plant site pub fn nat_sub(a: u64, b: u64) -> u64 { a.saturating_sub(b) } is now printed from the runtime module as pub fn nat_sub(p0: u64, p1: u64) -> u64 { u64::saturating_sub(p0, p1) } over three lines. Fix: the plant and its wrapping replacement spelled in the printed form.

Both cases, the identity unit tests and clippy are running locally now. The push comes with the Atlas join once the five shards of this run have uploaded their parts (the shards do not depend on rest), then the final gate.


Generated by Claude Code

Alexander Flom and others added 3 commits October 21, 2026 13:38
A case reads committed modules whose data nests as deeply as their lists,
and a debug build overflows a test thread's two megabytes doing so; the
dispatcher now runs each case on a thread sized by lexlean::READER_STACK,
named after the case, with a panic re-raised as the case's own. Validated
on the whole `verification` part (91 cases, 2,051 s).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QppGKetUURseXowZun9KY

afflom commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Maintainer: pushed 20efca5 on top of 9666ee5. The two fixes in 9666ee5 are the same text I had validated locally (conformance_rb_06 and conformance_rb_16 pass, the identity unit tests pass, clippy clean), with one difference: rustfmt wraps the let from = "…" line, so 9666ee5 fails cargo fmt --all -- --check, which is the first recipe of every just vv job. 20efca5 is that wrap, and it carries the harness change announced earlier (every conformance case runs on the compiler's reader stack, crates/conformance/src/cases/mod.rs; the verification part passed on it locally, 91 cases).

This run is the one whose Atlas shards I join; the join is the next push, then the final gate. Nothing else is outstanding on this branch, so no further push is needed from anyone until then.


Generated by Claude Code

afflom commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Maintainer: bdd-production of run 39663718224 is red on conformance_md_02 and the cause is my harness commit 463a625, not the tree. MD-02 re-runs itself in a process whose address space ulimit -v bounds at 1 GiB, where the wide artifact must be refused before decoding; the 64 MB stack of the per-case thread is reserved in that space and leaves it no headroom (memory allocation of 5 bytes failed). The part was green on 526caf7 without that commit.

Fix: a revert of 463a625 (the AU-* cases keep their own reader-stack thread from 497bb77, which is all the overflow needed). I am holding the revert locally and will push it together with the Atlas join once this run's shards have uploaded their parts, so that one push starts the final gate. Please hold pushes to this branch.


Generated by Claude Code

…der stack"

This reverts commit 463a625.

MD-02 re-runs itself in a process whose address space `ulimit -v` bounds at
1 GiB, where the refusal of the wide artifact must land before decoding; the
64 MB stack of a case thread is reserved in that space and leaves it no
headroom (`memory allocation of 5 bytes failed`). The AU-* cases keep their
own reader-stack thread (497bb77), which is what the overflow needed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QppGKetUURseXowZun9KY
…thirteen shard artifacts of the first gate run

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QppGKetUURseXowZun9KY

afflom commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Maintainer: pushed 677e88d, the final candidate. It carries the revert of my harness commit (MD-02's two reds) and the Atlas verification records joined locally from the thirteen shard artifacts of run 39663718224 (347 records, verified-digest ad57cd76…, audit prefix A9e69b244…, the one the gate's join asked for). On run 39663718224 every other job was green: rest with the two case fixes, examples with the package records, every bdd part, all thirteen Atlas shards. The gate on 677e88d is run 39679288933; on green I merge by merge commit, close the contained issues, and tell the sessions.


Generated by Claude Code

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