eutaxy 0.4.0 → 0.5.1

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 (46) hide show
  1. package/README.md +2 -2
  2. package/dist/aws.d.mts +7 -5
  3. package/dist/aws.d.mts.map +1 -1
  4. package/dist/aws.mjs +41 -135
  5. package/dist/aws.mjs.map +1 -1
  6. package/dist/bin.mjs +2 -2
  7. package/dist/checked-CGpA2-F0.d.mts +285 -0
  8. package/dist/checked-CGpA2-F0.d.mts.map +1 -0
  9. package/dist/cli-IJrKkeYS.mjs +2 -0
  10. package/dist/cli.d.mts.map +1 -1
  11. package/dist/cli.mjs +2 -2
  12. package/dist/cloudflare.d.mts +232 -51
  13. package/dist/cloudflare.d.mts.map +1 -1
  14. package/dist/cloudflare.mjs +3 -1083
  15. package/dist/delivery-invariants-BraYqcYN.d.mts +5 -0
  16. package/dist/delivery-invariants-BraYqcYN.d.mts.map +1 -0
  17. package/dist/delivery-invariants-Cuxdna28.mjs +39 -0
  18. package/dist/delivery-invariants-Cuxdna28.mjs.map +1 -0
  19. package/dist/index.d.mts +66 -5
  20. package/dist/index.d.mts.map +1 -1
  21. package/dist/index.mjs +81 -5
  22. package/dist/index.mjs.map +1 -0
  23. package/dist/{platform-TwATAkL3.d.mts → platform-DfMwknw1.d.mts} +179 -42
  24. package/dist/platform-DfMwknw1.d.mts.map +1 -0
  25. package/dist/src-Bqc9Eyb1.mjs +2655 -0
  26. package/dist/src-Bqc9Eyb1.mjs.map +1 -0
  27. package/dist/src-DKb-fkdb.mjs +3399 -0
  28. package/dist/src-DKb-fkdb.mjs.map +1 -0
  29. package/dist/src-Dxl9ZlKn.mjs +1752 -0
  30. package/dist/src-Dxl9ZlKn.mjs.map +1 -0
  31. package/package.json +1 -1
  32. package/dist/cli-Dr-Ziogu.mjs +0 -2
  33. package/dist/cloudflare.mjs.map +0 -1
  34. package/dist/explore-YVHTRjjS.d.mts +0 -63
  35. package/dist/explore-YVHTRjjS.d.mts.map +0 -1
  36. package/dist/platform-TwATAkL3.d.mts.map +0 -1
  37. package/dist/src-BBXd0WEp.mjs +0 -117
  38. package/dist/src-BBXd0WEp.mjs.map +0 -1
  39. package/dist/src-BGdIBGkN.mjs +0 -311
  40. package/dist/src-BGdIBGkN.mjs.map +0 -1
  41. package/dist/src-Brt0dfNL.mjs +0 -1286
  42. package/dist/src-Brt0dfNL.mjs.map +0 -1
  43. package/dist/src-s6uYyC0B.mjs +0 -89
  44. package/dist/src-s6uYyC0B.mjs.map +0 -1
  45. package/dist/verdict-evEM5Gxx.mjs +0 -12
  46. package/dist/verdict-evEM5Gxx.mjs.map +0 -1
package/dist/bin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as main } from "./src-BGdIBGkN.mjs";
3
- import "./cli-Dr-Ziogu.mjs";
2
+ import { N as main } from "./src-DKb-fkdb.mjs";
3
+ import "./cli-IJrKkeYS.mjs";
4
4
  // packages/eutaxy/src/bin.ts
