gdp-wired 0.23.0 → 0.24.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/README.md +12 -2
- package/dist/core/bmc.d.ts +13 -2
- package/dist/core/bmc.js +390 -18
- package/dist/core/cycles.d.ts +23 -0
- package/dist/core/cycles.js +104 -54
- package/dist/core/data.d.ts +9 -0
- package/dist/core/data.js +352 -121
- package/dist/core/discover.js +8 -3
- package/dist/core/dsl.d.ts +7 -2
- package/dist/core/dsl.js +47 -9
- package/dist/core/extract-check.d.ts +77 -0
- package/dist/core/extract-check.js +785 -0
- package/dist/core/extract-ir.d.ts +139 -0
- package/dist/core/extract-ir.js +198 -0
- package/dist/core/extract-print.d.ts +30 -0
- package/dist/core/extract-print.js +426 -0
- package/dist/core/extract-read.d.ts +298 -0
- package/dist/core/extract-read.js +1298 -0
- package/dist/core/extract-shapes.d.ts +13 -0
- package/dist/core/extract-shapes.js +993 -0
- package/dist/core/extract-xstate.d.ts +34 -0
- package/dist/core/extract-xstate.js +320 -0
- package/dist/core/extract.d.ts +31 -0
- package/dist/core/extract.js +249 -0
- package/dist/core/kind.d.ts +30 -0
- package/dist/core/kind.js +81 -0
- package/dist/core/relation.js +7 -4
- package/dist/core/xstate.d.ts +6 -0
- package/dist/core/xstate.js +70 -12
- package/dist/kernel/cdcl.d.ts +10 -0
- package/dist/kernel/cdcl.js +291 -241
- package/dist/kernel/kernel.d.ts +15 -0
- package/dist/kernel/kernel.js +32 -0
- package/dist/kernel/prove.js +14 -3
- package/dist/kernel/reader.d.ts +14 -0
- package/dist/kernel/reader.js +102 -14
- package/dist/lean-kernel/emit.d.ts +28 -1
- package/dist/lean-kernel/emit.js +56 -15
- package/dist/lean-kernel/library.js +2 -1
- package/package.json +12 -3
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { B, K, L, N } from './extract-ir.js';
|
|
3
|
+
export declare class Refusal extends Error {
|
|
4
|
+
readonly where: string;
|
|
5
|
+
readonly what: string;
|
|
6
|
+
constructor(where: string, what: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class Retype extends Error {
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly sort: Sort;
|
|
11
|
+
constructor(path: string, sort: Sort);
|
|
12
|
+
}
|
|
13
|
+
export type Sort = {
|
|
14
|
+
k: 'num';
|
|
15
|
+
} | {
|
|
16
|
+
k: 'bool';
|
|
17
|
+
} | {
|
|
18
|
+
k: 'choice';
|
|
19
|
+
values: string[];
|
|
20
|
+
} | {
|
|
21
|
+
k: 'str';
|
|
22
|
+
};
|
|
23
|
+
export type Shape = Sort | {
|
|
24
|
+
k: 'rec';
|
|
25
|
+
fields: [string, Shape][];
|
|
26
|
+
} | {
|
|
27
|
+
k: 'map';
|
|
28
|
+
key: 'num' | 'str';
|
|
29
|
+
val: Shape;
|
|
30
|
+
js: 'Map' | 'record';
|
|
31
|
+
};
|
|
32
|
+
export type Var = {
|
|
33
|
+
name: string;
|
|
34
|
+
sort: Sort;
|
|
35
|
+
role: 'param' | 'input' | 'state';
|
|
36
|
+
note?: string;
|
|
37
|
+
};
|
|
38
|
+
export type MapDecl = {
|
|
39
|
+
name: string;
|
|
40
|
+
key: 'num' | 'str';
|
|
41
|
+
fields: Var[];
|
|
42
|
+
scalar: boolean;
|
|
43
|
+
js: 'Map' | 'record';
|
|
44
|
+
untyped?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type Layout = {
|
|
47
|
+
k: 'scalar';
|
|
48
|
+
name: string;
|
|
49
|
+
} | {
|
|
50
|
+
k: 'rec';
|
|
51
|
+
fields: [string, Layout][];
|
|
52
|
+
} | {
|
|
53
|
+
k: 'map';
|
|
54
|
+
name: string;
|
|
55
|
+
} | {
|
|
56
|
+
k: 'const';
|
|
57
|
+
value: Term;
|
|
58
|
+
};
|
|
59
|
+
export type Term = {
|
|
60
|
+
s: 'num';
|
|
61
|
+
e: N;
|
|
62
|
+
} | {
|
|
63
|
+
s: 'bool';
|
|
64
|
+
e: B;
|
|
65
|
+
} | {
|
|
66
|
+
s: 'choice';
|
|
67
|
+
e: L;
|
|
68
|
+
} | {
|
|
69
|
+
s: 'str';
|
|
70
|
+
e: K;
|
|
71
|
+
};
|
|
72
|
+
export type Arg = {
|
|
73
|
+
k: 'input';
|
|
74
|
+
name: string;
|
|
75
|
+
} | {
|
|
76
|
+
k: 'lit';
|
|
77
|
+
value: string;
|
|
78
|
+
} | {
|
|
79
|
+
k: 'rec';
|
|
80
|
+
fields: [string, Arg][];
|
|
81
|
+
} | {
|
|
82
|
+
k: 'state';
|
|
83
|
+
} | {
|
|
84
|
+
k: 'lazy';
|
|
85
|
+
prefix: string;
|
|
86
|
+
};
|
|
87
|
+
export type Event = {
|
|
88
|
+
select: Record<string, string>;
|
|
89
|
+
call: string;
|
|
90
|
+
args: Arg[];
|
|
91
|
+
};
|
|
92
|
+
export type MapWrite = {
|
|
93
|
+
key: K;
|
|
94
|
+
has: B;
|
|
95
|
+
vals: Record<string, Term>;
|
|
96
|
+
};
|
|
97
|
+
export type Model = {
|
|
98
|
+
name: string;
|
|
99
|
+
shape: 'reducer' | 'functions' | 'class';
|
|
100
|
+
file: string;
|
|
101
|
+
entry: string;
|
|
102
|
+
params: Var[];
|
|
103
|
+
inputs: Var[];
|
|
104
|
+
state: Var[];
|
|
105
|
+
maps: MapDecl[];
|
|
106
|
+
event?: string;
|
|
107
|
+
init: Record<string, Term>;
|
|
108
|
+
writes: Record<string, Term>;
|
|
109
|
+
mapWrites: Record<string, MapWrite>;
|
|
110
|
+
outputs: string[];
|
|
111
|
+
refuse: B;
|
|
112
|
+
pre: B;
|
|
113
|
+
layout: Layout;
|
|
114
|
+
events: Event[];
|
|
115
|
+
notes: string[];
|
|
116
|
+
hints: WeakMap<object, string>;
|
|
117
|
+
ctorArgs?: string[];
|
|
118
|
+
lazy?: Map<string, {
|
|
119
|
+
prefix: string;
|
|
120
|
+
field: string;
|
|
121
|
+
}>;
|
|
122
|
+
initSource?: string;
|
|
123
|
+
spans?: [number, number][];
|
|
124
|
+
};
|
|
125
|
+
type V = {
|
|
126
|
+
t: 'num';
|
|
127
|
+
e: N;
|
|
128
|
+
} | {
|
|
129
|
+
t: 'bool';
|
|
130
|
+
e: B;
|
|
131
|
+
} | {
|
|
132
|
+
t: 'choice';
|
|
133
|
+
e: L;
|
|
134
|
+
values: string[];
|
|
135
|
+
} | {
|
|
136
|
+
t: 'str';
|
|
137
|
+
e: K;
|
|
138
|
+
} | {
|
|
139
|
+
t: 'ref';
|
|
140
|
+
id: string;
|
|
141
|
+
} | {
|
|
142
|
+
t: 'cell';
|
|
143
|
+
map: string;
|
|
144
|
+
key: K;
|
|
145
|
+
gen: number;
|
|
146
|
+
} | {
|
|
147
|
+
t: 'opt';
|
|
148
|
+
has: B;
|
|
149
|
+
v: V;
|
|
150
|
+
} | {
|
|
151
|
+
t: 'undef';
|
|
152
|
+
} | {
|
|
153
|
+
t: 'phi';
|
|
154
|
+
c: B;
|
|
155
|
+
a: V;
|
|
156
|
+
b: V;
|
|
157
|
+
};
|
|
158
|
+
type Rec = {
|
|
159
|
+
k: 'rec';
|
|
160
|
+
fields: Map<string, V>;
|
|
161
|
+
origin: 'fresh' | 'input' | 'this' | 'shared';
|
|
162
|
+
lazy?: {
|
|
163
|
+
prefix: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
type MapObj = {
|
|
167
|
+
k: 'map';
|
|
168
|
+
base: string;
|
|
169
|
+
decl: MapDecl;
|
|
170
|
+
w?: {
|
|
171
|
+
key: K;
|
|
172
|
+
has: B;
|
|
173
|
+
vals: Map<string, V>;
|
|
174
|
+
};
|
|
175
|
+
origin: 'fresh' | 'input' | 'this' | 'shared';
|
|
176
|
+
gen: number;
|
|
177
|
+
};
|
|
178
|
+
type Obj = Rec | MapObj | {
|
|
179
|
+
k: 'alias';
|
|
180
|
+
to: V;
|
|
181
|
+
};
|
|
182
|
+
type Heap = Map<string, Obj>;
|
|
183
|
+
type Path = {
|
|
184
|
+
pc: B[];
|
|
185
|
+
locals: Map<string, V>;
|
|
186
|
+
heap: Heap;
|
|
187
|
+
wrote: string[];
|
|
188
|
+
nows: number;
|
|
189
|
+
};
|
|
190
|
+
type Flow = {
|
|
191
|
+
live?: Path;
|
|
192
|
+
rets: [Path, V][];
|
|
193
|
+
breaks: Path[];
|
|
194
|
+
};
|
|
195
|
+
export declare const normalize: (path: string) => string;
|
|
196
|
+
export declare const resolveIn: (files: Record<string, string>, from: string, spec: string) => string | undefined;
|
|
197
|
+
export declare function program(code: string, file: string, extra?: Record<string, string>): {
|
|
198
|
+
sf: ts.SourceFile;
|
|
199
|
+
checker: ts.TypeChecker;
|
|
200
|
+
};
|
|
201
|
+
export declare const scriptKind: (file: string) => ts.ScriptKind;
|
|
202
|
+
export declare function shapeOf(t: ts.Type, checker: ts.TypeChecker, at: ts.Node): Shape;
|
|
203
|
+
type Callable = {
|
|
204
|
+
decl: ts.FunctionLikeDeclaration;
|
|
205
|
+
self?: string;
|
|
206
|
+
};
|
|
207
|
+
export type Setup = {
|
|
208
|
+
checker: ts.TypeChecker;
|
|
209
|
+
sf: ts.SourceFile;
|
|
210
|
+
names: Set<string>;
|
|
211
|
+
vars: Map<string, Var>;
|
|
212
|
+
maps: Map<string, MapDecl>;
|
|
213
|
+
lazySorts: Map<string, Sort>;
|
|
214
|
+
cls?: ts.ClassLikeDeclaration;
|
|
215
|
+
now?: string;
|
|
216
|
+
nowRole: 'input' | 'param';
|
|
217
|
+
hints: WeakMap<object, string>;
|
|
218
|
+
notes: Set<string>;
|
|
219
|
+
lazy: Map<string, {
|
|
220
|
+
prefix: string;
|
|
221
|
+
field: string;
|
|
222
|
+
}>;
|
|
223
|
+
ctor?: boolean;
|
|
224
|
+
ours: (sf: ts.SourceFile) => boolean;
|
|
225
|
+
spans?: [number, number][];
|
|
226
|
+
};
|
|
227
|
+
export declare class Exec {
|
|
228
|
+
readonly s: Setup;
|
|
229
|
+
throws: {
|
|
230
|
+
pc: B[];
|
|
231
|
+
}[];
|
|
232
|
+
private depth;
|
|
233
|
+
private ids;
|
|
234
|
+
constructor(s: Setup);
|
|
235
|
+
fresh(base: string): string;
|
|
236
|
+
newVar(base: string, sort: Sort, role: Var['role'], note?: string): Var;
|
|
237
|
+
id(prefix: string): string;
|
|
238
|
+
static valueOf(v: Var): V;
|
|
239
|
+
static cellOf(m: MapDecl, key: K, f: Var): V;
|
|
240
|
+
static defaultOf(sort: Sort): V;
|
|
241
|
+
withCond(p: Path, c: B): Path;
|
|
242
|
+
feasible(p: Path): boolean;
|
|
243
|
+
known(p: Path, c: B): boolean;
|
|
244
|
+
merge(a: Path | undefined, b: Path | undefined, at: ts.Node): Path | undefined;
|
|
245
|
+
private deref;
|
|
246
|
+
private mergeV;
|
|
247
|
+
private mergeObj;
|
|
248
|
+
private mergeW;
|
|
249
|
+
mergeWrites(c: B, decl: MapDecl, wa: MapObj['w'], wb: MapObj['w'], at: ts.Node): MapObj['w'];
|
|
250
|
+
mergeScalar(c: B, a: V, b: V, at: ts.Node): V;
|
|
251
|
+
baseCell(m: MapDecl, key: K): {
|
|
252
|
+
has: B;
|
|
253
|
+
vals: Map<string, V>;
|
|
254
|
+
};
|
|
255
|
+
asChoice(v: V, values: string[], at: ts.Node): L;
|
|
256
|
+
block(stmts: readonly ts.Statement[], p: Path): Flow;
|
|
257
|
+
stmt(st: ts.Statement, p: Path): Flow;
|
|
258
|
+
private switch;
|
|
259
|
+
private narrow;
|
|
260
|
+
bind(name: ts.BindingName, v: V, p: Path): Path;
|
|
261
|
+
private hint;
|
|
262
|
+
truthy(v: V, at: ts.Node): B;
|
|
263
|
+
num(v: V, at: ts.Node, p: Path): N;
|
|
264
|
+
private bool;
|
|
265
|
+
equal(a: V, b: V, at: ts.Node): B;
|
|
266
|
+
ev(e: ts.Expression, p: Path): [V, Path];
|
|
267
|
+
private joinValues;
|
|
268
|
+
private name;
|
|
269
|
+
private prefix;
|
|
270
|
+
private binary;
|
|
271
|
+
private arith;
|
|
272
|
+
private object;
|
|
273
|
+
private obj;
|
|
274
|
+
private key;
|
|
275
|
+
phiV(c: B, x: V, y: V, at: ts.Node): V;
|
|
276
|
+
field(v: V, f: string, at: ts.Node, p: Path): [V, Path];
|
|
277
|
+
readCell(m: MapObj, key: K): {
|
|
278
|
+
has: B;
|
|
279
|
+
vals: Map<string, V>;
|
|
280
|
+
};
|
|
281
|
+
private access;
|
|
282
|
+
private mapGet;
|
|
283
|
+
private mapId;
|
|
284
|
+
mapSet(id: string, key: K, v: V | undefined, at: ts.Node, p: Path, track?: boolean): Path;
|
|
285
|
+
private cellValue;
|
|
286
|
+
assign(target: ts.Expression, v: V, p: Path): Path;
|
|
287
|
+
private writeField;
|
|
288
|
+
resolved(e: ts.Node): ts.Symbol | undefined;
|
|
289
|
+
private args;
|
|
290
|
+
private call;
|
|
291
|
+
private math;
|
|
292
|
+
private now;
|
|
293
|
+
private newExpr;
|
|
294
|
+
inline(f: Callable, args: V[], at: ts.Node, p: Path): [V, Path];
|
|
295
|
+
}
|
|
296
|
+
export declare const memberName: (n: ts.PropertyName | ts.MemberName) => string;
|
|
297
|
+
export declare function impure(e: ts.Node): boolean;
|
|
298
|
+
export type { V, Path, Rec, MapObj, Heap, Flow };
|