tla-ts 0.0.9 → 0.0.10-dev.06b481ee0

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 (631) hide show
  1. package/README.md +30 -1
  2. package/dist/compile.cjs +23 -0
  3. package/dist/compile.js +23 -0
  4. package/dist/deciders.cjs +41 -37
  5. package/dist/deciders.js +48 -44
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.cts +122 -12
  8. package/dist/index.d.ts +122 -12
  9. package/dist/index.js +1 -1
  10. package/dist/parallel-worker.cjs +1 -1
  11. package/dist/parallel-worker.js +1 -1
  12. package/dist/prove-worker.cjs +1 -1
  13. package/dist/prove-worker.js +1 -1
  14. package/dist/prove.cjs +2746 -410
  15. package/dist/prove.js +2745 -409
  16. package/dist/run.cjs +144 -31
  17. package/dist/run.js +144 -31
  18. package/dist/tlapm.cjs +2 -2
  19. package/dist/tlapm.js +2 -2
  20. package/dist/transfer.cjs +134 -104
  21. package/dist/transfer.js +134 -104
  22. package/dist/worker.cjs +7 -7
  23. package/dist/worker.js +7 -7
  24. package/package.json +3 -1
  25. package/src/ast.ts +56 -60
  26. package/src/bags.ts +128 -110
  27. package/src/builtins.ts +31 -77
  28. package/src/bundled-modules.ts +1 -8
  29. package/src/check-failure.ts +118 -0
  30. package/src/check-trace.ts +320 -0
  31. package/src/check.ts +1156 -888
  32. package/src/cli/options.ts +12 -32
  33. package/src/cli/run.ts +0 -2
  34. package/src/cli/runtime-invariants.ts +100 -0
  35. package/src/cli/shared.ts +19 -12
  36. package/src/cli/tlapm.ts +433 -82
  37. package/src/cli/tlc-arguments.ts +652 -0
  38. package/src/cli/tlc-output.ts +701 -0
  39. package/src/cli/tlc-usage.ts +360 -0
  40. package/src/cli/tlc.ts +330 -659
  41. package/src/cli/typescript.ts +23 -0
  42. package/src/cli/xml-exporter.ts +27 -49
  43. package/src/cli.ts +0 -1
  44. package/src/codegen.ts +217 -82
  45. package/src/config.ts +140 -109
  46. package/src/coverage.ts +1019 -0
  47. package/src/dependencies.ts +101 -66
  48. package/src/dfid.ts +683 -0
  49. package/src/environment-config.ts +315 -0
  50. package/src/environment.ts +263 -370
  51. package/src/errors.ts +107 -57
  52. package/src/evaluate.ts +898 -369
  53. package/src/exit-codes.ts +63 -13
  54. package/src/fingerprints.ts +75 -11
  55. package/src/index.ts +3 -0
  56. package/src/instances.ts +137 -22
  57. package/src/java-hash.ts +21 -0
  58. package/src/java-overrides.ts +6 -21
  59. package/src/json-reader.ts +455 -0
  60. package/src/json.ts +252 -139
  61. package/src/levels.ts +231 -154
  62. package/src/lexer.ts +83 -101
  63. package/src/liveness-checker.ts +743 -322
  64. package/src/liveness.ts +230 -133
  65. package/src/obligations/action.ts +17 -44
  66. package/src/obligations/anonymize.ts +120 -95
  67. package/src/obligations/enabled-axioms.ts +218 -0
  68. package/src/obligations/equality.ts +1 -3
  69. package/src/obligations/expression.ts +37 -26
  70. package/src/obligations/format.ts +0 -10
  71. package/src/obligations/generate.ts +66 -64
  72. package/src/obligations/index.ts +39 -20
  73. package/src/obligations/levels.ts +27 -18
  74. package/src/obligations/module.ts +28 -55
  75. package/src/obligations/normalize.ts +31 -41
  76. package/src/obligations/operators.ts +0 -3
  77. package/src/obligations/pragma.ts +52 -24
  78. package/src/obligations/printer.ts +94 -63
  79. package/src/obligations/proof.ts +3 -6
  80. package/src/obligations/regroup.ts +0 -5
  81. package/src/obligations/simplify.ts +57 -63
  82. package/src/obligations/source.ts +121 -95
  83. package/src/obligations/subexpression.ts +49 -28
  84. package/src/obligations/substitution.ts +1 -5
  85. package/src/obligations/temporal.ts +12 -20
  86. package/src/obligations/tuples.ts +2 -10
  87. package/src/parallel-worker.ts +36 -60
  88. package/src/parallel.ts +64 -73
  89. package/src/parser.ts +1184 -531
  90. package/src/pcal/ast.ts +53 -86
  91. package/src/pcal/parse.ts +144 -219
  92. package/src/pcal/tokenize.ts +91 -131
  93. package/src/pcal/translate.ts +83 -130
  94. package/src/pcal/validate.ts +48 -68
  95. package/src/pretty-print.ts +7 -8
  96. package/src/prover/decide-pool.ts +8 -13
  97. package/src/prover/deciders.ts +12 -13
  98. package/src/prover/first-order.ts +0 -11
  99. package/src/prover/isabelle/decide.ts +3 -31
  100. package/src/prover/isabelle/encode.ts +82 -64
  101. package/src/prover/isabelle/isar/attrib.ts +250 -0
  102. package/src/prover/isabelle/isar/context.ts +335 -0
  103. package/src/prover/isabelle/isar/induct.ts +382 -0
  104. package/src/prover/isabelle/isar/inner-syntax.ts +262 -117
  105. package/src/prover/isabelle/isar/method.ts +510 -226
  106. package/src/prover/isabelle/isar/proof.ts +570 -23
  107. package/src/prover/isabelle/isar/rule-cases.ts +226 -0
  108. package/src/prover/isabelle/isar/theory.ts +488 -88
  109. package/src/prover/isabelle/isar/toplevel.ts +331 -0
  110. package/src/prover/isabelle/isar/type-check.ts +99 -38
  111. package/src/prover/isabelle/provers/blast/blast.ts +16 -105
  112. package/src/prover/isabelle/provers/blast/branch.ts +0 -33
  113. package/src/prover/isabelle/provers/blast/prove.ts +0 -36
  114. package/src/prover/isabelle/provers/blast/rules.ts +5 -45
  115. package/src/prover/isabelle/provers/blast/state.ts +1 -29
  116. package/src/prover/isabelle/provers/blast/term.ts +8 -37
  117. package/src/prover/isabelle/provers/clasimp.ts +1 -15
  118. package/src/prover/isabelle/provers/classical.ts +58 -61
  119. package/src/prover/isabelle/provers/hypsubst.ts +29 -54
  120. package/src/prover/isabelle/pure/bicompose.ts +24 -39
  121. package/src/prover/isabelle/pure/consts.ts +0 -8
  122. package/src/prover/isabelle/pure/conv.ts +2 -18
  123. package/src/prover/isabelle/pure/drule.ts +95 -45
  124. package/src/prover/isabelle/pure/envir.ts +2 -53
  125. package/src/prover/isabelle/pure/goal.ts +1 -9
  126. package/src/prover/isabelle/pure/interrupt.ts +0 -5
  127. package/src/prover/isabelle/pure/list.ts +0 -3
  128. package/src/prover/isabelle/pure/logic.ts +1 -16
  129. package/src/prover/isabelle/pure/name.ts +1 -10
  130. package/src/prover/isabelle/pure/net.ts +2 -60
  131. package/src/prover/isabelle/pure/object-logic.ts +15 -16
  132. package/src/prover/isabelle/pure/pattern.ts +1 -20
  133. package/src/prover/isabelle/pure/raw-simplifier.ts +16 -63
  134. package/src/prover/isabelle/pure/rewriter.ts +34 -77
  135. package/src/prover/isabelle/pure/search.ts +2 -11
  136. package/src/prover/isabelle/pure/seq.ts +0 -11
  137. package/src/prover/isabelle/pure/simplifier.ts +27 -16
  138. package/src/prover/isabelle/pure/table.ts +2 -33
  139. package/src/prover/isabelle/pure/tactic.ts +11 -23
  140. package/src/prover/isabelle/pure/tactical.ts +47 -48
  141. package/src/prover/isabelle/pure/term-ord.ts +1 -7
  142. package/src/prover/isabelle/pure/term.ts +4 -47
  143. package/src/prover/isabelle/pure/thm.ts +26 -48
  144. package/src/prover/isabelle/pure/type.ts +1 -16
  145. package/src/prover/isabelle/pure/unify.ts +19 -31
  146. package/src/prover/isabelle/pure/variable.ts +2 -8
  147. package/src/prover/isabelle/tla/classical-setup.ts +17 -25
  148. package/src/prover/isabelle/tla/context.ts +65 -26
  149. package/src/prover/isabelle/tla/logic-data.ts +1 -1
  150. package/src/prover/isabelle/tla/logic.ts +53 -32
  151. package/src/prover/isabelle/tla/simpdata.ts +45 -44
  152. package/src/prover/isabelle/tools/intuitionistic.ts +28 -21
  153. package/src/prover/ocaml.ts +4 -7
  154. package/src/prover/prep/action.ts +33 -66
  155. package/src/prover/prep/enabled-axioms.ts +22 -20
  156. package/src/prover/prep/fingerprint.ts +2 -21
  157. package/src/prover/prep/level-comparison.ts +8 -12
  158. package/src/prover/prep/md5.ts +26 -31
  159. package/src/prover/prep/methods.ts +189 -86
  160. package/src/prover/prep/normalize.ts +42 -37
  161. package/src/prover/prove-worker.ts +0 -2
  162. package/src/prover/prove.ts +398 -133
  163. package/src/prover/ptl/decide.ts +96 -56
  164. package/src/prover/ptl/encode.ts +15 -38
  165. package/src/prover/ptl/sat.ts +24 -32
  166. package/src/prover/ptl/tableau.ts +40 -28
  167. package/src/prover/smt/arithmetic.ts +310 -0
  168. package/src/prover/smt/axioms.ts +12 -15
  169. package/src/prover/smt/context.ts +60 -32
  170. package/src/prover/smt/data.ts +517 -401
  171. package/src/prover/smt/encode.ts +155 -85
  172. package/src/prover/smt/extensionality.ts +5 -13
  173. package/src/prover/smt/flatten.ts +7 -28
  174. package/src/prover/smt/format.ts +33 -14
  175. package/src/prover/smt/instances.ts +7 -11
  176. package/src/prover/smt/layout.ts +91 -0
  177. package/src/prover/smt/rewrite.ts +1021 -658
  178. package/src/prover/smt/simplify.ts +441 -0
  179. package/src/prover/smt/solver/ackermannize-bv-tactic.ts +61 -0
  180. package/src/prover/smt/solver/ackr-helper.ts +179 -0
  181. package/src/prover/smt/solver/ackr-model-converter.ts +105 -0
  182. package/src/prover/smt/solver/act-cache.ts +0 -16
  183. package/src/prover/smt/solver/add-bounds-tactic.ts +59 -0
  184. package/src/prover/smt/solver/aig-tactic.ts +52 -0
  185. package/src/prover/smt/solver/aig.ts +889 -0
  186. package/src/prover/smt/solver/arith-rewriter.ts +626 -56
  187. package/src/prover/smt/solver/arith-terms.ts +121 -0
  188. package/src/prover/smt/solver/array-decl-plugin.ts +175 -0
  189. package/src/prover/smt/solver/array-rewriter.ts +319 -0
  190. package/src/prover/smt/solver/array.ts +1 -3
  191. package/src/prover/smt/solver/asserted-formulas.ts +241 -99
  192. package/src/prover/smt/solver/ast-lt.ts +165 -21
  193. package/src/prover/smt/solver/ast-util.ts +160 -7
  194. package/src/prover/smt/solver/ast.ts +1480 -184
  195. package/src/prover/smt/solver/auf-solver.ts +30 -56
  196. package/src/prover/smt/solver/bit-blast-tactic.ts +608 -0
  197. package/src/prover/smt/solver/bit-blaster.ts +871 -0
  198. package/src/prover/smt/solver/blast-term-ite.ts +47 -0
  199. package/src/prover/smt/solver/bound-manager.ts +196 -0
  200. package/src/prover/smt/solver/bound-simplifier.ts +598 -0
  201. package/src/prover/smt/solver/bv-bound-chk.ts +492 -0
  202. package/src/prover/smt/solver/bv-decl-plugin.ts +341 -0
  203. package/src/prover/smt/solver/bv-divrem-bounds.ts +95 -0
  204. package/src/prover/smt/solver/bv-rewriter.ts +1901 -0
  205. package/src/prover/smt/solver/bv1-blast.ts +214 -0
  206. package/src/prover/smt/solver/bv2fpa-converter.ts +174 -0
  207. package/src/prover/smt/solver/bv2int-rewriter.ts +544 -0
  208. package/src/prover/smt/solver/bv2real-rewriter.ts +533 -0
  209. package/src/prover/smt/solver/card2bv.ts +127 -0
  210. package/src/prover/smt/solver/case-split-queue.ts +0 -10
  211. package/src/prover/smt/solver/cg-table.ts +39 -42
  212. package/src/prover/smt/solver/check-logic.ts +330 -0
  213. package/src/prover/smt/solver/clause.ts +0 -27
  214. package/src/prover/smt/solver/cofactor-elim-term-ite.ts +293 -0
  215. package/src/prover/smt/solver/conflict-resolution.ts +78 -11
  216. package/src/prover/smt/solver/context.ts +600 -187
  217. package/src/prover/smt/solver/ctx-simplify.ts +34 -52
  218. package/src/prover/smt/solver/ctx-solver-simplify.ts +122 -0
  219. package/src/prover/smt/solver/datatype-decl-plugin.ts +580 -0
  220. package/src/prover/smt/solver/datatype-rewriter.ts +82 -0
  221. package/src/prover/smt/solver/demodulator.ts +786 -0
  222. package/src/prover/smt/solver/dependent-expr-state.ts +93 -0
  223. package/src/prover/smt/solver/der.ts +39 -30
  224. package/src/prover/smt/solver/diff-neq.ts +205 -0
  225. package/src/prover/smt/solver/distribute-forall.ts +57 -0
  226. package/src/prover/smt/solver/dom-simplify.ts +511 -0
  227. package/src/prover/smt/solver/dt2bv-tactic.ts +296 -0
  228. package/src/prover/smt/solver/dyn-ack.ts +0 -11
  229. package/src/prover/smt/solver/e-matching.ts +9 -41
  230. package/src/prover/smt/solver/elim-bounds.ts +89 -0
  231. package/src/prover/smt/solver/elim-small-bv-tactic.ts +129 -0
  232. package/src/prover/smt/solver/elim-term-ite-tactic.ts +48 -0
  233. package/src/prover/smt/solver/elim-uncnstr.ts +542 -0
  234. package/src/prover/smt/solver/enode.ts +100 -23
  235. package/src/prover/smt/solver/eq2bv-tactic.ts +218 -0
  236. package/src/prover/smt/solver/euf/arith-axioms.ts +403 -0
  237. package/src/prover/smt/solver/euf/arith-internalize.ts +653 -0
  238. package/src/prover/smt/solver/euf/arith-solver.ts +889 -0
  239. package/src/prover/smt/solver/euf/array-axioms.ts +527 -0
  240. package/src/prover/smt/solver/euf/array-internalize.ts +428 -0
  241. package/src/prover/smt/solver/euf/array-solver.ts +306 -0
  242. package/src/prover/smt/solver/euf/bv-ackerman.ts +162 -0
  243. package/src/prover/smt/solver/euf/bv-internalize.ts +748 -0
  244. package/src/prover/smt/solver/euf/bv-solver.ts +449 -0
  245. package/src/prover/smt/solver/euf/dt-solver.ts +618 -0
  246. package/src/prover/smt/solver/euf/egraph.ts +901 -0
  247. package/src/prover/smt/solver/euf/euf-solver.ts +1204 -0
  248. package/src/prover/smt/solver/euf/fpa-solver.ts +317 -0
  249. package/src/prover/smt/solver/euf/mam.ts +1046 -0
  250. package/src/prover/smt/solver/euf/q-ematch.ts +829 -0
  251. package/src/prover/smt/solver/euf/q-mbi.ts +587 -0
  252. package/src/prover/smt/solver/euf/q-model-fixer.ts +296 -0
  253. package/src/prover/smt/solver/euf/q-solver.ts +361 -0
  254. package/src/prover/smt/solver/euf/th-solver.ts +328 -0
  255. package/src/prover/smt/solver/euf/th-solvers.ts +30 -0
  256. package/src/prover/smt/solver/expr-ref.ts +0 -5
  257. package/src/prover/smt/solver/expr-safe-replace.ts +26 -7
  258. package/src/prover/smt/solver/expr2polynomial.ts +271 -0
  259. package/src/prover/smt/solver/factor.ts +163 -0
  260. package/src/prover/smt/solver/fd-solver.ts +734 -0
  261. package/src/prover/smt/solver/fingerprints.ts +15 -26
  262. package/src/prover/smt/solver/fix-dl-var.ts +147 -0
  263. package/src/prover/smt/solver/flat-literals.ts +0 -9
  264. package/src/prover/smt/solver/fm-tactic.ts +884 -0
  265. package/src/prover/smt/solver/fpa-decl-plugin.ts +618 -0
  266. package/src/prover/smt/solver/fpa-rewriter.ts +639 -0
  267. package/src/prover/smt/solver/fpa2bv-converter.ts +2251 -0
  268. package/src/prover/smt/solver/fpa2bv-rewriter.ts +349 -0
  269. package/src/prover/smt/solver/fpa2bv-tactic.ts +73 -0
  270. package/src/prover/smt/solver/goal.ts +179 -28
  271. package/src/prover/smt/solver/goal2nlsat.ts +216 -0
  272. package/src/prover/smt/solver/guard-set.ts +219 -0
  273. package/src/prover/smt/solver/hash.ts +0 -9
  274. package/src/prover/smt/solver/hashtable.ts +30 -23
  275. package/src/prover/smt/solver/inf-eps.ts +63 -0
  276. package/src/prover/smt/solver/inj-axiom.ts +101 -0
  277. package/src/prover/smt/solver/internalizer.ts +113 -133
  278. package/src/prover/smt/solver/lackr.ts +381 -0
  279. package/src/prover/smt/solver/lbool.ts +0 -2
  280. package/src/prover/smt/solver/lia2card.ts +268 -0
  281. package/src/prover/smt/solver/lia2pb.ts +154 -0
  282. package/src/prover/smt/solver/literal.ts +0 -4
  283. package/src/prover/smt/solver/logic-tactics.ts +355 -0
  284. package/src/prover/smt/solver/lp/bound-propagator.ts +7 -26
  285. package/src/prover/smt/solver/lp/constraints.ts +1 -8
  286. package/src/prover/smt/solver/lp/containers.ts +18 -31
  287. package/src/prover/smt/solver/lp/core-solver.ts +35 -37
  288. package/src/prover/smt/solver/lp/cross-nested.ts +4 -21
  289. package/src/prover/smt/solver/lp/dep-intervals.ts +6 -24
  290. package/src/prover/smt/solver/lp/dependency.ts +0 -5
  291. package/src/prover/smt/solver/lp/dioph-eq.ts +8 -103
  292. package/src/prover/smt/solver/lp/explanation.ts +0 -6
  293. package/src/prover/smt/solver/lp/gomory.ts +8 -22
  294. package/src/prover/smt/solver/lp/hnf-cutter.ts +16 -23
  295. package/src/prover/smt/solver/lp/hnf.ts +10 -28
  296. package/src/prover/smt/solver/lp/int-cube.ts +17 -39
  297. package/src/prover/smt/solver/lp/int-solver.ts +3 -35
  298. package/src/prover/smt/solver/lp/lar-solver.ts +70 -83
  299. package/src/prover/smt/solver/lp/lar-term.ts +0 -5
  300. package/src/prover/smt/solver/lp/lp-settings.ts +6 -16
  301. package/src/prover/smt/solver/lp/maximize-term.ts +76 -52
  302. package/src/prover/smt/solver/lp/nex-creator.ts +7 -30
  303. package/src/prover/smt/solver/lp/nex.ts +2 -7
  304. package/src/prover/smt/solver/lp/nla-backoff.ts +0 -5
  305. package/src/prover/smt/solver/lp/nla-basics.ts +48 -30
  306. package/src/prover/smt/solver/lp/nla-core.ts +92 -136
  307. package/src/prover/smt/solver/lp/nla-divisions.ts +31 -43
  308. package/src/prover/smt/solver/lp/nla-emonics.ts +3 -21
  309. package/src/prover/smt/solver/lp/nla-factorization.ts +0 -4
  310. package/src/prover/smt/solver/lp/nla-grobner.ts +177 -149
  311. package/src/prover/smt/solver/lp/nla-horner.ts +2 -12
  312. package/src/prover/smt/solver/lp/nla-intervals.ts +1 -12
  313. package/src/prover/smt/solver/lp/nla-monomial-bounds.ts +15 -42
  314. package/src/prover/smt/solver/lp/nla-monotone.ts +1 -6
  315. package/src/prover/smt/solver/lp/nla-order.ts +0 -13
  316. package/src/prover/smt/solver/lp/nla-patcher.ts +3 -7
  317. package/src/prover/smt/solver/lp/nla-powers.ts +220 -0
  318. package/src/prover/smt/solver/lp/nla-tangents.ts +0 -10
  319. package/src/prover/smt/solver/lp/nla-throttle.ts +0 -6
  320. package/src/prover/smt/solver/lp/nla-transcendentals.ts +324 -0
  321. package/src/prover/smt/solver/lp/nla-types.ts +0 -12
  322. package/src/prover/smt/solver/lp/nla-var-eqs.ts +4 -26
  323. package/src/prover/smt/solver/lp/nra-solver.ts +164 -147
  324. package/src/prover/smt/solver/lp/numeric-pair.ts +0 -4
  325. package/src/prover/smt/solver/lp/pdd-interval.ts +6 -5
  326. package/src/prover/smt/solver/lp/pdd-simplifier.ts +61 -34
  327. package/src/prover/smt/solver/lp/pdd-solver.ts +74 -72
  328. package/src/prover/smt/solver/lp/pdd.ts +730 -358
  329. package/src/prover/smt/solver/lp/random-updater.ts +0 -9
  330. package/src/prover/smt/solver/lp/static-matrix.ts +8 -19
  331. package/src/prover/smt/solver/lp/union-find.ts +5 -5
  332. package/src/prover/smt/solver/macro-finder.ts +530 -0
  333. package/src/prover/smt/solver/mam-compiler.ts +129 -139
  334. package/src/prover/smt/solver/mam-interpreter.ts +0 -21
  335. package/src/prover/smt/solver/max-bv-sharing-tactic.ts +17 -0
  336. package/src/prover/smt/solver/max-cliques.ts +105 -0
  337. package/src/prover/smt/solver/maxcore.ts +310 -0
  338. package/src/prover/smt/solver/maximize-ac-sharing.ts +8 -21
  339. package/src/prover/smt/solver/maxlex.ts +115 -0
  340. package/src/prover/smt/solver/maxsmt-base.ts +106 -0
  341. package/src/prover/smt/solver/maxsmt.ts +92 -0
  342. package/src/prover/smt/solver/mbp/mbp-arith.ts +467 -0
  343. package/src/prover/smt/solver/mbp/mbp-basic-tg.ts +101 -0
  344. package/src/prover/smt/solver/mbp/mbp-plugin.ts +287 -0
  345. package/src/prover/smt/solver/mbp/mbp-qel.ts +48 -0
  346. package/src/prover/smt/solver/mbp/mbp-solve-plugin.ts +271 -0
  347. package/src/prover/smt/solver/mbp/mbp-term-graph.ts +606 -0
  348. package/src/prover/smt/solver/model-based-opt.ts +844 -0
  349. package/src/prover/smt/solver/model-checker.ts +20 -63
  350. package/src/prover/smt/solver/model-evaluator.ts +192 -40
  351. package/src/prover/smt/solver/model-finder.ts +14 -32
  352. package/src/prover/smt/solver/model-generator.ts +104 -46
  353. package/src/prover/smt/solver/model-macro-solver.ts +60 -114
  354. package/src/prover/smt/solver/model-printer.ts +214 -0
  355. package/src/prover/smt/solver/mpf.ts +709 -0
  356. package/src/prover/smt/solver/mus.ts +50 -0
  357. package/src/prover/smt/solver/muz/dl-context.ts +382 -0
  358. package/src/prover/smt/solver/muz/dl-mk-bit-blast.ts +97 -0
  359. package/src/prover/smt/solver/muz/dl-mk-coi-filter.ts +167 -0
  360. package/src/prover/smt/solver/muz/dl-mk-elim-term-ite.ts +125 -0
  361. package/src/prover/smt/solver/muz/dl-mk-interp-tail-simplifier.ts +299 -0
  362. package/src/prover/smt/solver/muz/dl-mk-rule-inliner.ts +455 -0
  363. package/src/prover/smt/solver/muz/dl-mk-slice.ts +340 -0
  364. package/src/prover/smt/solver/muz/dl-mk-subsumption-checker.ts +163 -0
  365. package/src/prover/smt/solver/muz/dl-rule-set.ts +273 -0
  366. package/src/prover/smt/solver/muz/dl-rule-transformer.ts +123 -0
  367. package/src/prover/smt/solver/muz/dl-rule.ts +495 -0
  368. package/src/prover/smt/solver/muz/hnf.ts +201 -0
  369. package/src/prover/smt/solver/muz/horn-subsume-model-converter.ts +176 -0
  370. package/src/prover/smt/solver/muz/horn-tactic.ts +214 -0
  371. package/src/prover/smt/solver/muz/rule-properties.ts +359 -0
  372. package/src/prover/smt/solver/muz/spacer-context.ts +1404 -0
  373. package/src/prover/smt/solver/muz/spacer-dl-interface.ts +52 -0
  374. package/src/prover/smt/solver/muz/spacer-generalizers.ts +241 -0
  375. package/src/prover/smt/solver/muz/spacer-manager.ts +127 -0
  376. package/src/prover/smt/solver/muz/spacer-pdr.ts +219 -0
  377. package/src/prover/smt/solver/muz/spacer-prop-solver.ts +333 -0
  378. package/src/prover/smt/solver/muz/spacer-util.ts +282 -0
  379. package/src/prover/smt/solver/muz/substitution.ts +203 -0
  380. package/src/prover/smt/solver/nla2bv-tactic.ts +285 -0
  381. package/src/prover/smt/solver/nlqsat.ts +484 -0
  382. package/src/prover/smt/solver/nlsat/algebraic.ts +357 -236
  383. package/src/prover/smt/solver/nlsat/atoms.ts +73 -54
  384. package/src/prover/smt/solver/nlsat/evaluator.ts +16 -22
  385. package/src/prover/smt/solver/nlsat/explain.ts +429 -275
  386. package/src/prover/smt/solver/nlsat/interval-set.ts +9 -51
  387. package/src/prover/smt/solver/nlsat/levelwise.ts +477 -344
  388. package/src/prover/smt/solver/nlsat/mpbq.ts +47 -14
  389. package/src/prover/smt/solver/nlsat/polynomial.ts +2385 -832
  390. package/src/prover/smt/solver/nlsat/solver.ts +297 -156
  391. package/src/prover/smt/solver/nlsat/transcendental-eval.ts +310 -0
  392. package/src/prover/smt/solver/nlsat/transcendentals.ts +391 -0
  393. package/src/prover/smt/solver/nlsat/types.ts +0 -9
  394. package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +9 -51
  395. package/src/prover/smt/solver/nlsat/upolynomial.ts +49 -109
  396. package/src/prover/smt/solver/nlsat-tactic.ts +82 -0
  397. package/src/prover/smt/solver/nnf.ts +112 -61
  398. package/src/prover/smt/solver/normalize-bounds.ts +53 -0
  399. package/src/prover/smt/solver/occf.ts +97 -0
  400. package/src/prover/smt/solver/opt-context.ts +801 -0
  401. package/src/prover/smt/solver/opt-nlsat.ts +386 -0
  402. package/src/prover/smt/solver/opt-pareto.ts +301 -0
  403. package/src/prover/smt/solver/opt-preprocess.ts +101 -0
  404. package/src/prover/smt/solver/opt-solver.ts +312 -0
  405. package/src/prover/smt/solver/opt-value.ts +55 -0
  406. package/src/prover/smt/solver/optsmt.ts +692 -0
  407. package/src/prover/smt/solver/parallel-tactic.ts +299 -0
  408. package/src/prover/smt/solver/pattern-inference.ts +21 -26
  409. package/src/prover/smt/solver/pb-rewriter.ts +281 -0
  410. package/src/prover/smt/solver/pb2bv-tactic.ts +540 -0
  411. package/src/prover/smt/solver/poly-rewriter.ts +261 -79
  412. package/src/prover/smt/solver/probes.ts +577 -0
  413. package/src/prover/smt/solver/propagate-values.ts +37 -30
  414. package/src/prover/smt/solver/proto-model.ts +650 -66
  415. package/src/prover/smt/solver/pull-quant.ts +28 -23
  416. package/src/prover/smt/solver/purify-arith.ts +632 -0
  417. package/src/prover/smt/solver/push-app-ite.ts +37 -0
  418. package/src/prover/smt/solver/qe-arith-plugin.ts +1096 -0
  419. package/src/prover/smt/solver/qe-lite-der.ts +2 -31
  420. package/src/prover/smt/solver/qe-lite-fm.ts +4 -28
  421. package/src/prover/smt/solver/qe-lite.ts +41 -51
  422. package/src/prover/smt/solver/qe-mbp.ts +270 -0
  423. package/src/prover/smt/solver/qe.ts +1499 -0
  424. package/src/prover/smt/solver/qel.ts +25 -0
  425. package/src/prover/smt/solver/qi-queue.ts +0 -16
  426. package/src/prover/smt/solver/qsat.ts +829 -0
  427. package/src/prover/smt/solver/quant-hoist.ts +196 -0
  428. package/src/prover/smt/solver/quant-tactics.ts +17 -74
  429. package/src/prover/smt/solver/quantifier-analyzer.ts +26 -47
  430. package/src/prover/smt/solver/quantifier-manager.ts +22 -32
  431. package/src/prover/smt/solver/quasi-macros.ts +243 -0
  432. package/src/prover/smt/solver/random-gen.ts +0 -2
  433. package/src/prover/smt/solver/rational.ts +45 -8
  434. package/src/prover/smt/solver/recfun-decl-plugin.ts +262 -0
  435. package/src/prover/smt/solver/recfun-rewriter.ts +107 -0
  436. package/src/prover/smt/solver/reduce-args.ts +225 -0
  437. package/src/prover/smt/solver/reduce-bv-size.ts +119 -0
  438. package/src/prover/smt/solver/ref-vector.ts +0 -6
  439. package/src/prover/smt/solver/relevancy.ts +2 -16
  440. package/src/prover/smt/solver/rewriter-tpl.ts +59 -135
  441. package/src/prover/smt/solver/rewriter.ts +507 -144
  442. package/src/prover/smt/solver/rlimit.ts +46 -24
  443. package/src/prover/smt/solver/sat/asymm-branch.ts +325 -0
  444. package/src/prover/smt/solver/sat/big.ts +177 -0
  445. package/src/prover/smt/solver/sat/clause-use-list.ts +71 -0
  446. package/src/prover/smt/solver/sat/clause.ts +203 -0
  447. package/src/prover/smt/solver/sat/cleaner.ts +94 -0
  448. package/src/prover/smt/solver/sat/config.ts +122 -0
  449. package/src/prover/smt/solver/sat/consequences.ts +203 -0
  450. package/src/prover/smt/solver/sat/elim-eqs.ts +142 -0
  451. package/src/prover/smt/solver/sat/goal2sat.ts +579 -0
  452. package/src/prover/smt/solver/sat/inc-sat-solver.ts +464 -0
  453. package/src/prover/smt/solver/sat/model-converter.ts +136 -0
  454. package/src/prover/smt/solver/sat/pb-constraint.ts +268 -0
  455. package/src/prover/smt/solver/sat/pb-solver.ts +1596 -0
  456. package/src/prover/smt/solver/sat/probing.ts +170 -0
  457. package/src/prover/smt/solver/sat/sat-tactic.ts +53 -0
  458. package/src/prover/smt/solver/sat/sat2goal.ts +189 -0
  459. package/src/prover/smt/solver/sat/scc.ts +142 -0
  460. package/src/prover/smt/solver/sat/simplifier.ts +1618 -0
  461. package/src/prover/smt/solver/sat/solver.ts +2107 -0
  462. package/src/prover/smt/solver/sat/var-queue.ts +117 -0
  463. package/src/prover/smt/solver/sat/watch-list.ts +140 -0
  464. package/src/prover/smt/solver/search-tree.ts +284 -0
  465. package/src/prover/smt/solver/seq-axioms.ts +995 -0
  466. package/src/prover/smt/solver/seq-decl-plugin.ts +819 -0
  467. package/src/prover/smt/solver/seq-derive.ts +1298 -0
  468. package/src/prover/smt/solver/seq-eq-approx.ts +236 -0
  469. package/src/prover/smt/solver/seq-eq-solver.ts +439 -0
  470. package/src/prover/smt/solver/seq-factory.ts +89 -0
  471. package/src/prover/smt/solver/seq-monadic.ts +730 -0
  472. package/src/prover/smt/solver/seq-range-predicate.ts +235 -0
  473. package/src/prover/smt/solver/seq-re-rewriter.ts +1171 -0
  474. package/src/prover/smt/solver/seq-re-util.ts +758 -0
  475. package/src/prover/smt/solver/seq-regex-bisim.ts +144 -0
  476. package/src/prover/smt/solver/seq-regex-live.ts +200 -0
  477. package/src/prover/smt/solver/seq-rewriter.ts +2404 -0
  478. package/src/prover/smt/solver/seq-skolem.ts +294 -0
  479. package/src/prover/smt/solver/seq-subset.ts +165 -0
  480. package/src/prover/smt/solver/seq-view-witness.ts +353 -0
  481. package/src/prover/smt/solver/smt-consequences.ts +297 -0
  482. package/src/prover/smt/solver/smt-kernel.ts +124 -0
  483. package/src/prover/smt/solver/smt-logics.ts +66 -0
  484. package/src/prover/smt/solver/smt-setup.ts +589 -0
  485. package/src/prover/smt/solver/smt2-printer.ts +765 -0
  486. package/src/prover/smt/solver/smtlib-parser.ts +3546 -406
  487. package/src/prover/smt/solver/smtlib-script.ts +2134 -0
  488. package/src/prover/smt/solver/solve-eqs.ts +928 -0
  489. package/src/prover/smt/solver/solver.ts +135 -40
  490. package/src/prover/smt/solver/sort.ts +1 -5
  491. package/src/prover/smt/solver/static-features.ts +314 -0
  492. package/src/prover/smt/solver/sticky-generations.ts +0 -6
  493. package/src/prover/smt/solver/tactic.ts +2141 -0
  494. package/src/prover/smt/solver/term-enumeration.ts +205 -0
  495. package/src/prover/smt/solver/theory-array.ts +1240 -0
  496. package/src/prover/smt/solver/theory-bv.ts +1210 -0
  497. package/src/prover/smt/solver/theory-char.ts +355 -0
  498. package/src/prover/smt/solver/theory-datatype.ts +598 -0
  499. package/src/prover/smt/solver/theory-finite-set.ts +30 -0
  500. package/src/prover/smt/solver/theory-fpa.ts +389 -0
  501. package/src/prover/smt/solver/theory-lra-axioms.ts +55 -25
  502. package/src/prover/smt/solver/theory-lra-bounds.ts +31 -11
  503. package/src/prover/smt/solver/theory-lra-final-check.ts +60 -91
  504. package/src/prover/smt/solver/theory-lra-internalize.ts +96 -53
  505. package/src/prover/smt/solver/theory-lra-model.ts +23 -53
  506. package/src/prover/smt/solver/theory-lra-propagate.ts +34 -42
  507. package/src/prover/smt/solver/theory-lra-state.ts +7 -28
  508. package/src/prover/smt/solver/theory-lra.ts +189 -9
  509. package/src/prover/smt/solver/theory-pb.ts +951 -0
  510. package/src/prover/smt/solver/theory-polymorphism.ts +58 -0
  511. package/src/prover/smt/solver/theory-recfun.ts +307 -0
  512. package/src/prover/smt/solver/theory-seq-regex.ts +867 -0
  513. package/src/prover/smt/solver/theory-seq-solve.ts +1373 -0
  514. package/src/prover/smt/solver/theory-seq-state.ts +852 -0
  515. package/src/prover/smt/solver/theory-seq.ts +961 -0
  516. package/src/prover/smt/solver/theory-without-terms.ts +24 -0
  517. package/src/prover/smt/solver/theory.ts +189 -0
  518. package/src/prover/smt/solver/tseitin-cnf.ts +486 -0
  519. package/src/prover/smt/solver/var-subst.ts +37 -39
  520. package/src/prover/smt/table.ts +3 -10
  521. package/src/prover/smt/types.ts +146 -0
  522. package/src/prover/tlapm/cache.ts +74 -48
  523. package/src/prover/tlapm/ocaml-marshal.ts +19 -21
  524. package/src/prover/tlapm/tlapm.ts +21 -20
  525. package/src/prover/tlapm-library.ts +3208 -0
  526. package/src/prover/verdict.ts +9 -2
  527. package/src/prover/zenon/check/check.ts +1 -11
  528. package/src/prover/zenon/check/definitions.ts +5 -15
  529. package/src/prover/zenon/check/equality.ts +0 -8
  530. package/src/prover/zenon/check/functions.ts +0 -4
  531. package/src/prover/zenon/check/keys.ts +0 -7
  532. package/src/prover/zenon/check/propositional.ts +0 -3
  533. package/src/prover/zenon/check/records.ts +1 -6
  534. package/src/prover/zenon/check/relations.ts +2 -14
  535. package/src/prover/zenon/check/rewrites.ts +2 -21
  536. package/src/prover/zenon/check/sets.ts +40 -61
  537. package/src/prover/zenon/check/terms.ts +1 -19
  538. package/src/prover/zenon/check/tla.ts +0 -6
  539. package/src/prover/zenon/decide.ts +10 -19
  540. package/src/prover/zenon/encode.ts +0 -9
  541. package/src/prover/zenon/eqrel.ts +2 -15
  542. package/src/prover/zenon/equality-rules.ts +24 -6
  543. package/src/prover/zenon/expr.ts +29 -28
  544. package/src/prover/zenon/index-table.ts +33 -61
  545. package/src/prover/zenon/isar-case.ts +9 -21
  546. package/src/prover/zenon/isar.ts +37 -67
  547. package/src/prover/zenon/limits.ts +0 -4
  548. package/src/prover/zenon/llproof.ts +2 -22
  549. package/src/prover/zenon/mltoll.ts +66 -106
  550. package/src/prover/zenon/node.ts +20 -15
  551. package/src/prover/zenon/ocaml.ts +1 -17
  552. package/src/prover/zenon/parse.ts +9 -13
  553. package/src/prover/zenon/phrase.ts +2 -14
  554. package/src/prover/zenon/proof.ts +0 -11
  555. package/src/prover/zenon/propositional-rules.ts +0 -7
  556. package/src/prover/zenon/rules.ts +3 -8
  557. package/src/prover/zenon/search.ts +11 -35
  558. package/src/prover/zenon/tla/functions.ts +59 -33
  559. package/src/prover/zenon/tla/llproof.ts +67 -78
  560. package/src/prover/zenon/tla/records.ts +57 -35
  561. package/src/prover/zenon/tla/rewrites.ts +12 -21
  562. package/src/prover/zenon/tla/sets.ts +88 -59
  563. package/src/prover/zenon/tla/terms.ts +0 -8
  564. package/src/prover/zenon/tla/tla.ts +66 -66
  565. package/src/randomization.ts +81 -35
  566. package/src/resolve.ts +1132 -430
  567. package/src/runtime.ts +33 -23
  568. package/src/sany/builtins.ts +11 -14
  569. package/src/sany/generation.ts +383 -0
  570. package/src/sany/generator-def-entries.ts +210 -0
  571. package/src/sany/generator-definitions.ts +688 -0
  572. package/src/sany/generator-expressions.ts +1108 -0
  573. package/src/sany/generator-proofs.ts +665 -0
  574. package/src/sany/generator.ts +192 -2764
  575. package/src/sany/levels.ts +5 -35
  576. package/src/sany/lexer.ts +61 -80
  577. package/src/sany/linter.ts +0 -10
  578. package/src/sany/modules.ts +5 -7
  579. package/src/sany/nodes.ts +6 -44
  580. package/src/sany/parse-error.ts +39 -117
  581. package/src/sany/report.ts +32 -69
  582. package/src/sany/selectors.ts +60 -82
  583. package/src/sany/source.ts +1 -17
  584. package/src/sany/xml.ts +37 -120
  585. package/src/search.ts +913 -227
  586. package/src/simulate.ts +765 -0
  587. package/src/spec-description.ts +198 -104
  588. package/src/standard-definitions.ts +4 -4
  589. package/src/standard-modules.ts +302 -99
  590. package/src/state-graph.ts +52 -33
  591. package/src/subexpressions.ts +578 -166
  592. package/src/substitution-levels.ts +7 -7
  593. package/src/successors.ts +299 -108
  594. package/src/symmetry.ts +37 -28
  595. package/src/tableau.ts +29 -26
  596. package/src/tlc/fingerprint.ts +267 -79
  597. package/src/tlc/jar-data.ts +122 -6
  598. package/src/tlc/messages.ts +127 -56
  599. package/src/tlc/order.ts +53 -72
  600. package/src/tlc/random.ts +38 -49
  601. package/src/tlc/replay.ts +579 -230
  602. package/src/tlc/summary.ts +64 -60
  603. package/src/tlc/tlc-operators.ts +83 -47
  604. package/src/tlc/tlcext-operators.ts +205 -127
  605. package/src/tlc/trace-spec.ts +235 -0
  606. package/src/tlc/value-stream.ts +139 -0
  607. package/src/tlc/version.ts +1 -4
  608. package/src/trace-liveness.ts +529 -0
  609. package/src/transfer.ts +22 -25
  610. package/src/typed-tier.ts +6556 -0
  611. package/src/typescript/actions.ts +479 -0
  612. package/src/typescript/collections.ts +614 -0
  613. package/src/typescript/compile.ts +63 -0
  614. package/src/typescript/context.ts +94 -0
  615. package/src/typescript/emit.ts +121 -0
  616. package/src/typescript/expressions.ts +496 -0
  617. package/src/typescript/formula.ts +154 -0
  618. package/src/typescript/functions.ts +284 -0
  619. package/src/typescript/model.ts +162 -0
  620. package/src/typescript/names.ts +114 -0
  621. package/src/typescript/program.ts +48 -0
  622. package/src/typescript/properties.ts +139 -0
  623. package/src/typescript/scope.ts +112 -0
  624. package/src/typescript/steps.ts +167 -0
  625. package/src/typescript/types.ts +171 -0
  626. package/src/values.ts +945 -526
  627. package/src/worker.ts +7 -8
  628. package/src/prover/isabelle/isar/statement.ts +0 -57
  629. package/src/prover/smt/solver/z3-license.txt +0 -10
  630. package/src/prover/tlaps-module.ts +0 -510
  631. package/src/prover/zenon/LICENSE +0 -32
