tla-ts 0.0.4-dev.b254db0 → 0.0.4-dev.ca40dfe
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 +31 -10
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/deciders.cjs +27 -27
- package/dist/deciders.js +34 -34
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -14
- package/dist/index.d.ts +12 -14
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove-worker.cjs +1 -1
- package/dist/prove-worker.js +1 -1
- package/dist/prove.cjs +37 -27
- package/dist/prove.js +39 -29
- package/dist/run.cjs +45 -0
- package/dist/run.js +45 -0
- package/dist/tlapm.cjs +2 -2
- package/dist/tlapm.js +2 -2
- package/dist/transfer.cjs +76 -86
- package/dist/transfer.js +73 -83
- package/dist/worker.cjs +6 -6
- package/dist/worker.js +6 -6
- package/package.json +1 -1
- package/src/ast.ts +2 -2
- package/src/bags.ts +22 -23
- package/src/builtins.ts +16 -8
- package/src/check.ts +131 -1154
- package/src/{cli-options.ts → cli/options.ts} +54 -9
- package/src/cli/run.ts +63 -0
- package/src/cli/shared.ts +106 -0
- package/src/cli/tlapm.ts +374 -0
- package/src/cli/tlc.ts +941 -0
- package/src/cli/xml-exporter.ts +221 -0
- package/src/cli.ts +1 -1
- package/src/codegen.ts +17 -15
- package/src/config.ts +5 -5
- package/src/dependencies.ts +4 -6
- package/src/environment.ts +55 -60
- package/src/errors.ts +12 -36
- package/src/evaluate.ts +81 -101
- package/src/exit-codes.ts +1 -1
- package/src/fingerprints.ts +3 -3
- package/src/instances.ts +56 -46
- package/src/java-overrides.ts +79 -41
- package/src/json.ts +31 -36
- package/src/levels.ts +10 -13
- package/src/{live-check.ts → liveness-checker.ts} +169 -142
- package/src/liveness.ts +38 -34
- package/src/obligations/action.ts +9 -45
- package/src/obligations/{anon.ts → anonymize.ts} +13 -25
- package/src/obligations/equality.ts +260 -0
- package/src/obligations/expression.ts +42 -517
- package/src/obligations/generate.ts +88 -778
- package/src/obligations/index.ts +20 -22
- package/src/obligations/levels.ts +36 -41
- package/src/obligations/module.ts +88 -708
- package/src/obligations/normalize.ts +554 -0
- package/src/obligations/operators.ts +176 -0
- package/src/obligations/pragma.ts +21 -15
- package/src/obligations/printer.ts +81 -188
- package/src/obligations/proof.ts +0 -1
- package/src/obligations/regroup.ts +100 -0
- package/src/obligations/simplify.ts +668 -0
- package/src/obligations/source.ts +25 -131
- package/src/obligations/{deref.ts → subexpression.ts} +48 -56
- package/src/obligations/substitution.ts +261 -0
- package/src/obligations/temporal.ts +28 -26
- package/src/obligations/tuples.ts +37 -53
- package/src/parallel-worker.ts +37 -33
- package/src/parallel.ts +30 -24
- package/src/parser.ts +67 -74
- package/src/{pcal-ast.ts → pcal/ast.ts} +2 -17
- package/src/{pcal-parse.ts → pcal/parse.ts} +28 -64
- package/src/{pcal-tokenize.ts → pcal/tokenize.ts} +10 -39
- package/src/{pcal-translate.ts → pcal/translate.ts} +30 -109
- package/src/{pcal-validate.ts → pcal/validate.ts} +10 -20
- package/src/prove/decide-pool.ts +7 -12
- package/src/{obligations/pickle.ts → prove/first-order.ts} +79 -2
- package/src/prove/isabelle/decide.ts +3 -6
- package/src/prove/isabelle/encode.ts +35 -93
- package/src/prove/isabelle/isar/inner-syntax.ts +1 -1
- package/src/prove/isabelle/isar/method.ts +3 -3
- package/src/prove/isabelle/isar/type-check.ts +1 -1
- package/src/prove/isabelle/provers/blast/blast.ts +1 -1
- package/src/prove/isabelle/provers/blast/branch.ts +1 -1
- package/src/prove/isabelle/provers/blast/term.ts +3 -4
- package/src/prove/isabelle/provers/clasimp.ts +1 -1
- package/src/prove/isabelle/provers/classical.ts +3 -3
- package/src/prove/isabelle/provers/hypsubst.ts +1 -9
- package/src/prove/isabelle/pure/conv.ts +1 -1
- package/src/prove/isabelle/pure/drule.ts +2 -2
- package/src/prove/isabelle/pure/envir.ts +3 -35
- package/src/prove/isabelle/pure/logic.ts +4 -76
- package/src/prove/isabelle/pure/name.ts +1 -13
- package/src/prove/isabelle/pure/net.ts +2 -49
- package/src/prove/isabelle/pure/pattern.ts +3 -22
- package/src/prove/isabelle/pure/raw-simplifier.ts +3 -18
- package/src/prove/isabelle/pure/seq.ts +0 -23
- package/src/prove/isabelle/pure/simplifier.ts +2 -8
- package/src/prove/isabelle/pure/table.ts +1 -8
- package/src/prove/isabelle/pure/tactic.ts +5 -113
- package/src/prove/isabelle/pure/tactical.ts +1 -84
- package/src/prove/isabelle/pure/term-ord.ts +1 -55
- package/src/prove/isabelle/pure/term.ts +8 -128
- package/src/prove/isabelle/pure/thm.ts +4 -27
- package/src/prove/isabelle/pure/type.ts +0 -12
- package/src/prove/isabelle/pure/unify.ts +1 -1
- package/src/prove/isabelle/tla/classical-setup.ts +1 -1
- package/src/prove/ocaml.ts +1 -1
- package/src/prove/prep/action.ts +23 -36
- package/src/prove/prep/enabled-axioms.ts +2 -2
- package/src/prove/prep/fingerprint.ts +3 -3
- package/src/prove/prep/level-comparison.ts +9 -37
- package/src/prove/prep/md5.ts +2 -9
- package/src/prove/prep/normalize.ts +309 -0
- package/src/prove/prove-worker.ts +2 -5
- package/src/prove/prove.ts +98 -111
- package/src/prove/ptl/encode.ts +19 -31
- package/src/prove/smt/axioms.ts +45 -58
- package/src/prove/smt/encode.ts +124 -15
- package/src/prove/smt/instances.ts +2 -3
- package/src/prove/smt/rewrite.ts +24 -31
- package/src/prove/smt/solver/ast-util.ts +0 -56
- package/src/prove/smt/solver/case-split-queue.ts +1 -1
- package/src/prove/smt/solver/enode.ts +1 -1
- package/src/prove/smt/solver/lp/dep-intervals.ts +0 -14
- package/src/prove/smt/solver/model-macro-solver.ts +1 -1
- package/src/prove/smt/solver/nlsat/algebraic.ts +3 -3
- package/src/prove/smt/solver/nlsat/atoms.ts +1 -1
- package/src/prove/smt/solver/nlsat/explain.ts +1 -1
- package/src/prove/smt/solver/nlsat/interval-set.ts +1 -1
- package/src/prove/smt/solver/nlsat/levelwise.ts +4 -7
- package/src/prove/smt/solver/nlsat/polynomial.ts +4 -4
- package/src/prove/smt/solver/nlsat/upolynomial.ts +2 -2
- package/src/prove/smt/solver/pattern-inference.ts +1 -1
- package/src/prove/smt/solver/relevancy.ts +2 -2
- package/src/prove/smt/solver/rewriter.ts +1 -1
- package/src/prove/smt/solver/solver.ts +2 -2
- package/src/{tlapm-cache.ts → prove/tlapm/cache.ts} +11 -11
- package/src/{ocaml-marshal.ts → prove/tlapm/ocaml-marshal.ts} +1 -1
- package/src/prove/verdict.ts +0 -5
- package/src/prove/zenon/decide.ts +5 -11
- package/src/prove/zenon/encode.ts +21 -80
- package/src/prove/zenon/eqrel.ts +1 -1
- package/src/prove/zenon/equality-rules.ts +1 -1
- package/src/prove/zenon/expr.ts +2 -2
- package/src/prove/zenon/index-table.ts +1 -1
- package/src/prove/zenon/isar.ts +1 -1
- package/src/prove/zenon/llproof.ts +1 -1
- package/src/prove/zenon/mltoll.ts +1 -1
- package/src/prove/zenon/node.ts +1 -1
- package/src/prove/zenon/search.ts +1 -1
- package/src/prove/zenon/tla/terms.ts +1 -20
- package/src/prove/zenon/tla/tla.ts +1 -1
- package/src/randomization.ts +19 -24
- package/src/resolve.ts +15 -22
- package/src/runtime.ts +8 -8
- package/src/{sany-builtins.ts → sany/builtins.ts} +1 -1
- package/src/{sany-generator.ts → sany/generator.ts} +38 -55
- package/src/{sany-levels.ts → sany/levels.ts} +45 -48
- package/src/{sany-lexer.ts → sany/lexer.ts} +2 -3
- package/src/{sany-linter.ts → sany/linter.ts} +1 -1
- package/src/{sany-modules.ts → sany/modules.ts} +2 -2
- package/src/{sany-nodes.ts → sany/nodes.ts} +2 -2
- package/src/{sany-parse-error.ts → sany/parse-error.ts} +2 -2
- package/src/{sany-report.ts → sany/report.ts} +16 -17
- package/src/{sany-selectors.ts → sany/selectors.ts} +3 -5
- package/src/{sany-source.ts → sany/source.ts} +6 -7
- package/src/{sany-xml.ts → sany/xml.ts} +5 -6
- package/src/search.ts +969 -0
- package/src/spec-description.ts +26 -20
- package/src/{standard-levels.ts → standard-definitions.ts} +118 -2
- package/src/standard-modules.ts +16 -20
- package/src/state-graph.ts +9 -8
- package/src/substitution-levels.ts +2 -2
- package/src/successors.ts +16 -19
- package/src/symmetry.ts +1 -1
- package/src/tableau.ts +6 -7
- package/src/tlc/fingerprint.ts +214 -0
- package/src/{tlc-messages.ts → tlc/messages.ts} +119 -7
- package/src/{tlc-order.ts → tlc/order.ts} +7 -7
- package/src/{tlc-random.ts → tlc/random.ts} +3 -213
- package/src/{tlc-replay.ts → tlc/replay.ts} +40 -36
- package/src/{tlc-module.ts → tlc/tlc-operators.ts} +9 -9
- package/src/{tlc-ext.ts → tlc/tlcext-operators.ts} +30 -25
- package/src/transfer.ts +32 -32
- package/src/values.ts +72 -67
- package/src/worker.ts +1 -4
- package/dist/run-cli.cjs +0 -45
- package/dist/run-cli.js +0 -45
- package/src/canonical.ts +0 -40
- package/src/obligations/ctx.ts +0 -64
- package/src/prove/prep/defs.ts +0 -33
- package/src/prove/prep/elab.ts +0 -156
- package/src/prove/prep/enabled.ts +0 -43
- package/src/prove/prep/flatten.ts +0 -70
- package/src/prove/prep/trivial.ts +0 -22
- package/src/prove/smt/axiomatize.ts +0 -69
- package/src/prove/smt/simplify.ts +0 -57
- package/src/run-cli.ts +0 -1806
- package/src/standard-ranges.ts +0 -116
- package/src/value-sources.ts +0 -29
- /package/src/prove/prep/{pragma.ts → methods.ts} +0 -0
- /package/src/{tlc-modules.ts → tlc/jar-data.ts} +0 -0
- /package/src/{tlc-summary.ts → tlc/summary.ts} +0 -0
- /package/src/{tlc-version.ts → tlc/version.ts} +0 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// tlapm's E_subst: substitutions for de Bruijn indices, applied to every part of an expression.
|
|
2
|
+
|
|
3
|
+
import { TlaProofError } from "../errors";
|
|
4
|
+
import {
|
|
5
|
+
at,
|
|
6
|
+
mapAccumulate,
|
|
7
|
+
mapBoundDomains,
|
|
8
|
+
mapDefnBody,
|
|
9
|
+
mapExceptSpecs,
|
|
10
|
+
mapSelectorArgs,
|
|
11
|
+
stripProps,
|
|
12
|
+
type Bound,
|
|
13
|
+
type Defn,
|
|
14
|
+
type Expr,
|
|
15
|
+
type ExprCore,
|
|
16
|
+
type Hyp,
|
|
17
|
+
type Sequent,
|
|
18
|
+
} from "./expression";
|
|
19
|
+
|
|
20
|
+
export type Substitution =
|
|
21
|
+
| { kind: "Shift"; amount: number }
|
|
22
|
+
| { kind: "Cons"; expression: Expr; rest: Substitution }
|
|
23
|
+
| { kind: "Compose"; outer: Substitution; inner: Substitution }
|
|
24
|
+
| { kind: "Bump"; amount: number; rest: Substitution };
|
|
25
|
+
|
|
26
|
+
export const shift = (amount: number): Substitution => ({ kind: "Shift", amount });
|
|
27
|
+
|
|
28
|
+
export const consSubstitution = (expression: Expr, rest: Substitution): Substitution => ({
|
|
29
|
+
kind: "Cons",
|
|
30
|
+
expression,
|
|
31
|
+
rest,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Binds the expressions in order, so the last one becomes index 1.
|
|
35
|
+
export const consAll = (expressions: Expr[], rest: Substitution) =>
|
|
36
|
+
expressions.reduce((inner, expression) => consSubstitution(expression, inner), rest);
|
|
37
|
+
|
|
38
|
+
export const bumpBy = (amount: number, substitution: Substitution): Substitution =>
|
|
39
|
+
substitution.kind === "Bump"
|
|
40
|
+
? { kind: "Bump", amount: substitution.amount + amount, rest: substitution.rest }
|
|
41
|
+
: { kind: "Bump", amount, rest: substitution };
|
|
42
|
+
|
|
43
|
+
const applyIndex = (substitution: Substitution, index: number, from: Expr): Expr => {
|
|
44
|
+
switch (substitution.kind) {
|
|
45
|
+
case "Shift":
|
|
46
|
+
return at({ kind: "Ix", index: substitution.amount + index }, from);
|
|
47
|
+
case "Cons":
|
|
48
|
+
return index === 1
|
|
49
|
+
? at(stripProps(substitution.expression), from)
|
|
50
|
+
: applyIndex(substitution.rest, index - 1, from);
|
|
51
|
+
case "Compose":
|
|
52
|
+
return substituteExpr(substitution.outer, applyIndex(substitution.inner, index, from));
|
|
53
|
+
case "Bump":
|
|
54
|
+
return index <= substitution.amount
|
|
55
|
+
? at({ kind: "Ix", index }, from)
|
|
56
|
+
: substituteExpr(
|
|
57
|
+
shift(substitution.amount),
|
|
58
|
+
applyIndex(substitution.rest, index - substitution.amount, from),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const substituteExprs = (substitution: Substitution, expressions: Expr[]) =>
|
|
64
|
+
expressions.map((expression) => substituteExpr(substitution, expression));
|
|
65
|
+
|
|
66
|
+
// Beta-reduces a lambda applied to arguments, as E_subst.normalize does.
|
|
67
|
+
export const normalizeApply = (operator: Expr, args: Expr[]): ExprCore => {
|
|
68
|
+
if (operator.kind === "Lambda") {
|
|
69
|
+
if (operator.params.length !== args.length) throw new TlaProofError("Arity mismatch");
|
|
70
|
+
return stripProps(substituteExpr(consAll(args, shift(0)), operator.body));
|
|
71
|
+
}
|
|
72
|
+
if (operator.kind === "Apply") {
|
|
73
|
+
return { kind: "Apply", operator: operator.operator, args: [...operator.args, ...args] };
|
|
74
|
+
}
|
|
75
|
+
return args.length === 0 ? stripProps(operator) : { kind: "Apply", operator, args };
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const substituteBounds = (
|
|
79
|
+
substitution: Substitution,
|
|
80
|
+
bounds: Bound[],
|
|
81
|
+
): [Substitution, Bound[]] => [
|
|
82
|
+
bumpBy(bounds.length, substitution),
|
|
83
|
+
mapBoundDomains(bounds, (domain) => substituteExpr(substitution, domain)),
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
export const substituteDefn = (substitution: Substitution, definition: Defn): Defn => {
|
|
87
|
+
switch (definition.kind) {
|
|
88
|
+
case "Recursive":
|
|
89
|
+
case "Operator":
|
|
90
|
+
case "Bpragma":
|
|
91
|
+
return mapDefnBody(definition, (body) => substituteExpr(substitution, body));
|
|
92
|
+
case "Instance": {
|
|
93
|
+
const inner = bumpBy(definition.instance.args.length, substitution);
|
|
94
|
+
return {
|
|
95
|
+
...definition,
|
|
96
|
+
instance: {
|
|
97
|
+
...definition.instance,
|
|
98
|
+
substitutions: definition.instance.substitutions.map((entry) => ({
|
|
99
|
+
name: entry.name,
|
|
100
|
+
expression: substituteExpr(inner, entry.expression),
|
|
101
|
+
})),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const substituteHyp = (substitution: Substitution, hyp: Hyp): Hyp => {
|
|
109
|
+
switch (hyp.kind) {
|
|
110
|
+
case "Fresh":
|
|
111
|
+
return hyp.domain ? { ...hyp, domain: substituteExpr(substitution, hyp.domain) } : hyp;
|
|
112
|
+
case "Flex":
|
|
113
|
+
return hyp;
|
|
114
|
+
case "Defn":
|
|
115
|
+
return { ...hyp, definition: substituteDefn(substitution, hyp.definition) };
|
|
116
|
+
case "Fact":
|
|
117
|
+
return { ...hyp, expression: substituteExpr(substitution, hyp.expression) };
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const substituteSequent = (substitution: Substitution, sequent: Sequent): Sequent => {
|
|
122
|
+
const [inner, context] = mapAccumulate(substitution, sequent.context, (current, hyp) => [
|
|
123
|
+
bumpBy(1, current),
|
|
124
|
+
substituteHyp(current, hyp),
|
|
125
|
+
]);
|
|
126
|
+
return { context, active: substituteExpr(inner, sequent.active) };
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const substituteExpr = (substitution: Substitution, expression: Expr): Expr => {
|
|
130
|
+
const recurse = (inner: Expr) => substituteExpr(substitution, inner);
|
|
131
|
+
switch (expression.kind) {
|
|
132
|
+
case "Internal":
|
|
133
|
+
case "Opaque":
|
|
134
|
+
case "String":
|
|
135
|
+
case "Num":
|
|
136
|
+
case "At":
|
|
137
|
+
return expression;
|
|
138
|
+
case "Ix":
|
|
139
|
+
return applyIndex(substitution, expression.index, expression);
|
|
140
|
+
case "Apply":
|
|
141
|
+
return at(
|
|
142
|
+
normalizeApply(
|
|
143
|
+
recurse(expression.operator),
|
|
144
|
+
substituteExprs(substitution, expression.args),
|
|
145
|
+
),
|
|
146
|
+
expression,
|
|
147
|
+
);
|
|
148
|
+
case "Bang":
|
|
149
|
+
return {
|
|
150
|
+
...expression,
|
|
151
|
+
expression: recurse(expression.expression),
|
|
152
|
+
selectors: expression.selectors.map((selector) => mapSelectorArgs(selector, recurse)),
|
|
153
|
+
};
|
|
154
|
+
case "Lambda":
|
|
155
|
+
return {
|
|
156
|
+
...expression,
|
|
157
|
+
body: substituteExpr(bumpBy(expression.params.length, substitution), expression.body),
|
|
158
|
+
};
|
|
159
|
+
case "Let": {
|
|
160
|
+
const [inner, definitions] = mapAccumulate(
|
|
161
|
+
substitution,
|
|
162
|
+
expression.definitions,
|
|
163
|
+
(current, definition) => [bumpBy(1, current), substituteDefn(current, definition)],
|
|
164
|
+
);
|
|
165
|
+
return { ...expression, definitions, body: substituteExpr(inner, expression.body) };
|
|
166
|
+
}
|
|
167
|
+
case "Sequent":
|
|
168
|
+
return { ...expression, sequent: substituteSequent(substitution, expression.sequent) };
|
|
169
|
+
case "With":
|
|
170
|
+
case "Dot":
|
|
171
|
+
case "Parens":
|
|
172
|
+
return { ...expression, expression: recurse(expression.expression) };
|
|
173
|
+
case "If":
|
|
174
|
+
return {
|
|
175
|
+
...expression,
|
|
176
|
+
condition: recurse(expression.condition),
|
|
177
|
+
consequent: recurse(expression.consequent),
|
|
178
|
+
alternative: recurse(expression.alternative),
|
|
179
|
+
};
|
|
180
|
+
case "List":
|
|
181
|
+
return { ...expression, items: substituteExprs(substitution, expression.items) };
|
|
182
|
+
case "Quant":
|
|
183
|
+
case "Fcn": {
|
|
184
|
+
const [inner, bounds] = substituteBounds(substitution, expression.bounds);
|
|
185
|
+
return { ...expression, bounds, body: substituteExpr(inner, expression.body) };
|
|
186
|
+
}
|
|
187
|
+
case "Tquant":
|
|
188
|
+
return {
|
|
189
|
+
...expression,
|
|
190
|
+
body: substituteExpr(bumpBy(expression.names.length, substitution), expression.body),
|
|
191
|
+
};
|
|
192
|
+
case "Choose":
|
|
193
|
+
return {
|
|
194
|
+
...expression,
|
|
195
|
+
domain: expression.domain && recurse(expression.domain),
|
|
196
|
+
body: substituteExpr(bumpBy(1, substitution), expression.body),
|
|
197
|
+
};
|
|
198
|
+
case "SetSt":
|
|
199
|
+
return {
|
|
200
|
+
...expression,
|
|
201
|
+
domain: recurse(expression.domain),
|
|
202
|
+
body: substituteExpr(bumpBy(1, substitution), expression.body),
|
|
203
|
+
};
|
|
204
|
+
case "SetOf": {
|
|
205
|
+
const [inner, bounds] = substituteBounds(substitution, expression.bounds);
|
|
206
|
+
return { ...expression, bounds, element: substituteExpr(inner, expression.element) };
|
|
207
|
+
}
|
|
208
|
+
case "SetEnum":
|
|
209
|
+
case "Tuple":
|
|
210
|
+
return { ...expression, elements: substituteExprs(substitution, expression.elements) };
|
|
211
|
+
case "Arrow":
|
|
212
|
+
return {
|
|
213
|
+
...expression,
|
|
214
|
+
domain: recurse(expression.domain),
|
|
215
|
+
range: recurse(expression.range),
|
|
216
|
+
};
|
|
217
|
+
case "FcnApp":
|
|
218
|
+
return {
|
|
219
|
+
...expression,
|
|
220
|
+
function: recurse(expression.function),
|
|
221
|
+
args: substituteExprs(substitution, expression.args),
|
|
222
|
+
};
|
|
223
|
+
case "Product":
|
|
224
|
+
return { ...expression, factors: substituteExprs(substitution, expression.factors) };
|
|
225
|
+
case "Rect":
|
|
226
|
+
case "Record":
|
|
227
|
+
return {
|
|
228
|
+
...expression,
|
|
229
|
+
fields: expression.fields.map((field) => ({
|
|
230
|
+
name: field.name,
|
|
231
|
+
value: recurse(field.value),
|
|
232
|
+
})),
|
|
233
|
+
};
|
|
234
|
+
case "Except":
|
|
235
|
+
return {
|
|
236
|
+
...expression,
|
|
237
|
+
function: recurse(expression.function),
|
|
238
|
+
specs: mapExceptSpecs(expression.specs, recurse),
|
|
239
|
+
};
|
|
240
|
+
case "Sub":
|
|
241
|
+
case "Tsub":
|
|
242
|
+
case "Fair":
|
|
243
|
+
return {
|
|
244
|
+
...expression,
|
|
245
|
+
action: recurse(expression.action),
|
|
246
|
+
subscript: recurse(expression.subscript),
|
|
247
|
+
};
|
|
248
|
+
case "Case":
|
|
249
|
+
return {
|
|
250
|
+
...expression,
|
|
251
|
+
arms: expression.arms.map((arm) => ({
|
|
252
|
+
condition: recurse(arm.condition),
|
|
253
|
+
body: recurse(arm.body),
|
|
254
|
+
})),
|
|
255
|
+
other: expression.other && recurse(expression.other),
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export const shiftExpr = (amount: number, expression: Expr) =>
|
|
261
|
+
amount === 0 ? expression : substituteExpr(shift(amount), expression);
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
adjoin,
|
|
6
|
+
adjoinAll,
|
|
6
7
|
applyBuiltin,
|
|
7
8
|
at,
|
|
8
9
|
getFresh,
|
|
10
|
+
getLocalDefn,
|
|
9
11
|
getScopeAt,
|
|
10
12
|
mapChildren,
|
|
11
13
|
type Builtin,
|
|
@@ -20,7 +22,20 @@ const isApplied = (expression: Expr, builtins: Builtin[]) =>
|
|
|
20
22
|
expression.operator.kind === "Internal" &&
|
|
21
23
|
builtins.includes(expression.operator.builtin);
|
|
22
24
|
|
|
23
|
-
const
|
|
25
|
+
const applyUnchanged = (expression: Expr) => applyBuiltin("UNCHANGED", [expression], expression);
|
|
26
|
+
|
|
27
|
+
const getEquality = (expression: Expr) =>
|
|
28
|
+
applyBuiltin("Eq", [applyBuiltin("Prime", [expression], expression), expression], expression);
|
|
29
|
+
|
|
30
|
+
// E_tla_norm.rewrite_unch: UNCHANGED <<x, <<y>>>> as x' = x /\ y' = y.
|
|
31
|
+
export const rewriteUnchanged = (expression: Expr): Expr => {
|
|
32
|
+
const flatten = (inner: Expr): Expr[] =>
|
|
33
|
+
inner.kind === "Tuple" ? inner.elements.flatMap(flatten) : [inner];
|
|
34
|
+
const items = flatten(expression);
|
|
35
|
+
if (items.length === 0) return at({ kind: "Internal", builtin: "TRUE" }, expression);
|
|
36
|
+
if (items.length === 1) return getEquality(items[0]);
|
|
37
|
+
return at({ kind: "List", bullet: "And", items: items.map(getEquality) }, expression);
|
|
38
|
+
};
|
|
24
39
|
|
|
25
40
|
// Each visitor rewrites the outermost match and leaves the rest of the tree as it is.
|
|
26
41
|
const rewrite =
|
|
@@ -80,28 +95,22 @@ export const expandAction = rewrite((expression, recurse) => {
|
|
|
80
95
|
const subscript = recurse(expression.subscript);
|
|
81
96
|
const step =
|
|
82
97
|
expression.modal === "Box"
|
|
83
|
-
? applyBuiltin("Disj", [action,
|
|
98
|
+
? applyBuiltin("Disj", [action, applyUnchanged(subscript)], expression)
|
|
84
99
|
: applyBuiltin(
|
|
85
100
|
"Conj",
|
|
86
|
-
[action, applyBuiltin("Neg", [
|
|
101
|
+
[action, applyBuiltin("Neg", [applyUnchanged(subscript)], expression)],
|
|
87
102
|
expression,
|
|
88
103
|
);
|
|
89
104
|
if (expression.kind === "Sub") return step;
|
|
90
105
|
return applyBuiltin(expression.modal === "Box" ? "BoxTrue" : "Diamond", [step], expression);
|
|
91
106
|
});
|
|
92
107
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
applyBuiltin("Eq", [applyBuiltin("Prime", [element], element), element], element),
|
|
100
|
-
);
|
|
101
|
-
if (equalities.length === 0) return at({ kind: "Internal", builtin: "TRUE" }, expression);
|
|
102
|
-
if (equalities.length === 1) return equalities[0];
|
|
103
|
-
return at({ kind: "List", bullet: "And", items: equalities }, expression);
|
|
104
|
-
});
|
|
108
|
+
// Only getTime uses this, so the locations rewriteUnchanged gives do not matter.
|
|
109
|
+
const expandUnchanged = rewrite((expression) =>
|
|
110
|
+
expression.kind === "Apply" && isApplied(expression, ["UNCHANGED"])
|
|
111
|
+
? rewriteUnchanged(expression.args[0])
|
|
112
|
+
: undefined,
|
|
113
|
+
);
|
|
105
114
|
|
|
106
115
|
const TEMPORAL_BUILTINS: Builtin[] = [
|
|
107
116
|
"Prime",
|
|
@@ -132,9 +141,9 @@ const isConstantHyp = (scope: Scope | undefined, hyp: Hyp) => {
|
|
|
132
141
|
};
|
|
133
142
|
|
|
134
143
|
const bindConstants = (scope: Scope | undefined, names: string[]) =>
|
|
135
|
-
|
|
136
|
-
(inner, name) => adjoin(inner, getFresh(name, "Constant")),
|
|
144
|
+
adjoinAll(
|
|
137
145
|
scope,
|
|
146
|
+
names.map((name) => getFresh(name, "Constant")),
|
|
138
147
|
);
|
|
139
148
|
|
|
140
149
|
export const isConstant = (scope: Scope | undefined, expression: Expr): boolean => {
|
|
@@ -196,13 +205,7 @@ export const isConstant = (scope: Scope | undefined, expression: Expr): boolean
|
|
|
196
205
|
case "Let": {
|
|
197
206
|
const inner = expression.definitions.reduce<{ scope: Scope | undefined; isGood: boolean }>(
|
|
198
207
|
(state, definition) => ({
|
|
199
|
-
scope: adjoin(state.scope,
|
|
200
|
-
kind: "Defn",
|
|
201
|
-
definition,
|
|
202
|
-
whereDefined: "User",
|
|
203
|
-
visibility: "Visible",
|
|
204
|
-
isLocal: true,
|
|
205
|
-
}),
|
|
208
|
+
scope: adjoin(state.scope, getLocalDefn(definition)),
|
|
206
209
|
isGood:
|
|
207
210
|
state.isGood &&
|
|
208
211
|
definition.kind === "Operator" &&
|
|
@@ -281,8 +284,7 @@ const isClosed = (scope: Scope | undefined, expression: Expr, isBox: boolean): b
|
|
|
281
284
|
if (expression.kind === "List")
|
|
282
285
|
return expression.items.every((item) => isClosed(scope, item, isBox));
|
|
283
286
|
if (expression.kind === "Sequent") {
|
|
284
|
-
|
|
285
|
-
return isClosed(inner, expression.sequent.active, isBox);
|
|
287
|
+
return isClosed(adjoinAll(scope, expression.sequent.context), expression.sequent.active, isBox);
|
|
286
288
|
}
|
|
287
289
|
if (expression.kind !== "Apply") return false;
|
|
288
290
|
const args = expression.args;
|
|
@@ -63,74 +63,58 @@ export const expandQuant = (
|
|
|
63
63
|
else groups.push([bound]);
|
|
64
64
|
});
|
|
65
65
|
return groups.reduceRight((inner: Expr, group): Expr => {
|
|
66
|
+
const quantify = (quantified: Bound[], quantifiedBody = inner): Expr => ({
|
|
67
|
+
kind: "Quant",
|
|
68
|
+
quantifier,
|
|
69
|
+
bounds: quantified,
|
|
70
|
+
body: quantifiedBody,
|
|
71
|
+
location: inner.location,
|
|
72
|
+
});
|
|
66
73
|
const first = group[0];
|
|
67
74
|
if (first.kind === "Name") {
|
|
68
|
-
return
|
|
69
|
-
kind
|
|
70
|
-
|
|
71
|
-
bounds: group.flatMap((bound) => (bound.kind === "Name" ? [getNamedBound(bound)] : [])),
|
|
72
|
-
body: inner,
|
|
73
|
-
location: inner.location,
|
|
74
|
-
};
|
|
75
|
+
return quantify(
|
|
76
|
+
group.flatMap((bound) => (bound.kind === "Name" ? [getNamedBound(bound)] : [])),
|
|
77
|
+
);
|
|
75
78
|
}
|
|
76
79
|
const factors = getFactors(first.domain, first.names);
|
|
77
|
-
if (factors)
|
|
78
|
-
return {
|
|
79
|
-
kind: "Quant",
|
|
80
|
-
quantifier,
|
|
81
|
-
bounds: getFactorBounds(first.names, factors),
|
|
82
|
-
body: inner,
|
|
83
|
-
location: inner.location,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
80
|
+
if (factors) return quantify(getFactorBounds(first.names, factors));
|
|
86
81
|
const membership: Expr = {
|
|
87
82
|
kind: "Apply",
|
|
88
83
|
operator: { kind: "Internal", builtin: quantifier === "Exists" ? "Mem" : "Notmem" },
|
|
89
84
|
args: [getNamesTuple(first.names), first.domain],
|
|
90
85
|
};
|
|
91
|
-
return {
|
|
92
|
-
kind: "
|
|
93
|
-
quantifier,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
kind: "List",
|
|
97
|
-
bullet: quantifier === "Exists" ? "And" : "Or",
|
|
98
|
-
items: [membership, inner],
|
|
99
|
-
},
|
|
100
|
-
location: inner.location,
|
|
101
|
-
};
|
|
86
|
+
return quantify(getUnbounded(first.names), {
|
|
87
|
+
kind: "List",
|
|
88
|
+
bullet: quantifier === "Exists" ? "And" : "Or",
|
|
89
|
+
items: [membership, inner],
|
|
90
|
+
});
|
|
102
91
|
}, body);
|
|
103
92
|
};
|
|
104
93
|
|
|
105
94
|
// CHOOSE <<x, y>> \in A \X B: P binds t \in A \X B with x == t[1], y == t[2], and any other
|
|
106
|
-
// domain binds t with \E x, y: t = <<x, y>> /\ P.
|
|
107
|
-
const
|
|
108
|
-
|
|
95
|
+
// domain binds t with \E x, y: t = <<x, y>> /\ P. {<<x, y>> \in S: P} binds t the same way.
|
|
96
|
+
export const expandChoose = (
|
|
97
|
+
binder: { kind: "Choose"; domain: Expr | undefined } | { kind: "SetSt"; domain: Expr },
|
|
109
98
|
names: string[],
|
|
110
|
-
domain: Expr | undefined,
|
|
111
99
|
body: Expr,
|
|
112
|
-
): Expr =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
kind: "
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
): Expr => {
|
|
101
|
+
const name = `${binder.kind.toLowerCase()}#${names[0]}`;
|
|
102
|
+
return {
|
|
103
|
+
...binder,
|
|
104
|
+
name,
|
|
105
|
+
body: getFactors(binder.domain, names)
|
|
106
|
+
? { kind: "Let", definitions: getItemDefinitions(name, names), body }
|
|
107
|
+
: {
|
|
108
|
+
kind: "Quant",
|
|
109
|
+
quantifier: "Exists",
|
|
110
|
+
bounds: getUnbounded(names),
|
|
111
|
+
body: {
|
|
112
|
+
kind: "List",
|
|
113
|
+
bullet: "And",
|
|
114
|
+
items: [getEquality(getOpaque(name), getNamesTuple(names)), body],
|
|
115
|
+
},
|
|
123
116
|
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
export const expandChoose = (names: string[], domain: Expr | undefined, body: Expr): Expr => {
|
|
127
|
-
const name = `choose#${names[0]}`;
|
|
128
|
-
return { kind: "Choose", name, domain, body: getChooseBody(name, names, domain, body) };
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export const expandSetSt = (names: string[], domain: Expr, body: Expr): Expr => {
|
|
132
|
-
const name = `setst#${names[0]}`;
|
|
133
|
-
return { kind: "SetSt", name, domain, body: getChooseBody(name, names, domain, body) };
|
|
117
|
+
};
|
|
134
118
|
};
|
|
135
119
|
|
|
136
120
|
// A set or function constructor binds each tuple as fcn#x, with its names defined in a LET around
|
|
@@ -157,8 +141,8 @@ const expandConstructorBounds = (bounds: TuplyBound[], value: Expr, isSetOf: boo
|
|
|
157
141
|
kind: "Operator",
|
|
158
142
|
name: choice,
|
|
159
143
|
body: expandChoose(
|
|
144
|
+
{ kind: "Choose", domain: undefined },
|
|
160
145
|
bound.names,
|
|
161
|
-
undefined,
|
|
162
146
|
getEquality(getOpaque(name), getNamesTuple(bound.names)),
|
|
163
147
|
),
|
|
164
148
|
},
|
package/src/parallel-worker.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { createCanonicalizer } from "./canonical";
|
|
2
|
-
import { createSearch } from "./check";
|
|
3
1
|
import { createEnvironment } from "./environment";
|
|
4
2
|
import {
|
|
5
3
|
createFingerprintTable,
|
|
@@ -8,11 +6,18 @@ import {
|
|
|
8
6
|
writeStateFingerprint,
|
|
9
7
|
} from "./fingerprints";
|
|
10
8
|
import type { CoordinatorMessage, LevelMessage, StartMessage, WorkerMessage } from "./parallel";
|
|
9
|
+
import { createSearch } from "./search";
|
|
11
10
|
import { getSuccessors, type Successor } from "./successors";
|
|
12
|
-
import { getTlcStringOrder,
|
|
13
|
-
import { OUT_DEGREE_BUCKETS } from "./tlc
|
|
11
|
+
import { getTlcStringOrder, getTlcVariableOrder } from "./tlc/order";
|
|
12
|
+
import { OUT_DEGREE_BUCKETS } from "./tlc/summary";
|
|
14
13
|
import { createStateDecoder, createStateEncoder, type EncodedStates } from "./transfer";
|
|
15
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
createCanonicalizer,
|
|
16
|
+
getRankedStringCount,
|
|
17
|
+
setStringOrder,
|
|
18
|
+
setValueVersion,
|
|
19
|
+
type Value,
|
|
20
|
+
} from "./values";
|
|
16
21
|
import { getParentPort, type Port } from "./worker";
|
|
17
22
|
|
|
18
23
|
const LOCKED = -1;
|
|
@@ -30,7 +35,7 @@ interface Expansion {
|
|
|
30
35
|
fingerprintStates: Value[][];
|
|
31
36
|
}
|
|
32
37
|
|
|
33
|
-
const
|
|
38
|
+
const runWorker = (start: StartMessage, parent: Port) => {
|
|
34
39
|
const modules = new Map(start.modules);
|
|
35
40
|
const loadModule = (name: string) => modules.get(name);
|
|
36
41
|
const classes = new Map(start.classes);
|
|
@@ -50,12 +55,12 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
50
55
|
});
|
|
51
56
|
const environment = specification.environment;
|
|
52
57
|
const search = createSearch(start.config, environment, () =>
|
|
53
|
-
|
|
58
|
+
getTlcVariableOrder(start.source, loadModule),
|
|
54
59
|
);
|
|
55
60
|
const nextAction = search?.spec.next;
|
|
56
61
|
if (!search || nextAction === undefined)
|
|
57
62
|
return parent.postMessage({ type: "abort" } satisfies WorkerMessage);
|
|
58
|
-
const
|
|
63
|
+
const workerIndex = start.index;
|
|
59
64
|
const canonicalize = createCanonicalizer();
|
|
60
65
|
const decode = createStateDecoder(environment.variables.length);
|
|
61
66
|
const shared = { fingerprints: start.fingerprints };
|
|
@@ -75,8 +80,8 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
75
80
|
// A worker that runs out of states asks a peer for some by writing its index + 1 to the peer's
|
|
76
81
|
// request word. The peer sends half of the states it hasn't started, keeps expanding, and wakes
|
|
77
82
|
// the workers waiting to ask it next.
|
|
78
|
-
const
|
|
79
|
-
const thief = Atomics.load(requests,
|
|
83
|
+
const answerRequest = (expansion: Expansion, request: number) => {
|
|
84
|
+
const thief = Atomics.load(requests, workerIndex) - 1;
|
|
80
85
|
const given = Math.floor((expansion.end - expansion.origin - 1) / 2);
|
|
81
86
|
const encoder = createStateEncoder();
|
|
82
87
|
const states = expansion.states.slice(expansion.end - given, expansion.end);
|
|
@@ -84,21 +89,21 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
84
89
|
if (isEncoded) expansion.end -= given;
|
|
85
90
|
const loot = isEncoded ? encoder.finish() : createStateEncoder().finish();
|
|
86
91
|
start.ports[thief]?.postMessage(loot, [loot.words.buffer]);
|
|
87
|
-
Atomics.store(requests,
|
|
88
|
-
Atomics.notify(requests,
|
|
92
|
+
Atomics.store(requests, workerIndex, request);
|
|
93
|
+
Atomics.notify(requests, workerIndex);
|
|
89
94
|
};
|
|
90
95
|
|
|
91
96
|
// A worker answers any request before it pauses or runs out of states, and takes no more until
|
|
92
97
|
// it resumes.
|
|
93
|
-
const
|
|
94
|
-
Atomics.store(remaining,
|
|
95
|
-
if (Atomics.compareExchange(requests,
|
|
96
|
-
|
|
98
|
+
const lockRequests = (expansion: Expansion) => {
|
|
99
|
+
Atomics.store(remaining, workerIndex, 0);
|
|
100
|
+
if (Atomics.compareExchange(requests, workerIndex, 0, LOCKED) === 0) return;
|
|
101
|
+
answerRequest(expansion, LOCKED);
|
|
97
102
|
};
|
|
98
103
|
|
|
99
|
-
const
|
|
100
|
-
Atomics.store(remaining,
|
|
101
|
-
Atomics.store(requests,
|
|
104
|
+
const unlockRequests = (expansion: Expansion) => {
|
|
105
|
+
Atomics.store(remaining, workerIndex, expansion.end - expansion.origin);
|
|
106
|
+
Atomics.store(requests, workerIndex, 0);
|
|
102
107
|
};
|
|
103
108
|
|
|
104
109
|
// The worker pauses before a successor when the shared table needs to grow, and resumes there.
|
|
@@ -106,8 +111,8 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
106
111
|
for (; expansion.origin < expansion.end; expansion.origin++) {
|
|
107
112
|
const state = expansion.states[expansion.origin];
|
|
108
113
|
if (!expansion.successors) {
|
|
109
|
-
if (Atomics.load(requests,
|
|
110
|
-
Atomics.store(remaining,
|
|
114
|
+
if (Atomics.load(requests, workerIndex) > 0) answerRequest(expansion, 0);
|
|
115
|
+
Atomics.store(remaining, workerIndex, expansion.end - expansion.origin - 1);
|
|
111
116
|
expansion.successors = getSuccessors(nextAction, state, environment, search.spec.scope);
|
|
112
117
|
expansion.generated += expansion.successors.length;
|
|
113
118
|
if (expansion.successors.length === 0 && start.config.checkDeadlock) return undefined;
|
|
@@ -157,7 +162,7 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
157
162
|
: best;
|
|
158
163
|
}, undefined);
|
|
159
164
|
if (victim === undefined) return false;
|
|
160
|
-
const request = Atomics.compareExchange(requests, victim, 0,
|
|
165
|
+
const request = Atomics.compareExchange(requests, victim, 0, workerIndex + 1);
|
|
161
166
|
if (request === LOCKED) skipped.add(victim);
|
|
162
167
|
if (request > 0) Atomics.wait(requests, victim, request);
|
|
163
168
|
if (request !== 0) continue;
|
|
@@ -169,7 +174,7 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
169
174
|
expansion.states = decode(loot).map(canonicalize);
|
|
170
175
|
expansion.origin = 0;
|
|
171
176
|
expansion.end = expansion.states.length;
|
|
172
|
-
|
|
177
|
+
unlockRequests(expansion);
|
|
173
178
|
return true;
|
|
174
179
|
}
|
|
175
180
|
};
|
|
@@ -177,7 +182,7 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
177
182
|
const report = (message: WorkerMessage) =>
|
|
178
183
|
parent.postMessage(message, message.type === "level" ? [message.fingerprints.buffer] : []);
|
|
179
184
|
|
|
180
|
-
const runLevel = async (
|
|
185
|
+
const runLevel = async (): Promise<LevelMessage | undefined> => {
|
|
181
186
|
const expansion: Expansion = {
|
|
182
187
|
states: frontier.states,
|
|
183
188
|
origin: 0,
|
|
@@ -193,22 +198,21 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
193
198
|
for (;;) {
|
|
194
199
|
const status = expand(expansion);
|
|
195
200
|
if (status === undefined) return undefined;
|
|
196
|
-
|
|
201
|
+
lockRequests(expansion);
|
|
197
202
|
if (status === "paused") {
|
|
198
203
|
const resumed = new Promise<void>((resolve) => (waiters.resume = resolve));
|
|
199
204
|
report({ type: "paused" });
|
|
200
205
|
await resumed;
|
|
201
|
-
|
|
206
|
+
unlockRequests(expansion);
|
|
202
207
|
continue;
|
|
203
208
|
}
|
|
204
209
|
if (!(await steal(expansion))) break;
|
|
205
210
|
}
|
|
206
211
|
if (getRankedStringCount() !== startupStrings) return undefined;
|
|
207
212
|
frontier.states = expansion.next;
|
|
208
|
-
Atomics.store(remaining,
|
|
213
|
+
Atomics.store(remaining, workerIndex, frontier.states.length);
|
|
209
214
|
return {
|
|
210
215
|
type: "level",
|
|
211
|
-
level,
|
|
212
216
|
generated: expansion.generated,
|
|
213
217
|
added: expansion.next.length,
|
|
214
218
|
outDegrees: expansion.outDegrees,
|
|
@@ -216,21 +220,21 @@ const run = (start: StartMessage, parent: Port) => {
|
|
|
216
220
|
};
|
|
217
221
|
};
|
|
218
222
|
|
|
219
|
-
const
|
|
220
|
-
runLevel(
|
|
223
|
+
const startLevel = () => {
|
|
224
|
+
runLevel().then(
|
|
221
225
|
(message) => report(message ?? { type: "abort" }),
|
|
222
226
|
() => report({ type: "abort" }),
|
|
223
227
|
);
|
|
224
228
|
};
|
|
225
229
|
parent.addEventListener("message", (event) => {
|
|
226
230
|
const message = event.data as CoordinatorMessage;
|
|
227
|
-
if (message.type === "level")
|
|
231
|
+
if (message.type === "level") startLevel();
|
|
228
232
|
if (message.type === "resize") {
|
|
229
233
|
shared.fingerprints = message.fingerprints;
|
|
230
234
|
waiters.resume();
|
|
231
235
|
}
|
|
232
236
|
});
|
|
233
|
-
Atomics.store(remaining,
|
|
237
|
+
Atomics.store(remaining, workerIndex, frontier.states.length);
|
|
234
238
|
report({ type: "ready" });
|
|
235
239
|
};
|
|
236
240
|
|
|
@@ -240,7 +244,7 @@ void getParentPort().then((parent) => {
|
|
|
240
244
|
if (message.type !== "start") return;
|
|
241
245
|
parent.removeEventListener?.("message", onStart);
|
|
242
246
|
try {
|
|
243
|
-
|
|
247
|
+
runWorker(message, parent);
|
|
244
248
|
} catch {
|
|
245
249
|
parent.postMessage({ type: "abort" } satisfies WorkerMessage);
|
|
246
250
|
}
|