agent-formal-verify 0.4.21 → 0.4.22
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
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 0.4.22 - Matrix string constants refuse a backslash
|
|
4
|
+
|
|
5
|
+
A matrix whose `run` line gives a constant a string that holds a backslash, such as `Tag="a\"b"` or `Mode={"a\qb",Other}`, no longer runs. The matrix runner and `mutate.py` print a `FAIL <matrix>:<line>:` line for it and exit 2 before any run, and `baseline.py record` stops on it with `FAIL baseline:` as it does on the matrix lines that 0.4.21 refuses. TLC 1.7.4 keeps the backslash and the character after it, so `"a\"b"` has 4 characters, while everystate 0.4.6 reads the pair as one TLA+ escape and finds 3; TLC stops on `"a\qb"` with an exception, and everystate reads it as `aqb`. Before this change the same matrix checked a different model on each engine. A string without a backslash, such as `Mode="INIT"` or `Tag="a'b"`, still runs, and no bundled example uses a backslash.
|
|
6
|
+
|
|
3
7
|
## 0.4.21 - TLA+ matrix symmetry and cfg checks, a TLC check in setup, natively built Lean analysis, and Kani baselines that read the items beside a harness
|
|
4
8
|
|
|
5
9
|
The matrix runner and `mutate.py` now reject, before any run, a matrix line that could change the generated cfg beyond itself. That is a name on a `check` line, or a constant's name, that is not a TLA+ identifier or that is a cfg keyword of TLC or everystate, such as `TYPE` or `TYPE_CONSTRAINT`, or a TLA+ reserved word, and a `reach` operator that is not a TLA+ identifier or is a reserved word. It is also a constant's value that holds a comment opener, a string that it does not close, or a cfg keyword outside a string that is not the whole value or a whole set element, such as `{}PROPERTIES`. Each such line prints `FAIL <matrix>:<line>:` with the problem, and both runners exit 2. `baseline.py record` fails on the same lines. Before this change, the check line `check INVARIANTS InWindow PROPERTIES Bogus`, the constant `FailAt={}PROPERTIES(**)Bogus` or a constant named `PROPERTIES(**)Bogus(**)CONSTANT(**)FailAt` added a `PROPERTIES Bogus` statement to the cfg, and a value with an unclosed string made TLC stop with an unexpected exception.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The TLA+ behaviour of the helpers. The [helper reference](helpers.md) holds what every engine shares; read it first.
|
|
4
4
|
|
|
5
|
-
- **Matrix runner ([`scripts/tlc-matrix.sh`](../scripts/tlc-matrix.sh))**: runs TLC (or the native `everystate` engine with `-lncheck final` when `TLC_ENGINE=everystate`, requiring no JDK or JAR) with a matrix of constants. It prints an `ENGINE` line naming the checker and version before the first run, then one `PASS` or `FAIL` per run with its state count, then a `SUMMARY` line with the totals (tagged with `(everystate <version>)` when using `everystate`). Stops each run after sixty minutes, or after the limit in `TLC_TIMEOUT` as [setup](setup.md) describes, and forwards periodic elapsed-time and `Progress(...)` updates to `stderr` during long runs. A failing run prints its error trace reduced by [`scripts/tlc_trace.py`](../scripts/tlc_trace.py) to the variables each step changed. Before it checks the engine, the runner rejects each matrix line that could change the cfg beyond itself: a check name, reach or symmetry operator or constant name that is not a TLA+ identifier or is a TLA+ reserved word; a check name, symmetry operator or constant name that is a cfg keyword; and a constant value that holds a comment opener, a string that it does not close, or a cfg keyword outside a string that is not the whole value or a whole set element. So `Mode=INIT`, `Mode={TYPE,VIEW}`, `Mode="INIT"` and `reach INIT | label` pass, and `FailAt={}PROPERTIES` stops the runner. It prints a `FAIL <matrix>:<line>:` line for each and exits 2, and `mutate.py` does the same. Set `TLC_HTML_REPORT=<path>` to also write a self-contained offline HTML report through [`scripts/tlc_report.py`](../scripts/tlc_report.py) with the active engine metadata, the run table, an interactive native SVG state chain, a variable diff panel, and copyable Mermaid `stateDiagram-v2` source for each failing and `reach` witness trace. The runner checks the path after checking the TLA+ engine and before the first run, and a path where it cannot write the report prints an `UNAVAILABLE TLC_HTML_REPORT=...` line with the remedy and exits 3. It replaces the report in one step, and a written report leaves `stdout` and the exit status as they are without one. If the write fails after the runs, the runner prints the same line and exits 1 when a run failed and 3 otherwise. `tlc.py ready` and `mutate.py` ignore the variable. Copy [`examples/tla-template/`](../examples/tla-template/BoundedQueue.tla) to start a spec and its matrix.
|
|
5
|
+
- **Matrix runner ([`scripts/tlc-matrix.sh`](../scripts/tlc-matrix.sh))**: runs TLC (or the native `everystate` engine with `-lncheck final` when `TLC_ENGINE=everystate`, requiring no JDK or JAR) with a matrix of constants. It prints an `ENGINE` line naming the checker and version before the first run, then one `PASS` or `FAIL` per run with its state count, then a `SUMMARY` line with the totals (tagged with `(everystate <version>)` when using `everystate`). Stops each run after sixty minutes, or after the limit in `TLC_TIMEOUT` as [setup](setup.md) describes, and forwards periodic elapsed-time and `Progress(...)` updates to `stderr` during long runs. A failing run prints its error trace reduced by [`scripts/tlc_trace.py`](../scripts/tlc_trace.py) to the variables each step changed. Before it checks the engine, the runner rejects each matrix line that could change the cfg beyond itself: a check name, reach or symmetry operator or constant name that is not a TLA+ identifier or is a TLA+ reserved word; a check name, symmetry operator or constant name that is a cfg keyword; and a constant value that holds a comment opener, a string that it does not close, or a cfg keyword outside a string that is not the whole value or a whole set element. So `Mode=INIT`, `Mode={TYPE,VIEW}`, `Mode="INIT"` and `reach INIT | label` pass, and `FailAt={}PROPERTIES` stops the runner. A constant value cannot hold a backslash inside a string either: TLC keeps the backslash and the character after it, while everystate reads the pair as a TLA+ escape, so `Tag="a\"b"` would give the two engines different models. It prints a `FAIL <matrix>:<line>:` line for each and exits 2, and `mutate.py` does the same. Set `TLC_HTML_REPORT=<path>` to also write a self-contained offline HTML report through [`scripts/tlc_report.py`](../scripts/tlc_report.py) with the active engine metadata, the run table, an interactive native SVG state chain, a variable diff panel, and copyable Mermaid `stateDiagram-v2` source for each failing and `reach` witness trace. The runner checks the path after checking the TLA+ engine and before the first run, and a path where it cannot write the report prints an `UNAVAILABLE TLC_HTML_REPORT=...` line with the remedy and exits 3. It replaces the report in one step, and a written report leaves `stdout` and the exit status as they are without one. If the write fails after the runs, the runner prints the same line and exits 1 when a run failed and 3 otherwise. `tlc.py ready` and `mutate.py` ignore the variable. Copy [`examples/tla-template/`](../examples/tla-template/BoundedQueue.tla) to start a spec and its matrix.
|
|
6
6
|
- **Symmetry**: one `symmetry <Operator>` line in a matrix `spec` section adds `SYMMETRY <Operator>` to the cfg of each run and `reach` check of that section, wherever the line stands in it, and to the mutation runs that [`scripts/mutate.py`](../scripts/mutate.py) takes from the section. Both engines read the line. The line of each run and `reach` check of the section says `under symmetry <Operator>`, after the state count when a run passes and before the colon otherwise, as in `PASS BoundedQueue window=4 items=5 workers=3 8019 distinct states found under symmetry Perms`, where 8019 counts one state for each set of states that the symmetry merges. The run's row in the `TLC_HTML_REPORT` table and the title of its trace add the same words to its label. The mutation runner adds them after the run's name in a `DETECTED` line, and a `MISSED` line names each run that passed under symmetry, as in `MISSED <label>: run 'three' passes under symmetry Perms`. In a section that checks a `PROPERTY` or `PROPERTIES`, or that has two `symmetry` lines, the runner prints a `FAIL` line, runs the section without symmetry and exits 1. The mutation runner and the baseline helper stop on that line before any run. The [TLA+ brief](tla-brief.md) says when symmetry is sound.
|
|
7
7
|
- **Baseline helper ([`scripts/baseline.py`](../scripts/baseline.py))** on a TLA+ model:
|
|
8
8
|
- In the output of `compare`:
|
|
@@ -27,7 +27,8 @@ symmetry operator or constant name that is not a TLA+ identifier or is a TLA+
|
|
|
27
27
|
reserved word; a check name, symmetry operator or constant name that is a cfg
|
|
28
28
|
keyword; and a constant value that holds a comment opener, a string that it does
|
|
29
29
|
not close, or a cfg keyword outside a string that is not the whole value or a
|
|
30
|
-
whole set element.
|
|
30
|
+
whole set element. So does a constant value with a backslash inside a string,
|
|
31
|
+
which TLC and everystate read differently.
|
|
31
32
|
|
|
32
33
|
Usage: tlc-matrix.sh <matrix-file> [label-substring]
|
|
33
34
|
TLC_ENGINE=<name> TLA+ engine: tlc (default) or everystate
|
|
@@ -172,7 +173,8 @@ def name_problem(name):
|
|
|
172
173
|
|
|
173
174
|
|
|
174
175
|
def value_problem(value):
|
|
175
|
-
"""Return why a constant's value could end early and start a cfg statement
|
|
176
|
+
"""Return why a constant's value could end early and start a cfg statement, hide the ones after it, or give
|
|
177
|
+
TLC and everystate different models, or None.
|
|
176
178
|
|
|
177
179
|
TLC 1.7.4 and everystate 0.4.6 read a closed string as one token, and a cfg keyword that is the whole value or
|
|
178
180
|
a whole set element as a model value, so a keyword counts only in any other place.
|
|
@@ -190,6 +192,9 @@ def value_problem(value):
|
|
|
190
192
|
return f"holds the comment opener {opener}"
|
|
191
193
|
if not CLOSED_STRINGS.fullmatch(value):
|
|
192
194
|
return "opens a string that it does not close"
|
|
195
|
+
# TLC 1.7.4 keeps a string's backslash and the character after it, and everystate 0.4.6 reads the pair as one escape.
|
|
196
|
+
if any(token.startswith('"') and "\\" in token for token in tokens):
|
|
197
|
+
return "holds a backslash inside a string, which TLC and everystate read differently"
|
|
193
198
|
return None
|
|
194
199
|
|
|
195
200
|
|