eutaxy 0.18.0 → 0.19.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 (74) hide show
  1. package/README.md +15 -12
  2. package/dist/aws.d.mts +2 -2
  3. package/dist/aws.mjs +3 -2
  4. package/dist/aws.mjs.map +1 -1
  5. package/dist/bin.mjs +1 -1
  6. package/dist/check-zkHLdWyf.mjs +1281 -0
  7. package/dist/check-zkHLdWyf.mjs.map +1 -0
  8. package/dist/cli-CNAKqV9R.mjs +297 -0
  9. package/dist/cli-CNAKqV9R.mjs.map +1 -0
  10. package/dist/cli.d.mts.map +1 -1
  11. package/dist/cli.mjs +1 -1
  12. package/dist/cloudflare.d.mts +37 -5
  13. package/dist/cloudflare.d.mts.map +1 -1
  14. package/dist/cloudflare.mjs +6417 -3
  15. package/dist/cloudflare.mjs.map +1 -0
  16. package/dist/{delivery-invariants-BRwfZJrs.mjs → delivery-invariants-BJDck0K8.mjs} +2 -2
  17. package/dist/{delivery-invariants-BRwfZJrs.mjs.map → delivery-invariants-BJDck0K8.mjs.map} +1 -1
  18. package/dist/{delivery-invariants-D-_GPOqE.d.mts → delivery-invariants-C3GXJIbg.d.mts} +2 -2
  19. package/dist/{delivery-invariants-D-_GPOqE.d.mts.map → delivery-invariants-C3GXJIbg.d.mts.map} +1 -1
  20. package/dist/draft-DEUDffHa.mjs +467 -0
  21. package/dist/draft-DEUDffHa.mjs.map +1 -0
  22. package/dist/{src-H1Q8ytEx.mjs → generate-TBJM3-2P.mjs} +3 -618
  23. package/dist/generate-TBJM3-2P.mjs.map +1 -0
  24. package/dist/index.d.mts +36 -36
  25. package/dist/index.d.mts.map +1 -1
  26. package/dist/index.mjs +6 -3
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/install-DkzpGA5D.mjs +611 -0
  29. package/dist/install-DkzpGA5D.mjs.map +1 -0
  30. package/dist/{explore-D33RP9hF.d.mts → ir-KpC2epGn.d.mts} +70 -70
  31. package/dist/ir-KpC2epGn.d.mts.map +1 -0
  32. package/dist/keys-xtanNmuR.mjs +111 -0
  33. package/dist/keys-xtanNmuR.mjs.map +1 -0
  34. package/dist/mcp-B64Ko6y7.mjs +539 -0
  35. package/dist/mcp-B64Ko6y7.mjs.map +1 -0
  36. package/dist/{platform-CawKCUru.d.mts → platform-Cs9V9t2k.d.mts} +25 -11
  37. package/dist/platform-Cs9V9t2k.d.mts.map +1 -0
  38. package/dist/pool-CXN4CwGY.mjs +61 -0
  39. package/dist/pool-CXN4CwGY.mjs.map +1 -0
  40. package/dist/{provers-DS44OeEm.mjs → provers-D8VaY_OM.mjs} +18 -2
  41. package/dist/provers-D8VaY_OM.mjs.map +1 -0
  42. package/dist/reader-B9FSoEYW.mjs +1 -0
  43. package/dist/reader-Cz6_bLf6.mjs +3774 -0
  44. package/dist/reader-Cz6_bLf6.mjs.map +1 -0
  45. package/dist/report-_Vzavqg0.mjs +310 -0
  46. package/dist/report-_Vzavqg0.mjs.map +1 -0
  47. package/dist/src-B2DpVbMN.mjs +2 -0
  48. package/dist/src-BFGTvuA_.mjs +1235 -0
  49. package/dist/src-BFGTvuA_.mjs.map +1 -0
  50. package/dist/src-BtLZPRyG.mjs +120 -0
  51. package/dist/src-BtLZPRyG.mjs.map +1 -0
  52. package/dist/src-CB8DcvsK.mjs +1 -0
  53. package/dist/src-COuquJvI.mjs +269 -0
  54. package/dist/src-COuquJvI.mjs.map +1 -0
  55. package/dist/src-Chn-m_r1.mjs +1082 -0
  56. package/dist/src-Chn-m_r1.mjs.map +1 -0
  57. package/dist/src-DwYD3QQJ.mjs +346 -0
  58. package/dist/src-DwYD3QQJ.mjs.map +1 -0
  59. package/dist/{src-Whn0RMSh.mjs → src-Dx4QvrQb.mjs} +559 -517
  60. package/dist/src-Dx4QvrQb.mjs.map +1 -0
  61. package/dist/toolchain-DWfymxAJ.mjs +80 -0
  62. package/dist/toolchain-DWfymxAJ.mjs.map +1 -0
  63. package/dist/verdict-evEM5Gxx.mjs +12 -0
  64. package/dist/verdict-evEM5Gxx.mjs.map +1 -0
  65. package/package.json +4 -1
  66. package/dist/cli-DyA7uTBg.mjs +0 -9447
  67. package/dist/cli-DyA7uTBg.mjs.map +0 -1
  68. package/dist/explore-D33RP9hF.d.mts.map +0 -1
  69. package/dist/platform-CawKCUru.d.mts.map +0 -1
  70. package/dist/provers-DS44OeEm.mjs.map +0 -1
  71. package/dist/src-H1Q8ytEx.mjs.map +0 -1
  72. package/dist/src-Whn0RMSh.mjs.map +0 -1
  73. package/dist/workerd-tI8INa6v.mjs +0 -6334
  74. package/dist/workerd-tI8INa6v.mjs.map +0 -1
