tla-ts 0.0.1 → 0.0.2
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 +34 -41
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +166 -30
- package/dist/index.d.ts +166 -30
- 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 +2 -1
- package/dist/run-cli.js +2 -1
- package/dist/transfer.cjs +388 -39
- package/dist/transfer.js +388 -39
- package/package.json +4 -2
- package/src/ast.ts +82 -5
- package/src/bags.ts +161 -71
- package/src/builtins.ts +203 -23
- package/src/bundled-modules.ts +63 -32
- package/src/check.ts +904 -230
- package/src/codegen.ts +52 -18
- package/src/config.ts +39 -11
- package/src/environment.ts +485 -140
- package/src/errors.ts +22 -0
- package/src/evaluate.ts +486 -136
- package/src/exit-codes.ts +75 -0
- package/src/fingerprints.ts +2 -2
- package/src/index.ts +9 -4
- package/src/instances.ts +221 -66
- package/src/java-overrides.ts +241 -0
- package/src/json.ts +153 -72
- package/src/levels.ts +850 -0
- package/src/lexer.ts +97 -27
- package/src/liveness.ts +47 -91
- package/src/parallel-worker.ts +57 -28
- package/src/parallel.ts +116 -62
- package/src/parser.ts +703 -183
- package/src/pretty-print.ts +259 -0
- package/src/randomization.ts +24 -113
- package/src/resolve.ts +472 -41
- package/src/run-cli.ts +142 -44
- package/src/runtime.ts +63 -28
- package/src/spec-description.ts +509 -0
- package/src/standard-levels.ts +105 -0
- package/src/standard-modules.ts +223 -92
- package/src/subexpressions.ts +21 -35
- package/src/substitution-levels.ts +184 -0
- package/src/successors.ts +261 -46
- package/src/symmetry.ts +65 -21
- package/src/tableau.ts +43 -37
- package/src/tlc-ext.ts +120 -33
- package/src/tlc-module.ts +71 -47
- package/src/tlc-modules.ts +1022 -0
- package/src/tlc-order.ts +497 -0
- package/src/tlc-random.ts +411 -0
- package/src/tlc-summary.ts +109 -0
- package/src/transfer.ts +4 -4
- package/src/values.ts +1186 -164
package/README.md
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
[](https://npmjs.com/package/tla-ts)
|
|
4
4
|
[](https://npmjs.com/package/tla-ts)
|
|
5
5
|
|
|
6
|
-
A TLA+ model checker in TypeScript, **2
|
|
6
|
+
A TLA+ model checker in TypeScript, **2× faster than TLC**.
|
|
7
7
|
|
|
8
8
|
tla-ts checks TLA+ specs with the same verdicts, error traces, and state counts as TLC. It runs in Node and in the browser without a JVM. Try it in the [playground](https://tla-ts.aidenybai.com).
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
import { check } from "tla-ts";
|
|
12
12
|
|
|
13
|
-
const result = check({
|
|
13
|
+
const result = await check({
|
|
14
14
|
source: `---- MODULE Counter ----
|
|
15
15
|
EXTENDS Naturals
|
|
16
16
|
VARIABLE x
|
|
@@ -33,31 +33,27 @@ npm install tla-ts
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
35
35
|
```shell
|
|
36
|
-
npx tla-ts Spec.tla
|
|
37
|
-
npx tla-ts Spec.tla -config Other.cfg -deadlock
|
|
38
|
-
npx tla-ts Spec.tla -workers auto
|
|
36
|
+
npx tla-ts Spec.tla [-config Spec.cfg] [-deadlock] [-lncheck final] [-seed 0] [-workers auto]
|
|
39
37
|
```
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
- `-config`: the TLC configuration. Defaults to `Spec.cfg` next to the spec.
|
|
40
|
+
- `-deadlock`: turns off deadlock checking.
|
|
41
|
+
- `-lncheck final`: checks liveness once, after the search.
|
|
42
|
+
- `-seed`: seeds `RandomElement` and the Randomization module. Defaults to 0.
|
|
43
|
+
- `-workers`: the number of worker threads, or `auto` for one per core. Defaults to 1.
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
| --------: | ---------------------------- |
|
|
45
|
-
| 0 | No error found |
|
|
46
|
-
| 10 | An assumption is false |
|
|
47
|
-
| 11 | Deadlock |
|
|
48
|
-
| 12 | Invariant or property broken |
|
|
49
|
-
| 13 | Liveness violation |
|
|
45
|
+
Output and exit codes match TLC's. The CLI loads a compiled Java class such as `Module.class` from the spec's directory as an override for that module.
|
|
50
46
|
|
|
51
47
|
## API reference
|
|
52
48
|
|
|
53
49
|
### `check`
|
|
54
50
|
|
|
55
|
-
Checks a spec against a TLC configuration and
|
|
51
|
+
Checks a spec against a TLC configuration and resolves to the result.
|
|
56
52
|
|
|
57
53
|
```ts
|
|
58
54
|
import { check } from "tla-ts";
|
|
59
55
|
|
|
60
|
-
const result = check({
|
|
56
|
+
const result = await check({
|
|
61
57
|
source: specSource,
|
|
62
58
|
config: configSource,
|
|
63
59
|
loadModule: (name) => modules[name],
|
|
@@ -65,36 +61,33 @@ const result = check({
|
|
|
65
61
|
});
|
|
66
62
|
```
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
| Option | Description |
|
|
65
|
+
| ----------------------- | ---------------------------------------------------------------------------------------- |
|
|
66
|
+
| `source` | The TLA+ module to check |
|
|
67
|
+
| `config` | A TLC configuration, as text or as the result of `parseConfig` |
|
|
68
|
+
| `loadModule` | Returns the source of a module that isn't a standard module |
|
|
69
|
+
| `loadClass` | Returns a compiled Java class that overrides a module's operators with constants |
|
|
70
|
+
| `onPrint` | Receives the output of `Print` and `PrintT`. Defaults to `console.log` |
|
|
71
|
+
| `onPause` | Runs when `TLCSet("pause", TRUE)` pauses checking, which resumes when it returns |
|
|
72
|
+
| `readFile`, `writeFile` | Read and write files for the Json module |
|
|
73
|
+
| `seed` | A `bigint` seed. Defaults to `0n`, and matches TLC run with the same `-seed` and `-fp 0` |
|
|
74
|
+
| `workers` | The number of worker threads. Defaults to 1 |
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
- `config`: a TLC configuration, as source text or as the result of `parseConfig`
|
|
72
|
-
- `loadModule`: maps a module name to its source, for modules other than the standard modules
|
|
73
|
-
- `onPrint`: receives the output of `Print` and `PrintT`, which defaults to `console.log`
|
|
74
|
-
- `readFile` and `writeFile`: let the Json module read and write files. Without them, it has no file access
|
|
76
|
+
The result has these fields:
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
- `status`: `"success"`, `"deadlock"`, `"assumption-violation"`, `"invariant-violation"`, `"property-violation"`, `"liveness-violation"`, `"postcondition-violation"`, or `"error"`.
|
|
79
|
+
- `violation`: the `name` of what failed and the `trace` that reaches it. `loopStart` marks where a liveness counterexample loops back.
|
|
80
|
+
- `failure`: the message and trace when `status` is `"error"`.
|
|
81
|
+
- `generatedStates`, `distinctStates`, and `depth`: TLC's state counts.
|
|
77
82
|
|
|
78
|
-
`check`
|
|
79
|
-
|
|
80
|
-
- **Standard modules**: Naturals, Integers, Sequences, FiniteSets, TLC, Bags, Reals, RealTime, Toolbox, and the community modules TLCExt, Json, and Randomization
|
|
81
|
-
- **Modules**: `EXTENDS`, nested modules, and `INSTANCE` with `WITH` substitutions, `LAMBDA` substitutions for operator parameters, named instances, parameterized instances, and instances inside `LET`
|
|
82
|
-
- **Configuration**: `INIT`, `NEXT`, `SPECIFICATION`, `CONSTANTS`, `INVARIANTS`, `PROPERTIES`, `CONSTRAINTS`, `ACTION_CONSTRAINTS`, `SYMMETRY`, `VIEW`, `POSTCONDITION`, `CHECK_DEADLOCK`, and `_POSSIBLE` properties
|
|
83
|
-
- **Properties**: invariants, `[][A]_v`, and every temporal formula TLC accepts, checked through TLC's tableau construction under the fairness and temporal conjuncts of the specification
|
|
84
|
-
- **Subexpression references**: selectors such as `F(2)!3`, `Op!<<`, `Op!>>`, `Op!:`, `Op!@`, and `Op!(x)`, labels such as `Op!lab`, and names of `THEOREM` formulas
|
|
85
|
-
- **TLC semantics**: 32-bit integer overflow errors, `ENABLED`, `TLCGet` and `TLCSet` with TLC's counters and registers, and TLC's enumeration order for `CHOOSE` and quantifiers
|
|
86
|
-
|
|
87
|
-
### `checkInParallel`
|
|
88
|
-
|
|
89
|
-
Checks a spec on several worker threads and resolves to the same result as `check`. It takes the options of `check` plus `workers`, and runs in Node, Bun, Deno, and the browser.
|
|
83
|
+
Workers run in Node, Bun, Deno, and the browser, and deduplicate states by 64-bit fingerprint as TLC does. `check` runs on the calling thread for specs with liveness properties or impure operators such as `Print`. After a violation, it reruns there to return the exact trace.
|
|
90
84
|
|
|
91
|
-
|
|
92
|
-
import { checkInParallel } from "tla-ts";
|
|
93
|
-
|
|
94
|
-
const result = await checkInParallel({ source: specSource, config: configSource, workers: 4 });
|
|
95
|
-
```
|
|
85
|
+
`check` supports:
|
|
96
86
|
|
|
97
|
-
|
|
87
|
+
- **Modules**: the standard modules, TLCExt, Json, and Randomization, plus `EXTENDS`, `INSTANCE`, and `LAMBDA`.
|
|
88
|
+
- **Configuration**: `CONSTANTS`, `INIT`, `NEXT`, `SPECIFICATION`, invariants, properties, constraints, `SYMMETRY`, `VIEW`, `ALIAS`, `POSTCONDITION`, `CHECK_DEADLOCK`, and `_POSSIBLE`.
|
|
89
|
+
- **Properties**: invariants and every temporal formula TLC accepts, checked through TLC's tableau construction.
|
|
90
|
+
- **TLC semantics**: 32-bit integer overflow, `TLCGet` and `TLCSet`, subexpression references such as `Op!2`, and TLC's enumeration order for `CHOOSE` and quantifiers.
|
|
98
91
|
|
|
99
92
|
### `parseModule`
|
|
100
93
|
|
|
@@ -116,7 +109,7 @@ import { check, parseConfig } from "tla-ts";
|
|
|
116
109
|
|
|
117
110
|
const config = parseConfig(configSource);
|
|
118
111
|
config.checkDeadlock = false;
|
|
119
|
-
check({ source: specSource, config });
|
|
112
|
+
await check({ source: specSource, config });
|
|
120
113
|
```
|
|
121
114
|
|
|
122
115
|
### `formatValue`
|
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.D,exports.TlaError=e.O,exports.TlaEvaluationError=e.k,exports.TlaSyntaxError=e.A,exports.TlaUnsupportedError=e.j,exports.check=t.t,exports.formatValue=e.S,exports.parseConfig=e.E,exports.parseModule=e._;
|
package/dist/index.d.cts
CHANGED
|
@@ -12,10 +12,22 @@ interface LocalResolution {
|
|
|
12
12
|
interface SourceLocation {
|
|
13
13
|
line: number;
|
|
14
14
|
column: number;
|
|
15
|
+
range?: SourceRange;
|
|
16
|
+
}
|
|
17
|
+
interface SourceRange {
|
|
18
|
+
module: string;
|
|
19
|
+
start: SourceLocation;
|
|
20
|
+
end: SourceLocation;
|
|
15
21
|
}
|
|
16
22
|
interface NumberExpression {
|
|
17
23
|
kind: "Number";
|
|
18
24
|
value: number;
|
|
25
|
+
text?: string;
|
|
26
|
+
location: SourceLocation;
|
|
27
|
+
}
|
|
28
|
+
interface DecimalExpression {
|
|
29
|
+
kind: "Decimal";
|
|
30
|
+
text: string;
|
|
19
31
|
location: SourceLocation;
|
|
20
32
|
}
|
|
21
33
|
interface StringExpression {
|
|
@@ -249,7 +261,7 @@ interface SubexpressionExpression {
|
|
|
249
261
|
selectors: Selector[];
|
|
250
262
|
location: SourceLocation;
|
|
251
263
|
}
|
|
252
|
-
type Expression = NumberExpression | 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;
|
|
264
|
+
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;
|
|
253
265
|
interface OperatorParam {
|
|
254
266
|
name: string;
|
|
255
267
|
arity: number;
|
|
@@ -259,6 +271,7 @@ interface OperatorDefinition {
|
|
|
259
271
|
name: string;
|
|
260
272
|
params: OperatorParam[];
|
|
261
273
|
body: Expression;
|
|
274
|
+
bodyRange?: SourceRange;
|
|
262
275
|
isLocal: boolean;
|
|
263
276
|
isRecursive: boolean;
|
|
264
277
|
location: SourceLocation;
|
|
@@ -276,6 +289,7 @@ type Definition = OperatorDefinition | FunctionDefinition;
|
|
|
276
289
|
interface Declaration {
|
|
277
290
|
name: string;
|
|
278
291
|
arity: number;
|
|
292
|
+
location: SourceLocation;
|
|
279
293
|
}
|
|
280
294
|
interface Assumption {
|
|
281
295
|
name: string | undefined;
|
|
@@ -296,20 +310,101 @@ interface Instance {
|
|
|
296
310
|
isLocal: boolean;
|
|
297
311
|
location: SourceLocation;
|
|
298
312
|
}
|
|
299
|
-
interface
|
|
300
|
-
|
|
301
|
-
|
|
313
|
+
interface NewSymbol {
|
|
314
|
+
kind: "NewSymbol";
|
|
315
|
+
name: string;
|
|
316
|
+
arity: number;
|
|
317
|
+
level: "Constant" | "Variable" | "State" | "Action" | "Temporal";
|
|
318
|
+
set: Expression | undefined;
|
|
319
|
+
location: SourceLocation;
|
|
320
|
+
}
|
|
321
|
+
interface AssumeProve {
|
|
322
|
+
kind: "AssumeProve";
|
|
323
|
+
assumptions: (Expression | NewSymbol | AssumeProve)[];
|
|
324
|
+
conclusion: Expression;
|
|
325
|
+
location: SourceLocation;
|
|
326
|
+
}
|
|
327
|
+
type Fact = Expression | {
|
|
328
|
+
kind: "ModuleFact";
|
|
329
|
+
name: string;
|
|
330
|
+
location: SourceLocation;
|
|
331
|
+
};
|
|
332
|
+
interface UseOrHide {
|
|
333
|
+
kind: "Use" | "Hide";
|
|
334
|
+
isOnly: boolean;
|
|
335
|
+
facts: Fact[];
|
|
336
|
+
defs: Fact[];
|
|
337
|
+
location: SourceLocation;
|
|
338
|
+
}
|
|
339
|
+
type Proof = {
|
|
340
|
+
kind: "Obvious" | "Omitted";
|
|
341
|
+
location: SourceLocation;
|
|
342
|
+
} | {
|
|
343
|
+
kind: "By";
|
|
344
|
+
isOnly: boolean;
|
|
345
|
+
facts: Fact[];
|
|
346
|
+
defs: Fact[];
|
|
347
|
+
location: SourceLocation;
|
|
348
|
+
} | {
|
|
349
|
+
kind: "Steps";
|
|
350
|
+
level: number;
|
|
351
|
+
steps: ProofStep[];
|
|
352
|
+
location: SourceLocation;
|
|
353
|
+
};
|
|
354
|
+
interface DefineStep {
|
|
355
|
+
kind: "Define";
|
|
356
|
+
definitions: (Definition | Instance)[];
|
|
357
|
+
location: SourceLocation;
|
|
358
|
+
}
|
|
359
|
+
type StepBody = UseOrHide | Instance | DefineStep | {
|
|
360
|
+
kind: "Have";
|
|
361
|
+
expression: Expression;
|
|
362
|
+
} | {
|
|
363
|
+
kind: "Take";
|
|
364
|
+
names: string[];
|
|
365
|
+
bounds: Bound[];
|
|
366
|
+
} | {
|
|
367
|
+
kind: "Witness";
|
|
368
|
+
expressions: Expression[];
|
|
369
|
+
} | {
|
|
370
|
+
kind: "Pick";
|
|
371
|
+
names: string[];
|
|
372
|
+
bounds: Bound[];
|
|
373
|
+
body: Expression;
|
|
374
|
+
} | {
|
|
375
|
+
kind: "Case";
|
|
376
|
+
expression: Expression;
|
|
377
|
+
} | {
|
|
378
|
+
kind: "Assert";
|
|
379
|
+
isSuffices: boolean;
|
|
380
|
+
statement: Expression | AssumeProve;
|
|
381
|
+
} | {
|
|
382
|
+
kind: "Qed";
|
|
383
|
+
};
|
|
384
|
+
interface ProofStep {
|
|
385
|
+
name: string | undefined;
|
|
386
|
+
body: StepBody;
|
|
387
|
+
proof: Proof | undefined;
|
|
388
|
+
location: SourceLocation;
|
|
389
|
+
}
|
|
390
|
+
interface Theorem {
|
|
391
|
+
name: string | undefined;
|
|
392
|
+
statement: Expression | AssumeProve;
|
|
393
|
+
proof: Proof | undefined;
|
|
394
|
+
location: SourceLocation;
|
|
302
395
|
}
|
|
303
396
|
interface Module {
|
|
304
397
|
name: string;
|
|
305
|
-
outer: OuterScope | undefined;
|
|
306
398
|
modules: Module[];
|
|
307
399
|
extends: string[];
|
|
308
400
|
constants: Declaration[];
|
|
309
|
-
variables:
|
|
401
|
+
variables: Declaration[];
|
|
310
402
|
definitions: Definition[];
|
|
311
403
|
instances: Instance[];
|
|
312
404
|
assumptions: Assumption[];
|
|
405
|
+
location: SourceLocation;
|
|
406
|
+
theorems: Theorem[];
|
|
407
|
+
uses: UseOrHide[];
|
|
313
408
|
}
|
|
314
409
|
type ConfigValue = {
|
|
315
410
|
kind: "Number";
|
|
@@ -351,10 +446,28 @@ interface ModelConfig {
|
|
|
351
446
|
checkDeadlock: boolean;
|
|
352
447
|
symmetry: string | undefined;
|
|
353
448
|
view: string | undefined;
|
|
449
|
+
alias: string | undefined;
|
|
354
450
|
postconditions: string[];
|
|
355
451
|
possible: string[];
|
|
452
|
+
periodic: string | undefined;
|
|
453
|
+
rlReward: string | undefined;
|
|
356
454
|
}
|
|
357
455
|
export declare const parseConfig: (source: string) => ModelConfig;
|
|
456
|
+
export declare class TlaError extends Error {
|
|
457
|
+
constructor(message: string, cause?: unknown);
|
|
458
|
+
}
|
|
459
|
+
export declare class TlaSyntaxError extends TlaError {
|
|
460
|
+
constructor(message: string, cause?: unknown);
|
|
461
|
+
}
|
|
462
|
+
export declare class TlaConfigError extends TlaError {
|
|
463
|
+
constructor(message: string, cause?: unknown);
|
|
464
|
+
}
|
|
465
|
+
export declare class TlaEvaluationError extends TlaError {
|
|
466
|
+
constructor(message: string, cause?: unknown);
|
|
467
|
+
}
|
|
468
|
+
export declare class TlaUnsupportedError extends TlaError {
|
|
469
|
+
constructor(message: string, cause?: unknown);
|
|
470
|
+
}
|
|
358
471
|
interface ModelValue {
|
|
359
472
|
kind: "ModelValue";
|
|
360
473
|
name: string;
|
|
@@ -365,12 +478,17 @@ interface SetValue {
|
|
|
365
478
|
hash: number;
|
|
366
479
|
fingerprint: number;
|
|
367
480
|
}
|
|
481
|
+
interface MixedSetValue {
|
|
482
|
+
kind: "MixedSet";
|
|
483
|
+
elements: Value[];
|
|
484
|
+
}
|
|
368
485
|
interface FunctionValue {
|
|
369
486
|
kind: "Function";
|
|
370
487
|
domain: Value[];
|
|
371
488
|
range: Value[];
|
|
372
489
|
hash: number;
|
|
373
490
|
fingerprint: number;
|
|
491
|
+
writtenKeys: Value[] | undefined;
|
|
374
492
|
}
|
|
375
493
|
interface IntervalValue {
|
|
376
494
|
kind: "Interval";
|
|
@@ -414,58 +532,76 @@ interface FilteredSetValue {
|
|
|
414
532
|
base: Value;
|
|
415
533
|
test: (element: Value) => boolean;
|
|
416
534
|
}
|
|
535
|
+
interface UnionValue {
|
|
536
|
+
kind: "Union";
|
|
537
|
+
base: Value;
|
|
538
|
+
}
|
|
539
|
+
interface LazyFunctionParameter {
|
|
540
|
+
name: string;
|
|
541
|
+
domain: Value;
|
|
542
|
+
}
|
|
543
|
+
interface LazyFunctionSource {
|
|
544
|
+
parameters: LazyFunctionParameter[];
|
|
545
|
+
body: string;
|
|
546
|
+
}
|
|
417
547
|
interface LazyFunctionValue {
|
|
418
548
|
kind: "LazyFunction";
|
|
419
549
|
domain: Value;
|
|
420
550
|
apply: (argument: Value) => Value;
|
|
551
|
+
source?: LazyFunctionSource;
|
|
421
552
|
}
|
|
422
|
-
type Value = boolean | number | string | ModelValue | SetValue | FunctionValue | IntervalValue | InfiniteSetValue | SubsetValue | FunctionSetValue | RecordSetValue | ProductSetValue | SequenceSetValue | SetOperationValue | FilteredSetValue | LazyFunctionValue;
|
|
423
|
-
export declare const formatValue: (value: Value,
|
|
553
|
+
type Value = boolean | number | string | ModelValue | SetValue | MixedSetValue | FunctionValue | IntervalValue | InfiniteSetValue | SubsetValue | FunctionSetValue | RecordSetValue | ProductSetValue | SequenceSetValue | SetOperationValue | FilteredSetValue | UnionValue | LazyFunctionValue;
|
|
554
|
+
export declare const formatValue: (value: Value, isStrict?: boolean, isNormalized?: boolean) => string;
|
|
424
555
|
interface CheckOptions {
|
|
425
556
|
source: string;
|
|
426
557
|
config: string | ModelConfig;
|
|
427
558
|
loadModule?: (name: string) => string | undefined;
|
|
559
|
+
loadClass?: (name: string) => Uint8Array | undefined;
|
|
428
560
|
onPrint?: (text: string) => void;
|
|
561
|
+
onPause?: () => void;
|
|
429
562
|
readFile?: (path: string) => string | undefined;
|
|
430
563
|
writeFile?: (path: string, content: string) => void;
|
|
564
|
+
seed?: bigint;
|
|
565
|
+
workers?: number;
|
|
566
|
+
livenessCheck?: "default" | "final";
|
|
431
567
|
}
|
|
432
|
-
type CheckStatus = "success" | "assumption-violation" | "invariant-violation" | "property-violation" | "liveness-violation" | "postcondition-violation" | "deadlock";
|
|
568
|
+
type CheckStatus = "success" | "assumption-violation" | "invariant-violation" | "property-violation" | "liveness-violation" | "postcondition-violation" | "deadlock" | "error";
|
|
433
569
|
interface TraceStep {
|
|
434
570
|
action: string | undefined;
|
|
571
|
+
label: string | undefined;
|
|
435
572
|
state: Record<string, Value>;
|
|
436
573
|
}
|
|
437
574
|
interface Violation {
|
|
438
575
|
name: string;
|
|
439
576
|
trace: TraceStep[];
|
|
440
577
|
loopStart: number | undefined;
|
|
578
|
+
loopLabel?: string;
|
|
441
579
|
message?: string;
|
|
580
|
+
counts?: string;
|
|
581
|
+
unwitnessed?: Postcondition;
|
|
582
|
+
}
|
|
583
|
+
interface Postcondition {
|
|
584
|
+
name: string;
|
|
585
|
+
message: string;
|
|
586
|
+
counts?: string;
|
|
587
|
+
}
|
|
588
|
+
interface EvaluationFailure {
|
|
589
|
+
message: string;
|
|
590
|
+
trace: TraceStep[];
|
|
591
|
+
initialState: Record<string, Value> | undefined;
|
|
592
|
+
exitCode: number;
|
|
442
593
|
}
|
|
443
594
|
interface CheckResult {
|
|
444
595
|
status: CheckStatus;
|
|
445
596
|
violation: Violation | undefined;
|
|
597
|
+
failure: EvaluationFailure | undefined;
|
|
446
598
|
generatedStates: number;
|
|
447
599
|
distinctStates: number;
|
|
600
|
+
queuedStates: number;
|
|
448
601
|
depth: number;
|
|
602
|
+
outDegrees: number[] | undefined;
|
|
603
|
+
fingerprintDistance: bigint | undefined;
|
|
449
604
|
}
|
|
450
|
-
export declare const check: (options: CheckOptions) => CheckResult
|
|
451
|
-
export declare class TlaError extends Error {
|
|
452
|
-
constructor(message: string, cause?: unknown);
|
|
453
|
-
}
|
|
454
|
-
export declare class TlaSyntaxError extends TlaError {
|
|
455
|
-
constructor(message: string, cause?: unknown);
|
|
456
|
-
}
|
|
457
|
-
export declare class TlaConfigError extends TlaError {
|
|
458
|
-
constructor(message: string, cause?: unknown);
|
|
459
|
-
}
|
|
460
|
-
export declare class TlaEvaluationError extends TlaError {
|
|
461
|
-
constructor(message: string, cause?: unknown);
|
|
462
|
-
}
|
|
463
|
-
export declare class TlaUnsupportedError extends TlaError {
|
|
464
|
-
constructor(message: string, cause?: unknown);
|
|
465
|
-
}
|
|
466
|
-
interface ParallelCheckOptions extends CheckOptions {
|
|
467
|
-
workers: number;
|
|
468
|
-
}
|
|
469
|
-
export declare const checkInParallel: (options: ParallelCheckOptions) => Promise<CheckResult>;
|
|
605
|
+
export declare const check: (options: CheckOptions) => Promise<CheckResult>;
|
|
470
606
|
export declare const parseModule: (source: string) => Module;
|
|
471
|
-
export type { CheckOptions, CheckResult, CheckStatus, ConfigValue, ConstantAssignment, ModelConfig, Module,
|
|
607
|
+
export type { CheckOptions, CheckResult, CheckStatus, ConfigValue, ConstantAssignment, EvaluationFailure, ModelConfig, Module, Substitution, TraceStep, Value, Violation };
|