tla-ts 0.0.3-dev.6a30eee → 0.0.3-dev.6ac5593

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 (55) hide show
  1. package/README.md +5 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.cts +70 -22
  4. package/dist/index.d.ts +70 -22
  5. package/dist/index.js +1 -1
  6. package/dist/parallel-worker.cjs +1 -1
  7. package/dist/parallel-worker.js +2 -2
  8. package/dist/parallel.cjs +1 -1
  9. package/dist/parallel.js +2 -2
  10. package/dist/run-cli.cjs +20 -18
  11. package/dist/run-cli.js +22 -20
  12. package/dist/transfer.cjs +41 -15
  13. package/dist/transfer.js +41 -15
  14. package/package.json +1 -1
  15. package/src/ast.ts +121 -4
  16. package/src/builtins.ts +9 -3
  17. package/src/check.ts +480 -106
  18. package/src/cli-options.ts +11 -5
  19. package/src/codegen.ts +15 -22
  20. package/src/config.ts +224 -170
  21. package/src/dependencies.ts +2 -2
  22. package/src/environment.ts +410 -130
  23. package/src/errors.ts +104 -3
  24. package/src/evaluate.ts +402 -182
  25. package/src/exit-codes.ts +21 -14
  26. package/src/fingerprints.ts +2 -1
  27. package/src/instances.ts +17 -16
  28. package/src/levels.ts +185 -44
  29. package/src/live-check.ts +132 -70
  30. package/src/liveness.ts +118 -24
  31. package/src/parallel-worker.ts +2 -2
  32. package/src/parallel.ts +5 -2
  33. package/src/parser.ts +172 -53
  34. package/src/resolve.ts +1378 -420
  35. package/src/run-cli.ts +106 -18
  36. package/src/runtime.ts +2 -0
  37. package/src/sany-lexer.ts +615 -0
  38. package/src/sany-parse-error.ts +3143 -0
  39. package/src/spec-description.ts +19 -8
  40. package/src/standard-modules.ts +54 -45
  41. package/src/standard-ranges.ts +116 -0
  42. package/src/state-graph.ts +157 -0
  43. package/src/subexpressions.ts +231 -171
  44. package/src/substitution-levels.ts +38 -17
  45. package/src/successors.ts +177 -37
  46. package/src/symmetry.ts +109 -41
  47. package/src/tableau.ts +51 -24
  48. package/src/tlc-ext.ts +29 -12
  49. package/src/tlc-module.ts +14 -33
  50. package/src/tlc-modules.ts +4 -0
  51. package/src/tlc-order.ts +8 -4
  52. package/src/tlc-random.ts +9 -6
  53. package/src/tlc-summary.ts +20 -5
  54. package/src/value-sources.ts +29 -0
  55. package/src/values.ts +242 -61
package/src/exit-codes.ts CHANGED
@@ -17,12 +17,6 @@ export const EXIT_STATUS = {
17
17
  } as const;
18
18
 
19
19
  const exitCodes = new WeakMap<Error, number>();
20
- const moduleExitCodes = new WeakMap<Error, number>();
21
- const phase = { isNextState: false };
22
-
23
- export const setNextStatePhase = (isNextState: boolean) => {
24
- phase.isNextState = isNextState;
25
- };
26
20
 
27
21
  // The innermost site that knows TLC's exit status for an error sets it first and wins.
