tla-ts 0.0.10-dev.11307be75 → 0.0.10-dev.22f7435d3

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 (108) hide show
  1. package/dist/deciders.cjs +31 -31
  2. package/dist/deciders.js +30 -30
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.cts +6 -2
  5. package/dist/index.d.ts +6 -2
  6. package/dist/index.js +1 -1
  7. package/dist/parallel-worker.cjs +1 -1
  8. package/dist/parallel-worker.js +1 -1
  9. package/dist/prove.cjs +68 -68
  10. package/dist/prove.js +61 -61
  11. package/dist/run.cjs +42 -42
  12. package/dist/run.js +44 -44
  13. package/dist/transfer.cjs +38 -38
  14. package/dist/transfer.js +29 -29
  15. package/dist/worker.cjs +7 -7
  16. package/dist/worker.js +7 -7
  17. package/package.json +1 -1
  18. package/src/bags.ts +5 -2
  19. package/src/builtins.ts +4 -3
  20. package/src/check-failure.ts +9 -6
  21. package/src/check-trace.ts +116 -64
  22. package/src/check.ts +343 -166
  23. package/src/cli/tlc-output.ts +1 -0
  24. package/src/cli/tlc.ts +3 -2
  25. package/src/codegen.ts +23 -8
  26. package/src/dependencies.ts +5 -4
  27. package/src/dfid.ts +13 -8
  28. package/src/environment.ts +1 -0
  29. package/src/evaluate.ts +58 -23
  30. package/src/exit-codes.ts +27 -13
  31. package/src/java-hash.ts +14 -0
  32. package/src/liveness-checker.ts +131 -81
  33. package/src/liveness.ts +48 -10
  34. package/src/parser.ts +6 -1
  35. package/src/prover/smt/solver/arith-rewriter.ts +11 -3
  36. package/src/prover/smt/solver/array-rewriter.ts +12 -2
  37. package/src/prover/smt/solver/asserted-formulas.ts +109 -63
  38. package/src/prover/smt/solver/ast.ts +5 -3
  39. package/src/prover/smt/solver/auf-solver.ts +23 -12
  40. package/src/prover/smt/solver/bit-blast-tactic.ts +26 -0
  41. package/src/prover/smt/solver/bound-simplifier.ts +10 -11
  42. package/src/prover/smt/solver/card2bv.ts +34 -15
  43. package/src/prover/smt/solver/cofactor-elim-term-ite.ts +39 -23
  44. package/src/prover/smt/solver/context.ts +44 -11
  45. package/src/prover/smt/solver/dependent-expr-state.ts +19 -13
  46. package/src/prover/smt/solver/dt2bv-tactic.ts +36 -20
  47. package/src/prover/smt/solver/elim-bounds.ts +89 -0
  48. package/src/prover/smt/solver/elim-uncnstr.ts +1 -1
  49. package/src/prover/smt/solver/fd-solver.ts +146 -39
  50. package/src/prover/smt/solver/internalizer.ts +1 -1
  51. package/src/prover/smt/solver/lp/lp-settings.ts +4 -0
  52. package/src/prover/smt/solver/maxcore.ts +2 -1
  53. package/src/prover/smt/solver/maxsmt-base.ts +1 -0
  54. package/src/prover/smt/solver/model-checker.ts +1 -1
  55. package/src/prover/smt/solver/model-evaluator.ts +2 -0
  56. package/src/prover/smt/solver/model-generator.ts +82 -42
  57. package/src/prover/smt/solver/muz/dl-context.ts +12 -40
  58. package/src/prover/smt/solver/muz/dl-mk-coi-filter.ts +1 -1
  59. package/src/prover/smt/solver/muz/dl-rule.ts +6 -7
  60. package/src/prover/smt/solver/muz/hnf.ts +2 -2
  61. package/src/prover/smt/solver/muz/horn-tactic.ts +14 -1
  62. package/src/prover/smt/solver/muz/rule-properties.ts +22 -0
  63. package/src/prover/smt/solver/muz/spacer-prop-solver.ts +1 -1
  64. package/src/prover/smt/solver/opt-context.ts +12 -4
  65. package/src/prover/smt/solver/opt-pareto.ts +19 -0
  66. package/src/prover/smt/solver/opt-solver.ts +4 -3
  67. package/src/prover/smt/solver/parallel-tactic.ts +1 -1
  68. package/src/prover/smt/solver/poly-rewriter.ts +1 -0
  69. package/src/prover/smt/solver/proto-model.ts +4 -2
  70. package/src/prover/smt/solver/push-app-ite.ts +37 -0
  71. package/src/prover/smt/solver/qsat.ts +23 -8
  72. package/src/prover/smt/solver/rewriter-tpl.ts +7 -6
  73. package/src/prover/smt/solver/rewriter.ts +31 -25
  74. package/src/prover/smt/solver/sat/goal2sat.ts +0 -1
  75. package/src/prover/smt/solver/sat/inc-sat-solver.ts +56 -28
  76. package/src/prover/smt/solver/sat/sat-tactic.ts +13 -4
  77. package/src/prover/smt/solver/sat/sat2goal.ts +10 -7
  78. package/src/prover/smt/solver/smt-consequences.ts +1 -1
  79. package/src/prover/smt/solver/smt-kernel.ts +39 -4
  80. package/src/prover/smt/solver/smt-setup.ts +28 -4
  81. package/src/prover/smt/solver/smtlib-parser.ts +31 -4
  82. package/src/prover/smt/solver/smtlib-script.ts +219 -82
  83. package/src/prover/smt/solver/solve-eqs.ts +24 -17
  84. package/src/prover/smt/solver/solver.ts +18 -3
  85. package/src/prover/smt/solver/tactic.ts +132 -78
  86. package/src/prover/smt/solver/theory-bv.ts +11 -1
  87. package/src/prover/smt/solver/theory-fpa.ts +1 -1
  88. package/src/prover/smt/solver/theory-lra-final-check.ts +1 -0
  89. package/src/prover/smt/solver/theory-lra-internalize.ts +1 -0
  90. package/src/prover/smt/solver/theory-lra-propagate.ts +7 -1
  91. package/src/prover/smt/solver/theory-lra.ts +1 -0
  92. package/src/prover/smt/solver/tseitin-cnf.ts +1 -0
  93. package/src/resolve.ts +242 -80
  94. package/src/runtime.ts +4 -0
  95. package/src/search.ts +161 -92
  96. package/src/simulate.ts +165 -102
  97. package/src/spec-description.ts +3 -4
  98. package/src/standard-modules.ts +56 -22
  99. package/src/subexpressions.ts +71 -16
  100. package/src/successors.ts +6 -3
  101. package/src/symmetry.ts +1 -0
  102. package/src/tlc/random.ts +2 -1
  103. package/src/tlc/replay.ts +22 -14
  104. package/src/tlc/tlc-operators.ts +7 -7
  105. package/src/tlc/tlcext-operators.ts +26 -10
  106. package/src/tlc/trace-spec.ts +6 -20
  107. package/src/typed-tier.ts +9 -4
  108. package/src/values.ts +95 -57
