tla-ts 0.0.3 → 0.0.4-dev.2be6058
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/README.md +32 -12
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +160 -8
- package/dist/index.d.ts +160 -8
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +2 -2
- package/dist/parallel-worker.js +2 -2
- package/dist/parallel.cjs +1 -1
- package/dist/parallel.js +2 -2
- package/dist/run-cli.cjs +45 -18
- package/dist/run-cli.js +45 -18
- package/dist/transfer.cjs +1393 -18
- package/dist/transfer.js +1393 -18
- package/package.json +5 -1
- package/src/ast.ts +147 -6
- package/src/bags.ts +4 -7
- package/src/builtins.ts +29 -11
- package/src/bundled-modules.ts +3 -3
- package/src/canonical.ts +4 -3
- package/src/check.ts +1539 -235
- package/src/cli-options.ts +11 -5
- package/src/cli.ts +8 -1
- package/src/codegen.ts +77 -37
- package/src/config.ts +254 -181
- package/src/dependencies.ts +2 -2
- package/src/environment.ts +540 -140
- package/src/errors.ts +224 -3
- package/src/evaluate.ts +797 -246
- package/src/exit-codes.ts +22 -43
- package/src/fingerprints.ts +46 -11
- package/src/index.ts +1 -0
- package/src/instances.ts +19 -16
- package/src/java-overrides.ts +104 -25
- package/src/levels.ts +191 -45
- package/src/lexer.ts +127 -30
- package/src/live-check.ts +867 -0
- package/src/liveness.ts +218 -572
- package/src/obligation-expression.ts +2 -2
- package/src/obligation-source.ts +2 -0
- package/src/parallel-worker.ts +174 -213
- package/src/parallel.ts +131 -39
- package/src/parser.ts +456 -147
- package/src/pcal-ast.ts +770 -0
- package/src/pcal-parse.ts +1523 -0
- package/src/pcal-tokenize.ts +516 -0
- package/src/pcal-translate.ts +1230 -0
- package/src/pcal-validate.ts +454 -0
- package/src/randomization.ts +24 -7
- package/src/resolve.ts +1481 -426
- package/src/run-cli.ts +1212 -143
- package/src/runtime.ts +19 -1
- package/src/sany-builtins.ts +147 -0
- package/src/sany-generator.ts +3128 -0
- package/src/sany-levels.ts +1208 -0
- package/src/sany-lexer.ts +545 -0
- package/src/sany-linter.ts +122 -0
- package/src/sany-modules.ts +1398 -0
- package/src/sany-nodes.ts +463 -0
- package/src/sany-parse-error.ts +2161 -0
- package/src/sany-report.ts +356 -0
- package/src/sany-selectors.ts +738 -0
- package/src/sany-source.ts +248 -0
- package/src/sany-xml.ts +1017 -0
- package/src/spec-description.ts +42 -11
- package/src/standard-modules.ts +200 -148
- package/src/standard-ranges.ts +116 -0
- package/src/state-graph.ts +180 -0
- package/src/subexpressions.ts +231 -171
- package/src/substitution-levels.ts +38 -17
- package/src/successors.ts +219 -107
- package/src/symmetry.ts +194 -54
- package/src/tableau.ts +54 -25
- package/src/tlc-ext.ts +42 -29
- package/src/tlc-messages.ts +329 -0
- package/src/tlc-module.ts +52 -43
- package/src/tlc-modules.ts +4 -0
- package/src/tlc-order.ts +78 -10
- package/src/tlc-random.ts +37 -9
- package/src/tlc-replay.ts +655 -0
- package/src/tlc-summary.ts +20 -5
- package/src/tlc-version.ts +18 -0
- package/src/transfer.ts +15 -3
- package/src/value-sources.ts +29 -0
- package/src/values.ts +731 -184
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ The options are:
|
|
|
50
50
|
|
|
51
51
|
- `-config <Spec.cfg>`: read the configuration from this file. You can use it only when you check one spec.
|
|
52
52
|
- `-deadlock`: don't report deadlocks.
|
|
53
|
+
- `-dump [dot[,colorize][,actionlabels][,snapshot]] <file>`: write every reachable state to `<file>.dump`, or with `dot`, the state graph to `<file>.dot`. The output matches TLC run with `-fp 0`. tla-ts doesn't support the `constrained`, `stuttering`, or `strict` formats.
|
|
53
54
|
- `-lncheck final`: check liveness once, after the search ends.
|
|
54
55
|
- `-seed <num>`: seed `RandomElement` and the `Randomization` module. The default is 0.
|
|
55
56
|
- `-workers <count|auto>`: search with this number of worker threads. `auto` uses one thread per core. The default is 1.
|
|
@@ -107,17 +108,20 @@ const result = await check({
|
|
|
107
108
|
});
|
|
108
109
|
```
|
|
109
110
|
|
|
110
|
-
| Option | Description
|
|
111
|
-
| ----------------------- |
|
|
112
|
-
| `source` | The TLA+ module to check
|
|
113
|
-
| `config` | A TLC configuration, as text or as the result of `parseConfig`
|
|
114
|
-
| `loadModule` | Returns the source of a module that isn't a standard module
|
|
115
|
-
| `loadClass` | Returns a compiled Java class that overrides a module's operators with constants
|
|
116
|
-
| `onPrint` | Receives the output of `Print` and `PrintT`. Defaults to `console.log`
|
|
117
|
-
| `onPause` | Runs when `TLCSet("pause", TRUE)` pauses checking, which resumes when it returns
|
|
118
|
-
| `readFile`, `writeFile` | Read and write files for the Json module
|
|
119
|
-
| `seed` | A `bigint` seed. Defaults to `0n`, and matches TLC run with the same `-seed` and `-fp 0`
|
|
120
|
-
| `workers` | The number of worker threads. Defaults to 1
|
|
111
|
+
| Option | Description |
|
|
112
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
113
|
+
| `source` | The TLA+ module to check |
|
|
114
|
+
| `config` | A TLC configuration, as text or as the result of `parseConfig` |
|
|
115
|
+
| `loadModule` | Returns the source of a module that isn't a standard module, or of Bags, Json, Randomization, or TLCExt to read in place of tla-ts's own |
|
|
116
|
+
| `loadClass` | Returns a compiled Java class that overrides a module's operators with constants |
|
|
117
|
+
| `onPrint` | Receives the output of `Print` and `PrintT`. Defaults to `console.log` |
|
|
118
|
+
| `onPause` | Runs when `TLCSet("pause", TRUE)` pauses checking, which resumes when it returns |
|
|
119
|
+
| `readFile`, `writeFile` | Read and write files for the Json module and `dump` |
|
|
120
|
+
| `seed` | A `bigint` seed. Defaults to `0n`, and matches TLC run with the same `-seed` and `-fp 0` |
|
|
121
|
+
| `workers` | The number of worker threads. Defaults to 1 |
|
|
122
|
+
| `dump` | Writes the reachable states or the state graph, as TLC's `-dump` does |
|
|
123
|
+
|
|
124
|
+
`dump` takes the `path` that `check` passes to `writeFile` before it returns. Set `dot` to write the state graph in the DOT language of Graphviz, and `colorize`, `actionLabels`, or `snapshot` for TLC's formats of the same names. A dump checks the spec on the calling thread, as one TLC worker does.
|
|
121
125
|
|
|
122
126
|
The result has these fields:
|
|
123
127
|
|
|
@@ -126,7 +130,14 @@ The result has these fields:
|
|
|
126
130
|
- `failure`: the message and trace when `status` is `"error"`.
|
|
127
131
|
- `generatedStates`, `distinctStates`, and `depth`: TLC's state counts.
|
|
128
132
|
|
|
129
|
-
Workers run in Node, Bun, Deno, and the browser,
|
|
133
|
+
Workers run in Node, Bun, Deno, and cross-origin isolated pages in the browser. Like TLC's workers, they share one table of 64-bit fingerprints. `check` runs on the calling thread in these cases:
|
|
134
|
+
|
|
135
|
+
- `SharedArrayBuffer` is unavailable, as on a page without cross-origin isolation.
|
|
136
|
+
- The spec has liveness properties.
|
|
137
|
+
- The spec uses impure operators such as `Print`.
|
|
138
|
+
- The configuration has `VIEW`, `POSTCONDITION`, or `_POSSIBLE`.
|
|
139
|
+
|
|
140
|
+
After a violation or an error, `check` reruns on the calling thread to return TLC's exact trace.
|
|
130
141
|
|
|
131
142
|
`check` supports:
|
|
132
143
|
|
|
@@ -190,6 +201,15 @@ Wall time on one worker, including JVM and Node startup. Both checkers report th
|
|
|
190
201
|
| [Bounded queue](packages/tla-ts/benchmarks/queue) | 44,044 | 0.37 s | 0.17 s | 2.2× |
|
|
191
202
|
| 542 conformance models | | 986.6 s | 403.3 s | 2.4× |
|
|
192
203
|
|
|
204
|
+
Wall time on 8 workers, also including startup. Each time is the median of 3 runs on an Apple M4 Pro.
|
|
205
|
+
|
|
206
|
+
| Spec | Distinct states | TLC | tla-ts | Speedup |
|
|
207
|
+
| --------------------------------------------------------------------------------------------------------------------- | --------------: | ------: | -----: | ------: |
|
|
208
|
+
| [Raft with reconfiguration](https://github.com/will62794/tla-web/blob/8193eb0/specs/RaftWithReconfigSingleServer.tla) | 298,493 | 10.50 s | 8.96 s | 1.2× |
|
|
209
|
+
| [Sailfish](https://github.com/tlaplus/Examples/tree/0cab2b3/specifications/dag-consensus) | 109,604 | 4.34 s | 4.07 s | 1.1× |
|
|
210
|
+
| [Fast Paxos](https://github.com/tlaplus/Examples/tree/0cab2b3/specifications/SimplifiedFastPaxos) | 25,617 | 3.91 s | 2.57 s | 1.5× |
|
|
211
|
+
| [Buffered random access file](https://github.com/tlaplus/Examples/tree/0cab2b3/specifications/braf) | 3,316 | 4.70 s | 3.61 s | 1.3× |
|
|
212
|
+
|
|
193
213
|
## Development
|
|
194
214
|
|
|
195
215
|
```shell
|
package/dist/cli.cjs
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
require("node:module").enableCompileCache?.(),Promise.resolve().then(()=>require("./run-cli.cjs")).then(e=>e.runCli());
|
|
10
|
+
let e=require("node:module"),t=require("node:path");const n=process.argv.find(e=>e.startsWith(`-Djava.io.tmpdir=`))?.slice(17);e.enableCompileCache?.(n&&(0,t.join)(n,`node-compile-cache`)),Promise.resolve().then(()=>require("./run-cli.cjs")).then(e=>e.runCli());
|
package/dist/cli.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
import{enableCompileCache as e}from"node:module";e?.(),import(`./run-cli.js`).then(e=>e.runCli());
|
|
10
|
+
import{enableCompileCache as e}from"node:module";import{join as t}from"node:path";const n=process.argv.find(e=>e.startsWith(`-Djava.io.tmpdir=`))?.slice(17);e?.(n&&t(n,`node-compile-cache`)),import(`./run-cli.js`).then(e=>e.runCli());
|
package/dist/index.cjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./transfer.cjs"),t=require("./parallel.cjs");exports.TlaConfigError=e.
|
|
9
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./transfer.cjs"),t=require("./parallel.cjs");exports.TlaConfigError=e.at,exports.TlaError=e.ot,exports.TlaEvaluationError=e.st,exports.TlaSyntaxError=e.ft,exports.TlaUnsupportedError=e.pt,exports.check=t.t,exports.formatValue=e.q,exports.parseConfig=e.Z,exports.parseModule=e.D;
|
package/dist/index.d.cts
CHANGED
|
@@ -38,32 +38,42 @@ interface StringExpression {
|
|
|
38
38
|
interface IdentifierExpression {
|
|
39
39
|
kind: "Identifier";
|
|
40
40
|
name: string;
|
|
41
|
+
spelling?: string;
|
|
42
|
+
selectorRanges?: SourceRange[];
|
|
41
43
|
location: SourceLocation;
|
|
42
44
|
resolution?: LocalResolution;
|
|
43
45
|
}
|
|
44
46
|
interface ApplyExpression {
|
|
45
47
|
kind: "Apply";
|
|
46
48
|
operator: string;
|
|
49
|
+
spelling?: string;
|
|
47
50
|
args: Expression[];
|
|
48
51
|
argumentCounts?: number[];
|
|
52
|
+
argumentsRange?: SourceRange;
|
|
53
|
+
selectorRanges?: SourceRange[];
|
|
54
|
+
argumentRanges?: (SourceRange | undefined)[];
|
|
49
55
|
location: SourceLocation;
|
|
50
56
|
resolution?: LocalResolution;
|
|
51
57
|
}
|
|
52
58
|
interface OperatorReferenceExpression {
|
|
53
59
|
kind: "OperatorReference";
|
|
54
60
|
operator: string;
|
|
61
|
+
spelling?: string;
|
|
55
62
|
location: SourceLocation;
|
|
56
63
|
}
|
|
57
64
|
interface LambdaExpression {
|
|
58
65
|
kind: "Lambda";
|
|
59
66
|
params: string[];
|
|
67
|
+
paramRanges?: SourceRange[];
|
|
60
68
|
body: Expression;
|
|
69
|
+
operator?: string;
|
|
61
70
|
location: SourceLocation;
|
|
62
71
|
}
|
|
63
72
|
interface JunctionExpression {
|
|
64
73
|
kind: "And" | "Or";
|
|
65
74
|
operands: Expression[];
|
|
66
75
|
isBulleted?: boolean;
|
|
76
|
+
prefixEnds?: SourceLocation[];
|
|
67
77
|
location: SourceLocation;
|
|
68
78
|
}
|
|
69
79
|
interface PrimeExpression {
|
|
@@ -108,9 +118,11 @@ interface LetExpression {
|
|
|
108
118
|
type BoundPattern = {
|
|
109
119
|
kind: "Name";
|
|
110
120
|
name: string;
|
|
121
|
+
ranges?: SourceRange[];
|
|
111
122
|
} | {
|
|
112
123
|
kind: "Tuple";
|
|
113
124
|
names: string[];
|
|
125
|
+
ranges?: SourceRange[];
|
|
114
126
|
};
|
|
115
127
|
interface Bound {
|
|
116
128
|
pattern: BoundPattern;
|
|
@@ -126,6 +138,7 @@ interface UnboundedQuantifierExpression {
|
|
|
126
138
|
kind: "UnboundedQuantifier";
|
|
127
139
|
quantifier: "Forall" | "Exists";
|
|
128
140
|
names: string[];
|
|
141
|
+
nameRanges?: SourceRange[];
|
|
129
142
|
isTemporal?: boolean;
|
|
130
143
|
body: Expression;
|
|
131
144
|
location: SourceLocation;
|
|
@@ -175,6 +188,7 @@ interface FunctionSetExpression {
|
|
|
175
188
|
interface RecordField {
|
|
176
189
|
name: string;
|
|
177
190
|
value: Expression;
|
|
191
|
+
location: SourceLocation;
|
|
178
192
|
}
|
|
179
193
|
interface RecordExpression {
|
|
180
194
|
kind: "Record" | "RecordSet";
|
|
@@ -208,6 +222,11 @@ interface FunctionApplicationExpression {
|
|
|
208
222
|
args: Expression[];
|
|
209
223
|
location: SourceLocation;
|
|
210
224
|
}
|
|
225
|
+
interface BracketExpression {
|
|
226
|
+
kind: "Bracket";
|
|
227
|
+
args: Expression[];
|
|
228
|
+
location: SourceLocation;
|
|
229
|
+
}
|
|
211
230
|
interface FieldAccessExpression {
|
|
212
231
|
kind: "FieldAccess";
|
|
213
232
|
record: Expression;
|
|
@@ -241,6 +260,7 @@ interface LabelExpression {
|
|
|
241
260
|
kind: "Label";
|
|
242
261
|
name: string;
|
|
243
262
|
params: string[];
|
|
263
|
+
paramRanges?: SourceRange[];
|
|
244
264
|
body: Expression;
|
|
245
265
|
location: SourceLocation;
|
|
246
266
|
}
|
|
@@ -262,9 +282,11 @@ type Selector = {
|
|
|
262
282
|
interface SubexpressionExpression {
|
|
263
283
|
kind: "Subexpression";
|
|
264
284
|
selectors: Selector[];
|
|
285
|
+
selectorRanges?: SourceRange[];
|
|
286
|
+
argumentRanges?: (SourceRange | undefined)[];
|
|
265
287
|
location: SourceLocation;
|
|
266
288
|
}
|
|
267
|
-
type Expression = NumberExpression | DecimalExpression | StringExpression | IdentifierExpression | ApplyExpression | OperatorReferenceExpression | LambdaExpression | JunctionExpression | PrimeExpression | UnchangedExpression | EnabledExpression | IfExpression | CaseExpression | LetExpression | QuantifierExpression | UnboundedQuantifierExpression | ChooseExpression | SetEnumerationExpression | SetFilterExpression | SetMapExpression | TupleExpression | FunctionConstructionExpression | FunctionSetExpression | RecordExpression | ExceptExpression | ExceptAtExpression | FunctionApplicationExpression | FieldAccessExpression | ProductExpression | TemporalExpression | ActionExpression | FairnessExpression | LabelExpression | SubexpressionExpression;
|
|
289
|
+
type Expression = NumberExpression | DecimalExpression | StringExpression | IdentifierExpression | ApplyExpression | OperatorReferenceExpression | LambdaExpression | JunctionExpression | PrimeExpression | UnchangedExpression | EnabledExpression | IfExpression | CaseExpression | LetExpression | QuantifierExpression | UnboundedQuantifierExpression | ChooseExpression | SetEnumerationExpression | SetFilterExpression | SetMapExpression | TupleExpression | FunctionConstructionExpression | FunctionSetExpression | RecordExpression | ExceptExpression | ExceptAtExpression | FunctionApplicationExpression | BracketExpression | FieldAccessExpression | ProductExpression | TemporalExpression | ActionExpression | FairnessExpression | LabelExpression | SubexpressionExpression;
|
|
268
290
|
interface OperatorParam {
|
|
269
291
|
name: string;
|
|
270
292
|
arity: number;
|
|
@@ -287,6 +309,7 @@ interface FunctionDefinition {
|
|
|
287
309
|
body: Expression;
|
|
288
310
|
isLocal: boolean;
|
|
289
311
|
isRecursive: boolean;
|
|
312
|
+
isSelfReferential?: boolean;
|
|
290
313
|
location: SourceLocation;
|
|
291
314
|
}
|
|
292
315
|
type Definition = OperatorDefinition | FunctionDefinition;
|
|
@@ -303,6 +326,7 @@ interface Assumption {
|
|
|
303
326
|
}
|
|
304
327
|
interface InstanceSubstitution {
|
|
305
328
|
name: string;
|
|
329
|
+
nameRange: SourceRange;
|
|
306
330
|
expression: Expression;
|
|
307
331
|
}
|
|
308
332
|
interface Instance {
|
|
@@ -322,6 +346,7 @@ interface NewSymbol {
|
|
|
322
346
|
arity: number;
|
|
323
347
|
level: "Constant" | "Variable" | "State" | "Action" | "Temporal";
|
|
324
348
|
set: Expression | undefined;
|
|
349
|
+
nameRange?: SourceRange;
|
|
325
350
|
location: SourceLocation;
|
|
326
351
|
}
|
|
327
352
|
interface AssumeProve {
|
|
@@ -371,6 +396,7 @@ type StepBody = UseOrHide | Instance | DefineStep | {
|
|
|
371
396
|
} | {
|
|
372
397
|
kind: "Take";
|
|
373
398
|
names: string[];
|
|
399
|
+
nameRanges?: SourceRange[];
|
|
374
400
|
bounds: Bound[];
|
|
375
401
|
} | {
|
|
376
402
|
kind: "Witness";
|
|
@@ -378,6 +404,7 @@ type StepBody = UseOrHide | Instance | DefineStep | {
|
|
|
378
404
|
} | {
|
|
379
405
|
kind: "Pick";
|
|
380
406
|
names: string[];
|
|
407
|
+
nameRanges?: SourceRange[];
|
|
381
408
|
bounds: Bound[];
|
|
382
409
|
body: Expression;
|
|
383
410
|
} | {
|
|
@@ -395,6 +422,7 @@ interface ProofStep {
|
|
|
395
422
|
token: string;
|
|
396
423
|
body: StepBody;
|
|
397
424
|
head: SourceRange;
|
|
425
|
+
statement: SourceRange;
|
|
398
426
|
proof: Proof | undefined;
|
|
399
427
|
location: SourceLocation;
|
|
400
428
|
}
|
|
@@ -405,11 +433,9 @@ interface Theorem {
|
|
|
405
433
|
location: SourceLocation;
|
|
406
434
|
}
|
|
407
435
|
type ModuleUnit = {
|
|
408
|
-
kind: "Constants";
|
|
409
|
-
declarations: Declaration[];
|
|
410
|
-
} | {
|
|
411
|
-
kind: "Variables";
|
|
436
|
+
kind: "Constants" | "Variables";
|
|
412
437
|
declarations: Declaration[];
|
|
438
|
+
location: SourceLocation;
|
|
413
439
|
} | {
|
|
414
440
|
kind: "Recursive";
|
|
415
441
|
declarations: Declaration[];
|
|
@@ -447,6 +473,7 @@ interface Module {
|
|
|
447
473
|
uses: UseOrHide[];
|
|
448
474
|
units: ModuleUnit[];
|
|
449
475
|
}
|
|
476
|
+
type TlcVersion = "1.7.4" | "master";
|
|
450
477
|
type ConfigValue = {
|
|
451
478
|
kind: "Number";
|
|
452
479
|
value: number;
|
|
@@ -493,7 +520,13 @@ interface ModelConfig {
|
|
|
493
520
|
periodic: string | undefined;
|
|
494
521
|
rlReward: string | undefined;
|
|
495
522
|
}
|
|
496
|
-
export declare const parseConfig: (source: string) => ModelConfig;
|
|
523
|
+
export declare const parseConfig: (source: string, version?: TlcVersion) => ModelConfig;
|
|
524
|
+
interface JavaOverride {
|
|
525
|
+
module: string;
|
|
526
|
+
operator: string;
|
|
527
|
+
signature: string;
|
|
528
|
+
isMatched: boolean;
|
|
529
|
+
}
|
|
497
530
|
export declare class TlaError extends Error {
|
|
498
531
|
constructor(message: string, cause?: unknown);
|
|
499
532
|
}
|
|
@@ -503,9 +536,20 @@ interface SyntaxFailure {
|
|
|
503
536
|
column: number;
|
|
504
537
|
isEnd: boolean;
|
|
505
538
|
}
|
|
539
|
+
interface SanyError {
|
|
540
|
+
location: string;
|
|
541
|
+
message: string;
|
|
542
|
+
}
|
|
543
|
+
interface SanyReport {
|
|
544
|
+
errors: SanyError[];
|
|
545
|
+
warnings: SanyError[];
|
|
546
|
+
isFatal: boolean;
|
|
547
|
+
parseError?: string;
|
|
548
|
+
}
|
|
506
549
|
export declare class TlaSyntaxError extends TlaError {
|
|
507
550
|
failure: SyntaxFailure | undefined;
|
|
508
|
-
|
|
551
|
+
sany: SanyReport | undefined;
|
|
552
|
+
constructor(message: string, cause?: unknown, failure?: SyntaxFailure, sany?: SanyReport);
|
|
509
553
|
}
|
|
510
554
|
export declare class TlaConfigError extends TlaError {
|
|
511
555
|
constructor(message: string, cause?: unknown);
|
|
@@ -520,6 +564,7 @@ interface ModelValue {
|
|
|
520
564
|
kind: "ModelValue";
|
|
521
565
|
name: string;
|
|
522
566
|
type: string | undefined;
|
|
567
|
+
rank: number;
|
|
523
568
|
}
|
|
524
569
|
interface SetValue {
|
|
525
570
|
kind: "Set";
|
|
@@ -538,6 +583,7 @@ interface FunctionValue {
|
|
|
538
583
|
hash: number;
|
|
539
584
|
fingerprint: number;
|
|
540
585
|
writtenKeys: Value[] | undefined;
|
|
586
|
+
functionClass: FunctionClass | undefined;
|
|
541
587
|
}
|
|
542
588
|
interface IntervalValue {
|
|
543
589
|
kind: "Interval";
|
|
@@ -576,10 +622,15 @@ interface SetOperationValue {
|
|
|
576
622
|
left: Value;
|
|
577
623
|
right: Value;
|
|
578
624
|
}
|
|
625
|
+
interface FilteredSetSource {
|
|
626
|
+
names: string;
|
|
627
|
+
predicate: string;
|
|
628
|
+
}
|
|
579
629
|
interface FilteredSetValue {
|
|
580
630
|
kind: "FilteredSet";
|
|
581
631
|
base: Value;
|
|
582
632
|
test: (element: Value) => boolean;
|
|
633
|
+
source?: FilteredSetSource;
|
|
583
634
|
}
|
|
584
635
|
interface UnionValue {
|
|
585
636
|
kind: "Union";
|
|
@@ -598,9 +649,22 @@ interface LazyFunctionValue {
|
|
|
598
649
|
domain: Value;
|
|
599
650
|
apply: (argument: Value) => Value;
|
|
600
651
|
source?: LazyFunctionSource;
|
|
652
|
+
functionClass?: FunctionClass;
|
|
601
653
|
}
|
|
602
654
|
type Value = boolean | number | string | ModelValue | SetValue | MixedSetValue | FunctionValue | IntervalValue | InfiniteSetValue | SubsetValue | FunctionSetValue | RecordSetValue | ProductSetValue | SequenceSetValue | SetOperationValue | FilteredSetValue | UnionValue | LazyFunctionValue;
|
|
655
|
+
type FunctionClass = "lambda" | "tuple" | "record";
|
|
603
656
|
export declare const formatValue: (value: Value, isStrict?: boolean, isNormalized?: boolean) => string;
|
|
657
|
+
interface FingerprintFailure {
|
|
658
|
+
sources: Expression[];
|
|
659
|
+
reason: string;
|
|
660
|
+
}
|
|
661
|
+
interface StateDump {
|
|
662
|
+
path: string;
|
|
663
|
+
dot?: boolean;
|
|
664
|
+
colorize?: boolean;
|
|
665
|
+
actionLabels?: boolean;
|
|
666
|
+
snapshot?: boolean;
|
|
667
|
+
}
|
|
604
668
|
interface CheckOptions {
|
|
605
669
|
source: string;
|
|
606
670
|
config: string | ModelConfig;
|
|
@@ -613,32 +677,111 @@ interface CheckOptions {
|
|
|
613
677
|
seed?: bigint;
|
|
614
678
|
workers?: number;
|
|
615
679
|
livenessCheck?: "default" | "final";
|
|
680
|
+
dump?: StateDump;
|
|
681
|
+
isTool?: boolean;
|
|
682
|
+
isTraceRecorded?: boolean;
|
|
683
|
+
isSanyReported?: boolean;
|
|
684
|
+
isWarningEnabled?: boolean;
|
|
685
|
+
version?: TlcVersion;
|
|
686
|
+
onProgress?: (progress: CheckProgress) => void;
|
|
687
|
+
}
|
|
688
|
+
interface InitialStatesProgress {
|
|
689
|
+
kind: "initial-states-progress";
|
|
690
|
+
count: number;
|
|
691
|
+
}
|
|
692
|
+
interface InitialStateViolation {
|
|
693
|
+
kind: "initial-state-violation";
|
|
694
|
+
status: "invariant-violation" | "liveness-violation";
|
|
695
|
+
name: string;
|
|
696
|
+
state: Record<string, Value>;
|
|
616
697
|
}
|
|
698
|
+
type OutputLine = string | InitialStatesProgress | InitialStateViolation;
|
|
699
|
+
type CheckProgress = {
|
|
700
|
+
kind: "parsed";
|
|
701
|
+
} | {
|
|
702
|
+
kind: "constant-level-invariant";
|
|
703
|
+
name: string;
|
|
704
|
+
} | {
|
|
705
|
+
kind: "state-level-property";
|
|
706
|
+
name: string;
|
|
707
|
+
} | {
|
|
708
|
+
kind: "liveness-initializing";
|
|
709
|
+
isSymmetric: boolean;
|
|
710
|
+
isConstrained: boolean;
|
|
711
|
+
} | {
|
|
712
|
+
kind: "liveness-prepared";
|
|
713
|
+
branches: number;
|
|
714
|
+
} | {
|
|
715
|
+
kind: "initial-states-started";
|
|
716
|
+
} | InitialStatesProgress | {
|
|
717
|
+
kind: "initial-states-computed";
|
|
718
|
+
initialStates: InitialStates;
|
|
719
|
+
} | {
|
|
720
|
+
kind: "progress";
|
|
721
|
+
statistics: SearchStatistics;
|
|
722
|
+
} | {
|
|
723
|
+
kind: "liveness-started";
|
|
724
|
+
branches: number;
|
|
725
|
+
isComplete: boolean;
|
|
726
|
+
states: number;
|
|
727
|
+
statistics: SearchStatistics;
|
|
728
|
+
} | {
|
|
729
|
+
kind: "liveness-finished";
|
|
730
|
+
} | {
|
|
731
|
+
kind: "warning";
|
|
732
|
+
code: number;
|
|
733
|
+
text: string;
|
|
734
|
+
} | ({
|
|
735
|
+
kind: "java-override";
|
|
736
|
+
} & JavaOverride);
|
|
737
|
+
interface SearchStatistics extends Pick<CheckResult, "generatedStates" | "distinctStates" | "queuedStates" | "depth"> {}
|
|
617
738
|
type CheckStatus = "success" | "assumption-violation" | "invariant-violation" | "property-violation" | "liveness-violation" | "postcondition-violation" | "deadlock" | "error";
|
|
618
739
|
interface TraceStep {
|
|
619
740
|
action: string | undefined;
|
|
620
741
|
label: string | undefined;
|
|
621
742
|
state: Record<string, Value>;
|
|
743
|
+
output?: OutputLine[];
|
|
622
744
|
}
|
|
623
745
|
interface Violation {
|
|
624
746
|
name: string;
|
|
747
|
+
properties?: string[];
|
|
625
748
|
trace: TraceStep[];
|
|
749
|
+
traceOutput?: OutputLine[];
|
|
626
750
|
loopStart: number | undefined;
|
|
627
751
|
loopLabel?: string;
|
|
628
752
|
message?: string;
|
|
629
753
|
counts?: string;
|
|
630
754
|
unwitnessed?: Postcondition;
|
|
755
|
+
postcondition?: Postcondition;
|
|
756
|
+
warning?: {
|
|
757
|
+
code: number;
|
|
758
|
+
text: string;
|
|
759
|
+
};
|
|
631
760
|
}
|
|
632
761
|
interface Postcondition {
|
|
633
762
|
name: string;
|
|
763
|
+
code: number;
|
|
634
764
|
message: string;
|
|
635
765
|
counts?: string;
|
|
636
766
|
}
|
|
637
767
|
interface EvaluationFailure {
|
|
768
|
+
code: number;
|
|
638
769
|
message: string;
|
|
770
|
+
toolMessage: string;
|
|
639
771
|
trace: TraceStep[];
|
|
772
|
+
traceOutput?: OutputLine[];
|
|
640
773
|
initialState: Record<string, Value> | undefined;
|
|
641
774
|
exitCode: number;
|
|
775
|
+
callStack: Expression[] | undefined;
|
|
776
|
+
isCallStackFirst?: boolean;
|
|
777
|
+
fingerprint?: FingerprintFailure;
|
|
778
|
+
traceFailure?: FailureMessage;
|
|
779
|
+
postcondition?: Postcondition;
|
|
780
|
+
isWithoutStatistics?: boolean;
|
|
781
|
+
}
|
|
782
|
+
interface InitialStates {
|
|
783
|
+
generated: number;
|
|
784
|
+
distinct: number;
|
|
642
785
|
}
|
|
643
786
|
interface CheckResult {
|
|
644
787
|
status: CheckStatus;
|
|
@@ -648,9 +791,18 @@ interface CheckResult {
|
|
|
648
791
|
distinctStates: number;
|
|
649
792
|
queuedStates: number;
|
|
650
793
|
depth: number;
|
|
794
|
+
initialStates: InitialStates | undefined;
|
|
651
795
|
outDegrees: number[] | undefined;
|
|
652
796
|
fingerprintDistance: bigint | undefined;
|
|
797
|
+
additionalViolation?: Violation;
|
|
798
|
+
liveCallStack?: Expression[];
|
|
799
|
+
violationOutDegrees?: number[];
|
|
800
|
+
}
|
|
801
|
+
interface FailureMessage {
|
|
802
|
+
code: number;
|
|
803
|
+
message: string;
|
|
804
|
+
toolMessage: string;
|
|
653
805
|
}
|
|
654
806
|
export declare const check: (options: CheckOptions) => Promise<CheckResult>;
|
|
655
807
|
export declare const parseModule: (source: string) => Module;
|
|
656
|
-
export type { CheckOptions, CheckResult, CheckStatus, ConfigValue, ConstantAssignment, EvaluationFailure, ModelConfig, Module, Substitution, TraceStep, Value, Violation };
|
|
808
|
+
export type { CheckOptions, CheckProgress, CheckResult, CheckStatus, ConfigValue, ConstantAssignment, EvaluationFailure, ModelConfig, Module, Substitution, TraceStep, Value, Violation };
|