gdp-wired 0.31.0 → 0.32.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.
Files changed (73) hide show
  1. package/README.md +82 -6
  2. package/dist/core/c/reader.d.ts +86 -0
  3. package/dist/core/c/reader.js +860 -0
  4. package/dist/core/cli.d.ts +66 -0
  5. package/dist/core/cli.js +582 -0
  6. package/dist/core/dsl.d.ts +4 -2
  7. package/dist/core/dsl.js +22 -12
  8. package/dist/core/effect.d.ts +6 -4
  9. package/dist/core/effect.js +48 -10
  10. package/dist/core/ex/harness.exs +177 -0
  11. package/dist/core/ex/json.exs +46 -0
  12. package/dist/core/ex/reader.exs +462 -0
  13. package/dist/core/exists.d.ts +3 -0
  14. package/dist/core/exists.js +3 -1
  15. package/dist/core/extract-c.d.ts +35 -0
  16. package/dist/core/extract-c.js +424 -0
  17. package/dist/core/extract-check.js +27 -6
  18. package/dist/core/extract-ex.d.ts +16 -0
  19. package/dist/core/extract-ex.js +33 -0
  20. package/dist/core/extract-go-check.d.ts +28 -0
  21. package/dist/core/extract-go-check.js +639 -0
  22. package/dist/core/extract-go.d.ts +231 -0
  23. package/dist/core/extract-go.js +1166 -0
  24. package/dist/core/extract-jvm.d.ts +23 -0
  25. package/dist/core/extract-jvm.js +220 -0
  26. package/dist/core/extract-print.js +17 -7
  27. package/dist/core/extract-py.d.ts +15 -0
  28. package/dist/core/extract-py.js +31 -0
  29. package/dist/core/extract-rb.d.ts +17 -0
  30. package/dist/core/extract-rb.js +31 -0
  31. package/dist/core/extract-read.d.ts +20 -0
  32. package/dist/core/extract-read.js +46 -6
  33. package/dist/core/extract-rs.d.ts +12 -0
  34. package/dist/core/extract-rs.js +306 -0
  35. package/dist/core/extract-shapes.d.ts +2 -0
  36. package/dist/core/extract-shapes.js +6 -5
  37. package/dist/core/extract-step.d.ts +806 -0
  38. package/dist/core/extract-step.js +4141 -0
  39. package/dist/core/extract-swift.d.ts +27 -0
  40. package/dist/core/extract-swift.js +484 -0
  41. package/dist/core/extract-xstate.d.ts +10 -3
  42. package/dist/core/extract-xstate.js +50 -4
  43. package/dist/core/extract.d.ts +22 -3
  44. package/dist/core/extract.js +107 -18
  45. package/dist/core/go/go.mod +3 -0
  46. package/dist/core/go/reader.go +901 -0
  47. package/dist/core/infer.js +1770 -52
  48. package/dist/core/jvm/Harness.java +361 -0
  49. package/dist/core/jvm/JavaReader.java +825 -0
  50. package/dist/core/jvm/Jvm.java +332 -0
  51. package/dist/core/jvm/KtReader.java +960 -0
  52. package/dist/core/jvm/Rt.java +10 -0
  53. package/dist/core/laws.d.ts +66 -0
  54. package/dist/core/laws.js +522 -0
  55. package/dist/core/py/harness.py +328 -0
  56. package/dist/core/py/reader.py +447 -0
  57. package/dist/core/rb/harness.rb +233 -0
  58. package/dist/core/rb/reader.rb +375 -0
  59. package/dist/core/rs/Cargo.lock +108 -0
  60. package/dist/core/rs/Cargo.toml +14 -0
  61. package/dist/core/rs/src/main.rs +681 -0
  62. package/dist/core/swift/Harness.swift +124 -0
  63. package/dist/core/swift/Main.swift +34 -0
  64. package/dist/core/swift/Package.swift +13 -0
  65. package/dist/core/swift/Sources/gdp-swiftreader/main.swift +1341 -0
  66. package/dist/kernel/cdcl.js +43 -18
  67. package/dist/kernel/epr.d.ts +35 -0
  68. package/dist/kernel/epr.js +1676 -0
  69. package/dist/kernel/prove.d.ts +44 -0
  70. package/dist/kernel/prove.js +668 -54
  71. package/dist/lean-kernel/emit.d.ts +1 -0
  72. package/dist/lean-kernel/emit.js +21 -4
  73. package/package.json +53 -6