package/dist/worker.cjs CHANGED
@@ -6,19 +6,19 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=/* @__PURE__ */ new WeakMap,n=(e,n)=>(e instanceof Error&&!t.has(e)&&t.set(e,n),e),r=e=>t.get(e),i=t=>{try{return t()}catch(t){throw n(t,e.error)}},a=e=>{let t=i(e);return t&&{branches:t.branches,addInitialState:(e,n,r)=>i(()=>t.addInitialState(e,n,r)),addState:(e,n,r,a)=>i(()=>t.addState(e,n,r,a)),findViolation:()=>i(()=>t.findViolation()),getViolatedProperties:(e,n)=>i(()=>t.getViolatedProperties(e,n))}},o=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,s=o(`java.lang.RuntimeException`),c=o(`tlc2.tool.EvalException`),l=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`;var u=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},d=class extends u{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},f=class extends d{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},p=class extends f{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const m=(e,t=!1,n,r=[])=>new d(e.map(e=>`${e.location}\n\n${e.message}`).join(`
9
+ const e={success:0,abort:1,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>({branches:e.branches,solutions:e.solutions,addInitialState:e.addInitialState,addState:(t,n,r,i)=>o(()=>e.addState(t,n,r,i)),storeState:e.storeState,getStateCounts:e.getStateCounts,findViolation:()=>o(()=>e.findViolation()),getViolatedProperties:(t,n)=>o(()=>e.getViolatedProperties(t,n))}),ee=e=>{let t=o(e);return t&&s(t)},c=e=>{let t=o(e);return t&&{solutions:t.solutions,findTraceViolation:(e,n)=>o(()=>t.findTraceViolation(e,n))}},l=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,u=l(`java.lang.RuntimeException`),d=l(`tlc2.tool.EvalException`),te=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var f=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},p=class extends f{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},m=class extends p{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},h=class extends m{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const g=(e,t=!1,n,r=[])=>new p(e.map(e=>`${e.location}\n\n${e.message}`).join(`
10
10
 
11
- `),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),h=(e,t)=>m([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),g=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
12
- `)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,v=(e,t)=>m([{location:_(t),message:e}]);var y=class extends u{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},b=class extends u{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const x=`This was a Java StackOverflowError. It was probably the result
11
+ `),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),_=(e,t)=>g([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),v=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
12
+ `)}`,y=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,b=(e,t)=>g([{location:y(t),message:e}]);var x=class extends f{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},S=class extends f{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const C=`This was a Java StackOverflowError. It was probably the result
13
13
  of an incorrect recursive function definition that caused TLC to enter
