Skip to content

BS-25: the LSE reader and printer as language-1.2 source (first slice of the lexicon, #269) - #445

Closed
humuhumu33 wants to merge 2 commits into
release/v0.4from
claude/issue-269-lexicon-lse
Closed

humuhumu33 wants to merge 2 commits into
release/v0.4from
claude/issue-269-lexicon-lse

Conversation

@humuhumu33

Copy link
Copy Markdown
Contributor

Part of #269: the reader and the canonical printer of LexLean Semantic Expressions (BS-25, lexicon/lse.rs: parse and Lse::print) as language-1.2 source, with roots parseLse and printLse of LexiconLse. It is the first slice of the lexicon, and it stacks on nothing: the branch is release/v0.4 after #415.

Design

parseLse reads a text in the oracle's three phases, each an iteration over an explicit state: the tokenizer; the reader, with a stack of the open lists bounded by the depth argument, which reports the depth error apart from the syntax errors as ParseError does; and the conversion, with a work stack that visits a form's parts in the oracle's order (the function before its arguments, the binder headers of a pi or lam last to first, then the binder types, then the body) and builds the form when its parts are on the value stack. So the root admits no recursion and states the oracle's first error with its message to the byte. Every list of a sort's own values is a chain in the sort, so the data holds no nested inductive. printLse writes the canonical text by structural recursion over the expression, its chains, and its universes, renaming binders x0, x1, ... in printing order when asked, with the oracle's scoping (a binder's type before the binder enters the scope, a let entering its name before its type, value, and body). The scope check, the conservative checker, and the rendering expressions stay in the host.

Evidence

Measured on the normative host on release/v0.4 at 4dc5b803c:

Leg Runs Agreed
named vectors, evaluator 139 (105 read, reaching all 34 listed refusals and the limit on nesting; 34 printed) all
committed lexicon entries (signature, value), evaluator 417 expressions: 834 reads, 834 prints all
seeded expressions and edits, evaluator 300 expressions: 300 prints, 600 reads all
planted defects, each on its own named vector 30 all detected

Lean verifies the module on a copy of the project whose only entrypoint is LexiconLse, and the eligibility report gives parseLse exactly allocation and overflow and printLse exactly allocation, overflow, and recursion.

The first run found one defect in the printer (a constant's universe list closed the list and not the constant) and one certificate rejection (the ID scanner's state as nested pairs tested as a condition; now a structure). VERIFICATION.md records them.

Gates at the head

cargo fmt --check, validate-model (479 IDs), validate-spec-links (479 rows), clippy on the workspace with -D warnings, and the 17 RP cases pass.

CI is expected red until the regeneration

The bootstrap/parse_lse and bootstrap/print_lse packages are not committed. conformance_bs_25 stops at the stack-bound step, bootstrap/parse_lse is no package of the committed exports, after the differentials above have agreed. The regeneration owes the lock, the two packages, the bootstrap expected/ records, the row of print_lse in tests/stack-bounds.json, and the recount of BS-05 to BS-08 and BS-13 to BS-15, whose corpora grow with each committed package. It is queued on the normative host.

🤖 Generated with Claude Code

humuhumu33 and others added 2 commits November 9, 2026 16:50
…nter

The first slice of the lexicon as source (#269): the row (register 478 ->
479, the §31 table, the RP-07 check and its case), the scenario, the §17.23
prose, the CHANGELOG entry, the README's claim, the CI part, and the case,
conformance_bs_25, which holds LexiconLse.parseLse and printLse to
lexicon::lse::parse and Lse::print on hand-built vectors that reach every
error of the reader and the limit on nesting, on every signature and value
of the committed lexicon entries, and on seeded expressions and edits, with
30 planted defects each named by its vector. VERIFICATION.md records the
first run.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bootstrap/src/LexiconLse.lex.tex: the tokenizer, the reader with its stack of
open lists bounded by the depth argument, and the conversion with its work
stack, each an iteration over an explicit state, so parseLse admits no
recursion and states the oracle's first error to the byte; and printLse,
the canonical printer with alpha-renaming, by structural recursion over the
expression, its chains, and its universes. Lean verifies the module and
the eligibility report gives each root exactly its declared effects. The
entrypoint, the lock, the two export roots, and the project README follow.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@humuhumu33

Copy link
Copy Markdown
Contributor Author

Landed in #480 (merge aaf845507 on release/v0.4), which carries this change with the BS-25..34 batch, regenerated together and verified by full gate run 43135541484. The branch is kept.

@humuhumu33 humuhumu33 closed this Nov 12, 2026
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.

1 participant