Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install the pinned Rust toolchain
run: rustup toolchain install
# CL-25 builds the executable for WASI with the pinned toolchain and runs
# it under the runner's Node (§8.3); the target is added here rather than
# in rust-toolchain.toml, which the export custody records byte for byte.
- name: Add the WASI target of the pinned toolchain
run: rustup target add wasm32-wasip1
- uses: taiki-e/install-action@b6b84cf49ebfe0176417bdce007c624f0db37f20 # v2.86.2
with:
tool: just,cargo-deny
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ workspace carried at those versions without a tag.

## Unreleased

- `lexlean check` builds and runs on `wasm32-wasip1`, #494 (SPEC.md §8.3,
`CL-25`). WASI has no threads, no file lock, and no processes: the check
pipeline runs on the instance's stack, a command that changes the project
is refused with `LLV7010` before it touches it, and the compiler-semantics
digest reads its files on the one thread. A file's identity there is the
device and inode WASI reports, read through `rustix`, so `LLC0104` still
refuses one file under two names; `fs4` and `same-file` are dependencies of
the other targets only. The executable is linked there with the 80 MiB
stack the depth plan assumes (`config::WASI_STACK_BYTES`, read by
`build.rs` and the plan alike), so deep input is `LLS8002` on WASI too, at a
hosted depth of 1,024. Native code is unchanged but
for the digest's reader, which reads on the calling thread when no thread
can be had. `CL-25` builds the target and compares it with the native
executable under Node's `node:wasi`; the register is 494.
- Breaking security update: replace the single Lean 4.32.1 pin with
`leanprover/lean4:v4.32.2`, source commit
`f3b06c705e6c85f5314019d5d3baab0fec5b580c` (SPEC.md §8.2). The
Expand Down
1 change: 1 addition & 0 deletions CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ the error registry does not sanction (R5, `ERRORS.md`).
| `CL-22` | `build` | A host that embeds the library ends every child process group the library started and has not seen exit through the public function `lexlean::verify::end_live_children`, which installs no signal handler, alters no signal disposition, never signals the host's own process or group, reports each group as ended, already gone, or failing with the OS error, and refuses a later child start with LLV7018 until the host re-enables it, and the `lexlean` executable ends its interrupted children through the same function. |
| `CL-23` | `build` | lexlean production targets prints the canonical target-descriptor document in either output mode, production build --request publishes the bundle its request names and reports the bundle and the project's source, semantic, build, and attestation IDs in its command result, production verify-artifact replays a bundle with no project, and each maps a malformed request, a refused request, and a rejected replay to the exact exit code of its registered class. |
| `CL-24` | `build` | lexlean migrate --to 1.2 migrates a language-1.1 data-form project to language 1.2 in one command: it rewrites every module to the authoring notation through lexlean::sdk::to_notation with the same declarations, names, statements, and axiom policies, moves the builtin glossary references of every source and the imports of every path lexicon package to 1.2.0, rewrites the language row, and regenerates the lock as lexlean/lock/2, so the result checks, has a current lock, and is canonical; --check proves the migration and writes nothing; and a project that is not language 1.1 is refused with LLC0103 and a module that is not a language-1.1 data-form semantic module, a data form that is not canonical JSON included, with LLP2003, each leaving every file of the project unchanged. |
| `CL-25` | `build` | The lexlean executable builds for wasm32-wasip1 with the pinned toolchain and, run by a WASI host, gives the native executable's exit code and JSON output for check on every single-step check fixture and every example; there a module with two names of one file is refused with LLC0104, nesting beyond the depth its linked stack hosts is refused with LLS8002, and a command that changes the project is refused with LLV7010 and leaves the project unchanged. |

## configuration-lock

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,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 496 registered conformance IDs have their named tests; `just vv` checks them with the pinned toolchain installed.
All 497 registered conformance IDs have their named tests; `just vv` checks them with the pinned toolchain installed.

The differential against the independent generator `lean4-prod` (SPEC.md §17.19, `OR-01`..`OR-08`) acquires it at its pinned commit: from the checkout `LEXLEAN_ORACLE_DIR` names, or by fetching the commit with `git` into the Cargo target directory (`LEXLEAN_ORACLE_CACHE` overrides), and builds it with the pinned Lean and Rust toolchains. It is validation evidence only and no input to any identity. An oracle that cannot be acquired, is not the pinned files, or fails is unavailable: that fails the gate on Linux x86-64 and is printed as `NOT VALIDATED` elsewhere, and is never reported as agreement.

