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.
- 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 +162 -8
- package/dist/index.d.ts +162 -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 +994 -279
- 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 +220 -108
- 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 +741 -189
package/dist/index.d.ts
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,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 };
|
package/dist/index.js
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
|
-
import{
|
|
9
|
+
import{D as e,Z as t,at as n,ft as r,ot as i,pt as a,q as o,st as s}from"./transfer.js";import{t as c}from"./parallel.js";export{n as TlaConfigError,i as TlaError,s as TlaEvaluationError,r as TlaSyntaxError,a as TlaUnsupportedError,c as check,o as formatValue,t as parseConfig,e as parseModule};
|
package/dist/parallel-worker.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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
|
-
const e=require("./transfer.cjs"),t=
|
|
9
|
+
const e=require("./transfer.cjs"),t=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
10
10
|
/* @vite-ignore */
|
|
11
11
|
/* webpackIgnore: true */
|
|
12
|
-
`node:worker_threads`)).parentPort,
|
|
12
|
+
`node:worker_threads`)).parentPort,n=(t,n)=>{let r=new Map(t.modules),i=e=>r.get(e),a=new Map(t.classes);e.Y(e.x(t.source,t.config,i)),e.X(t.version);let o=e.J(),s=e.y(t.config,{source:t.source,loadModule:i,loadClass:e=>a.get(e),print:()=>{},files:{readFile:void 0,writeFile:void 0},isTool:t.isTool,isTraceRecorded:t.isTraceRecorded,isWarningEnabled:t.isWarningEnabled,version:t.version}).environment,c=e.u(t.config,s,()=>e.b(t.source,i,`variable`)),l=c?.spec.next;if(!c||l===void 0)return n.postMessage({type:`abort`});let u=t.index,d=e.G(),f=e.t(s.variables.length),p={fingerprints:t.fingerprints},m=t.requests,h=t.remaining,g=c.isSymmetric?e.r():void 0,_=/* @__PURE__ */ new Int32Array(2),v={resume:()=>{},loot:e=>{}};t.ports.forEach(e=>{e?.addEventListener(`message`,e=>v.loot(e.data)),e?.start?.()});let y={states:f(t.seed).map(d)},b=(n,r)=>{let i=Atomics.load(m,u)-1,a=Math.floor((n.end-n.origin-1)/2),o=e.n(),s=n.states.slice(n.end-a,n.end),c=a>0&&s.every(o.encode);c&&(n.end-=a);let l=c?o.finish():e.n().finish();t.ports[i]?.postMessage(l,[l.words.buffer]),Atomics.store(m,u,r),Atomics.notify(m,u)},x=e=>{Atomics.store(h,u,0),Atomics.compareExchange(m,u,0,-1)!==0&&b(e,-1)},S=e=>{Atomics.store(h,u,e.end-e.origin),Atomics.store(m,u,0)},C=n=>{for(;n.origin<n.end;n.origin++){let r=n.states[n.origin];if(!n.successors&&(Atomics.load(m,u)>0&&b(n,0),Atomics.store(h,u,n.end-n.origin-1),n.successors=e.F(l,r,s,c.spec.scope),n.generated+=n.successors.length,n.successors.length===0&&t.config.checkDeadlock))return;let i=n.successors;for(;n.index<i.length;n.index++){if(e.s(p.fingerprints))return`paused`;let t=i[n.index];if(c.findViolatedActionProperty(r,t.state))return;if(!c.satisfiesActionConstraints(r,t.state)){if(c.findViolatedInvariant(t.state,r))return;continue}if(g&&(e.c(t.state,_),!g.insert(_[0],_[1])))continue;d(t.state);let a=c.getFingerprintState(t.state);if(e.c(a,_),e.o(p.fingerprints,_[0],_[1])){if(c.findViolatedInvariant(t.state,r))return;c.satisfiesConstraints(t.state,r)&&(n.next.push(t.state),n.fingerprintStates.push(a),n.added++)}}n.outDegrees[Math.min(n.added,31)]++,n.successors=void 0,n.index=0,n.added=0}return`done`},w=async e=>{let n=/* @__PURE__ */ new Set;for(;;){let r=t.ports.reduce((e,t,r)=>!t||n.has(r)||Atomics.load(h,r)<2?e:e===void 0||Atomics.load(h,r)>Atomics.load(h,e)?r:e,void 0);if(r===void 0)return!1;let i=Atomics.compareExchange(m,r,0,u+1);if(i===-1&&n.add(r),i>0&&Atomics.wait(m,r,i),i!==0)continue;let a=await new Promise(e=>v.loot=e);if(a.count===0)n.add(r);else return e.states=f(a).map(d),e.origin=0,e.end=e.states.length,S(e),!0}},T=e=>n.postMessage(e,e.type===`level`?[e.fingerprints.buffer]:[]),E=async t=>{let n={states:y.states,origin:0,end:y.states.length,successors:void 0,index:0,added:0,generated:0,outDegrees:Array.from({length:32},()=>0),next:[],fingerprintStates:[]};for(;;){let e=C(n);if(e===void 0)return;if(x(n),e===`paused`){let e=new Promise(e=>v.resume=e);T({type:`paused`}),await e,S(n)}else if(!await w(n))break}if(e.J()===o)return y.states=n.next,Atomics.store(h,u,y.states.length),{type:`level`,level:t,generated:n.generated,added:n.next.length,outDegrees:n.outDegrees,fingerprints:c.getStoredFingerprints(n.next,n.fingerprintStates)}},D=e=>{E(e).then(e=>T(e??{type:`abort`}),()=>T({type:`abort`}))};n.addEventListener(`message`,e=>{let t=e.data;t.type===`level`&&D(t.level),t.type===`resize`&&(p.fingerprints=t.fingerprints,v.resume())}),Atomics.store(h,u,y.states.length),T({type:`ready`})};t().then(e=>{let t=r=>{let i=r.data;if(i.type===`start`){e.removeEventListener?.(`message`,t);try{n(i,e)}catch{e.postMessage({type:`abort`})}}};e.addEventListener(`message`,t),e.start?.()});
|
package/dist/parallel-worker.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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
|
-
import{
|
|
9
|
+
import{F as e,G as t,J as n,X as r,Y as i,b as a,c as o,n as s,o as c,r as l,s as u,t as d,u as f,x as p,y as m}from"./transfer.js";const h=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
10
10
|
/* @vite-ignore */
|
|
11
11
|
/* webpackIgnore: true */
|
|
12
|
-
`node:worker_threads`)).parentPort,
|
|
12
|
+
`node:worker_threads`)).parentPort,g=(h,g)=>{let _=new Map(h.modules),v=e=>_.get(e),y=new Map(h.classes);i(p(h.source,h.config,v)),r(h.version);let b=n(),x=m(h.config,{source:h.source,loadModule:v,loadClass:e=>y.get(e),print:()=>{},files:{readFile:void 0,writeFile:void 0},isTool:h.isTool,isTraceRecorded:h.isTraceRecorded,isWarningEnabled:h.isWarningEnabled,version:h.version}).environment,S=f(h.config,x,()=>a(h.source,v,`variable`)),C=S?.spec.next;if(!S||C===void 0)return g.postMessage({type:`abort`});let w=h.index,T=t(),E=d(x.variables.length),D={fingerprints:h.fingerprints},O=h.requests,k=h.remaining,A=S.isSymmetric?l():void 0,j=/* @__PURE__ */ new Int32Array(2),M={resume:()=>{},loot:e=>{}};h.ports.forEach(e=>{e?.addEventListener(`message`,e=>M.loot(e.data)),e?.start?.()});let N={states:E(h.seed).map(T)},P=(e,t)=>{let n=Atomics.load(O,w)-1,r=Math.floor((e.end-e.origin-1)/2),i=s(),a=e.states.slice(e.end-r,e.end),o=r>0&&a.every(i.encode);o&&(e.end-=r);let c=o?i.finish():s().finish();h.ports[n]?.postMessage(c,[c.words.buffer]),Atomics.store(O,w,t),Atomics.notify(O,w)},F=e=>{Atomics.store(k,w,0),Atomics.compareExchange(O,w,0,-1)!==0&&P(e,-1)},I=e=>{Atomics.store(k,w,e.end-e.origin),Atomics.store(O,w,0)},L=t=>{for(;t.origin<t.end;t.origin++){let n=t.states[t.origin];if(!t.successors&&(Atomics.load(O,w)>0&&P(t,0),Atomics.store(k,w,t.end-t.origin-1),t.successors=e(C,n,x,S.spec.scope),t.generated+=t.successors.length,t.successors.length===0&&h.config.checkDeadlock))return;let r=t.successors;for(;t.index<r.length;t.index++){if(u(D.fingerprints))return`paused`;let e=r[t.index];if(S.findViolatedActionProperty(n,e.state))return;if(!S.satisfiesActionConstraints(n,e.state)){if(S.findViolatedInvariant(e.state,n))return;continue}if(A&&(o(e.state,j),!A.insert(j[0],j[1])))continue;T(e.state);let i=S.getFingerprintState(e.state);if(o(i,j),c(D.fingerprints,j[0],j[1])){if(S.findViolatedInvariant(e.state,n))return;S.satisfiesConstraints(e.state,n)&&(t.next.push(e.state),t.fingerprintStates.push(i),t.added++)}}t.outDegrees[Math.min(t.added,31)]++,t.successors=void 0,t.index=0,t.added=0}return`done`},R=async e=>{let t=/* @__PURE__ */ new Set;for(;;){let n=h.ports.reduce((e,n,r)=>!n||t.has(r)||Atomics.load(k,r)<2?e:e===void 0||Atomics.load(k,r)>Atomics.load(k,e)?r:e,void 0);if(n===void 0)return!1;let r=Atomics.compareExchange(O,n,0,w+1);if(r===-1&&t.add(n),r>0&&Atomics.wait(O,n,r),r!==0)continue;let i=await new Promise(e=>M.loot=e);if(i.count===0)t.add(n);else return e.states=E(i).map(T),e.origin=0,e.end=e.states.length,I(e),!0}},z=e=>g.postMessage(e,e.type===`level`?[e.fingerprints.buffer]:[]),B=async e=>{let t={states:N.states,origin:0,end:N.states.length,successors:void 0,index:0,added:0,generated:0,outDegrees:Array.from({length:32},()=>0),next:[],fingerprintStates:[]};for(;;){let e=L(t);if(e===void 0)return;if(F(t),e===`paused`){let e=new Promise(e=>M.resume=e);z({type:`paused`}),await e,I(t)}else if(!await R(t))break}if(n()===b)return N.states=t.next,Atomics.store(k,w,N.states.length),{type:`level`,level:e,generated:t.generated,added:t.next.length,outDegrees:t.outDegrees,fingerprints:S.getStoredFingerprints(t.next,t.fingerprintStates)}},V=e=>{B(e).then(e=>z(e??{type:`abort`}),()=>z({type:`abort`}))};g.addEventListener(`message`,e=>{let t=e.data;t.type===`level`&&V(t.level),t.type===`resize`&&(D.fingerprints=t.fingerprints,M.resume())}),Atomics.store(k,w,N.states.length),z({type:`ready`})};h().then(e=>{let t=n=>{let r=n.data;if(r.type===`start`){e.removeEventListener?.(`message`,t);try{g(r,e)}catch{e.postMessage({type:`abort`})}}};e.addEventListener(`message`,t),e.start?.()});
|
package/dist/parallel.cjs
CHANGED
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
const e=require("./transfer.cjs"),t=async e=>{if(typeof Worker==`function`){let t=new Worker(new URL(`./parallel-worker.js`,require("url").pathToFileURL(__filename).href),{type:`module`});return t.addEventListener(`message`,t=>e(t.data)),t.addEventListener(`error`,()=>e({type:`abort`})),t}let t=new(await(import(
|
|
10
10
|
/* @vite-ignore */
|
|
11
11
|
/* webpackIgnore: true */
|
|
12
|
-
`node:worker_threads`))).Worker(new URL(`./parallel-worker.js`,require("url").pathToFileURL(__filename).href));return t.on(`message`,e),t.on(`error`,()=>e({type:`abort`})),{postMessage:(e,n)=>t.postMessage(e,n),terminate:()=>void t.terminate()}},n=async n=>{let r=typeof n.config==`string`?e.
|
|
12
|
+
`node:worker_threads`))).Worker(new URL(`./parallel-worker.js`,require("url").pathToFileURL(__filename).href));return t.on(`message`,e),t.on(`error`,()=>e({type:`abort`})),{postMessage:(e,n)=>t.postMessage(e,n),terminate:()=>void t.terminate()}},n=async n=>{let r=typeof n.config==`string`?e.Z(n.config,n.version):n.config,i=n.onPrint??console.log,a={count:0},o=e=>[e.kind,`name`in e?e.name:``,`count`in e?e.count:``,`text`in e?e.text:``].join(` `),s=/* @__PURE__ */ new Set,c=e=>{s.add(o(e)),n.onProgress?.(e)},l=()=>{let t={count:a.count};return e.l({...n,config:r,onPrint:e=>t.count-->0?void 0:i(e),onProgress:e=>{s.has(o(e))||n.onProgress?.(e)}})},u=n.workers??1;if(u<2||typeof SharedArrayBuffer!=`function`||n.dump!==void 0||r.view!==void 0||r.postconditions.length>0||r.possible.length>0)return l();let d=/* @__PURE__ */ new Map,f=e=>{let t=n.loadModule?.(e);return d.set(e,t),t},p=/* @__PURE__ */ new Map,m=e=>{let t=n.loadClass?.(e);return p.set(e,t),t};e.Y(e.x(n.source,r,f)),e.X(n.version);let h=e.J(),g=e.y(r,{source:n.source,loadModule:f,loadClass:m,print:e=>{a.count++,i(e)},files:{readFile:n.readFile,writeFile:n.writeFile},isTool:n.isTool,isTraceRecorded:n.isTraceRecorded,isSanyReported:n.isSanyReported,isWarningEnabled:n.isWarningEnabled,version:n.version});e.p(g,r,c);let _=g.environment,v=e.u(r,_,()=>e.S(n.source,f),c);if(e.d(g.assumptions,_)||!v||v.spec.init===void 0||v.spec.next===void 0||v.properties.liveness.length>0||e.N(_))return l();let y=e.G(),b={fingerprints:e.i()},x=/* @__PURE__ */ new Int32Array(2),S=Array.from({length:u},e.n),C={generatedStates:0,distinctStates:0,queuedStates:0,depth:0,initialStates:void 0,outDegrees:Array.from({length:32},()=>0)},w=[],T=()=>({status:`success`,violation:void 0,failure:void 0,...C,fingerprintDistance:e.g(C.distinctStates,C.generatedStates,()=>{let e=new BigInt64Array(C.distinctStates);return w.reduce((t,n)=>(e.set(n,t),t+n.length),0),e})}),E=t=>{let n=[];for(let r of e.P(t,_,v.spec.scope))if(e.f(C.generatedStates,c),y(r),C.generatedStates++,e.c(v.getFingerprintState(r),x),e.s(b.fingerprints)&&(b.fingerprints=e.a(b.fingerprints)),e.o(b.fingerprints,x[0],x[1])){if(v.findViolatedInvariant(r)||v.findFailedInitialPredicate(r))return!1;if(v.satisfiesConstraints(r)){if(!S[n.length%u].encode(r))return!1;n.push(r),C.distinctStates++}}return w.push(BigInt64Array.from(n,e=>_.runtime.getFingerprint(e))),!0};c({kind:`initial-states-started`});try{if(!E(v.spec.init))return l()}catch(t){if(!(t instanceof e.st))throw t;return l()}if(e.J()!==h)return l();if(C.depth=C.generatedStates===0?0:1,C.initialStates={generated:C.generatedStates,distinct:C.distinctStates},c({kind:`initial-states-computed`,initialStates:C.initialStates}),C.distinctStates===0)return T();let D=[],O={count:u,resolve:e=>{}},k=e=>{D.push(e),(e.type===`abort`||D.length===O.count)&&O.resolve(D.splice(0))},A=e=>new Promise(t=>{O.count=e,O.resolve=t}),j=A(u),M=new Int32Array(new SharedArrayBuffer(u*4)),N=new Int32Array(new SharedArrayBuffer(u*4)),P=await Promise.all(Array.from({length:u},()=>t(k))),F=()=>P.forEach(e=>e.terminate()),I=/* @__PURE__ */ new Map,L=(e,t)=>{let n=e<t?`${e}:${t}`:`${t}:${e}`,r=I.get(n)??new MessageChannel;return I.set(n,r),e<t?r.port1:r.port2};P.forEach((e,t)=>{let i=Array.from({length:u},(e,n)=>n===t?void 0:L(t,n)),a=S[t].finish(),o={type:`start`,source:n.source,config:r,modules:[...d],classes:[...p],index:t,ports:i,seed:a,isTool:n.isTool,isTraceRecorded:n.isTraceRecorded,isWarningEnabled:n.isWarningEnabled,version:n.version,fingerprints:b.fingerprints,requests:M,remaining:N};e.postMessage(o,[...i.filter(e=>e!==void 0),a.words.buffer])});let R=e=>e.some(e=>e.type===`abort`),z=e=>P.forEach(t=>t.postMessage(e)),B=async t=>{let n=t.filter(e=>e.type===`paused`).length;if(n===0||R(t))return t;b.fingerprints=e.a(b.fingerprints);let r=A(n);return z({type:`resize`,fingerprints:b.fingerprints}),[...t.filter(e=>e.type!==`paused`),...await B(await r)]};if(R(await j))return F(),l();for(let e=1;;e++){let t=A(u);M.forEach((e,t)=>Atomics.store(M,t,0)),z({type:`level`,level:e});let n=await B(await t);if(R(n))return F(),l();let r=n.flatMap(e=>e.type===`level`?[e]:[]),i=r.reduce((e,t)=>e+t.added,0);if(C.generatedStates+=r.reduce((e,t)=>e+t.generated,0),C.distinctStates+=i,r.forEach(e=>{e.outDegrees.forEach((e,t)=>C.outDegrees[t]+=e),w.push(e.fingerprints)}),i===0)return F(),T();C.depth++}};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
package/dist/parallel.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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
|
-
import{
|
|
9
|
+
import{G as e,J as t,N as n,P as r,S as i,X as ee,Y as te,Z as a,a as o,c as ne,d as s,f as c,g as l,i as u,l as d,n as f,o as re,p,s as ie,st as m,u as h,x as g,y as _}from"./transfer.js";const ae=async e=>{if(typeof Worker==`function`){let t=new Worker(new URL(`./parallel-worker.js`,import.meta.url),{type:`module`});return t.addEventListener(`message`,t=>e(t.data)),t.addEventListener(`error`,()=>e({type:`abort`})),t}let t=new(await(import(
|
|
10
10
|
/* @vite-ignore */
|
|
11
11
|
/* webpackIgnore: true */
|
|
12
|
-
`node:worker_threads`))).Worker(new URL(`./parallel-worker.js`,import.meta.url));return t.on(`message`,e),t.on(`error`,()=>e({type:`abort`})),{postMessage:(e,n)=>t.postMessage(e,n),terminate:()=>void t.terminate()}},
|
|
12
|
+
`node:worker_threads`))).Worker(new URL(`./parallel-worker.js`,import.meta.url));return t.on(`message`,e),t.on(`error`,()=>e({type:`abort`})),{postMessage:(e,n)=>t.postMessage(e,n),terminate:()=>void t.terminate()}},v=async v=>{let y=typeof v.config==`string`?a(v.config,v.version):v.config,b=v.onPrint??console.log,x={count:0},S=e=>[e.kind,`name`in e?e.name:``,`count`in e?e.count:``,`text`in e?e.text:``].join(` `),C=/* @__PURE__ */ new Set,w=e=>{C.add(S(e)),v.onProgress?.(e)},T=()=>{let e={count:x.count};return d({...v,config:y,onPrint:t=>e.count-->0?void 0:b(t),onProgress:e=>{C.has(S(e))||v.onProgress?.(e)}})},E=v.workers??1;if(E<2||typeof SharedArrayBuffer!=`function`||v.dump!==void 0||y.view!==void 0||y.postconditions.length>0||y.possible.length>0)return T();let D=/* @__PURE__ */ new Map,O=e=>{let t=v.loadModule?.(e);return D.set(e,t),t},k=/* @__PURE__ */ new Map,A=e=>{let t=v.loadClass?.(e);return k.set(e,t),t};te(g(v.source,y,O)),ee(v.version);let oe=t(),j=_(y,{source:v.source,loadModule:O,loadClass:A,print:e=>{x.count++,b(e)},files:{readFile:v.readFile,writeFile:v.writeFile},isTool:v.isTool,isTraceRecorded:v.isTraceRecorded,isSanyReported:v.isSanyReported,isWarningEnabled:v.isWarningEnabled,version:v.version});p(j,y,w);let M=j.environment,N=h(y,M,()=>i(v.source,O),w);if(s(j.assumptions,M)||!N||N.spec.init===void 0||N.spec.next===void 0||N.properties.liveness.length>0||n(M))return T();let P=e(),F={fingerprints:u()},I=/* @__PURE__ */ new Int32Array(2),L=Array.from({length:E},f),R={generatedStates:0,distinctStates:0,queuedStates:0,depth:0,initialStates:void 0,outDegrees:Array.from({length:32},()=>0)},z=[],B=()=>({status:`success`,violation:void 0,failure:void 0,...R,fingerprintDistance:l(R.distinctStates,R.generatedStates,()=>{let e=new BigInt64Array(R.distinctStates);return z.reduce((t,n)=>(e.set(n,t),t+n.length),0),e})}),V=e=>{let t=[];for(let n of r(e,M,N.spec.scope))if(c(R.generatedStates,w),P(n),R.generatedStates++,ne(N.getFingerprintState(n),I),ie(F.fingerprints)&&(F.fingerprints=o(F.fingerprints)),re(F.fingerprints,I[0],I[1])){if(N.findViolatedInvariant(n)||N.findFailedInitialPredicate(n))return!1;if(N.satisfiesConstraints(n)){if(!L[t.length%E].encode(n))return!1;t.push(n),R.distinctStates++}}return z.push(BigInt64Array.from(t,e=>M.runtime.getFingerprint(e))),!0};w({kind:`initial-states-started`});try{if(!V(N.spec.init))return T()}catch(e){if(!(e instanceof m))throw e;return T()}if(t()!==oe)return T();if(R.depth=R.generatedStates===0?0:1,R.initialStates={generated:R.generatedStates,distinct:R.distinctStates},w({kind:`initial-states-computed`,initialStates:R.initialStates}),R.distinctStates===0)return B();let H=[],U={count:E,resolve:e=>{}},W=e=>{H.push(e),(e.type===`abort`||H.length===U.count)&&U.resolve(H.splice(0))},G=e=>new Promise(t=>{U.count=e,U.resolve=t}),K=G(E),q=new Int32Array(new SharedArrayBuffer(E*4)),se=new Int32Array(new SharedArrayBuffer(E*4)),J=await Promise.all(Array.from({length:E},()=>ae(W))),Y=()=>J.forEach(e=>e.terminate()),X=/* @__PURE__ */ new Map,ce=(e,t)=>{let n=e<t?`${e}:${t}`:`${t}:${e}`,r=X.get(n)??new MessageChannel;return X.set(n,r),e<t?r.port1:r.port2};J.forEach((e,t)=>{let n=Array.from({length:E},(e,n)=>n===t?void 0:ce(t,n)),r=L[t].finish(),i={type:`start`,source:v.source,config:y,modules:[...D],classes:[...k],index:t,ports:n,seed:r,isTool:v.isTool,isTraceRecorded:v.isTraceRecorded,isWarningEnabled:v.isWarningEnabled,version:v.version,fingerprints:F.fingerprints,requests:q,remaining:se};e.postMessage(i,[...n.filter(e=>e!==void 0),r.words.buffer])});let Z=e=>e.some(e=>e.type===`abort`),Q=e=>J.forEach(t=>t.postMessage(e)),$=async e=>{let t=e.filter(e=>e.type===`paused`).length;if(t===0||Z(e))return e;F.fingerprints=o(F.fingerprints);let n=G(t);return Q({type:`resize`,fingerprints:F.fingerprints}),[...e.filter(e=>e.type!==`paused`),...await $(await n)]};if(Z(await K))return Y(),T();for(let e=1;;e++){let t=G(E);q.forEach((e,t)=>Atomics.store(q,t,0)),Q({type:`level`,level:e});let n=await $(await t);if(Z(n))return Y(),T();let r=n.flatMap(e=>e.type===`level`?[e]:[]),i=r.reduce((e,t)=>e+t.added,0);if(R.generatedStates+=r.reduce((e,t)=>e+t.generated,0),R.distinctStates+=i,r.forEach(e=>{e.outDegrees.forEach((e,t)=>R.outDegrees[t]+=e),z.push(e.fingerprints)}),i===0)return Y(),B();R.depth++}};export{v as t};
|