@@ -35,6 +35,13 @@ interface Schedule {
35
35
  * Exhaustive exploration records them, since it picks rather than draws.
36
36
  */
37
37
  readonly turns?: readonly number[];
38
+ /**
39
+ * Present when the run made every asynchronous effect a turn although one
40
+ * invocation ran at a time, because an invocation made calls in parallel
41
+ * (a handler awaiting two calls together): a replay does the same, so the
42
+ * order of such calls is the schedule's and not real time's.
43
+ */
44
+ readonly effectsAsTurns?: true;
38
45
  }
39
46
  /**
40
47
  * Effect points a fault may hit, matched on the effect's call as an
@@ -90,6 +97,16 @@ interface EffectSelector {
90
97
  readonly [path: string]: number;
91
98
  };
92
99
  }
100
+ /** A violation: what a check of an invariant reports when it does not hold, and when two of them are the same one. */
101
+ /** An invariant that did not hold: its name, what went wrong, the keys involved and the effects that show it. */
102
+ interface Violation {
103
+ readonly invariant: string;
104
+ readonly message: string;
105
+ /** The keys involved, in canonical JSON, so two violations can be compared across runs. */
106
+ readonly keys: readonly string[];
107
+ /** Sequence numbers of the effects that witness the violation. */
108
+ readonly evidence: readonly number[];
109
+ }
93
110
  /**
94
111
  * The shell follows the core. Calls to a pure core function are recorded as
95
112
  * decisions (`Core:<function>` results, payload `{ args, result }`). Every
@@ -211,15 +228,6 @@ interface AtLeastOnce {
211
228
  }
212
229
  /** Anything a scenario says must hold after every run, over the effect log or the end-of-run state. */
213
230
  type Invariant = AtMostOncePerKey | AtLeastOnce | EveryRow | Implies | Unique | References | Refines;
214
- /** An invariant that did not hold: its name, what went wrong, the keys involved and the effects that show it. */
215
- interface Violation {
216
- readonly invariant: string;
217
- readonly message: string;
218
- /** The keys involved, in canonical JSON, so two violations can be compared across runs. */
219
- readonly keys: readonly string[];
220
- /** Sequence numbers of the effects that witness the violation. */
221
- readonly evidence: readonly number[];
222
- }
223
231
  /** Check one invariant against a run's effect log; null when it holds. */
224
232
  declare function checkInvariant(log: EffectLog, inv: Invariant): Violation | null;
225
233
  /** Check every invariant against a run's effect log and return the violations, in the invariants' order. */
