From 904c1afc0cfae114a1fdae2c002906ca5dae9d13 Mon Sep 17 00:00:00 2001 From: Alex Flom Date: Thu, 22 Oct 2026 12:21:05 -0600 Subject: [PATCH 01/10] register SM-37: induction over a nested inductive type, nested_induction (#278, R3: row, scenario, named test, first negative fixture) R3: the register row, the SPEC.md section 31 row, the scenario, the failing named test conformance_sm_37, and the negative fixture induction-nested-type, which records that `induction` on a type that holds a list of itself is refused as LLT4001 with a message that names `nested_induction`. No implementation: the fixture fails until the message changes. The count moves 446 to 447. Stacked on the DF-19 branch. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk --- CONFORMANCE.md | 1 + README.md | 2 +- SPEC.md | 3 +- crates/conformance/src/cases/examples.rs | 5 +- crates/conformance/src/cases/repository.rs | 2 +- crates/conformance/tests/conformance.rs | 5 ++ features/suites/semantic-ir.feature | 7 ++ model/ids.toml | 6 ++ .../negative/induction-nested-type/case.toml | 5 ++ .../expected/artifacts.json | 1 + .../expected/command.json | 1 + .../expected/diagnostics.json | 1 + .../expected/hashes.toml | 8 ++ .../project/lake-manifest.json | 6 ++ .../project/lakefile.toml | 2 + .../project/lean-toolchain | 1 + .../project/lexlean.lock | 47 +++++++++++ .../project/lexlean.toml | 27 +++++++ .../project/src/Main.lex.tex | 77 +++++++++++++++++++ xtask/src/spec_links.rs | 4 +- 20 files changed, 205 insertions(+), 6 deletions(-) create mode 100644 tests/negative/induction-nested-type/case.toml create mode 100644 tests/negative/induction-nested-type/expected/artifacts.json create mode 100644 tests/negative/induction-nested-type/expected/command.json create mode 100644 tests/negative/induction-nested-type/expected/diagnostics.json create mode 100644 tests/negative/induction-nested-type/expected/hashes.toml create mode 100644 tests/negative/induction-nested-type/project/lake-manifest.json create mode 100644 tests/negative/induction-nested-type/project/lakefile.toml create mode 100644 tests/negative/induction-nested-type/project/lean-toolchain create mode 100644 tests/negative/induction-nested-type/project/lexlean.lock create mode 100644 tests/negative/induction-nested-type/project/lexlean.toml create mode 100644 tests/negative/induction-nested-type/project/src/Main.lex.tex diff --git a/CONFORMANCE.md b/CONFORMANCE.md index c368ff3ac1..6c2e398975 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -576,6 +576,7 @@ the error registry does not sanction (R5, `ERRORS.md`). | `SM-34` | `build` | A version 2 core-module row may be derived, stating its name, kind, and extension state, and for a sparse casesOn its recipe, and no universe parameters, type, or value: the decoder makes the constant with the pinned Lean's own construction at the row's place in the order, and refuses the module when the name is not one the pinned Lean reserves and the row states no sparse casesOn recipe, when the construction does not make the name, or when the constant it makes is not a theorem, definition, or abbreviation as the row says; the notation writes a derived row without a type, the schema and the linker refuse a derived row that states what the construction decides, a stored row is still checked against the construction, the decoder checks that the constructors a recipe names are constructors of the type and are named once, that the module states every sparse casesOn its construction makes, and that every derived sparse casesOn is referred to by the type or value of a row, and the content of a derived row is checked by its uses alone, so that a recipe naming other valid constructors of the type is not distinguished where the use accepts it; and the shipped preservation library states every row that carries a sparse casesOn record or is named like an equation, an unfolding equation, a splitter, or an else equation as a derived row. | | `SM-35` | `build` | A language-1.2 theorem may be proved by `term_cases`, a split on the value of a document term: the proof names a term and a nonempty, strictly sorted, duplicate-free list of prior document definitions, the term's type is an inductive type of the document, and the backend lowers the proof to a split of the goal on every constructor of that type with the hypothesis that equates the term to the constructor, then `simp only` over the named definitions, that hypothesis, and the reduction of a conditional on a decided condition, with closed propositions decided, which uses exactly the axioms the theorem's policy states; the schema, the linker, the notation, the Lean backend, the canonical LaTeX, and the formatter accept it, and a use in language 1.1, a term whose type is not an inductive type of the document, an empty list, an unsorted or repeated name, a name that is not a prior definition, and a theorem parameter that takes the hypothesis's name are each refused. | | `SM-36` | `build` | A language-1.2 `cases` proof may split a local of type `Bool` into its two constructors: the proof names the local and gives a branch for `false` and one for `true`, each with no binders, the backend lowers it to `cases` on the local with those two alternatives, the theorem verifies with exactly the axioms its policy states, and the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it; a use in language 1.1, a missing branch, a repeated branch, a branch with a binder, and an `induction` on a Boolean are each refused. | +| `SM-37` | `build` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | ## stdlib diff --git a/README.md b/README.md index 203c554f81..f289455440 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,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 446 registered conformance IDs are implemented and pass; `just vv` runs clean from a checkout with the pinned toolchain installed. +All 447 registered conformance IDs are implemented and pass; `just vv` runs clean from a checkout 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. diff --git a/SPEC.md b/SPEC.md index d598a2da30..7213bbbc6d 100644 --- a/SPEC.md +++ b/SPEC.md @@ -10334,6 +10334,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `SM-34` | `semantic-ir` | A version 2 core-module row may be derived, stating its name, kind, and extension state, and for a sparse casesOn its recipe, and no universe parameters, type, or value: the decoder makes the constant with the pinned Lean's own construction at the row's place in the order, and refuses the module when the name is not one the pinned Lean reserves and the row states no sparse casesOn recipe, when the construction does not make the name, or when the constant it makes is not a theorem, definition, or abbreviation as the row says; the notation writes a derived row without a type, the schema and the linker refuse a derived row that states what the construction decides, a stored row is still checked against the construction, the decoder checks that the constructors a recipe names are constructors of the type and are named once, that the module states every sparse casesOn its construction makes, and that every derived sparse casesOn is referred to by the type or value of a row, and the content of a derived row is checked by its uses alone, so that a recipe naming other valid constructors of the type is not distinguished where the use accepts it; and the shipped preservation library states every row that carries a sparse casesOn record or is named like an equation, an unfolding equation, a splitter, or an else equation as a derived row. | §17.10 | | `SM-35` | `semantic-ir` | A language-1.2 theorem may be proved by `term_cases`, a split on the value of a document term: the proof names a term and a nonempty, strictly sorted, duplicate-free list of prior document definitions, the term's type is an inductive type of the document, and the backend lowers the proof to a split of the goal on every constructor of that type with the hypothesis that equates the term to the constructor, then `simp only` over the named definitions, that hypothesis, and the reduction of a conditional on a decided condition, with closed propositions decided, which uses exactly the axioms the theorem's policy states; the schema, the linker, the notation, the Lean backend, the canonical LaTeX, and the formatter accept it, and a use in language 1.1, a term whose type is not an inductive type of the document, an empty list, an unsorted or repeated name, a name that is not a prior definition, and a theorem parameter that takes the hypothesis's name are each refused. | §17.10 | | `SM-36` | `semantic-ir` | A language-1.2 `cases` proof may split a local of type `Bool` into its two constructors: the proof names the local and gives a branch for `false` and one for `true`, each with no binders, the backend lowers it to `cases` on the local with those two alternatives, the theorem verifies with exactly the axioms its policy states, and the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it; a use in language 1.1, a missing branch, a repeated branch, a branch with a binder, and an `induction` on a Boolean are each refused. | §17.10 | +| `SM-37` | `semantic-ir` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | §16.9, §17.10, §17.12 | | `DF-01` | `declarations` | A valid type-definition sentence emits one nonrecursive sort-valued Lean def linked to its document entry. | §15.7, §18.6 | | `DF-02` | `declarations` | A valid term-definition sentence emits one nonrecursive explicitly typed Lean def. | §15.7, §18.6 | | `DF-03` | `declarations` | A valid predicate-definition sentence emits one nonrecursive Prop-valued Lean def. | §15.7, §18.6 | @@ -10664,7 +10665,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:** 446. +**Total required capability IDs:** 447. 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/crates/conformance/src/cases/examples.rs b/crates/conformance/src/cases/examples.rs index 55896ebecc..d40efe43d2 100644 --- a/crates/conformance/src/cases/examples.rs +++ b/crates/conformance/src/cases/examples.rs @@ -171,7 +171,7 @@ pub(crate) fn run(id: &str) { // exactly the one prescribed diagnostic code. "EX-07" => { let root = support::repo_root(); - let prescribed: [(&str, &str); 297] = [ + let prescribed: [(&str, &str); 298] = [ ("unknown-word", "LLL1004"), ("unknown-symbol", "LLL1004"), ("unknown-control", "LLL1004"), @@ -296,6 +296,9 @@ pub(crate) fn run(id: &str) { ("cases-bool-branch-repeated", "LLT4001"), ("cases-bool-branch-binder", "LLT4001"), ("cases-bool-induction", "LLT4001"), + // SM-37: `induction` still refuses a type that holds a list of itself, + // and its message names the form for it, `nested_induction`. + ("induction-nested-type", "LLT4001"), ("mutual-label-shared", "LLT4001"), ("recursion-member-under-lambda", "LLT4001"), ("recursion-well-founded-reference", "LLT4001"), diff --git a/crates/conformance/src/cases/repository.rs b/crates/conformance/src/cases/repository.rs index 6c31fe69ff..b6f7f4993e 100644 --- a/crates/conformance/src/cases/repository.rs +++ b/crates/conformance/src/cases/repository.rs @@ -760,7 +760,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(), 446, "§31 has 446 rows"); + assert_eq!(table.len(), 447, "§31 has 447 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 d898f76d70..81bf88ff62 100644 --- a/crates/conformance/tests/conformance.rs +++ b/crates/conformance/tests/conformance.rs @@ -590,6 +590,11 @@ fn conformance_sm_36() { repo_conformance::cases::run("SM-36"); } +#[test] +fn conformance_sm_37() { + repo_conformance::cases::run("SM-37"); +} + #[test] fn conformance_sm_32() { repo_conformance::cases::run("SM-32"); diff --git a/features/suites/semantic-ir.feature b/features/suites/semantic-ir.feature index c18373d035..0a4c8c3332 100644 --- a/features/suites/semantic-ir.feature +++ b/features/suites/semantic-ir.feature @@ -257,3 +257,10 @@ Feature: semantic-ir When the project is linked, built, and verified by the pinned Lean, its formatted source and its LaTeX are read back, and each planted project is linked Then the theorem verifies with exactly the axioms its policy states and the formatter writes the proof unchanged And each planted project is refused naming the misuse + + @SM-37 @build + Scenario: A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. + Given a language-1.2 project whose type holds a `List` of itself and a `List` of pairs that end in itself, whose mutual definition groups range over its recursive family, and whose theorem over every value of the type is proved by `nested_induction`, and the planted projects that misuse the form + When the project is linked, built, and verified by the pinned Lean, its formatted source and its LaTeX are read back, and each planted project is linked + Then the generated Lean induces over the recursor the pinned Lean generates for the type, with the goals in the order of its minor premises, and the theorem verifies with exactly the axioms its policy states and the formatter writes the proof unchanged + And each planted project is refused as LLT4001 naming the misuse, and no backend output is written diff --git a/model/ids.toml b/model/ids.toml index 3d4c210961..1759e21190 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -715,6 +715,12 @@ level = "build" suite = "semantic-ir" statement = "A language-1.2 `cases` proof may split a local of type `Bool` into its two constructors: the proof names the local and gives a branch for `false` and one for `true`, each with no binders, the backend lowers it to `cases` on the local with those two alternatives, the theorem verifies with exactly the axioms its policy states, and the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it; a use in language 1.1, a missing branch, a repeated branch, a branch with a binder, and an `induction` on a Boolean are each refused." +[[id]] +id = "SM-37" +level = "build" +suite = "semantic-ir" +statement = "A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001." + [[id]] id = "DF-01" level = "build" diff --git a/tests/negative/induction-nested-type/case.toml b/tests/negative/induction-nested-type/case.toml new file mode 100644 index 0000000000..155efc4c9e --- /dev/null +++ b/tests/negative/induction-nested-type/case.toml @@ -0,0 +1,5 @@ +spec = "lexlean/test-case/1" +command = "check" +args = [] +expected_exit = 1 +expect_artifacts = false diff --git a/tests/negative/induction-nested-type/expected/artifacts.json b/tests/negative/induction-nested-type/expected/artifacts.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/tests/negative/induction-nested-type/expected/artifacts.json @@ -0,0 +1 @@ +[] diff --git a/tests/negative/induction-nested-type/expected/command.json b/tests/negative/induction-nested-type/expected/command.json new file mode 100644 index 0000000000..0602cfe436 --- /dev/null +++ b/tests/negative/induction-nested-type/expected/command.json @@ -0,0 +1 @@ +{"artifacts":[],"command":"check","diagnostics":[{"causes":[],"code":"LLT4001","help":[],"labels":[],"message":"phase link: induction on `value` requires a self-recursive inductive without nested or mutual occurrences; its type holds itself under a container, so use nested_induction (or cases)","notes":[],"primary":{"byte_end":1801,"byte_start":113,"column_end":1,"column_start":1,"line_end":76,"line_start":5,"path":"src/Main.lex.tex"},"severity":"error","spec":"lexlean/diagnostic/1"}],"exit_code":1,"modules":[],"spec":"lexlean/command-result/1","success":false} diff --git a/tests/negative/induction-nested-type/expected/diagnostics.json b/tests/negative/induction-nested-type/expected/diagnostics.json new file mode 100644 index 0000000000..f6b9c3e206 --- /dev/null +++ b/tests/negative/induction-nested-type/expected/diagnostics.json @@ -0,0 +1 @@ +[{"causes":[],"code":"LLT4001","help":[],"labels":[],"message":"phase link: induction on `value` requires a self-recursive inductive without nested or mutual occurrences; its type holds itself under a container, so use nested_induction (or cases)","notes":[],"primary":{"byte_end":1801,"byte_start":113,"column_end":1,"column_start":1,"line_end":76,"line_start":5,"path":"src/Main.lex.tex"},"severity":"error","spec":"lexlean/diagnostic/1"}] diff --git a/tests/negative/induction-nested-type/expected/hashes.toml b/tests/negative/induction-nested-type/expected/hashes.toml new file mode 100644 index 0000000000..a8f66a2c18 --- /dev/null +++ b/tests/negative/induction-nested-type/expected/hashes.toml @@ -0,0 +1,8 @@ +# Platform-independent artifact hashes (compared exactly) and the +# process-bound files whose bytes vary per host, toolchain build, and +# compiler executable (presence only). SPEC.md §28.2, §28.4. + +[platform_independent] + +[process_bound] +files = [] diff --git a/tests/negative/induction-nested-type/project/lake-manifest.json b/tests/negative/induction-nested-type/project/lake-manifest.json new file mode 100644 index 0000000000..0f4752de0d --- /dev/null +++ b/tests/negative/induction-nested-type/project/lake-manifest.json @@ -0,0 +1,6 @@ +{"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": [], + "name": "language_twelve_host", + "lakeDir": ".lake", + "fixedToolchain": false} diff --git a/tests/negative/induction-nested-type/project/lakefile.toml b/tests/negative/induction-nested-type/project/lakefile.toml new file mode 100644 index 0000000000..e696023284 --- /dev/null +++ b/tests/negative/induction-nested-type/project/lakefile.toml @@ -0,0 +1,2 @@ +name = "language_twelve_host" +version = "0.1.0" diff --git a/tests/negative/induction-nested-type/project/lean-toolchain b/tests/negative/induction-nested-type/project/lean-toolchain new file mode 100644 index 0000000000..2b61957be5 --- /dev/null +++ b/tests/negative/induction-nested-type/project/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.32.1 diff --git a/tests/negative/induction-nested-type/project/lexlean.lock b/tests/negative/induction-nested-type/project/lexlean.lock new file mode 100644 index 0000000000..f1aa14adec --- /dev/null +++ b/tests/negative/induction-nested-type/project/lexlean.lock @@ -0,0 +1,47 @@ +spec = "lexlean/lock/2" +language = "1.2" +compiler_semantics = "30c5829bdd3f072456985b81111b40c8d20bfeaaa66c908df679c034ec32e032" +project_config_sha256 = "6bb823538ff0c18b80a9851c1cc936cf70dc31ce0625cb1a2211c1f30d91411d" +lean_toolchain = "leanprover/lean4:v4.32.1" + +[[workspace_file]] +path = "lake-manifest.json" +sha256 = "085d92d07d61ab5d911a028611320c7f621b9a04e05ebf43ee2c01ce8762fad1" + +[[workspace_file]] +path = "lakefile.toml" +sha256 = "897f6c447c62589e544a276b49aea37b44f3bcc7b3a9604eedcfe726bcbcbee5" + +[[workspace_file]] +path = "lean-toolchain" +sha256 = "8e3538e0ab5f81a3ee04927d8838c8c674e0e112838b4b3ce87ec218143276af" + +[[package]] +id = "lexlean.core" +version = "1.2.0" +kind = "builtin" +source = "embedded" +revision = "compiler-semantics" +tree_sha256 = "827317cae68c162f3a96c8a8de4e53ab348e7d3724fd2b834fa85ecde1a1b392" +manifest_sha256 = "271079763d269cc873531f515e56da960cd6321393b9460ff0e617666fa01d71" +imports = [] + +[[package]] +id = "lexlean.std.bool" +version = "1.2.0" +kind = "builtin" +source = "embedded" +revision = "compiler-semantics" +tree_sha256 = "3bc0fb09d706ffa7d5a1363302ea87c049acc7c7dcafde63c62682620c11be9b" +manifest_sha256 = "de58de2cf18a7a5a62d8c20649139d6dfe1f7b16b3130c75f150fbac5440a71e" +imports = ["lexlean.core@1.2.0"] + +[[package]] +id = "lexlean.std.nat" +version = "1.2.0" +kind = "builtin" +source = "embedded" +revision = "compiler-semantics" +tree_sha256 = "e0db021e01b91d651c43921d66f6b0023c8efbf17cac2ec53192ce5305e4e1ac" +manifest_sha256 = "6fb446b39e3c1c18a5f10cfa1f7aa2bd431837719eb0eb7489aadf452c9420a7" +imports = ["lexlean.core@1.2.0", "lexlean.std.bool@1.2.0"] diff --git a/tests/negative/induction-nested-type/project/lexlean.toml b/tests/negative/induction-nested-type/project/lexlean.toml new file mode 100644 index 0000000000..fafd078696 --- /dev/null +++ b/tests/negative/induction-nested-type/project/lexlean.toml @@ -0,0 +1,27 @@ +spec = "lexlean/project/1" +name = "language-twelve" +language = "1.2" +module_prefix = "LanguageTwelve" +source_roots = ["src"] +entrypoints = ["src/Main.lex.tex"] +build_root = ".lexlean" +lockfile = "lexlean.lock" +lean_workspace = "." +lean_toolchain = "leanprover/lean4:v4.32.1" + +[[lexicon_source]] +package = "lexlean.std.nat" +kind = "builtin" + +[limits] +max_file_bytes = 4194304 +max_total_source_bytes = 67108864 +max_primitive_atoms = 2000000 +max_token_lattice_edges = 4000000 +max_parse_states = 4000000 +max_ir_nodes = 2000000 +max_scope_depth = 1024 +max_import_depth = 128 +max_diagnostics = 256 +max_child_output_bytes = 16777216 +child_timeout_ms = 300000 diff --git a/tests/negative/induction-nested-type/project/src/Main.lex.tex b/tests/negative/induction-nested-type/project/src/Main.lex.tex new file mode 100644 index 0000000000..54a989d161 --- /dev/null +++ b/tests/negative/induction-nested-type/project/src/Main.lex.tex @@ -0,0 +1,77 @@ +\begin{lexlean}{Main} +\useglossary{lexlean.std.nat@1.2.0} +\title{Natural number addition} +\begin{semanticmodule} +inductive{ + name: Json, + type_parameters: [], + parameters: [], + constructors: [ + {name: null, fields: []}, + {name: text, fields: [String]}, + {name: array, fields: [(List Json)]} + ] +} + +definition{ + name: size, + parameters: [value : Json], + result: Nat, + body: (match value + | Json.null => 1 + | Json.text content => 1 + | Json.array items => (1 + (sizeList items))), + mutual: Size, + recursive_argument: value +} + +definition{ + name: sizeList, + parameters: [items : (List Json)], + result: Nat, + body: (match items | List.nil => 0 | List.cons head tail => ((size head) + (sizeList tail))), + mutual: Size, + recursive_argument: items +} + +definition{ + name: leaves, + parameters: [value : Json], + result: Nat, + body: (match value + | Json.null => 1 + | Json.text content => 1 + | Json.array items => (leavesList items)), + mutual: Leaves, + recursive_argument: value +} + +definition{ + name: leavesList, + parameters: [items : (List Json)], + result: Nat, + body: (match items | List.nil => 0 | List.cons head tail => ((leaves head) + (leavesList tail))), + mutual: Leaves, + recursive_argument: items +} + +theorem{ + name: leaves_le_size, + parameters: [value : Json], + statement: ((leaves value) <= (size value)), + proof: induction{ + branches: [ + {proof: linear_arithmetic{definitions: [leaves, size]}, binders: [], constructor: null}, + { + proof: linear_arithmetic{definitions: [leaves, size]}, + binders: [content], + constructor: text + }, + {proof: linear_arithmetic{definitions: [leaves, size]}, binders: [items, itemsHyp], constructor: array} + ], + scrutinee: value + }, + axioms: [Quot.sound, propext] +} +\end{semanticmodule} +\end{lexlean} diff --git a/xtask/src/spec_links.rs b/xtask/src/spec_links.rs index 2bcb1a9062..db6fa5b8b1 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() != 446 { - return Err(format!("RP-07: the §31 table has {} rows, not 446", rows.len()).into()); + if rows.len() != 447 { + return Err(format!("RP-07: the §31 table has {} rows, not 447", 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. From 1ee15eff6dfaf40ba600efb4d2d2176935af4951 Mon Sep 17 00:00:00 2001 From: Alex Flom Date: Thu, 22 Oct 2026 17:48:11 -0600 Subject: [PATCH 02/10] feat(proof): nested_induction, induction over a nested inductive type through its recursor (SM-37, #278) A language-1.2 theorem about a value of a nested inductive type (one that holds itself under List, Option, Result or a product, in no mutual group) may be proved by nested_induction: the proof names a parameter of the theorem, states one proposition for each auxiliary member of the type's recursive family (the family DF-19 computes) and gives a branch for every constructor of the type and of each member. The linker checks the members, the branch sets and the binder counts level by level before any backend; the backend lowers the step to `induction x using T.rec (motive_n := fun b => P)` and one positional `next binders =>` per minor premise, in the recursor's order whatever order the branches are written in. `induction` keeps refusing a nested type, and its message now names nested_induction. The theorem's scrutinee must be a theorem parameter so the backend knows its type to name T.rec; Environment.proof_parameters carries them. Both schemas gain the step. language/semantics-1.2.toml: semantic_ir 15 -> 16, proof_lowering 3 -> 4, which moves the 21.2 identity; the locks, records, goldens, fixtures and packages the digest binds are not regenerated here. examples/nested-induction proves leaves_le_size over Json by nested_induction, verified under Lean 4.32.1 with exactly the axioms propext and Quot.sound, which the SM-37 row now records. conformance_sm_37 refuses 49 plants as LLT4001 (reordered members, wrong binder counts and a missing branch on each level, a member of another instantiation, ...). A Rose (Rose Nat) case pins that the family counts a group only at its own type arguments. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk --- CHANGELOG.md | 14 + CONFORMANCE.md | 2 +- README.md | 1 + SPEC.md | 45 +- VERIFICATION.md | 88 ++++ crates/conformance/src/cases/semantic_ir.rs | 3 + .../src/cases/semantic_ir/nested.rs | 481 ++++++++++++++++++ crates/conformance/src/support.rs | 11 + crates/lexlean/src/backend/semantic.rs | 90 +++- crates/lexlean/src/ir/semantic.rs | 467 +++++++++++++++-- crates/lexlean/src/ir/semantic/widen.rs | 70 ++- crates/lexlean/src/lib.rs | 8 +- examples/nested-induction/README.md | 10 + examples/nested-induction/lake-manifest.json | 6 + examples/nested-induction/lakefile.toml | 2 + examples/nested-induction/lean-toolchain | 1 + examples/nested-induction/lexlean.lock | 47 ++ examples/nested-induction/lexlean.toml | 27 + examples/nested-induction/src/Main.lex.tex | 177 +++++++ features/suites/semantic-ir.feature | 4 +- language/semantics-1.2.toml | 4 +- model/ids.toml | 2 +- schemas/semantic-module-v2.schema.json | 2 +- schemas/semantic-snapshot-v2.schema.json | 2 +- 24 files changed, 1502 insertions(+), 62 deletions(-) create mode 100644 crates/conformance/src/cases/semantic_ir/nested.rs create mode 100644 examples/nested-induction/README.md create mode 100644 examples/nested-induction/lake-manifest.json create mode 100644 examples/nested-induction/lakefile.toml create mode 100644 examples/nested-induction/lean-toolchain create mode 100644 examples/nested-induction/lexlean.lock create mode 100644 examples/nested-induction/lexlean.toml create mode 100644 examples/nested-induction/src/Main.lex.tex diff --git a/CHANGELOG.md b/CHANGELOG.md index e736308a23..0fd6ec0446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,20 @@ and Unreleased holds what has landed since. ## Unreleased +- Induction over a nested inductive type, #278 (SPEC.md §16.9, §17.10, §17.12, + `SM-37`). A new proof step, `nested_induction`, proves a statement about a + value of a nested inductive type (a type with a constructor that holds + itself under `List`, `Option`, `Result`, or a product) by the type's own + recursor: one branch for each constructor of the recursive family, in the + recursor's order, each binding its fields and one hypothesis for every field + that is a member of the family. The compiler checks the branch set, the + binder counts and the members before any backend and lowers the step to + `induction x using T.rec (motive_n := ...)` with positional `next` goals. + `induction` keeps refusing such a type, and its message now names + `nested_induction`. Moves the compiler-semantics identity: `semantic_ir` 15 + to 16 and `proof_lowering` 3 to 4 in `language/semantics-1.2.toml`, and both + schemas gain the step; the locks, records, goldens, fixtures and packages the + digest binds are regenerated at landing. The register is 447 IDs. - Structural recursion over the recursive family of a nested inductive type, #278 (SPEC.md §17.12, `DF-19`). A mutual definition group may decrease on any member of the family the pinned Lean takes as the motives of the type's diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 6c2e398975..9eba457c83 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -576,7 +576,7 @@ the error registry does not sanction (R5, `ERRORS.md`). | `SM-34` | `build` | A version 2 core-module row may be derived, stating its name, kind, and extension state, and for a sparse casesOn its recipe, and no universe parameters, type, or value: the decoder makes the constant with the pinned Lean's own construction at the row's place in the order, and refuses the module when the name is not one the pinned Lean reserves and the row states no sparse casesOn recipe, when the construction does not make the name, or when the constant it makes is not a theorem, definition, or abbreviation as the row says; the notation writes a derived row without a type, the schema and the linker refuse a derived row that states what the construction decides, a stored row is still checked against the construction, the decoder checks that the constructors a recipe names are constructors of the type and are named once, that the module states every sparse casesOn its construction makes, and that every derived sparse casesOn is referred to by the type or value of a row, and the content of a derived row is checked by its uses alone, so that a recipe naming other valid constructors of the type is not distinguished where the use accepts it; and the shipped preservation library states every row that carries a sparse casesOn record or is named like an equation, an unfolding equation, a splitter, or an else equation as a derived row. | | `SM-35` | `build` | A language-1.2 theorem may be proved by `term_cases`, a split on the value of a document term: the proof names a term and a nonempty, strictly sorted, duplicate-free list of prior document definitions, the term's type is an inductive type of the document, and the backend lowers the proof to a split of the goal on every constructor of that type with the hypothesis that equates the term to the constructor, then `simp only` over the named definitions, that hypothesis, and the reduction of a conditional on a decided condition, with closed propositions decided, which uses exactly the axioms the theorem's policy states; the schema, the linker, the notation, the Lean backend, the canonical LaTeX, and the formatter accept it, and a use in language 1.1, a term whose type is not an inductive type of the document, an empty list, an unsorted or repeated name, a name that is not a prior definition, and a theorem parameter that takes the hypothesis's name are each refused. | | `SM-36` | `build` | A language-1.2 `cases` proof may split a local of type `Bool` into its two constructors: the proof names the local and gives a branch for `false` and one for `true`, each with no binders, the backend lowers it to `cases` on the local with those two alternatives, the theorem verifies with exactly the axioms its policy states, and the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it; a use in language 1.1, a missing branch, a repeated branch, a branch with a binder, and an `induction` on a Boolean are each refused. | -| `SM-37` | `build` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | +| `SM-37` | `build` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | ## stdlib diff --git a/README.md b/README.md index f289455440..8c2c394440 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ Every directory under [examples/](examples/) is discovered by the example gate ( | [recursive-data](examples/recursive-data/) | Language-1.2 recursive data (SPEC.md §17.12) across two modules: a self-recursive parameterized `Tree`, a nested `Rose` through `List`, the mutual `Expr`/`Stmt` group, a parameterized result-like `Outcome`, products and pairs in a structure; structural recursion and induction with one hypothesis per recursive field, under exact axiom policies. | | [higher-order](examples/higher-order/) | Language-1.2 first-class functions (SPEC.md §17.12): generic `mapList`, `foldList`, and `compose`; lambdas with explicit captures; definition references across modules; a visitor record of functions over an arithmetic AST agreeing with direct evaluation; a generic induction theorem applied at `Nat`; executable definitions passing only non-escaping closures. | | [recursion](examples/recursion/) | Language-1.2 recursion (SPEC.md §17.12): mutual structural groups over a nested rose tree, the mutual `Expr`/`Stmt` syntax, and the naturals, each lowered with `termination_by structural`; three well-founded normalizations (`countdown`, `reduce`, a bounded `search`) whose per-call decrease obligations are proved by `linear_arithmetic` and bound as explicit evidence; closed values computed by kernel reduction under exact axiom policies. | +| [nested-induction](examples/nested-induction/) | Language-1.2 induction over a nested inductive type (SPEC.md §17.10, §17.12): a `Json` value that holds a `List` of itself and a `List` of pairs that end in itself, mutual structural `size` and `leaves` groups over the four members of its recursive family, and `leaves_le_size` proved by `nested_induction` over the recursor the pinned Lean generates, under an exact axiom policy. | | [collections](examples/collections/) | Language-1.2 ordered collections (SPEC.md §17.12): a String-keyed compiler symbol table built by an executable fold, a call graph whose reachability and least-first topological order the kernel computes, a cyclic graph with no order, a reasoning-state fixed point (the ancestor closure of a parent relation) reached by bounded iteration, and reordered literals that are equal by construction. | | [production](examples/production/) | Language-1.2 production eligibility (SPEC.md §17.13): six declared roots across two modules beside formal-only theorems and a proposition-valued definition; an effect-free fixed-width root eligible on `rust-core` and `rust-std`, overflow-admitting roots over a non-recursive inductive and a non-escaping closure, a well-founded root whose termination evidence is erased, and allocation-admitting list roots eligible on `rust-std` only, including a generic dependency instantiated at `Nat`; each root's closure, effects, and dispositions are published as its eligibility report, and verification extracts the roots through Lean's compiler front end into the canonical compiler input. | | [production-coverage](examples/production-coverage/) | Language-1.2 semantic preservation coverage (SPEC.md §17.17): 33 production roots across four modules that together exercise every runtime row of the production registry (§17.13) — fixed-width arithmetic at every width, text, bytes, and decimal parsing and formatting, records, options, generic and nested inductive types, higher-order functions with captures, structural, mutual, and well-founded recursion, and every collection template and key order; verification extracts every root and checks its certificate A. | diff --git a/SPEC.md b/SPEC.md index 7213bbbc6d..e84fddc597 100644 --- a/SPEC.md +++ b/SPEC.md @@ -2061,7 +2061,7 @@ PROOF-STEPS Requirements mirror cases. The eliminator descriptor distinguishes constructor fields from induction hypotheses and fixes their binding order. Every case occurs exactly once. -The backend emits pinned Lean `induction` syntax. LexLean does not synthesize an induction principle or infer missing cases. +The backend emits pinned Lean `induction` syntax. LexLean does not synthesize an induction principle or infer missing cases. A nested inductive type has a recursor of several motives that `induction` does not use; language 1.2 names it in `nested_induction` (§17.10, `SM-37`). ### 16.10 Calculation chains @@ -2699,6 +2699,41 @@ take it. The canonical LaTeX of a semantic module is a catalog of its declarations that states a theorem's statement and axiom policy and no proof, for every proof form, so the form adds nothing to it. +A `nested_induction` proof (language 1.2, `SM-37`) is induction over a nested inductive type +of the document: one that holds a member of itself under `List`, `Option`, `Result`, or a +product, and is in no mutual group. The pinned Lean's `induction` tactic refuses such a type +(`The induction tactic does not support the type … because it is a nested inductive type`), +and the recursor Lean generates for it, `T.rec`, has one motive for each member of the type's +recursive family (§17.12 *Recursion* rule 2: the type itself, then each such application, in +the order of discovery) and one minor premise for each constructor of each member, the type's +first, then the members' in the family's order. The proof names the scrutinee, a parameter of +the theorem of that type; one proposition for each auxiliary member, in the family's order, +over a fresh binder of the member's type and the theorem's other parameters (the motive of +the type itself is the theorem's statement); and a branch for every constructor of the type +and of each member, in any order. A branch binds the constructor's fields followed by one +hypothesis for each field whose type is a member of the family, in field order: the binders +of the constructor's minor premise. The proof lowers to +`induction using T.rec (motive_2 := fun => ) …` +and then one `next =>` for each minor premise, taken in the order of the recursor +whatever order the branches are written in. The goals are named by position, because the +constructors of two members can share a name (`nil` of `List Json` and of +`List (String * Json)`), which `induction … with` refuses. LexLean synthesizes no induction +principle: it names the one Lean generated, as §16.9 says for `induction`, and the proof +carries no tactic, option, or lemma. It adds no axiom of its own: the theorem's policy states +the exact set the pinned Lean observes, which for the example's theorem under Lean 4.32.1 is +`propext` and `Quot.sound`. The linker refuses, as `LLT4001`, a use in language +1.1; a scrutinee that is not a theorem parameter whose type is a document inductive that +holds itself under a container and lies in no mutual group (a type with no nested field is +inducted over by `induction`, and a mutual group has no recursor this form names); a member +that is missing, repeated, not of the family, or out of order; a binder used by two members; +a proposition that is not well typed or not a proposition; a missing or repeated branch; a +branch for no constructor; and a branch with the wrong number of binders. There is no +`generalizing` list: a proposition states the parameters it quantifies. `induction` on a +nested type is refused (§17.12 rule 7). The canonical LaTeX states no proof for any proof +form, so the form adds nothing to it. The example `examples/nested-induction` proves +`leaves_le_size` over a `Json` value, with mutual `size` and `leaves` groups over the four +members of its family (`DF-19`). + A `cases` proof (§17.10) may name a local of type `Bool` (language 1.2, `SM-36`): the branches are exactly `false` and `true`, each without binders, and the proof lowers to `cases` on the local with those two alternatives, as it does for a natural number, a @@ -2830,7 +2865,11 @@ either backend runs; they do not defer to what Lean would accept. 7. **Induction.** `induction` applies to a self-recursive inductive with no nested occurrence and no mutual group, and binds the constructor fields followed by one hypothesis per direct recursive field, in field order. - `cases` applies to every inductive. + `cases` applies to every inductive. A nested inductive in no mutual group is + inducted over by `nested_induction` (§17.10, `SM-37`), which binds one + hypothesis per constructor field whose type is a member of the type's + recursive family (rule 2), in field order; `induction` on such a type is + refused, and its message names `nested_induction`. 8. **Lowering.** Each inductive lowers to one `public inductive` with positional `(_ : T)` fields; each mutual group lowers to one `mutual ... end` block. A constructor's identity is its owner and name, @@ -10334,7 +10373,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `SM-34` | `semantic-ir` | A version 2 core-module row may be derived, stating its name, kind, and extension state, and for a sparse casesOn its recipe, and no universe parameters, type, or value: the decoder makes the constant with the pinned Lean's own construction at the row's place in the order, and refuses the module when the name is not one the pinned Lean reserves and the row states no sparse casesOn recipe, when the construction does not make the name, or when the constant it makes is not a theorem, definition, or abbreviation as the row says; the notation writes a derived row without a type, the schema and the linker refuse a derived row that states what the construction decides, a stored row is still checked against the construction, the decoder checks that the constructors a recipe names are constructors of the type and are named once, that the module states every sparse casesOn its construction makes, and that every derived sparse casesOn is referred to by the type or value of a row, and the content of a derived row is checked by its uses alone, so that a recipe naming other valid constructors of the type is not distinguished where the use accepts it; and the shipped preservation library states every row that carries a sparse casesOn record or is named like an equation, an unfolding equation, a splitter, or an else equation as a derived row. | §17.10 | | `SM-35` | `semantic-ir` | A language-1.2 theorem may be proved by `term_cases`, a split on the value of a document term: the proof names a term and a nonempty, strictly sorted, duplicate-free list of prior document definitions, the term's type is an inductive type of the document, and the backend lowers the proof to a split of the goal on every constructor of that type with the hypothesis that equates the term to the constructor, then `simp only` over the named definitions, that hypothesis, and the reduction of a conditional on a decided condition, with closed propositions decided, which uses exactly the axioms the theorem's policy states; the schema, the linker, the notation, the Lean backend, the canonical LaTeX, and the formatter accept it, and a use in language 1.1, a term whose type is not an inductive type of the document, an empty list, an unsorted or repeated name, a name that is not a prior definition, and a theorem parameter that takes the hypothesis's name are each refused. | §17.10 | | `SM-36` | `semantic-ir` | A language-1.2 `cases` proof may split a local of type `Bool` into its two constructors: the proof names the local and gives a branch for `false` and one for `true`, each with no binders, the backend lowers it to `cases` on the local with those two alternatives, the theorem verifies with exactly the axioms its policy states, and the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it; a use in language 1.1, a missing branch, a repeated branch, a branch with a binder, and an `induction` on a Boolean are each refused. | §17.10 | -| `SM-37` | `semantic-ir` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | §16.9, §17.10, §17.12 | +| `SM-37` | `semantic-ir` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | §16.9, §17.10, §17.12 | | `DF-01` | `declarations` | A valid type-definition sentence emits one nonrecursive sort-valued Lean def linked to its document entry. | §15.7, §18.6 | | `DF-02` | `declarations` | A valid term-definition sentence emits one nonrecursive explicitly typed Lean def. | §15.7, §18.6 | | `DF-03` | `declarations` | A valid predicate-definition sentence emits one nonrecursive Prop-valued Lean def. | §15.7, §18.6 | diff --git a/VERIFICATION.md b/VERIFICATION.md index fff42d3ebd..d093bff974 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -855,6 +855,94 @@ Planted: `mentions_family_group` ignored the arguments again (the comparison test ir::semantic::family_order_tests::a_group_instantiated_at_its_own_type_has_two_motives ... FAILED ``` +### a nested induction can be refused or mis-ordered (SM-37) + +A theorem over a nested inductive type is proved by `nested_induction` +(`SM-37`, §16.9, §17.10, #278). `examples/nested-induction` proves +`leaves_le_size` over `Json` (`null`, `string`, `array (List Json)`, +`object (List (String * Json))`), whose recursor has four motives and nine +minor premises, with mutual `size` and `leaves` groups over the four members of +its family (`DF-19`). The backend lowers the proof to `induction value using +Json.rec (motive_2 := ...) (motive_3 := ...) (motive_4 := ...)` and nine +positional `next` goals in the recursor's order, whatever order the branches are +written in. + +Command and host: `lexlean fmt`, `lock`, `check`, `build` and `verify` in the +example, then `cargo test -p repo-conformance --test conformance -- +conformance_sm_37 conformance_df_13 conformance_df_19 conformance_ex_07` and +`cargo test -p lexlean --lib`, on the 2-core Linux x86-64 machine the series is +prepared on, Lean 4.32.1, rustc stable 1.97.0, under the shared heavy-job lock. + +```text +verified 1 module; attestation c7af737dad4c8d13d8835083917ceeaadf066a1b5a1fb623e544c374ec2ac573 (19.3 s) +error[LLV7005]: `NestedInduction.Main.leaves_le_size` violates its none axiom policy: observed [Quot.sound, propext] +``` + +The second line is the first verification, with the placeholder policy `[]`: the +axiom set the real build observes for the theorem is `Quot.sound` and `propext`, +which the example's policy and the `SM-37` row now state. `conformance_sm_37` +verifies the example and a `Rose` of naturals (a type with a parameter) under +the pinned Lean, shows the nine goals and the three motives in the Lean text, +shows the reversed branch order of every level lowers to the same Lean, and +refuses 49 plants as `LLT4001` before any backend output: + +- the family: each of the three members omitted; each pair of members swapped + (the reordered member); the first member repeated; a member outside the + family; two members with one binder; a proposition that is not a `Prop`; +- a member of another instantiation, `List (Rose Nat)` for the family of `Rose (Rose Nat)`; +- on each of the four levels (`Json`, `List Json`, `List (String * Json)`, + `String * Json`): every branch omitted ("are not exhaustive", 9), every branch + with one binder too many (9) and one too few (6, those with binders) ("expects + n binder(s), received m"), a branch repeated (4), a branch for no constructor + (4); +- `induction` on the same nested type (the message names `nested_induction`), + a language-1.1 module, and a scrutinee that is a natural number, a type with no + nested field, a type in a mutual group, or a local that is not a theorem + parameter. + +`conformance_df_13` still asserts the `induction` refusal, `conformance_ex_07` +refuses the `induction-nested-type` fixture with the new message, and +`cargo test -p lexlean --lib` passes (212 tests). Run on a tree whose locks were +regenerated locally and not committed (the identity moved, see the landing list +of the pull request), `conformance_ex_07` fails only on the fixtures whose +goldens bind the identity (`certificate-*-rejected`, +`production-expectation-stale`) and on the two `lock-schema-language-mismatch` +fixtures, which the local regeneration overwrote. + +A type used at one of its own types (the maintainer's review of DF-19): +`Rose Item | node : Item -> List (Rose Item)` at `Rose (Rose Nat)` has the two +motives `Rose.rec` has at any instantiation, so the family is `Rose (Rose Nat)` +and `List (Rose (Rose Nat))`, and `Rose Nat`, which the field `label` becomes, +joins nothing. `conformance_sm_37` proves `rose = rose` for a `Rose (Rose Nat)` +by `nested_induction` with the one member `List (Rose (Rose Nat))`, shows +`induction rose using Rose.rec (motive_2 := ...)` with no `motive_3`, and +verifies it under the pinned Lean. With `mentions_family_group` ignoring the +type arguments again (`(true || observed.as_slice() == arguments)`), the same +case fails: + +```text +thread 'conformance_sm_37' panicked at crates/conformance/src/support.rs:864:14: +check succeeds: ... "phase link: nested_induction is missing the member `Rose (Nat)` of the recursive family of `Rose (Rose (Nat))`" ... +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 446 filtered out +``` + +The plant was restored with `git checkout`; the case passes (41.0 s). + +Planted: the member-order test of `check_nested_induction` compared the members +as sets (`observed.len() != auxiliary.len() || auxiliary.iter().any(|ty| +!observed.contains(&ty))` in place of the sequence comparison). Command: +`cargo test -p repo-conformance --test conformance -- conformance_sm_37`. + +```text +thread 'conformance_sm_37' panicked at crates/conformance/src/support.rs:874:14: +check fails +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 446 filtered out +``` + +Removed: the plant was restored from a copy; `conformance_sm_37` passes (40.0 s) +and the swapped-members plants are refused with `nested_induction members are out +of order`. + ### recursion call graph check can fail Planted: `check_group_call_graph` returned `Ok(())` at once, so a mutual diff --git a/crates/conformance/src/cases/semantic_ir.rs b/crates/conformance/src/cases/semantic_ir.rs index 230cc994f5..75ce8ddaa9 100644 --- a/crates/conformance/src/cases/semantic_ir.rs +++ b/crates/conformance/src/cases/semantic_ir.rs @@ -10,6 +10,7 @@ use crate::support::{self, P}; mod boolean; mod bytes; mod names; +mod nested; mod strings; mod widen; @@ -2580,6 +2581,8 @@ pub(crate) fn run(id: &str) { "SM-32" => widen::run(), // §17.10: a theorem proved by a split on a Boolean local. "SM-36" => boolean::run(), + // §17.10: a theorem proved by induction over a nested inductive type. + "SM-37" => nested::run(), // §17.10: a theorem proved by a split on the value of a document // term. "SM-35" => { diff --git a/crates/conformance/src/cases/semantic_ir/nested.rs b/crates/conformance/src/cases/semantic_ir/nested.rs new file mode 100644 index 0000000000..289d0b43b9 --- /dev/null +++ b/crates/conformance/src/cases/semantic_ir/nested.rs @@ -0,0 +1,481 @@ +//! SM-37: a language-1.2 `nested_induction` proof (SPEC.md §16.9, §17.10). + +use serde_json::{json, Value}; + +use crate::support::{self, P}; + +/// The committed example's theorem, in the module data. +fn theorem(module: &mut Value) -> &mut Value { + module["declarations"] + .as_array_mut() + .expect("declarations") + .iter_mut() + .find(|declaration| declaration["name"] == "leaves_le_size") + .expect("the example's theorem") +} + +/// The branches of one level of the proof: the constructors of `Json` at +/// level 0, then those of each auxiliary member of its recursive family. +fn branches(proof: &mut Value, level: usize) -> &mut Vec { + let node = if level == 0 { + &mut proof["branches"] + } else { + &mut proof["members"][level - 1]["branches"] + }; + node.as_array_mut().expect("branches") +} + +/// How many levels the example's proof has: `Json`, `List Json`, +/// `List (String * Json)`, and `String * Json`. +const LEVELS: usize = 4; + +/// A copy of the example whose theorem's proof the edit changed, and the +/// error of checking it. +fn planted(edit: &dyn Fn(&mut Value)) -> P { + let copy = P::copy_example("nested-induction"); + let text = copy.read("src/Main.lex.tex"); + let mut module = support::module_json(&text); + edit(&mut theorem(&mut module)["proof"]); + copy.write( + "src/Main.lex.tex", + &support::with_module_json(&text, &module), + ); + copy +} + +/// The plant is refused by the linker (LLT4001) with a message that names the +/// misuse, and no backend output is written. +fn refuse(what: &str, edit: &dyn Fn(&mut Value), message: &str) { + let copy = planted(edit); + let error = copy.check_fails_with("LLT4001"); + assert!( + error.to_string().contains(message), + "{what}: expected {message:?}, got {error}" + ); + copy.assert_no_backend_output(); +} + +/// A whole module, in the authoring notation, for the misuses that need a +/// different type or theorem than the example's. +fn module(declarations: &str) -> String { + format!( + "\\begin{{lexlean}}{{Main}}\n\\useglossary{{lexlean.std.nat@1.2.0}}\n\\title{{Natural number addition}}\n\\begin{{semanticmodule}}\n{declarations}\n\\end{{semanticmodule}}\n\\end{{lexlean}}\n" + ) +} + +fn project_of(text: &str) -> P { + let project = P::example(); + project.edit("lexlean.toml", "language = \"1.0\"", "language = \"1.2\""); + project.write("src/Main.lex.tex", text); + project.relock(); + project +} + +/// The Lean text of every module of a project's build. +fn built_lean(project: &P) -> String { + let built = project.build_ok(); + let build_dir = project.build_dir(&built.build_id.expect("a build id")); + std::fs::read_dir(build_dir.join("modules").as_std_path()) + .expect("the modules") + .flatten() + .flat_map(|entry| { + std::fs::read_dir(entry.path()) + .into_iter() + .flatten() + .flatten() + }) + .filter(|entry| entry.path().extension().is_some_and(|ext| ext == "lean")) + .map(|entry| std::fs::read_to_string(entry.path()).expect("Lean text")) + .collect::() +} + +/// A `Rose` of naturals, which holds a `List` of itself and has a type +/// argument, and a theorem over it by `nested_induction`. +const ROSE: &str = r"inductive{ + name: Rose, + type_parameters: [Item], + parameters: [], + constructors: [{name: node, fields: ['Item, (List (Rose 'Item))]}] +} + +definition{ + name: count, + parameters: [rose : (Rose Nat)], + result: Nat, + body: (match rose | Rose.node label children => (1 + (countAll children))), + mutual: Count, + recursive_argument: rose +} + +definition{ + name: countAll, + parameters: [roses : (List (Rose Nat))], + result: Nat, + body: (match roses | List.nil => 0 | List.cons head tail => ((count head) + (countAll tail))), + mutual: Count, + recursive_argument: roses +} + +theorem{ + name: count_positive, + parameters: [rose : (Rose Nat)], + statement: (1 <= (count rose)), + proof: nested_induction{ + scrutinee: rose, + branches: [ + { + constructor: node, + binders: [label, children, childrenHypothesis], + proof: linear_arithmetic{definitions: [count]} + } + ], + members: [ + { + type: (List (Rose Nat)), + binder: roses, + statement: (0 <= (countAll roses)), + branches: [ + {constructor: nil, binders: [], proof: linear_arithmetic{definitions: [countAll]}}, + { + constructor: cons, + binders: [head, tail, headHypothesis, tailHypothesis], + proof: linear_arithmetic{definitions: [countAll]} + } + ] + } + ] + }, + axioms: [Quot.sound, propext] +}"; + +/// The same `Rose`, and a theorem over a `Rose` of `Rose`s of naturals: the +/// recursor of `Rose` has two motives at any instantiation, so the family of +/// `Rose (Rose Nat)` is itself and `List (Rose (Rose Nat))`, and `Rose Nat`, +/// which the field `label` becomes, is another type that joins nothing. +const ROSE_OF_ROSE: &str = r"inductive{ + name: Rose, + type_parameters: [Item], + parameters: [], + constructors: [{name: node, fields: ['Item, (List (Rose 'Item))]}] +} + +theorem{ + name: rose_of_rose_refl, + parameters: [rose : (Rose (Rose Nat))], + statement: (rose = rose), + proof: nested_induction{ + scrutinee: rose, + branches: [ + {constructor: node, binders: [label, children, childrenHypothesis], proof: reflexivity{}} + ], + members: [ + { + type: (List (Rose (Rose Nat))), + binder: roses, + statement: (roses = roses), + branches: [ + {constructor: nil, binders: [], proof: reflexivity{}}, + { + constructor: cons, + binders: [head, tail, headHypothesis, tailHypothesis], + proof: reflexivity{} + } + ] + } + ] + }, + axioms: [] +}"; + +/// Run the case of `SM-37`. +pub fn run() { + let accepted = P::copy_example("nested-induction"); + let checked = support::checked_project(&accepted); + let core = serde_json::to_value( + checked.modules["Main"] + .document + .semantic + .as_ref() + .expect("a semantic module"), + ) + .expect("module JSON"); + support::assert_schema("semantic-module-v2", "a nested_induction proof", &core); + // The committed source is the formatter's fixed point, the formatter + // keeps the proof, and the notation reads back to the same module. + accepted.fmt_check_ok(); + let source = accepted.read("src/Main.lex.tex"); + assert!(source.contains("\"kind\":\"nested_induction\""), "{source}"); + let notation = lexlean::sdk::to_notation(&source).expect("the notation"); + assert!(notation.contains("nested_induction{"), "{notation}"); + assert_eq!( + lexlean::sdk::read_module(¬ation).expect("reads back"), + lexlean::sdk::read_module(&source).expect("reads"), + "the notation is the same module" + ); + // The lowering: the recursor Lean generated, the propositions of the + // auxiliary members as its motives, and one positional goal for each + // minor premise, in the order of the recursor (the constructors of + // `Json`, then `nil` and `cons` of `List Json`, `nil` and `cons` of + // `List (String * Json)`, and `mk` of the pair). + let lean = built_lean(&accepted); + let goals: Vec<&str> = lean + .lines() + .filter(|line| line.trim_start().starts_with("next")) + .map(str::trim) + .collect(); + assert_eq!( + goals, + [ + "next =>", + "next content =>", + "next items itemsHypothesis =>", + "next entries entriesHypothesis =>", + "next =>", + "next head tail headHypothesis tailHypothesis =>", + "next =>", + "next head tail headHypothesis tailHypothesis =>", + "next key content contentHypothesis =>", + ], + "{lean}" + ); + assert!( + lean.contains("induction value using Json.rec\n") + && lean.contains("(motive_2 := fun items =>") + && lean.contains("(motive_3 := fun entries =>") + && lean.contains("(motive_4 := fun entry =>"), + "{lean}" + ); + // The pinned Lean checks the theorem, with exactly the axioms its policy + // states. + support::verify_ok_backed("SM-37", &accepted); + // The goals follow the recursor, not the order the branches are written + // in: every level written in reverse lowers to the same Lean. + let reversed = planted(&|proof| { + for level in 0..LEVELS { + branches(proof, level).reverse(); + } + }); + reversed.check_ok(); + assert_eq!( + built_lean(&reversed), + lean, + "the branch order is not the recursor's" + ); + // A type with a type argument, and a theorem over it. + let rose = project_of(&module(ROSE)); + rose.check_ok(); + let rose_lean = built_lean(&rose); + assert!( + rose_lean.contains("induction rose using Rose.rec\n") + && rose_lean.contains("(motive_2 := fun roses =>"), + "{rose_lean}" + ); + support::verify_ok_backed("SM-37", &rose); + // A type used at one of its own types: two motives, not four. + let nested = project_of(&module(ROSE_OF_ROSE)); + nested.check_ok(); + let nested_lean = built_lean(&nested); + assert!( + nested_lean.contains("induction rose using Rose.rec\n") + && nested_lean.contains("(motive_2 := fun roses =>") + && !nested_lean.contains("(motive_3 :="), + "{nested_lean}" + ); + support::verify_ok_backed("SM-37", &nested); + // `List (Rose Nat)` is not a member of the family of `Rose (Rose Nat)`. + let extra = project_of(&module(&ROSE_OF_ROSE.replace( + "members: [\n {\n type: (List (Rose (Rose Nat))),", + "members: [\n {\n type: (List (Rose Nat)),", + ))); + let shown = format!("{:?}", extra.check_err()); + assert!( + shown.contains("nested_induction is missing the member"), + "{shown}" + ); + + // The misuses are refused by the linker, each as LLT4001 before any + // backend output. + // The members of the recursive family: missing, reordered, repeated, and + // not of the family, each as Lean's recursor takes them. + for member in 0..LEVELS - 1 { + refuse( + &format!("member {member} omitted"), + &|proof| { + proof["members"] + .as_array_mut() + .expect("members") + .remove(member); + }, + "nested_induction is missing the member", + ); + } + for (first, second) in [(0, 1), (1, 2), (0, 2)] { + refuse( + &format!("members {first} and {second} swapped"), + &|proof| { + proof["members"] + .as_array_mut() + .expect("members") + .swap(first, second); + }, + "nested_induction members are out of order", + ); + } + refuse( + "the first member repeated", + &|proof| { + let members = proof["members"].as_array_mut().expect("members"); + members[1] = members[0].clone(); + }, + "nested_induction names the member `List (Json)` more than once", + ); + refuse( + "a member outside the family", + &|proof| { + let members = proof["members"].as_array_mut().expect("members"); + let mut extra = members[0].clone(); + extra["type"] = json!({"kind": "list", "element": {"kind": "nat"}}); + members.push(extra); + }, + "which is not a member of the recursive family of `Json`", + ); + refuse( + "two members that share a binder", + &|proof| { + proof["members"][1]["binder"] = proof["members"][0]["binder"].clone(); + }, + "is used by two members", + ); + refuse( + "a proposition that is not a proposition", + &|proof| { + proof["members"][0]["statement"] = json!({ + "kind": "call", + "function": {"name": "sizeList"}, + "arguments": [{"kind": "var", "name": "items"}] + }); + }, + "has type Nat, expected Prop", + ); + // Each level: a missing branch, a branch with one binder too many and + // one too few, a repeated branch, and a branch for no constructor. + for level in 0..LEVELS { + let count = { + let mut module = support::module_json(&accepted.read("src/Main.lex.tex")); + let count = branches(&mut theorem(&mut module)["proof"], level).len(); + count + }; + for index in 0..count { + refuse( + &format!("level {level}: branch {index} missing"), + &|proof| { + branches(proof, level).remove(index); + }, + "are not exhaustive", + ); + refuse( + &format!("level {level}: branch {index} with a binder too many"), + &|proof| { + branches(proof, level)[index]["binders"] + .as_array_mut() + .expect("binders") + .push("surplus".into()); + }, + "binder(s), received", + ); + let has_binders = { + let mut module = support::module_json(&accepted.read("src/Main.lex.tex")); + !branches(&mut theorem(&mut module)["proof"], level)[index]["binders"] + .as_array() + .expect("binders") + .is_empty() + }; + if has_binders { + refuse( + &format!("level {level}: branch {index} with a binder too few"), + &|proof| { + branches(proof, level)[index]["binders"] + .as_array_mut() + .expect("binders") + .pop(); + }, + "binder(s), received", + ); + } + } + refuse( + &format!("level {level}: a branch repeated"), + &|proof| { + let level = branches(proof, level); + level.push(level[0].clone()); + }, + "duplicate proof branch", + ); + refuse( + &format!("level {level}: a branch for no constructor"), + &|proof| { + branches(proof, level)[0]["constructor"] = "absent".into(); + }, + "is not a constructor of", + ); + } + // `induction` on the same type is still refused, and says which form + // takes it. + refuse( + "induction on a nested type", + &|proof| { + proof["kind"] = "induction".into(); + proof.as_object_mut().expect("proof").remove("members"); + }, + "its type holds itself under a container, so use nested_induction (or cases)", + ); + // A language-1.1 module has no such proof. + { + let on_nat = "theorem{name: t, parameters: [n : Nat], statement: (n = n), proof: nested_induction{scrutinee: n, branches: [{constructor: zero, binders: [], proof: reflexivity{}}], members: [{type: (List Nat), binder: xs, statement: (xs = xs), branches: [{constructor: nil, binders: [], proof: reflexivity{}}]}]}, axioms: []}"; + let text = project_of(&module(on_nat)).read("src/Main.lex.tex"); + let old = P::example(); + old.edit("lexlean.toml", "language = \"1.0\"", "language = \"1.1\""); + old.write_raw( + "src/Main.lex.tex", + &text + .replace("@1.2.0", "@1.1.0") + .replace("lexlean/semantic-module/2", "lexlean/semantic-module/1"), + ); + old.relock(); + let shown = format!("{:?}", old.check_err()); + assert!( + shown.contains("`nested_induction proof` is a language-1.2 construct"), + "language 1.1: {shown}" + ); + } + // The scrutinee must be a nested inductive of the document that is in no + // mutual group, and a parameter of the theorem. + let json = "inductive{\n name: Json,\n type_parameters: [],\n parameters: [],\n constructors: [{name: null, fields: []}, {name: array, fields: [(List Json)]}]\n}\n\n"; + let list_member = "members: [{type: (List Json), binder: items, statement: (items = items), branches: [{constructor: nil, binders: [], proof: reflexivity{}}, {constructor: cons, binders: [head, tail, headHypothesis, tailHypothesis], proof: reflexivity{}}]}]"; + for (what, declarations, message) in [ + ( + "a natural number", + "theorem{name: t, parameters: [n : Nat], statement: (n = n), proof: nested_induction{scrutinee: n, branches: [{constructor: zero, binders: [], proof: reflexivity{}}], members: [{type: (List Nat), binder: xs, statement: (xs = xs), branches: [{constructor: nil, binders: [], proof: reflexivity{}}]}]}, axioms: []}".to_owned(), + "is not of a nested inductive type of the document", + ), + ( + "a type with no nested field", + format!("inductive{{\n name: Tree,\n type_parameters: [],\n parameters: [],\n constructors: [{{name: leaf, fields: []}}, {{name: node, fields: [Tree, Tree]}}]\n}}\n\ntheorem{{name: t, parameters: [tree : Tree], statement: (tree = tree), proof: nested_induction{{scrutinee: tree, branches: [{{constructor: leaf, binders: [], proof: reflexivity{{}}}}, {{constructor: node, binders: [left, right, leftHypothesis, rightHypothesis], proof: reflexivity{{}}}}], {list_member}}}, axioms: []}}"), + "holds no member of itself under List, Option, Result, or a product", + ), + ( + "a type in a mutual group", + format!("inductive{{\n name: Expr,\n type_parameters: [],\n parameters: [],\n constructors: [{{name: literal, fields: [Nat]}}, {{name: block, fields: [(List Stmt)]}}],\n mutual: Syntax\n}}\n\ninductive{{\n name: Stmt,\n type_parameters: [],\n parameters: [],\n constructors: [{{name: assign, fields: [String, Expr]}}],\n mutual: Syntax\n}}\n\ntheorem{{name: t, parameters: [expr : Expr], statement: (expr = expr), proof: nested_induction{{scrutinee: expr, branches: [{{constructor: literal, binders: [value], proof: reflexivity{{}}}}], {list_member}}}, axioms: []}}"), + "which is in a mutual group", + ), + ( + "a local that is not a parameter of the theorem", + format!("{json}inductive{{\n name: Box,\n type_parameters: [],\n parameters: [],\n constructors: [{{name: wrap, fields: [Json]}}]\n}}\n\ntheorem{{name: t, parameters: [box : Box], statement: (box = box), proof: cases{{scrutinee: box, branches: [{{constructor: wrap, binders: [inner], proof: nested_induction{{scrutinee: inner, branches: [{{constructor: null, binders: [], proof: reflexivity{{}}}}, {{constructor: array, binders: [items, itemsHypothesis], proof: reflexivity{{}}}}], {list_member}}}}}]}}, axioms: []}}"), + "is not a parameter of the theorem", + ), + ] { + let project = project_of(&module(&declarations)); + let shown = format!("{:?}", project.check_err()); + assert!(shown.contains(message), "{what}: {shown}"); + } +} diff --git a/crates/conformance/src/support.rs b/crates/conformance/src/support.rs index 2f1a6a188b..1809bb2546 100644 --- a/crates/conformance/src/support.rs +++ b/crates/conformance/src/support.rs @@ -267,6 +267,17 @@ fn prove(value: &SnapshotProof) -> usize { SnapshotProof::Simplify { definitions } => definitions.len(), SnapshotProof::Constructor { branches } => branches.iter().map(prove).sum(), SnapshotProof::Cases { branches, .. } | SnapshotProof::Induction { branches, .. } => branches.iter().map(|v| prove(&v.proof)).sum(), + SnapshotProof::NestedInduction { branches, members, .. } => { + branches.iter().map(|v| prove(&v.proof)).sum::() + + members + .iter() + .map(|m| { + ty(&m.r#type) + + term(&m.statement) + + m.branches.iter().map(|v| prove(&v.proof)).sum::() + }) + .sum::() + } SnapshotProof::BooleanReflection { reflection } => match reflection { lexlean::SnapshotReflection::List { .. } => 1, lexlean::SnapshotReflection::Record { fields, .. } => fields.len(), diff --git a/crates/lexlean/src/backend/semantic.rs b/crates/lexlean/src/backend/semantic.rs index b0d2fea8ad..c1b357d166 100644 --- a/crates/lexlean/src/backend/semantic.rs +++ b/crates/lexlean/src/backend/semantic.rs @@ -19,6 +19,20 @@ use crate::source::coverage::Origin; mod reasoning; +/// The document inductive type of each theorem parameter that has one, by the +/// parameter's name. +type ScrutineeTypes = std::collections::BTreeMap; + +fn scrutinee_types(parameters: &[SemanticParameter]) -> ScrutineeTypes { + parameters + .iter() + .filter_map(|parameter| match ¶meter.r#type { + SemanticType::Named { member, .. } => Some((parameter.name.clone(), member.clone())), + _ => None, + }) + .collect() +} + struct Render<'a> { prefix: &'a str, /// The Lean module each imported module's key names; a module not in it @@ -146,6 +160,18 @@ fn proof_uses(proof: &SemanticProof, local: &str) -> bool { .iter() .any(|member| member.module.is_none() && member.name == local) } + SemanticProof::NestedInduction { + scrutinee, + branches, + members, + } => { + scrutinee == local + || branch_uses(branches) + || members.iter().any(|member| { + member.binder != local + && (term_uses(&member.statement, local) || branch_uses(&member.branches)) + }) + } } } @@ -1190,7 +1216,12 @@ impl Render<'_> { } } - fn proof_branch(&self, branch: &SemanticProofBranch, indent: usize) -> String { + fn proof_branch( + &self, + branch: &SemanticProofBranch, + indent: usize, + owners: &ScrutineeTypes, + ) -> String { let binders = if branch.binders.is_empty() { String::new() } else { @@ -1209,11 +1240,14 @@ impl Render<'_> { " ".repeat(indent), identifier(&branch.constructor), binders, - self.proof(&branch.proof, indent + 1) + self.proof(&branch.proof, indent + 1, owners) ) } - fn proof(&self, proof: &SemanticProof, indent: usize) -> String { + /// `owners` names, for each theorem parameter of a document inductive + /// type, that type: `nested_induction` names the recursor Lean generated + /// for the scrutinee's type (§16.9, `SM-37`). + fn proof(&self, proof: &SemanticProof, indent: usize, owners: &ScrutineeTypes) -> String { let pad = " ".repeat(indent); match proof { SemanticProof::Reflexivity => format!("{pad}rfl\n"), @@ -1237,7 +1271,7 @@ impl Render<'_> { let mut out = format!("{pad}constructor\n"); for branch in branches { out.push_str(&format!("{pad}·\n")); - out.push_str(&self.proof(branch, indent + 1)); + out.push_str(&self.proof(branch, indent + 1, owners)); } out } @@ -1247,7 +1281,7 @@ impl Render<'_> { } => { let mut out = format!("{pad}cases {} with\n", identifier(scrutinee)); for branch in branches { - out.push_str(&self.proof_branch(branch, indent)); + out.push_str(&self.proof_branch(branch, indent, owners)); } out } @@ -1273,7 +1307,49 @@ impl Render<'_> { identifier(scrutinee) ); for branch in branches { - out.push_str(&self.proof_branch(branch, indent)); + out.push_str(&self.proof_branch(branch, indent, owners)); + } + out + } + SemanticProof::NestedInduction { + scrutinee, + branches, + members, + } => { + // The recursor Lean generates for a nested inductive takes + // one motive for each member of the type's recursive family, + // `motive_1` (the goal) first. The proof states the others, + // and the goals that remain are the minor premises, in the + // order the checker put the branches in: the constructors of + // the type, then those of each member. Two members can share + // a constructor name, which `induction ... with` refuses, so + // the goals are named by position. + let recursor = owners.get(scrutinee).map_or_else( + || format!("{}.rec", identifier(scrutinee)), + |owner| format!("{}.rec", self.member(owner)), + ); + let mut out = format!("{pad}induction {} using {recursor}\n", identifier(scrutinee)); + for (index, member) in members.iter().enumerate() { + out.push_str(&format!( + "{pad} (motive_{} := fun {} => {})\n", + index + 2, + identifier(&member.binder), + self.term(&member.statement) + )); + } + for branch in branches + .iter() + .chain(members.iter().flat_map(|member| &member.branches)) + { + let binders: String = branch + .binders + .iter() + .map(|name| format!(" {}", identifier(name))) + .collect(); + out.push_str(&format!( + "{pad}next{binders} =>\n{}", + self.proof(&branch.proof, indent + 1, owners) + )); } out } @@ -2229,7 +2305,7 @@ pub fn render_lean( "public theorem {name}{}{binders} : {} := by\n{}", render.scoped_type_parameters(type_parameters, declaration), render.term(statement), - render.proof(proof, 1) + render.proof(proof, 1, &scrutinee_types(parameters)) )); } SemanticDeclaration::Artifact { .. } diff --git a/crates/lexlean/src/ir/semantic.rs b/crates/lexlean/src/ir/semantic.rs index 9619675101..73fa3e98b3 100644 --- a/crates/lexlean/src/ir/semantic.rs +++ b/crates/lexlean/src/ir/semantic.rs @@ -642,6 +642,20 @@ pub struct SemanticProofBranch { pub proof: Box, } +/// One auxiliary member of the recursive family of a nested inductive type in +/// a `nested_induction` proof (§16.9, `SM-37`): the member's type, the binder +/// its proposition ranges over, the proposition (the member's motive in the +/// recursor the pinned Lean generates for the type), and a branch for each +/// constructor of the member. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct SemanticNestedMember { + pub r#type: SemanticType, + pub binder: String, + pub statement: SemanticTerm, + pub branches: Vec, +} + /// A fixed Boolean comparison reflected into a proposition without using /// propositional extensionality. #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] @@ -727,6 +741,18 @@ pub enum SemanticProof { generalizing: Vec, branches: Vec, }, + /// Language 1.2: induction over a nested inductive type of the document, + /// one that holds a member of itself under `List`, `Option`, `Result`, or a + /// product and is in no mutual group. The proof states one proposition for + /// each auxiliary member of the type's recursive family, in the order the + /// pinned Lean's recursor takes them, and a branch for every constructor of + /// the type and of each member; it lowers to `induction` over the recursor + /// the pinned Lean generates for the type (§16.9, `SM-37`). + NestedInduction { + scrutinee: String, + branches: Vec, + members: Vec, + }, Congruence, /// A fixed natural-deduction bridge from executable Boolean validation to /// an independent proposition. The backend never invokes `propext`. @@ -2284,6 +2310,25 @@ fn proof_node_count(proof: &SemanticProof) -> u64 { arguments.iter().map(term_node_count).sum() } SemanticProof::TermCases { scrutinee, .. } => term_node_count(scrutinee), + SemanticProof::NestedInduction { + branches, members, .. + } => { + branches + .iter() + .map(|branch| proof_node_count(&branch.proof)) + .sum::() + + members + .iter() + .map(|member| { + term_node_count(&member.statement) + + member + .branches + .iter() + .map(|branch| proof_node_count(&branch.proof)) + .sum::() + }) + .sum::() + } } } @@ -3051,6 +3096,19 @@ fn proof_terms(proof: &SemanticProof, visit: &mut impl FnMut(&SemanticTerm)) { } } SemanticProof::TermCases { scrutinee, .. } => visit_terms(scrutinee, visit), + SemanticProof::NestedInduction { + branches, members, .. + } => { + for branch in branches { + proof_terms(&branch.proof, visit); + } + for member in members { + visit_terms(&member.statement, visit); + for branch in &member.branches { + proof_terms(&branch.proof, visit); + } + } + } } } @@ -3078,6 +3136,19 @@ fn proof_terms_mut(proof: &mut SemanticProof, visit: &mut impl FnMut(&mut Semant } } SemanticProof::TermCases { scrutinee, .. } => visit_terms_mut(scrutinee, visit), + SemanticProof::NestedInduction { + branches, members, .. + } => { + for branch in branches { + proof_terms_mut(&mut branch.proof, visit); + } + for member in members { + visit_terms_mut(&mut member.statement, visit); + for branch in &mut member.branches { + proof_terms_mut(&mut branch.proof, visit); + } + } + } } } @@ -3220,6 +3291,20 @@ fn proof_binders(proof: &SemanticProof, visit: &mut impl FnMut(&str)) { proof_binders(&branch.proof, visit); } } + SemanticProof::NestedInduction { + branches, members, .. + } => { + for branch in branches + .iter() + .chain(members.iter().flat_map(|member| &member.branches)) + { + branch.binders.iter().for_each(|binder| visit(binder)); + proof_binders(&branch.proof, visit); + } + for member in members { + visit(&member.binder); + } + } } } @@ -3506,6 +3591,19 @@ fn proof_type_arguments(proof: &SemanticProof, visit: &mut impl FnMut(&SemanticT proof_type_arguments(&branch.proof, visit); } } + SemanticProof::NestedInduction { + branches, members, .. + } => { + for member in members { + visit(&member.r#type); + } + for branch in branches + .iter() + .chain(members.iter().flat_map(|member| &member.branches)) + { + proof_type_arguments(&branch.proof, visit); + } + } SemanticProof::Apply { type_arguments, .. } | SemanticProof::Law { type_arguments, .. } => { type_arguments.iter().for_each(visit); } @@ -3683,6 +3781,8 @@ struct Environment<'a> { /// Language 1.2 (models): the declaration being checked was elaborated /// from a model declaration, so generated binders are admitted. derived: bool, + /// The parameters of the theorem whose proof is being checked. + proof_parameters: BTreeSet, } #[derive(Clone, Default)] @@ -5310,41 +5410,93 @@ fn mentions_family_group(ty: &SemanticType, keys: &[String], arguments: &[Semant .any(|child| mentions_family_group(child, keys, arguments)) } -/// The constructor field types of one member of a recursive family, at the -/// member's own type arguments and in the order the pinned Lean takes the -/// constructors: the declaration order for a document inductive, `nil` and -/// `cons` for a list, `none` and `some` for an option, `error` and `ok` for a -/// result, and `mk` for a product. -fn family_constructor_fields(ty: &SemanticType, env: &Environment<'_>) -> Vec { - if let SemanticType::Named { member, arguments } = ty { - let Some(info) = type_info(member, env) else { - return Vec::new(); - }; - let map = substitutions(info, arguments); - // Every member of a recursive family is a document inductive, and - // those keep their declaration order; a structure, the only type - // without one, is in no group (`group_key_of`) and is never a member. - return info - .constructor_order - .iter() - .filter_map(|name| info.constructor_types.get(name)) - .flatten() - .map(|field| substitute_type(field, &map)) - .collect(); - } - if let SemanticType::List { element } = ty { - return vec![element.as_ref().clone(), ty.clone()]; - } - if let SemanticType::Option { value } = ty { - return vec![value.as_ref().clone()]; - } - if let SemanticType::Result { ok, error } = ty { - return vec![error.as_ref().clone(), ok.as_ref().clone()]; - } - if let SemanticType::Product { left, right } = ty { - return vec![left.as_ref().clone(), right.as_ref().clone()]; +/// The constructors of one member of a recursive family, each with the name +/// the proof forms write it by and the types of its fields, at the member's +/// own type arguments and in the order the pinned Lean takes the constructors +/// as the minor premises of a recursor: the declaration order for a document +/// inductive, `nil` and `cons` for a list, `none` and `some` for an option, +/// `error` and `ok` for a result, and `mk` for a product. +fn family_constructors( + ty: &SemanticType, + env: &Environment<'_>, +) -> Vec<(String, Vec)> { + let named = |name: &str, fields: Vec| (name.to_owned(), fields); + match ty { + SemanticType::Named { member, arguments } => { + let Some(info) = type_info(member, env) else { + return Vec::new(); + }; + let map = substitutions(info, arguments); + // Every member of a recursive family is a document inductive, and + // those keep their declaration order; a structure, the only type + // without one, is in no group (`group_key_of`) and is never a + // member. + info.constructor_order + .iter() + .filter_map(|name| { + info.constructor_types.get(name).map(|fields| { + ( + name.rsplit('.').next().unwrap_or(name).to_owned(), + fields + .iter() + .map(|field| substitute_type(field, &map)) + .collect(), + ) + }) + }) + .collect() + } + SemanticType::List { element } => vec![ + named("nil", Vec::new()), + named("cons", vec![element.as_ref().clone(), ty.clone()]), + ], + SemanticType::Option { value } => vec![ + named("none", Vec::new()), + named("some", vec![value.as_ref().clone()]), + ], + SemanticType::Result { ok, error } => vec![ + named("error", vec![error.as_ref().clone()]), + named("ok", vec![ok.as_ref().clone()]), + ], + SemanticType::Product { left, right } => { + vec![named( + "mk", + vec![left.as_ref().clone(), right.as_ref().clone()], + )] + } + SemanticType::Type + | SemanticType::Parameter { .. } + | SemanticType::Nat + | SemanticType::Bool + | SemanticType::Prop + | SemanticType::Unit + | SemanticType::Int + | SemanticType::Int8 + | SemanticType::Int16 + | SemanticType::Int32 + | SemanticType::Int64 + | SemanticType::UInt8 + | SemanticType::UInt16 + | SemanticType::UInt32 + | SemanticType::UInt64 + | SemanticType::String + | SemanticType::Bytes + | SemanticType::Ordering + | SemanticType::ContractViolation + | SemanticType::ReasoningFailure + | SemanticType::Function { .. } + | SemanticType::Map { .. } + | SemanticType::Set { .. } => Vec::new(), } - Vec::new() +} + +/// The constructor field types of one member of a recursive family, in the +/// order of `family_constructors`. +fn family_constructor_fields(ty: &SemanticType, env: &Environment<'_>) -> Vec { + family_constructors(ty, env) + .into_iter() + .flat_map(|(_, fields)| fields) + .collect() } /// §17.12: the recursive family of the inductive group `keys` at `arguments` @@ -8638,6 +8790,11 @@ fn check_proof( } check_elimination_proof(scrutinee, branches, true, locals, env) } + SemanticProof::NestedInduction { + scrutinee, + branches, + members, + } => check_nested_induction(scrutinee, branches, members, locals, env), } } @@ -8801,6 +8958,229 @@ fn check_boolean_reflection( } } +/// The recursive family of the nested inductive type of the local `scrutinee` +/// (§16.9, `SM-37`): the type itself, then its auxiliary members in the order +/// the pinned Lean's recursor takes its motives. A type with no nested +/// occurrence has no auxiliary member, a type in a mutual group has a +/// recursor this form does not name, and neither is a nested inductive here. +fn nested_family( + scrutinee: &str, + locals: &BTreeMap, + env: &Environment<'_>, +) -> Result, String> { + let ty = locals + .get(scrutinee) + .ok_or_else(|| format!("proof scrutinee `{scrutinee}` is absent"))?; + let SemanticType::Named { member, arguments } = ty else { + return Err(format!( + "nested_induction scrutinee `{scrutinee}` is not of a nested inductive type of the document" + )); + }; + let info = type_info(member, env) + .filter(|info| !info.constructors.is_empty() && info.fields.is_empty()) + .ok_or_else(|| { + format!( + "nested_induction scrutinee `{scrutinee}` is not of a nested inductive type of the document" + ) + })?; + if info.group.len() != 1 { + return Err(format!( + "nested_induction scrutinee `{scrutinee}` is of `{ty}`, which is in a mutual group; the form ranges over a nested type in no mutual group" + )); + } + let family = family_members(&info.group, arguments, env); + if family.len() < 2 { + return Err(format!( + "nested_induction scrutinee `{scrutinee}` is of `{ty}`, which holds no member of itself under List, Option, Result, or a product; use induction" + )); + } + Ok(family) +} + +/// The binder types of each constructor's branch of one member of a nested +/// inductive's recursive family, in the order of the member's minor +/// premises in the recursor the pinned Lean generates: the constructor's +/// fields, then one hypothesis for each field whose type is a member of the +/// family, in field order. +fn nested_branch_types( + ty: &SemanticType, + family: &[SemanticType], + env: &Environment<'_>, +) -> Vec<(String, Vec)> { + let family = Family::Group(family.to_vec()); + family_constructors(ty, env) + .into_iter() + .map(|(name, fields)| { + let hypotheses = fields + .iter() + .filter(|field| in_family(field, &family)) + .count(); + let mut binders = fields; + binders.extend(std::iter::repeat_n(SemanticType::Prop, hypotheses)); + (name, binders) + }) + .collect() +} + +/// Check the branches of one member against its constructors: every +/// constructor exactly once, each with exactly the binders of the minor +/// premise, each proof closed over its binders (and the theorem's other +/// parameters). +fn check_nested_branches( + owner: &SemanticType, + branches: &[SemanticProofBranch], + expected: &[(String, Vec)], + scope: &BTreeMap, + env: &Environment<'_>, +) -> Result<(), String> { + let mut observed = BTreeSet::new(); + for branch in branches { + check_name(&branch.constructor, "proof constructor")?; + if !observed.insert(branch.constructor.clone()) { + return Err(format!( + "duplicate proof branch `{}` of `{owner}`", + branch.constructor + )); + } + let (_, binder_types) = expected + .iter() + .find(|(name, _)| *name == branch.constructor) + .ok_or_else(|| { + format!( + "proof branch `{}` is not a constructor of `{owner}`", + branch.constructor + ) + })?; + if branch.binders.len() != binder_types.len() { + return Err(format!( + "proof branch `{}` of `{owner}` expects {} binder(s), received {}", + branch.constructor, + binder_types.len(), + branch.binders.len() + )); + } + let mut nested = scope.clone(); + for (binder, binder_type) in branch.binders.iter().zip(binder_types) { + check_name(binder, "proof binder")?; + if nested.insert(binder.clone(), binder_type.clone()).is_some() { + return Err(format!("shadowed proof binder `{binder}`")); + } + } + check_proof(&branch.proof, &nested, env)?; + } + if let Some((missing, _)) = expected.iter().find(|(name, _)| !observed.contains(name)) { + return Err(format!( + "proof branches of `{owner}` are not exhaustive: the branch for `{missing}` is missing" + )); + } + Ok(()) +} + +/// A `nested_induction` proof (§16.9, `SM-37`). The members must be exactly +/// the auxiliary members of the recursive family, in the order of the family; +/// each proposition is a well-typed `Prop` over the theorem's other parameters +/// and its member's binder; every constructor of the type and of each member +/// has a branch with the binders of its minor premise. +fn check_nested_induction( + scrutinee: &str, + branches: &[SemanticProofBranch], + members: &[SemanticNestedMember], + locals: &BTreeMap, + env: &Environment<'_>, +) -> Result<(), String> { + require_language_1_2(env, "nested_induction proof")?; + // The Lean the proof lowers to names the recursor of the scrutinee's type, + // which the backend reads from the theorem's parameter of that name. + if !env.proof_parameters.contains(scrutinee) { + return Err(format!( + "nested_induction scrutinee `{scrutinee}` is not a parameter of the theorem" + )); + } + let family = nested_family(scrutinee, locals, env)?; + let auxiliary = &family[1..]; + let observed: Vec<&SemanticType> = members.iter().map(|member| &member.r#type).collect(); + if observed.iter().copied().ne(auxiliary.iter()) { + if let Some(duplicate) = observed + .iter() + .enumerate() + .find(|(index, ty)| observed[..*index].contains(ty)) + .map(|(_, ty)| ty) + { + return Err(format!( + "nested_induction names the member `{duplicate}` more than once" + )); + } + if let Some(missing) = auxiliary.iter().find(|ty| !observed.contains(ty)) { + return Err(format!( + "nested_induction is missing the member `{missing}` of the recursive family of `{}`", + family[0] + )); + } + if let Some(extra) = observed.iter().find(|ty| !auxiliary.contains(**ty)) { + return Err(format!( + "nested_induction names `{extra}`, which is not a member of the recursive family of `{}`", + family[0] + )); + } + return Err(format!( + "nested_induction members are out of order: the pinned Lean's recursor takes them as {}", + auxiliary + .iter() + .map(|ty| format!("`{ty}`")) + .collect::>() + .join(", ") + )); + } + // The induction eliminates the scrutinee, so no proposition and no branch + // can name it. + let mut scope = locals.clone(); + scope.remove(scrutinee); + let mut binders = BTreeSet::new(); + for member in members { + check_name(&member.binder, "nested_induction member binder")?; + if !binders.insert(member.binder.as_str()) { + return Err(format!( + "nested_induction member binder `{}` is used by two members", + member.binder + )); + } + let mut motive_scope = scope.clone(); + if motive_scope + .insert(member.binder.clone(), member.r#type.clone()) + .is_some() + { + return Err(format!( + "nested_induction member binder `{}` shadows a theorem parameter", + member.binder + )); + } + let names: BTreeSet = motive_scope.keys().cloned().collect(); + check_term(&member.statement, &names, env, None, &BTreeSet::new())?; + require_type( + infer_term(&member.statement, &motive_scope, env)?, + &SemanticType::Prop, + &format!("nested_induction proposition for `{}`", member.r#type), + )?; + } + check_nested_branches( + &family[0], + branches, + &nested_branch_types(&family[0], &family, env), + &scope, + env, + )?; + for member in members { + check_nested_branches( + &member.r#type, + &member.branches, + &nested_branch_types(&member.r#type, &family, env), + &scope, + env, + )?; + } + Ok(()) +} + fn check_elimination_proof( scrutinee: &str, branches: &[SemanticProofBranch], @@ -8910,9 +9290,18 @@ fn elimination_binder_types( )); } if induction && env.language_1_2 && info.nested_or_mutual { - return Err(format!( - "induction on `{scrutinee}` requires a self-recursive inductive without nested or mutual occurrences; use cases" - )); + // A nested type in no mutual group has a recursor of its own + // to induct over; a mutual group has none that a proof form + // names (§16.9, `SM-37`). + return Err(if info.group.len() == 1 { + format!( + "induction on `{scrutinee}` requires a self-recursive inductive without nested or mutual occurrences; its type holds itself under a container, so use nested_induction (or cases)" + ) + } else { + format!( + "induction on `{scrutinee}` requires a self-recursive inductive without nested or mutual occurrences; use cases" + ) + }); } let substitutions = substitutions(info, arguments); info.constructor_types @@ -9820,6 +10209,10 @@ fn check_theorem( &SemanticType::Prop, &format!("theorem `{name}` statement"), )?; + env.proof_parameters = parameters + .iter() + .map(|parameter| parameter.name.clone()) + .collect(); check_proof(proof, &typed_locals(parameters), env)?; env.theorems.insert( name.to_owned(), diff --git a/crates/lexlean/src/ir/semantic/widen.rs b/crates/lexlean/src/ir/semantic/widen.rs index 7f496266c3..6ff9583332 100644 --- a/crates/lexlean/src/ir/semantic/widen.rs +++ b/crates/lexlean/src/ir/semantic/widen.rs @@ -20,9 +20,9 @@ use std::collections::{BTreeMap, BTreeSet}; use super::model::{CheckStatement, Elaboration}; use super::reasoning::Formula; use super::{ - branch_binder_types, elimination_binder_types, infer_term, Environment, SemanticDeclaration, - SemanticFailure, SemanticInteger, SemanticParameter, SemanticPrimitive, SemanticProof, - SemanticTerm, SemanticType, + branch_binder_types, elimination_binder_types, infer_term, nested_branch_types, nested_family, + Environment, SemanticDeclaration, SemanticFailure, SemanticInteger, SemanticParameter, + SemanticPrimitive, SemanticProof, SemanticProofBranch, SemanticTerm, SemanticType, }; type Locals = BTreeMap; @@ -218,6 +218,32 @@ fn proof( term(scrutinee, locals, env, counter)?; return Ok(()); } + SemanticProof::NestedInduction { + scrutinee, + branches, + members, + } => { + // The induction eliminates the scrutinee, so neither a + // proposition nor a branch has it in scope. + let family = nested_family(scrutinee, locals, env)?; + let mut scope = locals.clone(); + scope.remove(scrutinee.as_str()); + nested_branches(&family[0], branches, &family, &scope, env, counter)?; + for member in members { + let mut motive = scope.clone(); + motive.insert(member.binder.clone(), member.r#type.clone()); + term(&mut member.statement, &motive, env, counter)?; + nested_branches( + &member.r#type, + &mut member.branches, + &family, + &scope, + env, + counter, + )?; + } + return Ok(()); + } SemanticProof::Constructor { branches } => { for branch in branches { self::proof(branch, locals, env, counter)?; @@ -247,6 +273,44 @@ fn proof( Ok(()) } +/// Elaborate the branches of one member of a `nested_induction` proof, and put +/// them in the order of the constructors of the member. The Lean the proof +/// lowers to names the goals of the recursor by position (the constructors of +/// two members can share a name, which `induction ... with` refuses), so the +/// elaboration carries each member's branches in the order of its minor +/// premises, whatever order the source wrote them in; the source keeps its own +/// order. +fn nested_branches( + owner: &SemanticType, + branches: &mut [SemanticProofBranch], + family: &[SemanticType], + scope: &Locals, + env: &Environment<'_>, + counter: &mut State, +) -> Result<(), SemanticFailure> { + let expected = nested_branch_types(owner, family, env); + let position = |branch: &SemanticProofBranch| { + expected + .iter() + .position(|(name, _)| *name == branch.constructor) + .unwrap_or(usize::MAX) + }; + branches.sort_by_key(position); + for branch in branches { + let mut nested = scope.clone(); + if let Some((_, types)) = expected + .iter() + .find(|(name, _)| *name == branch.constructor) + { + for (binder, ty) in branch.binders.iter().zip(types) { + nested.insert(binder.clone(), ty.clone()); + } + } + self::proof(&mut branch.proof, &nested, env, counter)?; + } + Ok(()) +} + /// Elaborate every widening conversion of `term`, innermost first, under /// `locals`, the types of the locals in scope. fn term( diff --git a/crates/lexlean/src/lib.rs b/crates/lexlean/src/lib.rs index ad7fe3dc4f..dd7664959b 100644 --- a/crates/lexlean/src/lib.rs +++ b/crates/lexlean/src/lib.rs @@ -89,10 +89,10 @@ pub use ir::semantic::{ SemanticConstructor as SnapshotConstructor, SemanticDeclaration as SnapshotSemanticDeclaration, SemanticEdge as SnapshotEdge, SemanticField as SnapshotField, SemanticInteger as SnapshotInteger, SemanticMapEntry as SnapshotMapEntry, - SemanticModule as SnapshotSemanticModule, SemanticParameter as SnapshotParameter, - SemanticPrimitive as SnapshotPrimitive, SemanticProduction as SnapshotProduction, - SemanticProof as SnapshotProof, SemanticProofBranch as SnapshotProofBranch, - SemanticReflection as SnapshotReflection, + SemanticModule as SnapshotSemanticModule, SemanticNestedMember as SnapshotNestedMember, + SemanticParameter as SnapshotParameter, SemanticPrimitive as SnapshotPrimitive, + SemanticProduction as SnapshotProduction, SemanticProof as SnapshotProof, + SemanticProofBranch as SnapshotProofBranch, SemanticReflection as SnapshotReflection, SemanticReflectionComparison as SnapshotReflectionComparison, SemanticReflectionField as SnapshotReflectionField, SemanticTerm as SnapshotTerm, SemanticTermination as SnapshotTermination, SemanticType as SnapshotType, diff --git a/examples/nested-induction/README.md b/examples/nested-induction/README.md new file mode 100644 index 0000000000..e7b8e14d16 --- /dev/null +++ b/examples/nested-induction/README.md @@ -0,0 +1,10 @@ +# nested-induction + +Language-1.2 induction over a nested inductive type: a `Json` value that holds a `List` of itself and a `List` of pairs that end in itself, mutual structural `size` and `leaves` groups over the four members of its recursive family, and `leaves_le_size`, proved by `nested_induction` with `linear_arithmetic` in each of its nine branches. + +- **Language:** 1.2. **Source modules:** 1 under `src/`. +- **Register rows whose gates run on it** (`model/ids.toml`, level `build`): `SM-37`, `DF-19`, and `EX-08` (every example is discovered and must pass the full example gate). +- **What is claimed.** `cargo xtask verify-examples` formats, locks, checks and builds the project, verifies it under the pinned `leanprover/lean4:v4.32.1` (elaboration, `leanchecker` replay, exact axiom audit), and compares its build outputs and normalized verification records with `expected/` byte for byte (SPEC.md §28.6, §28.3, §29.5). The theorem is lowered to `induction value using Json.rec` with the propositions of the three auxiliary members as its motives, and its nine goals are named by position. +- **What is not claimed.** Nothing beyond what the rows above and the statements in `src/` say. +- **Run.** From this directory, with the `lexlean` binary and the pinned toolchain installed: `lexlean check` and `lexlean verify`. The comparison with `expected/` is the gate's: `cargo xtask verify-examples` from the repository root. +- **Titles.** The module is titled “Natural number addition”, carried over from the literal example; #251 retitles the examples that carry it. diff --git a/examples/nested-induction/lake-manifest.json b/examples/nested-induction/lake-manifest.json new file mode 100644 index 0000000000..2b697c022e --- /dev/null +++ b/examples/nested-induction/lake-manifest.json @@ -0,0 +1,6 @@ +{"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": [], + "name": "nested_induction_host", + "lakeDir": ".lake", + "fixedToolchain": false} diff --git a/examples/nested-induction/lakefile.toml b/examples/nested-induction/lakefile.toml new file mode 100644 index 0000000000..4b5344b730 --- /dev/null +++ b/examples/nested-induction/lakefile.toml @@ -0,0 +1,2 @@ +name = "nested_induction_host" +version = "0.1.0" diff --git a/examples/nested-induction/lean-toolchain b/examples/nested-induction/lean-toolchain new file mode 100644 index 0000000000..2b61957be5 --- /dev/null +++ b/examples/nested-induction/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.32.1 diff --git a/examples/nested-induction/lexlean.lock b/examples/nested-induction/lexlean.lock new file mode 100644 index 0000000000..936269591f --- /dev/null +++ b/examples/nested-induction/lexlean.lock @@ -0,0 +1,47 @@ +spec = "lexlean/lock/2" +language = "1.2" +compiler_semantics = "81a5f530241bed4ca42585e2345d91be731fe46121284fbe4c199ea356489b10" +project_config_sha256 = "c7c9eb0c9422b501f5f1922e32c3624307cb0e7a3848adb1351be3a064af5659" +lean_toolchain = "leanprover/lean4:v4.32.1" + +[[workspace_file]] +path = "lake-manifest.json" +sha256 = "076c2dd3c4f4149bb126d34a1a1538e265c7609c58920faa9bc19223168a2015" + +[[workspace_file]] +path = "lakefile.toml" +sha256 = "4fb32105b02352c7775ecaf594bb852f05b4dfc2b03f77c27ab6fa2dc1ac6827" + +[[workspace_file]] +path = "lean-toolchain" +sha256 = "8e3538e0ab5f81a3ee04927d8838c8c674e0e112838b4b3ce87ec218143276af" + +[[package]] +id = "lexlean.core" +version = "1.2.0" +kind = "builtin" +source = "embedded" +revision = "compiler-semantics" +tree_sha256 = "827317cae68c162f3a96c8a8de4e53ab348e7d3724fd2b834fa85ecde1a1b392" +manifest_sha256 = "271079763d269cc873531f515e56da960cd6321393b9460ff0e617666fa01d71" +imports = [] + +[[package]] +id = "lexlean.std.bool" +version = "1.2.0" +kind = "builtin" +source = "embedded" +revision = "compiler-semantics" +tree_sha256 = "3bc0fb09d706ffa7d5a1363302ea87c049acc7c7dcafde63c62682620c11be9b" +manifest_sha256 = "de58de2cf18a7a5a62d8c20649139d6dfe1f7b16b3130c75f150fbac5440a71e" +imports = ["lexlean.core@1.2.0"] + +[[package]] +id = "lexlean.std.nat" +version = "1.2.0" +kind = "builtin" +source = "embedded" +revision = "compiler-semantics" +tree_sha256 = "e0db021e01b91d651c43921d66f6b0023c8efbf17cac2ec53192ce5305e4e1ac" +manifest_sha256 = "6fb446b39e3c1c18a5f10cfa1f7aa2bd431837719eb0eb7489aadf452c9420a7" +imports = ["lexlean.core@1.2.0", "lexlean.std.bool@1.2.0"] diff --git a/examples/nested-induction/lexlean.toml b/examples/nested-induction/lexlean.toml new file mode 100644 index 0000000000..40c872c6d9 --- /dev/null +++ b/examples/nested-induction/lexlean.toml @@ -0,0 +1,27 @@ +spec = "lexlean/project/1" +name = "nested-induction" +language = "1.2" +module_prefix = "NestedInduction" +source_roots = ["src"] +entrypoints = ["src/Main.lex.tex"] +build_root = ".lexlean" +lockfile = "lexlean.lock" +lean_workspace = "." +lean_toolchain = "leanprover/lean4:v4.32.1" + +[[lexicon_source]] +package = "lexlean.std.nat" +kind = "builtin" + +[limits] +max_file_bytes = 4194304 +max_total_source_bytes = 67108864 +max_primitive_atoms = 2000000 +max_token_lattice_edges = 4000000 +max_parse_states = 4000000 +max_ir_nodes = 2000000 +max_scope_depth = 1024 +max_import_depth = 128 +max_diagnostics = 256 +max_child_output_bytes = 16777216 +child_timeout_ms = 300000 diff --git a/examples/nested-induction/src/Main.lex.tex b/examples/nested-induction/src/Main.lex.tex new file mode 100644 index 0000000000..7b3d09a435 --- /dev/null +++ b/examples/nested-induction/src/Main.lex.tex @@ -0,0 +1,177 @@ +\begin{lexlean}{Main} +\useglossary{lexlean.std.nat@1.2.0} +\title{Natural number addition} +\begin{semanticmodule} +inductive{ + name: Json, + type_parameters: [], + parameters: [], + constructors: [ + {name: null, fields: []}, + {name: text, fields: [String]}, + {name: array, fields: [(List Json)]}, + {name: object, fields: [(List (String * Json))]} + ] +} + +definition{ + name: size, + parameters: [value : Json], + result: Nat, + body: (match value + | Json.null => 1 + | Json.text content => 1 + | Json.array items => (1 + (sizeList items)) + | Json.object entries => (1 + (sizeEntries entries))), + mutual: Size, + recursive_argument: value +} + +definition{ + name: sizeList, + parameters: [items : (List Json)], + result: Nat, + body: (match items | List.nil => 0 | List.cons head tail => ((size head) + (sizeList tail))), + mutual: Size, + recursive_argument: items +} + +definition{ + name: sizeEntries, + parameters: [entries : (List (String * Json))], + result: Nat, + body: (match entries + | List.nil => 0 + | List.cons head tail => ((sizeEntry head) + (sizeEntries tail))), + mutual: Size, + recursive_argument: entries +} + +definition{ + name: sizeEntry, + parameters: [entry : (String * Json)], + result: Nat, + body: (match entry | Prod.mk key value => (size value)), + mutual: Size, + recursive_argument: entry +} + +definition{ + name: leaves, + parameters: [value : Json], + result: Nat, + body: (match value + | Json.null => 1 + | Json.text content => 1 + | Json.array items => (leavesList items) + | Json.object entries => (leavesEntries entries)), + mutual: Leaves, + recursive_argument: value +} + +definition{ + name: leavesList, + parameters: [items : (List Json)], + result: Nat, + body: (match items | List.nil => 0 | List.cons head tail => ((leaves head) + (leavesList tail))), + mutual: Leaves, + recursive_argument: items +} + +definition{ + name: leavesEntries, + parameters: [entries : (List (String * Json))], + result: Nat, + body: (match entries + | List.nil => 0 + | List.cons head tail => ((leavesEntry head) + (leavesEntries tail))), + mutual: Leaves, + recursive_argument: entries +} + +definition{ + name: leavesEntry, + parameters: [entry : (String * Json)], + result: Nat, + body: (match entry | Prod.mk key value => (leaves value)), + mutual: Leaves, + recursive_argument: entry +} + +theorem{ + name: leaves_le_size, + parameters: [value : Json], + statement: ((leaves value) <= (size value)), + proof: nested_induction{ + branches: [ + {proof: linear_arithmetic{definitions: [leaves, size]}, binders: [], constructor: null}, + { + proof: linear_arithmetic{definitions: [leaves, size]}, + binders: [content], + constructor: text + }, + { + proof: linear_arithmetic{definitions: [leaves, size]}, + binders: [items, itemsHypothesis], + constructor: array + }, + { + proof: linear_arithmetic{definitions: [leaves, size]}, + binders: [entries, entriesHypothesis], + constructor: object + } + ], + members: [ + { + type: (List Json), + statement: ((leavesList items) <= (sizeList items)), + binder: items, + branches: [ + { + proof: linear_arithmetic{definitions: [leavesList, sizeList]}, + binders: [], + constructor: nil + }, + { + proof: linear_arithmetic{definitions: [leavesList, sizeList]}, + binders: [head, tail, headHypothesis, tailHypothesis], + constructor: cons + } + ] + }, + { + type: (List (String * Json)), + statement: ((leavesEntries entries) <= (sizeEntries entries)), + binder: entries, + branches: [ + { + proof: linear_arithmetic{definitions: [leavesEntries, sizeEntries]}, + binders: [], + constructor: nil + }, + { + proof: linear_arithmetic{definitions: [leavesEntries, sizeEntries]}, + binders: [head, tail, headHypothesis, tailHypothesis], + constructor: cons + } + ] + }, + { + type: (String * Json), + statement: ((leavesEntry entry) <= (sizeEntry entry)), + binder: entry, + branches: [ + { + proof: linear_arithmetic{definitions: [leavesEntry, sizeEntry]}, + binders: [key, content, contentHypothesis], + constructor: mk + } + ] + } + ], + scrutinee: value + }, + axioms: [Quot.sound, propext] +} +\end{semanticmodule} +\end{lexlean} diff --git a/features/suites/semantic-ir.feature b/features/suites/semantic-ir.feature index 0a4c8c3332..70c3973f81 100644 --- a/features/suites/semantic-ir.feature +++ b/features/suites/semantic-ir.feature @@ -259,8 +259,8 @@ Feature: semantic-ir And each planted project is refused naming the misuse @SM-37 @build - Scenario: A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. + Scenario: A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. Given a language-1.2 project whose type holds a `List` of itself and a `List` of pairs that end in itself, whose mutual definition groups range over its recursive family, and whose theorem over every value of the type is proved by `nested_induction`, and the planted projects that misuse the form When the project is linked, built, and verified by the pinned Lean, its formatted source and its LaTeX are read back, and each planted project is linked - Then the generated Lean induces over the recursor the pinned Lean generates for the type, with the goals in the order of its minor premises, and the theorem verifies with exactly the axioms its policy states and the formatter writes the proof unchanged + Then the generated Lean induces over the recursor the pinned Lean generates for the type, with the goals in the order of its minor premises, and the theorem verifies with exactly the axioms `propext` and `Quot.sound` and the formatter writes the proof unchanged And each planted project is refused as LLT4001 naming the misuse, and no backend output is written diff --git a/language/semantics-1.2.toml b/language/semantics-1.2.toml index 4f42e26a56..2e4c48c5cf 100644 --- a/language/semantics-1.2.toml +++ b/language/semantics-1.2.toml @@ -10,8 +10,8 @@ rust_backend = "4" rust_runtime_core = "f3c11eef9db0785d5d20c987c971a7b4fc5f6d187f60082f8982d3d33dd76408" rust_renderer = "2a5cc3d820d9fe9158f583a622c91bc86849a74e73954c6d288f3b66e529f40f" rust_runtime_std = "535d96995ba72b67f8022ac3bdf560520221313843b9d5d36065ed6b8ad4cbad" -semantic_ir = "15" +semantic_ir = "16" semantic_snapshot = "2" -proof_lowering = "3" +proof_lowering = "4" axiom_parser = "lean-4.32.1/2" canonical_json = "1" diff --git a/model/ids.toml b/model/ids.toml index 1759e21190..c3e4a89d03 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -719,7 +719,7 @@ statement = "A language-1.2 `cases` proof may split a local of type `Bool` into id = "SM-37" level = "build" suite = "semantic-ir" -statement = "A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean with exactly the axioms its policy states; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001." +statement = "A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001." [[id]] id = "DF-01" diff --git a/schemas/semantic-module-v2.schema.json b/schemas/semantic-module-v2.schema.json index 9eb1d31442..eaedbaed52 100644 --- a/schemas/semantic-module-v2.schema.json +++ b/schemas/semantic-module-v2.schema.json @@ -1 +1 @@ -{"$defs":{"artifactSchema":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"bytes"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"int_tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"utf8_lines"}},"required":["kind"],"type":"object"}]},"assignment":{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/name"},"value":{"$ref":"#/$defs/term"}},"required":["field","value"],"type":"object"},"branch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/term"},"constructor":{"$ref":"#/$defs/member"}},"required":["binders","body","constructor"],"type":"object"},"claim":{"oneOf":[{"additionalProperties":false,"properties":{"agreements":{"minimum":0,"type":"integer"},"comparison":{"$ref":"#/$defs/member"},"comparison_sound":{"$ref":"#/$defs/member"},"dataset":{"$ref":"#/$defs/member"},"examples":{"minimum":0,"type":"integer"},"kind":{"const":"dataset_agreement"},"theorem":{"$ref":"#/$defs/member"}},"required":["agreements","comparison","comparison_sound","dataset","examples","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"equivalent_to"},"reference":{"$ref":"#/$defs/modelUse"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","reference","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"preserves_invariant"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"satisfies_contract"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"}]},"compositeForm":{"oneOf":[{"additionalProperties":false,"properties":{"junctions":{"items":{"$ref":"#/$defs/compositeJunction"},"minItems":1,"type":"array"},"kind":{"const":"sequence"},"stages":{"items":{"$ref":"#/$defs/modelUse"},"minItems":2,"type":"array"}},"required":["junctions","kind","stages"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"fanout"},"left":{"$ref":"#/$defs/modelUse"},"right":{"$ref":"#/$defs/modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/modelUse"},"right":{"$ref":"#/$defs/modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"else":{"$ref":"#/$defs/modelUse"},"guard":{"$ref":"#/$defs/term"},"kind":{"const":"branch"},"then":{"$ref":"#/$defs/modelUse"}},"required":["else","guard","kind","then"],"type":"object"},{"additionalProperties":false,"properties":{"junction":{"$ref":"#/$defs/compositeJunction"},"kind":{"const":"scan"},"stage":{"$ref":"#/$defs/modelUse"}},"required":["junction","kind","stage"],"type":"object"}]},"compositeJunction":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"unconditional"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"evidence":{"$ref":"#/$defs/member"},"kind":{"const":"proved"}},"required":["evidence","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"checked"}},"required":["kind"],"type":"object"}]},"constructor":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/type"},"type":"array"},"name":{"$ref":"#/$defs/name"}},"required":["fields","name"],"type":"object"},"contractState":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"next":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","next","type"],"type":"object"},"contractValidator":{"additionalProperties":false,"properties":{"complete":{"$ref":"#/$defs/member"},"predicate":{"enum":["invariant","postcondition","precondition"]},"sound":{"$ref":"#/$defs/member"},"validator":{"$ref":"#/$defs/member"}},"required":["predicate","sound","validator"],"type":"object"},"declaration":{"oneOf":[{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/field"},"minItems":1,"type":"array"},"kind":{"const":"structure"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/field"},"minItems":1,"type":"array"},"kind":{"const":"class"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"},"class":{"$ref":"#/$defs/member"},"fields":{"items":{"$ref":"#/$defs/assignment"},"minItems":1,"type":"array"},"kind":{"const":"instance"},"name":{"$ref":"#/$defs/name"},"priority":{"const":1000}},"required":["arguments","class","fields","kind","name","priority"],"type":"object"},{"additionalProperties":false,"properties":{"constructors":{"items":{"$ref":"#/$defs/constructor"},"minItems":1,"type":"array"},"kind":{"const":"inductive"},"mutual":{"$ref":"#/$defs/name"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["constructors","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/term"},"executable":{"type":"boolean"},"kind":{"const":"definition"},"mutual":{"$ref":"#/$defs/name"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"production":{"$ref":"#/$defs/production"},"recursive_argument":{"$ref":"#/$defs/name"},"result":{"$ref":"#/$defs/type"},"termination":{"additionalProperties":false,"properties":{"evidence":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array"},"measure":{"$ref":"#/$defs/term"}},"required":["evidence","measure"],"type":"object"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["body","kind","name","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"theorem"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"proof":{"$ref":"#/$defs/proof"},"statement":{"$ref":"#/$defs/term"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["kind","name","parameters","proof","statement"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"artifact"},"length":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/name"},"role":{"enum":["binary","dataset","parameters","table","vocabulary"]},"schema":{"$ref":"#/$defs/artifactSchema"},"sha256":{"pattern":"^[0-9a-f]{64}$","type":"string"},"type":{"$ref":"#/$defs/type"}},"required":["kind","length","name","role","schema","sha256","type"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"input":{"$ref":"#/$defs/modelBinder"},"invariant":{"$ref":"#/$defs/member"},"kind":{"const":"contract"},"name":{"$ref":"#/$defs/name"},"output":{"$ref":"#/$defs/modelBinder"},"postcondition":{"$ref":"#/$defs/member"},"precondition":{"$ref":"#/$defs/member"},"state":{"$ref":"#/$defs/contractState"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"validators":{"items":{"$ref":"#/$defs/contractValidator"},"type":"array"}},"required":["input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"descriptor":{"$ref":"#/$defs/descriptor"},"executable":{"type":"boolean"},"input":{"$ref":"#/$defs/modelBinder"},"kind":{"const":"realization"},"name":{"$ref":"#/$defs/name"},"output":{"$ref":"#/$defs/type"},"state":{"$ref":"#/$defs/realizationState"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["descriptor","input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/claim"},"minItems":1,"type":"array"},"contract":{"$ref":"#/$defs/modelUse"},"kind":{"const":"evidence"},"name":{"$ref":"#/$defs/name"},"realization":{"$ref":"#/$defs/modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["claims","contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"contract":{"$ref":"#/$defs/modelUse"},"entry":{"items":{"$ref":"#/$defs/member"},"type":"array"},"evidence":{"items":{"$ref":"#/$defs/modelUse"},"type":"array"},"kind":{"const":"model"},"name":{"$ref":"#/$defs/name"},"realization":{"$ref":"#/$defs/modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"invariant":{"$ref":"#/$defs/logicInvariant"},"kind":{"const":"logic"},"name":{"$ref":"#/$defs/name"},"ranking":{"$ref":"#/$defs/member"},"relation":{"$ref":"#/$defs/member"},"state":{"$ref":"#/$defs/contractState"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["kind","name","relation","state"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"binding":{"$ref":"#/$defs/ruleBinding"},"conclusion":{"$ref":"#/$defs/term"},"executable":{"type":"boolean"},"guard":{"$ref":"#/$defs/term"},"kind":{"const":"inference_rule"},"logic":{"$ref":"#/$defs/modelUse"},"name":{"$ref":"#/$defs/name"},"progress":{"$ref":"#/$defs/member"},"soundness":{"$ref":"#/$defs/member"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["conclusion","guard","kind","logic","name","soundness"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"candidate":{"$ref":"#/$defs/modelBinder"},"check":{"$ref":"#/$defs/member"},"complete":{"$ref":"#/$defs/member"},"kind":{"const":"verifier"},"name":{"$ref":"#/$defs/name"},"sound":{"$ref":"#/$defs/member"},"specification":{"$ref":"#/$defs/member"},"subject":{"$ref":"#/$defs/modelBinder"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["candidate","check","kind","name","sound","specification","subject"],"type":"object"},{"additionalProperties":false,"properties":{"answer":{"$ref":"#/$defs/reasoningAnswer"},"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/reasoningClaim"},"type":"array"},"executable":{"type":"boolean"},"kind":{"const":"reasoner"},"logic":{"$ref":"#/$defs/modelUse"},"name":{"$ref":"#/$defs/name"},"observation":{"$ref":"#/$defs/modelBinder"},"observe":{"$ref":"#/$defs/term"},"rules":{"items":{"$ref":"#/$defs/modelUse"},"type":"array"},"strategy":{"$ref":"#/$defs/reasoningStrategy"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"verifier":{"$ref":"#/$defs/modelUse"}},"required":["kind","name","observation","rules","strategy","verifier"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"tokenizer"},"name":{"$ref":"#/$defs/name"},"scheme":{"enum":["byte_level","longest_match"]},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"vocabulary":{"$ref":"#/$defs/modelUse"}},"required":["kind","name","scheme","vocabulary"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"capacity":{"minimum":0,"type":"integer"},"kind":{"const":"context_window"},"name":{"$ref":"#/$defs/name"},"overflow":{"enum":["refuse","keep_last"]}},"required":["capacity","kind","name","overflow"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"text_generator"},"max_tokens":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/name"},"policy":{"$ref":"#/$defs/generationPolicy"},"scorer":{"$ref":"#/$defs/modelUse"},"stop":{"$ref":"#/$defs/member"},"tokenizer":{"$ref":"#/$defs/member"},"window":{"$ref":"#/$defs/member"}},"required":["kind","max_tokens","name","policy","scorer","stop","tokenizer","window"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"text_classifier"},"model":{"$ref":"#/$defs/modelUse"},"name":{"$ref":"#/$defs/name"},"tokenizer":{"$ref":"#/$defs/member"}},"required":["kind","model","name","tokenizer"],"type":"object"}]},"descriptor":{"oneOf":[{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/term"},"kind":{"const":"deterministic"}},"required":["body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"default":{"$ref":"#/$defs/term"},"kind":{"const":"rule"},"rules":{"items":{"$ref":"#/$defs/realizationRule"},"minItems":1,"type":"array"}},"required":["default","kind","rules"],"type":"object"},{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/member"},"features":{"$ref":"#/$defs/term"},"kind":{"const":"statistical"},"labels":{"items":{"$ref":"#/$defs/term"},"minItems":1,"type":"array"},"scheme":{"const":"linear_scoring"},"weights":{"$ref":"#/$defs/member"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/member"}},"required":["bias","features","kind","labels","scheme","weights","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"architecture":{"const":"integer_feedforward"},"decoder":{"$ref":"#/$defs/neuralDecoder"},"encoder":{"$ref":"#/$defs/term"},"kind":{"const":"neural"},"layers":{"items":{"$ref":"#/$defs/neuralLayer"},"minItems":1,"type":"array"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/member"}},"required":["architecture","decoder","encoder","kind","layers","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"form":{"$ref":"#/$defs/compositeForm"},"kind":{"const":"composite"}},"required":["form","kind"],"type":"object"}]},"field":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","type"],"type":"object"},"generationPolicy":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"greedy"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"distribution":{"enum":["proportional"]},"generator":{"enum":["xorshift32"]},"kind":{"const":"sample"}},"required":["distribution","generator","kind"],"type":"object"}]},"logicInvariant":{"additionalProperties":false,"properties":{"predicate":{"$ref":"#/$defs/member"},"preserves":{"$ref":"#/$defs/member"}},"required":["predicate","preserves"],"type":"object"},"member":{"additionalProperties":false,"properties":{"module":{"$ref":"#/$defs/name"},"name":{"$ref":"#/$defs/name"}},"required":["name"],"type":"object"},"modelBinder":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","type"],"type":"object"},"modelUse":{"additionalProperties":false,"properties":{"member":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["member"],"type":"object"},"name":{"pattern":"^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)*$","type":"string"},"neuralDecoder":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"argmax"},"labels":{"items":{"$ref":"#/$defs/term"},"minItems":1,"type":"array"}},"required":["kind","labels"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/name"},"body":{"$ref":"#/$defs/term"},"kind":{"const":"function"}},"required":["binder","body","kind"],"type":"object"}]},"neuralLayer":{"oneOf":[{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/member"},"inputs":{"minimum":1,"type":"integer"},"kind":{"const":"dense"},"outputs":{"minimum":1,"type":"integer"},"weights":{"$ref":"#/$defs/member"}},"required":["bias","inputs","kind","outputs","weights"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"relu"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"requantize"},"maximum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"minimum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"shift":{"maximum":4096,"minimum":0,"type":"integer"}},"required":["kind","maximum","minimum","shift"],"type":"object"}]},"parameter":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","type"],"type":"object"},"production":{"additionalProperties":false,"properties":{"effects":{"items":{"enum":["allocation","overflow","recursion"]},"type":"array","uniqueItems":true},"targets":{"items":{"enum":["rust-core","rust-std"]},"minItems":1,"type":"array","uniqueItems":true}},"required":["effects","targets"],"type":"object"},"proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"reflexivity"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"simplify"}},"required":["definitions","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/proof"},"minItems":1,"type":"array"},"kind":{"const":"constructor"}},"required":["branches","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"cases"},"scrutinee":{"$ref":"#/$defs/name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/proofBranch"},"minItems":1,"type":"array"},"generalizing":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"induction"},"scrutinee":{"$ref":"#/$defs/name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"congruence"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"boolean_reflection"},"reflection":{"$ref":"#/$defs/reflection"}},"required":["kind","reflection"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"law"},"name":{"$ref":"#/$defs/name"},"premises":{"items":{"$ref":"#/$defs/member"},"type":"array"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"apply"},"theorem":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"linear_arithmetic"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"term_cases"},"scrutinee":{"$ref":"#/$defs/term"}},"required":["definitions","kind","scrutinee"],"type":"object"}]},"proofBranch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"constructor":{"$ref":"#/$defs/name"},"proof":{"$ref":"#/$defs/proof"}},"required":["binders","constructor","proof"],"type":"object"},"realizationRule":{"additionalProperties":false,"properties":{"action":{"$ref":"#/$defs/term"},"guard":{"$ref":"#/$defs/term"},"name":{"$ref":"#/$defs/name"}},"required":["action","guard","name"],"type":"object"},"realizationState":{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/term"},"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["initial","name","type"],"type":"object"},"reasoningAnswer":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"},"value":{"$ref":"#/$defs/term"}},"required":["name","type","value"],"type":"object"},"reasoningClaim":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"answer_correct"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/member"},"kind":{"const":"observation_invariant"},"predicate":{"$ref":"#/$defs/member"},"preserved":{"$ref":"#/$defs/member"}},"required":["initial","kind","predicate","preserved"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"terminates"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"}]},"reasoningStrategy":{"oneOf":[{"additionalProperties":false,"properties":{"fuel":{"$ref":"#/$defs/term"},"kind":{"const":"forward"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"budget":{"$ref":"#/$defs/term"},"generator":{"$ref":"#/$defs/term"},"kind":{"const":"generate_and_verify"}},"required":["generator","kind"],"type":"object"},{"additionalProperties":false,"properties":{"deduplicate":{"type":"boolean"},"frontier":{"$ref":"#/$defs/term"},"fuel":{"$ref":"#/$defs/term"},"kind":{"const":"search"},"order":{"enum":["breadth_first","depth_first"]}},"required":["kind","order"],"type":"object"}]},"reflection":{"oneOf":[{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/member"},"comparison":{"$ref":"#/$defs/reflectionComparison"},"kind":{"const":"list"},"parameter":{"$ref":"#/$defs/name"},"proposition_definition":{"$ref":"#/$defs/member"},"values":{"$ref":"#/$defs/name"}},"required":["boolean_definition","comparison","kind","parameter","proposition_definition","values"],"type":"object"},{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/member"},"fields":{"items":{"$ref":"#/$defs/reflectionField"},"minItems":1,"type":"array"},"kind":{"const":"record"},"proposition_definition":{"$ref":"#/$defs/member"},"record":{"$ref":"#/$defs/name"}},"required":["boolean_definition","fields","kind","proposition_definition","record"],"type":"object"}]},"reflectionComparison":{"enum":["nat_beq","nat_blt"]},"reflectionField":{"additionalProperties":false,"properties":{"expected":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]},"field":{"$ref":"#/$defs/name"}},"required":["expected","field"],"type":"object"},"ruleBinding":{"additionalProperties":false,"properties":{"candidates":{"$ref":"#/$defs/term"},"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["candidates","name","type"],"type":"object"},"term":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"var"},"name":{"$ref":"#/$defs/name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"nat"},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"bool"},"value":{"type":"boolean"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["int","int8","int16","int32","int64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["uint8","uint16","uint32","uint64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"},"kind":{"const":"bytes"}},"required":["hex","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"primitive"},"operation":{"enum":["append","bit_and","bit_not","bit_or","bit_xor","checked_add","checked_convert","checked_multiply","checked_negate","checked_quotient","checked_subtract","compare_bytes","equal","format_decimal","graph_reachable","graph_successors","graph_topological","index","iterate","iterate_until","join","length","less_than","list_fold","map_contains","map_entries","map_fold","map_insert","map_keys","map_lookup","map_remove","map_size","map_values","multiply","negate","parse_decimal","quotient","remainder","set_contains","set_difference","set_elements","set_fold","set_insert","set_intersection","set_remove","set_size","set_union","shift_left","shift_right","slice","split_exact","subtract","to_int","to_nat","utf8_decode","utf8_encode"]},"result":{"$ref":"#/$defs/type"}},"required":["arguments","kind","operation","result"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"unit"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"kind":{"const":"nil"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"head":{"$ref":"#/$defs/term"},"kind":{"const":"cons"},"tail":{"$ref":"#/$defs/term"}},"required":["head","kind","tail"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/assignment"},"type":"array"},"kind":{"const":"record"},"type":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["fields","kind","type"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"constructor":{"$ref":"#/$defs/member"},"kind":{"const":"constructor"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","constructor","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"},"class":{"$ref":"#/$defs/member"},"kind":{"const":"instance_value"},"resolved":{"$ref":"#/$defs/member"}},"required":["arguments","class","kind","resolved"],"type":"object"},{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/name"},"kind":{"const":"project"},"value":{"$ref":"#/$defs/term"}},"required":["field","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"function":{"$ref":"#/$defs/member"},"kind":{"const":"call"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"condition":{"$ref":"#/$defs/term"},"else_value":{"$ref":"#/$defs/term"},"kind":{"const":"if"},"then_value":{"$ref":"#/$defs/term"}},"required":["condition","else_value","kind","then_value"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/branch"},"minItems":1,"type":"array"},"kind":{"const":"match"},"scrutinee":{"$ref":"#/$defs/term"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"eq"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"le"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"lt"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"add"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"beq"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"ble"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"blt"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"iff"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/term"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/term"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"not"},"value":{"$ref":"#/$defs/term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/parameter"},"body":{"$ref":"#/$defs/term"},"kind":{"const":"forall"}},"required":["binder","body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"prop_and"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/parameter"},"body":{"$ref":"#/$defs/term"},"kind":{"const":"let"},"value":{"$ref":"#/$defs/term"}},"required":["binder","body","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"pair"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"first"},"value":{"$ref":"#/$defs/term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"second"},"value":{"$ref":"#/$defs/term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/term"},"captures":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"lambda"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"minItems":1,"type":"array"}},"required":["body","captures","kind","parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"minItems":1,"type":"array"},"function":{"$ref":"#/$defs/term"},"kind":{"const":"apply"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"function":{"$ref":"#/$defs/member"},"kind":{"const":"function_ref"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"entries":{"items":{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/term"},"value":{"$ref":"#/$defs/term"}},"required":["key","value"],"type":"object"},"type":"array"},"key":{"$ref":"#/$defs/type"},"kind":{"const":"map_literal"},"value":{"$ref":"#/$defs/type"}},"required":["entries","key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"elements":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"set_literal"}},"required":["element","elements","kind"],"type":"object"},{"additionalProperties":false,"properties":{"edges":{"items":{"additionalProperties":false,"properties":{"source":{"$ref":"#/$defs/term"},"target":{"$ref":"#/$defs/term"}},"required":["source","target"],"type":"object"},"type":"array"},"kind":{"const":"graph_literal"},"node":{"$ref":"#/$defs/type"},"nodes":{"items":{"$ref":"#/$defs/term"},"type":"array"}},"required":["edges","kind","node","nodes"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array","uniqueItems":true},"kind":{"const":"checked_apply"},"model":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","checks","kind","model"],"type":"object"}]},"type":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"enum":["bool","bytes","int","int8","int16","int32","int64","nat","ordering","prop","string","type","uint8","uint16","uint32","uint64","unit"]}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"parameter"},"name":{"$ref":"#/$defs/name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"kind":{"const":"list"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"},"kind":{"const":"named"},"member":{"$ref":"#/$defs/member"}},"required":["arguments","kind","member"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"option"},"value":{"$ref":"#/$defs/type"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"error":{"$ref":"#/$defs/type"},"kind":{"const":"result"},"ok":{"$ref":"#/$defs/type"}},"required":["error","kind","ok"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/type"},"right":{"$ref":"#/$defs/type"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"function"},"parameters":{"items":{"$ref":"#/$defs/type"},"minItems":1,"type":"array"},"result":{"$ref":"#/$defs/type"}},"required":["kind","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/type"},"kind":{"const":"map"},"value":{"$ref":"#/$defs/type"}},"required":["key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"kind":{"const":"set"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"contract_violation"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"reasoning_failure"}},"required":["kind"],"type":"object"}]}},"$id":"https://github.com/UOR-Foundation/LexLean/schemas/semantic-module-v2.schema.json","$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"declarations":{"items":{"$ref":"#/$defs/declaration"},"minItems":1,"type":"array"},"spec":{"const":"lexlean/semantic-module/2"}},"required":["declarations","spec"],"title":"LexLean language-1.2 semantic module","type":"object"} +{"$defs":{"artifactSchema":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"bytes"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"int_tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"utf8_lines"}},"required":["kind"],"type":"object"}]},"assignment":{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/name"},"value":{"$ref":"#/$defs/term"}},"required":["field","value"],"type":"object"},"branch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/term"},"constructor":{"$ref":"#/$defs/member"}},"required":["binders","body","constructor"],"type":"object"},"claim":{"oneOf":[{"additionalProperties":false,"properties":{"agreements":{"minimum":0,"type":"integer"},"comparison":{"$ref":"#/$defs/member"},"comparison_sound":{"$ref":"#/$defs/member"},"dataset":{"$ref":"#/$defs/member"},"examples":{"minimum":0,"type":"integer"},"kind":{"const":"dataset_agreement"},"theorem":{"$ref":"#/$defs/member"}},"required":["agreements","comparison","comparison_sound","dataset","examples","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"equivalent_to"},"reference":{"$ref":"#/$defs/modelUse"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","reference","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"preserves_invariant"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"satisfies_contract"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"}]},"compositeForm":{"oneOf":[{"additionalProperties":false,"properties":{"junctions":{"items":{"$ref":"#/$defs/compositeJunction"},"minItems":1,"type":"array"},"kind":{"const":"sequence"},"stages":{"items":{"$ref":"#/$defs/modelUse"},"minItems":2,"type":"array"}},"required":["junctions","kind","stages"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"fanout"},"left":{"$ref":"#/$defs/modelUse"},"right":{"$ref":"#/$defs/modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/modelUse"},"right":{"$ref":"#/$defs/modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"else":{"$ref":"#/$defs/modelUse"},"guard":{"$ref":"#/$defs/term"},"kind":{"const":"branch"},"then":{"$ref":"#/$defs/modelUse"}},"required":["else","guard","kind","then"],"type":"object"},{"additionalProperties":false,"properties":{"junction":{"$ref":"#/$defs/compositeJunction"},"kind":{"const":"scan"},"stage":{"$ref":"#/$defs/modelUse"}},"required":["junction","kind","stage"],"type":"object"}]},"compositeJunction":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"unconditional"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"evidence":{"$ref":"#/$defs/member"},"kind":{"const":"proved"}},"required":["evidence","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"checked"}},"required":["kind"],"type":"object"}]},"constructor":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/type"},"type":"array"},"name":{"$ref":"#/$defs/name"}},"required":["fields","name"],"type":"object"},"contractState":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"next":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","next","type"],"type":"object"},"contractValidator":{"additionalProperties":false,"properties":{"complete":{"$ref":"#/$defs/member"},"predicate":{"enum":["invariant","postcondition","precondition"]},"sound":{"$ref":"#/$defs/member"},"validator":{"$ref":"#/$defs/member"}},"required":["predicate","sound","validator"],"type":"object"},"declaration":{"oneOf":[{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/field"},"minItems":1,"type":"array"},"kind":{"const":"structure"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/field"},"minItems":1,"type":"array"},"kind":{"const":"class"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"},"class":{"$ref":"#/$defs/member"},"fields":{"items":{"$ref":"#/$defs/assignment"},"minItems":1,"type":"array"},"kind":{"const":"instance"},"name":{"$ref":"#/$defs/name"},"priority":{"const":1000}},"required":["arguments","class","fields","kind","name","priority"],"type":"object"},{"additionalProperties":false,"properties":{"constructors":{"items":{"$ref":"#/$defs/constructor"},"minItems":1,"type":"array"},"kind":{"const":"inductive"},"mutual":{"$ref":"#/$defs/name"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["constructors","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/term"},"executable":{"type":"boolean"},"kind":{"const":"definition"},"mutual":{"$ref":"#/$defs/name"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"production":{"$ref":"#/$defs/production"},"recursive_argument":{"$ref":"#/$defs/name"},"result":{"$ref":"#/$defs/type"},"termination":{"additionalProperties":false,"properties":{"evidence":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array"},"measure":{"$ref":"#/$defs/term"}},"required":["evidence","measure"],"type":"object"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["body","kind","name","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"theorem"},"name":{"$ref":"#/$defs/name"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"type":"array"},"proof":{"$ref":"#/$defs/proof"},"statement":{"$ref":"#/$defs/term"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["kind","name","parameters","proof","statement"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"artifact"},"length":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/name"},"role":{"enum":["binary","dataset","parameters","table","vocabulary"]},"schema":{"$ref":"#/$defs/artifactSchema"},"sha256":{"pattern":"^[0-9a-f]{64}$","type":"string"},"type":{"$ref":"#/$defs/type"}},"required":["kind","length","name","role","schema","sha256","type"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"input":{"$ref":"#/$defs/modelBinder"},"invariant":{"$ref":"#/$defs/member"},"kind":{"const":"contract"},"name":{"$ref":"#/$defs/name"},"output":{"$ref":"#/$defs/modelBinder"},"postcondition":{"$ref":"#/$defs/member"},"precondition":{"$ref":"#/$defs/member"},"state":{"$ref":"#/$defs/contractState"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"validators":{"items":{"$ref":"#/$defs/contractValidator"},"type":"array"}},"required":["input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"descriptor":{"$ref":"#/$defs/descriptor"},"executable":{"type":"boolean"},"input":{"$ref":"#/$defs/modelBinder"},"kind":{"const":"realization"},"name":{"$ref":"#/$defs/name"},"output":{"$ref":"#/$defs/type"},"state":{"$ref":"#/$defs/realizationState"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["descriptor","input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/claim"},"minItems":1,"type":"array"},"contract":{"$ref":"#/$defs/modelUse"},"kind":{"const":"evidence"},"name":{"$ref":"#/$defs/name"},"realization":{"$ref":"#/$defs/modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["claims","contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"contract":{"$ref":"#/$defs/modelUse"},"entry":{"items":{"$ref":"#/$defs/member"},"type":"array"},"evidence":{"items":{"$ref":"#/$defs/modelUse"},"type":"array"},"kind":{"const":"model"},"name":{"$ref":"#/$defs/name"},"realization":{"$ref":"#/$defs/modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"invariant":{"$ref":"#/$defs/logicInvariant"},"kind":{"const":"logic"},"name":{"$ref":"#/$defs/name"},"ranking":{"$ref":"#/$defs/member"},"relation":{"$ref":"#/$defs/member"},"state":{"$ref":"#/$defs/contractState"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["kind","name","relation","state"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"binding":{"$ref":"#/$defs/ruleBinding"},"conclusion":{"$ref":"#/$defs/term"},"executable":{"type":"boolean"},"guard":{"$ref":"#/$defs/term"},"kind":{"const":"inference_rule"},"logic":{"$ref":"#/$defs/modelUse"},"name":{"$ref":"#/$defs/name"},"progress":{"$ref":"#/$defs/member"},"soundness":{"$ref":"#/$defs/member"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["conclusion","guard","kind","logic","name","soundness"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"candidate":{"$ref":"#/$defs/modelBinder"},"check":{"$ref":"#/$defs/member"},"complete":{"$ref":"#/$defs/member"},"kind":{"const":"verifier"},"name":{"$ref":"#/$defs/name"},"sound":{"$ref":"#/$defs/member"},"specification":{"$ref":"#/$defs/member"},"subject":{"$ref":"#/$defs/modelBinder"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true}},"required":["candidate","check","kind","name","sound","specification","subject"],"type":"object"},{"additionalProperties":false,"properties":{"answer":{"$ref":"#/$defs/reasoningAnswer"},"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/reasoningClaim"},"type":"array"},"executable":{"type":"boolean"},"kind":{"const":"reasoner"},"logic":{"$ref":"#/$defs/modelUse"},"name":{"$ref":"#/$defs/name"},"observation":{"$ref":"#/$defs/modelBinder"},"observe":{"$ref":"#/$defs/term"},"rules":{"items":{"$ref":"#/$defs/modelUse"},"type":"array"},"strategy":{"$ref":"#/$defs/reasoningStrategy"},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"verifier":{"$ref":"#/$defs/modelUse"}},"required":["kind","name","observation","rules","strategy","verifier"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"tokenizer"},"name":{"$ref":"#/$defs/name"},"scheme":{"enum":["byte_level","longest_match"]},"type_parameters":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"vocabulary":{"$ref":"#/$defs/modelUse"}},"required":["kind","name","scheme","vocabulary"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"capacity":{"minimum":0,"type":"integer"},"kind":{"const":"context_window"},"name":{"$ref":"#/$defs/name"},"overflow":{"enum":["refuse","keep_last"]}},"required":["capacity","kind","name","overflow"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"text_generator"},"max_tokens":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/name"},"policy":{"$ref":"#/$defs/generationPolicy"},"scorer":{"$ref":"#/$defs/modelUse"},"stop":{"$ref":"#/$defs/member"},"tokenizer":{"$ref":"#/$defs/member"},"window":{"$ref":"#/$defs/member"}},"required":["kind","max_tokens","name","policy","scorer","stop","tokenizer","window"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"text_classifier"},"model":{"$ref":"#/$defs/modelUse"},"name":{"$ref":"#/$defs/name"},"tokenizer":{"$ref":"#/$defs/member"}},"required":["kind","model","name","tokenizer"],"type":"object"}]},"descriptor":{"oneOf":[{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/term"},"kind":{"const":"deterministic"}},"required":["body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"default":{"$ref":"#/$defs/term"},"kind":{"const":"rule"},"rules":{"items":{"$ref":"#/$defs/realizationRule"},"minItems":1,"type":"array"}},"required":["default","kind","rules"],"type":"object"},{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/member"},"features":{"$ref":"#/$defs/term"},"kind":{"const":"statistical"},"labels":{"items":{"$ref":"#/$defs/term"},"minItems":1,"type":"array"},"scheme":{"const":"linear_scoring"},"weights":{"$ref":"#/$defs/member"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/member"}},"required":["bias","features","kind","labels","scheme","weights","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"architecture":{"const":"integer_feedforward"},"decoder":{"$ref":"#/$defs/neuralDecoder"},"encoder":{"$ref":"#/$defs/term"},"kind":{"const":"neural"},"layers":{"items":{"$ref":"#/$defs/neuralLayer"},"minItems":1,"type":"array"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/member"}},"required":["architecture","decoder","encoder","kind","layers","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"form":{"$ref":"#/$defs/compositeForm"},"kind":{"const":"composite"}},"required":["form","kind"],"type":"object"}]},"field":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","type"],"type":"object"},"generationPolicy":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"greedy"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"distribution":{"enum":["proportional"]},"generator":{"enum":["xorshift32"]},"kind":{"const":"sample"}},"required":["distribution","generator","kind"],"type":"object"}]},"logicInvariant":{"additionalProperties":false,"properties":{"predicate":{"$ref":"#/$defs/member"},"preserves":{"$ref":"#/$defs/member"}},"required":["predicate","preserves"],"type":"object"},"member":{"additionalProperties":false,"properties":{"module":{"$ref":"#/$defs/name"},"name":{"$ref":"#/$defs/name"}},"required":["name"],"type":"object"},"modelBinder":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","type"],"type":"object"},"modelUse":{"additionalProperties":false,"properties":{"member":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["member"],"type":"object"},"name":{"pattern":"^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)*$","type":"string"},"nestedMember":{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/name"},"branches":{"items":{"$ref":"#/$defs/proofBranch"},"minItems":1,"type":"array"},"statement":{"$ref":"#/$defs/term"},"type":{"$ref":"#/$defs/type"}},"required":["binder","branches","statement","type"],"type":"object"},"neuralDecoder":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"argmax"},"labels":{"items":{"$ref":"#/$defs/term"},"minItems":1,"type":"array"}},"required":["kind","labels"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/name"},"body":{"$ref":"#/$defs/term"},"kind":{"const":"function"}},"required":["binder","body","kind"],"type":"object"}]},"neuralLayer":{"oneOf":[{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/member"},"inputs":{"minimum":1,"type":"integer"},"kind":{"const":"dense"},"outputs":{"minimum":1,"type":"integer"},"weights":{"$ref":"#/$defs/member"}},"required":["bias","inputs","kind","outputs","weights"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"relu"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"requantize"},"maximum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"minimum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"shift":{"maximum":4096,"minimum":0,"type":"integer"}},"required":["kind","maximum","minimum","shift"],"type":"object"}]},"parameter":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["name","type"],"type":"object"},"production":{"additionalProperties":false,"properties":{"effects":{"items":{"enum":["allocation","overflow","recursion"]},"type":"array","uniqueItems":true},"targets":{"items":{"enum":["rust-core","rust-std"]},"minItems":1,"type":"array","uniqueItems":true}},"required":["effects","targets"],"type":"object"},"proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"reflexivity"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"simplify"}},"required":["definitions","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/proof"},"minItems":1,"type":"array"},"kind":{"const":"constructor"}},"required":["branches","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"cases"},"scrutinee":{"$ref":"#/$defs/name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/proofBranch"},"minItems":1,"type":"array"},"generalizing":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"induction"},"scrutinee":{"$ref":"#/$defs/name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"congruence"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"boolean_reflection"},"reflection":{"$ref":"#/$defs/reflection"}},"required":["kind","reflection"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"law"},"name":{"$ref":"#/$defs/name"},"premises":{"items":{"$ref":"#/$defs/member"},"type":"array"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"apply"},"theorem":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"linear_arithmetic"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"term_cases"},"scrutinee":{"$ref":"#/$defs/term"}},"required":["definitions","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"nested_induction"},"members":{"items":{"$ref":"#/$defs/nestedMember"},"minItems":1,"type":"array"},"scrutinee":{"$ref":"#/$defs/name"}},"required":["branches","kind","members","scrutinee"],"type":"object"}]},"proofBranch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"constructor":{"$ref":"#/$defs/name"},"proof":{"$ref":"#/$defs/proof"}},"required":["binders","constructor","proof"],"type":"object"},"realizationRule":{"additionalProperties":false,"properties":{"action":{"$ref":"#/$defs/term"},"guard":{"$ref":"#/$defs/term"},"name":{"$ref":"#/$defs/name"}},"required":["action","guard","name"],"type":"object"},"realizationState":{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/term"},"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["initial","name","type"],"type":"object"},"reasoningAnswer":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"},"value":{"$ref":"#/$defs/term"}},"required":["name","type","value"],"type":"object"},"reasoningClaim":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"answer_correct"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/member"},"kind":{"const":"observation_invariant"},"predicate":{"$ref":"#/$defs/member"},"preserved":{"$ref":"#/$defs/member"}},"required":["initial","kind","predicate","preserved"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"terminates"},"theorem":{"$ref":"#/$defs/member"}},"required":["kind","theorem"],"type":"object"}]},"reasoningStrategy":{"oneOf":[{"additionalProperties":false,"properties":{"fuel":{"$ref":"#/$defs/term"},"kind":{"const":"forward"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"budget":{"$ref":"#/$defs/term"},"generator":{"$ref":"#/$defs/term"},"kind":{"const":"generate_and_verify"}},"required":["generator","kind"],"type":"object"},{"additionalProperties":false,"properties":{"deduplicate":{"type":"boolean"},"frontier":{"$ref":"#/$defs/term"},"fuel":{"$ref":"#/$defs/term"},"kind":{"const":"search"},"order":{"enum":["breadth_first","depth_first"]}},"required":["kind","order"],"type":"object"}]},"reflection":{"oneOf":[{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/member"},"comparison":{"$ref":"#/$defs/reflectionComparison"},"kind":{"const":"list"},"parameter":{"$ref":"#/$defs/name"},"proposition_definition":{"$ref":"#/$defs/member"},"values":{"$ref":"#/$defs/name"}},"required":["boolean_definition","comparison","kind","parameter","proposition_definition","values"],"type":"object"},{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/member"},"fields":{"items":{"$ref":"#/$defs/reflectionField"},"minItems":1,"type":"array"},"kind":{"const":"record"},"proposition_definition":{"$ref":"#/$defs/member"},"record":{"$ref":"#/$defs/name"}},"required":["boolean_definition","fields","kind","proposition_definition","record"],"type":"object"}]},"reflectionComparison":{"enum":["nat_beq","nat_blt"]},"reflectionField":{"additionalProperties":false,"properties":{"expected":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]},"field":{"$ref":"#/$defs/name"}},"required":["expected","field"],"type":"object"},"ruleBinding":{"additionalProperties":false,"properties":{"candidates":{"$ref":"#/$defs/term"},"name":{"$ref":"#/$defs/name"},"type":{"$ref":"#/$defs/type"}},"required":["candidates","name","type"],"type":"object"},"term":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"var"},"name":{"$ref":"#/$defs/name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"nat"},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"bool"},"value":{"type":"boolean"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["int","int8","int16","int32","int64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["uint8","uint16","uint32","uint64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"},"kind":{"const":"bytes"}},"required":["hex","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"primitive"},"operation":{"enum":["append","bit_and","bit_not","bit_or","bit_xor","checked_add","checked_convert","checked_multiply","checked_negate","checked_quotient","checked_subtract","compare_bytes","equal","format_decimal","graph_reachable","graph_successors","graph_topological","index","iterate","iterate_until","join","length","less_than","list_fold","map_contains","map_entries","map_fold","map_insert","map_keys","map_lookup","map_remove","map_size","map_values","multiply","negate","parse_decimal","quotient","remainder","set_contains","set_difference","set_elements","set_fold","set_insert","set_intersection","set_remove","set_size","set_union","shift_left","shift_right","slice","split_exact","subtract","to_int","to_nat","utf8_decode","utf8_encode"]},"result":{"$ref":"#/$defs/type"}},"required":["arguments","kind","operation","result"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"unit"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"kind":{"const":"nil"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"head":{"$ref":"#/$defs/term"},"kind":{"const":"cons"},"tail":{"$ref":"#/$defs/term"}},"required":["head","kind","tail"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/assignment"},"type":"array"},"kind":{"const":"record"},"type":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["fields","kind","type"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"constructor":{"$ref":"#/$defs/member"},"kind":{"const":"constructor"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","constructor","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"},"class":{"$ref":"#/$defs/member"},"kind":{"const":"instance_value"},"resolved":{"$ref":"#/$defs/member"}},"required":["arguments","class","kind","resolved"],"type":"object"},{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/name"},"kind":{"const":"project"},"value":{"$ref":"#/$defs/term"}},"required":["field","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"function":{"$ref":"#/$defs/member"},"kind":{"const":"call"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"condition":{"$ref":"#/$defs/term"},"else_value":{"$ref":"#/$defs/term"},"kind":{"const":"if"},"then_value":{"$ref":"#/$defs/term"}},"required":["condition","else_value","kind","then_value"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/branch"},"minItems":1,"type":"array"},"kind":{"const":"match"},"scrutinee":{"$ref":"#/$defs/term"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"eq"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"le"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"lt"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"add"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"beq"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"ble"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"blt"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"iff"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/term"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/term"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"not"},"value":{"$ref":"#/$defs/term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/parameter"},"body":{"$ref":"#/$defs/term"},"kind":{"const":"forall"}},"required":["binder","body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"prop_and"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/parameter"},"body":{"$ref":"#/$defs/term"},"kind":{"const":"let"},"value":{"$ref":"#/$defs/term"}},"required":["binder","body","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"pair"},"left":{"$ref":"#/$defs/term"},"right":{"$ref":"#/$defs/term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"first"},"value":{"$ref":"#/$defs/term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"second"},"value":{"$ref":"#/$defs/term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/term"},"captures":{"items":{"$ref":"#/$defs/name"},"type":"array","uniqueItems":true},"kind":{"const":"lambda"},"parameters":{"items":{"$ref":"#/$defs/parameter"},"minItems":1,"type":"array"}},"required":["body","captures","kind","parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"minItems":1,"type":"array"},"function":{"$ref":"#/$defs/term"},"kind":{"const":"apply"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"function":{"$ref":"#/$defs/member"},"kind":{"const":"function_ref"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"entries":{"items":{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/term"},"value":{"$ref":"#/$defs/term"}},"required":["key","value"],"type":"object"},"type":"array"},"key":{"$ref":"#/$defs/type"},"kind":{"const":"map_literal"},"value":{"$ref":"#/$defs/type"}},"required":["entries","key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"elements":{"items":{"$ref":"#/$defs/term"},"type":"array"},"kind":{"const":"set_literal"}},"required":["element","elements","kind"],"type":"object"},{"additionalProperties":false,"properties":{"edges":{"items":{"additionalProperties":false,"properties":{"source":{"$ref":"#/$defs/term"},"target":{"$ref":"#/$defs/term"}},"required":["source","target"],"type":"object"},"type":"array"},"kind":{"const":"graph_literal"},"node":{"$ref":"#/$defs/type"},"nodes":{"items":{"$ref":"#/$defs/term"},"type":"array"}},"required":["edges","kind","node","nodes"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/term"},"type":"array"},"checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array","uniqueItems":true},"kind":{"const":"checked_apply"},"model":{"$ref":"#/$defs/member"},"type_arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"}},"required":["arguments","checks","kind","model"],"type":"object"}]},"type":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"enum":["bool","bytes","int","int8","int16","int32","int64","nat","ordering","prop","string","type","uint8","uint16","uint32","uint64","unit"]}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"parameter"},"name":{"$ref":"#/$defs/name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"kind":{"const":"list"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/type"},"type":"array"},"kind":{"const":"named"},"member":{"$ref":"#/$defs/member"}},"required":["arguments","kind","member"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"option"},"value":{"$ref":"#/$defs/type"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"error":{"$ref":"#/$defs/type"},"kind":{"const":"result"},"ok":{"$ref":"#/$defs/type"}},"required":["error","kind","ok"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/type"},"right":{"$ref":"#/$defs/type"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"function"},"parameters":{"items":{"$ref":"#/$defs/type"},"minItems":1,"type":"array"},"result":{"$ref":"#/$defs/type"}},"required":["kind","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/type"},"kind":{"const":"map"},"value":{"$ref":"#/$defs/type"}},"required":["key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/type"},"kind":{"const":"set"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"contract_violation"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"reasoning_failure"}},"required":["kind"],"type":"object"}]}},"$id":"https://github.com/UOR-Foundation/LexLean/schemas/semantic-module-v2.schema.json","$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"declarations":{"items":{"$ref":"#/$defs/declaration"},"minItems":1,"type":"array"},"spec":{"const":"lexlean/semantic-module/2"}},"required":["declarations","spec"],"title":"LexLean language-1.2 semantic module","type":"object"} diff --git a/schemas/semantic-snapshot-v2.schema.json b/schemas/semantic-snapshot-v2.schema.json index b887fc2c45..e3589fad16 100644 --- a/schemas/semantic-snapshot-v2.schema.json +++ b/schemas/semantic-snapshot-v2.schema.json @@ -1 +1 @@ -{"$defs":{"axiomPolicy":{"additionalProperties":false,"properties":{"axioms":{"items":{"type":"string"},"type":"array","uniqueItems":true},"kind":{"enum":["allow","exact","none"]}},"required":["axioms","kind"],"type":"object"},"crossCheck":{"additionalProperties":false,"properties":{"name":{"minLength":1,"type":"string"},"proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"theorem"},"theorem":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["kind","theorem","type_arguments"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"}]},"statement":{"oneOf":[{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"helper":{"minLength":1,"type":"string"},"kind":{"const":"helper"}},"required":["arguments","helper","kind"],"type":"object"},{"additionalProperties":false,"properties":{"artifact":{"$ref":"#/$defs/elaboration_name"},"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["artifact","element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"artifact":{"$ref":"#/$defs/elaboration_name"},"kind":{"const":"lines"}},"required":["artifact","kind"],"type":"object"},{"additionalProperties":false,"properties":{"artifact":{"$ref":"#/$defs/elaboration_name"},"kind":{"const":"bytes"}},"required":["artifact","kind"],"type":"object"}]},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array"}},"required":["name","proof","statement","type_parameters"],"type":"object"},"declaration":{"additionalProperties":false,"properties":{"alpha_id":{"$ref":"#/$defs/digest"},"axiom_policy":{"$ref":"#/$defs/axiomPolicy"},"elaboration":{"$ref":"#/$defs/elaboration"},"kind":{"enum":["abbrev","artifact","class","constructor","contract","corollary","definition","evidence","inductive","inference_rule","instance","lemma","logic","model","predicatedefinition","realization","reasoner","recursor","structure","termdefinition","theorem","typedefinition","verifier"]},"lean_name":{"minLength":1,"type":"string"},"linked_ir":{"$ref":"#/$defs/semanticValue"},"logical_id":{"minLength":1,"type":"string"},"origin":{"$ref":"#/$defs/origin"}},"required":["axiom_policy","kind","lean_name","linked_ir","logical_id"],"type":"object"},"digest":{"pattern":"^[0-9a-f]{64}$","type":"string"},"elaboration":{"additionalProperties":false,"properties":{"alpha_ids":{"additionalProperties":{"$ref":"#/$defs/digest"},"type":"object"},"cross_checks":{"items":{"$ref":"#/$defs/crossCheck"},"type":"array"},"declarations":{"items":{"$ref":"#/$defs/elaboration_declaration"},"type":"array"},"obligations":{"items":{"$ref":"#/$defs/obligation"},"type":"array"},"required_checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array"},"theorems":{"items":{"$ref":"#/$defs/generatedTheorem"},"type":"array"}},"required":["alpha_ids","cross_checks","declarations","obligations","required_checks"],"type":"object"},"elaboration_artifactSchema":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"bytes"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"int_tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"utf8_lines"}},"required":["kind"],"type":"object"}]},"elaboration_assignment":{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/elaboration_name"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["field","value"],"type":"object"},"elaboration_branch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/elaboration_term"},"constructor":{"$ref":"#/$defs/elaboration_member"}},"required":["binders","body","constructor"],"type":"object"},"elaboration_claim":{"oneOf":[{"additionalProperties":false,"properties":{"agreements":{"minimum":0,"type":"integer"},"comparison":{"$ref":"#/$defs/elaboration_member"},"comparison_sound":{"$ref":"#/$defs/elaboration_member"},"dataset":{"$ref":"#/$defs/elaboration_member"},"examples":{"minimum":0,"type":"integer"},"kind":{"const":"dataset_agreement"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["agreements","comparison","comparison_sound","dataset","examples","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"equivalent_to"},"reference":{"$ref":"#/$defs/elaboration_modelUse"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","reference","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"preserves_invariant"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"satisfies_contract"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"}]},"elaboration_compositeForm":{"oneOf":[{"additionalProperties":false,"properties":{"junctions":{"items":{"$ref":"#/$defs/elaboration_compositeJunction"},"minItems":1,"type":"array"},"kind":{"const":"sequence"},"stages":{"items":{"$ref":"#/$defs/elaboration_modelUse"},"minItems":2,"type":"array"}},"required":["junctions","kind","stages"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"fanout"},"left":{"$ref":"#/$defs/elaboration_modelUse"},"right":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/elaboration_modelUse"},"right":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"else":{"$ref":"#/$defs/elaboration_modelUse"},"guard":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"branch"},"then":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["else","guard","kind","then"],"type":"object"},{"additionalProperties":false,"properties":{"junction":{"$ref":"#/$defs/elaboration_compositeJunction"},"kind":{"const":"scan"},"stage":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["junction","kind","stage"],"type":"object"}]},"elaboration_compositeJunction":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"unconditional"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"evidence":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"proved"}},"required":["evidence","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"checked"}},"required":["kind"],"type":"object"}]},"elaboration_constructor":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["fields","name"],"type":"object"},"elaboration_contractState":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"next":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","next","type"],"type":"object"},"elaboration_contractValidator":{"additionalProperties":false,"properties":{"complete":{"$ref":"#/$defs/elaboration_member"},"predicate":{"enum":["invariant","postcondition","precondition"]},"sound":{"$ref":"#/$defs/elaboration_member"},"validator":{"$ref":"#/$defs/elaboration_member"}},"required":["predicate","sound","validator"],"type":"object"},"elaboration_declaration":{"oneOf":[{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_field"},"minItems":1,"type":"array"},"kind":{"const":"structure"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_field"},"minItems":1,"type":"array"},"kind":{"const":"class"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"class":{"$ref":"#/$defs/elaboration_member"},"fields":{"items":{"$ref":"#/$defs/elaboration_assignment"},"minItems":1,"type":"array"},"kind":{"const":"instance"},"name":{"$ref":"#/$defs/elaboration_name"},"priority":{"const":1000}},"required":["arguments","class","fields","kind","name","priority"],"type":"object"},{"additionalProperties":false,"properties":{"constructors":{"items":{"$ref":"#/$defs/elaboration_constructor"},"minItems":1,"type":"array"},"kind":{"const":"inductive"},"mutual":{"$ref":"#/$defs/elaboration_name"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["constructors","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/elaboration_term"},"executable":{"type":"boolean"},"kind":{"const":"definition"},"mutual":{"$ref":"#/$defs/elaboration_name"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"production":{"$ref":"#/$defs/elaboration_production"},"recursive_argument":{"$ref":"#/$defs/elaboration_name"},"result":{"$ref":"#/$defs/elaboration_type"},"termination":{"additionalProperties":false,"properties":{"evidence":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array"},"measure":{"$ref":"#/$defs/elaboration_term"}},"required":["evidence","measure"],"type":"object"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["body","kind","name","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"theorem"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"proof":{"$ref":"#/$defs/elaboration_proof"},"statement":{"$ref":"#/$defs/elaboration_term"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["kind","name","parameters","proof","statement"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"artifact"},"length":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/elaboration_name"},"role":{"enum":["binary","dataset","parameters","table","vocabulary"]},"schema":{"$ref":"#/$defs/elaboration_artifactSchema"},"sha256":{"pattern":"^[0-9a-f]{64}$","type":"string"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","length","name","role","schema","sha256","type"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"input":{"$ref":"#/$defs/elaboration_modelBinder"},"invariant":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"contract"},"name":{"$ref":"#/$defs/elaboration_name"},"output":{"$ref":"#/$defs/elaboration_modelBinder"},"postcondition":{"$ref":"#/$defs/elaboration_member"},"precondition":{"$ref":"#/$defs/elaboration_member"},"state":{"$ref":"#/$defs/elaboration_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"validators":{"items":{"$ref":"#/$defs/elaboration_contractValidator"},"type":"array"}},"required":["input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"descriptor":{"$ref":"#/$defs/elaboration_descriptor"},"executable":{"type":"boolean"},"input":{"$ref":"#/$defs/elaboration_modelBinder"},"kind":{"const":"realization"},"name":{"$ref":"#/$defs/elaboration_name"},"output":{"$ref":"#/$defs/elaboration_type"},"state":{"$ref":"#/$defs/elaboration_realizationState"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["descriptor","input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/elaboration_claim"},"minItems":1,"type":"array"},"contract":{"$ref":"#/$defs/elaboration_modelUse"},"kind":{"const":"evidence"},"name":{"$ref":"#/$defs/elaboration_name"},"realization":{"$ref":"#/$defs/elaboration_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["claims","contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"contract":{"$ref":"#/$defs/elaboration_modelUse"},"entry":{"items":{"$ref":"#/$defs/elaboration_member"},"type":"array"},"evidence":{"items":{"$ref":"#/$defs/elaboration_modelUse"},"type":"array"},"kind":{"const":"model"},"name":{"$ref":"#/$defs/elaboration_name"},"realization":{"$ref":"#/$defs/elaboration_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"invariant":{"$ref":"#/$defs/elaboration_logicInvariant"},"kind":{"const":"logic"},"name":{"$ref":"#/$defs/elaboration_name"},"ranking":{"$ref":"#/$defs/elaboration_member"},"relation":{"$ref":"#/$defs/elaboration_member"},"state":{"$ref":"#/$defs/elaboration_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["kind","name","relation","state"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"binding":{"$ref":"#/$defs/elaboration_ruleBinding"},"conclusion":{"$ref":"#/$defs/elaboration_term"},"executable":{"type":"boolean"},"guard":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"inference_rule"},"logic":{"$ref":"#/$defs/elaboration_modelUse"},"name":{"$ref":"#/$defs/elaboration_name"},"progress":{"$ref":"#/$defs/elaboration_member"},"soundness":{"$ref":"#/$defs/elaboration_member"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["conclusion","guard","kind","logic","name","soundness"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"candidate":{"$ref":"#/$defs/elaboration_modelBinder"},"check":{"$ref":"#/$defs/elaboration_member"},"complete":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"verifier"},"name":{"$ref":"#/$defs/elaboration_name"},"sound":{"$ref":"#/$defs/elaboration_member"},"specification":{"$ref":"#/$defs/elaboration_member"},"subject":{"$ref":"#/$defs/elaboration_modelBinder"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["candidate","check","kind","name","sound","specification","subject"],"type":"object"},{"additionalProperties":false,"properties":{"answer":{"$ref":"#/$defs/elaboration_reasoningAnswer"},"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/elaboration_reasoningClaim"},"type":"array"},"executable":{"type":"boolean"},"kind":{"const":"reasoner"},"logic":{"$ref":"#/$defs/elaboration_modelUse"},"name":{"$ref":"#/$defs/elaboration_name"},"observation":{"$ref":"#/$defs/elaboration_modelBinder"},"observe":{"$ref":"#/$defs/elaboration_term"},"rules":{"items":{"$ref":"#/$defs/elaboration_modelUse"},"type":"array"},"strategy":{"$ref":"#/$defs/elaboration_reasoningStrategy"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"verifier":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["kind","name","observation","rules","strategy","verifier"],"type":"object"}]},"elaboration_descriptor":{"oneOf":[{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"deterministic"}},"required":["body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"default":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"rule"},"rules":{"items":{"$ref":"#/$defs/elaboration_realizationRule"},"minItems":1,"type":"array"}},"required":["default","kind","rules"],"type":"object"},{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/elaboration_member"},"features":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"statistical"},"labels":{"items":{"$ref":"#/$defs/elaboration_term"},"minItems":1,"type":"array"},"scheme":{"const":"linear_scoring"},"weights":{"$ref":"#/$defs/elaboration_member"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/elaboration_member"}},"required":["bias","features","kind","labels","scheme","weights","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"architecture":{"const":"integer_feedforward"},"decoder":{"$ref":"#/$defs/elaboration_neuralDecoder"},"encoder":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"neural"},"layers":{"items":{"$ref":"#/$defs/elaboration_neuralLayer"},"minItems":1,"type":"array"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/elaboration_member"}},"required":["architecture","decoder","encoder","kind","layers","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"form":{"$ref":"#/$defs/elaboration_compositeForm"},"kind":{"const":"composite"}},"required":["form","kind"],"type":"object"}]},"elaboration_field":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","type"],"type":"object"},"elaboration_logicInvariant":{"additionalProperties":false,"properties":{"predicate":{"$ref":"#/$defs/elaboration_member"},"preserves":{"$ref":"#/$defs/elaboration_member"}},"required":["predicate","preserves"],"type":"object"},"elaboration_member":{"additionalProperties":false,"properties":{"module":{"$ref":"#/$defs/elaboration_name"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["name"],"type":"object"},"elaboration_modelBinder":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","type"],"type":"object"},"elaboration_modelUse":{"additionalProperties":false,"properties":{"member":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["member"],"type":"object"},"elaboration_name":{"description":"A name inside an elaboration. Besides every source spelling it admits the reserved spelling with two leading underscores, which only generated binders use; linking rejects it in every source module, and the source semantic_name excludes it.","pattern":"^(__)?[A-Za-z][A-Za-z0-9_]*(\\.(__)?[A-Za-z][A-Za-z0-9_]*)*$","type":"string"},"elaboration_neuralDecoder":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"argmax"},"labels":{"items":{"$ref":"#/$defs/elaboration_term"},"minItems":1,"type":"array"}},"required":["kind","labels"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/elaboration_name"},"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"function"}},"required":["binder","body","kind"],"type":"object"}]},"elaboration_neuralLayer":{"oneOf":[{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/elaboration_member"},"inputs":{"minimum":1,"type":"integer"},"kind":{"const":"dense"},"outputs":{"minimum":1,"type":"integer"},"weights":{"$ref":"#/$defs/elaboration_member"}},"required":["bias","inputs","kind","outputs","weights"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"relu"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"requantize"},"maximum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"minimum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"shift":{"maximum":4096,"minimum":0,"type":"integer"}},"required":["kind","maximum","minimum","shift"],"type":"object"}]},"elaboration_parameter":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","type"],"type":"object"},"elaboration_production":{"additionalProperties":false,"properties":{"effects":{"items":{"enum":["allocation","overflow","recursion"]},"type":"array","uniqueItems":true},"targets":{"items":{"enum":["rust-core","rust-std"]},"minItems":1,"type":"array","uniqueItems":true}},"required":["effects","targets"],"type":"object"},"elaboration_proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"reflexivity"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"simplify"}},"required":["definitions","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_proof"},"minItems":1,"type":"array"},"kind":{"const":"constructor"}},"required":["branches","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"cases"},"scrutinee":{"$ref":"#/$defs/elaboration_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_proofBranch"},"minItems":1,"type":"array"},"generalizing":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"induction"},"scrutinee":{"$ref":"#/$defs/elaboration_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"congruence"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"boolean_reflection"},"reflection":{"$ref":"#/$defs/elaboration_reflection"}},"required":["kind","reflection"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"law"},"name":{"$ref":"#/$defs/elaboration_name"},"premises":{"items":{"$ref":"#/$defs/elaboration_member"},"type":"array"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"apply"},"theorem":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"linear_arithmetic"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"term_cases"},"scrutinee":{"$ref":"#/$defs/elaboration_term"}},"required":["definitions","kind","scrutinee"],"type":"object"}]},"elaboration_proofBranch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"constructor":{"$ref":"#/$defs/elaboration_name"},"proof":{"$ref":"#/$defs/elaboration_proof"}},"required":["binders","constructor","proof"],"type":"object"},"elaboration_realizationRule":{"additionalProperties":false,"properties":{"action":{"$ref":"#/$defs/elaboration_term"},"guard":{"$ref":"#/$defs/elaboration_term"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["action","guard","name"],"type":"object"},"elaboration_realizationState":{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/elaboration_term"},"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["initial","name","type"],"type":"object"},"elaboration_reasoningAnswer":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["name","type","value"],"type":"object"},"elaboration_reasoningClaim":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"answer_correct"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"observation_invariant"},"predicate":{"$ref":"#/$defs/elaboration_member"},"preserved":{"$ref":"#/$defs/elaboration_member"}},"required":["initial","kind","predicate","preserved"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"terminates"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"}]},"elaboration_reasoningStrategy":{"oneOf":[{"additionalProperties":false,"properties":{"fuel":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"forward"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"budget":{"$ref":"#/$defs/elaboration_term"},"generator":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"generate_and_verify"}},"required":["generator","kind"],"type":"object"},{"additionalProperties":false,"properties":{"deduplicate":{"type":"boolean"},"frontier":{"$ref":"#/$defs/elaboration_term"},"fuel":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"search"},"order":{"enum":["breadth_first","depth_first"]}},"required":["kind","order"],"type":"object"}]},"elaboration_reflection":{"oneOf":[{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/elaboration_member"},"comparison":{"$ref":"#/$defs/elaboration_reflectionComparison"},"kind":{"const":"list"},"parameter":{"$ref":"#/$defs/elaboration_name"},"proposition_definition":{"$ref":"#/$defs/elaboration_member"},"values":{"$ref":"#/$defs/elaboration_name"}},"required":["boolean_definition","comparison","kind","parameter","proposition_definition","values"],"type":"object"},{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/elaboration_member"},"fields":{"items":{"$ref":"#/$defs/elaboration_reflectionField"},"minItems":1,"type":"array"},"kind":{"const":"record"},"proposition_definition":{"$ref":"#/$defs/elaboration_member"},"record":{"$ref":"#/$defs/elaboration_name"}},"required":["boolean_definition","fields","kind","proposition_definition","record"],"type":"object"}]},"elaboration_reflectionComparison":{"enum":["nat_beq","nat_blt"]},"elaboration_reflectionField":{"additionalProperties":false,"properties":{"expected":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]},"field":{"$ref":"#/$defs/elaboration_name"}},"required":["expected","field"],"type":"object"},"elaboration_ruleBinding":{"additionalProperties":false,"properties":{"candidates":{"$ref":"#/$defs/elaboration_term"},"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["candidates","name","type"],"type":"object"},"elaboration_term":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"var"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"nat"},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"bool"},"value":{"type":"boolean"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["int","int8","int16","int32","int64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["uint8","uint16","uint32","uint64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"},"kind":{"const":"bytes"}},"required":["hex","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"primitive"},"operation":{"enum":["append","bit_and","bit_not","bit_or","bit_xor","checked_add","checked_convert","checked_multiply","checked_negate","checked_quotient","checked_subtract","compare_bytes","equal","format_decimal","graph_reachable","graph_successors","graph_topological","index","iterate","iterate_until","join","length","less_than","list_fold","map_contains","map_entries","map_fold","map_insert","map_keys","map_lookup","map_remove","map_size","map_values","multiply","negate","parse_decimal","quotient","remainder","set_contains","set_difference","set_elements","set_fold","set_insert","set_intersection","set_remove","set_size","set_union","shift_left","shift_right","slice","split_exact","subtract","to_int","to_nat","utf8_decode","utf8_encode"]},"result":{"$ref":"#/$defs/elaboration_type"}},"required":["arguments","kind","operation","result"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"unit"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"nil"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"head":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"cons"},"tail":{"$ref":"#/$defs/elaboration_term"}},"required":["head","kind","tail"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_assignment"},"type":"array"},"kind":{"const":"record"},"type":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["fields","kind","type"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"constructor":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"constructor"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","constructor","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"class":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"instance_value"},"resolved":{"$ref":"#/$defs/elaboration_member"}},"required":["arguments","class","kind","resolved"],"type":"object"},{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/elaboration_name"},"kind":{"const":"project"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["field","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"function":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"call"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"condition":{"$ref":"#/$defs/elaboration_term"},"else_value":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"if"},"then_value":{"$ref":"#/$defs/elaboration_term"}},"required":["condition","else_value","kind","then_value"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_branch"},"minItems":1,"type":"array"},"kind":{"const":"match"},"scrutinee":{"$ref":"#/$defs/elaboration_term"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"eq"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"le"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"lt"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"add"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"beq"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"ble"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"blt"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"iff"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/elaboration_term"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"not"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/elaboration_parameter"},"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"forall"}},"required":["binder","body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"prop_and"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/elaboration_parameter"},"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"let"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["binder","body","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"pair"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"first"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"second"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/elaboration_term"},"captures":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"lambda"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"minItems":1,"type":"array"}},"required":["body","captures","kind","parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"minItems":1,"type":"array"},"function":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"apply"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"function":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"function_ref"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"entries":{"items":{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/elaboration_term"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["key","value"],"type":"object"},"type":"array"},"key":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"map_literal"},"value":{"$ref":"#/$defs/elaboration_type"}},"required":["entries","key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"elements":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"set_literal"}},"required":["element","elements","kind"],"type":"object"},{"additionalProperties":false,"properties":{"edges":{"items":{"additionalProperties":false,"properties":{"source":{"$ref":"#/$defs/elaboration_term"},"target":{"$ref":"#/$defs/elaboration_term"}},"required":["source","target"],"type":"object"},"type":"array"},"kind":{"const":"graph_literal"},"node":{"$ref":"#/$defs/elaboration_type"},"nodes":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"}},"required":["edges","kind","node","nodes"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array","uniqueItems":true},"kind":{"const":"checked_apply"},"model":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","checks","kind","model"],"type":"object"}]},"elaboration_type":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"enum":["bool","bytes","int","int8","int16","int32","int64","nat","ordering","prop","string","type","uint8","uint16","uint32","uint64","unit"]}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"parameter"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"list"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"kind":{"const":"named"},"member":{"$ref":"#/$defs/elaboration_member"}},"required":["arguments","kind","member"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"option"},"value":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"error":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"result"},"ok":{"$ref":"#/$defs/elaboration_type"}},"required":["error","kind","ok"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/elaboration_type"},"right":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"function"},"parameters":{"items":{"$ref":"#/$defs/elaboration_type"},"minItems":1,"type":"array"},"result":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"map"},"value":{"$ref":"#/$defs/elaboration_type"}},"required":["key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"set"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"contract_violation"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"reasoning_failure"}},"required":["kind"],"type":"object"}]},"formula":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"term"},"term":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","term"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"helper":{"enum":["all","complete","preserves","reaches","search_ok","sound","star"]},"kind":{"const":"helper"}},"required":["arguments","helper","kind"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/formula"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/formula"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"true"}},"required":["kind"],"type":"object"}]},"generatedTheorem":{"additionalProperties":false,"properties":{"name":{"minLength":1,"type":"string"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"statement":{"$ref":"#/$defs/formula"},"template":{"enum":["accept_sound","conclude_accept","conclude_sound","explained_forward","explained_generate","explained_search","extend","fire_cases","next_progress","next_sound","replay_fire","replay_sound","run_invariant","search_count","search_growth","search_peak","search_step","step_count","step_none","step_some","step_trace","successors_bound","successors_free","term","try_count","try_sound","unfold","verdict_forward","verdict_generate","verdict_search","verify_sound"]},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array"}},"required":["name","parameters","statement","template","type_parameters"],"type":"object"},"module":{"additionalProperties":false,"properties":{"core":{"$ref":"#/$defs/semanticValue"},"declarations":{"items":{"$ref":"#/$defs/declaration"},"type":"array"},"glossary":{"items":{"type":"string"},"type":"array"},"imports":{"items":{"type":"string"},"type":"array"},"lean_module":{"minLength":1,"type":"string"},"linked_ir":{"$ref":"#/$defs/semanticValue"},"name":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"semantic":{"$ref":"#/$defs/semanticModule"},"source":{"$ref":"#/$defs/source"},"visible_packages":{"items":{"type":"string"},"type":"array"}},"required":["declarations","glossary","imports","lean_module","linked_ir","name","source","visible_packages"],"type":"object"},"obligation":{"additionalProperties":false,"properties":{"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"role":{"minLength":1,"type":"string"},"statement":{"$ref":"#/$defs/elaboration_term"},"theorem":{"$ref":"#/$defs/elaboration_member"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array"}},"required":["parameters","role","statement","theorem","type_parameters"],"type":"object"},"origin":{"additionalProperties":false,"properties":{"proof":{"$ref":"#/$defs/range"},"proof_steps":{"items":{"$ref":"#/$defs/range"},"type":"array"},"sentence":{"$ref":"#/$defs/range"},"whole":{"$ref":"#/$defs/range"}},"required":["proof_steps","sentence","whole"],"type":"object"},"range":{"additionalProperties":false,"properties":{"end":{"minimum":0,"type":"integer"},"start":{"minimum":0,"type":"integer"}},"required":["end","start"],"type":"object"},"semanticModule":{"additionalProperties":false,"properties":{"declarations":{"items":{"$ref":"#/$defs/semantic_declaration"},"minItems":1,"type":"array"},"spec":{"const":"lexlean/semantic-module/2"}},"required":["declarations","spec"],"type":"object"},"semanticValue":{"oneOf":[{"type":"boolean"},{"type":"integer"},{"type":"string"},{"items":{"$ref":"#/$defs/semanticValue"},"type":"array"},{"additionalProperties":{"$ref":"#/$defs/semanticValue"},"type":"object"}]},"semantic_artifactSchema":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"bytes"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"int_tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"utf8_lines"}},"required":["kind"],"type":"object"}]},"semantic_assignment":{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/semantic_name"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["field","value"],"type":"object"},"semantic_branch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/semantic_term"},"constructor":{"$ref":"#/$defs/semantic_member"}},"required":["binders","body","constructor"],"type":"object"},"semantic_claim":{"oneOf":[{"additionalProperties":false,"properties":{"agreements":{"minimum":0,"type":"integer"},"comparison":{"$ref":"#/$defs/semantic_member"},"comparison_sound":{"$ref":"#/$defs/semantic_member"},"dataset":{"$ref":"#/$defs/semantic_member"},"examples":{"minimum":0,"type":"integer"},"kind":{"const":"dataset_agreement"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["agreements","comparison","comparison_sound","dataset","examples","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"equivalent_to"},"reference":{"$ref":"#/$defs/semantic_modelUse"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","reference","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"preserves_invariant"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"satisfies_contract"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"}]},"semantic_compositeForm":{"oneOf":[{"additionalProperties":false,"properties":{"junctions":{"items":{"$ref":"#/$defs/semantic_compositeJunction"},"minItems":1,"type":"array"},"kind":{"const":"sequence"},"stages":{"items":{"$ref":"#/$defs/semantic_modelUse"},"minItems":2,"type":"array"}},"required":["junctions","kind","stages"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"fanout"},"left":{"$ref":"#/$defs/semantic_modelUse"},"right":{"$ref":"#/$defs/semantic_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/semantic_modelUse"},"right":{"$ref":"#/$defs/semantic_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"else":{"$ref":"#/$defs/semantic_modelUse"},"guard":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"branch"},"then":{"$ref":"#/$defs/semantic_modelUse"}},"required":["else","guard","kind","then"],"type":"object"},{"additionalProperties":false,"properties":{"junction":{"$ref":"#/$defs/semantic_compositeJunction"},"kind":{"const":"scan"},"stage":{"$ref":"#/$defs/semantic_modelUse"}},"required":["junction","kind","stage"],"type":"object"}]},"semantic_compositeJunction":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"unconditional"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"evidence":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"proved"}},"required":["evidence","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"checked"}},"required":["kind"],"type":"object"}]},"semantic_constructor":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["fields","name"],"type":"object"},"semantic_contractState":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"next":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","next","type"],"type":"object"},"semantic_contractValidator":{"additionalProperties":false,"properties":{"complete":{"$ref":"#/$defs/semantic_member"},"predicate":{"enum":["invariant","postcondition","precondition"]},"sound":{"$ref":"#/$defs/semantic_member"},"validator":{"$ref":"#/$defs/semantic_member"}},"required":["predicate","sound","validator"],"type":"object"},"semantic_declaration":{"oneOf":[{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_field"},"minItems":1,"type":"array"},"kind":{"const":"structure"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_field"},"minItems":1,"type":"array"},"kind":{"const":"class"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"class":{"$ref":"#/$defs/semantic_member"},"fields":{"items":{"$ref":"#/$defs/semantic_assignment"},"minItems":1,"type":"array"},"kind":{"const":"instance"},"name":{"$ref":"#/$defs/semantic_name"},"priority":{"const":1000}},"required":["arguments","class","fields","kind","name","priority"],"type":"object"},{"additionalProperties":false,"properties":{"constructors":{"items":{"$ref":"#/$defs/semantic_constructor"},"minItems":1,"type":"array"},"kind":{"const":"inductive"},"mutual":{"$ref":"#/$defs/semantic_name"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["constructors","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/semantic_term"},"executable":{"type":"boolean"},"kind":{"const":"definition"},"mutual":{"$ref":"#/$defs/semantic_name"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"production":{"$ref":"#/$defs/semantic_production"},"recursive_argument":{"$ref":"#/$defs/semantic_name"},"result":{"$ref":"#/$defs/semantic_type"},"termination":{"additionalProperties":false,"properties":{"evidence":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array"},"measure":{"$ref":"#/$defs/semantic_term"}},"required":["evidence","measure"],"type":"object"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["body","kind","name","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"theorem"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"proof":{"$ref":"#/$defs/semantic_proof"},"statement":{"$ref":"#/$defs/semantic_term"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["kind","name","parameters","proof","statement"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"artifact"},"length":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/semantic_name"},"role":{"enum":["binary","dataset","parameters","table","vocabulary"]},"schema":{"$ref":"#/$defs/semantic_artifactSchema"},"sha256":{"pattern":"^[0-9a-f]{64}$","type":"string"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["kind","length","name","role","schema","sha256","type"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"input":{"$ref":"#/$defs/semantic_modelBinder"},"invariant":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"contract"},"name":{"$ref":"#/$defs/semantic_name"},"output":{"$ref":"#/$defs/semantic_modelBinder"},"postcondition":{"$ref":"#/$defs/semantic_member"},"precondition":{"$ref":"#/$defs/semantic_member"},"state":{"$ref":"#/$defs/semantic_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"validators":{"items":{"$ref":"#/$defs/semantic_contractValidator"},"type":"array"}},"required":["input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"descriptor":{"$ref":"#/$defs/semantic_descriptor"},"executable":{"type":"boolean"},"input":{"$ref":"#/$defs/semantic_modelBinder"},"kind":{"const":"realization"},"name":{"$ref":"#/$defs/semantic_name"},"output":{"$ref":"#/$defs/semantic_type"},"state":{"$ref":"#/$defs/semantic_realizationState"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["descriptor","input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/semantic_claim"},"minItems":1,"type":"array"},"contract":{"$ref":"#/$defs/semantic_modelUse"},"kind":{"const":"evidence"},"name":{"$ref":"#/$defs/semantic_name"},"realization":{"$ref":"#/$defs/semantic_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["claims","contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"contract":{"$ref":"#/$defs/semantic_modelUse"},"entry":{"items":{"$ref":"#/$defs/semantic_member"},"type":"array"},"evidence":{"items":{"$ref":"#/$defs/semantic_modelUse"},"type":"array"},"kind":{"const":"model"},"name":{"$ref":"#/$defs/semantic_name"},"realization":{"$ref":"#/$defs/semantic_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"invariant":{"$ref":"#/$defs/semantic_logicInvariant"},"kind":{"const":"logic"},"name":{"$ref":"#/$defs/semantic_name"},"ranking":{"$ref":"#/$defs/semantic_member"},"relation":{"$ref":"#/$defs/semantic_member"},"state":{"$ref":"#/$defs/semantic_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["kind","name","relation","state"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"binding":{"$ref":"#/$defs/semantic_ruleBinding"},"conclusion":{"$ref":"#/$defs/semantic_term"},"executable":{"type":"boolean"},"guard":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"inference_rule"},"logic":{"$ref":"#/$defs/semantic_modelUse"},"name":{"$ref":"#/$defs/semantic_name"},"progress":{"$ref":"#/$defs/semantic_member"},"soundness":{"$ref":"#/$defs/semantic_member"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["conclusion","guard","kind","logic","name","soundness"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"candidate":{"$ref":"#/$defs/semantic_modelBinder"},"check":{"$ref":"#/$defs/semantic_member"},"complete":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"verifier"},"name":{"$ref":"#/$defs/semantic_name"},"sound":{"$ref":"#/$defs/semantic_member"},"specification":{"$ref":"#/$defs/semantic_member"},"subject":{"$ref":"#/$defs/semantic_modelBinder"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["candidate","check","kind","name","sound","specification","subject"],"type":"object"},{"additionalProperties":false,"properties":{"answer":{"$ref":"#/$defs/semantic_reasoningAnswer"},"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/semantic_reasoningClaim"},"type":"array"},"executable":{"type":"boolean"},"kind":{"const":"reasoner"},"logic":{"$ref":"#/$defs/semantic_modelUse"},"name":{"$ref":"#/$defs/semantic_name"},"observation":{"$ref":"#/$defs/semantic_modelBinder"},"observe":{"$ref":"#/$defs/semantic_term"},"rules":{"items":{"$ref":"#/$defs/semantic_modelUse"},"type":"array"},"strategy":{"$ref":"#/$defs/semantic_reasoningStrategy"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"verifier":{"$ref":"#/$defs/semantic_modelUse"}},"required":["kind","name","observation","rules","strategy","verifier"],"type":"object"}]},"semantic_descriptor":{"oneOf":[{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"deterministic"}},"required":["body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"default":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"rule"},"rules":{"items":{"$ref":"#/$defs/semantic_realizationRule"},"minItems":1,"type":"array"}},"required":["default","kind","rules"],"type":"object"},{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/semantic_member"},"features":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"statistical"},"labels":{"items":{"$ref":"#/$defs/semantic_term"},"minItems":1,"type":"array"},"scheme":{"const":"linear_scoring"},"weights":{"$ref":"#/$defs/semantic_member"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/semantic_member"}},"required":["bias","features","kind","labels","scheme","weights","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"architecture":{"const":"integer_feedforward"},"decoder":{"$ref":"#/$defs/semantic_neuralDecoder"},"encoder":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"neural"},"layers":{"items":{"$ref":"#/$defs/semantic_neuralLayer"},"minItems":1,"type":"array"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/semantic_member"}},"required":["architecture","decoder","encoder","kind","layers","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"form":{"$ref":"#/$defs/semantic_compositeForm"},"kind":{"const":"composite"}},"required":["form","kind"],"type":"object"}]},"semantic_field":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","type"],"type":"object"},"semantic_logicInvariant":{"additionalProperties":false,"properties":{"predicate":{"$ref":"#/$defs/semantic_member"},"preserves":{"$ref":"#/$defs/semantic_member"}},"required":["predicate","preserves"],"type":"object"},"semantic_member":{"additionalProperties":false,"properties":{"module":{"$ref":"#/$defs/semantic_name"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["name"],"type":"object"},"semantic_modelBinder":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","type"],"type":"object"},"semantic_modelUse":{"additionalProperties":false,"properties":{"member":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["member"],"type":"object"},"semantic_name":{"pattern":"^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)*$","type":"string"},"semantic_neuralDecoder":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"argmax"},"labels":{"items":{"$ref":"#/$defs/semantic_term"},"minItems":1,"type":"array"}},"required":["kind","labels"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/semantic_name"},"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"function"}},"required":["binder","body","kind"],"type":"object"}]},"semantic_neuralLayer":{"oneOf":[{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/semantic_member"},"inputs":{"minimum":1,"type":"integer"},"kind":{"const":"dense"},"outputs":{"minimum":1,"type":"integer"},"weights":{"$ref":"#/$defs/semantic_member"}},"required":["bias","inputs","kind","outputs","weights"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"relu"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"requantize"},"maximum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"minimum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"shift":{"maximum":4096,"minimum":0,"type":"integer"}},"required":["kind","maximum","minimum","shift"],"type":"object"}]},"semantic_parameter":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","type"],"type":"object"},"semantic_production":{"additionalProperties":false,"properties":{"effects":{"items":{"enum":["allocation","overflow","recursion"]},"type":"array","uniqueItems":true},"targets":{"items":{"enum":["rust-core","rust-std"]},"minItems":1,"type":"array","uniqueItems":true}},"required":["effects","targets"],"type":"object"},"semantic_proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"reflexivity"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"simplify"}},"required":["definitions","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_proof"},"minItems":1,"type":"array"},"kind":{"const":"constructor"}},"required":["branches","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"cases"},"scrutinee":{"$ref":"#/$defs/semantic_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_proofBranch"},"minItems":1,"type":"array"},"generalizing":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"induction"},"scrutinee":{"$ref":"#/$defs/semantic_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"congruence"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"boolean_reflection"},"reflection":{"$ref":"#/$defs/semantic_reflection"}},"required":["kind","reflection"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"law"},"name":{"$ref":"#/$defs/semantic_name"},"premises":{"items":{"$ref":"#/$defs/semantic_member"},"type":"array"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"apply"},"theorem":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"linear_arithmetic"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"term_cases"},"scrutinee":{"$ref":"#/$defs/semantic_term"}},"required":["definitions","kind","scrutinee"],"type":"object"}]},"semantic_proofBranch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"constructor":{"$ref":"#/$defs/semantic_name"},"proof":{"$ref":"#/$defs/semantic_proof"}},"required":["binders","constructor","proof"],"type":"object"},"semantic_realizationRule":{"additionalProperties":false,"properties":{"action":{"$ref":"#/$defs/semantic_term"},"guard":{"$ref":"#/$defs/semantic_term"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["action","guard","name"],"type":"object"},"semantic_realizationState":{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/semantic_term"},"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["initial","name","type"],"type":"object"},"semantic_reasoningAnswer":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["name","type","value"],"type":"object"},"semantic_reasoningClaim":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"answer_correct"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"observation_invariant"},"predicate":{"$ref":"#/$defs/semantic_member"},"preserved":{"$ref":"#/$defs/semantic_member"}},"required":["initial","kind","predicate","preserved"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"terminates"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"}]},"semantic_reasoningStrategy":{"oneOf":[{"additionalProperties":false,"properties":{"fuel":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"forward"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"budget":{"$ref":"#/$defs/semantic_term"},"generator":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"generate_and_verify"}},"required":["generator","kind"],"type":"object"},{"additionalProperties":false,"properties":{"deduplicate":{"type":"boolean"},"frontier":{"$ref":"#/$defs/semantic_term"},"fuel":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"search"},"order":{"enum":["breadth_first","depth_first"]}},"required":["kind","order"],"type":"object"}]},"semantic_reflection":{"oneOf":[{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/semantic_member"},"comparison":{"$ref":"#/$defs/semantic_reflectionComparison"},"kind":{"const":"list"},"parameter":{"$ref":"#/$defs/semantic_name"},"proposition_definition":{"$ref":"#/$defs/semantic_member"},"values":{"$ref":"#/$defs/semantic_name"}},"required":["boolean_definition","comparison","kind","parameter","proposition_definition","values"],"type":"object"},{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/semantic_member"},"fields":{"items":{"$ref":"#/$defs/semantic_reflectionField"},"minItems":1,"type":"array"},"kind":{"const":"record"},"proposition_definition":{"$ref":"#/$defs/semantic_member"},"record":{"$ref":"#/$defs/semantic_name"}},"required":["boolean_definition","fields","kind","proposition_definition","record"],"type":"object"}]},"semantic_reflectionComparison":{"enum":["nat_beq","nat_blt"]},"semantic_reflectionField":{"additionalProperties":false,"properties":{"expected":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]},"field":{"$ref":"#/$defs/semantic_name"}},"required":["expected","field"],"type":"object"},"semantic_ruleBinding":{"additionalProperties":false,"properties":{"candidates":{"$ref":"#/$defs/semantic_term"},"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["candidates","name","type"],"type":"object"},"semantic_term":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"var"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"nat"},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"bool"},"value":{"type":"boolean"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["int","int8","int16","int32","int64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["uint8","uint16","uint32","uint64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"},"kind":{"const":"bytes"}},"required":["hex","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"primitive"},"operation":{"enum":["append","bit_and","bit_not","bit_or","bit_xor","checked_add","checked_convert","checked_multiply","checked_negate","checked_quotient","checked_subtract","compare_bytes","equal","format_decimal","graph_reachable","graph_successors","graph_topological","index","iterate","iterate_until","join","length","less_than","list_fold","map_contains","map_entries","map_fold","map_insert","map_keys","map_lookup","map_remove","map_size","map_values","multiply","negate","parse_decimal","quotient","remainder","set_contains","set_difference","set_elements","set_fold","set_insert","set_intersection","set_remove","set_size","set_union","shift_left","shift_right","slice","split_exact","subtract","to_int","to_nat","utf8_decode","utf8_encode"]},"result":{"$ref":"#/$defs/semantic_type"}},"required":["arguments","kind","operation","result"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"unit"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"nil"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"head":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"cons"},"tail":{"$ref":"#/$defs/semantic_term"}},"required":["head","kind","tail"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_assignment"},"type":"array"},"kind":{"const":"record"},"type":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["fields","kind","type"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"constructor":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"constructor"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","constructor","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"class":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"instance_value"},"resolved":{"$ref":"#/$defs/semantic_member"}},"required":["arguments","class","kind","resolved"],"type":"object"},{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/semantic_name"},"kind":{"const":"project"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["field","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"function":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"call"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"condition":{"$ref":"#/$defs/semantic_term"},"else_value":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"if"},"then_value":{"$ref":"#/$defs/semantic_term"}},"required":["condition","else_value","kind","then_value"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_branch"},"minItems":1,"type":"array"},"kind":{"const":"match"},"scrutinee":{"$ref":"#/$defs/semantic_term"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"eq"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"le"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"lt"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"add"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"beq"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"ble"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"blt"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"iff"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/semantic_term"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"not"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/semantic_parameter"},"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"forall"}},"required":["binder","body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"prop_and"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/semantic_parameter"},"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"let"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["binder","body","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"pair"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"first"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"second"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/semantic_term"},"captures":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"lambda"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"minItems":1,"type":"array"}},"required":["body","captures","kind","parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"minItems":1,"type":"array"},"function":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"apply"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"function":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"function_ref"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"entries":{"items":{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/semantic_term"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["key","value"],"type":"object"},"type":"array"},"key":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"map_literal"},"value":{"$ref":"#/$defs/semantic_type"}},"required":["entries","key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"elements":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"set_literal"}},"required":["element","elements","kind"],"type":"object"},{"additionalProperties":false,"properties":{"edges":{"items":{"additionalProperties":false,"properties":{"source":{"$ref":"#/$defs/semantic_term"},"target":{"$ref":"#/$defs/semantic_term"}},"required":["source","target"],"type":"object"},"type":"array"},"kind":{"const":"graph_literal"},"node":{"$ref":"#/$defs/semantic_type"},"nodes":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"}},"required":["edges","kind","node","nodes"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array","uniqueItems":true},"kind":{"const":"checked_apply"},"model":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","checks","kind","model"],"type":"object"}]},"semantic_type":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"enum":["bool","bytes","int","int8","int16","int32","int64","nat","ordering","prop","string","type","uint8","uint16","uint32","uint64","unit"]}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"parameter"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"list"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"kind":{"const":"named"},"member":{"$ref":"#/$defs/semantic_member"}},"required":["arguments","kind","member"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"option"},"value":{"$ref":"#/$defs/semantic_type"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"error":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"result"},"ok":{"$ref":"#/$defs/semantic_type"}},"required":["error","kind","ok"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/semantic_type"},"right":{"$ref":"#/$defs/semantic_type"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"function"},"parameters":{"items":{"$ref":"#/$defs/semantic_type"},"minItems":1,"type":"array"},"result":{"$ref":"#/$defs/semantic_type"}},"required":["kind","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"map"},"value":{"$ref":"#/$defs/semantic_type"}},"required":["key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"set"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"contract_violation"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"reasoning_failure"}},"required":["kind"],"type":"object"}]},"source":{"additionalProperties":false,"properties":{"path":{"minLength":1,"type":"string"},"sha256":{"$ref":"#/$defs/digest"}},"required":["path","sha256"],"type":"object"}},"$id":"https://github.com/UOR-Foundation/LexLean/schemas/semantic-snapshot-v2.schema.json","$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"compiler_semantics_id":{"$ref":"#/$defs/digest"},"language":{"const":"1.2"},"lexicon_closure":{"$ref":"#/$defs/semanticValue"},"modules":{"items":{"$ref":"#/$defs/module"},"type":"array"},"semantic_id":{"$ref":"#/$defs/digest"},"source_id":{"$ref":"#/$defs/digest"},"spec":{"const":"lexlean/semantic-snapshot/2"}},"required":["compiler_semantics_id","language","lexicon_closure","modules","semantic_id","source_id","spec"],"title":"LexLean language-1.2 semantic snapshot","type":"object"} +{"$defs":{"axiomPolicy":{"additionalProperties":false,"properties":{"axioms":{"items":{"type":"string"},"type":"array","uniqueItems":true},"kind":{"enum":["allow","exact","none"]}},"required":["axioms","kind"],"type":"object"},"crossCheck":{"additionalProperties":false,"properties":{"name":{"minLength":1,"type":"string"},"proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"theorem"},"theorem":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["kind","theorem","type_arguments"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"}]},"statement":{"oneOf":[{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"helper":{"minLength":1,"type":"string"},"kind":{"const":"helper"}},"required":["arguments","helper","kind"],"type":"object"},{"additionalProperties":false,"properties":{"artifact":{"$ref":"#/$defs/elaboration_name"},"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["artifact","element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"artifact":{"$ref":"#/$defs/elaboration_name"},"kind":{"const":"lines"}},"required":["artifact","kind"],"type":"object"},{"additionalProperties":false,"properties":{"artifact":{"$ref":"#/$defs/elaboration_name"},"kind":{"const":"bytes"}},"required":["artifact","kind"],"type":"object"}]},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array"}},"required":["name","proof","statement","type_parameters"],"type":"object"},"declaration":{"additionalProperties":false,"properties":{"alpha_id":{"$ref":"#/$defs/digest"},"axiom_policy":{"$ref":"#/$defs/axiomPolicy"},"elaboration":{"$ref":"#/$defs/elaboration"},"kind":{"enum":["abbrev","artifact","class","constructor","contract","corollary","definition","evidence","inductive","inference_rule","instance","lemma","logic","model","predicatedefinition","realization","reasoner","recursor","structure","termdefinition","theorem","typedefinition","verifier"]},"lean_name":{"minLength":1,"type":"string"},"linked_ir":{"$ref":"#/$defs/semanticValue"},"logical_id":{"minLength":1,"type":"string"},"origin":{"$ref":"#/$defs/origin"}},"required":["axiom_policy","kind","lean_name","linked_ir","logical_id"],"type":"object"},"digest":{"pattern":"^[0-9a-f]{64}$","type":"string"},"elaboration":{"additionalProperties":false,"properties":{"alpha_ids":{"additionalProperties":{"$ref":"#/$defs/digest"},"type":"object"},"cross_checks":{"items":{"$ref":"#/$defs/crossCheck"},"type":"array"},"declarations":{"items":{"$ref":"#/$defs/elaboration_declaration"},"type":"array"},"obligations":{"items":{"$ref":"#/$defs/obligation"},"type":"array"},"required_checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array"},"theorems":{"items":{"$ref":"#/$defs/generatedTheorem"},"type":"array"}},"required":["alpha_ids","cross_checks","declarations","obligations","required_checks"],"type":"object"},"elaboration_artifactSchema":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"bytes"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"int_tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"utf8_lines"}},"required":["kind"],"type":"object"}]},"elaboration_assignment":{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/elaboration_name"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["field","value"],"type":"object"},"elaboration_branch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/elaboration_term"},"constructor":{"$ref":"#/$defs/elaboration_member"}},"required":["binders","body","constructor"],"type":"object"},"elaboration_claim":{"oneOf":[{"additionalProperties":false,"properties":{"agreements":{"minimum":0,"type":"integer"},"comparison":{"$ref":"#/$defs/elaboration_member"},"comparison_sound":{"$ref":"#/$defs/elaboration_member"},"dataset":{"$ref":"#/$defs/elaboration_member"},"examples":{"minimum":0,"type":"integer"},"kind":{"const":"dataset_agreement"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["agreements","comparison","comparison_sound","dataset","examples","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"equivalent_to"},"reference":{"$ref":"#/$defs/elaboration_modelUse"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","reference","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"preserves_invariant"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"satisfies_contract"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"}]},"elaboration_compositeForm":{"oneOf":[{"additionalProperties":false,"properties":{"junctions":{"items":{"$ref":"#/$defs/elaboration_compositeJunction"},"minItems":1,"type":"array"},"kind":{"const":"sequence"},"stages":{"items":{"$ref":"#/$defs/elaboration_modelUse"},"minItems":2,"type":"array"}},"required":["junctions","kind","stages"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"fanout"},"left":{"$ref":"#/$defs/elaboration_modelUse"},"right":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/elaboration_modelUse"},"right":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"else":{"$ref":"#/$defs/elaboration_modelUse"},"guard":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"branch"},"then":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["else","guard","kind","then"],"type":"object"},{"additionalProperties":false,"properties":{"junction":{"$ref":"#/$defs/elaboration_compositeJunction"},"kind":{"const":"scan"},"stage":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["junction","kind","stage"],"type":"object"}]},"elaboration_compositeJunction":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"unconditional"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"evidence":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"proved"}},"required":["evidence","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"checked"}},"required":["kind"],"type":"object"}]},"elaboration_constructor":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["fields","name"],"type":"object"},"elaboration_contractState":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"next":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","next","type"],"type":"object"},"elaboration_contractValidator":{"additionalProperties":false,"properties":{"complete":{"$ref":"#/$defs/elaboration_member"},"predicate":{"enum":["invariant","postcondition","precondition"]},"sound":{"$ref":"#/$defs/elaboration_member"},"validator":{"$ref":"#/$defs/elaboration_member"}},"required":["predicate","sound","validator"],"type":"object"},"elaboration_declaration":{"oneOf":[{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_field"},"minItems":1,"type":"array"},"kind":{"const":"structure"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_field"},"minItems":1,"type":"array"},"kind":{"const":"class"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"class":{"$ref":"#/$defs/elaboration_member"},"fields":{"items":{"$ref":"#/$defs/elaboration_assignment"},"minItems":1,"type":"array"},"kind":{"const":"instance"},"name":{"$ref":"#/$defs/elaboration_name"},"priority":{"const":1000}},"required":["arguments","class","fields","kind","name","priority"],"type":"object"},{"additionalProperties":false,"properties":{"constructors":{"items":{"$ref":"#/$defs/elaboration_constructor"},"minItems":1,"type":"array"},"kind":{"const":"inductive"},"mutual":{"$ref":"#/$defs/elaboration_name"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["constructors","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/elaboration_term"},"executable":{"type":"boolean"},"kind":{"const":"definition"},"mutual":{"$ref":"#/$defs/elaboration_name"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"production":{"$ref":"#/$defs/elaboration_production"},"recursive_argument":{"$ref":"#/$defs/elaboration_name"},"result":{"$ref":"#/$defs/elaboration_type"},"termination":{"additionalProperties":false,"properties":{"evidence":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array"},"measure":{"$ref":"#/$defs/elaboration_term"}},"required":["evidence","measure"],"type":"object"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["body","kind","name","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"theorem"},"name":{"$ref":"#/$defs/elaboration_name"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"proof":{"$ref":"#/$defs/elaboration_proof"},"statement":{"$ref":"#/$defs/elaboration_term"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["kind","name","parameters","proof","statement"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"artifact"},"length":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/elaboration_name"},"role":{"enum":["binary","dataset","parameters","table","vocabulary"]},"schema":{"$ref":"#/$defs/elaboration_artifactSchema"},"sha256":{"pattern":"^[0-9a-f]{64}$","type":"string"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","length","name","role","schema","sha256","type"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"input":{"$ref":"#/$defs/elaboration_modelBinder"},"invariant":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"contract"},"name":{"$ref":"#/$defs/elaboration_name"},"output":{"$ref":"#/$defs/elaboration_modelBinder"},"postcondition":{"$ref":"#/$defs/elaboration_member"},"precondition":{"$ref":"#/$defs/elaboration_member"},"state":{"$ref":"#/$defs/elaboration_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"validators":{"items":{"$ref":"#/$defs/elaboration_contractValidator"},"type":"array"}},"required":["input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"descriptor":{"$ref":"#/$defs/elaboration_descriptor"},"executable":{"type":"boolean"},"input":{"$ref":"#/$defs/elaboration_modelBinder"},"kind":{"const":"realization"},"name":{"$ref":"#/$defs/elaboration_name"},"output":{"$ref":"#/$defs/elaboration_type"},"state":{"$ref":"#/$defs/elaboration_realizationState"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["descriptor","input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/elaboration_claim"},"minItems":1,"type":"array"},"contract":{"$ref":"#/$defs/elaboration_modelUse"},"kind":{"const":"evidence"},"name":{"$ref":"#/$defs/elaboration_name"},"realization":{"$ref":"#/$defs/elaboration_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["claims","contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"contract":{"$ref":"#/$defs/elaboration_modelUse"},"entry":{"items":{"$ref":"#/$defs/elaboration_member"},"type":"array"},"evidence":{"items":{"$ref":"#/$defs/elaboration_modelUse"},"type":"array"},"kind":{"const":"model"},"name":{"$ref":"#/$defs/elaboration_name"},"realization":{"$ref":"#/$defs/elaboration_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"invariant":{"$ref":"#/$defs/elaboration_logicInvariant"},"kind":{"const":"logic"},"name":{"$ref":"#/$defs/elaboration_name"},"ranking":{"$ref":"#/$defs/elaboration_member"},"relation":{"$ref":"#/$defs/elaboration_member"},"state":{"$ref":"#/$defs/elaboration_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["kind","name","relation","state"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"binding":{"$ref":"#/$defs/elaboration_ruleBinding"},"conclusion":{"$ref":"#/$defs/elaboration_term"},"executable":{"type":"boolean"},"guard":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"inference_rule"},"logic":{"$ref":"#/$defs/elaboration_modelUse"},"name":{"$ref":"#/$defs/elaboration_name"},"progress":{"$ref":"#/$defs/elaboration_member"},"soundness":{"$ref":"#/$defs/elaboration_member"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["conclusion","guard","kind","logic","name","soundness"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"candidate":{"$ref":"#/$defs/elaboration_modelBinder"},"check":{"$ref":"#/$defs/elaboration_member"},"complete":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"verifier"},"name":{"$ref":"#/$defs/elaboration_name"},"sound":{"$ref":"#/$defs/elaboration_member"},"specification":{"$ref":"#/$defs/elaboration_member"},"subject":{"$ref":"#/$defs/elaboration_modelBinder"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true}},"required":["candidate","check","kind","name","sound","specification","subject"],"type":"object"},{"additionalProperties":false,"properties":{"answer":{"$ref":"#/$defs/elaboration_reasoningAnswer"},"axioms":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/elaboration_reasoningClaim"},"type":"array"},"executable":{"type":"boolean"},"kind":{"const":"reasoner"},"logic":{"$ref":"#/$defs/elaboration_modelUse"},"name":{"$ref":"#/$defs/elaboration_name"},"observation":{"$ref":"#/$defs/elaboration_modelBinder"},"observe":{"$ref":"#/$defs/elaboration_term"},"rules":{"items":{"$ref":"#/$defs/elaboration_modelUse"},"type":"array"},"strategy":{"$ref":"#/$defs/elaboration_reasoningStrategy"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"verifier":{"$ref":"#/$defs/elaboration_modelUse"}},"required":["kind","name","observation","rules","strategy","verifier"],"type":"object"}]},"elaboration_descriptor":{"oneOf":[{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"deterministic"}},"required":["body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"default":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"rule"},"rules":{"items":{"$ref":"#/$defs/elaboration_realizationRule"},"minItems":1,"type":"array"}},"required":["default","kind","rules"],"type":"object"},{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/elaboration_member"},"features":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"statistical"},"labels":{"items":{"$ref":"#/$defs/elaboration_term"},"minItems":1,"type":"array"},"scheme":{"const":"linear_scoring"},"weights":{"$ref":"#/$defs/elaboration_member"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/elaboration_member"}},"required":["bias","features","kind","labels","scheme","weights","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"architecture":{"const":"integer_feedforward"},"decoder":{"$ref":"#/$defs/elaboration_neuralDecoder"},"encoder":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"neural"},"layers":{"items":{"$ref":"#/$defs/elaboration_neuralLayer"},"minItems":1,"type":"array"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/elaboration_member"}},"required":["architecture","decoder","encoder","kind","layers","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"form":{"$ref":"#/$defs/elaboration_compositeForm"},"kind":{"const":"composite"}},"required":["form","kind"],"type":"object"}]},"elaboration_field":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","type"],"type":"object"},"elaboration_logicInvariant":{"additionalProperties":false,"properties":{"predicate":{"$ref":"#/$defs/elaboration_member"},"preserves":{"$ref":"#/$defs/elaboration_member"}},"required":["predicate","preserves"],"type":"object"},"elaboration_member":{"additionalProperties":false,"properties":{"module":{"$ref":"#/$defs/elaboration_name"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["name"],"type":"object"},"elaboration_modelBinder":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","type"],"type":"object"},"elaboration_modelUse":{"additionalProperties":false,"properties":{"member":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["member"],"type":"object"},"elaboration_name":{"description":"A name inside an elaboration. Besides every source spelling it admits the reserved spelling with two leading underscores, which only generated binders use; linking rejects it in every source module, and the source semantic_name excludes it.","pattern":"^(__)?[A-Za-z][A-Za-z0-9_]*(\\.(__)?[A-Za-z][A-Za-z0-9_]*)*$","type":"string"},"elaboration_nestedMember":{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/elaboration_name"},"branches":{"items":{"$ref":"#/$defs/elaboration_proofBranch"},"minItems":1,"type":"array"},"statement":{"$ref":"#/$defs/elaboration_term"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["binder","branches","statement","type"],"type":"object"},"elaboration_neuralDecoder":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"argmax"},"labels":{"items":{"$ref":"#/$defs/elaboration_term"},"minItems":1,"type":"array"}},"required":["kind","labels"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/elaboration_name"},"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"function"}},"required":["binder","body","kind"],"type":"object"}]},"elaboration_neuralLayer":{"oneOf":[{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/elaboration_member"},"inputs":{"minimum":1,"type":"integer"},"kind":{"const":"dense"},"outputs":{"minimum":1,"type":"integer"},"weights":{"$ref":"#/$defs/elaboration_member"}},"required":["bias","inputs","kind","outputs","weights"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"relu"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"requantize"},"maximum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"minimum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"shift":{"maximum":4096,"minimum":0,"type":"integer"}},"required":["kind","maximum","minimum","shift"],"type":"object"}]},"elaboration_parameter":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["name","type"],"type":"object"},"elaboration_production":{"additionalProperties":false,"properties":{"effects":{"items":{"enum":["allocation","overflow","recursion"]},"type":"array","uniqueItems":true},"targets":{"items":{"enum":["rust-core","rust-std"]},"minItems":1,"type":"array","uniqueItems":true}},"required":["effects","targets"],"type":"object"},"elaboration_proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"reflexivity"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"simplify"}},"required":["definitions","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_proof"},"minItems":1,"type":"array"},"kind":{"const":"constructor"}},"required":["branches","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"cases"},"scrutinee":{"$ref":"#/$defs/elaboration_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_proofBranch"},"minItems":1,"type":"array"},"generalizing":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"induction"},"scrutinee":{"$ref":"#/$defs/elaboration_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"congruence"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"boolean_reflection"},"reflection":{"$ref":"#/$defs/elaboration_reflection"}},"required":["kind","reflection"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"law"},"name":{"$ref":"#/$defs/elaboration_name"},"premises":{"items":{"$ref":"#/$defs/elaboration_member"},"type":"array"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"apply"},"theorem":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"linear_arithmetic"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/elaboration_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"term_cases"},"scrutinee":{"$ref":"#/$defs/elaboration_term"}},"required":["definitions","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"nested_induction"},"members":{"items":{"$ref":"#/$defs/elaboration_nestedMember"},"minItems":1,"type":"array"},"scrutinee":{"$ref":"#/$defs/elaboration_name"}},"required":["branches","kind","members","scrutinee"],"type":"object"}]},"elaboration_proofBranch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"constructor":{"$ref":"#/$defs/elaboration_name"},"proof":{"$ref":"#/$defs/elaboration_proof"}},"required":["binders","constructor","proof"],"type":"object"},"elaboration_realizationRule":{"additionalProperties":false,"properties":{"action":{"$ref":"#/$defs/elaboration_term"},"guard":{"$ref":"#/$defs/elaboration_term"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["action","guard","name"],"type":"object"},"elaboration_realizationState":{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/elaboration_term"},"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["initial","name","type"],"type":"object"},"elaboration_reasoningAnswer":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["name","type","value"],"type":"object"},"elaboration_reasoningClaim":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"answer_correct"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"observation_invariant"},"predicate":{"$ref":"#/$defs/elaboration_member"},"preserved":{"$ref":"#/$defs/elaboration_member"}},"required":["initial","kind","predicate","preserved"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"terminates"},"theorem":{"$ref":"#/$defs/elaboration_member"}},"required":["kind","theorem"],"type":"object"}]},"elaboration_reasoningStrategy":{"oneOf":[{"additionalProperties":false,"properties":{"fuel":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"forward"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"budget":{"$ref":"#/$defs/elaboration_term"},"generator":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"generate_and_verify"}},"required":["generator","kind"],"type":"object"},{"additionalProperties":false,"properties":{"deduplicate":{"type":"boolean"},"frontier":{"$ref":"#/$defs/elaboration_term"},"fuel":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"search"},"order":{"enum":["breadth_first","depth_first"]}},"required":["kind","order"],"type":"object"}]},"elaboration_reflection":{"oneOf":[{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/elaboration_member"},"comparison":{"$ref":"#/$defs/elaboration_reflectionComparison"},"kind":{"const":"list"},"parameter":{"$ref":"#/$defs/elaboration_name"},"proposition_definition":{"$ref":"#/$defs/elaboration_member"},"values":{"$ref":"#/$defs/elaboration_name"}},"required":["boolean_definition","comparison","kind","parameter","proposition_definition","values"],"type":"object"},{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/elaboration_member"},"fields":{"items":{"$ref":"#/$defs/elaboration_reflectionField"},"minItems":1,"type":"array"},"kind":{"const":"record"},"proposition_definition":{"$ref":"#/$defs/elaboration_member"},"record":{"$ref":"#/$defs/elaboration_name"}},"required":["boolean_definition","fields","kind","proposition_definition","record"],"type":"object"}]},"elaboration_reflectionComparison":{"enum":["nat_beq","nat_blt"]},"elaboration_reflectionField":{"additionalProperties":false,"properties":{"expected":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]},"field":{"$ref":"#/$defs/elaboration_name"}},"required":["expected","field"],"type":"object"},"elaboration_ruleBinding":{"additionalProperties":false,"properties":{"candidates":{"$ref":"#/$defs/elaboration_term"},"name":{"$ref":"#/$defs/elaboration_name"},"type":{"$ref":"#/$defs/elaboration_type"}},"required":["candidates","name","type"],"type":"object"},"elaboration_term":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"var"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"nat"},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"bool"},"value":{"type":"boolean"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["int","int8","int16","int32","int64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["uint8","uint16","uint32","uint64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"},"kind":{"const":"bytes"}},"required":["hex","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"primitive"},"operation":{"enum":["append","bit_and","bit_not","bit_or","bit_xor","checked_add","checked_convert","checked_multiply","checked_negate","checked_quotient","checked_subtract","compare_bytes","equal","format_decimal","graph_reachable","graph_successors","graph_topological","index","iterate","iterate_until","join","length","less_than","list_fold","map_contains","map_entries","map_fold","map_insert","map_keys","map_lookup","map_remove","map_size","map_values","multiply","negate","parse_decimal","quotient","remainder","set_contains","set_difference","set_elements","set_fold","set_insert","set_intersection","set_remove","set_size","set_union","shift_left","shift_right","slice","split_exact","subtract","to_int","to_nat","utf8_decode","utf8_encode"]},"result":{"$ref":"#/$defs/elaboration_type"}},"required":["arguments","kind","operation","result"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"unit"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"nil"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"head":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"cons"},"tail":{"$ref":"#/$defs/elaboration_term"}},"required":["head","kind","tail"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/elaboration_assignment"},"type":"array"},"kind":{"const":"record"},"type":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["fields","kind","type"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"constructor":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"constructor"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","constructor","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"class":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"instance_value"},"resolved":{"$ref":"#/$defs/elaboration_member"}},"required":["arguments","class","kind","resolved"],"type":"object"},{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/elaboration_name"},"kind":{"const":"project"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["field","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"function":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"call"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"condition":{"$ref":"#/$defs/elaboration_term"},"else_value":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"if"},"then_value":{"$ref":"#/$defs/elaboration_term"}},"required":["condition","else_value","kind","then_value"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/elaboration_branch"},"minItems":1,"type":"array"},"kind":{"const":"match"},"scrutinee":{"$ref":"#/$defs/elaboration_term"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"eq"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"le"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"lt"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"add"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"beq"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"ble"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"blt"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"iff"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/elaboration_term"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"not"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/elaboration_parameter"},"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"forall"}},"required":["binder","body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"prop_and"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/elaboration_parameter"},"body":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"let"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["binder","body","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"pair"},"left":{"$ref":"#/$defs/elaboration_term"},"right":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"first"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"second"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/elaboration_term"},"captures":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array","uniqueItems":true},"kind":{"const":"lambda"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"minItems":1,"type":"array"}},"required":["body","captures","kind","parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"minItems":1,"type":"array"},"function":{"$ref":"#/$defs/elaboration_term"},"kind":{"const":"apply"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"function":{"$ref":"#/$defs/elaboration_member"},"kind":{"const":"function_ref"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"entries":{"items":{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/elaboration_term"},"value":{"$ref":"#/$defs/elaboration_term"}},"required":["key","value"],"type":"object"},"type":"array"},"key":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"map_literal"},"value":{"$ref":"#/$defs/elaboration_type"}},"required":["entries","key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"elements":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"kind":{"const":"set_literal"}},"required":["element","elements","kind"],"type":"object"},{"additionalProperties":false,"properties":{"edges":{"items":{"additionalProperties":false,"properties":{"source":{"$ref":"#/$defs/elaboration_term"},"target":{"$ref":"#/$defs/elaboration_term"}},"required":["source","target"],"type":"object"},"type":"array"},"kind":{"const":"graph_literal"},"node":{"$ref":"#/$defs/elaboration_type"},"nodes":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"}},"required":["edges","kind","node","nodes"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array","uniqueItems":true},"kind":{"const":"checked_apply"},"model":{"$ref":"#/$defs/elaboration_member"},"type_arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"}},"required":["arguments","checks","kind","model"],"type":"object"}]},"elaboration_type":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"enum":["bool","bytes","int","int8","int16","int32","int64","nat","ordering","prop","string","type","uint8","uint16","uint32","uint64","unit"]}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"parameter"},"name":{"$ref":"#/$defs/elaboration_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"list"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_type"},"type":"array"},"kind":{"const":"named"},"member":{"$ref":"#/$defs/elaboration_member"}},"required":["arguments","kind","member"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"option"},"value":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"error":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"result"},"ok":{"$ref":"#/$defs/elaboration_type"}},"required":["error","kind","ok"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/elaboration_type"},"right":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"function"},"parameters":{"items":{"$ref":"#/$defs/elaboration_type"},"minItems":1,"type":"array"},"result":{"$ref":"#/$defs/elaboration_type"}},"required":["kind","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"map"},"value":{"$ref":"#/$defs/elaboration_type"}},"required":["key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/elaboration_type"},"kind":{"const":"set"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"contract_violation"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"reasoning_failure"}},"required":["kind"],"type":"object"}]},"formula":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"term"},"term":{"$ref":"#/$defs/elaboration_term"}},"required":["kind","term"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/elaboration_term"},"type":"array"},"helper":{"enum":["all","complete","preserves","reaches","search_ok","sound","star"]},"kind":{"const":"helper"}},"required":["arguments","helper","kind"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/formula"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/formula"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"true"}},"required":["kind"],"type":"object"}]},"generatedTheorem":{"additionalProperties":false,"properties":{"name":{"minLength":1,"type":"string"},"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"statement":{"$ref":"#/$defs/formula"},"template":{"enum":["accept_sound","conclude_accept","conclude_sound","explained_forward","explained_generate","explained_search","extend","fire_cases","next_progress","next_sound","replay_fire","replay_sound","run_invariant","search_count","search_growth","search_peak","search_step","step_count","step_none","step_some","step_trace","successors_bound","successors_free","term","try_count","try_sound","unfold","verdict_forward","verdict_generate","verdict_search","verify_sound"]},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array"}},"required":["name","parameters","statement","template","type_parameters"],"type":"object"},"module":{"additionalProperties":false,"properties":{"core":{"$ref":"#/$defs/semanticValue"},"declarations":{"items":{"$ref":"#/$defs/declaration"},"type":"array"},"glossary":{"items":{"type":"string"},"type":"array"},"imports":{"items":{"type":"string"},"type":"array"},"lean_module":{"minLength":1,"type":"string"},"linked_ir":{"$ref":"#/$defs/semanticValue"},"name":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"semantic":{"$ref":"#/$defs/semanticModule"},"source":{"$ref":"#/$defs/source"},"visible_packages":{"items":{"type":"string"},"type":"array"}},"required":["declarations","glossary","imports","lean_module","linked_ir","name","source","visible_packages"],"type":"object"},"obligation":{"additionalProperties":false,"properties":{"parameters":{"items":{"$ref":"#/$defs/elaboration_parameter"},"type":"array"},"role":{"minLength":1,"type":"string"},"statement":{"$ref":"#/$defs/elaboration_term"},"theorem":{"$ref":"#/$defs/elaboration_member"},"type_parameters":{"items":{"$ref":"#/$defs/elaboration_name"},"type":"array"}},"required":["parameters","role","statement","theorem","type_parameters"],"type":"object"},"origin":{"additionalProperties":false,"properties":{"proof":{"$ref":"#/$defs/range"},"proof_steps":{"items":{"$ref":"#/$defs/range"},"type":"array"},"sentence":{"$ref":"#/$defs/range"},"whole":{"$ref":"#/$defs/range"}},"required":["proof_steps","sentence","whole"],"type":"object"},"range":{"additionalProperties":false,"properties":{"end":{"minimum":0,"type":"integer"},"start":{"minimum":0,"type":"integer"}},"required":["end","start"],"type":"object"},"semanticModule":{"additionalProperties":false,"properties":{"declarations":{"items":{"$ref":"#/$defs/semantic_declaration"},"minItems":1,"type":"array"},"spec":{"const":"lexlean/semantic-module/2"}},"required":["declarations","spec"],"type":"object"},"semanticValue":{"oneOf":[{"type":"boolean"},{"type":"integer"},{"type":"string"},{"items":{"$ref":"#/$defs/semanticValue"},"type":"array"},{"additionalProperties":{"$ref":"#/$defs/semanticValue"},"type":"object"}]},"semantic_artifactSchema":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"bytes"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"enum":["int16","int32","int64","int8","uint16","uint32","uint64","uint8"]},"kind":{"const":"int_tensor"},"shape":{"items":{"minimum":1,"type":"integer"},"minItems":1,"type":"array"}},"required":["element","kind","shape"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"utf8_lines"}},"required":["kind"],"type":"object"}]},"semantic_assignment":{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/semantic_name"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["field","value"],"type":"object"},"semantic_branch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/semantic_term"},"constructor":{"$ref":"#/$defs/semantic_member"}},"required":["binders","body","constructor"],"type":"object"},"semantic_claim":{"oneOf":[{"additionalProperties":false,"properties":{"agreements":{"minimum":0,"type":"integer"},"comparison":{"$ref":"#/$defs/semantic_member"},"comparison_sound":{"$ref":"#/$defs/semantic_member"},"dataset":{"$ref":"#/$defs/semantic_member"},"examples":{"minimum":0,"type":"integer"},"kind":{"const":"dataset_agreement"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["agreements","comparison","comparison_sound","dataset","examples","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"equivalent_to"},"reference":{"$ref":"#/$defs/semantic_modelUse"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","reference","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"preserves_invariant"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"satisfies_contract"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"}]},"semantic_compositeForm":{"oneOf":[{"additionalProperties":false,"properties":{"junctions":{"items":{"$ref":"#/$defs/semantic_compositeJunction"},"minItems":1,"type":"array"},"kind":{"const":"sequence"},"stages":{"items":{"$ref":"#/$defs/semantic_modelUse"},"minItems":2,"type":"array"}},"required":["junctions","kind","stages"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"fanout"},"left":{"$ref":"#/$defs/semantic_modelUse"},"right":{"$ref":"#/$defs/semantic_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/semantic_modelUse"},"right":{"$ref":"#/$defs/semantic_modelUse"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"else":{"$ref":"#/$defs/semantic_modelUse"},"guard":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"branch"},"then":{"$ref":"#/$defs/semantic_modelUse"}},"required":["else","guard","kind","then"],"type":"object"},{"additionalProperties":false,"properties":{"junction":{"$ref":"#/$defs/semantic_compositeJunction"},"kind":{"const":"scan"},"stage":{"$ref":"#/$defs/semantic_modelUse"}},"required":["junction","kind","stage"],"type":"object"}]},"semantic_compositeJunction":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"unconditional"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"evidence":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"proved"}},"required":["evidence","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"checked"}},"required":["kind"],"type":"object"}]},"semantic_constructor":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["fields","name"],"type":"object"},"semantic_contractState":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"next":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","next","type"],"type":"object"},"semantic_contractValidator":{"additionalProperties":false,"properties":{"complete":{"$ref":"#/$defs/semantic_member"},"predicate":{"enum":["invariant","postcondition","precondition"]},"sound":{"$ref":"#/$defs/semantic_member"},"validator":{"$ref":"#/$defs/semantic_member"}},"required":["predicate","sound","validator"],"type":"object"},"semantic_declaration":{"oneOf":[{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_field"},"minItems":1,"type":"array"},"kind":{"const":"structure"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_field"},"minItems":1,"type":"array"},"kind":{"const":"class"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["fields","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"class":{"$ref":"#/$defs/semantic_member"},"fields":{"items":{"$ref":"#/$defs/semantic_assignment"},"minItems":1,"type":"array"},"kind":{"const":"instance"},"name":{"$ref":"#/$defs/semantic_name"},"priority":{"const":1000}},"required":["arguments","class","fields","kind","name","priority"],"type":"object"},{"additionalProperties":false,"properties":{"constructors":{"items":{"$ref":"#/$defs/semantic_constructor"},"minItems":1,"type":"array"},"kind":{"const":"inductive"},"mutual":{"$ref":"#/$defs/semantic_name"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["constructors","kind","name","parameters","type_parameters"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"body":{"$ref":"#/$defs/semantic_term"},"executable":{"type":"boolean"},"kind":{"const":"definition"},"mutual":{"$ref":"#/$defs/semantic_name"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"production":{"$ref":"#/$defs/semantic_production"},"recursive_argument":{"$ref":"#/$defs/semantic_name"},"result":{"$ref":"#/$defs/semantic_type"},"termination":{"additionalProperties":false,"properties":{"evidence":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array"},"measure":{"$ref":"#/$defs/semantic_term"}},"required":["evidence","measure"],"type":"object"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["body","kind","name","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"theorem"},"name":{"$ref":"#/$defs/semantic_name"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"type":"array"},"proof":{"$ref":"#/$defs/semantic_proof"},"statement":{"$ref":"#/$defs/semantic_term"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["kind","name","parameters","proof","statement"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"artifact"},"length":{"minimum":0,"type":"integer"},"name":{"$ref":"#/$defs/semantic_name"},"role":{"enum":["binary","dataset","parameters","table","vocabulary"]},"schema":{"$ref":"#/$defs/semantic_artifactSchema"},"sha256":{"pattern":"^[0-9a-f]{64}$","type":"string"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["kind","length","name","role","schema","sha256","type"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"input":{"$ref":"#/$defs/semantic_modelBinder"},"invariant":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"contract"},"name":{"$ref":"#/$defs/semantic_name"},"output":{"$ref":"#/$defs/semantic_modelBinder"},"postcondition":{"$ref":"#/$defs/semantic_member"},"precondition":{"$ref":"#/$defs/semantic_member"},"state":{"$ref":"#/$defs/semantic_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"validators":{"items":{"$ref":"#/$defs/semantic_contractValidator"},"type":"array"}},"required":["input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"descriptor":{"$ref":"#/$defs/semantic_descriptor"},"executable":{"type":"boolean"},"input":{"$ref":"#/$defs/semantic_modelBinder"},"kind":{"const":"realization"},"name":{"$ref":"#/$defs/semantic_name"},"output":{"$ref":"#/$defs/semantic_type"},"state":{"$ref":"#/$defs/semantic_realizationState"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["descriptor","input","kind","name","output"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/semantic_claim"},"minItems":1,"type":"array"},"contract":{"$ref":"#/$defs/semantic_modelUse"},"kind":{"const":"evidence"},"name":{"$ref":"#/$defs/semantic_name"},"realization":{"$ref":"#/$defs/semantic_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["claims","contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"contract":{"$ref":"#/$defs/semantic_modelUse"},"entry":{"items":{"$ref":"#/$defs/semantic_member"},"type":"array"},"evidence":{"items":{"$ref":"#/$defs/semantic_modelUse"},"type":"array"},"kind":{"const":"model"},"name":{"$ref":"#/$defs/semantic_name"},"realization":{"$ref":"#/$defs/semantic_modelUse"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["contract","kind","name","realization"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"invariant":{"$ref":"#/$defs/semantic_logicInvariant"},"kind":{"const":"logic"},"name":{"$ref":"#/$defs/semantic_name"},"ranking":{"$ref":"#/$defs/semantic_member"},"relation":{"$ref":"#/$defs/semantic_member"},"state":{"$ref":"#/$defs/semantic_contractState"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["kind","name","relation","state"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"binding":{"$ref":"#/$defs/semantic_ruleBinding"},"conclusion":{"$ref":"#/$defs/semantic_term"},"executable":{"type":"boolean"},"guard":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"inference_rule"},"logic":{"$ref":"#/$defs/semantic_modelUse"},"name":{"$ref":"#/$defs/semantic_name"},"progress":{"$ref":"#/$defs/semantic_member"},"soundness":{"$ref":"#/$defs/semantic_member"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["conclusion","guard","kind","logic","name","soundness"],"type":"object"},{"additionalProperties":false,"properties":{"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"candidate":{"$ref":"#/$defs/semantic_modelBinder"},"check":{"$ref":"#/$defs/semantic_member"},"complete":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"verifier"},"name":{"$ref":"#/$defs/semantic_name"},"sound":{"$ref":"#/$defs/semantic_member"},"specification":{"$ref":"#/$defs/semantic_member"},"subject":{"$ref":"#/$defs/semantic_modelBinder"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true}},"required":["candidate","check","kind","name","sound","specification","subject"],"type":"object"},{"additionalProperties":false,"properties":{"answer":{"$ref":"#/$defs/semantic_reasoningAnswer"},"axioms":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"claims":{"items":{"$ref":"#/$defs/semantic_reasoningClaim"},"type":"array"},"executable":{"type":"boolean"},"kind":{"const":"reasoner"},"logic":{"$ref":"#/$defs/semantic_modelUse"},"name":{"$ref":"#/$defs/semantic_name"},"observation":{"$ref":"#/$defs/semantic_modelBinder"},"observe":{"$ref":"#/$defs/semantic_term"},"rules":{"items":{"$ref":"#/$defs/semantic_modelUse"},"type":"array"},"strategy":{"$ref":"#/$defs/semantic_reasoningStrategy"},"type_parameters":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"verifier":{"$ref":"#/$defs/semantic_modelUse"}},"required":["kind","name","observation","rules","strategy","verifier"],"type":"object"}]},"semantic_descriptor":{"oneOf":[{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"deterministic"}},"required":["body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"default":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"rule"},"rules":{"items":{"$ref":"#/$defs/semantic_realizationRule"},"minItems":1,"type":"array"}},"required":["default","kind","rules"],"type":"object"},{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/semantic_member"},"features":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"statistical"},"labels":{"items":{"$ref":"#/$defs/semantic_term"},"minItems":1,"type":"array"},"scheme":{"const":"linear_scoring"},"weights":{"$ref":"#/$defs/semantic_member"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/semantic_member"}},"required":["bias","features","kind","labels","scheme","weights","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"architecture":{"const":"integer_feedforward"},"decoder":{"$ref":"#/$defs/semantic_neuralDecoder"},"encoder":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"neural"},"layers":{"items":{"$ref":"#/$defs/semantic_neuralLayer"},"minItems":1,"type":"array"},"width":{"minimum":1,"type":"integer"},"width_evidence":{"$ref":"#/$defs/semantic_member"}},"required":["architecture","decoder","encoder","kind","layers","width","width_evidence"],"type":"object"},{"additionalProperties":false,"properties":{"form":{"$ref":"#/$defs/semantic_compositeForm"},"kind":{"const":"composite"}},"required":["form","kind"],"type":"object"}]},"semantic_field":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","type"],"type":"object"},"semantic_logicInvariant":{"additionalProperties":false,"properties":{"predicate":{"$ref":"#/$defs/semantic_member"},"preserves":{"$ref":"#/$defs/semantic_member"}},"required":["predicate","preserves"],"type":"object"},"semantic_member":{"additionalProperties":false,"properties":{"module":{"$ref":"#/$defs/semantic_name"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["name"],"type":"object"},"semantic_modelBinder":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","type"],"type":"object"},"semantic_modelUse":{"additionalProperties":false,"properties":{"member":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["member"],"type":"object"},"semantic_name":{"pattern":"^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)*$","type":"string"},"semantic_nestedMember":{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/semantic_name"},"branches":{"items":{"$ref":"#/$defs/semantic_proofBranch"},"minItems":1,"type":"array"},"statement":{"$ref":"#/$defs/semantic_term"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["binder","branches","statement","type"],"type":"object"},"semantic_neuralDecoder":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"argmax"},"labels":{"items":{"$ref":"#/$defs/semantic_term"},"minItems":1,"type":"array"}},"required":["kind","labels"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/semantic_name"},"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"function"}},"required":["binder","body","kind"],"type":"object"}]},"semantic_neuralLayer":{"oneOf":[{"additionalProperties":false,"properties":{"bias":{"$ref":"#/$defs/semantic_member"},"inputs":{"minimum":1,"type":"integer"},"kind":{"const":"dense"},"outputs":{"minimum":1,"type":"integer"},"weights":{"$ref":"#/$defs/semantic_member"}},"required":["bias","inputs","kind","outputs","weights"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"relu"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"requantize"},"maximum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"minimum":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]},"shift":{"maximum":4096,"minimum":0,"type":"integer"}},"required":["kind","maximum","minimum","shift"],"type":"object"}]},"semantic_parameter":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["name","type"],"type":"object"},"semantic_production":{"additionalProperties":false,"properties":{"effects":{"items":{"enum":["allocation","overflow","recursion"]},"type":"array","uniqueItems":true},"targets":{"items":{"enum":["rust-core","rust-std"]},"minItems":1,"type":"array","uniqueItems":true}},"required":["effects","targets"],"type":"object"},"semantic_proof":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"reflexivity"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"decide"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"simplify"}},"required":["definitions","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_proof"},"minItems":1,"type":"array"},"kind":{"const":"constructor"}},"required":["branches","kind"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"cases"},"scrutinee":{"$ref":"#/$defs/semantic_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_proofBranch"},"minItems":1,"type":"array"},"generalizing":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"induction"},"scrutinee":{"$ref":"#/$defs/semantic_name"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"congruence"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"boolean_reflection"},"reflection":{"$ref":"#/$defs/semantic_reflection"}},"required":["kind","reflection"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"law"},"name":{"$ref":"#/$defs/semantic_name"},"premises":{"items":{"$ref":"#/$defs/semantic_member"},"type":"array"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"apply"},"theorem":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"linear_arithmetic"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"definitions":{"items":{"$ref":"#/$defs/semantic_member"},"minItems":1,"type":"array","uniqueItems":true},"kind":{"const":"term_cases"},"scrutinee":{"$ref":"#/$defs/semantic_term"}},"required":["definitions","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_proofBranch"},"minItems":1,"type":"array"},"kind":{"const":"nested_induction"},"members":{"items":{"$ref":"#/$defs/semantic_nestedMember"},"minItems":1,"type":"array"},"scrutinee":{"$ref":"#/$defs/semantic_name"}},"required":["branches","kind","members","scrutinee"],"type":"object"}]},"semantic_proofBranch":{"additionalProperties":false,"properties":{"binders":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"constructor":{"$ref":"#/$defs/semantic_name"},"proof":{"$ref":"#/$defs/semantic_proof"}},"required":["binders","constructor","proof"],"type":"object"},"semantic_realizationRule":{"additionalProperties":false,"properties":{"action":{"$ref":"#/$defs/semantic_term"},"guard":{"$ref":"#/$defs/semantic_term"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["action","guard","name"],"type":"object"},"semantic_realizationState":{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/semantic_term"},"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["initial","name","type"],"type":"object"},"semantic_reasoningAnswer":{"additionalProperties":false,"properties":{"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["name","type","value"],"type":"object"},"semantic_reasoningClaim":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"answer_correct"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"initial_invariant"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"},{"additionalProperties":false,"properties":{"initial":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"observation_invariant"},"predicate":{"$ref":"#/$defs/semantic_member"},"preserved":{"$ref":"#/$defs/semantic_member"}},"required":["initial","kind","predicate","preserved"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"terminates"},"theorem":{"$ref":"#/$defs/semantic_member"}},"required":["kind","theorem"],"type":"object"}]},"semantic_reasoningStrategy":{"oneOf":[{"additionalProperties":false,"properties":{"fuel":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"forward"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"budget":{"$ref":"#/$defs/semantic_term"},"generator":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"generate_and_verify"}},"required":["generator","kind"],"type":"object"},{"additionalProperties":false,"properties":{"deduplicate":{"type":"boolean"},"frontier":{"$ref":"#/$defs/semantic_term"},"fuel":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"search"},"order":{"enum":["breadth_first","depth_first"]}},"required":["kind","order"],"type":"object"}]},"semantic_reflection":{"oneOf":[{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/semantic_member"},"comparison":{"$ref":"#/$defs/semantic_reflectionComparison"},"kind":{"const":"list"},"parameter":{"$ref":"#/$defs/semantic_name"},"proposition_definition":{"$ref":"#/$defs/semantic_member"},"values":{"$ref":"#/$defs/semantic_name"}},"required":["boolean_definition","comparison","kind","parameter","proposition_definition","values"],"type":"object"},{"additionalProperties":false,"properties":{"boolean_definition":{"$ref":"#/$defs/semantic_member"},"fields":{"items":{"$ref":"#/$defs/semantic_reflectionField"},"minItems":1,"type":"array"},"kind":{"const":"record"},"proposition_definition":{"$ref":"#/$defs/semantic_member"},"record":{"$ref":"#/$defs/semantic_name"}},"required":["boolean_definition","fields","kind","proposition_definition","record"],"type":"object"}]},"semantic_reflectionComparison":{"enum":["nat_beq","nat_blt"]},"semantic_reflectionField":{"additionalProperties":false,"properties":{"expected":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]},"field":{"$ref":"#/$defs/semantic_name"}},"required":["expected","field"],"type":"object"},"semantic_ruleBinding":{"additionalProperties":false,"properties":{"candidates":{"$ref":"#/$defs/semantic_term"},"name":{"$ref":"#/$defs/semantic_name"},"type":{"$ref":"#/$defs/semantic_type"}},"required":["candidates","name","type"],"type":"object"},"semantic_term":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"const":"var"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"nat"},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"bool"},"value":{"type":"boolean"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["int","int8","int16","int32","int64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"},{"pattern":"^-[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"integer"},"representation":{"enum":["uint8","uint16","uint32","uint64"]},"value":{"oneOf":[{"const":"0"},{"pattern":"^[1-9][0-9]*$","type":"string"}]}},"required":["kind","representation","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"string"},"value":{"type":"string"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"},"kind":{"const":"bytes"}},"required":["hex","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"primitive"},"operation":{"enum":["append","bit_and","bit_not","bit_or","bit_xor","checked_add","checked_convert","checked_multiply","checked_negate","checked_quotient","checked_subtract","compare_bytes","equal","format_decimal","graph_reachable","graph_successors","graph_topological","index","iterate","iterate_until","join","length","less_than","list_fold","map_contains","map_entries","map_fold","map_insert","map_keys","map_lookup","map_remove","map_size","map_values","multiply","negate","parse_decimal","quotient","remainder","set_contains","set_difference","set_elements","set_fold","set_insert","set_intersection","set_remove","set_size","set_union","shift_left","shift_right","slice","split_exact","subtract","to_int","to_nat","utf8_decode","utf8_encode"]},"result":{"$ref":"#/$defs/semantic_type"}},"required":["arguments","kind","operation","result"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"unit"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"nil"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"head":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"cons"},"tail":{"$ref":"#/$defs/semantic_term"}},"required":["head","kind","tail"],"type":"object"},{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/$defs/semantic_assignment"},"type":"array"},"kind":{"const":"record"},"type":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["fields","kind","type"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"constructor":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"constructor"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","constructor","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"class":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"instance_value"},"resolved":{"$ref":"#/$defs/semantic_member"}},"required":["arguments","class","kind","resolved"],"type":"object"},{"additionalProperties":false,"properties":{"field":{"$ref":"#/$defs/semantic_name"},"kind":{"const":"project"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["field","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"function":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"call"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"condition":{"$ref":"#/$defs/semantic_term"},"else_value":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"if"},"then_value":{"$ref":"#/$defs/semantic_term"}},"required":["condition","else_value","kind","then_value"],"type":"object"},{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/$defs/semantic_branch"},"minItems":1,"type":"array"},"kind":{"const":"match"},"scrutinee":{"$ref":"#/$defs/semantic_term"}},"required":["branches","kind","scrutinee"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"eq"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"le"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"lt"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"add"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"beq"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"ble"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"blt"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"and"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"or"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"iff"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"conclusion":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"implies"},"premise":{"$ref":"#/$defs/semantic_term"}},"required":["conclusion","kind","premise"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"not"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/semantic_parameter"},"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"forall"}},"required":["binder","body","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"prop_and"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"binder":{"$ref":"#/$defs/semantic_parameter"},"body":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"let"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["binder","body","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"pair"},"left":{"$ref":"#/$defs/semantic_term"},"right":{"$ref":"#/$defs/semantic_term"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"first"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"second"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"body":{"$ref":"#/$defs/semantic_term"},"captures":{"items":{"$ref":"#/$defs/semantic_name"},"type":"array","uniqueItems":true},"kind":{"const":"lambda"},"parameters":{"items":{"$ref":"#/$defs/semantic_parameter"},"minItems":1,"type":"array"}},"required":["body","captures","kind","parameters"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"minItems":1,"type":"array"},"function":{"$ref":"#/$defs/semantic_term"},"kind":{"const":"apply"}},"required":["arguments","function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"function":{"$ref":"#/$defs/semantic_member"},"kind":{"const":"function_ref"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["function","kind"],"type":"object"},{"additionalProperties":false,"properties":{"entries":{"items":{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/semantic_term"},"value":{"$ref":"#/$defs/semantic_term"}},"required":["key","value"],"type":"object"},"type":"array"},"key":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"map_literal"},"value":{"$ref":"#/$defs/semantic_type"}},"required":["entries","key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"elements":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"kind":{"const":"set_literal"}},"required":["element","elements","kind"],"type":"object"},{"additionalProperties":false,"properties":{"edges":{"items":{"additionalProperties":false,"properties":{"source":{"$ref":"#/$defs/semantic_term"},"target":{"$ref":"#/$defs/semantic_term"}},"required":["source","target"],"type":"object"},"type":"array"},"kind":{"const":"graph_literal"},"node":{"$ref":"#/$defs/semantic_type"},"nodes":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"}},"required":["edges","kind","node","nodes"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_term"},"type":"array"},"checks":{"items":{"enum":["input_invariant","output_invariant","postcondition","precondition"]},"type":"array","uniqueItems":true},"kind":{"const":"checked_apply"},"model":{"$ref":"#/$defs/semantic_member"},"type_arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"}},"required":["arguments","checks","kind","model"],"type":"object"}]},"semantic_type":{"oneOf":[{"additionalProperties":false,"properties":{"kind":{"enum":["bool","bytes","int","int8","int16","int32","int64","nat","ordering","prop","string","type","uint8","uint16","uint32","uint64","unit"]}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"parameter"},"name":{"$ref":"#/$defs/semantic_name"}},"required":["kind","name"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"list"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"arguments":{"items":{"$ref":"#/$defs/semantic_type"},"type":"array"},"kind":{"const":"named"},"member":{"$ref":"#/$defs/semantic_member"}},"required":["arguments","kind","member"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"option"},"value":{"$ref":"#/$defs/semantic_type"}},"required":["kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"error":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"result"},"ok":{"$ref":"#/$defs/semantic_type"}},"required":["error","kind","ok"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"product"},"left":{"$ref":"#/$defs/semantic_type"},"right":{"$ref":"#/$defs/semantic_type"}},"required":["kind","left","right"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"function"},"parameters":{"items":{"$ref":"#/$defs/semantic_type"},"minItems":1,"type":"array"},"result":{"$ref":"#/$defs/semantic_type"}},"required":["kind","parameters","result"],"type":"object"},{"additionalProperties":false,"properties":{"key":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"map"},"value":{"$ref":"#/$defs/semantic_type"}},"required":["key","kind","value"],"type":"object"},{"additionalProperties":false,"properties":{"element":{"$ref":"#/$defs/semantic_type"},"kind":{"const":"set"}},"required":["element","kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"contract_violation"}},"required":["kind"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"reasoning_failure"}},"required":["kind"],"type":"object"}]},"source":{"additionalProperties":false,"properties":{"path":{"minLength":1,"type":"string"},"sha256":{"$ref":"#/$defs/digest"}},"required":["path","sha256"],"type":"object"}},"$id":"https://github.com/UOR-Foundation/LexLean/schemas/semantic-snapshot-v2.schema.json","$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"compiler_semantics_id":{"$ref":"#/$defs/digest"},"language":{"const":"1.2"},"lexicon_closure":{"$ref":"#/$defs/semanticValue"},"modules":{"items":{"$ref":"#/$defs/module"},"type":"array"},"semantic_id":{"$ref":"#/$defs/digest"},"source_id":{"$ref":"#/$defs/digest"},"spec":{"const":"lexlean/semantic-snapshot/2"}},"required":["compiler_semantics_id","language","lexicon_closure","modules","semantic_id","source_id","spec"],"title":"LexLean language-1.2 semantic snapshot","type":"object"} From 0b0c95d96ad544723dceee31e936c5d0b27445cf Mon Sep 17 00:00:00 2001 From: Alex Flom Date: Fri, 23 Oct 2026 01:10:17 -0600 Subject: [PATCH 03/10] fix(proof): review of nested_induction: no lock, a backend diagnostic, Option and Result members (SM-37, #278) - examples/nested-induction carries no lexlean.lock: every lock is regenerated at landing on the identity current then. conformance_sm_37 locks its own copy of the example. - backend/semantic.rs: a nested_induction scrutinee with no named parameter is an LLI9001 diagnostic (proof and proof_branch return Result), not a guessed `.rec`. - conformance_sm_37: Lean-backed positive cases with one member under Option and one under Result, with the goals asserted in the recursor's order, so the none,some and error,ok rows of family_constructors are exercised; the language-1.1 use and the four scrutinee misuses go through refuse_project (LLT4001, the message, no backend output). - The SM-37 row, SPEC section 31 and the scenario say the proof names a parameter of the theorem; CONFORMANCE.md regenerated. - VERIFICATION.md: the lib-test count is 213. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk --- CONFORMANCE.md | 2 +- SPEC.md | 2 +- VERIFICATION.md | 26 ++- .../src/cases/semantic_ir/nested.rs | 162 +++++++++++++++--- crates/lexlean/src/backend/semantic.rs | 44 +++-- examples/nested-induction/lexlean.lock | 47 ----- features/suites/semantic-ir.feature | 2 +- model/ids.toml | 2 +- 8 files changed, 196 insertions(+), 91 deletions(-) delete mode 100644 examples/nested-induction/lexlean.lock diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 9eba457c83..b66f726ab8 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -576,7 +576,7 @@ the error registry does not sanction (R5, `ERRORS.md`). | `SM-34` | `build` | A version 2 core-module row may be derived, stating its name, kind, and extension state, and for a sparse casesOn its recipe, and no universe parameters, type, or value: the decoder makes the constant with the pinned Lean's own construction at the row's place in the order, and refuses the module when the name is not one the pinned Lean reserves and the row states no sparse casesOn recipe, when the construction does not make the name, or when the constant it makes is not a theorem, definition, or abbreviation as the row says; the notation writes a derived row without a type, the schema and the linker refuse a derived row that states what the construction decides, a stored row is still checked against the construction, the decoder checks that the constructors a recipe names are constructors of the type and are named once, that the module states every sparse casesOn its construction makes, and that every derived sparse casesOn is referred to by the type or value of a row, and the content of a derived row is checked by its uses alone, so that a recipe naming other valid constructors of the type is not distinguished where the use accepts it; and the shipped preservation library states every row that carries a sparse casesOn record or is named like an equation, an unfolding equation, a splitter, or an else equation as a derived row. | | `SM-35` | `build` | A language-1.2 theorem may be proved by `term_cases`, a split on the value of a document term: the proof names a term and a nonempty, strictly sorted, duplicate-free list of prior document definitions, the term's type is an inductive type of the document, and the backend lowers the proof to a split of the goal on every constructor of that type with the hypothesis that equates the term to the constructor, then `simp only` over the named definitions, that hypothesis, and the reduction of a conditional on a decided condition, with closed propositions decided, which uses exactly the axioms the theorem's policy states; the schema, the linker, the notation, the Lean backend, the canonical LaTeX, and the formatter accept it, and a use in language 1.1, a term whose type is not an inductive type of the document, an empty list, an unsorted or repeated name, a name that is not a prior definition, and a theorem parameter that takes the hypothesis's name are each refused. | | `SM-36` | `build` | A language-1.2 `cases` proof may split a local of type `Bool` into its two constructors: the proof names the local and gives a branch for `false` and one for `true`, each with no binders, the backend lowers it to `cases` on the local with those two alternatives, the theorem verifies with exactly the axioms its policy states, and the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it; a use in language 1.1, a missing branch, a repeated branch, a branch with a binder, and an `induction` on a Boolean are each refused. | -| `SM-37` | `build` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | +| `SM-37` | `build` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names a parameter of the theorem, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | ## stdlib diff --git a/SPEC.md b/SPEC.md index e84fddc597..b5ccee5e17 100644 --- a/SPEC.md +++ b/SPEC.md @@ -10373,7 +10373,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `SM-34` | `semantic-ir` | A version 2 core-module row may be derived, stating its name, kind, and extension state, and for a sparse casesOn its recipe, and no universe parameters, type, or value: the decoder makes the constant with the pinned Lean's own construction at the row's place in the order, and refuses the module when the name is not one the pinned Lean reserves and the row states no sparse casesOn recipe, when the construction does not make the name, or when the constant it makes is not a theorem, definition, or abbreviation as the row says; the notation writes a derived row without a type, the schema and the linker refuse a derived row that states what the construction decides, a stored row is still checked against the construction, the decoder checks that the constructors a recipe names are constructors of the type and are named once, that the module states every sparse casesOn its construction makes, and that every derived sparse casesOn is referred to by the type or value of a row, and the content of a derived row is checked by its uses alone, so that a recipe naming other valid constructors of the type is not distinguished where the use accepts it; and the shipped preservation library states every row that carries a sparse casesOn record or is named like an equation, an unfolding equation, a splitter, or an else equation as a derived row. | §17.10 | | `SM-35` | `semantic-ir` | A language-1.2 theorem may be proved by `term_cases`, a split on the value of a document term: the proof names a term and a nonempty, strictly sorted, duplicate-free list of prior document definitions, the term's type is an inductive type of the document, and the backend lowers the proof to a split of the goal on every constructor of that type with the hypothesis that equates the term to the constructor, then `simp only` over the named definitions, that hypothesis, and the reduction of a conditional on a decided condition, with closed propositions decided, which uses exactly the axioms the theorem's policy states; the schema, the linker, the notation, the Lean backend, the canonical LaTeX, and the formatter accept it, and a use in language 1.1, a term whose type is not an inductive type of the document, an empty list, an unsorted or repeated name, a name that is not a prior definition, and a theorem parameter that takes the hypothesis's name are each refused. | §17.10 | | `SM-36` | `semantic-ir` | A language-1.2 `cases` proof may split a local of type `Bool` into its two constructors: the proof names the local and gives a branch for `false` and one for `true`, each with no binders, the backend lowers it to `cases` on the local with those two alternatives, the theorem verifies with exactly the axioms its policy states, and the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it; a use in language 1.1, a missing branch, a repeated branch, a branch with a binder, and an `induction` on a Boolean are each refused. | §17.10 | -| `SM-37` | `semantic-ir` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | §16.9, §17.10, §17.12 | +| `SM-37` | `semantic-ir` | A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names a parameter of the theorem, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. | §16.9, §17.10, §17.12 | | `DF-01` | `declarations` | A valid type-definition sentence emits one nonrecursive sort-valued Lean def linked to its document entry. | §15.7, §18.6 | | `DF-02` | `declarations` | A valid term-definition sentence emits one nonrecursive explicitly typed Lean def. | §15.7, §18.6 | | `DF-03` | `declarations` | A valid predicate-definition sentence emits one nonrecursive Prop-valued Lean def. | §15.7, §18.6 | diff --git a/VERIFICATION.md b/VERIFICATION.md index d093bff974..3449bf086b 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -898,11 +898,33 @@ refuses 49 plants as `LLT4001` before any backend output: - `induction` on the same nested type (the message names `nested_induction`), a language-1.1 module, and a scrutinee that is a natural number, a type with no nested field, a type in a mutual group, or a local that is not a theorem - parameter. + parameter. Each of these goes through `refuse_project`, which asserts the + code `LLT4001`, the message, and that `build` writes no output. + +`conformance_sm_37` also proves, and verifies under the pinned Lean, a theorem +with one member under `Option` (`Chain | link : Option Chain -> Chain`) and one +under `Result` (`Attempt | wrap : Result Attempt Nat -> Attempt`), so the +`none, some` and `error, ok` rows of `family_constructors` are exercised. Their +goals have different binder counts (`next =>` then `next value valueHypothesis +=>`; `next code =>` then `next value valueHypothesis =>`), and the case asserts +the goals in the recursor's order. With the `Option` rows swapped in +`family_constructors` (`some` before `none`) the case fails: + +```text +thread 'conformance_sm_37' panicked at crates/conformance/src/cases/semantic_ir/nested.rs:406:9: +assertion `left == right` failed: an Option member: module +``` + +The plant was restored with `git checkout`; the case passes (77.1 s). + +The example carries no `lexlean.lock` (every lock is regenerated at landing on +the identity then current); the case locks its own copy of the example. A +scrutinee with no named parameter is a backend `LLI9001` and no longer a guessed +`.rec`. `conformance_df_13` still asserts the `induction` refusal, `conformance_ex_07` refuses the `induction-nested-type` fixture with the new message, and -`cargo test -p lexlean --lib` passes (212 tests). Run on a tree whose locks were +`cargo test -p lexlean --lib` passes (213 tests). Run on a tree whose locks were regenerated locally and not committed (the identity moved, see the landing list of the pull request), `conformance_ex_07` fails only on the fixtures whose goldens bind the identity (`certificate-*-rejected`, diff --git a/crates/conformance/src/cases/semantic_ir/nested.rs b/crates/conformance/src/cases/semantic_ir/nested.rs index 289d0b43b9..37e43d4313 100644 --- a/crates/conformance/src/cases/semantic_ir/nested.rs +++ b/crates/conformance/src/cases/semantic_ir/nested.rs @@ -29,10 +29,19 @@ fn branches(proof: &mut Value, level: usize) -> &mut Vec { /// `List (String * Json)`, and `String * Json`. const LEVELS: usize = 4; +/// A copy of the committed example, locked for this compiler: the example +/// carries no lock, because every lock is regenerated on the identity current +/// at landing. +fn example_copy() -> P { + let copy = P::copy_example("nested-induction"); + copy.relock(); + copy +} + /// A copy of the example whose theorem's proof the edit changed, and the /// error of checking it. fn planted(edit: &dyn Fn(&mut Value)) -> P { - let copy = P::copy_example("nested-induction"); + let copy = example_copy(); let text = copy.read("src/Main.lex.tex"); let mut module = support::module_json(&text); edit(&mut theorem(&mut module)["proof"]); @@ -46,13 +55,18 @@ fn planted(edit: &dyn Fn(&mut Value)) -> P { /// The plant is refused by the linker (LLT4001) with a message that names the /// misuse, and no backend output is written. fn refuse(what: &str, edit: &dyn Fn(&mut Value), message: &str) { - let copy = planted(edit); - let error = copy.check_fails_with("LLT4001"); + refuse_project(what, &planted(edit), message); +} + +/// The project is refused by the linker (LLT4001) with a message that names +/// the misuse, and no backend output is written. +fn refuse_project(what: &str, project: &P, message: &str) { + let error = project.check_fails_with("LLT4001"); assert!( error.to_string().contains(message), "{what}: expected {message:?}, got {error}" ); - copy.assert_no_backend_output(); + project.assert_no_backend_output(); } /// A whole module, in the authoring notation, for the misuses that need a @@ -187,9 +201,82 @@ theorem{ axioms: [] }"; +/// A `Chain` of one optional `Chain`: the family holds `Option Chain`. +const OPTION_CHAIN: &str = r"inductive{ + name: Chain, + type_parameters: [], + parameters: [], + constructors: [{name: link, fields: [(Option Chain)]}] +} + +theorem{ + name: chain_refl, + parameters: [chain : Chain], + statement: (chain = chain), + proof: nested_induction{ + scrutinee: chain, + branches: [ + {constructor: link, binders: [rest, restHypothesis], proof: reflexivity{}} + ], + members: [ + { + type: (Option Chain), + binder: choice, + statement: (choice = choice), + branches: [ + {constructor: some, binders: [value, valueHypothesis], proof: reflexivity{}}, + {constructor: none, binders: [], proof: reflexivity{}} + ] + } + ] + }, + axioms: [] +}"; + +/// An `Attempt` that wraps a `Result` of itself or a natural number: the +/// family holds `Result Attempt Nat`, whose `ok` is the member. +const RESULT_ATTEMPT: &str = r"inductive{ + name: Attempt, + type_parameters: [], + parameters: [], + constructors: [{name: wrap, fields: [(Result Attempt Nat)]}] +} + +theorem{ + name: attempt_refl, + parameters: [attempt : Attempt], + statement: (attempt = attempt), + proof: nested_induction{ + scrutinee: attempt, + branches: [ + {constructor: wrap, binders: [outcome, outcomeHypothesis], proof: reflexivity{}} + ], + members: [ + { + type: (Result Attempt Nat), + binder: settled, + statement: (settled = settled), + branches: [ + {constructor: ok, binders: [value, valueHypothesis], proof: reflexivity{}}, + {constructor: error, binders: [code], proof: reflexivity{}} + ] + } + ] + }, + axioms: [] +}"; + +/// The positional goals of the generated Lean, in order. +fn goal_lines(lean: &str) -> Vec<&str> { + lean.lines() + .filter(|line| line.trim_start().starts_with("next")) + .map(str::trim) + .collect() +} + /// Run the case of `SM-37`. pub fn run() { - let accepted = P::copy_example("nested-induction"); + let accepted = example_copy(); let checked = support::checked_project(&accepted); let core = serde_json::to_value( checked.modules["Main"] @@ -218,13 +305,8 @@ pub fn run() { // `Json`, then `nil` and `cons` of `List Json`, `nil` and `cons` of // `List (String * Json)`, and `mk` of the pair). let lean = built_lean(&accepted); - let goals: Vec<&str> = lean - .lines() - .filter(|line| line.trim_start().starts_with("next")) - .map(str::trim) - .collect(); assert_eq!( - goals, + goal_lines(&lean), [ "next =>", "next content =>", @@ -287,11 +369,49 @@ pub fn run() { "members: [\n {\n type: (List (Rose (Rose Nat))),", "members: [\n {\n type: (List (Rose Nat)),", ))); - let shown = format!("{:?}", extra.check_err()); - assert!( - shown.contains("nested_induction is missing the member"), - "{shown}" + refuse_project( + "a member of another instantiation", + &extra, + "nested_induction is missing the member", ); + // A member under `Option` and one under `Result`: the minor premises of + // `Option` are `none` then `some`, and those of `Result` (`Except`) are + // `error` then `ok`. The goals have different binder counts, so a + // recursor whose order the table has wrong would not elaborate. + for (what, source, goals_expected, motive) in [ + ( + "an Option member", + OPTION_CHAIN, + [ + "next rest restHypothesis =>", + "next =>", + "next value valueHypothesis =>", + ], + "induction chain using Chain.rec\n", + ), + ( + "a Result member", + RESULT_ATTEMPT, + [ + "next outcome outcomeHypothesis =>", + "next code =>", + "next value valueHypothesis =>", + ], + "induction attempt using Attempt.rec\n", + ), + ] { + let project = project_of(&module(source)); + project.check_ok(); + let text = built_lean(&project); + assert_eq!(goal_lines(&text), goals_expected, "{what}: {text}"); + assert!( + text.contains(motive) + && text.contains("(motive_2 := fun") + && !text.contains("(motive_3 :="), + "{what}: {text}" + ); + support::verify_ok_backed("SM-37", &project); + } // The misuses are refused by the linker, each as LLT4001 before any // backend output. @@ -442,10 +562,10 @@ pub fn run() { .replace("lexlean/semantic-module/2", "lexlean/semantic-module/1"), ); old.relock(); - let shown = format!("{:?}", old.check_err()); - assert!( - shown.contains("`nested_induction proof` is a language-1.2 construct"), - "language 1.1: {shown}" + refuse_project( + "language 1.1", + &old, + "`nested_induction proof` is a language-1.2 construct", ); } // The scrutinee must be a nested inductive of the document that is in no @@ -474,8 +594,6 @@ pub fn run() { "is not a parameter of the theorem", ), ] { - let project = project_of(&module(&declarations)); - let shown = format!("{:?}", project.check_err()); - assert!(shown.contains(message), "{what}: {shown}"); + refuse_project(what, &project_of(&module(&declarations)), message); } } diff --git a/crates/lexlean/src/backend/semantic.rs b/crates/lexlean/src/backend/semantic.rs index c1b357d166..2c615ef1a6 100644 --- a/crates/lexlean/src/backend/semantic.rs +++ b/crates/lexlean/src/backend/semantic.rs @@ -1221,7 +1221,7 @@ impl Render<'_> { branch: &SemanticProofBranch, indent: usize, owners: &ScrutineeTypes, - ) -> String { + ) -> Result { let binders = if branch.binders.is_empty() { String::new() } else { @@ -1235,21 +1235,26 @@ impl Render<'_> { .join(" ") ) }; - format!( + Ok(format!( "{}| {}{} =>\n{}", " ".repeat(indent), identifier(&branch.constructor), binders, - self.proof(&branch.proof, indent + 1, owners) - ) + self.proof(&branch.proof, indent + 1, owners)? + )) } /// `owners` names, for each theorem parameter of a document inductive /// type, that type: `nested_induction` names the recursor Lean generated /// for the scrutinee's type (§16.9, `SM-37`). - fn proof(&self, proof: &SemanticProof, indent: usize, owners: &ScrutineeTypes) -> String { + fn proof( + &self, + proof: &SemanticProof, + indent: usize, + owners: &ScrutineeTypes, + ) -> Result { let pad = " ".repeat(indent); - match proof { + Ok(match proof { SemanticProof::Reflexivity => format!("{pad}rfl\n"), SemanticProof::Decide => format!("{pad}decide\n"), SemanticProof::LinearArithmetic { definitions } => { @@ -1271,7 +1276,7 @@ impl Render<'_> { let mut out = format!("{pad}constructor\n"); for branch in branches { out.push_str(&format!("{pad}·\n")); - out.push_str(&self.proof(branch, indent + 1, owners)); + out.push_str(&self.proof(branch, indent + 1, owners)?); } out } @@ -1281,7 +1286,7 @@ impl Render<'_> { } => { let mut out = format!("{pad}cases {} with\n", identifier(scrutinee)); for branch in branches { - out.push_str(&self.proof_branch(branch, indent, owners)); + out.push_str(&self.proof_branch(branch, indent, owners)?); } out } @@ -1307,7 +1312,7 @@ impl Render<'_> { identifier(scrutinee) ); for branch in branches { - out.push_str(&self.proof_branch(branch, indent, owners)); + out.push_str(&self.proof_branch(branch, indent, owners)?); } out } @@ -1324,10 +1329,17 @@ impl Render<'_> { // the type, then those of each member. Two members can share // a constructor name, which `induction ... with` refuses, so // the goals are named by position. - let recursor = owners.get(scrutinee).map_or_else( - || format!("{}.rec", identifier(scrutinee)), - |owner| format!("{}.rec", self.member(owner)), - ); + // The linker admits only a theorem parameter of a document + // inductive type, so a scrutinee with no owner is a defect. + let owner = owners.get(scrutinee).ok_or_else(|| { + Diagnostic::new( + code!("LLI9001"), + format!( + "phase lean-backend: nested_induction scrutinee `{scrutinee}` is not a theorem parameter of a document inductive type" + ), + ) + })?; + let recursor = format!("{}.rec", self.member(owner)); let mut out = format!("{pad}induction {} using {recursor}\n", identifier(scrutinee)); for (index, member) in members.iter().enumerate() { out.push_str(&format!( @@ -1348,7 +1360,7 @@ impl Render<'_> { .collect(); out.push_str(&format!( "{pad}next{binders} =>\n{}", - self.proof(&branch.proof, indent + 1, owners) + self.proof(&branch.proof, indent + 1, owners)? )); } out @@ -1460,7 +1472,7 @@ impl Render<'_> { .collect::(); format!("{pad}exact {}{arguments}\n", self.member(theorem)) } - } + }) } } @@ -2305,7 +2317,7 @@ pub fn render_lean( "public theorem {name}{}{binders} : {} := by\n{}", render.scoped_type_parameters(type_parameters, declaration), render.term(statement), - render.proof(proof, 1, &scrutinee_types(parameters)) + render.proof(proof, 1, &scrutinee_types(parameters))? )); } SemanticDeclaration::Artifact { .. } diff --git a/examples/nested-induction/lexlean.lock b/examples/nested-induction/lexlean.lock deleted file mode 100644 index 936269591f..0000000000 --- a/examples/nested-induction/lexlean.lock +++ /dev/null @@ -1,47 +0,0 @@ -spec = "lexlean/lock/2" -language = "1.2" -compiler_semantics = "81a5f530241bed4ca42585e2345d91be731fe46121284fbe4c199ea356489b10" -project_config_sha256 = "c7c9eb0c9422b501f5f1922e32c3624307cb0e7a3848adb1351be3a064af5659" -lean_toolchain = "leanprover/lean4:v4.32.1" - -[[workspace_file]] -path = "lake-manifest.json" -sha256 = "076c2dd3c4f4149bb126d34a1a1538e265c7609c58920faa9bc19223168a2015" - -[[workspace_file]] -path = "lakefile.toml" -sha256 = "4fb32105b02352c7775ecaf594bb852f05b4dfc2b03f77c27ab6fa2dc1ac6827" - -[[workspace_file]] -path = "lean-toolchain" -sha256 = "8e3538e0ab5f81a3ee04927d8838c8c674e0e112838b4b3ce87ec218143276af" - -[[package]] -id = "lexlean.core" -version = "1.2.0" -kind = "builtin" -source = "embedded" -revision = "compiler-semantics" -tree_sha256 = "827317cae68c162f3a96c8a8de4e53ab348e7d3724fd2b834fa85ecde1a1b392" -manifest_sha256 = "271079763d269cc873531f515e56da960cd6321393b9460ff0e617666fa01d71" -imports = [] - -[[package]] -id = "lexlean.std.bool" -version = "1.2.0" -kind = "builtin" -source = "embedded" -revision = "compiler-semantics" -tree_sha256 = "3bc0fb09d706ffa7d5a1363302ea87c049acc7c7dcafde63c62682620c11be9b" -manifest_sha256 = "de58de2cf18a7a5a62d8c20649139d6dfe1f7b16b3130c75f150fbac5440a71e" -imports = ["lexlean.core@1.2.0"] - -[[package]] -id = "lexlean.std.nat" -version = "1.2.0" -kind = "builtin" -source = "embedded" -revision = "compiler-semantics" -tree_sha256 = "e0db021e01b91d651c43921d66f6b0023c8efbf17cac2ec53192ce5305e4e1ac" -manifest_sha256 = "6fb446b39e3c1c18a5f10cfa1f7aa2bd431837719eb0eb7489aadf452c9420a7" -imports = ["lexlean.core@1.2.0", "lexlean.std.bool@1.2.0"] diff --git a/features/suites/semantic-ir.feature b/features/suites/semantic-ir.feature index 70c3973f81..da3d7cb089 100644 --- a/features/suites/semantic-ir.feature +++ b/features/suites/semantic-ir.feature @@ -259,7 +259,7 @@ Feature: semantic-ir And each planted project is refused naming the misuse @SM-37 @build - Scenario: A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. + Scenario: A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names a parameter of the theorem, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001. Given a language-1.2 project whose type holds a `List` of itself and a `List` of pairs that end in itself, whose mutual definition groups range over its recursive family, and whose theorem over every value of the type is proved by `nested_induction`, and the planted projects that misuse the form When the project is linked, built, and verified by the pinned Lean, its formatted source and its LaTeX are read back, and each planted project is linked Then the generated Lean induces over the recursor the pinned Lean generates for the type, with the goals in the order of its minor premises, and the theorem verifies with exactly the axioms `propext` and `Quot.sound` and the formatter writes the proof unchanged diff --git a/model/ids.toml b/model/ids.toml index c3e4a89d03..27dcf3f135 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -719,7 +719,7 @@ statement = "A language-1.2 `cases` proof may split a local of type `Bool` into id = "SM-37" level = "build" suite = "semantic-ir" -statement = "A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names the local, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001." +statement = "A language-1.2 theorem may be proved by `nested_induction`, an induction over a nested inductive type of the document, one that holds a member of itself under `List`, `Option`, `Result`, or a product and is in no mutual group: the proof names a parameter of the theorem, states one proposition for each auxiliary member of the type's recursive family in the order the pinned Lean's recursor takes them, and gives a branch for every constructor of the type and of each auxiliary member, each binding the constructor's fields followed by one hypothesis for each field that is a member of the family, in field order; the backend lowers it to `induction` over the recursor the pinned Lean generates for the type, with the propositions as its auxiliary motives and the goals taken in the order of its minor premises, so that a theorem over every value of a type with a constructor that holds a `List` of the type verifies under the pinned Lean 4.32.1 with exactly the axioms `propext` and `Quot.sound`, the set its build observes; the schema, the linker, the notation, the formatter, and the canonical LaTeX accept it, and a use in language 1.1, a local whose type is not a nested inductive of the document or lies in a mutual group, an auxiliary member that is missing, repeated, or out of order, a missing or repeated branch, a branch with the wrong number of binders, a proposition that is not well typed, and an `induction` proof on a nested type are each refused as LLT4001." [[id]] id = "DF-01" From d6d838fa0761c94fcf7524620b9daf7dbcca1421 Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:36:08 +0000 Subject: [PATCH 04/10] SP-31: a definition recurses on the argument its source declares (#314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Certificate A reduces a structural definition on its declared argument, but the Lean backend stated the argument only for a mutual group. Lean took the first parameter every recursive call decreases, so `paramsOf names types ...` recursed on `names`, stuck on the free list at `Ty.TUnit`, and the kernel refused `__rel_N` (LLV7013). The backend now states the argument when a definition is executable and matches a parameter before it. No committed definition has that shape. `lean_backend` moves with the regeneration of this branch, as I10 and §30.1 require. Co-Authored-By: Claude Opus 5.5 --- .github/bdd-parts.json | 3 +- CHANGELOG.md | 6 ++ CONFORMANCE.md | 1 + README.md | 2 +- SPEC.md | 10 +- VERIFICATION.md | 43 +++++++++ crates/conformance/src/cases/mod.rs | 1 + crates/conformance/src/cases/preservation.rs | 2 + .../src/cases/recursive_argument.rs | 73 ++++++++++++++ crates/conformance/src/cases/repository.rs | 2 +- crates/conformance/tests/conformance.rs | 5 + crates/lexlean/src/backend/semantic.rs | 42 +++++++- features/suites/preservation.feature | 7 ++ model/ids.toml | 6 ++ .../recursive-argument/lake-manifest.json | 6 ++ .../fixtures/recursive-argument/lakefile.toml | 2 + .../recursive-argument/lean-toolchain | 1 + .../fixtures/recursive-argument/lexlean.toml | 27 ++++++ .../recursive-argument/src/Main.lex.tex | 95 +++++++++++++++++++ xtask/src/spec_links.rs | 4 +- 20 files changed, 326 insertions(+), 12 deletions(-) create mode 100644 crates/conformance/src/cases/recursive_argument.rs create mode 100644 tests/fixtures/recursive-argument/lake-manifest.json create mode 100644 tests/fixtures/recursive-argument/lakefile.toml create mode 100644 tests/fixtures/recursive-argument/lean-toolchain create mode 100644 tests/fixtures/recursive-argument/lexlean.toml create mode 100644 tests/fixtures/recursive-argument/src/Main.lex.tex diff --git a/.github/bdd-parts.json b/.github/bdd-parts.json index 0e631af319..565f8a06de 100644 --- a/.github/bdd-parts.json +++ b/.github/bdd-parts.json @@ -241,7 +241,8 @@ "SP-28" ], "preservation-std": [ - "SP-29" + "SP-29", + "SP-31" ] } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 33a97fe4f1..e9a9e037eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,12 @@ workspace carried at those versions without a tag. ## Unreleased +- `SP-31`, certificate A of a recursive function with a matched parameter before + its recursive argument (#314). The Lean backend states the declared argument + with `termination_by structural` when a definition is executable and matches + such a parameter, where Lean's own search took that parameter and left the + definition stuck on it (`LLV7013`). `lean_backend` of language 1.2 moves. + - The #34 closure pass (documentation and evidence; no register row, language datum, schema, or compiler source moves). Sixteen examples carry a `README.md` that names the register rows whose gates run on them, what diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 722a511296..8d06c3a739 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -403,6 +403,7 @@ the error registry does not sanction (R5, `ERRORS.md`). | `SP-28` | `build` | The meaning of the runtime's buffer, share, and replace primitives is stated over the model and its laws are kernel-checked: the module `RustPrims` of the compiler project (language 1.2, on `RustMemory` and `RustLists`) reads a buffer as the list of its items in order (`readBuf`), gives the primitives their erased meaning on that list (`erasedPush` and `erasedLength` are the calculus primitives `append` and `length`, stated on a list by `prim_append_nil`, `prim_append_cons`, `prim_length_nil` and `prim_length_cons`; `erasedTruncate` keeps a prefix), and states what the runtime does with a buffer as `bufNew` (`Vec::with_capacity`), `pushGrow` (the push of `RustMemory`, after a growth when the buffer is full), `bufTruncate`, and the length, and the pinned Lean accepts, with exactly the axioms its policy states, a theorem for each of these laws, the set the case lists and does not read from the module: the push of a buffer, grown when it is full, reads as the items and the item after them (`push_reads`, with `first_of_snoc`, `append_nothing`, `less_than_itself`, `put_into_blank`), a new buffer of a capacity reads as no items (`new_reads`), a truncation reads as the first items (`truncate_reads`, `first_of_take`), and its length is the number of its items (`length_reads`, with `first_of_front`, `length_of_items`); a clone of a list's buffer (`cloneHandle`, the `clone` of its `Rc`) reads as the handle it clones, holds the buffer that handle holds, and keeps it from being alone (`clone_reads` (by definition), `clone_holds` (by definition), `clone_blocks`), a buffer with no other handle is alone (`alone_without_others` (by definition)), and a replaced place reads as it did while the place holds the value (`replace_old_reads` (by definition), `replace_now_reads` (by definition)); a push that puts the item in front, a full buffer that is not grown, a truncation that keeps one too many, a clone that does not hold, a replace that returns the new value, a length that counts one more, a new buffer that is not empty, a theorem for another function, and a missing theorem are each refused; that the runtime's `Vec`, `Rc`, and `mem::replace` behave as the model, and that the primitives of the declared semantics are given these readings, are the evidence of the differential and of the pinned rustc and the work of the first function of H4a, and are not claimed here, and `share_copy`, the `Rc::from` of a slice or text, is given no meaning here: it belongs to H4b with `Str` and `Bytes`. | | `SP-29` | `build` | The functions of the `rust-std` runtime that the language-1.2 module `RustStd` of the compiler project defines, the list functions `append_list`, `length_list`, `index_list`, and `slice_list` and the byte and text functions `append_bytes`, `length_bytes`, `length_string`, `index_bytes`, `slice_bytes`, `utf8_encode`, `utf8_decode`, `compare_bytes`, `split_exact`, and `join` and the number functions `parse_int`, `format_int`, and the `format_` and `parse_` function of each of the eight fixed widths (`u8` to `i64`), are each one machine call (`Machine.listAppend`, `listLength`, `listIndex`, `listSlice`, `bytesAppend`, `bytesLength`, `stringLength`, `bytesIndex`, `bytesSlice`, `utf8Encode`, `utf8Decode`, `bytesCompare`, `stringSplit`, `stringJoin`, `formatDecimal`, `parseDecimal`, `parseDecimalInt`, `formatDecimalInt`; `parseDecimalInt` is optional, and `parse_int` turns its `None` into `Err(Overflow)` as `nat_add` does), whose meaning `RustSemantics` states as the existing calculus primitive of the runtime item of the same function (`append`, `length`, `index`, `slice`, `utf8Encode`, `utf8Decode`, `compareBytes`, `splitExact`, `join`, `formatDecimal`, and `parseDecimal` at a width or at the integers, of `TargetSyntax.Prim`), and the pinned Lean accepts, with exactly the axioms its policy states, a theorem `refines_` for each, of the shape of those of the core runtime (`SP-22`): for every list, byte string, text, and number (and every position, start, count, delimiter, and maximum), the declared semantics' run of the function in the std crate of the module equals the run of the runtime item of the same name, the set of theorems equalling the set of the functions the module defines; this is the whole of what is kernel-checked here, and it does not refine the walks of the support impl with their work ticks, nor the decimal check `canonical_decimal` and the digits of the methods that hold the number text, which are evidence and not proof: they are held by the abstraction theorems of `RustLists` and `RustPrims` (`SP-27`, `SP-28`), by the validator twin of `BS-09`, and by the differential of `RB-20` with counted work, which cannot construct a list of 2^64 cells, so that the point at which the length walk's count overflows, which is where the `natResult` of `Prim.length` overflows, is declared and not exercised; the type parameter of the signature is carried by the syntax (`RustType.param`) and erased by the semantics; a theorem for another function, a function without a theorem, a theorem that states another runtime item, and a machine call whose primitive is another are each refused. | | `SP-30` | `build` | Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item. | +| `SP-31` | `build` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | ## production diff --git a/README.md b/README.md index e2a440927e..af2b1f59c3 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,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 467 registered conformance IDs are implemented and pass; `just vv` runs clean from a checkout with the pinned toolchain installed. +All 468 registered conformance IDs are implemented and pass; `just vv` runs clean from a checkout 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. diff --git a/SPEC.md b/SPEC.md index d64ec1dc17..daadd9bed5 100644 --- a/SPEC.md +++ b/SPEC.md @@ -2830,7 +2830,12 @@ either backend runs; they do not defer to what Lean would accept. definition decreases only on `Nat`, `List`, or a self-recursive inductive with no nested occurrence and no mutual group, exactly the types `induction` accepts: a nested or mutual type has no single structural - eliminator for one function. + eliminator for one function. The argument Lean recurses on is the declared + one: with no stated argument Lean takes the first parameter that every + recursive call decreases, and a call can decrease only a parameter the body + matches, so an executable definition that matches a parameter before its + declared argument states the argument with `termination_by structural` + (`SP-31`). Certificate A reduces the definition on the declared argument. 7. **Induction.** `induction` applies to a self-recursive inductive with no nested occurrence and no mutual group, and binds the constructor fields followed by one hypothesis per direct recursive field, in field order. @@ -11266,6 +11271,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `SP-28` | `preservation` | The meaning of the runtime's buffer, share, and replace primitives is stated over the model and its laws are kernel-checked: the module `RustPrims` of the compiler project (language 1.2, on `RustMemory` and `RustLists`) reads a buffer as the list of its items in order (`readBuf`), gives the primitives their erased meaning on that list (`erasedPush` and `erasedLength` are the calculus primitives `append` and `length`, stated on a list by `prim_append_nil`, `prim_append_cons`, `prim_length_nil` and `prim_length_cons`; `erasedTruncate` keeps a prefix), and states what the runtime does with a buffer as `bufNew` (`Vec::with_capacity`), `pushGrow` (the push of `RustMemory`, after a growth when the buffer is full), `bufTruncate`, and the length, and the pinned Lean accepts, with exactly the axioms its policy states, a theorem for each of these laws, the set the case lists and does not read from the module: the push of a buffer, grown when it is full, reads as the items and the item after them (`push_reads`, with `first_of_snoc`, `append_nothing`, `less_than_itself`, `put_into_blank`), a new buffer of a capacity reads as no items (`new_reads`), a truncation reads as the first items (`truncate_reads`, `first_of_take`), and its length is the number of its items (`length_reads`, with `first_of_front`, `length_of_items`); a clone of a list's buffer (`cloneHandle`, the `clone` of its `Rc`) reads as the handle it clones, holds the buffer that handle holds, and keeps it from being alone (`clone_reads` (by definition), `clone_holds` (by definition), `clone_blocks`), a buffer with no other handle is alone (`alone_without_others` (by definition)), and a replaced place reads as it did while the place holds the value (`replace_old_reads` (by definition), `replace_now_reads` (by definition)); a push that puts the item in front, a full buffer that is not grown, a truncation that keeps one too many, a clone that does not hold, a replace that returns the new value, a length that counts one more, a new buffer that is not empty, a theorem for another function, and a missing theorem are each refused; that the runtime's `Vec`, `Rc`, and `mem::replace` behave as the model, and that the primitives of the declared semantics are given these readings, are the evidence of the differential and of the pinned rustc and the work of the first function of H4a, and are not claimed here, and `share_copy`, the `Rc::from` of a slice or text, is given no meaning here: it belongs to H4b with `Str` and `Bytes`. | §17.17 | | `SP-29` | `preservation` | The functions of the `rust-std` runtime that the language-1.2 module `RustStd` of the compiler project defines, the list functions `append_list`, `length_list`, `index_list`, and `slice_list` and the byte and text functions `append_bytes`, `length_bytes`, `length_string`, `index_bytes`, `slice_bytes`, `utf8_encode`, `utf8_decode`, `compare_bytes`, `split_exact`, and `join` and the number functions `parse_int`, `format_int`, and the `format_` and `parse_` function of each of the eight fixed widths (`u8` to `i64`), are each one machine call (`Machine.listAppend`, `listLength`, `listIndex`, `listSlice`, `bytesAppend`, `bytesLength`, `stringLength`, `bytesIndex`, `bytesSlice`, `utf8Encode`, `utf8Decode`, `bytesCompare`, `stringSplit`, `stringJoin`, `formatDecimal`, `parseDecimal`, `parseDecimalInt`, `formatDecimalInt`; `parseDecimalInt` is optional, and `parse_int` turns its `None` into `Err(Overflow)` as `nat_add` does), whose meaning `RustSemantics` states as the existing calculus primitive of the runtime item of the same function (`append`, `length`, `index`, `slice`, `utf8Encode`, `utf8Decode`, `compareBytes`, `splitExact`, `join`, `formatDecimal`, and `parseDecimal` at a width or at the integers, of `TargetSyntax.Prim`), and the pinned Lean accepts, with exactly the axioms its policy states, a theorem `refines_` for each, of the shape of those of the core runtime (`SP-22`): for every list, byte string, text, and number (and every position, start, count, delimiter, and maximum), the declared semantics' run of the function in the std crate of the module equals the run of the runtime item of the same name, the set of theorems equalling the set of the functions the module defines; this is the whole of what is kernel-checked here, and it does not refine the walks of the support impl with their work ticks, nor the decimal check `canonical_decimal` and the digits of the methods that hold the number text, which are evidence and not proof: they are held by the abstraction theorems of `RustLists` and `RustPrims` (`SP-27`, `SP-28`), by the validator twin of `BS-09`, and by the differential of `RB-20` with counted work, which cannot construct a list of 2^64 cells, so that the point at which the length walk's count overflows, which is where the `natResult` of `Prim.length` overflows, is declared and not exercised; the type parameter of the signature is carried by the syntax (`RustType.param`) and erased by the semantics; a theorem for another function, a function without a theorem, a theorem that states another runtime item, and a machine call whose primitive is another are each refused. | §17.17 | | `SP-30` | `preservation` | Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item. | §17.16, §17.17 | +| `SP-31` | `preservation` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | | `MD-01` | `models` | Language 1.2 artifact, contract, realization, evidence, and model declarations, the checked_apply term, the contract_violation type, and the less_than primitive belong to the closed lexlean/semantic-module/2 schema and its snapshot schema, are rejected under language 1.1 before either backend runs, and admit no member outside the closed schema, such as prompt text, a free-form description, or raw model configuration. | §17.12 | | `MD-02` | `models` | A model artifact is admitted only from a configured, content-addressed, confined project file whose SHA-256 and byte length equal its declaration and whose bytes decode under its declared closed schema to its declared type and role; a missing artifact or a digest or length mismatch fails with LLR3007, a schema, type, or role violation fails with LLR3008, and the generated Lean embeds the exact bytes with a kernel-checked theorem that the typed value is their decoding. | §17.12, §10.1, §26.3 | | `MD-03` | `models` | A contract names typed input, output, and optional state interfaces and prior proposition-valued predicates of exactly those interface signatures, and each runtime validator is an executable Boolean definition of the same signature linked to its predicate by a statement-exact soundness theorem and an optional completeness theorem that Lean restates against the fixed model semantics; any mismatch fails with LLT4006. | §17.12 | @@ -11380,7 +11386,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:** 467. +**Total required capability IDs:** 468. 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 7eb30114ec..d2cf974d75 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -11506,6 +11506,7 @@ the first panic message, trimmed. | `PD-02` | `production/eligibility.rs`: `analyse_module` no longer returns `Ok(None)` for a module without roots | `a module with formal content and no root is never analysed` | | `PD-03` | `production/eligibility.rs`: termination evidence is no longer inserted into `erased` | `termination evidence is erased, never realized` (`left: []`, `right: ["Production.Kernel.countdown_decreases"]`) | | `PD-06` | `production/eligibility.rs`: every `EffectRow` is built with no sources | `array shorter than minItems 1` at `/roots/1/targets/0/effects/0/sources` of `production-eligibility.schema.json` | +| `SP-31` | `backend/semantic.rs`: the clause is written only for a mutual group | `` `paramsOf` matches a parameter before its argument and states the argument ``, the generated definition with no clause; the issue's project on that binary: `LLV7013` in `__rel_1` | | `TC-01` | `calculus/mod.rs`: `canonical` binds parameters but keeps their spelling | `assertion left == right failed: adt-evaluation` (alpha variant bytes differ) | | `TC-02` | `calculus/check.rs`: the match exhaustiveness test made `false &&` | `an invalid program loads: expected `the match is not exhaustive: Adt { constructor: 2 } is not covered`` | | `MD-01` | `ir/semantic.rs`: the language-1.1 gate `first_language_1_2_construct` made `&& false` | `tests/negative/model-under-1.1: expected "`contract declaration` is a language-1.2 construct"` | @@ -12179,3 +12180,45 @@ On the merged member, regenerated, on one WSL host with 4 build jobs: The figures of the `BS-06` record above are that record's own run and stay as measured. + +## A definition recurses on the argument its source declares (`SP-31`, #314) + +### The defect + +Certificate A of a production root was refused (`LLV7013`, in `__rel_N`) for a +recursive function whose declared argument is not its first parameter, when a +parameter before it is matched in the recursive arm. The certificate was right +and the generated Lean was not what it assumed. The backend stated the argument +only for a mutual group, so Lean searched: it takes the first parameter every +recursive call decreases, and `paramsOf rest tail ...` decreases `names`. The +definition was then `List.brecOn` on `names`, `f names Ty.TUnit ...` was stuck on +the free `names`, and the minor premise at `TUnit` did not typecheck. A small +Lean file shows it: with no clause, `#print` gives `List.brecOn` and +`recArgPos` is 0, and `example : f n Ty.a b = 0 := rfl` fails; with +`termination_by structural _ t _ => t` it gives `Ty.brecOn` and the `rfl` +passes. The issue's variants with the argument first and with an arm that does +not match the list leave Lean no other parameter to take. Its `Nat` variant does +not show its source, so it was not checked against this. + +### The fix + +The backend states the argument when a definition is executable and a parameter +before the argument is the scrutinee of a match in its body. A call can decrease +only a parameter the body matches, so nothing else can make Lean choose +differently. A definition that is not executable has no certificate, and the +seven such definitions in `compiler/` keep the recursion their proofs were +written against. + +### The check can fail + +| Run | Observed | +| --- | --- | +| `conformance_sp_31`, fixed source | ok, 253 s | +| `conformance_sp_31`, clause written only for a mutual group | fails at the text check before Lean runs, with the generated definition in the message | +| the issue's project, on a binary with that plant | `LLV7013` in `__rel_1`, exit 1, 123 s | +| the issue's project, fixed source | exit 0, 145 s | + +A scan of every `.lex.tex` source found no executable definition with this shape, +so no committed generated Lean changes. `lean_backend` still moves, because I10 +and §30.1 do not let generated artifacts or a failure diagnostic change under +one identity. diff --git a/crates/conformance/src/cases/mod.rs b/crates/conformance/src/cases/mod.rs index f0f15d57e3..7f35c2a082 100644 --- a/crates/conformance/src/cases/mod.rs +++ b/crates/conformance/src/cases/mod.rs @@ -37,6 +37,7 @@ mod production; mod production_export; mod proofs; mod reasoning; +mod recursive_argument; mod repository; mod runtime; mod runtime_semantics; diff --git a/crates/conformance/src/cases/preservation.rs b/crates/conformance/src/cases/preservation.rs index 34b300d46e..a22548c4ae 100644 --- a/crates/conformance/src/cases/preservation.rs +++ b/crates/conformance/src/cases/preservation.rs @@ -4816,6 +4816,8 @@ pub fn run(id: &str) { "SP-29" => super::rust_std::run(id), // §17.16, §17.17: every runtime item has its refinement statement. "SP-30" => super::rust_items::run(id), + // §17.12, §17.17: a definition recurses on its declared argument. + "SP-31" => super::recursive_argument::run(id), "SP-23" => { let syntax = support::module_json( &std::fs::read_to_string( diff --git a/crates/conformance/src/cases/recursive_argument.rs b/crates/conformance/src/cases/recursive_argument.rs new file mode 100644 index 0000000000..1b6a0608d6 --- /dev/null +++ b/crates/conformance/src/cases/recursive_argument.rs @@ -0,0 +1,73 @@ +//! A definition recurses in its generated Lean on the argument its source +//! declares (SPEC.md §17.12, §17.17): `SP-31`, #314. +//! +//! Certificate A reduces a structural definition on the declared argument, so +//! it holds only if Lean recursed on that argument. `paramsOf` of the fixture +//! is the case where Lean's own search would take another: it matches a list +//! written before the argument, and every recursive call decreases that list. +//! `countOf` has an earlier parameter it does not match, and `modelOf` is not +//! executable, so neither states an argument: their bytes, like those of every +//! committed definition, are what they were before the rule. + +use crate::production_consumer::{self, AppRoot, Application}; +use crate::support::{self, P}; + +/// The fixture's generated clause for `paramsOf`. +const STATED: &str = "termination_by structural _ types _ _ _ _ => types"; + +/// The generated Lean of the fixture's definition `name`: from its line to the +/// next declaration. +fn definition<'a>(lean: &'a str, name: &str) -> &'a str { + let head = format!("public def {name} "); + let start = lean + .find(&head) + .unwrap_or_else(|| panic!("`{name}` is generated")); + let rest = &lean[start..]; + let end = rest[head.len()..] + .find("public def ") + .map_or(rest.len(), |next| next + head.len()); + &rest[..end] +} + +/// `SP-31`. +/// +/// # Panics +/// +/// When the fixture's Lean or its export disagrees with the row. +pub fn run(id: &str) { + assert_eq!(id, "SP-31"); + let project = P::copy_tests_project("fixtures/recursive-argument"); + project.relock(); + let lean = support::lean_text(&support::rendered(&project), "Main"); + assert!( + definition(&lean, "paramsOf").contains(STATED), + "`paramsOf` matches a parameter before its argument and states the argument:\n{}", + definition(&lean, "paramsOf") + ); + for control in ["countOf", "modelOf"] { + assert!( + !definition(&lean, control).contains("termination_by"), + "`{control}` states no argument:\n{}", + definition(&lean, control) + ); + } + if !support::lean_backed(id) { + return; + } + let application = Application { + roots: vec![AppRoot { + root: "RecursiveArgument.Main.tailOf".to_owned(), + name: "recursive_argument".to_owned(), + version: "1.0.0".to_owned(), + targets: vec!["rust-std".to_owned()], + }], + }; + let exported = + production_consumer::export(&project.root.join("lexlean.toml"), &application, &[]); + if let Err(error) = exported { + panic!( + "the kernel accepts every certificate of `tailOf`: {:?}", + error.diagnostics + ); + } +} diff --git a/crates/conformance/src/cases/repository.rs b/crates/conformance/src/cases/repository.rs index 2e0a8f7c11..bc6d98bbe0 100644 --- a/crates/conformance/src/cases/repository.rs +++ b/crates/conformance/src/cases/repository.rs @@ -813,7 +813,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(), 467, "§31 has 467 rows"); + assert_eq!(table.len(), 468, "§31 has 468 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 053376ff8d..f959c87ca3 100644 --- a/crates/conformance/tests/conformance.rs +++ b/crates/conformance/tests/conformance.rs @@ -1780,6 +1780,11 @@ fn conformance_sp_30() { repo_conformance::cases::run("SP-30"); } +#[test] +fn conformance_sp_31() { + repo_conformance::cases::run("SP-31"); +} + #[test] fn conformance_md_01() { repo_conformance::cases::run("MD-01"); diff --git a/crates/lexlean/src/backend/semantic.rs b/crates/lexlean/src/backend/semantic.rs index b0d2fea8ad..6d7f6167cf 100644 --- a/crates/lexlean/src/backend/semantic.rs +++ b/crates/lexlean/src/backend/semantic.rs @@ -149,6 +149,31 @@ fn proof_uses(proof: &SemanticProof, local: &str) -> bool { } } +/// Whether a parameter before the recursive argument is matched in `body`. +/// With no stated argument, Lean recurses on the first parameter every +/// recursive call decreases, and a call can decrease only a parameter the body +/// matches, so this is when Lean's choice can differ from the checked argument. +fn matches_earlier_parameter( + parameters: &[SemanticParameter], + recursive_argument: &str, + body: &SemanticTerm, +) -> bool { + let earlier: BTreeSet<&str> = parameters + .iter() + .map(|parameter| parameter.name.as_str()) + .take_while(|name| *name != recursive_argument) + .collect(); + let mut found = false; + crate::ir::semantic::visit_terms(body, &mut |term| { + if let SemanticTerm::Match { scrutinee, .. } = term { + if let SemanticTerm::Var { name } = scrutinee.as_ref() { + found |= earlier.contains(name.as_str()); + } + } + }); + found +} + pub(crate) fn term_uses(term: &SemanticTerm, local: &str) -> bool { let pair = |left: &SemanticTerm, right: &SemanticTerm| { term_uses(left, local) || term_uses(right, local) @@ -2120,6 +2145,7 @@ pub fn render_lean( recursive_argument, mutual, termination, + executable, .. } => { let type_binders = render.scoped_type_parameters(type_parameters, declaration); @@ -2163,9 +2189,15 @@ pub fn render_lean( ) })?; text.push_str(&equations); - if mutual.is_some() { + if mutual.is_some() + || (*executable + && matches_earlier_parameter(parameters, recursive_argument, body)) + { // §17.12: a mutual group is structurally recursive by - // construction; Lean must confirm exactly that. + // construction; Lean must confirm exactly that. So + // must an executable definition Lean could recurse + // otherwise, since its certificate A reduces the + // definition on the checked argument. // Only the decreasing parameter is used after `=>`; // naming the others would trip Lean's unused-variable // linter, which fails verification. @@ -2184,9 +2216,9 @@ pub fn render_lean( "termination_by structural {binders} => {}\n", identifier(recursive_argument) )); - if group_of(index + 1) != group_of(index) { - text.push_str("end\n"); - } + } + if mutual.is_some() && group_of(index + 1) != group_of(index) { + text.push_str("end\n"); } } else { let name = identifier(name); diff --git a/features/suites/preservation.feature b/features/suites/preservation.feature index f3e4d7e20f..25a654e9ba 100644 --- a/features/suites/preservation.feature +++ b/features/suites/preservation.feature @@ -206,3 +206,10 @@ Feature: preservation When each theorem `refines_` of RustRuntime and RustStd is read for the function it runs and the runtime item it states Then every runtime item is stated by exactly one theorem, at its profile, on the function the generated code calls for it, or is a trait item with the theorems of SP-25 And a theorem left out, a statement of another item, a statement at the other profile, an item called as another function, and a trait item without its theorems are each refused naming the item + + @SP-31 @build + Scenario: A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. + Given the `recursive-argument` fixture, whose `paramsOf` matches a list written before its declared recursive argument + When the fixture's generated Lean is read and its production root is exported + Then `paramsOf` states its argument, its two controls state none, and the kernel accepts every certificate of the root + And a backend that stops stating the argument is refused by the kernel with `LLV7013` diff --git a/model/ids.toml b/model/ids.toml index 44d732b8f8..ead07372e8 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -2137,6 +2137,12 @@ id = "SP-30" level = "build" suite = "preservation" statement = "Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item." +[[id]] +id = "SP-31" +level = "build" +suite = "preservation" +statement = "A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before." + [[id]] id = "MD-01" level = "build" diff --git a/tests/fixtures/recursive-argument/lake-manifest.json b/tests/fixtures/recursive-argument/lake-manifest.json new file mode 100644 index 0000000000..2467df2f28 --- /dev/null +++ b/tests/fixtures/recursive-argument/lake-manifest.json @@ -0,0 +1,6 @@ +{"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": [], + "name": "recursive_argument", + "lakeDir": ".lake", + "fixedToolchain": false} diff --git a/tests/fixtures/recursive-argument/lakefile.toml b/tests/fixtures/recursive-argument/lakefile.toml new file mode 100644 index 0000000000..c511cd3127 --- /dev/null +++ b/tests/fixtures/recursive-argument/lakefile.toml @@ -0,0 +1,2 @@ +name = "recursive_argument" +version = "0.1.0" diff --git a/tests/fixtures/recursive-argument/lean-toolchain b/tests/fixtures/recursive-argument/lean-toolchain new file mode 100644 index 0000000000..2b61957be5 --- /dev/null +++ b/tests/fixtures/recursive-argument/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.32.1 diff --git a/tests/fixtures/recursive-argument/lexlean.toml b/tests/fixtures/recursive-argument/lexlean.toml new file mode 100644 index 0000000000..17d0d4c8c3 --- /dev/null +++ b/tests/fixtures/recursive-argument/lexlean.toml @@ -0,0 +1,27 @@ +spec = "lexlean/project/1" +name = "recursive-argument" +language = "1.2" +module_prefix = "RecursiveArgument" +source_roots = ["src"] +entrypoints = ["src/Main.lex.tex"] +build_root = ".lexlean" +lockfile = "lexlean.lock" +lean_workspace = "." +lean_toolchain = "leanprover/lean4:v4.32.1" + +[[lexicon_source]] +package = "lexlean.std.nat" +kind = "builtin" + +[limits] +max_file_bytes = 4194304 +max_total_source_bytes = 67108864 +max_primitive_atoms = 2000000 +max_token_lattice_edges = 4000000 +max_parse_states = 4000000 +max_ir_nodes = 2000000 +max_scope_depth = 1024 +max_import_depth = 128 +max_diagnostics = 256 +max_child_output_bytes = 16777216 +child_timeout_ms = 300000 diff --git a/tests/fixtures/recursive-argument/src/Main.lex.tex b/tests/fixtures/recursive-argument/src/Main.lex.tex new file mode 100644 index 0000000000..377ddb3ef1 --- /dev/null +++ b/tests/fixtures/recursive-argument/src/Main.lex.tex @@ -0,0 +1,95 @@ +\begin{lexlean}{Main} +\useglossary{lexlean.std.nat@1.2.0} +\title{Natural number addition} +\begin{semanticmodule} +inductive{ + name: Ty, + type_parameters: [], + parameters: [], + constructors: [ + {name: TUnit, fields: []}, + {name: TBool, fields: []}, + {name: TNat, fields: []}, + {name: TInt, fields: []}, + {name: TFixed, fields: [Nat]}, + {name: TString, fields: []}, + {name: TBytes, fields: []}, + {name: TOrdering, fields: []}, + {name: TOption, fields: [Ty]}, + {name: TResult, fields: [Ty, Ty]}, + {name: TList, fields: [Ty]}, + {name: TPair, fields: [Ty, Ty]}, + {name: TAdt, fields: [Nat]}, + {name: TFn, fields: [Ty, Ty]}, + {name: TNil, fields: []}, + {name: TCons, fields: [Ty, Ty]} + ] +} + +inductive{ + name: Par, + type_parameters: [], + parameters: [], + constructors: [{name: ParNil, fields: []}, {name: ParCons, fields: [Nat, Nat, Par]}] +} + +definition{ + name: paramsOf, + parameters: [names : (List Nat), types : Ty, body : Nat, known : Ty, position : Nat, empty : Nat], + result: Par, + body: (match types + | Ty.TUnit => (ctor Par.ParNil) + | Ty.TBool => (ctor Par.ParNil) + | Ty.TNat => (ctor Par.ParNil) + | Ty.TInt => (ctor Par.ParNil) + | Ty.TFixed u5x0 => (ctor Par.ParNil) + | Ty.TString => (ctor Par.ParNil) + | Ty.TBytes => (ctor Par.ParNil) + | Ty.TOrdering => (ctor Par.ParNil) + | Ty.TOption u9x0 => (ctor Par.ParNil) + | Ty.TResult u10x0 u10x1 => (ctor Par.ParNil) + | Ty.TList u11x0 => (ctor Par.ParNil) + | Ty.TPair u12x0 u12x1 => (ctor Par.ParNil) + | Ty.TAdt u13x0 => (ctor Par.ParNil) + | Ty.TFn u14x0 u14x1 => (ctor Par.ParNil) + | Ty.TNil => (ctor Par.ParNil) + | Ty.TCons head tail => (match names + | List.nil => (ctor Par.ParNil) + | List.cons name rest => (ctor Par.ParCons name 0 (paramsOf rest tail body known (position + 1) empty)))), + executable: true, + recursive_argument: types +} + +definition{ + name: countOf, + parameters: [start : Nat, types : (List Nat)], + result: Nat, + body: (match types + | List.nil => start + | List.cons head tail => (countOf (start + 1) tail)), + executable: true, + recursive_argument: types +} + +definition{ + name: modelOf, + parameters: [names : (List Nat), count : Nat], + result: Nat, + body: (match count + | Nat.zero => 0 + | Nat.succ less => (match names + | List.nil => 0 + | List.cons name rest => (modelOf rest less))), + recursive_argument: count +} + +definition{ + name: tailOf, + parameters: [names : (List Nat), types : Ty], + result: Par, + body: (paramsOf names types 0 (ctor Ty.TUnit) (countOf 0 names) 0), + executable: true, + production: {effects: [allocation, overflow, recursion], targets: [rust-std]} +} +\end{semanticmodule} +\end{lexlean} diff --git a/xtask/src/spec_links.rs b/xtask/src/spec_links.rs index 025f1c5075..7b38fb24c9 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() != 467 { - return Err(format!("RP-07: the §31 table has {} rows, not 467", rows.len()).into()); + if rows.len() != 468 { + return Err(format!("RP-07: the §31 table has {} rows, not 468", 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. From f452cdbf17a17111f03d391ba2ee86ed7c991a57 Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:36:10 +0000 Subject: [PATCH 05/10] SP-32: an arm that returns a boxed field is the read of the box (#310) `fold` read only a returned move or copy and runs before the last-use moves, so `let x = (*b).clone(); x.clone()` was left alone and became `let x = (*b).clone(); x`. Certificate B's `mCons` states an arm through `foldB`, which folds that block, so the kernel refused the arm the crate wrote (LLV7015), and no certificate could state it. `fold` and `returnedLet` of `RustBodies` now read a returned clone too. `lower.rs` is a file of the renderer, so `rust_renderer` and the language-1.2 identity move with the regeneration of this branch. Co-Authored-By: Claude Opus 5.5 --- .github/bdd-parts.json | 3 +- CHANGELOG.md | 5 + CONFORMANCE.md | 1 + README.md | 2 +- SPEC.md | 3 +- VERIFICATION.md | 35 +++++++ bootstrap/src/RustBodies.lex.tex | 2 +- crates/conformance/src/cases/binder_arm.rs | 104 +++++++++++++++++++ crates/conformance/src/cases/mod.rs | 1 + crates/conformance/src/cases/preservation.rs | 2 + crates/conformance/src/cases/repository.rs | 2 +- crates/conformance/tests/conformance.rs | 5 + crates/lexlean/src/calculus/rust/lower.rs | 6 +- features/suites/preservation.feature | 7 ++ model/ids.toml | 6 ++ tests/fixtures/binder-arm/lake-manifest.json | 6 ++ tests/fixtures/binder-arm/lakefile.toml | 2 + tests/fixtures/binder-arm/lean-toolchain | 1 + tests/fixtures/binder-arm/lexlean.toml | 27 +++++ tests/fixtures/binder-arm/src/Main.lex.tex | 62 +++++++++++ xtask/src/spec_links.rs | 4 +- 21 files changed, 277 insertions(+), 9 deletions(-) create mode 100644 crates/conformance/src/cases/binder_arm.rs create mode 100644 tests/fixtures/binder-arm/lake-manifest.json create mode 100644 tests/fixtures/binder-arm/lakefile.toml create mode 100644 tests/fixtures/binder-arm/lean-toolchain create mode 100644 tests/fixtures/binder-arm/lexlean.toml create mode 100644 tests/fixtures/binder-arm/src/Main.lex.tex diff --git a/.github/bdd-parts.json b/.github/bdd-parts.json index 565f8a06de..5be4958e37 100644 --- a/.github/bdd-parts.json +++ b/.github/bdd-parts.json @@ -242,7 +242,8 @@ ], "preservation-std": [ "SP-29", - "SP-31" + "SP-31", + "SP-32" ] } } diff --git a/CHANGELOG.md b/CHANGELOG.md index e9a9e037eb..5f07d2a958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ workspace carried at those versions without a tag. ## Unreleased +- `SP-32`, certificate B of a match arm that returns a boxed field (#310). `fold` + of the Rust lowering and `returnedLet` of `RustBodies` fold a returned clone, + which is the arm the library's `mCons` states (`LLV7015`). `lower.rs` is a file + of the renderer, so `rust_renderer` and the language-1.2 identity move. + - `SP-31`, certificate A of a recursive function with a matched parameter before its recursive argument (#314). The Lean backend states the declared argument with `termination_by structural` when a definition is executable and matches diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 8d06c3a739..5e8f46ae28 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -404,6 +404,7 @@ the error registry does not sanction (R5, `ERRORS.md`). | `SP-29` | `build` | The functions of the `rust-std` runtime that the language-1.2 module `RustStd` of the compiler project defines, the list functions `append_list`, `length_list`, `index_list`, and `slice_list` and the byte and text functions `append_bytes`, `length_bytes`, `length_string`, `index_bytes`, `slice_bytes`, `utf8_encode`, `utf8_decode`, `compare_bytes`, `split_exact`, and `join` and the number functions `parse_int`, `format_int`, and the `format_` and `parse_` function of each of the eight fixed widths (`u8` to `i64`), are each one machine call (`Machine.listAppend`, `listLength`, `listIndex`, `listSlice`, `bytesAppend`, `bytesLength`, `stringLength`, `bytesIndex`, `bytesSlice`, `utf8Encode`, `utf8Decode`, `bytesCompare`, `stringSplit`, `stringJoin`, `formatDecimal`, `parseDecimal`, `parseDecimalInt`, `formatDecimalInt`; `parseDecimalInt` is optional, and `parse_int` turns its `None` into `Err(Overflow)` as `nat_add` does), whose meaning `RustSemantics` states as the existing calculus primitive of the runtime item of the same function (`append`, `length`, `index`, `slice`, `utf8Encode`, `utf8Decode`, `compareBytes`, `splitExact`, `join`, `formatDecimal`, and `parseDecimal` at a width or at the integers, of `TargetSyntax.Prim`), and the pinned Lean accepts, with exactly the axioms its policy states, a theorem `refines_` for each, of the shape of those of the core runtime (`SP-22`): for every list, byte string, text, and number (and every position, start, count, delimiter, and maximum), the declared semantics' run of the function in the std crate of the module equals the run of the runtime item of the same name, the set of theorems equalling the set of the functions the module defines; this is the whole of what is kernel-checked here, and it does not refine the walks of the support impl with their work ticks, nor the decimal check `canonical_decimal` and the digits of the methods that hold the number text, which are evidence and not proof: they are held by the abstraction theorems of `RustLists` and `RustPrims` (`SP-27`, `SP-28`), by the validator twin of `BS-09`, and by the differential of `RB-20` with counted work, which cannot construct a list of 2^64 cells, so that the point at which the length walk's count overflows, which is where the `natResult` of `Prim.length` overflows, is declared and not exercised; the type parameter of the signature is carried by the syntax (`RustType.param`) and erased by the semantics; a theorem for another function, a function without a theorem, a theorem that states another runtime item, and a machine call whose primitive is another are each refused. | | `SP-30` | `build` | Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item. | | `SP-31` | `build` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | +| `SP-32` | `build` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | ## production diff --git a/README.md b/README.md index af2b1f59c3..888d5ceabf 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,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 468 registered conformance IDs are implemented and pass; `just vv` runs clean from a checkout with the pinned toolchain installed. +All 469 registered conformance IDs are implemented and pass; `just vv` runs clean from a checkout 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. diff --git a/SPEC.md b/SPEC.md index daadd9bed5..d228afc9ee 100644 --- a/SPEC.md +++ b/SPEC.md @@ -11272,6 +11272,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `SP-29` | `preservation` | The functions of the `rust-std` runtime that the language-1.2 module `RustStd` of the compiler project defines, the list functions `append_list`, `length_list`, `index_list`, and `slice_list` and the byte and text functions `append_bytes`, `length_bytes`, `length_string`, `index_bytes`, `slice_bytes`, `utf8_encode`, `utf8_decode`, `compare_bytes`, `split_exact`, and `join` and the number functions `parse_int`, `format_int`, and the `format_` and `parse_` function of each of the eight fixed widths (`u8` to `i64`), are each one machine call (`Machine.listAppend`, `listLength`, `listIndex`, `listSlice`, `bytesAppend`, `bytesLength`, `stringLength`, `bytesIndex`, `bytesSlice`, `utf8Encode`, `utf8Decode`, `bytesCompare`, `stringSplit`, `stringJoin`, `formatDecimal`, `parseDecimal`, `parseDecimalInt`, `formatDecimalInt`; `parseDecimalInt` is optional, and `parse_int` turns its `None` into `Err(Overflow)` as `nat_add` does), whose meaning `RustSemantics` states as the existing calculus primitive of the runtime item of the same function (`append`, `length`, `index`, `slice`, `utf8Encode`, `utf8Decode`, `compareBytes`, `splitExact`, `join`, `formatDecimal`, and `parseDecimal` at a width or at the integers, of `TargetSyntax.Prim`), and the pinned Lean accepts, with exactly the axioms its policy states, a theorem `refines_` for each, of the shape of those of the core runtime (`SP-22`): for every list, byte string, text, and number (and every position, start, count, delimiter, and maximum), the declared semantics' run of the function in the std crate of the module equals the run of the runtime item of the same name, the set of theorems equalling the set of the functions the module defines; this is the whole of what is kernel-checked here, and it does not refine the walks of the support impl with their work ticks, nor the decimal check `canonical_decimal` and the digits of the methods that hold the number text, which are evidence and not proof: they are held by the abstraction theorems of `RustLists` and `RustPrims` (`SP-27`, `SP-28`), by the validator twin of `BS-09`, and by the differential of `RB-20` with counted work, which cannot construct a list of 2^64 cells, so that the point at which the length walk's count overflows, which is where the `natResult` of `Prim.length` overflows, is declared and not exercised; the type parameter of the signature is carried by the syntax (`RustType.param`) and erased by the semantics; a theorem for another function, a function without a theorem, a theorem that states another runtime item, and a machine call whose primitive is another are each refused. | §17.17 | | `SP-30` | `preservation` | Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item. | §17.16, §17.17 | | `SP-31` | `preservation` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | +| `SP-32` | `preservation` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | | `MD-01` | `models` | Language 1.2 artifact, contract, realization, evidence, and model declarations, the checked_apply term, the contract_violation type, and the less_than primitive belong to the closed lexlean/semantic-module/2 schema and its snapshot schema, are rejected under language 1.1 before either backend runs, and admit no member outside the closed schema, such as prompt text, a free-form description, or raw model configuration. | §17.12 | | `MD-02` | `models` | A model artifact is admitted only from a configured, content-addressed, confined project file whose SHA-256 and byte length equal its declaration and whose bytes decode under its declared closed schema to its declared type and role; a missing artifact or a digest or length mismatch fails with LLR3007, a schema, type, or role violation fails with LLR3008, and the generated Lean embeds the exact bytes with a kernel-checked theorem that the typed value is their decoding. | §17.12, §10.1, §26.3 | | `MD-03` | `models` | A contract names typed input, output, and optional state interfaces and prior proposition-valued predicates of exactly those interface signatures, and each runtime validator is an executable Boolean definition of the same signature linked to its predicate by a statement-exact soundness theorem and an optional completeness theorem that Lean restates against the fixed model semantics; any mismatch fails with LLT4006. | §17.12 | @@ -11386,7 +11387,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:** 468. +**Total required capability IDs:** 469. 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 d2cf974d75..c17574cd3a 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -11507,6 +11507,7 @@ the first panic message, trimmed. | `PD-03` | `production/eligibility.rs`: termination evidence is no longer inserted into `erased` | `termination evidence is erased, never realized` (`left: []`, `right: ["Production.Kernel.countdown_decreases"]`) | | `PD-06` | `production/eligibility.rs`: every `EffectRow` is built with no sources | `array shorter than minItems 1` at `/roots/1/targets/0/effects/0/sources` of `production-eligibility.schema.json` | | `SP-31` | `backend/semantic.rs`: the clause is written only for a mutual group | `` `paramsOf` matches a parameter before its argument and states the argument ``, the generated definition with no clause; the issue's project on that binary: `LLV7013` in `__rel_1` | +| `SP-32` | `calculus/rust/lower.rs`: `fold` does not read `Expr::Clone` | `the arm reads the box and binds nothing`, the arm being `Let { pat: Bind(Local(2)), value: Unbox(Boxed(2)) }` then `Move(Local(2))`; the issue's project on that binary: `LLV7015` at `Corr.mCons` in `fun1` | | `TC-01` | `calculus/mod.rs`: `canonical` binds parameters but keeps their spelling | `assertion left == right failed: adt-evaluation` (alpha variant bytes differ) | | `TC-02` | `calculus/check.rs`: the match exhaustiveness test made `false &&` | `an invalid program loads: expected `the match is not exhaustive: Adt { constructor: 2 } is not covered`` | | `MD-01` | `ir/semantic.rs`: the language-1.1 gate `first_language_1_2_construct` made `&& false` | `tests/negative/model-under-1.1: expected "`contract declaration` is a language-1.2 construct"` | @@ -12222,3 +12223,37 @@ A scan of every `.lex.tex` source found no executable definition with this shape so no committed generated Lean changes. `lean_backend` still moves, because I10 and §30.1 do not let generated artifacts or a failure diagnostic change under one identity. + +## An arm that returns a boxed field is the read of the box (`SP-32`, #310) + +### The defect + +Certificate B of a production root was refused (`LLV7015`, at `Corr.mCons`) for a +match arm whose whole body is a binder of a boxed field. The certificate could +not have been accepted. `fold` of the lowering folds a block that returns the +binding it just made, but it read only `Move` and `Copy`, and it runs before the +last-use moves. So `let x = (*b).clone(); x.clone()` was not folded, and the +moves then made it `let x = (*b).clone(); x`. `Corr.mCons` states an arm through +`foldB`, which folds that block to `(*b).clone()`, so the arm the crate wrote and +the arm the rule states differ. The certificate builder cannot state the unfolded +arm: `foldN` takes one step per binding, and `directPat` holds the load first, so +the fold always fires. + +### The fix + +`fold` reads a returned clone as it reads a returned move or a copy, and +`returnedLet` of `RustBodies` does the same so that `BS-11`, `BS-13` and `BS-14` +stay equal to the renderer. The fold path of `m_arm` in certificate B, which +restates the load the fold removed, already states this arm. The library does not +change. `lower.rs` is a file of the renderer, so `rust_renderer` and the +language-1.2 identity move. + +### The check can fail + +| Run | Observed | +| --- | --- | +| `conformance_sp_32`, fixed source | ok, 196 s | +| `conformance_sp_32`, `fold` without `Expr::Clone` | fails without Lean: the arm is the load, then `Move(Local(2))` | +| the issue's project, on a binary with that plant | `LLV7015` at `Corr.mCons` in `fun1`, exit 1, 127 s | +| the issue's project, fixed source | exit 0, 137 s | +| the fixture with an overflowing arm, fixed source | exit 0, 141 s; `Ok` wraps the arm's value, so that arm is not folded | diff --git a/bootstrap/src/RustBodies.lex.tex b/bootstrap/src/RustBodies.lex.tex index 6e98692f21..a79cf0e9ce 100644 --- a/bootstrap/src/RustBodies.lex.tex +++ b/bootstrap/src/RustBodies.lex.tex @@ -824,7 +824,7 @@ | RustAst::Expr.ELit u23x0 u23x1 => false | RustAst::Expr.ERead kind read at => (match kind | RustValidate::ReadKind.RkMove => (idEq bound read) - | RustValidate::ReadKind.RkClone => false + | RustValidate::ReadKind.RkClone => (idEq bound read) | RustValidate::ReadKind.RkCopy => (idEq bound read) | RustValidate::ReadKind.RkDeref => false | RustValidate::ReadKind.RkUnbox => false) diff --git a/crates/conformance/src/cases/binder_arm.rs b/crates/conformance/src/cases/binder_arm.rs new file mode 100644 index 0000000000..0662b087b3 --- /dev/null +++ b/crates/conformance/src/cases/binder_arm.rs @@ -0,0 +1,104 @@ +//! A match arm whose whole body is a binder of a boxed field (SPEC.md §17.16, +//! §17.17): `SP-32`, #310. +//! +//! The arm loads the field and returns the load, which `fold` folds to the +//! read of the box. Certificate B's `mCons` states an arm through `foldB`, so +//! a rendering that kept the binding could not be certified at all. The case +//! holds the rendering without Lean, on a hand-built program, and the kernel's +//! acceptance on the fixture: `itemTail` and `itemHead` return either field, +//! and `bumpedTail` returns one in a function that can overflow, whose arm +//! is not folded because `Ok` wraps its value. + +use lexlean::calculus::rust::ast::{Block, Expr as Rust, Ident, ItemDef}; +use lexlean::calculus::rust::{self, Profile}; +use lexlean::calculus::{Adt, Arm, Expr, Function, Program, Shape, Ty, PROGRAM_SPEC}; + +use crate::production_consumer::{self, AppRoot, Application}; +use crate::support::{self, P}; + +/// The rendering of the arm `ECons a b => b`, over a type with an empty +/// constructor and a pair of itself. +fn rendered_arm() -> Block { + let expr = Ty::Adt { index: 0 }; + let body = Expr::Match { + ty: expr.clone(), + scrutinee: Box::new(Expr::Var { name: 0 }), + arms: vec![ + Arm { + shape: Shape::Adt { constructor: 0 }, + binders: Vec::new(), + body: Expr::Build { + shape: Shape::Adt { constructor: 0 }, + ty: expr.clone(), + operands: Vec::new(), + }, + }, + Arm { + shape: Shape::Adt { constructor: 1 }, + binders: vec![1, 2], + body: Expr::Var { name: 2 }, + }, + ], + }; + let program = Program { + spec: PROGRAM_SPEC.to_owned(), + adts: vec![Adt { + constructors: vec![Vec::new(), vec![expr.clone(), expr.clone()]], + }], + functions: vec![Function { + parameters: vec![0], + types: vec![expr.clone()], + result: expr, + body, + }], + }; + let krate = rust::lower(&program, Profile::Std).expect("the program lowers"); + let body = krate + .items + .into_iter() + .find_map(|item| match item { + ItemDef::Function { body, .. } => Some(body), + ItemDef::Enum { .. } | ItemDef::Apply { .. } => None, + }) + .expect("the function is rendered"); + let Rust::Match { arms, .. } = body.tail else { + panic!("the body is a match") + }; + let (_, arm) = arms.into_iter().nth(1).expect("the arm with binders"); + arm +} + +/// `SP-32`. +/// +/// # Panics +/// +/// When the rendering or the fixture's export disagrees with the row. +pub fn run(id: &str) { + assert_eq!(id, "SP-32"); + let arm = rendered_arm(); + assert!( + arm.lets.is_empty() && matches!(arm.tail, Rust::Unbox(Ident::Boxed(_), _)), + "the arm reads the box and binds nothing: {arm:?}" + ); + if !support::lean_backed(id) { + return; + } + let project = P::copy_tests_project("fixtures/binder-arm"); + project.relock(); + let application = Application { + roots: vec![AppRoot { + root: "BinderArm.Main.tailOf".to_owned(), + name: "binder_arm".to_owned(), + version: "1.0.0".to_owned(), + targets: vec!["rust-std".to_owned()], + }], + }; + let exported = + production_consumer::export(&project.root.join("lexlean.toml"), &application, &[]); + if let Err(error) = exported { + panic!( + "the kernel accepts every certificate of `tailOf`: {:?}", + error.diagnostics + ); + } +} diff --git a/crates/conformance/src/cases/mod.rs b/crates/conformance/src/cases/mod.rs index 7f35c2a082..5db93a48de 100644 --- a/crates/conformance/src/cases/mod.rs +++ b/crates/conformance/src/cases/mod.rs @@ -7,6 +7,7 @@ mod artifacts; mod authoring; mod authoring_core; +mod binder_arm; mod bootstrap; /// The performance of the certified components against their oracles (#277). pub use bootstrap::perf as bootstrap_perf; diff --git a/crates/conformance/src/cases/preservation.rs b/crates/conformance/src/cases/preservation.rs index a22548c4ae..57d560c490 100644 --- a/crates/conformance/src/cases/preservation.rs +++ b/crates/conformance/src/cases/preservation.rs @@ -4818,6 +4818,8 @@ pub fn run(id: &str) { "SP-30" => super::rust_items::run(id), // §17.12, §17.17: a definition recurses on its declared argument. "SP-31" => super::recursive_argument::run(id), + // §17.16, §17.17: an arm that returns a boxed field. + "SP-32" => super::binder_arm::run(id), "SP-23" => { let syntax = support::module_json( &std::fs::read_to_string( diff --git a/crates/conformance/src/cases/repository.rs b/crates/conformance/src/cases/repository.rs index bc6d98bbe0..4237ccd569 100644 --- a/crates/conformance/src/cases/repository.rs +++ b/crates/conformance/src/cases/repository.rs @@ -813,7 +813,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(), 468, "§31 has 468 rows"); + assert_eq!(table.len(), 469, "§31 has 469 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 f959c87ca3..6f6bdc3de2 100644 --- a/crates/conformance/tests/conformance.rs +++ b/crates/conformance/tests/conformance.rs @@ -1785,6 +1785,11 @@ fn conformance_sp_31() { repo_conformance::cases::run("SP-31"); } +#[test] +fn conformance_sp_32() { + repo_conformance::cases::run("SP-32"); +} + #[test] fn conformance_md_01() { repo_conformance::cases::run("MD-01"); diff --git a/crates/lexlean/src/calculus/rust/lower.rs b/crates/lexlean/src/calculus/rust/lower.rs index 05102d6faa..7cd356ffcc 100644 --- a/crates/lexlean/src/calculus/rust/lower.rs +++ b/crates/lexlean/src/calculus/rust/lower.rs @@ -206,7 +206,9 @@ fn set_tail(block: &mut Block, expr: Expr) { /// Fold every block that binds a value and then returns exactly that binding /// into the value itself: Rust's lint gate refuses the binding, and the two /// evaluate the same. Names are unique in their function, so a block the -/// value is joins the enclosing one without changing any name's meaning. +/// value is joins the enclosing one without changing any name's meaning. A +/// clone is a return too: this pass runs before the last-use moves, which +/// would make it the move that certificate B's `foldB` folds (#310). fn fold(block: &mut Block) { for binding in &mut block.lets { fold_expr(&mut binding.value); @@ -215,7 +217,7 @@ fn fold(block: &mut Block) { loop { let returned = match (&block.tail, block.lets.last()) { ( - Expr::Move(read, _) | Expr::Copy(read, _), + Expr::Move(read, _) | Expr::Copy(read, _) | Expr::Clone(read, _), Some(Let { pat: Pat::Bind(bound), ty: None, diff --git a/features/suites/preservation.feature b/features/suites/preservation.feature index 25a654e9ba..72d1063833 100644 --- a/features/suites/preservation.feature +++ b/features/suites/preservation.feature @@ -213,3 +213,10 @@ Feature: preservation When the fixture's generated Lean is read and its production root is exported Then `paramsOf` states its argument, its two controls state none, and the kernel accepts every certificate of the root And a backend that stops stating the argument is refused by the kernel with `LLV7013` + + @SP-32 @build + Scenario: A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. + Given a hand-built program whose arm returns a boxed field, and the `binder-arm` fixture, whose arms return either field in a function that cannot overflow and in one that can + When the program is rendered and the fixture's production root is exported + Then the arm reads the box and binds nothing, and the kernel accepts every certificate of the root + And a lowering that does not fold a returned clone is refused by the kernel with `LLV7015` diff --git a/model/ids.toml b/model/ids.toml index ead07372e8..6cb64013fa 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -2143,6 +2143,12 @@ level = "build" suite = "preservation" statement = "A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before." +[[id]] +id = "SP-32" +level = "build" +suite = "preservation" +statement = "A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm." + [[id]] id = "MD-01" level = "build" diff --git a/tests/fixtures/binder-arm/lake-manifest.json b/tests/fixtures/binder-arm/lake-manifest.json new file mode 100644 index 0000000000..a73cbd82ad --- /dev/null +++ b/tests/fixtures/binder-arm/lake-manifest.json @@ -0,0 +1,6 @@ +{"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": [], + "name": "binder_arm", + "lakeDir": ".lake", + "fixedToolchain": false} diff --git a/tests/fixtures/binder-arm/lakefile.toml b/tests/fixtures/binder-arm/lakefile.toml new file mode 100644 index 0000000000..3af58d1fcb --- /dev/null +++ b/tests/fixtures/binder-arm/lakefile.toml @@ -0,0 +1,2 @@ +name = "binder_arm" +version = "0.1.0" diff --git a/tests/fixtures/binder-arm/lean-toolchain b/tests/fixtures/binder-arm/lean-toolchain new file mode 100644 index 0000000000..2b61957be5 --- /dev/null +++ b/tests/fixtures/binder-arm/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.32.1 diff --git a/tests/fixtures/binder-arm/lexlean.toml b/tests/fixtures/binder-arm/lexlean.toml new file mode 100644 index 0000000000..62a974a682 --- /dev/null +++ b/tests/fixtures/binder-arm/lexlean.toml @@ -0,0 +1,27 @@ +spec = "lexlean/project/1" +name = "binder-arm" +language = "1.2" +module_prefix = "BinderArm" +source_roots = ["src"] +entrypoints = ["src/Main.lex.tex"] +build_root = ".lexlean" +lockfile = "lexlean.lock" +lean_workspace = "." +lean_toolchain = "leanprover/lean4:v4.32.1" + +[[lexicon_source]] +package = "lexlean.std.nat" +kind = "builtin" + +[limits] +max_file_bytes = 4194304 +max_total_source_bytes = 67108864 +max_primitive_atoms = 2000000 +max_token_lattice_edges = 4000000 +max_parse_states = 4000000 +max_ir_nodes = 2000000 +max_scope_depth = 1024 +max_import_depth = 128 +max_diagnostics = 256 +max_child_output_bytes = 16777216 +child_timeout_ms = 300000 diff --git a/tests/fixtures/binder-arm/src/Main.lex.tex b/tests/fixtures/binder-arm/src/Main.lex.tex new file mode 100644 index 0000000000..b70cc983c9 --- /dev/null +++ b/tests/fixtures/binder-arm/src/Main.lex.tex @@ -0,0 +1,62 @@ +\begin{lexlean}{Main} +\useglossary{lexlean.std.nat@1.2.0} +\title{Natural number addition} +\begin{semanticmodule} +inductive{ + name: Expr, + type_parameters: [], + parameters: [], + constructors: [ + {name: ELit, fields: [Nat, Nat]}, + {name: ERead, fields: [Nat, Nat, Nat]}, + {name: ENil, fields: []}, + {name: ECons, fields: [Expr, Expr]} + ] +} + +definition{ + name: itemTail, + parameters: [items : Expr], + result: Expr, + body: (match items + | Expr.ELit v0 v1 => (ctor Expr.ENil) + | Expr.ERead v0 v1 v2 => (ctor Expr.ENil) + | Expr.ENil => (ctor Expr.ENil) + | Expr.ECons item itemsTail => itemsTail), + executable: true +} + +definition{ + name: itemHead, + parameters: [items : Expr], + result: Expr, + body: (match items + | Expr.ELit v0 v1 => (ctor Expr.ENil) + | Expr.ERead v0 v1 v2 => (ctor Expr.ENil) + | Expr.ENil => (ctor Expr.ENil) + | Expr.ECons item itemsTail => item), + executable: true +} + +definition{ + name: bumpedTail, + parameters: [items : Expr], + result: Expr, + body: (match items + | Expr.ELit v0 v1 => (ctor Expr.ELit (v0 + 1) v1) + | Expr.ERead v0 v1 v2 => (ctor Expr.ENil) + | Expr.ENil => (ctor Expr.ENil) + | Expr.ECons item itemsTail => itemsTail), + executable: true +} + +definition{ + name: tailOf, + parameters: [items : Expr], + result: Expr, + body: (bumpedTail (itemHead (itemTail items))), + production: {effects: [allocation, overflow, recursion], targets: [rust-std]}, + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/xtask/src/spec_links.rs b/xtask/src/spec_links.rs index 7b38fb24c9..6eea6aecad 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() != 468 { - return Err(format!("RP-07: the §31 table has {} rows, not 468", rows.len()).into()); + if rows.len() != 469 { + return Err(format!("RP-07: the §31 table has {} rows, not 469", 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. From 4f41736c76ba814d48c5d5c5e2ad095bff6cd5ff Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:43:05 +0000 Subject: [PATCH 06/10] Renumber to SP-32 and SP-33: SP-31 is claimed on release/v0.5 Draft #295 (#116, the overflow bound) names SP-31 in the same preservation suite for a different claim. Its branch is not merged, so the two would collide at the next forward merge of this line. Co-Authored-By: Claude Opus 5.5 --- .github/bdd-parts.json | 4 ++-- CHANGELOG.md | 4 ++-- CONFORMANCE.md | 4 ++-- SPEC.md | 6 +++--- VERIFICATION.md | 16 ++++++++-------- crates/conformance/src/cases/binder_arm.rs | 6 +++--- crates/conformance/src/cases/preservation.rs | 4 ++-- .../conformance/src/cases/recursive_argument.rs | 6 +++--- crates/conformance/tests/conformance.rs | 8 ++++---- features/suites/preservation.feature | 4 ++-- model/ids.toml | 4 ++-- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/bdd-parts.json b/.github/bdd-parts.json index 5be4958e37..8cbac2cfc7 100644 --- a/.github/bdd-parts.json +++ b/.github/bdd-parts.json @@ -242,8 +242,8 @@ ], "preservation-std": [ "SP-29", - "SP-31", - "SP-32" + "SP-32", + "SP-33" ] } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 47e3ad85e9..328867c509 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,12 +17,12 @@ workspace carried at those versions without a tag. ## Unreleased -- `SP-32`, certificate B of a match arm that returns a boxed field (#310). `fold` +- `SP-33`, certificate B of a match arm that returns a boxed field (#310). `fold` of the Rust lowering and `returnedLet` of `RustBodies` fold a returned clone, which is the arm the library's `mCons` states (`LLV7015`). `lower.rs` is a file of the renderer, so `rust_renderer` and the language-1.2 identity move. -- `SP-31`, certificate A of a recursive function with a matched parameter before +- `SP-32`, certificate A of a recursive function with a matched parameter before its recursive argument (#314). The Lean backend states the declared argument with `termination_by structural` when a definition is executable and matches such a parameter, where Lean's own search took that parameter and left the diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 92f0f013b0..ff079e9308 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -403,8 +403,8 @@ the error registry does not sanction (R5, `ERRORS.md`). | `SP-28` | `build` | The meaning of the runtime's buffer, share, and replace primitives is stated over the model and its laws are kernel-checked: the module `RustPrims` of the compiler project (language 1.2, on `RustMemory` and `RustLists`) reads a buffer as the list of its items in order (`readBuf`), gives the primitives their erased meaning on that list (`erasedPush` and `erasedLength` are the calculus primitives `append` and `length`, stated on a list by `prim_append_nil`, `prim_append_cons`, `prim_length_nil` and `prim_length_cons`; `erasedTruncate` keeps a prefix), and states what the runtime does with a buffer as `bufNew` (`Vec::with_capacity`), `pushGrow` (the push of `RustMemory`, after a growth when the buffer is full), `bufTruncate`, and the length, and the pinned Lean accepts, with exactly the axioms its policy states, a theorem for each of these laws, the set the case lists and does not read from the module: the push of a buffer, grown when it is full, reads as the items and the item after them (`push_reads`, with `first_of_snoc`, `append_nothing`, `less_than_itself`, `put_into_blank`), a new buffer of a capacity reads as no items (`new_reads`), a truncation reads as the first items (`truncate_reads`, `first_of_take`), and its length is the number of its items (`length_reads`, with `first_of_front`, `length_of_items`); a clone of a list's buffer (`cloneHandle`, the `clone` of its `Rc`) reads as the handle it clones, holds the buffer that handle holds, and keeps it from being alone (`clone_reads` (by definition), `clone_holds` (by definition), `clone_blocks`), a buffer with no other handle is alone (`alone_without_others` (by definition)), and a replaced place reads as it did while the place holds the value (`replace_old_reads` (by definition), `replace_now_reads` (by definition)); a push that puts the item in front, a full buffer that is not grown, a truncation that keeps one too many, a clone that does not hold, a replace that returns the new value, a length that counts one more, a new buffer that is not empty, a theorem for another function, and a missing theorem are each refused; that the runtime's `Vec`, `Rc`, and `mem::replace` behave as the model, and that the primitives of the declared semantics are given these readings, are the evidence of the differential and of the pinned rustc and the work of the first function of H4a, and are not claimed here, and `share_copy`, the `Rc::from` of a slice or text, is given no meaning here: it belongs to H4b with `Str` and `Bytes`. | | `SP-29` | `build` | The functions of the `rust-std` runtime that the language-1.2 module `RustStd` of the compiler project defines, the list functions `append_list`, `length_list`, `index_list`, and `slice_list` and the byte and text functions `append_bytes`, `length_bytes`, `length_string`, `index_bytes`, `slice_bytes`, `utf8_encode`, `utf8_decode`, `compare_bytes`, `split_exact`, and `join` and the number functions `parse_int`, `format_int`, and the `format_` and `parse_` function of each of the eight fixed widths (`u8` to `i64`), are each one machine call (`Machine.listAppend`, `listLength`, `listIndex`, `listSlice`, `bytesAppend`, `bytesLength`, `stringLength`, `bytesIndex`, `bytesSlice`, `utf8Encode`, `utf8Decode`, `bytesCompare`, `stringSplit`, `stringJoin`, `formatDecimal`, `parseDecimal`, `parseDecimalInt`, `formatDecimalInt`; `parseDecimalInt` is optional, and `parse_int` turns its `None` into `Err(Overflow)` as `nat_add` does), whose meaning `RustSemantics` states as the existing calculus primitive of the runtime item of the same function (`append`, `length`, `index`, `slice`, `utf8Encode`, `utf8Decode`, `compareBytes`, `splitExact`, `join`, `formatDecimal`, and `parseDecimal` at a width or at the integers, of `TargetSyntax.Prim`), and the pinned Lean accepts, with exactly the axioms its policy states, a theorem `refines_` for each, of the shape of those of the core runtime (`SP-22`): for every list, byte string, text, and number (and every position, start, count, delimiter, and maximum), the declared semantics' run of the function in the std crate of the module equals the run of the runtime item of the same name, the set of theorems equalling the set of the functions the module defines; this is the whole of what is kernel-checked here, and it does not refine the walks of the support impl with their work ticks, nor the decimal check `canonical_decimal` and the digits of the methods that hold the number text, which are evidence and not proof: they are held by the abstraction theorems of `RustLists` and `RustPrims` (`SP-27`, `SP-28`), by the validator twin of `BS-09`, and by the differential of `RB-20` with counted work, which cannot construct a list of 2^64 cells, so that the point at which the length walk's count overflows, which is where the `natResult` of `Prim.length` overflows, is declared and not exercised; the type parameter of the signature is carried by the syntax (`RustType.param`) and erased by the semantics; a theorem for another function, a function without a theorem, a theorem that states another runtime item, and a machine call whose primitive is another are each refused. | | `SP-30` | `build` | Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item. | -| `SP-31` | `build` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | -| `SP-32` | `build` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | +| `SP-32` | `build` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | +| `SP-33` | `build` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | ## production diff --git a/SPEC.md b/SPEC.md index 3409ceb554..b32ec268c5 100644 --- a/SPEC.md +++ b/SPEC.md @@ -2835,7 +2835,7 @@ either backend runs; they do not defer to what Lean would accept. recursive call decreases, and a call can decrease only a parameter the body matches, so an executable definition that matches a parameter before its declared argument states the argument with `termination_by structural` - (`SP-31`). Certificate A reduces the definition on the declared argument. + (`SP-32`). Certificate A reduces the definition on the declared argument. 7. **Induction.** `induction` applies to a self-recursive inductive with no nested occurrence and no mutual group, and binds the constructor fields followed by one hypothesis per direct recursive field, in field order. @@ -11294,8 +11294,8 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `SP-28` | `preservation` | The meaning of the runtime's buffer, share, and replace primitives is stated over the model and its laws are kernel-checked: the module `RustPrims` of the compiler project (language 1.2, on `RustMemory` and `RustLists`) reads a buffer as the list of its items in order (`readBuf`), gives the primitives their erased meaning on that list (`erasedPush` and `erasedLength` are the calculus primitives `append` and `length`, stated on a list by `prim_append_nil`, `prim_append_cons`, `prim_length_nil` and `prim_length_cons`; `erasedTruncate` keeps a prefix), and states what the runtime does with a buffer as `bufNew` (`Vec::with_capacity`), `pushGrow` (the push of `RustMemory`, after a growth when the buffer is full), `bufTruncate`, and the length, and the pinned Lean accepts, with exactly the axioms its policy states, a theorem for each of these laws, the set the case lists and does not read from the module: the push of a buffer, grown when it is full, reads as the items and the item after them (`push_reads`, with `first_of_snoc`, `append_nothing`, `less_than_itself`, `put_into_blank`), a new buffer of a capacity reads as no items (`new_reads`), a truncation reads as the first items (`truncate_reads`, `first_of_take`), and its length is the number of its items (`length_reads`, with `first_of_front`, `length_of_items`); a clone of a list's buffer (`cloneHandle`, the `clone` of its `Rc`) reads as the handle it clones, holds the buffer that handle holds, and keeps it from being alone (`clone_reads` (by definition), `clone_holds` (by definition), `clone_blocks`), a buffer with no other handle is alone (`alone_without_others` (by definition)), and a replaced place reads as it did while the place holds the value (`replace_old_reads` (by definition), `replace_now_reads` (by definition)); a push that puts the item in front, a full buffer that is not grown, a truncation that keeps one too many, a clone that does not hold, a replace that returns the new value, a length that counts one more, a new buffer that is not empty, a theorem for another function, and a missing theorem are each refused; that the runtime's `Vec`, `Rc`, and `mem::replace` behave as the model, and that the primitives of the declared semantics are given these readings, are the evidence of the differential and of the pinned rustc and the work of the first function of H4a, and are not claimed here, and `share_copy`, the `Rc::from` of a slice or text, is given no meaning here: it belongs to H4b with `Str` and `Bytes`. | §17.17 | | `SP-29` | `preservation` | The functions of the `rust-std` runtime that the language-1.2 module `RustStd` of the compiler project defines, the list functions `append_list`, `length_list`, `index_list`, and `slice_list` and the byte and text functions `append_bytes`, `length_bytes`, `length_string`, `index_bytes`, `slice_bytes`, `utf8_encode`, `utf8_decode`, `compare_bytes`, `split_exact`, and `join` and the number functions `parse_int`, `format_int`, and the `format_` and `parse_` function of each of the eight fixed widths (`u8` to `i64`), are each one machine call (`Machine.listAppend`, `listLength`, `listIndex`, `listSlice`, `bytesAppend`, `bytesLength`, `stringLength`, `bytesIndex`, `bytesSlice`, `utf8Encode`, `utf8Decode`, `bytesCompare`, `stringSplit`, `stringJoin`, `formatDecimal`, `parseDecimal`, `parseDecimalInt`, `formatDecimalInt`; `parseDecimalInt` is optional, and `parse_int` turns its `None` into `Err(Overflow)` as `nat_add` does), whose meaning `RustSemantics` states as the existing calculus primitive of the runtime item of the same function (`append`, `length`, `index`, `slice`, `utf8Encode`, `utf8Decode`, `compareBytes`, `splitExact`, `join`, `formatDecimal`, and `parseDecimal` at a width or at the integers, of `TargetSyntax.Prim`), and the pinned Lean accepts, with exactly the axioms its policy states, a theorem `refines_` for each, of the shape of those of the core runtime (`SP-22`): for every list, byte string, text, and number (and every position, start, count, delimiter, and maximum), the declared semantics' run of the function in the std crate of the module equals the run of the runtime item of the same name, the set of theorems equalling the set of the functions the module defines; this is the whole of what is kernel-checked here, and it does not refine the walks of the support impl with their work ticks, nor the decimal check `canonical_decimal` and the digits of the methods that hold the number text, which are evidence and not proof: they are held by the abstraction theorems of `RustLists` and `RustPrims` (`SP-27`, `SP-28`), by the validator twin of `BS-09`, and by the differential of `RB-20` with counted work, which cannot construct a list of 2^64 cells, so that the point at which the length walk's count overflows, which is where the `natResult` of `Prim.length` overflows, is declared and not exercised; the type parameter of the signature is carried by the syntax (`RustType.param`) and erased by the semantics; a theorem for another function, a function without a theorem, a theorem that states another runtime item, and a machine call whose primitive is another are each refused. | §17.17 | | `SP-30` | `preservation` | Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item. | §17.16, §17.17 | -| `SP-31` | `preservation` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | -| `SP-32` | `preservation` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | +| `SP-32` | `preservation` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | +| `SP-33` | `preservation` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | | `MD-01` | `models` | Language 1.2 artifact, contract, realization, evidence, and model declarations, the checked_apply term, the contract_violation type, and the less_than primitive belong to the closed lexlean/semantic-module/2 schema and its snapshot schema, are rejected under language 1.1 before either backend runs, and admit no member outside the closed schema, such as prompt text, a free-form description, or raw model configuration. | §17.12 | | `MD-02` | `models` | A model artifact is admitted only from a configured, content-addressed, confined project file whose SHA-256 and byte length equal its declaration and whose bytes decode under its declared closed schema to its declared type and role; a missing artifact or a digest or length mismatch fails with LLR3007, a schema, type, or role violation fails with LLR3008, and the generated Lean embeds the exact bytes with a kernel-checked theorem that the typed value is their decoding. | §17.12, §10.1, §26.3 | | `MD-03` | `models` | A contract names typed input, output, and optional state interfaces and prior proposition-valued predicates of exactly those interface signatures, and each runtime validator is an executable Boolean definition of the same signature linked to its predicate by a statement-exact soundness theorem and an optional completeness theorem that Lean restates against the fixed model semantics; any mismatch fails with LLT4006. | §17.12 | diff --git a/VERIFICATION.md b/VERIFICATION.md index 054d12c74d..eff9a29b21 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -11506,8 +11506,8 @@ the first panic message, trimmed. | `PD-02` | `production/eligibility.rs`: `analyse_module` no longer returns `Ok(None)` for a module without roots | `a module with formal content and no root is never analysed` | | `PD-03` | `production/eligibility.rs`: termination evidence is no longer inserted into `erased` | `termination evidence is erased, never realized` (`left: []`, `right: ["Production.Kernel.countdown_decreases"]`) | | `PD-06` | `production/eligibility.rs`: every `EffectRow` is built with no sources | `array shorter than minItems 1` at `/roots/1/targets/0/effects/0/sources` of `production-eligibility.schema.json` | -| `SP-31` | `backend/semantic.rs`: the clause is written only for a mutual group | `` `paramsOf` matches a parameter before its argument and states the argument ``, the generated definition with no clause; the issue's project on that binary: `LLV7013` in `__rel_1` | -| `SP-32` | `calculus/rust/lower.rs`: `fold` does not read `Expr::Clone` | `the arm reads the box and binds nothing`, the arm being `Let { pat: Bind(Local(2)), value: Unbox(Boxed(2)) }` then `Move(Local(2))`; the issue's project on that binary: `LLV7015` at `Corr.mCons` in `fun1` | +| `SP-32` | `backend/semantic.rs`: the clause is written only for a mutual group | `` `paramsOf` matches a parameter before its argument and states the argument ``, the generated definition with no clause; the issue's project on that binary: `LLV7013` in `__rel_1` | +| `SP-33` | `calculus/rust/lower.rs`: `fold` does not read `Expr::Clone` | `the arm reads the box and binds nothing`, the arm being `Let { pat: Bind(Local(2)), value: Unbox(Boxed(2)) }` then `Move(Local(2))`; the issue's project on that binary: `LLV7015` at `Corr.mCons` in `fun1` | | `TC-01` | `calculus/mod.rs`: `canonical` binds parameters but keeps their spelling | `assertion left == right failed: adt-evaluation` (alpha variant bytes differ) | | `TC-02` | `calculus/check.rs`: the match exhaustiveness test made `false &&` | `an invalid program loads: expected `the match is not exhaustive: Adt { constructor: 2 } is not covered`` | | `MD-01` | `ir/semantic.rs`: the language-1.1 gate `first_language_1_2_construct` made `&& false` | `tests/negative/model-under-1.1: expected "`contract declaration` is a language-1.2 construct"` | @@ -12277,7 +12277,7 @@ and fixtures. The three failing cases assert the count before their plants, so t run did not reach the plants on the new draws. A package that adds records should set these counts with its records in the tree, on the same commit. -## A definition recurses on the argument its source declares (`SP-31`, #314) +## A definition recurses on the argument its source declares (`SP-32`, #314) ### The defect @@ -12309,8 +12309,8 @@ written against. | Run | Observed | | --- | --- | -| `conformance_sp_31`, fixed source | ok, 253 s | -| `conformance_sp_31`, clause written only for a mutual group | fails at the text check before Lean runs, with the generated definition in the message | +| `conformance_sp_32`, fixed source | ok, 253 s | +| `conformance_sp_32`, clause written only for a mutual group | fails at the text check before Lean runs, with the generated definition in the message | | the issue's project, on a binary with that plant | `LLV7013` in `__rel_1`, exit 1, 123 s | | the issue's project, fixed source | exit 0, 145 s | @@ -12319,7 +12319,7 @@ so no committed generated Lean changes. `lean_backend` still moves, because I10 and §30.1 do not let generated artifacts or a failure diagnostic change under one identity. -## An arm that returns a boxed field is the read of the box (`SP-32`, #310) +## An arm that returns a boxed field is the read of the box (`SP-33`, #310) ### The defect @@ -12347,8 +12347,8 @@ language-1.2 identity move. | Run | Observed | | --- | --- | -| `conformance_sp_32`, fixed source | ok, 196 s | -| `conformance_sp_32`, `fold` without `Expr::Clone` | fails without Lean: the arm is the load, then `Move(Local(2))` | +| `conformance_sp_33`, fixed source | ok, 196 s | +| `conformance_sp_33`, `fold` without `Expr::Clone` | fails without Lean: the arm is the load, then `Move(Local(2))` | | the issue's project, on a binary with that plant | `LLV7015` at `Corr.mCons` in `fun1`, exit 1, 127 s | | the issue's project, fixed source | exit 0, 137 s | | the fixture with an overflowing arm, fixed source | exit 0, 141 s; `Ok` wraps the arm's value, so that arm is not folded | diff --git a/crates/conformance/src/cases/binder_arm.rs b/crates/conformance/src/cases/binder_arm.rs index 0662b087b3..159006b1a9 100644 --- a/crates/conformance/src/cases/binder_arm.rs +++ b/crates/conformance/src/cases/binder_arm.rs @@ -1,5 +1,5 @@ //! A match arm whose whole body is a binder of a boxed field (SPEC.md §17.16, -//! §17.17): `SP-32`, #310. +//! §17.17): `SP-33`, #310. //! //! The arm loads the field and returns the load, which `fold` folds to the //! read of the box. Certificate B's `mCons` states an arm through `foldB`, so @@ -68,13 +68,13 @@ fn rendered_arm() -> Block { arm } -/// `SP-32`. +/// `SP-33`. /// /// # Panics /// /// When the rendering or the fixture's export disagrees with the row. pub fn run(id: &str) { - assert_eq!(id, "SP-32"); + assert_eq!(id, "SP-33"); let arm = rendered_arm(); assert!( arm.lets.is_empty() && matches!(arm.tail, Rust::Unbox(Ident::Boxed(_), _)), diff --git a/crates/conformance/src/cases/preservation.rs b/crates/conformance/src/cases/preservation.rs index 57d560c490..25450ed7cd 100644 --- a/crates/conformance/src/cases/preservation.rs +++ b/crates/conformance/src/cases/preservation.rs @@ -4817,9 +4817,9 @@ pub fn run(id: &str) { // §17.16, §17.17: every runtime item has its refinement statement. "SP-30" => super::rust_items::run(id), // §17.12, §17.17: a definition recurses on its declared argument. - "SP-31" => super::recursive_argument::run(id), + "SP-32" => super::recursive_argument::run(id), // §17.16, §17.17: an arm that returns a boxed field. - "SP-32" => super::binder_arm::run(id), + "SP-33" => super::binder_arm::run(id), "SP-23" => { let syntax = support::module_json( &std::fs::read_to_string( diff --git a/crates/conformance/src/cases/recursive_argument.rs b/crates/conformance/src/cases/recursive_argument.rs index 1b6a0608d6..00650ed483 100644 --- a/crates/conformance/src/cases/recursive_argument.rs +++ b/crates/conformance/src/cases/recursive_argument.rs @@ -1,5 +1,5 @@ //! A definition recurses in its generated Lean on the argument its source -//! declares (SPEC.md §17.12, §17.17): `SP-31`, #314. +//! declares (SPEC.md §17.12, §17.17): `SP-32`, #314. //! //! Certificate A reduces a structural definition on the declared argument, so //! it holds only if Lean recursed on that argument. `paramsOf` of the fixture @@ -29,13 +29,13 @@ fn definition<'a>(lean: &'a str, name: &str) -> &'a str { &rest[..end] } -/// `SP-31`. +/// `SP-32`. /// /// # Panics /// /// When the fixture's Lean or its export disagrees with the row. pub fn run(id: &str) { - assert_eq!(id, "SP-31"); + assert_eq!(id, "SP-32"); let project = P::copy_tests_project("fixtures/recursive-argument"); project.relock(); let lean = support::lean_text(&support::rendered(&project), "Main"); diff --git a/crates/conformance/tests/conformance.rs b/crates/conformance/tests/conformance.rs index a9fb7c88f8..7f75af5eb1 100644 --- a/crates/conformance/tests/conformance.rs +++ b/crates/conformance/tests/conformance.rs @@ -1781,13 +1781,13 @@ fn conformance_sp_30() { } #[test] -fn conformance_sp_31() { - repo_conformance::cases::run("SP-31"); +fn conformance_sp_32() { + repo_conformance::cases::run("SP-32"); } #[test] -fn conformance_sp_32() { - repo_conformance::cases::run("SP-32"); +fn conformance_sp_33() { + repo_conformance::cases::run("SP-33"); } #[test] diff --git a/features/suites/preservation.feature b/features/suites/preservation.feature index 72d1063833..db7b2476b1 100644 --- a/features/suites/preservation.feature +++ b/features/suites/preservation.feature @@ -207,14 +207,14 @@ Feature: preservation Then every runtime item is stated by exactly one theorem, at its profile, on the function the generated code calls for it, or is a trait item with the theorems of SP-25 And a theorem left out, a statement of another item, a statement at the other profile, an item called as another function, and a trait item without its theorems are each refused naming the item - @SP-31 @build + @SP-32 @build Scenario: A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. Given the `recursive-argument` fixture, whose `paramsOf` matches a list written before its declared recursive argument When the fixture's generated Lean is read and its production root is exported Then `paramsOf` states its argument, its two controls state none, and the kernel accepts every certificate of the root And a backend that stops stating the argument is refused by the kernel with `LLV7013` - @SP-32 @build + @SP-33 @build Scenario: A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. Given a hand-built program whose arm returns a boxed field, and the `binder-arm` fixture, whose arms return either field in a function that cannot overflow and in one that can When the program is rendered and the fixture's production root is exported diff --git a/model/ids.toml b/model/ids.toml index 9696271d0c..43f0bb7dbb 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -2138,13 +2138,13 @@ level = "build" suite = "preservation" statement = "Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item." [[id]] -id = "SP-31" +id = "SP-32" level = "build" suite = "preservation" statement = "A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before." [[id]] -id = "SP-32" +id = "SP-33" level = "build" suite = "preservation" statement = "A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm." From 7184a9405a76e159cf868e52af872bd541a062bb Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:55:22 +0000 Subject: [PATCH 07/10] SP-32, SP-33: the sections cell of their rows in the section 31 table The gate reads a row of four cells, so these two were not counted (RP-07: 468 rows, not 470). Co-Authored-By: Claude Opus 5.5 --- SPEC.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SPEC.md b/SPEC.md index b32ec268c5..efd22fde99 100644 --- a/SPEC.md +++ b/SPEC.md @@ -11294,8 +11294,8 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `SP-28` | `preservation` | The meaning of the runtime's buffer, share, and replace primitives is stated over the model and its laws are kernel-checked: the module `RustPrims` of the compiler project (language 1.2, on `RustMemory` and `RustLists`) reads a buffer as the list of its items in order (`readBuf`), gives the primitives their erased meaning on that list (`erasedPush` and `erasedLength` are the calculus primitives `append` and `length`, stated on a list by `prim_append_nil`, `prim_append_cons`, `prim_length_nil` and `prim_length_cons`; `erasedTruncate` keeps a prefix), and states what the runtime does with a buffer as `bufNew` (`Vec::with_capacity`), `pushGrow` (the push of `RustMemory`, after a growth when the buffer is full), `bufTruncate`, and the length, and the pinned Lean accepts, with exactly the axioms its policy states, a theorem for each of these laws, the set the case lists and does not read from the module: the push of a buffer, grown when it is full, reads as the items and the item after them (`push_reads`, with `first_of_snoc`, `append_nothing`, `less_than_itself`, `put_into_blank`), a new buffer of a capacity reads as no items (`new_reads`), a truncation reads as the first items (`truncate_reads`, `first_of_take`), and its length is the number of its items (`length_reads`, with `first_of_front`, `length_of_items`); a clone of a list's buffer (`cloneHandle`, the `clone` of its `Rc`) reads as the handle it clones, holds the buffer that handle holds, and keeps it from being alone (`clone_reads` (by definition), `clone_holds` (by definition), `clone_blocks`), a buffer with no other handle is alone (`alone_without_others` (by definition)), and a replaced place reads as it did while the place holds the value (`replace_old_reads` (by definition), `replace_now_reads` (by definition)); a push that puts the item in front, a full buffer that is not grown, a truncation that keeps one too many, a clone that does not hold, a replace that returns the new value, a length that counts one more, a new buffer that is not empty, a theorem for another function, and a missing theorem are each refused; that the runtime's `Vec`, `Rc`, and `mem::replace` behave as the model, and that the primitives of the declared semantics are given these readings, are the evidence of the differential and of the pinned rustc and the work of the first function of H4a, and are not claimed here, and `share_copy`, the `Rc::from` of a slice or text, is given no meaning here: it belongs to H4b with `Str` and `Bytes`. | §17.17 | | `SP-29` | `preservation` | The functions of the `rust-std` runtime that the language-1.2 module `RustStd` of the compiler project defines, the list functions `append_list`, `length_list`, `index_list`, and `slice_list` and the byte and text functions `append_bytes`, `length_bytes`, `length_string`, `index_bytes`, `slice_bytes`, `utf8_encode`, `utf8_decode`, `compare_bytes`, `split_exact`, and `join` and the number functions `parse_int`, `format_int`, and the `format_` and `parse_` function of each of the eight fixed widths (`u8` to `i64`), are each one machine call (`Machine.listAppend`, `listLength`, `listIndex`, `listSlice`, `bytesAppend`, `bytesLength`, `stringLength`, `bytesIndex`, `bytesSlice`, `utf8Encode`, `utf8Decode`, `bytesCompare`, `stringSplit`, `stringJoin`, `formatDecimal`, `parseDecimal`, `parseDecimalInt`, `formatDecimalInt`; `parseDecimalInt` is optional, and `parse_int` turns its `None` into `Err(Overflow)` as `nat_add` does), whose meaning `RustSemantics` states as the existing calculus primitive of the runtime item of the same function (`append`, `length`, `index`, `slice`, `utf8Encode`, `utf8Decode`, `compareBytes`, `splitExact`, `join`, `formatDecimal`, and `parseDecimal` at a width or at the integers, of `TargetSyntax.Prim`), and the pinned Lean accepts, with exactly the axioms its policy states, a theorem `refines_` for each, of the shape of those of the core runtime (`SP-22`): for every list, byte string, text, and number (and every position, start, count, delimiter, and maximum), the declared semantics' run of the function in the std crate of the module equals the run of the runtime item of the same name, the set of theorems equalling the set of the functions the module defines; this is the whole of what is kernel-checked here, and it does not refine the walks of the support impl with their work ticks, nor the decimal check `canonical_decimal` and the digits of the methods that hold the number text, which are evidence and not proof: they are held by the abstraction theorems of `RustLists` and `RustPrims` (`SP-27`, `SP-28`), by the validator twin of `BS-09`, and by the differential of `RB-20` with counted work, which cannot construct a list of 2^64 cells, so that the point at which the length walk's count overflows, which is where the `natResult` of `Prim.length` overflows, is declared and not exercised; the type parameter of the signature is carried by the syntax (`RustType.param`) and erased by the semantics; a theorem for another function, a function without a theorem, a theorem that states another runtime item, and a machine call whose primitive is another are each refused. | §17.17 | | `SP-30` | `preservation` | Every runtime item the generated code calls has its refinement statement: each item of the compiler's table of runtime items, every fixed width included, is stated by exactly one theorem `refines_` of the language-1.2 module `RustRuntime` of the compiler project if the item is of the core profile, or of the module `RustStd` if it is of `rust-std`, whose statement runs, in that module's crate, the function the generated code calls for the item and equates it with the run of the item itself at the item's profile, or is `equal` or `compare`, whose meaning `SP-25` states per type; the items are listed from the compiler's table and the statements from the modules' theorems, neither from the other, and a runtime item with no refinement statement, a statement of another item than the one its function is called for, a statement at the other profile, an item the generated code calls another function for than the one its statement runs, and a trait item without the theorems of `SP-25` are each refused naming the item. | §17.16, §17.17 | -| `SP-32` | `preservation` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | -| `SP-33` | `preservation` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | +| `SP-32` | `preservation` | A structurally recursive executable definition recurses in its generated Lean on the argument its source declares: where a parameter written before `recursive_argument` is matched in the body, which is the one case in which Lean's own search could take that parameter instead, the definition states the argument with `termination_by structural`, so that the kernel accepts certificate A of a production root that reaches it; an executable definition with no such parameter, and a definition that is not executable, generate the bytes they generated before. | §17.12, §17.17 | +| `SP-33` | `preservation` | A match arm whose whole body is a binder of a boxed field renders as the read of the box, with no binding, in a function that cannot overflow: `fold` of the Rust lowering of SPEC.md §17.16 and `returnedLet` of `RustBodies` fold a returned clone as they fold a returned move or copy, which is the arm that `foldB` of certificate B's `mCons` states, so that the kernel accepts certificate B of a production root whose closure has such an arm. | §17.16, §17.17 | | `MD-01` | `models` | Language 1.2 artifact, contract, realization, evidence, and model declarations, the checked_apply term, the contract_violation type, and the less_than primitive belong to the closed lexlean/semantic-module/2 schema and its snapshot schema, are rejected under language 1.1 before either backend runs, and admit no member outside the closed schema, such as prompt text, a free-form description, or raw model configuration. | §17.12 | | `MD-02` | `models` | A model artifact is admitted only from a configured, content-addressed, confined project file whose SHA-256 and byte length equal its declaration and whose bytes decode under its declared closed schema to its declared type and role; a missing artifact or a digest or length mismatch fails with LLR3007, a schema, type, or role violation fails with LLR3008, and the generated Lean embeds the exact bytes with a kernel-checked theorem that the typed value is their decoding. | §17.12, §10.1, §26.3 | | `MD-03` | `models` | A contract names typed input, output, and optional state interfaces and prior proposition-valued predicates of exactly those interface signatures, and each runtime validator is an executable Boolean definition of the same signature linked to its predicate by a statement-exact soundness theorem and an optional completeness theorem that Lean restates against the fixed model semantics; any mismatch fails with LLT4006. | §17.12 | From eee82cdf3d135302e5a4d2a0cefea4c10020b0f1 Mon Sep 17 00:00:00 2001 From: humuhumu33 <68450279+humuhumu33@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:17:48 +0000 Subject: [PATCH 08/10] Remove the workarounds of #310 and #314 from the bootstrap source Not for the first push: this commit is to be dropped if the regeneration wave does not prove it out. keepE and keepP, the identity functions that handed a binder of the matched type through an arm, are gone from RustBodies: their eleven call sites are the binders themselves. paramsOf of RustAssemble takes the list of names before its recursive argument again, and the backend now states that argument. The note on CERTIFICATE_BUDGET and the paragraph of SPEC.md section 17.23 that named both workarounds go with them. Only the source is edited. `lexlean check` of a copy of bootstrap and stdlib accepts the 19 modules; no certificate has been checked, and the committed expected outputs, production packages, counts and records still describe the old source. Co-Authored-By: Claude Sonnet 5.5 --- SPEC.md | 5 --- bootstrap/src/RustAssemble.lex.tex | 8 ++-- bootstrap/src/RustBodies.lex.tex | 38 ++++++------------- .../src/cases/bootstrap/rust_bodies.rs | 3 +- 4 files changed, 16 insertions(+), 38 deletions(-) diff --git a/SPEC.md b/SPEC.md index efd22fde99..05a3b2987d 100644 --- a/SPEC.md +++ b/SPEC.md @@ -8360,11 +8360,6 @@ on 281 seeded mutants, the rendered packages under the pinned rustc on the vectors, thirteen planted defects in the source, and the production export (§24.7). -Certificate B (the `rust-std` rendering) of a function is refused by the Lean -kernel when an arm of a match returns, as its whole body, a binder of the -matched recursive type (issue 310); `RustBodies` hands such a binder through the -identity functions `keepE` and `keepP` until that is fixed. - The eleventh component continues the lowering of terms (§17.16) with the value a function that can overflow returns, `succeed` (`BS-12`, the sixth slice of the lowering, step 4 of issue 92), the module `RustSucceed` with one production diff --git a/bootstrap/src/RustAssemble.lex.tex b/bootstrap/src/RustAssemble.lex.tex index c5635996f5..34819d1079 100644 --- a/bootstrap/src/RustAssemble.lex.tex +++ b/bootstrap/src/RustAssemble.lex.tex @@ -85,8 +85,8 @@ definition{ name: paramsOf, parameters: [ - types : CalculusCheck::Ty, names : (List Nat), + types : CalculusCheck::Ty, body : CalculusCheck::Expr, known : CalculusCheck::Ty, position : Nat, @@ -111,7 +111,7 @@ | CalculusCheck::Ty.TNil => (ctor RustAst::Par.ParNil) | CalculusCheck::Ty.TCons head tail => (match names | List.nil => (ctor RustAst::Par.ParNil) - | List.cons name rest => (ctor RustAst::Par.ParCons (if (empty =? 0) then (binderPat head body name) else (if ((position + 1) =? empty) then (ctor RustAst::Pat.PBind (ctor RustValidate::Id.IdLocal name)) else (RustBodies::wildPat 0))) (RustLower::vty known head) (paramsOf tail rest body known (position + 1) empty)))), + | List.cons name rest => (ctor RustAst::Par.ParCons (if (empty =? 0) then (binderPat head body name) else (if ((position + 1) =? empty) then (ctor RustAst::Pat.PBind (ctor RustValidate::Id.IdLocal name)) else (RustBodies::wildPat 0))) (RustLower::vty known head) (paramsOf rest tail body known (position + 1) empty)))), executable: true, recursive_argument: types } @@ -158,8 +158,8 @@ ], result: RustAst::Def, body: (let resultTy : RustValidate::Ty := (if failing then (ctor RustValidate::Ty.TyUnary (ctor RustValidate::UnaryKind.UkFallible) (RustLower::vty known result)) else (RustLower::vty known result)); (match (firstEmpty types inhabited 0) - | Option.some empty => (ctor RustAst::Def.DFunction (ctor RustValidate::Id.IdFunction position) (paramsOf types names body known 0 (empty + 1)) resultTy (emptyBody (nameAt names empty) (typeAt types empty)) (functionAt 0)) - | Option.none => (ctor RustAst::Def.DFunction (ctor RustValidate::Id.IdFunction position) (paramsOf types names body known 0 0) resultTy (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) (ctor RustAst::Expr.ENil)) (functionAt 0)))), + | Option.some empty => (ctor RustAst::Def.DFunction (ctor RustValidate::Id.IdFunction position) (paramsOf names types body known 0 (empty + 1)) resultTy (emptyBody (nameAt names empty) (typeAt types empty)) (functionAt 0)) + | Option.none => (ctor RustAst::Def.DFunction (ctor RustValidate::Id.IdFunction position) (paramsOf names types body known 0 0) resultTy (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) (ctor RustAst::Expr.ENil)) (functionAt 0)))), executable: true } diff --git a/bootstrap/src/RustBodies.lex.tex b/bootstrap/src/RustBodies.lex.tex index a79cf0e9ce..e949be1c3c 100644 --- a/bootstrap/src/RustBodies.lex.tex +++ b/bootstrap/src/RustBodies.lex.tex @@ -419,22 +419,6 @@ executable: true } -definition{ - name: keepE, - parameters: [value : RustAst::Expr], - result: RustAst::Expr, - body: value, - executable: true -} - -definition{ - name: keepP, - parameters: [value : RustAst::Pat], - result: RustAst::Pat, - body: value, - executable: true -} - definition{ name: blockOn, parameters: [subject : RustAst::Expr, whole : RustAst::Expr], @@ -449,7 +433,7 @@ | RustAst::Expr.EPair u13x0 u13x1 u13x2 => (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) whole) | RustAst::Expr.EIf u13x0 u13x1 u13x2 u13x3 => (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) whole) | RustAst::Expr.EMatch u13x0 u13x1 u13x2 => (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) whole) - | RustAst::Expr.EBlockE inner => (keepE inner) + | RustAst::Expr.EBlockE inner => inner | RustAst::Expr.EProbe u13x0 u13x1 u13x2 => (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) whole) | RustAst::Expr.EBlock u13x0 u13x1 => (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) whole) | RustAst::Expr.ENil => (ctor RustAst::Expr.EBlock (ctor RustAst::Expr.ENil) whole) @@ -484,7 +468,7 @@ | RustAst::Expr.EMatch u14x0 u14x1 u14x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EBlockE u14x0 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EProbe u14x0 u14x1 u14x2 => (ctor RustAst::Expr.ENil) - | RustAst::Expr.EBlock lets tail => (keepE lets) + | RustAst::Expr.EBlock lets tail => lets | RustAst::Expr.ENil => (ctor RustAst::Expr.ENil) | RustAst::Expr.ECons u14x0 u14x1 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ELet u14x0 u14x1 u14x2 u14x3 u14x4 u14x5 => (ctor RustAst::Expr.ENil) @@ -509,7 +493,7 @@ | RustAst::Expr.EMatch u15x0 u15x1 u15x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EBlockE u15x0 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EProbe u15x0 u15x1 u15x2 => (ctor RustAst::Expr.ENil) - | RustAst::Expr.EBlock lets tail => (keepE tail) + | RustAst::Expr.EBlock lets tail => tail | RustAst::Expr.ENil => (ctor RustAst::Expr.ENil) | RustAst::Expr.ECons u15x0 u15x1 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ELet u15x0 u15x1 u15x2 u15x3 u15x4 u15x5 => (ctor RustAst::Expr.ENil) @@ -1319,7 +1303,7 @@ | RustAst::Expr.EWrap u45x0 u45x1 u45x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ECall u45x0 u45x1 u45x2 u45x3 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EApply u45x0 u45x1 u45x2 u45x3 => (ctor RustAst::Expr.ENil) - | RustAst::Expr.EConstruct con args at => (keepE args) + | RustAst::Expr.EConstruct con args at => args | RustAst::Expr.EPair u45x0 u45x1 u45x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EIf u45x0 u45x1 u45x2 u45x3 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EMatch u45x0 u45x1 u45x2 => (ctor RustAst::Expr.ENil) @@ -1762,7 +1746,7 @@ | RustAst::Expr.ENil => (ctor RustAst::Pat.PNil) | RustAst::Expr.ECons u63x0 u63x1 => (ctor RustAst::Pat.PNil) | RustAst::Expr.ELet u63x0 u63x1 u63x2 u63x3 u63x4 u63x5 => (ctor RustAst::Pat.PNil) - | RustAst::Expr.EArm pats block rest => (keepP pats) + | RustAst::Expr.EArm pats block rest => pats | RustAst::Expr.ELoop u63x0 u63x1 => (ctor RustAst::Pat.PNil)), executable: true } @@ -1787,7 +1771,7 @@ | RustAst::Expr.ENil => (ctor RustAst::Expr.ENil) | RustAst::Expr.ECons u64x0 u64x1 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ELet u64x0 u64x1 u64x2 u64x3 u64x4 u64x5 => (ctor RustAst::Expr.ENil) - | RustAst::Expr.EArm pats block rest => (keepE block) + | RustAst::Expr.EArm pats block rest => block | RustAst::Expr.ELoop u64x0 u64x1 => (ctor RustAst::Expr.ENil)), executable: true } @@ -1810,7 +1794,7 @@ | RustAst::Expr.EProbe u65x0 u65x1 u65x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EBlock u65x0 u65x1 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ENil => (ctor RustAst::Expr.ENil) - | RustAst::Expr.ECons item itemsTail => (keepE item) + | RustAst::Expr.ECons item itemsTail => item | RustAst::Expr.ELet u65x0 u65x1 u65x2 u65x3 u65x4 u65x5 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EArm u65x0 u65x1 u65x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ELoop u65x0 u65x1 => (ctor RustAst::Expr.ENil)), @@ -1835,7 +1819,7 @@ | RustAst::Expr.EProbe u66x0 u66x1 u66x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EBlock u66x0 u66x1 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ENil => (ctor RustAst::Expr.ENil) - | RustAst::Expr.ECons item itemsTail => (keepE itemsTail) + | RustAst::Expr.ECons item itemsTail => itemsTail | RustAst::Expr.ELet u66x0 u66x1 u66x2 u66x3 u66x4 u66x5 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EArm u66x0 u66x1 u66x2 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ELoop u66x0 u66x1 => (ctor RustAst::Expr.ENil)), @@ -1881,7 +1865,7 @@ | RustAst::Pat.PAdt u68x0 u68x1 u68x2 => (ctor RustAst::Pat.PLeaf (ctor RustAst::PatLeaf.PlWild)) | RustAst::Pat.PNil => (ctor RustAst::Pat.PLeaf (ctor RustAst::PatLeaf.PlWild)) | RustAst::Pat.PCons head tail => (match position - | Nat.zero => (keepP head) + | Nat.zero => head | Nat.succ previous => (patAt tail previous)) | RustAst::Pat.POrdering u68x0 => (ctor RustAst::Pat.PLeaf (ctor RustAst::PatLeaf.PlWild))), executable: true, @@ -2025,7 +2009,7 @@ body: (match pat | RustAst::Pat.PLeaf u69x0 => (ctor RustAst::Pat.PNil) | RustAst::Pat.PBind u69x0 => (ctor RustAst::Pat.PNil) - | RustAst::Pat.PTuple items => (keepP items) + | RustAst::Pat.PTuple items => items | RustAst::Pat.PWrap u69x0 u69x1 => (ctor RustAst::Pat.PNil) | RustAst::Pat.PAdt u69x0 u69x1 u69x2 => (ctor RustAst::Pat.PNil) | RustAst::Pat.PNil => (ctor RustAst::Pat.PNil) @@ -2160,7 +2144,7 @@ | RustAst::Expr.EBlock u72x0 u72x1 => (ctor RustAst::Expr.ENil) | RustAst::Expr.ENil => (ctor RustAst::Expr.ENil) | RustAst::Expr.ECons head tail => (match position - | Nat.zero => (keepE head) + | Nat.zero => head | Nat.succ previous => (argAt tail previous)) | RustAst::Expr.ELet u72x0 u72x1 u72x2 u72x3 u72x4 u72x5 => (ctor RustAst::Expr.ENil) | RustAst::Expr.EArm u72x0 u72x1 u72x2 => (ctor RustAst::Expr.ENil) diff --git a/crates/conformance/src/cases/bootstrap/rust_bodies.rs b/crates/conformance/src/cases/bootstrap/rust_bodies.rs index ae3c896fe3..16dfbeaa22 100644 --- a/crates/conformance/src/cases/bootstrap/rust_bodies.rs +++ b/crates/conformance/src/cases/bootstrap/rust_bodies.rs @@ -45,8 +45,7 @@ const MOVES: &str = "LexLeanBoot.RustMoves"; /// The most a part of a certificate of these roots may be, as the row states: /// 87.5% of `max_file_bytes`, above the 75% of the rule of #92 because the term -/// lowering is one recursion family. The source hands a binder of the matched -/// type through `keepE` and `keepP` until certificate B accepts it (#310). +/// lowering is one recursion family. const CERTIFICATE_BUDGET: u64 = 5_505_024; const LITERALS: usize = 200; From 30171790ee99469242723e7cf3057bdbd514df0a Mon Sep 17 00:00:00 2001 From: Alexander Flom Date: Wed, 4 Nov 2026 00:00:53 +0000 Subject: [PATCH 09/10] fix(bootstrap): reconcile BS16 corpus counts and restore Unicode --- SPEC.md | 20 ++++---- VERIFICATION.md | 49 +++++++++++++++++++ .../src/cases/bootstrap/rust_assemble.rs | 2 +- .../src/cases/bootstrap/rust_loops.rs | 2 +- .../src/cases/bootstrap/rust_package.rs | 4 +- .../src/cases/bootstrap/rust_print.rs | 10 ++-- .../src/cases/bootstrap/rust_validate.rs | 10 ++-- features/suites/bootstrap.feature | 10 ++-- model/ids.toml | 10 ++-- 9 files changed, 83 insertions(+), 34 deletions(-) diff --git a/SPEC.md b/SPEC.md index f120e4a3f8..6ed692a598 100644 --- a/SPEC.md +++ b/SPEC.md @@ -8062,8 +8062,8 @@ the overflow value (a call of each of the 44 families of machine primitives with one operand too many, three with the right count, a propagating call, the overflow value alone, one in an `Err`, one function that takes the error type of the runtime, one that takes `i128`, and the failure of a runtime function: a fallible function whose tail is `Err::(Overflow)`, which both validators accept, and the same `Err` with another payload and with another error type, which both refuse), which reach the three refusals no mutant of a committed crate reaches (an operand count, a stray overflow value, and the -construct `call:machine`, which no row of the table has); that is 495 runs of -`validateCrate` (211 refused) and 360 of `correspondCrate` (100 refused), and the case asserts +construct `call:machine`, which no row of the table has); that is 496 runs of +`validateCrate` (211 refused) and 361 of `correspondCrate` (100 refused), and the case asserts these counts. On every host, the rendered `rust-std` packages of both roots (§17.16), compiled by the pinned rustc, are run on all of them. On the normative host, the lowered programs of both roots are run under the calculus @@ -8125,11 +8125,11 @@ report: it asserts them, so a tree that no longer gives them fails the case. The tree is the one with the packages of the two roots of this component and of the three roots of `Buffer` (`SL-05`), the five roots of `Numeral` (`SL-09`), the five roots of `Order` (`SL-10`), and those of the roots of `BS-07` to `BS-15` and `BS-20` (seventeen) committed, so the committed manifests are 284; `BS-05` asserts the same corpus. On every host -the rendered packages, compiled by the pinned rustc, run 2,829 vectors: 684 -of `printCrate` (518 the distinct crates the renderer lowers from the 200 +the rendered packages, compiled by the pinned rustc, run 2,832 vectors: 687 +of `printCrate` (520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed manifests and 122 fixtures and the crates of the 284 committed packages, the hand-built crates of every item and -profile, the real header of each profile, and 64 runs with a capacity one byte +profile, the real header of each profile, and 65 runs with a capacity one byte short of the output) and 2,145 of `printExpr` (1,532 hand-built expressions of every construct, literal, runtime row and machine primitive, and the function bodies of the committed crates). The items of each of the 284 committed @@ -11447,17 +11447,17 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `BS-02` | `bootstrap` | The preservation lexer and token audit of SPEC.md §17.17 are language-1.2 source in the `bootstrap/` project: `lex` and `auditTokens` of `TokenAudit` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `production::preserve::{lex, audit_tokens}` on every lexeme, position, and rejection message for the first 1,500 characters of every module of the shipped preservation library and calculus modules, the number-lexing corpus, and every token-audit unit vector; on the normative host, both roots' lowered programs under the calculus evaluator agree with the Rust oracle on those vectors and a seeded corpus, the rendered packages under the pinned rustc agree with the oracle on the large seeded corpus of generated and mutated Lean texts with no disagreement, a planted defect in the source is detected, and the certified packages the production export publishes for the project are the committed ones. | §17.17, §17.23 | | `BS-03` | `bootstrap` | The primitive scanner of SPEC.md §12.2 is language-1.2 source in the `bootstrap/` project: `scanSource` and `rejectAtoms` of `PrimitiveScan` are production roots eligible for `rust-std` with exactly their declared effects; on every host of the matrix, both roots' rendered `rust-std` packages under that host's pinned rustc agree with the Rust oracle `source::scan::{scan, reject_forbidden_atoms}` on every atom with its class, text, and byte, line, and column spans and on every rejection with its code, message, span, and help, for the deterministic vectors (the oracle's unit inputs, the atom limit at N and N+1, atom lists with gaps, payload strings, and notation bodies), a 128-byte window and a 2,048-byte prefix of every committed `.lex.tex` source, and the whole of each such source up to 8,192 bytes (up to 1,024 bytes, one source in four, for `rejectAtoms`); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the vectors and the 128-byte windows and on 80 seeded texts, the packages agree on 2,500 seeded texts, each of ten planted defects in the source is detected, and the certified packages the production export publishes for the project are the committed ones. | §12.2, §17.23 | | `BS-04` | `bootstrap` | The target calculus's checker of SPEC.md §17.14 (`lexlean::calculus::check`), for a program given as calculus data, each list of a recursive type carried as a chain of that type's own `Nil` and `Cons` constructors and decoded back to the program on every vector (reading a program from its canonical JSON is not part of this row), is language-1.2 source in the `bootstrap/` project: `checkProgram` and `checkArguments` of `CalculusCheck` are production roots eligible for `rust-std` with exactly their declared effects; on the normative host the lowered programs of both roots under the calculus evaluator agree with the Rust checker on acceptance and on the rejection message to the byte for every committed target program and the refusal edits of `TC-02` and for a seeded corpus of data-level mutations, and each planted defect in the source is detected; on every host the rendered `rust-std` packages of both roots under the pinned rustc agree with the Rust checker on the deterministic vectors, and on the normative host also on a larger seeded corpus with no disagreement; strings whose Rust `Debug` spelling escapes a non-ASCII scalar other than `U+0080`..`U+009F` are outside the claim; and the certified packages the production export publishes for the project are the committed ones. | §17.14, §17.23 | -| `BS-05` | `bootstrap` | The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (495 `validateCrate` runs, 211 of them refusals, and 360 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. | §17.16, §17.23 | -| `BS-06` | `bootstrap` | The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,829 vectors, 684 of `printCrate` (64 of them refused for the capacity, 518 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. | §17.16, §17.23 | +| `BS-05` | `bootstrap` | The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (496 `validateCrate` runs, 211 of them refusals, and 361 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. | §17.16, §17.23 | +| `BS-06` | `bootstrap` | The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. | §17.16, §17.23 | | `BS-07` | `bootstrap` | The failure typing and the types of the Rust lowering of SPEC.md §17.16 (`calculus::rust::fallible_functions`, and the enums and dispatch of the types of the crate that `rust::lower` builds) are language-1.2 source in the `bootstrap/` project as four production roots that the host composes: `siteTrees` of `CalculusCheck` (the type of each match scrutinee and of each applied target of a program, computed by the module's own `walk` and `inferTy`, the copy `checkProgram` runs on), `deadFunctions` and `fallibleFunctions` of `RustLower`, which read that tree as an argument and never call `walk`, and `lowerTypes` of `RustLower`, which returns the `Enum` item of each ADT and of each function type and the `Apply` item of each function type as a `Def` chain of `RustAst`, given the tree and the two flag lists; for a program given as calculus data that `checkProgram` accepts, each list of a recursive type carried as a chain of that type's own `Nil` and `Cons` constructors as in `BS-04`, each root is eligible for `rust-std` with exactly its declared effects and has no part of its certificates beyond three quarters of `max_file_bytes`; on every host the rendered `rust-std` packages of the four roots under the pinned rustc agree with the Rust oracle (the typing sites of `calculus::sites::trees`, the dead functions the crate of `rust::lower` shows, `fallible_functions`, and the type items of that crate, each given the legs before it) on 335 vectors, the committed target programs and the programs that exercise each rule of the analysis (a failing primitive, a successor, a call, an application of a function type one of whose closures fails, a function with an argument of a function type no closure inhabits, the closure of a dead function) and the programs of the corpora of `BS-04` that the checker accepts; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 281 of those vectors of at most 300 nodes and on 150 seeded mutants that `checkProgram` accepts, the rendered packages agree on 1,500 further seeded mutants, twenty planted defects in the source, three of them in the typing root and seven in the types, are each detected, and the certified packages the production export publishes for the project are the committed ones; the function bodies of the lowering and its composition with `checkProgram`, `validateCrate`, and `correspondCrate` are carried by the later roots of this row. | §17.16, §17.23 | | `BS-08` | `bootstrap` | The last-use moves of the Rust lowering of SPEC.md §17.16 (`calculus::rust::moves::apply`: a read of a binding that nothing after it reads becomes a move, and the projection of a pair component that nothing after it reads moves that component out of the pair) are language-1.2 source in the `bootstrap/` project, the first pass of the function bodies of the lowering: `applyMoves` of `RustMoves`, for the items of a crate given as the `Def` chain of `RustAst`, each list of the AST carried as a chain of its own `Nil` and `Cons` constructors as in `BS-06`, is a production root eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond three quarters of `max_file_bytes`; on every host its rendered `rust-std` package under the pinned rustc agrees with the oracle to the byte, on the function bodies of 394 crates (the hand-built crates of each rule of the pass, the hand-built crates of `BS-05`, and the crates the renderer lowers from the committed programs); on the normative host its lowered program under the calculus evaluator agrees with the oracle on the 342 of those crates of at most 400 expressions and on 150 seeded mutants of the crates of at most 80 expressions, the rendered package agrees on 1,500 further seeded mutants, eight planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; an exported name in an expression and the passes of the function bodies that follow this one (the folds, the loops, and the lowering of terms, carried by their own rows and held by their composition to the final functions of `rust::lower`) are outside the claim. | §17.16, §17.23 | | `BS-09` | `bootstrap` | The runtime syntax validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateRuntime` of `RuntimeValidate` is a production root eligible for `rust-std` with exactly its declared effects, and its rendered `rust-std` package under the pinned rustc agrees with the Rust oracle `calculus::rust::rt_validate::validate` on the exact outcome and message for each of 717 crates: the committed `supportCrate` and `probeCrate` and each in the other profile, the 113 crates that break one rule, or one site of a rule, each, built by changing the committed crates and from small crates, and 600 seeded mutants of the two committed modules, 576 of the 717 refused, so that the refusals reach each of the 45 rules the oracle names and no other; the evaluator agrees on all 717; each of eight planted defects in the source is detected, and the certified package the production export publishes for the project is the committed one; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. | §17.16, §17.23 | | `BS-10` | `bootstrap` | The literal values of the Rust lowering of SPEC.md §17.16 (`Lowering::value`: the Rust expression of a literal of a type, with its origin, the box of a field that an ADT holds in place, and the width of a fixed-width literal) are language-1.2 source in the `bootstrap/` project, the first pass of the lowering of terms: `lowerValueAt` of `RustTerms`, for a program as in `BS-07`, the tree of `siteTrees`, and the index of a function whose body is a literal value, is a production root eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond three quarters of `max_file_bytes`; on every host its rendered `rust-std` package under the pinned rustc agrees with the oracle to the byte, the oracle being the tail of that function in the crate `rust::lower` builds, which no later pass of the lowering changes, on 358 explicit runs (every scalar literal at the ends of its range in each of five contexts, the composite literals, the literals of ADTs that hold themselves or each other, and the absent option of a function type); on the normative host its lowered program under the calculus evaluator agrees with the oracle on those and on 150 seeded runs, the rendered package agrees on 1,500 further seeded runs, ten planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; a literal text the checker refuses (a sign but the minus of a negative number, a leading zero, upper-case or odd-length hexadecimal, a magnitude beyond 64 bits), the other terms of the lowering, and the passes of the function bodies that follow (carried by their own rows and held by their composition to the final functions of `rust::lower`) are outside the claim. | §17.16, §17.23 | | `BS-11` | `bootstrap` | The lowering of the terms of a function body in the Rust lowering of SPEC.md §17.16 (`Lowering::expr` with its operands, conditionals, matches and their arms, builds, calls, closures, applications, primitives, and projections, and the `fold` of `lower`) is language-1.2 source in the `bootstrap/` project, the second pass of the lowering of terms, as four production roots that the host composes: `useTrees` of `CalculusCheck`, the types the lowering reads beside the tree of `siteTrees` (those of the operands of each primitive and of the value each field is read from); `lowerFrame` of `RustBodies`, what the analysis of `BS-07` knows that the terms read (the numbered function types, the boxed fields, the inhabited types, the closures of the live functions); `lowerBodies` of `RustBodies`, which for a program as calculus data, the two trees, the dead and the failing functions, that frame, and the counter its fresh names continue from returns the body of each live function as `lower` holds it before its fold (a dead function's place is the empty chain), numbering the fresh names as the lowering does, and the counter after them; and `foldBodies` of `RustBodies`, the fold; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 5,505,024 bytes, seven eighths of `max_file_bytes`; for the programs that `rust::lower` lowers in which no function can overflow and none loops, on every host the rendered `useTrees` package under the pinned rustc agrees to the byte with `calculus::sites::uses` on 157 vectors (the programs of the rules of this row and of `BS-07`, of `BS-04`, and the committed ones that qualify); on the normative host the lowered programs under the calculus evaluator agree with the oracle on those vectors and on 281 seeded mutants (drawn 3,000 times from the smaller committed programs, of which the checker and these conditions keep that many), `useTrees` by its tree and the other three by composition (the frame, the bodies, and the fold they return, put in place of the bodies of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte), the rendered packages of the three agree with the evaluator on the 156 vectors, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; functions that can overflow (`succeed`), functions that loop (`tail::looped`, which takes names from the counter the terms take theirs from), the parameters and results of a function, the bodies of the dead functions, and the crate around the bodies are outside the claim. | §17.16, §17.23 | | `BS-12` | `bootstrap` | The value a function that can overflow returns in the Rust lowering of SPEC.md §17.16 (`succeed`: `Ok` pushed into every tail of the body, a fallible call or application in tail position returning its result instead of propagating and rewrapping it, a computed unit bound before `Ok(())`) is language-1.2 source in the `bootstrap/` project, the third pass of the lowering of terms, as one production root, `succeedBodies` of `RustSucceed`, that the host composes after `lowerBodies` of `BS-11` and before its `foldBodies`; it is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers in which some function can overflow and none loops, on the normative host the lowered program under the calculus evaluator agrees with the oracle (the frame, the bodies, the succeeded bodies, and the fold they return, put in place of the bodies of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte) on 76 vectors and 149 seeded mutants, the rendered package agrees with the evaluator under the pinned rustc, eleven planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; functions that loop (`tail::looped`, which takes names from the counter the terms take theirs from) and the crate around the bodies are outside the claim. | §17.16, §17.23 | -| `BS-13` | `bootstrap` | The rendering of a function whose self calls are all tail calls as a loop in the Rust lowering of SPEC.md §17.16 (`tail::looped`: the state made of the parameters the self calls change, nested to the right; `Ok` of the next state at each tail self call and `Err` of the value at every other tail; the renamed parameters and the binding that holds the state) is language-1.2 source in the `bootstrap/` project, the fourth pass of the lowering of terms, as one production root, `loopFunction` of `RustLoops`, that the host composes after `foldBodies` function by function, passing on from one function to the next the counter of the fresh names that the terms and the loop both take; it is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers in which some function loops, on the normative host the lowered program under the calculus evaluator agrees with the oracle (the frame, then for each live function the terms from the counter, the success, the fold, and the loop, put in place of the bodies and parameters of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte), and says of each function that it loops exactly when `calculus::rust::loops` does, on 103 vectors and 108 seeded mutants, the rendered package agrees with the evaluator under the pinned rustc, 12 planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; the parameters and the result type of a function, which the host gives, and the crate around the bodies are outside the claim. | §17.16, §17.23 | -| `BS-14` | `bootstrap` | The crate around the bodies of the Rust lowering of SPEC.md §17.16 (the Function item of each function: its parameters, each a name when the body mentions it and its type is not unit; its result type, wrapped when the function can overflow; the body of a function with a parameter no value inhabits, which is the empty match on that parameter; and the order of all the items, the types' first) is language-1.2 source in the `bootstrap/` project, the last pass of the lowering, as two production roots of `RustAssemble` that the host composes with the roots of `BS-07` and `BS-11` to `BS-13`: `functionShells`, which for a program as calculus data, the failing functions, and the frame of `BS-11` returns a Function item of each function, complete for a function with an uninhabited parameter and with a placeholder body for the others, and `assembleItems`, which puts the items of `lowerTypes`, those shells, and the parameters and body that `loopFunction` returned for each live function into one chain of items; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers, on the normative host the lowered programs under the calculus evaluator agree with the oracle (the chain `assembleItems` returns, given to `applyMoves` of `BS-08`, is the whole chain of items of the crate to the byte, the items of the types too, the host passing the counter of the fresh names from one live function to the next and the profile) on 338 vectors and 580 seeded mutants, the rendered packages agree with the evaluator under the pinned rustc, 11 planted defects in the source and three hosts that do more than thread the counter (one that starts it again at each function, one that lowers the functions last to first, one that leaves out the items of the first live function) are each detected, and the certified packages the production export publishes for the project are the committed ones; the checks that `rust::lower` runs on the crate (`validate` and `correspond`), which are the roots of `BS-05` and `BS-06`, are outside the claim. | §17.16, §17.23 | -| `BS-15` | `bootstrap` | The package renderer of SPEC.md §17.16 (the checks `package::lower` makes of a manifest's own fields before it reads the program: the spec, the crate name against the Rust keywords and the reserved crates, the version, the profile, the form and the order of the sources, and the effects against the registry, with `allocation` refused on `rust-core`; the Cargo manifest over the scaffold record; and the provenance in canonical JSON with the digests of the runtime, the Cargo manifest, and the library) is language-1.2 source in the `bootstrap/` project, as two production roots of `RustPackage` that the host composes around the roots of `BS-04` to `BS-14`: `checkManifest`, which for the fields of a manifest and the registered effects returns whether the profile is `rust-std`, or the refusal of `package::lower` to the byte, and `renderPackage`, which for the scaffold record, the manifest's name, version, profile, sources, effects and exports, the program's identity, the compiler-semantics identity, the two runtime texts, and the library returns the `Cargo.toml` and the `provenance.json` of `package::package` to the byte; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; the oracle of `checkManifest` is `package::lower` on the manifest with its program and exports replaced by a pair every later check accepts, which agrees with each committed negative manifest's refusal, and the oracle of `renderPackage` is `package::package` on the 284 committed manifests it accepts and, on 137 hand-built inputs (names, exports, sources and effects that reach the escaper, and scaffold records that differ from the committed one) and 284 seeded mutants, `cargo_toml_of` and the canonical JSON of §21.7 by the recipe `package::package` is held to; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 302 committed manifests, 182 rule manifests and 2,000 seeded mutants, and on the 241 renders whose library is at most 16,384 bytes; the rendered packages agree with the oracle under the pinned rustc on all 3,184 runs; 21 planted defects in the source are each detected; and the certified packages the production export publishes for the project are the committed ones; the checks of the program, the exports and the crate, and the bytes of the library, which are the rows `BS-04` to `BS-14`, are outside the claim. | §17.16, §17.23 | +| `BS-13` | `bootstrap` | The rendering of a function whose self calls are all tail calls as a loop in the Rust lowering of SPEC.md §17.16 (`tail::looped`: the state made of the parameters the self calls change, nested to the right; `Ok` of the next state at each tail self call and `Err` of the value at every other tail; the renamed parameters and the binding that holds the state) is language-1.2 source in the `bootstrap/` project, the fourth pass of the lowering of terms, as one production root, `loopFunction` of `RustLoops`, that the host composes after `foldBodies` function by function, passing on from one function to the next the counter of the fresh names that the terms and the loop both take; it is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers in which some function loops, on the normative host the lowered program under the calculus evaluator agrees with the oracle (the frame, then for each live function the terms from the counter, the success, the fold, and the loop, put in place of the bodies and parameters of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte), and says of each function that it loops exactly when `calculus::rust::loops` does, on 104 vectors and 108 seeded mutants, the rendered package agrees with the evaluator under the pinned rustc, 12 planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; the parameters and the result type of a function, which the host gives, and the crate around the bodies are outside the claim. | §17.16, §17.23 | +| `BS-14` | `bootstrap` | The crate around the bodies of the Rust lowering of SPEC.md §17.16 (the Function item of each function: its parameters, each a name when the body mentions it and its type is not unit; its result type, wrapped when the function can overflow; the body of a function with a parameter no value inhabits, which is the empty match on that parameter; and the order of all the items, the types' first) is language-1.2 source in the `bootstrap/` project, the last pass of the lowering, as two production roots of `RustAssemble` that the host composes with the roots of `BS-07` and `BS-11` to `BS-13`: `functionShells`, which for a program as calculus data, the failing functions, and the frame of `BS-11` returns a Function item of each function, complete for a function with an uninhabited parameter and with a placeholder body for the others, and `assembleItems`, which puts the items of `lowerTypes`, those shells, and the parameters and body that `loopFunction` returned for each live function into one chain of items; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers, on the normative host the lowered programs under the calculus evaluator agree with the oracle (the chain `assembleItems` returns, given to `applyMoves` of `BS-08`, is the whole chain of items of the crate to the byte, the items of the types too, the host passing the counter of the fresh names from one live function to the next and the profile) on 339 vectors and 580 seeded mutants, the rendered packages agree with the evaluator under the pinned rustc, 11 planted defects in the source and three hosts that do more than thread the counter (one that starts it again at each function, one that lowers the functions last to first, one that leaves out the items of the first live function) are each detected, and the certified packages the production export publishes for the project are the committed ones; the checks that `rust::lower` runs on the crate (`validate` and `correspond`), which are the roots of `BS-05` and `BS-06`, are outside the claim. | §17.16, §17.23 | +| `BS-15` | `bootstrap` | The package renderer of SPEC.md §17.16 (the checks `package::lower` makes of a manifest's own fields before it reads the program: the spec, the crate name against the Rust keywords and the reserved crates, the version, the profile, the form and the order of the sources, and the effects against the registry, with `allocation` refused on `rust-core`; the Cargo manifest over the scaffold record; and the provenance in canonical JSON with the digests of the runtime, the Cargo manifest, and the library) is language-1.2 source in the `bootstrap/` project, as two production roots of `RustPackage` that the host composes around the roots of `BS-04` to `BS-14`: `checkManifest`, which for the fields of a manifest and the registered effects returns whether the profile is `rust-std`, or the refusal of `package::lower` to the byte, and `renderPackage`, which for the scaffold record, the manifest's name, version, profile, sources, effects and exports, the program's identity, the compiler-semantics identity, the two runtime texts, and the library returns the `Cargo.toml` and the `provenance.json` of `package::package` to the byte; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; the oracle of `checkManifest` is `package::lower` on the manifest with its program and exports replaced by a pair every later check accepts, which agrees with each committed negative manifest's refusal, and the oracle of `renderPackage` is `package::package` on the 284 committed manifests it accepts and, on 137 hand-built inputs (names, exports, sources and effects that reach the escaper, and scaffold records that differ from the committed one) and 284 seeded mutants, `cargo_toml_of` and the canonical JSON of §21.7 by the recipe `package::package` is held to; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 303 committed manifests, 182 rule manifests and 2,000 seeded mutants, and on the 241 renders whose library is at most 16,384 bytes; the rendered packages agree with the oracle under the pinned rustc on all 3,190 runs; 21 planted defects in the source are each detected; and the certified packages the production export publishes for the project are the committed ones; the checks of the program, the exports and the crate, and the bytes of the library, which are the rows `BS-04` to `BS-14`, are outside the claim. | §17.16, §17.23 | | `BS-16` | `bootstrap` | The GNAF request validation of SPEC.md §17.15 (`gnaf::validate`, with `universe_size`) is language-1.2 source in the `bootstrap/` project: `validateRequest` of `GnafValidate` is a production root eligible for `rust-std` with exactly its declared effects, over the projection of a request that validation reads (the length of the domain, the machine, the carrier's kind with each plan's preparations and the thresholds, the completeness evidence, the objective, the claim's class, and the scope) as first-order data, and returns the first violated rule in the model's order as the oracle's `serde_json` bytes, or nothing; on every host, its rendered `rust-std` package under the pinned rustc agrees with the Rust oracle `gnaf::validate` on the acceptance and on the rejection, to the byte, on the committed requests of `compiler/gnaf/`, the requests the committed certificate fixtures name, hand-built requests that reach each rejection, and seeded mutants of the committed requests; on the normative host, the root's lowered program under the calculus evaluator agrees with the oracle on the same corpus, each planted defect in the source is detected, and the certified package the production export publishes for the project is the committed one; loading a request (`gnaf::load`), the universe identity, the answer, and certification are outside the claim. | §17.15, §17.23 | | `BS-20` | `bootstrap` | The canonical LaTeX of a tooling module of SPEC.md §17.20 (`backend::tooling::render_latex`: the fixed document frame and, for each declaration in order, its title, its kind, and the lines the Lean printer of the same file spells for its types, signatures, and terms, every line escaped by `tex_escape`) is language-1.2 source in the `bootstrap/` project: `renderToolingLatex` of `ToolingLatex`, over the tooling module as first-order data with each list carried as a chain of its own `Nil` and `Cons` constructors and with the typings the checker infers as an argument, writing through the standard library's `Buffer` with an explicit capacity, is a production root eligible for `rust-std` with exactly its declared effects; its rendered `rust-std` package under the pinned rustc and its lowered program under the calculus evaluator agree with the Rust oracle on the text, to the byte, and on the refusal of a write past the capacity, on the committed tooling modules (whose committed `.tex` is equal to the text), on hand-built modules that reach every declaration, type, signature, and term form and every byte class of the escaper, and on seeded mutants, every planted defect is detected, and the certified package the production export publishes for the project is the committed one; the checker, the decoder of the module, and the source map of the emitted pieces stay in the host. | §17.20, §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 | diff --git a/VERIFICATION.md b/VERIFICATION.md index a6b95be8d4..42fa066f7b 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -12451,3 +12451,52 @@ weighting makes its partition assertion fail. This is a harness correction, not a change to the generated packages or a resolution of #164's consumer compiler-nesting question. A Windows rerun is required to establish whether this bounded partition removes the observed compiler failure. + +## BS-16 corpus counter repair prepared from current-head failures (#432) + +This source correction is pinned to PR #390 head +`7b854b6dc6dcbb4c0d95367b5ec56a44625e2cb3`. Run 41667292905 +reported BS-05 `(496,211,361,100)`, BS-06 +`(687,520,65,2145,1532,0)`, BS-13 `(104,52,108)`, and BS-14 +`(339,285,580)` before those cases' later assertions could execute. +These are observed corpus counters, not passing differential, mutation, +evaluator, certificate, or final export results. + +The new `validate_request/package.json` adds one distinct program and one +lowerable `rust-std` crate. The BS-05 totals are 260 committed crates plus +129 rule runs, 17 branch crates, 34 loop crates, 55 machine crates and one +list-match crate: 496 validation runs; correspondence has 260 + 12 + 34 + 55 += 361. The committed crate contributes no refusal. BS-06 adds that crate and +its exported-name package crate (520 committed runs); stepping through 260 +lowered crates by seven also adds index 259, whose capacity is one byte +short, making 687 crate runs and 65 refusals. Expression counts do not move. +The regenerated preserved program and the package program deduplicate in +the BS-13/14 source corpus. That program has 1,021 expression nodes and +self-tail calls, adding one looping and one whole-program vector while +remaining above the 300-node evaluator bound. Thus the within-bound and +seeded counters in the observed tuples do not move. + +The original Unicode comments and the `"é"` name fixture are restored from +the predecessor of commit `305635aaa`; assertions and differential/mutation +checks remain strict. Preparation used source/JSON inspection and +`git diff --check` only. No Rust build, test, writer, identity update, or +complete gate was run for this repair. Generated conformance documentation +still requires the official model writer. Later assertions remain +unexecuted for this correction. Integration with the active Host wave will +require its own combined-corpus measurements and final acceptance evidence; +these counters apply only to this PR head's corpus. #275 remains open. + +BS-15's existing PR CI job 126026329845 of run 41667292905 checked +out synthetic merge `fc16794` of `7b854b6dc` into `0a01df682` and +completed successfully (`conformance_bs_15 ... ok` at 18:44:51 UTC). Its +asserted manifest/render counts are 303/284, with 182 header rules, 137 +render rules, 2,000 header mutants and 284 render mutants. The two rustc +differential inputs therefore have 303 + 182 + 2,000 = 2,485 header runs +and 284 + 137 + 284 = 705 render runs, totaling 3,190. The statement's +302 manifests and 3,184 total were stale: 3,184 was the 301-manifest, +282-accepted corpus recorded for Order; BS-20 and GnafValidate each add +one manifest, one accepted render and one render mutant, three runs each. +The manifest statement had already incorporated BS-20's increment to 302 +but omitted GnafValidate's increment. These prose mirrors now match the +source and existing CI; this does not establish acceptance after restoring +the Unicode fixture or after any further integration. diff --git a/crates/conformance/src/cases/bootstrap/rust_assemble.rs b/crates/conformance/src/cases/bootstrap/rust_assemble.rs index d3fbbf7113..981087bd78 100644 --- a/crates/conformance/src/cases/bootstrap/rust_assemble.rs +++ b/crates/conformance/src/cases/bootstrap/rust_assemble.rs @@ -65,7 +65,7 @@ const ROOTS: [&str; 2] = ["functionShells", "assembleItems"]; /// The programs the evaluator is given: those of at most this many nodes. const EVALUATOR_NODES: usize = 300; -const VECTORS: usize = 338; +const VECTORS: usize = 339; const VECTORS_WITHIN: usize = 285; const EVALUATOR_MUTANTS: usize = 580; diff --git a/crates/conformance/src/cases/bootstrap/rust_loops.rs b/crates/conformance/src/cases/bootstrap/rust_loops.rs index 0593d25710..4cd67ce40b 100644 --- a/crates/conformance/src/cases/bootstrap/rust_loops.rs +++ b/crates/conformance/src/cases/bootstrap/rust_loops.rs @@ -40,7 +40,7 @@ const CERTIFICATE_BUDGET: u64 = 3_145_728; /// The programs the evaluator is given: those of at most this many nodes. const EVALUATOR_NODES: usize = 300; -const VECTORS: usize = 103; +const VECTORS: usize = 104; const VECTORS_WITHIN: usize = 52; const EVALUATOR_MUTANTS: usize = 108; diff --git a/crates/conformance/src/cases/bootstrap/rust_package.rs b/crates/conformance/src/cases/bootstrap/rust_package.rs index cd16afa986..6176486b49 100644 --- a/crates/conformance/src/cases/bootstrap/rust_package.rs +++ b/crates/conformance/src/cases/bootstrap/rust_package.rs @@ -1,4 +1,4 @@ -//! `BS-15`: the package renderer of SPEC.md §17.16 as language-1.2 source +//! `BS-15`: the package renderer of SPEC.md §17.16 as language-1.2 source //! (`LexLeanBoot.RustPackage`), held to `calculus::rust::package`. //! //! `package::lower` checks a manifest's own fields before it reads the @@ -369,7 +369,7 @@ const NAMES: &[&str] = &[ "a_b", "a-b", "a.b", - "é", + "é", "a\u{e9}", "a b", "sum_to_std", diff --git a/crates/conformance/src/cases/bootstrap/rust_print.rs b/crates/conformance/src/cases/bootstrap/rust_print.rs index e7338c0afc..a7237d887d 100644 --- a/crates/conformance/src/cases/bootstrap/rust_print.rs +++ b/crates/conformance/src/cases/bootstrap/rust_print.rs @@ -1,4 +1,4 @@ -//! `BS-06`: the Rust printer of SPEC.md §17.16 as language-1.2 source +//! `BS-06`: the Rust printer of SPEC.md §17.16 as language-1.2 source //! (`LexLeanBoot.RustPrint`), held to `calculus::rust::ast::{print, //! print_expr}` to the byte. //! @@ -1186,7 +1186,7 @@ const ROOTS: [(&str, &[&str]); 2] = [ ("printExpr", &["allocation", "overflow", "recursion"]), ]; -// The counts SPEC.md §17.23, the register statement of BS-06, its scenario, +// The counts SPEC.md §17.23, the register statement of BS-06, its scenario, // and VERIFICATION.md state, over the tree with the packages of the two roots // committed: the case fails when the tree no longer gives them. const COMMITTED_MANIFESTS: usize = 284; @@ -1194,9 +1194,9 @@ const COMMITTED_FIXTURES: usize = 122; const COMMITTED_PROGRAMS: usize = 201; const COMMITTED_CRATES: usize = 260; const COMMITTED_PACKAGES: usize = 284; -const VECTORS_CRATE: usize = 684; -const COMMITTED_DISTINCT: usize = 518; -const REFUSED_CRATE: usize = 64; +const VECTORS_CRATE: usize = 687; +const COMMITTED_DISTINCT: usize = 520; +const REFUSED_CRATE: usize = 65; const VECTORS_EXPR: usize = 2_145; const HAND_EXPR: usize = 1_532; const EVALUATOR_CRATE: usize = 582; diff --git a/crates/conformance/src/cases/bootstrap/rust_validate.rs b/crates/conformance/src/cases/bootstrap/rust_validate.rs index 9dd435e89b..03298dc029 100644 --- a/crates/conformance/src/cases/bootstrap/rust_validate.rs +++ b/crates/conformance/src/cases/bootstrap/rust_validate.rs @@ -1,4 +1,4 @@ -//! `BS-05` (SPEC.md §17.23, §17.16): the Rust crate validator as language-1.2 +//! `BS-05` (SPEC.md §17.23, §17.16): the Rust crate validator as language-1.2 //! source, held to `lexlean::calculus::rust::validate::{validate, correspond}`. //! //! The roots take the crate as module data, the constructors of the module's @@ -3003,7 +3003,7 @@ const RUSTC_MUTANTS: usize = 2_000; const RULES_EACH: usize = 3; // The counts the specification states, over the committed tree: SPEC.md -// §17.23, the register statement of BS-05, its scenario, and VERIFICATION.md +// §17.23, the register statement of BS-05, its scenario, and VERIFICATION.md // restate them, and the case fails when the tree no longer gives them. const COMMITTED_MANIFESTS: usize = 284; const COMMITTED_FIXTURES: usize = 122; @@ -3015,9 +3015,9 @@ const BRANCH_CRATES: usize = 17; const LOOP_CRATES: usize = 34; const LIST_MATCH_CRATES: usize = 1; const MACHINE_CRATES: usize = 44 + 3 + 1 + 2 + 2 + 3; -const VECTORS_VALIDATE: usize = 495; +const VECTORS_VALIDATE: usize = 496; const REFUSED_VALIDATE: usize = 211; -const VECTORS_CORRESPOND: usize = 360; +const VECTORS_CORRESPOND: usize = 361; const REFUSED_CORRESPOND: usize = 100; const EVALUATOR_CRATES: usize = 208; const EVALUATOR_VALIDATE: usize = 444; @@ -3038,7 +3038,7 @@ pub(super) fn case() { let (sources, manifests, fixtures, distinct) = committed(); let all = rendered(&sources); - // The counts SPEC.md §17.23, the register statement, and the scenario + // The counts SPEC.md §17.23, the register statement, and the scenario // state are asserted here, so a repository that grows fails the case // instead of leaving a stale statement behind. assert_eq!( diff --git a/features/suites/bootstrap.feature b/features/suites/bootstrap.feature index ff06074e60..e146657b6a 100644 --- a/features/suites/bootstrap.feature +++ b/features/suites/bootstrap.feature @@ -31,14 +31,14 @@ Feature: bootstrap And every planted defect is detected, and every exported package is byte-identical to its committed package and realizes the lowered program @BS-05 @build - Scenario: The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (495 `validateCrate` runs, 211 of them refusals, and 360 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. + Scenario: The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (496 `validateCrate` runs, 211 of them refusals, and 361 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. Given the committed `bootstrap` project, the crates the Rust renderer lowers from every committed target program, the refusals the seeded rule runs and the hand-built crates give, and the Rust validator `calculus::rust::validate` as the oracle When the project is checked and built, both roots' lowered programs are run by the evaluator on those crates and a seeded mutation corpus, both roots' rendered rust-std packages are run on those crates and the large seeded corpus, a defect is planted in the source, and the project is exported through the production pipeline Then both roots are eligible for rust-std with exactly their declared effects and no run disagrees with the oracle And every planted defect is detected, and every exported package is byte-identical to its committed package and realizes the lowered program @BS-06 @build - Scenario: The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,829 vectors, 684 of `printCrate` (64 of them refused for the capacity, 518 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. + Scenario: The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. Given the committed `bootstrap` project, the crates the Rust renderer lowers from every committed target program, the committed packages' libraries, the hand-built crates and expressions of the escaper, and the Rust printer `calculus::rust::ast::print` as the oracle When the project is checked and built, both roots' lowered programs are run by the evaluator on the crates of bounded size and a seeded mutation corpus, both roots' rendered rust-std packages are run on those crates and the large seeded corpus, a defect is planted in the source, and the project is exported through the production pipeline Then both roots are eligible for rust-std with exactly their declared effects and no run disagrees with the oracle @@ -87,21 +87,21 @@ Feature: bootstrap And every planted defect is detected, and the exported package is byte-identical to its committed package and realizes the program the differential ran @BS-13 @build - Scenario: The rendering of a function whose self calls are all tail calls as a loop in the Rust lowering of SPEC.md §17.16 (`tail::looped`: the state made of the parameters the self calls change, nested to the right; `Ok` of the next state at each tail self call and `Err` of the value at every other tail; the renamed parameters and the binding that holds the state) is language-1.2 source in the `bootstrap/` project, the fourth pass of the lowering of terms, as one production root, `loopFunction` of `RustLoops`, that the host composes after `foldBodies` function by function, passing on from one function to the next the counter of the fresh names that the terms and the loop both take; it is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers in which some function loops, on the normative host the lowered program under the calculus evaluator agrees with the oracle (the frame, then for each live function the terms from the counter, the success, the fold, and the loop, put in place of the bodies and parameters of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte), and says of each function that it loops exactly when `calculus::rust::loops` does, on 103 vectors and 108 seeded mutants, the rendered package agrees with the evaluator under the pinned rustc, 12 planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; the parameters and the result type of a function, which the host gives, and the crate around the bodies are outside the claim. + Scenario: The rendering of a function whose self calls are all tail calls as a loop in the Rust lowering of SPEC.md §17.16 (`tail::looped`: the state made of the parameters the self calls change, nested to the right; `Ok` of the next state at each tail self call and `Err` of the value at every other tail; the renamed parameters and the binding that holds the state) is language-1.2 source in the `bootstrap/` project, the fourth pass of the lowering of terms, as one production root, `loopFunction` of `RustLoops`, that the host composes after `foldBodies` function by function, passing on from one function to the next the counter of the fresh names that the terms and the loop both take; it is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers in which some function loops, on the normative host the lowered program under the calculus evaluator agrees with the oracle (the frame, then for each live function the terms from the counter, the success, the fold, and the loop, put in place of the bodies and parameters of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte), and says of each function that it loops exactly when `calculus::rust::loops` does, on 104 vectors and 108 seeded mutants, the rendered package agrees with the evaluator under the pinned rustc, 12 planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; the parameters and the result type of a function, which the host gives, and the crate around the bodies are outside the claim. Given the committed `bootstrap` project, the programs of the rules of the lowering, those of the target calculus' checker, the committed programs, and seeded mutants of the smaller ones, kept when some function loops When the project is checked and built, the lowered program of the root is run by the evaluator on the programs and the seeds, function by function with the counter of the fresh names, composed with the roots of `BS-11` and `BS-12` and `applyMoves`, and its rendered package is run under the pinned rustc Then the root is eligible for rust-std with exactly its declared effects, no certificate part is beyond 3,145,728 bytes, and the composition equals the Function items of the crate `rust::lower` returns, to the byte And every planted defect is detected, and the exported package is byte-identical to its committed package and realizes the program the differential ran @BS-14 @build - Scenario: The crate around the bodies of the Rust lowering of SPEC.md §17.16 (the Function item of each function: its parameters, each a name when the body mentions it and its type is not unit; its result type, wrapped when the function can overflow; the body of a function with a parameter no value inhabits, which is the empty match on that parameter; and the order of all the items, the types' first) is language-1.2 source in the `bootstrap/` project, the last pass of the lowering, as two production roots of `RustAssemble` that the host composes with the roots of `BS-07` and `BS-11` to `BS-13`: `functionShells`, which for a program as calculus data, the failing functions, and the frame of `BS-11` returns a Function item of each function, complete for a function with an uninhabited parameter and with a placeholder body for the others, and `assembleItems`, which puts the items of `lowerTypes`, those shells, and the parameters and body that `loopFunction` returned for each live function into one chain of items; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers, on the normative host the lowered programs under the calculus evaluator agree with the oracle (the chain `assembleItems` returns, given to `applyMoves` of `BS-08`, is the whole chain of items of the crate to the byte, the items of the types too, the host passing the counter of the fresh names from one live function to the next and the profile) on 338 vectors and 580 seeded mutants, the rendered packages agree with the evaluator under the pinned rustc, 11 planted defects in the source and three hosts that do more than thread the counter (one that starts it again at each function, one that lowers the functions last to first, one that leaves out the items of the first live function) are each detected, and the certified packages the production export publishes for the project are the committed ones; the checks that `rust::lower` runs on the crate (`validate` and `correspond`), which are the roots of `BS-05` and `BS-06`, are outside the claim. + Scenario: The crate around the bodies of the Rust lowering of SPEC.md §17.16 (the Function item of each function: its parameters, each a name when the body mentions it and its type is not unit; its result type, wrapped when the function can overflow; the body of a function with a parameter no value inhabits, which is the empty match on that parameter; and the order of all the items, the types' first) is language-1.2 source in the `bootstrap/` project, the last pass of the lowering, as two production roots of `RustAssemble` that the host composes with the roots of `BS-07` and `BS-11` to `BS-13`: `functionShells`, which for a program as calculus data, the failing functions, and the frame of `BS-11` returns a Function item of each function, complete for a function with an uninhabited parameter and with a placeholder body for the others, and `assembleItems`, which puts the items of `lowerTypes`, those shells, and the parameters and body that `loopFunction` returned for each live function into one chain of items; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers, on the normative host the lowered programs under the calculus evaluator agree with the oracle (the chain `assembleItems` returns, given to `applyMoves` of `BS-08`, is the whole chain of items of the crate to the byte, the items of the types too, the host passing the counter of the fresh names from one live function to the next and the profile) on 339 vectors and 580 seeded mutants, the rendered packages agree with the evaluator under the pinned rustc, 11 planted defects in the source and three hosts that do more than thread the counter (one that starts it again at each function, one that lowers the functions last to first, one that leaves out the items of the first live function) are each detected, and the certified packages the production export publishes for the project are the committed ones; the checks that `rust::lower` runs on the crate (`validate` and `correspond`), which are the roots of `BS-05` and `BS-06`, are outside the claim. Given the committed `bootstrap` project, the programs of the rules of the lowering, those of the target calculus' checker, the committed programs, and seeded mutants of the smaller ones, kept when the oracle lowers them When the project is checked and built, the lowered program of the root is run by the evaluator on the programs and the seeds, function by function with the counter of the fresh names, composed with the roots of `BS-07` and `BS-11` to `BS-13` and `applyMoves`, and its rendered package is run under the pinned rustc Then the root is eligible for rust-std with exactly its declared effects, no certificate part is beyond 3,145,728 bytes, and the composition equals the Function items of the crate `rust::lower` returns, to the byte And every planted defect is detected, and the exported package is byte-identical to its committed package and realizes the program the differential ran @BS-15 @build - Scenario: The package renderer of SPEC.md §17.16 (the checks `package::lower` makes of a manifest's own fields before it reads the program: the spec, the crate name against the Rust keywords and the reserved crates, the version, the profile, the form and the order of the sources, and the effects against the registry, with `allocation` refused on `rust-core`; the Cargo manifest over the scaffold record; and the provenance in canonical JSON with the digests of the runtime, the Cargo manifest, and the library) is language-1.2 source in the `bootstrap/` project, as two production roots of `RustPackage` that the host composes around the roots of `BS-04` to `BS-14`: `checkManifest`, which for the fields of a manifest and the registered effects returns whether the profile is `rust-std`, or the refusal of `package::lower` to the byte, and `renderPackage`, which for the scaffold record, the manifest's name, version, profile, sources, effects and exports, the program's identity, the compiler-semantics identity, the two runtime texts, and the library returns the `Cargo.toml` and the `provenance.json` of `package::package` to the byte; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; the oracle of `checkManifest` is `package::lower` on the manifest with its program and exports replaced by a pair every later check accepts, which agrees with each committed negative manifest's refusal, and the oracle of `renderPackage` is `package::package` on the 284 committed manifests it accepts and, on 137 hand-built inputs (names, exports, sources and effects that reach the escaper, and scaffold records that differ from the committed one) and 284 seeded mutants, `cargo_toml_of` and the canonical JSON of §21.7 by the recipe `package::package` is held to; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 302 committed manifests, 182 rule manifests and 2,000 seeded mutants, and on the 241 renders whose library is at most 16,384 bytes; the rendered packages agree with the oracle under the pinned rustc on all 3,184 runs; 21 planted defects in the source are each detected; and the certified packages the production export publishes for the project are the committed ones; the checks of the program, the exports and the crate, and the bytes of the library, which are the rows `BS-04` to `BS-14`, are outside the claim. + Scenario: The package renderer of SPEC.md §17.16 (the checks `package::lower` makes of a manifest's own fields before it reads the program: the spec, the crate name against the Rust keywords and the reserved crates, the version, the profile, the form and the order of the sources, and the effects against the registry, with `allocation` refused on `rust-core`; the Cargo manifest over the scaffold record; and the provenance in canonical JSON with the digests of the runtime, the Cargo manifest, and the library) is language-1.2 source in the `bootstrap/` project, as two production roots of `RustPackage` that the host composes around the roots of `BS-04` to `BS-14`: `checkManifest`, which for the fields of a manifest and the registered effects returns whether the profile is `rust-std`, or the refusal of `package::lower` to the byte, and `renderPackage`, which for the scaffold record, the manifest's name, version, profile, sources, effects and exports, the program's identity, the compiler-semantics identity, the two runtime texts, and the library returns the `Cargo.toml` and the `provenance.json` of `package::package` to the byte; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; the oracle of `checkManifest` is `package::lower` on the manifest with its program and exports replaced by a pair every later check accepts, which agrees with each committed negative manifest's refusal, and the oracle of `renderPackage` is `package::package` on the 284 committed manifests it accepts and, on 137 hand-built inputs (names, exports, sources and effects that reach the escaper, and scaffold records that differ from the committed one) and 284 seeded mutants, `cargo_toml_of` and the canonical JSON of §21.7 by the recipe `package::package` is held to; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 303 committed manifests, 182 rule manifests and 2,000 seeded mutants, and on the 241 renders whose library is at most 16,384 bytes; the rendered packages agree with the oracle under the pinned rustc on all 3,190 runs; 21 planted defects in the source are each detected; and the certified packages the production export publishes for the project are the committed ones; the checks of the program, the exports and the crate, and the bytes of the library, which are the rows `BS-04` to `BS-14`, are outside the claim. Given the committed `bootstrap` project, the committed package manifests and negative manifests, the rule manifests of each check of the fields, hand-built inputs of the escaper and the scaffold, and seeded mutants of both When the project is checked and built, the lowered program of each root is run by the evaluator on the manifests and on the renders whose library is within the bound, and its rendered package is run under the pinned rustc on all of them Then each root is eligible for rust-std with exactly its declared effects, no certificate part is beyond 3,145,728 bytes, `checkManifest` equals the refusal of `package::lower` on the fields, and `renderPackage` equals the `Cargo.toml` and `provenance.json` of `package::package`, to the byte diff --git a/model/ids.toml b/model/ids.toml index 61a4e73e67..76462031c5 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -2663,13 +2663,13 @@ statement = "The target calculus's checker of SPEC.md §17.14 (`lexlean::calculu id = "BS-05" level = "build" suite = "bootstrap" -statement = "The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (495 `validateCrate` runs, 211 of them refusals, and 360 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim." +statement = "The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (496 `validateCrate` runs, 211 of them refusals, and 361 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim." [[id]] id = "BS-06" level = "build" suite = "bootstrap" -statement = "The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,829 vectors, 684 of `printCrate` (64 of them refused for the capacity, 518 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim." +statement = "The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim." [[id]] @@ -2712,19 +2712,19 @@ statement = "The value a function that can overflow returns in the Rust lowering id = "BS-13" level = "build" suite = "bootstrap" -statement = "The rendering of a function whose self calls are all tail calls as a loop in the Rust lowering of SPEC.md §17.16 (`tail::looped`: the state made of the parameters the self calls change, nested to the right; `Ok` of the next state at each tail self call and `Err` of the value at every other tail; the renamed parameters and the binding that holds the state) is language-1.2 source in the `bootstrap/` project, the fourth pass of the lowering of terms, as one production root, `loopFunction` of `RustLoops`, that the host composes after `foldBodies` function by function, passing on from one function to the next the counter of the fresh names that the terms and the loop both take; it is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers in which some function loops, on the normative host the lowered program under the calculus evaluator agrees with the oracle (the frame, then for each live function the terms from the counter, the success, the fold, and the loop, put in place of the bodies and parameters of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte), and says of each function that it loops exactly when `calculus::rust::loops` does, on 103 vectors and 108 seeded mutants, the rendered package agrees with the evaluator under the pinned rustc, 12 planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; the parameters and the result type of a function, which the host gives, and the crate around the bodies are outside the claim." +statement = "The rendering of a function whose self calls are all tail calls as a loop in the Rust lowering of SPEC.md §17.16 (`tail::looped`: the state made of the parameters the self calls change, nested to the right; `Ok` of the next state at each tail self call and `Err` of the value at every other tail; the renamed parameters and the binding that holds the state) is language-1.2 source in the `bootstrap/` project, the fourth pass of the lowering of terms, as one production root, `loopFunction` of `RustLoops`, that the host composes after `foldBodies` function by function, passing on from one function to the next the counter of the fresh names that the terms and the loop both take; it is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers in which some function loops, on the normative host the lowered program under the calculus evaluator agrees with the oracle (the frame, then for each live function the terms from the counter, the success, the fold, and the loop, put in place of the bodies and parameters of the Function items of the crate and given to `applyMoves` of `BS-08`, give those items to the byte), and says of each function that it loops exactly when `calculus::rust::loops` does, on 104 vectors and 108 seeded mutants, the rendered package agrees with the evaluator under the pinned rustc, 12 planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; the parameters and the result type of a function, which the host gives, and the crate around the bodies are outside the claim." [[id]] id = "BS-14" level = "build" suite = "bootstrap" -statement = "The crate around the bodies of the Rust lowering of SPEC.md §17.16 (the Function item of each function: its parameters, each a name when the body mentions it and its type is not unit; its result type, wrapped when the function can overflow; the body of a function with a parameter no value inhabits, which is the empty match on that parameter; and the order of all the items, the types' first) is language-1.2 source in the `bootstrap/` project, the last pass of the lowering, as two production roots of `RustAssemble` that the host composes with the roots of `BS-07` and `BS-11` to `BS-13`: `functionShells`, which for a program as calculus data, the failing functions, and the frame of `BS-11` returns a Function item of each function, complete for a function with an uninhabited parameter and with a placeholder body for the others, and `assembleItems`, which puts the items of `lowerTypes`, those shells, and the parameters and body that `loopFunction` returned for each live function into one chain of items; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers, on the normative host the lowered programs under the calculus evaluator agree with the oracle (the chain `assembleItems` returns, given to `applyMoves` of `BS-08`, is the whole chain of items of the crate to the byte, the items of the types too, the host passing the counter of the fresh names from one live function to the next and the profile) on 338 vectors and 580 seeded mutants, the rendered packages agree with the evaluator under the pinned rustc, 11 planted defects in the source and three hosts that do more than thread the counter (one that starts it again at each function, one that lowers the functions last to first, one that leaves out the items of the first live function) are each detected, and the certified packages the production export publishes for the project are the committed ones; the checks that `rust::lower` runs on the crate (`validate` and `correspond`), which are the roots of `BS-05` and `BS-06`, are outside the claim." +statement = "The crate around the bodies of the Rust lowering of SPEC.md §17.16 (the Function item of each function: its parameters, each a name when the body mentions it and its type is not unit; its result type, wrapped when the function can overflow; the body of a function with a parameter no value inhabits, which is the empty match on that parameter; and the order of all the items, the types' first) is language-1.2 source in the `bootstrap/` project, the last pass of the lowering, as two production roots of `RustAssemble` that the host composes with the roots of `BS-07` and `BS-11` to `BS-13`: `functionShells`, which for a program as calculus data, the failing functions, and the frame of `BS-11` returns a Function item of each function, complete for a function with an uninhabited parameter and with a placeholder body for the others, and `assembleItems`, which puts the items of `lowerTypes`, those shells, and the parameters and body that `loopFunction` returned for each live function into one chain of items; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; for the programs that `rust::lower` lowers, on the normative host the lowered programs under the calculus evaluator agree with the oracle (the chain `assembleItems` returns, given to `applyMoves` of `BS-08`, is the whole chain of items of the crate to the byte, the items of the types too, the host passing the counter of the fresh names from one live function to the next and the profile) on 339 vectors and 580 seeded mutants, the rendered packages agree with the evaluator under the pinned rustc, 11 planted defects in the source and three hosts that do more than thread the counter (one that starts it again at each function, one that lowers the functions last to first, one that leaves out the items of the first live function) are each detected, and the certified packages the production export publishes for the project are the committed ones; the checks that `rust::lower` runs on the crate (`validate` and `correspond`), which are the roots of `BS-05` and `BS-06`, are outside the claim." [[id]] id = "BS-15" level = "build" suite = "bootstrap" -statement = "The package renderer of SPEC.md §17.16 (the checks `package::lower` makes of a manifest's own fields before it reads the program: the spec, the crate name against the Rust keywords and the reserved crates, the version, the profile, the form and the order of the sources, and the effects against the registry, with `allocation` refused on `rust-core`; the Cargo manifest over the scaffold record; and the provenance in canonical JSON with the digests of the runtime, the Cargo manifest, and the library) is language-1.2 source in the `bootstrap/` project, as two production roots of `RustPackage` that the host composes around the roots of `BS-04` to `BS-14`: `checkManifest`, which for the fields of a manifest and the registered effects returns whether the profile is `rust-std`, or the refusal of `package::lower` to the byte, and `renderPackage`, which for the scaffold record, the manifest's name, version, profile, sources, effects and exports, the program's identity, the compiler-semantics identity, the two runtime texts, and the library returns the `Cargo.toml` and the `provenance.json` of `package::package` to the byte; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; the oracle of `checkManifest` is `package::lower` on the manifest with its program and exports replaced by a pair every later check accepts, which agrees with each committed negative manifest's refusal, and the oracle of `renderPackage` is `package::package` on the 284 committed manifests it accepts and, on 137 hand-built inputs (names, exports, sources and effects that reach the escaper, and scaffold records that differ from the committed one) and 284 seeded mutants, `cargo_toml_of` and the canonical JSON of §21.7 by the recipe `package::package` is held to; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 302 committed manifests, 182 rule manifests and 2,000 seeded mutants, and on the 241 renders whose library is at most 16,384 bytes; the rendered packages agree with the oracle under the pinned rustc on all 3,184 runs; 21 planted defects in the source are each detected; and the certified packages the production export publishes for the project are the committed ones; the checks of the program, the exports and the crate, and the bytes of the library, which are the rows `BS-04` to `BS-14`, are outside the claim." +statement = "The package renderer of SPEC.md §17.16 (the checks `package::lower` makes of a manifest's own fields before it reads the program: the spec, the crate name against the Rust keywords and the reserved crates, the version, the profile, the form and the order of the sources, and the effects against the registry, with `allocation` refused on `rust-core`; the Cargo manifest over the scaffold record; and the provenance in canonical JSON with the digests of the runtime, the Cargo manifest, and the library) is language-1.2 source in the `bootstrap/` project, as two production roots of `RustPackage` that the host composes around the roots of `BS-04` to `BS-14`: `checkManifest`, which for the fields of a manifest and the registered effects returns whether the profile is `rust-std`, or the refusal of `package::lower` to the byte, and `renderPackage`, which for the scaffold record, the manifest's name, version, profile, sources, effects and exports, the program's identity, the compiler-semantics identity, the two runtime texts, and the library returns the `Cargo.toml` and the `provenance.json` of `package::package` to the byte; each is eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond 3,145,728 bytes; the oracle of `checkManifest` is `package::lower` on the manifest with its program and exports replaced by a pair every later check accepts, which agrees with each committed negative manifest's refusal, and the oracle of `renderPackage` is `package::package` on the 284 committed manifests it accepts and, on 137 hand-built inputs (names, exports, sources and effects that reach the escaper, and scaffold records that differ from the committed one) and 284 seeded mutants, `cargo_toml_of` and the canonical JSON of §21.7 by the recipe `package::package` is held to; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 303 committed manifests, 182 rule manifests and 2,000 seeded mutants, and on the 241 renders whose library is at most 16,384 bytes; the rendered packages agree with the oracle under the pinned rustc on all 3,190 runs; 21 planted defects in the source are each detected; and the certified packages the production export publishes for the project are the committed ones; the checks of the program, the exports and the crate, and the bytes of the library, which are the rows `BS-04` to `BS-14`, are outside the claim." [[id]] id = "BS-16" From 050e96579b83f2f71dda78e1bf6a87791278582a Mon Sep 17 00:00:00 2001 From: Alexander Flom Date: Wed, 4 Nov 2026 19:48:53 +0000 Subject: [PATCH 10/10] Reconcile BS06 census and canonicalize preservation fixtures Keep the existing typed factory and 6000-node predicate strict while updating its observed evaluator census and all normative mirrors from 582 to 583. Adopt the official formatter's two fixture-source outputs and regenerate the conformance projection through the official model writer. Preserve failed CI and published verification history; no individual crossing cause or later BS06/AU04 case pass is claimed. Validation: official model write, validate-model, validate-spec-links, cargo fmt --all -- --check; independently reviewed eight-path actual delta. Complete final changed-head CI remains required before merge. --- CONFORMANCE.md | 2 +- SPEC.md | 4 +- VERIFICATION.md | 49 +++++++++++++++++++ .../src/cases/bootstrap/rust_print.rs | 2 +- features/suites/bootstrap.feature | 2 +- model/ids.toml | 2 +- tests/fixtures/binder-arm/src/Main.lex.tex | 4 +- .../recursive-argument/src/Main.lex.tex | 8 +-- 8 files changed, 59 insertions(+), 14 deletions(-) diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 57dcf3874f..7058bc3b75 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -65,7 +65,7 @@ the error registry does not sanction (R5, `ERRORS.md`). | `BS-03` | `build` | The primitive scanner of SPEC.md §12.2 is language-1.2 source in the `bootstrap/` project: `scanSource` and `rejectAtoms` of `PrimitiveScan` are production roots eligible for `rust-std` with exactly their declared effects; on every host of the matrix, both roots' rendered `rust-std` packages under that host's pinned rustc agree with the Rust oracle `source::scan::{scan, reject_forbidden_atoms}` on every atom with its class, text, and byte, line, and column spans and on every rejection with its code, message, span, and help, for the deterministic vectors (the oracle's unit inputs, the atom limit at N and N+1, atom lists with gaps, payload strings, and notation bodies), a 128-byte window and a 2,048-byte prefix of every committed `.lex.tex` source, and the whole of each such source up to 8,192 bytes (up to 1,024 bytes, one source in four, for `rejectAtoms`); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the vectors and the 128-byte windows and on 80 seeded texts, the packages agree on 2,500 seeded texts, each of ten planted defects in the source is detected, and the certified packages the production export publishes for the project are the committed ones. | | `BS-04` | `build` | The target calculus's checker of SPEC.md §17.14 (`lexlean::calculus::check`), for a program given as calculus data, each list of a recursive type carried as a chain of that type's own `Nil` and `Cons` constructors and decoded back to the program on every vector (reading a program from its canonical JSON is not part of this row), is language-1.2 source in the `bootstrap/` project: `checkProgram` and `checkArguments` of `CalculusCheck` are production roots eligible for `rust-std` with exactly their declared effects; on the normative host the lowered programs of both roots under the calculus evaluator agree with the Rust checker on acceptance and on the rejection message to the byte for every committed target program and the refusal edits of `TC-02` and for a seeded corpus of data-level mutations, and each planted defect in the source is detected; on every host the rendered `rust-std` packages of both roots under the pinned rustc agree with the Rust checker on the deterministic vectors, and on the normative host also on a larger seeded corpus with no disagreement; strings whose Rust `Debug` spelling escapes a non-ASCII scalar other than `U+0080`..`U+009F` are outside the claim; and the certified packages the production export publishes for the project are the committed ones. | | `BS-05` | `build` | The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (496 `validateCrate` runs, 211 of them refusals, and 361 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. | -| `BS-06` | `build` | The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. | +| `BS-06` | `build` | The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 583 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. | | `BS-07` | `build` | The failure typing and the types of the Rust lowering of SPEC.md §17.16 (`calculus::rust::fallible_functions`, and the enums and dispatch of the types of the crate that `rust::lower` builds) are language-1.2 source in the `bootstrap/` project as four production roots that the host composes: `siteTrees` of `CalculusCheck` (the type of each match scrutinee and of each applied target of a program, computed by the module's own `walk` and `inferTy`, the copy `checkProgram` runs on), `deadFunctions` and `fallibleFunctions` of `RustLower`, which read that tree as an argument and never call `walk`, and `lowerTypes` of `RustLower`, which returns the `Enum` item of each ADT and of each function type and the `Apply` item of each function type as a `Def` chain of `RustAst`, given the tree and the two flag lists; for a program given as calculus data that `checkProgram` accepts, each list of a recursive type carried as a chain of that type's own `Nil` and `Cons` constructors as in `BS-04`, each root is eligible for `rust-std` with exactly its declared effects and has no part of its certificates beyond three quarters of `max_file_bytes`; on every host the rendered `rust-std` packages of the four roots under the pinned rustc agree with the Rust oracle (the typing sites of `calculus::sites::trees`, the dead functions the crate of `rust::lower` shows, `fallible_functions`, and the type items of that crate, each given the legs before it) on 335 vectors, the committed target programs and the programs that exercise each rule of the analysis (a failing primitive, a successor, a call, an application of a function type one of whose closures fails, a function with an argument of a function type no closure inhabits, the closure of a dead function) and the programs of the corpora of `BS-04` that the checker accepts; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 281 of those vectors of at most 300 nodes and on 150 seeded mutants that `checkProgram` accepts, the rendered packages agree on 1,500 further seeded mutants, twenty planted defects in the source, three of them in the typing root and seven in the types, are each detected, and the certified packages the production export publishes for the project are the committed ones; the function bodies of the lowering and its composition with `checkProgram`, `validateCrate`, and `correspondCrate` are carried by the later roots of this row. | | `BS-08` | `build` | The last-use moves of the Rust lowering of SPEC.md §17.16 (`calculus::rust::moves::apply`: a read of a binding that nothing after it reads becomes a move, and the projection of a pair component that nothing after it reads moves that component out of the pair) are language-1.2 source in the `bootstrap/` project, the first pass of the function bodies of the lowering: `applyMoves` of `RustMoves`, for the items of a crate given as the `Def` chain of `RustAst`, each list of the AST carried as a chain of its own `Nil` and `Cons` constructors as in `BS-06`, is a production root eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond three quarters of `max_file_bytes`; on every host its rendered `rust-std` package under the pinned rustc agrees with the oracle to the byte, on the function bodies of 394 crates (the hand-built crates of each rule of the pass, the hand-built crates of `BS-05`, and the crates the renderer lowers from the committed programs); on the normative host its lowered program under the calculus evaluator agrees with the oracle on the 342 of those crates of at most 400 expressions and on 150 seeded mutants of the crates of at most 80 expressions, the rendered package agrees on 1,500 further seeded mutants, eight planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; an exported name in an expression and the passes of the function bodies that follow this one (the folds, the loops, and the lowering of terms, carried by their own rows and held by their composition to the final functions of `rust::lower`) are outside the claim. | | `BS-09` | `build` | The runtime syntax validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateRuntime` of `RuntimeValidate` is a production root eligible for `rust-std` with exactly its declared effects, and its rendered `rust-std` package under the pinned rustc agrees with the Rust oracle `calculus::rust::rt_validate::validate` on the exact outcome and message for each of 717 crates: the committed `supportCrate` and `probeCrate` and each in the other profile, the 113 crates that break one rule, or one site of a rule, each, built by changing the committed crates and from small crates, and 600 seeded mutants of the two committed modules, 576 of the 717 refused, so that the refusals reach each of the 45 rules the oracle names and no other; the evaluator agrees on all 717; each of eight planted defects in the source is detected, and the certified package the production export publishes for the project is the committed one; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. | diff --git a/SPEC.md b/SPEC.md index c9f2192db8..db000fbb84 100644 --- a/SPEC.md +++ b/SPEC.md @@ -8229,7 +8229,7 @@ every construct, literal, runtime row and machine primitive, and the function bodies of the committed crates). The items of each of the 284 committed libraries are the oracle's printed items; the header before them is the runtime of the committed export, which the regeneration of the records moves -with the runtime. On the normative host the evaluator agrees on 582 and 2,145 +with the runtime. On the normative host the evaluator agrees on 583 and 2,145 of those vectors (the crates of at most 6,000 nodes of data) and on 400 and 394 seeded mutants of the crates of at most 80 expressions, the rendered packages agree on 2,989 further mutants, thirteen planted defects in the source @@ -11542,7 +11542,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte | `BS-03` | `bootstrap` | The primitive scanner of SPEC.md §12.2 is language-1.2 source in the `bootstrap/` project: `scanSource` and `rejectAtoms` of `PrimitiveScan` are production roots eligible for `rust-std` with exactly their declared effects; on every host of the matrix, both roots' rendered `rust-std` packages under that host's pinned rustc agree with the Rust oracle `source::scan::{scan, reject_forbidden_atoms}` on every atom with its class, text, and byte, line, and column spans and on every rejection with its code, message, span, and help, for the deterministic vectors (the oracle's unit inputs, the atom limit at N and N+1, atom lists with gaps, payload strings, and notation bodies), a 128-byte window and a 2,048-byte prefix of every committed `.lex.tex` source, and the whole of each such source up to 8,192 bytes (up to 1,024 bytes, one source in four, for `rejectAtoms`); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the vectors and the 128-byte windows and on 80 seeded texts, the packages agree on 2,500 seeded texts, each of ten planted defects in the source is detected, and the certified packages the production export publishes for the project are the committed ones. | §12.2, §17.23 | | `BS-04` | `bootstrap` | The target calculus's checker of SPEC.md §17.14 (`lexlean::calculus::check`), for a program given as calculus data, each list of a recursive type carried as a chain of that type's own `Nil` and `Cons` constructors and decoded back to the program on every vector (reading a program from its canonical JSON is not part of this row), is language-1.2 source in the `bootstrap/` project: `checkProgram` and `checkArguments` of `CalculusCheck` are production roots eligible for `rust-std` with exactly their declared effects; on the normative host the lowered programs of both roots under the calculus evaluator agree with the Rust checker on acceptance and on the rejection message to the byte for every committed target program and the refusal edits of `TC-02` and for a seeded corpus of data-level mutations, and each planted defect in the source is detected; on every host the rendered `rust-std` packages of both roots under the pinned rustc agree with the Rust checker on the deterministic vectors, and on the normative host also on a larger seeded corpus with no disagreement; strings whose Rust `Debug` spelling escapes a non-ASCII scalar other than `U+0080`..`U+009F` are outside the claim; and the certified packages the production export publishes for the project are the committed ones. | §17.14, §17.23 | | `BS-05` | `bootstrap` | The Rust crate validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateCrate` and `correspondCrate` of `RustValidate` are production roots eligible for `rust-std` with exactly their declared effects; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle `calculus::rust::validate::{validate, correspond}` on the exact outcome and message for the 260 distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures, for 129 `validateCrate` and 12 `correspondCrate` runs that reach 47 of the 48 reachable refusals three times each, for 17 hand-built crates of the merge of moved sets, for 34 hand-built crates of the loop rules, for one hand-built crate of the 48th, a list match under `rust-core`, and for 55 hand-built crates of the machine callee and the overflow value, whose three refusals no mutant reaches (496 `validateCrate` runs, 211 of them refusals, and 361 `correspondCrate` runs, 100 of them refusals); on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on the crates of at most 400 expressions (208) with the rule runs and on 500 seeded mutants of the crates of at most 80 expressions, the rendered packages under the pinned rustc agree on 2,000 further seeded mutants per root, twenty planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. | §17.16, §17.23 | -| `BS-06` | `bootstrap` | The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. | §17.16, §17.23 | +| `BS-06` | `bootstrap` | The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 583 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. | §17.16, §17.23 | | `BS-07` | `bootstrap` | The failure typing and the types of the Rust lowering of SPEC.md §17.16 (`calculus::rust::fallible_functions`, and the enums and dispatch of the types of the crate that `rust::lower` builds) are language-1.2 source in the `bootstrap/` project as four production roots that the host composes: `siteTrees` of `CalculusCheck` (the type of each match scrutinee and of each applied target of a program, computed by the module's own `walk` and `inferTy`, the copy `checkProgram` runs on), `deadFunctions` and `fallibleFunctions` of `RustLower`, which read that tree as an argument and never call `walk`, and `lowerTypes` of `RustLower`, which returns the `Enum` item of each ADT and of each function type and the `Apply` item of each function type as a `Def` chain of `RustAst`, given the tree and the two flag lists; for a program given as calculus data that `checkProgram` accepts, each list of a recursive type carried as a chain of that type's own `Nil` and `Cons` constructors as in `BS-04`, each root is eligible for `rust-std` with exactly its declared effects and has no part of its certificates beyond three quarters of `max_file_bytes`; on every host the rendered `rust-std` packages of the four roots under the pinned rustc agree with the Rust oracle (the typing sites of `calculus::sites::trees`, the dead functions the crate of `rust::lower` shows, `fallible_functions`, and the type items of that crate, each given the legs before it) on 335 vectors, the committed target programs and the programs that exercise each rule of the analysis (a failing primitive, a successor, a call, an application of a function type one of whose closures fails, a function with an argument of a function type no closure inhabits, the closure of a dead function) and the programs of the corpora of `BS-04` that the checker accepts; on the normative host the lowered programs under the calculus evaluator agree with the oracle on the 281 of those vectors of at most 300 nodes and on 150 seeded mutants that `checkProgram` accepts, the rendered packages agree on 1,500 further seeded mutants, twenty planted defects in the source, three of them in the typing root and seven in the types, are each detected, and the certified packages the production export publishes for the project are the committed ones; the function bodies of the lowering and its composition with `checkProgram`, `validateCrate`, and `correspondCrate` are carried by the later roots of this row. | §17.16, §17.23 | | `BS-08` | `bootstrap` | The last-use moves of the Rust lowering of SPEC.md §17.16 (`calculus::rust::moves::apply`: a read of a binding that nothing after it reads becomes a move, and the projection of a pair component that nothing after it reads moves that component out of the pair) are language-1.2 source in the `bootstrap/` project, the first pass of the function bodies of the lowering: `applyMoves` of `RustMoves`, for the items of a crate given as the `Def` chain of `RustAst`, each list of the AST carried as a chain of its own `Nil` and `Cons` constructors as in `BS-06`, is a production root eligible for `rust-std` with exactly its declared effects and has no part of its certificate beyond three quarters of `max_file_bytes`; on every host its rendered `rust-std` package under the pinned rustc agrees with the oracle to the byte, on the function bodies of 394 crates (the hand-built crates of each rule of the pass, the hand-built crates of `BS-05`, and the crates the renderer lowers from the committed programs); on the normative host its lowered program under the calculus evaluator agrees with the oracle on the 342 of those crates of at most 400 expressions and on 150 seeded mutants of the crates of at most 80 expressions, the rendered package agrees on 1,500 further seeded mutants, eight planted defects in the source are each detected, and the certified package the production export publishes for the project is the committed one; an exported name in an expression and the passes of the function bodies that follow this one (the folds, the loops, and the lowering of terms, carried by their own rows and held by their composition to the final functions of `rust::lower`) are outside the claim. | §17.16, §17.23 | | `BS-09` | `bootstrap` | The runtime syntax validator of SPEC.md §17.16 is language-1.2 source in the `bootstrap/` project: `validateRuntime` of `RuntimeValidate` is a production root eligible for `rust-std` with exactly its declared effects, and its rendered `rust-std` package under the pinned rustc agrees with the Rust oracle `calculus::rust::rt_validate::validate` on the exact outcome and message for each of 717 crates: the committed `supportCrate` and `probeCrate` and each in the other profile, the 113 crates that break one rule, or one site of a rule, each, built by changing the committed crates and from small crates, and 600 seeded mutants of the two committed modules, 576 of the 717 refused, so that the refusals reach each of the 45 rules the oracle names and no other; the evaluator agrees on all 717; each of eight planted defects in the source is detected, and the certified package the production export publishes for the project is the committed one; lowering, printing, packaging, and crates naming a non-ASCII or non-printable scalar are outside the claim. | §17.16, §17.23 | diff --git a/VERIFICATION.md b/VERIFICATION.md index 5c91d05767..9625a4aeef 100644 --- a/VERIFICATION.md +++ b/VERIFICATION.md @@ -13318,3 +13318,52 @@ accepted landing. #390 and #292 remain open until complete combined CI and final review, then must be explicitly closed as superseded before the carrier merges, avoiding misleading automatic ancestry dispositions. #275, #278 and other broader parent issues remain open. No #391 implementation is included. + +## Combined carrier follow-up: observed BS06 census and AU04 formatting + +Final-head CI for `3fe13b50` failed BS06 in run 41889333456, job +126784187495. The unchanged typed factory and 6,000-value-node filter measured +`(583, 2145, 400, 394, 2989)`, against expected +`(582, 2145, 400, 394, 2989)`. Preceding assertions established 284 manifests, +122 fixtures, 201 programs, 260 crates and 284 packages; 687 `printCrate` +vectors included 520 committed distinct crates and 65 capacity refusals, while +2,145 `printExpr` vectors included 1,532 hand-built vectors and no refusals. + +Independent acceptance-contract review (`8e766098`) concluded that the case's +own observed census supports changing only the expected evaluator-crate count +582 to 583 and its strict source mirrors. The factory, ordering, deduplication, +6,000-node membership predicate, seeds, refusals, differentials and 13 plants +remain unchanged. This requires one more current vector in the evaluator leg; +it does not reduce coverage. The exact individual member and historical +crossing cause were not identified and are not claimed. The failed case had +not reached its later evaluator/differential/plant legs, so no BS06 pass follows +from this calibration. The earlier unexecuted observer proposal and its review +history remain preserved; no observer build or run was required or performed. + +Separately, the actual official frozen formatter produced the two AU04 fixture +source corrections: canonical declaration field order in `binder-arm`, and +canonical match layout in `recursive-argument`. Independent output review +`f7a61783` found the exact two-source patch `8f6beb` suitable for adoption. +Only those official emitted source bytes are adopted; no copied lock, helper, +expected output, policy, semantic effect or capability is added. + +This source repair preserves the full published verification record, including +the earlier 71-line combined-wave append and all CI failures. CONFORMANCE +remains owned by the one official model writer after source adoption; no +hand-edited projection or new runtime acceptance is claimed here. One +complete final changed-head hosted gate, including full BS06 and every other +required case, reproducibility and honesty remains required before merge. +No extra local heavy case, identity/pin rebuild, product regeneration or +publication is authorized by this source preparation. + +The admitted minimal follow-up phase completed on 2026-11-04 at 19:45:40 UTC. +It adopted the seven reviewed source files, preserving the published combined +verification appendix. The official model writer changed only CONFORMANCE's +BS06 evaluator census from 582 to 583 (0.682 seconds); validate-model +(42.877 seconds), validate-spec-links (1.436 seconds) and format checking +(3.347 seconds) passed with no additional writes. ERRORS, 905 embedded inputs, +both frozen executables, the probe, source index and HEAD remained exact. +Independent actual review `67b0a369` cleared the eight-path source/projection +delta. Result `6f2c0f5a` and final inventory `b10f93e0` retain exact outcomes. +These are source/model checks, not BS06 or AU04 conformance-case passes; the +complete changed-head hosted gate and all later obligations remain required. diff --git a/crates/conformance/src/cases/bootstrap/rust_print.rs b/crates/conformance/src/cases/bootstrap/rust_print.rs index a7237d887d..0ad2a96b30 100644 --- a/crates/conformance/src/cases/bootstrap/rust_print.rs +++ b/crates/conformance/src/cases/bootstrap/rust_print.rs @@ -1199,7 +1199,7 @@ const COMMITTED_DISTINCT: usize = 520; const REFUSED_CRATE: usize = 65; const VECTORS_EXPR: usize = 2_145; const HAND_EXPR: usize = 1_532; -const EVALUATOR_CRATE: usize = 582; +const EVALUATOR_CRATE: usize = 583; const SEEDED_CRATE: usize = 400; const SEEDED_EXPR: usize = 394; const RUSTC_SEEDED_RUNS: usize = 2_989; diff --git a/features/suites/bootstrap.feature b/features/suites/bootstrap.feature index e146657b6a..db748c99ca 100644 --- a/features/suites/bootstrap.feature +++ b/features/suites/bootstrap.feature @@ -38,7 +38,7 @@ Feature: bootstrap And every planted defect is detected, and every exported package is byte-identical to its committed package and realizes the lowered program @BS-06 @build - Scenario: The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. + Scenario: The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 583 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim. Given the committed `bootstrap` project, the crates the Rust renderer lowers from every committed target program, the committed packages' libraries, the hand-built crates and expressions of the escaper, and the Rust printer `calculus::rust::ast::print` as the oracle When the project is checked and built, both roots' lowered programs are run by the evaluator on the crates of bounded size and a seeded mutation corpus, both roots' rendered rust-std packages are run on those crates and the large seeded corpus, a defect is planted in the source, and the project is exported through the production pipeline Then both roots are eligible for rust-std with exactly their declared effects and no run disagrees with the oracle diff --git a/model/ids.toml b/model/ids.toml index 7d72229577..714b85d18a 100644 --- a/model/ids.toml +++ b/model/ids.toml @@ -2699,7 +2699,7 @@ statement = "The Rust crate validator of SPEC.md §17.16 is language-1.2 source id = "BS-06" level = "build" suite = "bootstrap" -statement = "The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 582 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim." +statement = "The Rust printer of SPEC.md §17.16 (`calculus::rust::ast::{print, print_expr}`) is language-1.2 source in the `bootstrap/` project: `printCrate` and `printExpr` of `RustPrint`, over the closed Rust AST as first-order data with its literal payloads, exported names, runtime rows, and machine primitives (`RustAst`), each list of the AST carried as a chain of its own `Nil` and `Cons` constructors, are production roots eligible for `rust-std` with exactly their declared effects, and write their output into a `Buffer` of a given capacity, the capacity exceeded being the refusal of the buffer; the header of the library (the crate attributes and the runtime) is an argument; on every host, both roots' rendered `rust-std` packages under the pinned rustc agree with the Rust oracle to the byte on 2,832 vectors, 687 of `printCrate` (65 of them refused for the capacity, 520 the distinct crates the renderer lowers from the 201 distinct programs among the 284 committed package manifests and 122 fixtures and the crates of the 284 committed packages) and 2,145 of `printExpr` (1,532 of them hand-built, the rest the function bodies of those crates), with the items of each of the 284 committed libraries equal to the oracle's printed items; on the normative host, both roots' lowered programs under the calculus evaluator agree with the oracle on 583 and 2,145 of those vectors and on 400 and 394 seeded mutants, the rendered packages agree on 2,989 further seeded mutants, thirteen planted defects in the source are each detected, and the certified packages the production export publishes for the project are the committed ones; a crate naming a non-ASCII or non-printable scalar in an exported name, a literal wider than 64 bits, and a machine call with fewer operands than its primitive, which the oracle indexes past, are outside the claim." [[id]] diff --git a/tests/fixtures/binder-arm/src/Main.lex.tex b/tests/fixtures/binder-arm/src/Main.lex.tex index b70cc983c9..3ecb2e7261 100644 --- a/tests/fixtures/binder-arm/src/Main.lex.tex +++ b/tests/fixtures/binder-arm/src/Main.lex.tex @@ -55,8 +55,8 @@ parameters: [items : Expr], result: Expr, body: (bumpedTail (itemHead (itemTail items))), - production: {effects: [allocation, overflow, recursion], targets: [rust-std]}, - executable: true + executable: true, + production: {effects: [allocation, overflow, recursion], targets: [rust-std]} } \end{semanticmodule} \end{lexlean} diff --git a/tests/fixtures/recursive-argument/src/Main.lex.tex b/tests/fixtures/recursive-argument/src/Main.lex.tex index 377ddb3ef1..dfc27c5a1b 100644 --- a/tests/fixtures/recursive-argument/src/Main.lex.tex +++ b/tests/fixtures/recursive-argument/src/Main.lex.tex @@ -64,9 +64,7 @@ name: countOf, parameters: [start : Nat, types : (List Nat)], result: Nat, - body: (match types - | List.nil => start - | List.cons head tail => (countOf (start + 1) tail)), + body: (match types | List.nil => start | List.cons head tail => (countOf (start + 1) tail)), executable: true, recursive_argument: types } @@ -77,9 +75,7 @@ result: Nat, body: (match count | Nat.zero => 0 - | Nat.succ less => (match names - | List.nil => 0 - | List.cons name rest => (modelOf rest less))), + | Nat.succ less => (match names | List.nil => 0 | List.cons name rest => (modelOf rest less))), recursive_argument: count }