gdp-wired 0.41.1 → 0.42.0
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/kernel/cdcl.js +31 -14
- package/package.json +1 -1
package/dist/kernel/cdcl.js
CHANGED
|
@@ -84,7 +84,8 @@ export function cdclSession(goal, root, opts = {}) {
|
|
|
84
84
|
let until = Infinity, budget = { nodes: 0 }, wall, assumed = [], listed = false;
|
|
85
85
|
// (the first assumption not known to hold: those before it held when last looked at, and an assumption taken back
|
|
86
86
|
// brings it down to its own; each assumption's index by name)
|
|
87
|
-
|
|
87
|
+
// (and on each assumption's variable, `aq`, its index this run: the undo's lookup by variable, not by name)
|
|
88
|
+
let aq = 0, aqOf = new Map(), aqVars = [];
|
|
88
89
|
const st = cdclStats, timing = st.on;
|
|
89
90
|
const t = (f, add) => { if (!timing)
|
|
90
91
|
return f(); const t0 = performance.now(); try {
|
|
@@ -340,7 +341,7 @@ export function cdclSession(goal, root, opts = {}) {
|
|
|
340
341
|
const undoKernel = (l) => {
|
|
341
342
|
const keep = levels[l] ?? trail.length;
|
|
342
343
|
while (trail.length > Math.max(keep, fixed)) {
|
|
343
|
-
const name = trail.pop(), x = tv.pop(), q =
|
|
344
|
+
const name = trail.pop(), x = tv.pop(), q = x.aq;
|
|
344
345
|
x.val = undefined;
|
|
345
346
|
x.level = -1;
|
|
346
347
|
x.reason = undefined;
|
|
@@ -358,7 +359,8 @@ export function cdclSession(goal, root, opts = {}) {
|
|
|
358
359
|
const undoClausal = (l) => {
|
|
359
360
|
const keep = levels[l] ?? trail.length, undone = [];
|
|
360
361
|
while (trail.length > keep) {
|
|
361
|
-
|
|
362
|
+
trail.pop();
|
|
363
|
+
const x = tv.pop(), q = x.aq;
|
|
362
364
|
vals[x.id] = 0;
|
|
363
365
|
undone.push(x);
|
|
364
366
|
x.val = undefined;
|
|
@@ -796,7 +798,9 @@ export function cdclSession(goal, root, opts = {}) {
|
|
|
796
798
|
};
|
|
797
799
|
let restartAt = 32, nRestart = 0, sinceRestart = 0, free = 0;
|
|
798
800
|
const batch = Number(env.GDP_CDCL_BATCH ?? 16);
|
|
799
|
-
|
|
801
|
+
// (the clausal mode's path left empty: its callers, core/interp.ts's sessions, read a model's witness and never the
|
|
802
|
+
// path, which over a session's gates is a map of thousands, made at every model)
|
|
803
|
+
const stuck = (kind, why, extra = {}) => ({ stuck: kind, path: clausal ? new Map() : pathOf(), why, ...extra });
|
|
800
804
|
const run = (b, w, assume) => {
|
|
801
805
|
budget = b;
|
|
802
806
|
until = b.until ?? Infinity;
|
|
@@ -823,6 +827,9 @@ export function cdclSession(goal, root, opts = {}) {
|
|
|
823
827
|
}
|
|
824
828
|
aq = 0;
|
|
825
829
|
aqOf = new Map(assumed.map(([name], q) => [name, q]));
|
|
830
|
+
for (const y of aqVars)
|
|
831
|
+
y.aq = undefined;
|
|
832
|
+
aqVars = assumed.map(([name], q) => { const y = vars.get(name); y.aq = q; return y; });
|
|
826
833
|
undoTo(keep);
|
|
827
834
|
qhead = Math.min(qhead, trail.length);
|
|
828
835
|
take();
|
|
@@ -834,24 +841,34 @@ export function cdclSession(goal, root, opts = {}) {
|
|
|
834
841
|
};
|
|
835
842
|
// The assumptions a falsified one rests on: the decisions its reasons reach, each reason materialized where it is a
|
|
836
843
|
// bound's (every decision on the trail is an assumption here: the search decides nothing else until they all hold).
|
|
844
|
+
// (the walk by variables, each seen once a call (`fs`, a stamp); a clause of the clausal mode read by its codes)
|
|
845
|
+
let finalN = 0;
|
|
837
846
|
const final = (q0) => {
|
|
838
|
-
const
|
|
847
|
+
const out = new Set([q0]), todo = [vars.get(assumed[q0][0])], stamp = ++finalN;
|
|
839
848
|
while (todo.length) {
|
|
840
|
-
const
|
|
841
|
-
if (
|
|
849
|
+
const x = todo.pop();
|
|
850
|
+
if (x.fs === stamp || x.level <= 0)
|
|
842
851
|
continue;
|
|
843
|
-
|
|
852
|
+
x.fs = stamp;
|
|
844
853
|
if (x.reason === undefined) {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
out.add(q);
|
|
854
|
+
if (x.aq !== undefined)
|
|
855
|
+
out.add(x.aq);
|
|
848
856
|
continue;
|
|
849
857
|
}
|
|
850
858
|
if (clauses[x.reason].node < 0)
|
|
851
859
|
materialize(x.reason);
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
860
|
+
const c = clausal ? cls[x.reason] : undefined;
|
|
861
|
+
if (c) {
|
|
862
|
+
for (let j = 0; j < c.length; j++) {
|
|
863
|
+
const y = byId[c[j] >> 1];
|
|
864
|
+
if (y !== x)
|
|
865
|
+
todo.push(y);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
else
|
|
869
|
+
for (const w of clauses[x.reason].lits.keys())
|
|
870
|
+
if (w !== x.name)
|
|
871
|
+
todo.push(vars.get(w));
|
|
855
872
|
}
|
|
856
873
|
return [...out].sort((a, b) => a - b);
|
|
857
874
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdp-wired",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "An automatic prover for stateful rules (budgets, caps, windows, workflows, policies): laws proven with no proof to write, checked again in Lean, counterexamples found on the GPU, the rule shipped as code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"verification",
|