tla-ts 0.0.10-dev.1ebc153bd → 0.0.10-dev.22f7435d3
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/deciders.cjs +31 -31
- package/dist/deciders.js +30 -30
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove.cjs +68 -68
- package/dist/prove.js +61 -61
- package/dist/run.cjs +42 -42
- package/dist/run.js +44 -44
- package/dist/transfer.cjs +38 -38
- package/dist/transfer.js +29 -29
- package/dist/worker.cjs +7 -7
- package/dist/worker.js +7 -7
- package/package.json +1 -1
- package/src/bags.ts +5 -2
- package/src/builtins.ts +4 -3
- package/src/check-failure.ts +9 -6
- package/src/check-trace.ts +116 -64
- package/src/check.ts +343 -166
- package/src/cli/tlc-output.ts +1 -0
- package/src/cli/tlc.ts +3 -2
- package/src/codegen.ts +23 -8
- package/src/dependencies.ts +5 -4
- package/src/dfid.ts +13 -8
- package/src/environment.ts +1 -0
- package/src/evaluate.ts +58 -23
- package/src/exit-codes.ts +27 -13
- package/src/java-hash.ts +14 -0
- package/src/liveness-checker.ts +131 -81
- package/src/liveness.ts +48 -10
- package/src/parser.ts +6 -1
- package/src/prover/smt/solver/arith-rewriter.ts +11 -3
- package/src/prover/smt/solver/array-rewriter.ts +12 -2
- package/src/prover/smt/solver/asserted-formulas.ts +109 -63
- package/src/prover/smt/solver/ast.ts +5 -3
- package/src/prover/smt/solver/auf-solver.ts +23 -12
- package/src/prover/smt/solver/bit-blast-tactic.ts +26 -0
- package/src/prover/smt/solver/bound-simplifier.ts +10 -11
- package/src/prover/smt/solver/card2bv.ts +34 -15
- package/src/prover/smt/solver/cofactor-elim-term-ite.ts +39 -23
- package/src/prover/smt/solver/context.ts +44 -11
- package/src/prover/smt/solver/dependent-expr-state.ts +19 -13
- package/src/prover/smt/solver/dt2bv-tactic.ts +36 -20
- package/src/prover/smt/solver/elim-bounds.ts +89 -0
- package/src/prover/smt/solver/elim-uncnstr.ts +1 -1
- package/src/prover/smt/solver/fd-solver.ts +146 -39
- package/src/prover/smt/solver/internalizer.ts +1 -1
- package/src/prover/smt/solver/lp/lp-settings.ts +4 -0
- package/src/prover/smt/solver/maxcore.ts +2 -1
- package/src/prover/smt/solver/maxsmt-base.ts +1 -0
- package/src/prover/smt/solver/model-checker.ts +1 -1
- package/src/prover/smt/solver/model-evaluator.ts +2 -0
- package/src/prover/smt/solver/model-generator.ts +82 -42
- package/src/prover/smt/solver/muz/dl-context.ts +12 -40
- package/src/prover/smt/solver/muz/dl-mk-coi-filter.ts +1 -1
- package/src/prover/smt/solver/muz/dl-rule.ts +6 -7
- package/src/prover/smt/solver/muz/hnf.ts +2 -2
- package/src/prover/smt/solver/muz/horn-tactic.ts +14 -1
- package/src/prover/smt/solver/muz/rule-properties.ts +22 -0
- package/src/prover/smt/solver/muz/spacer-prop-solver.ts +1 -1
- package/src/prover/smt/solver/opt-context.ts +12 -4
- package/src/prover/smt/solver/opt-pareto.ts +19 -0
- package/src/prover/smt/solver/opt-solver.ts +4 -3
- package/src/prover/smt/solver/parallel-tactic.ts +1 -1
- package/src/prover/smt/solver/poly-rewriter.ts +1 -0
- package/src/prover/smt/solver/proto-model.ts +4 -2
- package/src/prover/smt/solver/push-app-ite.ts +37 -0
- package/src/prover/smt/solver/qsat.ts +23 -8
- package/src/prover/smt/solver/rewriter-tpl.ts +7 -6
- package/src/prover/smt/solver/rewriter.ts +31 -25
- package/src/prover/smt/solver/sat/goal2sat.ts +0 -1
- package/src/prover/smt/solver/sat/inc-sat-solver.ts +56 -28
- package/src/prover/smt/solver/sat/sat-tactic.ts +13 -4
- package/src/prover/smt/solver/sat/sat2goal.ts +10 -7
- package/src/prover/smt/solver/smt-consequences.ts +1 -1
- package/src/prover/smt/solver/smt-kernel.ts +39 -4
- package/src/prover/smt/solver/smt-setup.ts +28 -4
- package/src/prover/smt/solver/smtlib-parser.ts +31 -4
- package/src/prover/smt/solver/smtlib-script.ts +219 -82
- package/src/prover/smt/solver/solve-eqs.ts +24 -17
- package/src/prover/smt/solver/solver.ts +18 -3
- package/src/prover/smt/solver/tactic.ts +132 -78
- package/src/prover/smt/solver/theory-bv.ts +11 -1
- package/src/prover/smt/solver/theory-fpa.ts +1 -1
- package/src/prover/smt/solver/theory-lra-final-check.ts +1 -0
- package/src/prover/smt/solver/theory-lra-internalize.ts +1 -0
- package/src/prover/smt/solver/theory-lra-propagate.ts +7 -1
- package/src/prover/smt/solver/theory-lra.ts +1 -0
- package/src/prover/smt/solver/tseitin-cnf.ts +1 -0
- package/src/resolve.ts +446 -167
- package/src/runtime.ts +4 -0
- package/src/search.ts +161 -92
- package/src/simulate.ts +165 -102
- package/src/spec-description.ts +3 -4
- package/src/standard-modules.ts +56 -22
- package/src/subexpressions.ts +168 -49
- package/src/successors.ts +6 -3
- package/src/symmetry.ts +1 -0
- package/src/tlc/random.ts +2 -1
- package/src/tlc/replay.ts +22 -14
- package/src/tlc/tlc-operators.ts +7 -7
- package/src/tlc/tlcext-operators.ts +26 -10
- package/src/tlc/trace-spec.ts +6 -20
- package/src/typed-tier.ts +9 -4
- package/src/values.ts +95 -57
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SmtDefaultError } from "../../../errors";
|
|
2
2
|
import { type AstManager } from "./ast";
|
|
3
3
|
import type { SmtSetup } from "./smt-setup";
|
|
4
4
|
import { AssertedFormulas } from "./asserted-formulas";
|
|
5
5
|
import { Context } from "./context";
|
|
6
|
+
import { L_TRUE } from "./lbool";
|
|
7
|
+
import { Mus } from "./mus";
|
|
8
|
+
import { RefVector } from "./ref-vector";
|
|
6
9
|
import type { KernelParams } from "./solver";
|
|
7
10
|
|
|
8
11
|
export class SmtKernel {
|
|
@@ -10,6 +13,8 @@ export class SmtKernel {
|
|
|
10
13
|
private asserted: AssertedFormulas;
|
|
11
14
|
isSetUp = false;
|
|
12
15
|
private setup: SmtSetup | undefined;
|
|
16
|
+
private isCoreMinimizing: boolean;
|
|
17
|
+
private scopeCount = 0;
|
|
13
18
|
|
|
14
19
|
constructor(manager: AstManager, params: KernelParams) {
|
|
15
20
|
this.asserted = new AssertedFormulas(manager, params.isFindingMacros);
|
|
@@ -17,13 +22,16 @@ export class SmtKernel {
|
|
|
17
22
|
isMbqi: params.isMbqi,
|
|
18
23
|
mbqiMaxIterations: params.mbqiMaxIterations,
|
|
19
24
|
relevancyLevel: params.relevancyLevel ?? 2,
|
|
25
|
+
randomSeed: params.randomSeed,
|
|
20
26
|
});
|
|
21
27
|
this.setup = params.setup;
|
|
28
|
+
this.isCoreMinimizing = params.isCoreMinimizing ?? false;
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
// As in Z3, a kernel not yet set up reads auto_config again.
|
|
25
32
|
updateParams(params: KernelParams) {
|
|
26
33
|
if (!this.isSetUp) this.setup = params.setup;
|
|
34
|
+
this.isCoreMinimizing = params.isCoreMinimizing ?? false;
|
|
27
35
|
this.context.updateParams(params);
|
|
28
36
|
this.asserted.updateParams(this.context.config);
|
|
29
37
|
}
|
|
@@ -43,7 +51,9 @@ export class SmtKernel {
|
|
|
43
51
|
this.asserted.isPreprocessing = isPreprocessing;
|
|
44
52
|
}
|
|
45
53
|
|
|
54
|
+
// context::assert_expr_core counts a step, and drops the formula once the limit is spent.
|
|
46
55
|
assertExpr(expr: number) {
|
|
56
|
+
if (this.context.checkCanceled()) return;
|
|
47
57
|
this.context.popToBaseLevel();
|
|
48
58
|
this.asserted.assertExpr(expr);
|
|
49
59
|
}
|
|
@@ -52,15 +62,19 @@ export class SmtKernel {
|
|
|
52
62
|
const context = this.context;
|
|
53
63
|
context.popToBaseLevel();
|
|
54
64
|
this.setupContext(false);
|
|
65
|
+
const wasConsistent = !context.isInconsistent();
|
|
55
66
|
context.internalizeAssertions(this.asserted);
|
|
56
67
|
const limit = context.manager.limit;
|
|
57
|
-
if (!limit.inc()) throw new
|
|
68
|
+
if (!limit.inc()) throw new SmtDefaultError("push canceled");
|
|
58
69
|
const wasSuspended = limit.isSuspended;
|
|
59
70
|
limit.isSuspended = true;
|
|
60
71
|
if (!context.isInconsistent()) context.propagate();
|
|
72
|
+
if (wasConsistent && context.isInconsistent() && !this.asserted.isInconsistent)
|
|
73
|
+
context.resolveConflict();
|
|
61
74
|
limit.isSuspended = wasSuspended;
|
|
62
75
|
context.push();
|
|
63
76
|
this.asserted.push();
|
|
77
|
+
this.scopeCount++;
|
|
64
78
|
}
|
|
65
79
|
|
|
66
80
|
getAssertions() {
|
|
@@ -68,8 +82,11 @@ export class SmtKernel {
|
|
|
68
82
|
}
|
|
69
83
|
|
|
70
84
|
pop(numScopes: number) {
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
const count = Math.min(numScopes, this.scopeCount);
|
|
86
|
+
if (count === 0) return;
|
|
87
|
+
this.context.pop(count);
|
|
88
|
+
for (let index = 0; index < count; index++) this.asserted.pop();
|
|
89
|
+
this.scopeCount -= count;
|
|
73
90
|
}
|
|
74
91
|
|
|
75
92
|
initAssumptions(assumptions: number[]) {
|
|
@@ -86,4 +103,22 @@ export class SmtKernel {
|
|
|
86
103
|
this.setupContext(true);
|
|
87
104
|
return this.check();
|
|
88
105
|
}
|
|
106
|
+
|
|
107
|
+
getUnsatCore(core: RefVector) {
|
|
108
|
+
for (const expr of this.context.unsatCore) core.push(expr);
|
|
109
|
+
if (!this.isCoreMinimizing) return;
|
|
110
|
+
const manager = this.context.manager;
|
|
111
|
+
const mus = new Mus(manager, {
|
|
112
|
+
checkSat: (assumptions) => this.check(assumptions),
|
|
113
|
+
getUnsatCore: () => this.context.unsatCore,
|
|
114
|
+
});
|
|
115
|
+
for (const literal of core.items) mus.addSoft(literal);
|
|
116
|
+
const minimized = new RefVector(manager);
|
|
117
|
+
if (mus.getMus(minimized) === L_TRUE) {
|
|
118
|
+
core.reset();
|
|
119
|
+
for (const literal of minimized.items) core.push(literal);
|
|
120
|
+
}
|
|
121
|
+
minimized.reset();
|
|
122
|
+
mus.reset();
|
|
123
|
+
}
|
|
89
124
|
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "./ast";
|
|
17
17
|
import { SmtDefaultError } from "../../../errors";
|
|
18
18
|
import { collectStaticFeatures, isDense, type StaticFeatures } from "./static-features";
|
|
19
|
+
import { Rational } from "./rational";
|
|
19
20
|
|
|
20
21
|
const AUFLIA_LOGICS = new Set([
|
|
21
22
|
"AUFLIA",
|
|
@@ -103,7 +104,11 @@ export interface SmtConfig {
|
|
|
103
104
|
isEq2Ineq: boolean;
|
|
104
105
|
isFindingMacros: boolean;
|
|
105
106
|
isEliminatingTermIte: boolean;
|
|
107
|
+
isLiftingNonGroundIte: boolean;
|
|
108
|
+
isEliminatingBounds: boolean;
|
|
106
109
|
isArithPropagatingEqs: boolean;
|
|
110
|
+
arithPropagationThreshold: number;
|
|
111
|
+
isArithBoundPropagating: boolean;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
const UNKNOWN_THEORIES = [
|
|
@@ -132,7 +137,11 @@ export const DEFAULT_CONFIG: SmtConfig = {
|
|
|
132
137
|
isEq2Ineq: false,
|
|
133
138
|
isFindingMacros: false,
|
|
134
139
|
isEliminatingTermIte: false,
|
|
140
|
+
isLiftingNonGroundIte: false,
|
|
141
|
+
isEliminatingBounds: false,
|
|
135
142
|
isArithPropagatingEqs: true,
|
|
143
|
+
arithPropagationThreshold: Infinity,
|
|
144
|
+
isArithBoundPropagating: true,
|
|
136
145
|
};
|
|
137
146
|
|
|
138
147
|
// setup_unknown(), which closes with setup_relevancy.
|
|
@@ -197,6 +206,12 @@ const setupQfLiaByFeatures = (config: SmtConfig, features: StaticFeatures) => {
|
|
|
197
206
|
config.restartStrategy = RS_GEOMETRIC;
|
|
198
207
|
config.restartFactor = 1.5;
|
|
199
208
|
}
|
|
209
|
+
if (
|
|
210
|
+
features.numBinClauses + features.numUnits === features.numClauses &&
|
|
211
|
+
features.isCnf &&
|
|
212
|
+
features.arithKSum.compare(Rational.of(100000n)) > 0
|
|
213
|
+
)
|
|
214
|
+
config.isArithBoundPropagating = false;
|
|
200
215
|
config.theories.push(FAMILY_ARITH);
|
|
201
216
|
};
|
|
202
217
|
|
|
@@ -288,12 +303,17 @@ const setupQfUfIdlByFeatures = (config: SmtConfig, features: StaticFeatures) =>
|
|
|
288
303
|
config.theories.push(FAMILY_ARITH);
|
|
289
304
|
};
|
|
290
305
|
|
|
291
|
-
const
|
|
306
|
+
const setupQfUfLra = (config: SmtConfig) => {
|
|
292
307
|
config.theories.push(FAMILY_ARITH);
|
|
293
308
|
config.relevancyLevel = 0;
|
|
294
309
|
config.isNnfCnf = false;
|
|
295
310
|
};
|
|
296
311
|
|
|
312
|
+
const setupQfUfLia = (config: SmtConfig) => {
|
|
313
|
+
setupQfUfLra(config);
|
|
314
|
+
config.arithPropagationThreshold = 1000;
|
|
315
|
+
};
|
|
316
|
+
|
|
297
317
|
const setupQfBv = (config: SmtConfig) => {
|
|
298
318
|
config.relevancyLevel = 0;
|
|
299
319
|
config.isNnfCnf = false;
|
|
@@ -360,6 +380,8 @@ const setupAufLia = (config: SmtConfig) => {
|
|
|
360
380
|
config.phaseSelection = PS_ALWAYS_FALSE;
|
|
361
381
|
config.restartStrategy = RS_GEOMETRIC;
|
|
362
382
|
config.restartFactor = 1.5;
|
|
383
|
+
config.isEliminatingBounds = true;
|
|
384
|
+
config.isLiftingNonGroundIte = true;
|
|
363
385
|
config.theories.push(FAMILY_ARITH, FAMILY_ARRAY);
|
|
364
386
|
};
|
|
365
387
|
|
|
@@ -373,7 +395,9 @@ const setupAufLiaByFeatures = (config: SmtConfig, features: StaticFeatures) => {
|
|
|
373
395
|
|
|
374
396
|
const setupAufLira = (config: SmtConfig) => {
|
|
375
397
|
config.phaseSelection = PS_ALWAYS_FALSE;
|
|
398
|
+
config.isEliminatingBounds = true;
|
|
376
399
|
config.isFindingMacros = true;
|
|
400
|
+
config.isLiftingNonGroundIte = true;
|
|
377
401
|
config.theories.push(FAMILY_ARITH, FAMILY_ARRAY);
|
|
378
402
|
};
|
|
379
403
|
|
|
@@ -403,7 +427,7 @@ const DEFAULT_SETUPS = new Map<string, (config: SmtConfig) => void>([
|
|
|
403
427
|
["QF_LRA", setupQfLra],
|
|
404
428
|
["QF_LIA", setupQfLia],
|
|
405
429
|
["QF_UFLIA", setupQfUfLia],
|
|
406
|
-
["QF_UFLRA",
|
|
430
|
+
["QF_UFLRA", setupQfUfLra],
|
|
407
431
|
["QF_AX", setupQfAx],
|
|
408
432
|
["QF_AUFLIA", setupQfAufLia],
|
|
409
433
|
["QF_BV", setupQfBv],
|
|
@@ -479,7 +503,7 @@ const setupUnknownByFeatures = (config: SmtConfig, features: StaticFeatures, set
|
|
|
479
503
|
else setupQfLiaByFeatures(config, features);
|
|
480
504
|
} else if (isTwoWithUf && isArith(features)) {
|
|
481
505
|
if (!features.hasReal && isLinear) setupQfUfLiaByFeatures(config, features);
|
|
482
|
-
else if (!features.hasInt && isLinear)
|
|
506
|
+
else if (!features.hasInt && isLinear) setupQfUfLra(config);
|
|
483
507
|
else setupUnknown(config, features);
|
|
484
508
|
} else if (numTheories === 1 && features.hasBv) setupQfBv(config);
|
|
485
509
|
else if (numTheories === 1 && features.hasFpa) setupQfFp(config);
|
|
@@ -503,7 +527,7 @@ const AUTO_SETUPS = new Map<
|
|
|
503
527
|
["QF_LRA", setupQfLraByFeatures],
|
|
504
528
|
["QF_LIA", setupQfLiaByFeatures],
|
|
505
529
|
["QF_UFLIA", setupQfUfLiaByFeatures],
|
|
506
|
-
["QF_UFLRA",
|
|
530
|
+
["QF_UFLRA", setupQfUfLra],
|
|
507
531
|
["QF_AX", setupQfAxByFeatures],
|
|
508
532
|
["QF_BVRE", setupQfBvre],
|
|
509
533
|
["QF_AUFLIA", setupQfAufLiaByFeatures],
|
|
@@ -32,10 +32,12 @@ import {
|
|
|
32
32
|
OP_GT,
|
|
33
33
|
OP_IDIV,
|
|
34
34
|
OP_IMPLIES,
|
|
35
|
+
OP_INT2BV,
|
|
35
36
|
OP_IS_INT,
|
|
36
37
|
OP_ITE,
|
|
37
38
|
OP_LE,
|
|
38
39
|
OP_LT,
|
|
40
|
+
OP_MKBV,
|
|
39
41
|
OP_MOD,
|
|
40
42
|
OP_REM,
|
|
41
43
|
OP_MUL,
|
|
@@ -537,6 +539,8 @@ const REAL_FUNCTION_OPS = new Set([
|
|
|
537
539
|
|
|
538
540
|
// The arity of each builtin declaration but distinct, which takes the arguments it is given.
|
|
539
541
|
const ARITIES = new Map<number, number>([
|
|
542
|
+
[OP_TRUE, 0],
|
|
543
|
+
[OP_FALSE, 0],
|
|
540
544
|
[OP_ITE, 3],
|
|
541
545
|
...[OP_NOT, OP_UMINUS, OP_ABS, OP_TO_REAL, OP_TO_INT, OP_IS_INT, ...REAL_FUNCTION_OPS]
|
|
542
546
|
.filter((op) => op !== OP_ATAN2)
|
|
@@ -972,6 +976,10 @@ export const createSmtlibReader = (
|
|
|
972
976
|
]);
|
|
973
977
|
const funcs = new Map<string, readonly number[]>();
|
|
974
978
|
const macros = new Map<string, Macro>();
|
|
979
|
+
// A pop empties the macros of a name but keeps the name in the dictionary.
|
|
980
|
+
const macroNames: string[] = [];
|
|
981
|
+
const dictionaryNames = new Set<string>();
|
|
982
|
+
const macroDictionary = new ObjMap<string>((index) => getSymbolHash(macroNames[index]));
|
|
975
983
|
const lastNamed = { name: "", expr: -1 };
|
|
976
984
|
const notifiedSorts = new Set<number>();
|
|
977
985
|
const undo: (() => void)[] = [];
|
|
@@ -1008,6 +1016,14 @@ export const createSmtlibReader = (
|
|
|
1008
1016
|
names.set(name, value);
|
|
1009
1017
|
};
|
|
1010
1018
|
|
|
1019
|
+
const insertMacro = (name: string, macro: Macro) => {
|
|
1020
|
+
if (!dictionaryNames.has(name)) {
|
|
1021
|
+
dictionaryNames.add(name);
|
|
1022
|
+
macroDictionary.set(macroNames.push(name) - 1, name);
|
|
1023
|
+
}
|
|
1024
|
+
declare(macros, name, macro);
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1011
1027
|
const hasArrays = logic === undefined || logicHasArray(logic);
|
|
1012
1028
|
const hasFpa = logic === undefined || logicHasFpa(logic);
|
|
1013
1029
|
const hasArrayExtensions = logic === undefined || ARRAY_EXTENSION_LOGICS.has(logic);
|
|
@@ -1653,6 +1669,8 @@ export const createSmtlibReader = (
|
|
|
1653
1669
|
const mkBvApp = (name: string, args: number[], indices: number[], at: SExpr) => {
|
|
1654
1670
|
const op = BV_OP_NAMES.get(name) ?? -1;
|
|
1655
1671
|
const argSorts = args.map((arg) => manager.sorts[arg]);
|
|
1672
|
+
if (op !== OP_INT2BV && op !== OP_MKBV && (args.length === 0 || !manager.isBvSort(argSorts[0])))
|
|
1673
|
+
throw new SmtParseError("operator is applied to arguments of the wrong sort", at);
|
|
1656
1674
|
const signature = getBvSignature(manager, op, argSorts, indices);
|
|
1657
1675
|
if (typeof signature === "string") throw new SmtParseError(signature, at);
|
|
1658
1676
|
const mismatched = getMismatchedArgument(signature, argSorts);
|
|
@@ -2263,7 +2281,11 @@ export const createSmtlibReader = (
|
|
|
2263
2281
|
const builtinOp =
|
|
2264
2282
|
builtin === "~"
|
|
2265
2283
|
? OP_UMINUS
|
|
2266
|
-
:
|
|
2284
|
+
: builtin === "true"
|
|
2285
|
+
? OP_TRUE
|
|
2286
|
+
: builtin === "false"
|
|
2287
|
+
? OP_FALSE
|
|
2288
|
+
: (CHAINABLE_OPS.get(builtin) ?? BUILTIN_OPS.get(builtin) ?? transcendentalOp);
|
|
2267
2289
|
// load_plugin registers the operators of arithmetic only for a logic that has it.
|
|
2268
2290
|
const named =
|
|
2269
2291
|
builtinOp !== undefined && manager.funcDecls[builtinOp].family === FAMILY_ARITH && !hasArith
|
|
@@ -2351,7 +2373,7 @@ export const createSmtlibReader = (
|
|
|
2351
2373
|
const decl = manager.mkMacro(name, expr);
|
|
2352
2374
|
declare(funcs, name, [...(funcs.get(name) ?? []), decl]);
|
|
2353
2375
|
scopedFuncs.push(decl);
|
|
2354
|
-
|
|
2376
|
+
insertMacro(name, { domain: [], range: manager.sorts[expr], body: expr });
|
|
2355
2377
|
};
|
|
2356
2378
|
|
|
2357
2379
|
// push_app_frame's parse_qualified_identifier_core, on a head that is (_ <symbol> <index>*) or
|
|
@@ -3397,7 +3419,7 @@ export const createSmtlibReader = (
|
|
|
3397
3419
|
extra ?? list.end,
|
|
3398
3420
|
);
|
|
3399
3421
|
manager.incRef(body);
|
|
3400
|
-
|
|
3422
|
+
insertMacro(symbol.text, { domain: bound.varSorts, range, body });
|
|
3401
3423
|
defineMacroFunc(symbol.text, bound.varSorts, body);
|
|
3402
3424
|
expectEnd(
|
|
3403
3425
|
extra,
|
|
@@ -3536,7 +3558,7 @@ export const createSmtlibReader = (
|
|
|
3536
3558
|
getFuncs: (name: string) => funcs.get(name) ?? [],
|
|
3537
3559
|
hasDefinitions,
|
|
3538
3560
|
parseTerm,
|
|
3539
|
-
parseSort: (sexpr: SExpr) => parseSort(sexpr,
|
|
3561
|
+
parseSort: (sexpr: SExpr, context: string) => parseSort(sexpr, context),
|
|
3540
3562
|
parseFormula,
|
|
3541
3563
|
parseAssertion,
|
|
3542
3564
|
getLogicError: logicChecker.checkExpr,
|
|
@@ -3548,6 +3570,11 @@ export const createSmtlibReader = (
|
|
|
3548
3570
|
isUsed,
|
|
3549
3571
|
isClashing,
|
|
3550
3572
|
getDeclaredFuncs,
|
|
3573
|
+
getConstantMacros: () =>
|
|
3574
|
+
[...macroDictionary.values()].flatMap((name) => {
|
|
3575
|
+
const macro = macros.get(name);
|
|
3576
|
+
return macro?.domain.length === 0 ? [{ name, body: macro.body }] : [];
|
|
3577
|
+
}),
|
|
3551
3578
|
};
|
|
3552
3579
|
};
|
|
3553
3580
|
|