Expand All @@ -188,7 +188,7 @@ Every row is validated by `just vv`; the IDs link the claim to its register row,
| Canonical LaTeX regeneration and the optional hash-checked PDF provider | `TX-01`..`TX-12` | `build` |
| Canonical diagnostics, source maps, coverage, manifests, and reproducible builds | `AR-01`..`AR-14` | `build` |
| Sixteen-stage verification with leanchecker replay and exact axiom audit | `VR-01`..`VR-23` | `build` |
| The exact CLI contract, the stable seven-method Rust `Engine` API, the host-driven end of the children the library started, the `production` subcommands, and the `migrate` command | `CL-01`..`CL-24` | `build` |
| The exact CLI contract, the stable seven-method Rust `Engine` API, the host-driven end of the children the library started, the `production` subcommands, the `migrate` command, and `check` on `wasm32-wasip1` | `CL-01`..`CL-25` | `build` |
| Filesystem confinement, no shell, no hidden network, closed failure model | `SE-01`..`SE-12` | `build` |
| Language-1.2 production eligibility: closed targets, effects, and construct dispositions; runtime closures; target-dependent, fail-closed root analysis; deterministic eligibility reports; an exhaustiveness audit; measured stack bounds for every recursive root a harness runs; the effect each host request realizes | `PD-01`..`PD-10` | `build` |
| Named-root extraction through Lean's compiler front end: an adapter that is a closed tooling module over a registry derived from the pinned Lean and probed on every extraction, checked against a handwritten oracle; a closed, canonical, root-independent compiler input; fail-closed rejection; and an exact closure cross-check against production eligibility | `NE-01`..`NE-06` | `build` |
Expand Down
11 changes: 7 additions & 4 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ On Windows x86-64 that same complete workspace test workload runs as lanes of on

Non-UTF-8 project paths are outside language 1.0 and produce a registered environment diagnostic.

The `lexlean` executable MUST also build for `wasm32-wasip1` with the pinned toolchain, so that `check` runs where a WASI host is the only host, such as a browser worker over a file system held in memory. Run by a WASI host, `check` MUST give the native executable's exit code and JSON output on the same project. WASI has no threads, no file lock, and no processes, and three things follow on that target alone. The check pipeline runs on the instance's one stack rather than on a thread, and the executable is linked with the stack `Limits::compile_stack_plan` plans on there, `lexlean::config::WASI_STACK_BYTES` (80 MiB, which hosts a depth of 1,024), so nesting beyond the configured or the hosted depth is `LLS8002` as on every host (§25.5). The host supplies the rest of the instance's call stack; Node 22's default is sufficient at the hosted depth, and a host whose call stack ends sooner stops the instance with a trap, which is never a verdict. An embedder that links the library into a module of its own links it with at least that stack. A command that changes the project is refused with `LLV7010` before it touches the project, since the exclusive lock of §21.8 cannot be taken; `check` takes no lock. `verify` starts no toolchain process. A file's identity (§25.1) is the device and inode WASI reports for it, so a host that gives one file two names is refused with `LLC0104` there as well. `CL-25` builds the executable for the target from the tree under test and runs it under Node's `node:wasi`, over the real file system, beside the native executable on every single-step `check` fixture of §28.2 that sets no toolchain, overlay, or environment, and on every example.

### 8.4 Cargo dependency rules

- Every dependency requirement MUST be explicit; wildcard requirements are forbidden.
Expand Down Expand Up @@ -606,9 +608,9 @@ Every dependency the shipped crate declares, for any target and of any kind but
| --- | --- |
| `camino` | UTF-8 path handling |
| `clap` | CLI parsing |
| `fs4` | file locking |
| `rustix` | process-group signalling (`kill` of a group, without an external `kill`; safe wrappers, the crate forbids unsafe code) |
| `same-file` | file identity |
| `fs4` | file locking (every target but WASI, which has no file lock; §8.3) |
| `rustix` | process-group signalling (`kill` of a group, without an external `kill`; safe wrappers, the crate forbids unsafe code), and file identity on WASI (the device and inode of `stat`; §8.3) |
| `same-file` | file identity (every target but WASI, where it refuses every path; §8.3) |
| `semver` | semantic-version parsing |
| `serde` | JSON and TOML deserialization and serialization |
| `serde_json` | JSON parsing and serialization |
Expand Down Expand Up @@ -11927,6 +11929,7 @@ Every row below is normative, has honesty level `build`, and MUST be copied byte
| `CL-22` | `cli-api` | A host that embeds the library ends every child process group the library started and has not seen exit through the public function `lexlean::verify::end_live_children`, which installs no signal handler, alters no signal disposition, never signals the host's own process or group, reports each group as ended, already gone, or failing with the OS error, and refuses a later child start with LLV7018 until the host re-enables it, and the `lexlean` executable ends its interrupted children through the same function. | §17.17, §24.6 |
| `CL-23` | `cli-api` | lexlean production targets prints the canonical target-descriptor document in either output mode, production build --request publishes the bundle its request names and reports the bundle and the project's source, semantic, build, and attestation IDs in its command result, production verify-artifact replays a bundle with no project, and each maps a malformed request, a refused request, and a rejected replay to the exact exit code of its registered class. | §24.7 |
| `CL-24` | `cli-api` | lexlean migrate --to 1.2 migrates a language-1.1 data-form project to language 1.2 in one command: it rewrites every module to the authoring notation through lexlean::sdk::to_notation with the same declarations, names, statements, and axiom policies, moves the builtin glossary references of every source and the imports of every path lexicon package to 1.2.0, rewrites the language row, and regenerates the lock as lexlean/lock/2, so the result checks, has a current lock, and is canonical; --check proves the migration and writes nothing; and a project that is not language 1.1 is refused with LLC0103 and a module that is not a language-1.1 data-form semantic module, a data form that is not canonical JSON included, with LLP2003, each leaving every file of the project unchanged. | §17.12, §23.4 |
| `CL-25` | `cli-api` | The lexlean executable builds for wasm32-wasip1 with the pinned toolchain and, run by a WASI host, gives the native executable's exit code and JSON output for check on every single-step check fixture and every example; there a module with two names of one file is refused with LLC0104, nesting beyond the depth its linked stack hosts is refused with LLS8002, and a command that changes the project is refused with LLV7010 and leaves the project unchanged. | §8.3, §21.8, §25.1 |
| `SE-01` | `security` | Source, package, workspace, resource, and output paths are confined and symlinks are rejected. | §25.1 |
| `SE-02` | `security` | Special files, duplicate filesystem identities, and case-fold collisions are rejected before processing. | §25.1 |
| `SE-03` | `security` | All child processes use direct executable and argv invocation with no shell. | §25.2 |
Expand Down Expand Up @@ -12175,7 +12178,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:** 496.
**Total required capability IDs:** 497.

