tslaws 1.0.0 → 1.2.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 (51) hide show
  1. package/README.md +183 -187
  2. package/dist/api.d.ts +86 -0
  3. package/dist/api.js +78 -0
  4. package/dist/badge.d.ts +111 -0
  5. package/dist/badge.js +288 -0
  6. package/dist/browser.d.ts +5 -2
  7. package/dist/browser.js +403 -173
  8. package/dist/browserApi.d.ts +305 -0
  9. package/dist/browserApi.js +456 -0
  10. package/dist/browserServer.d.ts +13 -0
  11. package/dist/browserServer.js +406 -0
  12. package/dist/certificates.js +50 -28
  13. package/dist/chc.d.ts +13 -1
  14. package/dist/chc.js +40 -8
  15. package/dist/check.js +64 -36
  16. package/dist/cli.d.ts +16 -0
  17. package/dist/cli.js +78 -1
  18. package/dist/compile.js +46 -5
  19. package/dist/coverage.d.ts +17 -0
  20. package/dist/coverage.js +297 -24
  21. package/dist/derived.d.ts +2 -0
  22. package/dist/derived.js +9 -4
  23. package/dist/generators.d.ts +5 -1
  24. package/dist/generators.js +50 -4
  25. package/dist/githubCli.js +88 -15
  26. package/dist/isolate.d.ts +5 -0
  27. package/dist/isolate.js +1 -1
  28. package/dist/lawHost.d.ts +2 -0
  29. package/dist/lawHost.js +32 -21
  30. package/dist/lawRuntime.d.ts +6 -0
  31. package/dist/lawRuntime.js +86 -7
  32. package/dist/nativeZ3.d.ts +11 -0
  33. package/dist/nativeZ3.js +162 -0
  34. package/dist/plan.d.ts +7 -0
  35. package/dist/plan.js +11 -0
  36. package/dist/pluginHooks.d.ts +4 -0
  37. package/dist/pluginHooks.js +13 -4
  38. package/dist/proofCache.d.ts +24 -0
  39. package/dist/proofCache.js +135 -0
  40. package/dist/property.d.ts +2 -2
  41. package/dist/property.js +33 -8
  42. package/dist/propertyWorker.js +14 -8
  43. package/dist/sandbox.d.ts +1 -1
  44. package/dist/sandbox.js +48 -8
  45. package/dist/seal.js +47 -8
  46. package/dist/smt.d.ts +16 -2
  47. package/dist/smt.js +241 -31
  48. package/dist/symbolic.d.ts +38 -3
  49. package/dist/symbolic.js +504 -47
  50. package/dist/types.d.ts +9 -0
  51. package/package.json +7 -7