14
14
  an infinite loop when trying to compute the function or its application
15
- to an element in its putative domain.`;var S=class extends b{constructor(){super(x)}};const C=()=>n(new S,e.error);var w=class extends b{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},T=class extends b{variable;constructor(e,t){super(e),this.variable=t}},E=class extends b{exitCode;constructor(t,n=e.error){super(t),this.name=`TlaEvaluationError`,this.exitCode=n}},D=class extends b{state;constructor(e){super(`current state is not a legal state`),this.name=`TlaEvaluationError`,this.state=e}},O=class extends u{failure;exception;constructor(e,t={}){super(e),this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},k=class extends O{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e}),this.name=`TlaProofError`}},A=class extends u{constructor(e,t){super(e,t),this.name=`TlaProverError`}},j=class extends u{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},M=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}},N=class extends u{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},P=class extends u{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},F=class extends u{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},I=class extends u{constructor(e){super(e),this.name=`SmtInvariantError`}},L=class extends u{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},R=class extends u{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},z=class extends u{constructor(e,t){super(e,t),this.name=`SmtParseError`}},B=class extends N{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const V=t=>r(t)??(t instanceof d?e.specParseError:t instanceof y?e.configParseError:t instanceof b?e.specEvaluationFailure:e.error);var H=class extends u{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},U=class extends u{constructor(e){super(e),this.name=`PcalRuntimeError`}},W=class extends u{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}};const G=`node:worker_threads`,K=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,q=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
15
+ to an element in its putative domain.`;var w=class extends S{constructor(){super(C)}};const T=()=>i(new w,e.error);var E=class extends S{},D=class extends S{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},O=class extends S{variable;constructor(e,t){super(e),this.variable=t}},k=class extends S{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},A=class extends S{constructor(t){super(t),i(this,e.error)}},j=class extends E{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},M=class extends S{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},N=class extends S{},P=class extends S{};const F=`Too many possible next states for the last state in the trace.`;var I=class extends S{constructor(){super(F)}},L=class extends S{code;constructor(e,t){super(t),this.code=e}},R=class extends S{state;constructor(e){super(`current state is not a legal state`),this.state=e}},z=class extends f{failure;exception;locus;constructor(e,t={}){super(e),this.locus=t.locus,this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},B=class extends z{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},V=class extends f{constructor(e,t){super(e,t),this.name=`TlaProverError`}},H=class extends V{locus;constructor(e,t){super(e),this.name=`TlaMethodError`,this.locus=t}},ne=class extends f{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},U=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const W=(e,t)=>e instanceof U&&e.exception===t;var G=class extends f{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},K=class extends f{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},q=class extends f{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},J=class extends f{constructor(e){super(e),this.name=`SmtDefaultError`}},Y=class extends f{constructor(e){super(e),this.name=`SmtInvariantError`}},X=class extends f{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},Z=class extends f{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},re=class extends f{line;column;constructor(e,t){super(e),this.name=`SmtParseError`,this.line=t.line,this.column=t.column}},ie=class extends G{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const ae=t=>a(t)??(t instanceof p?e.specParseError:t instanceof x?e.configParseError:t instanceof S?e.specEvaluationFailure:e.error);var oe=class extends f{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},se=class extends f{constructor(e){super(e),this.name=`PcalRuntimeError`}},Q=class extends f{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}},ce=class extends f{constructor(e,t){let n=t?.getSourceFile(),r=n?.getLineAndCharacterOfPosition(t?.getStart()??0);super(n===void 0||r===void 0?e:`${n.fileName}:${r.line+1}:${r.character+1} ${e}`),this.name=`TlaTypeScriptError`}};const $=`node:worker_threads`,le=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,ue=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
16
16
  /* @vite-ignore */
17
17
  /* webpackIgnore: true */
18
- G))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},J=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
18
+ $))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},de=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
19
19
  /* @vite-ignore */
