lawspec 0.31.1 → 0.31.3
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/CHANGELOG.md +89 -2
- package/README.md +85 -9
- package/api.mjs +14 -9
- package/authoring.mjs +899 -0
- package/beam-coverage.mjs +190 -65
- package/beam-doctor.mjs +343 -124
- package/bin/lawspec.mjs +1949 -661
- package/build.json +134 -128
- package/component-packages.mjs +662 -176
- package/component.d.ts +82 -20
- package/component.mjs +317 -94
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -5
- package/doctor.mjs +558 -299
- package/examples-command.mjs +44 -23
- package/failure-database.mjs +60 -17
- package/files.mjs +122 -62
- package/index.d.ts +585 -312
- package/input-files.mjs +90 -25
- package/launcher.mjs +72 -31
- package/learn/coverage.json +184 -112
- package/learn/curriculum.json +4 -1
- package/learn/vendor/fantomas/{LawSpec.Learn.Formatter.5arcua4vy0.wasm → LawSpec.Learn.Formatter.poiijdbsl9.wasm} +0 -0
- package/learn/vendor/fantomas/dotnet.js +3 -3
- package/learn/vendor/manifest.json +4 -8
- package/lsp.mjs +444 -133
- package/mcp.mjs +250 -0
- package/native-evidence.mjs +668 -182
- package/native-examples.mjs +56 -19
- package/native-host.mjs +136 -42
- package/native-parsers/clojure.LICENSE +121 -0
- package/native-parsers/clojure.wasm +0 -0
- package/native-parsers/csharp.LICENSE +21 -0
- package/native-parsers/csharp.wasm +0 -0
- package/native-parsers/elixir.LICENSE +176 -0
- package/native-parsers/elixir.wasm +0 -0
- package/native-parsers/erlang.LICENSE +201 -0
- package/native-parsers/erlang.wasm +0 -0
- package/native-parsers/fsharp.LICENSE +21 -0
- package/native-parsers/fsharp.wasm +0 -0
- package/native-parsers/gleam.LICENSE +202 -0
- package/native-parsers/gleam.wasm +0 -0
- package/native-parsers/go.LICENSE +21 -0
- package/native-parsers/go.wasm +0 -0
- package/native-parsers/groovy.LICENSE +21 -0
- package/native-parsers/groovy.wasm +0 -0
- package/native-parsers/haskell.LICENSE +21 -0
- package/native-parsers/haskell.wasm +0 -0
- package/native-parsers/java.LICENSE +21 -0
- package/native-parsers/java.wasm +0 -0
- package/native-parsers/javascript.LICENSE +21 -0
- package/native-parsers/javascript.wasm +0 -0
- package/native-parsers/kotlin.LICENSE +9 -0
- package/native-parsers/kotlin.wasm +0 -0
- package/native-parsers/lock.json +114 -0
- package/native-parsers/prolog.LICENSE +21 -0
- package/native-parsers/prolog.wasm +0 -0
- package/native-parsers/python.LICENSE +21 -0
- package/native-parsers/python.wasm +0 -0
- package/native-parsers/rust.LICENSE +21 -0
- package/native-parsers/rust.wasm +0 -0
- package/native-parsers/scala.LICENSE +21 -0
- package/native-parsers/scala.wasm +0 -0
- package/native-parsers/swift.LICENSE +21 -0
- package/native-parsers/swift.wasm +0 -0
- package/native-parsers/typescript.LICENSE +21 -0
- package/native-parsers/typescript.wasm +0 -0
- package/node-events-reporter.mjs +41 -17
- package/package.json +4 -3
- package/project.mjs +338 -0
- package/proof.d.ts +93 -19
- package/proof.mjs +1538 -447
- package/read-only-hpack.mjs +6 -5
- package/scala-build-state.mjs +131 -41
- package/scala-coverage.mjs +57 -34
- package/scalars.mjs +23 -8
- package/templates.mjs +566 -617
- package/test-command.mjs +1671 -521
- package/learn/vendor/fantomas/LawSpec.Learn.Formatter.u1ne3a6xd2.wasm +0 -0
package/project.mjs
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
// Generated from templates/npm/project.mjs by lawspec-dev generate. Do not edit.
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {fileURLToPath} from 'node:url';
|
|
4
|
+
import {lstat, mkdir, readFile} from 'node:fs/promises';
|
|
5
|
+
import {spawnSync} from 'node:child_process';
|
|
6
|
+
import {initialize} from 'ricestax/setup.mjs';
|
|
7
|
+
import {createCompiler} from './api.mjs';
|
|
8
|
+
import {readManifest, writeManifest, dependencyRanges} from './component.mjs';
|
|
9
|
+
import {resolveDependencies} from './component-packages.mjs';
|
|
10
|
+
import {atomicWrite, collectSources, safePath} from './files.mjs';
|
|
11
|
+
// Rice's Tax owns Canon setup and grammars; its exact npm version is pinned.
|
|
12
|
+
export const canonSetupVersion = '0.3.2';
|
|
13
|
+
const rice = fileURLToPath(import.meta.resolve('ricestax/bin/ricestax.mjs'));
|
|
14
|
+
const cli = fileURLToPath(new URL('./bin/lawspec.mjs', import.meta.url));
|
|
15
|
+
async function exists(file)
|
|
16
|
+
{
|
|
17
|
+
try
|
|
18
|
+
{
|
|
19
|
+
await lstat(file);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch (error)
|
|
23
|
+
{
|
|
24
|
+
if (error.code === 'ENOENT')
|
|
25
|
+
{
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function run(root, file, args, node = true)
|
|
32
|
+
{
|
|
33
|
+
const result = spawnSync(
|
|
34
|
+
node ? process.execPath : file,
|
|
35
|
+
node ? [file, ...args] : args,
|
|
36
|
+
{cwd: root, encoding: 'utf8', maxBuffer: 32 * 1024 * 1024},
|
|
37
|
+
);
|
|
38
|
+
let data;
|
|
39
|
+
try
|
|
40
|
+
{
|
|
41
|
+
data = JSON.parse(result.stdout);
|
|
42
|
+
}
|
|
43
|
+
catch
|
|
44
|
+
{
|
|
45
|
+
/* Canon emits text. */
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
status:
|
|
49
|
+
result.error || result.signal
|
|
50
|
+
? 'incomplete'
|
|
51
|
+
: result.status === 0
|
|
52
|
+
? 'passed'
|
|
53
|
+
: result.status === 2
|
|
54
|
+
? 'incomplete'
|
|
55
|
+
: 'failed',
|
|
56
|
+
exitCode: result.status,
|
|
57
|
+
...(data === undefined ? {output: result.stdout ?? ''} : {result: data}),
|
|
58
|
+
...(result.stderr || result.error
|
|
59
|
+
? {detail: result.error?.message ?? result.stderr}
|
|
60
|
+
: {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async function inspectCanon(root, validate)
|
|
64
|
+
{
|
|
65
|
+
if (!(await exists(path.join(root, 'canon.yaml'))))
|
|
66
|
+
{
|
|
67
|
+
return {
|
|
68
|
+
status: 'incomplete',
|
|
69
|
+
detail: 'No canon.yaml; run lawspec project adopt',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const config = await readFile(path.join(root, 'canon.yaml'), 'utf8');
|
|
73
|
+
const expected =
|
|
74
|
+
config.match(/^canon:\s*["']?([\d.x]+)/m)?.[1] ??
|
|
75
|
+
config.match(/"canon"\s*:\s*"([\d.x]+)"/)?.[1];
|
|
76
|
+
const binary = process.env.CANON;
|
|
77
|
+
const version = binary
|
|
78
|
+
? run(root, binary, ['version'], false)
|
|
79
|
+
: run(root, rice, ['canon', 'version']);
|
|
80
|
+
const actual = version.output?.match(/canon\s+(\d+\.\d+\.\d+)/)?.[1];
|
|
81
|
+
if (
|
|
82
|
+
version.status !== 'passed' ||
|
|
83
|
+
!actual ||
|
|
84
|
+
(expected &&
|
|
85
|
+
expected.split('.').slice(0, 2).join('.') !==
|
|
86
|
+
actual.split('.').slice(0, 2).join('.'))
|
|
87
|
+
)
|
|
88
|
+
{
|
|
89
|
+
return {
|
|
90
|
+
status: 'incomplete',
|
|
91
|
+
expectedVersion: expected,
|
|
92
|
+
actualVersion: actual,
|
|
93
|
+
detail:
|
|
94
|
+
'Canon version unavailable or incompatible. Set CANON to the matching native executable; existing metadata is preserved.',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const args = [validate ? 'check' : 'decisions'];
|
|
98
|
+
return {
|
|
99
|
+
...(binary
|
|
100
|
+
? run(root, binary, args, false)
|
|
101
|
+
: run(root, rice, ['canon', ...args])),
|
|
102
|
+
version: actual,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export async function setupProject(
|
|
106
|
+
root,
|
|
107
|
+
{adopt = false, languages = ['folio']} = {},
|
|
108
|
+
)
|
|
109
|
+
{
|
|
110
|
+
root = path.resolve(root);
|
|
111
|
+
// Complete preflight before invoking the upstream initializer or writing files.
|
|
112
|
+
for (const old of ['lawspec.json', 'lawspec-package.json'])
|
|
113
|
+
{
|
|
114
|
+
if (await exists(path.join(root, old)))
|
|
115
|
+
{
|
|
116
|
+
throw new Error(`${old} is no longer supported; use lawspec.edn`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const hasManifest = await exists(path.join(root, 'lawspec.edn'));
|
|
120
|
+
const hasCanon = await exists(path.join(root, 'canon.yaml'));
|
|
121
|
+
if (!adopt && (hasManifest || hasCanon))
|
|
122
|
+
{
|
|
123
|
+
throw new Error(
|
|
124
|
+
'Project metadata already exists; use lawspec project adopt',
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
if (hasManifest)
|
|
128
|
+
{
|
|
129
|
+
await readManifest(path.join(root, 'lawspec.edn'));
|
|
130
|
+
}
|
|
131
|
+
if (!hasCanon && (await exists(path.join(root, '.ricestax'))))
|
|
132
|
+
{
|
|
133
|
+
throw new Error(
|
|
134
|
+
'.ricestax exists without canon.yaml; review the incomplete Canon setup',
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
const manifest = {
|
|
138
|
+
manifestVersion: 1,
|
|
139
|
+
component: {
|
|
140
|
+
name: path.basename(root).replace(/[^A-Za-z0-9_.-]/g, '-'),
|
|
141
|
+
version: '0.1.0',
|
|
142
|
+
},
|
|
143
|
+
languageProfile: '1.0-rc.2',
|
|
144
|
+
verification: {layers: []},
|
|
145
|
+
sources: ['laws'],
|
|
146
|
+
targets: [],
|
|
147
|
+
};
|
|
148
|
+
// A tiny empty unit makes mandatory validation available before choosing a target.
|
|
149
|
+
const starter = !hasManifest && !(await exists(path.join(root, 'laws')));
|
|
150
|
+
await mkdir(root, {recursive: true});
|
|
151
|
+
if (!hasCanon)
|
|
152
|
+
{
|
|
153
|
+
await initialize(root, languages);
|
|
154
|
+
// Upstream setup does not create a decision ledger. Never replace an existing one.
|
|
155
|
+
for (const name of [
|
|
156
|
+
'canonical_decisions.yaml',
|
|
157
|
+
'canonical_refs.yaml',
|
|
158
|
+
'canonical_exemptions.yaml',
|
|
159
|
+
])
|
|
160
|
+
{
|
|
161
|
+
if (!(await exists(path.join(root, name))))
|
|
162
|
+
{
|
|
163
|
+
await atomicWrite(await safePath(root, name), '{}\n', true);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (!hasManifest)
|
|
168
|
+
{
|
|
169
|
+
if (starter)
|
|
170
|
+
{
|
|
171
|
+
await atomicWrite(
|
|
172
|
+
await safePath(root, 'laws/project.lawspec'),
|
|
173
|
+
'unit project\nend unit\n',
|
|
174
|
+
true,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
await atomicWrite(
|
|
178
|
+
await safePath(root, 'lawspec.edn'),
|
|
179
|
+
writeManifest(manifest),
|
|
180
|
+
true,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
root,
|
|
185
|
+
manifest: hasManifest ? 'preserved' : 'created',
|
|
186
|
+
canon: hasCanon ? 'preserved' : 'created',
|
|
187
|
+
canonSetup: `ricestax@${canonSetupVersion}`,
|
|
188
|
+
applicationFilesChanged: false,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
export async function inspectProject(
|
|
192
|
+
root,
|
|
193
|
+
{validate = false, configFile = path.join(root, 'lawspec.edn')} = {},
|
|
194
|
+
)
|
|
195
|
+
{
|
|
196
|
+
root = path.resolve(root);
|
|
197
|
+
configFile = path.resolve(configFile);
|
|
198
|
+
const canon = await inspectCanon(root, validate).catch(error => ({
|
|
199
|
+
status: 'incomplete',
|
|
200
|
+
detail: error.message,
|
|
201
|
+
}));
|
|
202
|
+
const report = {root, canon};
|
|
203
|
+
try
|
|
204
|
+
{
|
|
205
|
+
const manifest = await readManifest(configFile);
|
|
206
|
+
const compiler = await createCompiler();
|
|
207
|
+
const dependencies = await resolveDependencies(configFile, manifest, {
|
|
208
|
+
writeLock: false,
|
|
209
|
+
});
|
|
210
|
+
const input = {
|
|
211
|
+
sources: await collectSources(root, manifest.sources),
|
|
212
|
+
languageProfile: manifest.languageProfile,
|
|
213
|
+
machineBits: manifest.machineBits ?? 64,
|
|
214
|
+
packages: dependencies.packages,
|
|
215
|
+
dependencies: dependencyRanges(manifest),
|
|
216
|
+
...(manifest.package ? {package: manifest.package} : {}),
|
|
217
|
+
projectVersion: manifest.component?.version ?? manifest.package?.version,
|
|
218
|
+
now: new Date().toISOString(),
|
|
219
|
+
};
|
|
220
|
+
const checked = await compiler.check({
|
|
221
|
+
...input,
|
|
222
|
+
verification: {layers: []},
|
|
223
|
+
});
|
|
224
|
+
report.definitions = {
|
|
225
|
+
status: checked.diagnostics?.length ? 'failed' : 'passed',
|
|
226
|
+
diagnostics: checked.diagnostics ?? [],
|
|
227
|
+
};
|
|
228
|
+
report.verification = {
|
|
229
|
+
layers: manifest.verification?.layers ?? [],
|
|
230
|
+
status: 'not-verified',
|
|
231
|
+
evidence: checked.evidence,
|
|
232
|
+
};
|
|
233
|
+
if (validate && report.definitions.status === 'passed')
|
|
234
|
+
{
|
|
235
|
+
const selected = await compiler.check({
|
|
236
|
+
...input,
|
|
237
|
+
verification: manifest.verification ?? {layers: []},
|
|
238
|
+
});
|
|
239
|
+
report.verification = {
|
|
240
|
+
layers: manifest.verification?.layers ?? [],
|
|
241
|
+
status: selected.diagnostics?.length
|
|
242
|
+
? 'failed'
|
|
243
|
+
: manifest.verification?.layers?.length
|
|
244
|
+
? 'completed'
|
|
245
|
+
: 'not-verified',
|
|
246
|
+
selection: selected.verification,
|
|
247
|
+
diagnostics: selected.diagnostics ?? [],
|
|
248
|
+
evidence: selected.evidence,
|
|
249
|
+
};
|
|
250
|
+
if (report.verification.layers.includes('proof'))
|
|
251
|
+
{
|
|
252
|
+
report.proof = run(root, cli, [
|
|
253
|
+
'prove',
|
|
254
|
+
'--config',
|
|
255
|
+
configFile,
|
|
256
|
+
'--json',
|
|
257
|
+
]);
|
|
258
|
+
// Solver discharge settles the previously generated obligations. Keep
|
|
259
|
+
// its original rows, rather than reporting the pre-solver incompleteness.
|
|
260
|
+
if (Array.isArray(report.proof.result?.evidence))
|
|
261
|
+
{
|
|
262
|
+
report.verification.evidence = report.proof.result.evidence;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (
|
|
266
|
+
report.verification.layers.some(layer =>
|
|
267
|
+
['property', 'examples', 'exhaustive', 'model'].includes(layer),
|
|
268
|
+
)
|
|
269
|
+
)
|
|
270
|
+
{
|
|
271
|
+
report.native = manifest.targets?.length
|
|
272
|
+
? run(root, cli, ['test', '--config', configFile, '--json'])
|
|
273
|
+
: {
|
|
274
|
+
status: 'incomplete',
|
|
275
|
+
detail: 'Selected execution layers have no application target',
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
catch (error)
|
|
281
|
+
{
|
|
282
|
+
if (!report.definitions)
|
|
283
|
+
{
|
|
284
|
+
report.definitions = {
|
|
285
|
+
status: 'incomplete',
|
|
286
|
+
detail: error.message,
|
|
287
|
+
diagnostics: error.diagnostics ?? [],
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
else
|
|
291
|
+
{
|
|
292
|
+
report.verification = {
|
|
293
|
+
...report.verification,
|
|
294
|
+
status: 'incomplete',
|
|
295
|
+
detail: error.message,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return report;
|
|
300
|
+
}
|
|
301
|
+
export function projectExitCode(report)
|
|
302
|
+
{
|
|
303
|
+
if (
|
|
304
|
+
[
|
|
305
|
+
report.canon,
|
|
306
|
+
report.definitions,
|
|
307
|
+
report.verification,
|
|
308
|
+
report.proof,
|
|
309
|
+
report.native,
|
|
310
|
+
].some(row => row?.status === 'failed')
|
|
311
|
+
)
|
|
312
|
+
{
|
|
313
|
+
return 1;
|
|
314
|
+
}
|
|
315
|
+
const evidence = report.verification?.evidence;
|
|
316
|
+
const rows =
|
|
317
|
+
evidence?.obligations ?? (Array.isArray(evidence) ? evidence : []);
|
|
318
|
+
if (rows.some(row => row.status === 'refuted'))
|
|
319
|
+
{
|
|
320
|
+
return 1;
|
|
321
|
+
}
|
|
322
|
+
if (
|
|
323
|
+
[
|
|
324
|
+
report.canon,
|
|
325
|
+
report.definitions,
|
|
326
|
+
report.verification,
|
|
327
|
+
report.proof,
|
|
328
|
+
report.native,
|
|
329
|
+
].some(row => row?.status === 'incomplete') ||
|
|
330
|
+
rows.some(row =>
|
|
331
|
+
['unknown', 'unsupported', 'incomplete', 'pending'].includes(row.status),
|
|
332
|
+
)
|
|
333
|
+
)
|
|
334
|
+
{
|
|
335
|
+
return 2;
|
|
336
|
+
}
|
|
337
|
+
return 0;
|
|
338
|
+
}
|
package/proof.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// Generated from templates/npm/proof.d.ts by lawspec-dev generate. Do not edit.
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
CheckRequest,
|
|
4
|
+
Compiler,
|
|
5
|
+
Location,
|
|
6
|
+
Recursion,
|
|
7
|
+
Result,
|
|
8
|
+
} from './index.d.ts';
|
|
3
9
|
|
|
4
|
-
export interface Z3Options
|
|
10
|
+
export interface Z3Options
|
|
11
|
+
{
|
|
5
12
|
binary?: string;
|
|
6
13
|
timeoutMs?: number;
|
|
7
14
|
memoryMb?: number;
|
|
@@ -10,12 +17,28 @@ export interface Z3Options {
|
|
|
10
17
|
maxOutputBytes?: number;
|
|
11
18
|
}
|
|
12
19
|
/** How a solver run went: shared by law and law-set evidence. */
|
|
13
|
-
interface SolverRun
|
|
20
|
+
interface SolverRun
|
|
21
|
+
{
|
|
14
22
|
/** Current task binding when a semantic result reuses an earlier execution. */
|
|
15
23
|
currentTaskFingerprint?: string;
|
|
16
24
|
/** Provenance of the completed execution reused; no fresh solver run occurred. */
|
|
17
|
-
reused?: {
|
|
18
|
-
|
|
25
|
+
reused?: {
|
|
26
|
+
key: string;
|
|
27
|
+
owner: string;
|
|
28
|
+
declaration: string;
|
|
29
|
+
taskFingerprint: string;
|
|
30
|
+
runFingerprint: string;
|
|
31
|
+
};
|
|
32
|
+
outcome:
|
|
33
|
+
| 'unsat'
|
|
34
|
+
| 'sat'
|
|
35
|
+
| 'unknown'
|
|
36
|
+
| 'timeout'
|
|
37
|
+
| 'resource-limit'
|
|
38
|
+
| 'out-of-memory'
|
|
39
|
+
| 'unavailable'
|
|
40
|
+
| 'failed'
|
|
41
|
+
| 'unsupported';
|
|
19
42
|
reason: string;
|
|
20
43
|
stdout?: string;
|
|
21
44
|
stderr?: string;
|
|
@@ -23,11 +46,19 @@ interface SolverRun {
|
|
|
23
46
|
exitCode?: number | null;
|
|
24
47
|
signal?: string | null;
|
|
25
48
|
runFingerprint?: string;
|
|
26
|
-
prover?: {
|
|
49
|
+
prover?: {
|
|
50
|
+
name: 'z3';
|
|
51
|
+
version: string;
|
|
52
|
+
binary: string;
|
|
53
|
+
binaryFingerprint: string;
|
|
54
|
+
fingerprint: string;
|
|
55
|
+
arguments: string[];
|
|
56
|
+
};
|
|
27
57
|
configuration?: Required<Z3Options>;
|
|
28
58
|
}
|
|
29
59
|
/** A law's proof task, run by Z3. */
|
|
30
|
-
export interface LawSolverEvidence extends SolverRun
|
|
60
|
+
export interface LawSolverEvidence extends SolverRun
|
|
61
|
+
{
|
|
31
62
|
kind?: undefined;
|
|
32
63
|
owner: string;
|
|
33
64
|
declaration: string;
|
|
@@ -37,24 +68,54 @@ export interface LawSolverEvidence extends SolverRun {
|
|
|
37
68
|
lawFingerprint: string;
|
|
38
69
|
taskFingerprint?: string;
|
|
39
70
|
/** Current names for the same semantic induction plan; original cases remain in induction. */
|
|
40
|
-
currentInduction?: {on:string; using:string[]};
|
|
71
|
+
currentInduction?: {on: string; using: string[]};
|
|
41
72
|
status: 'proved' | 'refuted' | 'incomplete' | 'unsupported';
|
|
42
73
|
model?: string;
|
|
43
74
|
modelValidated?: boolean;
|
|
44
|
-
counterexample?: {
|
|
45
|
-
|
|
75
|
+
counterexample?: {
|
|
76
|
+
inputs: {name: string; value: string}[];
|
|
77
|
+
values: string;
|
|
78
|
+
fingerprint: string;
|
|
79
|
+
runFingerprint: string;
|
|
80
|
+
check: 'refuted' | 'model-not-confirmed' | 'incomplete';
|
|
81
|
+
};
|
|
46
82
|
/** For a law over recursive definitions: the encoding of the run reported,
|
|
47
83
|
and each encoding tried, in order. */
|
|
48
84
|
recursion?: Recursion;
|
|
49
|
-
attempts?: {
|
|
85
|
+
attempts?: {
|
|
86
|
+
recursion: Recursion;
|
|
87
|
+
taskFingerprint: string;
|
|
88
|
+
outcome: SolverRun['outcome'];
|
|
89
|
+
runFingerprint?: string;
|
|
90
|
+
elapsedMs?: number;
|
|
91
|
+
}[];
|
|
50
92
|
/** Induction on an input: the cited laws, and each case's receipt. */
|
|
51
|
-
induction?: {
|
|
52
|
-
|
|
53
|
-
|
|
93
|
+
induction?: {
|
|
94
|
+
on: string;
|
|
95
|
+
using: string[];
|
|
96
|
+
asked?: boolean;
|
|
97
|
+
cases: {
|
|
98
|
+
case: string;
|
|
99
|
+
outcome?: SolverRun['outcome'];
|
|
100
|
+
recursion?: Recursion;
|
|
101
|
+
taskFingerprint?: string;
|
|
102
|
+
runFingerprint?: string;
|
|
103
|
+
values?: string;
|
|
104
|
+
reason?: string;
|
|
105
|
+
attempts?: {
|
|
106
|
+
recursion: Recursion;
|
|
107
|
+
taskFingerprint: string;
|
|
108
|
+
outcome: SolverRun['outcome'];
|
|
109
|
+
runFingerprint?: string;
|
|
110
|
+
elapsedMs?: number;
|
|
111
|
+
}[];
|
|
112
|
+
}[];
|
|
113
|
+
};
|
|
54
114
|
}
|
|
55
115
|
/** A law-set check's task (completeness, overlap, conflict or vacuity).
|
|
56
116
|
status is the task's own result; check is its row's. */
|
|
57
|
-
export interface AnalysisSolverEvidence extends SolverRun
|
|
117
|
+
export interface AnalysisSolverEvidence extends SolverRun
|
|
118
|
+
{
|
|
58
119
|
kind: 'analysis';
|
|
59
120
|
owner: string;
|
|
60
121
|
declaration: string;
|
|
@@ -69,7 +130,8 @@ export interface AnalysisSolverEvidence extends SolverRun {
|
|
|
69
130
|
}
|
|
70
131
|
/** A model law's task: induction, Spacer, an invariant re-check or the
|
|
71
132
|
bounded run search; the law's own row says what they settled. */
|
|
72
|
-
export interface ModelSolverEvidence extends SolverRun
|
|
133
|
+
export interface ModelSolverEvidence extends SolverRun
|
|
134
|
+
{
|
|
73
135
|
kind: 'model';
|
|
74
136
|
owner: string;
|
|
75
137
|
declaration: string;
|
|
@@ -81,6 +143,18 @@ export interface ModelSolverEvidence extends SolverRun {
|
|
|
81
143
|
modelValidated?: undefined;
|
|
82
144
|
counterexample?: undefined;
|
|
83
145
|
}
|
|
84
|
-
export type SolverEvidence =
|
|
85
|
-
|
|
86
|
-
export function
|
|
146
|
+
export type SolverEvidence =
|
|
147
|
+
LawSolverEvidence | AnalysisSolverEvidence | ModelSolverEvidence;
|
|
148
|
+
export function proofTaskFingerprint(task: {
|
|
149
|
+
encoding: string;
|
|
150
|
+
lawFingerprint: string;
|
|
151
|
+
machineBits: number;
|
|
152
|
+
owner: string;
|
|
153
|
+
declaration: string;
|
|
154
|
+
script: string;
|
|
155
|
+
}): string;
|
|
156
|
+
export function proveWithZ3(
|
|
157
|
+
compiler: Compiler,
|
|
158
|
+
request: CheckRequest,
|
|
159
|
+
options?: Z3Options,
|
|
160
|
+
): Promise<Result & {solverEvidence: SolverEvidence[]}>;
|