tla-ts 0.0.10-dev.09e53c2a6 → 0.0.10-dev.1ebc153bd
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/compile.cjs +3 -3
- package/dist/compile.js +1 -1
- package/dist/deciders.cjs +36 -36
- package/dist/deciders.js +54 -54
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- 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 +43 -43
- package/dist/prove.js +78 -78
- package/dist/run.cjs +33 -35
- package/dist/run.js +44 -46
- package/dist/tlapm.cjs +1 -1
- package/dist/tlapm.js +2 -2
- package/dist/transfer.cjs +43 -43
- package/dist/transfer.js +38 -38
- package/dist/worker.cjs +6 -6
- package/dist/worker.js +6 -6
- package/package.json +1 -1
- package/src/ast.ts +1 -0
- package/src/bags.ts +46 -28
- package/src/check-trace.ts +2 -16
- package/src/check.ts +152 -64
- package/src/cli/runtime-invariants.ts +20 -56
- package/src/cli/tlc-arguments.ts +2 -2
- package/src/cli/tlc-output.ts +1 -2
- package/src/cli/tlc.ts +13 -8
- package/src/cli/xml-exporter.ts +1 -1
- package/src/codegen.ts +9 -5
- package/src/dependencies.ts +49 -9
- package/src/dfid.ts +9 -2
- package/src/environment.ts +57 -33
- package/src/errors.ts +7 -0
- package/src/evaluate.ts +92 -32
- package/src/exit-codes.ts +4 -2
- package/src/instances.ts +5 -5
- package/src/java-overrides.ts +2 -2
- package/src/levels.ts +138 -90
- package/src/liveness-checker.ts +43 -4
- package/src/liveness.ts +1 -1
- package/src/obligations/index.ts +1 -1
- package/src/obligations/normalize.ts +1 -4
- package/src/obligations/printer.ts +5 -5
- package/src/parallel-worker.ts +8 -2
- package/src/parallel.ts +5 -0
- package/src/parser.ts +106 -144
- package/src/prover/isabelle/isar/attrib.ts +4 -4
- package/src/prover/isabelle/isar/rule-cases.ts +8 -6
- package/src/prover/isabelle/provers/clasimp.ts +1 -1
- package/src/prover/isabelle/provers/hypsubst.ts +2 -2
- package/src/prover/isabelle/pure/rewriter.ts +3 -3
- package/src/prover/isabelle/pure/term.ts +3 -3
- package/src/prover/prep/md5.ts +26 -29
- package/src/prover/smt/rewrite.ts +2 -7
- package/src/prover/smt/simplify.ts +1 -1
- package/src/prover/smt/solver/asserted-formulas.ts +66 -1
- package/src/prover/smt/solver/ast-lt.ts +1 -1
- package/src/prover/smt/solver/ast.ts +58 -11
- package/src/prover/smt/solver/blast-term-ite.ts +47 -0
- package/src/prover/smt/solver/bound-simplifier.ts +2 -3
- package/src/prover/smt/solver/bv-decl-plugin.ts +13 -10
- package/src/prover/smt/solver/bv-rewriter.ts +1 -1
- package/src/prover/smt/solver/card2bv.ts +3 -5
- package/src/prover/smt/solver/cofactor-elim-term-ite.ts +2 -3
- package/src/prover/smt/solver/context.ts +24 -3
- package/src/prover/smt/solver/ctx-simplify.ts +1 -2
- package/src/prover/smt/solver/datatype-decl-plugin.ts +15 -7
- package/src/prover/smt/solver/dependent-expr-state.ts +9 -4
- package/src/prover/smt/solver/diff-neq.ts +1 -2
- package/src/prover/smt/solver/elim-term-ite-tactic.ts +48 -0
- package/src/prover/smt/solver/elim-uncnstr.ts +4 -7
- package/src/prover/smt/solver/euf/arith-internalize.ts +1 -1
- package/src/prover/smt/solver/euf/array-internalize.ts +1 -1
- package/src/prover/smt/solver/euf/bv-internalize.ts +1 -1
- package/src/prover/smt/solver/euf/egraph.ts +4 -10
- package/src/prover/smt/solver/euf/euf-solver.ts +1 -2
- package/src/prover/smt/solver/euf/mam.ts +1 -5
- package/src/prover/smt/solver/euf/q-ematch.ts +1 -2
- package/src/prover/smt/solver/euf/th-solver.ts +0 -7
- package/src/prover/smt/solver/expr2polynomial.ts +204 -79
- package/src/prover/smt/solver/factor.ts +36 -14
- package/src/prover/smt/solver/fd-solver.ts +2 -0
- package/src/prover/smt/solver/fix-dl-var.ts +1 -2
- package/src/prover/smt/solver/fpa-rewriter.ts +1 -2
- package/src/prover/smt/solver/fpa2bv-converter.ts +3 -1
- package/src/prover/smt/solver/fpa2bv-rewriter.ts +1 -0
- package/src/prover/smt/solver/goal.ts +6 -3
- package/src/prover/smt/solver/goal2nlsat.ts +57 -30
- package/src/prover/smt/solver/hashtable.ts +4 -0
- package/src/prover/smt/solver/logic-tactics.ts +9 -2
- package/src/prover/smt/solver/lp/containers.ts +7 -1
- package/src/prover/smt/solver/lp/cross-nested.ts +1 -3
- package/src/prover/smt/solver/lp/lp-settings.ts +1 -1
- package/src/prover/smt/solver/lp/nex-creator.ts +3 -2
- package/src/prover/smt/solver/lp/nex.ts +2 -1
- package/src/prover/smt/solver/lp/nla-core.ts +1 -1
- package/src/prover/smt/solver/lp/nla-grobner.ts +158 -80
- package/src/prover/smt/solver/lp/nra-solver.ts +45 -39
- package/src/prover/smt/solver/lp/pdd-interval.ts +6 -2
- package/src/prover/smt/solver/lp/pdd-simplifier.ts +60 -20
- package/src/prover/smt/solver/lp/pdd-solver.ts +72 -39
- package/src/prover/smt/solver/lp/pdd.ts +725 -290
- package/src/prover/smt/solver/lp/union-find.ts +1 -1
- package/src/prover/smt/solver/mam-compiler.ts +1 -1
- package/src/prover/smt/solver/model-based-opt.ts +1 -1
- package/src/prover/smt/solver/model-generator.ts +3 -1
- package/src/prover/smt/solver/mpf.ts +2 -4
- package/src/prover/smt/solver/mus.ts +2 -3
- package/src/prover/smt/solver/muz/dl-context.ts +10 -4
- package/src/prover/smt/solver/muz/dl-mk-slice.ts +3 -3
- package/src/prover/smt/solver/muz/dl-rule.ts +2 -2
- package/src/prover/smt/solver/muz/horn-subsume-model-converter.ts +1 -1
- package/src/prover/smt/solver/muz/horn-tactic.ts +1 -1
- package/src/prover/smt/solver/muz/spacer-context.ts +2 -4
- package/src/prover/smt/solver/muz/spacer-pdr.ts +1 -0
- package/src/prover/smt/solver/nlqsat.ts +1 -1
- package/src/prover/smt/solver/nlsat/algebraic.ts +196 -92
- package/src/prover/smt/solver/nlsat/atoms.ts +52 -33
- package/src/prover/smt/solver/nlsat/explain.ts +375 -217
- package/src/prover/smt/solver/nlsat/levelwise.ts +460 -240
- package/src/prover/smt/solver/nlsat/polynomial.ts +2366 -681
- package/src/prover/smt/solver/nlsat/solver.ts +74 -64
- package/src/prover/smt/solver/nlsat/transcendentals.ts +41 -17
- package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +8 -4
- package/src/prover/smt/solver/nlsat/upolynomial.ts +41 -18
- package/src/prover/smt/solver/nlsat-tactic.ts +1 -1
- package/src/prover/smt/solver/nnf.ts +6 -2
- package/src/prover/smt/solver/opt-context.ts +9 -3
- package/src/prover/smt/solver/opt-nlsat.ts +29 -18
- package/src/prover/smt/solver/opt-preprocess.ts +1 -1
- package/src/prover/smt/solver/opt-solver.ts +6 -3
- package/src/prover/smt/solver/optsmt.ts +1 -1
- package/src/prover/smt/solver/pb-rewriter.ts +1 -4
- package/src/prover/smt/solver/poly-rewriter.ts +74 -18
- package/src/prover/smt/solver/probes.ts +88 -23
- package/src/prover/smt/solver/proto-model.ts +4 -6
- package/src/prover/smt/solver/qe-arith-plugin.ts +2 -4
- package/src/prover/smt/solver/qe-lite.ts +2 -2
- package/src/prover/smt/solver/qe.ts +3 -2
- package/src/prover/smt/solver/quantifier-manager.ts +14 -9
- package/src/prover/smt/solver/recfun-decl-plugin.ts +2 -1
- package/src/prover/smt/solver/rlimit.ts +4 -0
- package/src/prover/smt/solver/sat/config.ts +1 -1
- package/src/prover/smt/solver/sat/inc-sat-solver.ts +26 -1
- package/src/prover/smt/solver/sat/model-converter.ts +1 -1
- package/src/prover/smt/solver/sat/pb-solver.ts +1 -1
- package/src/prover/smt/solver/sat/sat-tactic.ts +4 -3
- package/src/prover/smt/solver/sat/simplifier.ts +1 -1
- package/src/prover/smt/solver/sat/solver.ts +25 -47
- package/src/prover/smt/solver/seq-axioms.ts +20 -35
- package/src/prover/smt/solver/seq-decl-plugin.ts +1 -1
- package/src/prover/smt/solver/seq-derive.ts +4 -7
- package/src/prover/smt/solver/seq-eq-solver.ts +2 -2
- package/src/prover/smt/solver/seq-monadic.ts +7 -5
- package/src/prover/smt/solver/seq-re-rewriter.ts +2 -1
- package/src/prover/smt/solver/seq-re-util.ts +1 -1
- package/src/prover/smt/solver/seq-regex-bisim.ts +1 -1
- package/src/prover/smt/solver/seq-regex-live.ts +2 -2
- package/src/prover/smt/solver/seq-rewriter.ts +31 -29
- package/src/prover/smt/solver/seq-skolem.ts +0 -23
- package/src/prover/smt/solver/seq-view-witness.ts +4 -4
- package/src/prover/smt/solver/smt-kernel.ts +9 -3
- package/src/prover/smt/solver/smt-setup.ts +68 -6
- package/src/prover/smt/solver/smtlib-parser.ts +558 -220
- package/src/prover/smt/solver/smtlib-script.ts +495 -153
- package/src/prover/smt/solver/solve-eqs.ts +13 -21
- package/src/prover/smt/solver/tactic.ts +219 -130
- package/src/prover/smt/solver/theory-bv.ts +2 -2
- package/src/prover/smt/solver/theory-lra-final-check.ts +1 -1
- package/src/prover/smt/solver/theory-lra-internalize.ts +1 -0
- package/src/prover/smt/solver/theory-lra-propagate.ts +6 -4
- package/src/prover/smt/solver/theory-lra.ts +0 -1
- package/src/prover/smt/solver/theory-pb.ts +24 -7
- package/src/prover/smt/solver/theory-seq-solve.ts +1 -1
- package/src/prover/smt/solver/theory-seq-state.ts +2 -21
- package/src/prover/tlapm/cache.ts +8 -8
- package/src/prover/zenon/equality-rules.ts +24 -0
- package/src/prover/zenon/expr.ts +21 -0
- package/src/prover/zenon/index-table.ts +7 -2
- package/src/prover/zenon/isar-case.ts +1 -1
- package/src/prover/zenon/isar.ts +2 -2
- package/src/prover/zenon/phrase.ts +1 -1
- package/src/prover/zenon/rules.ts +2 -1
- package/src/resolve.ts +624 -187
- package/src/runtime.ts +3 -1
- package/src/sany/builtins.ts +10 -10
- package/src/sany/generation.ts +2 -13
- package/src/sany/generator-definitions.ts +3 -1
- package/src/sany/generator-expressions.ts +36 -30
- package/src/sany/generator-proofs.ts +5 -3
- package/src/sany/generator.ts +2 -1
- package/src/sany/lexer.ts +3 -3
- package/src/sany/modules.ts +4 -2
- package/src/sany/nodes.ts +1 -1
- package/src/sany/selectors.ts +11 -6
- package/src/sany/xml.ts +2 -3
- package/src/search.ts +51 -22
- package/src/spec-description.ts +2 -2
- package/src/subexpressions.ts +265 -94
- package/src/successors.ts +1 -0
- package/src/symmetry.ts +1 -1
- package/src/tlc/jar-data.ts +10 -0
- package/src/tlc/messages.ts +3 -3
- package/src/tlc/order.ts +14 -3
- package/src/tlc/tlc-operators.ts +3 -1
- package/src/tlc/tlcext-operators.ts +18 -5
- package/src/tlc/trace-spec.ts +5 -5
- package/src/typed-tier.ts +29 -23
- package/src/typescript/types.ts +2 -2
- package/src/values.ts +46 -27
package/src/java-overrides.ts
CHANGED
|
@@ -184,8 +184,8 @@ const readClassFile = (bytes: Uint8Array) => {
|
|
|
184
184
|
getJavaClassName(pool, thrown.readUint16()),
|
|
185
185
|
)
|
|
186
186
|
: [];
|
|
187
|
-
const modifiers = METHOD_MODIFIERS.filter((
|
|
188
|
-
(
|
|
187
|
+
const modifiers = METHOD_MODIFIERS.filter((entry) => (access & entry[0]) !== 0).map(
|
|
188
|
+
(entry) => entry[1],
|
|
189
189
|
);
|
|
190
190
|
const returnType = getTypeNames(descriptor.slice(parametersEnd + 1))[0];
|
|
191
191
|
const throwsClause = exceptions.length === 0 ? "" : ` throws ${exceptions.join(",")}`;
|
package/src/levels.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getChildren,
|
|
3
3
|
type AssumeProve,
|
|
4
|
+
type Bound,
|
|
4
5
|
type Definition,
|
|
5
6
|
type Expression,
|
|
6
7
|
type Module,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
} from "./errors";
|
|
19
20
|
import { forEachChild } from "./instances";
|
|
20
21
|
import { collectSemanticErrors, getBoundNames, getPatternNames } from "./resolve";
|
|
22
|
+
import { resolveSynonym } from "./tlc/jar-data";
|
|
21
23
|
import { STANDARD_LEVELS } from "./standard-definitions";
|
|
22
24
|
|
|
23
25
|
interface LevelData {
|
|
@@ -154,27 +156,50 @@ const CORE_SIGNATURES = new Map(
|
|
|
154
156
|
["BOOLEAN", 0, [], []],
|
|
155
157
|
["STRING", 0, [], []],
|
|
156
158
|
] as const
|
|
157
|
-
).map((
|
|
158
|
-
|
|
159
|
+
).map((signature): [string, OperatorLevels] => [
|
|
160
|
+
signature[0],
|
|
159
161
|
{
|
|
160
|
-
...createSignature(
|
|
161
|
-
nonLeibniz: new Set(
|
|
162
|
+
...createSignature(signature[0], signature[1], [...signature[2]], [...signature[3]]),
|
|
163
|
+
nonLeibniz: new Set(signature[1] > 1 ? [0, 1] : []),
|
|
162
164
|
},
|
|
163
165
|
]),
|
|
164
166
|
);
|
|
165
167
|
|
|
166
|
-
const SET_LEVELS = createSignature("$Set", 0, [2], [1]);
|
|
167
|
-
const JUNCTION_LEVELS = createSignature("$Junction", 0, [3], [1]);
|
|
168
|
-
const CHOOSE_LEVELS = createSignature("$Choose", 0, [2], [1]);
|
|
169
|
-
const FUNCTION_LEVELS = createSignature("$Function", 0, [3], [1]);
|
|
170
|
-
const APPLY_LEVELS = createSignature("$FcnApply", 0, [2, 2], [1, 1]);
|
|
171
|
-
const SELECT_LEVELS = createSignature("$RcdSelect", 0, [2, 0], [1, 1]);
|
|
172
168
|
const PRIME_LEVELS = createSignature("'", 2, [1], [0]);
|
|
169
|
+
const UNCHANGED_LEVELS = createSignature("UNCHANGED", 2, [1], [0]);
|
|
173
170
|
const ENABLED_LEVELS = createSignature("ENABLED", 1, [2], [0]);
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
171
|
+
const ALWAYS_LEVELS = createSignature("[]", 3, [3], [0]);
|
|
172
|
+
const EVENTUALLY_LEVELS = createSignature("<>", 3, [3], [0]);
|
|
173
|
+
const AND_LEVELS = createSignature("$ConjList", 0, [3], [1]);
|
|
174
|
+
const OR_LEVELS = createSignature("$DisjList", 0, [3], [1]);
|
|
175
|
+
const IF_LEVELS = createSignature("$IfThenElse", 0, [3], [1]);
|
|
176
|
+
const CASE_LEVELS = createSignature("$Case", 0, [3], [1]);
|
|
177
|
+
const FORALL_LEVELS = createSignature("$BoundedForall", 0, [3], [1]);
|
|
178
|
+
const EXISTS_LEVELS = createSignature("$BoundedExists", 0, [3], [1]);
|
|
179
|
+
const UNBOUNDED_FORALL_LEVELS = createSignature("$UnboundedForall", 0, [3], [1]);
|
|
180
|
+
const UNBOUNDED_EXISTS_LEVELS = createSignature("$UnboundedExists", 0, [3], [1]);
|
|
181
|
+
const TEMPORAL_FORALL_LEVELS = createSignature("$TemporalForall", 3, [3], [0]);
|
|
182
|
+
const TEMPORAL_EXISTS_LEVELS = createSignature("$TemporalExists", 3, [3], [0]);
|
|
183
|
+
const BOUNDED_CHOOSE_LEVELS = createSignature("$BoundedChoose", 0, [2], [1]);
|
|
184
|
+
const UNBOUNDED_CHOOSE_LEVELS = createSignature("$UnboundedChoose", 0, [2], [1]);
|
|
185
|
+
const SET_ENUMERATE_LEVELS = createSignature("$SetEnumerate", 0, [2], [1]);
|
|
186
|
+
const TUPLE_LEVELS = createSignature("$Tuple", 0, [2], [1]);
|
|
187
|
+
const SET_OF_FCNS_LEVELS = createSignature("$SetOfFcns", 0, [2], [1]);
|
|
188
|
+
const CARTESIAN_PROD_LEVELS = createSignature("$CartesianProd", 0, [2], [1]);
|
|
189
|
+
const SUBSET_OF_LEVELS = createSignature("$SubsetOf", 0, [2], [1]);
|
|
190
|
+
const SET_OF_ALL_LEVELS = createSignature("$SetOfAll", 0, [2], [1]);
|
|
191
|
+
const FCN_CONSTRUCTOR_LEVELS = createSignature("$FcnConstructor", 0, [3], [1]);
|
|
192
|
+
const RCD_CONSTRUCTOR_LEVELS = createSignature("$RcdConstructor", 0, [3], [1]);
|
|
193
|
+
const SET_OF_RCDS_LEVELS = createSignature("$SetOfRcds", 0, [2], [1]);
|
|
194
|
+
const EXCEPT_LEVELS = createSignature("$Except", 0, [2], [1]);
|
|
195
|
+
const PAIR_LEVELS = createSignature("$Pair", 0, [3], [1]);
|
|
196
|
+
const SEQ_LEVELS = createSignature("$Seq", 0, [2], [1]);
|
|
197
|
+
const APPLY_LEVELS = createSignature("$FcnApply", 0, [2, 2], [1, 1]);
|
|
198
|
+
const SELECT_LEVELS = createSignature("$RcdSelect", 0, [2, 0], [1, 1]);
|
|
199
|
+
const SQUARE_ACT_LEVELS = createSignature("$SquareAct", 2, [2, 1], [0, 0]);
|
|
200
|
+
const ANGLE_ACT_LEVELS = createSignature("$AngleAct", 2, [2, 1], [0, 0]);
|
|
201
|
+
const WF_LEVELS = createSignature("$WF", 3, [1, 2], [0, 0]);
|
|
202
|
+
const SF_LEVELS = createSignature("$SF", 3, [1, 2], [0, 0]);
|
|
178
203
|
|
|
179
204
|
const bindFormals = (scope: Scope, formals: OperatorParam[]) =>
|
|
180
205
|
formals.length === 0
|
|
@@ -253,15 +278,10 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
253
278
|
if (operand.kind !== "Value") return;
|
|
254
279
|
if (operand.data.level > getMaxLevel(operator, index)) {
|
|
255
280
|
throw new TlaSyntaxError(
|
|
256
|
-
`Level error in applying operator ${operator.name}:\nThe level of argument ${index + 1} exceeds the maximum level allowed by the operator`,
|
|
281
|
+
`Level error in applying operator ${resolveSynonym(operator.name)}:\nThe level of argument ${index + 1} exceeds the maximum level allowed by the operator`,
|
|
257
282
|
);
|
|
258
283
|
}
|
|
259
284
|
});
|
|
260
|
-
if (ranges.some((range) => range.level > ACTION_LEVEL)) {
|
|
261
|
-
throw new TlaSyntaxError(
|
|
262
|
-
`Level error in applying operator ${operator.name}:\nThe level of the range for a bounded variable exceeds the maximum level allowed by the operator`,
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
285
|
const getOperand = (formal: string) => {
|
|
266
286
|
const index = operator.formals.findIndex((param) => param.name === formal);
|
|
267
287
|
return index === -1 ? undefined : operands[index];
|
|
@@ -448,16 +468,20 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
448
468
|
operator: OperatorLevels,
|
|
449
469
|
expressions: Expression[],
|
|
450
470
|
scope: Scope,
|
|
451
|
-
|
|
452
|
-
bound
|
|
471
|
+
bounds: Bound[] = [],
|
|
472
|
+
bound = getBoundNames(bounds),
|
|
453
473
|
) => {
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
474
|
+
const operands = toOperands(expressions, bindFormals(scope, toFormals(bound)));
|
|
475
|
+
const ranges = bounds.map((range) => analyze(range.set, scope));
|
|
476
|
+
const data = applyDefined(operator, operands, ranges, bound);
|
|
477
|
+
const pattern = bounds[ranges.findIndex((range) => range.level > ACTION_LEVEL)]?.pattern;
|
|
478
|
+
if (pattern) {
|
|
479
|
+
const range = pattern.ranges?.[0];
|
|
480
|
+
throw new TlaSyntaxError(
|
|
481
|
+
`Level error in applying operator ${operator.name}:\nThe level of the range for the bounded variable ${range ? formatRange(range) : getPatternNames(pattern)[0]} \nexceeds the maximum level allowed by the operator`,
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
return data;
|
|
461
485
|
};
|
|
462
486
|
|
|
463
487
|
const applyResolved = (resolved: Resolved, operands: Operand[]) =>
|
|
@@ -465,11 +489,11 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
465
489
|
? applyDeclared(resolved.name, resolved.level, operands)
|
|
466
490
|
: applyDefined(resolved.levels, operands);
|
|
467
491
|
|
|
468
|
-
const checkJunction = (operands: Operand[], expression: Expression) => {
|
|
492
|
+
const checkJunction = (operands: Operand[], expression: Expression, name: string) => {
|
|
469
493
|
const levels = operands.map((operand) => operand.data.level);
|
|
470
494
|
if (levels.includes(ACTION_LEVEL) && levels.includes(TEMPORAL_LEVEL)) {
|
|
471
495
|
throw createLevelError(
|
|
472
|
-
|
|
496
|
+
`${name} has both temporal formula and action as arguments`,
|
|
473
497
|
expression,
|
|
474
498
|
);
|
|
475
499
|
}
|
|
@@ -483,7 +507,9 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
483
507
|
expression,
|
|
484
508
|
);
|
|
485
509
|
}
|
|
486
|
-
if (LOGICAL_OPERATORS.has(expression.operator))
|
|
510
|
+
if (LOGICAL_OPERATORS.has(expression.operator)) {
|
|
511
|
+
checkJunction(operands, expression, resolveSynonym(expression.operator));
|
|
512
|
+
}
|
|
487
513
|
};
|
|
488
514
|
|
|
489
515
|
const checkTemporal = (
|
|
@@ -549,29 +575,41 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
549
575
|
case "And":
|
|
550
576
|
case "Or": {
|
|
551
577
|
const operands = toOperands(expression.operands, scope);
|
|
552
|
-
|
|
553
|
-
|
|
578
|
+
const isAnd = expression.kind === "And";
|
|
579
|
+
checkJunction(
|
|
580
|
+
operands,
|
|
581
|
+
expression,
|
|
582
|
+
expression.isBulleted
|
|
583
|
+
? `${isAnd ? "Conjunction" : "Disjunction"} list`
|
|
584
|
+
: isAnd
|
|
585
|
+
? "\\land"
|
|
586
|
+
: "\\lor",
|
|
587
|
+
);
|
|
588
|
+
return applyDefined(isAnd ? AND_LEVELS : OR_LEVELS, operands);
|
|
554
589
|
}
|
|
555
590
|
case "Prime":
|
|
556
|
-
case "Unchanged":
|
|
557
591
|
return applyBuiltin(PRIME_LEVELS, [expression.expression], scope);
|
|
592
|
+
case "Unchanged":
|
|
593
|
+
return applyBuiltin(UNCHANGED_LEVELS, [expression.expression], scope);
|
|
558
594
|
case "Enabled":
|
|
559
595
|
return applyBuiltin(ENABLED_LEVELS, [expression.expression], scope);
|
|
560
596
|
case "Always":
|
|
561
597
|
case "Eventually": {
|
|
562
598
|
const operand = toOperand(expression.expression, scope);
|
|
563
599
|
checkTemporal(expression, operand.data.level);
|
|
564
|
-
return applyDefined(
|
|
600
|
+
return applyDefined(expression.kind === "Always" ? ALWAYS_LEVELS : EVENTUALLY_LEVELS, [
|
|
601
|
+
operand,
|
|
602
|
+
]);
|
|
565
603
|
}
|
|
566
604
|
case "If":
|
|
567
605
|
return applyBuiltin(
|
|
568
|
-
|
|
606
|
+
IF_LEVELS,
|
|
569
607
|
[expression.condition, expression.consequent, expression.alternative],
|
|
570
608
|
scope,
|
|
571
609
|
);
|
|
572
610
|
case "Case":
|
|
573
611
|
return applyBuiltin(
|
|
574
|
-
|
|
612
|
+
CASE_LEVELS,
|
|
575
613
|
[
|
|
576
614
|
...expression.arms.flatMap((arm) => [arm.condition, arm.body]),
|
|
577
615
|
...(expression.other ? [expression.other] : []),
|
|
@@ -583,11 +621,10 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
583
621
|
case "Forall":
|
|
584
622
|
case "Exists": {
|
|
585
623
|
const data = applyBuiltin(
|
|
586
|
-
|
|
624
|
+
expression.kind === "Forall" ? FORALL_LEVELS : EXISTS_LEVELS,
|
|
587
625
|
[expression.body],
|
|
588
626
|
scope,
|
|
589
|
-
expression.bounds
|
|
590
|
-
getBoundNames(expression.bounds),
|
|
627
|
+
expression.bounds,
|
|
591
628
|
);
|
|
592
629
|
const actionBound =
|
|
593
630
|
data.level === TEMPORAL_LEVEL
|
|
@@ -603,7 +640,13 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
603
640
|
}
|
|
604
641
|
case "UnboundedQuantifier":
|
|
605
642
|
return applyBuiltin(
|
|
606
|
-
expression.isTemporal
|
|
643
|
+
expression.isTemporal
|
|
644
|
+
? expression.quantifier === "Forall"
|
|
645
|
+
? TEMPORAL_FORALL_LEVELS
|
|
646
|
+
: TEMPORAL_EXISTS_LEVELS
|
|
647
|
+
: expression.quantifier === "Forall"
|
|
648
|
+
? UNBOUNDED_FORALL_LEVELS
|
|
649
|
+
: UNBOUNDED_EXISTS_LEVELS,
|
|
607
650
|
[expression.body],
|
|
608
651
|
scope,
|
|
609
652
|
[],
|
|
@@ -611,79 +654,67 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
611
654
|
);
|
|
612
655
|
case "Choose":
|
|
613
656
|
return applyBuiltin(
|
|
614
|
-
|
|
657
|
+
expression.set ? BOUNDED_CHOOSE_LEVELS : UNBOUNDED_CHOOSE_LEVELS,
|
|
615
658
|
[expression.body],
|
|
616
659
|
scope,
|
|
617
|
-
expression.set ? [expression.set] : [],
|
|
660
|
+
expression.set ? [{ pattern: expression.pattern, set: expression.set }] : [],
|
|
618
661
|
getPatternNames(expression.pattern),
|
|
619
662
|
);
|
|
620
663
|
case "SetEnumeration":
|
|
664
|
+
return applyBuiltin(SET_ENUMERATE_LEVELS, expression.elements, scope);
|
|
621
665
|
case "Tuple":
|
|
666
|
+
return applyBuiltin(TUPLE_LEVELS, expression.elements, scope);
|
|
622
667
|
case "FunctionSet":
|
|
668
|
+
return applyBuiltin(SET_OF_FCNS_LEVELS, [expression.domain, expression.range], scope);
|
|
623
669
|
case "Product":
|
|
624
|
-
return applyBuiltin(
|
|
625
|
-
SET_LEVELS,
|
|
626
|
-
expression.kind === "FunctionSet"
|
|
627
|
-
? [expression.domain, expression.range]
|
|
628
|
-
: expression.kind === "Product"
|
|
629
|
-
? expression.factors
|
|
630
|
-
: expression.elements,
|
|
631
|
-
scope,
|
|
632
|
-
);
|
|
670
|
+
return applyBuiltin(CARTESIAN_PROD_LEVELS, expression.factors, scope);
|
|
633
671
|
case "SetFilter":
|
|
634
|
-
return applyBuiltin(
|
|
635
|
-
SET_LEVELS,
|
|
636
|
-
[expression.predicate],
|
|
637
|
-
scope,
|
|
638
|
-
[expression.bound.set],
|
|
639
|
-
getPatternNames(expression.bound.pattern),
|
|
640
|
-
);
|
|
672
|
+
return applyBuiltin(SUBSET_OF_LEVELS, [expression.predicate], scope, [expression.bound]);
|
|
641
673
|
case "SetMap":
|
|
642
|
-
return applyBuiltin(
|
|
643
|
-
SET_LEVELS,
|
|
644
|
-
[expression.expression],
|
|
645
|
-
scope,
|
|
646
|
-
expression.bounds.map((bound) => bound.set),
|
|
647
|
-
getBoundNames(expression.bounds),
|
|
648
|
-
);
|
|
674
|
+
return applyBuiltin(SET_OF_ALL_LEVELS, [expression.expression], scope, expression.bounds);
|
|
649
675
|
case "FunctionConstruction":
|
|
650
|
-
return applyBuiltin(
|
|
651
|
-
FUNCTION_LEVELS,
|
|
652
|
-
[expression.body],
|
|
653
|
-
scope,
|
|
654
|
-
expression.bounds.map((bound) => bound.set),
|
|
655
|
-
getBoundNames(expression.bounds),
|
|
656
|
-
);
|
|
676
|
+
return applyBuiltin(FCN_CONSTRUCTOR_LEVELS, [expression.body], scope, expression.bounds);
|
|
657
677
|
case "Record":
|
|
658
678
|
return applyBuiltin(
|
|
659
|
-
|
|
679
|
+
RCD_CONSTRUCTOR_LEVELS,
|
|
660
680
|
expression.fields.map((field) => field.value),
|
|
661
681
|
scope,
|
|
662
682
|
);
|
|
663
683
|
case "RecordSet":
|
|
664
684
|
return applyBuiltin(
|
|
665
|
-
|
|
685
|
+
SET_OF_RCDS_LEVELS,
|
|
666
686
|
expression.fields.map((field) => field.value),
|
|
667
687
|
scope,
|
|
668
688
|
);
|
|
669
689
|
case "Except":
|
|
670
|
-
return
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
690
|
+
return applyDefined(EXCEPT_LEVELS, [
|
|
691
|
+
toOperand(expression.function, scope),
|
|
692
|
+
...expression.updates.map((update): Operand => ({
|
|
693
|
+
kind: "Value",
|
|
694
|
+
data: applyDefined(PAIR_LEVELS, [
|
|
695
|
+
{
|
|
696
|
+
kind: "Value",
|
|
697
|
+
data: applyDefined(
|
|
698
|
+
SEQ_LEVELS,
|
|
699
|
+
update.path.map((step): Operand =>
|
|
700
|
+
step.kind === "Field"
|
|
701
|
+
? { kind: "Value", data: createData() }
|
|
702
|
+
: step.args.length === 1
|
|
703
|
+
? toOperand(step.args[0], scope)
|
|
704
|
+
: { kind: "Value", data: applyBuiltin(TUPLE_LEVELS, step.args, scope) },
|
|
705
|
+
),
|
|
706
|
+
),
|
|
707
|
+
},
|
|
708
|
+
toOperand(update.value, scope),
|
|
677
709
|
]),
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
);
|
|
710
|
+
})),
|
|
711
|
+
]);
|
|
681
712
|
case "FunctionApplication":
|
|
682
713
|
return applyDefined(APPLY_LEVELS, [
|
|
683
714
|
toOperand(expression.function, scope),
|
|
684
715
|
expression.args.length === 1
|
|
685
716
|
? toOperand(expression.args[0], scope)
|
|
686
|
-
: { kind: "Value", data: applyBuiltin(
|
|
717
|
+
: { kind: "Value", data: applyBuiltin(TUPLE_LEVELS, expression.args, scope) },
|
|
687
718
|
]);
|
|
688
719
|
case "Bracket":
|
|
689
720
|
return createData();
|
|
@@ -694,10 +725,18 @@ export const createLevelAnalyzer = (context: LevelContext) => {
|
|
|
694
725
|
]);
|
|
695
726
|
case "BoxAction":
|
|
696
727
|
case "AngleAction":
|
|
697
|
-
return applyBuiltin(
|
|
728
|
+
return applyBuiltin(
|
|
729
|
+
expression.kind === "BoxAction" ? SQUARE_ACT_LEVELS : ANGLE_ACT_LEVELS,
|
|
730
|
+
[expression.action, expression.subscript],
|
|
731
|
+
scope,
|
|
732
|
+
);
|
|
698
733
|
case "WeakFairness":
|
|
699
734
|
case "StrongFairness":
|
|
700
|
-
return applyBuiltin(
|
|
735
|
+
return applyBuiltin(
|
|
736
|
+
expression.kind === "WeakFairness" ? WF_LEVELS : SF_LEVELS,
|
|
737
|
+
[expression.subscript, expression.action],
|
|
738
|
+
scope,
|
|
739
|
+
);
|
|
701
740
|
case "Label":
|
|
702
741
|
return analyze(expression.body, scope);
|
|
703
742
|
case "Subexpression":
|
|
@@ -957,7 +996,16 @@ export const checkModuleLevels = (
|
|
|
957
996
|
})),
|
|
958
997
|
...module.assumptions.map((assumption) => ({
|
|
959
998
|
location: assumption.location,
|
|
960
|
-
check: () =>
|
|
999
|
+
check: () => {
|
|
1000
|
+
const level = analyzer.analyze(assumption.expression, new Map()).level;
|
|
1001
|
+
const range = assumption.location.range;
|
|
1002
|
+
if (level !== CONSTANT_LEVEL && range) {
|
|
1003
|
+
throw createSemanticError(
|
|
1004
|
+
`Level error: assumptions must be level 0 (Constant), \nbut this one has level ${level}.`,
|
|
1005
|
+
range,
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
},
|
|
961
1009
|
})),
|
|
962
1010
|
...module.theorems.map((theorem) => ({
|
|
963
1011
|
location: theorem.location,
|
package/src/liveness-checker.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface LivenessChecker {
|
|
|
45
45
|
successors: LiveSuccessor[],
|
|
46
46
|
tracing?: Environment,
|
|
47
47
|
) => number[] | undefined;
|
|
48
|
+
storeState: (pending: number, index: number) => void;
|
|
49
|
+
getStateCounts: () => number[];
|
|
48
50
|
findViolation: () => Lasso | undefined;
|
|
49
51
|
getViolatedProperties: (path: Value[][], cycleStart: number) => string[];
|
|
50
52
|
}
|
|
@@ -58,6 +60,8 @@ export interface LiveGraph<State> {
|
|
|
58
60
|
state: State,
|
|
59
61
|
successors: LiveSuccessor<State>[],
|
|
60
62
|
) => number[] | undefined;
|
|
63
|
+
storeState: (pending: number, index: number) => void;
|
|
64
|
+
getStateCounts: () => number[];
|
|
61
65
|
findViolation: () => Lasso | undefined;
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -114,6 +118,7 @@ interface BehaviorGraph<State> {
|
|
|
114
118
|
nextSiblings: number[];
|
|
115
119
|
nodeIds: NodeTable;
|
|
116
120
|
isDone: boolean[];
|
|
121
|
+
stateCount: number;
|
|
117
122
|
errorNode: number | undefined;
|
|
118
123
|
}
|
|
119
124
|
|
|
@@ -366,6 +371,8 @@ export const createLivenessChecker = (
|
|
|
366
371
|
traceWith(replay, () => graph.addInitialState(index, state)),
|
|
367
372
|
addState: (index, state, successors, replay) =>
|
|
368
373
|
traceWith(replay, () => graph.addState(index, state, successors)),
|
|
374
|
+
storeState: graph.storeState,
|
|
375
|
+
getStateCounts: graph.getStateCounts,
|
|
369
376
|
findViolation: graph.findViolation,
|
|
370
377
|
getViolatedProperties: (path, cycleStart) => [
|
|
371
378
|
...new Set(
|
|
@@ -505,6 +512,7 @@ export const createLiveGraph = <State>(
|
|
|
505
512
|
nextSiblings: [],
|
|
506
513
|
nodeIds: { slots: new Int32Array(3 << 10), size: 0, shift: 22 },
|
|
507
514
|
isDone: [],
|
|
515
|
+
stateCount: 0,
|
|
508
516
|
errorNode: undefined,
|
|
509
517
|
}));
|
|
510
518
|
const checkState = (
|
|
@@ -600,8 +608,12 @@ export const createLiveGraph = <State>(
|
|
|
600
608
|
const slot = getNodeSlot(behavior.nodeIds, state, tableauNode);
|
|
601
609
|
return slots[slot] === 0 ? undefined : slots[slot + 2];
|
|
602
610
|
};
|
|
603
|
-
const
|
|
604
|
-
|
|
611
|
+
const linkNode = (
|
|
612
|
+
behavior: BehaviorGraph<State>,
|
|
613
|
+
state: number,
|
|
614
|
+
tableauNode: number,
|
|
615
|
+
node: number,
|
|
616
|
+
) => {
|
|
605
617
|
const table = behavior.nodeIds;
|
|
606
618
|
if (++table.size * 2 > table.slots.length / 3) {
|
|
607
619
|
const old = table.slots;
|
|
@@ -617,12 +629,23 @@ export const createLiveGraph = <State>(
|
|
|
617
629
|
}
|
|
618
630
|
}
|
|
619
631
|
table.slots.set([state + 1, tableauNode, node], getNodeSlot(table, state, tableauNode));
|
|
632
|
+
if (state < 0) return node;
|
|
620
633
|
const last = behavior.lastNodes.data[state] ?? NO_NODE;
|
|
621
634
|
if (last === NO_NODE) writeToPool(behavior.firstNodes, state, [node]);
|
|
622
635
|
else behavior.nextSiblings[last] = node;
|
|
623
636
|
writeToPool(behavior.lastNodes, state, [node]);
|
|
624
637
|
return node;
|
|
625
638
|
};
|
|
639
|
+
const hasState = (behavior: BehaviorGraph<State>, state: number) =>
|
|
640
|
+
state < 0
|
|
641
|
+
? behavior.checks.nodes.some(
|
|
642
|
+
(_checks, tableauNode) => getNodeId(behavior, state, tableauNode) !== undefined,
|
|
643
|
+
)
|
|
644
|
+
: behavior.isDone[state] === true || (behavior.firstNodes.data[state] ?? NO_NODE) !== NO_NODE;
|
|
645
|
+
const recordNode = (behavior: BehaviorGraph<State>, state: number, tableauNode: number) => {
|
|
646
|
+
if (!hasState(behavior, state)) behavior.stateCount++;
|
|
647
|
+
return linkNode(behavior, state, tableauNode, pushNode(behavior, state, tableauNode));
|
|
648
|
+
};
|
|
626
649
|
// The action results of the edge to each target are at its position in actions.
|
|
627
650
|
const writeNode = (
|
|
628
651
|
behavior: BehaviorGraph<State>,
|
|
@@ -753,8 +776,6 @@ export const createLiveGraph = <State>(
|
|
|
753
776
|
const isDone = behavior.isDone[successor.index] === true;
|
|
754
777
|
for (const next of tableauNode.successors) {
|
|
755
778
|
if (!isConsistent(behavior, next, index, successor.state, successorRow, 0)) continue;
|
|
756
|
-
// Deviation from TLC: TLC records the node of a successor the search never stored, which it never expands.
|
|
757
|
-
if (successor.index === -1) continue;
|
|
758
779
|
const existing = getNodeId(behavior, successor.index, next);
|
|
759
780
|
if (existing !== undefined && successors.includes(existing)) continue;
|
|
760
781
|
const target = existing ?? recordNode(behavior, successor.index, next);
|
|
@@ -791,6 +812,7 @@ export const createLiveGraph = <State>(
|
|
|
791
812
|
}
|
|
792
813
|
}
|
|
793
814
|
});
|
|
815
|
+
if (!hasState(behavior, index)) behavior.stateCount++;
|
|
794
816
|
behavior.isDone[index] = true;
|
|
795
817
|
// TLC expands the nodes recorded before the loop, not the ones the loop records.
|
|
796
818
|
for (const node of getStateNodes(behavior, index)) {
|
|
@@ -840,6 +862,7 @@ export const createLiveGraph = <State>(
|
|
|
840
862
|
successors.push(successor.index);
|
|
841
863
|
actions.push(position);
|
|
842
864
|
});
|
|
865
|
+
if (!isWritten(behavior, index)) behavior.stateCount++;
|
|
843
866
|
writeNode(behavior, index, successors, actionResults, actions, stateResults);
|
|
844
867
|
};
|
|
845
868
|
|
|
@@ -1160,6 +1183,22 @@ export const createLiveGraph = <State>(
|
|
|
1160
1183
|
}
|
|
1161
1184
|
return undefined;
|
|
1162
1185
|
},
|
|
1186
|
+
storeState: (pending, index) => {
|
|
1187
|
+
for (const behavior of behaviors) {
|
|
1188
|
+
const tableau = behavior.solution.tableau;
|
|
1189
|
+
if (!tableau) continue;
|
|
1190
|
+
const nodes: number[] = [];
|
|
1191
|
+
for (let tableauNode = 0; tableauNode < tableau.nodes.length; tableauNode++) {
|
|
1192
|
+
const node = getNodeId(behavior, pending, tableauNode);
|
|
1193
|
+
if (node !== undefined) nodes.push(node);
|
|
1194
|
+
}
|
|
1195
|
+
for (const node of nodes.sort((left, right) => left - right)) {
|
|
1196
|
+
behavior.nodeStates[node] = index;
|
|
1197
|
+
linkNode(behavior, index, behavior.nodeTableaux[node], node);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
getStateCounts: () => behaviors.map((behavior) => behavior.stateCount),
|
|
1163
1202
|
findViolation: () => {
|
|
1164
1203
|
for (const behavior of behaviors) {
|
|
1165
1204
|
for (const model of behavior.solution.models) {
|
package/src/liveness.ts
CHANGED
|
@@ -636,7 +636,7 @@ export const getInterpretedAtoms = (environment: Environment): LiveAtoms<Value[]
|
|
|
636
636
|
},
|
|
637
637
|
});
|
|
638
638
|
|
|
639
|
-
|
|
639
|
+
const evaluateLive = <State>(
|
|
640
640
|
expression: LiveExpression,
|
|
641
641
|
state: State,
|
|
642
642
|
next: State | undefined,
|
package/src/obligations/index.ts
CHANGED
|
@@ -179,7 +179,7 @@ const loadMule = (
|
|
|
179
179
|
|
|
180
180
|
const schedule = (modules: Map<string, Mule>) => {
|
|
181
181
|
const dependencies = new Map(
|
|
182
|
-
[...modules].map((
|
|
182
|
+
[...modules].map((entry) => [entry[0], getDependencies(entry[1]).dependencies]),
|
|
183
183
|
);
|
|
184
184
|
const seen = new Set<string>();
|
|
185
185
|
const order: Mule[] = [];
|
|
@@ -351,10 +351,7 @@ const instantiate = (
|
|
|
351
351
|
substitutes.set(name, at({ kind: "Opaque", name }, { location }));
|
|
352
352
|
}
|
|
353
353
|
const anonymized = new Map(
|
|
354
|
-
[...substitutes].map(([
|
|
355
|
-
name,
|
|
356
|
-
pipeline.anonymizer.expr(instanceScope, expression),
|
|
357
|
-
]),
|
|
354
|
+
[...substitutes].map((entry) => [entry[0], pipeline.anonymizer.expr(instanceScope, entry[1])]),
|
|
358
355
|
);
|
|
359
356
|
const body = substituteUnits(
|
|
360
357
|
shift((instanceScope?.size ?? 0) - (module.depth ?? 0)),
|
|
@@ -430,26 +430,26 @@ const createPrinter = (hyps: Hyp[] = [], options: PrinterOptions = {}) => {
|
|
|
430
430
|
);
|
|
431
431
|
case "Choose": {
|
|
432
432
|
const domainDoc = expression.domain && printExpr(expression.domain);
|
|
433
|
-
return withNames(context, [expression.name], (
|
|
433
|
+
return withNames(context, [expression.name], (names) =>
|
|
434
434
|
createBig(
|
|
435
435
|
domainDoc
|
|
436
436
|
? format(
|
|
437
437
|
"@[<b2>CHOOSE @[<b2>%s \\in@ %a@] :@ %a@]",
|
|
438
|
-
|
|
438
|
+
names[0],
|
|
439
439
|
domainDoc,
|
|
440
440
|
printExpr(expression.body),
|
|
441
441
|
)
|
|
442
|
-
: format("@[<b2>CHOOSE %s :@ %a@]",
|
|
442
|
+
: format("@[<b2>CHOOSE %s :@ %a@]", names[0], printExpr(expression.body)),
|
|
443
443
|
),
|
|
444
444
|
);
|
|
445
445
|
}
|
|
446
446
|
case "SetSt": {
|
|
447
447
|
const domainDoc = printExpr(expression.domain);
|
|
448
|
-
return withNames(context, [expression.name], (
|
|
448
|
+
return withNames(context, [expression.name], (names) =>
|
|
449
449
|
createAtom(
|
|
450
450
|
format(
|
|
451
451
|
"@[<b3>{@[<b2>%s \\in@ %a@] :@ %a}@]",
|
|
452
|
-
|
|
452
|
+
names[0],
|
|
453
453
|
domainDoc,
|
|
454
454
|
printExpr(expression.body),
|
|
455
455
|
),
|
package/src/parallel-worker.ts
CHANGED
|
@@ -41,8 +41,14 @@ const runWorker = (start: StartMessage, parent: Port) => {
|
|
|
41
41
|
);
|
|
42
42
|
const specification = created.specification;
|
|
43
43
|
const environment = specification.environment;
|
|
44
|
-
const search = createSearch(
|
|
45
|
-
|
|
44
|
+
const search = createSearch(
|
|
45
|
+
start.config,
|
|
46
|
+
environment,
|
|
47
|
+
specification.variableLocations,
|
|
48
|
+
() => created.order.getDeclarationOrder("variable"),
|
|
49
|
+
undefined,
|
|
50
|
+
[],
|
|
51
|
+
specification.runtimeInvariants,
|
|
46
52
|
);
|
|
47
53
|
const nextAction = search?.spec.next;
|
|
48
54
|
if (!search || nextAction === undefined)
|
package/src/parallel.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "./check";
|
|
9
9
|
import { parseConfig, type ModelConfig } from "./config";
|
|
10
10
|
import { TlaEvaluationError } from "./errors";
|
|
11
|
+
import type { RuntimeInvariant } from "./environment";
|
|
11
12
|
import { isImpure } from "./evaluate";
|
|
12
13
|
import {
|
|
13
14
|
createSharedFingerprints,
|
|
@@ -43,6 +44,7 @@ export interface StartMessage extends Pick<
|
|
|
43
44
|
> {
|
|
44
45
|
type: "start";
|
|
45
46
|
config: ModelConfig;
|
|
47
|
+
runtimeInvariants: RuntimeInvariant[];
|
|
46
48
|
modules: [string, string | undefined][];
|
|
47
49
|
classes: [string, Uint8Array | undefined][];
|
|
48
50
|
index: number;
|
|
@@ -146,6 +148,8 @@ export const check = async (options: CheckOptions): Promise<CheckResult> => {
|
|
|
146
148
|
specification.variableLocations,
|
|
147
149
|
() => created.order.getDeclarationOrder("variable"),
|
|
148
150
|
report,
|
|
151
|
+
[],
|
|
152
|
+
specification.runtimeInvariants,
|
|
149
153
|
);
|
|
150
154
|
if (findAssumptionViolation(specification.assumptions, environment)) return fallBack();
|
|
151
155
|
if (
|
|
@@ -273,6 +277,7 @@ export const check = async (options: CheckOptions): Promise<CheckResult> => {
|
|
|
273
277
|
type: "start",
|
|
274
278
|
source: options.source,
|
|
275
279
|
config,
|
|
280
|
+
runtimeInvariants: specification.runtimeInvariants,
|
|
276
281
|
modules: [...modules],
|
|
277
282
|
classes: [...classes],
|
|
278
283
|
index,
|