20
20
  /* webpackIgnore: true */
21
- G)).parentPort,Y=()=>{let e=`Bun`in globalThis?import(
21
+ $)).parentPort,fe=()=>{let e=`Bun`in globalThis?import(
22
22
  /* @vite-ignore */
23
23
  /* webpackIgnore: true */
24
- `bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return _}});
24
+ `bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return O}});
package/dist/worker.js CHANGED
@@ -6,19 +6,19 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=/* @__PURE__ */ new WeakMap,n=(e,n)=>(e instanceof Error&&!t.has(e)&&t.set(e,n),e),r=e=>t.get(e),i=t=>{try{return t()}catch(t){throw n(t,e.error)}},a=e=>{let t=i(e);return t&&{branches:t.branches,addInitialState:(e,n,r)=>i(()=>t.addInitialState(e,n,r)),addState:(e,n,r,a)=>i(()=>t.addState(e,n,r,a)),findViolation:()=>i(()=>t.findViolation()),getViolatedProperties:(e,n)=>i(()=>t.getViolatedProperties(e,n))}},o=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,s=o(`java.lang.RuntimeException`),c=o(`tlc2.tool.EvalException`),l=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`;var u=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},d=class extends u{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},f=class extends d{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},p=class extends f{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const m=(e,t=!1,n,r=[])=>new d(e.map(e=>`${e.location}\n\n${e.message}`).join(`
9
+ const e={success:0,abort:1,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>({branches:e.branches,solutions:e.solutions,addInitialState:e.addInitialState,addState:(t,n,r,i)=>o(()=>e.addState(t,n,r,i)),storeState:e.storeState,getStateCounts:e.getStateCounts,findViolation:()=>o(()=>e.findViolation()),getViolatedProperties:(t,n)=>o(()=>e.getViolatedProperties(t,n))}),ee=e=>{let t=o(e);return t&&s(t)},c=e=>{let t=o(e);return t&&{solutions:t.solutions,findTraceViolation:(e,n)=>o(()=>t.findTraceViolation(e,n))}},l=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,u=l(`java.lang.RuntimeException`),d=l(`tlc2.tool.EvalException`),te=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var f=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},p=class extends f{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},m=class extends p{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},h=class extends m{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const g=(e,t=!1,n,r=[])=>new p(e.map(e=>`${e.location}\n\n${e.message}`).join(`
10
10
 
11
- `),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),h=(e,t)=>m([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),g=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
12
- `)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,v=(e,t)=>m([{location:_(t),message:e}]);var y=class extends u{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},b=class extends u{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const x=`This was a Java StackOverflowError. It was probably the result
11
+ `),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),_=(e,t)=>g([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),v=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
12
+ `)}`,y=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,b=(e,t)=>g([{location:y(t),message:e}]);var x=class extends f{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},S=class extends f{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const C=`This was a Java StackOverflowError. It was probably the result
13
13
  of an incorrect recursive function definition that caused TLC to enter
