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.
Files changed (68) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.d.cts +0 -34
  3. package/dist/index.d.ts +0 -34
  4. package/dist/index.js +1 -1
  5. package/dist/parallel-worker.cjs +1 -1
  6. package/dist/parallel-worker.js +1 -1
  7. package/dist/prove.cjs +43 -43
  8. package/dist/prove.js +47 -47
  9. package/dist/run.cjs +30 -30
  10. package/dist/run.js +33 -33
  11. package/dist/transfer.cjs +38 -38
  12. package/dist/transfer.js +39 -39
  13. package/package.json +1 -1
  14. package/src/ast.ts +5 -0
  15. package/src/bags.ts +5 -2
  16. package/src/builtins.ts +8 -1
  17. package/src/check.ts +193 -128
  18. package/src/cli/run.ts +2 -0
  19. package/src/cli/runtime-invariants.ts +7 -8
  20. package/src/cli/shared.ts +4 -0
  21. package/src/cli/tlc-arguments.ts +30 -24
  22. package/src/cli/tlc-usage.ts +3 -2
  23. package/src/evaluate.ts +102 -26
  24. package/src/java-overrides.ts +9 -4
  25. package/src/json-reader.ts +2 -1
  26. package/src/json.ts +11 -4
  27. package/src/levels.ts +15 -7
  28. package/src/lexer.ts +83 -72
  29. package/src/liveness-checker.ts +106 -77
  30. package/src/liveness.ts +34 -10
  31. package/src/parallel.ts +33 -26
  32. package/src/parser.ts +226 -163
  33. package/src/pcal/ast.ts +65 -53
  34. package/src/pcal/parse.ts +191 -144
  35. package/src/pcal/tokenize.ts +115 -91
  36. package/src/pcal/translate.ts +98 -83
  37. package/src/pcal/validate.ts +50 -48
  38. package/src/pretty-print.ts +6 -6
  39. package/src/randomization.ts +4 -1
  40. package/src/resolve.ts +70 -12
  41. package/src/runtime.ts +18 -11
  42. package/src/sany/builtins.ts +3 -1
  43. package/src/sany/generator.ts +127 -74
  44. package/src/sany/levels.ts +9 -5
  45. package/src/sany/lexer.ts +44 -40
  46. package/src/sany/linter.ts +1 -0
  47. package/src/search.ts +1 -1
  48. package/src/simulate.ts +59 -50
  49. package/src/spec-description.ts +34 -23
  50. package/src/standard-definitions.ts +3 -0
  51. package/src/standard-modules.ts +12 -1
  52. package/src/state-graph.ts +8 -1
  53. package/src/subexpressions.ts +47 -38
  54. package/src/successors.ts +35 -14
  55. package/src/symmetry.ts +19 -4
  56. package/src/tlc/fingerprint.ts +21 -15
  57. package/src/tlc/jar-data.ts +1 -0
  58. package/src/tlc/messages.ts +21 -2
  59. package/src/tlc/order.ts +38 -20
  60. package/src/tlc/random.ts +30 -18
  61. package/src/tlc/replay.ts +33 -13
  62. package/src/tlc/summary.ts +45 -36
  63. package/src/tlc/tlc-operators.ts +14 -4
  64. package/src/tlc/tlcext-operators.ts +15 -11
  65. package/src/tlc/trace-spec.ts +4 -0
  66. package/src/tlc/value-stream.ts +13 -9
  67. package/src/tlc/version.ts +1 -0
  68. package/src/values.ts +181 -74
@@ -24,11 +24,14 @@ const TAGS = {
24
24
  handle: 26,
25
25
  };
26
26
 
27
- const serializeValue = (value: Value) => {
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 objectHandles = new Map<object, number>();
30
- const nameHandles = new Map<string, number>();
31
- let handleCount = 0;
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
- handleCount++;
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 = objectHandles.get(inner);
85
+ const handle = handles.objects.get(inner);
82
86
  if (handle !== undefined) {
83
87
  writeHandle(handle);
84
88
  return;
85
89
  }
86
- objectHandles.set(inner, handleCount++);
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 = nameHandles.get(fieldName);
111
+ const nameHandle = handles.names.get(fieldName);
108
112
  if (nameHandle === undefined) {
109
- nameHandles.set(fieldName, handleCount++);
113
+ handles.names.set(fieldName, handles.count++);
110
114
  writeString(fieldName);
111
115
  } else {
112
116
  writeHandle(nameHandle);
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
 
3
+ // "master" stands for the master builds that tla-ts follows for any other tla2tools.jar.
3
4
  export type TlcVersion = "1.7.4" | "master";
4
5
 
5
6
  const MANIFEST = "META-INF/MANIFEST.MF";