tla-ts 0.0.4-dev.4c0ab96 → 0.0.4-dev.55f2117

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 (359) hide show
  1. package/README.md +37 -126
  2. package/dist/cli.cjs +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/deciders.cjs +366 -0
  5. package/dist/deciders.js +366 -0
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.cts +33 -1
  8. package/dist/index.d.ts +33 -1
  9. package/dist/index.js +1 -1
  10. package/dist/parallel-worker.cjs +1 -4
  11. package/dist/parallel-worker.js +1 -4
  12. package/dist/prove-worker.cjs +9 -0
  13. package/dist/prove-worker.d.cts +9 -0
  14. package/dist/prove-worker.d.ts +9 -0
  15. package/dist/prove-worker.js +9 -0
  16. package/dist/prove.cjs +996 -0
  17. package/dist/prove.js +996 -0
  18. package/dist/run.cjs +45 -0
  19. package/dist/run.js +45 -0
  20. package/dist/tlapm.cjs +10 -0
  21. package/dist/tlapm.js +10 -0
  22. package/dist/transfer.cjs +38 -44
  23. package/dist/transfer.js +38 -44
  24. package/dist/worker.cjs +21 -0
  25. package/dist/worker.js +21 -0
  26. package/package.json +21 -12
  27. package/src/ast.ts +2 -2
  28. package/src/check.ts +7 -7
  29. package/src/{cli-options.ts → cli/options.ts} +1 -1
  30. package/src/{run-cli.ts → cli/run.ts} +293 -91
  31. package/src/cli.ts +1 -1
  32. package/src/config.ts +2 -2
  33. package/src/environment.ts +9 -9
  34. package/src/errors.ts +89 -30
  35. package/src/evaluate.ts +32 -11
  36. package/src/index.ts +10 -0
  37. package/src/levels.ts +1 -1
  38. package/src/live-check.ts +1 -1
  39. package/src/liveness.ts +1 -1
  40. package/src/{obligation-action.ts → obligations/action.ts} +247 -69
  41. package/src/{obligation-anon.ts → obligations/anon.ts} +49 -47
  42. package/src/obligations/ctx.ts +64 -0
  43. package/src/{obligation-deref.ts → obligations/deref.ts} +51 -92
  44. package/src/{obligation-expression.ts → obligations/expression.ts} +117 -57
  45. package/src/{obligation-format.ts → obligations/format.ts} +7 -8
  46. package/src/{obligation-generate.ts → obligations/generate.ts} +170 -192
  47. package/src/{obligations.ts → obligations/index.ts} +32 -16
  48. package/src/{obligation-levels.ts → obligations/levels.ts} +26 -28
  49. package/src/{obligation-module.ts → obligations/module.ts} +113 -121
  50. package/src/obligations/pickle.ts +98 -0
  51. package/src/obligations/pragma.ts +189 -0
  52. package/src/{obligation-printer.ts → obligations/printer.ts} +22 -80
  53. package/src/{obligation-proof.ts → obligations/proof.ts} +7 -2
  54. package/src/{obligation-source.ts → obligations/source.ts} +154 -99
  55. package/src/obligations/temporal.ts +321 -0
  56. package/src/{obligation-tuples.ts → obligations/tuples.ts} +38 -54
  57. package/src/parallel-worker.ts +4 -20
  58. package/src/parallel.ts +13 -46
  59. package/src/parser.ts +1 -1
  60. package/src/{pcal-ast.ts → pcal/ast.ts} +2 -2
  61. package/src/{pcal-parse.ts → pcal/parse.ts} +3 -3
  62. package/src/{pcal-tokenize.ts → pcal/tokenize.ts} +2 -2
  63. package/src/{pcal-translate.ts → pcal/translate.ts} +2 -2
  64. package/src/{pcal-validate.ts → pcal/validate.ts} +6 -6
  65. package/src/prove/decide-pool.ts +95 -0
  66. package/src/prove/deciders.ts +33 -0
  67. package/src/prove/first-order.ts +78 -0
  68. package/src/prove/isabelle/LICENSE +36 -0
  69. package/src/prove/isabelle/LICENSE-tlapm +26 -0
  70. package/src/prove/isabelle/decide.ts +47 -0
  71. package/src/prove/isabelle/encode.ts +446 -0
  72. package/src/prove/isabelle/isar/inner-syntax.ts +579 -0
  73. package/src/prove/isabelle/isar/method.ts +367 -0
  74. package/src/prove/isabelle/isar/proof.ts +28 -0
  75. package/src/prove/isabelle/isar/statement.ts +57 -0
  76. package/src/prove/isabelle/isar/theory.ts +192 -0
  77. package/src/prove/isabelle/isar/type-check.ts +278 -0
  78. package/src/prove/isabelle/provers/blast/blast.ts +258 -0
  79. package/src/prove/isabelle/provers/blast/branch.ts +322 -0
  80. package/src/prove/isabelle/provers/blast/prove.ts +347 -0
  81. package/src/prove/isabelle/provers/blast/rules.ts +330 -0
  82. package/src/prove/isabelle/provers/blast/state.ts +180 -0
  83. package/src/prove/isabelle/provers/blast/term.ts +546 -0
  84. package/src/prove/isabelle/provers/clasimp.ts +150 -0
  85. package/src/prove/isabelle/provers/classical.ts +389 -0
  86. package/src/prove/isabelle/provers/hypsubst.ts +433 -0
  87. package/src/prove/isabelle/pure/bicompose.ts +174 -0
  88. package/src/prove/isabelle/pure/consts.ts +32 -0
  89. package/src/prove/isabelle/pure/conv.ts +79 -0
  90. package/src/prove/isabelle/pure/drule.ts +264 -0
  91. package/src/prove/isabelle/pure/envir.ts +331 -0
  92. package/src/prove/isabelle/pure/goal.ts +53 -0
  93. package/src/prove/isabelle/pure/interrupt.ts +16 -0
  94. package/src/prove/isabelle/pure/list.ts +12 -0
  95. package/src/prove/isabelle/pure/logic.ts +330 -0
  96. package/src/prove/isabelle/pure/name.ts +98 -0
  97. package/src/prove/isabelle/pure/net.ts +215 -0
  98. package/src/prove/isabelle/pure/object-logic.ts +41 -0
  99. package/src/prove/isabelle/pure/pattern.ts +631 -0
  100. package/src/prove/isabelle/pure/raw-simplifier.ts +338 -0
  101. package/src/prove/isabelle/pure/rewriter.ts +602 -0
  102. package/src/prove/isabelle/pure/search.ts +68 -0
  103. package/src/prove/isabelle/pure/seq.ts +133 -0
  104. package/src/prove/isabelle/pure/simplifier.ts +106 -0
  105. package/src/prove/isabelle/pure/table.ts +201 -0
  106. package/src/prove/isabelle/pure/tactic.ts +168 -0
  107. package/src/prove/isabelle/pure/tactical.ts +264 -0
  108. package/src/prove/isabelle/pure/term-ord.ts +105 -0
  109. package/src/prove/isabelle/pure/term.ts +688 -0
  110. package/src/prove/isabelle/pure/thm.ts +783 -0
  111. package/src/prove/isabelle/pure/type.ts +121 -0
  112. package/src/prove/isabelle/pure/unify.ts +753 -0
  113. package/src/prove/isabelle/pure/variable.ts +25 -0
  114. package/src/prove/isabelle/tla/classical-setup.ts +101 -0
  115. package/src/prove/isabelle/tla/context.ts +74 -0
  116. package/src/prove/isabelle/tla/logic-data.ts +5 -0
  117. package/src/prove/isabelle/tla/logic.ts +215 -0
  118. package/src/prove/isabelle/tla/simpdata.ts +241 -0
  119. package/src/prove/isabelle/tools/intuitionistic.ts +132 -0
  120. package/src/prove/ocaml.ts +22 -0
  121. package/src/prove/prep/action.ts +508 -0
  122. package/src/prove/prep/defs.ts +33 -0
  123. package/src/prove/prep/elab.ts +156 -0
  124. package/src/prove/prep/enabled-axioms.ts +189 -0
  125. package/src/prove/prep/enabled.ts +43 -0
  126. package/src/prove/prep/fingerprint.ts +388 -0
  127. package/src/prove/prep/flatten.ts +70 -0
  128. package/src/prove/prep/level-comparison.ts +529 -0
  129. package/src/prove/prep/md5.ts +67 -0
  130. package/src/prove/prep/pragma.ts +221 -0
  131. package/src/prove/prep/trivial.ts +22 -0
  132. package/src/prove/prove-worker.ts +22 -0
  133. package/src/prove/prove.ts +498 -0
  134. package/src/prove/ptl/decide.ts +68 -0
  135. package/src/prove/ptl/encode.ts +255 -0
  136. package/src/prove/ptl/sat.ts +151 -0
  137. package/src/prove/ptl/tableau.ts +276 -0
  138. package/src/prove/smt/axiomatize.ts +69 -0
  139. package/src/prove/smt/axioms.ts +209 -0
  140. package/src/prove/smt/context.ts +108 -0
  141. package/src/prove/smt/data.ts +636 -0
  142. package/src/prove/smt/encode.ts +164 -0
  143. package/src/prove/smt/extensionality.ts +65 -0
  144. package/src/prove/smt/flatten.ts +112 -0
  145. package/src/prove/smt/format.ts +154 -0
  146. package/src/prove/smt/instances.ts +181 -0
  147. package/src/prove/smt/rewrite.ts +772 -0
  148. package/src/prove/smt/simplify.ts +57 -0
  149. package/src/prove/smt/solver/act-cache.ts +265 -0
  150. package/src/prove/smt/solver/arith-rewriter.ts +962 -0
  151. package/src/prove/smt/solver/array.ts +22 -0
  152. package/src/prove/smt/solver/asserted-formulas.ts +469 -0
  153. package/src/prove/smt/solver/ast-lt.ts +157 -0
  154. package/src/prove/smt/solver/ast-util.ts +91 -0
  155. package/src/prove/smt/solver/ast.ts +1315 -0
  156. package/src/prove/smt/solver/auf-solver.ts +572 -0
  157. package/src/prove/smt/solver/case-split-queue.ts +178 -0
  158. package/src/prove/smt/solver/cg-table.ts +175 -0
  159. package/src/prove/smt/solver/clause.ts +276 -0
  160. package/src/prove/smt/solver/conflict-resolution.ts +343 -0
  161. package/src/prove/smt/solver/context.ts +1292 -0
  162. package/src/prove/smt/solver/ctx-simplify.ts +334 -0
  163. package/src/prove/smt/solver/der.ts +224 -0
  164. package/src/prove/smt/solver/dyn-ack.ts +141 -0
  165. package/src/prove/smt/solver/e-matching.ts +659 -0
  166. package/src/prove/smt/solver/enode.ts +259 -0
  167. package/src/prove/smt/solver/expr-ref.ts +21 -0
  168. package/src/prove/smt/solver/expr-safe-replace.ts +172 -0
  169. package/src/prove/smt/solver/fingerprints.ts +92 -0
  170. package/src/prove/smt/solver/flat-literals.ts +51 -0
  171. package/src/prove/smt/solver/goal.ts +138 -0
  172. package/src/prove/smt/solver/hash.ts +173 -0
  173. package/src/prove/smt/solver/hashtable.ts +166 -0
  174. package/src/prove/smt/solver/internalizer.ts +1381 -0
  175. package/src/prove/smt/solver/lbool.ts +5 -0
  176. package/src/prove/smt/solver/literal.ts +24 -0
  177. package/src/prove/smt/solver/lp/bound-propagator.ts +391 -0
  178. package/src/prove/smt/solver/lp/constraints.ts +78 -0
  179. package/src/prove/smt/solver/lp/containers.ts +296 -0
  180. package/src/prove/smt/solver/lp/core-solver.ts +504 -0
  181. package/src/prove/smt/solver/lp/cross-nested.ts +224 -0
  182. package/src/prove/smt/solver/lp/dep-intervals.ts +642 -0
  183. package/src/prove/smt/solver/lp/dependency.ts +51 -0
  184. package/src/prove/smt/solver/lp/dioph-eq.ts +1181 -0
  185. package/src/prove/smt/solver/lp/explanation.ts +46 -0
  186. package/src/prove/smt/solver/lp/gomory.ts +255 -0
  187. package/src/prove/smt/solver/lp/hnf-cutter.ts +125 -0
  188. package/src/prove/smt/solver/lp/hnf.ts +281 -0
  189. package/src/prove/smt/solver/lp/int-cube.ts +295 -0
  190. package/src/prove/smt/solver/lp/int-solver.ts +514 -0
  191. package/src/prove/smt/solver/lp/lar-solver.ts +816 -0
  192. package/src/prove/smt/solver/lp/lar-term.ts +62 -0
  193. package/src/prove/smt/solver/lp/lp-settings.ts +91 -0
  194. package/src/prove/smt/solver/lp/maximize-term.ts +347 -0
  195. package/src/prove/smt/solver/lp/nex-creator.ts +381 -0
  196. package/src/prove/smt/solver/lp/nex.ts +120 -0
  197. package/src/prove/smt/solver/lp/nla-backoff.ts +43 -0
  198. package/src/prove/smt/solver/lp/nla-basics.ts +398 -0
  199. package/src/prove/smt/solver/lp/nla-core.ts +968 -0
  200. package/src/prove/smt/solver/lp/nla-divisions.ts +332 -0
  201. package/src/prove/smt/solver/lp/nla-emonics.ts +373 -0
  202. package/src/prove/smt/solver/lp/nla-factorization.ts +30 -0
  203. package/src/prove/smt/solver/lp/nla-grobner.ts +904 -0
  204. package/src/prove/smt/solver/lp/nla-horner.ts +126 -0
  205. package/src/prove/smt/solver/lp/nla-intervals.ts +265 -0
  206. package/src/prove/smt/solver/lp/nla-monomial-bounds.ts +715 -0
  207. package/src/prove/smt/solver/lp/nla-monotone.ts +59 -0
  208. package/src/prove/smt/solver/lp/nla-order.ts +307 -0
  209. package/src/prove/smt/solver/lp/nla-patcher.ts +112 -0
  210. package/src/prove/smt/solver/lp/nla-tangents.ts +251 -0
  211. package/src/prove/smt/solver/lp/nla-throttle.ts +85 -0
  212. package/src/prove/smt/solver/lp/nla-types.ts +124 -0
  213. package/src/prove/smt/solver/lp/nla-var-eqs.ts +141 -0
  214. package/src/prove/smt/solver/lp/nra-solver.ts +440 -0
  215. package/src/prove/smt/solver/lp/numeric-pair.ts +65 -0
  216. package/src/prove/smt/solver/lp/pdd-interval.ts +31 -0
  217. package/src/prove/smt/solver/lp/pdd-simplifier.ts +184 -0
  218. package/src/prove/smt/solver/lp/pdd-solver.ts +408 -0
  219. package/src/prove/smt/solver/lp/pdd.ts +971 -0
  220. package/src/prove/smt/solver/lp/random-updater.ts +138 -0
  221. package/src/prove/smt/solver/lp/static-matrix.ts +246 -0
  222. package/src/prove/smt/solver/lp/union-find.ts +96 -0
  223. package/src/prove/smt/solver/mam-compiler.ts +847 -0
  224. package/src/prove/smt/solver/mam-interpreter.ts +400 -0
  225. package/src/prove/smt/solver/maximize-ac-sharing.ts +118 -0
  226. package/src/prove/smt/solver/model-checker.ts +347 -0
  227. package/src/prove/smt/solver/model-evaluator.ts +262 -0
  228. package/src/prove/smt/solver/model-finder.ts +155 -0
  229. package/src/prove/smt/solver/model-generator.ts +97 -0
  230. package/src/prove/smt/solver/model-macro-solver.ts +728 -0
  231. package/src/prove/smt/solver/nlsat/algebraic.ts +1161 -0
  232. package/src/prove/smt/solver/nlsat/atoms.ts +238 -0
  233. package/src/prove/smt/solver/nlsat/evaluator.ts +303 -0
  234. package/src/prove/smt/solver/nlsat/explain.ts +607 -0
  235. package/src/prove/smt/solver/nlsat/interval-set.ts +351 -0
  236. package/src/prove/smt/solver/nlsat/levelwise.ts +737 -0
  237. package/src/prove/smt/solver/nlsat/mpbq.ts +161 -0
  238. package/src/prove/smt/solver/nlsat/polynomial.ts +1722 -0
  239. package/src/prove/smt/solver/nlsat/solver.ts +911 -0
  240. package/src/prove/smt/solver/nlsat/types.ts +43 -0
  241. package/src/prove/smt/solver/nlsat/upolynomial-factorization.ts +648 -0
  242. package/src/prove/smt/solver/nlsat/upolynomial.ts +996 -0
  243. package/src/prove/smt/solver/nnf.ts +469 -0
  244. package/src/prove/smt/solver/pattern-inference.ts +351 -0
  245. package/src/prove/smt/solver/poly-rewriter.ts +477 -0
  246. package/src/prove/smt/solver/propagate-values.ts +83 -0
  247. package/src/prove/smt/solver/proto-model.ts +551 -0
  248. package/src/prove/smt/solver/pull-quant.ts +139 -0
  249. package/src/prove/smt/solver/qe-lite-der.ts +526 -0
  250. package/src/prove/smt/solver/qe-lite-fm.ts +576 -0
  251. package/src/prove/smt/solver/qe-lite.ts +381 -0
  252. package/src/prove/smt/solver/qi-queue.ts +362 -0
  253. package/src/prove/smt/solver/quant-tactics.ts +117 -0
  254. package/src/prove/smt/solver/quantifier-analyzer.ts +562 -0
  255. package/src/prove/smt/solver/quantifier-manager.ts +186 -0
  256. package/src/prove/smt/solver/random-gen.ts +10 -0
  257. package/src/prove/smt/solver/rational.ts +165 -0
  258. package/src/prove/smt/solver/ref-vector.ts +62 -0
  259. package/src/prove/smt/solver/relevancy.ts +247 -0
  260. package/src/prove/smt/solver/rewriter-tpl.ts +1159 -0
  261. package/src/prove/smt/solver/rewriter.ts +843 -0
  262. package/src/prove/smt/solver/rlimit.ts +79 -0
  263. package/src/prove/smt/solver/smtlib-parser.ts +526 -0
  264. package/src/prove/smt/solver/solver.ts +71 -0
  265. package/src/prove/smt/solver/sort.ts +35 -0
  266. package/src/prove/smt/solver/sticky-generations.ts +69 -0
  267. package/src/prove/smt/solver/theory-lra-axioms.ts +340 -0
  268. package/src/prove/smt/solver/theory-lra-bounds.ts +226 -0
  269. package/src/prove/smt/solver/theory-lra-final-check.ts +252 -0
  270. package/src/prove/smt/solver/theory-lra-internalize.ts +476 -0
  271. package/src/prove/smt/solver/theory-lra-model.ts +243 -0
  272. package/src/prove/smt/solver/theory-lra-propagate.ts +405 -0
  273. package/src/prove/smt/solver/theory-lra-state.ts +43 -0
  274. package/src/prove/smt/solver/theory-lra.ts +56 -0
  275. package/src/prove/smt/solver/var-subst.ts +258 -0
  276. package/src/prove/smt/solver/z3-license.txt +10 -0
  277. package/src/prove/smt/table.ts +170 -0
  278. package/src/prove/tlapm/cache.ts +236 -0
  279. package/src/prove/tlapm/ocaml-marshal.ts +166 -0
  280. package/src/prove/tlapm/tlapm.ts +96 -0
  281. package/src/prove/tlaps-module.ts +510 -0
  282. package/src/prove/verdict.ts +18 -0
  283. package/src/prove/zenon/LICENSE +32 -0
  284. package/src/prove/zenon/check/check.ts +105 -0
  285. package/src/prove/zenon/check/definitions.ts +144 -0
  286. package/src/prove/zenon/check/equality.ts +182 -0
  287. package/src/prove/zenon/check/functions.ts +62 -0
  288. package/src/prove/zenon/check/keys.ts +125 -0
  289. package/src/prove/zenon/check/propositional.ts +104 -0
  290. package/src/prove/zenon/check/records.ts +188 -0
  291. package/src/prove/zenon/check/relations.ts +121 -0
  292. package/src/prove/zenon/check/rewrites.ts +224 -0
  293. package/src/prove/zenon/check/sets.ts +302 -0
  294. package/src/prove/zenon/check/terms.ts +127 -0
  295. package/src/prove/zenon/check/tla.ts +126 -0
  296. package/src/prove/zenon/decide.ts +113 -0
  297. package/src/prove/zenon/encode.ts +379 -0
  298. package/src/prove/zenon/eqrel.ts +300 -0
  299. package/src/prove/zenon/equality-rules.ts +435 -0
  300. package/src/prove/zenon/expr.ts +551 -0
  301. package/src/prove/zenon/index-table.ts +350 -0
  302. package/src/prove/zenon/isar-case.ts +513 -0
  303. package/src/prove/zenon/isar.ts +1249 -0
  304. package/src/prove/zenon/limits.ts +15 -0
  305. package/src/prove/zenon/llproof.ts +173 -0
  306. package/src/prove/zenon/mltoll.ts +1566 -0
  307. package/src/prove/zenon/node.ts +297 -0
  308. package/src/prove/zenon/ocaml.ts +169 -0
  309. package/src/prove/zenon/parse.ts +247 -0
  310. package/src/prove/zenon/phrase.ts +191 -0
  311. package/src/prove/zenon/proof.ts +198 -0
  312. package/src/prove/zenon/propositional-rules.ts +387 -0
  313. package/src/prove/zenon/rules.ts +94 -0
  314. package/src/prove/zenon/search.ts +288 -0
  315. package/src/prove/zenon/tla/functions.ts +151 -0
  316. package/src/prove/zenon/tla/llproof.ts +480 -0
  317. package/src/prove/zenon/tla/records.ts +225 -0
  318. package/src/prove/zenon/tla/rewrites.ts +447 -0
  319. package/src/prove/zenon/tla/sets.ts +304 -0
  320. package/src/prove/zenon/tla/terms.ts +162 -0
  321. package/src/prove/zenon/tla/tla.ts +506 -0
  322. package/src/randomization.ts +1 -1
  323. package/src/resolve.ts +1 -1
  324. package/src/runtime.ts +2 -2
  325. package/src/{sany-builtins.ts → sany/builtins.ts} +1 -1
  326. package/src/{sany-generator.ts → sany/generator.ts} +14 -14
  327. package/src/{sany-levels.ts → sany/levels.ts} +2 -2
  328. package/src/{sany-lexer.ts → sany/lexer.ts} +1 -1
  329. package/src/{sany-linter.ts → sany/linter.ts} +1 -1
  330. package/src/{sany-modules.ts → sany/modules.ts} +2 -2
  331. package/src/{sany-parse-error.ts → sany/parse-error.ts} +2 -2
  332. package/src/{sany-report.ts → sany/report.ts} +15 -15
  333. package/src/{sany-selectors.ts → sany/selectors.ts} +3 -3
  334. package/src/{sany-source.ts → sany/source.ts} +6 -6
  335. package/src/{sany-xml.ts → sany/xml.ts} +5 -5
  336. package/src/spec-description.ts +1 -1
  337. package/src/{standard-levels.ts → standard/levels.ts} +1 -1
  338. package/src/{standard-modules.ts → standard/modules.ts} +12 -12
  339. package/src/{standard-ranges.ts → standard/ranges.ts} +1 -1
  340. package/src/state-graph.ts +1 -1
  341. package/src/successors.ts +1 -1
  342. package/src/symmetry.ts +1 -1
  343. package/src/{tlc-messages.ts → tlc/messages.ts} +2 -2
  344. package/src/{tlc-order.ts → tlc/order.ts} +7 -7
  345. package/src/{tlc-random.ts → tlc/random.ts} +3 -3
  346. package/src/{tlc-replay.ts → tlc/replay.ts} +5 -5
  347. package/src/{tlc-module.ts → tlc/tlc-operators.ts} +9 -9
  348. package/src/{tlc-ext.ts → tlc/tlcext-operators.ts} +14 -8
  349. package/src/values.ts +1 -1
  350. package/src/worker.ts +65 -0
  351. package/dist/parallel.cjs +0 -12
  352. package/dist/parallel.js +0 -12
  353. package/dist/run-cli.cjs +0 -55
  354. package/dist/run-cli.js +0 -55
  355. package/src/value-sources.ts +0 -29
  356. /package/src/{sany-nodes.ts → sany/nodes.ts} +0 -0
  357. /package/src/{tlc-modules.ts → tlc/jar-data.ts} +0 -0
  358. /package/src/{tlc-summary.ts → tlc/summary.ts} +0 -0
  359. /package/src/{tlc-version.ts → tlc/version.ts} +0 -0