@@ -0,0 +1,424 @@
1
+ // The extractor's C front end (`gdp-wired/extract-c`): a struct of a C file and the functions that take it by pointer,
2
+ // read through clang (core/c/reader.ts: its JSON dump, with the project's flags or its compile_commands.json), put in
3
+ // the typed shape Go's reader prints and lowered by Go's lowering into the shared step IR (core/extract-go.ts, then
4
+ // core/extract-step.ts): one lowering for both, C's semantics written as explicit nodes where clang's types say so.
5
+ // The check compiles the file as it ships with a generated harness (it #includes the file, so its static functions are
6
+ // called as they are, with the same flags and the undefined-behavior sanitizer trapping), drives the functions with
7
+ // the rule's requests and compares every state (core/extract-go-check.ts's `speak`, Go's own driver).
8
+ //
9
+ // const x = extractC('src/bucket.c', {fails: {bucket_take: '< 0'}, flags: ['-Iinclude']}) // a path or a URL; the struct inferred
10
+ //
11
+ // The subset: a struct of the file (its typedef's name or its tag) starting at all zeros, each function of the file
12
+ // whose first parameter points to it a request (by default the non-static ones; `functions` names them), the others
13
+ // called inlined; fields of integer types (every width, signed and unsigned, enums as their integers), bool, nested
14
+ // structs, pointers to the state's structs; locals, assignment (=, op=, ++, --), if, switch (a case runs into the
15
+ // next unless it breaks), early returns, ?:, the file's functions inlined; assert and abort (the step's refusal), and
16
+ // a result the caller states is a failure (`fails: {take: '< 0'}`).
17
+ //
18
+ // Integers are exactly C's: unsigned arithmetic wraps modulo 2^n (by cases, the bounds and the path's facts deciding
19
+ // where it may); signed overflow is undefined behavior, refused where the bounds and the path's facts don't exclude it
20
+ // (never wrapped, never assumed away); the promotions and conversions are clang's, a conversion to a narrower type
21
+ // wrapping as clang and gcc define it; / and % by a constant truncate, by zero undefined (refused); u & (2^k − 1) of an
22
+ // unsigned u is u % 2^k; a 64-bit number stops at the rule's ±2^53 (refused past it), an unsigned one below 0 refused.
23
+ //
24
+ // Refused, each where it is with why: loops, goto, arrays and pointer arithmetic, floats, strings, unions, globals and
25
+ // static locals (state every object shares), calls of other files' or libraries' code, function pointers, bit
26
+ // operations but the mask above, the comma operator, an assignment or ++ inside an expression, and sizeof.
27
+ import { fromModel } from "./extract.js";
28
+ import { Refusal, pathOf } from "./extract-read.js";
29
+ import { stubbed } from "./extract-step.js";
30
+ import { goNames, readGo, unsignedDomains } from "./extract-go.js";
31
+ import { speak } from "./extract-go-check.js";
32
+ import { clangDump, flagsFor, node, readC } from "./c/reader.js";
33
+ export { proveRule, proveSteps } from "./dsl.js";
34
+ export function readCFile(file, opts, cpp = false) {
35
+ // (no entry, C++: each class the file declares tried, its dump read for its name only)
36
+ if (!opts.entry && cpp) {
37
+ let text = '';
38
+ try {
39
+ text = node('node:fs').readFileSync(file, 'utf8');
40
+ }
41
+ catch {
42
+ throw new Refusal(file, 'no such file');
43
+ }
44
+ const why = [], names = [...new Set([...text.matchAll(/^\s*(?:class|struct)\s+(\w+)\s*(?:final\s*)?(?::[^{;]*)?\{/gm)].map(m => m[1]))];
45
+ const ok = names.flatMap(n => { try {
46
+ const r = readCFile(file, { ...opts, entry: n }, cpp);
47
+ readGo(r.c.pkg, { methods: r.c.methods });
48
+ return [r];
49
+ }
50
+ catch (e) {
51
+ if (e instanceof Refusal) {
52
+ why.push(`${n}: ${e.what}`);
53
+ return [];
54
+ }
55
+ throw e;
56
+ } });
57
+ if (ok.length !== 1)
58
+ throw new Refusal(file, ok.length ? `several classes write their state (${ok.map(r => r.c.entry).join(', ')}): name one (entry)` : `no class whose methods write its state${why.length ? ` (${why.join('; ')})` : ''}: name the entry`);
59
+ return ok[0];
60
+ }
61
+ const flags0 = [...flagsFor(file, opts.compileCommands), ...(opts.flags ?? [])], flags = cpp && !flags0.some(f => f.startsWith('-std=')) ? [...flags0, '-std=c++17'] : flags0, { tu, target } = clangDump(file, flags, opts.clang ?? (cpp ? 'clang++' : 'clang'), cpp, cpp ? opts.entry : undefined);
62
+ // (no entry: the file's one struct its functions write, each struct of the dump tried)
63
+ if (!opts.entry) {
64
+ const names = [...new Set((tu.inner ?? []).filter(n => n.kind === 'RecordDecl' && n.name && n.completeDefinition).map(n => String(n.name)))];
65
+ const ok = names.filter(n => { try {
66
+ const c = readC(file, n, tu, target, cpp, opts.root);
67
+ readGo(c.pkg, { methods: c.methods });
68
+ return true;
69
+ }
70
+ catch (e) {
71
+ if (e instanceof Refusal)
72
+ return false;
73
+ throw e;
74
+ } });
75
+ if (ok.length !== 1)
76
+ throw new Refusal(file, ok.length ? `several structs written by the file's functions (${ok.join(', ')}): name one (entry)` : 'no struct the file\'s functions write: name the entry');
77
+ return readCFile(file, { ...opts, entry: ok[0] }, cpp);
78
+ }
79
+ return { c: readC(file, opts.entry, tu, target, cpp, opts.root, Object.fromEntries((opts.functions ?? []).filter(f => f.includes('/')).map(f => [f.split('/')[0], Number(f.split('/')[1])]))), flags };
80
+ }
81
+ export function extractC(at, given = {}, cpp = false) {
82
+ const notes = [], file = pathOf(at), fns = given.methods ?? given.functions, opts = { ...given, ...(fns ? { functions: fns } : {}) };
83
+ let read, c, flags;
84
+ try {
85
+ ;
86
+ ({ c, flags } = readCFile(file, opts, cpp));
87
+ c.pkg.dir = node('node:path').resolve(file).replace(/\/[^/]*$/, '');
88
+ read = readGo(c.pkg, { entry: c.entry, methods: opts.functions?.map(f => f.split('/')[0]) ?? c.methods, ...(opts.onError ? { onError: opts.onError } : {}), ...(opts.fails ? { fails: opts.fails } : {}), ...(opts.strict ? { strict: true } : {}) });
89
+ }
90
+ catch (e) {
91
+ if (e instanceof Refusal)
92
+ return { ok: false, refusals: [{ where: e.where, what: e.what }], notes };
93
+ throw e;
94
+ }
95
+ // (a signed leaf the caller states is a natural: its range law from 0, the claim for those states)
96
+ for (const [n, d] of Object.entries(opts.domains ?? {}))
97
+ if (d === 'nat')
98
+ read.model.laws = read.model.laws?.map(l => (l.includes(`"${n} within its type's range"`) ? l.replace(/\.atLeast\(-\d+\)/, '.atLeast(0)') : l));
99
+ if (!opts.entry)
100
+ read.model.notes.unshift(`the entry inferred: ${c.entry}, ${cpp ? 'the class whose methods write its state' : 'the struct the file\'s functions write'}`);
101
+ const x = fromModel(read.model, `${c.entry}.${cpp ? 'cpp' : 'c'}`, { ...unsignedDomains(read), ...signedDomains(c.pkg, read), ...opts.domains }, notes, (rule, sorts) => checkC(file, flags, c, read, rule, sorts, opts, cpp));
102
+ return { ...x, leaves: read.leaves, names: goNames(read) };
103
+ }
104
+ // A signed field (and a signed result) is an integer, never inferred a natural: its range law reads below 0.
105
+ function signedDomains(pkg, read) {
106
+ const out = {};
107
+ for (const l of read.leaves)
108
+ if (l.kind === 'int' && ty(pkg, l.t).signed !== false)
109
+ out[l.name] = 'int';
110
+ for (const l of read.leaves)
111
+ if (l.kind === 'list' && ty(pkg, ty(pkg, l.t).elem).k === 'int' && ty(pkg, ty(pkg, l.t).elem).signed !== false)
112
+ out[`${l.name}.$item`] = 'int';
113
+ for (const m of read.methods)
114
+ if (m.results[0] !== undefined && ty(pkg, m.results[0]).k === 'int' && ty(pkg, m.results[0]).signed !== false)
115
+ out[`${m.name}_result`] = 'int';
116
+ return out;
117
+ }
118
+ // The C++ front end (`gdp-wired/extract-cpp`): a class, its public methods the requests, its constructor the start (its
119
+ // parameters the rule's); `this` and references are pointers into the state, std::array a fixed array, std::min and
120
+ // std::max, std::lock_guard, std::scoped_lock and std::unique_lock of a member mutex the step atomic (Go's Lock with its
121
+ // deferred Unlock), a throw the step's refusal. Refused: templates, virtual methods, overloads, other classes' methods,
122
+ // STL containers but std::array, lambdas, try and catch.
123
+ export const extractCpp = (at, opts = {}) => extractC(at, opts, true);
124
+ // --- the harness: C (or C++) that #includes the file, sets and prints the state's leaves as JSON lines -------------------
125
+ const ty = (pkg, t) => pkg.ttab[t] ?? { k: 'invalid' };
126
+ export function harnessC(file, c, read, opts, cpp) {
127
+ const pkg = c.pkg, T = (t) => ty(pkg, t), q = JSON.stringify, robs = [];
128
+ // A leaf's place: o->a.b in C; in C++ each member through a pointer to it the explicit instantiation of gdp_rob takes
129
+ // (access isn't checked there), so private members are read and set as the class's own code does.
130
+ const acc = (path) => {
131
+ if (!cpp)
132
+ return `o->${path.join('.')}`;
133
+ let e = '(*o)', t = pkg.types[0].t;
134
+ for (const f of path) {
135
+ const r = T(t), k = `&${t === pkg.types[0].t ? c.cname : r.go}::${f}`;
136
+ if (!robs.includes(k))
137
+ robs.push(k);
138
+ e = `(${e}.*gdp_ptr(gdp_tag${robs.indexOf(k)}()))`;
139
+ t = r.fields.find(g => g.name === f).t;
140
+ }
141
+ return e;
142
+ };
143
+ const cast = (dst, t) => (cpp ? `std::remove_reference_t<decltype(${dst})>` : T(t).go);
144
+ const get = [], set = [];
145
+ const intOut = (e, t) => (T(t).signed === false ? `gdp_putf("\\"%llu\\"", (unsigned long long)(${e}))` : `gdp_putf("\\"%lld\\"", (long long)(${e}))`);
146
+ const intIn = (dst, raw, t, err) => `{ long long s_; unsigned long long u_; if (!gdp_int(${raw}, ${T(t).bits ?? 64}, ${T(t).signed === false ? 0 : 1}, &s_, &u_)) ${err}; ${dst} = (${cast(dst, t)})(${T(t).signed === false ? 'u_' : 's_'}); }`;
147
+ for (const l of read.leaves) {
148
+ const a = acc(l.path), k = q(l.name);
149
+ if (l.kind === 'int') {
150
+ get.push(`gdp_putf("%s\\"%s\\":", sep, ${k}); sep = ","; ${intOut(a, l.t)};`);
151
+ set.push(`if ((v = gdp_key(st, ${k}))) ${intIn(a, 'v', l.t, `return "${l.name} outside its type"`)}`);
152
+ }
153
+ else if (l.kind === 'list') {
154
+ // (a fixed array: all its items, exactly its length set)
155
+ const at = T(l.t), n = at.len, et = at.elem, item = (e) => (T(et).k === 'int' ? intOut(e, et) : `gdp_putf("%s", ${e} ? "true" : "false")`);
156
+ get.push(`gdp_putf("%s\\"%s\\":[", sep, ${k}); sep = ","; for (int i = 0; i < ${n}; i++) { if (i) gdp_putf(","); ${item(`${a}[i]`)}; } gdp_putf("]");`);
157
+ set.push(`if ((v = gdp_key(st, ${k}))) { for (int i = 0; i < ${n}; i++) { const char *e = gdp_idx(v, i); if (!e) return "${l.name}: not ${n} items"; ${T(et).k === 'int' ? intIn(`${a}[i]`, 'e', et, `return "${l.name}: an item outside its type"`) : `${a}[i] = !strncmp(e, "true", 4);`} } if (gdp_idx(v, ${n})) return "${l.name}: not ${n} items"; }`);
158
+ }
159
+ else if (l.kind === 'bool') {
160
+ get.push(`gdp_putf("%s\\"%s\\":%s", sep, ${k}, ${a} ? "true" : "false"); sep = ",";`);
161
+ set.push(`if ((v = gdp_key(st, ${k}))) { if (!strncmp(v, "true", 4)) ${a} = 1; else if (!strncmp(v, "false", 5)) ${a} = 0; else return "${l.name}: not a boolean"; }`);
162
+ }
163
+ }
164
+ const frames = read.leaves.filter(l => l.kind === 'frame' && !T(l.t).mutex);
165
+ const calls = read.methods.map(meth => {
166
+ const lines = [], args = ['o'], outs = [];
167
+ meth.params.forEach((pa, i) => {
168
+ const t = T(pa.t), raw = `gdp_idx(a, ${i})`;
169
+ if (pa.arg.k === 'input') {
170
+ lines.push(`${t.go} a${i}; memset(&a${i}, 0, sizeof a${i}); const char *r${i} = ${raw}; if (!r${i}) return "no argument ${i}";`);
171
+ lines.push(t.k === 'int' ? intIn(`a${i}`, `r${i}`, pa.t, `return "argument ${i} outside its type"`) : `a${i} = !strncmp(r${i}, "true", 4);`);
172
+ args.push(`a${i}`);
173
+ }
174
+ else if (pa.arg.k === 'rec' && t.k === 'ptr' && T(t.elem).box) {
175
+ // (an out-parameter: a local of its type, its address given, what is left in it reported)
176
+ const et = T(t.elem).fields[0].t;
177
+ lines.push(`${T(et).go} a${i} = 0; const char *r${i} = ${raw}; if (r${i} && (v = gdp_key(r${i}, "value"))) ${T(et).k === 'int' ? intIn(`a${i}`, 'v', et, `return "argument ${i} outside its type"`) : `a${i} = !strncmp(v, "true", 4);`}`);
178
+ args.push(t.go?.trim().endsWith('&') ? `a${i}` : `&a${i}`);
179
+ outs.push([pa.name, `a${i}`, et]);
180
+ }
181
+ else if (pa.arg.k === 'rec') {
182
+ const byValue = t.k !== 'ptr', st = byValue ? t : T(t.elem);
183
+ lines.push(`${st.go} a${i}; memset(&a${i}, 0, sizeof a${i}); const char *r${i} = ${raw}; if (!r${i}) return "no argument ${i}";`);
184
+ for (const [f] of pa.arg.fields) {
185
+ const ft = st.fields.find(g => g.name === f).t;
186
+ lines.push(`if ((v = gdp_key(r${i}, ${q(f)}))) ${T(ft).k === 'int' ? intIn(`a${i}.${f}`, 'v', ft, `return "argument ${i}.${f} outside its type"`) : `a${i}.${f} = !strncmp(v, "true", 4);`}`);
187
+ }
188
+ args.push(byValue ? `a${i}` : `&a${i}`);
189
+ }
190
+ else
191
+ lines.push(`return "an argument the harness can't make";`);
192
+ });
193
+ const rt = meth.results[0], fails = opts.fails?.[meth.name]?.trim();
194
+ const callee = cpp ? `o->${meth.name}(${args.slice(1).join(', ')})` : `${meth.name}(${args.join(', ')})`;
195
+ const invoke = rt === undefined ? `${callee};` : `${cpp ? 'auto' : T(rt).go} r0 = ${callee}; gdp_has = 1; ${T(rt).k === 'int' ? `gdp_outv = ${T(rt).signed === false ? '(long long)' : ''}r0; gdp_outu = ${T(rt).signed === false ? 1 : 0};` : 'gdp_outb = r0; gdp_isb = 1;'}`;
196
+ const failed = fails !== undefined && rt !== undefined ? `if (r0 ${fails.replace(/^(==|!=|<=|>=|<|>)\s*/, '$1 ')}) gdp_err = 1;` : '';
197
+ // (with out-parameters, the result is a record: the value returned and what each holds)
198
+ const rec = outs.length ? `gdp_rec = 1; gdp_putf(",\\"out\\":{"); ${[...(rt !== undefined ? [['result', 'r0', rt]] : []), ...outs].map(([n, v, et], j) => `gdp_putf("${j ? ',' : ''}\\"${n}\\":"); ${T(et).k === 'int' ? `gdp_putf(${T(et).signed === false ? '"%llu", (unsigned long long)' : '"%lld", (long long)'}(${v}))` : `gdp_putf("%s", ${v} ? "true" : "false")`};`).join(' ')} gdp_putf("},\\"hasOut\\":true");` : '';
199
+ return `if (!strcmp(m, ${q(meth.name)})) {\n ${lines.join('\n ')}\n memcpy(gdp_pre, (void *)o, sizeof(gdp_T));\n int sg = sigsetjmp(gdp_jb, 1);\n if (!sg) { gdp_armed = 1; ${cpp ? 'try { ' : ''}${invoke} ${failed} gdp_armed = 0; ${rec}${cpp ? ' } catch (...) { gdp_armed = 0; gdp_sig = SIGUSR2; }' : ''} } else gdp_sig = sg;\n return gdp_after(o);\n }`;
200
+ });
201
+ const frameLines = frames.map(l => { const e = acc(l.path); return `if (memcmp((char *)&${e}, (char *)gdp_pre + ((char *)&${e} - (char *)o), sizeof ${e})) return ${q(l.path.join('.'))};`; });
202
+ // The object, made as the code makes it: C's zeroed; C++'s constructed (in zeroed memory) with the rule's parameters.
203
+ const cps = read.ctor ?? [], make = `static gdp_T *gdp_make(const char *line, const char **bad) {
204
+ const char *a = gdp_key(line, "a"), *v; (void)a; (void)v;
205
+ ${cps.map((pa, i) => `${T(pa.t).go} c${i} = 0; if (!(v = a ? gdp_idx(a, ${i}) : 0)) { *bad = "no argument ${i}"; return 0; } ${T(pa.t).k === 'int' ? intIn(`c${i}`, 'v', pa.t, `{ *bad = "argument ${i} outside its type"; return 0; }`) : `c${i} = !strncmp(v, "true", 4);`}`).join('\n ')}
206
+ void *mem = calloc(1, sizeof(gdp_T));
207
+ return ${cpp ? `new (mem) gdp_T(${cps.map((_, i) => `c${i}`).join(', ')})` : '(gdp_T *)mem'};
208
+ }`;
209
+ return `// Generated by gdp-wired's ${cpp ? 'C++' : 'C'} check (core/extract-c.ts): the file's code is called as it is.
210
+ ${read.answers?.length ? `// The stub point of an answered call, by the callee's name (each call rewritten to it in the file's copy): the
211
+ // request's input for it, 0 where it is none.
212
+ #include <stdlib.h>
213
+ static const char *gdp_answers;
214
+ static const char *gdp_key(const char *p, const char *k);
215
+ static long long gdp_answer(const char *name) {
216
+ const char *a = gdp_answers ? gdp_key(gdp_answers, name) : 0, *v = a ? gdp_key(a, "in") : 0;
217
+ if (!v) return 0;
218
+ if (*v == '"') v++;
219
+ return strtoll(v, 0, 10);
220
+ }
221
+ ` : ''}#define main gdp_orig_main
222
+ #include ${q(file)}
223
+ #undef main
224
+ #include <stdio.h>
225
+ #include <stdlib.h>
226
+ #include <string.h>
227
+ #include <stdarg.h>
228
+ #include <signal.h>
229
+ #include <setjmp.h>
230
+ #include <errno.h>
231
+ ${cpp ? '#include <new>\n#include <type_traits>\n' : '#include <stdbool.h>\n'}
232
+ typedef ${c.cname} gdp_T;
233
+ static unsigned char gdp_pre[sizeof(gdp_T)];
234
+ ${robs.length ? `template <typename Tag, auto M> struct gdp_rob { friend auto gdp_ptr(Tag) { return M; } };\n${robs.map((k, i) => `struct gdp_tag${i} { friend auto gdp_ptr(gdp_tag${i}); };\ntemplate struct gdp_rob<gdp_tag${i}, ${k}>;`).join('\n')}` : ''}
235
+ static char *gdp_buf; static size_t gdp_n, gdp_cap;
236
+ static void gdp_putf(const char *f, ...) {
237
+ va_list ap; va_start(ap, f); char tmp[512]; int k = vsnprintf(tmp, sizeof tmp, f, ap); va_end(ap);
238
+ if (gdp_n + k + 1 > gdp_cap) { gdp_cap = (gdp_n + k + 1) * 2; gdp_buf = (char *)realloc(gdp_buf, gdp_cap); }
239
+ memcpy(gdp_buf + gdp_n, tmp, k + 1); gdp_n += k;
240
+ }
241
+ static const char *gdp_ws(const char *p) { while (*p == ' ' || *p == '\\t' || *p == '\\n' || *p == '\\r') p++; return p; }
242
+ static const char *gdp_skip(const char *p) {
243
+ p = gdp_ws(p);
244
+ if (*p == '"') { p++; while (*p && *p != '"') { if (*p == '\\\\' && p[1]) p++; p++; } return *p ? p + 1 : p; }
245
+ if (*p == '{' || *p == '[') { int d = 0; do { if (*p == '"') { p = gdp_skip(p); continue; } if (*p == '{' || *p == '[') d++; else if (*p == '}' || *p == ']') d--; p++; } while (*p && d > 0); return p; }
246
+ while (*p && *p != ',' && *p != '}' && *p != ']') p++;
247
+ return p;
248
+ }
249
+ // (a key's value in an object, an item of an array)
250
+ static const char *gdp_key(const char *o, const char *key) {
251
+ const char *p = gdp_ws(o); size_t n = strlen(key);
252
+ if (*p != '{') return 0; p++;
253
+ for (;;) {
254
+ p = gdp_ws(p); if (*p != '"') return 0;
255
+ const char *k = p + 1, *e = strchr(k, '"'); if (!e) return 0;
256
+ p = gdp_ws(e + 1); if (*p == ':') p++; p = gdp_ws(p);
257
+ if ((size_t)(e - k) == n && !strncmp(k, key, n)) return p;
258
+ p = gdp_ws(gdp_skip(p)); if (*p == ',') p++; else return 0;
259
+ }
260
+ }
261
+ static const char *gdp_idx(const char *a, int i) {
262
+ const char *p = gdp_ws(a); if (*p != '[') return 0; p++;
263
+ for (int j = 0;; j++) { p = gdp_ws(p); if (*p == ']' || !*p) return 0; if (j == i) return p; p = gdp_ws(gdp_skip(p)); if (*p == ',') p++; }
264
+ }
265
+ static int gdp_int(const char *v, int bits, int sgn, long long *s, unsigned long long *u) {
266
+ char tmp[64]; size_t n = 0; v = gdp_ws(v); if (*v == '"') v++;
267
+ while (*v && *v != '"' && *v != ',' && *v != '}' && *v != ']' && n < 63) tmp[n++] = *v++;
268
+ tmp[n] = 0; if (!n) return 0;
269
+ char *end; errno = 0;
270
+ if (sgn) { long long x = strtoll(tmp, &end, 10); if (*end || errno) return 0; if (bits < 64 && (x < -(1LL << (bits - 1)) || x > (1LL << (bits - 1)) - 1)) return 0; *s = x; }
271
+ else { if (tmp[0] == '-') return 0; unsigned long long x = strtoull(tmp, &end, 10); if (*end || errno) return 0; if (bits < 64 && x > (1ULL << bits) - 1) return 0; *u = x; }
272
+ return 1;
273
+ }
274
+ static void gdp_get(gdp_T *o) {
275
+ const char *sep = ""; (void)sep; (void)o;
276
+ gdp_putf("{");
277
+ ${get.join('\n ')}
278
+ gdp_putf("}");
279
+ }
280
+ static const char *gdp_set(gdp_T *o, const char *st) {
281
+ const char *v; (void)v; (void)o; (void)st;
282
+ ${set.join('\n ')}
283
+ return 0;
284
+ }
285
+ static sigjmp_buf gdp_jb; static volatile sig_atomic_t gdp_armed;
286
+ static int gdp_sig, gdp_err, gdp_has, gdp_outu, gdp_isb, gdp_rec; static long long gdp_outv; static bool gdp_outb;
287
+ static void gdp_on(int s) { if (gdp_armed) { gdp_armed = 0; siglongjmp(gdp_jb, s); } signal(s, SIG_DFL); raise(s); }
288
+ static const char *gdp_frame(gdp_T *o) {
289
+ (void)o;
290
+ ${frameLines.join('\n ')}
291
+ return 0;
292
+ }
293
+ // (another file's function, linked as a stub, reached: the step's failure)
294
+ static const char *gdp_extern;
295
+ ${cpp ? 'extern "C" ' : ''}void gdp_extern_called(const char *n) { gdp_extern = n; if (gdp_armed) { gdp_armed = 0; siglongjmp(gdp_jb, SIGUSR1); } abort(); }
296
+ static const char *gdp_after(gdp_T *o) {
297
+ const char *f = gdp_frame(o);
298
+ if (f) { gdp_putf(",\\"frame\\":\\"%s\\"", f); }
299
+ if (gdp_sig) gdp_putf(",\\"panic\\":\\"%s\\"", gdp_sig == SIGABRT ? "SIGABRT (abort, or an assertion failing)" : gdp_sig == SIGTRAP || gdp_sig == SIGILL ? "undefined behavior (the sanitizer's trap)" : gdp_sig == SIGUSR1 ? "another file's function called" : gdp_sig == SIGUSR2 ? "an exception thrown" : "a signal");
300
+ else if (gdp_err) gdp_putf(",\\"err\\":\\"its result is its failure (%lld)\\"", gdp_outv);
301
+ if (!gdp_sig && gdp_has && !gdp_rec) { if (gdp_isb) gdp_putf(",\\"out\\":%s,\\"hasOut\\":true", gdp_outb ? "true" : "false"); else if (gdp_outu) gdp_putf(",\\"out\\":\\"%llu\\",\\"hasOut\\":true", (unsigned long long)gdp_outv); else gdp_putf(",\\"out\\":\\"%lld\\",\\"hasOut\\":true", gdp_outv); }
302
+ if (${opts.onError === 'discard' ? 1 : 0} && (gdp_sig || gdp_err)) memcpy((void *)o, gdp_pre, sizeof(gdp_T));
303
+ gdp_putf(",\\"state\\":"); gdp_get(o);
304
+ return 0;
305
+ }
306
+ ${make}
307
+ static const char *gdp_call(gdp_T *o, const char *m, const char *a) {
308
+ const char *v; (void)v; (void)a;
309
+ gdp_sig = gdp_err = gdp_has = gdp_outu = gdp_isb = gdp_rec = 0; gdp_outv = 0;
310
+ ${calls.join('\n ')}
311
+ return "no such function";
312
+ }
313
+ int main(int argc, char **argv) {
314
+ if (argc == 2 && !strcmp(argv[1], "--probe")) return 0;
315
+ if (argc < 3) return 2;
316
+ FILE *in = fopen(argv[1], "r"), *out = fopen(argv[2], "w");
317
+ if (!in || !out) return 2;
318
+ int sigs[] = {SIGABRT, SIGTRAP, SIGILL, SIGFPE, SIGSEGV, SIGBUS};
319
+ for (unsigned i = 0; i < sizeof sigs / sizeof *sigs; i++) signal(sigs[i], gdp_on);
320
+ gdp_T **objs = 0; size_t nobj = 0;
321
+ char *line = 0; size_t lcap = 0;
322
+ for (;;) {
323
+ size_t ln = 0; int ch;
324
+ while ((ch = fgetc(in)) != EOF && ch != '\\n') { if (ln + 2 > lcap) { lcap = lcap ? lcap * 2 : 4096; line = (char *)realloc(line, lcap); } line[ln++] = (char)ch; }
325
+ if (ch == EOF && !ln) break;
326
+ if (!line) continue;
327
+ line[ln] = 0;
328
+ const char *op = gdp_key(line, "op"), *id = gdp_key(line, "id");
329
+ long long k = 0; unsigned long long ku; if (id) gdp_int(id, 64, 1, &k, &ku);
330
+ gdp_n = 0;
331
+ if (op && !strncmp(op, "\\"new\\"", 5)) { const char *bad = 0; gdp_T *o = gdp_make(line, &bad); if (!o) gdp_putf("{\\"bad\\":\\"%s\\"}", bad); else { objs = (gdp_T **)realloc(objs, ++nobj * sizeof *objs); objs[nobj - 1] = o; gdp_putf("{\\"id\\":%zu}", nobj); } }
332
+ else if (op && !strncmp(op, "\\"at\\"", 4)) {
333
+ const char *bad = 0; gdp_T *o = gdp_make(line, &bad); const char *st = gdp_key(line, "state");
334
+ if (o) bad = st ? gdp_set(o, st) : "no state";
335
+ if (bad) gdp_putf("{\\"bad\\":\\"%s\\"}", bad);
336
+ else { objs = (gdp_T **)realloc(objs, ++nobj * sizeof *objs); objs[nobj - 1] = o; gdp_putf("{\\"id\\":%zu}", nobj); }
337
+ }
338
+ else if (op && !strncmp(op, "\\"get\\"", 5)) { gdp_putf("{\\"state\\":"); gdp_get(objs[k - 1]); gdp_putf("}"); }
339
+ else if (op && !strncmp(op, "\\"call\\"", 6)) {
340
+ const char *mv = gdp_key(line, "m"), *av = gdp_key(line, "a"); char m[256] = {0};
341
+ if (mv && *mv == '"') { const char *e = strchr(mv + 1, '"'); size_t n = e ? (size_t)(e - mv - 1) : 0; if (n > 255) n = 255; memcpy(m, mv + 1, n); }
342
+ gdp_putf("{\\"ok\\":true");${read.answers?.length ? `
343
+ gdp_answers = gdp_key(line, "answers");` : ''}
344
+ const char *bad = gdp_call(objs[k - 1], m, av ? av : "[]");
345
+ if (bad) { gdp_n = 0; gdp_putf("{\\"bad\\":\\"%s\\"", bad); }
346
+ gdp_putf("}");
347
+ }
348
+ fputs(gdp_buf ? gdp_buf : "{}", out); fputc('\\n', out); fflush(out);
349
+ }
350
+ return 0;
351
+ }
352
+ `;
353
+ }
354
+ // (a fixed array last in a struct is still of its length, its index checked: clang 15 and later)
355
+ const flexOK = new Map();
356
+ function strictFlex(clang) {
357
+ if (!flexOK.has(clang)) {
358
+ try {
359
+ node('node:child_process').execFileSync(clang, ['-fstrict-flex-arrays=3', '-x', 'c', '-fsyntax-only', '/dev/null'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
360
+ flexOK.set(clang, true);
361
+ }
362
+ catch {
363
+ flexOK.set(clang, false);
364
+ }
365
+ }
366
+ return flexOK.get(clang) ? ['-fstrict-flex-arrays=3'] : [];
367
+ }
368
+ // --- the check ------------------------------------------------------------------------------------------------------------
369
+ export function checkC(file, flags, c, read, r, sorts, opts, cpp) {
370
+ const fs = node('node:fs'), cp = node('node:child_process'), os = node('node:os'), path = node('node:path');
371
+ const work = fs.mkdtempSync(`${os.tmpdir()}/gdp-ccheck-`), b0 = performance.now();
372
+ // (each answered call rewritten to the harness's answer in a copy of the file, its own includes found beside it)
373
+ const copy = stubbed(read, f => fs.readFileSync(`${path.resolve(file).replace(/[^/]*$/, '')}${f}`, 'utf8'), a => `((${a.ty})gdp_answer(${JSON.stringify(a.key)}))`);
374
+ for (const [f, t] of copy)
375
+ fs.writeFileSync(`${work}/${f}`, t);
376
+ const code = harnessC(copy.size ? `${work}/${path.resolve(file).split('/').pop()}` : path.resolve(file), c, read, opts, cpp);
377
+ if (copy.size)
378
+ flags = [...flags, '-iquote', path.resolve(file).replace(/\/[^/]*$/, '')];
379
+ const empty = { runs: 0, requests: 0, fromStates: 0, probes: { conditions: 0, witnesses: 0, steps: 0 }, refusedBoth: 0, outside: 0, edge: 0, compiledAgreed: 0, coverage: { arms: 0, hit: 0, missed: [] }, ms: 0, buildMs: 0, runMs: 0 };
380
+ try {
381
+ const h = `${work}/harness.${cpp ? 'cpp' : 'c'}`;
382
+ fs.writeFileSync(h, code);
383
+ if (opts.check?.keep) {
384
+ fs.mkdirSync(opts.check.keep, { recursive: true });
385
+ fs.writeFileSync(`${opts.check.keep}/harness.${cpp ? 'cpp' : 'c'}`, code);
386
+ }
387
+ // The same flags; undefined behavior trapped (the rule refuses it, so the code must fail there too); another
388
+ // file's functions linked as stubs that report themselves (the rule refuses their calls: one reached is the
389
+ // code's failure where the rule took the step, a difference).
390
+ const clang = opts.clang ?? (cpp ? 'clang++' : 'clang'), stubs = `${work}/gdp_stubs.c`;
391
+ const link = (more) => cp.execFileSync(clang, [...(cpp ? ['-x', 'c++'] : []), ...flags, '-w', '-O0', '-fsanitize=undefined', '-fsanitize-trap=undefined', '-fno-sanitize=vptr,function', ...strictFlex(clang), h, ...(more.length ? ['-x', 'c', ...more] : []), '-o', `${work}/harness`,], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 1 << 26 });
392
+ const why = (x) => String(x.stderr ?? x.message);
393
+ try {
394
+ link([]);
395
+ }
396
+ catch (x) {
397
+ const names = [...new Set([...why(x).matchAll(/undefined (?:reference to [`']|symbol: )_?([A-Za-z_]\w*)|"_([A-Za-z_]\w*)", referenced from/g)].map(m => m[1] ?? m[2]))];
398
+ if (!names.length)
399
+ return { ...empty, mismatch: `the file doesn't build with the check's harness: ${why(x).split('\n').filter(l => /error/.test(l)).slice(0, 6).join(' | ')}` };
400
+ fs.writeFileSync(stubs, `void gdp_extern_called(const char *);\n${names.map(n => `void ${n}(void) { gdp_extern_called(${JSON.stringify(n)}); }`).join('\n')}\n`);
401
+ try {
402
+ link([stubs]);
403
+ }
404
+ catch (y) {
405
+ return { ...empty, mismatch: `the file doesn't build with the check's harness: ${why(y).split('\n').filter(l => /error/.test(l)).slice(0, 6).join(' | ')}` };
406
+ }
407
+ }
408
+ // (a harness that doesn't start would leave the pipes unopened: asked to start and stop first)
409
+ try {
410
+ cp.execFileSync(`${work}/harness`, ['--probe'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 20_000 });
411
+ }
412
+ catch (x) {
413
+ return { ...empty, mismatch: `the check's harness doesn't start: ${why(x).split('\n').filter(Boolean).slice(0, 3).join(' | ')}` };
414
+ }
415
+ const buildMs = Math.round(performance.now() - b0), none = () => ({ arms: 0, hit: 0, missed: [] });
416
+ return { ...speak(work, `${work}/harness`, globalThis.process?.env, c.pkg, read, r, sorts, opts.check ?? {}, none), buildMs };
417
+ }
418
+ finally {
419
+ try {
420
+ fs.rmSync(work, { recursive: true, force: true });
421
+ }
422
+ catch { /* gone */ }
423
+ }
424
+ }
@@ -364,7 +364,11 @@ export function draw(sort, sorts, name, rand, near, bound, strs) {
364
364
  }
365
365
  export function check(code, file, m, r, sorts, opts = {}) {
366
366
  const isClass = m.shape === 'class', fns = m.shape === 'class' ? [m.entry] : [...new Set(m.events.map(e => e.call))];
367
- const box = sandbox(code, file, fns, opts.modules, m.initSource, opts.files, m.factory ? [[m.factory.at, m.factory.text], ...(m.factory.extra ?? [])] : []);
367
+ let answers = {};
368
+ // (the modules whose functions the class calls: each export answers its input, or nothing, by the callee's name)
369
+ const ans = (path) => () => { const n = Object.keys(m.answers ?? {}).find(k => m.answers[k] === path); return n === undefined ? undefined : answers[n]; };
370
+ const mods = { ...opts.modules, ...Object.fromEntries((m.imports ?? []).map(mod => [mod, new Proxy({}, { get: (_, k) => (k === '__esModule' ? true : typeof k === 'string' ? ans(`import:${mod}:${k}`) : undefined) })])) };
371
+ const box = sandbox(code, file, fns, mods, m.initSource, opts.files, m.factory ? [[m.factory.at, m.factory.text], ...(m.factory.extra ?? [])] : []);
368
372
  // An object a factory makes: its state is what its functions close over, read and set through the two functions the
369
373
  // check added to it.
370
374
  const stateOf = (self) => (m.factory ? box.call('$get', self, []).value : self);
@@ -379,7 +383,6 @@ export function check(code, file, m, r, sorts, opts = {}) {
379
383
  vmOf().runInContext(m.factory.calls ?? `__gdp.$method = function (name, args) { return this[name](...args) }; __gdp.$new = function (...args) { return __gdp[${E}](...args) }; __gdp.$get = function () { return this.__gdpGet() }; __gdp.$at = function (fields, args) { const o = __gdp[${E}](...args); o.__gdpSet(fields); return o }`, box.ctx);
380
384
  // A class's fields holding a function: each answers the request's input (set on the object before each call; a
381
385
  // function given to the constructor is one such too).
382
- let answers = {};
383
386
  const answering = (f) => () => { const n = Object.keys(m.answers ?? {}).find(k => m.answers[k] === f); return n === undefined ? undefined : answers[n]; };
384
387
  const fnArg = () => () => { throw new Error('a function given to the constructor called while the object is made'); };
385
388
  const ctorValue = (n, params) => (n === '$fn' ? fnArg() : n.startsWith('$map:') ? vmOf().runInContext(n === '$map:Map' ? 'new Map()' : '({})', box.ctx) : params[n]);
@@ -396,7 +399,8 @@ export function check(code, file, m, r, sorts, opts = {}) {
396
399
  snapOf: (self, params) => snapOf(stateOf(self), m.layout, m, evalAt(params)),
397
400
  call: (self, e, args) => {
398
401
  for (const f of new Set(Object.values(m.answers ?? {})))
399
- self[f] = answering(f);
402
+ if (!f.startsWith('import:'))
403
+ self[f] = answering(f);
400
404
  return box.call('$method', self, [e.call, args]);
401
405
  },
402
406
  reduce: (snap, e, args, params) => {
@@ -523,11 +527,12 @@ export function drive(m, r, sorts, code, opts = {}) {
523
527
  // The rule.
524
528
  let rule = { refused: 'not run' };
525
529
  let enc;
530
+ // (a drawn number past ±(2^53 − 1), next to a big one, is outside what the rule's numbers hold, not its refusal)
526
531
  try {
527
532
  enc = r.encodeInput(raw, params);
528
533
  }
529
534
  catch (x) {
530
- rule = { refused: `outside the input's kind (${x.message})` };
535
+ rule = JSON.stringify(raw, (_, v) => (typeof v === 'number' && !Number.isSafeInteger(v) ? 'unsafe$' : v)).includes('"unsafe$"') ? { outside: x.message } : { refused: `outside the input's kind (${x.message})` };
531
536
  }
532
537
  if (enc) {
533
538
  try {
@@ -617,7 +622,16 @@ export function drive(m, r, sorts, code, opts = {}) {
617
622
  return undefined;
618
623
  };
619
624
  // A class's object: made by its constructor, or set to a snapshot.
620
- const drawParams = () => Object.fromEntries(m.params.map(v => [v.name, v.note?.startsWith('Date.now()') ? rand(10_000) : draw(v.sort, sorts, v.name, rand, consts, bound, strs)]));
625
+ // (a param the precondition fixes from the others, a start's quotient: computed from them)
626
+ const drawParams = () => {
627
+ const ps = Object.fromEntries(m.params.filter(v => !v.derived).map(v => [v.name, v.note?.startsWith('Date.now()') ? rand(10_000) : draw(v.sort, sorts, v.name, rand, consts, bound, strs)]));
628
+ for (const v of m.params) {
629
+ const d = v.derived;
630
+ if (d)
631
+ ps[v.name] = evalTerm(d, ps);
632
+ }
633
+ return ps;
634
+ };
621
635
  const start = (params) => {
622
636
  const ctorRefuses = (() => { const pre = evalTerm(m.pre, params); return pre !== true; })();
623
637
  let ps;
@@ -754,7 +768,14 @@ export function drive(m, r, sorts, code, opts = {}) {
754
768
  catch {
755
769
  continue;
756
770
  }
757
- const v = proveSteps(r, [], [law], { search: false });
771
+ // (a probe the prover can't state is skipped: probes only add requests to compare)
772
+ let v;
773
+ try {
774
+ v = proveSteps(r, [], [law], { search: false });
775
+ }
776
+ catch {
777
+ continue;
778
+ }
758
779
  if (v.proven || !v.witness)
759
780
  continue;
760
781
  ev.probes.witnesses++;
@@ -0,0 +1,16 @@
1
+ import { type Extraction } from './extract.js';
2
+ import { type FileURL } from './extract-read.js';
3
+ import { type SModule, type StepOptions, type StepRead } from './extract-step.js';
4
+ export { proveRule, proveSteps } from './dsl.js';
5
+ export type ExOptions = StepOptions & {
6
+ elixir?: string;
7
+ };
8
+ type ExModule = SModule & {
9
+ shape?: string;
10
+ msgs?: Record<string, unknown>;
11
+ init?: unknown;
12
+ };
13
+ export declare function readElixir(file: string, module: string | undefined, elixir?: string): ExModule;
14
+ export declare function extractElixir(at: string | FileURL, opts?: ExOptions): Extraction & {
15
+ read?: StepRead;
16
+ };
@@ -0,0 +1,33 @@
1
+ import { Refusal, pathOf } from "./extract-read.js";
2
+ import { extractStep, node } from "./extract-step.js";
3
+ export { proveRule, proveSteps } from "./dsl.js";
4
+ const here = (f) => new URL(`./ex/${f}`, import.meta.url).pathname;
5
+ export function readElixir(file, module, elixir = 'elixir') {
6
+ const cp = node('node:child_process'), path = node('node:path');
7
+ let out;
8
+ try {
9
+ out = cp.execFileSync(elixir, [here('reader.exs'), JSON.stringify({ file: path.resolve(file), module: module ?? null })], { encoding: 'utf8', maxBuffer: 1 << 29, stdio: ['ignore', 'pipe', 'pipe'] });
10
+ }
11
+ catch (e) {
12
+ throw new Refusal(file, `the Elixir reader didn't run (${String(e.stderr ?? e.message).split('\n').filter(Boolean).slice(0, 2).join(' | ')}): elixir is needed to extract Elixir`);
13
+ }
14
+ return JSON.parse(out);
15
+ }
16
+ export function extractElixir(at, opts = {}) {
17
+ const file = pathOf(at);
18
+ let mod;
19
+ try {
20
+ if (opts.stores && Object.keys(opts.stores).length)
21
+ throw new Refusal(file, 'stores: not in the Elixir front end yet');
22
+ if (Array.isArray(opts.entry))
23
+ throw new Refusal(file, 'one module a time (entry: its name)');
24
+ mod = readElixir(file, opts.entry, opts.elixir);
25
+ }
26
+ catch (e) {
27
+ if (e instanceof Refusal)
28
+ return { ok: false, refusals: [{ where: e.where, what: e.what }], notes: [] };
29
+ throw e;
30
+ }
31
+ const harness = () => ({ cmd: opts.elixir ?? 'elixir', args: [here('harness.exs')], hello: { path: mod.path, module: mod.module, shape: mod.shape, msgs: mod.msgs, init: mod.init } });
32
+ return extractStep(mod, harness, opts);
33
+ }
@@ -0,0 +1,28 @@
1
+ import type { Rule } from './dsl.js';
2
+ import type { Sorts } from './extract-print.js';
3
+ import { type Coverage, type Evidence } from './extract-check.js';
4
+ import { type GoOptions, type GoPkg, type GoRead } from './extract-go.js';
5
+ export type GoLeaf = {
6
+ name: string;
7
+ path: string[];
8
+ kind: 'int' | 'bool' | 'str' | 'big' | 'bignil' | 'map' | 'mapnil' | 'list' | 'frame';
9
+ t: number;
10
+ go: string;
11
+ };
12
+ export type GoCheckOptions = {
13
+ runs?: number;
14
+ depth?: number;
15
+ states?: number;
16
+ seed?: number;
17
+ bound?: number;
18
+ probes?: boolean;
19
+ keep?: string;
20
+ };
21
+ export type GoEvidence = Evidence & {
22
+ buildMs: number;
23
+ runMs: number;
24
+ };
25
+ export declare function checkGo(dir: string, pkg: GoPkg, read: GoRead, r: Rule, sorts: Sorts, gopts: GoOptions): GoEvidence;
26
+ export declare function speak(work: string, bin: string, env: Record<string, string | undefined> | undefined, pkg: GoPkg, read: GoRead, r: Rule, sorts: Sorts, opts: GoCheckOptions, count: () => Coverage): Evidence & {
27
+ runMs: number;
28
+ };