5
5
  process.stdout.on("error", (err) => {
6
6
  if (err.code === "EPIPE") process.exit(process.exitCode ?? 0);
@@ -0,0 +1,285 @@
1
+ import { D as EffectLog, f as Schedule, g as Violation, n as Platform, o as ScenarioSpec, r as Bounds } from "./platform-DfMwknw1.mjs";
2
+ /**
3
+ * Spec verdicts: what is known about one property of one pure function.
4
+ * Kept apart from scenario verdicts in every report. The ladder starts at
5
+ * `CHECKED` (held on every input the simulator passed); `TESTED` and
6
+ * `PROVEN` come with the provers.
7
+ */
8
+ interface SpecVerdictBase {
9
+ /** The module, as the scenario names it. */
10
+ readonly module: string;
11
+ readonly function: string;
12
+ /** The `@ensures` name, or `@total` / `@throws` for those markers. */
13
+ readonly property: string;
14
+ /** The property as written. */
15
+ readonly text: string;
16
+ readonly assumptions: readonly string[];
17
+ }
18
+ interface Checked extends SpecVerdictBase {
19
+ readonly kind: "CHECKED";
20
+ /** Distinct inputs the property was evaluated on. */
21
+ readonly inputs: number;
22
+ /** Distinct inputs outside the claim: a precondition failed, or a value fell outside its binder's domain. */
23
+ readonly discarded: number;
24
+ }
25
+ /** One assignment that breaks the property, as JavaScript literals, and the call it came from. */
26
+ interface Counterexample {
27
+ /** In the property's binder order. */
28
+ readonly binders: readonly {
29
+ readonly name: string;
30
+ readonly value: string;
31
+ }[];
32
+ readonly call: string;
33
+ /** Set when evaluating the property threw instead of returning false. */
34
+ readonly error?: string;
35
+ }
36
+ interface Refuted extends SpecVerdictBase {
37
+ readonly kind: "REFUTED";
38
+ readonly rung: "CHECKED";
39
+ readonly counterexample: Counterexample;
40
+ }
41
+ type SpecUnknownCause = "gave_up" | "unsupported" | "unavailable";
42
+ interface SpecUnknown extends SpecVerdictBase {
43
+ readonly kind: "UNKNOWN";
44
+ readonly cause: SpecUnknownCause;
45
+ readonly reason: string;
46
+ }
47
+ type SpecVerdict = Checked | Refuted | SpecUnknown;
48
+ /** One line per spec verdict, for error messages; full rendering lives in `report`. */
49
+ declare function describeSpecVerdict(v: SpecVerdict): string;
50
+ interface BoundsReached {
51
+ readonly runs: number;
52
+ readonly effectPoints: number;
53
+ readonly faultsInjected: number;
54
+ readonly elapsedMs: number;
55
+ /**
56
+ * Present when exploration was exhaustive: how many distinct schedules ran
57
+ * (runs that only repeated an order the reduction had covered are not
58
+ * counted), and whether every schedule within the bounds was reached
59
+ * before the budget ran out.
60
+ */
61
+ readonly exhaustive?: {
62
+ readonly complete: boolean;
63
+ readonly schedules: number;
64
+ readonly reduction: boolean;
65
+ };
66
+ }
67
+ interface VerdictBase {
68
+ readonly scenario: string;
69
+ readonly seed: number | string;
70
+ readonly reached: BoundsReached;
71
+ readonly assumptions: readonly string[];
72
+ }
73
+ interface Shrunk {
74
+ readonly faultsRemoved: number;
75
+ readonly eventsRemoved: number;
76
+ readonly runs: number;
77
+ }
78
+ interface Violated extends VerdictBase {
79
+ readonly kind: "VIOLATED";
80
+ readonly violation: Violation;
81
+ /** The replayed, shrunk trace that breaks the invariant. */
82
+ readonly trace: EffectLog;
83
+ readonly schedule: Schedule;
84
+ /** Ids of the drive's events that remain after shrinking. */
85
+ readonly keptEvents: readonly string[];
86
+ readonly shrunk: Shrunk;
87
+ }
88
+ interface Bounded extends VerdictBase {
89
+ readonly kind: "BOUNDED";
90
+ readonly bounds: Bounds;
91
+ }
92
+ type UnsupportedCause = "unsupported_api" | "not_replayable" | "module_state_leak" | "unsupported_bounds";
93
+ interface Unsupported extends VerdictBase {
94
+ readonly kind: "UNSUPPORTED";
95
+ readonly cause: UnsupportedCause;
96
+ readonly reason: string;
97
+ }
98
+ type ScenarioVerdict = Violated | Bounded | Unsupported;
99
+ /** One line per verdict, for error messages; full rendering lives in `report`. */
100
+ declare function describeVerdict(v: ScenarioVerdict): string;
101
+ interface ExploreOptions {
102
+ readonly seed: number | string;
103
+ /** Hard cap on runs, in addition to the scenario's time budget. */
104
+ readonly maxRuns?: number;
105
+ /**
106
+ * Replaces the scenario's `budgetMs` for this exploration: the real time
107
+ * exploring and shrinking may take, and the real time one effect's I/O
108
+ * may take before it counts as hung. With a generous budget and
109
+ * `maxRuns`, the run cap ends exploration, so a seed decides the verdict
110
+ * on any machine.
111
+ */
112
+ readonly budgetMs?: number;
113
+ /**
114
+ * The share of seeded runs after the first (which injects none) that
115
+ * inject faults (see `planFaults`). Default 0.9: the runs without faults
116
+ * also check the scenario as it runs without them, and measure how many
117
+ * eligible points a run without faults has, which can vary with the seed.
118
+ */
119
+ readonly faultProbability?: number;
120
+ /** Clock for the time budget; injectable for tests. */
121
+ readonly now?: () => number;
122
+ /** Hard cap on replay runs spent shrinking a violation. */
123
+ readonly maxShrinkRuns?: number;
124
+ /**
125
+ * How many of the first exploration runs to replay in reverse order
126
+ * before reporting BOUNDED, to detect module-level state leaking between
127
+ * runs. 0 disables the pass.
128
+ */
129
+ readonly leakCheckRuns?: number;
130
+ /**
131
+ * Explore every schedule within the bounds, each once, instead of drawing
132
+ * schedules from the seed: every fault (or none) at every effect point
133
+ * that may still take one, and every order of turns. With `reduction`
134
+ * (the default), turns of different invocations on different targets
135
+ * commute and only one order of them is run.
136
+ */
137
+ readonly exhaustive?: boolean | {
138
+ readonly reduction?: boolean;
139
+ };
140
+ }
141
+ /** Re-run a recorded schedule exactly. */
142
+ declare function replay(spec: ScenarioSpec, platform: Platform, schedule: Schedule): Promise<EffectLog>;
143
+ declare function explore(scenario: ScenarioSpec, platform: Platform, options: ExploreOptions): Promise<ScenarioVerdict>;
144
+ /**
145
+ * SpecIR: function specs as plain data. The surface syntax is Lemma
146
+ * (https://github.com/jessealama/lemma-lang, grammar.ebnf and
147
+ * semantics.md); the IR is Eutaxy's own, so engines and the simulator read
148
+ * one shape whatever the annotation looked like. Leaves are opaque
149
+ * TypeScript expressions, kept as written.
150
+ */
151
+ /** Lemma's binder domains. */
152
+ type Domain = "int" | "nat" | "number" | "boolean" | "string" | "bigint";
153
+ /**
154
+ * One end of an interval: a numeric literal as written (sign included), or
155
+ * `∞` / `-∞` for either infinity. `[` and `]` include the endpoint.
156
+ */
157
+ interface Endpoint {
158
+ readonly value: string;
159
+ readonly inclusive: boolean;
160
+ }
161
+ /** A binder's constraint: an interval for numeric domains, a whole-string regex for `string`. */
162
+ type Guard = {
163
+ readonly kind: "interval";
164
+ readonly lower: Endpoint;
165
+ readonly upper: Endpoint;
166
+ } | {
167
+ readonly kind: "regex";
168
+ readonly pattern: string;
169
+ readonly flags: string;
170
+ };
171
+ interface Binder {
172
+ readonly name: string;
173
+ readonly domain: Domain;
174
+ readonly guard?: Guard;
175
+ }
176
+ /**
177
+ * A formula over boolean atoms. Atoms and equation sides are TypeScript
178
+ * expressions, verbatim. `and` and `or` are n-ary (both are associative);
179
+ * `implies` keeps Lemma's chain: every segment but the last is an
180
+ * antecedent. An implication at a property's root is not a formula node but
181
+ * the property's preconditions (`Property.requires`).
182
+ */
183
+ type Formula = {
184
+ readonly kind: "atom";
185
+ readonly text: string;
186
+ } | {
187
+ readonly kind: "equation";
188
+ readonly left: string;
189
+ readonly right: string;
190
+ /** `≢` rather than `≡`. */
191
+ readonly negated: boolean;
192
+ } | {
193
+ readonly kind: "not";
194
+ readonly operand: Formula;
195
+ } | {
196
+ readonly kind: "and" | "or";
197
+ readonly operands: readonly Formula[];
198
+ } | {
199
+ readonly kind: "implies";
200
+ readonly antecedents: readonly Formula[];
201
+ readonly consequent: Formula;
202
+ } | {
203
+ readonly kind: "iff";
204
+ readonly left: Formula;
205
+ readonly right: Formula;
206
+ };
207
+ /**
208
+ * A universally quantified claim: for every assignment of the binders from
209
+ * their (guarded) domains where every precondition holds, `claim` holds.
210
+ * Assignments failing a precondition are outside the claim.
211
+ */
212
+ interface Property {
213
+ readonly binders: readonly Binder[];
214
+ readonly requires: readonly Formula[];
215
+ readonly claim: Formula;
216
+ }
217
+ /** An `@ensures{name}` annotation. */
218
+ interface NamedProperty {
219
+ readonly name: string;
220
+ readonly property: Property;
221
+ /** The annotation's property text, as written. */
222
+ readonly text: string;
223
+ }
224
+ /** The specs on one exported function. */
225
+ interface FunctionSpec {
226
+ readonly name: string;
227
+ /** Parameter names in order; null for a destructured or rest parameter. */
228
+ readonly params: readonly (string | null)[];
229
+ readonly ensures: readonly NamedProperty[];
230
+ /** `@total`: the function terminates on every input. */
231
+ readonly total: boolean;
232
+ /** `@throws`: the function throws (Lemma has not fixed its semantics yet). */
233
+ readonly throws: boolean;
234
+ /** 1-based line of the declaration. */
235
+ readonly line: number;
236
+ }
237
+ /** A problem with an annotation, located in the module. */
238
+ interface SpecError {
239
+ readonly line: number;
240
+ readonly message: string;
241
+ }
242
+ /** Every spec in one module, the names it exports, and the annotations that did not parse. */
243
+ interface ModuleSpecs {
244
+ readonly functions: readonly FunctionSpec[];
245
+ readonly exports: readonly string[];
246
+ readonly errors: readonly SpecError[];
247
+ }
248
+ /** The outcome a predicate returns for one assignment. */
249
+ type PredicateOutcome = "held" | "discarded" | "refuted";
250
+ /** What generated predicates call when free names did not resolve. */
251
+ declare function lemmaUnresolved(names: readonly string[]): never;
252
+ /** The atom check generated predicates call: its argument when it is a boolean. */
253
+ declare function lemmaBool(value: unknown): boolean;
254
+ interface CheckedInput {
255
+ readonly module: string;
256
+ readonly fn: FunctionSpec;
257
+ readonly property: NamedProperty;
258
+ /** The calls the simulator made, with their arguments. */
259
+ readonly calls: readonly {
260
+ readonly args: readonly unknown[];
261
+ }[];
262
+ /** The compiled predicate over the binders, or undefined when it could not be built. */
263
+ readonly predicate: ((...binders: never[]) => PredicateOutcome) | undefined;
264
+ /** Why the function's calls could not be observed, when they could not. */
265
+ readonly unobservable?: string;
266
+ }
267
+ declare function checkedRung(input: CheckedInput): SpecVerdict;
268
+ /** Compiled predicates of a module, by function and property name. */
269
+ interface ModulePredicates {
270
+ readonly [fn: string]: {
271
+ readonly [property: string]: (...binders: never[]) => PredicateOutcome;
272
+ };
273
+ }
274
+ /** Every spec verdict for one module, from what was observed of its calls. */
275
+ declare function checkSpecModule(module: string, specs: ModuleSpecs, predicates: ModulePredicates, observed: {
276
+ readonly calls: readonly {
277
+ readonly function: string;
278
+ readonly args: readonly unknown[];
279
+ }[];
280
+ readonly unobservable: {
281
+ readonly [fn: string]: string;
282
+ };
283
+ }): SpecVerdict[];
284
+ export { Checked as C, SpecVerdict as D, SpecUnknown as E, describeSpecVerdict as O, describeVerdict as S, Refuted as T, Bounded as _, lemmaUnresolved as a, Unsupported as b, Formula as c, ModuleSpecs as d, NamedProperty as f, replay as g, explore as h, lemmaBool as i, FunctionSpec as l, ExploreOptions as m, checkSpecModule as n, Binder as o, Property as p, checkedRung as r, Domain as s, ModulePredicates as t, Guard as u, BoundsReached as v, Counterexample as w, Violated as x, ScenarioVerdict as y };
285
+ //# sourceMappingURL=checked-CGpA2-F0.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checked-CGpA2-F0.d.mts","names":[],"sources":["../../core/src/spec-verdict.ts","../../core/src/verdict.ts","../../engine/src/explore.ts","../../spec/src/ir.ts","../../spec/src/predicate.ts","../../prover/src/checked.ts"],"mappings":";;;;;;;UA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ACA;;;UAIM;WACN,oBAAoB;WACpB;WACA,iBAAiB;;;KCxFhB;;iBCcI,gBAAgB;;iBAOhB,UAAU;UAqET;WACN;WACA,IAAI;WACJ,UAAU;;WAEV;aAA2B;;;WAE3B,gBAAgB,qBAAqB;;WAErC;;iBAGK,YAAY,OAAO,eAAe;;UA2HjC;YACL;cAAyB,uBAAuB,qBAAqB;;;;iBAIjE,gBACd,gBACA,OAAO,aACP,YAAY,kBACZ;WACW;aAA2B;aAA2B;;WACtD;cAA0B;;IAEpC"}
@@ -0,0 +1,2 @@
1
+ import "./src-DKb-fkdb.mjs";
2
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.mts","names":[],"sources":["../../cli/src/main.ts"],"mappings":"A,UAqBiB;WACN;WACA,SAAS;WACT,SAAS;;wBAGE,KAAK,yBAAyB,IAAI,KAAK"}
1
+ {"version":3,"file":"cli.d.mts","names":[],"sources":["../../cli/src/main.ts"],"mappings":"A,UAuBiB;WACN;WACA,SAAS;WACT,SAAS;;wBAGE,KAAK,yBAAyB,IAAI,KAAK"}
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { t as main } from "./src-BGdIBGkN.mjs";
2
- import "./cli-Dr-Ziogu.mjs";
1
+ export { N as main } from "./src-DKb-fkdb.mjs";
2
+ import "./cli-IJrKkeYS.mjs";