@@ -1,16 +1,17 @@
1
1
  // Generates the proof obligations tlapm prints for a module, in tlapm's order and layout.
2
2
 
3
- import { TlaProofError, TlaSyntaxError, type SyntaxFailure } from "./errors";
4
- import { createAnonymizer } from "./obligation-anon";
3
+ import { TlaProofError, TlaSyntaxError, type SyntaxFailure } from "../errors";
4
+ import { createAnonymizer } from "./anon";
5
5
  import {
6
6
  getAtPrefix,
7
7
  getErrorNote,
8
8
  getLocusPosition,
9
9
  getLocusPrefix,
10
10
  type Locus,
11
- type ObligationWarning,
12
- } from "./obligation-expression";
13
- import { createGenerator, type LineRange } from "./obligation-generate";
11
+ type Warn,
12
+ type Sequent,
13
+ } from "./expression";
14
+ import { createGenerator, type LineRange } from "./generate";
14
15
  import {
15
16
  compareNames,
16
17
  expandInstance,
@@ -23,15 +24,16 @@ import {
23
24
  type Mule,
24
25
  type TheoremSummary,
25
26
  type Pipeline,
26
- } from "./obligation-module";
27
- import { formatObligation } from "./obligation-printer";
28
- import type { Counter } from "./obligation-proof";
29
- import { createSource } from "./obligation-source";
30
- import { tokenize } from "./lexer";
31
- import { parseTlapmModule } from "./parser";
32
- import type { Module } from "./ast";
27
+ } from "./module";
28
+ import { formatObligation } from "./printer";
29
+ import type { Counter, ObligationKind } from "./proof";
30
+ import type { OldMethod } from "./pragma";
31
+ import { createSource } from "./source";
32
+ import { tokenize } from "../lexer";
33
+ import { parseTlapmModule } from "../parser";
34
+ import type { Module } from "../ast";
33
35
 