No row may be downgraded to `some-true` or `open`. Upstream Lean facts are ledger/authority rows, not substitutions for these build behaviors.

Expand Down
36 changes: 36 additions & 0 deletions VERIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,42 @@ 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
```

### check on WASI can trap, merge two names of a file, or differ (CL-25)

`CL-25` holds `lexlean check` on `wasm32-wasip1` (§8.3). `conformance_cl_25`
builds the executable for the target in the release profile, runs it under
Node's `node:wasi` over the real file system, and compares it with
`lexlean::cli::run`. It covers every single-step `check` fixture with no
toolchain, overlay or environment of its own, and every example: 277 projects
on the first run, each with the same exit code and byte-identical stdout and
stderr. A hard-linked module is `LLC0104` on both builds. `fmt` on WASI exits 3
with `LLV7010` and leaves the project as it was. With `max_scope_depth =
100000000`, nesting 1,000 is identical on both, and nesting 1,040 is `LLS8002`
(exit 4) on WASI, where the linked 80 MiB stack hosts 1,024. The case ran in
435 s, the module build excluded, on a shared Linux x86-64 host.

Planted defect: `build.rs` without the line that links the executable with
`WASI_STACK_BYTES`, so it gets Rust's default 1 MiB stack. `cargo test -p
repo-conformance --all-features --test conformance conformance_cl_25` still
agreed on all 277 projects, then failed in 393 s at the depth vector:

```text
assertion `left == right` failed: CL-25: nesting 1000 on WASI
left: (1, "", "... RuntimeError: memory access out of bounds
at ...lexlean7grammar4mathNtB2_7MathAst5atoms ...
```

With the line restored, the case passes. Before the stack was linked, the
same depth was measured directly: on WASI, nesting 512 checked and nesting 1,024
trapped when the project allowed it, while natively both checked. This is the
trap the depth vector exists to catch.

Node 22 collects garbage inside its fast call of WASI `path_filestat_get`
and dies with SIGSEGV on a language-1.2 project. The backtrace runs from
`uvwasi_path_filestat_get` through `MallocImpl` to `Heap::CollectGarbage`. The
case runs Node with `--no-turbo-fast-api-calls`, under which every project
checks.

### a declaration ID can miss a reference or keep a proof (SM-38)

`SM-38` holds the declaration and statement IDs of §21.9. `conformance_sm_38`
Expand Down
1 change: 1 addition & 0 deletions crates/conformance/src/cases/cli_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ pub(crate) fn run(id: &str) {
}
"CL-23" => super::production_export::cli(),
"CL-24" => super::migration::cli(),
"CL-25" => super::wasi::cli(),
other => panic!("no cli-api case is wired for {other}"),
}
}
1 change: 1 addition & 0 deletions crates/conformance/src/cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ mod stdlib_sha256;
mod tooling;
mod typed_diagnostics;
mod verification;
mod wasi;

/// The wall time of one case, written to the CI evidence directory when the
/// environment names one (SPEC.md §22.12) and nowhere else. It is written when
Expand Down
2 changes: 1 addition & 1 deletion crates/conformance/src/cases/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,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(), 496, "§31 has 496 rows");
assert_eq!(table.len(), 497, "§31 has 497 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())
Expand Down
Loading
Loading