tla-ts 0.0.4-dev.81d0769 → 0.0.4-dev.8fefa42

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 (307) hide show
  1. package/README.md +62 -70
  2. package/dist/deciders.cjs +366 -0
  3. package/dist/deciders.js +366 -0
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.cts +35 -1
  6. package/dist/index.d.ts +35 -1
  7. package/dist/index.js +1 -1
  8. package/dist/parallel-worker.cjs +1 -4
  9. package/dist/parallel-worker.js +1 -4
  10. package/dist/prove-worker.cjs +9 -0
  11. package/dist/prove-worker.d.cts +9 -0
  12. package/dist/prove-worker.d.ts +9 -0
  13. package/dist/prove-worker.js +9 -0
  14. package/dist/prove.cjs +515 -0
  15. package/dist/prove.js +515 -0
  16. package/dist/run-cli.cjs +30 -47
  17. package/dist/run-cli.js +30 -47
  18. package/dist/tlapm.cjs +10 -0
  19. package/dist/tlapm.js +10 -0
  20. package/dist/transfer.cjs +38 -44
  21. package/dist/transfer.js +38 -44
  22. package/dist/worker.cjs +21 -0
  23. package/dist/worker.js +21 -0
  24. package/package.json +21 -12
  25. package/src/errors.ts +86 -0
  26. package/src/evaluate.ts +29 -8
  27. package/src/index.ts +10 -0
  28. package/src/{obligation-action.ts → obligations/action.ts} +258 -37
  29. package/src/{obligation-anon.ts → obligations/anon.ts} +13 -7
  30. package/src/obligations/ctx.ts +64 -0
  31. package/src/{obligation-deref.ts → obligations/deref.ts} +2 -2
  32. package/src/{obligation-expression.ts → obligations/expression.ts} +54 -8
  33. package/src/{obligation-generate.ts → obligations/generate.ts} +134 -61
  34. package/src/{obligations.ts → obligations/index.ts} +26 -12
  35. package/src/{obligation-levels.ts → obligations/levels.ts} +12 -2
  36. package/src/{obligation-module.ts → obligations/module.ts} +46 -20
  37. package/src/obligations/pickle.ts +100 -0
  38. package/src/obligations/pragma.ts +189 -0
  39. package/src/{obligation-printer.ts → obligations/printer.ts} +5 -59
  40. package/src/{obligation-proof.ts → obligations/proof.ts} +7 -1
  41. package/src/{obligation-source.ts → obligations/source.ts} +91 -35
  42. package/src/obligations/temporal.ts +319 -0
  43. package/src/{obligation-tuples.ts → obligations/tuples.ts} +1 -1
  44. package/src/parallel-worker.ts +2 -18
  45. package/src/parallel.ts +10 -43
  46. package/src/prove/decide-pool.ts +100 -0
  47. package/src/prove/deciders.ts +27 -0
  48. package/src/prove/isabelle/LICENSE +36 -0
  49. package/src/prove/isabelle/LICENSE-tlapm +26 -0
  50. package/src/prove/isabelle/decide.ts +47 -0
  51. package/src/prove/isabelle/encode.ts +477 -0
  52. package/src/prove/isabelle/isar/inner-syntax.ts +579 -0
  53. package/src/prove/isabelle/isar/method.ts +367 -0
  54. package/src/prove/isabelle/isar/proof.ts +28 -0
  55. package/src/prove/isabelle/isar/statement.ts +57 -0
  56. package/src/prove/isabelle/isar/theory.ts +192 -0
  57. package/src/prove/isabelle/isar/type-check.ts +278 -0
  58. package/src/prove/isabelle/provers/blast/blast.ts +258 -0
  59. package/src/prove/isabelle/provers/blast/branch.ts +322 -0
  60. package/src/prove/isabelle/provers/blast/prove.ts +347 -0
  61. package/src/prove/isabelle/provers/blast/rules.ts +330 -0
  62. package/src/prove/isabelle/provers/blast/state.ts +180 -0
  63. package/src/prove/isabelle/provers/blast/term.ts +547 -0
  64. package/src/prove/isabelle/provers/clasimp.ts +150 -0
  65. package/src/prove/isabelle/provers/classical.ts +389 -0
  66. package/src/prove/isabelle/provers/hypsubst.ts +441 -0
  67. package/src/prove/isabelle/pure/bicompose.ts +174 -0
  68. package/src/prove/isabelle/pure/consts.ts +32 -0
  69. package/src/prove/isabelle/pure/conv.ts +79 -0
  70. package/src/prove/isabelle/pure/drule.ts +264 -0
  71. package/src/prove/isabelle/pure/envir.ts +363 -0
  72. package/src/prove/isabelle/pure/goal.ts +53 -0
  73. package/src/prove/isabelle/pure/interrupt.ts +16 -0
  74. package/src/prove/isabelle/pure/list.ts +12 -0
  75. package/src/prove/isabelle/pure/logic.ts +402 -0
  76. package/src/prove/isabelle/pure/name.ts +110 -0
  77. package/src/prove/isabelle/pure/net.ts +262 -0
  78. package/src/prove/isabelle/pure/object-logic.ts +41 -0
  79. package/src/prove/isabelle/pure/pattern.ts +650 -0
  80. package/src/prove/isabelle/pure/raw-simplifier.ts +353 -0
  81. package/src/prove/isabelle/pure/rewriter.ts +602 -0
  82. package/src/prove/isabelle/pure/search.ts +68 -0
  83. package/src/prove/isabelle/pure/seq.ts +156 -0
  84. package/src/prove/isabelle/pure/simplifier.ts +112 -0
  85. package/src/prove/isabelle/pure/table.ts +208 -0
  86. package/src/prove/isabelle/pure/tactic.ts +276 -0
  87. package/src/prove/isabelle/pure/tactical.ts +347 -0
  88. package/src/prove/isabelle/pure/term-ord.ts +159 -0
  89. package/src/prove/isabelle/pure/term.ts +808 -0
  90. package/src/prove/isabelle/pure/thm.ts +806 -0
  91. package/src/prove/isabelle/pure/type.ts +133 -0
  92. package/src/prove/isabelle/pure/unify.ts +753 -0
  93. package/src/prove/isabelle/pure/variable.ts +25 -0
  94. package/src/prove/isabelle/tla/classical-setup.ts +101 -0
  95. package/src/prove/isabelle/tla/context.ts +74 -0
  96. package/src/prove/isabelle/tla/logic-data.ts +5 -0
  97. package/src/prove/isabelle/tla/logic.ts +215 -0
  98. package/src/prove/isabelle/tla/simpdata.ts +241 -0
  99. package/src/prove/isabelle/tools/intuitionistic.ts +132 -0
  100. package/src/prove/ocaml.ts +22 -0
  101. package/src/prove/prep/action.ts +520 -0
  102. package/src/prove/prep/defs.ts +27 -0
  103. package/src/prove/prep/elab.ts +156 -0
  104. package/src/prove/prep/enabled-axioms.ts +189 -0
  105. package/src/prove/prep/enabled.ts +43 -0
  106. package/src/prove/prep/fingerprint.ts +388 -0
  107. package/src/prove/prep/flatten.ts +70 -0
  108. package/src/prove/prep/level-comparison.ts +552 -0
  109. package/src/prove/prep/md5.ts +67 -0
  110. package/src/prove/prep/pragma.ts +221 -0
  111. package/src/prove/prep/trivial.ts +22 -0
  112. package/src/prove/prove-worker.ts +29 -0
  113. package/src/prove/prove.ts +417 -0
  114. package/src/prove/ptl/decide.ts +68 -0
  115. package/src/prove/ptl/encode.ts +256 -0
  116. package/src/prove/ptl/sat.ts +151 -0
  117. package/src/prove/ptl/tableau.ts +276 -0
  118. package/src/prove/smt/axiomatize.ts +69 -0
  119. package/src/prove/smt/axioms.ts +210 -0
  120. package/src/prove/smt/context.ts +108 -0
  121. package/src/prove/smt/data.ts +665 -0
  122. package/src/prove/smt/encode.ts +169 -0
  123. package/src/prove/smt/extensionality.ts +63 -0
  124. package/src/prove/smt/flatten.ts +127 -0
  125. package/src/prove/smt/format.ts +143 -0
  126. package/src/prove/smt/instances.ts +182 -0
  127. package/src/prove/smt/rewrite.ts +784 -0
  128. package/src/prove/smt/simplify.ts +57 -0
  129. package/src/prove/smt/solver/act-cache.ts +265 -0
  130. package/src/prove/smt/solver/arith-rewriter.ts +962 -0
  131. package/src/prove/smt/solver/array.ts +22 -0
  132. package/src/prove/smt/solver/asserted-formulas.ts +469 -0
  133. package/src/prove/smt/solver/ast-lt.ts +157 -0
  134. package/src/prove/smt/solver/ast-util.ts +147 -0
  135. package/src/prove/smt/solver/ast.ts +1315 -0
  136. package/src/prove/smt/solver/auf-solver.ts +572 -0
  137. package/src/prove/smt/solver/case-split-queue.ts +178 -0
  138. package/src/prove/smt/solver/cg-table.ts +175 -0
  139. package/src/prove/smt/solver/clause.ts +276 -0
  140. package/src/prove/smt/solver/conflict-resolution.ts +343 -0
  141. package/src/prove/smt/solver/context.ts +1292 -0
  142. package/src/prove/smt/solver/ctx-simplify.ts +334 -0
  143. package/src/prove/smt/solver/der.ts +224 -0
  144. package/src/prove/smt/solver/dyn-ack.ts +141 -0
  145. package/src/prove/smt/solver/e-matching.ts +659 -0
  146. package/src/prove/smt/solver/enode.ts +259 -0
  147. package/src/prove/smt/solver/expr-ref.ts +21 -0
  148. package/src/prove/smt/solver/expr-safe-replace.ts +172 -0
  149. package/src/prove/smt/solver/fingerprints.ts +92 -0
  150. package/src/prove/smt/solver/flat-literals.ts +51 -0
  151. package/src/prove/smt/solver/goal.ts +138 -0
  152. package/src/prove/smt/solver/hash.ts +173 -0
  153. package/src/prove/smt/solver/hashtable.ts +166 -0
  154. package/src/prove/smt/solver/internalizer.ts +1381 -0
  155. package/src/prove/smt/solver/lbool.ts +5 -0
  156. package/src/prove/smt/solver/literal.ts +24 -0
  157. package/src/prove/smt/solver/lp/bound-propagator.ts +391 -0
  158. package/src/prove/smt/solver/lp/constraints.ts +78 -0
  159. package/src/prove/smt/solver/lp/containers.ts +296 -0
  160. package/src/prove/smt/solver/lp/core-solver.ts +504 -0
  161. package/src/prove/smt/solver/lp/cross-nested.ts +224 -0
  162. package/src/prove/smt/solver/lp/dep-intervals.ts +656 -0
  163. package/src/prove/smt/solver/lp/dependency.ts +51 -0
  164. package/src/prove/smt/solver/lp/dioph-eq.ts +1181 -0
  165. package/src/prove/smt/solver/lp/explanation.ts +46 -0
  166. package/src/prove/smt/solver/lp/gomory.ts +255 -0
  167. package/src/prove/smt/solver/lp/hnf-cutter.ts +125 -0
  168. package/src/prove/smt/solver/lp/hnf.ts +281 -0
  169. package/src/prove/smt/solver/lp/int-cube.ts +295 -0
  170. package/src/prove/smt/solver/lp/int-solver.ts +514 -0
  171. package/src/prove/smt/solver/lp/lar-solver.ts +816 -0
  172. package/src/prove/smt/solver/lp/lar-term.ts +62 -0
  173. package/src/prove/smt/solver/lp/lp-settings.ts +91 -0
  174. package/src/prove/smt/solver/lp/maximize-term.ts +347 -0
  175. package/src/prove/smt/solver/lp/nex-creator.ts +381 -0
  176. package/src/prove/smt/solver/lp/nex.ts +120 -0
  177. package/src/prove/smt/solver/lp/nla-backoff.ts +43 -0
  178. package/src/prove/smt/solver/lp/nla-basics.ts +398 -0
  179. package/src/prove/smt/solver/lp/nla-core.ts +968 -0
  180. package/src/prove/smt/solver/lp/nla-divisions.ts +332 -0
  181. package/src/prove/smt/solver/lp/nla-emonics.ts +373 -0
  182. package/src/prove/smt/solver/lp/nla-factorization.ts +30 -0
  183. package/src/prove/smt/solver/lp/nla-grobner.ts +904 -0
  184. package/src/prove/smt/solver/lp/nla-horner.ts +126 -0
  185. package/src/prove/smt/solver/lp/nla-intervals.ts +265 -0
  186. package/src/prove/smt/solver/lp/nla-monomial-bounds.ts +715 -0
  187. package/src/prove/smt/solver/lp/nla-monotone.ts +59 -0
  188. package/src/prove/smt/solver/lp/nla-order.ts +307 -0
  189. package/src/prove/smt/solver/lp/nla-patcher.ts +112 -0
  190. package/src/prove/smt/solver/lp/nla-tangents.ts +251 -0
  191. package/src/prove/smt/solver/lp/nla-throttle.ts +85 -0
  192. package/src/prove/smt/solver/lp/nla-types.ts +124 -0
  193. package/src/prove/smt/solver/lp/nla-var-eqs.ts +141 -0
  194. package/src/prove/smt/solver/lp/nra-solver.ts +440 -0
  195. package/src/prove/smt/solver/lp/numeric-pair.ts +65 -0
  196. package/src/prove/smt/solver/lp/pdd-interval.ts +31 -0
  197. package/src/prove/smt/solver/lp/pdd-simplifier.ts +184 -0
  198. package/src/prove/smt/solver/lp/pdd-solver.ts +408 -0
  199. package/src/prove/smt/solver/lp/pdd.ts +971 -0
  200. package/src/prove/smt/solver/lp/random-updater.ts +138 -0
  201. package/src/prove/smt/solver/lp/static-matrix.ts +246 -0
  202. package/src/prove/smt/solver/lp/union-find.ts +96 -0
  203. package/src/prove/smt/solver/mam-compiler.ts +847 -0
  204. package/src/prove/smt/solver/mam-interpreter.ts +400 -0
  205. package/src/prove/smt/solver/maximize-ac-sharing.ts +118 -0
  206. package/src/prove/smt/solver/model-checker.ts +347 -0
  207. package/src/prove/smt/solver/model-evaluator.ts +262 -0
  208. package/src/prove/smt/solver/model-finder.ts +155 -0
  209. package/src/prove/smt/solver/model-generator.ts +97 -0
  210. package/src/prove/smt/solver/model-macro-solver.ts +728 -0
  211. package/src/prove/smt/solver/nlsat/algebraic.ts +1161 -0
  212. package/src/prove/smt/solver/nlsat/atoms.ts +238 -0
  213. package/src/prove/smt/solver/nlsat/evaluator.ts +303 -0
  214. package/src/prove/smt/solver/nlsat/explain.ts +607 -0
  215. package/src/prove/smt/solver/nlsat/interval-set.ts +351 -0
  216. package/src/prove/smt/solver/nlsat/levelwise.ts +740 -0
  217. package/src/prove/smt/solver/nlsat/mpbq.ts +161 -0
  218. package/src/prove/smt/solver/nlsat/polynomial.ts +1722 -0
  219. package/src/prove/smt/solver/nlsat/solver.ts +911 -0
  220. package/src/prove/smt/solver/nlsat/types.ts +43 -0
  221. package/src/prove/smt/solver/nlsat/upolynomial-factorization.ts +648 -0
  222. package/src/prove/smt/solver/nlsat/upolynomial.ts +996 -0
  223. package/src/prove/smt/solver/nnf.ts +469 -0
  224. package/src/prove/smt/solver/pattern-inference.ts +351 -0
  225. package/src/prove/smt/solver/poly-rewriter.ts +477 -0
  226. package/src/prove/smt/solver/propagate-values.ts +83 -0
  227. package/src/prove/smt/solver/proto-model.ts +551 -0
  228. package/src/prove/smt/solver/pull-quant.ts +139 -0
  229. package/src/prove/smt/solver/qe-lite-der.ts +526 -0
  230. package/src/prove/smt/solver/qe-lite-fm.ts +576 -0
  231. package/src/prove/smt/solver/qe-lite.ts +381 -0
  232. package/src/prove/smt/solver/qi-queue.ts +362 -0
  233. package/src/prove/smt/solver/quant-tactics.ts +117 -0
  234. package/src/prove/smt/solver/quantifier-analyzer.ts +562 -0
  235. package/src/prove/smt/solver/quantifier-manager.ts +186 -0
  236. package/src/prove/smt/solver/random-gen.ts +10 -0
  237. package/src/prove/smt/solver/rational.ts +165 -0
  238. package/src/prove/smt/solver/ref-vector.ts +62 -0
  239. package/src/prove/smt/solver/relevancy.ts +247 -0
  240. package/src/prove/smt/solver/rewriter-tpl.ts +1159 -0
  241. package/src/prove/smt/solver/rewriter.ts +843 -0
  242. package/src/prove/smt/solver/rlimit.ts +79 -0
  243. package/src/prove/smt/solver/smtlib-parser.ts +526 -0
  244. package/src/prove/smt/solver/solver.ts +71 -0
  245. package/src/prove/smt/solver/sort.ts +35 -0
  246. package/src/prove/smt/solver/sticky-generations.ts +69 -0
  247. package/src/prove/smt/solver/theory-lra-axioms.ts +340 -0
  248. package/src/prove/smt/solver/theory-lra-bounds.ts +226 -0
  249. package/src/prove/smt/solver/theory-lra-final-check.ts +252 -0
  250. package/src/prove/smt/solver/theory-lra-internalize.ts +476 -0
  251. package/src/prove/smt/solver/theory-lra-model.ts +243 -0
  252. package/src/prove/smt/solver/theory-lra-propagate.ts +405 -0
  253. package/src/prove/smt/solver/theory-lra-state.ts +43 -0
  254. package/src/prove/smt/solver/theory-lra.ts +56 -0
  255. package/src/prove/smt/solver/var-subst.ts +258 -0
  256. package/src/prove/smt/solver/z3-license.txt +10 -0
  257. package/src/prove/smt/table.ts +170 -0
  258. package/src/prove/tlapm/tlapm.ts +96 -0
  259. package/src/prove/tlaps-module.ts +510 -0
  260. package/src/prove/verdict.ts +13 -0
  261. package/src/prove/zenon/LICENSE +32 -0
  262. package/src/prove/zenon/check/check.ts +105 -0
  263. package/src/prove/zenon/check/definitions.ts +144 -0
  264. package/src/prove/zenon/check/equality.ts +182 -0
  265. package/src/prove/zenon/check/functions.ts +62 -0
  266. package/src/prove/zenon/check/keys.ts +125 -0
  267. package/src/prove/zenon/check/propositional.ts +104 -0
  268. package/src/prove/zenon/check/records.ts +188 -0
  269. package/src/prove/zenon/check/relations.ts +121 -0
  270. package/src/prove/zenon/check/rewrites.ts +224 -0
  271. package/src/prove/zenon/check/sets.ts +302 -0
  272. package/src/prove/zenon/check/terms.ts +127 -0
  273. package/src/prove/zenon/check/tla.ts +126 -0
  274. package/src/prove/zenon/decide.ts +113 -0
  275. package/src/prove/zenon/encode.ts +444 -0
  276. package/src/prove/zenon/eqrel.ts +300 -0
  277. package/src/prove/zenon/equality-rules.ts +435 -0
  278. package/src/prove/zenon/expr.ts +551 -0
  279. package/src/prove/zenon/index-table.ts +350 -0
  280. package/src/prove/zenon/isar-case.ts +513 -0
  281. package/src/prove/zenon/isar.ts +1249 -0
  282. package/src/prove/zenon/limits.ts +15 -0
  283. package/src/prove/zenon/llproof.ts +173 -0
  284. package/src/prove/zenon/mltoll.ts +1566 -0
  285. package/src/prove/zenon/node.ts +297 -0
  286. package/src/prove/zenon/ocaml.ts +169 -0
  287. package/src/prove/zenon/parse.ts +247 -0
  288. package/src/prove/zenon/phrase.ts +191 -0
  289. package/src/prove/zenon/proof.ts +198 -0
  290. package/src/prove/zenon/propositional-rules.ts +387 -0
  291. package/src/prove/zenon/rules.ts +94 -0
  292. package/src/prove/zenon/search.ts +288 -0
  293. package/src/prove/zenon/tla/functions.ts +151 -0
  294. package/src/prove/zenon/tla/llproof.ts +480 -0
  295. package/src/prove/zenon/tla/records.ts +225 -0
  296. package/src/prove/zenon/tla/rewrites.ts +447 -0
  297. package/src/prove/zenon/tla/sets.ts +304 -0
  298. package/src/prove/zenon/tla/terms.ts +181 -0
  299. package/src/prove/zenon/tla/tla.ts +506 -0
  300. package/src/run-cli.ts +73 -20
  301. package/src/successors.ts +24 -5
  302. package/src/tlc-version.ts +8 -7
  303. package/src/values.ts +8 -3
  304. package/src/worker.ts +65 -0
  305. package/dist/parallel.cjs +0 -12
  306. package/dist/parallel.js +0 -12
  307. /package/src/{obligation-format.ts → obligations/format.ts} +0 -0
