tla-ts 0.0.3 → 0.0.4-dev.4819fb7

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.
Files changed (86) hide show
  1. package/README.md +32 -12
  2. package/dist/cli.cjs +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.cts +162 -8
  6. package/dist/index.d.ts +162 -8
  7. package/dist/index.js +1 -1
  8. package/dist/parallel-worker.cjs +2 -2
  9. package/dist/parallel-worker.js +2 -2
  10. package/dist/parallel.cjs +1 -1
  11. package/dist/parallel.js +2 -2
  12. package/dist/run-cli.cjs +45 -18
  13. package/dist/run-cli.js +45 -18
  14. package/dist/transfer.cjs +1393 -18
  15. package/dist/transfer.js +1393 -18
  16. package/package.json +5 -1
  17. package/src/ast.ts +147 -6
  18. package/src/bags.ts +4 -7
  19. package/src/builtins.ts +29 -11
  20. package/src/bundled-modules.ts +3 -3
  21. package/src/canonical.ts +4 -3
  22. package/src/check.ts +1539 -235
  23. package/src/cli-options.ts +11 -5
  24. package/src/cli.ts +8 -1
  25. package/src/codegen.ts +77 -37
  26. package/src/config.ts +254 -181
  27. package/src/dependencies.ts +2 -2
  28. package/src/environment.ts +540 -140
  29. package/src/errors.ts +224 -3
  30. package/src/evaluate.ts +994 -279
  31. package/src/exit-codes.ts +22 -43
  32. package/src/fingerprints.ts +46 -11
  33. package/src/index.ts +1 -0
  34. package/src/instances.ts +19 -16
  35. package/src/java-overrides.ts +104 -25
  36. package/src/levels.ts +191 -45
  37. package/src/lexer.ts +127 -30
  38. package/src/live-check.ts +867 -0
  39. package/src/liveness.ts +218 -572
  40. package/src/obligation-expression.ts +2 -2
  41. package/src/obligation-source.ts +2 -0
  42. package/src/parallel-worker.ts +174 -213
  43. package/src/parallel.ts +131 -39
  44. package/src/parser.ts +456 -147
  45. package/src/pcal-ast.ts +770 -0
  46. package/src/pcal-parse.ts +1523 -0
  47. package/src/pcal-tokenize.ts +516 -0
  48. package/src/pcal-translate.ts +1230 -0
  49. package/src/pcal-validate.ts +454 -0
  50. package/src/randomization.ts +24 -7
  51. package/src/resolve.ts +1481 -426
  52. package/src/run-cli.ts +1212 -143
  53. package/src/runtime.ts +19 -1
  54. package/src/sany-builtins.ts +147 -0
  55. package/src/sany-generator.ts +3128 -0
  56. package/src/sany-levels.ts +1208 -0
  57. package/src/sany-lexer.ts +545 -0
  58. package/src/sany-linter.ts +122 -0
  59. package/src/sany-modules.ts +1398 -0
  60. package/src/sany-nodes.ts +463 -0
  61. package/src/sany-parse-error.ts +2161 -0
  62. package/src/sany-report.ts +356 -0
  63. package/src/sany-selectors.ts +738 -0
  64. package/src/sany-source.ts +248 -0
  65. package/src/sany-xml.ts +1017 -0
  66. package/src/spec-description.ts +42 -11
  67. package/src/standard-modules.ts +200 -148
  68. package/src/standard-ranges.ts +116 -0
  69. package/src/state-graph.ts +180 -0
  70. package/src/subexpressions.ts +231 -171
  71. package/src/substitution-levels.ts +38 -17
  72. package/src/successors.ts +220 -108
  73. package/src/symmetry.ts +194 -54
  74. package/src/tableau.ts +54 -25
  75. package/src/tlc-ext.ts +42 -29
  76. package/src/tlc-messages.ts +329 -0
  77. package/src/tlc-module.ts +52 -43
  78. package/src/tlc-modules.ts +4 -0
  79. package/src/tlc-order.ts +78 -10
  80. package/src/tlc-random.ts +37 -9
  81. package/src/tlc-replay.ts +655 -0
  82. package/src/tlc-summary.ts +20 -5
  83. package/src/tlc-version.ts +18 -0
  84. package/src/transfer.ts +15 -3
  85. package/src/value-sources.ts +29 -0
  86. package/src/values.ts +741 -189
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, 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.
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.k,exports.TlaError=e.A,exports.TlaEvaluationError=e.j,exports.TlaSyntaxError=e.N,exports.TlaUnsupportedError=e.P,exports.check=t.t,exports.formatValue=e.C,exports.parseConfig=e.D,exports.parseModule=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
- constructor(message: string, cause?: unknown, failure?: SyntaxFailure);
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,12 +564,14 @@ 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";
526
571
  elements: Value[];