package/src/search.ts CHANGED
@@ -52,6 +52,7 @@ import {
52
52
  type Context,
53
53
  type Environment,
54
54
  type Scope,
55
+ type State,
55
56
  } from "./evaluate";
56
57
  import { EXIT_STATUS, setExitCode } from "./exit-codes";
57
58
  import type { JavaOverride } from "./java-overrides";
@@ -85,11 +86,13 @@ import { createTlcOrder } from "./tlc/order";
85
86
  import { getTlcFingerprint, getTlcFingerprints, setFingerprintPolynomial } from "./tlc/fingerprint";
86
87
  import type { TlcVersion } from "./tlc/version";
87
88
  import {
89
+ createModelValue,
88
90
  formatValue,
89
91
  freezeStringOrder,
90
92
  getWrittenPairs,
91
93
  isFunctionValue,
92
94
  isUpdatedElementOf,
95
+ markNormalized,
93
96
  setAliasName,
94
97
  setStringOrder,
95
98
  setValueOptions,
@@ -656,20 +659,26 @@ const getPredicate = (expression: Expression, environment: Environment) => {
656
659
  };
657
660
 
658
661
  const getStateChecks = (named: NamedExpression[], environment: Environment): StateCheck[] =>
659
- named.flatMap((item) =>
660
- getConjuncts(item.expression, environment).map((expression) => {
661
- const variables =
662
- item.scope === undefined ? getReadVariables(expression, environment) : undefined;
663
- return {
664
- name: item.name,
665
- expression,
666
- scope: item.scope,
667
- variables,
668
- membership: getMembership(expression, variables, environment),
669
- predicate: getPredicate(item.expression, environment),
670
- };
671
- }),
672
- );
662
+ named.flatMap((item) => {
663
+ const predicate = getPredicate(item.expression, environment);
664
+ const isImpure =
665
+ item.scope === undefined && getReadVariables(predicate, environment) === undefined;
666
+ // TLC evaluates an invariant whole, so one that prints isn't split into conjuncts.
667
+ return (isImpure ? [predicate] : getConjuncts(item.expression, environment)).map(
668
+ (expression) => {
669
+ const variables =
670
+ item.scope === undefined ? getReadVariables(expression, environment) : undefined;
671
+ return {
672
+ name: item.name,
673
+ expression,
674
+ scope: item.scope,
675
+ variables,
676
+ membership: getMembership(expression, variables, environment),
677
+ predicate,
678
+ };
679
+ },
680
+ );
681
+ });
673
682
 
674
683
  const isUnchangedFor = (stateCheck: StateCheck, state: Value[], parent: Value[] | undefined) => {
675
684
  const variables = stateCheck.variables;
@@ -712,8 +721,8 @@ export interface Search {
712
721
  toRecord: (state: Value[]) => Record<string, Value>;
713
722
  evaluateAlias: (
714
723
  alias: string,
715
- state: Value[],
716
- next: Value[] | undefined,
724
+ state: State,
725
+ next: State | undefined,
717
726
  isTool: boolean,
718
727
  ) => Record<string, Value>;
719
728
  spec: Specification;
@@ -738,12 +747,13 @@ export interface Search {
738
747
  }
739
748
  | undefined;
740
749
  findViolatedInvariant: (state: Value[], parent?: Value[]) => StateCheck | undefined;
741
- getViolatedInvariants: (state: Value[]) => StateCheck[];
750
+ forEachViolatedInvariant: (state: Value[], onViolated: (invariant: StateCheck) => void) => void;
742
751
  checkReplayedInitialState: (
743
752
  state: Value[],
744
753
  tracing: Environment,
745
754
  addFingerprint: () => void,
746
- ) => Pick<InitialStateViolation, "status" | "name"> | undefined;
755
+ onViolated: (violation: Pick<InitialStateViolation, "status" | "name">) => void,
756
+ ) => void;
747
757
  checkReplayedSuccessor: (
748
758
  state: Value[],
749
759
  next: Value[],
@@ -783,8 +793,8 @@ export const getIncompleteSuccessorMessage = (
783
793
 
784
794
  export const getContext = (
785
795
  environment: Environment,
786
- state: Value[] | undefined,
787
- next: Value[] | undefined,
796
+ state: State | undefined,
797
+ next: State | undefined,
788
798
  scope?: Scope,
789
799
  ) => ({ environment, scope, state, next });
790
800
 
@@ -817,7 +827,7 @@ const getExpectedBoolean = (expression: Expression, environment: Environment) =>
817
827
 
818
828
  const holdsAsConjunct = (check: StateCheck, context: Context) =>
819
829
  holdsLikeTlc(check.expression, context, (expression, environment) => {
820
- holdsLikeTlc(check.predicate, context);
830
+ if (check.predicate !== check.expression) holdsLikeTlc(check.predicate, context);
821
831
  return getExpectedBoolean(expression, environment);
822
832
  });
823
833
 
@@ -1052,8 +1062,20 @@ export const createSearch = (
1052
1062
  ...getCoveredChecks("invariant", configInvariants),
1053
1063
  ...getCoveredChecks("invariant", properties.invariants, false),
1054
1064
  ];
1065
+ const coveredInvariantChecks = new Map(
1066
+ [...configInvariants, ...properties.invariants].map((item, index) => [
1067
+ getPredicate(item.expression, environment),
1068
+ coveredInvariants[index],
1069
+ ]),
1070
+ );
1055
1071
  const coveredActionConstraints = getCoveredChecks("constraint", actionConstraints);
1056
1072
  const coveredConstraints = getCoveredChecks("constraint", namedConstraints);
1073
+ const coveredConstraintChecks = new Map(
1074
+ coveredConstraints.map((check) => [check.expression, check]),
1075
+ );
1076
+ const constraintPredicates = [
1077
+ ...new Map(constraints.map((constraint) => [constraint.predicate, constraint])).values(),
1078
+ ];
1057
1079
  const coveredInitialPredicates = getCoveredChecks("implied", properties.initialPredicates, false);
1058
1080
  const coveredActionProperties = getCoveredChecks(
1059
1081
  "implied",
@@ -1074,9 +1096,14 @@ export const createSearch = (
1074
1096
  return undefined;
1075
1097
  }
1076
1098
  };
1077
- const isCoveredHeld = (checks: CoveredCheck[], state: Value[], next?: Value[]) =>
1078
- coverage !== undefined &&
1079
- checks.every((check) => evaluateCovered(coverage, check, state, next) === true);
1099
+ const holdsReplayed = (
1100
+ covered: CoveredCheck | undefined,
1101
+ expression: Expression,
1102
+ context: Context,
1103
+ ) =>
1104
+ coverage && covered
1105
+ ? runAtCoverageNode(coverage, covered.node, () => holdsLikeTlc(covered.expression, context))
1106
+ : holdsLikeTlc(expression, context);
1080
1107
  const satisfiesCovered = (checks: CoveredCheck[], state: Value[], next?: Value[]) => {
1081
1108
  if (!coverage) return undefined;
1082
1109
  for (const check of checks) {
@@ -1132,9 +1159,15 @@ export const createSearch = (
1132
1159
  };
1133
1160
  const getViewValue = (expression: Expression, state: Value[]) =>
1134
1161
  evaluate(expression, getContext(environment, state, undefined));
1162
+ const getRepresentativeState = (state: Value[]) => {
1163
+ // TLC's TLCStateMut#fingerPrint deep-normalizes a state before it evaluates the view.
1164
+ if (view !== undefined) state.forEach(markNormalized);
1165
+ return symmetryGroup === undefined
1166
+ ? state
1167
+ : getRepresentative(state, symmetryGroup, getTlcOrder());
1168
+ };
1135
1169
  const getTlcStateFingerprint = (state: Value[]) => {
1136
- const representative =
1137
- symmetryGroup === undefined ? state : getRepresentative(state, symmetryGroup, getTlcOrder());
1170
+ const representative = getRepresentativeState(state);
1138
1171
  return getTlcFingerprint(
1139
1172
  view === undefined
1140
1173
  ? getTlcOrder().map((index) => representative[index])
@@ -1142,15 +1175,16 @@ export const createSearch = (
1142
1175
  );
1143
1176
  };
1144
1177
  const findFailedInitialPredicate = (state: Value[]) =>
1145
- isCoveredHeld(coveredInitialPredicates, state)
1146
- ? undefined
1147
- : properties.initialPredicates.find(
1148
- (predicate) =>
1149
- !holdsLikeTlc(
1150
- predicate.expression,
1151
- getContext(environment, state, undefined, predicate.scope),
1152
- ),
1153
- );
1178
+ properties.initialPredicates.find((predicate, index) => {
1179
+ const value =
1180
+ coverage && evaluateCovered(coverage, coveredInitialPredicates[index], state, undefined);
1181
+ return typeof value === "boolean"
1182
+ ? !value
1183
+ : !holdsLikeTlc(
1184
+ predicate.expression,
1185
+ getContext(environment, state, undefined, predicate.scope),
1186
+ );
1187
+ });
1154
1188
  const violatingStates = new WeakSet<Value[]>();
1155
1189
  const isViolated = (invariant: StateCheck, state: Value[], parent: Value[] | undefined) => {
1156
1190
  const checkedParent = parent && !violatingStates.has(parent) ? parent : undefined;
@@ -1174,6 +1208,21 @@ export const createSearch = (
1174
1208
  );
1175
1209
  }
1176
1210
  };
1211
+ const isPredicateViolated = (
1212
+ predicate: StateCheck,
1213
+ state: Value[],
1214
+ parent: Value[] | undefined,
1215
+ ) => {
1216
+ const covered = coveredInvariantChecks.get(predicate.predicate);
1217
+ const value =
1218
+ coverage && covered ? evaluateCovered(coverage, covered, state, undefined) : undefined;
1219
+ return typeof value === "boolean"
1220
+ ? !value
1221
+ : invariants.some(
1222
+ (invariant) =>
1223
+ invariant.predicate === predicate.predicate && isViolated(invariant, state, parent),
1224
+ );
1225
+ };
1177
1226
  const isFingerprintedLikeTlc = hasWideString(config, environment);
1178
1227
  runtime.getFingerprint = getTlcStateFingerprint;
1179
1228
  const findUnwitnessedPossible = () => {
@@ -1229,14 +1278,16 @@ export const createSearch = (
1229
1278
  spec,
1230
1279
  toRecord,
1231
1280
  evaluateAlias: (alias, state, next, isTool) => {
1281
+ const getStateRecord = () =>
1282
+ toRecord(state.map((value) => value ?? createModelValue("null")));
1232
1283
  try {
1233
1284
  getConfigDefinition("alias", alias, environment);
1234
1285
  const value = evaluate(createIdentifier(alias), getContext(environment, state, next));
1235
1286
  const record = toAliasRecord(value);
1236
- return record === undefined ? toRecord(state) : setAliasName(record, alias);
1287
+ return record === undefined ? getStateRecord() : setAliasName(record, alias);
1237
1288
  } catch (error) {
1238
1289
  if (!(error instanceof TlaConfigError || error instanceof TlaEvaluationError)) throw error;
1239
- return { ...toRecord(state), _ALIASEvalError: formatNestedMessage(error.message, isTool) };
1290
+ return { ...getStateRecord(), _ALIASEvalError: formatNestedMessage(error.message, isTool) };
1240
1291
  }
1241
1292
  },
1242
1293
  isSymmetric: symmetryGroup !== undefined,
@@ -1320,64 +1371,81 @@ export const createSearch = (
1320
1371
  },
1321
1372
  getFingerprintState: (state) => {
1322
1373
  if (isFingerprintedLikeTlc) return [String(getTlcStateFingerprint(state))];
1323
- const representative =
1324
- symmetryGroup === undefined
1325
- ? state
1326
- : getRepresentative(state, symmetryGroup, getTlcOrder());
1374
+ const representative = getRepresentativeState(state);
1327
1375
  return view === undefined ? representative : [getViewValue(view.expression, representative)];
1328
1376
  },
1329
1377
  findViolatedInvariant: (state, parent) => {
1330
- const checked = isCoveredHeld(coveredInvariants, state) ? runtimeChecks : invariants;
1331
- const violated = checked.find((invariant) => isViolated(invariant, state, parent));
1378
+ const violated =
1379
+ coverage === undefined
1380
+ ? invariants.find((invariant) => isViolated(invariant, state, parent))
1381
+ : invariantPredicates.find((predicate) => isPredicateViolated(predicate, state, parent));
1332
1382
  if (violated) violatingStates.add(state);
1333
1383
  return violated;
1334
1384
  },
1335
- getViolatedInvariants: (state) => {
1336
- const violated = invariantPredicates.filter((predicate) =>
1337
- invariants.some(
1338
- (invariant) =>
1339
- invariant.predicate === predicate.predicate && isViolated(invariant, state, undefined),
1385
+ forEachViolatedInvariant: (state, onViolated) => {
1386
+ for (const predicate of invariantPredicates) {
1387
+ if (!isPredicateViolated(predicate, state, undefined)) continue;
1388
+ violatingStates.add(state);
1389
+ onViolated(predicate);
1390
+ }
1391
+ },
1392
+ checkReplayedInitialState: (state, tracing, addFingerprint, onViolated) => {
1393
+ const holdsIn = (
1394
+ covered: CoveredCheck | undefined,
1395
+ expression: Expression,
1396
+ scope: Scope | undefined,
1397
+ ) => holdsReplayed(covered, expression, getContext(tracing, state, undefined, scope));
1398
+ const isInModel = constraintPredicates.every((constraint) =>
1399
+ holdsIn(
1400
+ coveredConstraintChecks.get(constraint.predicate),
1401
+ constraint.predicate,
1402
+ constraint.scope,
1340
1403
  ),
1341
1404
  );
1342
- if (violated.length > 0) violatingStates.add(state);
1343
- return violated;
1344
- },
1345
- checkReplayedInitialState: (state, tracing, addFingerprint) => {
1346
- const holdsIn = (expression: Expression, scope: Scope | undefined) =>
1347
- holdsLikeTlc(expression, getContext(tracing, state, undefined, scope));
1348
- if (constraints.every((constraint) => holdsIn(constraint.predicate, constraint.scope))) {
1349
- addFingerprint();
1405
+ if (isInModel) addFingerprint();
1406
+ for (const invariant of invariantPredicates) {
1407
+ const covered = coveredInvariantChecks.get(invariant.predicate);
1408
+ if (holdsIn(covered, invariant.predicate, invariant.scope)) continue;
1409
+ onViolated({ status: "invariant-violation", name: invariant.name });
1350
1410
  }
1351
- const invariant = invariantPredicates.find((check) => !holdsIn(check.predicate, check.scope));
1352
- if (invariant) return { status: "invariant-violation", name: invariant.name };
1353
1411
  const predicate = properties.initialPredicates.find(
1354
- (check) => !holdsIn(check.expression, check.scope),
1412
+ (check, index) => !holdsIn(coveredInitialPredicates[index], check.expression, check.scope),
1355
1413
  );
1356
- return predicate && { status: "liveness-violation", name: predicate.name };
1414
+ if (predicate) onViolated({ status: "liveness-violation", name: predicate.name });
1357
1415
  },
1358
1416
  checkReplayedSuccessor: (state, next, tracing, addFingerprint) => {
1359
1417
  const isInModel =
1360
- constraints.every((constraint) =>
1361
- holdsLikeTlc(
1418
+ constraintPredicates.every((constraint) =>
1419
+ holdsReplayed(
1420
+ coveredConstraintChecks.get(constraint.predicate),
1362
1421
  constraint.predicate,
1363
1422
  getContext(tracing, next, undefined, constraint.scope),
1364
1423
  ),
1365
1424
  ) &&
1366
- actionConstraints.every((constraint) =>
1367
- holdsLikeTlc(constraint.expression, getContext(tracing, state, next, constraint.scope)),
1425
+ actionConstraints.every((constraint, index) =>
1426
+ holdsReplayed(
1427
+ coveredActionConstraints[index],
1428
+ constraint.expression,
1429
+ getContext(tracing, state, next, constraint.scope),
1430
+ ),
1368
1431
  );
1369
1432
  // TLC checks the invariants of a successor it has not seen, even outside the model.
1370
1433
  const isUnseen = isInModel ? addFingerprint() : true;
1371
1434
  return (
1372
1435
  (!isUnseen ||
1373
1436
  invariantPredicates.every((invariant) =>
1374
- holdsLikeTlc(
1437
+ holdsReplayed(
1438
+ coveredInvariantChecks.get(invariant.predicate),
1375
1439
  invariant.predicate,
1376
1440
  getContext(tracing, next, undefined, invariant.scope),
1377
1441
  ),
1378
1442
  )) &&
1379
- actionProperties.every((property) =>
1380
- holdsLikeTlc(property.box, getContext(tracing, state, next, property.scope)),
1443
+ actionProperties.every((property, index) =>
1444
+ holdsReplayed(
1445
+ coveredActionProperties[index],
1446
+ property.box,
1447
+ getContext(tracing, state, next, property.scope),
1448
+ ),
1381
1449
  )
1382
1450
  );
1383
1451
  },
@@ -1390,31 +1458,32 @@ export const createSearch = (
1390
1458
  ),
1391
1459
  findFailedInitialPredicate,
1392
1460
  findViolatedActionProperty: (state, next) =>
1393
- isCoveredHeld(coveredActionProperties, state, next)
1394
- ? undefined
1395
- : actionProperties.find((property) => {
1396
- try {
1397
- return (
1398
- !holdsLikeTlc(
1399
- property.action,
1400
- getContext(environment, state, next, property.scope),
1401
- () =>
1402
- `Attempted to evaluate an expression of form [A]_e, but A was not a boolean.\n${describeRange(property.box)}`,
1403
- ) &&
1404
- !holds(
1405
- property.unchanged,
1406
- getContext(environment, state, next, property.scope),
1407
- "a subscript",
1408
- )
1409
- );
1410
- } catch (error) {
1411
- throw withHeadline(
1412
- withNextStateExitCode(error),
1413
- MESSAGE_CODE.actionPropertyEvaluationFailed,
1414
- `Evaluating action property ${property.name} failed.`,
1415
- );
1416
- }
1417
- }),
1461
+ actionProperties.find((property, index) => {
1462
+ const value =
1463
+ coverage && evaluateCovered(coverage, coveredActionProperties[index], state, next);
1464
+ if (typeof value === "boolean") return !value;
1465
+ try {
1466
+ return (
1467
+ !holdsLikeTlc(
1468
+ property.action,
1469
+ getContext(environment, state, next, property.scope),
1470
+ () =>
1471
+ `Attempted to evaluate an expression of form [A]_e, but A was not a boolean.\n${describeRange(property.box)}`,
1472
+ ) &&
1473
+ !holds(
1474
+ property.unchanged,
1475
+ getContext(environment, state, next, property.scope),
1476
+ "a subscript",
1477
+ )
1478
+ );
1479
+ } catch (error) {
1480
+ throw withHeadline(
1481
+ withNextStateExitCode(error),
1482
+ MESSAGE_CODE.actionPropertyEvaluationFailed,
1483
+ `Evaluating action property ${property.name} failed.`,
1484
+ );
1485
+ }
1486
+ }),
1418
1487
  satisfiesActionConstraints: (state, next) =>
1419
1488
  satisfiesCovered(coveredActionConstraints, state, next) ??
1420
1489
  actionConstraints.every((constraint) => holdsActionConstraint(constraint, state, next)),