tla-ts 0.0.3 → 0.0.4-dev.1a3acf6

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 (381) hide show
  1. package/README.md +46 -115
  2. package/dist/cli.cjs +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/deciders.cjs +366 -0
  5. package/dist/deciders.js +366 -0
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.cts +194 -8
  8. package/dist/index.d.ts +194 -8
  9. package/dist/index.js +1 -1
  10. package/dist/parallel-worker.cjs +1 -4
  11. package/dist/parallel-worker.js +1 -4
  12. package/dist/prove-worker.cjs +9 -0
  13. package/dist/prove-worker.d.cts +9 -0
  14. package/dist/prove-worker.d.ts +9 -0
  15. package/dist/prove-worker.js +9 -0
  16. package/dist/prove.cjs +1006 -0
  17. package/dist/prove.js +1006 -0
  18. package/dist/run.cjs +45 -0
  19. package/dist/run.js +45 -0
  20. package/dist/tlapm.cjs +10 -0
  21. package/dist/tlapm.js +10 -0
  22. package/dist/transfer.cjs +1377 -18
  23. package/dist/transfer.js +1377 -18
  24. package/dist/worker.cjs +21 -0
  25. package/dist/worker.js +21 -0
  26. package/package.json +24 -11
  27. package/src/ast.ts +149 -8
  28. package/src/bags.ts +26 -30
  29. package/src/builtins.ts +45 -19
  30. package/src/bundled-modules.ts +3 -3
  31. package/src/check.ts +1182 -900
  32. package/src/cli/options.ts +109 -0
  33. package/src/cli/run.ts +63 -0
  34. package/src/cli/shared.ts +106 -0
  35. package/src/cli/tlapm.ts +374 -0
  36. package/src/cli/tlc.ts +941 -0
  37. package/src/cli/xml-exporter.ts +221 -0
  38. package/src/cli.ts +9 -2
  39. package/src/codegen.ts +112 -51
  40. package/src/config.ts +254 -181
  41. package/src/dependencies.ts +5 -7
  42. package/src/environment.ts +579 -184
  43. package/src/errors.ts +287 -4
  44. package/src/evaluate.ts +1095 -365
  45. package/src/exit-codes.ts +22 -43
  46. package/src/fingerprints.ts +49 -14
  47. package/src/index.ts +11 -0
  48. package/src/instances.ts +73 -60
  49. package/src/java-overrides.ts +183 -66
  50. package/src/json.ts +31 -36
  51. package/src/levels.ts +197 -54
  52. package/src/lexer.ts +127 -30
  53. package/src/liveness-checker.ts +894 -0
  54. package/src/liveness.ts +246 -596
  55. package/src/{obligation-action.ts → obligations/action.ts} +248 -74
  56. package/src/{obligation-anon.ts → obligations/anonymize.ts} +55 -57
  57. package/src/obligations/equality.ts +260 -0
  58. package/src/obligations/expression.ts +618 -0
  59. package/src/{obligation-format.ts → obligations/format.ts} +7 -8
  60. package/src/obligations/generate.ts +457 -0
  61. package/src/{obligations.ts → obligations/index.ts} +46 -32
  62. package/src/{obligation-levels.ts → obligations/levels.ts} +44 -40
  63. package/src/obligations/module.ts +445 -0
  64. package/src/obligations/normalize.ts +554 -0
  65. package/src/obligations/operators.ts +176 -0
  66. package/src/obligations/pragma.ts +195 -0
  67. package/src/{obligation-printer.ts → obligations/printer.ts} +65 -230
  68. package/src/{obligation-proof.ts → obligations/proof.ts} +7 -2
  69. package/src/obligations/regroup.ts +100 -0
  70. package/src/{obligation-generate.ts → obligations/simplify.ts} +130 -536
  71. package/src/{obligation-source.ts → obligations/source.ts} +174 -216
  72. package/src/{obligation-deref.ts → obligations/subexpression.ts} +84 -115
  73. package/src/obligations/substitution.ts +261 -0
  74. package/src/obligations/temporal.ts +321 -0
  75. package/src/{obligation-tuples.ts → obligations/tuples.ts} +38 -54
  76. package/src/parallel-worker.ts +184 -235
  77. package/src/parallel.ts +156 -91
  78. package/src/parser.ts +490 -188
  79. package/src/pcal/ast.ts +755 -0
  80. package/src/pcal/parse.ts +1487 -0
  81. package/src/pcal/tokenize.ts +487 -0
  82. package/src/pcal/translate.ts +1151 -0
  83. package/src/pcal/validate.ts +444 -0
  84. package/src/prover/decide-pool.ts +95 -0
  85. package/src/prover/deciders.ts +33 -0
  86. package/src/prover/first-order.ts +175 -0
  87. package/src/prover/isabelle/LICENSE +36 -0
  88. package/src/prover/isabelle/LICENSE-tlapm +26 -0
  89. package/src/prover/isabelle/decide.ts +44 -0
  90. package/src/prover/isabelle/encode.ts +445 -0
  91. package/src/prover/isabelle/isar/inner-syntax.ts +579 -0
  92. package/src/prover/isabelle/isar/method.ts +367 -0
  93. package/src/prover/isabelle/isar/proof.ts +28 -0
  94. package/src/prover/isabelle/isar/statement.ts +57 -0
  95. package/src/prover/isabelle/isar/theory.ts +192 -0
  96. package/src/prover/isabelle/isar/type-check.ts +278 -0
  97. package/src/prover/isabelle/provers/blast/blast.ts +258 -0
  98. package/src/prover/isabelle/provers/blast/branch.ts +322 -0
  99. package/src/prover/isabelle/provers/blast/prove.ts +347 -0
  100. package/src/prover/isabelle/provers/blast/rules.ts +330 -0
  101. package/src/prover/isabelle/provers/blast/state.ts +180 -0
  102. package/src/prover/isabelle/provers/blast/term.ts +546 -0
  103. package/src/prover/isabelle/provers/clasimp.ts +150 -0
  104. package/src/prover/isabelle/provers/classical.ts +389 -0
  105. package/src/prover/isabelle/provers/hypsubst.ts +433 -0
  106. package/src/prover/isabelle/pure/bicompose.ts +174 -0
  107. package/src/prover/isabelle/pure/consts.ts +32 -0
  108. package/src/prover/isabelle/pure/conv.ts +79 -0
  109. package/src/prover/isabelle/pure/drule.ts +264 -0
  110. package/src/prover/isabelle/pure/envir.ts +331 -0
  111. package/src/prover/isabelle/pure/goal.ts +53 -0
  112. package/src/prover/isabelle/pure/interrupt.ts +16 -0
  113. package/src/prover/isabelle/pure/list.ts +12 -0
  114. package/src/prover/isabelle/pure/logic.ts +330 -0
  115. package/src/prover/isabelle/pure/name.ts +98 -0
  116. package/src/prover/isabelle/pure/net.ts +215 -0
  117. package/src/prover/isabelle/pure/object-logic.ts +41 -0
  118. package/src/prover/isabelle/pure/pattern.ts +631 -0
  119. package/src/prover/isabelle/pure/raw-simplifier.ts +338 -0
  120. package/src/prover/isabelle/pure/rewriter.ts +602 -0
  121. package/src/prover/isabelle/pure/search.ts +68 -0
  122. package/src/prover/isabelle/pure/seq.ts +133 -0
  123. package/src/prover/isabelle/pure/simplifier.ts +106 -0
  124. package/src/prover/isabelle/pure/table.ts +201 -0
  125. package/src/prover/isabelle/pure/tactic.ts +168 -0
  126. package/src/prover/isabelle/pure/tactical.ts +264 -0
  127. package/src/prover/isabelle/pure/term-ord.ts +105 -0
  128. package/src/prover/isabelle/pure/term.ts +688 -0
  129. package/src/prover/isabelle/pure/thm.ts +783 -0
  130. package/src/prover/isabelle/pure/type.ts +121 -0
  131. package/src/prover/isabelle/pure/unify.ts +753 -0
  132. package/src/prover/isabelle/pure/variable.ts +25 -0
  133. package/src/prover/isabelle/tla/classical-setup.ts +101 -0
  134. package/src/prover/isabelle/tla/context.ts +74 -0
  135. package/src/prover/isabelle/tla/logic-data.ts +5 -0
  136. package/src/prover/isabelle/tla/logic.ts +215 -0
  137. package/src/prover/isabelle/tla/simpdata.ts +241 -0
  138. package/src/prover/isabelle/tools/intuitionistic.ts +132 -0
  139. package/src/prover/ocaml.ts +22 -0
  140. package/src/prover/prep/action.ts +508 -0
  141. package/src/prover/prep/enabled-axioms.ts +189 -0
  142. package/src/prover/prep/fingerprint.ts +388 -0
  143. package/src/prover/prep/level-comparison.ts +529 -0
  144. package/src/prover/prep/md5.ts +60 -0
  145. package/src/prover/prep/methods.ts +221 -0
  146. package/src/prover/prep/normalize.ts +309 -0
  147. package/src/prover/prove-worker.ts +22 -0
  148. package/src/prover/prove.ts +492 -0
  149. package/src/prover/ptl/decide.ts +68 -0
  150. package/src/prover/ptl/encode.ts +244 -0
  151. package/src/prover/ptl/sat.ts +151 -0
  152. package/src/prover/ptl/tableau.ts +276 -0
  153. package/src/prover/smt/axioms.ts +209 -0
  154. package/src/prover/smt/context.ts +108 -0
  155. package/src/prover/smt/data.ts +636 -0
  156. package/src/prover/smt/encode.ts +275 -0
  157. package/src/prover/smt/extensionality.ts +65 -0
  158. package/src/prover/smt/flatten.ts +112 -0
  159. package/src/prover/smt/format.ts +154 -0
  160. package/src/prover/smt/instances.ts +181 -0
  161. package/src/prover/smt/rewrite.ts +766 -0
  162. package/src/prover/smt/solver/act-cache.ts +265 -0
  163. package/src/prover/smt/solver/arith-rewriter.ts +962 -0
  164. package/src/prover/smt/solver/array.ts +22 -0
  165. package/src/prover/smt/solver/asserted-formulas.ts +469 -0
  166. package/src/prover/smt/solver/ast-lt.ts +157 -0
  167. package/src/prover/smt/solver/ast-util.ts +91 -0
  168. package/src/prover/smt/solver/ast.ts +1315 -0
  169. package/src/prover/smt/solver/auf-solver.ts +572 -0
  170. package/src/prover/smt/solver/case-split-queue.ts +178 -0
  171. package/src/prover/smt/solver/cg-table.ts +175 -0
  172. package/src/prover/smt/solver/clause.ts +276 -0
  173. package/src/prover/smt/solver/conflict-resolution.ts +343 -0
  174. package/src/prover/smt/solver/context.ts +1292 -0
  175. package/src/prover/smt/solver/ctx-simplify.ts +334 -0
  176. package/src/prover/smt/solver/der.ts +224 -0
  177. package/src/prover/smt/solver/dyn-ack.ts +141 -0
  178. package/src/prover/smt/solver/e-matching.ts +659 -0
  179. package/src/prover/smt/solver/enode.ts +259 -0
  180. package/src/prover/smt/solver/expr-ref.ts +21 -0
  181. package/src/prover/smt/solver/expr-safe-replace.ts +172 -0
  182. package/src/prover/smt/solver/fingerprints.ts +92 -0
  183. package/src/prover/smt/solver/flat-literals.ts +51 -0
  184. package/src/prover/smt/solver/goal.ts +138 -0
  185. package/src/prover/smt/solver/hash.ts +173 -0
  186. package/src/prover/smt/solver/hashtable.ts +166 -0
  187. package/src/prover/smt/solver/internalizer.ts +1381 -0
  188. package/src/prover/smt/solver/lbool.ts +5 -0
  189. package/src/prover/smt/solver/literal.ts +24 -0
  190. package/src/prover/smt/solver/lp/bound-propagator.ts +391 -0
  191. package/src/prover/smt/solver/lp/constraints.ts +78 -0
  192. package/src/prover/smt/solver/lp/containers.ts +296 -0
  193. package/src/prover/smt/solver/lp/core-solver.ts +504 -0
  194. package/src/prover/smt/solver/lp/cross-nested.ts +224 -0
  195. package/src/prover/smt/solver/lp/dep-intervals.ts +642 -0
  196. package/src/prover/smt/solver/lp/dependency.ts +51 -0
  197. package/src/prover/smt/solver/lp/dioph-eq.ts +1181 -0
  198. package/src/prover/smt/solver/lp/explanation.ts +46 -0
  199. package/src/prover/smt/solver/lp/gomory.ts +255 -0
  200. package/src/prover/smt/solver/lp/hnf-cutter.ts +125 -0
  201. package/src/prover/smt/solver/lp/hnf.ts +281 -0
  202. package/src/prover/smt/solver/lp/int-cube.ts +295 -0
  203. package/src/prover/smt/solver/lp/int-solver.ts +514 -0
  204. package/src/prover/smt/solver/lp/lar-solver.ts +816 -0
  205. package/src/prover/smt/solver/lp/lar-term.ts +62 -0
  206. package/src/prover/smt/solver/lp/lp-settings.ts +91 -0
  207. package/src/prover/smt/solver/lp/maximize-term.ts +347 -0
  208. package/src/prover/smt/solver/lp/nex-creator.ts +381 -0
  209. package/src/prover/smt/solver/lp/nex.ts +120 -0
  210. package/src/prover/smt/solver/lp/nla-backoff.ts +43 -0
  211. package/src/prover/smt/solver/lp/nla-basics.ts +398 -0
  212. package/src/prover/smt/solver/lp/nla-core.ts +968 -0
  213. package/src/prover/smt/solver/lp/nla-divisions.ts +332 -0
  214. package/src/prover/smt/solver/lp/nla-emonics.ts +373 -0
  215. package/src/prover/smt/solver/lp/nla-factorization.ts +30 -0
  216. package/src/prover/smt/solver/lp/nla-grobner.ts +904 -0
  217. package/src/prover/smt/solver/lp/nla-horner.ts +126 -0
  218. package/src/prover/smt/solver/lp/nla-intervals.ts +265 -0
  219. package/src/prover/smt/solver/lp/nla-monomial-bounds.ts +715 -0
  220. package/src/prover/smt/solver/lp/nla-monotone.ts +59 -0
  221. package/src/prover/smt/solver/lp/nla-order.ts +307 -0
  222. package/src/prover/smt/solver/lp/nla-patcher.ts +112 -0
  223. package/src/prover/smt/solver/lp/nla-tangents.ts +251 -0
  224. package/src/prover/smt/solver/lp/nla-throttle.ts +85 -0
  225. package/src/prover/smt/solver/lp/nla-types.ts +124 -0
  226. package/src/prover/smt/solver/lp/nla-var-eqs.ts +141 -0
  227. package/src/prover/smt/solver/lp/nra-solver.ts +440 -0
  228. package/src/prover/smt/solver/lp/numeric-pair.ts +65 -0
  229. package/src/prover/smt/solver/lp/pdd-interval.ts +31 -0
  230. package/src/prover/smt/solver/lp/pdd-simplifier.ts +184 -0
  231. package/src/prover/smt/solver/lp/pdd-solver.ts +408 -0
  232. package/src/prover/smt/solver/lp/pdd.ts +971 -0
  233. package/src/prover/smt/solver/lp/random-updater.ts +138 -0
  234. package/src/prover/smt/solver/lp/static-matrix.ts +246 -0
  235. package/src/prover/smt/solver/lp/union-find.ts +96 -0
  236. package/src/prover/smt/solver/mam-compiler.ts +847 -0
  237. package/src/prover/smt/solver/mam-interpreter.ts +400 -0
  238. package/src/prover/smt/solver/maximize-ac-sharing.ts +118 -0
  239. package/src/prover/smt/solver/model-checker.ts +347 -0
  240. package/src/prover/smt/solver/model-evaluator.ts +262 -0
  241. package/src/prover/smt/solver/model-finder.ts +155 -0
  242. package/src/prover/smt/solver/model-generator.ts +97 -0
  243. package/src/prover/smt/solver/model-macro-solver.ts +728 -0
  244. package/src/prover/smt/solver/nlsat/algebraic.ts +1161 -0
  245. package/src/prover/smt/solver/nlsat/atoms.ts +238 -0
  246. package/src/prover/smt/solver/nlsat/evaluator.ts +303 -0
  247. package/src/prover/smt/solver/nlsat/explain.ts +607 -0
  248. package/src/prover/smt/solver/nlsat/interval-set.ts +351 -0
  249. package/src/prover/smt/solver/nlsat/levelwise.ts +737 -0
  250. package/src/prover/smt/solver/nlsat/mpbq.ts +161 -0
  251. package/src/prover/smt/solver/nlsat/polynomial.ts +1722 -0
  252. package/src/prover/smt/solver/nlsat/solver.ts +911 -0
  253. package/src/prover/smt/solver/nlsat/types.ts +43 -0
  254. package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +648 -0
  255. package/src/prover/smt/solver/nlsat/upolynomial.ts +996 -0
  256. package/src/prover/smt/solver/nnf.ts +469 -0
  257. package/src/prover/smt/solver/pattern-inference.ts +351 -0
  258. package/src/prover/smt/solver/poly-rewriter.ts +477 -0
  259. package/src/prover/smt/solver/propagate-values.ts +83 -0
  260. package/src/prover/smt/solver/proto-model.ts +551 -0
  261. package/src/prover/smt/solver/pull-quant.ts +139 -0
  262. package/src/prover/smt/solver/qe-lite-der.ts +526 -0
  263. package/src/prover/smt/solver/qe-lite-fm.ts +576 -0
  264. package/src/prover/smt/solver/qe-lite.ts +381 -0
  265. package/src/prover/smt/solver/qi-queue.ts +362 -0
  266. package/src/prover/smt/solver/quant-tactics.ts +117 -0
  267. package/src/prover/smt/solver/quantifier-analyzer.ts +562 -0
  268. package/src/prover/smt/solver/quantifier-manager.ts +186 -0
  269. package/src/prover/smt/solver/random-gen.ts +10 -0
  270. package/src/prover/smt/solver/rational.ts +165 -0
  271. package/src/prover/smt/solver/ref-vector.ts +62 -0
  272. package/src/prover/smt/solver/relevancy.ts +247 -0
  273. package/src/prover/smt/solver/rewriter-tpl.ts +1159 -0
  274. package/src/prover/smt/solver/rewriter.ts +843 -0
  275. package/src/prover/smt/solver/rlimit.ts +79 -0
  276. package/src/prover/smt/solver/smtlib-parser.ts +526 -0
  277. package/src/prover/smt/solver/solver.ts +71 -0
  278. package/src/prover/smt/solver/sort.ts +35 -0
  279. package/src/prover/smt/solver/sticky-generations.ts +69 -0
  280. package/src/prover/smt/solver/theory-lra-axioms.ts +340 -0
  281. package/src/prover/smt/solver/theory-lra-bounds.ts +226 -0
  282. package/src/prover/smt/solver/theory-lra-final-check.ts +252 -0
  283. package/src/prover/smt/solver/theory-lra-internalize.ts +476 -0
  284. package/src/prover/smt/solver/theory-lra-model.ts +243 -0
  285. package/src/prover/smt/solver/theory-lra-propagate.ts +405 -0
  286. package/src/prover/smt/solver/theory-lra-state.ts +43 -0
  287. package/src/prover/smt/solver/theory-lra.ts +56 -0
  288. package/src/prover/smt/solver/var-subst.ts +258 -0
  289. package/src/prover/smt/solver/z3-license.txt +10 -0
  290. package/src/prover/smt/table.ts +170 -0
  291. package/src/prover/tlapm/cache.ts +236 -0
  292. package/src/prover/tlapm/ocaml-marshal.ts +166 -0
  293. package/src/prover/tlapm/tlapm.ts +96 -0
  294. package/src/prover/tlaps-module.ts +510 -0
  295. package/src/prover/verdict.ts +13 -0
  296. package/src/prover/zenon/LICENSE +32 -0
  297. package/src/prover/zenon/check/check.ts +105 -0
  298. package/src/prover/zenon/check/definitions.ts +144 -0
  299. package/src/prover/zenon/check/equality.ts +182 -0
  300. package/src/prover/zenon/check/functions.ts +62 -0
  301. package/src/prover/zenon/check/keys.ts +125 -0
  302. package/src/prover/zenon/check/propositional.ts +104 -0
  303. package/src/prover/zenon/check/records.ts +188 -0
  304. package/src/prover/zenon/check/relations.ts +121 -0
  305. package/src/prover/zenon/check/rewrites.ts +224 -0
  306. package/src/prover/zenon/check/sets.ts +302 -0
  307. package/src/prover/zenon/check/terms.ts +127 -0
  308. package/src/prover/zenon/check/tla.ts +126 -0
  309. package/src/prover/zenon/decide.ts +107 -0
  310. package/src/prover/zenon/encode.ts +378 -0
  311. package/src/prover/zenon/eqrel.ts +300 -0
  312. package/src/prover/zenon/equality-rules.ts +435 -0
  313. package/src/prover/zenon/expr.ts +551 -0
  314. package/src/prover/zenon/index-table.ts +350 -0
  315. package/src/prover/zenon/isar-case.ts +513 -0
  316. package/src/prover/zenon/isar.ts +1249 -0
  317. package/src/prover/zenon/limits.ts +15 -0
  318. package/src/prover/zenon/llproof.ts +173 -0
  319. package/src/prover/zenon/mltoll.ts +1566 -0
  320. package/src/prover/zenon/node.ts +297 -0
  321. package/src/prover/zenon/ocaml.ts +169 -0
  322. package/src/prover/zenon/parse.ts +247 -0
  323. package/src/prover/zenon/phrase.ts +191 -0
  324. package/src/prover/zenon/proof.ts +198 -0
  325. package/src/prover/zenon/propositional-rules.ts +387 -0
  326. package/src/prover/zenon/rules.ts +94 -0
  327. package/src/prover/zenon/search.ts +288 -0
  328. package/src/prover/zenon/tla/functions.ts +151 -0
  329. package/src/prover/zenon/tla/llproof.ts +480 -0
  330. package/src/prover/zenon/tla/records.ts +225 -0
  331. package/src/prover/zenon/tla/rewrites.ts +447 -0
  332. package/src/prover/zenon/tla/sets.ts +304 -0
  333. package/src/prover/zenon/tla/terms.ts +162 -0
  334. package/src/prover/zenon/tla/tla.ts +506 -0
  335. package/src/randomization.ts +39 -27
  336. package/src/resolve.ts +1474 -426
  337. package/src/runtime.ts +25 -7
  338. package/src/sany/builtins.ts +147 -0
  339. package/src/sany/generator.ts +3111 -0
  340. package/src/sany/levels.ts +1205 -0
  341. package/src/sany/lexer.ts +544 -0
  342. package/src/sany/linter.ts +122 -0
  343. package/src/sany/modules.ts +1398 -0
  344. package/src/sany/nodes.ts +463 -0
  345. package/src/sany/parse-error.ts +2161 -0
  346. package/src/sany/report.ts +355 -0
  347. package/src/sany/selectors.ts +736 -0
  348. package/src/sany/source.ts +247 -0
  349. package/src/sany/xml.ts +1016 -0
  350. package/src/search.ts +969 -0
  351. package/src/spec-description.ts +66 -29
  352. package/src/{standard-levels.ts → standard-definitions.ts} +118 -2
  353. package/src/standard-modules.ts +215 -164
  354. package/src/state-graph.ts +181 -0
  355. package/src/subexpressions.ts +231 -171
  356. package/src/substitution-levels.ts +40 -19
  357. package/src/successors.ts +253 -125
  358. package/src/symmetry.ts +194 -54
  359. package/src/tableau.ts +60 -32
  360. package/src/tlc/fingerprint.ts +214 -0
  361. package/src/{tlc-modules.ts → tlc/jar-data.ts} +4 -0
  362. package/src/tlc/messages.ts +441 -0
  363. package/src/{tlc-order.ts → tlc/order.ts} +84 -16
  364. package/src/{tlc-random.ts → tlc/random.ts} +30 -189
  365. package/src/tlc/replay.ts +659 -0
  366. package/src/{tlc-summary.ts → tlc/summary.ts} +20 -5
  367. package/src/{tlc-module.ts → tlc/tlc-operators.ts} +59 -50
  368. package/src/{tlc-ext.ts → tlc/tlcext-operators.ts} +63 -45
  369. package/src/tlc/version.ts +19 -0
  370. package/src/transfer.ts +44 -32
  371. package/src/values.ts +843 -241
  372. package/src/worker.ts +62 -0
  373. package/dist/parallel.cjs +0 -12
  374. package/dist/parallel.js +0 -12
  375. package/dist/run-cli.cjs +0 -28
  376. package/dist/run-cli.js +0 -28
  377. package/src/canonical.ts +0 -39
  378. package/src/cli-options.ts +0 -58
  379. package/src/obligation-expression.ts +0 -1060
  380. package/src/obligation-module.ts +0 -1042
  381. package/src/run-cli.ts +0 -478