14
14
  an infinite loop when trying to compute the function or its application
15
- to an element in its putative domain.`;var S=class extends b{constructor(){super(x)}};const C=()=>n(new S,e.error);var w=class extends b{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},T=class extends b{variable;constructor(e,t){super(e),this.variable=t}},E=class extends b{exitCode;constructor(t,n=e.error){super(t),this.name=`TlaEvaluationError`,this.exitCode=n}},D=class extends b{state;constructor(e){super(`current state is not a legal state`),this.name=`TlaEvaluationError`,this.state=e}},O=class extends u{failure;exception;constructor(e,t={}){super(e),this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},k=class extends O{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e}),this.name=`TlaProofError`}},A=class extends u{constructor(e,t){super(e,t),this.name=`TlaProverError`}},j=class extends u{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},M=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}},N=class extends u{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},P=class extends u{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},F=class extends u{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},I=class extends u{constructor(e){super(e),this.name=`SmtInvariantError`}},L=class extends u{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},R=class extends u{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},z=class extends u{constructor(e,t){super(e,t),this.name=`SmtParseError`}},B=class extends N{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const V=t=>r(t)??(t instanceof d?e.specParseError:t instanceof y?e.configParseError:t instanceof b?e.specEvaluationFailure:e.error);var H=class extends u{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},U=class extends u{constructor(e){super(e),this.name=`PcalRuntimeError`}},W=class extends u{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}};const G=`node:worker_threads`,K=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,q=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
15
+ to an element in its putative domain.`;var w=class extends S{constructor(){super(C)}};const T=()=>i(new w,e.error);var E=class extends S{},D=class extends S{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},O=class extends S{variable;constructor(e,t){super(e),this.variable=t}},k=class extends S{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},A=class extends S{constructor(t){super(t),i(this,e.error)}},j=class extends E{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},M=class extends S{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},N=class extends S{},P=class extends S{};const F=`Too many possible next states for the last state in the trace.`;var I=class extends S{constructor(){super(F)}},L=class extends S{code;constructor(e,t){super(t),this.code=e}},R=class extends S{state;constructor(e){super(`current state is not a legal state`),this.state=e}},z=class extends f{failure;exception;locus;constructor(e,t={}){super(e),this.locus=t.locus,this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},B=class extends z{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},V=class extends f{constructor(e,t){super(e,t),this.name=`TlaProverError`}},H=class extends V{locus;constructor(e,t){super(e),this.name=`TlaMethodError`,this.locus=t}},ne=class extends f{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},U=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const W=(e,t)=>e instanceof U&&e.exception===t;var G=class extends f{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},K=class extends f{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},q=class extends f{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},J=class extends f{constructor(e){super(e),this.name=`SmtDefaultError`}},Y=class extends f{constructor(e){super(e),this.name=`SmtInvariantError`}},X=class extends f{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},Z=class extends f{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},re=class extends f{line;column;constructor(e,t){super(e),this.name=`SmtParseError`,this.line=t.line,this.column=t.column}},ie=class extends G{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const ae=t=>a(t)??(t instanceof p?e.specParseError:t instanceof x?e.configParseError:t instanceof S?e.specEvaluationFailure:e.error);var oe=class extends f{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},se=class extends f{constructor(e){super(e),this.name=`PcalRuntimeError`}},Q=class extends f{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}},ce=class extends f{constructor(e,t){let n=t?.getSourceFile(),r=n?.getLineAndCharacterOfPosition(t?.getStart()??0);super(n===void 0||r===void 0?e:`${n.fileName}:${r.line+1}:${r.character+1} ${e}`),this.name=`TlaTypeScriptError`}};const $=`node:worker_threads`,le=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,ue=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
16
16
  /* @vite-ignore */
17
17
  /* webpackIgnore: true */
18
- G))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},J=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
18
+ $))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},de=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
19
19
  /* @vite-ignore */
