tla-ts 0.0.4-dev.4819fb7 → 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.
- package/README.md +37 -126
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/deciders.cjs +366 -0
- package/dist/deciders.js +366 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -4
- package/dist/parallel-worker.js +1 -4
- package/dist/prove-worker.cjs +9 -0
- package/dist/prove-worker.d.cts +9 -0
- package/dist/prove-worker.d.ts +9 -0
- package/dist/prove-worker.js +9 -0
- package/dist/prove.cjs +996 -0
- package/dist/prove.js +996 -0
- package/dist/run.cjs +45 -0
- package/dist/run.js +45 -0
- package/dist/tlapm.cjs +10 -0
- package/dist/tlapm.js +10 -0
- package/dist/transfer.cjs +38 -44
- package/dist/transfer.js +38 -44
- package/dist/worker.cjs +21 -0
- package/dist/worker.js +21 -0
- package/package.json +21 -12
- package/src/ast.ts +2 -2
- package/src/check.ts +8 -7
- package/src/{cli-options.ts → cli/options.ts} +1 -1
- package/src/{run-cli.ts → cli/run.ts} +302 -100
- package/src/cli.ts +1 -1
- package/src/codegen.ts +26 -7
- package/src/config.ts +2 -2
- package/src/environment.ts +9 -9
- package/src/errors.ts +89 -30
- package/src/evaluate.ts +58 -23
- package/src/index.ts +10 -0
- package/src/levels.ts +1 -1
- package/src/live-check.ts +1 -1
- package/src/liveness.ts +1 -1
- package/src/{obligation-action.ts → obligations/action.ts} +247 -69
- package/src/{obligation-anon.ts → obligations/anon.ts} +49 -47
- package/src/obligations/ctx.ts +64 -0
- package/src/{obligation-deref.ts → obligations/deref.ts} +51 -92
- package/src/{obligation-expression.ts → obligations/expression.ts} +117 -57
- package/src/{obligation-format.ts → obligations/format.ts} +7 -8
- package/src/{obligation-generate.ts → obligations/generate.ts} +170 -192
- package/src/{obligations.ts → obligations/index.ts} +32 -16
- package/src/{obligation-levels.ts → obligations/levels.ts} +26 -28
- package/src/{obligation-module.ts → obligations/module.ts} +113 -121
- package/src/obligations/pickle.ts +98 -0
- package/src/obligations/pragma.ts +189 -0
- package/src/{obligation-printer.ts → obligations/printer.ts} +22 -80
- package/src/{obligation-proof.ts → obligations/proof.ts} +7 -2
- package/src/{obligation-source.ts → obligations/source.ts} +154 -99
- package/src/obligations/temporal.ts +321 -0
- package/src/{obligation-tuples.ts → obligations/tuples.ts} +38 -54
- package/src/parallel-worker.ts +4 -20
- package/src/parallel.ts +13 -46
- package/src/parser.ts +1 -1
- package/src/{pcal-ast.ts → pcal/ast.ts} +2 -2
- package/src/{pcal-parse.ts → pcal/parse.ts} +3 -3
- package/src/{pcal-tokenize.ts → pcal/tokenize.ts} +2 -2
- package/src/{pcal-translate.ts → pcal/translate.ts} +2 -2
- package/src/{pcal-validate.ts → pcal/validate.ts} +6 -6
- package/src/prove/decide-pool.ts +95 -0
- package/src/prove/deciders.ts +33 -0
- package/src/prove/first-order.ts +78 -0
- package/src/prove/isabelle/LICENSE +36 -0
- package/src/prove/isabelle/LICENSE-tlapm +26 -0
- package/src/prove/isabelle/decide.ts +47 -0
- package/src/prove/isabelle/encode.ts +446 -0
- package/src/prove/isabelle/isar/inner-syntax.ts +579 -0
- package/src/prove/isabelle/isar/method.ts +367 -0
- package/src/prove/isabelle/isar/proof.ts +28 -0
- package/src/prove/isabelle/isar/statement.ts +57 -0
- package/src/prove/isabelle/isar/theory.ts +192 -0
- package/src/prove/isabelle/isar/type-check.ts +278 -0
- package/src/prove/isabelle/provers/blast/blast.ts +258 -0
- package/src/prove/isabelle/provers/blast/branch.ts +322 -0
- package/src/prove/isabelle/provers/blast/prove.ts +347 -0
- package/src/prove/isabelle/provers/blast/rules.ts +330 -0
- package/src/prove/isabelle/provers/blast/state.ts +180 -0
- package/src/prove/isabelle/provers/blast/term.ts +546 -0
- package/src/prove/isabelle/provers/clasimp.ts +150 -0
- package/src/prove/isabelle/provers/classical.ts +389 -0
- package/src/prove/isabelle/provers/hypsubst.ts +433 -0
- package/src/prove/isabelle/pure/bicompose.ts +174 -0
- package/src/prove/isabelle/pure/consts.ts +32 -0
- package/src/prove/isabelle/pure/conv.ts +79 -0
- package/src/prove/isabelle/pure/drule.ts +264 -0
- package/src/prove/isabelle/pure/envir.ts +331 -0
- package/src/prove/isabelle/pure/goal.ts +53 -0
- package/src/prove/isabelle/pure/interrupt.ts +16 -0
- package/src/prove/isabelle/pure/list.ts +12 -0
- package/src/prove/isabelle/pure/logic.ts +330 -0
- package/src/prove/isabelle/pure/name.ts +98 -0
- package/src/prove/isabelle/pure/net.ts +215 -0
- package/src/prove/isabelle/pure/object-logic.ts +41 -0
- package/src/prove/isabelle/pure/pattern.ts +631 -0
- package/src/prove/isabelle/pure/raw-simplifier.ts +338 -0
- package/src/prove/isabelle/pure/rewriter.ts +602 -0
- package/src/prove/isabelle/pure/search.ts +68 -0
- package/src/prove/isabelle/pure/seq.ts +133 -0
- package/src/prove/isabelle/pure/simplifier.ts +106 -0
- package/src/prove/isabelle/pure/table.ts +201 -0
- package/src/prove/isabelle/pure/tactic.ts +168 -0
- package/src/prove/isabelle/pure/tactical.ts +264 -0
- package/src/prove/isabelle/pure/term-ord.ts +105 -0
- package/src/prove/isabelle/pure/term.ts +688 -0
- package/src/prove/isabelle/pure/thm.ts +783 -0
- package/src/prove/isabelle/pure/type.ts +121 -0
- package/src/prove/isabelle/pure/unify.ts +753 -0
- package/src/prove/isabelle/pure/variable.ts +25 -0
- package/src/prove/isabelle/tla/classical-setup.ts +101 -0
- package/src/prove/isabelle/tla/context.ts +74 -0
- package/src/prove/isabelle/tla/logic-data.ts +5 -0
- package/src/prove/isabelle/tla/logic.ts +215 -0
- package/src/prove/isabelle/tla/simpdata.ts +241 -0
- package/src/prove/isabelle/tools/intuitionistic.ts +132 -0
- package/src/prove/ocaml.ts +22 -0
- package/src/prove/prep/action.ts +508 -0
- package/src/prove/prep/defs.ts +33 -0
- package/src/prove/prep/elab.ts +156 -0
- package/src/prove/prep/enabled-axioms.ts +189 -0
- package/src/prove/prep/enabled.ts +43 -0
- package/src/prove/prep/fingerprint.ts +388 -0
- package/src/prove/prep/flatten.ts +70 -0
- package/src/prove/prep/level-comparison.ts +529 -0
- package/src/prove/prep/md5.ts +67 -0
- package/src/prove/prep/pragma.ts +221 -0
- package/src/prove/prep/trivial.ts +22 -0
- package/src/prove/prove-worker.ts +22 -0
- package/src/prove/prove.ts +498 -0
- package/src/prove/ptl/decide.ts +68 -0
- package/src/prove/ptl/encode.ts +255 -0
- package/src/prove/ptl/sat.ts +151 -0
- package/src/prove/ptl/tableau.ts +276 -0
- package/src/prove/smt/axiomatize.ts +69 -0
- package/src/prove/smt/axioms.ts +209 -0
- package/src/prove/smt/context.ts +108 -0
- package/src/prove/smt/data.ts +636 -0
- package/src/prove/smt/encode.ts +164 -0
- package/src/prove/smt/extensionality.ts +65 -0
- package/src/prove/smt/flatten.ts +112 -0
- package/src/prove/smt/format.ts +154 -0
- package/src/prove/smt/instances.ts +181 -0
- package/src/prove/smt/rewrite.ts +772 -0
- package/src/prove/smt/simplify.ts +57 -0
- package/src/prove/smt/solver/act-cache.ts +265 -0
- package/src/prove/smt/solver/arith-rewriter.ts +962 -0
- package/src/prove/smt/solver/array.ts +22 -0
- package/src/prove/smt/solver/asserted-formulas.ts +469 -0
- package/src/prove/smt/solver/ast-lt.ts +157 -0
- package/src/prove/smt/solver/ast-util.ts +91 -0
- package/src/prove/smt/solver/ast.ts +1315 -0
- package/src/prove/smt/solver/auf-solver.ts +572 -0
- package/src/prove/smt/solver/case-split-queue.ts +178 -0
- package/src/prove/smt/solver/cg-table.ts +175 -0
- package/src/prove/smt/solver/clause.ts +276 -0
- package/src/prove/smt/solver/conflict-resolution.ts +343 -0
- package/src/prove/smt/solver/context.ts +1292 -0
- package/src/prove/smt/solver/ctx-simplify.ts +334 -0
- package/src/prove/smt/solver/der.ts +224 -0
- package/src/prove/smt/solver/dyn-ack.ts +141 -0
- package/src/prove/smt/solver/e-matching.ts +659 -0
- package/src/prove/smt/solver/enode.ts +259 -0
- package/src/prove/smt/solver/expr-ref.ts +21 -0
- package/src/prove/smt/solver/expr-safe-replace.ts +172 -0
- package/src/prove/smt/solver/fingerprints.ts +92 -0
- package/src/prove/smt/solver/flat-literals.ts +51 -0
- package/src/prove/smt/solver/goal.ts +138 -0
- package/src/prove/smt/solver/hash.ts +173 -0
- package/src/prove/smt/solver/hashtable.ts +166 -0
- package/src/prove/smt/solver/internalizer.ts +1381 -0
- package/src/prove/smt/solver/lbool.ts +5 -0
- package/src/prove/smt/solver/literal.ts +24 -0
- package/src/prove/smt/solver/lp/bound-propagator.ts +391 -0
- package/src/prove/smt/solver/lp/constraints.ts +78 -0
- package/src/prove/smt/solver/lp/containers.ts +296 -0
- package/src/prove/smt/solver/lp/core-solver.ts +504 -0
- package/src/prove/smt/solver/lp/cross-nested.ts +224 -0
- package/src/prove/smt/solver/lp/dep-intervals.ts +642 -0
- package/src/prove/smt/solver/lp/dependency.ts +51 -0
- package/src/prove/smt/solver/lp/dioph-eq.ts +1181 -0
- package/src/prove/smt/solver/lp/explanation.ts +46 -0
- package/src/prove/smt/solver/lp/gomory.ts +255 -0
- package/src/prove/smt/solver/lp/hnf-cutter.ts +125 -0
- package/src/prove/smt/solver/lp/hnf.ts +281 -0
- package/src/prove/smt/solver/lp/int-cube.ts +295 -0
- package/src/prove/smt/solver/lp/int-solver.ts +514 -0
- package/src/prove/smt/solver/lp/lar-solver.ts +816 -0
- package/src/prove/smt/solver/lp/lar-term.ts +62 -0
- package/src/prove/smt/solver/lp/lp-settings.ts +91 -0
- package/src/prove/smt/solver/lp/maximize-term.ts +347 -0
- package/src/prove/smt/solver/lp/nex-creator.ts +381 -0
- package/src/prove/smt/solver/lp/nex.ts +120 -0
- package/src/prove/smt/solver/lp/nla-backoff.ts +43 -0
- package/src/prove/smt/solver/lp/nla-basics.ts +398 -0
- package/src/prove/smt/solver/lp/nla-core.ts +968 -0
- package/src/prove/smt/solver/lp/nla-divisions.ts +332 -0
- package/src/prove/smt/solver/lp/nla-emonics.ts +373 -0
- package/src/prove/smt/solver/lp/nla-factorization.ts +30 -0
- package/src/prove/smt/solver/lp/nla-grobner.ts +904 -0
- package/src/prove/smt/solver/lp/nla-horner.ts +126 -0
- package/src/prove/smt/solver/lp/nla-intervals.ts +265 -0
- package/src/prove/smt/solver/lp/nla-monomial-bounds.ts +715 -0
- package/src/prove/smt/solver/lp/nla-monotone.ts +59 -0
- package/src/prove/smt/solver/lp/nla-order.ts +307 -0
- package/src/prove/smt/solver/lp/nla-patcher.ts +112 -0
- package/src/prove/smt/solver/lp/nla-tangents.ts +251 -0
- package/src/prove/smt/solver/lp/nla-throttle.ts +85 -0
- package/src/prove/smt/solver/lp/nla-types.ts +124 -0
- package/src/prove/smt/solver/lp/nla-var-eqs.ts +141 -0
- package/src/prove/smt/solver/lp/nra-solver.ts +440 -0
- package/src/prove/smt/solver/lp/numeric-pair.ts +65 -0
- package/src/prove/smt/solver/lp/pdd-interval.ts +31 -0
- package/src/prove/smt/solver/lp/pdd-simplifier.ts +184 -0
- package/src/prove/smt/solver/lp/pdd-solver.ts +408 -0
- package/src/prove/smt/solver/lp/pdd.ts +971 -0
- package/src/prove/smt/solver/lp/random-updater.ts +138 -0
- package/src/prove/smt/solver/lp/static-matrix.ts +246 -0
- package/src/prove/smt/solver/lp/union-find.ts +96 -0
- package/src/prove/smt/solver/mam-compiler.ts +847 -0
- package/src/prove/smt/solver/mam-interpreter.ts +400 -0
- package/src/prove/smt/solver/maximize-ac-sharing.ts +118 -0
- package/src/prove/smt/solver/model-checker.ts +347 -0
- package/src/prove/smt/solver/model-evaluator.ts +262 -0
- package/src/prove/smt/solver/model-finder.ts +155 -0
- package/src/prove/smt/solver/model-generator.ts +97 -0
- package/src/prove/smt/solver/model-macro-solver.ts +728 -0
- package/src/prove/smt/solver/nlsat/algebraic.ts +1161 -0
- package/src/prove/smt/solver/nlsat/atoms.ts +238 -0
- package/src/prove/smt/solver/nlsat/evaluator.ts +303 -0
- package/src/prove/smt/solver/nlsat/explain.ts +607 -0
- package/src/prove/smt/solver/nlsat/interval-set.ts +351 -0
- package/src/prove/smt/solver/nlsat/levelwise.ts +737 -0
- package/src/prove/smt/solver/nlsat/mpbq.ts +161 -0
- package/src/prove/smt/solver/nlsat/polynomial.ts +1722 -0
- package/src/prove/smt/solver/nlsat/solver.ts +911 -0
- package/src/prove/smt/solver/nlsat/types.ts +43 -0
- package/src/prove/smt/solver/nlsat/upolynomial-factorization.ts +648 -0
- package/src/prove/smt/solver/nlsat/upolynomial.ts +996 -0
- package/src/prove/smt/solver/nnf.ts +469 -0
- package/src/prove/smt/solver/pattern-inference.ts +351 -0
- package/src/prove/smt/solver/poly-rewriter.ts +477 -0
- package/src/prove/smt/solver/propagate-values.ts +83 -0
- package/src/prove/smt/solver/proto-model.ts +551 -0
- package/src/prove/smt/solver/pull-quant.ts +139 -0
- package/src/prove/smt/solver/qe-lite-der.ts +526 -0
- package/src/prove/smt/solver/qe-lite-fm.ts +576 -0
- package/src/prove/smt/solver/qe-lite.ts +381 -0
- package/src/prove/smt/solver/qi-queue.ts +362 -0
- package/src/prove/smt/solver/quant-tactics.ts +117 -0
- package/src/prove/smt/solver/quantifier-analyzer.ts +562 -0
- package/src/prove/smt/solver/quantifier-manager.ts +186 -0
- package/src/prove/smt/solver/random-gen.ts +10 -0
- package/src/prove/smt/solver/rational.ts +165 -0
- package/src/prove/smt/solver/ref-vector.ts +62 -0
- package/src/prove/smt/solver/relevancy.ts +247 -0
- package/src/prove/smt/solver/rewriter-tpl.ts +1159 -0
- package/src/prove/smt/solver/rewriter.ts +843 -0
- package/src/prove/smt/solver/rlimit.ts +79 -0
- package/src/prove/smt/solver/smtlib-parser.ts +526 -0
- package/src/prove/smt/solver/solver.ts +71 -0
- package/src/prove/smt/solver/sort.ts +35 -0
- package/src/prove/smt/solver/sticky-generations.ts +69 -0
- package/src/prove/smt/solver/theory-lra-axioms.ts +340 -0
- package/src/prove/smt/solver/theory-lra-bounds.ts +226 -0
- package/src/prove/smt/solver/theory-lra-final-check.ts +252 -0
- package/src/prove/smt/solver/theory-lra-internalize.ts +476 -0
- package/src/prove/smt/solver/theory-lra-model.ts +243 -0
- package/src/prove/smt/solver/theory-lra-propagate.ts +405 -0
- package/src/prove/smt/solver/theory-lra-state.ts +43 -0
- package/src/prove/smt/solver/theory-lra.ts +56 -0
- package/src/prove/smt/solver/var-subst.ts +258 -0
- package/src/prove/smt/solver/z3-license.txt +10 -0
- package/src/prove/smt/table.ts +170 -0
- package/src/prove/tlapm/cache.ts +236 -0
- package/src/prove/tlapm/ocaml-marshal.ts +166 -0
- package/src/prove/tlapm/tlapm.ts +96 -0
- package/src/prove/tlaps-module.ts +510 -0
- package/src/prove/verdict.ts +18 -0
- package/src/prove/zenon/LICENSE +32 -0
- package/src/prove/zenon/check/check.ts +105 -0
- package/src/prove/zenon/check/definitions.ts +144 -0
- package/src/prove/zenon/check/equality.ts +182 -0
- package/src/prove/zenon/check/functions.ts +62 -0
- package/src/prove/zenon/check/keys.ts +125 -0
- package/src/prove/zenon/check/propositional.ts +104 -0
- package/src/prove/zenon/check/records.ts +188 -0
- package/src/prove/zenon/check/relations.ts +121 -0
- package/src/prove/zenon/check/rewrites.ts +224 -0
- package/src/prove/zenon/check/sets.ts +302 -0
- package/src/prove/zenon/check/terms.ts +127 -0
- package/src/prove/zenon/check/tla.ts +126 -0
- package/src/prove/zenon/decide.ts +113 -0
- package/src/prove/zenon/encode.ts +379 -0
- package/src/prove/zenon/eqrel.ts +300 -0
- package/src/prove/zenon/equality-rules.ts +435 -0
- package/src/prove/zenon/expr.ts +551 -0
- package/src/prove/zenon/index-table.ts +350 -0
- package/src/prove/zenon/isar-case.ts +513 -0
- package/src/prove/zenon/isar.ts +1249 -0
- package/src/prove/zenon/limits.ts +15 -0
- package/src/prove/zenon/llproof.ts +173 -0
- package/src/prove/zenon/mltoll.ts +1566 -0
- package/src/prove/zenon/node.ts +297 -0
- package/src/prove/zenon/ocaml.ts +169 -0
- package/src/prove/zenon/parse.ts +247 -0
- package/src/prove/zenon/phrase.ts +191 -0
- package/src/prove/zenon/proof.ts +198 -0
- package/src/prove/zenon/propositional-rules.ts +387 -0
- package/src/prove/zenon/rules.ts +94 -0
- package/src/prove/zenon/search.ts +288 -0
- package/src/prove/zenon/tla/functions.ts +151 -0
- package/src/prove/zenon/tla/llproof.ts +480 -0
- package/src/prove/zenon/tla/records.ts +225 -0
- package/src/prove/zenon/tla/rewrites.ts +447 -0
- package/src/prove/zenon/tla/sets.ts +304 -0
- package/src/prove/zenon/tla/terms.ts +162 -0
- package/src/prove/zenon/tla/tla.ts +506 -0
- package/src/randomization.ts +1 -1
- package/src/resolve.ts +1 -1
- package/src/runtime.ts +2 -2
- package/src/{sany-builtins.ts → sany/builtins.ts} +1 -1
- package/src/{sany-generator.ts → sany/generator.ts} +14 -14
- package/src/{sany-levels.ts → sany/levels.ts} +2 -2
- package/src/{sany-lexer.ts → sany/lexer.ts} +1 -1
- package/src/{sany-linter.ts → sany/linter.ts} +1 -1
- package/src/{sany-modules.ts → sany/modules.ts} +2 -2
- package/src/{sany-parse-error.ts → sany/parse-error.ts} +2 -2
- package/src/{sany-report.ts → sany/report.ts} +15 -15
- package/src/{sany-selectors.ts → sany/selectors.ts} +3 -3
- package/src/{sany-source.ts → sany/source.ts} +6 -6
- package/src/{sany-xml.ts → sany/xml.ts} +5 -5
- package/src/spec-description.ts +1 -1
- package/src/{standard-levels.ts → standard/levels.ts} +1 -1
- package/src/{standard-modules.ts → standard/modules.ts} +17 -14
- package/src/{standard-ranges.ts → standard/ranges.ts} +1 -1
- package/src/state-graph.ts +1 -1
- package/src/successors.ts +25 -6
- package/src/symmetry.ts +1 -1
- package/src/{tlc-messages.ts → tlc/messages.ts} +2 -2
- package/src/{tlc-order.ts → tlc/order.ts} +7 -7
- package/src/{tlc-random.ts → tlc/random.ts} +58 -35
- package/src/{tlc-replay.ts → tlc/replay.ts} +5 -5
- package/src/{tlc-module.ts → tlc/tlc-operators.ts} +9 -9
- package/src/{tlc-ext.ts → tlc/tlcext-operators.ts} +14 -8
- package/src/{tlc-version.ts → tlc/version.ts} +8 -7
- package/src/values.ts +81 -36
- package/src/worker.ts +65 -0
- package/dist/parallel.cjs +0 -12
- package/dist/parallel.js +0 -12
- package/dist/run-cli.cjs +0 -55
- package/dist/run-cli.js +0 -55
- package/src/value-sources.ts +0 -29
- /package/src/{sany-nodes.ts → sany/nodes.ts} +0 -0
- /package/src/{tlc-modules.ts → tlc/jar-data.ts} +0 -0
- /package/src/{tlc-summary.ts → tlc/summary.ts} +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
|
-
import type { Module } from "
|
|
4
|
-
import { TlaSyntaxError, PcalRuntimeError, TlaSanyFatalError } from "
|
|
5
|
-
import { extractModule, parseSanyModule } from "
|
|
6
|
-
import { createPcalParams } from "
|
|
7
|
-
import { createPcalSession } from "
|
|
8
|
-
import { validatePcalModule } from "
|
|
9
|
-
import { generateSanySpecification, type SanySpecification } from "./
|
|
10
|
-
import { checkModuleLevels } from "./
|
|
11
|
-
import { getSany174LexicalError } from "./
|
|
12
|
-
import { lintSanyModule } from "./
|
|
13
|
-
import { getSanyStandardModules } from "./
|
|
14
|
-
import { formatSanyLocation, type SanyMessage } from "./
|
|
15
|
-
import { getUnboxedSource } from "./
|
|
16
|
-
import type { TlcVersion } from "
|
|
3
|
+
import type { Module } from "../ast";
|
|
4
|
+
import { TlaSyntaxError, PcalRuntimeError, TlaSanyFatalError } from "../errors";
|
|
5
|
+
import { extractModule, parseSanyModule } from "../parser";
|
|
6
|
+
import { createPcalParams } from "../pcal/ast";
|
|
7
|
+
import { createPcalSession } from "../pcal/parse";
|
|
8
|
+
import { validatePcalModule } from "../pcal/validate";
|
|
9
|
+
import { generateSanySpecification, type SanySpecification } from "./generator";
|
|
10
|
+
import { checkModuleLevels } from "./levels";
|
|
11
|
+
import { getSany174LexicalError } from "./lexer";
|
|
12
|
+
import { lintSanyModule } from "./linter";
|
|
13
|
+
import { getSanyStandardModules } from "./modules";
|
|
14
|
+
import { formatSanyLocation, type SanyMessage } from "./nodes";
|
|
15
|
+
import { getUnboxedSource } from "./source";
|
|
16
|
+
import type { TlcVersion } from "../tlc/version";
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
interface SanyReport {
|
|
19
19
|
text: string;
|
|
20
20
|
isFailed: boolean;
|
|
21
21
|
// The specification SANY analyzes, which has errors when SANY rejects it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Expression } from "
|
|
2
|
-
import type { TlcVersion } from "
|
|
1
|
+
import type { Expression } from "../ast";
|
|
2
|
+
import type { TlcVersion } from "../tlc/version";
|
|
3
3
|
import {
|
|
4
4
|
CONSTANT_DECL_KIND,
|
|
5
5
|
getContextSymbol,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
type SubstInNode,
|
|
20
20
|
type SymbolNode,
|
|
21
21
|
type ThmOrAssumpDefNode,
|
|
22
|
-
} from "./
|
|
22
|
+
} from "./nodes";
|
|
23
23
|
|
|
24
24
|
// A port of SANY's Generator.selectorToNode, which turns a name such as Op(a)!lab(b)!:!2 into the
|
|
25
25
|
// semantic node it names, following the Subexpression algorithm of SANY's Subexpression.tla.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Expression, SourceLocation, SourceRange } from "
|
|
2
|
-
import { TlaSyntaxError } from "
|
|
3
|
-
import { readAtAsIdentifier, tokenize, type Token } from "
|
|
4
|
-
import { getTabStop } from "./
|
|
5
|
-
import { getSanyParseError } from "./
|
|
6
|
-
import type { SanyLocation } from "./
|
|
1
|
+
import type { Expression, SourceLocation, SourceRange } from "../ast";
|
|
2
|
+
import { TlaSyntaxError } from "../errors";
|
|
3
|
+
import { readAtAsIdentifier, tokenize, type Token } from "../lexer";
|
|
4
|
+
import { getTabStop } from "./lexer";
|
|
5
|
+
import { getSanyParseError } from "./parse-error";
|
|
6
|
+
import type { SanyLocation } from "./nodes";
|
|
7
7
|
|
|
8
8
|
// The tokens of one file, to find the locations SANY gives to names, brackets and parentheses that
|
|
9
9
|
// the syntax tree of tla-ts leaves out, and the comments SANY attaches to definitions.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TlaJavaException, TlaUnsupportedError } from "
|
|
2
|
-
import { setExitCode } from "
|
|
3
|
-
import type { TlcVersion } from "
|
|
4
|
-
import type { SanySpecification } from "./
|
|
1
|
+
import { TlaJavaException, TlaUnsupportedError } from "../errors";
|
|
2
|
+
import { setExitCode } from "../exit-codes";
|
|
3
|
+
import type { TlcVersion } from "../tlc/version";
|
|
4
|
+
import type { SanySpecification } from "./generator";
|
|
5
5
|
import {
|
|
6
6
|
CONSTANT_DECL_KIND,
|
|
7
7
|
VARIABLE_DECL_KIND,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type ProofPartNode,
|
|
24
24
|
type InstanceNode,
|
|
25
25
|
type UseOrHideNode,
|
|
26
|
-
} from "./
|
|
26
|
+
} from "./nodes";
|
|
27
27
|
|
|
28
28
|
// XMLExporterExitCode, and the status Java exits with on an exception that nothing catches.
|
|
29
29
|
export const XML_EXPORT_EXIT_CODE = {
|
package/src/spec-description.ts
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { TEMPORAL_LEVEL } from "./levels";
|
|
25
25
|
import { getLevel } from "./liveness";
|
|
26
26
|
import { createRecord, createSet, createTuple, formatValue, type Value } from "./values";
|
|
27
|
-
import type { TlcVersion } from "./tlc
|
|
27
|
+
import type { TlcVersion } from "./tlc/version";
|
|
28
28
|
|
|
29
29
|
export interface SpecAction {
|
|
30
30
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TlaEvaluationError, TlaModuleError } from "
|
|
1
|
+
import { TlaEvaluationError, TlaModuleError } from "../errors";
|
|
2
2
|
import {
|
|
3
3
|
createOverflowError,
|
|
4
4
|
defineArithmetic,
|
|
@@ -16,15 +16,15 @@ import {
|
|
|
16
16
|
getValue,
|
|
17
17
|
isOutOfRange,
|
|
18
18
|
overrideWithJava,
|
|
19
|
-
} from "
|
|
20
|
-
import type { Builtin, BuiltinArgument } from "
|
|
21
|
-
import type { CheckerRuntime } from "
|
|
22
|
-
import { createBagsOperators } from "
|
|
23
|
-
import { createJsonOperators, type FileSystem } from "
|
|
24
|
-
import { createRandomizationOperators } from "
|
|
25
|
-
import { createPossibleOperators, createTlcExtOperators } from "
|
|
26
|
-
import { createTlcOperators } from "
|
|
27
|
-
import { TLC_JAVA_METHODS } from "
|
|
19
|
+
} from "../builtins";
|
|
20
|
+
import type { Builtin, BuiltinArgument } from "../evaluate";
|
|
21
|
+
import type { CheckerRuntime } from "../runtime";
|
|
22
|
+
import { createBagsOperators } from "../bags";
|
|
23
|
+
import { createJsonOperators, type FileSystem } from "../json";
|
|
24
|
+
import { createRandomizationOperators } from "../randomization";
|
|
25
|
+
import { createPossibleOperators, createTlcExtOperators } from "../tlc/tlcext-operators";
|
|
26
|
+
import { createTlcOperators } from "../tlc/tlc-operators";
|
|
27
|
+
import { TLC_JAVA_METHODS } from "../tlc/jar-data";
|
|
28
28
|
import {
|
|
29
29
|
createSet,
|
|
30
30
|
describeKind,
|
|
@@ -56,8 +56,8 @@ import {
|
|
|
56
56
|
type SetValue,
|
|
57
57
|
type Value,
|
|
58
58
|
rankString,
|
|
59
|
-
} from "
|
|
60
|
-
import type { TlcVersion } from "
|
|
59
|
+
} from "../values";
|
|
60
|
+
import type { TlcVersion } from "../tlc/version";
|
|
61
61
|
|
|
62
62
|
interface StandardModule {
|
|
63
63
|
extends: string[];
|
|
@@ -162,8 +162,11 @@ export const CORE_OPERATORS: Builtin[] = [
|
|
|
162
162
|
: differenceSorted;
|
|
163
163
|
// The merge compares the elements, which TLC tests for membership one by one instead.
|
|
164
164
|
return computeLikeTlcOnFailure(
|
|
165
|
-
() => merge(toFiniteSet(
|
|
166
|
-
() =>
|
|
165
|
+
(finiteLeft, finiteRight) => merge(toFiniteSet(finiteLeft), toFiniteSet(finiteRight)),
|
|
166
|
+
(reducibleLeft, reducibleRight) =>
|
|
167
|
+
combineReducible(operator, reducibleLeft, reducibleRight),
|
|
168
|
+
left,
|
|
169
|
+
right,
|
|
167
170
|
);
|
|
168
171
|
}
|
|
169
172
|
if (isReducibleSet(left)) return combineReducible(operator, left, right);
|
package/src/state-graph.ts
CHANGED
package/src/successors.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
toKeepLazyContext,
|
|
26
26
|
getDefinition,
|
|
27
27
|
getContextElements,
|
|
28
|
+
getEntryEvaluator,
|
|
28
29
|
getReevaluatedDefinitions,
|
|
29
30
|
lookupScope,
|
|
30
31
|
resolveApplyOperator,
|
|
@@ -32,11 +33,12 @@ import {
|
|
|
32
33
|
toUnspecifiedSubscriptError,
|
|
33
34
|
type Context,
|
|
34
35
|
type Environment,
|
|
36
|
+
type Evaluator,
|
|
35
37
|
type Scope,
|
|
36
38
|
type State,
|
|
37
39
|
} from "./evaluate";
|
|
38
40
|
import { mapChildren } from "./instances";
|
|
39
|
-
import { isAssignedShortcut, LITERAL_KINDS, replayEnabled } from "./tlc
|
|
41
|
+
import { isAssignedShortcut, LITERAL_KINDS, replayEnabled } from "./tlc/replay";
|
|
40
42
|
import {
|
|
41
43
|
formatValue,
|
|
42
44
|
getStreamedElements,
|
|
@@ -129,12 +131,24 @@ const getIfConditionMessage = (run: Run, value: Value, expression: Expression) =
|
|
|
129
131
|
return `In computing ${getComputation(run)}, a non-boolean expression (${kind}) was used as the condition of an IF.${run.isInit ? "\n" : ""}${range}`;
|
|
130
132
|
};
|
|
131
133
|
|
|
132
|
-
const holds = (run: Run, expression: Expression, context: Context, isWalked = true) =>
|
|
133
|
-
|
|
134
|
+
const holds = (run: Run, expression: Expression, context: Context, isWalked = true) =>
|
|
135
|
+
holdsValue(run, expression, evaluate(expression, context), isWalked);
|
|
136
|
+
|
|
137
|
+
const holdsValue = (run: Run, expression: Expression, value: Value, isWalked = true) => {
|
|
134
138
|
if (typeof value === "boolean") return value;
|
|
135
139
|
throw createRunError(run, getNonBooleanMessage(run, value, expression, isWalked));
|
|
136
140
|
};
|
|
137
141
|
|
|
142
|
+
const evaluateCached = (
|
|
143
|
+
evaluators: (Evaluator | undefined)[],
|
|
144
|
+
index: number,
|
|
145
|
+
expression: Expression,
|
|
146
|
+
context: Context,
|
|
147
|
+
) =>
|
|
148
|
+
context.environment.callStack
|
|
149
|
+
? evaluate(expression, context)
|
|
150
|
+
: (evaluators[index] ??= getEntryEvaluator(expression, context.environment))(context);
|
|
151
|
+
|
|
138
152
|
const isAssignmentOperator = (operator: string) =>
|
|
139
153
|
operator === "=" || operator === "\\in" || operator === "\\subseteq";
|
|
140
154
|
|
|
@@ -357,6 +371,8 @@ const compileConjunction = (
|
|
|
357
371
|
isInit: boolean,
|
|
358
372
|
): Runner => {
|
|
359
373
|
const conjuncts = operands.map((operand) => toConjunct(operand, environment, isInit));
|
|
374
|
+
const evaluators: (Evaluator | undefined)[] = [];
|
|
375
|
+
const restEvaluators: (Evaluator | undefined)[] = [];
|
|
360
376
|
const runFrom = (
|
|
361
377
|
start: number,
|
|
362
378
|
run: Run,
|
|
@@ -372,7 +388,9 @@ const compileConjunction = (
|
|
|
372
388
|
if (index > 0 && isShortcut && isComplete(current)) {
|
|
373
389
|
context ??= getContext(run, scope, current);
|
|
374
390
|
for (let rest = index; rest < conjuncts.length; rest++) {
|
|
375
|
-
|
|
391
|
+
const expression = conjuncts[rest].expression;
|
|
392
|
+
const value = evaluateCached(restEvaluators, rest, expression, context);
|
|
393
|
+
if (!holdsValue(run, expression, value, false)) return;
|
|
376
394
|
}
|
|
377
395
|
onComplete(current, action);
|
|
378
396
|
return;
|
|
@@ -380,12 +398,13 @@ const compileConjunction = (
|
|
|
380
398
|
const conjunct = conjuncts[index];
|
|
381
399
|
if (conjunct.kind === "Guard") {
|
|
382
400
|
context ??= getContext(run, scope, current);
|
|
383
|
-
|
|
401
|
+
const value = evaluateCached(evaluators, index, conjunct.expression, context);
|
|
402
|
+
if (!holdsValue(run, conjunct.expression, value)) return;
|
|
384
403
|
continue;
|
|
385
404
|
}
|
|
386
405
|
if (conjunct.kind === "Assign") {
|
|
387
406
|
context ??= getContext(run, scope, current);
|
|
388
|
-
const value =
|
|
407
|
+
const value = evaluateCached(evaluators, index, conjunct.value, context);
|
|
389
408
|
const assigned = current[conjunct.index];
|
|
390
409
|
if (assigned === undefined) {
|
|
391
410
|
current = assign(current, conjunct.index, value);
|
package/src/symmetry.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Expression } from "./ast";
|
|
|
2
2
|
import type { Substitution } from "./config";
|
|
3
3
|
import { TlaConfigError, TlaEvaluationError, UNEXPECTED_EXCEPTION } from "./errors";
|
|
4
4
|
import { EXIT_STATUS, setExitCode } from "./exit-codes";
|
|
5
|
-
import { MESSAGE_CODE } from "./tlc
|
|
5
|
+
import { MESSAGE_CODE } from "./tlc/messages";
|
|
6
6
|
import { evaluate, type Environment } from "./evaluate";
|
|
7
7
|
import {
|
|
8
8
|
compareValues,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { STACK_OVERFLOW_MESSAGE, TlaModuleError, type TlaEvaluationError } from "
|
|
2
|
-
import type { TlcVersion } from "./
|
|
1
|
+
import { STACK_OVERFLOW_MESSAGE, TlaModuleError, type TlaEvaluationError } from "../errors";
|
|
2
|
+
import type { TlcVersion } from "./version";
|
|
3
3
|
|
|
4
4
|
// TLC's codes for the messages it prints, from tlc2.output.EC.
|
|
5
5
|
export const MESSAGE_CODE = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// TLC orders strings and model values by when it first interned their text, and compares a
|
|
2
2
|
// state's variables in the order of SANY's symbol table. This reproduces both orders.
|
|
3
|
-
import type { Module, SourceLocation } from "
|
|
4
|
-
import type { ConfigValue, ModelConfig } from "
|
|
5
|
-
import { createMissingModuleError } from "
|
|
6
|
-
import { tokenize, type Token } from "
|
|
7
|
-
import { extractModule, parseModule } from "
|
|
8
|
-
import { isBefore } from "
|
|
3
|
+
import type { Module, SourceLocation } from "../ast";
|
|
4
|
+
import type { ConfigValue, ModelConfig } from "../config";
|
|
5
|
+
import { createMissingModuleError } from "../errors";
|
|
6
|
+
import { tokenize, type Token } from "../lexer";
|
|
7
|
+
import { extractModule, parseModule } from "../parser";
|
|
8
|
+
import { isBefore } from "../resolve";
|
|
9
9
|
import {
|
|
10
10
|
SANY_BUILTINS,
|
|
11
11
|
SANY_NODE_NAMES,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
TLC_RUNTIME_STRINGS,
|
|
15
15
|
TLC_STARTUP_STRINGS,
|
|
16
16
|
USER_STANDARD_MODULES,
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./jar-data";
|
|
18
18
|
|
|
19
19
|
type SymbolKind = "builtin" | "constant" | "variable" | "definition" | "theorem" | "module";
|
|
20
20
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TlaEvaluationError } from "
|
|
2
|
-
import type { TlcVersion } from "./
|
|
1
|
+
import { TlaEvaluationError } from "../errors";
|
|
2
|
+
import type { TlcVersion } from "./version";
|
|
3
3
|
import {
|
|
4
4
|
createRecord,
|
|
5
5
|
createSortedFunction,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
toFiniteFunction,
|
|
13
13
|
toFiniteSet,
|
|
14
14
|
type Value,
|
|
15
|
-
} from "
|
|
15
|
+
} from "../values";
|
|
16
16
|
|
|
17
17
|
export interface JavaRandom {
|
|
18
18
|
setSeed: (seed: bigint) => void;
|
|
@@ -182,24 +182,14 @@ const createShiftTable = (length: number) => {
|
|
|
182
182
|
|
|
183
183
|
// Extending a fingerprint by a byte is linear over GF(2), so extending it by a value's bytes
|
|
184
184
|
// XORs the value's own fingerprint from zero into the fingerprint shifted by their length.
|
|
185
|
-
// The fingerprinter caches each distinct
|
|
186
|
-
//
|
|
187
|
-
// `words`, an Int32Array over a
|
|
185
|
+
// The fingerprinter caches each distinct function or set it meets, nested ones included, for one
|
|
186
|
+
// pass over the stored states, as states share most of their values. It reads a state's variables
|
|
187
|
+
// in `order` and writes each fingerprint's low and high words into `words`, an Int32Array over a
|
|
188
|
+
// little-endian BigInt64Array.
|
|
188
189
|
export const createTlcFingerprinter = (order: number[], words: Int32Array) => {
|
|
189
190
|
const shiftTables = new Map<number, Int32Array>();
|
|
190
191
|
const indices = new Map<Value, number>();
|
|
191
192
|
const contributions: number[] = [];
|
|
192
|
-
const getContribution = (value: Value) => {
|
|
193
|
-
const cached = indices.get(value);
|
|
194
|
-
if (cached !== undefined) return cached;
|
|
195
|
-
const length = getFingerprintLength(value);
|
|
196
|
-
high = 0;
|
|
197
|
-
low = 0;
|
|
198
|
-
extendValue(value);
|
|
199
|
-
indices.set(value, contributions.length);
|
|
200
|
-
contributions.push(length, high, low);
|
|
201
|
-
return contributions.length - 3;
|
|
202
|
-
};
|
|
203
193
|
const getShiftTable = (length: number) => {
|
|
204
194
|
const cached = shiftTables.get(length);
|
|
205
195
|
if (cached) return cached;
|
|
@@ -207,29 +197,62 @@ export const createTlcFingerprinter = (order: number[], words: Int32Array) => {
|
|
|
207
197
|
shiftTables.set(length, table);
|
|
208
198
|
return table;
|
|
209
199
|
};
|
|
210
|
-
|
|
200
|
+
// Extends the fingerprint by a value's bytes and returns how many there are.
|
|
201
|
+
const extendElement = (value: Value): number => {
|
|
202
|
+
if (typeof value !== "object" || isModelValue(value)) {
|
|
203
|
+
extendValue(value);
|
|
204
|
+
return getFingerprintLength(value);
|
|
205
|
+
}
|
|
206
|
+
const contribution = getContribution(value);
|
|
207
|
+
const shifted = { high, low };
|
|
208
|
+
const table = getShiftTable(contributions[contribution]);
|
|
209
|
+
high = contributions[contribution + 1];
|
|
210
|
+
low = contributions[contribution + 2];
|
|
211
|
+
for (let position = 0; position < 8; position++) {
|
|
212
|
+
const word = position < 4 ? shifted.low : shifted.high;
|
|
213
|
+
const entry = (position * 256 + ((word >>> ((position & 3) * 8)) & 0xff)) * 2;
|
|
214
|
+
high ^= table[entry];
|
|
215
|
+
low ^= table[entry + 1];
|
|
216
|
+
}
|
|
217
|
+
return contributions[contribution];
|
|
218
|
+
};
|
|
219
|
+
const getContribution = (value: Value) => {
|
|
220
|
+
const cached = indices.get(value);
|
|
221
|
+
if (cached !== undefined) return cached;
|
|
211
222
|
const outer = { high, low };
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const entry = (position * 256 + ((word >>> ((position & 3) * 8)) & 0xff)) * 2;
|
|
223
|
-
extended.high ^= table[entry];
|
|
224
|
-
extended.low ^= table[entry + 1];
|
|
223
|
+
high = 0;
|
|
224
|
+
low = 0;
|
|
225
|
+
const length = { value: 5 };
|
|
226
|
+
if (isFunctionValue(value)) {
|
|
227
|
+
const functionValue = toFiniteFunction(value);
|
|
228
|
+
extendByte(FCN_RCD_VALUE);
|
|
229
|
+
extendInt(functionValue.domain.length);
|
|
230
|
+
for (let index = 0; index < functionValue.domain.length; index++) {
|
|
231
|
+
length.value += extendElement(functionValue.domain[index]);
|
|
232
|
+
length.value += extendElement(functionValue.range[index]);
|
|
225
233
|
}
|
|
226
|
-
|
|
227
|
-
|
|
234
|
+
} else {
|
|
235
|
+
const elements = toFiniteSet(value).elements;
|
|
236
|
+
extendByte(SET_ENUM_VALUE);
|
|
237
|
+
extendInt(elements.length);
|
|
238
|
+
for (const element of elements) length.value += extendElement(element);
|
|
228
239
|
}
|
|
240
|
+
const contribution = contributions.length;
|
|
241
|
+
indices.set(value, contribution);
|
|
242
|
+
contributions.push(length.value, high, low);
|
|
243
|
+
high = outer.high;
|
|
244
|
+
low = outer.low;
|
|
245
|
+
return contribution;
|
|
246
|
+
};
|
|
247
|
+
return (state: Value[], position: number) => {
|
|
248
|
+
const outer = { high, low };
|
|
249
|
+
high = INITIAL_HIGH;
|
|
250
|
+
low = INITIAL_LOW;
|
|
251
|
+
for (const index of order) extendElement(state[index]);
|
|
252
|
+
words[2 * position] = low;
|
|
253
|
+
words[2 * position + 1] = high;
|
|
229
254
|
high = outer.high;
|
|
230
255
|
low = outer.low;
|
|
231
|
-
words[2 * position] = fingerprint.low;
|
|
232
|
-
words[2 * position + 1] = fingerprint.high;
|
|
233
256
|
};
|
|
234
257
|
};
|
|
235
258
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Expression, SourceLocation } from "
|
|
2
|
-
import { TlaEvaluationError } from "
|
|
1
|
+
import type { Expression, SourceLocation } from "../ast";
|
|
2
|
+
import { TlaEvaluationError } from "../errors";
|
|
3
3
|
import {
|
|
4
4
|
bindDefinitions,
|
|
5
5
|
bindLazyArguments,
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
type Scope,
|
|
20
20
|
type State,
|
|
21
21
|
toUnspecifiedSubscriptError,
|
|
22
|
-
} from "
|
|
23
|
-
import { getStreamedElements, isTlcEnumerable, setTrace, valuesEqual, type Value } from "
|
|
22
|
+
} from "../evaluate";
|
|
23
|
+
import { getStreamedElements, isTlcEnumerable, setTrace, valuesEqual, type Value } from "../values";
|
|
24
24
|
|
|
25
25
|
// When TLC fails to compute the initial states or the successors of a state, it computes them
|
|
26
26
|
// again with its CallStackTool, which records each node it visits, and prints where the failure
|
|
@@ -28,7 +28,7 @@ import { getStreamedElements, isTlcEnumerable, setTrace, valuesEqual, type Value
|
|
|
28
28
|
// Tool.getNextStates do, in their order and with their nesting, so that it records the nodes TLC
|
|
29
29
|
// records. It evaluates the other expressions with an environment that records the nodes too.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
interface ReplayAction {
|
|
32
32
|
expression: Expression;
|
|
33
33
|
scope: Scope | undefined;
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TlaModuleError } from "
|
|
2
|
-
import { EXIT_STATUS } from "
|
|
3
|
-
import type { Builtin, Context } from "
|
|
4
|
-
import { prettyPrint } from "
|
|
1
|
+
import { TlaModuleError } from "../errors";
|
|
2
|
+
import { EXIT_STATUS } from "../exit-codes";
|
|
3
|
+
import type { Builtin, Context } from "../evaluate";
|
|
4
|
+
import { prettyPrint } from "../pretty-print";
|
|
5
5
|
import {
|
|
6
6
|
defineConstant,
|
|
7
7
|
defineHigherOrderOperator,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
getThunk,
|
|
17
17
|
getValue,
|
|
18
18
|
overrideWithJava,
|
|
19
|
-
} from "
|
|
20
|
-
import { getNamedRegisters, NAMED_REGISTER_PREFIX, type CheckerRuntime } from "
|
|
21
|
-
import { createActionRecord, setTlcValue } from "./
|
|
22
|
-
import { getRandomElement } from "./
|
|
19
|
+
} from "../builtins";
|
|
20
|
+
import { getNamedRegisters, NAMED_REGISTER_PREFIX, type CheckerRuntime } from "../runtime";
|
|
21
|
+
import { createActionRecord, setTlcValue } from "./tlcext-operators";
|
|
22
|
+
import { getRandomElement } from "./random";
|
|
23
23
|
import {
|
|
24
24
|
ANY_SET,
|
|
25
25
|
createFunction,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
toFiniteSet,
|
|
33
33
|
type Value,
|
|
34
34
|
rankString,
|
|
35
|
-
} from "
|
|
35
|
+
} from "../values";
|
|
36
36
|
|
|
37
37
|
const padTime = (value: number) => String(value).padStart(2, "0");
|
|
38
38
|
|
|
@@ -7,18 +7,24 @@ import {
|
|
|
7
7
|
getOperator,
|
|
8
8
|
getThunk,
|
|
9
9
|
getValue,
|
|
10
|
-
} from "
|
|
11
|
-
import { TlaEvaluationError, TlaModuleError, TlaUnsupportedError } from "
|
|
12
|
-
import { getTlcFingerprint } from "./
|
|
13
|
-
import { formatNestedMessage } from "./
|
|
14
|
-
import {
|
|
15
|
-
|
|
10
|
+
} from "../builtins";
|
|
11
|
+
import { TlaEvaluationError, TlaModuleError, TlaUnsupportedError } from "../errors";
|
|
12
|
+
import { getTlcFingerprint } from "./random";
|
|
13
|
+
import { formatNestedMessage } from "./messages";
|
|
14
|
+
import {
|
|
15
|
+
evaluate,
|
|
16
|
+
expectBoolean,
|
|
17
|
+
getDefinition,
|
|
18
|
+
type Builtin,
|
|
19
|
+
type Environment,
|
|
20
|
+
} from "../evaluate";
|
|
21
|
+
import { getChildren, isLocallyResolved, type Definition, type Expression } from "../ast";
|
|
16
22
|
import {
|
|
17
23
|
getNamedRegisters,
|
|
18
24
|
getPossibleCounts,
|
|
19
25
|
NAMED_REGISTER_PREFIX,
|
|
20
26
|
type CheckerRuntime,
|
|
21
|
-
} from "
|
|
27
|
+
} from "../runtime";
|
|
22
28
|
import {
|
|
23
29
|
applyFunction,
|
|
24
30
|
createModelValue,
|
|
@@ -33,7 +39,7 @@ import {
|
|
|
33
39
|
toFiniteSet,
|
|
34
40
|
valuesEqual,
|
|
35
41
|
type Value,
|
|
36
|
-
} from "
|
|
42
|
+
} from "../values";
|
|
37
43
|
|
|
38
44
|
const OVERRIDE_PARAMETERS =
|
|
39
45
|
"tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { strFromU8, unzipSync } from "fflate";
|
|
3
2
|
|
|
4
3
|
// The TLC whose output tla-ts reproduces: the 1.7.4 release, or the master builds that tla-ts
|
|
5
4
|
// follows for any other tla2tools.jar.
|
|
@@ -7,12 +6,14 @@ export type TlcVersion = "1.7.4" | "master";
|
|
|
7
6
|
|
|
8
7
|
const MANIFEST = "META-INF/MANIFEST.MF";
|
|
9
8
|
|
|
10
|
-
// The version of a tla2tools.jar, from the Git tag that its manifest records.
|
|
11
|
-
|
|
9
|
+
// The version of a tla2tools.jar, from the Git tag that its manifest records. fflate loads
|
|
10
|
+
// node:worker_threads, so only a run with a jar imports it.
|
|
11
|
+
export const getTlcVersion = async (jar: string | undefined): Promise<TlcVersion> => {
|
|
12
12
|
if (jar === undefined || !existsSync(jar)) return "master";
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const fflate = await import("fflate");
|
|
14
|
+
const manifest = fflate.unzipSync(readFileSync(jar), {
|
|
15
|
+
filter: (file) => file.name === MANIFEST,
|
|
16
|
+
})[MANIFEST];
|
|
17
|
+
const tag = manifest && /^X-Git-Tag: *(\S*)/m.exec(fflate.strFromU8(manifest))?.[1];
|
|
17
18
|
return tag === "v1.7.4" ? "1.7.4" : "master";
|
|
18
19
|
};
|