eutaxy 0.5.1 → 0.7.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.
- package/README.md +123 -12
- package/dist/aws.d.mts +2 -2
- package/dist/aws.mjs +5 -5
- package/dist/bin.mjs +2 -2
- package/dist/{checksum-DhS6ofSm.mjs → checksum-DHr5qb3Y.mjs} +2 -2
- package/dist/{checksum-DhS6ofSm.mjs.map → checksum-DHr5qb3Y.mjs.map} +1 -1
- package/dist/cli-CL28yx3H.mjs +2 -0
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cloudflare.d.mts +10 -12
- package/dist/cloudflare.d.mts.map +1 -1
- package/dist/cloudflare.mjs +2 -2
- package/dist/combinators-B7tV5fM_.d.mts +36 -0
- package/dist/combinators-B7tV5fM_.d.mts.map +1 -0
- package/dist/combinators-N4LmG4p4.mjs +26 -0
- package/dist/combinators-N4LmG4p4.mjs.map +1 -0
- package/dist/{delivery-invariants-BraYqcYN.d.mts → delivery-invariants-DfPkJL0Q.d.mts} +2 -2
- package/dist/{delivery-invariants-BraYqcYN.d.mts.map → delivery-invariants-DfPkJL0Q.d.mts.map} +1 -1
- package/dist/{delivery-invariants-Cuxdna28.mjs → delivery-invariants-hmhwh_qD.mjs} +2 -2
- package/dist/{delivery-invariants-Cuxdna28.mjs.map → delivery-invariants-hmhwh_qD.mjs.map} +1 -1
- package/dist/{event-streams-BANyO9xt.mjs → event-streams-i8OGzuFN.mjs} +2 -2
- package/dist/{event-streams-BANyO9xt.mjs.map → event-streams-i8OGzuFN.mjs.map} +1 -1
- package/dist/explore-DhfREiX9.d.mts +226 -0
- package/dist/explore-DhfREiX9.d.mts.map +1 -0
- package/dist/index.d.mts +196 -21
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -70
- package/dist/index.mjs.map +1 -1
- package/dist/{platform-DfMwknw1.d.mts → platform-Bpnav0kn.d.mts} +6 -4
- package/dist/{platform-DfMwknw1.d.mts.map → platform-Bpnav0kn.d.mts.map} +1 -1
- package/dist/spec.d.mts +2 -0
- package/dist/spec.mjs +1 -0
- package/dist/{src-Bqc9Eyb1.mjs → src-BO7I3f-1.mjs} +2 -2
- package/dist/src-BO7I3f-1.mjs.map +1 -0
- package/dist/src-CMoBPQuE.mjs +8231 -0
- package/dist/src-CMoBPQuE.mjs.map +1 -0
- package/dist/src-DzpZxvQi.mjs +1422 -0
- package/dist/src-DzpZxvQi.mjs.map +1 -0
- package/package.json +27 -7
- package/dist/checked-CGpA2-F0.d.mts +0 -285
- package/dist/checked-CGpA2-F0.d.mts.map +0 -1
- package/dist/cli-IJrKkeYS.mjs +0 -2
- package/dist/src-Bqc9Eyb1.mjs.map +0 -1
- package/dist/src-DKb-fkdb.mjs +0 -3399
- package/dist/src-DKb-fkdb.mjs.map +0 -1
- package/dist/src-Dxl9ZlKn.mjs +0 -1752
- package/dist/src-Dxl9ZlKn.mjs.map +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { D as EffectLog, f as Schedule, g as Violation, n as Platform, o as ScenarioSpec, r as Bounds } from "./platform-Bpnav0kn.mjs";
|
|
2
|
+
interface BoundsReached {
|
|
3
|
+
readonly runs: number;
|
|
4
|
+
readonly effectPoints: number;
|
|
5
|
+
readonly faultsInjected: number;
|
|
6
|
+
readonly elapsedMs: number;
|
|
7
|
+
/**
|
|
8
|
+
* Present when exploration was exhaustive: how many distinct schedules ran
|
|
9
|
+
* (runs that only repeated an order the reduction had covered are not
|
|
10
|
+
* counted), and whether every schedule within the bounds was reached
|
|
11
|
+
* before the budget ran out.
|
|
12
|
+
*/
|
|
13
|
+
readonly exhaustive?: {
|
|
14
|
+
readonly complete: boolean;
|
|
15
|
+
readonly schedules: number;
|
|
16
|
+
readonly reduction: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface VerdictBase {
|
|
20
|
+
readonly scenario: string;
|
|
21
|
+
readonly seed: number | string;
|
|
22
|
+
readonly reached: BoundsReached;
|
|
23
|
+
readonly assumptions: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
interface Shrunk {
|
|
26
|
+
readonly faultsRemoved: number;
|
|
27
|
+
readonly eventsRemoved: number;
|
|
28
|
+
readonly runs: number;
|
|
29
|
+
}
|
|
30
|
+
interface Violated extends VerdictBase {
|
|
31
|
+
readonly kind: "VIOLATED";
|
|
32
|
+
readonly violation: Violation;
|
|
33
|
+
/** The replayed, shrunk trace that breaks the invariant. */
|
|
34
|
+
readonly trace: EffectLog;
|
|
35
|
+
readonly schedule: Schedule;
|
|
36
|
+
/** Ids of the drive's events that remain after shrinking. */
|
|
37
|
+
readonly keptEvents: readonly string[];
|
|
38
|
+
readonly shrunk: Shrunk;
|
|
39
|
+
}
|
|
40
|
+
interface Bounded extends VerdictBase {
|
|
41
|
+
readonly kind: "BOUNDED";
|
|
42
|
+
readonly bounds: Bounds;
|
|
43
|
+
}
|
|
44
|
+
type UnsupportedCause = "unsupported_api" | "not_replayable" | "module_state_leak" | "unsupported_bounds";
|
|
45
|
+
interface Unsupported extends VerdictBase {
|
|
46
|
+
readonly kind: "UNSUPPORTED";
|
|
47
|
+
readonly cause: UnsupportedCause;
|
|
48
|
+
readonly reason: string;
|
|
49
|
+
}
|
|
50
|
+
type ScenarioVerdict = Violated | Bounded | Unsupported;
|
|
51
|
+
/** One line per verdict, for error messages; full rendering lives in `report`. */
|
|
52
|
+
declare function describeVerdict(v: ScenarioVerdict): string;
|
|
53
|
+
/**
|
|
54
|
+
* SpecIR: function specs as plain data. The surface is TypeScript (a spec
|
|
55
|
+
* file beside the module, `forall(f, { when, ensures })` and `total(f)`
|
|
56
|
+
* from `eutaxy/spec`); the IR is Eutaxy's own, so the simulator's rungs
|
|
57
|
+
* and every engine read one shape. Binder domains are the function's
|
|
58
|
+
* parameter types, read from its declaration; the precondition and the
|
|
59
|
+
* claim are kept as the arrow functions' text, read by each engine into
|
|
60
|
+
* its own tree, and evaluated as code by the simulator's rungs.
|
|
61
|
+
*/
|
|
62
|
+
/** A TypeScript type as far as the reader can read it; `unknown` carries what it could not. */
|
|
63
|
+
type SpecType = {
|
|
64
|
+
readonly kind: "number";
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: "boolean";
|
|
67
|
+
} | {
|
|
68
|
+
readonly kind: "string";
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: "bigint";
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "literal";
|
|
73
|
+
readonly value: string | number | boolean;
|
|
74
|
+
} | {
|
|
75
|
+
readonly kind: "null";
|
|
76
|
+
} | {
|
|
77
|
+
readonly kind: "undefined";
|
|
78
|
+
} | {
|
|
79
|
+
readonly kind: "record";
|
|
80
|
+
/** The declared name, when the type is an `interface` or a `type` alias rather than inline. */
|
|
81
|
+
readonly name?: string;
|
|
82
|
+
readonly fields: readonly Field[];
|
|
83
|
+
} | {
|
|
84
|
+
readonly kind: "union";
|
|
85
|
+
readonly members: readonly SpecType[];
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: "unknown";
|
|
88
|
+
readonly text: string;
|
|
89
|
+
};
|
|
90
|
+
interface Field {
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly type: SpecType;
|
|
93
|
+
}
|
|
94
|
+
/** One end of a numeric range: the literal as written (sign included). `[` and `]` include the endpoint. */
|
|
95
|
+
interface Endpoint {
|
|
96
|
+
readonly value: string;
|
|
97
|
+
readonly inclusive: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* What the precondition says about one binder on its own, read from its
|
|
101
|
+
* conjuncts: `Number.isInteger(n)`, `0 <= n`, `n < 5`, `/^a+$/.test(s)`.
|
|
102
|
+
* Draws are steered by it; the precondition itself still has the last word.
|
|
103
|
+
*/
|
|
104
|
+
interface Hint {
|
|
105
|
+
readonly integer?: true;
|
|
106
|
+
readonly lower?: Endpoint;
|
|
107
|
+
readonly upper?: Endpoint;
|
|
108
|
+
readonly regex?: {
|
|
109
|
+
readonly pattern: string;
|
|
110
|
+
readonly flags: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** A parameter of the function under spec. */
|
|
114
|
+
interface Param {
|
|
115
|
+
/** Null for a destructured or rest parameter. */
|
|
116
|
+
readonly name: string | null;
|
|
117
|
+
readonly type: SpecType;
|
|
118
|
+
}
|
|
119
|
+
/** A quantified variable: a parameter, under the name the claim gives it. */
|
|
120
|
+
interface Binder {
|
|
121
|
+
readonly name: string;
|
|
122
|
+
readonly type: SpecType;
|
|
123
|
+
readonly hint?: Hint;
|
|
124
|
+
}
|
|
125
|
+
/** An arrow function from the spec file, as written. */
|
|
126
|
+
interface Arrow {
|
|
127
|
+
/** Parameter names in order; null for a destructured one. */
|
|
128
|
+
readonly params: readonly (string | null)[];
|
|
129
|
+
/** The body's source text: an expression, or the statements between the braces when `block`. */
|
|
130
|
+
readonly body: string;
|
|
131
|
+
readonly block: boolean;
|
|
132
|
+
/** 1-based line of the arrow in the spec file. */
|
|
133
|
+
readonly line: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* One exported spec: `forall(f, { when, ensures })`, a universally
|
|
137
|
+
* quantified claim over `f`'s parameters where the precondition holds, or
|
|
138
|
+
* `total(f)`, that `f` terminates on every input.
|
|
139
|
+
*/
|
|
140
|
+
interface Property {
|
|
141
|
+
/** The export's name in the spec file. */
|
|
142
|
+
readonly name: string;
|
|
143
|
+
readonly kind: "forall" | "total";
|
|
144
|
+
/** The parameters, named as `ensures` names them (the function's own names past its arity). */
|
|
145
|
+
readonly binders: readonly Binder[];
|
|
146
|
+
readonly when?: Arrow;
|
|
147
|
+
readonly ensures?: Arrow;
|
|
148
|
+
/**
|
|
149
|
+
* The module's functions the spec file imports, by the local name the
|
|
150
|
+
* arrows use: a claim's free names resolve here, never in the module.
|
|
151
|
+
*/
|
|
152
|
+
readonly imports: readonly {
|
|
153
|
+
readonly local: string;
|
|
154
|
+
readonly fn: string;
|
|
155
|
+
}[];
|
|
156
|
+
/** The claim as written, for reports. */
|
|
157
|
+
readonly text: string;
|
|
158
|
+
/** 1-based line of the export in the spec file. */
|
|
159
|
+
readonly line: number;
|
|
160
|
+
}
|
|
161
|
+
/** The specs on one exported function. */
|
|
162
|
+
interface FunctionSpec {
|
|
163
|
+
readonly name: string;
|
|
164
|
+
readonly params: readonly Param[];
|
|
165
|
+
readonly properties: readonly Property[];
|
|
166
|
+
/** 1-based line of the declaration in the module. */
|
|
167
|
+
readonly line: number;
|
|
168
|
+
/** Offset in the module's source of the `(` opening the parameters: the declaration's identity. */
|
|
169
|
+
readonly offset: number;
|
|
170
|
+
}
|
|
171
|
+
/** A problem with a spec, located in the spec file (or the module when `inModule`). */
|
|
172
|
+
interface SpecError {
|
|
173
|
+
readonly line: number;
|
|
174
|
+
readonly message: string;
|
|
175
|
+
readonly inModule?: true;
|
|
176
|
+
}
|
|
177
|
+
/** Every spec of one module, and what did not read. */
|
|
178
|
+
interface ModuleSpecs {
|
|
179
|
+
readonly functions: readonly FunctionSpec[];
|
|
180
|
+
readonly errors: readonly SpecError[];
|
|
181
|
+
}
|
|
182
|
+
interface ExploreOptions {
|
|
183
|
+
readonly seed: number | string;
|
|
184
|
+
/** Hard cap on runs, in addition to the scenario's time budget. */
|
|
185
|
+
readonly maxRuns?: number;
|
|
186
|
+
/**
|
|
187
|
+
* Replaces the scenario's `budgetMs` for this exploration: the real time
|
|
188
|
+
* exploring and shrinking may take, and the real time one effect's I/O
|
|
189
|
+
* may take before it counts as hung. With a generous budget and
|
|
190
|
+
* `maxRuns`, the run cap ends exploration, so a seed decides the verdict
|
|
191
|
+
* on any machine.
|
|
192
|
+
*/
|
|
193
|
+
readonly budgetMs?: number;
|
|
194
|
+
/**
|
|
195
|
+
* The share of seeded runs after the first (which injects none) that
|
|
196
|
+
* inject faults (see `planFaults`). Default 0.9: the runs without faults
|
|
197
|
+
* also check the scenario as it runs without them, and measure how many
|
|
198
|
+
* eligible points a run without faults has, which can vary with the seed.
|
|
199
|
+
*/
|
|
200
|
+
readonly faultProbability?: number;
|
|
201
|
+
/** Clock for the time budget; injectable for tests. */
|
|
202
|
+
readonly now?: () => number;
|
|
203
|
+
/** Hard cap on replay runs spent shrinking a violation. */
|
|
204
|
+
readonly maxShrinkRuns?: number;
|
|
205
|
+
/**
|
|
206
|
+
* How many of the first exploration runs to replay in reverse order
|
|
207
|
+
* before reporting BOUNDED, to detect module-level state leaking between
|
|
208
|
+
* runs. 0 disables the pass.
|
|
209
|
+
*/
|
|
210
|
+
readonly leakCheckRuns?: number;
|
|
211
|
+
/**
|
|
212
|
+
* Explore every schedule within the bounds, each once, instead of drawing
|
|
213
|
+
* schedules from the seed: every fault (or none) at every effect point
|
|
214
|
+
* that may still take one, and every order of turns. With `reduction`
|
|
215
|
+
* (the default), turns of different invocations on different targets
|
|
216
|
+
* commute and only one order of them is run.
|
|
217
|
+
*/
|
|
218
|
+
readonly exhaustive?: boolean | {
|
|
219
|
+
readonly reduction?: boolean;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/** Re-run a recorded schedule exactly. */
|
|
223
|
+
declare function replay(spec: ScenarioSpec, platform: Platform, schedule: Schedule): Promise<EffectLog>;
|
|
224
|
+
declare function explore(scenario: ScenarioSpec, platform: Platform, options: ExploreOptions): Promise<ScenarioVerdict>;
|
|
225
|
+
export { describeVerdict as _, Binder as a, ModuleSpecs as c, SpecType as d, Bounded as f, Violated as g, Unsupported as h, Arrow as i, Property as l, ScenarioVerdict as m, explore as n, FunctionSpec as o, BoundsReached as p, replay as r, Hint as s, ExploreOptions as t, SpecError as u };
|
|
226
|
+
//# sourceMappingURL=explore-DhfREiX9.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore-DhfREiX9.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../spec/src/ir.ts","../../engine/src/explore.ts"],"mappings":";UAOiB;WACN;WACA;WACA;WACA;;;;;;;WAOA;aACE;aACA;aACA;;;UAIH;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;UAGM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;UAGF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;UAMK,oBAAoB;WAC1B;WACA,OAAO;WACP;;KAGC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;;;;;;;;;;;KC1DvB;WACG;;WACA;;WACA;;WACA;;WACA;WAA0B;;WAC1B;;WACA;;WAEA;;WAEA;WACA,iBAAiB;;WAEjB;WAAwB,kBAAkB;;WAC1C;WAA0B;;UAExB;WACN;WACA,MAAM;;;UAIA;WACN;WACA;;;;;;;UAQM;WACN;WACA,QAAQ;WACR,QAAQ;WACR;aAAmB;aAA0B;;;;UAIvC;;WAEN;WACA,MAAM;;;UAIA;WACN;WACA,MAAM;WACN,OAAO;;;UAID;;WAEN;;WAEA;WACA;;WAEA;;;;;;;UAQM;;WAEN;WACA;;WAEA,kBAAkB;WAClB,OAAO;WACP,UAAU;;;;;WAKV;aAA6B;aAAwB;;;WAErD;;WAEA;;;UAIM;WACN;WACA,iBAAiB;WACjB,qBAAqB;;WAErB;;WAEA;;;UAIM;WACN;WACA;WACA;;;UAIM;WACN,oBAAoB;WACpB,iBAAiB;;UC9FX;WACN;;WAEA;;;;;;;;WAQA;;;;;;;WAOA;;WAEA;;WAEA;;;;;;WAMA;;;;;;;;WAQA;aAAkC;;;;iBAqKvB,OACpB,MAAM,cACN,UAAU,UACV,UAAU,WACT,QAAQ;iBAIW,QACpB,UAAU,cACV,UAAU,UACV,SAAS,iBACR,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,198 @@
|
|
|
1
|
-
import { C as StateQuery, D as EffectLog, E as EffectSelector, O as EffectRecord, S as RowCondition, T as Refines, _ as checkInvariant, b as Implies, d as FaultKind, f as Schedule, g as Violation, h as Invariant, l as validateScenario, m as AtMostOncePerKey, n as Platform, o as ScenarioSpec, p as AtLeastOnce, r as Bounds, t as EventRef, u as FaultDecision, v as checkInvariants, w as Unique, y as EveryRow } from "./platform-
|
|
2
|
-
import {
|
|
1
|
+
import { C as StateQuery, D as EffectLog, E as EffectSelector, O as EffectRecord, S as RowCondition, T as Refines, _ as checkInvariant, b as Implies, d as FaultKind, f as Schedule, g as Violation, h as Invariant, l as validateScenario, m as AtMostOncePerKey, n as Platform, o as ScenarioSpec, p as AtLeastOnce, r as Bounds, t as EventRef, u as FaultDecision, v as checkInvariants, w as Unique, y as EveryRow } from "./platform-Bpnav0kn.mjs";
|
|
2
|
+
import { _ as describeVerdict, a as Binder, c as ModuleSpecs, d as SpecType, f as Bounded, g as Violated, h as Unsupported, i as Arrow, l as Property, m as ScenarioVerdict, n as explore, o as FunctionSpec, p as BoundsReached, r as replay, s as Hint, t as ExploreOptions, u as SpecError } from "./explore-DhfREiX9.mjs";
|
|
3
|
+
import { n as Forall, t as Fn } from "./combinators-B7tV5fM_.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Spec verdicts: what is known about one property of one pure function.
|
|
6
|
+
* Kept apart from scenario verdicts in every report. The ladder runs
|
|
7
|
+
* `CHECKED` (held on every input the simulator passed), then `TESTED` (held
|
|
8
|
+
* on inputs generated from the binders' domains), then `PROVEN` (an engine
|
|
9
|
+
* proved it for every input); `CONFLICT` when engines disagree.
|
|
10
|
+
*/
|
|
11
|
+
interface SpecVerdictBase {
|
|
12
|
+
/** The module, as the scenario names it. */
|
|
13
|
+
readonly module: string;
|
|
14
|
+
readonly function: string;
|
|
15
|
+
/** The property's export name in the spec file. */
|
|
16
|
+
readonly property: string;
|
|
17
|
+
/** The property as written. */
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly assumptions: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
interface Checked extends SpecVerdictBase {
|
|
22
|
+
readonly kind: "CHECKED";
|
|
23
|
+
/** Distinct inputs the property was evaluated on. */
|
|
24
|
+
readonly inputs: number;
|
|
25
|
+
/** Distinct inputs outside the claim: a precondition failed, or a value fell outside its binder's domain. */
|
|
26
|
+
readonly discarded: number;
|
|
27
|
+
}
|
|
28
|
+
/** The property held on inputs generated from its binders' domains, and on the simulator's where it passed any. */
|
|
29
|
+
interface Tested extends SpecVerdictBase {
|
|
30
|
+
readonly kind: "TESTED";
|
|
31
|
+
/** Generated assignments the property held on. */
|
|
32
|
+
readonly inputs: number;
|
|
33
|
+
/** Generated assignments outside the claim: a precondition failed. */
|
|
34
|
+
readonly discarded: number;
|
|
35
|
+
/** The seed the assignments were drawn from; the same seed draws the same assignments. */
|
|
36
|
+
readonly seed: string;
|
|
37
|
+
/** Distinct inputs the simulator passed that the property also held on, when it passed any. */
|
|
38
|
+
readonly checked?: number;
|
|
39
|
+
}
|
|
40
|
+
/** One assignment that breaks the property, as JavaScript literals, and where it came from. */
|
|
41
|
+
interface Counterexample {
|
|
42
|
+
/** In the property's binder order. */
|
|
43
|
+
readonly binders: readonly {
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly value: string;
|
|
46
|
+
}[];
|
|
47
|
+
/** The simulator's call the assignment was taken from; absent when it was generated. */
|
|
48
|
+
readonly call?: string;
|
|
49
|
+
/** Set when evaluating the property threw instead of returning false. */
|
|
50
|
+
readonly error?: string;
|
|
51
|
+
}
|
|
52
|
+
interface Refuted extends SpecVerdictBase {
|
|
53
|
+
readonly kind: "REFUTED";
|
|
54
|
+
/** The rung that found the counterexample: a rung of the simulator, or an engine by name. */
|
|
55
|
+
readonly rung: "CHECKED" | "TESTED" | "PROVEN";
|
|
56
|
+
/** The engine, when the rung is PROVEN. */
|
|
57
|
+
readonly engine?: {
|
|
58
|
+
readonly name: string;
|
|
59
|
+
readonly version: string;
|
|
60
|
+
};
|
|
61
|
+
readonly counterexample: Counterexample;
|
|
62
|
+
}
|
|
63
|
+
/** Proved for every input by a named engine; the lower rungs' evidence is kept beside it. */
|
|
64
|
+
interface Proven extends SpecVerdictBase {
|
|
65
|
+
readonly kind: "PROVEN";
|
|
66
|
+
readonly engine: {
|
|
67
|
+
readonly name: string;
|
|
68
|
+
readonly version: string;
|
|
69
|
+
};
|
|
70
|
+
/** Generated inputs the TESTED rung held on, when it ran. */
|
|
71
|
+
readonly tested?: number;
|
|
72
|
+
/** Distinct inputs the simulator passed that the CHECKED rung held on, when it passed any. */
|
|
73
|
+
readonly checked?: number;
|
|
74
|
+
}
|
|
75
|
+
/** Two engines disagree: one proves, one refutes. Never resolved automatically. */
|
|
76
|
+
interface Conflict extends SpecVerdictBase {
|
|
77
|
+
readonly kind: "CONFLICT";
|
|
78
|
+
readonly proven: {
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly version: string;
|
|
81
|
+
};
|
|
82
|
+
readonly refuted: {
|
|
83
|
+
readonly name: string;
|
|
84
|
+
readonly version: string;
|
|
85
|
+
readonly counterexample?: Counterexample;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
type SpecUnknownCause = "gave_up" | "unsupported" | "unavailable";
|
|
89
|
+
interface SpecUnknown extends SpecVerdictBase {
|
|
90
|
+
readonly kind: "UNKNOWN";
|
|
91
|
+
readonly cause: SpecUnknownCause;
|
|
92
|
+
readonly reason: string;
|
|
93
|
+
}
|
|
94
|
+
type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;
|
|
95
|
+
/** One line per spec verdict, for error messages; full rendering lives in `report`. */
|
|
96
|
+
export declare function describeSpecVerdict(v: SpecVerdict): string;
|
|
97
|
+
interface CheckedInput {
|
|
98
|
+
readonly module: string;
|
|
99
|
+
readonly fn: FunctionSpec;
|
|
100
|
+
readonly property: Property;
|
|
101
|
+
/** The calls the simulator made, with their arguments. */
|
|
102
|
+
readonly calls: readonly {
|
|
103
|
+
readonly args: readonly unknown[];
|
|
104
|
+
}[];
|
|
105
|
+
/** The spec file's export, or undefined when it could not be loaded. */
|
|
106
|
+
readonly spec: Forall<Fn> | undefined;
|
|
107
|
+
/** Why the function's calls could not be observed, when they could not. */
|
|
108
|
+
readonly unobservable?: string;
|
|
109
|
+
}
|
|
110
|
+
export declare function checkedRung(input: CheckedInput): SpecVerdict;
|
|
111
|
+
interface TestedOptions {
|
|
112
|
+
/** The check's seed; each property derives its own stream from it and its name. */
|
|
113
|
+
readonly seed: string;
|
|
114
|
+
/** Distinct assignments the property must hold on; default 100. Drawing stops after 20 times as many draws, whatever they were. */
|
|
115
|
+
readonly inputs?: number;
|
|
116
|
+
}
|
|
117
|
+
interface TestedInput extends TestedOptions {
|
|
118
|
+
readonly module: string;
|
|
119
|
+
readonly fn: FunctionSpec;
|
|
120
|
+
readonly property: Property;
|
|
121
|
+
/** The spec file's export, or undefined when it could not be loaded. */
|
|
122
|
+
readonly spec: Forall<Fn> | undefined;
|
|
123
|
+
}
|
|
124
|
+
export declare function testedRung(input: TestedInput): SpecVerdict;
|
|
125
|
+
interface LadderOptions {
|
|
126
|
+
/** Run the `TESTED` rung with these options; `false` stops the ladder at `CHECKED`. */
|
|
127
|
+
readonly tested?: TestedOptions | false;
|
|
128
|
+
}
|
|
129
|
+
/** One property through the ladder's rungs. */
|
|
130
|
+
export declare function specLadder(input: CheckedInput, options?: LadderOptions): SpecVerdict;
|
|
131
|
+
interface EngineId {
|
|
132
|
+
readonly name: string;
|
|
133
|
+
readonly version: string;
|
|
134
|
+
}
|
|
135
|
+
type ProofOutcome = {
|
|
136
|
+
readonly kind: "PROVEN";
|
|
137
|
+
readonly engine: EngineId;
|
|
138
|
+
readonly assumptions: readonly string[];
|
|
139
|
+
} | {
|
|
140
|
+
readonly kind: "REFUTED";
|
|
141
|
+
readonly engine: EngineId;
|
|
142
|
+
readonly counterexample?: Counterexample;
|
|
143
|
+
readonly assumptions: readonly string[];
|
|
144
|
+
} | {
|
|
145
|
+
readonly kind: "UNKNOWN";
|
|
146
|
+
readonly cause: "gave_up" | "unsupported" | "unavailable";
|
|
147
|
+
readonly reason: string;
|
|
148
|
+
};
|
|
149
|
+
interface PropertyProof {
|
|
150
|
+
readonly function: string;
|
|
151
|
+
/** The property's export name in the spec file. */
|
|
152
|
+
readonly property: string;
|
|
153
|
+
readonly outcome: ProofOutcome;
|
|
154
|
+
}
|
|
155
|
+
interface ModuleProofs {
|
|
156
|
+
readonly results: readonly PropertyProof[];
|
|
157
|
+
/** Specs that did not read: properties asked for and never checked. */
|
|
158
|
+
readonly specErrors: readonly SpecError[];
|
|
159
|
+
}
|
|
160
|
+
interface ProveInput {
|
|
161
|
+
/** The module's source text. */
|
|
162
|
+
readonly source: string;
|
|
163
|
+
/** The module's specs, read from its spec file. */
|
|
164
|
+
readonly specs: ModuleSpecs;
|
|
165
|
+
/** The functions to prove; every one with specs when omitted. */
|
|
166
|
+
readonly functions?: readonly string[];
|
|
167
|
+
/** The spec file's path, for an engine that replays a counterexample through the spec itself. */
|
|
168
|
+
readonly specPath?: string;
|
|
169
|
+
readonly timeoutMs?: number;
|
|
170
|
+
}
|
|
171
|
+
interface Prover {
|
|
172
|
+
readonly name: string;
|
|
173
|
+
/** Whether the engine can run here, or why not. */
|
|
174
|
+
available(): Promise<{
|
|
175
|
+
readonly version: string;
|
|
176
|
+
} | {
|
|
177
|
+
readonly unavailable: string;
|
|
178
|
+
}>;
|
|
179
|
+
prove(input: ProveInput): Promise<ModuleProofs>;
|
|
180
|
+
}
|
|
181
|
+
/** What an engine said about one module, by its name. */
|
|
182
|
+
interface EngineReport {
|
|
183
|
+
readonly engine: string;
|
|
184
|
+
readonly proofs: ModuleProofs;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The simulator's verdicts for a module (CHECKED, TESTED, REFUTED, UNKNOWN,
|
|
188
|
+
* `total` included) combined with what the engines proved. A simulator
|
|
189
|
+
* counterexample stands. One engine proving is `PROVEN`, the lower rungs'
|
|
190
|
+
* counts kept beside it; an engine refuting where nothing else did is
|
|
191
|
+
* `REFUTED` at the PROVEN rung; one proving and another refuting is
|
|
192
|
+
* `CONFLICT`. An engine that gave up, could not run or does not take the
|
|
193
|
+
* function leaves the verdict as it was, with why among the assumptions.
|
|
194
|
+
*/
|
|
195
|
+
export declare function aggregate(module: string, verdicts: readonly SpecVerdict[], reports: readonly EngineReport[]): SpecVerdict[];
|
|
3
196
|
/**
|
|
4
197
|
* Observe a module's pure core functions while runs are installed: each call
|
|
5
198
|
* from outside the module is recorded with its arguments, for spec checks
|
|
@@ -31,16 +224,6 @@ interface CoreObserver {
|
|
|
31
224
|
export declare function observeCore(namespace: object, functions: readonly string[]): CoreObserver;
|
|
32
225
|
/** The scenario restricted to the kept events, with per-message invariants re-derived. */
|
|
33
226
|
export declare function restrictSpec(platform: Platform, spec: ScenarioSpec, keepIds: readonly string[]): ScenarioSpec;
|
|
34
|
-
export declare function extractSpecs(source: string): ModuleSpecs;
|
|
35
|
-
/** A property that is not Lemma. `stage` says which part rejected it. */
|
|
36
|
-
export declare class LemmaSyntaxError extends Error {
|
|
37
|
-
readonly stage: "prefix" | "formula";
|
|
38
|
-
constructor(stage: "prefix" | "formula", message: string);
|
|
39
|
-
}
|
|
40
|
-
/** Parse the text after `@ensures{name}`. Throws LemmaSyntaxError. */
|
|
41
|
-
export declare function parseProperty(text: string): Property;
|
|
42
|
-
/** The property as Lemma text (what follows `@ensures{name}`). */
|
|
43
|
-
export declare function printProperty(p: Property): string;
|
|
44
227
|
interface RegressionTestOptions {
|
|
45
228
|
/** Import lines for the scenario, the platform's dependencies, and anything the platform expression needs. */
|
|
46
229
|
readonly imports: readonly string[];
|
|
@@ -73,13 +256,5 @@ export declare function renderSpecs(specs: readonly SpecVerdict[]): string;
|
|
|
73
256
|
export declare function renderTrace(log: EffectLog, evidence?: readonly number[]): string;
|
|
74
257
|
/** A readable report: verdict, what it rests on, and for a violation the schedule and trace. */
|
|
75
258
|
export declare function renderText(verdict: ScenarioVerdict): string;
|
|
76
|
-
|
|
77
|
-
export declare const checkSpecModule: typeof checkSpecModule$1;
|
|
78
|
-
/** @deprecated Internal to `eutaxy check` since 0.5.1; removed in 0.6.0. */
|
|
79
|
-
export declare const lemmaBool: typeof lemmaBool$1;
|
|
80
|
-
/** @deprecated Internal to `eutaxy check` since 0.5.1; removed in 0.6.0. */
|
|
81
|
-
export declare const lemmaUnresolved: typeof lemmaUnresolved$1;
|
|
82
|
-
/** @deprecated Internal to `eutaxy check` since 0.5.1; removed in 0.6.0. */
|
|
83
|
-
export type ModulePredicates = ModulePredicates$1;
|
|
84
|
-
export { type AtLeastOnce, type AtMostOncePerKey, type Binder, type Bounded, type Bounds, type BoundsReached, type Checked, type CoreObserver, type Counterexample, type Domain, type EffectLog, type EffectRecord, type EffectSelector, type EventRef, type EveryRow, type ExploreOptions, type FaultDecision, type FaultKind, type Formula, type FunctionSpec, type Guard, type Implies, type Invariant, type ModuleSpecs, type NamedProperty, type ObservedCall, type Platform, type Property, type Refines, type Refuted, type RegressionTestOptions, type RowCondition, type ScenarioSpec, type ScenarioVerdict, type Schedule, type SpecUnknown, type SpecVerdict, type StateQuery, type Unique, type Unsupported, type Violated, type Violation, checkInvariant, checkInvariants, checkedRung, describeSpecVerdict, describeVerdict, explore, replay, validateScenario };
|
|
259
|
+
export { type Arrow, type AtLeastOnce, type AtMostOncePerKey, type Binder, type Bounded, type Bounds, type BoundsReached, type Checked, type Conflict, type CoreObserver, type Counterexample, type EffectLog, type EffectRecord, type EffectSelector, type EngineId, type EngineReport, type EventRef, type EveryRow, type ExploreOptions, type FaultDecision, type FaultKind, type FunctionSpec, type Hint, type Implies, type Invariant, type LadderOptions, type ModuleProofs, type ModuleSpecs, type ObservedCall, type Platform, type ProofOutcome, type Property, type PropertyProof, type ProveInput, type Proven, type Prover, type Refines, type Refuted, type RegressionTestOptions, type RowCondition, type ScenarioSpec, type ScenarioVerdict, type Schedule, type SpecType, type SpecUnknown, type SpecVerdict, type StateQuery, type Tested, type TestedOptions, type Unique, type Unsupported, type Violated, type Violation, checkInvariant, checkInvariants, describeVerdict, explore, replay, validateScenario };
|
|
85
260
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../core/src/spec-verdict.ts","../../prover/src/checked.ts","../../prover/src/tested.ts","../../prover/src/ladder.ts","../../prover/src/provers.ts","../../engine/src/observe.ts","../../engine/src/shrink.ts","../../report/src/regression.ts","../../report/src/render.ts"],"mappings":";;;;;;;;;;UAQU;;WAEC;WACA;;WAEA;;WAEA;WACA;;UAGM,gBAAgB;WACtB;;WAEA;;WAEA;;;UAIM,eAAe;WACrB;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;;WAEN;aAA6B;aAAuB;;;WAEpD;;WAEA;;UAGM,gBAAgB;WACtB;;WAEA;;WAEA;aAAoB;aAAuB;;WAC3C,gBAAgB;;;UAIV,eAAe;WACrB;WACA;aAAmB;aAAuB;;;WAE1C;;WAEA;;;UAIM,iBAAiB;WACvB;WACA;aAAmB;aAAuB;;WAC1C;aACE;aACA;aACA,iBAAiB;;;KAIlB;UAEK,oBAAoB;WAC1B;WACA,OAAO;WACP;;KAGC,cAAc,UAAU,SAAS,SAAS,UAAU,WAAW;;wBAG3D,oBAAoB,GAAG;UC9BtB;WACN;WACA,IAAI;WACJ,UAAU;;WAEV;aAA2B;;;WAE3B,MAAM,OAAO;;WAEb;;wBAGK,YAAY,OAAO,eAAe;UCzDjC;;WAEN;;WAEA;;UAGM,oBAAoB;WAC1B;WACA,IAAI;WACJ,UAAU;;WAEV,MAAM,OAAO;;wBAGR,WAAW,OAAO,cAAc;UCnB/B;;WAEN,SAAS;;;wBAIJ,WAAW,OAAO,cAAc,UAAS,gBAAqB;UCH7D;WACN;WACA;;KAGC;WACG;WAAyB,QAAQ;WAAmB;;WAEpD;WACA,QAAQ;WACR,iBAAiB;WACjB;;WAGA;WACA;WACA;;UAGE;WACN;;WAEA;WACA,SAAS;;UAGH;WACN,kBAAkB;;WAElB,qBAAqB;;UAGf;;WAEN;;WAEA,OAAO;;WAEP;;WAEA;WACA;;UAGM;WACN;;EAET,aAAa;aAAmB;;aAA+B;;EAC/D,MAAM,OAAO,aAAa,QAAQ;;;UAInB;WACN;WACA,QAAQ;;;;;;;;;;;wBAYH,UACd,gBACA,mBAAmB,eACnB,kBAAkB,iBACjB;;;;;;;;;;;;;;UCnEc;WACN;;WAEA;WACA;;UAGM;WACN,gBAAgB;;WAEhB;cAA0B;;;EAEnC;;wBAGc,YAAY,mBAAmB,+BAA+B;;wBCK9D,aACd,UAAU,UACV,MAAM,cACN,6BACC;UC7Bc;;WAEN;;WAEA;;WAEA;;WAEA;WACA;;;;;;WAMA;aACE;aACA;;;wBAIG,mBAAmB,SAAS,UAAU,SAAS;;;;;wBCf/C,WAAW,SAAS,iBAAiB,iBAAgB;;wBAUrD,YAAY,gBAAgB;;wBAwE5B,YAAY,KAAK,WAAW;;wBAuB5B,WAAW,SAAS"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,81 +1,21 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as
|
|
3
|
-
// packages/spec/src/print.ts
|
|
4
|
-
const precedence = {
|
|
5
|
-
iff: 1,
|
|
6
|
-
implies: 2,
|
|
7
|
-
or: 3,
|
|
8
|
-
and: 4,
|
|
9
|
-
not: 5,
|
|
10
|
-
atom: 6,
|
|
11
|
-
equation: 6
|
|
12
|
-
};
|
|
13
|
-
function guardText(g) {
|
|
14
|
-
if (g.kind === "regex") return `/${g.pattern}/${g.flags}`;
|
|
15
|
-
return `${g.lower.inclusive ? "[" : "("}${g.lower.value}, ${g.upper.value}${g.upper.inclusive ? "]" : ")"}`;
|
|
16
|
-
}
|
|
17
|
-
function sameGroup(a, b) {
|
|
18
|
-
return a.domain === b.domain && a.guard === void 0 === (b.guard === void 0) && (a.guard === void 0 || b.guard !== void 0 && guardText(a.guard) === guardText(b.guard));
|
|
19
|
-
}
|
|
20
|
-
function prefixText(binders) {
|
|
21
|
-
const groups = [];
|
|
22
|
-
for (const b of binders) {
|
|
23
|
-
const last = groups[groups.length - 1];
|
|
24
|
-
if (last && sameGroup(last[0], b)) last.push(b);
|
|
25
|
-
else groups.push([b]);
|
|
26
|
-
}
|
|
27
|
-
return `forall ${groups.map((g) => {
|
|
28
|
-
const head = g[0];
|
|
29
|
-
const guard = head.guard ? ` ∈ ${guardText(head.guard)}` : "";
|
|
30
|
-
return `(${g.map((b) => b.name).join(" ")}: ${head.domain}${guard})`;
|
|
31
|
-
}).join(" ")}`;
|
|
32
|
-
}
|
|
33
|
-
/** Print a formula, parenthesized when its precedence is below `min`. */
|
|
34
|
-
function printFormula(f, min = 0) {
|
|
35
|
-
let s;
|
|
36
|
-
switch (f.kind) {
|
|
37
|
-
case "atom":
|
|
38
|
-
s = f.text;
|
|
39
|
-
break;
|
|
40
|
-
case "equation":
|
|
41
|
-
s = `${f.left} ${f.negated ? "≢" : "≡"} ${f.right}`;
|
|
42
|
-
break;
|
|
43
|
-
case "not":
|
|
44
|
-
s = `¬${printFormula(f.operand, precedence.not)}`;
|
|
45
|
-
break;
|
|
46
|
-
case "and":
|
|
47
|
-
case "or":
|
|
48
|
-
s = f.operands.map((o) => printFormula(o, precedence[f.kind] + 1)).join(f.kind === "and" ? " ∧ " : " ∨ ");
|
|
49
|
-
break;
|
|
50
|
-
case "implies":
|
|
51
|
-
s = [...f.antecedents, f.consequent].map((o) => printFormula(o, precedence.or)).join(" → ");
|
|
52
|
-
break;
|
|
53
|
-
case "iff": s = `${printFormula(f.left, precedence.implies)} ↔ ${printFormula(f.right, precedence.implies)}`;
|
|
54
|
-
}
|
|
55
|
-
return precedence[f.kind] < min ? `(${s})` : s;
|
|
56
|
-
}
|
|
57
|
-
/** The property as Lemma text (what follows `@ensures{name}`). */
|
|
58
|
-
function printProperty(p) {
|
|
59
|
-
const body = p.requires.length > 0 ? [...p.requires, p.claim].map((f) => printFormula(f, precedence.or)).join(" → ") : printFormula(p.claim, p.claim.kind === "implies" ? precedence.or : 0);
|
|
60
|
-
return `${prefixText(p.binders)} { ${body} }`;
|
|
61
|
-
}
|
|
1
|
+
import { a as explore, b as checkInvariants, o as replay, s as restrictSpec, t as observeCore, v as validateScenario, y as checkInvariant } from "./src-BO7I3f-1.mjs";
|
|
2
|
+
import { a as emitRegressionTest, c as specLadder, d as checkedRung, g as describeVerdict, i as renderTrace, l as testedRung, n as renderSpecs, o as aggregate, r as renderText, t as renderJson } from "./src-DzpZxvQi.mjs";
|
|
62
3
|
// packages/core/src/spec-verdict.ts
|
|
63
4
|
/** One line per spec verdict, for error messages; full rendering lives in `report`. */
|
|
64
5
|
function describeSpecVerdict(v) {
|
|
65
6
|
const what = `${v.function} ${v.property}`;
|
|
66
7
|
switch (v.kind) {
|
|
67
8
|
case "CHECKED": return `CHECKED ${what}: held on ${v.inputs} input(s) the simulator passed`;
|
|
68
|
-
case "
|
|
9
|
+
case "TESTED": return `TESTED ${what}: held on ${v.inputs} generated input(s)`;
|
|
10
|
+
case "PROVEN": return `PROVEN ${what}: by ${v.engine.name} ${v.engine.version}`;
|
|
11
|
+
case "CONFLICT": return `CONFLICT ${what}: ${v.proven.name} proves it, ${v.refuted.name} refutes it`;
|
|
12
|
+
case "REFUTED": {
|
|
13
|
+
const c = v.counterexample;
|
|
14
|
+
return `REFUTED ${what}: ${c.call ?? c.binders.map((b) => `${b.name} = ${b.value}`).join(", ")}${c.error ? ` threw ${c.error}` : ""}`;
|
|
15
|
+
}
|
|
69
16
|
case "UNKNOWN": return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;
|
|
70
17
|
}
|
|
71
18
|
}
|
|
72
|
-
|
|
73
|
-
/** @deprecated Internal to `eutaxy check` since 0.5.1; removed in 0.6.0. */
|
|
74
|
-
const checkSpecModule = checkSpecModule$1;
|
|
75
|
-
/** @deprecated Internal to `eutaxy check` since 0.5.1; removed in 0.6.0. */
|
|
76
|
-
const lemmaBool = lemmaBool$1;
|
|
77
|
-
/** @deprecated Internal to `eutaxy check` since 0.5.1; removed in 0.6.0. */
|
|
78
|
-
const lemmaUnresolved = lemmaUnresolved$1;
|
|
79
|
-
export { LemmaSyntaxError, checkInvariant, checkInvariants, checkSpecModule, checkedRung, describeSpecVerdict, describeVerdict, emitRegressionTest, explore, extractSpecs, lemmaBool, lemmaUnresolved, observeCore, parseProperty, printProperty, renderJson, renderSpecs, renderText, renderTrace, replay, restrictSpec, validateScenario };
|
|
19
|
+
export { aggregate, checkInvariant, checkInvariants, checkedRung, describeSpecVerdict, describeVerdict, emitRegressionTest, explore, observeCore, renderJson, renderSpecs, renderText, renderTrace, replay, restrictSpec, specLadder, testedRung, validateScenario };
|
|
80
20
|
|
|
81
21
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/spec-verdict.ts"],"sourcesContent":["/**\n * Spec verdicts: what is known about one property of one pure function.\n * Kept apart from scenario verdicts in every report. The ladder runs\n * `CHECKED` (held on every input the simulator passed), then `TESTED` (held\n * on inputs generated from the binders' domains), then `PROVEN` (an engine\n * proved it for every input); `CONFLICT` when engines disagree.\n */\n\ninterface SpecVerdictBase {\n /** The module, as the scenario names it. */\n readonly module: string;\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n /** The property as written. */\n readonly text: string;\n readonly assumptions: readonly string[];\n}\n\nexport interface Checked extends SpecVerdictBase {\n readonly kind: \"CHECKED\";\n /** Distinct inputs the property was evaluated on. */\n readonly inputs: number;\n /** Distinct inputs outside the claim: a precondition failed, or a value fell outside its binder's domain. */\n readonly discarded: number;\n}\n\n/** The property held on inputs generated from its binders' domains, and on the simulator's where it passed any. */\nexport interface Tested extends SpecVerdictBase {\n readonly kind: \"TESTED\";\n /** Generated assignments the property held on. */\n readonly inputs: number;\n /** Generated assignments outside the claim: a precondition failed. */\n readonly discarded: number;\n /** The seed the assignments were drawn from; the same seed draws the same assignments. */\n readonly seed: string;\n /** Distinct inputs the simulator passed that the property also held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** One assignment that breaks the property, as JavaScript literals, and where it came from. */\nexport interface Counterexample {\n /** In the property's binder order. */\n readonly binders: readonly { readonly name: string; readonly value: string }[];\n /** The simulator's call the assignment was taken from; absent when it was generated. */\n readonly call?: string;\n /** Set when evaluating the property threw instead of returning false. */\n readonly error?: string;\n}\n\nexport interface Refuted extends SpecVerdictBase {\n readonly kind: \"REFUTED\";\n /** The rung that found the counterexample: a rung of the simulator, or an engine by name. */\n readonly rung: \"CHECKED\" | \"TESTED\" | \"PROVEN\";\n /** The engine, when the rung is PROVEN. */\n readonly engine?: { readonly name: string; readonly version: string };\n readonly counterexample: Counterexample;\n}\n\n/** Proved for every input by a named engine; the lower rungs' evidence is kept beside it. */\nexport interface Proven extends SpecVerdictBase {\n readonly kind: \"PROVEN\";\n readonly engine: { readonly name: string; readonly version: string };\n /** Generated inputs the TESTED rung held on, when it ran. */\n readonly tested?: number;\n /** Distinct inputs the simulator passed that the CHECKED rung held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** Two engines disagree: one proves, one refutes. Never resolved automatically. */\nexport interface Conflict extends SpecVerdictBase {\n readonly kind: \"CONFLICT\";\n readonly proven: { readonly name: string; readonly version: string };\n readonly refuted: {\n readonly name: string;\n readonly version: string;\n readonly counterexample?: Counterexample;\n };\n}\n\nexport type SpecUnknownCause = \"gave_up\" | \"unsupported\" | \"unavailable\";\n\nexport interface SpecUnknown extends SpecVerdictBase {\n readonly kind: \"UNKNOWN\";\n readonly cause: SpecUnknownCause;\n readonly reason: string;\n}\n\nexport type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;\n\n/** One line per spec verdict, for error messages; full rendering lives in `report`. */\nexport function describeSpecVerdict(v: SpecVerdict): string {\n const what = `${v.function} ${v.property}`;\n switch (v.kind) {\n case \"CHECKED\":\n return `CHECKED ${what}: held on ${v.inputs} input(s) the simulator passed`;\n case \"TESTED\":\n return `TESTED ${what}: held on ${v.inputs} generated input(s)`;\n case \"PROVEN\":\n return `PROVEN ${what}: by ${v.engine.name} ${v.engine.version}`;\n case \"CONFLICT\":\n return `CONFLICT ${what}: ${v.proven.name} proves it, ${v.refuted.name} refutes it`;\n case \"REFUTED\": {\n const c = v.counterexample;\n const where = c.call ?? c.binders.map((b) => `${b.name} = ${b.value}`).join(\", \");\n return `REFUTED ${what}: ${where}${c.error ? ` threw ${c.error}` : \"\"}`;\n }\n case \"UNKNOWN\":\n return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;\n }\n}\n"],"mappings":";;;;AA2FA,SAAgB,oBAAoB,GAAwB;CAC1D,MAAM,OAAO,GAAG,EAAE,SAAS,GAAG,EAAE;CAChC,QAAQ,EAAE,MAAV;EACE,KAAK,WACH,OAAO,WAAW,KAAK,YAAY,EAAE,OAAO;EAC9C,KAAK,UACH,OAAO,UAAU,KAAK,YAAY,EAAE,OAAO;EAC7C,KAAK,UACH,OAAO,UAAU,KAAK,OAAO,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO;EACzD,KAAK,YACH,OAAO,YAAY,KAAK,IAAI,EAAE,OAAO,KAAK,cAAc,EAAE,QAAQ,KAAK;EACzE,KAAK,WAAW;GACd,MAAM,IAAI,EAAE;GAEZ,OAAO,WAAW,KAAK,IADT,EAAE,QAAQ,EAAE,QAAQ,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,IAC7C,EAAE,QAAQ,UAAU,EAAE,UAAU;EACrE;EACA,KAAK,WACH,OAAO,WAAW,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE;CAC7C;AACF"}
|
|
@@ -260,9 +260,11 @@ interface ScenarioSpec {
|
|
|
260
260
|
readonly invariants: readonly Invariant[];
|
|
261
261
|
readonly bounds: Bounds;
|
|
262
262
|
/**
|
|
263
|
-
* Modules of pure core functions with
|
|
264
|
-
*
|
|
265
|
-
*
|
|
263
|
+
* Modules of pure core functions with specs, relative to the scenario;
|
|
264
|
+
* each module's specs are in the spec file beside it (`domain.ts` has
|
|
265
|
+
* `domain.props.ts`). Calls to the functions with specs are recorded as
|
|
266
|
+
* decisions during exploration, and each property is checked on the
|
|
267
|
+
* inputs seen.
|
|
266
268
|
*/
|
|
267
269
|
readonly specs?: readonly string[];
|
|
268
270
|
}
|
|
@@ -403,4 +405,4 @@ interface Platform {
|
|
|
403
405
|
cleanup?(spec: ScenarioSpec): Promise<void>;
|
|
404
406
|
}
|
|
405
407
|
export { StateQuery as C, EffectLog as D, EffectSelector as E, EffectRecord as O, RowCondition as S, Refines as T, checkInvariant as _, PlatformData as a, Implies as b, WorkerRef as c, FaultKind as d, Schedule as f, Violation as g, Invariant as h, ExternalDecl as i, JsonValue as k, validateScenario as l, AtMostOncePerKey as m, Platform as n, ScenarioSpec as o, AtLeastOnce as p, Bounds as r, ScriptedResponse as s, EventRef as t, FaultDecision as u, checkInvariants as v, Unique as w, References as x, EveryRow as y };
|
|
406
|
-
//# sourceMappingURL=platform-
|
|
408
|
+
//# sourceMappingURL=platform-Bpnav0kn.d.mts.map
|