agent-formal-verify 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +150 -0
- package/README.md +5 -3
- package/package.json +2 -1
- package/skills/formal-verify/SKILL.md +17 -19
- package/skills/formal-verify/examples/kani-template/src/lib.rs +5 -6
- package/skills/formal-verify/examples/lean-template/Model/BoundedQueue.statements +10 -45
- package/skills/formal-verify/examples/tla-template/BoundedQueue.matrix +16 -13
- package/skills/formal-verify/examples/tla-template/BoundedQueue.mutations +92 -14
- package/skills/formal-verify/examples/tla-template/BoundedQueue.tla +169 -28
- package/skills/formal-verify/references/evidence.md +1 -1
- package/skills/formal-verify/references/helpers.md +33 -3
- package/skills/formal-verify/references/lean-brief.md +2 -2
- package/skills/formal-verify/references/rust-brief.md +58 -6
- package/skills/formal-verify/references/setup.md +23 -7
- package/skills/formal-verify/references/tla-brief.md +3 -3
- package/skills/formal-verify/scripts/baseline.py +290 -261
- package/skills/formal-verify/scripts/kani-check.sh +3 -1
- package/skills/formal-verify/scripts/kani.py +127 -59
- package/skills/formal-verify/scripts/kani_reader.py +592 -0
- package/skills/formal-verify/scripts/lean-analysis.lean +387 -0
- package/skills/formal-verify/scripts/lean-check.sh +6 -243
- package/skills/formal-verify/scripts/lean.py +484 -0
- package/skills/formal-verify/scripts/lean_mutations.py +195 -0
- package/skills/formal-verify/scripts/lean_records.py +25 -0
- package/skills/formal-verify/scripts/mutate.py +81 -195
- package/skills/formal-verify/scripts/processes.py +266 -0
- package/skills/formal-verify/scripts/python-tools.sh +15 -0
- package/skills/formal-verify/scripts/runner.py +56 -0
- package/skills/formal-verify/scripts/rust_source.py +74 -0
- package/skills/formal-verify/scripts/setup.sh +18 -19
- package/skills/formal-verify/scripts/storage.py +207 -0
- package/skills/formal-verify/scripts/surface.py +27 -0
- package/skills/formal-verify/scripts/sync.py +401 -0
- package/skills/formal-verify/scripts/tlc-matrix.sh +3 -1
- package/skills/formal-verify/scripts/tlc.py +501 -117
- package/skills/formal-verify/scripts/tlc_report.py +516 -0
- package/skills/formal-verify/scripts/tlc_trace.py +167 -0
- package/skills/setup/SKILL.md +1 -1
- package/skills/formal-verify/scripts/lean-mutations.lean +0 -95
- package/skills/formal-verify/scripts/lean-statements.py +0 -161
- package/skills/formal-verify/scripts/lean-tools.sh +0 -24
- package/skills/formal-verify/scripts/tlc-tools.sh +0 -47
- package/skills/formal-verify/scripts/tlc-trace.py +0 -64
package/CHANGES.md
CHANGED
|
@@ -1,7 +1,157 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 0.4.14 - an HTML report of TLC runs, and Kani baselines that say what they did not read or check
|
|
4
|
+
|
|
5
|
+
`scripts/tlc-matrix.sh` writes a self-contained HTML report when `TLC_HTML_REPORT` names a path. The report has a table of the runs and, for each failing or `reach` witness trace, a state chain to step through, the variables each step changed, and the trace as Mermaid `stateDiagram-v2` source to copy. It loads nothing over the network. The matrix runner checks the path after Java and TLC and before the first run, and replaces the file in one step. A written report leaves the printed lines and the exit status as they are without a report. A path where the report cannot be written prints an `UNAVAILABLE TLC_HTML_REPORT=...` line and exits with status 3. If the write fails after the runs, the runner prints that line and exits with status 1 when a run failed and 3 otherwise. `scripts/tlc_report.py` builds the report from the traces that `scripts/tlc_trace.py` now parses. The Mermaid labels keep the trace's TLA+ text: each character that Mermaid reads as syntax, such as `{`, `:` or `"`, is written as a Mermaid entity code, such as `#123;`, which Mermaid draws as that character. So are the space in words that Mermaid reads anywhere on a line, such as `direction LR`, and the first bracket of `[[fork]]`, `[[join]]` or `[[choice]]`, and a U+FEFF, which Mermaid reads as whitespace, so a state, transition or lasso label that holds them is kept. The last step of a liveness counter-example that ends in stuttering, which TLC prints as `State N: Stuttering` with no variables, lists the variables of the state it repeats. A matrix file name that is not valid UTF-8 shows U+FFFD in the report in place of the bytes that cannot be decoded. The table row of a failing run with a trace shows, beside the link to the trace, the lines that the matrix runner prints under the run.
|
|
6
|
+
|
|
7
|
+
`scripts/baseline.py move --module` now prints `FAIL baseline: cannot rename the recorded item '<item>', which is not a Kani harness, assume, cover or stub` and exits 1 when a recorded Kani entry holds such an item, such as one added to the record file by hand, and it leaves the record file as it was. Before this change, it printed a Python traceback.
|
|
8
|
+
|
|
9
|
+
`scripts/baseline.py` now records a Kani harness's `#[kani::should_panic]` and `#[kani::unwind(<n>)]` attributes, written alone or as any argument of `#[cfg_attr(kani, ...)]`, in the harness's value after its `cfg` guards, such as `kani::unwind(2)`, so adding, removing or changing either prints `CHANGED`. Any other form of either, such as one under `#[cfg_attr(all(kani, test), ...)]` or one that `use kani::unwind;` brings in, fails the record. The record leaves out either attribute on a function that is not a harness, which Kani refuses to compile. Before this change, the record did not read them, so adding `#[kani::should_panic]` to a harness, which then passes only when it panics, or lowering its `unwind` bound printed `UNCHANGED`. A harness without either attribute keeps its recorded value. A record that holds a harness with either attribute prints `CHANGED` once, with the attribute under `new:`; record the file again. The Rust brief puts `#[kani::unwind(N)]` on every harness, so this applies to most recorded harness files.
|
|
10
|
+
|
|
11
|
+
`scripts/baseline.py` now notes each route in a Kani harness file's crates that it cannot read, in the value of every harness in the file, as `unread(<file>: <route>; ...)` with the file relative to the harness file's directory, and `record` prints `route not read: <reason>` for each, with the file and, except for a file that fails to parse, the line. Such a route is a `mod <name>;` or an `include!` inside a macro, such as `cfg_if!`, including a `mod $name;` that a macro builds, or inside a block, such as a function body or `const _: () = { ... }`. It is also a `mod` declaration whose `#[path]` the record cannot read, an `include!` whose path it cannot read, or a file on the way that fails to parse. The record cannot tell where such a route leads, so it notes each one for every harness file in the crate, even when a route that it reads also reaches the file, and adding or removing one prints `CHANGED`. It still does not follow such a route or record its guards, so a guard changed on it prints no `CHANGED` line. `SKILL.md` and `references/evidence.md` now limit the `cfg` guards that `compare` covers to the routes that the record reads. Before this change, the record left such a route out without a word when another route reached the file. A harness file in a crate without such a route keeps its recorded value. A record that holds a harness file in a crate with one prints `CHANGED` once, with the note under `new:`; record the file again. So does a harness moved with `move` into a production file whose crate has one, and `references/helpers.md` now accepts such a move.
|
|
12
|
+
|
|
13
|
+
`scripts/baseline.py compare` now prints `NOT CHECKED <file>` for a Kani harness file in a Cargo package that `record` could not check against Kani, such as when Kani was missing or the package did not compile, when none of the file's recorded parts changed. The line under it says that `compare` cannot tell a harness that stopped compiling from one that never compiled. When Kani runs at `compare`, a `not compiled now harness <name>` line follows for each recorded harness that Kani does not compile, such as one that a dropped default feature switched off, or one behind a feature that is not a default, which never compiles. When Kani cannot run at `compare` either, a line gives the reason. Such a file does not count as a change, so `compare` exits 0 when no file prints `CHANGED`, and the `SUMMARY` line ends with `, <k> not checked`. A changed part, or a harness that Kani compiles under a name that no route the record reads gives, still prints `CHANGED`. A file that `record` did check against Kani still prints `CHANGED` with a `FAIL` line when Kani cannot run at `compare`. When `move` merges an entry recorded without Kani with one recorded with it, the merged entry now keeps the second entry's list of compiled harnesses, marked `"partial": true`, so `compare` prints `not compiled harness <name>` when one of them stops compiling. Before, `move` dropped that list. Step 3 of the skill now says to report a `NOT CHECKED` file as not checked against Kani. Before this change, `compare` printed `CHANGED` for such a file every time, so it could exit 0 only after a fresh `record`, which would accept the agents' edits as the baseline. A record made with 0.4.12, which holds no Kani list for any harness file, now prints `NOT CHECKED` for each harness file in a Cargo package whose parts are unchanged.
|
|
14
|
+
|
|
15
|
+
`scripts/baseline.py` now names the line where a `mod` item starts when it cannot read the item's `#[path]`, in the `route not read:` line that `record` prints and in the message of a `record` that no readable route reaches. Before this change, it named an earlier line: the one where the previous item or the enclosing `{` ends, or line 1 for the first item in a file, also after inner attributes such as `#![allow(dead_code)]`.
|
|
16
|
+
|
|
17
|
+
## 0.4.13 - baseline routes checked against the harnesses Kani compiles
|
|
18
|
+
|
|
19
|
+
`scripts/baseline.py` reads a route to a Kani harness file only through `mod` declarations, `#[path]` attributes and `include!` items outside macros and function bodies. It does not guess from source text whether a macro, an attribute macro or an `include!` that it cannot read builds another route. The check against the harnesses that Kani compiles covers such a route, so `#[path = "proofs.rs"] mod readable;` beside `cfg_if::cfg_if! { if #[cfg(kani)] { mod proofs; } }` fails `record` with the name that Kani gives the harness on the route inside the macro, such as `proofs::a`. When Kani cannot run at `record`, `compare` makes the check. A route inside a function body, an inline module in one included, and one through a `const _` block, are routes that the record does not read. A harness file outside any Cargo package gets no such check.
|
|
20
|
+
|
|
21
|
+
`scripts/baseline.py` now asks Kani which harnesses it compiles from a recorded Kani harness file, through the Rust checker's discovery. A harness that Kani compiles under a module path that no route the record reads gives, such as through a module that a macro declares, fails `record` and `compare` with the name Kani gives it. `record` stores the recorded harnesses that Kani compiles, and `move` carries them to the new file. `compare` prints `not compiled harness <name>` for one that Kani no longer compiles, including one that a change outside the source switches off, such as a default feature removed from `Cargo.toml`. `compare` needs Kani for a harness file inside a Cargo package; `record` notes when it cannot ask, and `compare` then prints `not checked against Kani at record` for the file, because it cannot see a harness that stopped compiling on a route that the record does not read. A record made with 0.4.12 prints that line for each Kani harness file; record the file again.
|
|
22
|
+
|
|
23
|
+
`scripts/sync.py`'s fallback now reads each parent of a rename made in a merge under that parent's own old path, and says in a `SYNC none` line when it could not. When the merge's parents hold the source under different old paths, such as a branch that renamed the file again before the merge, each old path gets a walk of its own into the parents that hold it. The walks are read together, newest commit first, as one `git log` reads them, so the sync commit is the latest commit that any of them finds, and a commit that two walks reach under the same paths counts once toward the limit of 100 commits. When git finds the rename against some parents only, such as when the branch grew the file below git's 50% rename similarity, the walk reads the other parents under the old path of the first parent with one. When such a parent does not hold that path, the line adds `it read the parent <parent> of the merge <commit> under <old path>, which that parent does not hold, since git finds no rename to <path> against it`. When git finds no rename to the source against any parent, such as when the merge's resolution grew the file below git's 50% rename similarity, the walk stops following that source, reads on for any other source, and the line adds `it stopped following <path> at the merge <commit>, since none of its parents has <path> and git finds no rename to it`. A source that a merge does not hold, such as one added after it, no longer counts as one that the merge renamed. Before this change, the walk read every parent under the first parent's old path, so it missed a harness commit made under the branch's own old path and did not say when a parent lacked the path it read.
|
|
24
|
+
|
|
25
|
+
`scripts/sync.py`'s fallback now follows a rename made in a merge commit, such as a `git mv` before committing a merge, back into each of the merge's parents, so it finds a harness commit made under the old name on the merged branch or on the first parent. It follows a source that is in none of the merge's parents into each parent, under the old path that `git diff-tree -M` finds against that parent, and still never counts the merge itself. The `PATH` and `READ` lines now include a path that a merge renamed, so the `READ` range shows a production change made under the old name before the merge. Before this change, `git diff-tree` printed nothing for the merge, so the walk followed no rename and printed a `SYNC none` line that did not say it had stopped at one.
|
|
26
|
+
|
|
27
|
+
`scripts/sync.py` now adds `it did not follow the rename of <old path> in <commit> into a branch merged after it` to a `SYNC none` line for each rename that the fallback walked back through when a branch merged after the rename has a commit of the old path. The walk follows a rename along the renaming commit's parent only, so it misses a harness commit made under the old name on a branch merged after the rename. Before this change, `SYNC none` said only that no commit qualified, which was wrong when such a branch held one.
|
|
28
|
+
|
|
29
|
+
`scripts/baseline.py` now follows an `include!` whose path is a `concat!` of strings and `env!("CARGO_MANIFEST_DIR")`, such as `include!(concat!(env!("CARGO_MANIFEST_DIR"), "/sub/items.rs"))`, and takes `env!("CARGO_MANIFEST_DIR")` to be the directory of the nearest `Cargo.toml` above the crate root that reaches the including file, as Cargo sets it. With no `Cargo.toml` there, such an `include!` is not followed. Before this change, a `cfg` added to such an `include!` switched off one copy of the harnesses that the included file declares while `compare` printed `UNCHANGED`. A record that holds a harness file reached through such an `include!` prints `CHANGED` once; record the file again.
|
|
30
|
+
|
|
31
|
+
`scripts/baseline.py` now follows an `include!("...")` item outside function bodies to the file it names, so a `cfg` on the `include!`, or on the modules around it, is a guard on the routes through the `mod` declarations in that file. As rustc does, those declarations load from the included file's own directory. Before this change, the record did not see that route, so `#[cfg(feature = "slow")]` added to `include!("sub/items.rs");` switched off one copy of the harnesses while `compare` printed `UNCHANGED`. A record that holds a harness file reached through `include!` prints `CHANGED` once; record the file again. It does not follow an `include!` inside a macro or function body, or one whose path it cannot read, such as one under `env!("OUT_DIR")`.
|
|
32
|
+
|
|
33
|
+
`scripts/baseline.py` now records each route that leads to a Kani harness file from a crate root, with the crate root's path relative to the harness file's directory and the route's guards, such as `routes(lib.rs: unguarded; main.rs: cfg(feature = "slow"))`, so removing, adding or guarding any route, or moving a guard from one route to another, prints `CHANGED`. A crate root counts as a route without a guard, unless it is a `lib.rs` or `main.rs` that Cargo does not name and that another file declares, such as `src/a/main.rs` under `mod main;`. Before this change, the record joined the guards of every route into one string, so deleting `mod proofs;` from `src/lib.rs` while `src/main.rs` kept `#[cfg(feature = "slow")] mod proofs;` printed `UNCHANGED`, though the harnesses then compiled only with the `slow` feature. A harness file that is itself a crate root and that another root also declares, such as a `src/lib.rs` that `src/main.rs` loads with `#[path = "lib.rs"] mod lib;`, now records both routes; before, it recorded no guard. A file with one route keeps its recorded value. A record that holds a file with several routes prints `CHANGED` once; record the file again. A new route, such as a `tests/*.rs` file that declares `mod common;`, also prints `CHANGED` for the harnesses in `common`.
|
|
34
|
+
|
|
35
|
+
`scripts/baseline.py` now follows a Kani harness file's `mod` declarations from the crate roots, as rustc does, so it records the `cfg` guards on a declaration that `#[path = "..."]` points at the file and on one in a crate root other than `lib.rs` or `main.rs`. The crate roots of a Cargo package include `src/bin/`, `tests/`, `examples/` and `benches/` files and the `.rs` paths that `Cargo.toml` names, such as `[lib] path`. A `#[cfg_attr(<condition>, path = "...")]` on a module is now a guard, so a record that holds one prints `CHANGED` once, with the attribute under `new:`; record the file again. Before this change, the reader looked only where Rust's default module layout puts a declaration, so adding `#[cfg(feature = "slow")]` to `#[path = "checks.rs"] mod proofs;` switched off the harnesses in `checks.rs` while `compare` printed `UNCHANGED`. A harness file that no route the record reads reaches, other than a crate root, now fails the record, such as one that only a `mod` declaration inside a macro such as `cfg_if!`, or in a function body, declares. Before, the record took such a file to have no declaration guards.
|
|
36
|
+
|
|
37
|
+
`scripts/baseline.py` no longer records a `cfg(...)` inside another attribute as a guard on a Kani harness. A `cfg_attr` counts when its own attribute list, or that of a `cfg_attr` nested in it, applies `cfg(...)`. Before this change, `#[cfg_attr(docsrs, doc(cfg(feature = "x")))]`, which only labels the documentation, was recorded, so editing it printed `CHANGED`. So were the `cfg(z)` inside an attribute such as `#[my(#[cfg(z)] q)]` and a `cfg_attr` whose condition string held `,cfg(`. A record that holds such a guard prints `CHANGED` once, with the guard under `old:`; record the file again.
|
|
38
|
+
|
|
39
|
+
A `SIGINT` that reaches `setup.sh tla`, `setup.sh rust` or `setup.sh lean` while its readiness check is still importing Python modules now ends the check by the signal with nothing on stderr. `tlc.py`, `kani.py`, `lean.py` and `mutate.py` restore the default `SIGINT` action before their other imports, when run as a script, until `runner.run` installs its handlers. Before this change, such a `SIGINT` printed a `KeyboardInterrupt` traceback.
|
|
40
|
+
|
|
41
|
+
`setup.sh tla` now prints `usage: setup.sh tla` and exits 2 when it gets an argument after `tla`, as `setup.sh rust` and `setup.sh storage` do for theirs. Before this change, it ignored the argument and ran the readiness check.
|
|
42
|
+
|
|
43
|
+
`scripts/sync.py` now adds to its `PATH` and `READ` lines each file where a commit since the sync added or removed a covered name as a whole word. It finds those commits with `git log -S` and applies the same rules as its name search. Before this change, a file that held the covered code between the sync and `HEAD`, such as one it moved through, was in neither set, and the `READ` command left out the commits made to the code while it lived there. A file renamed away without a content change counts too, and a changed path with a glob character such as `[id]` matches only itself. The helper still misses a path that held the code only under another name, or a path where each commit since the sync kept the number of times the name appears, such as one that replaced a mention of the name with its definition, and the skill and the helper reference now say so instead of claiming every path.
|
|
44
|
+
|
|
45
|
+
`scripts/sync.py` now prints a `MISSING` line for a covered name that only documents and other models still mention. Its name search leaves out documents, such as `.md`, `.txt` and `.tex` files and `README`, `CHANGELOG` or `CODEOWNERS` with no extension, and TLA+ and Lean model files, such as `.tla`, `.cfg`, `.lean` and `.mutations`, unless a source path has the same extension. Other files with no extension, such as a `Makefile`, and data files, such as `.json`, `.yml`, `.html` or `.ipynb` files, stay in the `PATH` and `READ` lines, but a name found only in them is `MISSING`. Before this change, a doc or another model that still named a deleted function counted as finding it, so the helper printed no `MISSING` line for the function and added that file to its `PATH` and `READ` lines.
|
|
46
|
+
|
|
47
|
+
`scripts/sync.py` no longer takes a production edit as the sync commit of a Kani harness that lives in the production file. When the model's header has no usable `Source read at` line and a model file is also a `--source`, the fallback is now the last commit that changed the code of that file's `#[cfg(kani)]` items and none of its other code, whether or not it changed another model file too, and `SYNC none` when there is no such commit. Comments and blank lines do not count as code, and a `#[cfg(kani)]` on a field or an enum variant does not mark a harness. The search reads the last 100 commits of the model files, following the source back through its renames, and its `SYNC none` line says when it reached that limit. Before this change, the fallback was the last commit of the model files, so each production edit moved it forward and the `READ` command left out the production changes that the harness had not been synced with.
|
|
48
|
+
|
|
49
|
+
The TLA+ template now models what the TLA+ brief asks for. Worker threads claim items under a mutex, build them without it and publish them. The consumer's `next()` waits on a condition variable that admits spurious wakeups, and its `close()` wakes every waiter, joins the workers and frees the items never taken. A build fails for each item in `FailAt`. The template checks item ownership, delivery order, error ordering, no delivery after an error and no leak at close. It also checks that `next()` and `close()` return, and that a consumer that keeps calling `next()` reaches the end or the error. Each action names the variable groups it leaves unchanged, as the brief's "Keep the spec small" section asks. Its matrix covers windows of 1, 2 and 4, 0, 1, 3 and 5 items, and one to three workers. It has reach checks for a full window, a parked worker, a parked consumer and a failure, and its header lists its assumptions. Before this change, the template modelled only the window counters, the same arithmetic that the Lean template proves. The template's matrix explores 50,021 states, and its 14 mutations, which include a `while` written as an `if` and each of the three broadcasts removed, carry `only` lines that keep each one to the runs that show its bug.
|
|
50
|
+
|
|
51
|
+
`scripts/sync.py` now prints a `MISSING` line for a covered name that Rust files mention only in comments and strings. Such a file stays in the `PATH` and `READ` lines. Before this change, a comment such as `// drain empties the queue` in `src/log.rs` counted as finding `drain` after its definition was deleted. In other languages, such as C, JavaScript or Python, a comment or a string still counts, because their comments and strings differ from Rust's.
|
|
52
|
+
|
|
53
|
+
Added `scripts/sync.py`, which lists what changed in the code an existing model covers since the model was last synced. It prints the sync commit from the header's `Source read at` line or the model files' last commit, every path the covered code has had since then through renames and moves, each covered name that no longer exists with the commits that removed it, and the `git log -p` command that shows every commit to read. Step 1 of the skill now runs it, where it listed the `git` commands to run by hand.
|
|
54
|
+
|
|
55
|
+
The skill and the Rust brief now ask for one Kani harness layout: a `#[cfg(kani)] mod proofs` at the end of the production file that defines the function, with the `.mutations` file beside it, as the Kani template has it. Before this change, the skill and the brief's file list asked for the harness in a separate crate, while the template and the brief's mutation section put it in the production file. The mutation runner changes only the file beside the mutations file, so a harness in a separate crate leaves no way to write a mutation of the production code. The skill now gives one agent every Rust target in one production file, so parallel agents still share no file. Before any agent starts, the main thread declares `cfg(kani)` in the crate's `Cargo.toml`, as the template does, so the harness module adds no compiler warning to the user's builds. The template's header comment now sits directly above its `proofs` module, where a production file can hold it.
|
|
56
|
+
|
|
57
|
+
A Kani harness that an earlier run wrote in a crate of its own now moves into the production file that defines the functions it calls, with its `.mutations` file, unless it copies a production function or calls functions from several files. The Rust brief's new "Moving a harness" section says how: the harnesses move unchanged into `mod proofs` under a `use crate as <name>;` line that keeps each path to the production crate, such as `prod::seed` in a stub, as it was, each `detects` names the new qualified harness name, and each mutation edits the production function instead of the harness. Before this change, such a harness kept its layout, so its mutations could edit only the harness, and the skill gave no way to move it. The agent leaves the old crate in place, so the workspace still builds while it checks the production crate, and the main thread deletes the old harness file, and its crate, workspace entry and CI steps once they hold nothing else, before it reruns the checks. Such a harness gets an agent even when it passes. `baseline.py` has a new `move` command for the main thread: `baseline.py move <record-file> <old file> <production file>` makes `compare` check the old file's recorded harnesses, assumptions, covers and stubs against the production file, and `--module crate proofs` renames harnesses that sat at the old crate's root, such as `first`, to `proofs::first`. It reads only the record, so a move that also adds an assumption or drops a harness still prints CHANGED with that item. The main thread accepts a move only when `git diff` shows the harness lines with nothing but their indentation changed. Before this change, `compare` reported only that the old file was missing and never read the production file.
|
|
58
|
+
|
|
59
|
+
The TLC pin and its readiness check moved from `scripts/tlc-tools.sh` to `scripts/tlc.py`, as Kani's live in `scripts/kani.py`. `setup.sh tla` now runs `python3 tlc.py ready`, and the matrix and mutation runners check TLC in their own process instead of through a `bash` shell that sources `tlc-tools.sh`, which is removed. `setup.sh tla` now also rejects a malformed `TLC_TIMEOUT` with `UNAVAILABLE` and exit 3, as the matrix and mutation runners do. It also reports a `JAVA` that cannot be executed, such as a script without a `#!` line, as having no runtime. Before this change it printed `READY` for both, and the runners then failed. An unreadable cached JAR is now reported as `cannot read <path>`, and a missing Python 3.9 is reported before a missing Java. The other readiness messages and exit codes are unchanged. Python now computes the cached JAR's SHA256, so `sha256sum` or `shasum` is no longer a prerequisite.
|
|
60
|
+
|
|
61
|
+
`setup.sh tla` and `setup.sh rust` now stop their readiness check on a `SIGINT`, `SIGTERM` or `SIGHUP` sent to the `setup.sh` process alone, as a supervisor can send it. A signal that arrives while the check runs its probes stops them, prints no `READY` and ends `setup.sh` by the signal. One that arrives during the storage report, after `READY`, ends `setup.sh` by the signal before the `TEMP_DIR` lines. Before this change, `setup.sh` held the signal while the check ran: after a `SIGINT` it went on to print `READY` and exit 0, and after a `SIGTERM` it ended at once while the check and its probe kept running and printed `READY` later. `setup.sh` now hands its process to the Python check, which prints the storage report itself, so `tlc.py ready` and `kani.py ready` now print the `TEMP_DIR` lines too. Run on their own, they now also print `FAIL` and exit 1 after `READY` when `TMPDIR` cannot be used, as `setup.sh` already did. The output and exit codes of `setup.sh tla` and `setup.sh rust` are otherwise unchanged.
|
|
62
|
+
|
|
63
|
+
The Lean checker and the Lean mutation runner no longer download a toolchain that is not installed. `elan run` installs a missing toolchain even without its install flag, so they now look for the pin in `elan toolchain list` first, under the name elan gives it, and print `UNAVAILABLE <pin> is not ready` with the `setup.sh lean` command when it is not there. A `lean-toolchain` that names the channel `stable`, `beta` or `nightly`, or a repository's `lean-toolchain` release name, now fails in the checker and in `setup.sh lean`, because elan resolves it to a release online. A pin that is an absolute path to a toolchain directory is ready when the directory exists. Before this change, `lean-check.sh` on a project pinned to a toolchain the machine lacked downloaded it, though `references/setup.md` said it reported UNAVAILABLE.
|
|
64
|
+
|
|
65
|
+
The Lean pin lookup and readiness check moved from `scripts/lean-tools.sh` to `scripts/lean.py`, as TLC's live in `scripts/tlc.py` and Kani's in `scripts/kani.py`. `setup.sh lean` now runs `lean.py ready`, which installs a missing toolchain as before and prints the storage report. Like `setup.sh tla` and `setup.sh rust`, `setup.sh lean` now stops its readiness check on a signal sent to the `setup.sh` process alone. The Lean checker's steps also run in `lean.py`, and `lean-check.sh` only checks for Python and starts it. The mutation runner checks the original Lean model in its own process instead of starting `lean-check.sh`. `lean-tools.sh`, `lean-statements.py` and `lean-layout.py` are removed; `lean.py` records and compares frozen statements, and reads Lake's search path with `lake env printenv LEAN_PATH`. `setup.sh lean` now needs Python 3.9 or later as `python3`, as `lean-check.sh` already did. Before this change, with an older `python3` it printed `READY` and then failed on the storage report. `lean-check.sh` reports an explicit `TMPDIR` that cannot be created or written with the message the other runners print. It now checks for Python 3.9 before its arguments and the project, so with an older `python3` it prints `UNAVAILABLE` and exits 3 where it reported a missing lakefile or a misplaced `--freeze` first. A project path that is a symbolic link to a directory is now checked; before this change the checker found no `.lean` file in it. The checker sorts a project's sources by code point rather than by the shell's locale, so the build and audit order no longer depends on the locale. A `lean-toolchain` file that cannot be read now gives `FAIL cannot read <path>` and exit 1 from both; before this change, they printed the shell's error and an empty line. The other output and exit codes of `setup.sh lean` and `lean-check.sh` are unchanged.
|
|
66
|
+
|
|
67
|
+
A frozen Lean record now keeps which match helper sits at each place in a declaration's type and value, and in each hygienic constant that the record carries. A record names every match helper alike and lists each helper's content once, so before this change a statement that used helpers A, B and A and an edited one that used A, B and B had the same record. An edit that moved a helper, such as one that changed the shape of a `local notation`'s `match`, could then change a frozen theorem's statement or a frozen definition's value and still pass the frozen check. A record frozen before this change reports each declaration whose type or value uses a `match`, itself or through a hygienic constant that the record carries, as changed, including instances that `deriving DecidableEq` adds; review them and run `--freeze` again. Other records are unchanged. The Lean template's record is frozen again, and the mutation runner compares statements in the same form.
|
|
68
|
+
|
|
69
|
+
A frozen Lean record now also keeps which of two universe parameters that look alike in it sits at each place in a declaration's type and value. A record writes a universe parameter's name without its macro scopes, so a macro-made `u` and the user's own `u` in one declaration look alike. Before this change, an edit that swapped them, such as `(α : Sort $v) (β : Sort (u + 1))` changed to `(α : Sort u) (β : Sort ($v + 1))` in a macro, changed which arguments the declaration takes and still passed the frozen check. A record frozen before this change reports each declaration with two such parameters as changed; review them and run `--freeze` again. Other records are unchanged, the Lean template's among them. The mutation runner compares statements in the same form.
|
|
70
|
+
|
|
71
|
+
A frozen Lean record now also keeps which of two constants that look alike in it sits at each place in a declaration's type and value. A record writes a hygienic name without its macro scopes, so two definitions of `a` that macros make, or one that a macro makes and the user's own `a`, look alike. So do the private helpers that `deriving` makes on Lean 4.20 for mutual types whose last name components match, such as `A.T` and `B.T`. Before this change, an edit that put one in place of the other in a frozen definition, such as a macro's `$x + a + $x` changed to `$x + a + a`, changed the definition's value and still passed the frozen check. A record frozen before this change reports each declaration whose type or value uses two such constants, itself or through a hygienic constant that the record carries, as changed; review them and run `--freeze` again. Other records are unchanged, the Lean template's among them. The mutation runner compares statements in the same form, so a mutation that makes the same swap in a theorem's statement now reads as a changed statement and gets no verdict. Before this change, the theorem's failing proof counted it as detected.
|
|
72
|
+
|
|
73
|
+
The mutation runner now checks a TLA+ model's unmutated spec on every run that its mutations select before it applies the first mutation, as it already did for Lean and Rust models. A model that fails one of those runs stops the runner with `FAIL unmutated model did not pass <Property>` and no verdict lines. Before this change, the runner checked each run the first time a mutation selected it, so it reported a broken model partway through the list, as the error of whichever mutation reached the run first, after earlier mutations had printed their verdicts. A mutation whose `only` line matches no run, or whose reach check has no run, now stops the runner with that mutation's label before TLC checks any run.
|
|
74
|
+
|
|
75
|
+
The TLC matrix runner now handles `SIGINT`, `SIGTERM` and `SIGHUP` while it checks that TLC is ready, as it does during a run, and ends by the signal. Before this change, a Ctrl-C during that check printed a Python traceback.
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
The Lean mutation runner now reads the output of its Lean analysis as UTF-8, and `mutate.py` writes its output as UTF-8, as the Lean checker does, so a run under a locale whose encoding is not UTF-8 prints the same verdicts and messages. Before this change, under `LC_ALL=C` with Python's UTF-8 mode off, every Lean mutation run stopped with an `'ascii' codec can't decode` error.
|
|
79
|
+
|
|
80
|
+
The Lean mutation runner now compares a theorem's, example's or `#guard`'s statement in the form the frozen record uses: match helpers by their content, together with the helper at each place in the statement, hygienic names and universe levels without their numbers, and no binder names. Before this change, it compared Lean's raw types, so a mutation that changed which match helper an unchanged statement shared, such as one that changed the shape of an earlier definition's `match`, read as a changed statement and gave the mutation no verdict, while the frozen record showed the statement unchanged. The Lean checker's audit and the mutation runner's analysis are now one program, `scripts/lean-analysis.lean`, instead of a Lean file that `lean-check.sh` wrote out on each run and a separate `lean-mutations.lean`. Frozen records and the output of a passing `lean-check.sh` run are unchanged. A failed import is now reported against `<audit>` instead of a temporary file's path.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
The trace reducer `scripts/tlc-trace.py` is now `scripts/tlc_trace.py`, which the matrix runner imports instead of running in a second Python process. Its command line is unchanged. A TLC log that holds bytes that are not UTF-8 now has its trace reduced with those bytes replaced; before this change, the reducer stopped with a decoding error and the runner printed the log's last 40 lines instead.
|
|
84
|
+
|
|
85
|
+
The Python runners now hold back `SIGINT`, `SIGTERM` and `SIGHUP` while they stop a checker, and end by the signal once the stop has finished. The stop no longer handles a signal at each of its steps. One effect is visible: a Ctrl-C during a stop, such as the TLC timeout stop, no longer shortens the two seconds that the checker's processes get to exit after `SIGTERM` before `SIGKILL`.
|
|
86
|
+
|
|
87
|
+
A `SIGINT`, `SIGTERM` or `SIGHUP` that reaches the Python runners while they start a checker, such as TLC, Kani or a Lean build step, now stops that checker and the processes it started. Before this change, such a signal could end the runner while `Popen` waited for the checker to start, or just after, before the runner held the checker, and the checker kept running. The runners now start each checker through `processes.guarded`, which holds a signal until the checker is known and then stops it.
|
|
88
|
+
|
|
89
|
+
The Lean checker no longer reports a frozen definition as changed when a `match` of the same shape, or a pattern lambda such as `fun (a, b) => ...`, is added above it. Lean shares one match helper among such matches, so the frozen definition's value could switch to the new declaration's helper. A record now names every match helper alike, and the splitter that the `split` tactic uses with one, and carries their content without binder names; match helpers get no record of their own. The arguments passed to a match helper are recorded without binder names too, since Lean 4.20 names the binders of a recursive definition's alternatives after the shared helper. An edit to a frozen definition's own patterns or results still fails its check. A record frozen before this change reports each definition that uses a `match` as changed and each match helper as deleted; review them and run `--freeze` again. The Lean template's record is frozen again.
|
|
90
|
+
|
|
91
|
+
A signal that reaches the Python runners while they stop a checker no longer cuts the stop short: the stop still finds the checker's processes and sends `SIGKILL` to those that ignore `SIGTERM`, then the runner ends by the signal. This holds for a signal during the stop's `ps` listings too, such as a Ctrl-C during the TLC timeout stop. Before this change, such a signal ended the stop before it found the checker's children, so a child that ignores `SIGTERM` kept running after the checker died.
|
|
92
|
+
|
|
93
|
+
A frozen Lean record now covers the content of the hygienic constants it refers to, such as a helper that a user's macro defines, including the body of a hygienic `partial def`, and of the hygienic constants those refer to in turn. Proofs stay out of the record, as before. Such a constant has no record of its own, so before this change an edit to it passed the frozen check although the frozen declaration that uses it changed meaning. Hygienic names that Lean extends with a suffix, such as a helper's `match_1`, are now recorded without their numbers too. Records that refer to no hygienic constant are unchanged. On older pins such as Lean 4.20.0, the instances that `deriving` adds refer to hygienic helpers, so a record frozen before this change reports them as changed; review them and run `--freeze` again.
|
|
94
|
+
|
|
95
|
+
When a signal interrupts the Python runners while they wait for a stopped checker and its processes to exit, as a Ctrl-C during the TLC timeout stop can, the stop still sends `SIGKILL` to the checker and to every process it found that still runs. Before this change, the interrupted stop skipped that step, and the second stop that follows found the checker reaped and returned, so a process that the checker started and that ignores `SIGTERM` kept running after the runner exited.
|
|
96
|
+
|
|
97
|
+
When the Python runners stop a checker, the `ps` listings of the checker's processes now share one five-second limit, and a `ps` that does not end when the runner kills it at that limit is left behind instead of waited for. Before this change, each listing had its own five-second limit, so a stop could take about four minutes over fifty slow listings, and the runner waited without a limit for a killed `ps` that could not die, such as one in uninterruptible sleep, with the checker suspended all the while.
|
|
98
|
+
|
|
99
|
+
When the Python runners stop a checker, each `ps` listing of the processes it started now has five seconds to answer, and one stop takes at most fifty listings. When either limit is reached, the runner signals the processes it has found and prints a warning to `stderr` that others may still be running. Before this change, a `ps` that hung kept the checker suspended and the runner waiting, and a process that kept starting others, such as one whose `SIGSTOP` failed, kept the runner listing forever.
|
|
100
|
+
|
|
101
|
+
The Rust checker and the mutation runner now give the tools that Kani runs, such as `goto-cc`, a `TMPDIR` inside the runner's working directory. Before this change those tools wrote their temporary files straight into `TMPDIR`, and a check stopped partway could leave them there; the runner's cleanup now removes them with its working directory.
|
|
102
|
+
|
|
103
|
+
The Lean checker now records each frozen declaration's type and value without the numbers that Lean 4.20 gives across the whole module to hygienic names, such as binder names, universe parameters and the helpers that `deriving` adds, and to abstracted proofs named `_proof_` and a number. Before this change, on Lean 4.20.0, adding a declaration or editing a proof above a frozen recursive definition, structure with derived instances or enumeration failed its check with `statement changed`, although the Lean brief allows both edits. User-written names are still recorded. A record frozen before this change can report some of its declarations as changed; review them and run `--freeze` again. The Lean template's record is frozen again.
|
|
104
|
+
|
|
105
|
+
When the Python runners stop a checker, a process the checker started that is still running two seconds after `SIGTERM`, such as one that ignores `SIGTERM`, now gets `SIGKILL`, as the checker already did. When `ps` fails, so the runner cannot find the processes the checker started, it prints a warning to `stderr` that they may still be running. Before this change, both kinds of process outlived the runner without a word.
|
|
106
|
+
|
|
107
|
+
The helpers now state and check that they need Python 3.9 or later as `python3`. `setup.sh rust`, `setup.sh storage`, `setup.sh tla`, `tlc-matrix.sh`, `kani-check.sh`, `lean-check.sh` and `mutate.py` print `UNAVAILABLE`, name the version found and exit 3 on an older Python, which before this change failed partway with a `TypeError` or an `AttributeError`. On Python 3.9, Rust mutation runs no longer stop when a crate's subdirectory holds a dangling symbolic link, such as an editor lock file in `src/`; before Python 3.10, `shutil.copytree` skipped such a link only in the top directory. The copy now also keeps a working relative link, such as `src/alias.rs -> lib.rs`, which it dropped before unless the link also resolved from the directory the runner was started in.
|
|
108
|
+
|
|
109
|
+
The Rust checker now handles `SIGINT`, `SIGTERM` and `SIGHUP` while Kani checks the bundle's version as it does during a check: it stops the driver and the processes the driver started, ignores a second signal while it does, and ends by the signal. Before this change, a `SIGTERM` or `SIGHUP` there left the driver's processes running, a Ctrl-C printed a traceback, and a second Ctrl-C ended the stop early.
|
|
110
|
+
|
|
111
|
+
`lean-check.sh` now stops its running build on `SIGTERM`, `SIGHUP` or `SIGINT`, with every process the build started, such as Lake and the Lean compiler, before it removes its temporary directory and ends by the same signal. Before this change, a `SIGTERM` sent to the script alone left Lake and Lean running. It runs each build step through `processes.py run`, which stops a command's process tree as the Python runners do.
|
|
112
|
+
|
|
113
|
+
The Python runners no longer signal the process ID of a checker that exits just as they stop it. Before this change, such a checker was reaped without a signal, and the runner then sent `SIGTERM` and `SIGCONT` to its process ID, which another process could have taken.
|
|
114
|
+
|
|
115
|
+
The Lean checker no longer records the declarations that Lean generates only when a proof uses them, such as the equation lemmas `f.eq_1` and `f.eq_def`, the induction principle `f.induct`, and the equations of a private definition's matcher. Before this change, a proof edit that stopped using one, such as replacing `simp [init]` with a term, failed with `statement changed` and `new: (deleted)`, although changing proofs is allowed. The record of a recursive definition now includes the body that Lean keeps in an auxiliary declaration: `_f` for structural recursion, `_unary` or `_mutual` for well-founded recursion, and `_unsafe_rec` for the code that runs. Before this change, a frozen `partial def`, recorded with only a placeholder value, could change its body and still pass, and on Lean 4.35.0 the body of a structural, mutual or multi-argument well-founded definition was covered only by its equation lemmas. Records frozen before this change report their generated lemmas as deleted and their recursive definitions as changed; review those definitions and run `--freeze` again. The Lean template's record is frozen again.
|
|
116
|
+
|
|
117
|
+
The TLA+ matrix runner and mutation runner now enforce a per-run time limit (`TLC_TIMEOUT`, sixty minutes by default, using the same `<n>[s|m|h]` syntax and upfront `UNAVAILABLE` check as `KANI_HARNESS_TIMEOUT`), forward periodic elapsed-time and `Progress(...)` updates to `stderr` during long runs, flush each mutation verdict immediately, and allow `TLC_WORKERS` when checking `reach:` mutations on a modified spec while keeping single-worker witness checks deterministic; the TLA+ brief recommends binding `reach:`-mutated checks to small boundary runs. A timed-out ordinary or mutation run fails with a message naming the limit and `TLC_TIMEOUT` and never counts as a detection or an unreachable state.
|
|
118
|
+
|
|
119
|
+
Each TLC run now unpacks the TLA+ standard modules into a `java` directory inside its own run directory instead of the JVM's shared temporary directory. Before this change, TLC runs started at the same time, such as those of parallel agents, could delete each other's copy of `Naturals.tla` or `TLC.tla` and fail with `Module-Table lookup failure`, a `NullPointerException` or `source file 'TLC.tla' has apparently been deleted`.
|
|
120
|
+
|
|
121
|
+
The TLC runner now removes each run directory as soon as its check and trace reduction finish instead of holding every `states` directory until the matrix ends. On a non-ignored `SIGINT`, `SIGTERM` or `SIGHUP`, the Python runners (`tlc.py`, `mutate.py`, `kani.py`) clean up active working directories, stop their child checkers and the processes those started, such as CBMC under Kani, and then end by the same signal, so a shell loop that calls them stops at Ctrl-C. They keep child processes in the caller's process group, so `SIGHUP` and `SIGKILL` sent to the group stop them too. `lean-check.sh` honors `TMPDIR` across platforms and exits promptly on `SIGTERM`, an explicitly configured `TMPDIR` that cannot be created or written fails fast instead of falling back to the system disk, and `setup.sh` plus the runners check free temporary space (`FORMAL_MIN_FREE_GIB`) and report larger writable `EXTERNAL_VOLUME` mounts with a shell-quoted suggested `TMPDIR`.
|
|
122
|
+
|
|
123
|
+
A Lean mutation that edits the text of a theorem, such as one that replaces only its proof term, now reaches no verdict when that theorem fails. Before this change, such a mutation counted as detected and covered the theorem, even though the model it describes had not changed.
|
|
124
|
+
|
|
125
|
+
A TLA+ mutation that a property such as `Safe == []Small` detects now counts as detected. TLC checks such a property as the invariant `Small` and reports `Invariant Small is violated`, with or without `by the initial state:`, so before this change the mutation reached no verdict and the runner stopped. The run's configuration holds only the named property, so the violation comes from it. An invariant check still needs TLC to name the invariant itself.
|
|
126
|
+
|
|
127
|
+
`scripts/baseline.py` now records the `#[cfg(...)]` and `#![cfg(...)]` attributes that can switch each Kani harness off: those on the harness, on its enclosing modules and functions, and at the top of its file, other than `#[cfg(kani)]`, and each `#[cfg_attr(<condition>, cfg(...))]` there. `compare` prints CHANGED when one is added, removed or edited. For a harness file that another file declares, such as `proofs.rs` under `#[cfg(kani)] mod proofs;` in `lib.rs`, it also records those on each out-of-line `mod <name>;` declaration that leads to the file, found by Rust's default module layout, up to the crate root. It does not follow a `#[path = "..."]` attribute, a declaration inside a macro, or a crate root other than `lib.rs` or `main.rs`. Before this change, a `#[cfg(feature = "slow-proofs")]` added above a recorded harness took it out of Kani's discovery while `compare` printed UNCHANGED.
|
|
128
|
+
|
|
129
|
+
TLA+ baselines now follow the subscript of `[][Next]_vars`, `<<A>>_vars`, `WF_vars(...)` and `SF_vars(...)`, such as `vars`, in `Spec` and in every definition they follow, such as a fairness definition. Before this change, the baseline removed the subscript with the action, so taking a variable out of `vars` could strengthen fairness and turn a failing liveness property into a passing one while the comparison printed `UNCHANGED`. The actions under those forms are still not followed. A record made before this change still compares as before; record the matrix again to cover the subscript.
|
|
130
|
+
|
|
131
|
+
TLA+ baselines now follow the operators that a function definition names in its domain, such as `Slots` in `Ok[i \in Slots] == ...`. Before this change, the baseline followed only the text after `==`, so an edit to `Slots` could turn a failing invariant into a passing one while the comparison printed `UNCHANGED`. A record made before this change still compares as before; record the matrix again to cover these operators.
|
|
132
|
+
|
|
133
|
+
The Rust checker and the mutation runner now reject a harness marked `#[kani::should_panic]` when it is among the harnesses they would verify, before they verify any, and name the harness. Naming the other harnesses still checks them. Kani reports the expected panic as a failed check, so before this change the checker printed `FAIL` for a harness that Kani verified, and the mutation runner stopped at the unmutated harness.
|
|
134
|
+
|
|
135
|
+
Rust mutation runs now skip a dangling symbolic link, such as the `.#lib.rs` lock file that Emacs leaves beside an open file, when they copy the crate. Before this change, the copy stopped the run with a Python traceback after the unmutated harnesses had passed.
|
|
136
|
+
|
|
137
|
+
The specification baseline now keeps the layout of a TLA+ definition that spans several lines, and a removed comment leaves spaces so that each token keeps its column. Before this change it flattened nested conjunction and disjunction lists, so an edit that regrouped them, which can turn a violated invariant into a passing one, compared as unchanged. When a module has an indented definition outside a `LET` expression, or a column-0 definition inside one, the baseline compares the whole module text, because it cannot tell which definition holds that line. A definition inside a `LET` stays part of the definition that contains it. A TLA+ baseline recorded before this change reports that it needs review; record it again after the review.
|
|
138
|
+
|
|
139
|
+
A TLA+ mutation now gets credit only when its detector passes on the original spec at the same run settings. An ordinary check must pass there, and a reach check must find its witness. Before this change, a mutation that only added parentheses could get credit for a violation the original model already had, or for a state the original model never reached. The mutation runner checks each selected run on the original once. When the original fails, the mutation gets no verdict. The run stops with a `FAIL` line for that mutation, followed by a line that names the detector the original did not pass.
|
|
140
|
+
|
|
141
|
+
The TLA+ matrix runner now drops every space and tab between a run's label and its `|`. Before this change it dropped one space, so a label followed by more spaces or a tab printed them in its `PASS` and `FAIL` lines. Spaces inside a label stay.
|
|
142
|
+
|
|
143
|
+
The Lean mutation runner now runs the Lean checker on the original model, with its frozen statements, before it checks any mutation. Before this change, deleting a frozen public theorem removed it from mutation coverage without a failure, and a malformed `.statements` file could still give a passing summary. The Lean checker, the mutation runner and the baseline helper now read statements records with the same reader.
|
|
144
|
+
|
|
145
|
+
Rust mutation runs now copy a module directory named `target`, such as `src/target/mod.rs`. Before this change, the copy left out every directory with that name. It still leaves out the target directory that `cargo metadata` reports, and any directory that holds Cargo's `CACHEDIR.TAG` file, such as a `target/` that stayed in the tree after `CARGO_TARGET_DIR` moved the build.
|
|
146
|
+
|
|
147
|
+
The Lean checker now finds compiled modules through the library paths that Lake reports. A project that set `buildDir` or `leanLibDir` used to build and then fail before the declaration audit. The kernel replay uses the same paths for the project modules that a checked file imports.
|
|
148
|
+
|
|
149
|
+
The npm package no longer includes the Kani template's Cargo build output when the template was built in the checkout before publishing. A test packs the package offline and compares its file list with the tracked files under `skills/` and the root entry points.
|
|
150
|
+
|
|
3
151
|
## 0.4.12 - Kani harness time limits checked before any harness runs
|
|
4
152
|
|
|
153
|
+
Lean mutations now match a failing example or guard to its original occurrence. Previously, inserting a broken example with the same statement as a passing one could count as a detection. A failure in a new check or one whose origin is ambiguous now gives the mutation no verdict.
|
|
154
|
+
|
|
5
155
|
The Rust checker, the mutation runner and `setup.sh rust` now check `KANI_HARNESS_TIMEOUT` before Kani runs. The setting takes a whole number from 1 to 4294967295 with an optional unit `s`, `m` or `h`, as Kani 0.68.0 reads it, and spaces around the value are ignored. For any other value, including `0`, the helpers print `UNAVAILABLE` and check no harness. Before this change, `0` stopped every harness at once, and a value that Kani rejects failed every harness with a message about a missing result file. The limit cannot be turned off, so set a long one, such as `24h`, instead. A harness that reaches the limit fails with a message that names the limit with its unit, such as `90s` for a value of `90`, and the setting that changes it. The setup guide says that each harness check can take up to the limit, so run the Rust checker and the mutation runner in the background or with a command timeout longer than the total.
|
|
6
156
|
|
|
7
157
|
## 0.4.11 - Antigravity install, stricter verdicts and a Kani harness time limit
|
package/README.md
CHANGED
|
@@ -73,9 +73,11 @@ In Claude Code, use `/agent-formal-verify:formal-verify`. In Codex, type `$forma
|
|
|
73
73
|
|
|
74
74
|
## How it works
|
|
75
75
|
|
|
76
|
-

|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
1. **Choose what to check.** If the repository already has models, the agent reads the source changes since each model was last checked, reruns its checks and mutations, and records what it promises before editing it. For new targets, it builds a TLA+ or Lean model or writes a Kani harness that calls the production Rust function.
|
|
79
|
+
2. **Test the guarantees.** The agent reruns the checks itself, tests each property against deliberate mistakes, and compares existing guarantees with the record. Past bug fixes supply mutations where practical. You can also request an independent review of the properties against the code.
|
|
80
|
+
3. **Follow failures back to the code.** The agent maps each counter-example to source lines, checks whether shipped settings can reach it, and tries to reproduce it. It reports a proposed fix and changes production code only if you ask. It gives you commands to rerun the checks and adds them to CI if you request it or the repository already runs models there.
|
|
79
81
|
|
|
80
82
|
A passing check establishes its stated properties under its assumptions and bounds. Reports must identify omitted constraints and unfinished proofs. See [scope and evidence](docs/reference.md#scope-and-evidence).
|
|
81
83
|
|
|
@@ -91,7 +93,7 @@ A passing check establishes its stated properties under its assumptions and boun
|
|
|
91
93
|
|
|
92
94
|
## Data handling
|
|
93
95
|
|
|
94
|
-
The plugin configures no MCP servers or hooks, requires no credentials and has no telemetry. Its OpenCode entry point, `opencode.mjs`,
|
|
96
|
+
The plugin configures no MCP servers or hooks, requires no credentials and has no telemetry. Its OpenCode entry point, `opencode.mjs`, reads and registers the bundled skills without running commands or making network requests. The agent sends selected source excerpts, models and results to its model provider. Verification runs locally. Setup verifies a TLC JAR you obtain from the pinned TLA+ release and uses elan to install a missing Lean toolchain. The Kani helpers use the pinned installation you prepare through Cargo. See [tool setup](skills/formal-verify/references/setup.md).
|
|
95
97
|
|
|
96
98
|
## Contributing
|
|
97
99
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-formal-verify",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
4
4
|
"description": "Model-check protocols with TLA+, prove invariants with Lean 4, and check bounded Rust functions with Kani.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Michael Denyer",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"opencode.mjs",
|
|
17
17
|
"skills/",
|
|
18
18
|
"!skills/**/.lake/",
|
|
19
|
+
"!skills/formal-verify/examples/kani-template/target/",
|
|
19
20
|
"LICENSE",
|
|
20
21
|
"README.md",
|
|
21
22
|
"CHANGES.md"
|
|
@@ -25,12 +25,7 @@ Use the tool the user names. When the table gives another tool for part of the t
|
|
|
25
25
|
|
|
26
26
|
When the repository has models from an earlier run, start with them. Find every model, wherever it lives: `.tla` specs with their `.matrix` and `.mutations` files, Lean models with their `.mutations` and `.statements` files, and Kani harness files. Each is a row in the table this step writes.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- Follow each source file in the header through the renames that `git log -M --diff-filter=R --name-status --format= <sync>..HEAD` lists, and keep every path on the way, not only the first and last.
|
|
31
|
-
- Add the files where the functions and shared variables it covers live now, from `git grep -l -w -e <name> -- . ':(exclude)<model file>'`. Exclude only model files that hold no production code; a Kani harness written inside a production file stays in the search.
|
|
32
|
-
|
|
33
|
-
Then read `git log -p <sync>..HEAD -- <paths collected>`, which includes commits made at an intermediate path and code that moved to another file. A covered name that `git grep` finds nowhere was renamed, moved or deleted. Find the commit that removed it with `git log -S <name> <sync>..HEAD -- <paths collected>` and read all of it with `git show <commit>`. When it renamed or moved the code, follow the code to its new name and file. Mark the row for retirement as step 5 says only when the code is gone.
|
|
28
|
+
For each model, run `python3 <skill-dir>/scripts/sync.py <model files> --source <file> ... --name <name> ...` with the source files and the covered functions and shared variables that its header names. Name a model file that holds production code, such as a Rust file with its Kani harness, as a `--source` too. `SYNC none` means the model has no sync commit, so compare it with the code in full. Otherwise run the `git log -p` command on its `READ` line, which covers each path where the helper found a covered name since the sync commit. It misses a path that held the code only under another name, or a path where each commit since the sync kept the number of times the name appears, such as one that replaced a mention of the name with its definition, so when the log shows a covered name renamed, read the commits of each file that held the new name. A `MISSING <name>` line names a covered name that `git grep` finds in none of the files it searches, outside documents, other models and Rust comments and strings, with the commits since the sync that added or removed it; read each with `git show <commit>`. When one renamed or moved the code, follow the code to its new name and file. Mark the row for retirement as step 5 says only when the code is gone.
|
|
34
29
|
|
|
35
30
|
Record the sync commit, the commits read and the answers to two questions in the row:
|
|
36
31
|
|
|
@@ -58,22 +53,25 @@ Then ask the user whether to add an independent review of each model's propertie
|
|
|
58
53
|
|
|
59
54
|
Prepare tools after picking targets and before launching agents. The helpers are in this skill's `scripts/` directory. Stay in the target repository and run each helper with `bash` and its absolute path. Pass absolute paths to models and matrices. [Tool setup](references/setup.md) describes the pins, caches and environment settings.
|
|
60
55
|
|
|
61
|
-
- When a target needs Kani, run `bash <skill-dir>/scripts/setup.sh rust`.
|
|
56
|
+
- When a target needs Kani, run `bash <skill-dir>/scripts/setup.sh rust`. Before any agent starts, declare `cfg(kani)` in each target crate's `Cargo.toml`, a moved harness's production crate among them, as the Kani template's `[lints.rust]` entry does, or under `[workspace.lints.rust]` when the crate sets `lints.workspace = true`. Without it, rustc warns about every harness module, and a build with `-D warnings` fails.
|
|
62
57
|
- When a target needs TLA+, run `bash <skill-dir>/scripts/setup.sh tla`.
|
|
63
58
|
- When a target needs Lean, every Lean model in the repository shares one Lake project. If the repository has none, copy `lakefile.toml`, `lake-manifest.json` and `lean-toolchain` from `<skill-dir>/examples/lean-template/` to `lean/` in the target repository, once. Then run `bash <skill-dir>/scripts/setup.sh lean <absolute-model-project-path>`.
|
|
64
59
|
|
|
65
60
|
Require a successful exit and a `READY` line from each command. A helper that cannot run prints `UNAVAILABLE` and exits 3. Report it as "not checked" with its remedy. It is neither a pass nor a failure of the model. A check that ran and failed exits 1; usage errors exit 2. The setup helper reuses ready tools and installs a missing Lean pin, so the user does not need to rerun `/agent-formal-verify:setup` when a target or pin changes. Keep the installed skill files read-only and copy templates into the target repository.
|
|
66
61
|
|
|
62
|
+
Each setup command also reports the temporary directory's free space; [tool setup](references/setup.md) explains its `TEMP_DIR`, `WARN` and `EXTERNAL_VOLUME` lines. Before running any checker or `mutate.py`, if `WARN` appears, or a larger `EXTERNAL_VOLUME` is available for a heavy TLA+ or Rust run, ask the user once per session, with the host's question tool where it has one, whether to keep the default temporary directory or set `TMPDIR=<volume>/.tmp/formal-verify` for the commands that follow. Do not ask again after the user answers. In a headless run where no user can answer, report the warning before continuing.
|
|
63
|
+
|
|
67
64
|
If a system prerequisite such as Java or elan is missing, use the [setup skill](../setup/SKILL.md) to prepare it within the user's installation constraints and existing authorization. Report any prerequisite that cannot be prepared. If `java` on PATH has no runtime, set `JAVA` to a working JDK's `java` binary for the setup helper and the matrix runner.
|
|
68
65
|
|
|
69
|
-
Read the [helper reference](references/helpers.md) before you interpret a helper's output. The helpers:
|
|
66
|
+
Read the [helper reference](references/helpers.md) before you interpret a helper's output. It says what each helper checks and prints. The helpers:
|
|
70
67
|
|
|
71
|
-
- The setup helper
|
|
72
|
-
- The matrix runner
|
|
73
|
-
- The Lean checker
|
|
74
|
-
- The Rust checker
|
|
75
|
-
- The mutation runner
|
|
76
|
-
- The
|
|
68
|
+
- The setup helper: [`scripts/setup.sh`](scripts/setup.sh)
|
|
69
|
+
- The matrix runner: [`scripts/tlc-matrix.sh`](scripts/tlc-matrix.sh)
|
|
70
|
+
- The Lean checker: [`scripts/lean-check.sh`](scripts/lean-check.sh)
|
|
71
|
+
- The Rust checker: [`scripts/kani-check.sh`](scripts/kani-check.sh)
|
|
72
|
+
- The mutation runner: [`scripts/mutate.py`](scripts/mutate.py)
|
|
73
|
+
- The sync helper: [`scripts/sync.py`](scripts/sync.py)
|
|
74
|
+
- The baseline helper: [`scripts/baseline.py`](scripts/baseline.py)
|
|
77
75
|
|
|
78
76
|
Run every existing model's checker and mutations once, before any agent changes a model, and record the results. Then record what the models specify with `python3 <skill-dir>/scripts/baseline.py record <record-file> <model files>`, naming each existing `.matrix`, `.statements` and Kani harness file. Put `<record-file>` in a temporary directory outside the repository, and leave its path out of every brief. For a TLA+ or Lean model a pass shows only that the old description still holds; a Kani harness runs the code as it is now. A model that still describes the code needs no agent. When it passes, refresh its header as step 5 says; when it fails, take the failure through step 4. A Kani compile error means the harness no longer fits the code, so give it to an agent. An UNCOVERED line means the mutations file lacks a bug that the property detects, not that the code fails; give the model to an agent to add one. A check that passes here and fails after the update was passing on a stale description; say so in the reply.
|
|
79
77
|
|
|
@@ -82,16 +80,16 @@ Run every existing model's checker and mutations once, before any agent changes
|
|
|
82
80
|
Spawn one agent per target, in parallel when supported. Use the host runtime's agent tools and follow the user's model configuration when selecting agents. An agent does not see this skill. Its brief contains:
|
|
83
81
|
|
|
84
82
|
- the target's row from the table, with its source files and line ranges;
|
|
85
|
-
- the model's name, `<Name>`, and for a Lean target the absolute path of the Lake project, or for Kani the absolute path of the crate;
|
|
83
|
+
- the model's name, `<Name>`, which for a new Kani harness is the stem of its production file, such as `lib`, and for a Lean target the absolute path of the Lake project, or for Kani the absolute path of the crate;
|
|
86
84
|
- the absolute path of this skill's directory as `<skill-dir>`, and any `JAVA` setting;
|
|
87
85
|
- the instruction to read `<skill-dir>/references/tla-brief.md` for a protocol, `<skill-dir>/references/lean-brief.md` for arithmetic, or `<skill-dir>/references/rust-brief.md` for a Rust function, in full and to follow it;
|
|
88
86
|
- for an existing model, its files.
|
|
89
87
|
|
|
90
88
|
Name the brief file and leave its text out of the prompt. The [TLA+ brief](references/tla-brief.md), the [Lean brief](references/lean-brief.md) and the [Rust brief](references/rust-brief.md) hold the modelling requirements, the files to write, the commands to run and what to report. If delegation is unavailable, read the brief for each target and model the targets yourself, one at a time.
|
|
91
89
|
|
|
92
|
-
An agent writes only its own files, `tla/<Name>.tla`, `.matrix` and `.mutations`, `lean/Model/<Name>.lean`, `.mutations` and `.statements`, or the
|
|
90
|
+
An agent writes only its own files, `tla/<Name>.tla`, `.matrix` and `.mutations`, `lean/Model/<Name>.lean`, `.mutations` and `.statements`, or the `#[cfg(kani)]` harness module in the production file that defines its Rust function and the `.mutations` file beside it, so parallel agents share none. Give one agent every Rust target in one production file. An existing Lean project keeps its layout and must pin Lean 4.20.0 or later. A Kani harness that an earlier run wrote in a crate of its own moves into its production file when the Rust brief's "Moving a harness" section allows, so it gets an agent even when it passes; otherwise its agent edits it and its `.mutations` file in place.
|
|
93
91
|
|
|
94
|
-
When the agents have reported, rerun every check in this thread: the matrix runner on each matrix file, the Lean checker on the whole project without a file name, the Rust checker on each crate, and the mutation runner on each mutations file. Take each verdict from these runs, not from an agent's report. Then run `python3 <skill-dir>/scripts/baseline.py compare <record-file>`. It exits 1 and prints CHANGED with the changed parts when a recorded property, fairness condition, matrix line, `.statements` record, Kani cover or stub changed, a Kani harness was removed or
|
|
92
|
+
When the agents have reported, delete each moved harness's old file, and its crate, workspace entry and CI steps once they hold nothing else. Then rerun every check in this thread: the matrix runner on each matrix file, the Lean checker on the whole project without a file name, the Rust checker on each crate, and the mutation runner on each mutations file. Take each verdict from these runs, not from an agent's report. For a moved harness, first run `baseline.py move` as the [helper reference](references/helpers.md) says. Then run `python3 <skill-dir>/scripts/baseline.py compare <record-file>`. It exits 1 and prints CHANGED with the changed parts when a recorded property, fairness condition, matrix line, `.statements` record, Kani cover or stub changed, a Kani harness was removed, renamed, no longer compiles or had its `cfg` guards changed on a route the record reads, or a Kani assumption was added or changed. Accept a move only as that reference says. Also read `git diff` for each model that existed before this run, for the changes the record does not cover, such as a theorem newly marked `private`, a new guard in a TLA+ action, or a removed assertion or narrowed input in a Kani harness. Each such change needs the evidence its row cites, a specification correction accepted below, or for a re-freeze another reason the Lean brief permits. Revert any change without it and give the model back to its agent with the reason. Run the comparison again until it exits 0. Report each file that prints `NOT CHECKED` as not checked against Kani.
|
|
95
93
|
|
|
96
94
|
Accept a specification correction when a reviewer finding, a missed mutation, an UNCOVERED result with source evidence, or a checked witness demonstrates a gap in the old statement. Read the old and proposed guarantees against the callers, record the evidence and decision in the target's row, and permit the corresponding re-freeze even when production code is unchanged. The correction must preserve the intended guarantee or strengthen it over the intended inputs. A broken proof alone does not justify changing a statement. A weaker guarantee or a new assumption excluding shipped inputs needs evidence of an intentional production contract change or the user's explicit agreement. Rerun all checks after the accepted correction and re-freeze. Then run `baseline.py record <record-file>` again on that model's file, and add the previous and new digests it prints to the row.
|
|
97
95
|
|
|
@@ -121,9 +119,9 @@ Each fact about a model has one home:
|
|
|
121
119
|
- The project's testing documentation, when it has any, has one row per model: what it checks, in the words the Reply section asks for, and its boundary configuration. Update the row when the model changes.
|
|
122
120
|
- A pull request description tells its bug's story once and links to the model.
|
|
123
121
|
|
|
124
|
-
When a model's covered code is gone, propose retiring it in the reply. With the user's agreement, delete its files, including a Lean model's `.statements` record, its CI steps and its row in the testing documentation.
|
|
122
|
+
When a model's covered code is gone, propose retiring it in the reply. With the user's agreement, delete its files, including a Lean model's `.statements` record, its CI steps and its row in the testing documentation. For a Kani harness in a production file, delete its `#[cfg(kani)]` module, the header comment above it and its mutations file, not the production file.
|
|
125
123
|
|
|
126
|
-
Do not add a report file per bug
|
|
124
|
+
Do not add a report file per bug or paste run tables or traces into several documents. Write an HTML report only when asked. Set `TLC_HTML_REPORT` for the matrix runner to a path outside the repository unless told otherwise. Write `<skill-dir>` in any committed command; a path from this machine fails for the next reader.
|
|
127
125
|
|
|
128
126
|
## What this does not cover
|
|
129
127
|
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
// Copyright (c) 2026 Michael Denyer
|
|
2
2
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
3
|
-
//
|
|
4
|
-
// The harnesses in `proofs` check `claim` and `consume` of a bounded queue with
|
|
5
|
-
// ordered output. To adapt them, replace this comment with the production
|
|
6
|
-
// source files and line ranges the harnesses call, the functions they cover,
|
|
7
|
-
// the commit they were read at as `Source read at <commit>`, and each caller
|
|
8
|
-
// constraint and stub assumption.
|
|
9
3
|
|
|
10
4
|
#[derive(Clone, Copy)]
|
|
11
5
|
pub struct State {
|
|
@@ -33,6 +27,11 @@ pub fn consume(state: State) -> Option<State> {
|
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
|
|
30
|
+
// The harnesses in `proofs` check `claim` and `consume` of a bounded queue with
|
|
31
|
+
// ordered output. To adapt them, replace this comment with the production
|
|
32
|
+
// source files and line ranges the harnesses call, the functions they cover,
|
|
33
|
+
// the commit they were read at as `Source read at <commit>`, and each caller
|
|
34
|
+
// constraint and stub assumption.
|
|
36
35
|
#[cfg(kani)]
|
|
37
36
|
mod proofs {
|
|
38
37
|
use super::*;
|
|
@@ -10,13 +10,6 @@
|
|
|
10
10
|
"typeHash": "7f6d7123a0a67d58d9769af023285e40990096f3ce18de2a1476b31821cb0f12",
|
|
11
11
|
"valueHash": "e4bb08954609a0a6c94443004be6dfe6c3c5ddf1e7d4565fb28ca3e7c3b2c3a7"
|
|
12
12
|
},
|
|
13
|
-
{
|
|
14
|
-
"name": "BoundedQueue.Invariant.eq_1",
|
|
15
|
-
"kind": "theorem",
|
|
16
|
-
"type": "∀ (w : Nat) (s : BoundedQueue.State), BoundedQueue.Invariant w s = (s.consumed ≤ s.next ∧ s.next ≤ s.consumed + w)",
|
|
17
|
-
"typeHash": "0206d5c005c8713f1ae3d80e748afe65aa3ca4c719821ef4556cb11846ac103a",
|
|
18
|
-
"valueHash": null
|
|
19
|
-
},
|
|
20
13
|
{
|
|
21
14
|
"name": "BoundedQueue.State",
|
|
22
15
|
"kind": "inductive",
|
|
@@ -42,7 +35,7 @@
|
|
|
42
35
|
"name": "BoundedQueue.State.ctorIdx",
|
|
43
36
|
"kind": "definition",
|
|
44
37
|
"type": "BoundedQueue.State → Nat",
|
|
45
|
-
"typeHash": "
|
|
38
|
+
"typeHash": "d8cb6693d62660ae03ff3f84f88120dccb5b63f77d67a924feec5cb5ed16585e",
|
|
46
39
|
"valueHash": "7619185feeaae7dd160024b3890ba3f6b7c656dcccf81b8b05ecf60a98cd51ca"
|
|
47
40
|
},
|
|
48
41
|
{
|
|
@@ -56,7 +49,7 @@
|
|
|
56
49
|
"name": "BoundedQueue.State.mk.inj",
|
|
57
50
|
"kind": "theorem",
|
|
58
51
|
"type": "∀ {next consumed next_1 consumed_1 : Nat}, { next := next, consumed := consumed } = { next := next_1, consumed := consumed_1 } → next = next_1 ∧ consumed = consumed_1",
|
|
59
|
-
"typeHash": "
|
|
52
|
+
"typeHash": "77f67e01eea41ebf59635ec872f0ba184fdbb760cbf6de0a2ff5f40f25c65a60",
|
|
60
53
|
"valueHash": null
|
|
61
54
|
},
|
|
62
55
|
{
|
|
@@ -99,7 +92,7 @@
|
|
|
99
92
|
"kind": "definition",
|
|
100
93
|
"type": "Sort u → BoundedQueue.State → BoundedQueue.State → Sort u",
|
|
101
94
|
"typeHash": "a54a36ba2814eb27334bce8bd22ec820d9d6afb559632c858f5fc98c2577e42a",
|
|
102
|
-
"valueHash": "
|
|
95
|
+
"valueHash": "202cafe7060522f87ff21c8cd1e91468012b3238a95a7c3f0b3dbae90a848b60"
|
|
103
96
|
},
|
|
104
97
|
{
|
|
105
98
|
"name": "BoundedQueue.State.rec",
|
|
@@ -120,14 +113,7 @@
|
|
|
120
113
|
"kind": "definition",
|
|
121
114
|
"type": "Nat → Nat → List (BoundedQueue.State × BoundedQueue.State)",
|
|
122
115
|
"typeHash": "3c10f9d3b1db7f38259addbb30531e138707750920468a6f0851dd61966e35c3",
|
|
123
|
-
"valueHash": "
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"name": "BoundedQueue.badPairs.match_1",
|
|
127
|
-
"kind": "definition",
|
|
128
|
-
"type": "(motive : Option BoundedQueue.State → Sort u_1) → (t : Option BoundedQueue.State) → ((t' : BoundedQueue.State) → motive (some t')) → (Unit → motive none) → motive t",
|
|
129
|
-
"typeHash": "af98a4e3bf5e18322b9281d582642a70793e0eb5ce6780696c448cbf28256cce",
|
|
130
|
-
"valueHash": "462c1132951924916484f4295f1aff8678fe9d71fa0a89a181829589f7f76d53"
|
|
116
|
+
"valueHash": "43f59760a207fb00fe34f5d61e38f6615353bfb0179b7a9706e57880b2668a06"
|
|
131
117
|
},
|
|
132
118
|
{
|
|
133
119
|
"name": "BoundedQueue.claim",
|
|
@@ -178,13 +164,6 @@
|
|
|
178
164
|
"typeHash": "11103524df36d3cdaaecfad5a8e4ea76bfd435294bead5f2acdefbe05c6aef71",
|
|
179
165
|
"valueHash": "bd3dc3f1382ed19a578267073024d6fbc246b465d6e7c14b0aed9787c0cbeef7"
|
|
180
166
|
},
|
|
181
|
-
{
|
|
182
|
-
"name": "BoundedQueue.init.eq_1",
|
|
183
|
-
"kind": "theorem",
|
|
184
|
-
"type": "BoundedQueue.init = { next := 0, consumed := 0 }",
|
|
185
|
-
"typeHash": "5e405f4acd1a41903fdd240d23ad3be5e67fb0883e48136d1ace01dfa756fdc9",
|
|
186
|
-
"valueHash": null
|
|
187
|
-
},
|
|
188
167
|
{
|
|
189
168
|
"name": "BoundedQueue.instDecidableEqState",
|
|
190
169
|
"kind": "definition",
|
|
@@ -196,15 +175,8 @@
|
|
|
196
175
|
"name": "BoundedQueue.instDecidableEqState.decEq",
|
|
197
176
|
"kind": "definition",
|
|
198
177
|
"type": "(x x_1 : BoundedQueue.State) → Decidable (x = x_1)",
|
|
199
|
-
"typeHash": "
|
|
200
|
-
"valueHash": "
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"name": "BoundedQueue.instDecidableEqState.decEq.match_1",
|
|
204
|
-
"kind": "definition",
|
|
205
|
-
"type": "(motive : BoundedQueue.State → BoundedQueue.State → Sort u_1) → (x x_1 : BoundedQueue.State) → ((a a_1 b b_1 : Nat) → motive { next := a, consumed := a_1 } { next := b, consumed := b_1 }) → motive x x_1",
|
|
206
|
-
"typeHash": "a3593a5bf4fe863d9a64998e6820f9d4d108b25b8a7dbadc85895186e774b0bd",
|
|
207
|
-
"valueHash": "8c1885bcd3420a131168e49097f6dbcc0424182d1b3c14d0cba7e31775881e9b"
|
|
178
|
+
"typeHash": "374541636a2ec028265455e19e18411bb5843e5f6acc04db6f6b9d946232582b",
|
|
179
|
+
"valueHash": "960a2dd546454ff2efa39969eb799cde6d43a8171d2cb5c8a20295bd2c6be847"
|
|
208
180
|
},
|
|
209
181
|
{
|
|
210
182
|
"name": "BoundedQueue.instDecidableInvariant",
|
|
@@ -224,8 +196,8 @@
|
|
|
224
196
|
"name": "BoundedQueue.instReprState.repr",
|
|
225
197
|
"kind": "definition",
|
|
226
198
|
"type": "BoundedQueue.State → Nat → Format",
|
|
227
|
-
"typeHash": "
|
|
228
|
-
"valueHash": "
|
|
199
|
+
"typeHash": "a45a356d5d9821099d6254833550a5115a3d7465b167435129d5c4ffcb0414c4",
|
|
200
|
+
"valueHash": "1e4dc4f0b9d773b3f88fdb678baed03d2bee6f49357b0d0cbc2fb25799e05ec9"
|
|
229
201
|
},
|
|
230
202
|
{
|
|
231
203
|
"name": "BoundedQueue.invariant_init",
|
|
@@ -238,15 +210,8 @@
|
|
|
238
210
|
"name": "BoundedQueue.reachable",
|
|
239
211
|
"kind": "definition",
|
|
240
212
|
"type": "Nat → Nat → List BoundedQueue.State",
|
|
241
|
-
"typeHash": "
|
|
242
|
-
"valueHash": "
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
"name": "BoundedQueue.reachable.match_1",
|
|
246
|
-
"kind": "definition",
|
|
247
|
-
"type": "(motive : Nat → Sort u_1) → (x : Nat) → (Unit → motive 0) → ((steps : Nat) → motive steps.succ) → motive x",
|
|
248
|
-
"typeHash": "762abfa7addd0bd8d4a548d7221baf925cf09a9c172d54d9d49a913a6c7908c2",
|
|
249
|
-
"valueHash": "d3ec4495c6184aacdc386c9a5da8fa7e98fa053decdc0d4ab66dcccd8ec23846"
|
|
213
|
+
"typeHash": "ba325d9d339b281c7edc5f19b115da5124ade8a48c1c6893b70d682942b3be97",
|
|
214
|
+
"valueHash": "26daa2c7fd07c4ff1e6ae00375c42578b5c067800660b1de7495d08e6935661b"
|
|
250
215
|
},
|
|
251
216
|
{
|
|
252
217
|
"name": "BoundedQueue.vectors",
|
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
# edit. Paths are relative to this file. A `spec` line resets the `check`
|
|
3
3
|
# lines; each `run` is one TLC run with the CONSTANTS after the bar. Each spec
|
|
4
4
|
# must name its top-level formula Spec. mutate.py reads the checks and runs of
|
|
5
|
-
# <Name>.matrix for the mutations in <Name>.mutations.
|
|
5
|
+
# <Name>.matrix for the mutations in <Name>.mutations. A set-valued constant
|
|
6
|
+
# has no spaces; model values are bare names.
|
|
6
7
|
|
|
7
8
|
spec BoundedQueue.tla
|
|
8
|
-
check INVARIANTS TypeOK InWindow
|
|
9
|
-
check PROPERTIES AllConsumed
|
|
9
|
+
check INVARIANTS TypeOK InWindow Owned InOrder ErrorInOrder NoDeliveryAfterError NoLeak
|
|
10
|
+
check PROPERTIES NextReturns CloseReturns AllConsumed
|
|
11
|
+
# Each reach check names a state the properties depend on and the first run whose label holds the text after the bar.
|
|
10
12
|
reach WindowFull | window=1
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
reach WorkerParked | window=1
|
|
14
|
+
reach ConsumerParked | window=1
|
|
15
|
+
reach Failed | fail=
|
|
16
|
+
# Windows of 1, 2 and the shipped 4; 0, 1, 3 and 5 items; one, two and three workers; and an
|
|
17
|
+
# injected failure at the only item and at an item behind one still being built.
|
|
18
|
+
run window=1 items=3 workers=1 | Window=1 Items=3 Workers={w1} FailAt={}
|
|
19
|
+
run window=2 items=5 workers=2 | Window=2 Items=5 Workers={w1,w2} FailAt={}
|
|
20
|
+
run window=4 items=5 workers=3 | Window=4 Items=5 Workers={w1,w2,w3} FailAt={}
|
|
21
|
+
run window=4 items=0 workers=2 | Window=4 Items=0 Workers={w1,w2} FailAt={}
|
|
22
|
+
run window=2 items=1 workers=3 fail=0 | Window=2 Items=1 Workers={w1,w2,w3} FailAt={0}
|
|
23
|
+
run window=2 items=3 workers=2 fail=1 | Window=2 Items=3 Workers={w1,w2} FailAt={1}
|