tla-ts 0.0.3-dev.31e0776 → 0.0.3-dev.3504663

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 (48) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.d.cts +50 -22
  3. package/dist/index.d.ts +50 -22
  4. package/dist/index.js +1 -1
  5. package/dist/parallel-worker.cjs +1 -1
  6. package/dist/parallel-worker.js +2 -2
  7. package/dist/parallel.cjs +1 -1
  8. package/dist/parallel.js +2 -2
  9. package/dist/run-cli.cjs +14 -12
  10. package/dist/run-cli.js +22 -20
  11. package/dist/transfer.cjs +38 -21
  12. package/dist/transfer.js +38 -21
  13. package/package.json +1 -1
  14. package/src/ast.ts +11 -1
  15. package/src/builtins.ts +9 -3
  16. package/src/check.ts +357 -79
  17. package/src/codegen.ts +6 -3
  18. package/src/config.ts +224 -170
  19. package/src/environment.ts +90 -40
  20. package/src/errors.ts +89 -1
  21. package/src/evaluate.ts +182 -26
  22. package/src/exit-codes.ts +22 -3
  23. package/src/fingerprints.ts +2 -1
  24. package/src/instances.ts +1 -1
  25. package/src/levels.ts +173 -37
  26. package/src/live-check.ts +132 -70
  27. package/src/liveness.ts +117 -22
  28. package/src/parallel-worker.ts +2 -2
  29. package/src/parallel.ts +2 -2
  30. package/src/parser.ts +71 -19
  31. package/src/resolve.ts +429 -52
  32. package/src/run-cli.ts +59 -11
  33. package/src/sany-lexer.ts +615 -0
  34. package/src/sany-parse-error.ts +3143 -0
  35. package/src/spec-description.ts +1 -2
  36. package/src/standard-modules.ts +54 -45
  37. package/src/subexpressions.ts +25 -13
  38. package/src/substitution-levels.ts +38 -17
  39. package/src/successors.ts +121 -34
  40. package/src/symmetry.ts +16 -6
  41. package/src/tableau.ts +51 -24
  42. package/src/tlc-module.ts +6 -6
  43. package/src/tlc-modules.ts +4 -0
  44. package/src/tlc-order.ts +8 -4
  45. package/src/tlc-random.ts +9 -6
  46. package/src/tlc-summary.ts +20 -5
  47. package/src/value-sources.ts +29 -0
  48. package/src/values.ts +222 -57
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tla-ts",
3
- "version": "0.0.3-dev.31e0776",
3
+ "version": "0.0.3-dev.3504663",
4
4
  "description": "A TLA+ interpreter and model checker in TypeScript, 2× faster than TLC",
5
5
  "keywords": [
6
6
  "formal verification",
package/src/ast.ts CHANGED
@@ -33,9 +33,12 @@ export interface StringExpression {
33
33
  location: SourceLocation;
34
34
  }
35
35
 
36
+ // selectorRanges holds the range of each part of a name such as foo!lab, where SANY reports an
37
+ // error in selecting that part.
36
38
  export interface IdentifierExpression {
37
39
  kind: "Identifier";
38
40
  name: string;
41
+ selectorRanges?: SourceRange[];
39
42
  location: SourceLocation;
40
43
  resolution?: LocalResolution;
41
44
  }
@@ -47,6 +50,9 @@ export interface ApplyExpression {
47
50
  // The number of args each part of a name like F(x)!l(y) takes, when a part before the last takes
48
51
  // some.
49
52
  argumentCounts?: number[];
53
+ // The range of the parenthesized arguments of a named operator, where SANY reports their count.
54
+ argumentsRange?: SourceRange;
55
+ selectorRanges?: SourceRange[];
50
56
  location: SourceLocation;
51
57
  resolution?: LocalResolution;
52
58
  }
@@ -192,6 +198,7 @@ export interface FunctionSetExpression {
192
198
  export interface RecordField {
193
199
  name: string;
194
200
  value: Expression;
201
+ location: SourceLocation;
195
202
  }
196
203
 
197
204
  export interface RecordExpression {
@@ -280,6 +287,7 @@ export type Selector =
280
287
  export interface SubexpressionExpression {
281
288
  kind: "Subexpression";
282
289
  selectors: Selector[];
290
+ selectorRanges?: SourceRange[];
283
291
  location: SourceLocation;
284
292
  }
285
293
 
@@ -442,12 +450,14 @@ export type StepBody =
442
450
  | { kind: "Assert"; isSuffices: boolean; statement: Expression | AssumeProve }
443
451
  | { kind: "Qed" };
444
452
 
445
- // head is the range of the step number and its statement, without the proof.
453
+ // head is the range of the step number and its statement, without the proof, and statement is the
454
+ // range of the statement alone.
446
455
  export interface ProofStep {
447
456
  name: string | undefined;
448
457
  token: string;
449
458
  body: StepBody;
450
459
  head: SourceRange;
460
+ statement: SourceRange;
451
461
  proof: Proof | undefined;
452
462
  location: SourceLocation;
453
463
  }
package/src/builtins.ts CHANGED
@@ -297,15 +297,21 @@ export const getJavaInteger = (value: Value, signature: string) => {
297
297
  return value;
298
298
  };
299
299
 
300
- export const getIntegersSignature = (method: string, result: string, arity: number) =>
301
- `public static tlc2.value.impl.${result} tlc2.module.Integers.${method}(${Array.from({ length: arity }, () => "tlc2.value.impl.IntValue").join(",")})`;
300
+ export const getArithmeticSignature = (
301
+ javaClass: "Naturals" | "Integers",
302
+ method: string,
303
+ result: string,
304
+ arity: number,
305
+ ) =>
306
+ `public static tlc2.value.impl.${result} tlc2.module.${javaClass}.${method}(${Array.from({ length: arity }, () => "tlc2.value.impl.IntValue").join(",")})`;
302
307
 
303
308
  export const defineArithmetic = (
309
+ javaClass: "Naturals" | "Integers",
304
310
  name: string,
305
311
  method: string,
306
312
  compute: (left: number, right: number) => number,
307
313
  ) => {
308
- const signature = getIntegersSignature(method, "IntValue", 2);
314
+ const signature = getArithmeticSignature(javaClass, method, "IntValue", 2);
309
315
  return defineBinary(name, (left, right) => {
310
316
  const leftNumber = getJavaInteger(left, signature);
311
317
  const rightNumber = getJavaInteger(right, signature);