@@ -0,0 +1,444 @@
1
+ import { PcalError, PcalRuntimeError } from "../errors";
2
+ import {
3
+ formatPcalNode,
4
+ getPcalLocation,
5
+ getPcalVersionNumber,
6
+ PCAL_VERSION_WEIGHT,
7
+ type PcalAlgorithm,
8
+ } from "./ast";
9
+ import { parsePcalAlgorithm, type PcalSession } from "./parse";
10
+ import { createPcalCharReader } from "./tokenize";
11
+ import { translatePcalAlgorithm } from "./translate";
12
+ import type { TlcVersion } from "../tlc/version";
13
+
14
+ // Validator.ValidationResult.
15
+ type PcalValidationResult =
16
+ | "NO_PLUSCAL_EXISTS"
17
+ | "NO_TRANSLATION_EXISTS"
18
+ | "NO_PCAL_CHECKSUMS_EXIST"
19
+ | "TLA_DIVERGENCE_EXISTS"
20
+ | "PCAL_DIVERGENCE_EXISTS"
21
+ | "ERROR_ENCOUNTERED"
22
+ | "NO_DIVERGENCE";
23
+
24
+ // Java's \s, which unlike JavaScript's matches no Unicode spaces.
25
+ const SPACE = "[ \\t\\n\\x0B\\f\\r]";
26
+
27
+ // Validator.CHECKSUM_PATTERN, whose (?i) groups become character classes.
28
+ const CHECKSUM_PATTERN = new RegExp(
29
+ `\\\\\\* BEGIN TRANSLATION${SPACE}+\\(${SPACE}*([cC][hH]([eE][cC])?[kK][sS][uU][mM]\\([pP]([lL][uU][sS])?[cC][aA][lL]\\))${SPACE}*(=${SPACE}*"(?<pcal>[0-9A-Fa-f]*)"|\\\\in${SPACE}*STRING)${SPACE}*\\/\\\\${SPACE}*([cC][hH]([eE][cC])?[kK][sS][uU][mM]\\([tT][lL][aA]\\+?\\))${SPACE}*(=${SPACE}*"(?<tla>[0-9A-Fa-f]*)"|\\\\in${SPACE}*STRING)${SPACE}*\\)`,
30
+ );
31
+
32
+ // Validator.checksum: CRC32 of the string's bytes, in Long.toHexString's unpadded lowercase hex.
33
+ // Only a spec with PlusCal needs node:zlib, so it loads then rather than at startup.
34
+ const getChecksum = (text: string) =>
35
+ process.getBuiltinModule("node:zlib").crc32(Buffer.from(text, "utf8")).toString(16);
36
+
37
+ const reportUnrecoverableError = (session: PcalSession, message: string) =>
38
+ session.log(`\nUnrecoverable error:\n -- ${message}.\n`);
39
+
40
+ // PcalDebug.reportError: an UnrecoverablePositionedException names its statement's position.
41
+ const reportPcalError = (session: PcalSession, error: PcalError) =>
42
+ reportUnrecoverableError(
43
+ session,
44
+ error.node === undefined || error.node.line === 0
45
+ ? error.message
46
+ : `${error.message}\n at ${getPcalLocation(error.node)}`,
47
+ );
48
+
49
+ // trans.removeTabs: tabs reach the next multiple of 8, and every line gets a trailing space.
50
+ const removeTabs = (lines: string[]) =>
51
+ lines.map(
52
+ (line) =>
53
+ `${Array.from(line).reduce(
54
+ (result, char) =>
55
+ char === "\t" ? result + " ".repeat(8 - (result.length % 8)) : result + char,
56
+ "",
57
+ )} `,
58
+ );
59
+
60
+ // trans.findTokenPair: the first line from start with first followed by second after spaces.
61
+ const findTokenPair = (lines: string[], start: number, first: string, second: string) => {
62
+ for (let index = Math.max(start, 0); index < lines.length; index++) {
63
+ const line = lines[index];
64
+ const column = line.indexOf(first);
65
+ if (column === -1) continue;
66
+ const afterFirst = column + first.length;
67
+ const spaces = line.slice(afterFirst).search(/[^ ]/);
68
+ if (spaces !== -1 && afterFirst + spaces === line.indexOf(second)) return index;
69
+ }
70
+ return -1;
71
+ };
72
+
73
+ interface PcalSearchLocation {
74
+ line: number;
75
+ column: number;
76
+ }
77
+
78
+ // ParseAlgorithm.GotoNextNonSpace: moves the location to the next character that isn't a space,
79
+ // returning its line, or "" past the last line.
80
+ const gotoNextNonSpace = (lines: string[], location: PcalSearchLocation) => {
81
+ while (location.line < lines.length) {
82
+ const line = lines[location.line];
83
+ while (location.column < line.length && line[location.column] === " ") location.column += 1;
84
+ if (location.column < line.length) return line;
85
+ location.line += 1;
86
+ location.column = 0;
87
+ }
88
+ return "";
89
+ };
90
+
91
+ // ParseAlgorithm.NextSpaceCol and NextDelimiterCol: the first delimiter from column on, or the
92
+ // end of the line.
93
+ const getNextDelimiter = (line: string, column: number, delimiters: string) => {
94
+ const index = Array.from(line.slice(column)).findIndex((char) => delimiters.includes(char));
95
+ return index === -1 ? line.length : column + line.slice(column, column + index).length;
96
+ };
97
+
98
+ const isIdChar = (char: string) => /^[\p{L}\p{Nd}_]$/u.test(char);
99
+
100
+ // ParseAlgorithm.FindToken: moves the location past the next occurrence of token that starts a
101
+ // word and isn't followed by a letter or "_".
102
+ const findToken = (lines: string[], location: PcalSearchLocation, token: string) => {
103
+ while (location.line < lines.length) {
104
+ const line = gotoNextNonSpace(lines, location);
105
+ if (line.slice(location.column).startsWith(token)) {
106
+ const end = location.column + token.length;
107
+ if (end >= line.length || !/^[\p{L}_]$/u.test(line[end])) {
108
+ location.column = getNextDelimiter(line, end, " ");
109
+ return true;
110
+ }
111
+ }
112
+ location.column = getNextDelimiter(line, location.column, " ");
113
+ }
114
+ return false;
115
+ };
116
+
117
+ // trans.CommandLineError.
118
+ const reportCommandLineError = (session: PcalSession, message: string) =>
119
+ reportUnrecoverableError(session, `Command-line error: ${message}`);
120
+
121
+ // trans.parseAndProcessArguments for the options of a "PlusCal options" statement, which set the
122
+ // translator's options for the rest of SANY's run.
123
+ const processOptionArguments = (session: PcalSession, args: string[]) => {
124
+ const params = session.params;
125
+ const fairness = { isFirst: true, isExplicitNof: false };
126
+ const setFairness = (option: string) => {
127
+ if (fairness.isFirst) {
128
+ params.fairnessOption = "";
129
+ fairness.isFirst = false;
130
+ }
131
+ if (params.fairnessOption !== "") {
132
+ reportCommandLineError(session, "Can only have one of -wf, -sf, -wfNext, and -nof options");
133
+ return false;
134
+ }
135
+ params.fairnessOption = option;
136
+ return true;
137
+ };
138
+ for (let index = 0; index < args.length; index++) {
139
+ const option = args[index];
140
+ const argument = args[index + 1];
141
+ switch (option) {
142
+ case "-spec":
143
+ case "spec":
144
+ case "-myspec":
145
+ case "myspec": {
146
+ const isMyspec = option.endsWith("myspec");
147
+ params[isMyspec ? "myspecOption" : "specOption"] = true;
148
+ if (params.specOption && params.myspecOption) {
149
+ reportCommandLineError(
150
+ session,
151
+ "\nCan have at most one of the options -spec, -myspec, -spec2, -myspec2, writeAST",
152
+ );
153
+ return;
154
+ }
155
+ if (argument === undefined) {
156
+ reportCommandLineError(
157
+ session,
158
+ `Specification name must follow \`-${isMyspec ? "myspec" : "spec"}' option`,
159
+ );
160
+ return;
161
+ }
162
+ index += 1;
163
+ continue;
164
+ }
165
+ case "-termination":
166
+ case "termination":
167
+ params.checkTermination = true;
168
+ continue;
169
+ case "-noold":
170
+ case "-nocfg":
171
+ case "-noDoneDisjunct":
172
+ case "noDoneDisjunct":
173
+ continue;
174
+ case "-wf":
175
+ case "wf":
176
+ case "-sf":
177
+ case "sf":
178
+ case "-wfNext":
179
+ case "wfNext":
180
+ case "-nof":
181
+ case "nof":
182
+ if (!setFairness(option.replace(/^-/, ""))) return;
183
+ if (option.endsWith("nof")) fairness.isExplicitNof = true;
184
+ continue;
185
+ case "-label":
186
+ case "label":
187
+ params.labelFlag = true;
188
+ continue;
189
+ case "-labelRoot":
190
+ case "labelRoot":
191
+ if (argument === undefined) {
192
+ reportCommandLineError(session, "Label root must follow `-labelRoot' option");
193
+ return;
194
+ }
195
+ if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(argument)) {
196
+ reportCommandLineError(
197
+ session,
198
+ "Label root must be a valid PlusCal identifier (must start with a letter and contain only letters, numbers, and underscores)",
199
+ );
200
+ return;
201
+ }
202
+ params.labelRoot = argument;
203
+ index += 1;
204
+ continue;
205
+ case "-version":
206
+ case "version": {
207
+ if (argument === undefined) {
208
+ reportCommandLineError(session, "Version number must follow `-version' option");
209
+ return;
210
+ }
211
+ // PcalParams.ProcessVersion.
212
+ const version = getPcalVersionNumber(argument);
213
+ if (version < 0 || version > PCAL_VERSION_WEIGHT) {
214
+ reportUnrecoverableError(
215
+ session,
216
+ version < 0
217
+ ? `Illegal version ${argument} specified.`
218
+ : `Specified version ${argument} later than current version 1.12`,
219
+ );
220
+ reportCommandLineError(session, "Bad version number");
221
+ return;
222
+ }
223
+ params.inputVersionNumber = version;
224
+ index += 1;
225
+ continue;
226
+ }
227
+ case "-lineWidth":
228
+ // PcalTLAGen's line width only shapes the translation's text.
229
+ if (!/^[+-]?\d+$/.test(argument ?? "") || Number(argument) < 60) {
230
+ reportCommandLineError(
231
+ session,
232
+ "Integer value at least 60 must follow `-lineWidth' option",
233
+ );
234
+ return;
235
+ }
236
+ index += 1;
237
+ continue;
238
+ default:
239
+ reportCommandLineError(
240
+ session,
241
+ `Unknown or illegal option in options statement: ${option}`,
242
+ );
243
+ return;
244
+ }
245
+ }
246
+ if (params.checkTermination && params.fairnessOption === "" && !fairness.isExplicitNof) {
247
+ params.fairnessOption = "wf";
248
+ }
249
+ };
250
+
251
+ // ParseAlgorithm.ProcessOptions: the location is just past "PlusCal".
252
+ const processOptions = (session: PcalSession, lines: string[], location: PcalSearchLocation) => {
253
+ gotoNextNonSpace(lines, location);
254
+ location.column += "options".length;
255
+ const afterOptions = gotoNextNonSpace(lines, location);
256
+ if (!afterOptions.slice(location.column).startsWith("(")) {
257
+ reportUnrecoverableError(session, "`PlusCal options' not followed by '('");
258
+ return;
259
+ }
260
+ location.column += 1;
261
+ const args: string[] = [];
262
+ for (;;) {
263
+ const line = gotoNextNonSpace(lines, location);
264
+ if (location.line >= lines.length || line[location.column] === ")") break;
265
+ if (line[location.column] === ",") {
266
+ location.column += 1;
267
+ continue;
268
+ }
269
+ const end = getNextDelimiter(line, location.column, " ,)");
270
+ args.push(line.slice(location.column, end));
271
+ location.column = end;
272
+ }
273
+ if (location.line >= lines.length) {
274
+ reportUnrecoverableError(session, "No closing ')' found in options statement");
275
+ return;
276
+ }
277
+ processOptionArguments(session, args);
278
+ };
279
+
280
+ // ParseAlgorithm.uncomment: blanks out the comment delimiters and nested comments from the
281
+ // algorithm's start to the "*)" that ends the comment it is in, dropping the rest of that line,
282
+ // and returns the error it throws for a line that ends in a string.
283
+ const uncomment = (lines: string[], startLine: number, startColumn: number) => {
284
+ const scan = { depth: 0, isDone: false, isInString: false };
285
+ for (let index = startLine; !scan.isDone && index < lines.length; index++) {
286
+ const line = lines[index];
287
+ const start = index === startLine ? startColumn : 0;
288
+ const output = [line.slice(0, start)];
289
+ scan.isInString = false;
290
+ for (let column = start; !scan.isDone && column < line.length; column++) {
291
+ const char = line[column];
292
+ const pair = line.slice(column, column + 2);
293
+ if (pair === "(*" && !scan.isInString) {
294
+ scan.depth += 1;
295
+ output.push(" ");
296
+ column += 1;
297
+ continue;
298
+ }
299
+ if (pair === "*)" && !scan.isInString && scan.depth === 0) {
300
+ output.push(pair);
301
+ scan.isDone = true;
302
+ continue;
303
+ }
304
+ if (pair === "*)" && !scan.isInString) {
305
+ scan.depth -= 1;
306
+ output.push(" ");
307
+ column += 1;
308
+ continue;
309
+ }
310
+ if (scan.depth > 0) {
311
+ output.push(" ");
312
+ continue;
313
+ }
314
+ if (scan.isInString && char === "\\" && pair.length === 2) {
315
+ output.push(pair);
316
+ column += 1;
317
+ continue;
318
+ }
319
+ if (!scan.isInString && pair === "\\*") {
320
+ output.push(" ");
321
+ break;
322
+ }
323
+ if (char === '"') scan.isInString = !scan.isInString;
324
+ output.push(char);
325
+ }
326
+ if (scan.isInString) return new PcalError(`Unterminated string in line ${index + 1}`);
327
+ lines[index] = output.join("");
328
+ }
329
+ return undefined;
330
+ };
331
+
332
+ // Vector.get on an index out of its range, whose message names the vector's capacity: the 10 it
333
+ // starts with, doubled as it grows.
334
+ const throwIndexOutOfBounds = (index: number, size: number): never => {
335
+ const capacity = 10 * 2 ** Math.max(0, Math.ceil(Math.log2(size / 10)));
336
+ throw new PcalRuntimeError(
337
+ `java.lang.ArrayIndexOutOfBoundsException: Index ${index} out of bounds for length ${capacity}`,
338
+ );
339
+ };
340
+
341
+ // Validator.validate: checks the PlusCal algorithm of the module whose lines are given, from its
342
+ // first to its last, against the checksums its translation records.
343
+ export const validatePcalModule = (
344
+ session: PcalSession,
345
+ specificationText: string[],
346
+ version?: TlcVersion,
347
+ ): Set<PcalValidationResult> => {
348
+ if (!specificationText.some((line) => line.indexOf("algorithm") > 0)) {
349
+ return new Set(["NO_PLUSCAL_EXISTS"]);
350
+ }
351
+ const lines = removeTabs(specificationText);
352
+ const searchLocation = { line: 0, column: 0 };
353
+ while (findToken(lines, searchLocation, "PlusCal")) {
354
+ const line = gotoNextNonSpace(lines, searchLocation);
355
+ const rest = line.slice(searchLocation.column);
356
+ const idEnd = Array.from(rest).findIndex((char) => !isIdChar(char));
357
+ if (rest.startsWith("options") && (idEnd === -1 ? rest.length : idEnd) === 7) {
358
+ processOptions(session, lines, searchLocation);
359
+ break;
360
+ }
361
+ }
362
+ const begin = { line: 0, column: -1, isFound: false, isFair: false };
363
+ for (; begin.line < lines.length; begin.line++) {
364
+ const line = lines[begin.line];
365
+ // TLAConstants.MODULE_CLOSING_REGEX, which the trailing space removeTabs adds keeps from
366
+ // matching.
367
+ if (/^=+$/.test(line)) break;
368
+ const algorithmColumn = line.indexOf("--algorithm");
369
+ const fairColumn = line.indexOf("--fair");
370
+ if (algorithmColumn !== -1) {
371
+ begin.column = algorithmColumn + "--algorithm".length;
372
+ begin.isFound = true;
373
+ break;
374
+ }
375
+ if (fairColumn !== -1) {
376
+ begin.column = fairColumn + "--fair".length;
377
+ begin.isFound = true;
378
+ begin.isFair = true;
379
+ break;
380
+ }
381
+ }
382
+ const results = new Set<PcalValidationResult>();
383
+ const translationLine = findTokenPair(lines, 0, "BEGIN", "TRANSLATION");
384
+ if (translationLine === -1) results.add("NO_TRANSLATION_EXISTS");
385
+ const endTranslationLine = findTokenPair(lines, translationLine + 1, "END", "TRANSLATION");
386
+ if (endTranslationLine === -1) results.add("NO_TRANSLATION_EXISTS");
387
+ if (translationLine === -1 && endTranslationLine === -1) return results;
388
+ if (!begin.isFound) {
389
+ results.add("NO_PLUSCAL_EXISTS");
390
+ return results;
391
+ }
392
+ const uncommentError = uncomment(lines, begin.line, begin.column);
393
+ if (uncommentError !== undefined) {
394
+ reportPcalError(session, uncommentError);
395
+ return new Set(["ERROR_ENCOUNTERED"]);
396
+ }
397
+ const parsed: { ast: PcalAlgorithm | undefined } = { ast: undefined };
398
+ // HACK: Validator reports the exceptions of ParseAlgorithm.getAlgorithm and PCalTLAGenerator
399
+ // and goes on to compare the checksums.
400
+ try {
401
+ const result = parsePcalAlgorithm(
402
+ session,
403
+ createPcalCharReader(lines, begin.line, begin.column),
404
+ begin.isFair,
405
+ );
406
+ parsed.ast = result.ast;
407
+ translatePcalAlgorithm(result.ast, result.omitPC, result.hasDefaultInitialization, session.log);
408
+ } catch (error) {
409
+ if (!(error instanceof PcalError)) throw error;
410
+ reportPcalError(session, error);
411
+ }
412
+ if (translationLine === -1) throwIndexOutOfBounds(-1, lines.length);
413
+ const match = CHECKSUM_PATTERN.exec(lines[translationLine]);
414
+ if (match === null) {
415
+ results.add("NO_PCAL_CHECKSUMS_EXIST");
416
+ return results;
417
+ }
418
+ const pcalChecksum = match.groups?.pcal;
419
+ // The Java checksums the string "fair" for a --fair algorithm, unlike TLC 1.7.4's, and a failed
420
+ // parse leaves an AST whose text, Object.toString's class name and hash code, matches no checksum.
421
+ const algorithmText =
422
+ begin.isFair && version !== "1.7.4"
423
+ ? "fair"
424
+ : parsed.ast === undefined
425
+ ? undefined
426
+ : formatPcalNode(parsed.ast, session.params.inputVersionNumber, version);
427
+ if (
428
+ pcalChecksum !== undefined &&
429
+ (algorithmText === undefined || pcalChecksum !== getChecksum(algorithmText))
430
+ ) {
431
+ results.add("PCAL_DIVERGENCE_EXISTS");
432
+ }
433
+ const tlaChecksum = match.groups?.tla;
434
+ if (tlaChecksum !== undefined) {
435
+ if (endTranslationLine === -1) {
436
+ throw new PcalRuntimeError(
437
+ `java.lang.IllegalArgumentException: fromIndex(${translationLine + 1}) > toIndex(-1)`,
438
+ );
439
+ }
440
+ const translation = specificationText.slice(translationLine + 1, endTranslationLine).join("");
441
+ if (tlaChecksum !== getChecksum(translation)) results.add("TLA_DIVERGENCE_EXISTS");
442
+ }
443
+ return results.size === 0 ? new Set(["NO_DIVERGENCE"]) : results;
444
+ };
@@ -0,0 +1,95 @@
1
+ // Worker threads that decide the obligations prove sends them, the earliest obligation first.
2
+
3
+ import { TlaProverError } from "../errors";
4
+ import { spawnWorker, type WorkerHandle } from "../worker";
5
+ import type { DecideOptions, Decision } from "./verdict";
6
+
7
+ export interface DecideRequest {
8
+ prover: string;
9
+ text: string;
10
+ timeLimitMs: number;
11
+ }
12
+
13
+ // A backend's decision, or the message of the TlaProverError it threw, which prove turns into a
14
+ // result.
15
+ export type DecideResponse = Decision | { error: string };
16
+
17
+ interface PendingDecision {
18
+ request: DecideRequest;
19
+ priority: number;
20
+ resolve: (decision: Decision) => void;
21
+ reject: (error: unknown) => void;
22
+ }
23
+
24
+ export interface DecidePool {
25
+ decide: (
26
+ prover: string,
27
+ text: string,
28
+ options: DecideOptions,
29
+ priority: number,
30
+ ) => Promise<Decision>;
31
+ // Rejects every decision not yet made with reason, and stops the workers.
32
+ terminate: (reason: unknown) => void;
33
+ }
34
+
35
+ export const createDecidePool = async (workerCount: number): Promise<DecidePool> => {
36
+ const workers: WorkerHandle[] = [];
37
+ const queue: PendingDecision[] = [];
38
+ const running = new Map<number, PendingDecision>();
39
+ const idle: number[] = [];
40
+ const state: { failure: { reason: unknown } | undefined } = { failure: undefined };
41
+ const dispatch = () => {
42
+ while (idle.length > 0 && queue.length > 0) {
43
+ const earliest = queue.reduce(
44
+ (best, decision, position) => (decision.priority < queue[best].priority ? position : best),
45
+ 0,
46
+ );
47
+ const [decision] = queue.splice(earliest, 1);
48
+ const index = idle.pop() ?? 0;
49
+ running.set(index, decision);
50
+ workers[index].postMessage(decision.request);
51
+ }
52
+ };
53
+ const onResponse = (index: number, message: unknown) => {
54
+ const response = message as DecideResponse;
55
+ const decision = running.get(index);
56
+ running.delete(index);
57
+ idle.push(index);
58
+ if ("verdict" in response) decision?.resolve(response);
59
+ if ("error" in response) decision?.reject(new TlaProverError(response.error));
60
+ dispatch();
61
+ };
62
+ const terminate = (reason: unknown) => {
63
+ if (state.failure) return;
64
+ state.failure = { reason };
65
+ [...queue.splice(0), ...running.values()].forEach((decision) => decision.reject(reason));
66
+ running.clear();
67
+ workers.forEach((worker) => worker.terminate());
68
+ };
69
+ workers.push(
70
+ ...(await Promise.all(
71
+ Array.from({ length: workerCount }, (_, index) =>
72
+ spawnWorker(
73
+ new URL("./prove-worker.js", import.meta.url),
74
+ (message) => onResponse(index, message),
75
+ terminate,
76
+ ),
77
+ ),
78
+ )),
79
+ );
80
+ idle.push(...workers.keys());
81
+ return {
82
+ decide: (prover, text, options, priority) =>
83
+ new Promise((resolve, reject) => {
84
+ if (state.failure) return reject(state.failure.reason);
85
+ queue.push({
86
+ request: { prover, text, timeLimitMs: options.timeLimitMs },
87
+ priority,
88
+ resolve,
89
+ reject,
90
+ });
91
+ dispatch();
92
+ }),
93
+ terminate,
94
+ };
95
+ };
@@ -0,0 +1,33 @@
1
+ // How each of tla-ts's backends decides the text tlapm would send its prover, by the prover of the
2
+ // method that selects it.
3
+
4
+ import { SmtParseError, TlaProverError } from "../errors";
5
+ import { decideIsabelle } from "./isabelle/decide";
6
+ import { decidePtl } from "./ptl/decide";
7
+ import { decideSmt } from "./smt/solver/solver";
8
+ import type { DecideOptions, Decision, Verdict } from "./verdict";
9
+ import { decideZenon } from "./zenon/decide";
10
+
11
+ // Z3 rejects malformed input with an error, and tlapm counts that as a failure.
12
+ const decideZ3 = (text: string, options: DecideOptions) => {
13
+ try {
14
+ return decideSmt(text, options);
15
+ } catch (error) {
16
+ if (error instanceof SmtParseError) throw new TlaProverError(error.message, error);
17
+ throw error;
18
+ }
19
+ };
20
+
21
+ export const DECIDERS: Record<string, (text: string, options: DecideOptions) => Verdict> = {
22
+ smt: decideZ3,
23
+ z3: decideZ3,
24
+ zenon: (text, options) => decideZenon(text, options).verdict,
25
+ isabelle: decideIsabelle,
26
+ ls4: decidePtl,
27
+ };
28
+
29
+ export const decide = (prover: string, text: string, options: DecideOptions): Decision => {
30
+ const start = performance.now();
31
+ const verdict = DECIDERS[prover](text, options);
32
+ return { verdict, timeUsedMs: performance.now() - start };
33
+ };