@@ -257,6 +265,12 @@ interface PinnedSchedule {
257
265
  * and the schedule written from it keeps them.
258
266
  */
259
267
  readonly turns?: readonly number[];
268
+ /**
269
+ * Present when the run the schedule was written from made every
270
+ * asynchronous effect a turn although one invocation ran at a time (see
271
+ * `Schedule.effectsAsTurns`): its runs do the same from their start.
272
+ */
273
+ readonly effectsAsTurns?: true;
260
274
  }
261
275
  /** Opaque, JSON-shaped data owned by a platform package. `kind` names its shape. */
262
276
  interface PlatformData {
@@ -565,5 +579,5 @@ interface Platform {
565
579
  /** Called when a run ends for any reason, after `finish` or after a failure: undo any per-run patching. */
566
580
  cleanup?(spec: ScenarioSpec): Promise<void>;
567
581
  }
568
- export { FaultKind as A, Unique as C, EffectRecord as D, EffectLog as E, JsonValue as M, FaultSite as O, StateQuery as S, EffectSelector as T, checkInvariants as _, PlatformData as a, References as b, WorkerRef as c, PinnedSchedule as d, AtLeastOnce as f, checkInvariant as g, Violation as h, ExternalDecl as i, Schedule as j, FaultDecision as k, validateScenario as l, Invariant as m, Platform as n, ScenarioSpec as o, AtMostOncePerKey as p, Bounds as r, ScriptedResponse as s, EventRef as t, PinnedFault as u, EveryRow as v, Refines as w, RowCondition as x, Implies as y };
569
- //# sourceMappingURL=platform-CawKCUru.d.mts.map
582
+ export { FaultKind as A, Refines as C, EffectRecord as D, EffectLog as E, JsonValue as M, FaultSite as O, Unique as S, EffectSelector as T, EveryRow as _, PlatformData as a, RowCondition as b, WorkerRef as c, PinnedSchedule as d, AtLeastOnce as f, checkInvariants as g, checkInvariant as h, ExternalDecl as i, Schedule as j, FaultDecision as k, validateScenario as l, Invariant as m, Platform as n, ScenarioSpec as o, AtMostOncePerKey as p, Bounds as r, ScriptedResponse as s, EventRef as t, PinnedFault as u, Implies as v, Violation as w, StateQuery as x, References as y };
583
+ //# sourceMappingURL=platform-Cs9V9t2k.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-Cs9V9t2k.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/faults.ts","../../core/src/fault-sites.ts","../../core/src/effect-log.ts","../../core/src/selectors.ts","../../core/src/violation.ts","../../core/src/refines.ts","../../core/src/state.ts","../../core/src/invariants.ts","../../core/src/pinned-schedules.ts","../../core/src/scenario.ts","../../core/src/platform.ts"],"mappings":";;;;;KAMY,wDAKC;YACG,cAAc;;;;;;;KCAlB;;UAoBK;;WAEN;;WAEA;WACA,OAAO;;WAEP;WACA;;;UAIM;;WAEN;WACA,iBAAiB;;;;;;;WAOjB;;;;;;;WAOA;;;;;;;;;;;UCxCM;WACN;WACA;WACA;cAAoB,eAAe;;WACnC;cAAsB;;WACtB,kBAAkB;;;KCfjB;;UAGK;;WAEN;WACA,MAAM;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;WACN,kBAAkB;;;UCxBZ;WACN;WACA;WACA,OAAO;;WAEP;cAAoB,eAAe;;;WAEnC;cAAsB;;;;;UCVhB;WACN;WACA;;WAEA;;WAEA;;;;;;;;;;;;;UCgBM;WACN;WACA;;WAEA;WACA,QAAQ;WACR;aAA8B;aAAyB;;WACvD;aACE,MAAM;aACN,OAAO;;aAEP;;;;KC5BD;WACG;WAAyB;WAA2B,OAAO;;WAC3D;WAAyB;WAA0C;;WACnE;WAAyB;WAAmB,gBAAgB;;WAC5D;WAAyB;;;UAGvB;;WAEN;WACA;WACA,iBAAiB;;;UAIX;WACN;WACA;W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WACzB,UAAU,gBACT,QAAQ;;EAEX,WAAW,GAAG,OAAO,aAAa,eAAe,GAAG,YAAY,OAAO,MAAM,YAAY;;EAEzF,YAAY;;;;;;EAMZ;;;;;;EAMA,cAAc;;;;;;;;;;EAUd,aAAa,GAAG,cAAc,YAAY,IAAI;;;;;;;;;;EAU9C,WAAW,GAAG,cAAc,YAAY,GAAG,cAAc;;EAEzD,UAAU;;;;;;;EAOV,QAAQ,OAAO;;EAEf,SAAS,oBAAoB,gBAAgB,SAAS;;;;;;;;;;EAUtD,OAAO,GAAG,SAAS,QAAQ,IAAI,qBAAqB,QAAQ;;;;;;;;;;;;;;;;EAgB5D,QAAQ,GAAG,oBAAoB,YAAY,GAAG,qBAAqB,QAAQ;;;UAI5D,QAAQ;;WAEd,OAAO;;WAEP,MAAM;;UAGA;WACN;;WAEA,oBAAoB;;;;;;;UAQd;WACN;;WAEA;;;;;;;WAOA;;EAET,MAAM,MAAM,eAAe;;EAE3B,cAAc,MAAM,wBAAwB;;EAE5C,QAAQ,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe,QAAQ;;EAEvE,eAAe,MAAM,cAAc,6BAA6B;;;;;;;;;EAShE,eAAe,MAAM,wBAAwB;;EAE7C,QAAQ,MAAM,cAAc,OAAO,WAAW;;EAE9C,SAAS,MAAM,eAAe"}
@@ -0,0 +1,61 @@
1
+ // packages/prover/src/pool.ts
2
+ /**
3
+ * Independent jobs run a few at a time, with their results in the order of
4
+ * the items whatever order the jobs finish in: what an engine needs to run
5
+ * one solver process per property, or the report one process per module,
6
+ * without the answer depending on which finished first. A job that throws
7
+ * rejects the pool, and no job is started after it.
8
+ */
9
+ /** `work` on every item, at most `limit` at once; the results in item order. */
10
+ async function inPool(items, limit, work) {
11
+ const results = new Array(items.length);
12
+ let next = 0;
13
+ let failed = false;
14
+ const worker = async () => {
15
+ while (next < items.length && !failed) {
16
+ const i = next++;
17
+ try {
18
+ results[i] = await work(items[i], i);
19
+ } catch (err) {
20
+ failed = true;
21
+ throw err;
22
+ }
23
+ }
24
+ };
25
+ const workers = Math.max(1, Math.min(Math.floor(limit), items.length));
26
+ await Promise.all(Array.from({ length: workers }, worker));
27
+ return results;
28
+ }
29
+ /**
30
+ * `inPool`, and no item starts `size` or more places past the earliest one
31
+ * not yet finished: when an early job is slow, the jobs behind it wait
32
+ * rather than run ahead, so whatever the finished ones hold for their turn
33
+ * (the report's held output) is never more than `size - 1` items' worth.
34
+ */
35
+ async function inWindow(items, size, work) {
36
+ const n = Math.max(1, Math.floor(size));
37
+ const finished = items.map(() => false);
38
+ let earliest = 0;
39
+ let failed = false;
40
+ const waiting = /* @__PURE__ */ new Map();
41
+ return inPool(items, n, async (item, i) => {
42
+ if (i >= earliest + n) await new Promise((go) => waiting.set(i, go));
43
+ if (failed) throw new Error("an earlier job failed");
44
+ try {
45
+ return await work(item, i);
46
+ } catch (err) {
47
+ failed = true;
48
+ throw err;
49
+ } finally {
50
+ finished[i] = true;
51
+ while (finished[earliest]) earliest++;
52
+ for (const [j, go] of waiting) if (j < earliest + n) {
53
+ waiting.delete(j);
54
+ go();
55
+ }
56
+ }
57
+ });
58
+ }
59
+ export { inWindow as n, inPool as t };
60
+
61
+ //# sourceMappingURL=pool-CXN4CwGY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-CXN4CwGY.mjs","names":[],"sources":["../../prover/src/pool.ts"],"sourcesContent":["/**\n * Independent jobs run a few at a time, with their results in the order of\n * the items whatever order the jobs finish in: what an engine needs to run\n * one solver process per property, or the report one process per module,\n * without the answer depending on which finished first. A job that throws\n * rejects the pool, and no job is started after it.\n */\n\n/** `work` on every item, at most `limit` at once; the results in item order. */\nexport async function inPool<T, R>(\n items: readonly T[],\n limit: number,\n work: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let next = 0;\n // Once a job has thrown, the pool's answer is that error: no further job is started.\n let failed = false;\n const worker = async (): Promise<void> => {\n while (next < items.length && !failed) {\n const i = next++;\n try {\n results[i] = await work(items[i] as T, i);\n } catch (err) {\n failed = true;\n throw err;\n }\n }\n };\n const workers = Math.max(1, Math.min(Math.floor(limit), items.length));\n await Promise.all(Array.from({ length: workers }, worker));\n return results;\n}\n\n/**\n * `inPool`, and no item starts `size` or more places past the earliest one\n * not yet finished: when an early job is slow, the jobs behind it wait\n * rather than run ahead, so whatever the finished ones hold for their turn\n * (the report's held output) is never more than `size - 1` items' worth.\n */\nexport async function inWindow<T, R>(\n items: readonly T[],\n size: number,\n work: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const n = Math.max(1, Math.floor(size));\n const finished = items.map(() => false);\n let earliest = 0;\n let failed = false;\n const waiting = new Map<number, () => void>();\n return inPool(items, n, async (item, i) => {\n if (i >= earliest + n) await new Promise<void>((go) => waiting.set(i, go));\n if (failed) throw new Error(\"an earlier job failed\");\n try {\n return await work(item, i);\n } catch (err) {\n failed = true;\n throw err;\n } finally {\n finished[i] = true;\n while (finished[earliest]) earliest++;\n for (const [j, go] of waiting)\n if (j < earliest + n) {\n waiting.delete(j);\n go();\n }\n }\n });\n}\n"],"mappings":";;;;;;;;;AASA,eAAsB,OACpB,OACA,OACA,MACc;CACd,MAAM,UAAU,IAAI,MAAS,MAAM,MAAM;CACzC,IAAI,OAAO;CAEX,IAAI,SAAS;CACb,MAAM,SAAS,YAA2B;EACxC,OAAO,OAAO,MAAM,UAAU,CAAC,QAAQ;GACrC,MAAM,IAAI;GACV,IAAI;IACF,QAAQ,KAAK,MAAM,KAAK,MAAM,IAAS,CAAC;GAC1C,SAAS,KAAK;IACZ,SAAS;IACT,MAAM;GACR;EACF;CACF;CACA,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC;CACrE,MAAM,QAAQ,IAAI,MAAM,KAAK,EAAE,QAAQ,QAAQ,GAAG,MAAM,CAAC;CACzD,OAAO;AACT;;;;;;;AAQA,eAAsB,SACpB,OACA,MACA,MACc;CACd,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,IAAI,CAAC;CACtC,MAAM,WAAW,MAAM,UAAU,KAAK;CACtC,IAAI,WAAW;CACf,IAAI,SAAS;CACb,MAAM,0BAAU,IAAI,IAAwB;CAC5C,OAAO,OAAO,OAAO,GAAG,OAAO,MAAM,MAAM;EACzC,IAAI,KAAK,WAAW,GAAG,MAAM,IAAI,SAAe,OAAO,QAAQ,IAAI,GAAG,EAAE,CAAC;EACzE,IAAI,QAAQ,MAAM,IAAI,MAAM,uBAAuB;EACnD,IAAI;GACF,OAAO,MAAM,KAAK,MAAM,CAAC;EAC3B,SAAS,KAAK;GACZ,SAAS;GACT,MAAM;EACR,UAAU;GACR,SAAS,KAAK;GACd,OAAO,SAAS,WAAW;GAC3B,KAAK,MAAM,CAAC,GAAG,OAAO,SACpB,IAAI,IAAI,WAAW,GAAG;IACpB,QAAQ,OAAO,CAAC;IAChB,GAAG;GACL;EACJ;CACF,CAAC;AACH"}
@@ -1,4 +1,20 @@
1
1
  // packages/prover/src/provers.ts
2
+ /** An engine's `UNKNOWN` for a property: it gave up, does not take it, or cannot run here. */
3
+ function unknownOutcome(cause, reason) {
4
+ return {
5
+ kind: "UNKNOWN",
6
+ cause,
7
+ reason
8
+ };
9
+ }
10
+ /** Every property of the functions with an outcome: the one given, or the one given for its function. */
11
+ function proofsOf(fns, outcome) {
12
+ return fns.flatMap((fn) => fn.properties.map((property) => ({
13
+ function: fn.name,
14
+ property: property.name,
15
+ outcome: typeof outcome === "function" ? outcome(fn) : outcome
16
+ })));
17
+ }
2
18
  /**
3
19
  * The simulator's verdicts for a module (CHECKED, TESTED, REFUTED, UNKNOWN,
4
20
  * `total` included) combined with what the engines proved. A simulator
@@ -78,6 +94,6 @@ function aggregate(module, verdicts, reports) {
78
94
  };
79
95
  });
80
96
  }
81
- export { aggregate as t };
97
+ export { proofsOf as n, unknownOutcome as r, aggregate as t };
82
98
 
83
- //# sourceMappingURL=provers-DS44OeEm.mjs.map
99
+ //# sourceMappingURL=provers-D8VaY_OM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provers-D8VaY_OM.mjs","names":[],"sources":["../../prover/src/provers.ts"],"sourcesContent":["/**\n * The `Prover` interface every engine implements, first-party or not, and\n * the aggregation of what engines say into the ladder's verdicts. An\n * engine takes a module's source with its specs and the functions to\n * prove and answers per property: `PROVEN` with its name, version and\n * assumptions, or `UNKNOWN` as `gave_up` (a proof did not close, or timed\n * out), `unsupported` (outside its subset) or `unavailable` (not\n * installed). An engine that refutes gives `REFUTED` with a counterexample\n * when it has one. Engines run over a process boundary; nothing here\n * spawns anything.\n */\n\nimport type { Counterexample, SpecVerdict } from \"@eutaxy/core\";\nimport type { FunctionSpec, ModuleSpecs, SpecError } from \"@eutaxy/spec\";\n\n/** A proof engine's name and version, as verdicts record it. */\nexport interface EngineId {\n readonly name: string;\n readonly version: string;\n}\n\n/** What an engine said about one property: proven, refuted (with a counterexample when it has one), or unknown and why. */\nexport type ProofOutcome =\n | { readonly kind: \"PROVEN\"; readonly engine: EngineId; readonly assumptions: readonly string[] }\n | {\n readonly kind: \"REFUTED\";\n readonly engine: EngineId;\n readonly counterexample?: Counterexample;\n readonly assumptions: readonly string[];\n }\n | {\n readonly kind: \"UNKNOWN\";\n readonly cause: \"gave_up\" | \"unsupported\" | \"unavailable\";\n readonly reason: string;\n };\n\n/** An engine's `UNKNOWN` for a property: it gave up, does not take it, or cannot run here. */\nexport function unknownOutcome(\n cause: \"gave_up\" | \"unsupported\" | \"unavailable\",\n reason: string,\n): ProofOutcome {\n return { kind: \"UNKNOWN\", cause, reason };\n}\n\n/** An engine's outcome for one property of one function. */\nexport interface PropertyProof {\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n readonly outcome: ProofOutcome;\n}\n\n/** A property an engine gave up on, with the statement it tried to prove, for a proof to be supplied. */\nexport interface OpenGoal {\n readonly function: string;\n readonly property: string;\n /** The statement in the engine's language, as it emitted it. */\n readonly statement: string;\n /** Why the engine gave up: its own words, first line. */\n readonly reason: string;\n}\n\n/** An engine's answer for one module: an outcome per property, the specs that did not read, and the open goals. */\nexport interface ModuleProofs {\n readonly results: readonly PropertyProof[];\n /** Specs that did not read: properties asked for and never checked. */\n readonly specErrors: readonly SpecError[];\n /**\n * The properties given up on that a supplied proof could close, when the engine takes supplied proofs\n * and answered (empty when it closed every one; absent when it could not run or finish).\n */\n readonly goals?: readonly OpenGoal[];\n}\n\n/** What an engine is given: the module's source and specs, the functions to prove, and where they live. */\nexport interface ProveInput {\n /** The module's source text. */\n readonly source: string;\n /** The module's specs, read from its spec file. */\n readonly specs: ModuleSpecs;\n /** The functions to prove; every one with specs when omitted. */\n readonly functions?: readonly string[];\n /** The module's path, under which its imports resolve; without it the module stands alone. */\n readonly modulePath?: string;\n /** The spec file's path, for an engine that replays a counterexample through the spec itself. */\n readonly specPath?: string;\n readonly timeoutMs?: number;\n}\n\n/** Every property of the functions with an outcome: the one given, or the one given for its function. */\nexport function proofsOf(\n fns: readonly FunctionSpec[],\n outcome: ProofOutcome | ((fn: FunctionSpec) => ProofOutcome),\n): PropertyProof[] {\n return fns.flatMap((fn) =>\n fn.properties.map((property) => ({\n function: fn.name,\n property: property.name,\n outcome: typeof outcome === \"function\" ? outcome(fn) : outcome,\n })),\n );\n}\n\n/** A proof engine: whether it can run here, and proving a module's properties. */\nexport interface Prover {\n readonly name: string;\n /** Whether the engine can run here, or why not. */\n available(): Promise<{ readonly version: string } | { readonly unavailable: string }>;\n prove(input: ProveInput): Promise<ModuleProofs>;\n}\n\n/** What an engine said about one module, by its name. */\nexport interface EngineReport {\n readonly engine: string;\n readonly proofs: ModuleProofs;\n}\n\n/**\n * The simulator's verdicts for a module (CHECKED, TESTED, REFUTED, UNKNOWN,\n * `total` included) combined with what the engines proved. A simulator\n * counterexample stands. One engine proving is `PROVEN`, the lower rungs'\n * counts kept beside it; an engine refuting where nothing else did is\n * `REFUTED` at the PROVEN rung; one proving and another refuting is\n * `CONFLICT`. An engine that gave up, could not run or does not take the\n * function leaves the verdict as it was, with why among the assumptions.\n */\nexport function aggregate(\n module: string,\n verdicts: readonly SpecVerdict[],\n reports: readonly EngineReport[],\n): SpecVerdict[] {\n return verdicts.map((v) => {\n if (v.module !== module) return v;\n const says = reports\n .map((r) => ({\n engine: r.engine,\n outcome: r.proofs.results.find(\n (p) => p.function === v.function && p.property === v.property,\n )?.outcome,\n }))\n .filter((x): x is { engine: string; outcome: ProofOutcome } => x.outcome !== undefined);\n if (says.length === 0) return v;\n const proven = says.find((x) => x.outcome.kind === \"PROVEN\");\n const refuted = says.find((x) => x.outcome.kind === \"REFUTED\");\n if (v.kind === \"REFUTED\" || v.kind === \"CONFLICT\") {\n // The simulator's counterexample is a fact; an engine proving against it is a conflict too.\n if (v.kind === \"REFUTED\" && proven?.outcome.kind === \"PROVEN\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"CONFLICT\",\n proven: proven.outcome.engine,\n refuted: { name: \"simulator\", version: v.rung, counterexample: v.counterexample },\n assumptions: [...v.assumptions, ...proven.outcome.assumptions],\n };\n return v;\n }\n if (proven?.outcome.kind === \"PROVEN\" && refuted?.outcome.kind === \"REFUTED\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"CONFLICT\",\n proven: proven.outcome.engine,\n refuted: {\n name: refuted.outcome.engine.name,\n version: refuted.outcome.engine.version,\n ...(refuted.outcome.counterexample\n ? { counterexample: refuted.outcome.counterexample }\n : {}),\n },\n assumptions: [...proven.outcome.assumptions, ...refuted.outcome.assumptions],\n };\n if (refuted?.outcome.kind === \"REFUTED\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"REFUTED\",\n rung: \"PROVEN\",\n engine: refuted.outcome.engine,\n counterexample: refuted.outcome.counterexample ?? { binders: [] },\n assumptions: refuted.outcome.assumptions,\n };\n if (proven?.outcome.kind === \"PROVEN\")\n return {\n module: v.module,\n function: v.function,\n property: v.property,\n text: v.text,\n kind: \"PROVEN\",\n engine: proven.outcome.engine,\n ...(v.kind === \"TESTED\" ? { tested: v.inputs } : {}),\n ...(v.kind === \"TESTED\" && v.checked !== undefined\n ? { checked: v.checked }\n : v.kind === \"CHECKED\"\n ? { checked: v.inputs }\n : {}),\n assumptions: [...proven.outcome.assumptions, ...v.assumptions],\n };\n // Every engine fell short: say so beside the verdict that stands.\n const notes = says.map((x) =>\n x.outcome.kind === \"UNKNOWN\"\n ? `not PROVEN by ${x.engine}: ${x.outcome.cause}: ${x.outcome.reason}`\n : `${x.engine}: ${x.outcome.kind}`,\n );\n return { ...v, assumptions: [...v.assumptions, ...notes] };\n });\n}\n"],"mappings":";;AAqCA,SAAgB,eACd,OACA,QACc;CACd,OAAO;EAAE,MAAM;EAAW;EAAO;CAAO;AAC1C;;AAgDA,SAAgB,SACd,KACA,SACiB;CACjB,OAAO,IAAI,SAAS,OAClB,GAAG,WAAW,KAAK,cAAc;EAC/B,UAAU,GAAG;EACb,UAAU,SAAS;EACnB,SAAS,OAAO,YAAY,aAAa,QAAQ,EAAE,IAAI;CACzD,EAAE,CACJ;AACF;;;;;;;;;;AAyBA,SAAgB,UACd,QACA,UACA,SACe;CACf,OAAO,SAAS,KAAK,MAAM;EACzB,IAAI,EAAE,WAAW,QAAQ,OAAO;EAChC,MAAM,OAAO,QACV,KAAK,OAAO;GACX,QAAQ,EAAE;GACV,SAAS,EAAE,OAAO,QAAQ,MACvB,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,QACvD,CAAC,EAAE;EACL,EAAE,CAAC,CACF,QAAQ,MAAsD,EAAE,YAAY,KAAA,CAAS;EACxF,IAAI,KAAK,WAAW,GAAG,OAAO;EAC9B,MAAM,SAAS,KAAK,MAAM,MAAM,EAAE,QAAQ,SAAS,QAAQ;EAC3D,MAAM,UAAU,KAAK,MAAM,MAAM,EAAE,QAAQ,SAAS,SAAS;EAC7D,IAAI,EAAE,SAAS,aAAa,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GAClD,GAAI,EAAE,SAAS,YAAY,EAAE,YAAY,KAAA,IACrC,EAAE,SAAS,EAAE,QAAQ,IACrB,EAAE,SAAS,YACT,EAAE,SAAS,EAAE,OAAO,IACpB,CAAC;GACP,aAAa,CAAC,GAAG,OAAO,QAAQ,aAAa,GAAG,EAAE,WAAW;EAC/D;EAEF,MAAM,QAAQ,KAAK,KAAK,MACtB,EAAE,QAAQ,SAAS,YACf,iBAAiB,EAAE,OAAO,IAAI,EAAE,QAAQ,MAAM,IAAI,EAAE,QAAQ,WAC5D,GAAG,EAAE,OAAO,IAAI,EAAE,QAAQ,MAChC;EACA,OAAO;GAAE,GAAG;GAAG,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,KAAK;EAAE;CAC3D,CAAC;AACH"}
@@ -0,0 +1 @@
1
+ export { y as OutsideSubset, h as builtinsAssumption, b as children, _ as closeCompiler, x as describe, r as engineGap, p as fits, S as hasLoneSurrogate, t as hintsOf, u as insertNarrows, C as isListExpr, w as listKinds, d as narrowsOf, i as outsideProofs, o as readArrowBody, v as readBinderType, s as readExpression, a as readForEngine, n as readSpecs, c as readSubset, l as renameVars, g as restrictModule, f as tagNarrowsOf, m as typeOf } from "./reader-Cz6_bLf6.mjs";