everystate 0.1.0 → 0.3.1
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 +121 -86
- package/bin/everystate.mjs +35 -0
- package/native/darwin-arm64/everystate +0 -0
- package/native/darwin-x64/everystate +0 -0
- package/native/linux-arm64/everystate +0 -0
- package/native/linux-x64/everystate +0 -0
- package/native/win32-x64/everystate.exe +0 -0
- package/package.json +29 -24
- package/skills/formal-verification/SKILL.md +115 -0
- package/skills/formal-verification/example/Charge.cfg +7 -0
- package/skills/formal-verification/example/Charge.tla +61 -0
- package/skills/formal-verification/example/ChargeBroken.cfg +7 -0
- package/wasm/cli.mjs +26 -0
- package/wasm/everystate.d.ts +33 -0
- package/wasm/everystate.mjs +112 -0
- package/wasm/everystate.wasm +0 -0
- package/CONFORMANCE.md +0 -64
- package/dist/bundled.d.ts +0 -1
- package/dist/bundled.js +0 -2
- package/dist/cfg.d.ts +0 -24
- package/dist/cfg.js +0 -252
- package/dist/checker.d.ts +0 -96
- package/dist/checker.js +0 -520
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -4
- package/dist/community.d.ts +0 -17
- package/dist/community.js +0 -1381
- package/dist/entry.d.ts +0 -2
- package/dist/entry.js +0 -39
- package/dist/eval.d.ts +0 -119
- package/dist/eval.js +0 -1533
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -24
- package/dist/java.d.ts +0 -2
- package/dist/java.js +0 -6
- package/dist/lexer.d.ts +0 -17
- package/dist/lexer.js +0 -255
- package/dist/liveness.d.ts +0 -80
- package/dist/liveness.js +0 -855
- package/dist/main.d.ts +0 -40
- package/dist/main.js +0 -494
- package/dist/model.d.ts +0 -56
- package/dist/model.js +0 -582
- package/dist/modules.d.ts +0 -91
- package/dist/modules.js +0 -649
- package/dist/node-host.d.ts +0 -2
- package/dist/node-host.js +0 -25
- package/dist/parser.d.ts +0 -30
- package/dist/parser.js +0 -1114
- package/dist/pprint.d.ts +0 -7
- package/dist/pprint.js +0 -647
- package/dist/stdlib.d.ts +0 -14
- package/dist/stdlib.js +0 -588
- package/dist/values.d.ts +0 -150
- package/dist/values.js +0 -822
package/dist/liveness.js
DELETED
|
@@ -1,855 +0,0 @@
|
|
|
1
|
-
import { exprLevel, ConfigError, locStr } from "./model.js";
|
|
2
|
-
import { Checker } from "./checker.js";
|
|
3
|
-
import { TlaError } from "./lexer.js";
|
|
4
|
-
const TRUE = { t: 'bool', lvl: 0, v: true };
|
|
5
|
-
const FALSE = { t: 'bool', lvl: 0, v: false };
|
|
6
|
-
const mkNot = (a) => a.t === 'bool' ? (a.v ? FALSE : TRUE) : a.t === 'not' ? a.a : { t: 'not', lvl: a.lvl, a };
|
|
7
|
-
function mkJunc(t, items) {
|
|
8
|
-
const out = [];
|
|
9
|
-
for (const x of items) {
|
|
10
|
-
if (x.t === 'bool') {
|
|
11
|
-
if (x.v === (t === 'or'))
|
|
12
|
-
return x; // TRUE in or / FALSE in and
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
if (x.t === t)
|
|
16
|
-
out.push(...x.as);
|
|
17
|
-
else
|
|
18
|
-
out.push(x);
|
|
19
|
-
}
|
|
20
|
-
if (out.length === 0)
|
|
21
|
-
return t === 'and' ? TRUE : FALSE;
|
|
22
|
-
if (out.length === 1)
|
|
23
|
-
return out[0];
|
|
24
|
-
return { t, lvl: Math.max(...out.map(x => x.lvl)), as: out };
|
|
25
|
-
}
|
|
26
|
-
// TLC does not fold constants through temporal operators when it decides whether a property is a tautology
|
|
27
|
-
// ([]TRUE stays a temporal formula); `foldTemporal` is switched off for that test only.
|
|
28
|
-
let foldTemporal = true;
|
|
29
|
-
const mkAlways = (a) => a.t === 'bool' && foldTemporal ? a : { t: 'always', lvl: 3, a };
|
|
30
|
-
const mkEventually = (a) => a.t === 'bool' && foldTemporal ? a : { t: 'eventually', lvl: 3, a };
|
|
31
|
-
export class Liveness {
|
|
32
|
-
model;
|
|
33
|
-
checker;
|
|
34
|
-
atomIds = new Map();
|
|
35
|
-
atoms = [];
|
|
36
|
-
constructor(model, checker) { this.model = model; this.checker = checker; }
|
|
37
|
-
atom(e, ctx, lvl) {
|
|
38
|
-
let m = this.atomIds.get(e);
|
|
39
|
-
if (!m) {
|
|
40
|
-
m = new Map();
|
|
41
|
-
this.atomIds.set(e, m);
|
|
42
|
-
}
|
|
43
|
-
let id = m.get(ctx);
|
|
44
|
-
if (id === undefined) {
|
|
45
|
-
id = this.atoms.length;
|
|
46
|
-
m.set(ctx, id);
|
|
47
|
-
this.atoms.push({ t: 'atom', lvl: Math.max(lvl, 1), e, ctx, id });
|
|
48
|
-
}
|
|
49
|
-
return this.atoms[id];
|
|
50
|
-
}
|
|
51
|
-
toLive(e, ctx) {
|
|
52
|
-
const ev = this.model.ev;
|
|
53
|
-
const lvl = exprLevel(ev, e, ctx);
|
|
54
|
-
if (lvl === 0) {
|
|
55
|
-
try {
|
|
56
|
-
ev.cur = [];
|
|
57
|
-
ev.nxt = null;
|
|
58
|
-
ev.initMode = false;
|
|
59
|
-
const v = ev.eval(e, ctx);
|
|
60
|
-
if (typeof v === 'boolean')
|
|
61
|
-
return v ? TRUE : FALSE;
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
if (!(err instanceof TlaError))
|
|
65
|
-
throw err;
|
|
66
|
-
}
|
|
67
|
-
return this.atom(e, ctx, 1);
|
|
68
|
-
}
|
|
69
|
-
if (lvl <= 2)
|
|
70
|
-
return this.atom(e, ctx, lvl);
|
|
71
|
-
const syn = (k, a) => ({ k, loc: e.loc, a, mod: e.mod });
|
|
72
|
-
switch (e.k) {
|
|
73
|
-
case 'app': {
|
|
74
|
-
const x = ev.expandApp(e, ctx);
|
|
75
|
-
if (x)
|
|
76
|
-
return this.toLive(x.body, x.ctx);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
case 'let': return this.toLive(e.body, ev.bindLet(e.defs, ctx));
|
|
80
|
-
case 'quant': {
|
|
81
|
-
const parts = [];
|
|
82
|
-
ev.cur = [];
|
|
83
|
-
ev.nxt = null;
|
|
84
|
-
ev.forBindings(e.bounds, ctx, c => { parts.push(this.toLive(e.body, c)); return false; });
|
|
85
|
-
return mkJunc(e.q === 'A' ? 'and' : 'or', parts);
|
|
86
|
-
}
|
|
87
|
-
case 'and': return mkJunc('and', e.a.map((x) => this.toLive(x, ctx)));
|
|
88
|
-
case 'or': return mkJunc('or', e.a.map((x) => this.toLive(x, ctx)));
|
|
89
|
-
case 'not': return mkNot(this.toLive(e.a[0], ctx));
|
|
90
|
-
case 'imp': return mkJunc('or', [mkNot(this.toLive(e.a[0], ctx)), this.toLive(e.a[1], ctx)]);
|
|
91
|
-
case 'eqv': {
|
|
92
|
-
const a = this.toLive(e.a[0], ctx), b = this.toLive(e.a[1], ctx);
|
|
93
|
-
return mkJunc('or', [mkJunc('and', [a, b]), mkJunc('and', [mkNot(a), mkNot(b)])]);
|
|
94
|
-
}
|
|
95
|
-
case 'if': {
|
|
96
|
-
if (exprLevel(ev, e.a[0], ctx) === 0) {
|
|
97
|
-
// constant guard: translate only the chosen branch (lets recursive temporal operators terminate)
|
|
98
|
-
let gv;
|
|
99
|
-
try {
|
|
100
|
-
ev.cur = [];
|
|
101
|
-
ev.nxt = null;
|
|
102
|
-
ev.initMode = false;
|
|
103
|
-
gv = ev.eval(e.a[0], ctx);
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
if (!(err instanceof TlaError))
|
|
107
|
-
throw err;
|
|
108
|
-
}
|
|
109
|
-
if (typeof gv === 'boolean')
|
|
110
|
-
return this.toLive(gv ? e.a[1] : e.a[2], ctx);
|
|
111
|
-
}
|
|
112
|
-
const g = this.toLive(e.a[0], ctx);
|
|
113
|
-
return mkJunc('or', [mkJunc('and', [g, this.toLive(e.a[1], ctx)]), mkJunc('and', [mkNot(g), this.toLive(e.a[2], ctx)])]);
|
|
114
|
-
}
|
|
115
|
-
case 'always': return mkAlways(this.toLive(e.a[0], ctx));
|
|
116
|
-
case 'eventually': return mkEventually(this.toLive(e.a[0], ctx));
|
|
117
|
-
case 'leadsto': return mkAlways(mkJunc('or', [mkNot(this.toLive(e.a[0], ctx)), mkEventually(this.toLive(e.a[1], ctx))]));
|
|
118
|
-
case 'wf':
|
|
119
|
-
case 'sf': {
|
|
120
|
-
const act = syn('angleact', [e.a[1], e.a[0]]);
|
|
121
|
-
const en = this.atom(syn('enabled', [act]), ctx, 1);
|
|
122
|
-
const a = this.atom(act, ctx, 2);
|
|
123
|
-
if (e.k === 'wf')
|
|
124
|
-
return mkAlways(mkEventually(mkJunc('or', [mkNot(en), a])));
|
|
125
|
-
return mkJunc('or', [mkEventually(mkAlways(mkNot(en))), mkAlways(mkEventually(a))]);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
throw new ConfigError(`TLC cannot handle the temporal formula at line ${e.loc[0]}, col ${e.loc[1]} to line ${e.loc[2]}, col ${e.loc[3]} of module ${e.mod ?? '?'}`);
|
|
129
|
-
}
|
|
130
|
-
// Push negations inward; non-temporal subtrees stay as (possibly negated) predicates.
|
|
131
|
-
pushNeg(x, neg) {
|
|
132
|
-
if (x.lvl <= 2)
|
|
133
|
-
return neg ? mkNot(x) : x;
|
|
134
|
-
switch (x.t) {
|
|
135
|
-
case 'not': return this.pushNeg(x.a, !neg);
|
|
136
|
-
case 'and':
|
|
137
|
-
case 'or': {
|
|
138
|
-
const t = (x.t === 'and') !== neg ? 'and' : 'or';
|
|
139
|
-
return mkJunc(t, x.as.map(y => this.pushNeg(y, neg)));
|
|
140
|
-
}
|
|
141
|
-
case 'always': return neg ? mkEventually(this.pushNeg(x.a, true)) : mkAlways(this.pushNeg(x.a, false));
|
|
142
|
-
case 'eventually': return neg ? mkAlways(this.pushNeg(x.a, true)) : mkEventually(this.pushNeg(x.a, false));
|
|
143
|
-
}
|
|
144
|
-
return x;
|
|
145
|
-
}
|
|
146
|
-
simp(x) {
|
|
147
|
-
if (x.lvl <= 2)
|
|
148
|
-
return x;
|
|
149
|
-
switch (x.t) {
|
|
150
|
-
case 'and':
|
|
151
|
-
case 'or': return mkJunc(x.t, x.as.map(y => this.simp(y)));
|
|
152
|
-
case 'always': {
|
|
153
|
-
const a = this.simp(x.a);
|
|
154
|
-
if (a.t === 'always')
|
|
155
|
-
return a;
|
|
156
|
-
if (a.t === 'and' && a.lvl === 3)
|
|
157
|
-
return mkJunc('and', a.as.map(y => this.simp(mkAlways(y))));
|
|
158
|
-
if (a.t === 'eventually' && a.a.t === 'always')
|
|
159
|
-
return a; // []<>[]p = <>[]p
|
|
160
|
-
if (a.t === 'eventually' && a.a.t === 'or' && a.a.lvl === 3)
|
|
161
|
-
return mkJunc('or', a.a.as.map(y => this.simp(mkAlways(mkEventually(y)))));
|
|
162
|
-
return mkAlways(a);
|
|
163
|
-
}
|
|
164
|
-
case 'eventually': {
|
|
165
|
-
const a = this.simp(x.a);
|
|
166
|
-
if (a.t === 'eventually')
|
|
167
|
-
return a;
|
|
168
|
-
if (a.t === 'or' && a.lvl === 3)
|
|
169
|
-
return mkJunc('or', a.as.map(y => this.simp(mkEventually(y))));
|
|
170
|
-
if (a.t === 'always' && a.a.t === 'eventually')
|
|
171
|
-
return a; // <>[]<>p = []<>p
|
|
172
|
-
if (a.t === 'always' && a.a.t === 'and' && a.a.lvl === 3)
|
|
173
|
-
return mkJunc('and', a.a.as.map(y => this.simp(mkEventually(mkAlways(y)))));
|
|
174
|
-
return mkEventually(a);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return x;
|
|
178
|
-
}
|
|
179
|
-
dnf(x) {
|
|
180
|
-
if (x.t === 'or' && x.lvl === 3)
|
|
181
|
-
return x.as.flatMap(y => this.dnf(y));
|
|
182
|
-
if (x.t === 'and' && x.lvl === 3) {
|
|
183
|
-
let acc = [[]];
|
|
184
|
-
for (const y of x.as) {
|
|
185
|
-
const d = this.dnf(y);
|
|
186
|
-
const next = [];
|
|
187
|
-
for (const a of acc)
|
|
188
|
-
for (const b of d)
|
|
189
|
-
next.push([...a, ...b]);
|
|
190
|
-
acc = next;
|
|
191
|
-
if (acc.length > 100000)
|
|
192
|
-
throw new ConfigError('The temporal formula is too large to check (DNF blow-up).');
|
|
193
|
-
}
|
|
194
|
-
return acc;
|
|
195
|
-
}
|
|
196
|
-
if (x.t === 'bool')
|
|
197
|
-
return x.v ? [[]] : [];
|
|
198
|
-
return [[x]];
|
|
199
|
-
}
|
|
200
|
-
key(x) {
|
|
201
|
-
switch (x.t) {
|
|
202
|
-
case 'bool': return x.v ? 'T' : 'F';
|
|
203
|
-
case 'atom': return 'a' + x.id;
|
|
204
|
-
case 'not': return '!' + this.key(x.a);
|
|
205
|
-
case 'always': return '[]' + this.key(x.a);
|
|
206
|
-
case 'eventually': return '<>' + this.key(x.a);
|
|
207
|
-
default: return (x.t === 'and' ? '&(' : '|(') + x.as.map(y => this.key(y)).join(',') + ')';
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
// ---- graph ----
|
|
211
|
-
S = 0;
|
|
212
|
-
eStart;
|
|
213
|
-
eTo;
|
|
214
|
-
eAct;
|
|
215
|
-
eState = null;
|
|
216
|
-
stateCache = new Map();
|
|
217
|
-
edgeCache = new Map();
|
|
218
|
-
buildGraph() {
|
|
219
|
-
const c = this.checker;
|
|
220
|
-
const S = this.S = c.states.length;
|
|
221
|
-
let E = S;
|
|
222
|
-
for (let i = 0; i < S; i++)
|
|
223
|
-
E += c.succ[i].length;
|
|
224
|
-
if (c.succState)
|
|
225
|
-
this.eState = new Array(E);
|
|
226
|
-
this.eStart = new Int32Array(S + 1);
|
|
227
|
-
this.eTo = new Int32Array(E);
|
|
228
|
-
this.eAct = new Int32Array(E);
|
|
229
|
-
let p = 0;
|
|
230
|
-
for (let i = 0; i < S; i++) {
|
|
231
|
-
this.eStart[i] = p;
|
|
232
|
-
const su = c.succ[i], sa = c.succAct[i];
|
|
233
|
-
const seen = new Set();
|
|
234
|
-
const real = c.succState ? c.succState[i] : undefined;
|
|
235
|
-
for (let j = 0; j < su.length; j++) {
|
|
236
|
-
if (!real && seen.has(su[j]))
|
|
237
|
-
continue;
|
|
238
|
-
seen.add(su[j]);
|
|
239
|
-
if (real)
|
|
240
|
-
this.eState[p] = real[j];
|
|
241
|
-
this.eTo[p] = su[j];
|
|
242
|
-
this.eAct[p] = sa[j];
|
|
243
|
-
p++;
|
|
244
|
-
}
|
|
245
|
-
if (!seen.has(i) || real) {
|
|
246
|
-
this.eTo[p] = i;
|
|
247
|
-
this.eAct[p] = -1;
|
|
248
|
-
p++;
|
|
249
|
-
} // stuttering self-loop
|
|
250
|
-
}
|
|
251
|
-
this.eStart[S] = p;
|
|
252
|
-
}
|
|
253
|
-
// Evaluate a non-temporal live expression at a state (and, for action level, along edge `e`).
|
|
254
|
-
evalLE(x, s, e) {
|
|
255
|
-
switch (x.t) {
|
|
256
|
-
case 'bool': return x.v;
|
|
257
|
-
case 'not': return !this.evalLE(x.a, s, e);
|
|
258
|
-
case 'and':
|
|
259
|
-
for (const y of x.as)
|
|
260
|
-
if (!this.evalLE(y, s, e))
|
|
261
|
-
return false;
|
|
262
|
-
return true;
|
|
263
|
-
case 'or':
|
|
264
|
-
for (const y of x.as)
|
|
265
|
-
if (this.evalLE(y, s, e))
|
|
266
|
-
return true;
|
|
267
|
-
return false;
|
|
268
|
-
case 'atom': {
|
|
269
|
-
const c = this.checker;
|
|
270
|
-
if (x.lvl <= 1) {
|
|
271
|
-
let cache = this.stateCache.get('a' + x.id);
|
|
272
|
-
if (!cache) {
|
|
273
|
-
cache = new Uint8Array(this.S);
|
|
274
|
-
this.stateCache.set('a' + x.id, cache);
|
|
275
|
-
}
|
|
276
|
-
if (cache[s] === 0)
|
|
277
|
-
cache[s] = c.evalPred(x, c.states[s], null) ? 2 : 1;
|
|
278
|
-
return cache[s] === 2;
|
|
279
|
-
}
|
|
280
|
-
if (e < 0)
|
|
281
|
-
throw new ConfigError('TLC cannot handle a temporal formula with an action in a state-level position.');
|
|
282
|
-
let cache = this.edgeCache.get('a' + x.id);
|
|
283
|
-
if (!cache) {
|
|
284
|
-
cache = new Uint8Array(this.eTo.length);
|
|
285
|
-
this.edgeCache.set('a' + x.id, cache);
|
|
286
|
-
}
|
|
287
|
-
if (cache[e] === 0)
|
|
288
|
-
cache[e] = c.evalPred(x, c.states[s], this.eState?.[e] ?? c.states[this.eTo[e]]) ? 2 : 1;
|
|
289
|
-
return cache[e] === 2;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
throw new Error('temporal operator in evalLE');
|
|
293
|
-
}
|
|
294
|
-
groups = null;
|
|
295
|
-
// Normalise the temporal formulas; returns the number of tableau branches (0 = nothing to check).
|
|
296
|
-
prepare() {
|
|
297
|
-
const m = this.model;
|
|
298
|
-
const groups = new Map();
|
|
299
|
-
this.groups = groups;
|
|
300
|
-
if (m.liveProps.length === 0)
|
|
301
|
-
return 0;
|
|
302
|
-
const fair = mkJunc('and', m.fairness.map(f => this.toLive(f.e, f.ctx)));
|
|
303
|
-
const props = m.liveProps.map(p => this.toLive(p.e, p.ctx));
|
|
304
|
-
const formula = mkJunc('and', [fair, mkJunc('or', props.map(p => mkNot(p)))]);
|
|
305
|
-
const nf = this.simp(this.pushNeg(formula, false));
|
|
306
|
-
const disjuncts = this.dnf(nf);
|
|
307
|
-
for (const d of disjuncts) {
|
|
308
|
-
const pem = { aeState: [], aeAction: [], ea: [] };
|
|
309
|
-
const tfs = [];
|
|
310
|
-
for (const c of d) {
|
|
311
|
-
if (c.t === 'always' && c.a.t === 'eventually' && c.a.a.lvl <= 2) {
|
|
312
|
-
(c.a.a.lvl <= 1 ? pem.aeState : pem.aeAction).push(c.a.a);
|
|
313
|
-
}
|
|
314
|
-
else if (c.t === 'eventually' && c.a.t === 'always' && c.a.a.lvl <= 2)
|
|
315
|
-
pem.ea.push(c.a.a);
|
|
316
|
-
else {
|
|
317
|
-
if (this.hasAction(c))
|
|
318
|
-
throw new ConfigError('TLC cannot handle the temporal formula: an action appears outside of a []<> or <>[] context.');
|
|
319
|
-
tfs.push(c);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
const tf = mkJunc('and', tfs);
|
|
323
|
-
const k = this.key(tf);
|
|
324
|
-
let g = groups.get(k);
|
|
325
|
-
if (!g) {
|
|
326
|
-
g = { tf, pems: [] };
|
|
327
|
-
groups.set(k, g);
|
|
328
|
-
}
|
|
329
|
-
g.pems.push(pem);
|
|
330
|
-
}
|
|
331
|
-
if (groups.size === 0) {
|
|
332
|
-
foldTemporal = false;
|
|
333
|
-
try {
|
|
334
|
-
const f2 = mkJunc('and', [mkJunc('and', m.fairness.map(f => this.toLive(f.e, f.ctx))), mkJunc('or', m.liveProps.map(p => mkNot(this.toLive(p.e, p.ctx))))]);
|
|
335
|
-
this.tautology = f2.t === 'bool' && f2.v === false;
|
|
336
|
-
}
|
|
337
|
-
finally {
|
|
338
|
-
foldTemporal = true;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return groups.size;
|
|
342
|
-
}
|
|
343
|
-
tautology = false;
|
|
344
|
-
check() {
|
|
345
|
-
if (!this.groups)
|
|
346
|
-
this.prepare();
|
|
347
|
-
const groups = this.groups;
|
|
348
|
-
if (groups.size === 0)
|
|
349
|
-
return null;
|
|
350
|
-
this.buildGraph();
|
|
351
|
-
for (const g of groups.values()) {
|
|
352
|
-
const r = this.checkGroup(g.tf, g.pems);
|
|
353
|
-
if (r)
|
|
354
|
-
return r;
|
|
355
|
-
}
|
|
356
|
-
return null;
|
|
357
|
-
}
|
|
358
|
-
hasAction(x) {
|
|
359
|
-
if (x.t === 'atom')
|
|
360
|
-
return x.lvl === 2;
|
|
361
|
-
if (x.a)
|
|
362
|
-
return this.hasAction(x.a);
|
|
363
|
-
if (x.as)
|
|
364
|
-
return x.as.some(y => this.hasAction(y));
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
// ---- tableau ----
|
|
368
|
-
buildTableau(tf) {
|
|
369
|
-
// intern formulas
|
|
370
|
-
const ids = new Map();
|
|
371
|
-
const forms = [];
|
|
372
|
-
const intern = (x) => {
|
|
373
|
-
const k = this.key(x);
|
|
374
|
-
const have = ids.get(k);
|
|
375
|
-
if (have !== undefined)
|
|
376
|
-
return have;
|
|
377
|
-
const id = forms.length;
|
|
378
|
-
ids.set(k, id);
|
|
379
|
-
const f = { le: x, kind: 'pred', kids: [] };
|
|
380
|
-
forms.push(f);
|
|
381
|
-
if (x.lvl === 3) {
|
|
382
|
-
if (x.t === 'and' || x.t === 'or') {
|
|
383
|
-
f.kind = x.t;
|
|
384
|
-
f.kids = x.as.map(intern);
|
|
385
|
-
}
|
|
386
|
-
else if (x.t === 'always' || x.t === 'eventually') {
|
|
387
|
-
f.kind = x.t;
|
|
388
|
-
f.kids = [intern(x.a)];
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return id;
|
|
392
|
-
};
|
|
393
|
-
const root = intern(tf);
|
|
394
|
-
const promises = [];
|
|
395
|
-
forms.forEach((f, i) => { if (f.kind === 'eventually')
|
|
396
|
-
promises.push({ ev: i, body: f.kids[0] }); });
|
|
397
|
-
const cover = (start) => {
|
|
398
|
-
const out = [];
|
|
399
|
-
const rec = (todo, set, next) => {
|
|
400
|
-
if (todo.length === 0) {
|
|
401
|
-
out.push({ set, next });
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
const f = todo[todo.length - 1];
|
|
405
|
-
const rest = todo.slice(0, -1);
|
|
406
|
-
if (set.has(f)) {
|
|
407
|
-
rec(rest, set, next);
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
const s2 = new Set(set);
|
|
411
|
-
s2.add(f);
|
|
412
|
-
const F = forms[f];
|
|
413
|
-
switch (F.kind) {
|
|
414
|
-
case 'pred':
|
|
415
|
-
rec(rest, s2, next);
|
|
416
|
-
return;
|
|
417
|
-
case 'and':
|
|
418
|
-
rec([...rest, ...F.kids], s2, next);
|
|
419
|
-
return;
|
|
420
|
-
case 'or':
|
|
421
|
-
for (const k of F.kids)
|
|
422
|
-
rec([...rest, k], s2, next);
|
|
423
|
-
return;
|
|
424
|
-
case 'always': {
|
|
425
|
-
const n2 = new Set(next);
|
|
426
|
-
n2.add(f);
|
|
427
|
-
rec([...rest, F.kids[0]], s2, n2);
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
case 'eventually': {
|
|
431
|
-
rec([...rest, F.kids[0]], s2, next);
|
|
432
|
-
const n2 = new Set(next);
|
|
433
|
-
n2.add(f);
|
|
434
|
-
rec(rest, s2, n2);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
rec(start, new Set(), new Set());
|
|
440
|
-
return out;
|
|
441
|
-
};
|
|
442
|
-
const partIds = new Map();
|
|
443
|
-
const parts = [];
|
|
444
|
-
const add = (p) => {
|
|
445
|
-
const k = [...p.set].sort((a, b) => a - b).join(',') + '|' + [...p.next].sort((a, b) => a - b).join(',');
|
|
446
|
-
const have = partIds.get(k);
|
|
447
|
-
if (have !== undefined)
|
|
448
|
-
return have;
|
|
449
|
-
const id = parts.length;
|
|
450
|
-
partIds.set(k, id);
|
|
451
|
-
parts.push({ preds: [...p.set].filter(f => forms[f].kind === 'pred').map(f => forms[f].le), succ: [], set: p.set, next: p.next });
|
|
452
|
-
return id;
|
|
453
|
-
};
|
|
454
|
-
const init = [...new Set(cover([root]).map(add))];
|
|
455
|
-
for (let i = 0; i < parts.length; i++) {
|
|
456
|
-
parts[i].succ = [...new Set(cover([...parts[i].next]).map(add))];
|
|
457
|
-
if (parts.length > 20000)
|
|
458
|
-
throw new ConfigError('The temporal formula is too large to check (tableau blow-up).');
|
|
459
|
-
}
|
|
460
|
-
return { init, parts, promises };
|
|
461
|
-
}
|
|
462
|
-
checkGroup(tf, pems) {
|
|
463
|
-
const c = this.checker;
|
|
464
|
-
const tb = this.buildTableau(tf);
|
|
465
|
-
const P = tb.parts.length;
|
|
466
|
-
const S = this.S;
|
|
467
|
-
// product nodes: reachable (state, particle) pairs
|
|
468
|
-
const nodeId = new Map();
|
|
469
|
-
const nState = [], nPart = [];
|
|
470
|
-
const adj = [], adjEdge = [];
|
|
471
|
-
const consistent = (s, p) => {
|
|
472
|
-
for (const pr of tb.parts[p].preds)
|
|
473
|
-
if (!this.evalLE(pr, s, -1))
|
|
474
|
-
return false;
|
|
475
|
-
return true;
|
|
476
|
-
};
|
|
477
|
-
const consCache = new Int8Array(S * P);
|
|
478
|
-
const cons = (s, p) => {
|
|
479
|
-
const k = s * P + p;
|
|
480
|
-
if (consCache[k] === 0)
|
|
481
|
-
consCache[k] = consistent(s, p) ? 2 : 1;
|
|
482
|
-
return consCache[k] === 2;
|
|
483
|
-
};
|
|
484
|
-
const getNode = (s, p) => {
|
|
485
|
-
const k = s * P + p;
|
|
486
|
-
let id = nodeId.get(k);
|
|
487
|
-
if (id === undefined) {
|
|
488
|
-
id = nState.length;
|
|
489
|
-
nodeId.set(k, id);
|
|
490
|
-
nState.push(s);
|
|
491
|
-
nPart.push(p);
|
|
492
|
-
adj.push([]);
|
|
493
|
-
adjEdge.push([]);
|
|
494
|
-
}
|
|
495
|
-
return id;
|
|
496
|
-
};
|
|
497
|
-
const initNodes = [];
|
|
498
|
-
for (const s of c.inits)
|
|
499
|
-
for (const p of tb.init)
|
|
500
|
-
if (cons(s, p))
|
|
501
|
-
initNodes.push(getNode(s, p));
|
|
502
|
-
for (let n = 0; n < nState.length; n++) {
|
|
503
|
-
const s = nState[n], p = nPart[n];
|
|
504
|
-
for (let e = this.eStart[s]; e < this.eStart[s + 1]; e++) {
|
|
505
|
-
const t = this.eTo[e];
|
|
506
|
-
for (const q of tb.parts[p].succ) {
|
|
507
|
-
if (!cons(t, q))
|
|
508
|
-
continue;
|
|
509
|
-
adj[n].push(getNode(t, q));
|
|
510
|
-
adjEdge[n].push(e);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
const N = nState.length;
|
|
515
|
-
// group PEMs by their EA constraints
|
|
516
|
-
const byEA = new Map();
|
|
517
|
-
for (const pem of pems) {
|
|
518
|
-
const k = pem.ea.map(x => this.key(x)).sort().join(';');
|
|
519
|
-
let g = byEA.get(k);
|
|
520
|
-
if (!g) {
|
|
521
|
-
g = { ea: pem.ea, pems: [] };
|
|
522
|
-
byEA.set(k, g);
|
|
523
|
-
}
|
|
524
|
-
g.pems.push(pem);
|
|
525
|
-
}
|
|
526
|
-
for (const g of byEA.values()) {
|
|
527
|
-
const edgeOk = (n, j) => {
|
|
528
|
-
for (const x of g.ea)
|
|
529
|
-
if (!this.evalLE(x, nState[n], adjEdge[n][j]))
|
|
530
|
-
return false;
|
|
531
|
-
return true;
|
|
532
|
-
};
|
|
533
|
-
// iterative Tarjan
|
|
534
|
-
const index = new Int32Array(N).fill(-1), low = new Int32Array(N), onStack = new Uint8Array(N);
|
|
535
|
-
const comp = new Int32Array(N).fill(-1);
|
|
536
|
-
const stack = [];
|
|
537
|
-
let idx = 0, ncomp = 0;
|
|
538
|
-
const callN = [], callJ = [];
|
|
539
|
-
for (let root = 0; root < N; root++) {
|
|
540
|
-
if (index[root] !== -1)
|
|
541
|
-
continue;
|
|
542
|
-
callN.push(root);
|
|
543
|
-
callJ.push(0);
|
|
544
|
-
index[root] = low[root] = idx++;
|
|
545
|
-
stack.push(root);
|
|
546
|
-
onStack[root] = 1;
|
|
547
|
-
while (callN.length) {
|
|
548
|
-
const n = callN[callN.length - 1];
|
|
549
|
-
let j = callJ[callJ.length - 1];
|
|
550
|
-
let pushed = false;
|
|
551
|
-
const a = adj[n];
|
|
552
|
-
while (j < a.length) {
|
|
553
|
-
const w = a[j];
|
|
554
|
-
if (!edgeOk(n, j)) {
|
|
555
|
-
j++;
|
|
556
|
-
continue;
|
|
557
|
-
}
|
|
558
|
-
if (index[w] === -1) {
|
|
559
|
-
callJ[callJ.length - 1] = j + 1;
|
|
560
|
-
index[w] = low[w] = idx++;
|
|
561
|
-
stack.push(w);
|
|
562
|
-
onStack[w] = 1;
|
|
563
|
-
callN.push(w);
|
|
564
|
-
callJ.push(0);
|
|
565
|
-
pushed = true;
|
|
566
|
-
break;
|
|
567
|
-
}
|
|
568
|
-
if (onStack[w] && index[w] < low[n])
|
|
569
|
-
low[n] = index[w];
|
|
570
|
-
j++;
|
|
571
|
-
}
|
|
572
|
-
if (pushed)
|
|
573
|
-
continue;
|
|
574
|
-
callN.pop();
|
|
575
|
-
callJ.pop();
|
|
576
|
-
if (callN.length) {
|
|
577
|
-
const par = callN[callN.length - 1];
|
|
578
|
-
if (low[n] < low[par])
|
|
579
|
-
low[par] = low[n];
|
|
580
|
-
}
|
|
581
|
-
if (low[n] === index[n]) {
|
|
582
|
-
const members = [];
|
|
583
|
-
for (;;) {
|
|
584
|
-
const w = stack.pop();
|
|
585
|
-
onStack[w] = 0;
|
|
586
|
-
comp[w] = ncomp;
|
|
587
|
-
members.push(w);
|
|
588
|
-
if (w === n)
|
|
589
|
-
break;
|
|
590
|
-
}
|
|
591
|
-
const r = this.checkComponent(members, comp, ncomp, g.pems, edgeOk, tb, nState, nPart, adj, adjEdge, initNodes);
|
|
592
|
-
ncomp++;
|
|
593
|
-
if (r)
|
|
594
|
-
return r;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
return null;
|
|
600
|
-
}
|
|
601
|
-
checkComponent(members, comp, cid, pems, edgeOk, tb, nState, nPart, adj, adjEdge, initNodes) {
|
|
602
|
-
// must contain at least one internal edge
|
|
603
|
-
let hasEdge = false;
|
|
604
|
-
for (const n of members) {
|
|
605
|
-
for (let j = 0; j < adj[n].length && !hasEdge; j++)
|
|
606
|
-
if (comp[adj[n][j]] === cid && edgeOk(n, j))
|
|
607
|
-
hasEdge = true;
|
|
608
|
-
if (hasEdge)
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
if (!hasEdge)
|
|
612
|
-
return null;
|
|
613
|
-
// promises
|
|
614
|
-
const promiseNodes = [];
|
|
615
|
-
for (const pr of tb.promises) {
|
|
616
|
-
let found = -1;
|
|
617
|
-
for (const n of members) {
|
|
618
|
-
const set = tb.parts[nPart[n]].set;
|
|
619
|
-
if (!set.has(pr.ev) || set.has(pr.body)) {
|
|
620
|
-
found = n;
|
|
621
|
-
break;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
if (found < 0)
|
|
625
|
-
return null;
|
|
626
|
-
promiseNodes.push(found);
|
|
627
|
-
}
|
|
628
|
-
for (const pem of pems) {
|
|
629
|
-
const targets = promiseNodes.map(n => ({ node: n, edge: -1 }));
|
|
630
|
-
let ok = true;
|
|
631
|
-
for (const x of pem.aeState) {
|
|
632
|
-
let found = -1;
|
|
633
|
-
for (const n of members)
|
|
634
|
-
if (this.evalLE(x, nState[n], -1)) {
|
|
635
|
-
found = n;
|
|
636
|
-
break;
|
|
637
|
-
}
|
|
638
|
-
if (found < 0) {
|
|
639
|
-
ok = false;
|
|
640
|
-
break;
|
|
641
|
-
}
|
|
642
|
-
targets.push({ node: found, edge: -1 });
|
|
643
|
-
}
|
|
644
|
-
if (!ok)
|
|
645
|
-
continue;
|
|
646
|
-
for (const x of pem.aeAction) {
|
|
647
|
-
let fn = -1, fj = -1;
|
|
648
|
-
outer: for (const n of members) {
|
|
649
|
-
for (let j = 0; j < adj[n].length; j++) {
|
|
650
|
-
if (comp[adj[n][j]] === cid && edgeOk(n, j) && this.evalLE(x, nState[n], adjEdge[n][j])) {
|
|
651
|
-
fn = n;
|
|
652
|
-
fj = j;
|
|
653
|
-
break outer;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
if (fn < 0) {
|
|
658
|
-
ok = false;
|
|
659
|
-
break;
|
|
660
|
-
}
|
|
661
|
-
targets.push({ node: fn, edge: fj });
|
|
662
|
-
}
|
|
663
|
-
if (!ok)
|
|
664
|
-
continue;
|
|
665
|
-
return this.counterexample(members, comp, cid, targets, edgeOk, nState, adj, adjEdge, initNodes);
|
|
666
|
-
}
|
|
667
|
-
return null;
|
|
668
|
-
}
|
|
669
|
-
counterexample(members, comp, cid, targets, edgeOk, nState, adj, adjEdge, initNodes) {
|
|
670
|
-
const c = this.checker;
|
|
671
|
-
const N = nState.length;
|
|
672
|
-
// BFS helper: shortest path from `from` to a node satisfying `goal`; `inside` restricts to the component.
|
|
673
|
-
const bfs = (from, goal, inside, minLen) => {
|
|
674
|
-
const prev = new Int32Array(N).fill(-2), prevE = new Int32Array(N).fill(-1);
|
|
675
|
-
const q = [];
|
|
676
|
-
if (minLen === 0) {
|
|
677
|
-
for (const f of from) {
|
|
678
|
-
if (prev[f] === -2) {
|
|
679
|
-
prev[f] = -1;
|
|
680
|
-
q.push(f);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
// paths of length >= 1: seed with successors
|
|
686
|
-
for (const f of from) {
|
|
687
|
-
for (let j = 0; j < adj[f].length; j++) {
|
|
688
|
-
const w = adj[f][j];
|
|
689
|
-
if (inside && (comp[w] !== cid || !edgeOk(f, j)))
|
|
690
|
-
continue;
|
|
691
|
-
if (prev[w] === -2) {
|
|
692
|
-
prev[w] = -3 - f;
|
|
693
|
-
prevE[w] = adjEdge[f][j];
|
|
694
|
-
q.push(w);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
for (let h = 0; h < q.length; h++) {
|
|
700
|
-
const n = q[h];
|
|
701
|
-
if (goal(n)) {
|
|
702
|
-
const nodes = [], edges = [];
|
|
703
|
-
let x = n;
|
|
704
|
-
for (;;) {
|
|
705
|
-
nodes.push(x);
|
|
706
|
-
const p = prev[x];
|
|
707
|
-
if (p === -1)
|
|
708
|
-
break;
|
|
709
|
-
edges.push(prevE[x]);
|
|
710
|
-
if (p <= -3) {
|
|
711
|
-
nodes.push(-3 - p);
|
|
712
|
-
break;
|
|
713
|
-
}
|
|
714
|
-
x = p;
|
|
715
|
-
}
|
|
716
|
-
return { nodes: nodes.reverse(), edges: edges.reverse() };
|
|
717
|
-
}
|
|
718
|
-
for (let j = 0; j < adj[n].length; j++) {
|
|
719
|
-
const w = adj[n][j];
|
|
720
|
-
if (inside && (comp[w] !== cid || !edgeOk(n, j)))
|
|
721
|
-
continue;
|
|
722
|
-
if (prev[w] === -2) {
|
|
723
|
-
prev[w] = n;
|
|
724
|
-
prevE[w] = adjEdge[n][j];
|
|
725
|
-
q.push(w);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
return null;
|
|
730
|
-
};
|
|
731
|
-
const inComp = (n) => comp[n] === cid;
|
|
732
|
-
const prefix = bfs(initNodes, inComp, false, 0);
|
|
733
|
-
const entry = prefix.nodes[prefix.nodes.length - 1];
|
|
734
|
-
// cycle through all targets and back to entry
|
|
735
|
-
const cycNodes = [entry], cycEdges = [];
|
|
736
|
-
let cur = entry;
|
|
737
|
-
for (const t of targets) {
|
|
738
|
-
if (cur !== t.node) {
|
|
739
|
-
const p = bfs([cur], n => n === t.node, true, 0);
|
|
740
|
-
cycNodes.push(...p.nodes.slice(1));
|
|
741
|
-
cycEdges.push(...p.edges);
|
|
742
|
-
cur = t.node;
|
|
743
|
-
}
|
|
744
|
-
if (t.edge >= 0) {
|
|
745
|
-
cycNodes.push(adj[cur][t.edge]);
|
|
746
|
-
cycEdges.push(adjEdge[cur][t.edge]);
|
|
747
|
-
cur = adj[cur][t.edge];
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
if (cur !== entry || cycEdges.length === 0) {
|
|
751
|
-
const p = bfs([cur], n => n === entry, true, cur === entry ? 1 : 0);
|
|
752
|
-
cycNodes.push(...p.nodes.slice(1));
|
|
753
|
-
cycEdges.push(...p.edges);
|
|
754
|
-
}
|
|
755
|
-
// project onto states
|
|
756
|
-
const steps = [];
|
|
757
|
-
const actOf = (e) => (this.eAct[e] >= 0 ? this.model.actions[this.eAct[e]] : null);
|
|
758
|
-
let last = -1;
|
|
759
|
-
prefix.nodes.forEach((n, i) => {
|
|
760
|
-
const s = nState[n];
|
|
761
|
-
if (s === last)
|
|
762
|
-
return;
|
|
763
|
-
steps.push({ state: c.states[s], action: i === 0 ? null : actOf(prefix.edges[i - 1]), id: s });
|
|
764
|
-
last = s;
|
|
765
|
-
});
|
|
766
|
-
const loopStart = steps.length - 1;
|
|
767
|
-
let loopAction = null;
|
|
768
|
-
for (let i = 1; i < cycNodes.length; i++) {
|
|
769
|
-
const s = nState[cycNodes[i]];
|
|
770
|
-
if (s === last)
|
|
771
|
-
continue;
|
|
772
|
-
if (i === cycNodes.length - 1) {
|
|
773
|
-
loopAction = actOf(cycEdges[i - 1]);
|
|
774
|
-
break;
|
|
775
|
-
} // returns to the entry state
|
|
776
|
-
steps.push({ state: c.states[s], action: actOf(cycEdges[i - 1]), id: s });
|
|
777
|
-
last = s;
|
|
778
|
-
}
|
|
779
|
-
if (loopAction === null && steps.length - 1 > loopStart && steps[steps.length - 1].id === steps[loopStart].id) {
|
|
780
|
-
loopAction = steps.pop().action;
|
|
781
|
-
}
|
|
782
|
-
const stutter = steps.length - 1 === loopStart && loopAction === null;
|
|
783
|
-
const names = this.model.liveProps.map(p => p.name);
|
|
784
|
-
return c.result('liveness', { name: names.length === 1 ? names[0] : undefined, trace: steps, loopTo: stutter ? -1 : loopStart, loopAction });
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
// Run safety checking, then (if there are temporal properties) liveness checking.
|
|
788
|
-
export function modelCheck(model, opts) {
|
|
789
|
-
const needLive = model.liveProps.length > 0;
|
|
790
|
-
const checker = new Checker(model, { ...opts, recordGraph: opts.recordGraph || needLive });
|
|
791
|
-
if (needLive && (model.view || model.symmetry))
|
|
792
|
-
checker.succState = [];
|
|
793
|
-
opts.onChecker?.(checker);
|
|
794
|
-
const live = new Liveness(model, checker);
|
|
795
|
-
let branches = 0;
|
|
796
|
-
if (needLive) {
|
|
797
|
-
try {
|
|
798
|
-
branches = live.prepare();
|
|
799
|
-
}
|
|
800
|
-
catch (e) {
|
|
801
|
-
if (!(e instanceof TlaError))
|
|
802
|
-
throw e;
|
|
803
|
-
return { result: checker.result('error', { message: e.message, printSummary: false }), checker };
|
|
804
|
-
}
|
|
805
|
-
if (branches === 0 && live.tautology) {
|
|
806
|
-
return { result: checker.result('error', { code: 2253, message: 'Temporal formula is a tautology (its negation is unsatisfiable).', printSummary: false }), checker };
|
|
807
|
-
}
|
|
808
|
-
opts.onLiveness?.('branches', branches);
|
|
809
|
-
}
|
|
810
|
-
let result = checker.run();
|
|
811
|
-
if (result.status === 'ok' && branches > 0) {
|
|
812
|
-
opts.onLiveness?.('start', branches);
|
|
813
|
-
try {
|
|
814
|
-
const r = live.check();
|
|
815
|
-
if (r)
|
|
816
|
-
result = r;
|
|
817
|
-
}
|
|
818
|
-
catch (e) {
|
|
819
|
-
if (!(e instanceof TlaError))
|
|
820
|
-
throw e;
|
|
821
|
-
result = checker.result('error', { message: checker.describeErr(e) });
|
|
822
|
-
}
|
|
823
|
-
if (result.status === 'ok')
|
|
824
|
-
opts.onLiveness?.('end', branches);
|
|
825
|
-
}
|
|
826
|
-
if (result.status === 'ok') {
|
|
827
|
-
const ev = model.ev;
|
|
828
|
-
for (const pc of model.postconditions) {
|
|
829
|
-
const at = `${pc.name} at ${locStr(pc.loc, pc.module)}`;
|
|
830
|
-
let ok;
|
|
831
|
-
try {
|
|
832
|
-
ev.cur = [];
|
|
833
|
-
ev.nxt = null;
|
|
834
|
-
ev.initMode = false;
|
|
835
|
-
ev.primeDepth = 0;
|
|
836
|
-
ev.callDepth = 0;
|
|
837
|
-
ok = ev.eval(pc.e, pc.ctx);
|
|
838
|
-
}
|
|
839
|
-
catch (e) {
|
|
840
|
-
if (!(e instanceof TlaError))
|
|
841
|
-
throw e;
|
|
842
|
-
result = checker.result('error', { code: 2405, message: `Evaluating postcondition ${at} failed.\n${e.message}` });
|
|
843
|
-
break;
|
|
844
|
-
}
|
|
845
|
-
if (ok !== true) {
|
|
846
|
-
result = checker.result('error', pc.possible
|
|
847
|
-
? { code: 2780, message: `The _POSSIBLE predicate ${at} was never witnessed.\nOthers may be unwitnessed too; only witnessed predicates appear with a\nnon-zero count in the record printed above.\nSee https://explain.tlapl.us/possible-conditions for additional details.` }
|
|
848
|
-
: { code: 2404, message: `Postcondition ${at} is false.` });
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
result.liveBranches = branches;
|
|
854
|
-
return { result, checker };
|
|
855
|
-
}
|