@earnestjs/model 0.1.0 → 0.2.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.
- package/README.md +110 -10
- package/dist/breadth.d.ts +125 -0
- package/dist/breadth.js +150 -0
- package/dist/declarations.d.ts +52 -2
- package/dist/declarations.js +94 -3
- package/dist/index.d.ts +6 -4
- package/dist/index.js +3 -2
- package/dist/m.d.ts +1 -1
- package/dist/m.js +1 -1
- package/dist/model.d.ts +135 -2
- package/dist/model.js +127 -5
- package/dist/replay.d.ts +8 -2
- package/dist/replay.js +6 -4
- package/dist/runs.d.ts +41 -0
- package/dist/runs.js +325 -0
- package/dist/search.d.ts +22 -13
- package/dist/search.js +236 -79
- package/dist/values.d.ts +12 -9
- package/dist/values.js +26 -15
- package/package.json +5 -5
package/dist/runs.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** One way a state changes into another: the positions of both states and of the action. */
|
|
2
|
+
export interface Edge {
|
|
3
|
+
readonly from: number;
|
|
4
|
+
readonly to: number;
|
|
5
|
+
readonly action: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The states a search visited and the actions between them, for judging a rule about runs.
|
|
9
|
+
* `edges` leaves out an action that keeps the state as it is, lists each edge once and is sorted
|
|
10
|
+
* by `from`, then `to`, then `action`. `fair` holds the positions of the actions that are not put
|
|
11
|
+
* off forever. `parents` gives the state each state was first reached from, or `null` for a start
|
|
12
|
+
* state, and `depth` the number of steps of that shortest way.
|
|
13
|
+
*/
|
|
14
|
+
export interface Graph {
|
|
15
|
+
readonly states: number;
|
|
16
|
+
readonly edges: readonly Edge[];
|
|
17
|
+
readonly fair: readonly number[];
|
|
18
|
+
readonly parents: readonly (number | null)[];
|
|
19
|
+
readonly depth: readonly number[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A run that never reaches the state a rule wants: `states` from a start state on, with the
|
|
23
|
+
* action taken into each state in `actions` (`null` for the first one that leads there, and for
|
|
24
|
+
* the start state). The steps from `repeatsFrom` on can repeat forever; `null` means the run
|
|
25
|
+
* stays in the last state.
|
|
26
|
+
*/
|
|
27
|
+
export interface Lasso {
|
|
28
|
+
readonly states: number[];
|
|
29
|
+
readonly actions: (number | null)[];
|
|
30
|
+
repeatsFrom: number | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gives the function that finds, for one rule about runs, a run of `graph` that never reaches
|
|
34
|
+
* the state the rule wants, or `null` when every run reaches it. `startsHere` says for each
|
|
35
|
+
* state whether the rule starts there, and `reached` whether the state is one the rule wants.
|
|
36
|
+
* A run never stops while an edge leaves its state, and never puts off forever a fair action
|
|
37
|
+
* that stays possible. The run found has the fewest steps before it stays or repeats. `"lost"`
|
|
38
|
+
* means a run exists and its loop could not be walked, which a graph of a finished search never
|
|
39
|
+
* gives.
|
|
40
|
+
*/
|
|
41
|
+
export declare const hunter: (graph: Graph) => ((startsHere: readonly boolean[], reached: readonly boolean[]) => Lasso | "lost" | null);
|
package/dist/runs.js
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
const NOWHERE = -1;
|
|
2
|
+
class Outgoing {
|
|
3
|
+
#first;
|
|
4
|
+
#edges;
|
|
5
|
+
constructor(states, edges) {
|
|
6
|
+
this.#edges = edges;
|
|
7
|
+
this.#first = Array.from({ length: states + 1 }, () => 0);
|
|
8
|
+
for (const edge of edges) {
|
|
9
|
+
this.#first[edge.from + 1] = (this.#first[edge.from + 1] ?? 0) + 1;
|
|
10
|
+
}
|
|
11
|
+
let total = 0;
|
|
12
|
+
for (const [position, count] of this.#first.entries()) {
|
|
13
|
+
total += count;
|
|
14
|
+
this.#first[position] = total;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
of(from) {
|
|
18
|
+
return this.#edges.slice(this.#first[from] ?? 0, this.#first[from + 1] ?? 0);
|
|
19
|
+
}
|
|
20
|
+
at(from, position) {
|
|
21
|
+
const index = (this.#first[from] ?? 0) + position;
|
|
22
|
+
return index < (this.#first[from + 1] ?? 0) ? this.#edges[index] : undefined;
|
|
23
|
+
}
|
|
24
|
+
firstAction(from, to) {
|
|
25
|
+
return this.of(from).find((edge) => edge.to === to)?.action ?? null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const groupsOf = (out, inside) => {
|
|
29
|
+
const states = inside.length;
|
|
30
|
+
const of = Array.from({ length: states }, () => NOWHERE);
|
|
31
|
+
const sizes = [];
|
|
32
|
+
const order = Array.from({ length: states }, () => NOWHERE);
|
|
33
|
+
const low = Array.from({ length: states }, () => NOWHERE);
|
|
34
|
+
const held = [];
|
|
35
|
+
const onHold = Array.from({ length: states }, () => false);
|
|
36
|
+
const walk = [];
|
|
37
|
+
let nextOrder = 0;
|
|
38
|
+
for (let root = 0; root < states; root += 1) {
|
|
39
|
+
if (inside[root] !== true || order[root] !== NOWHERE) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
walk.push([root, 0]);
|
|
43
|
+
for (let top = walk.pop(); top !== undefined; top = walk.pop()) {
|
|
44
|
+
const [state, tried] = top;
|
|
45
|
+
if (tried === 0) {
|
|
46
|
+
order[state] = nextOrder;
|
|
47
|
+
low[state] = nextOrder;
|
|
48
|
+
nextOrder += 1;
|
|
49
|
+
held.push(state);
|
|
50
|
+
onHold[state] = true;
|
|
51
|
+
}
|
|
52
|
+
const edge = out.at(state, tried);
|
|
53
|
+
if (edge !== undefined) {
|
|
54
|
+
walk.push([state, tried + 1]);
|
|
55
|
+
if (inside[edge.to] !== true) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (order[edge.to] === NOWHERE) {
|
|
59
|
+
walk.push([edge.to, 0]);
|
|
60
|
+
}
|
|
61
|
+
else if (onHold[edge.to] === true) {
|
|
62
|
+
low[state] = Math.min(low[state] ?? 0, order[edge.to] ?? 0);
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (low[state] === order[state]) {
|
|
67
|
+
const group = sizes.length;
|
|
68
|
+
let size = 0;
|
|
69
|
+
for (let member = held.pop(); member !== undefined; member = held.pop()) {
|
|
70
|
+
onHold[member] = false;
|
|
71
|
+
of[member] = group;
|
|
72
|
+
size += 1;
|
|
73
|
+
if (member === state) {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
sizes.push(size);
|
|
78
|
+
}
|
|
79
|
+
const parent = walk.at(-1);
|
|
80
|
+
if (parent !== undefined) {
|
|
81
|
+
low[parent[0]] = Math.min(low[parent[0]] ?? 0, low[state] ?? 0);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { of, sizes };
|
|
86
|
+
};
|
|
87
|
+
class Hunt {
|
|
88
|
+
#graph;
|
|
89
|
+
#out;
|
|
90
|
+
#possible;
|
|
91
|
+
constructor(graph) {
|
|
92
|
+
this.#graph = graph;
|
|
93
|
+
this.#out = new Outgoing(graph.states, graph.edges);
|
|
94
|
+
this.#possible = graph.fair.map((action) => {
|
|
95
|
+
const flags = Array.from({ length: graph.states }, () => false);
|
|
96
|
+
for (const edge of graph.edges) {
|
|
97
|
+
if (edge.action === action) {
|
|
98
|
+
flags[edge.from] = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return flags;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
#can(number, state) {
|
|
105
|
+
return this.#possible[number]?.[state] === true;
|
|
106
|
+
}
|
|
107
|
+
#doomed(inside, groups) {
|
|
108
|
+
const { fair } = this.#graph;
|
|
109
|
+
const flagsPerGroup = () => fair.map(() => Array.from({ length: groups.sizes.length }, () => false));
|
|
110
|
+
const putOff = flagsPerGroup();
|
|
111
|
+
const taken = flagsPerGroup();
|
|
112
|
+
for (const [state, group] of groups.of.entries()) {
|
|
113
|
+
if (group === NOWHERE) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
for (const [number, action] of fair.entries()) {
|
|
117
|
+
if (!this.#can(number, state)) {
|
|
118
|
+
(putOff[number] ?? [])[group] = true;
|
|
119
|
+
}
|
|
120
|
+
const insideTheGroup = this.#out
|
|
121
|
+
.of(state)
|
|
122
|
+
.some((edge) => edge.action === action && groups.of[edge.to] === group);
|
|
123
|
+
if (insideTheGroup) {
|
|
124
|
+
(taken[number] ?? [])[group] = true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return inside.map((_, state) => {
|
|
129
|
+
const group = groups.of[state] ?? NOWHERE;
|
|
130
|
+
if (group === NOWHERE) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
if ((groups.sizes[group] ?? 0) < 2) {
|
|
134
|
+
return this.#out.at(state, 0) === undefined;
|
|
135
|
+
}
|
|
136
|
+
return fair.every((_action, number) => putOff[number]?.[group] === true || taken[number]?.[group] === true);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
#wayIn(inside, triggers, doomed) {
|
|
140
|
+
const { depth } = this.#graph;
|
|
141
|
+
const depthOf = (state) => depth[state] ?? 0;
|
|
142
|
+
const sources = inside
|
|
143
|
+
.map((_, state) => state)
|
|
144
|
+
.filter((state) => triggers[state] === true && inside[state] === true)
|
|
145
|
+
.sort((one, other) => depthOf(one) - depthOf(other) || one - other);
|
|
146
|
+
let nextSource = 0;
|
|
147
|
+
const seen = inside.map(() => false);
|
|
148
|
+
const via = inside.map(() => NOWHERE);
|
|
149
|
+
const injectUpTo = (level, into) => {
|
|
150
|
+
for (let source = sources[nextSource]; source !== undefined && depthOf(source) <= level; source = sources[nextSource]) {
|
|
151
|
+
nextSource += 1;
|
|
152
|
+
if (seen[source] !== true) {
|
|
153
|
+
seen[source] = true;
|
|
154
|
+
into.push(source);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const first = sources[0];
|
|
159
|
+
if (first === undefined) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
let level = depthOf(first);
|
|
163
|
+
let frontier = [];
|
|
164
|
+
for (;;) {
|
|
165
|
+
injectUpTo(level, frontier);
|
|
166
|
+
frontier.sort((one, other) => one - other);
|
|
167
|
+
const found = frontier.find((state) => doomed[state] === true);
|
|
168
|
+
if (found !== undefined) {
|
|
169
|
+
const chain = [found];
|
|
170
|
+
for (let state = via[found] ?? NOWHERE; state !== NOWHERE; state = via[state] ?? NOWHERE) {
|
|
171
|
+
chain.push(state);
|
|
172
|
+
}
|
|
173
|
+
return chain.reverse();
|
|
174
|
+
}
|
|
175
|
+
const next = [];
|
|
176
|
+
injectUpTo(level + 1, next);
|
|
177
|
+
for (const state of frontier) {
|
|
178
|
+
for (const edge of this.#out.of(state)) {
|
|
179
|
+
if (inside[edge.to] === true && seen[edge.to] !== true) {
|
|
180
|
+
seen[edge.to] = true;
|
|
181
|
+
via[edge.to] = state;
|
|
182
|
+
next.push(edge.to);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (next.length === 0) {
|
|
187
|
+
const waiting = sources[nextSource];
|
|
188
|
+
if (waiting === undefined) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
level = depthOf(waiting);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
level += 1;
|
|
195
|
+
}
|
|
196
|
+
frontier = next;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
#route(from, group, groups, arrived) {
|
|
200
|
+
const via = new Map();
|
|
201
|
+
const queue = [from];
|
|
202
|
+
for (let head = 0; head < queue.length; head += 1) {
|
|
203
|
+
const state = queue[head] ?? from;
|
|
204
|
+
for (const edge of this.#out.of(state)) {
|
|
205
|
+
if (groups.of[edge.to] !== group) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (arrived(edge.to)) {
|
|
209
|
+
const chain = [edge.to, state];
|
|
210
|
+
for (let before = state; before !== from;) {
|
|
211
|
+
const earlier = via.get(before);
|
|
212
|
+
if (earlier === undefined) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
before = earlier;
|
|
216
|
+
chain.push(before);
|
|
217
|
+
}
|
|
218
|
+
return chain.reverse();
|
|
219
|
+
}
|
|
220
|
+
if (edge.to !== from && !via.has(edge.to)) {
|
|
221
|
+
via.set(edge.to, state);
|
|
222
|
+
queue.push(edge.to);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
#extend(lasso, chain) {
|
|
229
|
+
for (const [position, to] of chain.entries()) {
|
|
230
|
+
const from = chain[position - 1];
|
|
231
|
+
if (from !== undefined) {
|
|
232
|
+
lasso.states.push(to);
|
|
233
|
+
lasso.actions.push(this.#out.firstAction(from, to));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
#turn(lasso, groups) {
|
|
238
|
+
const home = lasso.states.at(-1);
|
|
239
|
+
if (home === undefined) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
const group = groups.of[home] ?? NOWHERE;
|
|
243
|
+
const begin = lasso.states.length - 1;
|
|
244
|
+
for (const [number, action] of this.#graph.fair.entries()) {
|
|
245
|
+
const here = lasso.states.at(-1) ?? home;
|
|
246
|
+
const waited = lasso.states.slice(begin).some((state) => !this.#can(number, state));
|
|
247
|
+
const happened = lasso.actions.slice(begin + 1).includes(action);
|
|
248
|
+
if (waited || happened) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
const waitsSomewhere = groups.of.some((found, state) => found === group && !this.#can(number, state));
|
|
252
|
+
if (waitsSomewhere) {
|
|
253
|
+
const chain = this.#route(here, group, groups, (state) => !this.#can(number, state));
|
|
254
|
+
if (chain === null) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
this.#extend(lasso, chain);
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const takes = (state) => this.#out.of(state).find((edge) => edge.action === action && groups.of[edge.to] === group);
|
|
261
|
+
if (takes(here) === undefined) {
|
|
262
|
+
const chain = this.#route(here, group, groups, (state) => takes(state) !== undefined);
|
|
263
|
+
if (chain === null) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
this.#extend(lasso, chain);
|
|
267
|
+
}
|
|
268
|
+
const edge = takes(lasso.states.at(-1) ?? home);
|
|
269
|
+
if (edge === undefined) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
lasso.states.push(edge.to);
|
|
273
|
+
lasso.actions.push(edge.action);
|
|
274
|
+
}
|
|
275
|
+
const here = lasso.states.at(-1) ?? home;
|
|
276
|
+
if (here !== home || lasso.states.length - 1 === begin) {
|
|
277
|
+
const chain = this.#route(here, group, groups, (state) => state === home);
|
|
278
|
+
if (chain === null) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
this.#extend(lasso, chain);
|
|
282
|
+
}
|
|
283
|
+
lasso.repeatsFrom = begin;
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
lasso(startsHere, reached) {
|
|
287
|
+
const inside = reached.map((reachedHere) => !reachedHere);
|
|
288
|
+
const groups = groupsOf(this.#out, inside);
|
|
289
|
+
const doomed = this.#doomed(inside, groups);
|
|
290
|
+
const chain = this.#wayIn(inside, startsHere, doomed);
|
|
291
|
+
const entered = chain?.[0];
|
|
292
|
+
if (chain === null || entered === undefined) {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
const before = [entered];
|
|
296
|
+
for (let parent = this.#graph.parents[entered] ?? null; parent !== null; parent = this.#graph.parents[parent] ?? null) {
|
|
297
|
+
before.push(parent);
|
|
298
|
+
}
|
|
299
|
+
before.reverse();
|
|
300
|
+
const lasso = {
|
|
301
|
+
states: before,
|
|
302
|
+
actions: before.map(() => null),
|
|
303
|
+
repeatsFrom: null,
|
|
304
|
+
};
|
|
305
|
+
this.#extend(lasso, chain);
|
|
306
|
+
const last = lasso.states.at(-1) ?? entered;
|
|
307
|
+
if ((groups.sizes[groups.of[last] ?? NOWHERE] ?? 0) >= 2 && !this.#turn(lasso, groups)) {
|
|
308
|
+
return "lost";
|
|
309
|
+
}
|
|
310
|
+
return lasso;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Gives the function that finds, for one rule about runs, a run of `graph` that never reaches
|
|
315
|
+
* the state the rule wants, or `null` when every run reaches it. `startsHere` says for each
|
|
316
|
+
* state whether the rule starts there, and `reached` whether the state is one the rule wants.
|
|
317
|
+
* A run never stops while an edge leaves its state, and never puts off forever a fair action
|
|
318
|
+
* that stays possible. The run found has the fewest steps before it stays or repeats. `"lost"`
|
|
319
|
+
* means a run exists and its loop could not be walked, which a graph of a finished search never
|
|
320
|
+
* gives.
|
|
321
|
+
*/
|
|
322
|
+
export const hunter = (graph) => {
|
|
323
|
+
const hunt = new Hunt(graph);
|
|
324
|
+
return (startsHere, reached) => hunt.lasso(startsHere, reached);
|
|
325
|
+
};
|
package/dist/search.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Status, type Verdict } from "./breadth.ts";
|
|
1
2
|
import type { ActionRunner, AnyModel } from "./model.ts";
|
|
2
3
|
import { type Json, type Row } from "./values.ts";
|
|
3
4
|
/** A field or an input with its value in JSON form. */
|
|
@@ -28,17 +29,22 @@ export interface Path {
|
|
|
28
29
|
readonly steps: readonly Step[];
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
|
-
* `
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* One rule's result. `path` is the shortest path to a state that breaks it, or `null`. A rule
|
|
33
|
+
* has no `kind`, `reason` or `repeatsFrom`. A rule about runs is listed after the rules with the
|
|
34
|
+
* `kind` `"eventually"`: its `path` leads into a run that never reaches the state it wants,
|
|
35
|
+
* `reason` says how the run goes on, and `repeatsFrom` is the position in `path.steps` of the
|
|
36
|
+
* first step of the loop that can repeat forever, left out when the run stays in the last state.
|
|
37
|
+
* A witness is listed last with the `kind` `"witness"`: its `path` is what was played until it
|
|
38
|
+
* broke, and `reason` says why it broke.
|
|
34
39
|
*/
|
|
35
|
-
export type Verdict = "holds" | "broken" | "unknown";
|
|
36
|
-
/** One rule's result. `path` is the shortest path to a state that breaks it, or `null`. */
|
|
37
40
|
export interface RuleResult {
|
|
38
41
|
readonly id: string;
|
|
39
42
|
readonly says: string;
|
|
40
43
|
readonly verdict: Verdict;
|
|
41
44
|
readonly path: Path | null;
|
|
45
|
+
readonly kind?: "eventually" | "witness";
|
|
46
|
+
readonly reason?: string;
|
|
47
|
+
readonly repeatsFrom?: number;
|
|
42
48
|
}
|
|
43
49
|
/**
|
|
44
50
|
* `stuck`: the condition of every action is false and so is every end. `out-of-range`: an action
|
|
@@ -53,12 +59,6 @@ export interface Finding {
|
|
|
53
59
|
readonly message: string;
|
|
54
60
|
readonly path: Path;
|
|
55
61
|
}
|
|
56
|
-
/**
|
|
57
|
-
* `unfinished` means the state limit stopped the search before anything was found wrong. Every
|
|
58
|
-
* state that is counted has its rules judged, also the ones the limit kept the search from
|
|
59
|
-
* going on from.
|
|
60
|
-
*/
|
|
61
|
-
export type Status = "pass" | "fail" | "unfinished";
|
|
62
62
|
/**
|
|
63
63
|
* What `explore` found. `states` counts distinct states, out-of-range ones included. `findings`
|
|
64
64
|
* holds at most one of each kind, in the order stuck, out-of-range, fault. `reason` says why an
|
|
@@ -77,13 +77,16 @@ export type Exports = Readonly<Record<string, unknown>>;
|
|
|
77
77
|
* `maxStates` stops the search before it holds more distinct states than this; the default is
|
|
78
78
|
* 5,000,000. `exports` is the model file's exports, which give each action, rule and end its
|
|
79
79
|
* id: the name it is exported under. One that is not among them has its sentence as its id.
|
|
80
|
+
* `setup` is a setup declared on the model with `m.setup`: the search then starts from the
|
|
81
|
+
* setup's start states and plays the witnesses that name it, as `earnest verify` does on the
|
|
82
|
+
* setup's own result line. Without it the search starts where the model declares and plays the
|
|
83
|
+
* witnesses that name no setup.
|
|
80
84
|
*/
|
|
81
85
|
export interface ExploreOptions {
|
|
82
86
|
readonly maxStates?: number;
|
|
83
87
|
readonly exports?: Exports;
|
|
88
|
+
readonly setup?: object;
|
|
84
89
|
}
|
|
85
|
-
/** The state limit `explore` uses when it is given none, the same as `earnest verify`. */
|
|
86
|
-
export declare const DEFAULT_MAX_STATES = 5000000;
|
|
87
90
|
/**
|
|
88
91
|
* Gives the function that names a part of a model: the name it is exported under in `exports`,
|
|
89
92
|
* or `fallback`, its sentence, when it is not exported there.
|
|
@@ -110,6 +113,12 @@ export declare const attempt: <T>(run: () => T) => Attempt<T>;
|
|
|
110
113
|
export declare const nextState: (action: ActionRunner, state: Row, input: Row) => Attempt<Row>;
|
|
111
114
|
/** Every input an action is tried with, in the checker's order: the first input varies fastest. */
|
|
112
115
|
export declare const inputsOf: (action: ActionRunner) => readonly Row[];
|
|
116
|
+
/**
|
|
117
|
+
* Gives the start states of `model`, or of `setup`, a setup declared on it with `m.setup`: each
|
|
118
|
+
* start state of the model with the setup's fields put in, once each, in the model's order.
|
|
119
|
+
* `asker` names the function in the error thrown for a setup of another model.
|
|
120
|
+
*/
|
|
121
|
+
export declare const startsOf: (model: AnyModel, setup: object | undefined, asker: string) => Row[];
|
|
113
122
|
/**
|
|
114
123
|
* Searches every state a model can reach, breadth first, and gives the count of distinct
|
|
115
124
|
* states, each rule's verdict with the shortest path to a state that breaks it, and the first
|