From 904c1afc0cfae114a1fdae2c002906ca5dae9d13 Mon Sep 17 00:00:00 2001 From: Alex Flom Date: Thu, 22 Oct 2026 12:21:05 -0600 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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"