20
20
  /* webpackIgnore: true */
21
- G)).parentPort,Y=()=>{let e=`Bun`in globalThis?import(
21
+ $)).parentPort,fe=()=>{let e=`Bun`in globalThis?import(
22
22
  /* @vite-ignore */
23
23
  /* webpackIgnore: true */
24
- `bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};export{N as A,g as B,E as C,S as D,f as E,h as F,r as G,o as H,m as I,n as K,v as L,k as M,c as N,d as O,s as P,C as R,p as S,A as T,l as U,V,e as W,b as _,L as a,M as b,U as c,F as d,I as f,u as g,y as h,q as i,j,T as k,R as l,P as m,J as n,W as o,z as p,a as q,K as r,H as s,Y as t,x as u,D as v,O as w,B as x,w as y,_ as z};
24
+ `bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};export{ae as $,k as A,E as B,R as C,H as D,ie as E,w as F,d as G,L as H,p as I,g as J,u as K,I as L,V as M,m as N,M as O,P,v as Q,ce as R,A as S,U as T,ne as U,G as V,B as W,T as X,b as Y,y as Z,N as _,X as a,n as at,f as b,se as c,ee as ct,q as d,l as et,J as f,F as g,K as h,ue as i,a as it,z as j,h as k,Z as l,re as m,de as n,te as nt,Q as o,i as ot,Y as p,_ as q,le as r,e as rt,oe as s,c as st,fe as t,W as tt,C as u,x as v,D as w,S as x,j as y,O as z};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tla-ts",
3
- "version": "0.0.9",
3
+ "version": "0.0.10-dev.06b481ee0",
4
4
  "description": "A TLA+ interpreter and model checker in TypeScript, 2× faster than TLC",
5
5
  "keywords": [
6
6
  "formal verification",
@@ -55,9 +55,11 @@
55
55
  "access": "public"
56
56
  },
57
57
  "dependencies": {
58
+ "@typescript/typescript6": "6.0.2",
58
59
  "fflate": "^0.8.3"
59
60
  },
60
61
  "devDependencies": {
62
+ "@engine262/engine262": "0.0.1-d553e7b52501fbc47eae981c8d0fa7a5c26d0171",
61
63
  "@types/node": "^22",
62
64
  "publint": "^0.3.0",
63
65
  "typescript": "^7.0.2",
package/src/ast.ts CHANGED
@@ -27,15 +27,13 @@ export interface DecimalExpression {
27
27
  location: SourceLocation;
28
28
  }
29
29
 
30
- export interface StringExpression {
30
+ interface StringExpression {
31
31
  kind: "String";
32
32
  value: string;
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. spelling holds the text of an operator written as a synonym.
38
- export interface IdentifierExpression {
36
+ interface IdentifierExpression {
39
37
  kind: "Identifier";
40
38
  name: string;
41
39
  spelling?: string;
@@ -44,36 +42,27 @@ export interface IdentifierExpression {
44
42
  resolution?: LocalResolution;
45
43
  }
46
44
 
47
- // spelling holds the text of an operator written as a synonym, such as (+) for \oplus, which SANY
48
- // reports as written.
49
45
  export interface ApplyExpression {
50
46
  kind: "Apply";
51
47
  operator: string;
52
48
  spelling?: string;
53
49
  args: Expression[];
54
- // The number of args each part of a name like F(x)!l(y) takes, when a part before the last takes
55
- // some.
56
50
  argumentCounts?: number[];
57
- // The range of the parenthesized arguments of a named operator, or of the whole name when its
58
- // last part takes none, where SANY reports their count.
59
51
  argumentsRange?: SourceRange;
60
52
  selectorRanges?: SourceRange[];
61
- // The range of the arguments of each part of a name like F(x)!l(y), for a part that takes some.
62
53
  argumentRanges?: (SourceRange | undefined)[];
63
54
  location: SourceLocation;
64
55
  resolution?: LocalResolution;
65
56
  }
66
57
 
67
- export interface OperatorReferenceExpression {
58
+ interface OperatorReferenceExpression {
68
59
  kind: "OperatorReference";
69
60
  operator: string;
70
61
  spelling?: string;
71
62
  location: SourceLocation;
72
63
  }
73
64
 
74
- // operator holds the operator, such as SUBSET, that an argument names, which tla-ts reads as a
75
- // LAMBDA.
76
- export interface LambdaExpression {
65
+ interface LambdaExpression {
77
66
  kind: "Lambda";
78
67
  params: string[];
79
68
  paramRanges?: SourceRange[];
@@ -82,35 +71,33 @@ export interface LambdaExpression {
82
71
  location: SourceLocation;
83
72
  }
84
73
 
85
- export interface JunctionExpression {
74
+ interface JunctionExpression {
86
75
  kind: "And" | "Or";
87
76
  operands: Expression[];
88
77
  isBulleted?: boolean;
89
- // SANY parses an infix chain such as A /\ B /\ C as (A /\ B) /\ C, whose node of each prefix of
90
- // two or more operands ends after the parentheses of its last operand.
91
78
  prefixEnds?: SourceLocation[];
92
79
  location: SourceLocation;
93
80
  }
94
81
 
95
- export interface PrimeExpression {
82
+ interface PrimeExpression {
96
83
  kind: "Prime";
97
84
  expression: Expression;
98
85
  location: SourceLocation;
99
86
  }
100
87
 
101
- export interface UnchangedExpression {
88
+ interface UnchangedExpression {
102
89
  kind: "Unchanged";
103
90
  expression: Expression;
104
91
  location: SourceLocation;
105
92
  }
106
93
 
107
- export interface EnabledExpression {
94
+ interface EnabledExpression {
108
95
  kind: "Enabled";
109
96
  expression: Expression;
110
97
  location: SourceLocation;
111
98
  }
112
99
 
113
- export interface IfExpression {
100
+ interface IfExpression {
114
101
  kind: "If";
115
102
  condition: Expression;
116
103
  consequent: Expression;
@@ -123,10 +110,11 @@ export interface CaseArm {
123
110
  body: Expression;
124
111
  }
125
112
 
126
- export interface CaseExpression {
113
+ interface CaseExpression {
127
114
  kind: "Case";
128
115
  arms: CaseArm[];
129
116
  other: Expression | undefined;
117
+ otherRange?: SourceRange;
130
118
  location: SourceLocation;
131
119
  }
132
120
 
@@ -134,11 +122,11 @@ export interface LetExpression {
134
122
  kind: "Let";
135
123
  definitions: Definition[];
136
124
  instances?: Instance[];
125
+ recursive?: Declaration[];
137
126
  body: Expression;
138
127
  location: SourceLocation;
139
128
  }
140
129
 
141
- // ranges holds the range of each name the pattern binds.
142
130
  export type BoundPattern =
143
131
  | { kind: "Name"; name: string; ranges?: SourceRange[] }
144
132
  | { kind: "Tuple"; names: string[]; ranges?: SourceRange[] };
@@ -155,7 +143,7 @@ export interface QuantifierExpression {
155
143
  location: SourceLocation;
156
144
  }
157
145
 
158
- export interface UnboundedQuantifierExpression {
146
+ interface UnboundedQuantifierExpression {
159
147
  kind: "UnboundedQuantifier";
160
148
  quantifier: "Forall" | "Exists";
161
149
  names: string[];
@@ -165,7 +153,7 @@ export interface UnboundedQuantifierExpression {
165
153
  location: SourceLocation;
166
154
  }
167
155
 
168
- export interface ChooseExpression {
156
+ interface ChooseExpression {
169
157
  kind: "Choose";
170
158
  pattern: BoundPattern;
171
159
  set: Expression | undefined;
@@ -173,27 +161,27 @@ export interface ChooseExpression {
173
161
  location: SourceLocation;
174
162
  }
175
163
 
176
- export interface SetEnumerationExpression {
164
+ interface SetEnumerationExpression {
177
165
  kind: "SetEnumeration";
178
166
  elements: Expression[];
179
167
  location: SourceLocation;
180
168
  }
181
169
 
182
- export interface SetFilterExpression {
170
+ interface SetFilterExpression {
183
171
  kind: "SetFilter";
184
172
  bound: Bound;
185
173
  predicate: Expression;
186
174
  location: SourceLocation;
187
175
  }
188
176
 
189
- export interface SetMapExpression {
177
+ interface SetMapExpression {
190
178
  kind: "SetMap";
191
179
  expression: Expression;
192
180
  bounds: Bound[];
193
181
  location: SourceLocation;
194
182
  }
195
183
 
196
- export interface TupleExpression {
184
+ interface TupleExpression {
197
185
  kind: "Tuple";
198
186
  elements: Expression[];
199
187
  location: SourceLocation;
@@ -207,7 +195,7 @@ export interface FunctionConstructionExpression {
207
195
  isRecursive?: boolean;
208
196
  }
209
197
 
210
- export interface FunctionSetExpression {
198
+ interface FunctionSetExpression {
211
199
  kind: "FunctionSet";
212
200
  domain: Expression;
213
201
  range: Expression;
@@ -220,7 +208,7 @@ export interface RecordField {
220
208
  location: SourceLocation;
221
209
  }
222
210
 
223
- export interface RecordExpression {
211
+ interface RecordExpression {
224
212
  kind: "Record" | "RecordSet";
225
213
  fields: RecordField[];
226
214
  location: SourceLocation;
@@ -235,60 +223,58 @@ interface ExceptUpdate {
235
223
  value: Expression;
236
224
  }
237
225
 
238
- export interface ExceptExpression {
226
+ interface ExceptExpression {
239
227
  kind: "Except";
240
228
  function: Expression;
241
229
  updates: ExceptUpdate[];
242
230
  location: SourceLocation;
243
231
  }
244
232
 
245
- export interface ExceptAtExpression {
233
+ interface ExceptAtExpression {
246
234
  kind: "ExceptAt";
247
235
  location: SourceLocation;
248
236
  }
249
237
 
250
- export interface FunctionApplicationExpression {
238
+ interface FunctionApplicationExpression {
251
239
  kind: "FunctionApplication";
252
240
  function: Expression;
253
241
  args: Expression[];
254
242
  location: SourceLocation;
255
243
  }
256
244
 
257
- // SANY parses [e1, ..., en] as a function application without the function, and its semantic
258
- // checker rejects it.
259
- export interface BracketExpression {
245
+ interface BracketExpression {
260
246
  kind: "Bracket";
261
247
  args: Expression[];
262
248
  location: SourceLocation;
263
249
  }
264
250
 
265
- export interface FieldAccessExpression {
251
+ interface FieldAccessExpression {
266
252
  kind: "FieldAccess";
267
253
  record: Expression;
268
254
  field: string;
269
255
  location: SourceLocation;
270
256
  }
271
257
 
272
- export interface ProductExpression {
258
+ interface ProductExpression {
273
259
  kind: "Product";
274
260
  factors: Expression[];
275
261
  location: SourceLocation;
276
262
  }
277
263
 
278
- export interface TemporalExpression {
264
+ interface TemporalExpression {
279
265
  kind: "Always" | "Eventually";
280
266
  expression: Expression;
281
267
  location: SourceLocation;
282
268
  }
283
269
 
284
- export interface ActionExpression {
270
+ interface ActionExpression {
285
271
  kind: "BoxAction" | "AngleAction";
286
272
  action: Expression;
287
273
  subscript: Expression;
288
274
  location: SourceLocation;
289
275
  }
290
276
 
291
- export interface FairnessExpression {
277
+ interface FairnessExpression {
292
278
  kind: "WeakFairness" | "StrongFairness";
293
279
  subscript: Expression;
294
280
  action: Expression;
@@ -301,6 +287,7 @@ export interface LabelExpression {
301
287
  name: string;
302
288
  params: string[];
303
289
  paramRanges?: SourceRange[];
290
+ head?: SourceRange;
304
291
  body: Expression;
305
292
  location: SourceLocation;
306
293
  }
@@ -312,7 +299,7 @@ export type Selector =
312
299
  | { kind: "At" }
313
300
  | { kind: "Colon" };
314
301
 
315
- export interface SubexpressionExpression {
302
+ interface SubexpressionExpression {
316
303
  kind: "Subexpression";
317
304
  selectors: Selector[];
318
305
  selectorRanges?: SourceRange[];
@@ -320,6 +307,12 @@ export interface SubexpressionExpression {
320
307
  location: SourceLocation;
321
308
  }
322
309
 
310
+ interface SelectionExpression {
311
+ kind: "Selection";
312
+ expression: Expression;
313
+ location: SourceLocation;
314
+ }
315
+
323
316
  export type Expression =
324
317
  | NumberExpression
325
318
  | DecimalExpression
@@ -355,7 +348,8 @@ export type Expression =
355
348
  | ActionExpression
356
349
  | FairnessExpression
357
350
  | LabelExpression
358
- | SubexpressionExpression;
351
+ | SubexpressionExpression
352
+ | SelectionExpression;
359
353
 
360
354
  export interface OperatorParam {
361
355
  name: string;
@@ -369,6 +363,7 @@ export interface OperatorDefinition {
369
363
  params: OperatorParam[];
370
364
  body: Expression;
371
365
  bodyRange?: SourceRange;
366
+ head?: SourceRange;
372
367
  isLocal: boolean;
373
368
  isRecursive: boolean;
374
369
  location: SourceLocation;
@@ -381,7 +376,6 @@ export interface FunctionDefinition {
381
376
  body: Expression;
382
377
  isLocal: boolean;
383
378
  isRecursive: boolean;
384
- // Whether the body applies the function, which SANY makes a recursive function definition.
385
379
  isSelfReferential?: boolean;
386
380
  location: SourceLocation;
387
381
  }
@@ -438,7 +432,6 @@ export interface AssumeProve {
438
432
 
439
433
  export type Fact = Expression | { kind: "ModuleFact"; name: string; location: SourceLocation };
440
434
 
441
- // keyword is the range of the USE or HIDE token and any ONLY after it.
442
435
  export interface UseOrHide {
443
436
  kind: "Use" | "Hide";
444
437
  isOnly: boolean;
@@ -448,7 +441,6 @@ export interface UseOrHide {
448
441
  location: SourceLocation;
449
442
  }
450
443
 
451
- // keyword is the range of the BY, OBVIOUS, or OMITTED token.
452
444
  export type Proof =
453
445
  | { kind: "Obvious" | "Omitted"; keyword: SourceRange; location: SourceLocation }
454
446
  | {
@@ -490,8 +482,6 @@ export type StepBody =
490
482
  | { kind: "Assert"; isSuffices: boolean; statement: Expression | AssumeProve }
491
483
  | { kind: "Qed" };
492
484
 
493
- // head is the range of the step number and its statement, without the proof, and statement is the
494
- // range of the statement alone.
495
485
  export interface ProofStep {
496
486
  name: string | undefined;
497
487
  token: string;
@@ -509,10 +499,9 @@ export interface Theorem {
509
499
  location: SourceLocation;
510
500
  }
511
501
 
512
- // The units of a module in source order, for consumers that need the order across kinds.
513
502
  export type ModuleUnit =
514
503
  | { kind: "Constants" | "Variables"; declarations: Declaration[]; location: SourceLocation }
515
- | { kind: "Recursive"; declarations: Declaration[] }
504
+ | { kind: "Recursive"; declarations: Declaration[]; location: SourceLocation }
516
505
  | { kind: "Definition"; definition: Definition }
517
506
  | { kind: "Instance"; instance: Instance }
518
507
  | { kind: "Assumption"; assumption: Assumption }
@@ -536,6 +525,11 @@ export interface Module {
536
525
  units: ModuleUnit[];
537
526
  }
538
527
 
528
+ export const getDefinitionExpressions = (definition: Definition) =>
529
+ definition.kind === "Function"
530
+ ? [...definition.bounds.map((bound) => bound.set), definition.body]
531
+ : [definition.body];
532
+
539
533
  export const getChildren = (expression: Expression): Expression[] => {
540
534
  switch (expression.kind) {
541
535
  case "Number":
@@ -566,14 +560,7 @@ export const getChildren = (expression: Expression): Expression[] => {
566
560
  ...(expression.other ? [expression.other] : []),
567
561
  ];
568
562
  case "Let":
569
- return [
570
- ...expression.definitions.flatMap((definition) =>
571
- definition.kind === "Function"
572
- ? [...definition.bounds.map((bound) => bound.set), definition.body]
573
- : [definition.body],
574
- ),
575
- expression.body,
576
- ];
563
+ return [...expression.definitions.flatMap(getDefinitionExpressions), expression.body];
577
564
  case "Forall":
578
565
  case "Exists":
579
566
  return [...expression.bounds.map((bound) => bound.set), expression.body];
@@ -621,9 +608,18 @@ export const getChildren = (expression: Expression): Expression[] => {
621
608
  return [expression.body];
622
609
  case "Subexpression":
623
610
  return expression.selectors.flatMap((selector) => ("args" in selector ? selector.args : []));
611
+ case "Selection":
612
+ return [expression.expression];
624
613
  }
625
614
  };
626
615
 
616
+ export const getReferencedName = (expression: Expression) => {
617
+ if (expression.kind === "Identifier") return expression.name;
618
+ if (expression.kind === "Apply" || expression.kind === "OperatorReference")
619
+ return expression.operator;
620
+ return undefined;
621
+ };
622
+
627
623
  export const isLocallyResolved = (expression: Expression) =>
628
624
  (expression.kind === "Identifier" || expression.kind === "Apply") &&
629
625
  expression.resolution?.kind === "Local";