diff --git a/.github/bdd-parts.json b/.github/bdd-parts.json index f385106a69..e98ba79d24 100644 --- a/.github/bdd-parts.json +++ b/.github/bdd-parts.json @@ -277,6 +277,9 @@ ], "bootstrap-manifest-text": [ "BS-34" + ], + "bootstrap-lse-scopes": [ + "BS-51" ] }, "targets": { diff --git a/.github/intel-host-lanes.json b/.github/intel-host-lanes.json index 6a7f0aa94a..9e7fa748b7 100644 --- a/.github/intel-host-lanes.json +++ b/.github/intel-host-lanes.json @@ -1,7 +1,7 @@ { "producer": ["honesty"], "lanes": { - "lower": ["bootstrap-lower", "bootstrap-lexicon-lse", "bootstrap-lexicon-lre", "bootstrap-surface-module", "bootstrap-diagnostics", "bootstrap-cli-output"], + "lower": ["bootstrap-lower", "bootstrap-lexicon-lse", "bootstrap-lexicon-lre", "bootstrap-surface-module", "bootstrap-diagnostics", "bootstrap-cli-output", "bootstrap-lse-scopes"], "print": ["bootstrap-print", "bootstrap-bodies", "bootstrap-succeed", "bootstrap-loops", "bootstrap-assemble", "bootstrap-package", "bootstrap-check", "bootstrap-gnaf", "bootstrap-runtime", "bootstrap-terms", "bootstrap-tooling-latex", "bootstrap-structural-grammar", "bootstrap-surface-lex", "bootstrap-surface-doc", "bootstrap-surface-generic", "bootstrap-surface-tooling", "bootstrap-lock-text", "bootstrap-content-id", "bootstrap-project-text", "bootstrap-manifest-text"], "validate": ["bootstrap-validate", "compiler", "preservation", "preservation-lists", "preservation-runtime", "preservation-support", "preservation-prims", "preservation-std", "production"], "moves": ["bootstrap-moves", "verification", "rest"] diff --git a/.github/vv-rows.json b/.github/vv-rows.json index 7223ecaf22..07ea784b64 100644 --- a/.github/vv-rows.json +++ b/.github/vv-rows.json @@ -358,5 +358,14 @@ "width": "", "memory_kib": "", "hints": "" + }, + { + "part": "bdd-bootstrap-lse-scopes", + "recipes": "bdd", + "examples_part": "", + "bdd_part": "bootstrap-lse-scopes", + "width": "", + "memory_kib": "", + "hints": "" } ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 253e3f3c28..8a59e4656d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,13 @@ workspace carried at those versions without a tag. ## Unreleased +- The scopes, references, and outer shape of a LexLean Semantic Expression as + language-1.2 source, the second slice of the lexicon closure (SPEC.md §17.23, + §13.8, `BS-51`, #269; no new diagnostic code, no change to the language-1.2 + identity). `checkScopes`, `referencedConsts`, and `outerShape` of `LseScopes` + return what `Lse::check_scopes`, `referenced_consts`, and + `outer_explicit_binders` with `result` return, over the expressions of + `BS-25`. None admits `recursion`. - `RB-24`, the driver of a command root (#271). A `rust-std` root of the type of a command's step gets `src/main.rs` beside `src/lib.rs`: a loop, printed from the new language-1.2 module `RuntimeHost`, that calls the step and carries out each diff --git a/CONFORMANCE.md b/CONFORMANCE.md index cfa9806bcb..91feff4388 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -91,6 +91,7 @@ the error registry does not sanction (R5, `ERRORS.md`). | `BS-32` | `build` | The labeled hash recipes of content identity of SPEC.md §21.1 to §21.5, §11.5, §19.8, and §22.9 (`artifact::content_id`: the frame of a label and a payload, each preceded by its big-endian length in four and eight bytes, under a domain and a NUL; `tree_digest` over path and content rows; `source_id` over the project manifest, the lock, and the sources; `semantic_id_for` over the compiler-semantics digest, the language, the pinned Lean toolchain, the linked IR, and the lexicon closure; `build_id`; `attestation_id`; and `pdf_recipe_id`) is language-1.2 source in the `bootstrap/` project, as six production roots of `ContentId` over the standard library's SHA-256: `treeDigest`, `sourceId`, `semanticId`, `buildId`, `attestationId`, and `pdfRecipeId`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built inputs that reach every frame of every recipe, lengths beyond one byte, and messages across blocks, on the trees and source inputs of the committed projects, on the source and semantic IDs of every committed build manifest, whose recorded build ID the oracle reproduces, and on seeded inputs; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; choosing and normalizing the files of a tree or a source ID, and serializing the IR, the closure, and the attestation body, are outside the claim. | | `BS-33` | `build` | The canonical text of the project manifest of SPEC.md §10.1 and its digest (`config::ProjectConfig::canonical_toml`: the ten header keys in their fixed order with the pinned Lean toolchain, the lexicon sources sorted by package or the empty array when there is none, the artifact sources and the source packages in their order, the eleven limits in their fixed order, and the PDF provider; and `config_sha256`: the lower-case hex SHA-256 of that text) is language-1.2 source in the `bootstrap/` project, as two production roots of `ProjectText` over the TOML writers of `BS-31`: `canonicalProject` and `configSha256`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built configurations, which reach every kind of lexicon source, the empty source list, equal packages, every optional table, escapes, and the largest limits, on every committed `lexlean.toml` that parses, and on seeded configurations; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; reading and validating a manifest is outside the claim. | | `BS-34` | `build` | The build manifest of SPEC.md §21.6 in the canonical JSON of §21.7 (`artifact::manifest::BuildManifest::to_json` written as a file: the specification, the compiler version and semantics ID, the language, the project, the source, semantic, and build IDs, the pinned Lean toolchain, the selection and the module rows in their order, a module's origin only when it has one, and the input and output rows sorted by kind, path, length, and digest, each digest in lower-case hex) is language-1.2 source in the `bootstrap/` project, as the production root `buildManifest` of `ManifestText` over the standard library's `Json` writer, eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `recursion`, and with no part of its certificate beyond 3,145,728 bytes; its rendered `rust-std` package under the pinned rustc, and on the normative host its lowered program under the calculus evaluator, agree with the oracle to the byte on hand-built manifests, which reach every key of the row order, lengths across a byte, a module's origin, and escapes, on every committed build manifest, each of which is the oracle's text of its own fields, and on seeded manifests; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; gathering the rows of a build and hashing its files are outside the claim. | +| `BS-51` | `build` | The scopes, the references, and the outer shape of a LexLean Semantic Expression of SPEC.md §13.8 (`lexicon::lse::Lse::check_scopes`: every local resolves lexically, a binder's type seen before its name and a `let`'s type and value before its name, and every universe variable is declared, or the message of the first that is not, in the oracle's order of visit; `referenced_consts`: the qualified constants in occurrence order; and `outer_explicit_binders` with `result`: the explicit binders of the outermost `pi` and whether its result is a sort) is language-1.2 source in the `bootstrap/` project, as three production roots of `LseScopes` over the expressions of `BS-25`: `checkScopes`, `referencedConsts`, and `outerShape`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, none of them `recursion`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built expressions, which reach both errors, shadowing, the end of every binder's scope, and every universe form, on every signature and defined value of the committed lexicon entries under the universes its entry declares, and on seeded expressions under seeded declarations; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; the conservative type checker of §13.7 is outside the claim. | ## calculus diff --git a/README.md b/README.md index 9d7b690591..544d04d675 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ just vv # the complete normative acceptance gate (SPEC.md §9.2) just release # vv, then the §30 release criterion; refused until 1.0.0 ``` -All 494 registered conformance IDs have their named tests; `just vv` checks them with the pinned toolchain installed. +All 495 registered conformance IDs have their named tests; `just vv` checks them with the pinned toolchain installed. The differential against the independent generator `lean4-prod` (SPEC.md §17.19, `OR-01`..`OR-08`) acquires it at its pinned commit: from the checkout `LEXLEAN_ORACLE_DIR` names, or by fetching the commit with `git` into the Cargo target directory (`LEXLEAN_ORACLE_CACHE` overrides), and builds it with the pinned Lean and Rust toolchains. It is validation evidence only and no input to any identity. An oracle that cannot be acquired, is not the pinned files, or fails is unavailable: that fails the gate on Linux x86-64 and is printed as `NOT VALIDATED` elsewhere, and is never reported as agreement. @@ -197,7 +197,7 @@ Every row is validated by `just vv`; the IDs link the claim to its register row, | The language-1.2 authoring notation: a readable `.lex.tex` text for a semantic module, in bijection with its canonical JSON, whose every position and variant is read from the schema, with readable forms for types and terms and a generic form for every other value, formatted canonically by `fmt` failing closed, the only form in which a language-1.2 source of the product is written (the data form is refused under language 1.2, and `lexlean::sdk` is the explicit conversion), the same for the compiler-tooling modules in the generic notation, with no compiler-semantics ID that depends on which form an embedded module is written in, with no product source owned by a generator but five named records, read and written by programs only through the authoring API (`lexlean::sdk`), and, for a native core module, a readable program over the shared table of kernel terms whose numbering is the order of its text | `AU-01`..`AU-13` | `build` | | The runtime of generated Lean as native modules: the portable, collection, model, and reasoning runtimes of language 1.2 are LexLean source that every generated module imports, migrated losslessly and audited against their exact axioms, the released runtime text of languages 1.0 and 1.1 is frozen data equal to their released output, and no other Lean runtime text remains in the compiler but the decoder of core module 2 | `RT-01`..`RT-04` | `build` | | The standard library: language-1.2 source beside the compiler whose members are certified production roots, each validated against its oracle by a seeded differential of its evaluator and rustc realizations; bytes and text over `Bytes`, an output buffer of a given capacity written in order; decimal and hexadecimal; the byte order and stable sorts over it; canonical JSON reading and writing; maps and sets over byte keys; SHA-256 against FIPS 180-4, the NIST CAVP vectors, and the `sha2` crate; and the `std-models` and `std-reasoning` source packages, generic over types, whose laws are kernel-checked theorems and whose application is the `helpdesk` example | `SL-01`, `SL-02`, `SL-03`, `SL-04`, `SL-05`, `SL-09`, `SL-10`, `SL-11`, `SL-13`, `SL-14` | `build` | -| The bootstrap project: the compiler's own components as language-1.2 source compiled by LexLean's production pipeline to certified Rust packages, the exact axiom-output parser and its closed Lean-name check, the primitive scanner of §12.2, the preservation lexer and token audit, the target calculus's checker, the Rust crate validator, the Rust printer, the runtime syntax validator, the failure typing and the types of the Rust lowering, its last-use moves, its literal values and its terms, the package renderer, the GNAF request validation, the LaTeX of a tooling module, the structural grammar, the lexer of the authoring notation, its layout algebra, its generic notation, the notation of a tooling module, the reader and printer of LexLean Semantic Expressions, the reader of LexLean Rendering Expressions, where the module of a source is, the canonical diagnostic and its terminal output, the canonical text of the lock file and of the project manifest, the hash recipes of content identity, and the build manifest, each held to the Rust it replaces (the stage-0 oracle) by the committed vectors and a seeded differential of its evaluator and rustc realizations, with planted defects detected and the production export committed | `BS-01`..`BS-34` | `build` | +| The bootstrap project: the compiler's own components as language-1.2 source compiled by LexLean's production pipeline to certified Rust packages, the exact axiom-output parser and its closed Lean-name check, the primitive scanner of §12.2, the preservation lexer and token audit, the target calculus's checker, the Rust crate validator, the Rust printer, the runtime syntax validator, the failure typing and the types of the Rust lowering, its last-use moves, its literal values and its terms, the package renderer, the GNAF request validation, the LaTeX of a tooling module, the structural grammar, the lexer of the authoring notation, its layout algebra, its generic notation, the notation of a tooling module, the reader and printer of LexLean Semantic Expressions, the reader of LexLean Rendering Expressions, where the module of a source is, the canonical diagnostic and its terminal output, the canonical text of the lock file and of the project manifest, the hash recipes of content identity, and the build manifest, the scopes and references of a semantic expression, each held to the Rust it replaces (the stage-0 oracle) by the committed vectors and a seeded differential of its evaluator and rustc realizations, with planted defects detected and the production export committed | `BS-01`..`BS-51` | `build` | | Source packages: a language-1.2 project imports the modules of a locked, content-addressed package of its workspace: `[[source_package]]` and `lexlean-workspace.toml`, the pins in `lexlean.lock` recomputed by every command, imports closed at link, no re-export of a package's production roots, and the package's modules replayed by the importer's `verify` with their origin in the records | `PK-01`..`PK-05` | `build` | | The literal `nat-add-zero` example, the Lean-verified feature examples, and the complete negative fixture suite | `EX-01`..`EX-09` | `build` | | Language-1.2 text components: tokenizers and their round-trip laws, with the laws carried as one native core module the generated modules import rather than authored Lean text | `LM-01`, `LM-02`, `LM-03`, `LM-13` | `build` | diff --git a/SPEC.md b/SPEC.md index 4e39313088..d817f49629 100644 --- a/SPEC.md +++ b/SPEC.md @@ -9063,6 +9063,21 @@ module with a state machine over the tokens, reading each member value with the span runs from the first token of the element to the end of its last. Neither of the last two admits `recursion`. The decoder of a tooling module and the checker stay in the host. +The scopes, the references, and the outer shape of a semantic expression (§13.8) are the +second component of the lexicon closure as source (`BS-51`, issue 269), the module `LseScopes` +over the expressions of `BS-25`, with three production roots for `rust-std`: + +| Root | Takes | Returns | Oracle | +| --- | --- | --- | --- | +| `LexLeanBoot.LseScopes.checkScopes` | an expression, the declared universes, and the length of its text | nothing, or the message of the first local or universe out of scope | `lse::Lse::check_scopes` | +| `LexLeanBoot.LseScopes.referencedConsts` | an expression and the length of its text | its qualified constants in occurrence order | `lse::Lse::referenced_consts` | +| `LexLeanBoot.LseScopes.outerShape` | an expression and the length of its text | the explicit binders of its outermost `pi` and whether its result is a sort | `lse::Lse::outer_explicit_binders`, `lse::Lse::result` | + +Each root walks the expression with an explicit work stack in the oracle's order, a binder's +type before its name and a scope truncated when its `pi`, `lam`, or `let` ends; the length of +the text bounds the walk. None of the roots admits `recursion`. The conservative type checker +of §13.7 stays in the host. + ## 18. Lean backend ### 18.1 Output contract @@ -12089,6 +12104,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `BS-32` | `bootstrap` | The labeled hash recipes of content identity of SPEC.md §21.1 to §21.5, §11.5, §19.8, and §22.9 (`artifact::content_id`: the frame of a label and a payload, each preceded by its big-endian length in four and eight bytes, under a domain and a NUL; `tree_digest` over path and content rows; `source_id` over the project manifest, the lock, and the sources; `semantic_id_for` over the compiler-semantics digest, the language, the pinned Lean toolchain, the linked IR, and the lexicon closure; `build_id`; `attestation_id`; and `pdf_recipe_id`) is language-1.2 source in the `bootstrap/` project, as six production roots of `ContentId` over the standard library's SHA-256: `treeDigest`, `sourceId`, `semanticId`, `buildId`, `attestationId`, and `pdfRecipeId`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built inputs that reach every frame of every recipe, lengths beyond one byte, and messages across blocks, on the trees and source inputs of the committed projects, on the source and semantic IDs of every committed build manifest, whose recorded build ID the oracle reproduces, and on seeded inputs; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; choosing and normalizing the files of a tree or a source ID, and serializing the IR, the closure, and the attestation body, are outside the claim. | §17.23, §21.1, §21.5 | | `BS-33` | `bootstrap` | The canonical text of the project manifest of SPEC.md §10.1 and its digest (`config::ProjectConfig::canonical_toml`: the ten header keys in their fixed order with the pinned Lean toolchain, the lexicon sources sorted by package or the empty array when there is none, the artifact sources and the source packages in their order, the eleven limits in their fixed order, and the PDF provider; and `config_sha256`: the lower-case hex SHA-256 of that text) is language-1.2 source in the `bootstrap/` project, as two production roots of `ProjectText` over the TOML writers of `BS-31`: `canonicalProject` and `configSha256`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built configurations, which reach every kind of lexicon source, the empty source list, equal packages, every optional table, escapes, and the largest limits, on every committed `lexlean.toml` that parses, and on seeded configurations; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; reading and validating a manifest is outside the claim. | §10.1, §17.23 | | `BS-34` | `bootstrap` | The build manifest of SPEC.md §21.6 in the canonical JSON of §21.7 (`artifact::manifest::BuildManifest::to_json` written as a file: the specification, the compiler version and semantics ID, the language, the project, the source, semantic, and build IDs, the pinned Lean toolchain, the selection and the module rows in their order, a module's origin only when it has one, and the input and output rows sorted by kind, path, length, and digest, each digest in lower-case hex) is language-1.2 source in the `bootstrap/` project, as the production root `buildManifest` of `ManifestText` over the standard library's `Json` writer, eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `recursion`, and with no part of its certificate beyond 3,145,728 bytes; its rendered `rust-std` package under the pinned rustc, and on the normative host its lowered program under the calculus evaluator, agree with the oracle to the byte on hand-built manifests, which reach every key of the row order, lengths across a byte, a module's origin, and escapes, on every committed build manifest, each of which is the oracle's text of its own fields, and on seeded manifests; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; gathering the rows of a build and hashing its files are outside the claim. | §17.23, §21.6, §21.7 | +| `BS-51` | `bootstrap` | The scopes, the references, and the outer shape of a LexLean Semantic Expression of SPEC.md §13.8 (`lexicon::lse::Lse::check_scopes`: every local resolves lexically, a binder's type seen before its name and a `let`'s type and value before its name, and every universe variable is declared, or the message of the first that is not, in the oracle's order of visit; `referenced_consts`: the qualified constants in occurrence order; and `outer_explicit_binders` with `result`: the explicit binders of the outermost `pi` and whether its result is a sort) is language-1.2 source in the `bootstrap/` project, as three production roots of `LseScopes` over the expressions of `BS-25`: `checkScopes`, `referencedConsts`, and `outerShape`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, none of them `recursion`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built expressions, which reach both errors, shadowing, the end of every binder's scope, and every universe form, on every signature and defined value of the committed lexicon entries under the universes its entry declares, and on seeded expressions under seeded declarations; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; the conservative type checker of §13.7 is outside the claim. | §17.23, §13.8 | | `PK-01` | `packages` | A language-1.2 project that declares a source package by its identifier, version, kind `path`, and the member directory a `lexlean-workspace.toml` lists locks it by the tree digest of its manifest and source files, its manifest digest, its version, its module prefix, and its own packages, and the configuration and the lock read back to the bytes written; a project without a source package keeps its bytes, and a package of another kind, a source package in another language, a changed byte or version (LLC0105), an undeclared package (LLC0106), a module prefix claimed twice (LLC0107), a project or a package outside the workspace (LLC0108), a path that escapes it, and a symlink (LLS8001) are each refused with the named code. | §10.5, §11.1, §25.1 | | `PK-02` | `packages` | A module of a project imports only modules of its own project and modules of the packages the project declares, and a module of a package only modules of itself and of the packages its own manifest declares: a package module is a module of the importing project under its own module prefix, a module of a package the project does not declare fails with LLR3009, and an import cycle through a package fails with LLR3003. | §10.5, §15.1 | | `PK-03` | `packages` | An importing project builds and verifies under the pinned Lean offline, and its package modules are generated, elaborated, replayed with `leanchecker`, and audited for their exact axioms under the package's module prefix with the package as their origin in the records; the source ID of the project changes with the pins, and no file of the package is written by `fmt`, `build`, or `verify`. | §10.5, §21.3, §22 | @@ -12105,7 +12121,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `LM-09` | `language-models` | No prompt is code: no member of the closed language maps `string` or `bytes` to a function, a term, or source — every operation of the primitive registry that takes a `string` or `bytes` operand is classified by the audit with a data result, the registry's schema enumeration and the production registry's primitive rows equal one another and equal that classified set, and the text declarations of `lexlean/semantic-module/2` state no `string`-typed member, so a prompt reaches a model only as the tokens `encodeText` makes of it; a planted operation or text member of that shape is caught by the audit with its name. | §17.12 | | `LM-13` | `language-models` | The text laws a tokenizer elaborates through are LexLean source and not authored text: the module that states them is one language-1.2 native core module of the embedded `language/text-1.2` project, the project holds no file of Lean source, no independently authored Lean file anywhere in the release tree declares the `LexLeanText` namespace or lies under its module root, and the one-time migration input is absent; the registry lists only that module, the declarations and their exact axiom policies are read from its native data, which the compiler embeds and hashes into the language-1.2 semantics, and a module that declares a text component imports the generated module rather than splicing any Lean text. | §17.10, §17.12 | -**Total required capability IDs:** 494. +**Total required capability IDs:** 495. No row may be downgraded to `some-true` or `open`. Upstream Lean facts are ledger/authority rows, not substitutions for these build behaviors. diff --git a/VERIFICATION.md b/VERIFICATION.md index 0429240fff..5ab301bfc4 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -11518,6 +11518,39 @@ axioms the module now declares. The case then stops at the stack-bound step, bootstrap member did before its regeneration, which produces the package and measures the root's stack bound. +### the scopes and references of a semantic expression are source (BS-51) + +`BS-51` holds the three production roots of `LexLeanBoot.LseScopes` +(`bootstrap/src/LseScopes.lex.tex`) to `lexicon::lse`: `checkScopes` to +`Lse::check_scopes`, `referencedConsts` to `Lse::referenced_consts`, and +`outerShape` to `outer_explicit_binders` with whether `result` is a sort. Each +walks an expression of `BS-25` with an explicit work stack in the oracle's +order of visit, so that the first error is the oracle's first; a universe is +walked on the same stack, and a scope is a list truncated when its binder +ends. The host passes the length of the expression's text, which bounds the +walk. No root admits `recursion`. The oracle is the existing public code of +`lse.rs`; the case reads the encoder and the seeded expressions of `BS-25`'s +case, made visible to its sibling, and no other Rust changes. + +The case holds the roots to the oracle on hand-built expressions that reach +both errors, a binder's type before its name, a `let`'s value before its name, +shadowing, the end of the scope of every binder form, and every universe form; +on every signature and defined value of the committed lexicon entries under +the universes its entry declares, each of which the case asserts is in scope; +and on seeded expressions under seeded declarations. Each of the 14 planted +defects names the one vector that catches it, and the case asserts that the +site of each plant occurs once. The row's statement carries no counts. + +The case was first compiled and run on the normative host over `release/v0.4` +at `26e5e0ace` (`cargo test -p repo-conformance --test conformance -- +conformance_bs_51`). Its corpus is 43 named vectors, the 417 committed +signatures and defined values, and 300 and 2,000 seeded expressions. The +evaluator agrees with the oracle on 2,194 runs, the rendered packages under +the pinned rustc on 7,294 runs, and each of the 14 planted defects is detected +by its own vector. The case then stops at the stack-bound step, as each +bootstrap member does before its regeneration, which produces the three +packages. + ### the lexer of the authoring notation is source (BS-22) `BS-22` holds the two production roots of `LexLeanBoot.SurfaceLex` diff --git a/bootstrap/README.md b/bootstrap/README.md index c99de3f256..f88557e8e6 100644 --- a/bootstrap/README.md +++ b/bootstrap/README.md @@ -55,3 +55,6 @@ writers it uses, and the standard library's `Numeral`, `Order`, and `Sha256`, an canonical project manifest of SPEC.md §10.1 and its digest. `src/ManifestText.lex.tex` (SPEC.md §17.23, `BS-34`) imports the standard library's `Json`, `Numeral`, `Order`, and `Text`, and writes the build manifest of SPEC.md §21.6. +`src/LseScopes.lex.tex` (SPEC.md §17.23, `BS-51`) imports `LexiconLse` (`BS-25`), whose +expressions it walks, and the standard library's `Order`: the scopes, references, and outer +shape of a semantic expression of SPEC.md §13.8. diff --git a/bootstrap/lexlean.lock b/bootstrap/lexlean.lock index fa8fc0c858..cc7e5b0fe5 100644 --- a/bootstrap/lexlean.lock +++ b/bootstrap/lexlean.lock @@ -1,7 +1,7 @@ spec = "lexlean/lock/2" language = "1.2" compiler_semantics = "06639c99a4cb1dbcb7fc9c0c87544ee05c599079d85272d8af66c8045900680b" -project_config_sha256 = "cb6f1d4f33f8c6a8b7e593d6c53094526bd477d565600f42c530fc1e4adaa5d4" +project_config_sha256 = "ae25077000c17fe570d2cd437a7322f0ab8026737aa05c1991ac0c9ec808efcb" lean_toolchain = "leanprover/lean4:v4.32.1" [[workspace_file]] diff --git a/bootstrap/lexlean.toml b/bootstrap/lexlean.toml index 680666515e..966818bc3b 100644 --- a/bootstrap/lexlean.toml +++ b/bootstrap/lexlean.toml @@ -3,7 +3,7 @@ name = "bootstrap" language = "1.2" module_prefix = "LexLeanBoot" source_roots = ["src"] -entrypoints = ["src/AxiomOutput.lex.tex", "src/CalculusCheck.lex.tex", "src/CliOutput.lex.tex", "src/ContentId.lex.tex", "src/Diagnostics.lex.tex", "src/GnafValidate.lex.tex", "src/LexiconLre.lex.tex", "src/LexiconLse.lex.tex", "src/LockText.lex.tex", "src/ManifestText.lex.tex", "src/PrimitiveScan.lex.tex", "src/ProjectText.lex.tex", "src/RuntimeValidate.lex.tex", "src/RustAssemble.lex.tex", "src/RustAst.lex.tex", "src/RustBodies.lex.tex", "src/RustLoops.lex.tex", "src/RustLower.lex.tex", "src/RustMoves.lex.tex", "src/RustPackage.lex.tex", "src/RustPrint.lex.tex", "src/RustSucceed.lex.tex", "src/RustTerms.lex.tex", "src/RustValidate.lex.tex", "src/StructuralGrammar.lex.tex", "src/SurfaceDoc.lex.tex", "src/SurfaceGeneric.lex.tex", "src/SurfaceLex.lex.tex", "src/SurfaceModule.lex.tex", "src/SurfaceTooling.lex.tex", "src/TokenAudit.lex.tex", "src/ToolingAst.lex.tex", "src/ToolingLatex.lex.tex"] +entrypoints = ["src/AxiomOutput.lex.tex", "src/CalculusCheck.lex.tex", "src/CliOutput.lex.tex", "src/ContentId.lex.tex", "src/Diagnostics.lex.tex", "src/GnafValidate.lex.tex", "src/LexiconLre.lex.tex", "src/LexiconLse.lex.tex", "src/LockText.lex.tex", "src/LseScopes.lex.tex", "src/ManifestText.lex.tex", "src/PrimitiveScan.lex.tex", "src/ProjectText.lex.tex", "src/RuntimeValidate.lex.tex", "src/RustAssemble.lex.tex", "src/RustAst.lex.tex", "src/RustBodies.lex.tex", "src/RustLoops.lex.tex", "src/RustLower.lex.tex", "src/RustMoves.lex.tex", "src/RustPackage.lex.tex", "src/RustPrint.lex.tex", "src/RustSucceed.lex.tex", "src/RustTerms.lex.tex", "src/RustValidate.lex.tex", "src/StructuralGrammar.lex.tex", "src/SurfaceDoc.lex.tex", "src/SurfaceGeneric.lex.tex", "src/SurfaceLex.lex.tex", "src/SurfaceModule.lex.tex", "src/SurfaceTooling.lex.tex", "src/TokenAudit.lex.tex", "src/ToolingAst.lex.tex", "src/ToolingLatex.lex.tex"] build_root = ".lexlean" lockfile = "lexlean.lock" lean_workspace = "." diff --git a/bootstrap/src/LseScopes.lex.tex b/bootstrap/src/LseScopes.lex.tex new file mode 100755 index 0000000000..46918af36e --- /dev/null +++ b/bootstrap/src/LseScopes.lex.tex @@ -0,0 +1,248 @@ +\begin{lexlean}{LseScopes} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{LexLeanStd.Order} +\importmodule{LexiconLse} +\title{Natural number addition} +\begin{semanticmodule} +inductive{ + name: SWork, + type_parameters: [], + parameters: [], + constructors: [ + {name: SExpr, fields: [LexiconLse::Lse]}, + {name: SBind, fields: [Bytes]}, + {name: STrunc, fields: [Nat]}, + {name: SUni, fields: [LexiconLse::Universe]} + ] +} + +structure{ + name: Sc, + type_parameters: [], + parameters: [], + fields: [ + {name: work, type: (List SWork)}, + {name: scope, type: (List Bytes)}, + {name: depth, type: Nat}, + {name: error, type: (Option Bytes)} + ] +} + +structure{ + name: Rc, + type_parameters: [], + parameters: [], + fields: [{name: stack, type: (List LexiconLse::Lse)}, {name: found, type: (List (Bytes * Bytes))}] +} + +definition{ + name: lit, + parameters: [literal : String], + result: Bytes, + body: (prim utf8_encode literal : Bytes), + executable: true +} + +definition{ + name: cat, + parameters: [left : Bytes, right : Bytes], + result: Bytes, + body: (prim append left right : Bytes), + executable: true +} + +definition{ + name: member, + parameters: [items : (List Bytes), wanted : Bytes], + result: Bool, + body: (prim list_fold (fun [wanted] (found : Bool) (item : Bytes) => (if found then true else (prim equal item wanted : Bool))) false items : Bool), + executable: true +} + +definition{ + name: dropFront, + parameters: [items : (List Bytes), count : Nat], + result: (List Bytes), + body: (first (prim iterate_until (fun (rest : (List Bytes)) => (match rest + | List.nil => (ctor Option.none [(List Bytes)]) + | List.cons head tail => (ctor Option.some [(List Bytes)] tail))) count items : ((List Bytes) * Bool))), + executable: true +} + +definition{ + name: scGo, + parameters: [st : Sc, work : (List SWork)], + result: (Option Sc), + body: (ctor Option.some [Sc] (record Sc {work := work, scope := (project st scope), depth := (project st depth), error := (ctor Option.none [Bytes])})), + executable: true +} + +definition{ + name: scFail, + parameters: [st : Sc, message : Bytes], + result: (Option Sc), + body: (ctor Option.some [Sc] (record Sc {work := (project st work), scope := (project st scope), depth := (project st depth), error := (ctor Option.some [Bytes] message)})), + executable: true +} + +definition{ + name: uniStep, + parameters: [st : Sc, rest : (List SWork), universes : (List Bytes), u : LexiconLse::Universe], + result: (Option Sc), + body: (match u + | LexiconLse::Universe.UNum n => (scGo st rest) + | LexiconLse::Universe.UVar name => (if (member universes name) then (scGo st rest) else (scFail st (cat (cat (lit "universe variable `") name) (lit "` is not declared")))) + | LexiconLse::Universe.USucc inner => (scGo st (cons (ctor SWork.SUni inner) rest)) + | LexiconLse::Universe.UMax items => (scGo st (cons (ctor SWork.SUni items) rest)) + | LexiconLse::Universe.UIMax a b => (scGo st (cons (ctor SWork.SUni a) (cons (ctor SWork.SUni b) rest))) + | LexiconLse::Universe.UNil => (scGo st rest) + | LexiconLse::Universe.UItem head tail => (scGo st (cons (ctor SWork.SUni head) (cons (ctor SWork.SUni tail) rest)))), + executable: true +} + +definition{ + name: exprStep, + parameters: [st : Sc, rest : (List SWork), expr : LexiconLse::Lse], + result: (Option Sc), + body: (match expr + | LexiconLse::Lse.LSortProp => (scGo st rest) + | LexiconLse::Lse.LSortType u => (scGo st (cons (ctor SWork.SUni u) rest)) + | LexiconLse::Lse.LConst p e us => (scGo st (cons (ctor SWork.SUni us) rest)) + | LexiconLse::Lse.LLocal name => (if (member (project st scope) name) then (scGo st rest) else (scFail st (cat (cat (lit "local `") name) (lit "` is not in scope")))) + | LexiconLse::Lse.LApp f args => (scGo st (cons (ctor SWork.SExpr f) (cons (ctor SWork.SExpr args) rest))) + | LexiconLse::Lse.LPi binders body => (scGo st (cons (ctor SWork.SExpr binders) (cons (ctor SWork.SExpr body) (cons (ctor SWork.STrunc (project st depth)) rest)))) + | LexiconLse::Lse.LLam binders body => (scGo st (cons (ctor SWork.SExpr binders) (cons (ctor SWork.SExpr body) (cons (ctor SWork.STrunc (project st depth)) rest)))) + | LexiconLse::Lse.LLet name ty value body => (scGo st (cons (ctor SWork.SExpr ty) (cons (ctor SWork.SExpr value) (cons (ctor SWork.SBind name) (cons (ctor SWork.SExpr body) (cons (ctor SWork.STrunc (project st depth)) rest)))))) + | LexiconLse::Lse.LNat digits => (scGo st rest) + | LexiconLse::Lse.LNil => (scGo st rest) + | LexiconLse::Lse.LArg head tail => (scGo st (cons (ctor SWork.SExpr head) (cons (ctor SWork.SExpr tail) rest))) + | LexiconLse::Lse.LBinder mode name ty more => (scGo st (cons (ctor SWork.SExpr ty) (cons (ctor SWork.SBind name) (cons (ctor SWork.SExpr more) rest))))), + executable: true +} + +definition{ + name: scStep, + parameters: [universes : (List Bytes), st : Sc], + result: (Option Sc), + body: (match (project st error) + | Option.some stopped => (ctor Option.none [Sc]) + | Option.none => (match (project st work) + | List.nil => (ctor Option.none [Sc]) + | List.cons item rest => (match item + | SWork.SExpr expr => (exprStep st rest expr) + | SWork.SBind name => (ctor Option.some [Sc] (record Sc {work := rest, scope := (cons name (project st scope)), depth := ((project st depth) + 1), error := (ctor Option.none [Bytes])})) + | SWork.STrunc wanted => (ctor Option.some [Sc] (record Sc {work := rest, scope := (dropFront (project st scope) (prim subtract (project st depth) wanted : Nat)), depth := wanted, error := (ctor Option.none [Bytes])})) + | SWork.SUni u => (uniStep st rest universes u)))), + executable: true +} + +definition{ + name: checkScopes, + parameters: [expr : LexiconLse::Lse, universes : (List Bytes), bound : Nat], + result: (Option Bytes), + body: (project (first (prim iterate_until (fun [universes] (st : Sc) => (scStep universes st)) ((prim multiply bound 4 : Nat) + 4) (record Sc {work := (cons (ctor SWork.SExpr expr) (nil SWork)), scope := (nil Bytes), depth := 0, error := (ctor Option.none [Bytes])}) : (Sc * Bool))) error), + executable: true, + production: {effects: [allocation, overflow], targets: [rust-std]} +} + +definition{ + name: rcGo, + parameters: [st : Rc, stack : (List LexiconLse::Lse)], + result: (Option Rc), + body: (ctor Option.some [Rc] (record Rc {stack := stack, found := (project st found)})), + executable: true +} + +definition{ + name: rcStep, + parameters: [st : Rc], + result: (Option Rc), + body: (match (project st stack) + | List.nil => (ctor Option.none [Rc]) + | List.cons expr rest => (match expr + | LexiconLse::Lse.LSortProp => (rcGo st rest) + | LexiconLse::Lse.LSortType u => (rcGo st rest) + | LexiconLse::Lse.LConst p e us => (ctor Option.some [Rc] (record Rc {stack := rest, found := (cons (p, e) (project st found))})) + | LexiconLse::Lse.LLocal name => (rcGo st rest) + | LexiconLse::Lse.LApp f args => (rcGo st (cons f (cons args rest))) + | LexiconLse::Lse.LPi binders body => (rcGo st (cons binders (cons body rest))) + | LexiconLse::Lse.LLam binders body => (rcGo st (cons binders (cons body rest))) + | LexiconLse::Lse.LLet name ty value body => (rcGo st (cons ty (cons value (cons body rest)))) + | LexiconLse::Lse.LNat digits => (rcGo st rest) + | LexiconLse::Lse.LNil => (rcGo st rest) + | LexiconLse::Lse.LArg head tail => (rcGo st (cons head (cons tail rest))) + | LexiconLse::Lse.LBinder mode name ty more => (rcGo st (cons ty (cons more rest))))), + executable: true +} + +definition{ + name: referencedConsts, + parameters: [expr : LexiconLse::Lse, bound : Nat], + result: (List (Bytes * Bytes)), + body: (LexLeanStd.Order::reverseList [(Bytes * Bytes)] (project (first (prim iterate_until (fun (st : Rc) => (rcStep st)) ((prim multiply bound 4 : Nat) + 4) (record Rc {stack := (cons expr (nil LexiconLse::Lse)), found := (nil (Bytes * Bytes))}) : (Rc * Bool))) found)), + executable: true, + production: {effects: [allocation, overflow], targets: [rust-std]} +} + +definition{ + name: isSort, + parameters: [expr : LexiconLse::Lse], + result: Bool, + body: (match expr + | LexiconLse::Lse.LSortProp => true + | LexiconLse::Lse.LSortType u => true + | LexiconLse::Lse.LConst p e us => false + | LexiconLse::Lse.LLocal name => false + | LexiconLse::Lse.LApp f args => false + | LexiconLse::Lse.LPi binders body => false + | LexiconLse::Lse.LLam binders body => false + | LexiconLse::Lse.LLet name ty value body => false + | LexiconLse::Lse.LNat digits => false + | LexiconLse::Lse.LNil => false + | LexiconLse::Lse.LArg head tail => false + | LexiconLse::Lse.LBinder mode name ty more => false), + executable: true +} + +definition{ + name: explicitStep, + parameters: [state : (LexiconLse::Lse * Nat)], + result: (Option (LexiconLse::Lse * Nat)), + body: (match (first state) + | LexiconLse::Lse.LBinder mode name ty more => (ctor Option.some [(LexiconLse::Lse * Nat)] (more, (if (mode =? 0) then ((second state) + 1) else (second state)))) + | LexiconLse::Lse.LSortProp => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LSortType u => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LConst p e us => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LLocal name => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LApp f args => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LPi binders body => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LLam binders body => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LLet name ty value body => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LNat digits => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LNil => (ctor Option.none [(LexiconLse::Lse * Nat)]) + | LexiconLse::Lse.LArg head tail => (ctor Option.none [(LexiconLse::Lse * Nat)])), + executable: true +} + +definition{ + name: outerShape, + parameters: [expr : LexiconLse::Lse, bound : Nat], + result: (Nat * Bool), + body: (match expr + | LexiconLse::Lse.LPi binders body => ((second (first (prim iterate_until (fun (state : (LexiconLse::Lse * Nat)) => (explicitStep state)) (bound + 1) (binders, 0) : ((LexiconLse::Lse * Nat) * Bool)))), (isSort body)) + | LexiconLse::Lse.LSortProp => (0, true) + | LexiconLse::Lse.LSortType u => (0, true) + | LexiconLse::Lse.LConst p e us => (0, false) + | LexiconLse::Lse.LLocal name => (0, false) + | LexiconLse::Lse.LApp f args => (0, false) + | LexiconLse::Lse.LLam binders body => (0, false) + | LexiconLse::Lse.LLet name ty value body => (0, false) + | LexiconLse::Lse.LNat digits => (0, false) + | LexiconLse::Lse.LNil => (0, false) + | LexiconLse::Lse.LArg head tail => (0, false) + | LexiconLse::Lse.LBinder mode name ty more => (0, false)), + executable: true, + production: {effects: [allocation, overflow], targets: [rust-std]} +} +\end{semanticmodule} +\end{lexlean} diff --git a/crates/conformance/src/cases/bootstrap.rs b/crates/conformance/src/cases/bootstrap.rs index ac797da29e..64479ed336 100644 --- a/crates/conformance/src/cases/bootstrap.rs +++ b/crates/conformance/src/cases/bootstrap.rs @@ -28,6 +28,7 @@ mod gnaf_validate; mod lexicon_lre; mod lexicon_lse; mod lock_text; +mod lse_scopes; mod manifest_text; mod project_text; mod runtime_validate; @@ -2574,6 +2575,7 @@ fn case(id: &str) { "BS-32" => content_id::case(), "BS-33" => project_text::case(), "BS-34" => manifest_text::case(), + "BS-51" => lse_scopes::case(), other => panic!("no bootstrap case is wired for {other}"), } } diff --git a/crates/conformance/src/cases/bootstrap/lexicon_lse.rs b/crates/conformance/src/cases/bootstrap/lexicon_lse.rs index 8cc5c85c3d..3d252016f3 100755 --- a/crates/conformance/src/cases/bootstrap/lexicon_lse.rs +++ b/crates/conformance/src/cases/bootstrap/lexicon_lse.rs @@ -162,7 +162,7 @@ fn binder_chain(binders: &[LseBinder]) -> Value { } /// An expression as the module's `Lse`. -fn enc_lse(expression: &Lse) -> Value { +pub(super) fn enc_lse(expression: &Lse) -> Value { match expression { Lse::SortProp => adt("Lse", "LSortProp", Vec::new()), Lse::SortType(universe) => adt("Lse", "LSortType", vec![enc_universe(universe)]), @@ -576,7 +576,7 @@ fn drawn_binders(seeded: &mut Seeded, depth: usize) -> Vec { } /// An expression of at most `depth` levels. -fn drawn_lse(seeded: &mut Seeded, depth: usize) -> Lse { +pub(super) fn drawn_lse(seeded: &mut Seeded, depth: usize) -> Lse { let kind = if depth == 0 { seeded.below(5) } else { diff --git a/crates/conformance/src/cases/bootstrap/lse_scopes.rs b/crates/conformance/src/cases/bootstrap/lse_scopes.rs new file mode 100755 index 0000000000..6f5cf2dae6 --- /dev/null +++ b/crates/conformance/src/cases/bootstrap/lse_scopes.rs @@ -0,0 +1,670 @@ +//! `BS-51` (SPEC.md §17.23, §13.8): the scopes, the references, and the +//! outer shape of a LexLean Semantic Expression as language-1.2 source, +//! `LexLeanBoot.LseScopes`, held to the byte to `Lse::check_scopes`, +//! `Lse::referenced_consts`, `Lse::outer_explicit_binders`, and `Lse::result`. +//! +//! The roots read the expressions of `BS-25` and walk them with an explicit +//! work stack, so that none admits `recursion`; the host passes the length of +//! the expression's text, which bounds the walk. Each planted defect names the +//! one vector that catches it. + +use std::collections::{BTreeMap, BTreeSet}; + +use lexlean::calculus::Value; +use lexlean::lexicon::lse::{parse, Lse}; +use serde_json::Value as Json2; + +use super::lexicon_lse::{drawn_lse, enc_lse}; +use super::rust_validate::{eligibility_of, rustc_differential}; +use super::{list, option, pair, text, Run, Seeded}; +use crate::production_export as harness; +use crate::support::{self, repo_root}; + +const MODULE: &str = "LexLeanBoot.LseScopes"; +const ROOTS: [(&str, &[&str]); 3] = [ + ("checkScopes", &["allocation", "overflow"]), + ("referencedConsts", &["allocation", "overflow"]), + ("outerShape", &["allocation", "overflow"]), +]; + +/// The most a part of a certificate of a root may be, as the row states. +const CERTIFICATE_BUDGET: u64 = 3_145_728; +/// The depth the committed expressions and the seeded ones are read at. +const DEPTH: u64 = 64; +/// Seeded expressions under the evaluator, and under rustc. +const EVALUATOR_SEEDED: usize = 300; +const RUSTC_SEEDED: usize = 2_000; +const UNIVERSE_NAMES: &[&str] = &["u", "v", "w1"]; + +fn nat(value: u64) -> Value { + Value::Nat { + value: value.to_string(), + } +} + +/// The bound the host passes: the length of the expression's text. +fn bound(expression: &Lse) -> Value { + nat(u64::try_from(expression.print(false).len()).expect("a length")) +} + +fn scopes_run(expression: &Lse, universes: &[&str]) -> Run { + let declared: BTreeSet = universes.iter().map(|name| (*name).to_owned()).collect(); + let outcome = expression.check_scopes(&declared).err(); + ( + vec![ + enc_lse(expression), + list(universes.iter().map(|name| text(name)).collect()), + bound(expression), + ], + serde_json::to_value(option(outcome.as_deref().map(text))).expect("a value is JSON"), + ) +} + +fn consts_run(expression: &Lse) -> Run { + let found = expression + .referenced_consts() + .iter() + .map(|id| pair(text(&id.package), text(&id.entry))) + .collect(); + ( + vec![enc_lse(expression), bound(expression)], + serde_json::to_value(list(found)).expect("a value is JSON"), + ) +} + +fn shape_run(expression: &Lse) -> Run { + let explicit = u64::try_from(expression.outer_explicit_binders()).expect("a count"); + let sort = matches!(expression.result(), Lse::SortProp | Lse::SortType(_)); + ( + vec![enc_lse(expression), bound(expression)], + serde_json::to_value(pair(nat(explicit), Value::Bool { value: sort })) + .expect("a value is JSON"), + ) +} + +fn parsed(source: &str) -> Lse { + parse(source, DEPTH).unwrap_or_else(|error| panic!("`{source}` parses: {error}")) +} + +// ------------------------------------------------------------------ vectors + +struct Vector { + label: &'static str, + root: usize, + run: Run, +} + +const P: &str = "(sort prop)"; + +#[allow(clippy::too_many_lines)] +fn named() -> Vec { + let mut out = Vec::new(); + let scoped: &[(&'static str, &str, &[&str])] = &[ + ( + "a closed signature", + "(pi ((explicit a (const p::nat))) (const p::nat))", + &[], + ), + ("a free local", "(local x)", &[]), + ( + "a local bound by a pi", + "(pi ((explicit x (sort prop))) (local x))", + &[], + ), + ( + "a local used after its pi", + "(app (const f::g) (pi ((explicit x (sort prop))) (local x)) (local x))", + &[], + ), + ( + "a local used after its lam", + "(app (lam ((explicit y (sort prop))) (local y)) (local y))", + &[], + ), + ( + "a binder sees the binders before it", + "(pi ((explicit a (sort prop)) (implicit b (local a))) (local b))", + &[], + ), + ( + "a binder's type does not see itself", + "(pi ((explicit a (local a))) (sort prop))", + &[], + ), + ( + "a binder's type does not see the binders after it", + "(pi ((explicit a (local b)) (explicit b (sort prop))) (sort prop))", + &[], + ), + ( + "a let value does not see its name", + "(let x (sort prop) (local x) (local x))", + &[], + ), + ( + "a let type does not see its name", + "(let x (local x) (sort prop) (local x))", + &[], + ), + ( + "a let body sees its name", + "(let x (sort prop) (sort prop) (local x))", + &[], + ), + ( + "a let's name ends with it", + "(app (const f::g) (let x (sort prop) (sort prop) (local x)) (local x))", + &[], + ), + ( + "an inner binder shadows an outer one", + "(pi ((explicit x (sort prop))) (lam ((explicit x (local x))) (local x)))", + &[], + ), + ("a declared universe variable", "(sort (type u))", &["u"]), + ("an undeclared universe variable", "(sort (type u))", &[]), + ("a universe of a numeral", "(sort (type 3))", &[]), + ( + "an undeclared variable inside a max", + "(sort (type (max u v w1)))", + &["u"], + ), + ( + "two undeclared variables of an imax", + "(sort (type (imax v w1)))", + &[], + ), + ( + "an undeclared variable under a succ", + "(sort (type (succ (succ w1))))", + &["u", "v"], + ), + ( + "an undeclared universe of a constant", + "(const a::b (u v))", + &["u"], + ), + ( + "the declared universes of a constant", + "(const a::b (u (max v 0)))", + &["u", "v"], + ), + ( + "a universe error after a local error", + "(app (local x) (sort (type u)))", + &[], + ), + ( + "a local error after a universe error", + "(app (const a::b (w1)) (local x))", + &[], + ), + ( + "a universe error in a binder type", + "(pi ((explicit a (sort (type v)))) (local z))", + &["u"], + ), + ("a natural literal", "(nat 42)", &[]), + ("a proposition", P, &[]), + ]; + for &(label, source, universes) in scoped { + out.push(Vector { + label, + root: 0, + run: scopes_run(&parsed(source), universes), + }); + } + for (label, source) in [ + ("no constant", "(sort prop)"), + ("one constant", "(const lexlean.std.nat::nat)"), + ( + "the function's constant before its arguments'", + "(app (const f::g) (const a::b) (const c::d))", + ), + ( + "a nested application", + "(app (app (const f::g) (const a::b)) (const c::d))", + ), + ( + "a constant in a binder type", + "(pi ((explicit x (const a::b)) (implicit y (const c::d))) (const e::f))", + ), + ( + "the constants of a lam", + "(lam ((explicit x (const a::b))) (app (const f::g) (local x)))", + ), + ( + "the constants of a let", + "(let x (const a::b) (const c::d) (const e::f))", + ), + ("a constant repeated", "(app (const a::b) (const a::b))"), + ("a constant with universes", "(const a::b (u 1))"), + ] { + out.push(Vector { + label, + root: 1, + run: consts_run(&parsed(source)), + }); + } + for (label, source) in [ + ("a pi of mixed binders", "(pi ((implicit a (sort prop)) (explicit b (local a)) (instance c (sort prop)) (explicit d (sort prop))) (local b))"), + ("a pi into a sort", "(pi ((explicit a (sort prop))) (sort (type 0)))"), + ("a pi into a proposition", "(pi ((explicit a (sort prop))) (sort prop))"), + ("a pi of implicit binders only", "(pi ((implicit a (sort prop))) (local a))"), + ("a pi into a pi", "(pi ((explicit a (sort prop))) (pi ((explicit b (sort prop))) (sort prop)))"), + ("a lam is no pi", "(lam ((explicit a (sort prop))) (sort prop))"), + ("a sort", "(sort (type 1))"), + ("a constant", "(const a::b)"), + ] { + out.push(Vector { + label, + root: 2, + run: shape_run(&parsed(source)), + }); + } + out +} + +// --------------------------------------------------------------- committed + +/// Every signature and defined value of the committed lexicon entries, with +/// the universes its entry declares. +fn committed() -> Vec<(String, Lse, Vec)> { + let root = repo_root(); + let walker = walkdir::WalkDir::new(root.as_std_path()) + .sort_by_file_name() + .into_iter() + .filter_entry(|entry| { + let name = entry.file_name().to_string_lossy(); + !(entry.file_type().is_dir() + && (matches!(name.as_ref(), "target" | ".git" | ".lexlean") + || support::holds_cache_tag(entry))) + }); + let mut out = Vec::new(); + for entry in walker.flatten() { + let path = entry.path(); + let shown = path.to_string_lossy().replace('\\', "/"); + if !entry.file_type().is_file() || !shown.ends_with(".toml") || !shown.contains("/entries/") + { + continue; + } + let Ok(content) = std::fs::read_to_string(path) else { + continue; + }; + let Ok(table) = content.parse::() else { + continue; + }; + let universes: Vec = table + .get("universes") + .and_then(toml::Value::as_array) + .into_iter() + .flatten() + .filter_map(|name| name.as_str().map(str::to_owned)) + .collect(); + let mut texts: Vec<&str> = Vec::new(); + if let Some(signature) = table.get("signature").and_then(toml::Value::as_str) { + texts.push(signature); + } + if let Some(value) = table + .get("denotation") + .and_then(|denotation| denotation.get("value")) + .and_then(toml::Value::as_str) + { + texts.push(value); + } + for source in texts { + if let Ok(expression) = parse(source, DEPTH) { + out.push((shown.clone(), expression, universes.clone())); + } + } + } + out +} + +/// `count` seeded expressions: each checked under a seeded set of declared +/// universes, its references, and its outer shape. +fn seeded_runs(count: usize) -> [Vec; 3] { + let mut seeded = Seeded(0x0B55_0051); + let mut runs: [Vec; 3] = Default::default(); + for _ in 0..count { + let depth = 1 + seeded.below(4); + let expression = drawn_lse(&mut seeded, depth); + let universes: Vec<&str> = UNIVERSE_NAMES + .iter() + .copied() + .filter(|_| seeded.chance(60)) + .collect(); + runs[0].push(scopes_run(&expression, &universes)); + runs[1].push(consts_run(&expression)); + runs[2].push(shape_run(&expression)); + } + runs +} + +// ------------------------------------------------------------------- plants + +struct Plant { + label: &'static str, + root: usize, + site: &'static str, + replacement: &'static str, + vector: &'static str, +} + +const PLANTS: &[Plant] = &[ + Plant { + label: "a local is in scope everywhere", + root: 0, + site: "| LexiconLse::Lse.LLocal name => (if (member (project st scope) name) then", + replacement: "| LexiconLse::Lse.LLocal name => (if true then", + vector: "a free local", + }, + Plant { + label: "a binder's type sees itself", + root: 0, + site: "(cons (ctor SWork.SExpr ty) (cons (ctor SWork.SBind name) (cons (ctor SWork.SExpr more) rest))", + replacement: "(cons (ctor SWork.SBind name) (cons (ctor SWork.SExpr ty) (cons (ctor SWork.SExpr more) rest))", + vector: "a binder's type does not see itself", + }, + Plant { + label: "a let value sees its name", + root: 0, + site: "(cons (ctor SWork.SExpr value) (cons (ctor SWork.SBind name)", + replacement: "(cons (ctor SWork.SBind name) (cons (ctor SWork.SExpr value)", + vector: "a let value does not see its name", + }, + Plant { + label: "a binder's scope outlives its pi", + root: 0, + site: "scope := (dropFront (project st scope) (prim subtract (project st depth) wanted : Nat)), depth := wanted", + replacement: "scope := (project st scope), depth := (project st depth)", + vector: "a local used after its pi", + }, + Plant { + label: "an undeclared universe variable passes", + root: 0, + site: "(if (member universes name) then (scGo st rest) else", + replacement: "(if true then (scGo st rest) else", + vector: "an undeclared universe variable", + }, + Plant { + label: "the arguments of a max are skipped", + root: 0, + site: "| LexiconLse::Universe.UMax items => (scGo st (cons (ctor SWork.SUni items) rest))", + replacement: "| LexiconLse::Universe.UMax items => (scGo st rest)", + vector: "an undeclared variable inside a max", + }, + Plant { + label: "an imax checks its right first", + root: 0, + site: "(scGo st (cons (ctor SWork.SUni a) (cons (ctor SWork.SUni b) rest)))", + replacement: "(scGo st (cons (ctor SWork.SUni b) (cons (ctor SWork.SUni a) rest)))", + vector: "two undeclared variables of an imax", + }, + Plant { + label: "an application's arguments are checked first", + root: 0, + site: "| LexiconLse::Lse.LApp f args => (scGo st (cons (ctor SWork.SExpr f) (cons (ctor SWork.SExpr args) rest)))", + replacement: "| LexiconLse::Lse.LApp f args => (scGo st (cons (ctor SWork.SExpr args) (cons (ctor SWork.SExpr f) rest)))", + vector: "a universe error after a local error", + }, + Plant { + label: "the universes of a constant are skipped", + root: 0, + site: "| LexiconLse::Lse.LConst p e us => (scGo st (cons (ctor SWork.SUni us) rest))", + replacement: "| LexiconLse::Lse.LConst p e us => (scGo st rest)", + vector: "an undeclared universe of a constant", + }, + Plant { + label: "an application's arguments are referenced first", + root: 1, + site: "| LexiconLse::Lse.LApp f args => (rcGo st (cons f (cons args rest)))", + replacement: "| LexiconLse::Lse.LApp f args => (rcGo st (cons args (cons f rest)))", + vector: "the function's constant before its arguments'", + }, + Plant { + label: "a let's value is skipped", + root: 1, + site: "(rcGo st (cons ty (cons value (cons body rest))))", + replacement: "(rcGo st (cons ty (cons body rest)))", + vector: "the constants of a let", + }, + Plant { + label: "a binder's type is skipped", + root: 1, + site: "| LexiconLse::Lse.LBinder mode name ty more => (rcGo st (cons ty (cons more rest)))", + replacement: "| LexiconLse::Lse.LBinder mode name ty more => (rcGo st (cons more rest))", + vector: "a constant in a binder type", + }, + Plant { + label: "every binder is explicit", + root: 2, + site: "(if (mode =? 0) then ((second state) + 1) else (second state))", + replacement: "((second state) + 1)", + vector: "a pi of mixed binders", + }, + Plant { + label: "a pi's result is never a sort", + root: 2, + site: "(isSort body))", + replacement: "false)", + vector: "a pi into a sort", + }, +]; + +fn plants(vectors: &[Vector]) { + let mut missed = Vec::new(); + for plant in PLANTS { + let vector = vectors + .iter() + .find(|vector| vector.label == plant.vector) + .unwrap_or_else(|| panic!("{}: no vector `{}`", plant.label, plant.vector)); + assert_eq!( + vector.root, plant.root, + "{}: the vector is a run of the root planted", + plant.label + ); + let planted = support::P::bootstrap(); + let source = planted.read_raw("src/LseScopes.lex.tex"); + assert_eq!( + source.matches(plant.site).count(), + 1, + "{}: the plant site occurs once", + plant.label + ); + planted.write( + "src/LseScopes.lex.tex", + &source.replacen(plant.site, plant.replacement, 1), + ); + let checked = support::checked_project(&planted); + let low = super::lower(&checked, &planted, MODULE, ROOTS[plant.root].0); + match super::evaluate(&low, std::slice::from_ref(&vector.run), 1).first() { + Some(first) => eprintln!( + "BS-51: plant detected: {}: {}", + plant.label, + first.chars().take(160).collect::() + ), + None => missed.push(plant.label), + } + } + assert!( + missed.is_empty(), + "planted defects their own vector does not detect: {missed:?}" + ); +} + +fn export(lowered: &BTreeMap<&str, super::Lowered>) { + let exported = harness::exported("bootstrap"); + let bundle = exported.bundle(); + let mut realized = 0usize; + for exported_root in &exported.output.result.roots { + let Some((member, low)) = exported_root + .root + .strip_prefix(&format!("{MODULE}.")) + .and_then(|member| lowered.get(member).map(|low| (member, low))) + else { + continue; + }; + let largest = exported_root + .outputs + .iter() + .flat_map(|output| &output.certification.certificates) + .map(|certificate| certificate.file.byte_length) + .max() + .expect("a certificate"); + eprintln!( + "BS-51: {}: largest certificate part {largest} bytes", + exported_root.root + ); + assert!( + largest <= CERTIFICATE_BUDGET, + "{}: a certificate part of {largest} bytes is beyond {CERTIFICATE_BUDGET}", + exported_root.root + ); + for output in &exported_root.outputs { + let package: Json2 = serde_json::from_slice( + &std::fs::read( + bundle + .join(&output.package.directory) + .join("package.json") + .as_std_path(), + ) + .expect("package.json"), + ) + .expect("package JSON"); + assert_eq!( + package["program"], + serde_json::to_value(&low.program).expect("a program is JSON"), + "{member}: the exported package realizes the program the differential ran" + ); + realized += 1; + } + } + assert_eq!(realized, ROOTS.len(), "one certified package per root"); + let packages = harness::tree(&bundle.join("packages")); + let committed_packages = harness::tree(&harness::fixture_dir("bootstrap").join("packages")); + assert_eq!( + packages.keys().collect::>(), + committed_packages.keys().collect::>(), + "the exported package files are the committed ones" + ); + for (relative, content) in &packages { + assert!( + committed_packages.get(relative) == Some(content), + "packages/{relative} differs from the committed package" + ); + } +} + +/// Every error `check_scopes` can state, by a part of its message (R2). +const REFUSALS: &[&str] = &["is not in scope", "is not declared"]; + +#[allow(clippy::too_many_lines)] +pub(super) fn case() { + let started = std::time::Instant::now(); + let project = support::P::bootstrap(); + let checked_units = project.check_ok(); + assert!( + checked_units.units.contains_key("LseScopes") + && checked_units.units.contains_key("LexiconLse"), + "LseScopes and LexiconLse are linked modules of the project" + ); + eligibility_of(&project, "LseScopes", MODULE, &ROOTS); + + let vectors = named(); + let labels: BTreeSet<&str> = vectors.iter().map(|vector| vector.label).collect(); + assert_eq!(labels.len(), vectors.len(), "each vector has its own label"); + let mut by_root: [Vec; 3] = Default::default(); + for vector in &vectors { + by_root[vector.root].push(vector.run.clone()); + } + let messages: Vec = by_root[0].iter().map(|run| run.1.to_string()).collect(); + for refusal in REFUSALS { + assert!( + messages + .iter() + .any(|message| message.contains(&super::hex(refusal.as_bytes()))), + "no vector reaches the error `{refusal}`" + ); + } + + let corpus = committed(); + assert!( + corpus.len() >= 200, + "the committed entries carry {} signatures and values", + corpus.len() + ); + let mut committed_runs: [Vec; 3] = Default::default(); + for (path, expression, universes) in &corpus { + let declared: Vec<&str> = universes.iter().map(String::as_str).collect(); + let run = scopes_run(expression, &declared); + assert_eq!( + run.1, + serde_json::to_value(Value::None).expect("a value is JSON"), + "{path}: a committed expression is in scope" + ); + committed_runs[0].push(run); + committed_runs[1].push(consts_run(expression)); + committed_runs[2].push(shape_run(expression)); + } + let normative = support::normative_host(); + let (evaluator_seeded, rustc_seeded) = if normative { + (seeded_runs(EVALUATOR_SEEDED), seeded_runs(RUSTC_SEEDED)) + } else { + (Default::default(), Default::default()) + }; + eprintln!( + "BS-51: {} vectors, {} committed expressions, {} and {} seeded expressions under the evaluator and rustc ({:?})", + vectors.len(), + corpus.len(), + evaluator_seeded[0].len(), + rustc_seeded[0].len(), + started.elapsed() + ); + + let checked = support::checked_project(&project); + let lowered: BTreeMap<&str, super::Lowered> = ROOTS + .iter() + .map(|(root, _)| (*root, super::lower(&checked, &project, MODULE, root))) + .collect(); + if normative { + for (index, (root, _)) in ROOTS.iter().enumerate() { + let mut runs: Vec = by_root[index].clone(); + runs.extend(committed_runs[index].iter().cloned()); + runs.extend(evaluator_seeded[index].iter().cloned()); + let disagreements = super::evaluate(&lowered[root], &runs, 5); + assert!( + disagreements.is_empty(), + "{root} and the Rust oracle disagree: {disagreements:?}" + ); + eprintln!( + "BS-51: {root}: the evaluator agrees on {} runs ({:?})", + runs.len(), + started.elapsed() + ); + } + plants(&vectors); + } else { + eprintln!("BS-51: platform-bound host: the evaluator, the seeded runs, and the planted defects run on the normative host"); + } + + let mut compiled: [Vec; 3] = Default::default(); + for (index, runs) in compiled.iter_mut().enumerate() { + runs.append(&mut by_root[index]); + runs.append(&mut committed_runs[index]); + runs.extend(rustc_seeded[index].iter().cloned()); + } + let suites: Vec<(&str, &super::Lowered, &[Run])> = ROOTS + .iter() + .enumerate() + .map(|(index, (root, _))| (*root, &lowered[root], compiled[index].as_slice())) + .collect(); + let total = rustc_differential("BS-51", &suites, "oracle"); + eprintln!("BS-51: {total} rustc runs agree ({:?})", started.elapsed()); + + if !support::lean_backed("BS-51") { + return; + } + export(&lowered); + eprintln!("BS-51: passed in {:?}", started.elapsed()); +} diff --git a/crates/conformance/src/cases/repository.rs b/crates/conformance/src/cases/repository.rs index 91e9093f87..b197cce4f4 100644 --- a/crates/conformance/src/cases/repository.rs +++ b/crates/conformance/src/cases/repository.rs @@ -898,7 +898,7 @@ pub(crate) fn run(id: &str) { let model = repo_model::Model::load(&root.join("model").into_std_path_buf()) .expect("the model loads"); let table = spec_table(); - assert_eq!(table.len(), 494, "§31 has 494 rows"); + assert_eq!(table.len(), 495, "§31 has 495 rows"); assert_eq!(model.ids.id.len(), table.len(), "register row count"); for ((spec_id, spec_suite, spec_statement), row) in table.iter().zip(model.ids.id.iter()) diff --git a/crates/conformance/tests/conformance.rs b/crates/conformance/tests/conformance.rs index 40de19344c..d423d53379 100644 --- a/crates/conformance/tests/conformance.rs +++ b/crates/conformance/tests/conformance.rs @@ -2400,6 +2400,11 @@ fn conformance_bs_34() { repo_conformance::cases::run("BS-34"); } +#[test] +fn conformance_bs_51() { + repo_conformance::cases::run("BS-51"); +} + #[test] fn conformance_pk_01() { repo_conformance::cases::run("PK-01"); diff --git a/features/suites/bootstrap.feature b/features/suites/bootstrap.feature index 13e468aa52..f82db6cec0 100644 --- a/features/suites/bootstrap.feature +++ b/features/suites/bootstrap.feature @@ -208,3 +208,10 @@ Feature: bootstrap When the project is checked and built, and the lowered program and the rendered package of the root are run on those manifests Then the root is eligible for rust-std with exactly its declared effects, no certificate part is beyond 3,145,728 bytes, the root equals the file bytes of `BuildManifest::to_json` on every run, and each committed manifest is the oracle's text of its own fields And every planted defect is detected by its own vector, and the exported packages are byte-identical to the committed packages and realize the programs the differential ran + + @BS-51 @build + Scenario: The scopes, the references, and the outer shape of a LexLean Semantic Expression of SPEC.md §13.8 (`lexicon::lse::Lse::check_scopes`: every local resolves lexically, a binder's type seen before its name and a `let`'s type and value before its name, and every universe variable is declared, or the message of the first that is not, in the oracle's order of visit; `referenced_consts`: the qualified constants in occurrence order; and `outer_explicit_binders` with `result`: the explicit binders of the outermost `pi` and whether its result is a sort) is language-1.2 source in the `bootstrap/` project, as three production roots of `LseScopes` over the expressions of `BS-25`: `checkScopes`, `referencedConsts`, and `outerShape`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, none of them `recursion`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built expressions, which reach both errors, shadowing, the end of every binder's scope, and every universe form, on every signature and defined value of the committed lexicon entries under the universes its entry declares, and on seeded expressions under seeded declarations; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; the conservative type checker of §13.7 is outside the claim. + Given the committed `bootstrap` project, hand-built expressions, the signatures and defined values of the committed lexicon entries, and seeded expressions + When the project is checked and built, and the lowered programs and the rendered packages of the three roots are run on those expressions + Then each root is eligible for rust-std with exactly its declared effects, no certificate part is beyond 3,145,728 bytes, and each root equals `Lse::check_scopes`, `Lse::referenced_consts`, or `outer_explicit_binders` with `result` on every run + And every planted defect is detected by its own vector, and the exported packages are byte-identical to the committed packages and realize the programs the differential ran diff --git a/model/ids.toml b/model/ids.toml index eace0ca124..ee48682295 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -2882,6 +2882,12 @@ level = "build" suite = "bootstrap" statement = "The build manifest of SPEC.md §21.6 in the canonical JSON of §21.7 (`artifact::manifest::BuildManifest::to_json` written as a file: the specification, the compiler version and semantics ID, the language, the project, the source, semantic, and build IDs, the pinned Lean toolchain, the selection and the module rows in their order, a module's origin only when it has one, and the input and output rows sorted by kind, path, length, and digest, each digest in lower-case hex) is language-1.2 source in the `bootstrap/` project, as the production root `buildManifest` of `ManifestText` over the standard library's `Json` writer, eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `recursion`, and with no part of its certificate beyond 3,145,728 bytes; its rendered `rust-std` package under the pinned rustc, and on the normative host its lowered program under the calculus evaluator, agree with the oracle to the byte on hand-built manifests, which reach every key of the row order, lengths across a byte, a module's origin, and escapes, on every committed build manifest, each of which is the oracle's text of its own fields, and on seeded manifests; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; gathering the rows of a build and hashing its files are outside the claim." +[[id]] +id = "BS-51" +level = "build" +suite = "bootstrap" +statement = "The scopes, the references, and the outer shape of a LexLean Semantic Expression of SPEC.md §13.8 (`lexicon::lse::Lse::check_scopes`: every local resolves lexically, a binder's type seen before its name and a `let`'s type and value before its name, and every universe variable is declared, or the message of the first that is not, in the oracle's order of visit; `referenced_consts`: the qualified constants in occurrence order; and `outer_explicit_binders` with `result`: the explicit binders of the outermost `pi` and whether its result is a sort) is language-1.2 source in the `bootstrap/` project, as three production roots of `LseScopes` over the expressions of `BS-25`: `checkScopes`, `referencedConsts`, and `outerShape`, each eligible for `rust-std` with exactly its declared effects, `allocation` and `overflow`, none of them `recursion`, and each with no part of its certificate beyond 3,145,728 bytes; their rendered `rust-std` packages under the pinned rustc, and on the normative host their lowered programs under the calculus evaluator, agree with the oracle to the byte on hand-built expressions, which reach both errors, shadowing, the end of every binder's scope, and every universe form, on every signature and defined value of the committed lexicon entries under the universes its entry declares, and on seeded expressions under seeded declarations; each planted defect in the source is detected by the one vector it names, and the certified packages the production export publishes for the project are the committed ones; the conservative type checker of §13.7 is outside the claim." + [[id]] id = "PK-01" level = "build" diff --git a/tests/production-export/bootstrap/roots.json b/tests/production-export/bootstrap/roots.json index 32674a57bb..9a175a815f 100644 --- a/tests/production-export/bootstrap/roots.json +++ b/tests/production-export/bootstrap/roots.json @@ -495,6 +495,30 @@ "rust-std" ], "version": "1.0.0" + }, + { + "name": "check_scopes", + "root": "LexLeanBoot.LseScopes.checkScopes", + "targets": [ + "rust-std" + ], + "version": "1.0.0" + }, + { + "name": "outer_shape", + "root": "LexLeanBoot.LseScopes.outerShape", + "targets": [ + "rust-std" + ], + "version": "1.0.0" + }, + { + "name": "referenced_consts", + "root": "LexLeanBoot.LseScopes.referencedConsts", + "targets": [ + "rust-std" + ], + "version": "1.0.0" } ] } diff --git a/xtask/src/spec_links.rs b/xtask/src/spec_links.rs index bc36890817..4b5b4ed499 100644 --- a/xtask/src/spec_links.rs +++ b/xtask/src/spec_links.rs @@ -61,8 +61,8 @@ fn parse_table(spec: &str) -> Result, Fail> { pub fn validate(root: &Path) -> Result<(), Fail> { let spec = std::fs::read_to_string(root.join("SPEC.md"))?; let rows = parse_table(&spec)?; - if rows.len() != 494 { - return Err(format!("RP-07: the §31 table has {} rows, not 494", rows.len()).into()); + if rows.len() != 495 { + return Err(format!("RP-07: the §31 table has {} rows, not 495", rows.len()).into()); } // The prose total under the table is part of the contract a reader // relies on; a row added without it would leave §31 contradicting itself.