gdp-wired 0.28.0 → 0.30.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/core/cycles.js +30 -3
- package/dist/core/data.d.ts +4 -0
- package/dist/core/data.js +188 -24
- package/dist/core/dsl.d.ts +11 -1
- package/dist/core/dsl.js +106 -11
- package/dist/core/extract-read.d.ts +1 -1
- package/dist/core/extract-read.js +4 -3
- package/dist/core/extract-shapes.js +9 -4
- package/dist/core/extract-xstate.js +89 -10
- package/dist/core/fresh.js +16 -1
- package/dist/core/infer.js +819 -188
- package/dist/core/machine.d.ts +5 -0
- package/dist/core/machine.js +3 -3
- package/dist/kernel/cdcl.d.ts +34 -11
- package/dist/kernel/cdcl.js +601 -60
- package/dist/kernel/kernel.d.ts +17 -1
- package/dist/kernel/kernel.js +187 -11
- package/dist/kernel/prove.d.ts +5 -1
- package/dist/kernel/prove.js +200 -63
- package/dist/kernel/reader.d.ts +35 -1
- package/dist/kernel/reader.js +342 -7
- package/dist/kernel/simplex.d.ts +3 -0
- package/dist/kernel/simplex.js +52 -6
- package/dist/lean-kernel/emit.d.ts +12 -0
- package/dist/lean-kernel/emit.js +108 -14
- package/dist/lean-kernel/library.js +2 -1
- package/package.json +3 -2
package/dist/core/machine.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export type Machine = {
|
|
|
69
69
|
pre?: C;
|
|
70
70
|
assume?: C;
|
|
71
71
|
history?: History;
|
|
72
|
+
sums?: Record<string, Sum>;
|
|
72
73
|
fns?: Record<string, Fn>;
|
|
73
74
|
facts?: Law[];
|
|
74
75
|
};
|
|
@@ -120,6 +121,10 @@ export type History = {
|
|
|
120
121
|
after: E;
|
|
121
122
|
};
|
|
122
123
|
};
|
|
124
|
+
export type Sum = {
|
|
125
|
+
key: string;
|
|
126
|
+
term: E;
|
|
127
|
+
};
|
|
123
128
|
export type MapUpdate = {
|
|
124
129
|
key: E;
|
|
125
130
|
value: E;
|
package/dist/core/machine.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Arithmetic is linear: +, −, × by a constant, min, max, if. Maps are naturals indexed by naturals, every cell starting
|
|
6
6
|
// at the same value; a law about a map holds for every key x, and is proven at one arbitrary x (with the law assumed at
|
|
7
7
|
// every other key the step reads).
|
|
8
|
-
import { boundOf, crossFree, historyMachine, keyTerm, plainKey, scope } from "../kernel/kernel.js";
|
|
8
|
+
import { boundOf, crossFree, historyMachine, keyTerm, plainKey, scope, sumRuntime } from "../kernel/kernel.js";
|
|
9
9
|
import { add, env, eq, k, le, lt, nat, scale, show, solve, sub, v } from "./solver.js";
|
|
10
10
|
export const seeded = (seed) => { let x = seed; return k => { x = (x * 1103515245 + 12345) % 2 ** 31; return Math.floor(x / 2 ** 31 * k); }; };
|
|
11
11
|
// Every object in a term, the term first.
|
|
@@ -321,9 +321,9 @@ function writeEvery(w, env, st, m) {
|
|
|
321
321
|
// The machine a runtime steps (with a history, kernel.ts's plain machine), its queries, and the inputs a request carries.
|
|
322
322
|
function runnable(m) {
|
|
323
323
|
const h = m.history;
|
|
324
|
+
const plain = h ? historyMachine(m).machine : sumRuntime(m);
|
|
324
325
|
if (!h)
|
|
325
|
-
scope(
|
|
326
|
-
const plain = h ? historyMachine(m).machine : m;
|
|
326
|
+
scope(plain);
|
|
327
327
|
const queries = h ? Object.keys(h.queries) : [];
|
|
328
328
|
return { h, plain, queries, carried: m.inputs.filter(i => !queries.includes(i)) };
|
|
329
329
|
}
|
package/dist/kernel/cdcl.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import { type Lin } from '../core/solver.js';
|
|
1
|
+
import { type Lin, type Step } from '../core/solver.js';
|
|
2
2
|
import { type Goal, type Path } from './kernel.js';
|
|
3
3
|
import { type Outcome } from './prove.js';
|
|
4
|
+
type DagNode = {
|
|
5
|
+
inputs: Lin[];
|
|
6
|
+
steps: Step[];
|
|
7
|
+
src?: number[];
|
|
8
|
+
lits?: [Lin, boolean][];
|
|
9
|
+
} | {
|
|
10
|
+
res: [number, number];
|
|
11
|
+
on: Lin;
|
|
12
|
+
} | {
|
|
13
|
+
hyp: number;
|
|
14
|
+
lits: [Lin, boolean][];
|
|
15
|
+
};
|
|
16
|
+
export type Dag = {
|
|
17
|
+
nodes: DagNode[];
|
|
18
|
+
top: number;
|
|
19
|
+
clausal?: boolean;
|
|
20
|
+
};
|
|
4
21
|
export declare const cdclStats: {
|
|
5
22
|
on: boolean;
|
|
6
23
|
runs: number;
|
|
@@ -36,23 +53,29 @@ export declare const cdclStats: {
|
|
|
36
53
|
export declare const REFUTED = "refuted, not unfolded";
|
|
37
54
|
export type Refuted = Outcome & {
|
|
38
55
|
core?: number[];
|
|
56
|
+
dag?: Dag;
|
|
57
|
+
assumed?: number[];
|
|
58
|
+
};
|
|
59
|
+
export type CdclOptions = {
|
|
60
|
+
maxLeaves?: number;
|
|
61
|
+
model?: boolean;
|
|
62
|
+
core?: boolean;
|
|
63
|
+
dag?: boolean;
|
|
64
|
+
clausal?: boolean;
|
|
65
|
+
sideOf?: (hyp: number) => number;
|
|
66
|
+
quiet?: (name: string) => boolean;
|
|
39
67
|
};
|
|
40
68
|
export declare function growCdcl(goal: Goal, root: Path, budget: {
|
|
41
69
|
nodes: number;
|
|
42
70
|
until?: number;
|
|
43
|
-
}, opts?: {
|
|
44
|
-
maxLeaves?: number;
|
|
45
|
-
model?: boolean;
|
|
71
|
+
}, opts?: CdclOptions & {
|
|
46
72
|
wall?: number;
|
|
47
|
-
core?: boolean;
|
|
48
73
|
}): Outcome;
|
|
49
|
-
export declare function cdclSession(goal: Goal, root: Path, opts?: {
|
|
50
|
-
maxLeaves?: number;
|
|
51
|
-
model?: boolean;
|
|
52
|
-
core?: boolean;
|
|
53
|
-
}): {
|
|
74
|
+
export declare function cdclSession(goal: Goal, root: Path, opts?: CdclOptions): {
|
|
54
75
|
run: (b: {
|
|
55
76
|
nodes: number;
|
|
56
77
|
until?: number;
|
|
57
|
-
}, w?: number, assume?: Lin) => Outcome;
|
|
78
|
+
}, w?: number, assume?: Lin | Lin[]) => Outcome;
|
|
79
|
+
retire: (hyp: number) => void;
|
|
58
80
|
};
|
|
81
|
+
export {};
|