28
22
  export const setExitCode = <Thrown>(error: Thrown, code: number) => {
@@ -30,15 +24,21 @@ export const setExitCode = <Thrown>(error: Thrown, code: number) => {
30
24
  return error;
31
25
  };
32
26
 
33
- // TLC exits with the code of an exception from a standard module's Java code only when the exception
34
- // escapes the computation of next states. In every other phase, the phase decides the code.
35
- export const setModuleExitCode = (error: Error, code: number) => {
36
- if (phase.isNextState) moduleExitCodes.set(error, code);
27
+ export const getExitCode = (error: Error) => exitCodes.get(error);
28
+
29
+ const ownExitCodes = new WeakMap<Error, number>();
30
+
31
+ // The exit status of the error code TLC gives an EvalException, which TLC uses only where it
32
+ // doesn't report the error again as a nested expression.
33
+ export const setOwnExitCode = <Thrown extends Error>(error: Thrown, code: number) => {
34
+ ownExitCodes.set(error, code);
35
+ return error;
37
36
  };
38
37
 
39
- export const getExitCode = (error: Error) => exitCodes.get(error) ?? moduleExitCodes.get(error);
38
+ export const getOwnExitCode = (error: unknown) =>
39
+ error instanceof Error ? ownExitCodes.get(error) : undefined;
40
40
 
41
- // TLC exits with 255 when it fails to process or evaluate a liveness property, in any phase.
41
+ // TLC exits with 255 when it fails to process or evaluate a liveness property.
42
42
  const withErrorExitCode = <Result>(run: () => Result) => {
43
43
  try {
44
44
  return run();
@@ -53,8 +53,15 @@ export const withLivenessExitCode = (
53
53
  const checker = withErrorExitCode(create);
54
54
  return (
55
55
  checker && {
56
- addInitialState: (index, state) =>
57
- withErrorExitCode(() => checker.addInitialState(index, state)),
56
+ // TLC replays the initial states to report an error, but skips the liveness check of a
57
+ // state it has already seen, so it exits with the status of the error's own code.
58
+ addInitialState: (index, state) => {
59
+ try {
60
+ checker.addInitialState(index, state);
61
+ } catch (error) {
62
+ throw setExitCode(error, getOwnExitCode(error) ?? EXIT_STATUS.error);
63
+ }
64
+ },
58
65
  addState: (index, state, successors) =>
59
66
  withErrorExitCode(() => checker.addState(index, state, successors)),
60
67
  findViolation: () => withErrorExitCode(() => checker.findViolation()),
@@ -1,4 +1,4 @@
1
- import { getValueFingerprint, getValueHash, type Value } from "./values";
1
+ import { assertFingerprintable, getValueFingerprint, getValueHash, type Value } from "./values";
2
2
 
3
3
  const EMPTY = 0;
4
4
  const INITIAL_CAPACITY = 1 << 12;
@@ -20,6 +20,7 @@ export const writeStateFingerprint = (state: Value[], fingerprint: Int32Array) =
20
20
  first = Math.imul(first ^ getValueHash(state[index]), 0x01000193);
21
21
  second = Math.imul(second ^ getValueFingerprint(state[index]), 0x5bd1e995);
22
22
  }
23
+ assertFingerprintable(state);
23
24
  fingerprint[0] = mix(first) || 1;
24
25
  fingerprint[1] = mix(second);
25
26
  };
package/src/instances.ts CHANGED
@@ -1,16 +1,17 @@
1
- import type {
2
- Bound,
3
- BoundPattern,
4
- Definition,
5
- Expression,
6
- Instance,
7
- Module,
8
- OperatorParam,
9
- SourceLocation,
10
- Theorem,
1
+ import {
2
+ getChildren,
3
+ isLocallyResolved,
4
+ type Bound,
5
+ type BoundPattern,
6
+ type Definition,
7
+ type Expression,
8
+ type Instance,
9
+ type Module,
10
+ type OperatorParam,
11
+ type SourceLocation,
12
+ type Theorem,
11
13
  } from "./ast";
12
14
  import { TlaSyntaxError } from "./errors";
13
- import { getChildren, isLocallyResolved } from "./evaluate";
14
15
  import { getArity, getBoundNames, getPatternNames, isBefore } from "./resolve";
15
16
 
16
17
  export const substitutedExpressions = new WeakSet<Expression>();
@@ -163,7 +164,7 @@ export const mapChildren = (
163
164
  case "RecordSet":
164
165
  return {
165
166
  ...expression,
166
- fields: expression.fields.map((field) => ({ name: field.name, value: plain(field.value) })),
167
+ fields: expression.fields.map((field) => ({ ...field, value: plain(field.value) })),
167
168
  };
168
169
  case "Except":
169
170
  return {
@@ -218,7 +219,7 @@ interface Instantiation {
218
219
  variables: Set<string>;
219
220
  getDefinition: (key: string) => Definition | undefined;
220
221
  isParameterized: (key: string) => boolean;
221
- addDefinition: (name: string, create: (key: string) => Definition) => string;
222
+ addDefinition: (source: string, name: string, create: (key: string) => Definition) => string;
222
223
  createName: (name: string) => string;
223
224
  }
224
225
 
@@ -639,7 +640,7 @@ const copyDefinition = (rewrite: Rewrite, key: string): string => {
639
640
  const instantiation = rewrite.instantiation;
640
641
  const definition = instantiation.getDefinition(key);
641
642
  if (!definition) return key;
642
- return instantiation.addDefinition(definition.name, (copyKey) => {
643
+ return instantiation.addDefinition(key, definition.name, (copyKey) => {
643
644
  rewrite.copies.set(key, copyKey);
644
645
  const rename = createRenamer(rewrite);
645
646
  const mapped = renameParams(
@@ -678,7 +679,7 @@ export const createInstantiation = (instantiation: Instantiation) => {
678
679
  if (copy !== undefined) return copy;
679
680
  const definition = instantiation.getDefinition(key);
680
681
  if (!definition) return key;
681
- return instantiation.addDefinition(definition.name, () =>
682
+ return instantiation.addDefinition(key, definition.name, () =>
682
683
  withInstanceParams(definition, instantiation.params, definition.location),
683
684
  );
684
685
  },
@@ -704,7 +705,7 @@ const expandLetInstances = (
704
705
  const index = position === -1 ? current.length : position;
705
706
  return [...current.slice(0, index), ...instantiate(instance, inner), ...current.slice(index)];
706
707
  }, mapped.definitions);
707
- return { kind: "Let", definitions, body: mapped.body, location: mapped.location };
708
+ return { ...mapped, definitions };
708
709
  };
709
710
 
710
711
  // A named theorem's statement is linked as its definition.
package/src/levels.ts CHANGED
@@ -1,15 +1,23 @@
1
- import type {
2
- AssumeProve,
3
- Definition,
4
- Expression,
5
- Module,
6
- OperatorParam,
7
- SourceLocation,
1
+ import {
2
+ getChildren,
3
+ type AssumeProve,
4
+ type Definition,
5
+ type Expression,
6
+ type Module,
7
+ type OperatorParam,
8
+ type Proof,
9
+ type ProofStep,
10
+ type SourceLocation,
8
11
  } from "./ast";
9
- import { TlaSyntaxError } from "./errors";
10
- import { getChildren } from "./evaluate";
12
+ import {
13
+ createSanyError,
14
+ createSemanticError,
15
+ formatRange,
16
+ TlaSyntaxError,
17
+ type SanyError,
18
+ } from "./errors";
11
19
  import { mapChildren } from "./instances";
12
- import { getBoundNames, getPatternNames } from "./resolve";
20
+ import { collectSemanticErrors, getBoundNames, getPatternNames } from "./resolve";
13
21
  import { STANDARD_LEVELS } from "./standard-levels";
14
22
 
15
23
  interface LevelData {
@@ -34,6 +42,7 @@ interface LevelContext {
34
42
  constants: Set<string>;
35
43
  variables: Set<string>;
36
44
  getDefinition: (name: string) => Definition | undefined;
45
+ getQualifiedName?: (name: string) => string | undefined;
37
46
  }
38
47
 
39
48
  type ScopeEntry =
@@ -176,8 +185,13 @@ export const ACTION_LEVEL = 2;
176
185
 
177
186
  export const TEMPORAL_LEVEL = 3;
178
187
 
179
- const createLevelError = (message: string, location: SourceLocation) =>
180
- new TlaSyntaxError(`${message} at line ${location.line}, column ${location.column}`);
188
+ // SANY reports a level error at the range of the expression it rejects.
189
+ const createLevelError = (message: string, expression: Expression) =>
190
+ expression.location.range
191
+ ? createSemanticError(`${message}.`, expression.location.range)
192
+ : new TlaSyntaxError(
193
+ `${message} at line ${expression.location.line}, column ${expression.location.column}`,
194
+ );
181
195
 
182
196
  const LOGICAL_OPERATORS = new Set(["/\\", "\\/", "=>", "<=>"]);
183
197
 
@@ -201,7 +215,13 @@ export const createLevelAnalyzer = (context: LevelContext) => {
201
215
  if (context.variables.has(name)) return { kind: "Declared", name, level: 1, arity: 0 };
202
216
  const definition = context.getDefinition(name);
203
217
  if (definition) {
204
- return { kind: "Defined", levels: analyzeDefinition(definition, new Map()) };
218
+ const levels = analyzeDefinition(definition, new Map());
219
+ // SANY names a definition of an instance by its qualified name, as in I!Foo.
220
+ const qualifiedName = context.getQualifiedName?.(name);
221
+ return {
222
+ kind: "Defined",
223
+ levels: qualifiedName ? { ...levels, name: qualifiedName } : levels,
224
+ };
205
225
  }
206
226
  const signature = CORE_SIGNATURES.get(name) ?? STANDARD_LEVELS.get(name);
207
227
  if (signature) return { kind: "Defined", levels: signature };
@@ -237,13 +257,13 @@ export const createLevelAnalyzer = (context: LevelContext) => {
237
257
  if (operand.operator || operand.declared) return;
238
258
  if (operand.data.level > getMaxLevel(operator, index)) {
239
259
  throw new TlaSyntaxError(
240
- `Level error in applying operator ${operator.name}: The level of argument ${index + 1} exceeds the maximum level allowed by the operator.`,
260
+ `Level error in applying operator ${operator.name}:\nThe level of argument ${index + 1} exceeds the maximum level allowed by the operator`,
241
261
  );
242
262
  }
243
263
  });
244
264
  if (ranges.some((range) => range.level > ACTION_LEVEL)) {
245
265
  throw new TlaSyntaxError(
246
- `Level error in applying operator ${operator.name}: The level of the range for a bounded variable exceeds the maximum level allowed by the operator.`,
266
+ `Level error in applying operator ${operator.name}:\nThe level of the range for a bounded variable exceeds the maximum level allowed by the operator`,
247
267
  );
248
268
  }
249
269
  const getOperand = (formal: string) => {
@@ -444,10 +464,13 @@ export const createLevelAnalyzer = (context: LevelContext) => {
444
464
  ? applyDeclared(resolved.name, resolved.level, operands)
445
465
  : applyDefined(resolved.levels, operands);
446
466
 
447
- const checkJunction = (operands: Operand[], location: SourceLocation) => {
467
+ const checkJunction = (operands: Operand[], expression: Expression) => {
448
468
  const levels = operands.map((operand) => operand.data.level);
449
469
  if (levels.includes(ACTION_LEVEL) && levels.includes(TEMPORAL_LEVEL)) {
450
- throw createLevelError("Formula has both temporal formula and action as arguments", location);
470
+ throw createLevelError(
471
+ "Formula has both temporal formula and action as arguments",
472
+ expression,
473
+ );
451
474
  }
452
475
  };
453
476
 
@@ -456,10 +479,10 @@ export const createLevelAnalyzer = (context: LevelContext) => {
456
479
  if (isLeadsTo && operands.some((operand) => operand.data.level === ACTION_LEVEL)) {
457
480
  throw createLevelError(
458
481
  "Action used where only temporal formula or state predicate allowed",
459
- expression.location,
482
+ expression,
460
483
  );
461
484
  }
462
- if (LOGICAL_OPERATORS.has(expression.operator)) checkJunction(operands, expression.location);
485
+ if (LOGICAL_OPERATORS.has(expression.operator)) checkJunction(operands, expression);
463
486
  };
464
487
 
465
488
  const checkTemporal = (
@@ -473,7 +496,7 @@ export const createLevelAnalyzer = (context: LevelContext) => {
473
496
  expression.kind === "Always"
474
497
  ? "[] followed by action not of form [A]_v"
475
498
  : "<> followed by action not of form <<A>>_v",
476
- expression.location,
499
+ expression,
477
500
  );
478
501
  };
479
502
 
@@ -501,7 +524,17 @@ export const createLevelAnalyzer = (context: LevelContext) => {
501
524
  return data;
502
525
  };
503
526
 
527
+ // SANY reports a level error of an operator's arguments at the application.
504
528
  const analyze = (expression: Expression, scope: Scope): LevelData => {
529
+ try {
530
+ return analyzeNode(expression, scope);
531
+ } catch (error) {
532
+ if (!(error instanceof TlaSyntaxError) || error.sany) throw error;
533
+ throw createLevelError(error.message, expression);
534
+ }
535
+ };
536
+
537
+ const analyzeNode = (expression: Expression, scope: Scope): LevelData => {
505
538
  switch (expression.kind) {
506
539
  case "Number":
507
540
  case "Decimal":
@@ -521,7 +554,7 @@ export const createLevelAnalyzer = (context: LevelContext) => {
521
554
  case "And":
522
555
  case "Or": {
523
556
  const operands = toOperands(expression.operands, scope);
524
- checkJunction(operands, expression.location);
557
+ checkJunction(operands, expression);
525
558
  return applyDefined(JUNCTION_LEVELS, operands);
526
559
  }
527
560
  case "Prime":
@@ -561,13 +594,14 @@ export const createLevelAnalyzer = (context: LevelContext) => {
561
594
  expression.bounds.map((bound) => bound.set),
562
595
  getBoundNames(expression.bounds),
563
596
  );
564
- if (
565
- data.level === TEMPORAL_LEVEL &&
566
- expression.bounds.some((bound) => analyze(bound.set, scope).level === ACTION_LEVEL)
567
- ) {
597
+ const actionBound =
598
+ data.level === TEMPORAL_LEVEL
599
+ ? expression.bounds.find((bound) => analyze(bound.set, scope).level === ACTION_LEVEL)
600
+ : undefined;
601
+ if (actionBound) {
568
602
  throw createLevelError(
569
603
  "Action-level bound of quantified temporal formula",
570
- expression.location,
604
+ actionBound.set,
571
605
  );
572
606
  }
573
607
  return data;
@@ -817,34 +851,141 @@ export const createLevelAnalyzer = (context: LevelContext) => {
817
851
  return { analyze, analyzeDefinition, toOperand };
818
852
  };
819
853
 
820
- const analyzeAssumeProve = (
854
+ export const analyzeAssumeProve = (
821
855
  assumeProve: AssumeProve,
822
856
  scope: Scope,
823
857
  analyzer: ReturnType<typeof createLevelAnalyzer>,
824
- ) => {
858
+ ): LevelData => {
825
859
  const inner = new Map(scope);
826
- assumeProve.assumptions.forEach((assumption) => {
860
+ const parts = assumeProve.assumptions.flatMap((assumption) => {
827
861
  if (assumption.kind === "NewSymbol") {
828
- if (assumption.set) analyzer.analyze(assumption.set, inner);
862
+ const set = assumption.set && analyzer.analyze(assumption.set, inner);
829
863
  inner.set(assumption.name, { kind: "Formal", arity: assumption.arity });
830
- return;
864
+ return set ? [set] : [];
831
865
  }
832
- if (assumption.kind === "AssumeProve") analyzeAssumeProve(assumption, inner, analyzer);
833
- else analyzer.analyze(assumption, inner);
866
+ return [
867
+ assumption.kind === "AssumeProve"
868
+ ? analyzeAssumeProve(assumption, inner, analyzer)
869
+ : analyzer.analyze(assumption, inner),
870
+ ];
871
+ });
872
+ parts.push(analyzer.analyze(assumeProve.conclusion, inner));
873
+ const data = createData(Math.max(...parts.map((part) => part.level)));
874
+ parts.forEach((part) => {
875
+ part.params.forEach((param) => data.params.add(param));
876
+ part.constraints.forEach((value, key) => putConstraint(data.constraints, key, value));
877
+ part.argConstraints.forEach((value, key) => putArgConstraint(data.argConstraints, key, value));
878
+ part.argParams.forEach((key) => data.argParams.add(key));
834
879
  });
835
- analyzer.analyze(assumeProve.conclusion, inner);
880
+ return data;
836
881
  };
837
882
 
838
- // SANY checks the level of every definition, assumption, and theorem of a module.
839
- export const checkModuleLevels = (module: Module, context: LevelContext) => {
883
+ // SANY checks the level of every definition, assumption, theorem, and instance of a module.
884
+ export const checkModuleLevels = (
885
+ module: Module,
886
+ context: LevelContext,
887
+ instances: { location: SourceLocation; check: () => void }[],
888
+ warnings: SanyError[],
889
+ ) => {
840
890
  const analyzer = createLevelAnalyzer(context);
841
- module.definitions
842
- .filter((definition) => !definition.name.includes("!"))
843
- .forEach((definition) => analyzer.analyzeDefinition(definition, new Map()));
844
- module.assumptions.forEach((assumption) => analyzer.analyze(assumption.expression, new Map()));
845
- module.theorems.forEach((theorem) =>
846
- theorem.statement.kind === "AssumeProve"
847
- ? analyzeAssumeProve(theorem.statement, new Map(), analyzer)
848
- : analyzer.analyze(theorem.statement, new Map()),
891
+ const getLevel = (expressions: Expression[]) =>
892
+ Math.max(0, ...expressions.map((expression) => analyzer.analyze(expression, new Map()).level));
893
+ const getStepLevel = (step: ProofStep) => {
894
+ const body = step.body;
895
+ if (body.kind === "Have" || body.kind === "Case") return getLevel([body.expression]);
896
+ if (body.kind === "Witness") return getLevel(body.expressions);
897
+ if (body.kind === "Take") return getLevel(body.bounds.map((bound) => bound.set));
898
+ if (body.kind === "Pick") {
899
+ return getLevel([body.body, ...body.bounds.map((bound) => bound.set)]);
900
+ }
901
+ if (body.kind !== "Assert") return 0;
902
+ return body.statement.kind === "AssumeProve"
903
+ ? analyzeAssumeProve(body.statement, new Map(), analyzer).level
904
+ : getLevel([body.statement]);
905
+ };
906
+ // SANY's TheoremNode.LevelCheckTemporal: the proof of a temporal goal may only assume constants.
907
+ const checkTemporalGoal = (proof: Proof | undefined): SanyError[] =>
908
+ proof?.kind !== "Steps"
909
+ ? []
910
+ : proof.steps.flatMap((step) => {
911
+ const location = formatRange(step.statement);
912
+ const isConstant = () => getStepLevel(step) === 0;
913
+ if (
914
+ step.body.kind === "Have" ||
915
+ step.body.kind === "Take" ||
916
+ step.body.kind === "Witness"
917
+ ) {
918
+ return isConstant()
919
+ ? []
920
+ : [{ location, message: "Non-constant TAKE, WITNESS, or HAVE for temporal goal." }];
921
+ }
922
+ if (step.body.kind === "Case") {
923
+ return [
924
+ ...(isConstant()
925
+ ? []
926
+ : [{ location, message: "Non-constant CASE for temporal goal." }]),
927
+ ...checkTemporalGoal(step.proof),
928
+ ];
929
+ }
930
+ return step.body.kind === "Qed" ? checkTemporalGoal(step.proof) : [];
931
+ });
932
+ // SANY checks each step as a theorem of its own after the steps of its proof.
933
+ const checkProof = (proof: Proof | undefined): SanyError[] =>
934
+ proof?.kind !== "Steps"
935
+ ? []
936
+ : proof.steps.flatMap((step) => {
937
+ const body = step.body;
938
+ const isTemporal = () => getStepLevel(step) === TEMPORAL_LEVEL;
939
+ const pickErrors =
940
+ body.kind === "Pick" && body.bounds.length > 0 && isTemporal()
941
+ ? body.bounds
942
+ .filter((bound) => getLevel([bound.set]) !== 0)
943
+ .flatMap((bound) =>
944
+ bound.set.location.range
945
+ ? [
946
+ {
947
+ location: formatRange(bound.set.location.range),
948
+ message: "Non-constant bound of temporal PICK.",
949
+ },
950
+ ]
951
+ : [],
952
+ )
953
+ : [];
954
+ return [
955
+ ...checkProof(step.proof),
956
+ ...pickErrors,
957
+ ...(step.proof?.kind === "Steps" && isTemporal() ? checkTemporalGoal(step.proof) : []),
958
+ ];
959
+ });
960
+ const errors = collectSemanticErrors(
961
+ [
962
+ ...module.definitions
963
+ .filter((definition) => !definition.name.includes("!"))
964
+ .map((definition) => ({
965
+ location: definition.location,
966
+ check: () => analyzer.analyzeDefinition(definition, new Map()),
967
+ })),
968
+ ...module.assumptions.map((assumption) => ({
969
+ location: assumption.location,
970
+ check: () => analyzer.analyze(assumption.expression, new Map()),
971
+ })),
972
+ ...module.theorems.map((theorem) => ({
973
+ location: theorem.location,
974
+ check: () => {
975
+ const data =
976
+ theorem.statement.kind === "AssumeProve"
977
+ ? analyzeAssumeProve(theorem.statement, new Map(), analyzer)
978
+ : analyzer.analyze(theorem.statement, new Map());
979
+ const errors = [
980
+ ...checkProof(theorem.proof),
981
+ ...(data.level === TEMPORAL_LEVEL ? checkTemporalGoal(theorem.proof) : []),
982
+ ];
983
+ if (errors.length > 0) throw createSanyError(errors);
984
+ },
985
+ })),
986
+ ...instances,
987
+ ],
988
+ warnings,
849
989
  );
990
+ if (errors.length > 0) throw createSanyError(errors, false, undefined, warnings);
850
991
  };