package/README.md CHANGED
@@ -32,70 +32,55 @@ npm install tla-ts
32
32
 
33
33
  ## Command line
34
34
 
35
- The `tla-ts` command takes TLC's options and prints TLC's output. `tla-ts prove` takes tlapm's options and prints tlapm's output.
36
-
37
35
  ### Check a spec
38
36
 
39
- To check a spec, pass its path:
40
-
41
37
  ```shell
42
38
  npx tla-ts Spec.tla
43
39
  ```
44
40
 
45
- tla-ts reads the configuration from `Spec.cfg` next to the spec. It exits with the exit code TLC uses for the same result.
46
-
47
- You can pass several paths, or a glob such as `"specs/*.tla"`. tla-ts checks each spec in turn and exits with the exit code of the first spec that fails. A glob skips each module that has no `.cfg` next to it, so it doesn't check helper modules that other specs import. tla-ts never skips a path that you pass by name. If you pass a `.cfg` path, tla-ts checks the `.tla` file with the same name.
41
+ tla-ts reads `Spec.cfg`, takes TLC's options and exits with TLC's exit codes. You can pass several specs or a glob.
48
42
 
49
- The options are:
50
-
51
- - `-config <Spec.cfg>`: read the configuration from this file. You can use it only when you check one spec.
43
+ - `-config <Spec.cfg>`: read the configuration from this file.
52
44
  - `-deadlock`: don't report deadlocks.
