Repository navigation
feat(language-1.2): tokenizers over the native text laws (LM-01..LM-03, LM-13; part of #30) - #82
Conversation
6b46b05 to
5e4939a
Compare
5e4939a to
65d5aa4
Compare
IR slice pushed —
|
| Gate | Result |
|---|---|
cargo fmt --all -- --check |
rc=0 |
cargo check --workspace --all-features |
rc=0 |
cargo xtask validate-model |
documents current, 375 ids, 80 codes, meta-gate and audits clean (R1); audit-production: every construct of 5 enums has an explicit disposition (PD-07) |
cargo xtask validate-spec-links |
375 table rows bijective with the register (RP-07) |
cargo xtask check-test-inventory |
588 tests = 181 + 407, disjoint, none lost (RP-13) |
cargo test -p repo-conformance --test bdd |
5 passed, 0 failed |
Still draft, still red on CI, for the same single reason: conformance_lm_01…lm_12 are unwired, so every job that runs the workspace test set fails on them. Next slices: elaboration into definitions and theorems (which needs the open question below answered), then backend rendering, then the cases and the examples/text-models pipeline with its artifacts and negative fixtures, then the regeneration sweep.
Still open for the maintainers: where the universal laws are proved (emitted LexLeanText runtime versus a LexLean-authored lexlean.text library), and the renumbering of the two proposed codes LLT4013/LLT4014, which #78 has already taken.
… on #30 Realigned to the design proposal on issue #30 (2026-10-12). The suite is language-models with IDs LM-01..LM-12, matching the coverage the design lists: tokenizers, the round-trip and boundary laws, invalid UTF-8, context bounds, greedy generation, explicit randomness, classification, composition and adapters, no prompt as code, production with text_rows and certificates A, B and E, the examples/text-models example with a planted mutation, and fixed-helper coverage. No diagnostic code is registered here: audit-errors refuses a code the shipped crate never constructs (R5, section 26.1), and the two the design proposes, LLT4013 and LLT4014, are already taken by the tooling work merged in #78 main, so they are renumbered when the implementations that raise them land.
…le (IR slice of #30) The IR and checker layer the design on #30 describes: four closed declarations in lexlean/semantic-module/2 - tokenizer (scheme byte_level or longest_match over a vocabulary artifact, uint32 tokens with the byte fallback), context_window (capacity and overflow refuse or keep_last), text_generator (tokenizer, window, scorer, max_tokens, stop and a closed greedy or sample policy with xorshift32 and proportional), and text_classifier (token counts into a #29 model) - with their closed member types in the core, the new family module crates/lexlean/src/ir/semantic/language_model.rs, and the schema members. Every traversal and disposition site gains an arm; the production analysis spells the four constructs out rather than using a rest pattern, as its neighbours do (PD-07). Verified: fmt-check, cargo check --workspace --all-features, validate-model (375 ids, 80 codes, meta-gate and audits clean), validate-spec-links (375 bijective), check-test-inventory (588 tests) and the bdd meta-gate all pass. No diagnostic code is registered and no elaboration, backend rendering, case or example is included: those are later slices, and conformance_lm_01..lm_12 still fail by design.
40f60dc to
e75e239
Compare
…e B of #30) Slices (3), (4) and (5) of the language-model elaboration on #30, tokenizer only. (3) The tokenizer's universal laws ship as one native `lexlean/core-module/2` module of the embedded project `language/text-1.2/`, and linking a tokenizer elaborates the declaration into that library's import — `public import LexLeanText.LexLeanText` — and into no local declaration. No Lean text is spliced anywhere: `crates/lexlean/src/text_laws.rs` is the single seam that names the library, and the backend writes the import once, from the elaboration. `language/text-1.2/` is added to `is_v1_2_file` and to the §21.2 exclusion list, so the language 1.0 and 1.1 identities stay byte-identical. (4) `tests/text-laws/MIGRATION.md` records the migration: the re-export is equivalent (17 declarations in order, 824 DAG nodes, 699 proof nodes, every row equal in kind, universe parameters, reducibility, transparency, attributes and exact axioms; the attribute probe prints two equal outputs), and it states the one difference plainly — the private `Lean` import the generic decoder runtime adds, which §17.10 allows, and the raw probe's repeated `Init`, which `canon.py` dedupes with `dict.fromkeys` before the artifact is committed. (5) `LM-13` registers the permanent condition: no independently authored Lean implementation of the text laws exists in the release tree. Register row, byte-identical §31 row, scenario, `conformance_lm_13` (which fails before the case is wired and passes after), and the count mirrors (380). Gates: `cargo fmt --all -- --check`, `cargo check --workspace --all-features`, `cargo xtask validate-model` (380 ids, 80 codes), `cargo xtask validate-spec-links` (380 rows), `cargo xtask check-test-inventory` (599 tests = 187 + 412), `cargo test -p repo-conformance --test bdd` (5 passed), plus `conformance_rp_07`, `conformance_rp_10`, `conformance_rp_11` and `conformance_lm_13` green. The language-1.2 compiler-semantics ID moves, so every lock, golden, fixture expectation and verified record bound to it is stale; that regeneration, the example, the conformance cases for LM-01..LM-12, the other three constructs and the diagnostic codes belong to the later slices.
|
Recorded under L0.4 of the completion plan #106 (open pull requests reviewed against R3–R6 and merged or closed). Generated by Claude Code |
|
Status check on #30 / this PR (L0.4 and L2.2 of #106), from reading the branch against What the branch holds, which the description above does not say: the registration ( It conflicts with @humuhumu33 are you continuing #30? If yes, nothing from me; the above is the state to rebase from. If not, I will merge Generated by Claude Code |
|
Yes, continuing #30. I merge The next slice is the tokenizer elaboration ( |
The seven conflicts are the register's count mirrors and the additive rows on both sides: main's AU-01..AU-12 and SP-13 (381 IDs) join this branch's LM-01..LM-13, so the total is 394 in README.md, SPEC.md §31, cases/repository.rs and xtask/src/spec_links.rs; ids.toml and conformance.rs keep both sides; lib.rs keeps `surface` and `text_laws`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…03, uncompiled) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ir, lean_backend, and latex_backend versions Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…-laws library Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Progress on the tokenizer slice (LM-01..LM-03 over the native text laws), as of e1e78a8 on this branch. Landed
Merge repair. The first merge of main (9e260b2) took the branch side for every conflict and dropped #130 (PX-13, In progress. The regeneration pass for the new compiler-semantics ID (locks, goldens, calculus packages, fixtures, production export, verification records) ran through golden and calculus in WSL and stopped when WSL itself failed ( |
…age-model; the register carries only the wired text rows LM-01..LM-03 and LM-13 (390 IDs)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…roduction export, and verification records for the new language-1.2 compiler-semantics ID Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to issue-30-language-model Conflicts resolved with main's text where both sides edited one statement (RT-04), both CHANGELOG entries kept, and the register count recomputed from model/ids.toml in its four places: 387 on main plus LM-01..LM-03 and LM-13 is 391. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y is in the notation, and the CI cases pass - PD-01: language/production-1.2.toml rows and STRUCTURAL_KEYS for declaration.tokenizer, .context_window, .text_generator and .text_classifier, all formal-only (SPEC.md §17.13 states why). - AU-04: language/text-1.2/library/src/LexLeanText.lex.tex written in the authoring notation by lexlean fmt (canonical; the module is unchanged). - CL-13: text_laws is #[doc(hidden)] like every internal module. - RP-11: the README row lists LM-01, LM-02, LM-03, LM-13 one by one, since a range must end at the register's last LM ID. - SM-16: the downstream snapshot consumer matches the four text variants. - cargo fmt. The production registry is part of the language-1.2 compiler-semantics ID, so the records are regenerated in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n list Main (#152) now gathers the runtime modules' records in runtime_lean_records and builds process_records once the parts have run; the text-laws loop still pushed into the old vector, so the merged tree did not compile. The loop now collects into text_laws_records, extended into process_records before the runtime records: the order the branch attested before the merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s compiler-semantics ID The production registry rows for the text declarations move the language-1.2 compiler-semantics ID from 0aae5802... to 47d53f0e...: locks (229 of 282 moved, a second relock moved none), goldens, calculus packages, CONFORMANCE.md and ERRORS.md, negative fixtures, the production export, and every example's verification records (uor-atlas is language 1.0 and unchanged). PD-01's reviewed copy of the registry carries the four new rows, and the text-laws migration record states that the module is committed in the authoring notation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le's non-overlap table (OR-02) Every formal-only or erased construct of the production registry is a not-runtime row of oracle/known-non-overlap.toml. The table gains declaration.tokenizer, .context_window, .text_generator and .text_classifier, its version moves 2 -> 3 with the rows' digest recorded in oracle/table-versions.toml, and the OR-02 plant that lowers the version names the new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to issue-30-language-model Hand-written conflicts: - language/semantics-1.2.toml: main (#158) and this branch each moved semantic_ir 10 -> 11 and lean_backend 17 -> 18 for different changes, so the combined tree takes fresh numbers past both: semantic_ir 12, lean_backend 19, latex_backend 12 (this branch), proof_lowering 3 (main). - crates/lexlean/src/ir/semantic.rs: BACKEND_BARE_NAMES is main's 43 names plus LexLeanText (44). - schemas/semantic-module-v2.schema.json: merged structurally; every change of either side is kept. - SPEC.md, CHANGELOG.md: both sides kept. - The register is 395 (main's 391 plus LM-01..LM-03 and LM-13); the 391 both sides wrote merged cleanly and is corrected in README.md, SPEC.md §31, repository.rs, spec_links.rs and the CHANGELOG entry. Generated records take main's side here and are regenerated for the combined tree in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…with #158 The merged tree's language-1.2 compiler-semantics ID is 7a7834c6... (from main's 7c6ad912...): locks (230 of 283 moved, a second relock moved none), goldens, calculus packages, CONFORMANCE.md and ERRORS.md, negative fixtures, the production export, and every example's verification records (uor-atlas is language 1.0 and unchanged). Also the register count 395 in README.md, repository.rs and spec_links.rs, which the merge commit left at the 391 both sides wrote. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…P-14) into issue-30-language-model Hand-written conflicts: the register count, now 396 (main's 392 with SP-14 plus LM-01..LM-03 and LM-13) in README.md, SPEC.md §31, repository.rs and spec_links.rs; SPEC.md keeps the LM rows; CHANGELOG.md keeps both entries. #146 moved no language-1.2 version, so semantic_ir 12, lean_backend 19, latex_backend 12 and proof_lowering 3 stand. Generated records take main's side here and are regenerated for the combined tree in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ith #146 The language-1.2 compiler-semantics ID stays 7a7834c6... (#146 changes compiler code, not the embedded files the ID hashes; a relock moves no lock). Goldens, calculus packages, CONFORMANCE.md and ERRORS.md, negative fixtures, the production export, and every example's verification records are rewritten for the combined tree, with certificate E held as data (SP-14) in every preservation record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
…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
left a comment
There was a problem hiding this comment.
Approved at 85886c355, as a non-author, on the head that ran.
CI. All 26 checks green on this head (host legs, examples, rest with LM-01..LM-03 and LM-13, the 14 Atlas jobs and atlas (join), repro, honesty). The head contains main c3905e7c (#158, #146, #159, #153), which is still main's tip.
What I read, against #30's first slice and the rules.
- No free-form prompt is semantic code, and a tokenizer elaborates, it does not splice.
ir/semantic/language_model.rselaborates atokenizerover autf8_linesartifact of rolevocabularyinto six ordinary definitions and three generated theorems that apply the embedded laws library, and the ordinary rules check them again (R8). The module imports the library's generated Lean once; theLM-01case counts the import and asserts the six definitions' types (encode/decodeoverbytes,encodeText/decodeTextoverstring). - The laws are LexLean source.
LexLeanText.lex.texis one nativelexlean/core-module/2module in the notation, exported once by an exporter that is removed from the tree in the next commit (tests/text-laws/MIGRATION.md), andLM-13checks that the library is one native module, the registry lists only it, the sources are embedded, and every applied name is declared with an exact axiom policy (R9). - Refusals and bounds. A vocabulary of another role or schema, or a tokenizer with type parameters, is
LLT4006; a scheme outsidebyte_level/longest_matchis a schema violation; a vocabulary that is not valid UTF-8 lines fails by the artifact rules (LLR3008) before any byte is tokenized (LM-03); the four text declarations areformal-onlyin the production registry andnot-runtimein the oracle's non-overlap table, so no production claim is made for them yet. - Identity and records.
semantic_ir11→,lean_backendandlatex_backendmove once; every language-1.2 record was regenerated by the repository's writers on a tree that contains main, 2,175 files; languages 1.0 and 1.1 are byte-identical.
Not a close of #30. This is slice 1 (the DoD's tokenization and round-trip items); context windows, generators, classifiers, adapters, composition and the nondeterminism contract follow, and #30 stays open. The PR says so ("Part of #30"), and it registers only the rows it implements.
Not blocking. R3's order is only partly in the history (the family rows first, the case wiring after the implementation); the gates check existence, not order.
Merging with a merge commit pinned to this head. Every other PR with language-1.2 records regenerates once after this.
Generated by Claude Code
…stack in the packages' build Refs #92. Certificate E records for bootstrap are committed (the CI failure on the examples leg). rustc crashes on the generated libs at RUST_MIN_STACK=1 MiB (SIGSEGV) and passes at the default, so the harness sets 64 MiB for cargo's children on every host. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012skqc8ahSxQGZ9urVg4tt2
#82's text library states its private names for the module LexLeanText while it is compiled as LexLeanText.LexLeanText; an action makes only the private names of the module it runs in, so such a row is submitted as data (LM-02). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The language-1.2 compiler-semantics ID moves from 7a7834c6 to 74bafbfa: locks relocked by ID substitution, then golden, calculus, model, fixtures, production export and verify-examples rewritten in #82's order (uor-atlas, language 1.0, aside). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AinddrUH9xHeNmR6FTWypN
Part of #30: the tokenizer, its laws as LexLean source, and the four rows this slice implements (
LM-01..LM-03,LM-13).Built to the design comment on #30. The design still covers the whole family (context windows, text generators, text classifiers, adapters, composition, production); this PR ships only what it implements and registers only those rows, the way #89 and #91 land stage by stage.
LM-04..LM-12are not inmodel/ids.toml, SPEC.md §31, the feature suite, or the test inventory here: each later slice adds its rows with its implementation (R3), so no registered ID is unwired and the gates are meaningful on this branch.What changes
The text laws are LexLean source (
LM-13).language/text-1.2/library/is an embedded language-1.2 project with one nativelexlean/core-module/2module,LexLeanText.lex.tex, exported once from a Lean file that is kept outside the tree (tests/text-laws/MIGRATION.mdrecords the migration; the oracle directory is absent, and a case checks that no authored Lean file declares theLexLeanTextnamespace or lies under its module root). The module statesencodeWith(longest_match),encodeBytes(byte_level),decodeWith,encodeText/decodeTextthroughutf8Encode/utf8Decode, and provesroundtrip,in_range,text_roundtripand their byte-level forms, parametric in the vocabulary, with axioms withinpropext,Quot.sound,Classical.choice.crates/lexlean/src/text_laws.rsreads the registry (language/text-1.2/library.toml) and the native data, requires every name the elaboration applies, and generates the library's Lean through the ordinary core backend;verifyaudits that Lean like every generated core module and compiles it into the olean root before any module that imports it. Nothing is spliced: a module that declares a tokenizer importsLexLeanText.LexLeanText.A
tokenizerelaborates in linking (LM-01).ir/semantic/language_model.rs: a tokenizer over autf8_linesartifact of rolevocabularyelaborates topieces,size,encode,decode,encodeText,decodeTextover the library's functions, checked again by the ordinary rules as derived declarations. A vocabulary of another role or schema, or a tokenizer with type parameters, is refused withLLT4006; a scheme outsidebyte_level/longest_matchis a schema violation (LLT4001). No new diagnostic code (the design'sLLT4013/LLT4014collide with #78 and are not needed by this slice).The laws are generated and kernel-checked (
LM-02). The tokenizer generatesroundtrip,in_range, andtext_roundtripas reasoning-style theorems, each proved by one library lemma after unfolding exactly the named derived definitions, under the tokenizer's exact axiom policy; the axiom audit covers them like every generated declaration (LLV7005on an understated policy).UTF-8 (
LM-03). A vocabulary that does not decode underutf8_lines(invalid UTF-8, a CR, a missing final LF) fails by the artifact rules (LLR3008) before any byte is tokenized;encodeTextis overstring, anddecodeTextgoes throughutf8Decode, which refuses bytes that are not UTF-8 rather than transcoding them.Document. The LaTeX document states the scheme, the vocabulary, the laws module, the elaboration, and the generated theorems; the vocabulary's pieces are never document text.
Production. The four text declarations have rows in
language/production-1.2.toml, allformal-only(SPEC.md §17.13): a tokenizer's elaborated definitions apply the text-laws library, which no production target realizes, so a root whose closure reaches one fails; context windows, text generators and text classifiers are not elaborated by linking in this release. The oracle's non-overlap table lists the same four asnot-runtime(version 3,OR-02).LexLeanText.lex.texis committed in the authoring notation, written bylexlean fmt(AU-04).Identity and records.
semantic_ir10 → 11,lean_backend17 → 18,latex_backend11 → 12; every language-1.2 lock, golden, calculus package, fixture, production export, and verification record is regenerated for the new compiler-semantics ID (47d53f0e…on the merged tree). The register holds 391 IDs (387 onmain+ 4).Cases
crates/conformance/src/cases/language_models.rs:LM-01(elaboration, generated Lean and document, refusals),LM-02(Lean-backed: the models example with two tokenizers verifies, and an understated policy fails the audit),LM-03(the three malformed vocabularies, the string-typedencodeText),LM-13(the library is one native module, the registry lists only the laws module, the sources are embedded, every applied name is declared with an exact policy). The scenarios infeatures/suites/language-models.featurecarry the same four rows.History note
The first merge of
mainon this branch (9e260b2) resolved every conflict to the branch side and dropped #130, #135, #137, #143 and #147; 8363b43 restores the correct merge tree, the merge of #144 (b6c4ba2) is clean, and the merge of #152 and #156 (c876764) keeps both sides; the verifier's text-laws records then join the attestation through their own list, since #152 movedprocess_recordsto the end of the run. No history was rewritten.🤖 Generated with Claude Code