diff --git a/.github/bdd-parts.json b/.github/bdd-parts.json index ea7d7f0982..091db20a31 100644 --- a/.github/bdd-parts.json +++ b/.github/bdd-parts.json @@ -292,6 +292,9 @@ ], "bootstrap-semantic-terms": [ "BS-69" + ], + "bootstrap-semantic-decls": [ + "BS-70" ] }, "targets": { diff --git a/.github/intel-host-lanes.json b/.github/intel-host-lanes.json index 086bf9bf7e..a377206058 100644 --- a/.github/intel-host-lanes.json +++ b/.github/intel-host-lanes.json @@ -2,7 +2,7 @@ "producer": ["honesty"], "lanes": { "lower": ["bootstrap-lower", "bootstrap-lexicon-lse", "bootstrap-lexicon-lre", "bootstrap-surface-module", "bootstrap-diagnostics", "bootstrap-cli-output"], - "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", "bootstrap-ir-term", "bootstrap-ir-proof", "bootstrap-ir-document", "bootstrap-semantic-types", "bootstrap-semantic-terms"], + "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", "bootstrap-ir-term", "bootstrap-ir-proof", "bootstrap-ir-document", "bootstrap-semantic-types", "bootstrap-semantic-terms", "bootstrap-semantic-decls"], "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 ca3b928524..605669197e 100644 --- a/.github/vv-rows.json +++ b/.github/vv-rows.json @@ -403,5 +403,14 @@ "width": "", "memory_kib": "", "hints": "" + }, + { + "part": "bdd-bootstrap-semantic-decls", + "recipes": "bdd", + "examples_part": "", + "bdd_part": "bootstrap-semantic-decls", + "width": "", + "memory_kib": "", + "hints": "" } ] diff --git a/CHANGELOG.md b/CHANGELOG.md index d01e304620..6b6d83fec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,13 @@ workspace carried at those versions without a tag. A landing that moves the language-1.2 ID now also updates the constant; `RP-10` names the new value when it is stale. +- The ordinary declarations of the semantic module language and its modules as + language-1.2 source, sixth slice of the typed IR (SPEC.md §17.23, §17.11, §17.12, + `BS-70`, #269; no new diagnostic code, no change to the language-1.2 identity). + `semanticDeclarationText` and `semanticModuleText` of `SemanticDecls` return the canonical JSON of + the serde form of `SemanticDeclaration` and `SemanticModule`, the latter for every + module of the `bootstrap/` project and the standard library, and admit `recursion`. + The register is 502 IDs. - The closed terms and proofs of the semantic module language as language-1.2 source, fifth slice of the typed IR (SPEC.md §17.23, §17.11, §17.12, `BS-69`, #269; no new diagnostic code, no change to the language-1.2 identity). `semanticTermText` and diff --git a/README.md b/README.md index 54b1b5a06d..7acaa2b1ca 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 501 registered conformance IDs have their named tests; `just vv` checks them with the pinned toolchain installed. +All 502 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-69` | `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-70` | `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 084402f83b..05497dafc5 100644 --- a/SPEC.md +++ b/SPEC.md @@ -9171,6 +9171,20 @@ Arguments, assignments, branches, map entries, and graph edges are chains of cel itself, and proof branches and nested members chains of cells of the proof, so that each root is one structural recursion. Both roots admit `recursion`. Reading terms and proofs from JSON stays in the host. +The ordinary declarations of the semantic module language (§17.11, §17.12) and the module that +holds them are the sixth component of the typed IR as source (`BS-70`, issue 269), the module +`SemanticDecls` over `SemanticTerms` and `SemanticTypes`, with two production roots for +`rust-std`: + +| Root | Takes | Returns | Oracle | +| --- | --- | --- | --- | +| `LexLeanBoot.SemanticDecls.semanticDeclarationText` | a structure, class, instance, inductive, definition, or theorem | its canonical JSON as the linked IR embeds it | the serde form of `ir::semantic::SemanticDeclaration` | +| `LexLeanBoot.SemanticDecls.semanticModuleText` | a specification and the declarations of a module | the module's canonical JSON | the serde form of `ir::semantic::SemanticModule` | + +Every module of the `bootstrap/` project and of the standard library declares only these kinds, +so `semanticModuleText` writes the semantic modules of LexLean's own sources. Both roots admit +`recursion`. The declarations of models, reasoning, and text components, and reading +declarations from JSON, stay in the host. The authoring notation of a tooling module (§17.20, §17.21) is the fifth component of the front end (`BS-27`, issue 269), the module `SurfaceTooling` over the generic notation of @@ -12235,6 +12249,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `BS-67` | `bootstrap` | The document IR and the linked project of SPEC.md §17.5 in the canonical JSON of §17.9, and the semantic ID of §21.4 (`ir::document::DocumentModule::to_json`: the name, the Lean module, the glossary, the imports, the title and the blocks under one hashing renumbering of `BS-65`, each section's heading, parameters, and blocks in order and each declaration through `BS-66`, the origin only when there is one, an import's Lean module only when it is not the one the module's prefix gives, and an embedded closed-core module as its serialized text and a semantic or tooling module as its JSON; `LinkedProject::to_json`: the specification and the modules in name order; and the semantic ID the linker records, the recipe of `BS-32` over that text) is language-1.2 source in the `bootstrap/` project, as three production roots of `IrDocument`: `moduleText`, `linkedText`, and `projectSemanticId`, each eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `recursion`, and each with no part of its certificate beyond 4,194,304 bytes; their rendered `rust-std` packages under the pinned rustc on the projects of at most 4,194,304 bytes of linked IR, and on the normative host their lowered programs under the calculus evaluator on the shorter ones, agree with the oracle to the byte on hand-built modules and projects, which reach every phrase item, sections, origins, default and foreign imports, every kind of embedded module, and modules out of order, and on every module, every linked project, and the recorded semantic ID of every committed project outside the negative fixtures and UOR Atlas that links under its committed lock, or under a lock computed from its manifest when it commits none; each planted defect in the source is detected by the root and the one vector it names, and the certified packages the production export publishes for the project are the committed ones; serializing the embedded modules and the lexicon closure is outside the claim. | §17.5, §17.9, §17.23, §21.4 | | `BS-68` | `bootstrap` | The closed types of the semantic module language of SPEC.md §17.11 and §17.12, its primitives, and its integer families (`ir::semantic::SemanticType` in the serde form the linked IR embeds, written as canonical JSON: each type tagged by its `kind`, a named type's module only when it has one, and the fixed-width names `int8` to `uint64`; its `Display`, the spelling diagnostics use; and of `SemanticPrimitive` and `SemanticInteger`, the serialized name, whether a primitive is language 1.2's, whether linking widens it away, and the position of its function argument) is language-1.2 source in the `bootstrap/` project, as four production roots of `SemanticTypes`: `primitiveFacts` and `integerName`, each eligible for `rust-std` with exactly `allocation`, `typeText`, with exactly `allocation`, `overflow`, and `recursion`, and `typeSpelling`, with exactly `allocation` and `recursion`, 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 types, which reach every constructor and every unit type, on every primitive and every integer family the module names, each read back through the oracle's serialized name, on every distinct type of every committed semantic module that links, and on seeded types; each planted defect in the source is detected by the root and the one vector it names, and the certified packages the production export publishes for the project are the committed ones; reading types from JSON is outside the claim. | §17.11, §17.12, §17.23 | | `BS-69` | `bootstrap` | The closed terms and proofs of the semantic module language of SPEC.md §17.11 and §17.12 (`ir::semantic::SemanticTerm` and `SemanticProof` in the serde form the linked IR embeds, written as canonical JSON: each term and proof tagged by its `kind`, its member references, assignments, branches, binders, map entries, graph edges, model checks, and reflections in their fields, a list of type arguments, definitions, generalized names, or premises left out when it is empty where the oracle skips it, and its types through `SemanticTypes`) is language-1.2 source in the `bootstrap/` project, as two production roots of `SemanticTerms`: `semanticTermText` and `semanticProofText`, each eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `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 terms and proofs, which reach every constructor and every optional list both empty and not, on every distinct term and proof of every committed semantic module that links, and on seeded terms and proofs; each planted defect in the source is detected by the root and the one vector it names, and the certified packages the production export publishes for the project are the committed ones; reading terms and proofs from JSON is outside the claim. | §17.11, §17.12, §17.23 | +| `BS-70` | `bootstrap` | The ordinary declarations of the semantic module language of SPEC.md §17.11 and §17.12 and the module that holds them (`ir::semantic::SemanticDeclaration` for structures, classes, instances, inductives, definitions, and theorems, and `SemanticModule`, in the serde form the linked IR embeds, written as canonical JSON: each declaration tagged by its `kind`, its parameters, fields, constructors, and assignments in order, and a definition's or a theorem's type parameters, recursive argument, axioms, executable flag, mutual group, termination, and production, and an inductive's mutual group, left out exactly where the oracle's serde attributes skip them; and a module's specification and declarations in order) is language-1.2 source in the `bootstrap/` project, as two production roots of `SemanticDecls` over `SemanticTerms` and `SemanticTypes`: `semanticDeclarationText` and `semanticModuleText`, each eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `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 on the shorter modules, agree with the oracle to the byte on hand-built declarations, which reach every kind and every optional member both present and absent, on every distinct ordinary declaration of every committed semantic module that links and on every such module whose declarations are all ordinary, among them every module of the `bootstrap/` project and the standard library, and on seeded declarations; each planted defect in the source is detected by the root and the one vector it names, and the certified packages the production export publishes for the project are the committed ones; the declarations of models, reasoning, and text components, and reading declarations from JSON, are outside the claim. | §17.11, §17.12, §17.23 | | `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 | @@ -12251,7 +12266,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:** 501. +**Total required capability IDs:** 502. 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 68f2a1e1d3..3c0486a8a8 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -11918,6 +11918,39 @@ check` of the `bootstrap/` project passes, with each of the two roots eligible for `rust-std` with exactly its declared effects, and `lexlean fmt --check` passes. +### the semantic declarations and modules are source (BS-70) + +`BS-70` holds the two production roots of `LexLeanBoot.SemanticDecls` +(`bootstrap/src/SemanticDecls.lex.tex`) to `lexlean::ir::semantic`: +`semanticDeclarationText` to the canonical JSON of the serde form of +`SemanticDeclaration` for structures, classes, instances, inductives, +definitions, and theorems, and `semanticModuleText` to that of `SemanticModule`, as +`DocumentModule::to_json` embeds a semantic module. The module declares the six +ordinary declaration kinds of SPEC.md §17.11 and §17.12 as one inductive over +the terms and proofs of `SemanticTerms` (`BS-69`) and the types of +`SemanticTypes` (`BS-68`). A definition's or a theorem's type parameters, +recursive argument, axioms, executable flag, mutual group, termination, and +production, and an inductive's mutual group, are left out exactly where the +oracle's serde attributes skip them. Every module of the `bootstrap/` project and +of the standard library declares only these kinds, so `semanticModuleText` writes the +semantic modules of LexLean's own sources. Both roots admit exactly +`allocation`, `overflow`, and `recursion`. The oracle is the existing public code +of `semantic.rs` and its serde derivations; no Rust outside the case changes. + +The case holds each root to the oracle on hand-built declarations of every kind, +with every optional member both present and absent, and a hand-built module; on +every distinct ordinary declaration of every committed semantic module that +links, and on every such module whose declarations are all ordinary, the +evaluator taking the modules whose JSON is at most 262,144 bytes and the rendered +packages all of them; and on seeded declarations. Each planted defect names the +root and the vector that catch it, and the case asserts that the site of each +plant occurs once. The row's statement carries no counts. + +Measured with the compiler binary of this tree's compiler sources: `lexlean +check` and `lexlean build` of the `bootstrap/` project pass, with each of the two +roots eligible for `rust-std` with exactly its declared effects, and `lexlean fmt +--check` passes. + ## The `bdd` recipe as the parts of one run (Issue #131) With UOR Atlas verified as the parts of one run, the `rest` leg became the diff --git a/bootstrap/README.md b/bootstrap/README.md index 2af2cae6b5..590e2c8728 100644 --- a/bootstrap/README.md +++ b/bootstrap/README.md @@ -70,3 +70,6 @@ them and as diagnostics spell them, and the facts of its primitives and integer `src/SemanticTerms.lex.tex` (SPEC.md §17.23, `BS-69`) imports `SemanticTypes` (`BS-68`) and the standard library's `Json` and `Order`, and writes the closed terms and proofs of the semantic module language as the linked IR embeds them. +`src/SemanticDecls.lex.tex` (SPEC.md §17.23, `BS-70`) imports `SemanticTerms` (`BS-69`), `SemanticTypes` +(`BS-68`), and the standard library's `Json` and `Order`, and writes the ordinary declarations of the +semantic module language and its modules as the linked IR embeds them. diff --git a/bootstrap/lexlean.lock b/bootstrap/lexlean.lock index 1d1eb0decb..7879dd8e2d 100644 --- a/bootstrap/lexlean.lock +++ b/bootstrap/lexlean.lock @@ -1,7 +1,7 @@ spec = "lexlean/lock/2" language = "1.2" compiler_semantics = "635a25acb886587f8777525e778092e9599d1f2df26da59403ee39e9e299151a" -project_config_sha256 = "cea127459a4bab167667f9d0d64252398a2e9db4d53dc74cfef5aa2b65ad406e" +project_config_sha256 = "b48ffa32d3a34197ff1ad80ee19edbf6ee5bdecaebbb47c9f8231d13d7dfc675" lean_toolchain = "leanprover/lean4:v4.32.1" [[workspace_file]] diff --git a/bootstrap/lexlean.toml b/bootstrap/lexlean.toml index 9c1a51bd3a..b033d495c8 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/IrDocument.lex.tex", "src/IrProof.lex.tex", "src/IrTerm.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/SemanticTerms.lex.tex", "src/SemanticTypes.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/IrDocument.lex.tex", "src/IrProof.lex.tex", "src/IrTerm.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/SemanticDecls.lex.tex", "src/SemanticTerms.lex.tex", "src/SemanticTypes.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/SemanticDecls.lex.tex b/bootstrap/src/SemanticDecls.lex.tex new file mode 100755 index 0000000000..d0fca84f47 --- /dev/null +++ b/bootstrap/src/SemanticDecls.lex.tex @@ -0,0 +1,207 @@ +\begin{lexlean}{SemanticDecls} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{SemanticTerms} +\importmodule{SemanticTypes} +\importmodule{LexLeanStd.Json} +\importmodule{LexLeanStd.Order} +\title{Natural number addition} +\begin{semanticmodule} +inductive{ + name: SDecl, + type_parameters: [], + parameters: [], + constructors: [ + { + name: DStructure, + fields: [ + Bytes, + (List Bytes), + (List (Bytes * SemanticTypes::SemanticType)), + (List (Bytes * SemanticTypes::SemanticType)) + ] + }, + { + name: DClass, + fields: [ + Bytes, + (List Bytes), + (List (Bytes * SemanticTypes::SemanticType)), + (List (Bytes * SemanticTypes::SemanticType)) + ] + }, + { + name: DInstance, + fields: [Bytes, (Option Bytes), Bytes, SemanticTypes::SemanticType, Nat, SemanticTerms::STerm] + }, + { + name: DInductive, + fields: [ + Bytes, + (List Bytes), + (List (Bytes * SemanticTypes::SemanticType)), + (List (Bytes * SemanticTypes::SemanticType)), + (Option Bytes) + ] + }, + { + name: DDefinition, + fields: [ + Bytes, + (List Bytes), + (List (Bytes * SemanticTypes::SemanticType)), + SemanticTypes::SemanticType, + (Option Bytes), + SemanticTerms::STerm, + (List Bytes), + Bool, + (Option Bytes), + (Option (SemanticTerms::STerm * (List ((Option Bytes) * Bytes)))), + (Option ((List Bytes) * (List Bytes))) + ] + }, + { + name: DTheorem, + fields: [ + Bytes, + (List Bytes), + (List (Bytes * SemanticTypes::SemanticType)), + SemanticTerms::STerm, + SemanticTerms::SProof, + (List Bytes) + ] + } + ] +} + +definition{ + name: lit, + parameters: [literal : String], + result: Bytes, + body: (prim utf8_encode literal : Bytes), + executable: true +} + +definition{ + name: member, + parameters: [key : String, entry : LexLeanStd.Json::Json, rest : LexLeanStd.Json::Json], + result: LexLeanStd.Json::Json, + body: (ctor LexLeanStd.Json::Json.JMember (lit key) entry rest), + executable: true +} + +definition{ + name: jnil, + parameters: [], + result: LexLeanStd.Json::Json, + body: (ctor LexLeanStd.Json::Json.JNil), + executable: true +} + +definition{ + name: jtext, + parameters: [text : Bytes], + result: LexLeanStd.Json::Json, + body: (ctor LexLeanStd.Json::Json.JStr text), + executable: true +} + +definition{ + name: kinded, + parameters: [kind : String, rest : LexLeanStd.Json::Json], + result: LexLeanStd.Json::Json, + body: (ctor LexLeanStd.Json::Json.JObj (member "kind" (jtext (lit kind)) rest)), + executable: true +} + +definition{ + name: fieldsJson, + parameters: [entries : (List (Bytes * SemanticTypes::SemanticType))], + result: LexLeanStd.Json::Json, + body: (SemanticTerms::paramsJson entries), + executable: true +} + +definition{ + name: namesWhenAny, + parameters: [key : String, names : (List Bytes), rest : LexLeanStd.Json::Json], + result: LexLeanStd.Json::Json, + body: (match names + | List.nil => rest + | List.cons head tail => (member key (SemanticTerms::namesJson names) rest)), + executable: true +} + +definition{ + name: textWhenSome, + parameters: [key : String, value : (Option Bytes), rest : LexLeanStd.Json::Json], + result: LexLeanStd.Json::Json, + body: (match value | Option.some text => (member key (jtext text) rest) | Option.none => rest), + executable: true +} + +definition{ + name: constructorsJson, + parameters: [constructors : (List (Bytes * SemanticTypes::SemanticType))], + result: LexLeanStd.Json::Json, + body: (ctor LexLeanStd.Json::Json.JArr (SemanticTerms::chainOf (prim list_fold (fun (acc : (List LexLeanStd.Json::Json)) (entry : (Bytes * SemanticTypes::SemanticType)) => (cons (ctor LexLeanStd.Json::Json.JObj (member "name" (jtext (first entry)) (member "fields" (ctor LexLeanStd.Json::Json.JArr (SemanticTypes::typeJson (second entry))) (jnil)))) acc)) (nil LexLeanStd.Json::Json) (LexLeanStd.Order::reverseList [(Bytes * SemanticTypes::SemanticType)] constructors) : (List LexLeanStd.Json::Json)))), + executable: true +} + +definition{ + name: terminationJson, + parameters: [ + termination : (Option (SemanticTerms::STerm * (List ((Option Bytes) * Bytes)))), + rest : LexLeanStd.Json::Json + ], + result: LexLeanStd.Json::Json, + body: (match termination + | Option.some evidenced => (member "termination" (ctor LexLeanStd.Json::Json.JObj (member "measure" (SemanticTerms::termJson (first evidenced)) (member "evidence" (SemanticTerms::membersJson (second evidenced)) (jnil)))) rest) + | Option.none => rest), + executable: true +} + +definition{ + name: productionJson, + parameters: [production : (Option ((List Bytes) * (List Bytes))), rest : LexLeanStd.Json::Json], + result: LexLeanStd.Json::Json, + body: (match production + | Option.some declared => (member "production" (ctor LexLeanStd.Json::Json.JObj (member "targets" (SemanticTerms::namesJson (first declared)) (member "effects" (SemanticTerms::namesJson (second declared)) (jnil)))) rest) + | Option.none => rest), + executable: true +} + +definition{ + name: declarationJson, + parameters: [declaration : SDecl], + result: LexLeanStd.Json::Json, + body: (match declaration + | SDecl.DStructure named typeParameters parameters fields => (kinded "structure" (member "name" (jtext named) (member "type_parameters" (SemanticTerms::namesJson typeParameters) (member "parameters" (SemanticTerms::paramsJson parameters) (member "fields" (fieldsJson fields) (jnil)))))) + | SDecl.DClass named typeParameters parameters fields => (kinded "class" (member "name" (jtext named) (member "type_parameters" (SemanticTerms::namesJson typeParameters) (member "parameters" (SemanticTerms::paramsJson parameters) (member "fields" (fieldsJson fields) (jnil)))))) + | SDecl.DInstance named classModule className arguments priority assigned => (kinded "instance" (member "name" (jtext named) (member "class" (SemanticTerms::memberJson classModule className) (member "arguments" (ctor LexLeanStd.Json::Json.JArr (SemanticTypes::typeJson arguments)) (member "priority" (ctor LexLeanStd.Json::Json.JInt false priority) (member "fields" (ctor LexLeanStd.Json::Json.JArr (SemanticTerms::termJson assigned)) (jnil))))))) + | SDecl.DInductive named typeParameters parameters constructors grouped => (kinded "inductive" (member "name" (jtext named) (member "type_parameters" (SemanticTerms::namesJson typeParameters) (member "parameters" (SemanticTerms::paramsJson parameters) (member "constructors" (constructorsJson constructors) (textWhenSome "mutual" grouped (jnil))))))) + | SDecl.DDefinition named typeParameters parameters outcome recursiveArg body axiomNames isExecutable grouped terminating produced => (kinded "definition" (member "name" (jtext named) (namesWhenAny "type_parameters" typeParameters (member "parameters" (SemanticTerms::paramsJson parameters) (member "result" (SemanticTypes::typeJson outcome) (textWhenSome "recursive_argument" recursiveArg (member "body" (SemanticTerms::termJson body) (namesWhenAny "axioms" axiomNames (if isExecutable then (member "executable" (ctor LexLeanStd.Json::Json.JBool true) (textWhenSome "mutual" grouped (terminationJson terminating (productionJson produced (jnil))))) else (textWhenSome "mutual" grouped (terminationJson terminating (productionJson produced (jnil))))))))))))) + | SDecl.DTheorem named typeParameters parameters statement proof axiomNames => (kinded "theorem" (member "name" (jtext named) (namesWhenAny "type_parameters" typeParameters (member "parameters" (SemanticTerms::paramsJson parameters) (member "statement" (SemanticTerms::termJson statement) (member "proof" (SemanticTerms::proofJson proof) (namesWhenAny "axioms" axiomNames (jnil))))))))), + executable: true +} + +definition{ + name: semanticDeclarationText, + parameters: [declaration : SDecl], + result: Bytes, + body: (LexLeanStd.Json::writeJson (declarationJson declaration)), + axioms: [Quot.sound, propext], + executable: true, + production: {effects: [allocation, overflow, recursion], targets: [rust-std]} +} + +definition{ + name: semanticModuleText, + parameters: [spec : Bytes, declarations : (List SDecl)], + result: Bytes, + body: (LexLeanStd.Json::writeJson (ctor LexLeanStd.Json::Json.JObj (member "spec" (jtext spec) (member "declarations" (ctor LexLeanStd.Json::Json.JArr (SemanticTerms::chainOf (prim list_fold (fun (acc : (List LexLeanStd.Json::Json)) (declaration : SDecl) => (cons (declarationJson declaration) acc)) (nil LexLeanStd.Json::Json) (LexLeanStd.Order::reverseList [SDecl] declarations) : (List LexLeanStd.Json::Json)))) (jnil))))), + axioms: [Quot.sound, propext], + executable: true, + production: {effects: [allocation, overflow, recursion], targets: [rust-std]} +} +\end{semanticmodule} +\end{lexlean} diff --git a/crates/conformance/src/cases/bootstrap.rs b/crates/conformance/src/cases/bootstrap.rs index 6d8e12aeea..57c1a85c23 100644 --- a/crates/conformance/src/cases/bootstrap.rs +++ b/crates/conformance/src/cases/bootstrap.rs @@ -45,6 +45,7 @@ mod rust_succeed; mod rust_terms; mod rust_validate; mod scan; +mod semantic_decls; mod semantic_terms; mod semantic_types; mod structural_grammar; @@ -2584,6 +2585,7 @@ fn case(id: &str) { "BS-67" => ir_document::case(), "BS-68" => semantic_types::case(), "BS-69" => semantic_terms::case(), + "BS-70" => semantic_decls::case(), other => panic!("no bootstrap case is wired for {other}"), } } diff --git a/crates/conformance/src/cases/bootstrap/semantic_decls.rs b/crates/conformance/src/cases/bootstrap/semantic_decls.rs new file mode 100755 index 0000000000..36cde01087 --- /dev/null +++ b/crates/conformance/src/cases/bootstrap/semantic_decls.rs @@ -0,0 +1,937 @@ +//! `BS-70` (SPEC.md §17.23, §17.11, §17.12): the ordinary declarations of the +//! semantic module language and the module that holds them as language-1.2 +//! source, `LexLeanBoot.SemanticDecls`, held to the byte to the serde form of +//! `lexlean::ir::semantic::SemanticDeclaration` and `SemanticModule` in +//! canonical JSON, as the linked IR embeds them. +//! +//! `declarationText` writes a structure, class, instance, inductive, +//! definition, or theorem, each optional member left out exactly where the +//! oracle's serde attributes skip it; `moduleText` writes a module's +//! specification and declarations. Every ordinary declaration of every +//! committed semantic module that links is a run, every such module whose +//! declarations are all ordinary is a run, and so are hand-built and seeded +//! declarations. +//! +//! Each planted defect names the root and the one vector that catch it. + +use std::collections::{BTreeMap, BTreeSet}; +use std::sync::OnceLock; + +use lexlean::calculus::Value; +use lexlean::ir::semantic::{ + MemberRef, SemanticAssignment, SemanticConstructor, SemanticDeclaration, SemanticField, + SemanticModule, SemanticParameter, SemanticProduction, SemanticProof, SemanticTerm, + SemanticTermination, SemanticType, +}; +use serde_json::Value as Json2; + +use super::ir_document::linked_projects; +use super::rust_validate::{eligibility_of, rustc_differential}; +use super::semantic_terms::{assign_chain, enc_proof, enc_term, members}; +use super::semantic_types::{canonical, enc_type, type_chain}; +use super::{list, option, pair, text, texts, Run, Seeded}; +use crate::production_export as harness; +use crate::support::{self, repo_root}; + +const MODULE: &str = "LexLeanBoot.SemanticDecls"; +const SOURCE: &str = "bootstrap/src/SemanticDecls.lex.tex"; +const ROOTS: [(&str, &[&str]); 2] = [ + ( + "semanticDeclarationText", + &["allocation", "overflow", "recursion"], + ), + ( + "semanticModuleText", + &["allocation", "overflow", "recursion"], + ), +]; + +/// The most a part of a certificate of a root may be, as the row states. +const CERTIFICATE_BUDGET: u64 = 3_145_728; +/// Seeded declarations under the evaluator, and under rustc. +const EVALUATOR_SEEDED: usize = 100; +const RUSTC_SEEDED: usize = 500; +/// A committed module whose JSON is longer runs under rustc only. +const EVALUATOR_BYTES: usize = 262_144; + +// ---------------------------------------------------------------- the sorts + +fn constructors(sort: &str) -> &'static Vec { + static TABLES: OnceLock>> = OnceLock::new(); + let tables = TABLES.get_or_init(|| { + let source = std::fs::read_to_string(repo_root().join(SOURCE).as_std_path()) + .expect("the module's source"); + let mut out = BTreeMap::new(); + for block in source.split("inductive{").skip(1) { + let block = block.split("\n}\n").next().expect("a block"); + let name = block + .split("name: ") + .nth(1) + .and_then(|rest| rest.split(',').next()) + .expect("the inductive's name") + .trim() + .to_owned(); + // The constructors after `constructors:`, each named by its + // `name:` whether the formatter keeps it on one line or wraps it. + let names: Vec = block + .split("constructors:") + .nth(1) + .expect("the constructors") + .split("name: ") + .skip(1) + .map(|rest| { + rest.split([',', '\n']) + .next() + .expect("a constructor") + .trim() + .to_owned() + }) + .collect(); + out.insert(name, names); + } + out + }); + tables + .get(sort) + .unwrap_or_else(|| panic!("the module has no inductive `{sort}`")) +} + +fn adt(constructor: &str, fields: Vec) -> Value { + let found = constructors("SDecl") + .iter() + .position(|name| name == constructor) + .unwrap_or_else(|| panic!("`SDecl` has no constructor `{constructor}`")); + Value::Adt { + constructor: u64::try_from(found).expect("an index"), + fields, + } +} + +// ------------------------------------------------------------- the encoders + +fn nat(value: u64) -> Value { + Value::Nat { + value: value.to_string(), + } +} + +fn typed(name: &str, ty: &SemanticType) -> Value { + pair(text(name), enc_type(ty)) +} + +fn params(parameters: &[SemanticParameter]) -> Value { + list( + parameters + .iter() + .map(|parameter| typed(¶meter.name, ¶meter.r#type)) + .collect(), + ) +} + +fn fields(fields: &[SemanticField]) -> Value { + list( + fields + .iter() + .map(|field| typed(&field.name, &field.r#type)) + .collect(), + ) +} + +fn constructors_of(constructors: &[SemanticConstructor]) -> Value { + list( + constructors + .iter() + .map(|constructor| pair(text(&constructor.name), type_chain(&constructor.fields))) + .collect(), + ) +} + +fn text_option(value: Option<&String>) -> Value { + option(value.map(|value| text(value))) +} + +fn is_ordinary(declaration: &SemanticDeclaration) -> bool { + matches!( + declaration, + SemanticDeclaration::Structure { .. } + | SemanticDeclaration::Class { .. } + | SemanticDeclaration::Instance { .. } + | SemanticDeclaration::Inductive { .. } + | SemanticDeclaration::Definition { .. } + | SemanticDeclaration::Theorem { .. } + ) +} + +fn enc_declaration(declaration: &SemanticDeclaration) -> Value { + match declaration { + SemanticDeclaration::Structure { + name, + type_parameters, + parameters, + fields: declared, + } => adt( + "DStructure", + vec![ + text(name), + texts(type_parameters), + params(parameters), + fields(declared), + ], + ), + SemanticDeclaration::Class { + name, + type_parameters, + parameters, + fields: declared, + } => adt( + "DClass", + vec![ + text(name), + texts(type_parameters), + params(parameters), + fields(declared), + ], + ), + SemanticDeclaration::Instance { + name, + class, + arguments, + priority, + fields: assigned, + } => adt( + "DInstance", + vec![ + text(name), + option(class.module.as_deref().map(text)), + text(&class.name), + type_chain(arguments), + nat(*priority), + assign_chain(assigned), + ], + ), + SemanticDeclaration::Inductive { + name, + type_parameters, + parameters, + constructors, + mutual, + } => adt( + "DInductive", + vec![ + text(name), + texts(type_parameters), + params(parameters), + constructors_of(constructors), + text_option(mutual.as_ref()), + ], + ), + SemanticDeclaration::Definition { + name, + type_parameters, + parameters, + result, + recursive_argument, + body, + axioms, + executable, + mutual, + termination, + production, + } => adt( + "DDefinition", + vec![ + text(name), + texts(type_parameters), + params(parameters), + enc_type(result), + text_option(recursive_argument.as_ref()), + enc_term(body), + texts(axioms), + Value::Bool { value: *executable }, + text_option(mutual.as_ref()), + option(termination.as_ref().map(|evidence| { + pair(enc_term(&evidence.measure), members(&evidence.evidence)) + })), + option( + production + .as_ref() + .map(|declared| pair(texts(&declared.targets), texts(&declared.effects))), + ), + ], + ), + SemanticDeclaration::Theorem { + name, + type_parameters, + parameters, + statement, + proof, + axioms, + } => adt( + "DTheorem", + vec![ + text(name), + texts(type_parameters), + params(parameters), + enc_term(statement), + enc_proof(proof), + texts(axioms), + ], + ), + other => panic!("not an ordinary declaration: {other:?}"), + } +} + +#[derive(Clone)] +enum Input { + Declaration(Box), + Module(Box), +} + +impl Input { + const fn root(&self) -> usize { + match self { + Self::Declaration(_) => 0, + Self::Module(_) => 1, + } + } + + fn run(&self) -> Run { + match self { + Self::Declaration(declaration) => ( + vec![enc_declaration(declaration)], + serde_json::to_value(text(&canonical(&**declaration))).expect("a value is JSON"), + ), + Self::Module(module) => ( + vec![ + text(&module.spec), + list(module.declarations.iter().map(enc_declaration).collect()), + ], + serde_json::to_value(text(&canonical(&**module))).expect("a value is JSON"), + ), + } + } +} + +// ---------------------------------------------------------------- the corpus + +/// Every distinct ordinary declaration of every committed semantic module +/// that links, and every such module whose declarations are all ordinary, +/// with how many modules carry another kind. +fn committed() -> (Vec, usize) { + let mut declarations = BTreeMap::new(); + let mut modules = BTreeMap::new(); + let mut other = 0usize; + for project in linked_projects() { + for module in project.modules.values() { + let Some(semantic) = &module.semantic else { + continue; + }; + for declaration in semantic + .declarations + .iter() + .filter(|item| is_ordinary(item)) + { + declarations.insert( + canonical(declaration), + Input::Declaration(Box::new(declaration.clone())), + ); + } + if semantic.declarations.iter().all(is_ordinary) { + modules.insert( + canonical(semantic), + Input::Module(Box::new(semantic.clone())), + ); + } else { + other += 1; + } + } + } + let mut out: Vec = declarations.into_values().collect(); + out.extend(modules.into_values()); + (out, other) +} + +// ------------------------------------------------------------------ vectors + +fn parameter(name: &str, ty: SemanticType) -> SemanticParameter { + SemanticParameter { + name: name.to_owned(), + r#type: ty, + } +} + +fn var(name: &str) -> SemanticTerm { + SemanticTerm::Var { + name: name.to_owned(), + } +} + +fn reference(module: Option<&str>, name: &str) -> MemberRef { + MemberRef { + module: module.map(str::to_owned), + name: name.to_owned(), + } +} + +fn names(items: &[&str]) -> Vec { + items.iter().map(|item| (*item).to_owned()).collect() +} + +fn structure() -> SemanticDeclaration { + SemanticDeclaration::Structure { + name: "Point".to_owned(), + type_parameters: Vec::new(), + parameters: Vec::new(), + fields: vec![ + SemanticField { + name: "x".to_owned(), + r#type: SemanticType::Nat, + }, + SemanticField { + name: "y".to_owned(), + r#type: SemanticType::Nat, + }, + ], + } +} + +fn definition_plain() -> SemanticDeclaration { + SemanticDeclaration::Definition { + name: "zero".to_owned(), + type_parameters: Vec::new(), + parameters: Vec::new(), + result: SemanticType::Nat, + recursive_argument: None, + body: SemanticTerm::Nat { + value: "0".to_owned(), + }, + axioms: Vec::new(), + executable: false, + mutual: None, + termination: None, + production: None, + } +} + +struct Vector { + label: &'static str, + input: Input, +} + +#[allow(clippy::too_many_lines)] +fn named() -> Vec { + let mut out = Vec::new(); + let mut add = |label: &'static str, declaration: SemanticDeclaration| { + out.push(Vector { + label, + input: Input::Declaration(Box::new(declaration)), + }); + }; + add("a structure", structure()); + add( + "a class", + SemanticDeclaration::Class { + name: "Show".to_owned(), + type_parameters: names(&["a"]), + parameters: vec![parameter("bound", SemanticType::Nat)], + fields: vec![SemanticField { + name: "show".to_owned(), + r#type: SemanticType::Function { + parameters: vec![SemanticType::Parameter { + name: "a".to_owned(), + }], + result: Box::new(SemanticType::String), + }, + }], + }, + ); + add( + "an instance", + SemanticDeclaration::Instance { + name: "showNat".to_owned(), + class: reference(Some("Lib"), "Show"), + arguments: vec![SemanticType::Nat], + priority: 100, + fields: vec![SemanticAssignment { + field: "show".to_owned(), + value: var("format"), + }], + }, + ); + add( + "an inductive in a mutual group", + SemanticDeclaration::Inductive { + name: "Tree".to_owned(), + type_parameters: Vec::new(), + parameters: Vec::new(), + constructors: vec![ + SemanticConstructor { + name: "leaf".to_owned(), + fields: Vec::new(), + }, + SemanticConstructor { + name: "node".to_owned(), + fields: vec![SemanticType::Nat, SemanticType::Bool], + }, + ], + mutual: Some("trees".to_owned()), + }, + ); + add( + "a definition with everything", + SemanticDeclaration::Definition { + name: "walk".to_owned(), + type_parameters: names(&["a"]), + parameters: vec![parameter("n", SemanticType::Nat)], + result: SemanticType::Nat, + recursive_argument: Some("n".to_owned()), + body: var("n"), + axioms: names(&["propext"]), + executable: true, + mutual: Some("walks".to_owned()), + termination: Some(SemanticTermination { + measure: var("n"), + evidence: vec![reference(None, "walk_decreases")], + }), + production: Some(SemanticProduction { + targets: names(&["rust-std"]), + effects: names(&["allocation", "recursion"]), + }), + }, + ); + add("a definition with nothing optional", definition_plain()); + add( + "a theorem with everything", + SemanticDeclaration::Theorem { + name: "walk_zero".to_owned(), + type_parameters: names(&["a"]), + parameters: vec![parameter("n", SemanticType::Nat)], + statement: SemanticTerm::Bool { value: true }, + proof: SemanticProof::Decide, + axioms: names(&["propext", "Quot.sound"]), + }, + ); + add( + "a theorem with nothing optional", + SemanticDeclaration::Theorem { + name: "trivial".to_owned(), + type_parameters: Vec::new(), + parameters: Vec::new(), + statement: SemanticTerm::Bool { value: true }, + proof: SemanticProof::Reflexivity, + axioms: Vec::new(), + }, + ); + let module: SemanticModule = serde_json::from_value(serde_json::json!({ + "spec": "lexlean/semantic-module/2", + "declarations": [ + serde_json::to_value(structure()).expect("JSON"), + serde_json::to_value(definition_plain()).expect("JSON"), + ], + })) + .expect("a module"); + out.push(Vector { + label: "a module", + input: Input::Module(Box::new(module)), + }); + out +} + +// ------------------------------------------------------------------- seeded + +const NAMES: &[&str] = &["x", "acc", "\"q\"", "\u{e9}", ""]; + +fn drawn_name(seeded: &mut Seeded) -> String { + (*seeded.pick(NAMES)).to_owned() +} + +fn drawn_names(seeded: &mut Seeded) -> Vec { + (0..seeded.below(3)).map(|_| drawn_name(seeded)).collect() +} + +fn drawn_type(seeded: &mut Seeded) -> SemanticType { + seeded + .pick(&[SemanticType::Nat, SemanticType::Bool, SemanticType::Bytes]) + .clone() +} + +fn drawn_params(seeded: &mut Seeded) -> Vec { + (0..seeded.below(3)) + .map(|_| parameter(&drawn_name(seeded), drawn_type(seeded))) + .collect() +} + +fn drawn_option(seeded: &mut Seeded) -> Option { + seeded.chance(50).then(|| drawn_name(seeded)) +} + +fn drawn_declaration(seeded: &mut Seeded) -> SemanticDeclaration { + match seeded.below(6) { + 0 => SemanticDeclaration::Structure { + name: drawn_name(seeded), + type_parameters: drawn_names(seeded), + parameters: drawn_params(seeded), + fields: (0..seeded.below(3)) + .map(|_| SemanticField { + name: drawn_name(seeded), + r#type: drawn_type(seeded), + }) + .collect(), + }, + 1 => SemanticDeclaration::Class { + name: drawn_name(seeded), + type_parameters: drawn_names(seeded), + parameters: drawn_params(seeded), + fields: Vec::new(), + }, + 2 => SemanticDeclaration::Instance { + name: drawn_name(seeded), + class: reference(None, "C"), + arguments: (0..seeded.below(3)).map(|_| drawn_type(seeded)).collect(), + // The canonical JSON domain ends at `i64::MAX`. + priority: *seeded.pick(&[0, 1, 100, 9_223_372_036_854_775_807]), + fields: (0..seeded.below(3)) + .map(|_| SemanticAssignment { + field: drawn_name(seeded), + value: var(&drawn_name(seeded)), + }) + .collect(), + }, + 3 => SemanticDeclaration::Inductive { + name: drawn_name(seeded), + type_parameters: drawn_names(seeded), + parameters: drawn_params(seeded), + constructors: (0..seeded.below(3)) + .map(|_| SemanticConstructor { + name: drawn_name(seeded), + fields: (0..seeded.below(3)).map(|_| drawn_type(seeded)).collect(), + }) + .collect(), + mutual: drawn_option(seeded), + }, + 4 => SemanticDeclaration::Definition { + name: drawn_name(seeded), + type_parameters: drawn_names(seeded), + parameters: drawn_params(seeded), + result: drawn_type(seeded), + recursive_argument: drawn_option(seeded), + body: var(&drawn_name(seeded)), + axioms: drawn_names(seeded), + executable: seeded.chance(50), + mutual: drawn_option(seeded), + termination: seeded.chance(40).then(|| SemanticTermination { + measure: var("n"), + evidence: (0..seeded.below(3)) + .map(|_| reference(drawn_option(seeded).as_deref(), "e")) + .collect(), + }), + production: seeded.chance(40).then(|| SemanticProduction { + targets: drawn_names(seeded), + effects: drawn_names(seeded), + }), + }, + _ => SemanticDeclaration::Theorem { + name: drawn_name(seeded), + type_parameters: drawn_names(seeded), + parameters: drawn_params(seeded), + statement: var(&drawn_name(seeded)), + proof: SemanticProof::Decide, + axioms: drawn_names(seeded), + }, + } +} + +fn seeded_inputs(count: usize, seed: u64) -> Vec { + let mut seeded = Seeded(seed); + (0..count) + .map(|_| Input::Declaration(Box::new(drawn_declaration(&mut seeded)))) + .collect() +} + +// ------------------------------------------------------------------- plants + +struct Plant { + label: &'static str, + site: &'static str, + replacement: &'static str, + vector: &'static str, +} + +const PLANTS: &[Plant] = &[ + Plant { + label: "a structure is a struct", + site: "(kinded \"structure\"", + replacement: "(kinded \"struct\"", + vector: "a structure", + }, + Plant { + label: "a class is a structure", + site: "(kinded \"class\"", + replacement: "(kinded \"structure\"", + vector: "a class", + }, + Plant { + label: "a priority is negative", + site: "(ctor LexLeanStd.Json::Json.JInt false priority)", + replacement: "(ctor LexLeanStd.Json::Json.JInt true priority)", + vector: "an instance", + }, + Plant { + label: "an inductive loses its mutual group", + site: "(member \"constructors\" (constructorsJson constructors) (textWhenSome \"mutual\" grouped (jnil)))", + replacement: "(member \"constructors\" (constructorsJson constructors) (jnil))", + vector: "an inductive in a mutual group", + }, + Plant { + label: "a constructor's fields are its arguments", + site: "(member \"fields\" (ctor LexLeanStd.Json::Json.JArr (SemanticTypes::typeJson (second entry)))", + replacement: "(member \"arguments\" (ctor LexLeanStd.Json::Json.JArr (SemanticTypes::typeJson (second entry)))", + vector: "an inductive in a mutual group", + }, + Plant { + label: "empty type parameters of a definition are written", + site: " | List.nil => rest\n", + replacement: " | List.nil => (member key (SemanticTerms::namesJson names) rest)\n", + vector: "a definition with nothing optional", + }, + Plant { + label: "an executable definition is written as not executable", + site: "then (member \"executable\" (ctor LexLeanStd.Json::Json.JBool true)", + replacement: "then (member \"executable\" (ctor LexLeanStd.Json::Json.JBool false)", + vector: "a definition with everything", + }, + Plant { + label: "the recursive argument is the recursion", + site: "(textWhenSome \"recursive_argument\" recursiveArg", + replacement: "(textWhenSome \"recursion\" recursiveArg", + vector: "a definition with everything", + }, + Plant { + label: "a termination loses its evidence", + site: "(member \"evidence\" (SemanticTerms::membersJson (second evidenced))", + replacement: "(member \"evidence\" (SemanticTerms::membersJson (nil ((Option Bytes) * Bytes)))", + vector: "a definition with everything", + }, + Plant { + label: "a production's effects are its targets", + site: "(member \"effects\" (SemanticTerms::namesJson (second declared))", + replacement: "(member \"effects\" (SemanticTerms::namesJson (first declared))", + vector: "a definition with everything", + }, + Plant { + label: "a theorem loses its axioms", + site: "(namesWhenAny \"axioms\" axiomNames (jnil))", + replacement: "(jnil)", + vector: "a theorem with everything", + }, + Plant { + label: "a module names its specification otherwise", + site: "(member \"spec\" (jtext spec)", + replacement: "(member \"specification\" (jtext spec)", + vector: "a module", + }, + Plant { + label: "a module's declarations are written last first", + site: "(LexLeanStd.Order::reverseList [SDecl] declarations)", + replacement: "declarations", + vector: "a module", + }, +]; + +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)); + let root = ROOTS[vector.input.root()].0; + let planted = support::P::bootstrap(); + let source = planted.read_raw("src/SemanticDecls.lex.tex"); + assert_eq!( + source.matches(plant.site).count(), + 1, + "{}: the plant site occurs once", + plant.label + ); + planted.write( + "src/SemanticDecls.lex.tex", + &source.replacen(plant.site, plant.replacement, 1), + ); + let checked = support::checked_project(&planted); + let low = super::lower(&checked, &planted, MODULE, root); + match super::evaluate(&low, &[vector.input.run()], 1).first() { + Some(first) => eprintln!( + "BS-70: 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-70: {}: 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" + ); + } +} + +fn split(inputs: &[Input], evaluator: bool) -> [Vec; 2] { + let mut out = [Vec::new(), Vec::new()]; + for input in inputs { + if evaluator { + if let Input::Module(module) = input { + if canonical(&**module).len() > EVALUATOR_BYTES { + continue; + } + } + } + out[input.root()].push(input.run()); + } + out +} + +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("SemanticDecls"), + "SemanticDecls is a linked module of the project" + ); + eligibility_of(&project, "SemanticDecls", 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 (corpus, other) = committed(); + let [declarations, modules] = split(&corpus, false).map(|runs| runs.len()); + assert!( + declarations >= 200 && modules >= 30, + "the committed semantic modules carry {declarations} distinct ordinary declarations and {modules} modules of only ordinary declarations" + ); + let normative = support::normative_host(); + let (evaluator_seeded, rustc_seeded) = if normative { + ( + seeded_inputs(EVALUATOR_SEEDED, 0x0B55_0070), + seeded_inputs(RUSTC_SEEDED, 0x0B55_1070), + ) + } else { + (Vec::new(), Vec::new()) + }; + eprintln!( + "BS-70: {} vectors, {declarations} committed ordinary declarations, {modules} committed modules of only ordinary declarations ({other} others), {} and {} seeded declarations ({:?})", + vectors.len(), + EVALUATOR_SEEDED, + RUSTC_SEEDED, + 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(); + let named_inputs: Vec = vectors.iter().map(|vector| vector.input.clone()).collect(); + if normative { + let mut inputs = named_inputs.clone(); + inputs.extend(corpus.iter().cloned()); + inputs.extend(evaluator_seeded); + for (index, runs) in split(&inputs, true).iter().enumerate() { + let root = ROOTS[index].0; + let disagreements = super::evaluate(&lowered[root], runs, 5); + assert!( + disagreements.is_empty(), + "{root} and the Rust oracle disagree: {disagreements:?}" + ); + eprintln!( + "BS-70: {root}: the evaluator agrees on {} runs ({:?})", + runs.len(), + started.elapsed() + ); + } + plants(&vectors); + } else { + eprintln!("BS-70: platform-bound host: the evaluator, the seeded runs, and the planted defects run on the normative host"); + } + + let mut compiled = named_inputs; + compiled.extend(corpus); + compiled.extend(rustc_seeded); + let runs = split(&compiled, false); + let differential: Vec<(&str, &super::Lowered, &[Run])> = ROOTS + .iter() + .enumerate() + .map(|(index, (root, _))| (*root, &lowered[root], runs[index].as_slice())) + .collect(); + let total = rustc_differential("BS-70", &differential, "oracle"); + eprintln!("BS-70: {total} rustc runs agree ({:?})", started.elapsed()); + + if !support::lean_backed("BS-70") { + return; + } + export(&lowered); + eprintln!("BS-70: passed in {:?}", started.elapsed()); +} diff --git a/crates/conformance/src/cases/bootstrap/semantic_terms.rs b/crates/conformance/src/cases/bootstrap/semantic_terms.rs index ede4793fa5..a0a155b33b 100755 --- a/crates/conformance/src/cases/bootstrap/semantic_terms.rs +++ b/crates/conformance/src/cases/bootstrap/semantic_terms.rs @@ -116,7 +116,7 @@ fn member_fields(member: &MemberRef) -> [Value; 2] { ] } -fn members(refs: &[MemberRef]) -> Value { +pub(super) fn members(refs: &[MemberRef]) -> Value { list( refs.iter() .map(|member| { @@ -149,7 +149,7 @@ fn term_chain(items: &[SemanticTerm]) -> Value { }) } -fn assign_chain(items: &[SemanticAssignment]) -> Value { +pub(super) fn assign_chain(items: &[SemanticAssignment]) -> Value { chain(items, |item, rest| { term( "KAssign", @@ -197,7 +197,7 @@ fn param_fields(parameter: &SemanticParameter) -> [Value; 2] { } #[allow(clippy::too_many_lines)] -fn enc_term(value: &SemanticTerm) -> Value { +pub(super) fn enc_term(value: &SemanticTerm) -> Value { let binary = |name: &str, left: &SemanticTerm, right: &SemanticTerm| { term(name, vec![enc_term(left), enc_term(right)]) }; @@ -509,7 +509,7 @@ fn enc_reflection(reflection: &SemanticReflection) -> Value { } } -fn enc_proof(value: &SemanticProof) -> Value { +pub(super) fn enc_proof(value: &SemanticProof) -> Value { match value { SemanticProof::Reflexivity => proof("PReflexivity", Vec::new()), SemanticProof::Decide => proof("PDecide", Vec::new()), diff --git a/crates/conformance/src/cases/repository.rs b/crates/conformance/src/cases/repository.rs index 6d3c49dc59..584f74624a 100644 --- a/crates/conformance/src/cases/repository.rs +++ b/crates/conformance/src/cases/repository.rs @@ -1091,7 +1091,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(), 501, "§31 has 501 rows"); + assert_eq!(table.len(), 502, "§31 has 502 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 dc632aa7df..7fc3ba738e 100644 --- a/crates/conformance/tests/conformance.rs +++ b/crates/conformance/tests/conformance.rs @@ -2435,6 +2435,11 @@ fn conformance_bs_69() { repo_conformance::cases::run("BS-69"); } +#[test] +fn conformance_bs_70() { + repo_conformance::cases::run("BS-70"); +} + #[test] fn conformance_pk_01() { repo_conformance::cases::run("PK-01"); diff --git a/features/suites/bootstrap.feature b/features/suites/bootstrap.feature index e0c9763da7..51f30dd06a 100644 --- a/features/suites/bootstrap.feature +++ b/features/suites/bootstrap.feature @@ -238,3 +238,9 @@ Feature: bootstrap When the project is checked and built, and the lowered program and the rendered package of each root are run on those inputs Then each root is eligible for rust-std with exactly its declared effects, no certificate part is beyond 3,145,728 bytes, and the two roots equal the canonical JSON of the serde form of `SemanticTerm` and `SemanticProof` 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 + @BS-70 @build + Scenario: The ordinary declarations of the semantic module language of SPEC.md §17.11 and §17.12 and the module that holds them (`ir::semantic::SemanticDeclaration` for structures, classes, instances, inductives, definitions, and theorems, and `SemanticModule`, in the serde form the linked IR embeds, written as canonical JSON: each declaration tagged by its `kind`, its parameters, fields, constructors, and assignments in order, and a definition's or a theorem's type parameters, recursive argument, axioms, executable flag, mutual group, termination, and production, and an inductive's mutual group, left out exactly where the oracle's serde attributes skip them; and a module's specification and declarations in order) is language-1.2 source in the `bootstrap/` project, as two production roots of `SemanticDecls` over `SemanticTerms` and `SemanticTypes`: `semanticDeclarationText` and `semanticModuleText`, each eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `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 on the shorter modules, agree with the oracle to the byte on hand-built declarations, which reach every kind and every optional member both present and absent, on every distinct ordinary declaration of every committed semantic module that links and on every such module whose declarations are all ordinary, among them every module of the `bootstrap/` project and the standard library, and on seeded declarations; each planted defect in the source is detected by the root and the one vector it names, and the certified packages the production export publishes for the project are the committed ones; the declarations of models, reasoning, and text components, and reading declarations from JSON, are outside the claim. + Given the committed `bootstrap` project, hand-built declarations and a module, every ordinary declaration of the committed semantic modules that link, every such module of only ordinary declarations, and seeded declarations + When the project is checked and built, and the lowered program and the rendered package of each root are run on those inputs + Then each root is eligible for rust-std with exactly its declared effects, no certificate part is beyond 3,145,728 bytes, and the two roots equal the canonical JSON of the serde form of `SemanticDeclaration` and `SemanticModule` 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 5f9f6ce395..481d9d631d 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -2924,6 +2924,12 @@ level = "build" suite = "bootstrap" statement = "The closed terms and proofs of the semantic module language of SPEC.md §17.11 and §17.12 (`ir::semantic::SemanticTerm` and `SemanticProof` in the serde form the linked IR embeds, written as canonical JSON: each term and proof tagged by its `kind`, its member references, assignments, branches, binders, map entries, graph edges, model checks, and reflections in their fields, a list of type arguments, definitions, generalized names, or premises left out when it is empty where the oracle skips it, and its types through `SemanticTypes`) is language-1.2 source in the `bootstrap/` project, as two production roots of `SemanticTerms`: `semanticTermText` and `semanticProofText`, each eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `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 terms and proofs, which reach every constructor and every optional list both empty and not, on every distinct term and proof of every committed semantic module that links, and on seeded terms and proofs; each planted defect in the source is detected by the root and the one vector it names, and the certified packages the production export publishes for the project are the committed ones; reading terms and proofs from JSON is outside the claim." +[[id]] +id = "BS-70" +level = "build" +suite = "bootstrap" +statement = "The ordinary declarations of the semantic module language of SPEC.md §17.11 and §17.12 and the module that holds them (`ir::semantic::SemanticDeclaration` for structures, classes, instances, inductives, definitions, and theorems, and `SemanticModule`, in the serde form the linked IR embeds, written as canonical JSON: each declaration tagged by its `kind`, its parameters, fields, constructors, and assignments in order, and a definition's or a theorem's type parameters, recursive argument, axioms, executable flag, mutual group, termination, and production, and an inductive's mutual group, left out exactly where the oracle's serde attributes skip them; and a module's specification and declarations in order) is language-1.2 source in the `bootstrap/` project, as two production roots of `SemanticDecls` over `SemanticTerms` and `SemanticTypes`: `semanticDeclarationText` and `semanticModuleText`, each eligible for `rust-std` with exactly its declared effects, `allocation`, `overflow`, and `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 on the shorter modules, agree with the oracle to the byte on hand-built declarations, which reach every kind and every optional member both present and absent, on every distinct ordinary declaration of every committed semantic module that links and on every such module whose declarations are all ordinary, among them every module of the `bootstrap/` project and the standard library, and on seeded declarations; each planted defect in the source is detected by the root and the one vector it names, and the certified packages the production export publishes for the project are the committed ones; the declarations of models, reasoning, and text components, and reading declarations from JSON, are 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 dc00e483fe..f67b601076 100644 --- a/tests/production-export/bootstrap/roots.json +++ b/tests/production-export/bootstrap/roots.json @@ -631,6 +631,22 @@ "rust-std" ], "version": "1.0.0" + }, + { + "name": "semantic_declaration_text", + "root": "LexLeanBoot.SemanticDecls.semanticDeclarationText", + "targets": [ + "rust-std" + ], + "version": "1.0.0" + }, + { + "name": "semantic_module_text", + "root": "LexLeanBoot.SemanticDecls.semanticModuleText", + "targets": [ + "rust-std" + ], + "version": "1.0.0" } ] } diff --git a/xtask/src/spec_links.rs b/xtask/src/spec_links.rs index fb3364c264..ebb4eaa4af 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() != 501 { - return Err(format!("RP-07: the §31 table has {} rows, not 501", rows.len()).into()); + if rows.len() != 502 { + return Err(format!("RP-07: the §31 table has {} rows, not 502", 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.