53
- - `-dump [dot[,colorize][,actionlabels][,snapshot]] <file>`: write every reachable state to `<file>.dump`, or with `dot`, the state graph to `<file>.dot`. The output matches TLC run with `-fp 0`. tla-ts doesn't support the `constrained`, `stuttering`, or `strict` formats.
45
+ - `-dump [dot[,colorize][,actionlabels][,snapshot]] <file>`: write every reachable state, or the state graph with `dot`.
54
46
  - `-lncheck final`: check liveness once, after the search ends.
55
47
  - `-seed <num>`: seed `RandomElement` and the `Randomization` module. The default is 0.
56
- - `-workers <count|auto>`: search with this number of worker threads. `auto` uses one thread per core. The default is 1.
57
-
58
- TLC can replace a module's operators with Java methods, and tla-ts reads the same files. If the spec's directory has `Module.class`, tla-ts replaces each operator in `Module` with the public static method that has the same name and arity.
48
+ - `-workers <count|auto>`: the number of worker threads. The default is 1.
59
49
 
60
50
  ### Generate proof obligations
61
51
 
62
- A proof obligation is one claim that a backend prover must prove. `tla-ts prove -N` prints the obligations of a module, as `tlapm -N` does. It doesn't run a prover. For example, this command prints every obligation in `Module.tla` with its text:
63
-
64
52
  ```shell
65
53
  npx tla-ts prove -N --toolbox 0 0 --printallobs Module.tla
66
54
  ```
