tla-ts 0.0.1 → 0.0.3-dev.037ac3b

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 (74) hide show
  1. package/README.md +98 -39
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.cts +225 -30
  4. package/dist/index.d.ts +225 -30
  5. package/dist/index.js +1 -1
  6. package/dist/parallel-worker.cjs +2 -2
  7. package/dist/parallel-worker.js +2 -2
  8. package/dist/parallel.cjs +1 -1
  9. package/dist/parallel.js +2 -2
  10. package/dist/run-cli.cjs +21 -1
  11. package/dist/run-cli.js +21 -1
  12. package/dist/transfer.cjs +400 -39
  13. package/dist/transfer.js +400 -39
  14. package/package.json +6 -2
  15. package/src/ast.ts +213 -6
  16. package/src/bags.ts +161 -71
  17. package/src/builtins.ts +203 -23
  18. package/src/bundled-modules.ts +63 -32
  19. package/src/check.ts +1132 -258
  20. package/src/cli-options.ts +64 -0
  21. package/src/codegen.ts +58 -34
  22. package/src/config.ts +39 -11
  23. package/src/dependencies.ts +2 -2
  24. package/src/environment.ts +557 -153
  25. package/src/errors.ts +66 -1
  26. package/src/evaluate.ts +553 -258
  27. package/src/exit-codes.ts +53 -0
  28. package/src/fingerprints.ts +48 -13
  29. package/src/index.ts +9 -4
  30. package/src/instances.ts +235 -79
  31. package/src/java-overrides.ts +241 -0
  32. package/src/json.ts +153 -72
  33. package/src/levels.ts +850 -0
  34. package/src/lexer.ts +108 -29
  35. package/src/live-check.ts +692 -0
  36. package/src/liveness.ts +71 -596
  37. package/src/obligation-action.ts +384 -0
  38. package/src/obligation-anon.ts +575 -0
  39. package/src/obligation-deref.ts +637 -0
  40. package/src/obligation-expression.ts +1060 -0
  41. package/src/obligation-format.ts +406 -0
  42. package/src/obligation-generate.ts +1074 -0
  43. package/src/obligation-levels.ts +329 -0
  44. package/src/obligation-module.ts +1042 -0
  45. package/src/obligation-printer.ts +889 -0
  46. package/src/obligation-proof.ts +76 -0
  47. package/src/obligation-source.ts +1084 -0
  48. package/src/obligation-tuples.ts +184 -0
  49. package/src/obligations.ts +316 -0
  50. package/src/parallel-worker.ts +186 -201
  51. package/src/parallel.ts +179 -84
  52. package/src/parser.ts +970 -206
  53. package/src/pretty-print.ts +259 -0
  54. package/src/randomization.ts +24 -113
  55. package/src/resolve.ts +483 -51
  56. package/src/run-cli.ts +473 -62
  57. package/src/runtime.ts +65 -28
  58. package/src/spec-description.ts +521 -0
  59. package/src/standard-levels.ts +105 -0
  60. package/src/standard-modules.ts +218 -92
  61. package/src/state-graph.ts +157 -0
  62. package/src/subexpressions.ts +31 -45
  63. package/src/substitution-levels.ts +184 -0
  64. package/src/successors.ts +336 -57
  65. package/src/symmetry.ts +79 -23
  66. package/src/tableau.ts +93 -60
  67. package/src/tlc-ext.ts +148 -44
  68. package/src/tlc-module.ts +71 -66
  69. package/src/tlc-modules.ts +1022 -0
  70. package/src/tlc-order.ts +511 -0
  71. package/src/tlc-random.ts +414 -0
  72. package/src/tlc-summary.ts +124 -0
  73. package/src/transfer.ts +26 -5
  74. package/src/values.ts +1285 -179
