everystate 0.1.0 → 0.3.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 +121 -86
- package/bin/everystate.mjs +35 -0
- package/native/darwin-arm64/everystate +0 -0
- package/native/darwin-x64/everystate +0 -0
- package/native/linux-arm64/everystate +0 -0
- package/native/linux-x64/everystate +0 -0
- package/native/win32-x64/everystate.exe +0 -0
- package/package.json +29 -24
- package/skills/formal-verification/SKILL.md +115 -0
- package/skills/formal-verification/example/Charge.cfg +7 -0
- package/skills/formal-verification/example/Charge.tla +61 -0
- package/skills/formal-verification/example/ChargeBroken.cfg +7 -0
- package/wasm/cli.mjs +26 -0
- package/wasm/everystate.d.ts +33 -0
- package/wasm/everystate.mjs +112 -0
- package/wasm/everystate.wasm +0 -0
- package/CONFORMANCE.md +0 -64
- package/dist/bundled.d.ts +0 -1
- package/dist/bundled.js +0 -2
- package/dist/cfg.d.ts +0 -24
- package/dist/cfg.js +0 -252
- package/dist/checker.d.ts +0 -96
- package/dist/checker.js +0 -520
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -4
- package/dist/community.d.ts +0 -17
- package/dist/community.js +0 -1381
- package/dist/entry.d.ts +0 -2
- package/dist/entry.js +0 -39
- package/dist/eval.d.ts +0 -119
- package/dist/eval.js +0 -1533
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -24
- package/dist/java.d.ts +0 -2
- package/dist/java.js +0 -6
- package/dist/lexer.d.ts +0 -17
- package/dist/lexer.js +0 -255
- package/dist/liveness.d.ts +0 -80
- package/dist/liveness.js +0 -855
- package/dist/main.d.ts +0 -40
- package/dist/main.js +0 -494
- package/dist/model.d.ts +0 -56
- package/dist/model.js +0 -582
- package/dist/modules.d.ts +0 -91
- package/dist/modules.js +0 -649
- package/dist/node-host.d.ts +0 -2
- package/dist/node-host.js +0 -25
- package/dist/parser.d.ts +0 -30
- package/dist/parser.js +0 -1114
- package/dist/pprint.d.ts +0 -7
- package/dist/pprint.js +0 -647
- package/dist/stdlib.d.ts +0 -14
- package/dist/stdlib.js +0 -588
- package/dist/values.d.ts +0 -150
- package/dist/values.js +0 -822
package/dist/entry.d.ts
DELETED
package/dist/entry.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Runs a CLI entry point. Under Node the work is done in a worker thread with a large stack, because
|
|
2
|
-
// evaluating deeply recursive TLA+ definitions needs far more stack than the 1 MB main-thread default.
|
|
3
|
-
import { Worker, isMainThread, parentPort, workerData } from 'node:worker_threads';
|
|
4
|
-
import * as os from 'node:os';
|
|
5
|
-
import { nodeHost } from "./node-host.js";
|
|
6
|
-
export function runEntry(entryUrl, main) {
|
|
7
|
-
const isNode = !process.versions.bun && !globalThis.Deno;
|
|
8
|
-
if (!isMainThread && workerData && workerData.verifyEntry) {
|
|
9
|
-
const host = nodeHost();
|
|
10
|
-
let code = 0;
|
|
11
|
-
host.exit = c => { code = c; };
|
|
12
|
-
try {
|
|
13
|
-
main(workerData.argv, host);
|
|
14
|
-
}
|
|
15
|
-
finally {
|
|
16
|
-
parentPort.postMessage({ exit: code });
|
|
17
|
-
}
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (!isNode || process.env.EVERYSTATE_NO_WORKER) {
|
|
21
|
-
main(process.argv.slice(2), nodeHost());
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const heapMb = Math.max(2048, Math.min(16384, Math.floor(os.totalmem() / 1048576 * 0.75)));
|
|
25
|
-
const w = new Worker(new URL(entryUrl), {
|
|
26
|
-
workerData: { verifyEntry: true, argv: process.argv.slice(2) },
|
|
27
|
-
resourceLimits: { stackSizeMb: 256, maxOldGenerationSizeMb: heapMb },
|
|
28
|
-
stdout: false, stderr: false,
|
|
29
|
-
});
|
|
30
|
-
w.on('message', m => { if (m && typeof m.exit === 'number')
|
|
31
|
-
process.exitCode = m.exit; });
|
|
32
|
-
w.on('error', e => {
|
|
33
|
-
const msg = e.code === 'ERR_WORKER_OUT_OF_MEMORY'
|
|
34
|
-
? 'Error: everystate ran out of memory while exploring the state space.'
|
|
35
|
-
: `Error: ${e && e.stack ? e.stack : e}`;
|
|
36
|
-
process.stdout.write(msg + '\n');
|
|
37
|
-
process.exitCode = 255;
|
|
38
|
-
});
|
|
39
|
-
}
|
package/dist/eval.d.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import type { Node, Bound, Param } from './parser.ts';
|
|
2
|
-
import type { Def, Decl } from './modules.ts';
|
|
3
|
-
import { SetBase, IntervalV, ModelValue, sortDedup, EMPTY_SET } from './values.ts';
|
|
4
|
-
import type { Value } from './values.ts';
|
|
5
|
-
import { TlaError } from './lexer.ts';
|
|
6
|
-
export declare class Ctx {
|
|
7
|
-
name: string;
|
|
8
|
-
val: any;
|
|
9
|
-
next: Ctx | null;
|
|
10
|
-
base: Ctx | null;
|
|
11
|
-
constructor(name: string, val: any, next: Ctx | null);
|
|
12
|
-
}
|
|
13
|
-
declare const cons: (name: string, val: any, next: Ctx | null) => Ctx;
|
|
14
|
-
export declare class Lazy {
|
|
15
|
-
e: Node;
|
|
16
|
-
ctx: Ctx | null;
|
|
17
|
-
v: Value;
|
|
18
|
-
st: any;
|
|
19
|
-
constructor(e: Node, ctx: Ctx | null);
|
|
20
|
-
}
|
|
21
|
-
export declare class Closure {
|
|
22
|
-
params: Param[];
|
|
23
|
-
body: Node;
|
|
24
|
-
ctx: Ctx | null;
|
|
25
|
-
name: string;
|
|
26
|
-
constructor(params: Param[], body: Node, ctx: Ctx | null, name?: string);
|
|
27
|
-
describe(): string;
|
|
28
|
-
}
|
|
29
|
-
export declare class DefRef {
|
|
30
|
-
def: Def;
|
|
31
|
-
base: Ctx | null;
|
|
32
|
-
constructor(def: Def, base: Ctx | null);
|
|
33
|
-
describe(): string;
|
|
34
|
-
}
|
|
35
|
-
export type Op = Closure | DefRef;
|
|
36
|
-
export declare class LazyFcn {
|
|
37
|
-
node: Node;
|
|
38
|
-
ctx: Ctx | null;
|
|
39
|
-
ev: Evaluator;
|
|
40
|
-
memo: Map<any, any>;
|
|
41
|
-
forced: Value;
|
|
42
|
-
constructor(node: Node, ctx: Ctx | null, ev: Evaluator);
|
|
43
|
-
describe(): string;
|
|
44
|
-
show(): string;
|
|
45
|
-
bind(arg: Value): Ctx | null;
|
|
46
|
-
over: [Value, Value][] | null;
|
|
47
|
-
withOverride(key: Value, val: Value): LazyFcn;
|
|
48
|
-
apply(arg: Value, lazy?: boolean): Value;
|
|
49
|
-
domain(): SetBase;
|
|
50
|
-
force(): Value;
|
|
51
|
-
}
|
|
52
|
-
export declare class Evaluator {
|
|
53
|
-
nvars: number;
|
|
54
|
-
varNames: string[];
|
|
55
|
-
cur: Value[];
|
|
56
|
-
nxt: Value[] | null;
|
|
57
|
-
initMode: boolean;
|
|
58
|
-
primeDepth: number;
|
|
59
|
-
stTouch: number;
|
|
60
|
-
prTouch: number;
|
|
61
|
-
hooks: {
|
|
62
|
-
[k: string]: any;
|
|
63
|
-
};
|
|
64
|
-
callDepth: number;
|
|
65
|
-
nAssigned: number;
|
|
66
|
-
inEnabled: number;
|
|
67
|
-
extraGenerated: number;
|
|
68
|
-
scratch: Map<Decl, number>;
|
|
69
|
-
fail(msg: string, n?: Node): never;
|
|
70
|
-
lookup(ctx: Ctx | null, name: string): any;
|
|
71
|
-
envLookup(base: Ctx | null, name: string): any;
|
|
72
|
-
bindTuple(names: string[], v: Value, ctx: Ctx | null): Ctx | null;
|
|
73
|
-
force(lz: Lazy, lazy?: boolean): Value;
|
|
74
|
-
mkArg(n: Node, ctx: Ctx | null): any;
|
|
75
|
-
unthunk(t: any): Value;
|
|
76
|
-
buildEnv(def: Def, thunks: any[], callerBase: Ctx | null): Ctx | null;
|
|
77
|
-
expandDef(def: Def, thunks: any[], base: Ctx | null, viaInstance?: boolean): {
|
|
78
|
-
body: Node;
|
|
79
|
-
ctx: Ctx | null;
|
|
80
|
-
} | null;
|
|
81
|
-
expandApp(n: Node, ctx: Ctx | null): {
|
|
82
|
-
body: Node;
|
|
83
|
-
ctx: Ctx | null;
|
|
84
|
-
} | null;
|
|
85
|
-
expandOp(op: Op, thunks: any[]): {
|
|
86
|
-
body: Node;
|
|
87
|
-
ctx: Ctx | null;
|
|
88
|
-
} | null;
|
|
89
|
-
select(res: {
|
|
90
|
-
body: Node;
|
|
91
|
-
ctx: Ctx | null;
|
|
92
|
-
}, n: Node): {
|
|
93
|
-
body: Node;
|
|
94
|
-
ctx: Ctx | null;
|
|
95
|
-
};
|
|
96
|
-
applyOp(op: any, args: any[]): Value;
|
|
97
|
-
applyDef(def: Def, n: Node, ctx: Ctx | null): Value;
|
|
98
|
-
evalApp(n: Node, ctx: Ctx | null): Value;
|
|
99
|
-
evalBool(n: Node, ctx: Ctx | null): boolean;
|
|
100
|
-
evalSet(n: Node, ctx: Ctx | null): SetBase;
|
|
101
|
-
evalElems(n: Node, ctx: Ctx | null): Value[];
|
|
102
|
-
forBindings(bounds: Bound[], ctx: Ctx | null, f: (c: Ctx | null) => boolean): boolean;
|
|
103
|
-
bindLet(defs: Node[], ctx: Ctx | null): Ctx | null;
|
|
104
|
-
eval(n: Node, ctx: Ctx | null): Value;
|
|
105
|
-
evalLazy(n: Node, ctx: Ctx | null): Value;
|
|
106
|
-
mkRecord(_n: Node, names: string[], vals: Value[]): Value;
|
|
107
|
-
unchangedVal(e: Node, ctx: Ctx | null): boolean;
|
|
108
|
-
setUnion(a: SetBase, b: SetBase): SetBase;
|
|
109
|
-
evalFnDef(n: Node, ctx: Ctx | null): Value;
|
|
110
|
-
applyFcn(f: Value, arg: Value, n?: Node): Value;
|
|
111
|
-
exceptUpdate(f: Value, path: Value[], i: number, valNode: Node, ctx: Ctx | null, n: Node): Value;
|
|
112
|
-
enabled(a: Node, ctx: Ctx | null): boolean;
|
|
113
|
-
asVar(e: Node, ctx: Ctx | null): number;
|
|
114
|
-
enumerate(e: Node, ctx: Ctx | null, k: () => void): void;
|
|
115
|
-
enumConj(items: Node[], i: number, ctx: Ctx | null, k: () => void): void;
|
|
116
|
-
targetVar(lhs: Node, ctx: Ctx | null): number;
|
|
117
|
-
enumUnchanged(e: Node, ctx: Ctx | null, k: () => void): void;
|
|
118
|
-
}
|
|
119
|
-
export { cons, TlaError, EMPTY_SET, IntervalV, sortDedup, ModelValue };
|