tla-ts 0.0.3-dev.c949d82 → 0.0.3-dev.ccbff8c
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/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +167 -36
- package/dist/index.d.ts +167 -36
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +2 -2
- package/dist/parallel.cjs +1 -1
- package/dist/parallel.js +2 -2
- package/dist/run-cli.cjs +1351 -21
- package/dist/run-cli.js +1351 -21
- package/dist/transfer.cjs +83 -34
- package/dist/transfer.js +83 -34
- package/package.json +5 -1
- package/src/ast.ts +55 -7
- 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 +1344 -285
- package/src/cli.ts +8 -1
- package/src/codegen.ts +68 -21
- package/src/config.ts +225 -206
- package/src/environment.ts +423 -127
- package/src/errors.ts +168 -9
- package/src/evaluate.ts +722 -146
- package/src/exit-codes.ts +6 -24
- package/src/index.ts +1 -0
- package/src/instances.ts +4 -2
- package/src/java-overrides.ts +104 -25
- package/src/levels.ts +183 -37
- package/src/lexer.ts +32 -4
- package/src/live-check.ts +204 -148
- package/src/liveness.ts +190 -117
- package/src/obligation-expression.ts +2 -2
- package/src/obligation-source.ts +2 -0
- package/src/parallel-worker.ts +6 -1
- package/src/parallel.ts +57 -6
- package/src/parser.ts +412 -139
- 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 +1405 -416
- package/src/run-cli.ts +1167 -174
- package/src/runtime.ts +16 -0
- package/src/sany-builtins.ts +147 -0
- package/src/sany-generator.ts +3112 -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 +354 -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 +25 -5
- package/src/standard-modules.ts +203 -146
- package/src/standard-ranges.ts +116 -0
- package/src/state-graph.ts +29 -6
- package/src/subexpressions.ts +221 -161
- package/src/substitution-levels.ts +38 -17
- package/src/successors.ts +158 -120
- package/src/symmetry.ts +168 -50
- package/src/tableau.ts +3 -1
- package/src/tlc-ext.ts +13 -17
- package/src/tlc-messages.ts +329 -0
- package/src/tlc-module.ts +49 -21
- package/src/tlc-modules.ts +0 -4
- package/src/tlc-order.ts +55 -9
- package/src/tlc-random.ts +28 -3
- package/src/tlc-replay.ts +655 -0
- package/src/tlc-version.ts +18 -0
- package/src/transfer.ts +15 -3
- package/src/value-sources.ts +29 -0
- package/src/values.ts +683 -256
package/dist/index.d.ts
CHANGED
|
@@ -38,33 +38,41 @@ interface StringExpression {
|
|
|
38
38
|
interface IdentifierExpression {
|
|
39
39
|
kind: "Identifier";
|
|
40
40
|
name: string;
|
|
41
|
+
selectorRanges?: SourceRange[];
|
|
41
42
|
location: SourceLocation;
|
|
42
43
|
resolution?: LocalResolution;
|
|
43
44
|
}
|
|
44
45
|
interface ApplyExpression {
|
|
45
46
|
kind: "Apply";
|
|
46
47
|
operator: string;
|
|
48
|
+
spelling?: string;
|
|
47
49
|
args: Expression[];
|
|
48
50
|
argumentCounts?: number[];
|
|
49
51
|
argumentsRange?: SourceRange;
|
|
52
|
+
selectorRanges?: SourceRange[];
|
|
53
|
+
argumentRanges?: (SourceRange | undefined)[];
|
|
50
54
|
location: SourceLocation;
|
|
51
55
|
resolution?: LocalResolution;
|
|
52
56
|
}
|
|
53
57
|
interface OperatorReferenceExpression {
|
|
54
58
|
kind: "OperatorReference";
|
|
55
59
|
operator: string;
|
|
60
|
+
spelling?: string;
|
|
56
61
|
location: SourceLocation;
|
|
57
62
|
}
|
|
58
63
|
interface LambdaExpression {
|
|
59
64
|
kind: "Lambda";
|
|
60
65
|
params: string[];
|
|
66
|
+
paramRanges?: SourceRange[];
|
|
61
67
|
body: Expression;
|
|
68
|
+
operator?: string;
|
|
62
69
|
location: SourceLocation;
|
|
63
70
|
}
|
|
64
71
|
interface JunctionExpression {
|
|
65
72
|
kind: "And" | "Or";
|
|
66
73
|
operands: Expression[];
|
|
67
74
|
isBulleted?: boolean;
|
|
75
|
+
prefixEnds?: SourceLocation[];
|
|
68
76
|
location: SourceLocation;
|
|
69
77
|
}
|
|
70
78
|
interface PrimeExpression {
|
|
@@ -109,9 +117,11 @@ interface LetExpression {
|
|
|
109
117
|
type BoundPattern = {
|
|
110
118
|
kind: "Name";
|
|
111
119
|
name: string;
|
|
120
|
+
ranges?: SourceRange[];
|
|
112
121
|
} | {
|
|
113
122
|
kind: "Tuple";
|
|
114
123
|
names: string[];
|
|
124
|
+
ranges?: SourceRange[];
|
|
115
125
|
};
|
|
116
126
|
interface Bound {
|
|
117
127
|
pattern: BoundPattern;
|
|
@@ -127,6 +137,7 @@ interface UnboundedQuantifierExpression {
|
|
|
127
137
|
kind: "UnboundedQuantifier";
|
|
128
138
|
quantifier: "Forall" | "Exists";
|
|
129
139
|
names: string[];
|
|
140
|
+
nameRanges?: SourceRange[];
|
|
130
141
|
isTemporal?: boolean;
|
|
131
142
|
body: Expression;
|
|
132
143
|
location: SourceLocation;
|
|
@@ -176,6 +187,7 @@ interface FunctionSetExpression {
|
|
|
176
187
|
interface RecordField {
|
|
177
188
|
name: string;
|
|
178
189
|
value: Expression;
|
|
190
|
+
location: SourceLocation;
|
|
179
191
|
}
|
|
180
192
|
interface RecordExpression {
|
|
181
193
|
kind: "Record" | "RecordSet";
|
|
@@ -209,6 +221,11 @@ interface FunctionApplicationExpression {
|
|
|
209
221
|
args: Expression[];
|
|
210
222
|
location: SourceLocation;
|
|
211
223
|
}
|
|
224
|
+
interface BracketExpression {
|
|
225
|
+
kind: "Bracket";
|
|
226
|
+
args: Expression[];
|
|
227
|
+
location: SourceLocation;
|
|
228
|
+
}
|
|
212
229
|
interface FieldAccessExpression {
|
|
213
230
|
kind: "FieldAccess";
|
|
214
231
|
record: Expression;
|
|
@@ -242,6 +259,7 @@ interface LabelExpression {
|
|
|
242
259
|
kind: "Label";
|
|
243
260
|
name: string;
|
|
244
261
|
params: string[];
|
|
262
|
+
paramRanges?: SourceRange[];
|
|
245
263
|
body: Expression;
|
|
246
264
|
location: SourceLocation;
|
|
247
265
|
}
|
|
@@ -263,9 +281,11 @@ type Selector = {
|
|
|
263
281
|
interface SubexpressionExpression {
|
|
264
282
|
kind: "Subexpression";
|
|
265
283
|
selectors: Selector[];
|
|
284
|
+
selectorRanges?: SourceRange[];
|
|
285
|
+
argumentRanges?: (SourceRange | undefined)[];
|
|
266
286
|
location: SourceLocation;
|
|
267
287
|
}
|
|
268
|
-
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;
|
|
288
|
+
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;
|
|
269
289
|
interface OperatorParam {
|
|
270
290
|
name: string;
|
|
271
291
|
arity: number;
|
|
@@ -288,6 +308,7 @@ interface FunctionDefinition {
|
|
|
288
308
|
body: Expression;
|
|
289
309
|
isLocal: boolean;
|
|
290
310
|
isRecursive: boolean;
|
|
311
|
+
isSelfReferential?: boolean;
|
|
291
312
|
location: SourceLocation;
|
|
292
313
|
}
|
|
293
314
|
type Definition = OperatorDefinition | FunctionDefinition;
|
|
@@ -304,6 +325,7 @@ interface Assumption {
|
|
|
304
325
|
}
|
|
305
326
|
interface InstanceSubstitution {
|
|
306
327
|
name: string;
|
|
328
|
+
nameRange: SourceRange;
|
|
307
329
|
expression: Expression;
|
|
308
330
|
}
|
|
309
331
|
interface Instance {
|
|
@@ -323,6 +345,7 @@ interface NewSymbol {
|
|
|
323
345
|
arity: number;
|
|
324
346
|
level: "Constant" | "Variable" | "State" | "Action" | "Temporal";
|
|
325
347
|
set: Expression | undefined;
|
|
348
|
+
nameRange?: SourceRange;
|
|
326
349
|
location: SourceLocation;
|
|
327
350
|
}
|
|
328
351
|
interface AssumeProve {
|
|
@@ -372,6 +395,7 @@ type StepBody = UseOrHide | Instance | DefineStep | {
|
|
|
372
395
|
} | {
|
|
373
396
|
kind: "Take";
|
|
374
397
|
names: string[];
|
|
398
|
+
nameRanges?: SourceRange[];
|
|
375
399
|
bounds: Bound[];
|
|
376
400
|
} | {
|
|
377
401
|
kind: "Witness";
|
|
@@ -379,6 +403,7 @@ type StepBody = UseOrHide | Instance | DefineStep | {
|
|
|
379
403
|
} | {
|
|
380
404
|
kind: "Pick";
|
|
381
405
|
names: string[];
|
|
406
|
+
nameRanges?: SourceRange[];
|
|
382
407
|
bounds: Bound[];
|
|
383
408
|
body: Expression;
|
|
384
409
|
} | {
|
|
@@ -396,6 +421,7 @@ interface ProofStep {
|
|
|
396
421
|
token: string;
|
|
397
422
|
body: StepBody;
|
|
398
423
|
head: SourceRange;
|
|
424
|
+
statement: SourceRange;
|
|
399
425
|
proof: Proof | undefined;
|
|
400
426
|
location: SourceLocation;
|
|
401
427
|
}
|
|
@@ -406,11 +432,9 @@ interface Theorem {
|
|
|
406
432
|
location: SourceLocation;
|
|
407
433
|
}
|
|
408
434
|
type ModuleUnit = {
|
|
409
|
-
kind: "Constants";
|
|
410
|
-
declarations: Declaration[];
|
|
411
|
-
} | {
|
|
412
|
-
kind: "Variables";
|
|
435
|
+
kind: "Constants" | "Variables";
|
|
413
436
|
declarations: Declaration[];
|
|
437
|
+
location: SourceLocation;
|
|
414
438
|
} | {
|
|
415
439
|
kind: "Recursive";
|
|
416
440
|
declarations: Declaration[];
|
|
@@ -448,6 +472,7 @@ interface Module {
|
|
|
448
472
|
uses: UseOrHide[];
|
|
449
473
|
units: ModuleUnit[];
|
|
450
474
|
}
|
|
475
|
+
type TlcVersion = "1.7.4" | "master";
|
|
451
476
|
type ConfigValue = {
|
|
452
477
|
kind: "Number";
|
|
453
478
|
value: number;
|
|
@@ -494,7 +519,46 @@ interface ModelConfig {
|
|
|
494
519
|
periodic: string | undefined;
|
|
495
520
|
rlReward: string | undefined;
|
|
496
521
|
}
|
|
497
|
-
export declare const parseConfig: (source: string) => ModelConfig;
|
|
522
|
+
export declare const parseConfig: (source: string, version?: TlcVersion) => ModelConfig;
|
|
523
|
+
interface JavaOverride {
|
|
524
|
+
module: string;
|
|
525
|
+
operator: string;
|
|
526
|
+
signature: string;
|
|
527
|
+
isMatched: boolean;
|
|
528
|
+
}
|
|
529
|
+
export declare class TlaError extends Error {
|
|
530
|
+
constructor(message: string, cause?: unknown);
|
|
531
|
+
}
|
|
532
|
+
interface SyntaxFailure {
|
|
533
|
+
reason: string;
|
|
534
|
+
line: number;
|
|
535
|
+
column: number;
|
|
536
|
+
isEnd: boolean;
|
|
537
|
+
}
|
|
538
|
+
interface SanyError {
|
|
539
|
+
location: string;
|
|
540
|
+
message: string;
|
|
541
|
+
}
|
|
542
|
+
interface SanyReport {
|
|
543
|
+
errors: SanyError[];
|
|
544
|
+
warnings: SanyError[];
|
|
545
|
+
isFatal: boolean;
|
|
546
|
+
parseError?: string;
|
|
547
|
+
}
|
|
548
|
+
export declare class TlaSyntaxError extends TlaError {
|
|
549
|
+
failure: SyntaxFailure | undefined;
|
|
550
|
+
sany: SanyReport | undefined;
|
|
551
|
+
constructor(message: string, cause?: unknown, failure?: SyntaxFailure, sany?: SanyReport);
|
|
552
|
+
}
|
|
553
|
+
export declare class TlaConfigError extends TlaError {
|
|
554
|
+
constructor(message: string, cause?: unknown);
|
|
555
|
+
}
|
|
556
|
+
export declare class TlaEvaluationError extends TlaError {
|
|
557
|
+
constructor(message: string, cause?: unknown);
|
|
558
|
+
}
|
|
559
|
+
export declare class TlaUnsupportedError extends TlaError {
|
|
560
|
+
constructor(message: string, cause?: unknown);
|
|
561
|
+
}
|
|
498
562
|
interface ModelValue {
|
|
499
563
|
kind: "ModelValue";
|
|
500
564
|
name: string;
|
|
@@ -518,6 +582,7 @@ interface FunctionValue {
|
|
|
518
582
|
hash: number;
|
|
519
583
|
fingerprint: number;
|
|
520
584
|
writtenKeys: Value[] | undefined;
|
|
585
|
+
functionClass: FunctionClass | undefined;
|
|
521
586
|
}
|
|
522
587
|
interface IntervalValue {
|
|
523
588
|
kind: "Interval";
|
|
@@ -556,10 +621,15 @@ interface SetOperationValue {
|
|
|
556
621
|
left: Value;
|
|
557
622
|
right: Value;
|
|
558
623
|
}
|
|
624
|
+
interface FilteredSetSource {
|
|
625
|
+
names: string;
|
|
626
|
+
predicate: string;
|
|
627
|
+
}
|
|
559
628
|
interface FilteredSetValue {
|
|
560
629
|
kind: "FilteredSet";
|
|
561
630
|
base: Value;
|
|
562
631
|
test: (element: Value) => boolean;
|
|
632
|
+
source?: FilteredSetSource;
|
|
563
633
|
}
|
|
564
634
|
interface UnionValue {
|
|
565
635
|
kind: "Union";
|
|
@@ -578,39 +648,14 @@ interface LazyFunctionValue {
|
|
|
578
648
|
domain: Value;
|
|
579
649
|
apply: (argument: Value) => Value;
|
|
580
650
|
source?: LazyFunctionSource;
|
|
651
|
+
functionClass?: FunctionClass;
|
|
581
652
|
}
|
|
582
653
|
type Value = boolean | number | string | ModelValue | SetValue | MixedSetValue | FunctionValue | IntervalValue | InfiniteSetValue | SubsetValue | FunctionSetValue | RecordSetValue | ProductSetValue | SequenceSetValue | SetOperationValue | FilteredSetValue | UnionValue | LazyFunctionValue;
|
|
654
|
+
type FunctionClass = "lambda" | "tuple" | "record";
|
|
583
655
|
export declare const formatValue: (value: Value, isStrict?: boolean, isNormalized?: boolean) => string;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
interface SyntaxFailure {
|
|
656
|
+
interface FingerprintFailure {
|
|
657
|
+
sources: Expression[];
|
|
588
658
|
reason: string;
|
|
589
|
-
line: number;
|
|
590
|
-
column: number;
|
|
591
|
-
isEnd: boolean;
|
|
592
|
-
}
|
|
593
|
-
interface SanyError {
|
|
594
|
-
location: string;
|
|
595
|
-
message: string;
|
|
596
|
-
}
|
|
597
|
-
interface SanyReport {
|
|
598
|
-
errors: SanyError[];
|
|
599
|
-
isFatal: boolean;
|
|
600
|
-
}
|
|
601
|
-
export declare class TlaSyntaxError extends TlaError {
|
|
602
|
-
failure: SyntaxFailure | undefined;
|
|
603
|
-
sany: SanyReport | undefined;
|
|
604
|
-
constructor(message: string, cause?: unknown, failure?: SyntaxFailure, sany?: SanyReport);
|
|
605
|
-
}
|
|
606
|
-
export declare class TlaConfigError extends TlaError {
|
|
607
|
-
constructor(message: string, cause?: unknown);
|
|
608
|
-
}
|
|
609
|
-
export declare class TlaEvaluationError extends TlaError {
|
|
610
|
-
constructor(message: string, cause?: unknown);
|
|
611
|
-
}
|
|
612
|
-
export declare class TlaUnsupportedError extends TlaError {
|
|
613
|
-
constructor(message: string, cause?: unknown);
|
|
614
659
|
}
|
|
615
660
|
interface StateDump {
|
|
616
661
|
path: string;
|
|
@@ -632,33 +677,110 @@ interface CheckOptions {
|
|
|
632
677
|
workers?: number;
|
|
633
678
|
livenessCheck?: "default" | "final";
|
|
634
679
|
dump?: StateDump;
|
|
680
|
+
isTool?: boolean;
|
|
681
|
+
isTraceRecorded?: boolean;
|
|
682
|
+
isSanyReported?: boolean;
|
|
683
|
+
isWarningEnabled?: boolean;
|
|
684
|
+
version?: TlcVersion;
|
|
685
|
+
onProgress?: (progress: CheckProgress) => void;
|
|
686
|
+
}
|
|
687
|
+
interface InitialStatesProgress {
|
|
688
|
+
kind: "initial-states-progress";
|
|
689
|
+
count: number;
|
|
690
|
+
}
|
|
691
|
+
interface InitialStateViolation {
|
|
692
|
+
kind: "initial-state-violation";
|
|
693
|
+
status: "invariant-violation" | "liveness-violation";
|
|
694
|
+
name: string;
|
|
695
|
+
state: Record<string, Value>;
|
|
635
696
|
}
|
|
697
|
+
type OutputLine = string | InitialStatesProgress | InitialStateViolation;
|
|
698
|
+
type CheckProgress = {
|
|
699
|
+
kind: "parsed";
|
|
700
|
+
} | {
|
|
701
|
+
kind: "constant-level-invariant";
|
|
702
|
+
name: string;
|
|
703
|
+
} | {
|
|
704
|
+
kind: "state-level-property";
|
|
705
|
+
name: string;
|
|
706
|
+
} | {
|
|
707
|
+
kind: "liveness-initializing";
|
|
708
|
+
isSymmetric: boolean;
|
|
709
|
+
isConstrained: boolean;
|
|
710
|
+
} | {
|
|
711
|
+
kind: "liveness-prepared";
|
|
712
|
+
branches: number;
|
|
713
|
+
} | {
|
|
714
|
+
kind: "initial-states-started";
|
|
715
|
+
} | InitialStatesProgress | {
|
|
716
|
+
kind: "initial-states-computed";
|
|
717
|
+
initialStates: InitialStates;
|
|
718
|
+
} | {
|
|
719
|
+
kind: "progress";
|
|
720
|
+
statistics: SearchStatistics;
|
|
721
|
+
} | {
|
|
722
|
+
kind: "liveness-started";
|
|
723
|
+
branches: number;
|
|
724
|
+
isComplete: boolean;
|
|
725
|
+
states: number;
|
|
726
|
+
statistics: SearchStatistics;
|
|
727
|
+
} | {
|
|
728
|
+
kind: "liveness-finished";
|
|
729
|
+
} | {
|
|
730
|
+
kind: "warning";
|
|
731
|
+
code: number;
|
|
732
|
+
text: string;
|
|
733
|
+
} | ({
|
|
734
|
+
kind: "java-override";
|
|
735
|
+
} & JavaOverride);
|
|
736
|
+
interface SearchStatistics extends Pick<CheckResult, "generatedStates" | "distinctStates" | "queuedStates" | "depth"> {}
|
|
636
737
|
type CheckStatus = "success" | "assumption-violation" | "invariant-violation" | "property-violation" | "liveness-violation" | "postcondition-violation" | "deadlock" | "error";
|
|
637
738
|
interface TraceStep {
|
|
638
739
|
action: string | undefined;
|
|
639
740
|
label: string | undefined;
|
|
640
741
|
state: Record<string, Value>;
|
|
742
|
+
output?: OutputLine[];
|
|
641
743
|
}
|
|
642
744
|
interface Violation {
|
|
643
745
|
name: string;
|
|
644
746
|
properties?: string[];
|
|
645
747
|
trace: TraceStep[];
|
|
748
|
+
traceOutput?: OutputLine[];
|
|
646
749
|
loopStart: number | undefined;
|
|
647
750
|
loopLabel?: string;
|
|
648
751
|
message?: string;
|
|
649
752
|
counts?: string;
|
|
650
753
|
unwitnessed?: Postcondition;
|
|
754
|
+
postcondition?: Postcondition;
|
|
755
|
+
warning?: {
|
|
756
|
+
code: number;
|
|
757
|
+
text: string;
|
|
758
|
+
};
|
|
651
759
|
}
|
|
652
760
|
interface Postcondition {
|
|
653
761
|
name: string;
|
|
762
|
+
code: number;
|
|
654
763
|
message: string;
|
|
655
764
|
counts?: string;
|
|
656
765
|
}
|
|
657
766
|
interface EvaluationFailure {
|
|
767
|
+
code: number;
|
|
658
768
|
message: string;
|
|
769
|
+
toolMessage: string;
|
|
659
770
|
trace: TraceStep[];
|
|
771
|
+
traceOutput?: OutputLine[];
|
|
660
772
|
initialState: Record<string, Value> | undefined;
|
|
661
773
|
exitCode: number;
|
|
774
|
+
callStack: Expression[] | undefined;
|
|
775
|
+
isCallStackFirst?: boolean;
|
|
776
|
+
fingerprint?: FingerprintFailure;
|
|
777
|
+
traceFailure?: FailureMessage;
|
|
778
|
+
postcondition?: Postcondition;
|
|
779
|
+
isWithoutStatistics?: boolean;
|
|
780
|
+
}
|
|
781
|
+
interface InitialStates {
|
|
782
|
+
generated: number;
|
|
783
|
+
distinct: number;
|
|
662
784
|
}
|
|
663
785
|
interface CheckResult {
|
|
664
786
|
status: CheckStatus;
|
|
@@ -668,9 +790,18 @@ interface CheckResult {
|
|
|
668
790
|
distinctStates: number;
|
|
669
791
|
queuedStates: number;
|
|
670
792
|
depth: number;
|
|
793
|
+
initialStates: InitialStates | undefined;
|
|
671
794
|
outDegrees: number[] | undefined;
|
|
672
795
|
fingerprintDistance: bigint | undefined;
|
|
796
|
+
additionalViolation?: Violation;
|
|
797
|
+
liveCallStack?: Expression[];
|
|
798
|
+
violationOutDegrees?: number[];
|
|
799
|
+
}
|
|
800
|
+
interface FailureMessage {
|
|
801
|
+
code: number;
|
|
802
|
+
message: string;
|
|
803
|
+
toolMessage: string;
|
|
673
804
|
}
|
|
674
805
|
export declare const check: (options: CheckOptions) => Promise<CheckResult>;
|
|
675
806
|
export declare const parseModule: (source: string) => Module;
|
|
676
|
-
export type { CheckOptions, CheckResult, CheckStatus, ConfigValue, ConstantAssignment, EvaluationFailure, ModelConfig, Module, Substitution, TraceStep, Value, Violation };
|
|
807
|
+
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{Z as e,at as t,ft as n,ot as r,pt as i,q as a,st as o,w as s}from"./transfer.js";import{t as c}from"./parallel.js";export{t as TlaConfigError,r as TlaError,o as TlaEvaluationError,n as TlaSyntaxError,i as TlaUnsupportedError,c as check,a as formatValue,e as parseConfig,s as parseModule};
|
package/dist/parallel-worker.cjs
CHANGED
|
@@ -9,4 +9,4 @@
|
|
|
9
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,n=(t,n)=>{let r=new Map(t.modules),i=e=>r.get(e),a=new Map(t.classes);e.
|
|
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()}},v=async v=>{let y=typeof v.config==`string`?
|
|
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};
|