67
55
 
68
- With `--toolbox` or `--line`, tla-ts writes the messages of the TLA+ Toolbox protocol to stderr, as tlapm does. If you pass a tlapm option that isn't in this list, tla-ts prints an error:
56
+ `tla-ts prove -N` prints a module's proof obligations, as `tlapm -N` does.
69
57
 
70
- - `--toolbox <start> <end>`: print Toolbox messages for the proofs from line `start` to line `end`. `0 0` selects the whole module.
58
+ - `--toolbox <start> <end>`: print Toolbox messages for the proofs in these lines. `0 0` selects the whole module.
71
59
  - `--line <num>`: print Toolbox messages for the proof at this line.
72
60
  - `--printallobs`: print the text of each obligation.
73
- - `--summary`: print the number of obligations in each module, and list its missing and omitted proofs. You don't need `-N` with `--summary`.
74
- - `--strict`: report missing proofs, omitted proofs and a selected range with no obligations as errors.
61
+ - `--summary`: print the number of obligations, and list missing and omitted proofs.
62
+ - `--strict`: report missing and omitted proofs as errors.
75
63
  - `-I <directory>`: search this directory for modules.
76
64
 
77
- tla-ts searches for modules in the same order as tlapm:
78
-
79
- 1. The directory of each module you pass, the last one first.
80
- 2. The current directory.
81
- 3. The standard library of tlapm, which has the `TLAPS` module. tla-ts searches it only if `tlapm` is on your `PATH`.
82
- 4. The `-I` directories, the last one first.
83
-
84
- ### Prove with tlapm
85
-
86
- tla-ts doesn't include a prover. Without `-N` or `--summary`, `tla-ts prove` runs [tlapm](https://github.com/tlaplus/tlapm) from your `PATH`:
65
+ ### Prove
87
66
 