package/src/symmetry.ts CHANGED
@@ -5,9 +5,11 @@ import {
5
5
  createFunction,
6
6
  createSet,
7
7
  createSortedFunction,
8
+ createSortedSet,
8
9
  isEnumerable,
9
10
  isFunctionValue,
10
11
  isModelValue,
12
+ isSameValue,
11
13
  isSetValue,
12
14
  toFiniteFunction,
13
15
  toFiniteSet,
@@ -18,6 +20,9 @@ import {
18
20
 
19
21
  type Images = Map<string, ModelValue>;
20
22
 
23
+ const CACHE_LIMIT = 1 << 22;
24
+ const CACHED_SIZE_LIMIT = 64;
25
+
21
26
  interface Permutation {
22
27
  images: Images;
23
28
  cache: WeakMap<ObjectValue, Value>;
@@ -31,7 +36,7 @@ const getPermutationKey = (permutation: Images) =>
31
36
  .sort()
32
37
  .join(",");
33
38
 
34
- const composePermutations = (first: Images, second: Images): Images => {
39
+ const composePermutations = (first: Images, second: Images) => {
35
40
  const composed: Images = new Map();
36
41
  const names = new Set([...first.keys(), ...second.keys()]);
37
42
  names.forEach((name) => {
@@ -42,14 +47,14 @@ const composePermutations = (first: Images, second: Images): Images => {
42
47
  return composed;
43
48
  };
44
49
 
45
- const toImages = (value: Value, name: string): Images => {
50
+ const toImages = (value: Value, name: string) => {
46
51
  if (!isFunctionValue(value)) {
47
52
  throw new TlaConfigError(`The symmetry values of ${name} must be functions`);
48
53
  }
49
- const fn = toFiniteFunction(value);
54
+ const functionValue = toFiniteFunction(value);
50
55
  const permutation: Images = new Map();
51
- fn.domain.forEach((key, index) => {
52
- const image = fn.range[index];
56
+ functionValue.domain.forEach((key, index) => {
57
+ const image = functionValue.range[index];
53
58
  if (!isModelValue(key) || !isModelValue(image)) {
54
59
  throw new TlaConfigError("Symmetry function must have model values as domain and range");
55
60
  }
@@ -103,7 +108,7 @@ export const getSymmetryGroup = (name: string, environment: Environment): Permut
103
108
  }));
104
109
  };
105
110
 
106
- const permuteElements = (elements: Value[], permutation: Permutation): Value[] | undefined => {
111
+ const permuteElements = (elements: Value[], permutation: Permutation) => {
107
112
  for (let index = 0; index < elements.length; index++) {
108
113
  const element = elements[index];
109
114
  const permuted = permuteValue(element, permutation);
@@ -118,8 +123,32 @@ const permuteElements = (elements: Value[], permutation: Permutation): Value[] |
118
123
  return undefined;
119
124
  };
120
125
 
121
- const CACHE_LIMIT = 1 << 22;
122
- const CACHED_SIZE_LIMIT = 16;
126
+ // A permutation maps distinct elements to distinct elements and keeps the elements it doesn't move
127
+ // in order, so it sorts only the moved ones and merges them back.
128
+ const permuteSortedElements = (elements: Value[], permutation: Permutation) => {
129
+ const kept: Value[] = [];
130
+ const moved: Value[] = [];
131
+ for (const element of elements) {
132
+ const permuted = permuteValue(element, permutation);
133
+ if (permuted === element) kept.push(element);
134
+ else moved.push(permuted);
135
+ }
136
+ if (moved.length === 0) return undefined;
137
+ moved.sort(compareValues);
138
+ const merged: Value[] = [];
139
+ let keptIndex = 0;
140
+ let movedIndex = 0;
141
+ while (keptIndex < kept.length && movedIndex < moved.length) {
142
+ merged.push(
143
+ compareValues(kept[keptIndex], moved[movedIndex]) < 0
144
+ ? kept[keptIndex++]
145
+ : moved[movedIndex++],
146
+ );
147
+ }
148
+ while (keptIndex < kept.length) merged.push(kept[keptIndex++]);
149
+ while (movedIndex < moved.length) merged.push(moved[movedIndex++]);
150
+ return merged;
151
+ };
123
152
 
124
153
  const getSize = (value: ObjectValue) =>
125
154
  value.kind === "Set"
@@ -135,7 +164,10 @@ const permuteValue = (value: Value, permutation: Permutation): Value => {
135
164
  if (size === 0 || size > CACHED_SIZE_LIMIT) return computePermutedValue(value, permutation);
136
165
  const cached = permutation.cache.get(value);
137
166
  if (cached !== undefined) return cached;
138
- const permuted = computePermutedValue(value, permutation);
167
+ const computed = computePermutedValue(value, permutation);
168
+ // A permutation often maps a value to an equal one. Keeping the original lets the comparison
169
+ // with the smallest state so far stop at identity.
170
+ const permuted = computed !== value && isSameValue(computed, value) ? value : computed;
139
171
  if (permutation.cacheSize >= permutation.cacheLimit) {
140
172
  permutation.cache = new WeakMap();
141
173
  permutation.cacheSize = 0;
@@ -145,20 +177,30 @@ const permuteValue = (value: Value, permutation: Permutation): Value => {
145
177
  return permuted;
146
178
  };
147
179
 
148
- const computePermutedValue = (value: ObjectValue, permutation: Permutation): Value => {
180
+ const computePermutedValue = (value: ObjectValue, permutation: Permutation) => {
149
181
  const kind = value.kind;
150
182
  if (kind === "Set") {
151
- const elements = permuteElements(value.elements, permutation);
152
- return elements ? createSet(elements) : value;
183
+ const elements = permuteSortedElements(value.elements, permutation);
184
+ return elements ? createSortedSet(elements) : value;
153
185
  }
154
186
  if (kind === "Function" || (kind === "LazyFunction" && isEnumerable(value.domain))) {
155
- const fn = toFiniteFunction(value);
156
- const domain = permuteElements(fn.domain, permutation);
157
- const range = permuteElements(fn.range, permutation) ?? fn.range;
187
+ const functionValue = toFiniteFunction(value);
188
+ const domain = permuteElements(functionValue.domain, permutation);
189
+ const range = permuteElements(functionValue.range, permutation) ?? functionValue.range;
158
190
  if (domain) {
159
- return createFunction(domain.map((key, index): [Value, Value] => [key, range[index]]));
191
+ const permuted = createFunction(
192
+ domain.map((key, index): [Value, Value] => [key, range[index]]),
193
+ );
194
+ // A permutation often maps the domain to itself, such as a function over the symmetric set.
195
+ // Sharing the original domain array lets comparisons with other images skip the domain.
196
+ const isSameDomain = permuted.domain.every(
197
+ (key, index) => key === functionValue.domain[index],
198
+ );
199
+ return isSameDomain ? createSortedFunction(functionValue.domain, permuted.range) : permuted;
160
200
  }
161
- return range === fn.range ? fn : createSortedFunction(fn.domain, range);
201
+ return range === functionValue.range
202
+ ? functionValue
203
+ : createSortedFunction(functionValue.domain, range);
162
204
  }
163
205
  if (kind === "Interval" || !isSetValue(value) || !isEnumerable(value)) return value;
164
206
  const set = toFiniteSet(value);
@@ -173,20 +215,34 @@ const permuteRemaining = (state: Value[], permuted: Value[], permutation: Permut
173
215
  return permuted;
174
216
  };
175
217
 
176
- const getSmallerPermutation = (state: Value[], minimum: Value[], permutation: Permutation) => {
218
+ const getSmallerPermutation = (
219
+ state: Value[],
220
+ minimum: Value[],
221
+ permutation: Permutation,
222
+ order: number[] | undefined,
223
+ ) => {
177
224
  const permuted: Value[] = [];
178
- for (let index = 0; index < state.length; index++) {
225
+ for (let position = 0; position < state.length; position++) {
226
+ const index = order ? order[position] : position;
179
227
  const value = permuteValue(state[index], permutation);
180
228
  const comparison = compareValues(value, minimum[index]);
181
229
  if (comparison > 0) return undefined;
182
- permuted.push(value);
183
- if (comparison < 0) return permuteRemaining(state, permuted, permutation);
230
+ if (!order) permuted.push(value);
231
+ if (comparison < 0) {
232
+ return order
233
+ ? state.map((item) => permuteValue(item, permutation))
234
+ : permuteRemaining(state, permuted, permutation);
235
+ }
184
236
  }
185
237
  return undefined;
186
238
  };
187
239
 
188
- export const getRepresentative = (state: Value[], group: Permutation[]): Value[] =>
240
+ export const getRepresentative = (
241
+ state: Value[],
242
+ group: Permutation[],
243
+ order?: number[],
244
+ ): Value[] =>
189
245
  group.reduce(
190
- (minimum, permutation) => getSmallerPermutation(state, minimum, permutation) ?? minimum,
246
+ (minimum, permutation) => getSmallerPermutation(state, minimum, permutation, order) ?? minimum,
191
247
  state,
192
248
  );
package/src/tableau.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import type { Expression } from "./ast";
2
2
  import { TlaEvaluationError } from "./errors";
3
3
  import type { Scope } from "./evaluate";
4
+ import { ACTION_LEVEL, TEMPORAL_LEVEL } from "./levels";
4
5
 
5
- export interface LiveBoolean {
6
+ interface LiveBoolean {
6
7
  kind: "Boolean";
7
8
  value: boolean;
8
9
  }
9
10
 
10
- export interface LiveState {
11
+ interface LiveState {
11
12
  kind: "State";
12
13
  expression: Expression;
13
14
  scope: Scope | undefined;
@@ -19,7 +20,7 @@ export interface LiveEnabled {
19
20
  scope: Scope | undefined;
20
21
  }
21
22
 
22
- export interface LiveAction {
23
+ interface LiveAction {
23
24
  kind: "Action";
24
25
  expression: Expression;
25
26
  unchanged: Expression | undefined;
@@ -27,12 +28,12 @@ export interface LiveAction {
27
28
  enabled?: LiveEnabled;
28
29
  }
29
30
 
30
- export interface LiveUnary {
31
+ interface LiveUnary {
31
32
  kind: "Not" | "Always" | "Eventually" | "Next";
32
33
  body: LiveExpression;
33
34
  }
34
35
 
35
- export interface LiveJunction {
36
+ interface LiveJunction {
36
37
  kind: "And" | "Or";
37
38
  operands: LiveExpression[];
38
39
  }
@@ -45,7 +46,7 @@ export type LiveExpression =
45
46
  | LiveUnary
46
47
  | LiveJunction;
47
48
 
48
- export interface TableauNode {
49
+ interface TableauNode {
49
50
  particle: LiveExpression[];
50
51
  successors: number[];
51
52
  statePredicates: LiveExpression[];
@@ -56,7 +57,7 @@ export interface Tableau {
56
57
  initialCount: number;
57
58
  }
58
59
 
59
- export interface ErrorModel {
60
+ interface ErrorModel {
60
61
  eventuallyAlways: number[];
61
62
  infinitelyOftenStates: number[];
62
63
  infinitelyOftenActions: number[];
@@ -84,14 +85,12 @@ interface Triple {
84
85
  }
85
86
 
86
87
  const STATE_LEVEL = 1;
87
- const ACTION_LEVEL = 2;
88
- const TEMPORAL_LEVEL = 3;
89
88
  const MAXIMUM_DISJUNCTS = 2147483647;
90
89
 
91
- export const TRUE: LiveBoolean = { kind: "Boolean", value: true };
92
- export const FALSE: LiveBoolean = { kind: "Boolean", value: false };
90
+ const TRUE: LiveBoolean = { kind: "Boolean", value: true };
91
+ const FALSE: LiveBoolean = { kind: "Boolean", value: false };
93
92
 
94
- const createBoolean = (value: boolean) => (value ? TRUE : FALSE);
93
+ export const createBoolean = (value: boolean) => (value ? TRUE : FALSE);
95
94
 
96
95
  const isAtom = (expression: LiveExpression) =>
97
96
  expression.kind === "State" || expression.kind === "Enabled" || expression.kind === "Action";
@@ -163,22 +162,39 @@ const containsAction = (expression: LiveExpression): boolean => {
163
162
  }
164
163
  };
165
164
 
166
- const isEqual = (left: LiveExpression, right: LiveExpression): boolean => {
167
- if (left.kind !== right.kind) return false;
168
- if (left.kind === "Boolean" && right.kind === "Boolean") return left.value === right.value;
169
- if (isAtom(left)) return left === right;
170
- if ("body" in left && "body" in right) return isEqual(left.body, right.body);
171
- if ("operands" in left && "operands" in right) {
172
- return (
173
- left.operands.length === right.operands.length &&
174
- left.operands.every((operand, index) => isEqual(operand, right.operands[index]))
175
- );
176
- }
177
- return false;
165
+ const termKeys = new WeakMap<LiveExpression, string>();
166
+ const atoms = { count: 0 };
167
+
168
+ // A term's structure as a string in which each atom stands for itself, so equal terms share a key.
169
+ export const getTermKey = (expression: LiveExpression): string => {
170
+ const cached = termKeys.get(expression);
171
+ if (cached !== undefined) return cached;
172
+ const key = (() => {
173
+ switch (expression.kind) {
174
+ case "Boolean":
175
+ return String(expression.value);
176
+ case "State":
177
+ case "Enabled":
178
+ case "Action":
179
+ return `#${atoms.count++}`;
180
+ case "And":
181
+ case "Or":
182
+ return `${expression.kind}(${expression.operands.map(getTermKey).join(",")})`;
183
+ default:
184
+ return `${expression.kind}(${getTermKey(expression.body)})`;
185
+ }
186
+ })();
187
+ termKeys.set(expression, key);
188
+ return key;
178
189
  };
179
190
 
180
- const isMember = (items: LiveExpression[], expression: LiveExpression) =>
181
- items.some((item) => isEqual(item, expression));
191
+ const isEqual = (left: LiveExpression, right: LiveExpression) =>
192
+ left === right || getTermKey(left) === getTermKey(right);
193
+
194
+ const isMember = (items: LiveExpression[], expression: LiveExpression) => {
195
+ const key = getTermKey(expression);
196
+ return items.some((item) => item === expression || getTermKey(item) === key);
197
+ };
182
198
 
183
199
  const getDual = (kind: LiveJunction["kind"]) => (kind === "And" ? "Or" : "And");
184
200
 
@@ -265,6 +281,10 @@ const toDisjunctiveNormalForm = (expression: LiveExpression): LiveExpression =>
265
281
  const total = { value: 1 };
266
282
  for (const operand of expression.operands) {
267
283
  const normal = toDisjunctiveNormalForm(operand);
284
+ if (normal.kind === "And") {
285
+ items.push(...normal.operands);
286
+ continue;
287
+ }
268
288
  if (normal.kind === "Or") {
269
289
  total.value *= normal.operands.length;
270
290
  if (total.value > MAXIMUM_DISJUNCTS) {
@@ -272,12 +292,8 @@ const toDisjunctiveNormalForm = (expression: LiveExpression): LiveExpression =>
272
292
  "TLC cannot handle the temporal formula because it exceeds the maximum supported size in disjunctive normal form",
273
293
  );
274
294
  }
275
- items.push(normal);
276
- } else if (normal.kind === "And") {
277
- items.push(...normal.operands);
278
- } else {
279
- items.push(normal);
280
295
  }
296
+ items.push(normal);
281
297
  }
282
298
  if (total.value === 1) return { kind: "And", operands: items };
283
299
  const conjunctions = Array.from({ length: total.value }, (): LiveExpression[] => []);
@@ -427,9 +443,13 @@ const getExpansion = (
427
443
  term: LiveExpression,
428
444
  repeated: "Always" | "Eventually",
429
445
  junction: "And" | "Or",
430
- ): [LiveExpression, LiveExpression] | undefined => {
431
- if (term.kind === repeated && "body" in term) return [term.body, createUnary("Next", term)];
432
- if (term.kind === junction && "operands" in term) return [term.operands[0], term.operands[1]];
446
+ ) => {
447
+ if (term.kind === repeated && "body" in term) {
448
+ return { first: term.body, second: createUnary("Next", term) };
449
+ }
450
+ if (term.kind === junction && "operands" in term) {
451
+ return { first: term.operands[0], second: term.operands[1] };
452
+ }
433
453
  return undefined;
434
454
  };
435
455
 
@@ -437,21 +457,22 @@ const getTriples = (
437
457
  closure: LiveExpression[],
438
458
  repeated: "Always" | "Eventually",
439
459
  junction: "And" | "Or",
440
- ): Triple[] =>
460
+ ) =>
441
461
  closure.flatMap((term): Triple[] => {
442
462
  const parts = getExpansion(term, repeated, junction);
443
- return parts ? [{ whole: term, first: parts[0], second: parts[1] }] : [];
463
+ return parts ? [{ whole: term, first: parts.first, second: parts.second }] : [];
444
464
  });
445
465
 
446
- const isSameParticle = (left: LiveExpression[], right: LiveExpression[]) =>
447
- left.every((term) => isMember(right, term)) && right.every((term) => isMember(left, term));
466
+ // A particle is a set of terms, so its key ignores order and repeats.
467
+ const getParticleKey = (particle: LiveExpression[]) =>
468
+ [...new Set(particle.map(getTermKey))].sort().join("|");
448
469
 
449
- const unionParticles = (left: LiveExpression[][], right: LiveExpression[][]) => [
450
- ...left.filter((particle) => !right.some((other) => isSameParticle(particle, other))),
451
- ...right,
452
- ];
470
+ const unionParticles = (left: LiveExpression[][], right: LiveExpression[][]) => {
471
+ const rightKeys = new Set(right.map(getParticleKey));
472
+ return [...left.filter((particle) => !rightKeys.has(getParticleKey(particle))), ...right];
473
+ };
453
474
 
454
- const getParticleClosure = (terms: LiveExpression[]): LiveExpression[][] => {
475
+ const getParticleClosure = (terms: LiveExpression[]) => {
455
476
  const closure = getPositiveClosure(terms);
456
477
  const alphas = getTriples(closure, "Always", "And");
457
478
  const betas = getTriples(closure, "Eventually", "Or");
@@ -460,9 +481,11 @@ const getParticleClosure = (terms: LiveExpression[]): LiveExpression[][] => {
460
481
  for (const term of particle) {
461
482
  const parts = getExpansion(term, "Eventually", "Or");
462
483
  if (!parts) continue;
463
- const [first, second] = parts;
464
- if (isMember(particle, first) || isMember(particle, second)) continue;
465
- return unionParticles(expand([...particle, first]), expand([...particle, second]));
484
+ if (isMember(particle, parts.first) || isMember(particle, parts.second)) continue;
485
+ return unionParticles(
486
+ expand([...particle, parts.first]),
487
+ expand([...particle, parts.second]),
488
+ );
466
489
  }
467
490
  const beta = betas.find(
468
491
  (triple) =>
@@ -478,9 +501,8 @@ const getParticleClosure = (terms: LiveExpression[]): LiveExpression[][] => {
478
501
  for (let index = 0; index < expanded.length; index++) {
479
502
  const parts = getExpansion(expanded[index], "Always", "And");
480
503
  if (!parts) continue;
481
- const [first, second] = parts;
482
- if (!isMember(expanded, first)) expanded.push(first);
483
- if (!isMember(expanded, second)) expanded.push(second);
504
+ if (!isMember(expanded, parts.first)) expanded.push(parts.first);
505
+ if (!isMember(expanded, parts.second)) expanded.push(parts.second);
484
506
  }
485
507
  const state = { isChanged: true };
486
508
  while (state.isChanged) {
@@ -509,17 +531,26 @@ const createTableauNode = (particle: LiveExpression[]): TableauNode => ({
509
531
  statePredicates: particle.filter((term) => getLiveLevel(term) <= STATE_LEVEL),
510
532
  });
511
533
 
512
- const createTableau = (formula: LiveExpression): Tableau => {
534
+ const createTableau = (formula: LiveExpression) => {
513
535
  const nodes = getParticleClosure([formula]).map(createTableauNode);
514
536
  const initialCount = nodes.length;
537
+ const indices = new Map<string, number>();
538
+ nodes.forEach((node, index) => {
539
+ const key = getParticleKey(node.particle);
540
+ if (!indices.has(key)) indices.set(key, index);
541
+ });
515
542
  for (let index = 0; index < nodes.length; index++) {
516
543
  const implied = nodes[index].particle.flatMap((term) =>
517
544
  term.kind === "Next" ? [term.body] : [],
518
545
  );
519
546
  for (const particle of getParticleClosure(implied)) {
520
- const existing = nodes.findIndex((node) => isSameParticle(node.particle, particle));
521
- if (existing === -1) nodes.push(createTableauNode(particle));
522
- nodes[index].successors.push(existing === -1 ? nodes.length - 1 : existing);
547
+ const key = getParticleKey(particle);
548
+ const existing = indices.get(key);
549
+ if (existing === undefined) {
550
+ indices.set(key, nodes.length);
551
+ nodes.push(createTableauNode(particle));
552
+ }
553
+ nodes[index].successors.push(existing ?? nodes.length - 1);
523
554
  }
524
555
  }
525
556
  return { nodes, initialCount };
@@ -529,11 +560,13 @@ export const isFulfilling = (particle: LiveExpression[], promise: LiveUnary) =>
529
560
  !isMember(particle, promise) || isMember(particle, promise.body);
530
561
 
531
562
  const classify = (expression: LiveExpression, classification: Classification) => {
532
- if (expression.kind === "Eventually" && expression.body.kind === "Always") {
533
- if (getLiveLevel(expression.body.body) < TEMPORAL_LEVEL) {
534
- classification.eventuallyAlways.push(expression.body.body);
535
- return;
536
- }
563
+ if (
564
+ expression.kind === "Eventually" &&
565
+ expression.body.kind === "Always" &&
566
+ getLiveLevel(expression.body.body) < TEMPORAL_LEVEL
567
+ ) {
568
+ classification.eventuallyAlways.push(expression.body.body);
569
+ return;
537
570
  }
538
571
  const infinitelyOften = getInfinitelyOftenBody(expression);
539
572
  if (infinitelyOften) {
@@ -592,13 +625,13 @@ export const getSolutions = (formula: LiveExpression): Solution[] => {
592
625
  if (group) group.classifications.push(classification);
593
626
  else groups.push({ formula: temporal, classifications: [classification] });
594
627
  }
595
- return groups.map((group): Solution => {
628
+ return groups.map((group) => {
596
629
  const binary = group.formula && makeBinary(group.formula);
597
630
  const promises: LiveUnary[] = [];
598
631
  if (binary) extractPromises(binary, promises);
599
632
  const stateChecks: LiveExpression[] = [];
600
633
  const actionChecks: LiveExpression[] = [];
601
- const models = group.classifications.map((classification): ErrorModel => ({
634
+ const models = group.classifications.map((classification) => ({
602
635
  infinitelyOftenActions: classification.infinitelyOftenActions.map((check) =>
603
636
  addToBin(actionChecks, check),
604
637
  ),