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.
@@ -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;
@@ -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(m);
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
  }
@@ -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 {};