tla-ts 0.0.10-dev.28c823e4b → 0.0.10-dev.b4a856304
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/dist/index.cjs +1 -1
- package/dist/index.d.cts +0 -34
- package/dist/index.d.ts +0 -34
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove.cjs +43 -43
- package/dist/prove.js +47 -47
- package/dist/run.cjs +30 -30
- package/dist/run.js +33 -33
- package/dist/transfer.cjs +38 -38
- package/dist/transfer.js +39 -39
- package/package.json +1 -1
- package/src/ast.ts +5 -0
- package/src/bags.ts +5 -2
- package/src/builtins.ts +8 -1
- package/src/check.ts +193 -128
- package/src/cli/run.ts +2 -0
- package/src/cli/runtime-invariants.ts +7 -8
- package/src/cli/shared.ts +4 -0
- package/src/cli/tlc-arguments.ts +30 -24
- package/src/cli/tlc-usage.ts +3 -2
- package/src/evaluate.ts +102 -26
- package/src/java-overrides.ts +9 -4
- package/src/json-reader.ts +2 -1
- package/src/json.ts +11 -4
- package/src/levels.ts +15 -7
- package/src/lexer.ts +83 -72
- package/src/liveness-checker.ts +106 -77
- package/src/liveness.ts +34 -10
- package/src/parallel.ts +33 -26
- package/src/parser.ts +226 -163
- package/src/pcal/ast.ts +65 -53
- package/src/pcal/parse.ts +191 -144
- package/src/pcal/tokenize.ts +115 -91
- package/src/pcal/translate.ts +98 -83
- package/src/pcal/validate.ts +50 -48
- package/src/pretty-print.ts +6 -6
- package/src/randomization.ts +4 -1
- package/src/resolve.ts +70 -12
- package/src/runtime.ts +18 -11
- package/src/sany/builtins.ts +3 -1
- package/src/sany/generator.ts +127 -74
- package/src/sany/levels.ts +9 -5
- package/src/sany/lexer.ts +44 -40
- package/src/sany/linter.ts +1 -0
- package/src/search.ts +1 -1
- package/src/simulate.ts +59 -50
- package/src/spec-description.ts +34 -23
- package/src/standard-definitions.ts +3 -0
- package/src/standard-modules.ts +12 -1
- package/src/state-graph.ts +8 -1
- package/src/subexpressions.ts +47 -38
- package/src/successors.ts +35 -14
- package/src/symmetry.ts +19 -4
- package/src/tlc/fingerprint.ts +21 -15
- package/src/tlc/jar-data.ts +1 -0
- package/src/tlc/messages.ts +21 -2
- package/src/tlc/order.ts +38 -20
- package/src/tlc/random.ts +30 -18
- package/src/tlc/replay.ts +33 -13
- package/src/tlc/summary.ts +45 -36
- package/src/tlc/tlc-operators.ts +14 -4
- package/src/tlc/tlcext-operators.ts +15 -11
- package/src/tlc/trace-spec.ts +4 -0
- package/src/tlc/value-stream.ts +13 -9
- package/src/tlc/version.ts +1 -0
- package/src/values.ts +181 -74
package/src/tlc/value-stream.ts
CHANGED
|
@@ -24,11 +24,14 @@ const TAGS = {
|
|
|
24
24
|
handle: 26,
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// TLC fingerprints the value before it writes it, which normalizes every set and function.
|
|
28
|
+
export const serializeValue = (value: Value) => {
|
|
28
29
|
const bytes: number[] = [];
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const handles = {
|
|
31
|
+
objects: new Map<object, number>(),
|
|
32
|
+
names: new Map<string, number>(),
|
|
33
|
+
count: 0,
|
|
34
|
+
};
|
|
32
35
|
const modelValues = getModelValues();
|
|
33
36
|
const writeByte = (byte: number) => bytes.push(byte & 0xff);
|
|
34
37
|
const writeShort = (short: number) => {
|
|
@@ -40,6 +43,7 @@ const serializeValue = (value: Value) => {
|
|
|
40
43
|
writeShort(int);
|
|
41
44
|
};
|
|
42
45
|
const writeNat = (nat: number) => (nat > 0x7fff ? writeInt(-nat) : writeShort(nat));
|
|
46
|
+
// A reader skips the token and the variable location that TLC writes before the characters.
|
|
43
47
|
const writeString = (text: string) => {
|
|
44
48
|
writeByte(TAGS.string);
|
|
45
49
|
writeInt(0);
|
|
@@ -63,7 +67,7 @@ const serializeValue = (value: Value) => {
|
|
|
63
67
|
return;
|
|
64
68
|
}
|
|
65
69
|
if (typeof inner === "string") {
|
|
66
|
-
|
|
70
|
+
handles.count++;
|
|
67
71
|
writeString(inner);
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
@@ -78,12 +82,12 @@ const serializeValue = (value: Value) => {
|
|
|
78
82
|
writeInt(inner.high);
|
|
79
83
|
return;
|
|
80
84
|
}
|
|
81
|
-
const handle =
|
|
85
|
+
const handle = handles.objects.get(inner);
|
|
82
86
|
if (handle !== undefined) {
|
|
83
87
|
writeHandle(handle);
|
|
84
88
|
return;
|
|
85
89
|
}
|
|
86
|
-
|
|
90
|
+
handles.objects.set(inner, handles.count++);
|
|
87
91
|
if (isSetValue(inner)) {
|
|
88
92
|
const elements = toFiniteSet(inner).elements;
|
|
89
93
|
writeByte(TAGS.set);
|
|
@@ -104,9 +108,9 @@ const serializeValue = (value: Value) => {
|
|
|
104
108
|
writeInt(functionValue.domain.length);
|
|
105
109
|
functionValue.domain.forEach((name, index) => {
|
|
106
110
|
const fieldName = String(name);
|
|
107
|
-
const nameHandle =
|
|
111
|
+
const nameHandle = handles.names.get(fieldName);
|
|
108
112
|
if (nameHandle === undefined) {
|
|
109
|
-
|
|
113
|
+
handles.names.set(fieldName, handles.count++);
|
|
110
114
|
writeString(fieldName);
|
|
111
115
|
} else {
|
|
112
116
|
writeHandle(nameHandle);
|
package/src/tlc/version.ts
CHANGED