@@ -0,0 +1,111 @@
1
+ import type { Certificate } from './certificates.ts';
2
+ import type { Lock } from './lock.ts';
3
+ import type { LawResult, LawStatus } from './types.ts';
4
+ /** The shields.io endpoint schema: https://shields.io/badges/endpoint-badge */
5
+ export interface Endpoint {
6
+ schemaVersion: 1;
7
+ label: string;
8
+ message: string;
9
+ color: 'brightgreen' | 'yellow' | 'red';
10
+ }
11
+ /** What a check concluded of a law. `tampered`, `uncovered` and `error` are failures of the check and count as `failed`. */
12
+ export type Outcome = 'proved' | 'bounded' | 'tested' | 'open' | 'failed';
13
+ /**
14
+ * Where a law stands with a certificate (a proof that a separate checker accepted).
15
+ * - `certified`: a checker accepted a proof of it.
16
+ * - `not-certifiable`: the proof format cannot check it. The law uses floating point or strings, which Alethe cannot
17
+ * express, or it was only tested or checked within a bound, so there is no proof to certify.
18
+ * - `not-certified`: a proof could be certified, but none was (certificates were off, or a tool was missing).
19
+ * - `rejected`: a certificate was tried and did not pass (cvc5 gave no proof, Carcara did not accept it, a timeout).
20
+ */
21
+ export type Certification = 'certified' | 'not-certifiable' | 'not-certified' | 'rejected';
22
+ /** What a badge or the certificates page reports of one law. */
23
+ export interface Standing {
24
+ outcome: Outcome;
25
+ certification: Certification;
26
+ /** For `not-certifiable`, `not-certified` and `rejected`: why, in the words of tslaws or of the tool. */
27
+ reason?: string;
28
+ /** For a tested or bounded law: how many random inputs ran. */
29
+ runs?: number;
30
+ /** For a tested, bounded or open law: what the prover said. */
31
+ note?: string;
32
+ }
33
+ export interface Badges {
34
+ laws: Endpoint;
35
+ certificates: Endpoint;
36
+ }
37
+ /** The files `tslaws badge` writes, and the repository's own gallery keeps beside its certificates. */
38
+ export declare const badgeFiles: {
39
+ readonly laws: "badge-laws.json";
40
+ readonly certificates: "badge-certificates.json";
41
+ };
42
+ /** What a check shows of a law: its status, the certificate of its proof if there is one, and whether the lock vouches for it. */
43
+ export interface LawFacts {
44
+ status: LawStatus;
45
+ certificate?: Pick<Certificate, 'status' | 'reason'>;
46
+ /** The lock records a certificate that is still for the law. */
47
+ certified?: boolean;
48
+ runs?: number;
49
+ message?: string;
50
+ }
51
+ /** The standing of a law. Only a `proved` law is certifiable: a tested, bounded or open one has no proof to check. */
52
+ export declare function standingOf(law: LawFacts): Standing;
53
+ /**
54
+ * The two badges as a breakdown, never "N of M".
55
+ *
56
+ * Laws, such as `7 proved · 1 tested`: red when a law failed, yellow when one is open or there are no laws, else green.
57
+ *
58
+ * Certificates, such as `7 certified · 1 not certifiable`: red when a law failed. Yellow when a law that could be
59
+ * certified has no certificate, or its certificate was rejected. Green otherwise: a law that cannot be certified does not
60
+ * count against the project.
61
+ */
62
+ export declare function badgesOf(laws: readonly Standing[]): Badges;
63
+ /**
64
+ * The standing of each law of a check. A law is certified when this run checked a proof of it, or when the lock records
65
+ * a certificate that is still for the law (`tslaws accept` verified it with Carcara before writing it).
66
+ */
67
+ export declare function standingsOf(results: readonly LawResult[], lock?: Lock): Standing[];
68
+ /** A reason a law cannot be certified, in plain words. Other reasons (a tool's own message) are shown as they are. */
69
+ export declare function plainReason(reason: string): string;
70
+ /** The status of a law in a table, in words that need no knowledge of solvers. */
71
+ export declare function statusWords(standing: Standing): string;
72
+ /** The section that opens a certificates page. */
73
+ export declare const whatIsACertificate: readonly string[];
74
+ /** The summary of a certificates page: the laws grouped by what they can and cannot do. Deterministic for a given input. */
75
+ export declare function certificateSummary(laws: readonly {
76
+ name: string;
77
+ standing: Standing;
78
+ }[]): string[];
79
+ /** The text of the two files, one JSON object each. */
80
+ export declare function badgeTexts(badges: Badges): Record<string, string>;
81
+ /** Writes the two files into `dir` (made if missing) and returns their paths. */
82
+ export declare function writeBadges(dir: string, badges: Badges): string[];
83
+ /** `owner/name` of a GitHub remote URL (https, ssh or scp-style), or undefined for any other host. */
84
+ export declare function githubRepoOf(url: string): string | undefined;
85
+ /** The repository's GitHub name and top directory, from git; undefined parts when there is no repository or remote. */
86
+ export declare function gitFacts(cwd: string): {
87
+ repo?: string;
88
+ top?: string;
89
+ };
90
+ export interface MarkdownOptions {
91
+ /** `owner/name`; the markdown names `OWNER/REPO` when it is not known. */
92
+ repo?: string;
93
+ branch: string;
94
+ /** The directory of the two files, relative to the repository root, with `/` separators. */
95
+ dir: string;
96
+ /** Where both badges link; by default the certificates page in `dir` when `page` is set, else the project's lock. */
97
+ link?: string;
98
+ /** Whether `dir` holds a certificates page (see `writeCertificatesPage`). */
99
+ page?: boolean;
100
+ }
101
+ /** The markdown of both badges, ready to paste into a README. */
102
+ export declare function badgeMarkdown(options: MarkdownOptions): string;
103
+ /** `dir` as the repository root sees it (`/` separators), or as given when there is no repository. */
104
+ export declare function repoRelative(cwd: string, dir: string, top: string | undefined): string;
105
+ /**
106
+ * The certificates page of `tslaws badge`: what a certificate is, the laws grouped by what they can and cannot do, and
107
+ * every law with its status and, for a certified one, its proof files. They are copied from `.tslaws/certificates` into
108
+ * `certificates/` beside the page, so the page links files the repository holds. Writes nothing and returns false when no
109
+ * law is certified.
110
+ */
111
+ export declare function writeCertificatesPage(cwd: string, dir: string, results: readonly LawResult[], lock?: Lock): boolean;
package/dist/badge.js ADDED
@@ -0,0 +1,288 @@
1
+ // `tslaws badge`: the two shields.io endpoint badges of a project, "laws: 7 proved · 1 tested" and "certificates: 7
2
+ // certified · 1 not certifiable", as JSON files to commit, and the markdown that shows them. An endpoint badge reads its
3
+ // JSON from a URL, so a file in the repository served by raw.githubusercontent.com is enough: no GitHub Pages. See
4
+ // docs/certificates.md, "Badges".
5
+ import { spawnSync } from 'node:child_process';
6
+ import { copyFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
7
+ import { join, relative, resolve } from 'node:path';
8
+ import { certificateName, certificatesDir, noCertificate } from "./certificates.js";
9
+ import { isCertified, lawKey } from "./lock.js";
10
+ /** The files `tslaws badge` writes, and the repository's own gallery keeps beside its certificates. */
11
+ export const badgeFiles = { laws: 'badge-laws.json', certificates: 'badge-certificates.json' };
12
+ /** The reasons `uncertifiable` (certificates.ts) gives for floating point and strings both end "which Alethe proofs do not cover". */
13
+ const outsideAlethe = /Alethe proofs do not cover/;
14
+ function outcomeOf(status) {
15
+ return status === 'proved' || status === 'bounded' || status === 'tested' || status === 'open' ? status : 'failed';
16
+ }
17
+ /** The standing of a law. Only a `proved` law is certifiable: a tested, bounded or open one has no proof to check. */
18
+ export function standingOf(law) {
19
+ const outcome = outcomeOf(law.status);
20
+ const detail = {
21
+ ...(law.runs === undefined ? {} : { runs: law.runs }),
22
+ ...(law.message === undefined ? {} : { note: law.message }),
23
+ };
24
+ const { certificate } = law;
25
+ if (law.certified === true || certificate?.status === 'certified')
26
+ return { outcome, certification: 'certified', ...detail };
27
+ if (outcome !== 'proved')
28
+ return { outcome, certification: 'not-certifiable', ...detail };
29
+ const reason = certificate?.reason === undefined ? {} : { reason: certificate.reason };
30
+ if (certificate?.status === 'uncertified' &&
31
+ certificate.reason !== undefined &&
32
+ outsideAlethe.test(certificate.reason))
33
+ return { outcome, certification: 'not-certifiable', ...reason, ...detail };
34
+ if (certificate?.status === 'uncertified' && certificate.reason !== noCertificate.reason)
35
+ return { outcome, certification: 'rejected', ...reason, ...detail };
36
+ return { outcome, certification: 'not-certified', ...reason, ...detail };
37
+ }
38
+ /** `3 proved · 1 tested`: the non-zero counts in order, or `no laws`. */
39
+ function breakdown(counts) {
40
+ const parts = counts.filter(([count]) => count > 0).map(([count, word]) => `${count} ${word}`);
41
+ return parts.length === 0 ? 'no laws' : parts.join(' · ');
42
+ }
43
+ /**
44
+ * The two badges as a breakdown, never "N of M".
45
+ *
46
+ * Laws, such as `7 proved · 1 tested`: red when a law failed, yellow when one is open or there are no laws, else green.
47
+ *
48
+ * Certificates, such as `7 certified · 1 not certifiable`: red when a law failed. Yellow when a law that could be
49
+ * certified has no certificate, or its certificate was rejected. Green otherwise: a law that cannot be certified does not
50
+ * count against the project.
51
+ */
52
+ export function badgesOf(laws) {
53
+ const outcomes = (outcome) => laws.filter((law) => law.outcome === outcome).length;
54
+ const certifications = (wanted) => laws.filter((law) => law.outcome !== 'failed' && law.certification === wanted).length;
55
+ const failed = outcomes('failed');
56
+ const open = outcomes('open');
57
+ const missing = certifications('not-certified');
58
+ const rejected = certifications('rejected');
59
+ return {
60
+ laws: {
61
+ schemaVersion: 1,
62
+ label: 'laws',
63
+ message: breakdown([
64
+ [outcomes('proved'), 'proved'],
65
+ [outcomes('bounded'), 'bounded'],
66
+ [outcomes('tested'), 'tested'],
67
+ [open, 'open'],
68
+ [failed, 'failed'],
69
+ ]),
70
+ color: failed > 0 ? 'red' : open > 0 || laws.length === 0 ? 'yellow' : 'brightgreen',
71
+ },
72
+ certificates: {
73
+ schemaVersion: 1,
74
+ label: 'certificates',
75
+ message: breakdown([
76
+ [certifications('certified'), 'certified'],
77
+ [certifications('not-certifiable'), 'not certifiable'],
78
+ [missing, 'not certified'],
79
+ [rejected, 'certificate failed'],
80
+ [failed, 'failed'],
81
+ ]),
82
+ color: failed > 0 ? 'red' : missing + rejected > 0 || laws.length === 0 ? 'yellow' : 'brightgreen',
83
+ },
84
+ };
85
+ }
86
+ /**
87
+ * The standing of each law of a check. A law is certified when this run checked a proof of it, or when the lock records
88
+ * a certificate that is still for the law (`tslaws accept` verified it with Carcara before writing it).
89
+ */
90
+ export function standingsOf(results, lock) {
91
+ return results.map((result) => standingOf({
92
+ status: result.status,
93
+ certificate: result.certificate,
94
+ certified: isCertified(lock, lawKey(result.file, result.name)),
95
+ runs: result.runs,
96
+ message: result.message,
97
+ }));
98
+ }
99
+ const firstLine = (text) => text.split('\n')[0].trim();
100
+ /** A reason a law cannot be certified, in plain words. Other reasons (a tool's own message) are shown as they are. */
101
+ export function plainReason(reason) {
102
+ const needsNumbers = 'the proof checker only handles whole numbers and true/false logic today.';
103
+ if (/floating-point/.test(reason))
104
+ return `uses decimal (floating-point) numbers; ${needsNumbers} Use \`int\` or \`bigint\` to get a certificate.`;
105
+ if (/strings/.test(reason))
106
+ return `uses text (strings); ${needsNumbers}`;
107
+ return reason;
108
+ }
109
+ /** The status of a law in a table, in words that need no knowledge of solvers. */
110
+ export function statusWords(standing) {
111
+ const base = {
112
+ proved: 'Proved',
113
+ bounded: 'Proved within a bound',
114
+ tested: 'Tested, not proved',
115
+ open: 'Not resolved',
116
+ failed: 'Failed',
117
+ }[standing.outcome];
118
+ if (standing.certification === 'certified')
119
+ return `${base}, independently checked`;
120
+ if (standing.outcome !== 'proved')
121
+ return base;
122
+ return {
123
+ 'not-certifiable': `${base}, can't be certified`,
124
+ 'not-certified': `${base}, not yet checked`,
125
+ rejected: `${base}, the check failed`,
126
+ certified: base,
127
+ }[standing.certification];
128
+ }
129
+ /** The section that opens a certificates page. */
130
+ export const whatIsACertificate = [
131
+ '## What is a certificate?',
132
+ '',
133
+ "tslaws proves a law with a solver. A certificate is the solver's proof written to a file, and a separate, independent checker ([Carcara](https://github.com/ufmg-smite/carcara)) re-checks every step of it. You don't have to trust tslaws or the solver: anyone can re-run the check. A law can only get a certificate if the proof format can express it. Today that means whole numbers and true/false logic, so a law about decimal numbers is proved but has no certificate.",
134
+ '',
135
+ ];
136
+ const groups = [
137
+ {
138
+ title: 'Proved and independently checked',
139
+ intro: 'A solver proved each of these laws, and Carcara re-checked every step of its proof.',
140
+ always: true,
141
+ has: (s) => s.certification === 'certified',
142
+ line: (name) => `- **${name}**`,
143
+ },
144
+ {
145
+ title: "Proved, but the proof can't be checked independently yet",
146
+ intro: 'A solver proved each of these laws, but no certificate that the checker accepted is on record. Run `tslaws check --certify` with cvc5 and Carcara installed to make them.',
147
+ always: true,
148
+ has: (s) => s.outcome === 'proved' && (s.certification === 'not-certified' || s.certification === 'rejected'),
149
+ line: (name, s) => `- **${name}**${s.reason === undefined ? '' : `: ${s.certification === 'rejected' ? `the check did not pass (${s.reason})` : s.reason}`}`,
150
+ },
151
+ {
152
+ title: 'Tested, not proved',
153
+ intro: 'These laws were run on random inputs. Passing is evidence, not a proof that they hold for every input, so there is nothing to certify.',
154
+ always: true,
155
+ has: (s) => s.outcome === 'tested' && s.certification !== 'certified',
156
+ line: (name, s) => `- **${name}**: ${s.runs === undefined ? 'run on random inputs' : `run on ${s.runs} random inputs`} without finding a counterexample${s.note === undefined ? '' : `. The prover said: ${firstLine(s.note)}`}`,
157
+ },
158
+ {
159
+ title: "Can't be certified, and why",
160
+ intro: 'These laws are proved, but the proof format cannot express them, so the checker has nothing to check.',
161
+ always: true,
162
+ has: (s) => s.outcome === 'proved' && s.certification === 'not-certifiable',
163
+ line: (name, s) => `- **${name}**: ${plainReason(s.reason ?? 'the proof format cannot express it')}`,
164
+ },
165
+ {
166
+ title: 'Proved only within a bound',
167
+ intro: 'These laws hold for every input up to a bound (array length, loop passes, a range of numbers), not for all inputs.',
168
+ always: false,
169
+ has: (s) => s.outcome === 'bounded' && s.certification !== 'certified',
170
+ line: (name, s) => `- **${name}**${s.note === undefined ? '' : `: ${firstLine(s.note)}`}`,
171
+ },
172
+ {
173
+ title: 'Not resolved',
174
+ intro: 'The prover could not settle these laws and they are marked `proved`, so the check fails until they are fixed.',
175
+ always: false,
176
+ has: (s) => s.outcome === 'open',
177
+ line: (name, s) => `- **${name}**${s.note === undefined ? '' : `: ${firstLine(s.note)}`}`,
178
+ },
179
+ {
180
+ title: 'Failed',
181
+ intro: 'These laws failed their check.',
182
+ always: false,
183
+ has: (s) => s.outcome === 'failed',
184
+ line: (name) => `- **${name}**`,
185
+ },
186
+ ];
187
+ /** The summary of a certificates page: the laws grouped by what they can and cannot do. Deterministic for a given input. */
188
+ export function certificateSummary(laws) {
189
+ const out = ['## Summary', ''];
190
+ for (const group of groups) {
191
+ const members = laws.filter((law) => group.has(law.standing));
192
+ if (members.length === 0 && !group.always)
193
+ continue;
194
+ out.push(`### ${group.title} (${members.length})`, '', group.intro, '');
195
+ out.push(...(members.length === 0 ? ['None.'] : members.map((law) => group.line(law.name, law.standing))), '');
196
+ }
197
+ return out;
198
+ }
199
+ /** The text of the two files, one JSON object each. */
200
+ export function badgeTexts(badges) {
201
+ return {
202
+ [badgeFiles.laws]: `${JSON.stringify(badges.laws, null, 2)}\n`,
203
+ [badgeFiles.certificates]: `${JSON.stringify(badges.certificates, null, 2)}\n`,
204
+ };
205
+ }
206
+ /** Writes the two files into `dir` (made if missing) and returns their paths. */
207
+ export function writeBadges(dir, badges) {
208
+ mkdirSync(dir, { recursive: true });
209
+ return Object.entries(badgeTexts(badges)).map(([name, text]) => {
210
+ writeFileSync(join(dir, name), text);
211
+ return join(dir, name);
212
+ });
213
+ }
214
+ /** `owner/name` of a GitHub remote URL (https, ssh or scp-style), or undefined for any other host. */
215
+ export function githubRepoOf(url) {
216
+ const match = /^(?:https?:\/\/(?:[^@/]+@)?|ssh:\/\/git@|git@)github\.com[:/]([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/i.exec(url.trim());
217
+ return match === null ? undefined : `${match[1]}/${match[2]}`;
218
+ }
219
+ /** The repository's GitHub name and top directory, from git; undefined parts when there is no repository or remote. */
220
+ export function gitFacts(cwd) {
221
+ const git = (...args) => {
222
+ const ran = spawnSync('git', args, { cwd, encoding: 'utf8' });
223
+ return ran.status === 0 ? ran.stdout.trim() : undefined;
224
+ };
225
+ const remote = git('remote', 'get-url', 'origin');
226
+ const top = git('rev-parse', '--show-toplevel');
227
+ return { repo: remote === undefined ? undefined : githubRepoOf(remote), top };
228
+ }
229
+ /** The markdown of both badges, ready to paste into a README. */
230
+ export function badgeMarkdown(options) {
231
+ const repo = options.repo ?? 'OWNER/REPO';
232
+ const dir = options.dir === '' || options.dir === '.' ? '' : `${options.dir.replace(/\/$/, '')}/`;
233
+ const raw = (file) => `https://img.shields.io/endpoint?url=${encodeURIComponent(`https://raw.githubusercontent.com/${repo}/${options.branch}/${dir}${file}`)}`;
234
+ const link = options.link ??
235
+ `https://github.com/${repo}/blob/${options.branch}/${options.page === true ? `${dir}README.md` : 'tsc-laws.lock'}`;
236
+ return [
237
+ `[![tslaws](${raw(badgeFiles.laws)})](${link})`,
238
+ `[![certificates](${raw(badgeFiles.certificates)})](${link})`,
239
+ ].join('\n');
240
+ }
241
+ /** `dir` as the repository root sees it (`/` separators), or as given when there is no repository. */
242
+ export function repoRelative(cwd, dir, top) {
243
+ const absolute = resolve(cwd, dir);
244
+ return relative(top ?? cwd, absolute).replaceAll('\\', '/');
245
+ }
246
+ /** The files a certified law leaves in `.tslaws/certificates`: its problem and proof, and for a loop the clauses and invariants. */
247
+ const proofExtensions = ['smt2', 'alethe', 'horn', 'inv'];
248
+ const cell = (text) => text.replaceAll('|', '\\|').replaceAll('\n', ' ');
249
+ /**
250
+ * The certificates page of `tslaws badge`: what a certificate is, the laws grouped by what they can and cannot do, and
251
+ * every law with its status and, for a certified one, its proof files. They are copied from `.tslaws/certificates` into
252
+ * `certificates/` beside the page, so the page links files the repository holds. Writes nothing and returns false when no
253
+ * law is certified.
254
+ */
255
+ export function writeCertificatesPage(cwd, dir, results, lock) {
256
+ const standings = standingsOf(results, lock);
257
+ if (!standings.some((standing) => standing.certification === 'certified'))
258
+ return false;
259
+ const saved = certificatesDir(cwd);
260
+ const rows = results.map((result, index) => {
261
+ const standing = standings[index];
262
+ const certified = standing.certification === 'certified';
263
+ const name = certificateName(lawKey(result.file, result.name));
264
+ const present = proofExtensions.filter((ext) => existsSync(join(saved, `${name}.${ext}`)));
265
+ if (certified && present.length > 0)
266
+ mkdirSync(join(dir, 'certificates'), { recursive: true });
267
+ for (const ext of certified ? present : [])
268
+ copyFileSync(join(saved, `${name}.${ext}`), join(dir, 'certificates', `${name}.${ext}`));
269
+ const files = certified && present.length > 0 ? present.map((ext) => `[${ext}](certificates/${name}.${ext})`) : [];
270
+ return `| ${cell(result.name)} | ${cell(`${result.file}:${result.line}`)} | ${statusWords(standing)} | ${files.length === 0 ? '-' : files.join(', ')} |`;
271
+ });
272
+ mkdirSync(dir, { recursive: true });
273
+ writeFileSync(join(dir, 'README.md'), [
274
+ '# Certificates',
275
+ '',
276
+ ...whatIsACertificate,
277
+ ...certificateSummary(results.map((result, index) => ({ name: result.name, standing: standings[index] }))),
278
+ '## Technical details',
279
+ '',
280
+ 'For a certified law, cvc5 wrote an [Alethe](https://verit.loria.fr/documentation/alethe-spec.pdf) proof of its SMT-LIB problem and Carcara accepted it. A law the lock records a certificate for counts as certified, and its proof files are listed when this run saved them. Generated by `tslaws badge`; do not edit it by hand.',
281
+ '',
282
+ '| Law | Source | Status | Proof files |',
283
+ '| --- | --- | --- | --- |',
284
+ ...rows,
285
+ '',
286
+ ].join('\n'));
287
+ return true;
288
+ }
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Browser } from 'playwright-core';
2
2
  import type * as fc from 'fast-check';
3
+ import type { Plan } from './plan.ts';
3
4
  import { type PropertyOutcome } from './property.ts';
4
5
  import type { CheckOptions } from './types.ts';
5
6
  export type BrowserEngine = 'chromium' | 'firefox' | 'webkit';
@@ -10,7 +11,7 @@ export declare function resolveEngine(requested?: string, env?: NodeJS.ProcessEn
10
11
  * TSLAWS_BROWSER or Playwright's own download. Throws, naming the install command, when there is none.
11
12
  */
12
13
  export declare function engineExecutable(engine: BrowserEngine, env?: NodeJS.ProcessEnv): string;
13
- export declare function launch(engine: BrowserEngine): Promise<Browser>;
14
+ export declare function launch(engine: BrowserEngine, headless?: boolean): Promise<Browser>;
14
15
  export declare function closeBrowser(): Promise<void>;
15
16
  export interface BrowserLaw {
16
17
  file: string;
@@ -19,6 +20,8 @@ export interface BrowserLaw {
19
20
  symbol?: string;
20
21
  jsFile: string;
21
22
  generators: fc.Arbitrary<unknown>[];
23
+ /** Serialized generator plans for zero-IPC in-browser fast-check execution. */
24
+ plans?: Plan[];
22
25
  }
23
- /** Property-tests one law in a page; `'timeout'` when it does not finish within `options.propertyTimeoutMs`. */
26
+ /** Property-tests one browser law on a real HTTP origin with configurable `page` (default) or `iframe` isolation. */
24
27
  export declare function runBrowserLaw(law: BrowserLaw, options: CheckOptions): Promise<PropertyOutcome | 'timeout'>;