Skip to content

feat(stdlib): the first member, bytes and text over Bytes (#92) - #153

Merged
afflom merged 11 commits into
mainfrom
claude/issue-92-stdlib-bytes-text
Oct 17, 2026
Merged

afflom merged 11 commits into
mainfrom
claude/issue-92-stdlib-bytes-text

Conversation

@humuhumu33

Copy link
Copy Markdown
Contributor

Stdlib lane of #92, member 1 of the order the issue sets: bytes and text over Bytes. Not the effects boundary (§3), which stays with afflom. SHA-256 is claimed under #126 and stays out.

What this adds

  • stdlib/, a language-1.2 project beside compiler/ (module prefix LexLeanStd), written in the authoring notation and verified by the examples leg exactly as compiler/ is (expected/build, expected/verify committed). First module Text, seven production roots for rust-std:

    root oracle (Rust std)
    startsWith (subject prefix : Bytes) : Bool <[u8]>::starts_with
    endsWith (subject suffix : Bytes) : Bool <[u8]>::ends_with
    trim (subject : Bytes) : Bytes <[u8]>::trim_ascii
    lines (subject : Bytes) : List Bytes str::lines on UTF-8 input
    splitOn (subject : Bytes) (delimiter : UInt8) : List Bytes <[u8]>::split
    joinWith (pieces : List Bytes) (separator : Bytes) : Bytes <[Vec<u8>]>::join
    find (subject needle : Bytes) : Option Nat str::find on UTF-8 input

    Written as the spike did (B1–B3): components over Bytes, character classes by equal on UInt8, no String scalar iteration; scans are iterate_until under the subject's length, accumulations list_fold, so the members carry recursion where they realize a library template (fix(production): a primitive realized by a library template carries the recursion effect (step 1 of #105) #129) and each declaration admits exactly the effects its closure realizes.

  • SL-01 (new suite stdlib, SPEC.md §17.22, register 382): the project checks and builds and the seven roots are eligible with exactly their declared effects; each member's lowered program under the calculus evaluator (600 runs) and its rendered rust-std package under the pinned rustc (3 000 runs) agree with the Rust oracle on a seeded corpus of edge cases and random inputs; a planted character class in trim (form feed → vertical tab) is detected; and under the pinned Lean the production export certifies every member (A, B, E) into packages byte-identical to the committed ones under tests/production-export/stdlib/, each realizing the program the differential ran.

  • Harness: production_export::EXPORTED adds stdlib to what check-production-export compares (PX-01 keeps its two examples); P::stdlib(); verify-examples and check-golden discover stdlib/ beside compiler/.

What it does not do

Evidence

SL-01 on Linux x86-64 with the pinned toolchain, just vv (see the CI run). The planted defect record is in VERIFICATION.md.

Closes nothing; #92 stays open for the remaining members (sorting, JSON, hex/decimal), one PR each.

🤖 Generated with Claude Code

A `stdlib/` project beside `compiler/` (module prefix `LexLeanStd`) whose
`Text` module declares `startsWith`, `endsWith`, `trim`, `lines`, `splitOn`,
`joinWith`, and `find` as production roots for `rust-std`, each admitting
exactly the effects its closure realizes. `SL-01` (suite `stdlib`, SPEC.md
§17.22) checks the eligibility of the seven roots, runs each member's
lowered program under the calculus evaluator and its rendered package under
the pinned rustc on a seeded corpus against Rust's standard library, detects
a planted character class in `trim`, and compares the certified packages the
production export publishes with the committed ones. The project passes the
example gates beside `compiler/`; `check-production-export` compares its
packages. The register has 382 IDs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The rust-std packages the production export publishes for the seven members
of LexLeanStd.Text, compared by check-production-export and SL-01.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…sue-92-stdlib-bytes-text

The register has 387 rows; SL-01 stays the last row.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ed compiler (#92)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The register has 388 rows; SL-01 stays the last row, and RT-04 keeps the
wording of #156.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The register has 392 rows; SL-01 stays the last row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed compiler, after #158 (#92)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@humuhumu33
humuhumu33 marked this pull request as ready for review October 16, 2026 23:04
#146 brought main to 392 rows with SP-14, the total this branch had reached
with SL-01, so the counts merged without a conflict at 392. The register
holds 393 rows; every count says so, and SL-01 stays the last row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
afflom pushed a commit that referenced this pull request Oct 16, 2026
… moved the identity

Refs #92. Only bootstrap/ is regenerated; stdlib/ belongs to #153.

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

afflom commented Oct 16, 2026

Copy link
Copy Markdown
Member

FYI from the axiom-parser pilot (#160, which vendors Text.lex.tex byte for byte minus the production: clauses, checked on every run). No change asked of this PR.

  • Text.trim is trim_ascii by design and is the right oracle for what it says. The parser needs Rust's str::trim / char::is_whitespace (Unicode White_Space: VT, U+0085, U+00A0, U+1680, U+2000-200A, U+2028/2029, U+202F, U+205F, U+3000), so the pilot defines its own trimmed. A trimUnicode member could replace it later.
  • startsWith, endsWith, lines, splitOn, find, matchAt, sliceOr, byteAt are used as they are and agree with the Rust parser on the pilot's corpus (12,000 audit outputs, the committed vectors).
  • Not found missing: rfind (the pilot has splitLast), parse usize and decimal formatting of a Nat (the pilot has local ones; they may be worth a member in your hex/decimal PR).

Generated by Claude Code

…ed compiler, after #146 (#92)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

afflom commented Oct 17, 2026

Copy link
Copy Markdown
Member

@humuhumu33, #159 is merged: main is ccd37ec7 (tested head 1c04cf36, 26 of 26 green; main's push run on 097b9b97 is green too). This PR's head 48e06da1 is on 097b9b97, so it lacks #159. Your run on it (38982809506) is still going (rest, atlas (cert4-replay), Intel macOS).

How I will treat the gap, so you do not spend a run on it. #159 changes only CI (ci.yml, Justfile, xtask bdd), the inventory, the join's toolchain check and the conformance harness; it changes no language data, generated Lean, record or package, so no artifact this PR's run verified can differ. For this PR only, and because of that, I accept your run on 48e06da1 if it is green, after checking the merge myself. I did that on a scratch merge of main into your head (not pushed): conflicts only in CHANGELOG.md and VERIFICATION.md (both kept); validate-model 393 ids, validate-spec-links 393 bijective, check-test-inventory reads the five parts (compiler 21, preservation 14, production 39, verification 91, rest 266; SL-01 lands in rest), check-golden equal; conformance_rp_07, rp_13, rp_14 and sl_01 are running on it now and I will post the result. Main's push run after the merge is the backstop; I will watch it.

If you push anything to this branch before then, the exception is void and the run on the new head is the one I wait for. Please do not merge main into it for this.

(R3: the first commit registers SL-01, writes the case and the module together, so the order row, scenario, failing test, implementation is not in the history. The gates check that the row, scenario and test exist, not their order; I note it as I did on #146.)


Generated by Claude Code

CHANGELOG.md and VERIFICATION.md conflicted (both kept). The merge was checked by the maintainer before the push: validate-model 393 ids, validate-spec-links 393, check-test-inventory (five parts), check-golden, and conformance_rp_07, rp_13, rp_14 and sl_01 pass on it; #159 changes no generated artifact, so the run on the previous head (22 of 22 green) is the evidence for the rest.

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

@afflom afflom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 8591c0c84, as a non-author.

What ran. Run 38982809506 on 48e06da1: all 22 checks green (host legs, examples, rest with SL-01, the 14 Atlas jobs, repro, honesty). 8591c0c84 is that head plus one merge commit of main ccd37ec7 (#159) that I made and pushed: CHANGELOG.md and VERIFICATION.md conflicted and both sides are kept. #159 changes only CI, the inventory, the join's toolchain check and the harness, no generated artifact, so the run on 48e06da1 stays the evidence for everything but the merge itself. I checked the merge before pushing: validate-model 393 ids, validate-spec-links 393 bijective, check-test-inventory (five parts, SL-01 in rest), check-golden (stdlib: 7 artifacts equal), and conformance_rp_07, rp_13, rp_14, sl_01 pass (sl_01 in 399 s with the Lean-backed export). Main's push run after the merge is the backstop.

Against #92's stdlib lane.

  • stdlib/ is a language-1.2 project (LexLeanStd.Text) written in the notation; seven roots for rust-std, each admitting exactly the effects its closure realizes.
  • SL-01: each member's lowered program under the calculus evaluator (600 runs) and its rendered package under the pinned rustc (3,000 runs) agree with the Rust oracle on a seeded corpus; a planted character class in trim is detected; under the pinned Lean the production export certifies every member (A, B, E) into packages byte-identical to the committed ones.
  • Honest scope: trim is trim_ascii; there are no theorems over the members (Bytes equality by evaluation is #91 stage 2), so the module's behavior is held by the differential, which is build evidence and is described as such. check-golden and check-production-export read stdlib/ beside the examples.

Not blocking. The first commit registers SL-01, writes the case and the module together, so R3's order is not in the history; the gates check existence, not order.

Merging with a merge commit pinned to this head.


Generated by Claude Code

@afflom
afflom merged commit c3905e7 into main Oct 17, 2026
13 checks passed
humuhumu33 pushed a commit that referenced this pull request Oct 17, 2026
…into issue-30-language-model

Both sides appended to the register: model/ids.toml, SPEC.md §31 and the
conformance test list keep SL-01 and then LM-01..LM-03 and LM-13, in the
order SPEC.md already had. The register count is 397 (main's 393 plus the
four LM rows) in README.md, SPEC.md, repository.rs, spec_links.rs and the
CHANGELOG entry, which keeps both sides. No language-1.2 version moved.
Generated records are regenerated for the combined tree in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
humuhumu33 pushed a commit that referenced this pull request Oct 17, 2026
…ith #159 and #153

stdlib/lexlean.lock moves from main's 7c6ad912... to the merged tree's
7a7834c6... (ID substitution only, as every other lock moved); goldens,
calculus packages, CONFORMANCE.md and ERRORS.md, negative fixtures, the
production export (stdlib's packages included), and every example's
verification records, stdlib's included, are rewritten for the combined
tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
afflom pushed a commit that referenced this pull request Oct 17, 2026
…rows (generated records taken from main, to be regenerated)
afflom pushed a commit that referenced this pull request Oct 17, 2026
…3f0c7 into #155)

Main moved under this branch with #162 (source packages), #153 (stdlib), #160
(bootstrap) and #165 (PK-05). The merge keeps this branch's side of the four points
that matter (the 53 renamed private names of LexLeanText.lex.tex, legacy certificate
E rendered with legacy_decoder() and no `import all`, SM-33, the decoder) and takes
main's tree for every generated record, which is regenerated here.

- register 404 (403 on main + SM-33): README, SPEC §31 total, table.len(),
  spec_links.rs set by hand;
- language-1.2 compiler-semantics ID 91b3cb51... -> 63dd4c08...: every lock that
  carried the old one is substituted and `lock --check` is current;
- regenerated in order: check-golden, check-fixtures, check-calculus,
  check-production-export, verify-examples (the language-1.2 examples, compiler,
  stdlib, bootstrap; languages 1.0/1.1 examples are untouched by this branch and
  were not rewritten), validate-model --write;
- local checks passed: validate-model, validate-spec-links, check-test-inventory,
  check-golden, conformance_{sm_33,lm_02,sp_14,rt_02,rt_04,bs_01,pk_05,rp_07,rp_14,
  rp_11,sl_01,sp_05,sp_09}.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QppGKetUURseXowZun9KY
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.

3 participants