34
- export interface ObligationSource {
36
+ interface ObligationSource {
35
37
  file: string;
36
38
  source: string;
37
39
  }
@@ -39,7 +41,11 @@ export interface ObligationSource {
39
41
  export interface PrintedObligation {
40
42
  id: number;
41
43
  location: string;
44
+ locus: Locus | undefined;
42
45
  text: string;
46
+ kind: ObligationKind;
47
+ sequent: Sequent;
48
+ method?: OldMethod;
43
49
  }
44
50
 
45
51
  export interface ModuleObligations {
@@ -53,7 +59,7 @@ export const WHOLE_MODULE: LineRange = { start: 0, end: Infinity };
53
59
 
54
60
  interface ObligationOptions {
55
61
  lines?: LineRange;
56
- onWarning?: (warning: ObligationWarning) => void;
62
+ onWarning?: Warn;
57
63
  }
58
64
 
59
65
  const MODULE_HEADER = /-{4,} *MODULE/;
@@ -122,7 +128,7 @@ const loadMule = (
122
128
  input: ObligationSource,
123
129
  counter: Counter,
124
130
  isMain: boolean,
125
- onWarning: (warning: ObligationWarning) => void,
131
+ onWarning: Warn,
126
132
  citation: string,
127
133
  ): Mule => {
128
134
  if (!MODULE_HEADER.test(input.source)) throw new TlaProofError("No tokens in file");
@@ -307,7 +313,17 @@ export const getObligations = (
307
313
  obligation.kind.kind === "Error"
308
314
  ? obligation.kind.message
309
315
  : `${formatObligation(obligation.sequent)}\n`;
310
- return [{ id: index + 1, location: formatLocus(location), text }];
316
+ return [
317
+ {
318
+ id: index + 1,
319
+ location: formatLocus(location),
320
+ locus: location,
321
+ text,
322
+ kind: obligation.kind,
323
+ sequent: obligation.sequent,
324
+ method: obligation.method,
325
+ },
326
+ ];
311
327
  });
312
328
  return [
313
329
  { name: module.name, location: module.location, obligations, summary: generated.summary },
@@ -1,20 +1,24 @@
1
- // A port of tlapm's Expr.Levels: the level of an expression (0 constant, 1 state, 2 action,
2
- // 3 temporal, 4 undefined), the weights of an operator's arguments, and the declared names the
3
- // level depends on.
1
+ // Expr.Levels: the level of an expression (0 constant, 1 state, 2 action, 3 temporal, 4 undefined),
2
+ // the weights of an operator's arguments, and the declared names the level depends on.
4
3
 
5
- import { TlaProofError, TlapmBugError } from "./errors";
4
+ import { TlaProofError, TlapmBugError } from "../errors";
6
5
  import {
7
6
  adjoin,
7
+ adjoinAll,
8
8
  getBoundedFresh,
9
+ getBoundFresh,
9
10
  getFresh,
11
+ getLocalDefn,
12
+ getParamFresh,
10
13
  getScopeAt,
14
+ isBuiltinApply,
11
15
  mapAccumulate,
12
16
  type Bound,
13
17
  type Builtin,
14
18
  type Expr,
15
19
  type Level,
16
20
  type Scope,
17
- } from "./obligation-expression";
21
+ } from "./expression";
18
22
 
19
23
  interface LevelInfo {
20
24
  level: number;
@@ -152,11 +156,7 @@ const getBoundsLevel = (scope: Scope | undefined, bounds: Bound[], body: Expr) =
152
156
  const domains = bounds.flatMap((bound) =>
153
157
  bound.domain.kind === "Domain" ? [getLevelInfo(scope, bound.domain.expression)] : [],
154
158
  );
155
- const inner = bounds.reduce(
156
- (current, bound) => adjoin(current, getFresh(bound.name, bound.level)),
157
- scope,
158
- );
159
- return combine([getLevelInfo(inner, body), ...domains]);
159
+ return combine([getLevelInfo(adjoinAll(scope, bounds.map(getBoundFresh)), body), ...domains]);
160
160
  };
161
161
 
162
162
  const applyOperator = (operator: LevelInfo, args: LevelInfo[]): LevelInfo => {
@@ -189,11 +189,10 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
189
189
  case "Num":
190
190
  return getInfo(0);
191
191
  case "Lambda": {
192
- const inner = expression.params.reduce(
193
- (current, param) => adjoin(current, getFresh(param.name, "Unknown", param.shape)),
194
- scope,
192
+ const body = getLevelInfo(
193
+ adjoinAll(scope, expression.params.map(getParamFresh)),
194
+ expression.body,
195
195
  );
196
- const body = getLevelInfo(inner, expression.body);
197
196
  const names = new Set(expression.params.map((param) => param.name));
198
197
  return {
199
198
  level: body.level,
@@ -203,6 +202,11 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
203
202
  }
204
203
  case "Apply": {
205
204
  const operator = expression.operator;
205
+ // The action frontend commutes a prime onto an operator, and tlapm keeps the level that
206
+ // the application had.
207
+ if (isBuiltinApply(operator, "Prime") && operator.args.length === 1) {
208
+ return recurse({ ...expression, operator: operator.args[0] });
209
+ }
206
210
  if (operator.kind === "Opaque") {
207
211
  return applyOperator(getInfo(0, expression.args.length), expression.args.map(recurse));
208
212
  }
@@ -246,20 +250,11 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
246
250
  case "Dot":
247
251
  case "Parens":
248
252
  return recurse(expression.expression);
249
- case "Let": {
250
- const inner = expression.definitions.reduce(
251
- (current, definition) =>
252
- adjoin(current, {
253
- kind: "Defn",
254
- definition,
255
- whereDefined: "User",
256
- visibility: "Visible",
257
- isLocal: true,
258
- }),
259
- scope,
253
+ case "Let":
254
+ return getLevelInfo(
255
+ adjoinAll(scope, expression.definitions.map(getLocalDefn)),
256
+ expression.body,
260
257
  );
261
- return getLevelInfo(inner, expression.body);
262
- }
263
258
  case "If":
264
259
  return combine(
265
260
  [expression.condition, expression.consequent, expression.alternative].map(recurse),
@@ -273,7 +268,10 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
273
268
  return getBoundsLevel(scope, expression.bounds, expression.element);
274
269
  case "Tquant":
275
270
  getLevelInfo(
276
- expression.names.reduce((current, name) => adjoin(current, { kind: "Flex", name }), scope),
271
+ adjoinAll(
272
+ scope,
273
+ expression.names.map((name) => ({ kind: "Flex", name })),
274
+ ),
277
275
  expression.body,
278
276
  );
279
277
  return getInfo(3);
@@ -1,9 +1,9 @@
1
1
  // A port of tlapm's module pipeline: flattening EXTENDS (Module.Flatten), normalization
2
2
  // (Module.Elab.normalize) and obligation generation (Module.Gen).
3
3
 
4
- import { TlaProofError, TlapmBugError } from "./errors";
5
- import { lambdify } from "./obligation-action";
6
- import type { Anonymizer } from "./obligation-anon";
4
+ import { TlaProofError, TlapmBugError } from "../errors";
5
+ import { lambdify } from "./action";
6
+ import type { Anonymizer } from "./anon";
7
7
  import {
8
8
  adjoinAll,
9
9
  at,
@@ -13,7 +13,8 @@ import {
13
13
  exprifySequent,
14
14
  findNamed,
15
15
  getAtPrefix,
16
- getLocusText,
16
+ getFact,
17
+ getLocationText,
17
18
  getLocusPrefix,
18
19
  getScopeHyps,
19
20
  mapAccumulate,
@@ -32,27 +33,22 @@ import {
32
33
  type Hyp,
33
34
  type InstanceDefinition,
34
35
  type Locus,
35
- type ObligationWarning,
36
+ type Warn,
36
37
  type Scope,
37
38
  type Sequent,
38
39
  type Substitution,
39
40
  type Visibility,
40
41
  type WhereDefined,
41
- } from "./obligation-expression";
42
+ } from "./expression";
42
43
  import {
43
44
  EMPTY_SUMMARY,
44
45
  getProofSummary,
45
46
  joinSummaries,
46
47
  type Generator,
47
48
  type ProofSummary,
48
- } from "./obligation-generate";
49
- import {
50
- getUnique,
51
- type Counter,
52
- type Obligation,
53
- type Proof,
54
- type Usable,
55
- } from "./obligation-proof";
49
+ } from "./generate";
50
+ import { getUnique, type Counter, type Obligation, type Proof, type Usable } from "./proof";
51
+ import { getScopeTime } from "./temporal";
56
52
 
57
53
  export type ModuleUnit = ModuleUnitCore & { location?: Locus };
58
54
 
@@ -75,7 +71,7 @@ type ModuleUnitCore =
75
71
  proof: Proof;
76
72
  }
77
73
  | { kind: "Submod"; module: Mule }
78
- | { kind: "Mutate"; mode: "Use" | "Hide"; isSuppressed: boolean; usable: Usable }
74
+ | { kind: "Mutate"; mode: "Use" | "Hide"; usable: Usable }
79
75
  | { kind: "Anoninst"; instance: InstanceDefinition; isLocal: boolean };
80
76
 
81
77
  // depth is the size of the context the module was normalized in, which instantiation shifts
@@ -91,34 +87,29 @@ export interface Mule {
91
87
  location?: Locus;
92
88
  }
93
89
 
94
- const getBuiltinConstant = (name: string, builtin: Builtin): ModuleUnit => ({
95
- kind: "Definition",
96
- definition: { kind: "Operator", name, body: { kind: "Internal", builtin } },
97
- whereDefined: "Builtin",
98
- visibility: "Visible",
99
- isLocal: false,
100
- });
101
-
102
- const getBuiltinOperator = (arity: number, name: string, builtin: Builtin): ModuleUnit => ({
90
+ const getBuiltin = (arity: number, name: string, builtin: Builtin): ModuleUnit => ({
103
91
  kind: "Definition",
104
92
  definition: {
105
93
  kind: "Operator",
106
94
  name,
107
- body: {
108
- kind: "Lambda",
109
- params: Array.from({ length: arity }, (_item, index) => ({
110
- name: `x${index + 1}`,
111
- shape: 0,
112
- })),
113
- body: {
114
- kind: "Apply",
115
- operator: { kind: "Internal", builtin },
116
- args: Array.from({ length: arity }, (_item, index) => ({
117
- kind: "Ix",
118
- index: arity - index,
119
- })),
120
- },
121
- },
95
+ body:
96
+ arity === 0
97
+ ? { kind: "Internal", builtin }
98
+ : {
99
+ kind: "Lambda",
100
+ params: Array.from({ length: arity }, (_item, index) => ({
101
+ name: `x${index + 1}`,
102
+ shape: 0,
103
+ })),
104
+ body: {
105
+ kind: "Apply",
106
+ operator: { kind: "Internal", builtin },
107
+ args: Array.from({ length: arity }, (_item, index) => ({
108
+ kind: "Ix",
109
+ index: arity - index,
110
+ })),
111
+ },
112
+ },
122
113
  },
123
114
  whereDefined: "Builtin",
124
115
  visibility: "Visible",
@@ -126,59 +117,55 @@ const getBuiltinOperator = (arity: number, name: string, builtin: Builtin): Modu
126
117
  });
127
118
 
128
119
  const NATURALS: ModuleUnit[] = [
129
- getBuiltinConstant("Nat", "Nat"),
130
- getBuiltinOperator(2, "+", "Plus"),
131
- getBuiltinOperator(2, "-", "Minus"),
132
- getBuiltinOperator(2, "*", "Times"),
133
- getBuiltinOperator(2, "^", "Exp"),
134
- getBuiltinOperator(2, "<", "Lt"),
135
- getBuiltinOperator(2, ">", "Gt"),
136
- getBuiltinOperator(2, "=<", "Lteq"),
137
- getBuiltinOperator(2, ">=", "Gteq"),
138
- getBuiltinOperator(2, "%", "Remainder"),
139
- getBuiltinOperator(2, "\\div", "Quotient"),
140
- getBuiltinOperator(2, "..", "Range"),
120
+ getBuiltin(0, "Nat", "Nat"),
121
+ getBuiltin(2, "+", "Plus"),
122
+ getBuiltin(2, "-", "Minus"),
123
+ getBuiltin(2, "*", "Times"),
124
+ getBuiltin(2, "^", "Exp"),
125
+ getBuiltin(2, "<", "Lt"),
126
+ getBuiltin(2, ">", "Gt"),
127
+ getBuiltin(2, "=<", "Lteq"),
128
+ getBuiltin(2, ">=", "Gteq"),
129
+ getBuiltin(2, "%", "Remainder"),
130
+ getBuiltin(2, "\\div", "Quotient"),
131
+ getBuiltin(2, "..", "Range"),
141
132
  ];
142
133
 
143
- const INTEGERS = [
144
- ...NATURALS,
145
- getBuiltinConstant("Int", "Int"),
146
- getBuiltinOperator(1, "-.", "Uminus"),
147
- ];
134
+ const INTEGERS = [...NATURALS, getBuiltin(0, "Int", "Int"), getBuiltin(1, "-.", "Uminus")];
148
135
 
149
136
  const REALS = [
150
137
  ...INTEGERS,
151
- getBuiltinConstant("Real", "Real"),
152
- getBuiltinOperator(2, "/", "Ratio"),
153
- getBuiltinConstant("Infinity", "Infinity"),
138
+ getBuiltin(0, "Real", "Real"),
139
+ getBuiltin(2, "/", "Ratio"),
140
+ getBuiltin(0, "Infinity", "Infinity"),
154
141
  ];
155
142
 
156
143
  const SEQUENCES = [
157
- getBuiltinOperator(1, "Seq", "Seq"),
158
- getBuiltinOperator(1, "Len", "Len"),
159
- getBuiltinOperator(2, "BSeq", "BSeq"),
160
- getBuiltinOperator(2, "\\o", "Cat"),
161
- getBuiltinOperator(2, "Append", "Append"),
162
- getBuiltinOperator(1, "Head", "Head"),
163
- getBuiltinOperator(1, "Tail", "Tail"),
164
- getBuiltinOperator(3, "SubSeq", "SubSeq"),
165
- getBuiltinOperator(2, "SelectSeq", "SelectSeq"),
144
+ getBuiltin(1, "Seq", "Seq"),
145
+ getBuiltin(1, "Len", "Len"),
146
+ getBuiltin(2, "BSeq", "BSeq"),
147
+ getBuiltin(2, "\\o", "Cat"),
148
+ getBuiltin(2, "Append", "Append"),
149
+ getBuiltin(1, "Head", "Head"),
150
+ getBuiltin(1, "Tail", "Tail"),
151
+ getBuiltin(3, "SubSeq", "SubSeq"),
152
+ getBuiltin(2, "SelectSeq", "SelectSeq"),
166
153
  ];
167
154
 
168
155
  const TLC = [
169
- getBuiltinOperator(2, "Print", "Print"),
170
- getBuiltinOperator(1, "PrintT", "PrintT"),
171
- getBuiltinOperator(2, "Assert", "Assert"),
172
- getBuiltinConstant("JavaTime", "JavaTime"),
173
- getBuiltinOperator(1, "TLCGet", "TLCGet"),
174
- getBuiltinOperator(2, "TLCSet", "TLCSet"),
175
- getBuiltinOperator(2, ":>", "OneArg"),
176
- getBuiltinOperator(2, "@@", "Extend"),
177
- getBuiltinOperator(1, "Permutations", "Permutations"),
178
- getBuiltinOperator(2, "SortSeq", "SortSeq"),
179
- getBuiltinOperator(1, "RandomElement", "RandomElement"),
180
- getBuiltinConstant("Any", "Any"),
181
- getBuiltinOperator(1, "ToString", "ToString"),
156
+ getBuiltin(2, "Print", "Print"),
157
+ getBuiltin(1, "PrintT", "PrintT"),
158
+ getBuiltin(2, "Assert", "Assert"),
159
+ getBuiltin(0, "JavaTime", "JavaTime"),
160
+ getBuiltin(1, "TLCGet", "TLCGet"),
161
+ getBuiltin(2, "TLCSet", "TLCSet"),
162
+ getBuiltin(2, ":>", "OneArg"),
163
+ getBuiltin(2, "@@", "Extend"),
164
+ getBuiltin(1, "Permutations", "Permutations"),
165
+ getBuiltin(2, "SortSeq", "SortSeq"),
166
+ getBuiltin(1, "RandomElement", "RandomElement"),
167
+ getBuiltin(0, "Any", "Any"),
168
+ getBuiltin(1, "ToString", "ToString"),
182
169
  ];
183
170
 
184
171
  const getStandard = (name: string, body: ModuleUnit[]): Mule => ({
@@ -241,27 +228,28 @@ const getUnitHyps = (unit: ModuleUnit): Hyp[] => {
241
228
  },
242
229
  ];
243
230
  case "Axiom":
244
- return unit.name === undefined
245
- ? [{ kind: "Fact", expression: unit.expression, visibility: "Hidden", location }]
246
- : getNamedFact(unit.name, unit.expression, location);
247
231
  case "Theorem": {
248
- const sequent = substituteSequent(shift(-unit.axiomCount), {
249
- ...unit.sequent,
250
- context: unit.sequent.context.slice(unit.axiomCount),
251
- });
252
- const body = at(exprifySequent(sequent), unit);
232
+ const expression =
233
+ unit.kind === "Axiom"
234
+ ? unit.expression
235
+ : at(
236
+ exprifySequent(
237
+ substituteSequent(shift(-unit.axiomCount), {
238
+ ...unit.sequent,
239
+ context: unit.sequent.context.slice(unit.axiomCount),
240
+ }),
241
+ ),
242
+ unit,
243
+ );
253
244
  return unit.name === undefined
254
- ? [{ kind: "Fact", expression: body, visibility: "Hidden", location }]
255
- : getNamedFact(unit.name, body, location);
245
+ ? [getFact(expression, "Hidden", "Always", location)]
246
+ : getNamedFact(unit.name, expression, location);
256
247
  }
257
248
  case "Mutate":
258
249
  return unit.mode === "Use"
259
- ? unit.usable.facts.map((fact, index) => ({
260
- kind: "Fact",
261
- expression: shiftExpr(index, fact),
262
- visibility: "Visible",
263
- location,
264
- }))
250
+ ? unit.usable.facts.map((fact, index) =>
251
+ getFact(shiftExpr(index, fact), "Visible", "Always", location),
252
+ )
265
253
  : [];
266
254
  case "Submod":
267
255
  case "Anoninst":
@@ -285,7 +273,7 @@ const getNamedFact = (name: string, expression: Expr, location: Locus | undefine
285
273
  isLocal: false,
286
274
  location,
287
275
  },
288
- { kind: "Fact", expression: { kind: "Ix", index: 1, location }, visibility: "Hidden", location },
276
+ getFact({ kind: "Ix", index: 1, location }, "Hidden", "Always", location),
289
277
  ];
290
278
 
291
279
  // Module.Flatten.exports: what an extending module sees, with local definitions inlined like
@@ -353,11 +341,12 @@ export const getDependencies = (module: Mule) => {
353
341
  }
354
342
  Object.values(value).forEach(addInstances);
355
343
  };
356
- // The hypotheses of each unit, leaving out the proofs of theorems.
344
+ // Leaves out the proofs of theorems.
357
345
  const visit = (unit: ModuleUnit) => {
358
- if (unit.kind === "Theorem") addInstances(unit.sequent);
359
- else if (unit.kind !== "Submod") addInstances(unit);
360
- if (unit.kind !== "Submod") return;
346
+ if (unit.kind !== "Submod") {
347
+ addInstances(unit.kind === "Theorem" ? unit.sequent : unit);
348
+ return;
349
+ }
361
350
  locals.add(unit.module.name);
362
351
  submodules.set(unit.module.name, unit.module);
363
352
  addExtendees(unit.module);
@@ -390,7 +379,7 @@ export interface Pipeline {
390
379
  generator: Generator;
391
380
  salts: Counter;
392
381
  latestModules: Map<string, Mule>;
393
- onWarning: (warning: ObligationWarning) => void;
382
+ onWarning: Warn;
394
383
  }
395
384
 
396
385
  const substituteUsable = (substitution: Substitution, usable: Usable): Usable => ({
@@ -479,7 +468,7 @@ const lambdifyTheorem = (
479
468
  } catch (error) {
480
469
  if (!(error instanceof TlaProofError) || error.failure === undefined) throw error;
481
470
  const location = sequent.active.location;
482
- const message = `${error.failure}\nCould not instantiate the theorem ${name === undefined ? "" : `named: ${name}, `}at: ${location ? getLocusText(location) : "<unknown location>"}`;
471
+ const message = `${error.failure}\nCould not instantiate the theorem ${name === undefined ? "" : `named: ${name}, `}at: ${getLocationText(location)}`;
483
472
  pipeline.onWarning({ text: `${getAtPrefix(location)}[ERROR]${message}`, channel: "stdout" });
484
473
  pipeline.onWarning({ text: message, channel: "toolboxOnly" });
485
474
  return { context: [], active: at({ kind: "Internal", builtin: "TRUE" }, sequent.active) };
@@ -681,21 +670,18 @@ const localizeAxioms = (units: ModuleUnit[]) => {
681
670
  body.push({
682
671
  kind: "Definition",
683
672
  definition: { kind: "Operator", name: unit.name, body: unit.expression, location },
684
- whereDefined: "Proof",
673
+ whereDefined: { kind: "Proof", time: "Always" },
685
674
  visibility: "Visible",
686
675
  isLocal: false,
687
676
  location,
688
677
  });
689
678
  }
690
- const hyp: Hyp = {
691
- kind: "Fact",
692
- expression:
693
- unit.name === undefined
694
- ? shiftExpr(1, unit.expression)
695
- : at({ kind: "Ix", index: 2 }, unit),
696
- visibility: "Visible",
679
+ const hyp = getFact(
680
+ unit.name === undefined ? shiftExpr(1, unit.expression) : at({ kind: "Ix", index: 2 }, unit),
681
+ "Visible",
682
+ "Always",
697
683
  location,
698
- };
684
+ );
699
685
  let distance = 0;
700
686
  const inserted = tail.map((next): ModuleUnit => {
701
687
  const size = distance;
@@ -808,7 +794,7 @@ const bindTheoremName = (
808
794
  body: at(exprifySequent(sequent), { location }),
809
795
  location,
810
796
  },
811
- whereDefined: "Proof",
797
+ whereDefined: { kind: "Proof", time: "Always" },
812
798
  visibility: "Visible",
813
799
  isLocal: false,
814
800
  location,
@@ -950,13 +936,20 @@ export const normalize = (
950
936
  pipeline.latestModules = new Map(modules);
951
937
  const sequent = pipeline.anonymizer.sequent(current, unit.sequent);
952
938
  const binding = bindTheoremName(name, sequent, unit.location);
953
- const proofScope = adjoinAll(adjoinAll(current, binding.hyps), binding.sequent.context);
939
+ const proofScope = adjoinAll(
940
+ adjoinAll(
941
+ current,
942
+ binding.hyps.map((hyp) => ({ ...hyp, isConstnessUnset: true })),
943
+ ),
944
+ binding.sequent.context,
945
+ );
954
946
  const anonymized = pipeline.anonymizer.proof(proofScope, proof);
955
947
  const simplified = module.isImportant
956
948
  ? pipeline.generator.simplify(
957
949
  getScopeHyps(proofScope),
958
950
  binding.sequent.active,
959
951
  anonymized,
952
+ getScopeTime(binding.sequent.context, "Always"),
960
953
  )
961
954
  : anonymized;
962
955
  emit({ ...unit, name, sequent, proof: simplified });
@@ -984,7 +977,7 @@ export interface ModuleSummary extends ProofSummary {
984
977
  theorems: TheoremSummary[];
985
978
  }
986
979
 
987
- // Module.Gen.generate: a named theorem binds its name as a proof definition for what follows.
980
+ // Module.Gen.generate.
988
981
  export const generate = (
989
982
  pipeline: Pipeline,
990
983
  context: Hyp[],
@@ -999,9 +992,11 @@ export const generate = (
999
992
  case "Theorem": {
1000
993
  const binding = bindTheoremName(unit.name, unit.sequent, unit.location);
1001
994
  const named = [...current, ...binding.hyps];
995
+ const context = [...named, ...binding.sequent.context];
1002
996
  const proof = pipeline.generator.generate(
1003
- { context: [...named, ...binding.sequent.context], active: binding.sequent.active },
997
+ { context, active: binding.sequent.active },
1004
998
  unit.proof,
999
+ getScopeTime(context, "Always"),
1005
1000
  );
1006
1001
  obligations.push(...pipeline.generator.collect(proof));
1007
1002
  const theorem = getProofSummary(proof);
@@ -1011,10 +1006,7 @@ export const generate = (
1011
1006
  unit.name === undefined
1012
1007
  ? at(exprifySequent(unit.sequent), unit)
1013
1008
  : { kind: "Ix", index: 1, location: unit.location };
1014
- current = [
1015
- ...named,
1016
- { kind: "Fact", expression: fact, visibility: "Hidden", location: unit.location },
1017
- ];
1009
+ current = [...named, getFact(fact, "Hidden", "Always", unit.location)];
1018
1010
  continue;
1019
1011
  }
1020
1012
  case "Submod": {