tla-ts 0.0.4-dev.66582d4 → 0.0.4
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/run-cli.cjs +1 -1
- package/dist/run-cli.js +1 -1
- package/dist/transfer.cjs +7 -7
- package/dist/transfer.js +7 -7
- package/package.json +1 -1
- package/src/live-check.ts +4 -43
package/package.json
CHANGED
package/src/live-check.ts
CHANGED
|
@@ -83,7 +83,6 @@ interface Check {
|
|
|
83
83
|
firstNodes: Pool<Int32Array>;
|
|
84
84
|
lastNodes: Pool<Int32Array>;
|
|
85
85
|
nextSiblings: number[];
|
|
86
|
-
nodeIds: NodeTable;
|
|
87
86
|
isDone: boolean[];
|
|
88
87
|
errorNode: number | undefined;
|
|
89
88
|
}
|
|
@@ -141,26 +140,6 @@ const writeToPool = <Data extends Int32Array | Uint8Array>(
|
|
|
141
140
|
|
|
142
141
|
const NO_NODE = -1;
|
|
143
142
|
|
|
144
|
-
// A Map holds at most 2^24 entries, so each tableau node of a state finds its node in an
|
|
145
|
-
// open-addressing table of (state plus one, tableau node, node) triples.
|
|
146
|
-
interface NodeTable {
|
|
147
|
-
slots: Int32Array;
|
|
148
|
-
size: number;
|
|
149
|
-
shift: number;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const getNodeSlot = (table: NodeTable, state: number, tableauNode: number) => {
|
|
153
|
-
const mask = table.slots.length / 3 - 1;
|
|
154
|
-
const hash = Math.imul(Math.imul(state, 0x9e3779b1) ^ tableauNode, 0x85ebca6b) >>> table.shift;
|
|
155
|
-
for (let index = hash; ; index = (index + 1) & mask) {
|
|
156
|
-
const slot = index * 3;
|
|
157
|
-
const stored = table.slots[slot];
|
|
158
|
-
if (stored === 0 || (stored === state + 1 && table.slots[slot + 1] === tableauNode)) {
|
|
159
|
-
return slot;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
143
|
const createNodes = (length: number) => new Int32Array(length).fill(NO_NODE);
|
|
165
144
|
|
|
166
145
|
const UNWRITTEN = -1;
|
|
@@ -248,7 +227,6 @@ export const createLivenessChecker = (
|
|
|
248
227
|
firstNodes: createPool(createNodes),
|
|
249
228
|
lastNodes: createPool(createNodes),
|
|
250
229
|
nextSiblings: [],
|
|
251
|
-
nodeIds: { slots: new Int32Array(3 << 10), size: 0, shift: 22 },
|
|
252
230
|
isDone: [],
|
|
253
231
|
errorNode: undefined,
|
|
254
232
|
}));
|
|
@@ -344,29 +322,12 @@ export const createLivenessChecker = (
|
|
|
344
322
|
model.infinitelyOftenActions.length === 0,
|
|
345
323
|
);
|
|
346
324
|
|
|
347
|
-
const getNodeId = (check: Check, state: number, tableauNode: number) =>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
return slots[slot] === 0 ? undefined : slots[slot + 2];
|
|
352
|
-
};
|
|
325
|
+
const getNodeId = (check: Check, state: number, tableauNode: number) =>
|
|
326
|
+
check.solution.tableau
|
|
327
|
+
? getStateNodes(check, state).find((node) => check.nodeTableaux[node] === tableauNode)
|
|
328
|
+
: state;
|
|
353
329
|
const recordNode = (check: Check, state: number, tableauNode: number) => {
|
|
354
330
|
const node = pushNode(check, state, tableauNode);
|
|
355
|
-
const table = check.nodeIds;
|
|
356
|
-
if (++table.size * 2 > table.slots.length / 3) {
|
|
357
|
-
const old = table.slots;
|
|
358
|
-
table.slots = new Int32Array(old.length * 2);
|
|
359
|
-
table.shift--;
|
|
360
|
-
for (let slot = 0; slot < old.length; slot += 3) {
|
|
361
|
-
if (old[slot] !== 0) {
|
|
362
|
-
table.slots.set(
|
|
363
|
-
old.subarray(slot, slot + 3),
|
|
364
|
-
getNodeSlot(table, old[slot] - 1, old[slot + 1]),
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
table.slots.set([state + 1, tableauNode, node], getNodeSlot(table, state, tableauNode));
|
|
370
331
|
const last = check.lastNodes.data[state] ?? NO_NODE;
|
|
371
332
|
if (last === NO_NODE) writeToPool(check.firstNodes, state, [node]);
|
|
372
333
|
else check.nextSiblings[last] = node;
|