527
572
  hash: number;
528
573
  fingerprint: number;
574
+ isFingerprinted: boolean;
529
575
  }
530
576
  interface MixedSetValue {
531
577
  kind: "MixedSet";
@@ -538,6 +584,8 @@ interface FunctionValue {
538
584
  hash: number;
539
585
  fingerprint: number;
540
586
  writtenKeys: Value[] | undefined;
587
+ functionClass: FunctionClass | undefined;
588
+ isFingerprinted: boolean;
541
589
  }
542
590
  interface IntervalValue {
543
591
  kind: "Interval";
@@ -576,10 +624,15 @@ interface SetOperationValue {
576
624
  left: Value;
577
625
  right: Value;
578
626
  }
627
+ interface FilteredSetSource {
628
+ names: string;
629
+ predicate: string;
630
+ }
579
631
  interface FilteredSetValue {
580
632
  kind: "FilteredSet";
581
633
  base: Value;
582
634
  test: (element: Value) => boolean;
635
+ source?: FilteredSetSource;
583
636
  }
584
637
  interface UnionValue {
585
638
  kind: "Union";
@@ -598,9 +651,22 @@ interface LazyFunctionValue {
598
651
  domain: Value;
599
652
  apply: (argument: Value) => Value;
600
653
  source?: LazyFunctionSource;
654
+ functionClass?: FunctionClass;
601
655
  }
602
656
  type Value = boolean | number | string | ModelValue | SetValue | MixedSetValue | FunctionValue | IntervalValue | InfiniteSetValue | SubsetValue | FunctionSetValue | RecordSetValue | ProductSetValue | SequenceSetValue | SetOperationValue | FilteredSetValue | UnionValue | LazyFunctionValue;
657
+ type FunctionClass = "lambda" | "tuple" | "record";
603
658
  export declare const formatValue: (value: Value, isStrict?: boolean, isNormalized?: boolean) => string;
659
+ interface FingerprintFailure {
660
+ sources: Expression[];
661
+ reason: string;
662
+ }
663
+ interface StateDump {
664
+ path: string;
665
+ dot?: boolean;
666
+ colorize?: boolean;
667
+ actionLabels?: boolean;
668
+ snapshot?: boolean;
669
+ }
604
670
  interface CheckOptions {
605
671
  source: string;
606
672
  config: string | ModelConfig;
@@ -613,32 +679,111 @@ interface CheckOptions {
613
679
  seed?: bigint;
614
680
  workers?: number;
615
681
  livenessCheck?: "default" | "final";
682
+ dump?: StateDump;
683
+ isTool?: boolean;
684
+ isTraceRecorded?: boolean;
685
+ isSanyReported?: boolean;
686
+ isWarningEnabled?: boolean;
687
+ version?: TlcVersion;
688
+ onProgress?: (progress: CheckProgress) => void;
689
+ }
690
+ interface InitialStatesProgress {
691
+ kind: "initial-states-progress";
692
+ count: number;
693
+ }
694
+ interface InitialStateViolation {
695
+ kind: "initial-state-violation";
696
+ status: "invariant-violation" | "liveness-violation";
697
+ name: string;
698
+ state: Record<string, Value>;
616
699
  }
700
+ type OutputLine = string | InitialStatesProgress | InitialStateViolation;
701
+ type CheckProgress = {
702
+ kind: "parsed";
703
+ } | {
704
+ kind: "constant-level-invariant";
705
+ name: string;
706
+ } | {
707
+ kind: "state-level-property";
708
+ name: string;
709
+ } | {
710
+ kind: "liveness-initializing";
711
+ isSymmetric: boolean;
712
+ isConstrained: boolean;
713
+ } | {
714
+ kind: "liveness-prepared";
715
+ branches: number;
716
+ } | {
717
+ kind: "initial-states-started";
718
+ } | InitialStatesProgress | {
719
+ kind: "initial-states-computed";
720
+ initialStates: InitialStates;
721
+ } | {
722
+ kind: "progress";
723
+ statistics: SearchStatistics;
724
+ } | {
725
+ kind: "liveness-started";
726
+ branches: number;
727
+ isComplete: boolean;
728
+ states: number;
729
+ statistics: SearchStatistics;
730
+ } | {
731
+ kind: "liveness-finished";
732
+ } | {
733
+ kind: "warning";
734
+ code: number;
735
+ text: string;
736
+ } | ({
737
+ kind: "java-override";
738
+ } & JavaOverride);
739
+ interface SearchStatistics extends Pick<CheckResult, "generatedStates" | "distinctStates" | "queuedStates" | "depth"> {}
617
740
  type CheckStatus = "success" | "assumption-violation" | "invariant-violation" | "property-violation" | "liveness-violation" | "postcondition-violation" | "deadlock" | "error";
618
741
  interface TraceStep {
619
742
  action: string | undefined;
620
743
  label: string | undefined;
621
744
  state: Record<string, Value>;
745
+ output?: OutputLine[];
622
746
  }
623
747
  interface Violation {
624
748
  name: string;
749
+ properties?: string[];
625
750
  trace: TraceStep[];
751
+ traceOutput?: OutputLine[];
626
752
  loopStart: number | undefined;
627
753
  loopLabel?: string;
628
754
  message?: string;
629
755
  counts?: string;
630
756
  unwitnessed?: Postcondition;
757
+ postcondition?: Postcondition;
758
+ warning?: {
759
+ code: number;
760
+ text: string;
761
+ };
631
762
  }
632
763
  interface Postcondition {
633
764
  name: string;
765
+ code: number;
634
766
  message: string;
635
767
  counts?: string;
636
768
  }
637
769
  interface EvaluationFailure {
770
+ code: number;
638
771
  message: string;
772
+ toolMessage: string;
639
773
  trace: TraceStep[];
774
+ traceOutput?: OutputLine[];
640
775
  initialState: Record<string, Value> | undefined;
641
776
  exitCode: number;
777
+ callStack: Expression[] | undefined;
778
+ isCallStackFirst?: boolean;
779
+ fingerprint?: FingerprintFailure;
780
+ traceFailure?: FailureMessage;
781
+ postcondition?: Postcondition;
782
+ isWithoutStatistics?: boolean;
783
+ }
784
+ interface InitialStates {
785
+ generated: number;
786
+ distinct: number;
642
787
  }
643
788
  interface CheckResult {
644
789
  status: CheckStatus;
@@ -648,9 +793,18 @@ interface CheckResult {
648
793
  distinctStates: number;
649
794
  queuedStates: number;
650
795
  depth: number;
796
+ initialStates: InitialStates | undefined;
651
797
  outDegrees: number[] | undefined;
652
798
  fingerprintDistance: bigint | undefined;
799
+ additionalViolation?: Violation;
800
+ liveCallStack?: Expression[];
801
+ violationOutDegrees?: number[];
802
+ }
803
+ interface FailureMessage {
804
+ code: number;
805
+ message: string;
806
+ toolMessage: string;
653
807
  }
654
808
  export declare const check: (options: CheckOptions) => Promise<CheckResult>;
655
809
  export declare const parseModule: (source: string) => Module;
656
- export type { CheckOptions, CheckResult, CheckStatus, ConfigValue, ConstantAssignment, EvaluationFailure, ModelConfig, Module, Substitution, TraceStep, Value, Violation };
810
+ export type { CheckOptions, CheckProgress, CheckResult, CheckStatus, ConfigValue, ConstantAssignment, EvaluationFailure, ModelConfig, Module, Substitution, TraceStep, Value, Violation };