88
67
  ```shell
89
- npx tla-ts prove Module.tla
68
+ npx tla-ts prove --backend tla-ts Module.tla
90
69
  ```
91
70
 
92
- tla-ts expands the globs and passes every argument to tlapm, so all of tlapm's options work. tlapm sends the obligations to its provers, and tla-ts exits with the exit code of tlapm. If `tlapm` isn't on your `PATH`, tla-ts prints an error and exits with code 1.
71
+ `tla-ts prove --backend` proves each module with [`prove`](#prove) and prints each obligation's status.
72
+
73
+ - `--backend <tla-ts|tlapm>`: prove with tla-ts's own provers, or with tlapm from your `PATH`.
74
+ - `-I <directory>`: search this directory for modules.
75
+ - `-workers <count|auto>`: the number of worker threads. The default is 1.
76
+
77
+ Without `-N`, `--summary` or `--backend`, `tla-ts prove` runs [tlapm](https://github.com/tlaplus/tlapm) with your arguments.
93
78
 
94
79
  ## API reference
95
80
 
96
81
  ### `check`
97
82
 
98
- Checks a spec against a TLC configuration and resolves to the result.
83
+ Checks a spec against a TLC configuration.
99
84
 
100
85
  ```ts
101
86
  import { check } from "tla-ts";
@@ -104,51 +89,60 @@ const result = await check({
104
89
  source: specSource,
105
90
  config: configSource,
106
91
  loadModule: (name) => modules[name],
107
- onPrint: (text) => console.log(text),
108
92
  });
109
93
  ```
110
94
 
111
- | Option | Description |
112
- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
113
- | `source` | The TLA+ module to check |
114
- | `config` | A TLC configuration, as text or as the result of `parseConfig` |
115
- | `loadModule` | Returns the source of a module that isn't a standard module, or of Bags, Json, Randomization, or TLCExt to read in place of tla-ts's own |
116
- | `loadClass` | Returns a compiled Java class that overrides a module's operators with constants |
117
- | `onPrint` | Receives the output of `Print` and `PrintT`. Defaults to `console.log` |
118
- | `onPause` | Runs when `TLCSet("pause", TRUE)` pauses checking, which resumes when it returns |
119
- | `readFile`, `writeFile` | Read and write files for the Json module and `dump` |
120
- | `seed` | A `bigint` seed. Defaults to `0n`, and matches TLC run with the same `-seed` and `-fp 0` |
121
- | `workers` | The number of worker threads. Defaults to 1 |
122
- | `dump` | Writes the reachable states or the state graph, as TLC's `-dump` does |
123
-
124
- `dump` takes the `path` that `check` passes to `writeFile` before it returns. Set `dot` to write the state graph in the DOT language of Graphviz, and `colorize`, `actionLabels`, or `snapshot` for TLC's formats of the same names. A dump checks the spec on the calling thread, as one TLC worker does.
95
+ | Option | Description |
96
+ | ----------------------- | ----------------------------------------------------------------- |
97
+ | `source` | The TLA+ module to check |
98
+ | `config` | A TLC configuration, as text or as the result of `parseConfig` |
99
+ | `loadModule` | Returns the source of a module that isn't a standard module |
100
+ | `loadClass` | Returns a compiled Java class that overrides a module's operators |
101
+ | `onPrint` | Receives the output of `Print` and `PrintT` |
102
+ | `onPause` | Runs when `TLCSet("pause", TRUE)` pauses checking |
103
+ | `readFile`, `writeFile` | Read and write files for the Json module and `dump` |
104
+ | `seed` | A `bigint` seed. Defaults to `0n` |
105
+ | `workers` | The number of worker threads. Defaults to 1 |
106
+ | `dump` | Writes the reachable states or the state graph |
125
107
 
126
108
  The result has these fields:
127
109
 
128
110
  - `status`: `"success"`, `"deadlock"`, `"assumption-violation"`, `"invariant-violation"`, `"property-violation"`, `"liveness-violation"`, `"postcondition-violation"`, or `"error"`.
129
- - `violation`: the `name` of what failed and the `trace` that reaches it. `loopStart` marks where a liveness counterexample loops back.
111
+ - `violation`: the `name` of what failed and the `trace` that reaches it.
130
112
  - `failure`: the message and trace when `status` is `"error"`.
131
113
  - `generatedStates`, `distinctStates`, and `depth`: TLC's state counts.
132
114
 
133
- Workers run in Node, Bun, Deno, and cross-origin isolated pages in the browser. Like TLC's workers, they share one table of 64-bit fingerprints. `check` runs on the calling thread in these cases:
115
+ ### `prove`
116
+
117
+ Proves the obligations of a TLAPS proof.
118
+
119
+ ```ts
120
+ import { prove } from "tla-ts";
134
121
 
135
- - `SharedArrayBuffer` is unavailable, as on a page without cross-origin isolation.
136
- - The spec has liveness properties.
137
- - The spec uses impure operators such as `Print`.
138
- - The configuration has `VIEW`, `POSTCONDITION`, or `_POSSIBLE`.
122
+ const result = await prove({
123
+ source: moduleSource,
124
+ loadModule: (name) => modules[name],
125
+ onObligation: (obligation) => console.log(obligation.location, obligation.status),
126
+ });
127
+ ```
139
128
 
140
- After a violation or an error, `check` reruns on the calling thread to return TLC's exact trace.
129
+ | Option | Description |
130
+ | -------------- | ------------------------------------------------------------------------- |
131
+ | `source` | The TLA+ module to prove |
132
+ | `loadModule` | Returns the source of a module it extends or instantiates |
133
+ | `backend` | `"tla-ts"` for tla-ts's own provers, or `"tlapm"`. Defaults to `"tla-ts"` |
134
+ | `signal` | An `AbortSignal` that stops proving |
135
+ | `onObligation` | Receives each obligation as soon as its status is known |
136
+ | `workers` | The number of worker threads. Defaults to 1 |
141
137
 
142
- `check` supports:
138
+ The result has these fields:
143
139
 
144
- - **Modules**: the standard modules, TLCExt, Json, and Randomization, plus `EXTENDS`, `INSTANCE`, and `LAMBDA`.
145
- - **Configuration**: `CONSTANTS`, `INIT`, `NEXT`, `SPECIFICATION`, invariants, properties, constraints, `SYMMETRY`, `VIEW`, `ALIAS`, `POSTCONDITION`, `CHECK_DEADLOCK`, and `_POSSIBLE`.
146
- - **Properties**: invariants and every temporal formula TLC accepts, checked through TLC's tableau construction.
147
- - **TLC semantics**: 32-bit integer overflow, `TLCGet` and `TLCSet`, subexpression references such as `Op!2`, and TLC's enumeration order for `CHOOSE` and quantifiers.
140
+ - `obligations`: each obligation's `id`, `location`, `text`, and `status`: `"proved"`, `"trivial"`, `"failed"`, or `"unsupported"`.
141
+ - `missingProofCount` and `omittedProofCount`: the numbers of missing and omitted proofs.
148
142
 
149
143
  ### `parseModule`
150
144
 
151
- Parses a TLA+ module into its syntax tree. Throws `TlaSyntaxError` on invalid input.
145
+ Parses a TLA+ module into its syntax tree.
152
146
 
153
147
  ```ts
154
148
  import { parseModule } from "tla-ts";
@@ -159,7 +153,7 @@ module.name; // "Counter"
159
153
 
160
154
  ### `parseConfig`
161
155
 
162
- Parses a TLC configuration file into a `ModelConfig`. Pass the result to `check` to change it before checking.
156
+ Parses a TLC configuration file.
163
157
 
164
158
  ```ts
165
159
  import { check, parseConfig } from "tla-ts";
@@ -171,24 +165,22 @@ await check({ source: specSource, config });
171
165
 
172
166
  ### `formatValue`
173
167
 
174
- Prints a value in TLA+ syntax, as TLC prints it in traces.
168
+ Prints a value in TLA+ syntax.
175
169
 
176
170
  ```ts
177
171
  import { formatValue } from "tla-ts";
178
172
 
179
- result.violation?.trace.forEach((step) => {
180
- Object.entries(step.state).forEach(([name, value]) => console.log(name, formatValue(value)));
181
- });
173
+ formatValue(value); // "<<1, 2>>"
182
174
  ```
183
175
 
184
176
  ### Errors
185
177
 
186
178
  Every error extends `TlaError`:
187
179
 
188
- - `TlaSyntaxError`: the module does not parse
189
- - `TlaConfigError`: the configuration is invalid or refers to an unknown name
190
- - `TlaEvaluationError`: evaluation failed, as when TLC reports an error
191
- - `TlaUnsupportedError`: the spec uses a feature tla-ts does not support yet
180
+ - `TlaSyntaxError`: the module doesn't parse.
181
+ - `TlaConfigError`: the configuration is invalid.
182
+ - `TlaEvaluationError`: evaluation failed.
183
+ - `TlaUnsupportedError`: the spec uses a feature tla-ts doesn't support yet.
192
184
 
193
185
  ## Benchmarks
194
186