tla-ts 0.0.9 → 0.0.10-dev.63a6693bd
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 +29 -1
- package/dist/compile.cjs +23 -0
- package/dist/compile.js +23 -0
- package/dist/deciders.cjs +29 -29
- package/dist/deciders.js +42 -42
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +106 -10
- package/dist/index.d.ts +106 -10
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove-worker.cjs +1 -1
- package/dist/prove-worker.js +1 -1
- package/dist/prove.cjs +117 -37
- package/dist/prove.js +116 -36
- package/dist/run.cjs +143 -31
- package/dist/run.js +143 -31
- package/dist/tlapm.cjs +2 -2
- package/dist/tlapm.js +2 -2
- package/dist/transfer.cjs +129 -104
- package/dist/transfer.js +129 -104
- package/dist/worker.cjs +7 -7
- package/dist/worker.js +7 -7
- package/package.json +3 -1
- package/src/ast.ts +48 -62
- package/src/bags.ts +99 -102
- package/src/builtins.ts +28 -75
- package/src/bundled-modules.ts +1 -8
- package/src/check-failure.ts +116 -0
- package/src/check-trace.ts +282 -0
- package/src/check.ts +599 -754
- package/src/cli/options.ts +12 -32
- package/src/cli/run.ts +0 -2
- package/src/cli/runtime-invariants.ts +136 -0
- package/src/cli/shared.ts +19 -12
- package/src/cli/tlapm.ts +14 -25
- package/src/cli/tlc-arguments.ts +652 -0
- package/src/cli/tlc-output.ts +687 -0
- package/src/cli/tlc-usage.ts +361 -0
- package/src/cli/tlc.ts +309 -658
- package/src/cli/typescript.ts +23 -0
- package/src/cli/xml-exporter.ts +27 -49
- package/src/cli.ts +0 -1
- package/src/codegen.ts +196 -74
- package/src/config.ts +140 -109
- package/src/coverage.ts +830 -0
- package/src/dependencies.ts +14 -53
- package/src/dfid.ts +618 -0
- package/src/environment-config.ts +315 -0
- package/src/environment.ts +169 -335
- package/src/errors.ts +71 -55
- package/src/evaluate.ts +598 -340
- package/src/exit-codes.ts +37 -3
- package/src/fingerprints.ts +75 -11
- package/src/index.ts +3 -0
- package/src/instances.ts +126 -21
- package/src/java-hash.ts +7 -0
- package/src/java-overrides.ts +4 -19
- package/src/json-reader.ts +455 -0
- package/src/json.ts +252 -139
- package/src/levels.ts +46 -58
- package/src/lexer.ts +80 -100
- package/src/liveness-checker.ts +103 -153
- package/src/liveness.ts +150 -109
- package/src/obligations/action.ts +8 -39
- package/src/obligations/anonymize.ts +88 -82
- package/src/obligations/equality.ts +1 -1
- package/src/obligations/expression.ts +20 -21
- package/src/obligations/format.ts +1 -9
- package/src/obligations/generate.ts +46 -49
- package/src/obligations/index.ts +2 -13
- package/src/obligations/levels.ts +4 -8
- package/src/obligations/module.ts +28 -53
- package/src/obligations/normalize.ts +7 -25
- package/src/obligations/operators.ts +1 -2
- package/src/obligations/pragma.ts +1 -10
- package/src/obligations/printer.ts +47 -46
- package/src/obligations/proof.ts +1 -5
- package/src/obligations/regroup.ts +1 -4
- package/src/obligations/simplify.ts +42 -58
- package/src/obligations/source.ts +48 -78
- package/src/obligations/subexpression.ts +5 -11
- package/src/obligations/substitution.ts +1 -3
- package/src/obligations/temporal.ts +13 -19
- package/src/obligations/tuples.ts +3 -9
- package/src/parallel-worker.ts +30 -60
- package/src/parallel.ts +57 -71
- package/src/parser.ts +584 -316
- package/src/pcal/ast.ts +53 -86
- package/src/pcal/parse.ts +144 -219
- package/src/pcal/tokenize.ts +91 -131
- package/src/pcal/translate.ts +83 -130
- package/src/pcal/validate.ts +48 -68
- package/src/pretty-print.ts +7 -8
- package/src/prover/decide-pool.ts +8 -13
- package/src/prover/deciders.ts +3 -7
- package/src/prover/first-order.ts +0 -11
- package/src/prover/isabelle/decide.ts +0 -6
- package/src/prover/isabelle/encode.ts +11 -23
- package/src/prover/isabelle/isar/inner-syntax.ts +114 -115
- package/src/prover/isabelle/isar/method.ts +29 -53
- package/src/prover/isabelle/isar/proof.ts +1 -10
- package/src/prover/isabelle/isar/statement.ts +1 -6
- package/src/prover/isabelle/isar/theory.ts +26 -36
- package/src/prover/isabelle/isar/type-check.ts +17 -31
- package/src/prover/isabelle/provers/blast/blast.ts +17 -104
- package/src/prover/isabelle/provers/blast/branch.ts +1 -32
- package/src/prover/isabelle/provers/blast/prove.ts +1 -35
- package/src/prover/isabelle/provers/blast/rules.ts +6 -44
- package/src/prover/isabelle/provers/blast/state.ts +2 -28
- package/src/prover/isabelle/provers/blast/term.ts +9 -36
- package/src/prover/isabelle/provers/clasimp.ts +1 -13
- package/src/prover/isabelle/provers/classical.ts +14 -42
- package/src/prover/isabelle/provers/hypsubst.ts +28 -51
- package/src/prover/isabelle/pure/bicompose.ts +25 -38
- package/src/prover/isabelle/pure/consts.ts +1 -7
- package/src/prover/isabelle/pure/conv.ts +3 -17
- package/src/prover/isabelle/pure/drule.ts +33 -42
- package/src/prover/isabelle/pure/envir.ts +3 -52
- package/src/prover/isabelle/pure/goal.ts +1 -7
- package/src/prover/isabelle/pure/interrupt.ts +0 -5
- package/src/prover/isabelle/pure/list.ts +0 -3
- package/src/prover/isabelle/pure/logic.ts +2 -15
- package/src/prover/isabelle/pure/name.ts +2 -9
- package/src/prover/isabelle/pure/net.ts +3 -59
- package/src/prover/isabelle/pure/object-logic.ts +3 -10
- package/src/prover/isabelle/pure/pattern.ts +2 -19
- package/src/prover/isabelle/pure/raw-simplifier.ts +17 -62
- package/src/prover/isabelle/pure/rewriter.ts +31 -67
- package/src/prover/isabelle/pure/search.ts +3 -10
- package/src/prover/isabelle/pure/seq.ts +1 -10
- package/src/prover/isabelle/pure/simplifier.ts +4 -12
- package/src/prover/isabelle/pure/table.ts +3 -32
- package/src/prover/isabelle/pure/tactic.ts +12 -22
- package/src/prover/isabelle/pure/tactical.ts +48 -47
- package/src/prover/isabelle/pure/term-ord.ts +2 -6
- package/src/prover/isabelle/pure/term.ts +2 -43
- package/src/prover/isabelle/pure/thm.ts +27 -47
- package/src/prover/isabelle/pure/type.ts +2 -15
- package/src/prover/isabelle/pure/unify.ts +20 -30
- package/src/prover/isabelle/pure/variable.ts +3 -7
- package/src/prover/isabelle/tla/classical-setup.ts +17 -24
- package/src/prover/isabelle/tla/context.ts +15 -18
- package/src/prover/isabelle/tla/logic.ts +14 -32
- package/src/prover/isabelle/tla/simpdata.ts +46 -43
- package/src/prover/isabelle/tools/intuitionistic.ts +1 -10
- package/src/prover/ocaml.ts +0 -6
- package/src/prover/prep/action.ts +14 -54
- package/src/prover/prep/enabled-axioms.ts +12 -19
- package/src/prover/prep/fingerprint.ts +2 -21
- package/src/prover/prep/level-comparison.ts +8 -12
- package/src/prover/prep/md5.ts +0 -2
- package/src/prover/prep/methods.ts +33 -39
- package/src/prover/prep/normalize.ts +4 -28
- package/src/prover/prove-worker.ts +0 -2
- package/src/prover/prove.ts +87 -100
- package/src/prover/ptl/decide.ts +7 -12
- package/src/prover/ptl/encode.ts +14 -36
- package/src/prover/ptl/sat.ts +24 -32
- package/src/prover/ptl/tableau.ts +12 -26
- package/src/prover/smt/axioms.ts +0 -7
- package/src/prover/smt/context.ts +20 -28
- package/src/prover/smt/data.ts +433 -424
- package/src/prover/smt/encode.ts +43 -52
- package/src/prover/smt/extensionality.ts +0 -10
- package/src/prover/smt/flatten.ts +3 -22
- package/src/prover/smt/format.ts +5 -10
- package/src/prover/smt/instances.ts +0 -10
- package/src/prover/smt/rewrite.ts +663 -667
- package/src/prover/smt/solver/act-cache.ts +0 -15
- package/src/prover/smt/solver/arith-rewriter.ts +3 -48
- package/src/prover/smt/solver/array.ts +1 -3
- package/src/prover/smt/solver/asserted-formulas.ts +1 -43
- package/src/prover/smt/solver/ast-lt.ts +1 -11
- package/src/prover/smt/solver/ast-util.ts +1 -6
- package/src/prover/smt/solver/ast.ts +1 -165
- package/src/prover/smt/solver/auf-solver.ts +8 -44
- package/src/prover/smt/solver/case-split-queue.ts +1 -9
- package/src/prover/smt/solver/cg-table.ts +1 -18
- package/src/prover/smt/solver/clause.ts +1 -27
- package/src/prover/smt/solver/conflict-resolution.ts +0 -9
- package/src/prover/smt/solver/context.ts +7 -64
- package/src/prover/smt/solver/ctx-simplify.ts +14 -41
- package/src/prover/smt/solver/der.ts +2 -21
- package/src/prover/smt/solver/dyn-ack.ts +1 -11
- package/src/prover/smt/solver/e-matching.ts +4 -35
- package/src/prover/smt/solver/enode.ts +1 -21
- package/src/prover/smt/solver/expr-ref.ts +1 -5
- package/src/prover/smt/solver/expr-safe-replace.ts +1 -6
- package/src/prover/smt/solver/fingerprints.ts +1 -12
- package/src/prover/smt/solver/flat-literals.ts +1 -9
- package/src/prover/smt/solver/goal.ts +2 -14
- package/src/prover/smt/solver/hash.ts +0 -8
- package/src/prover/smt/solver/hashtable.ts +1 -12
- package/src/prover/smt/solver/internalizer.ts +7 -100
- package/src/prover/smt/solver/lbool.ts +1 -2
- package/src/prover/smt/solver/literal.ts +0 -3
- package/src/prover/smt/solver/lp/bound-propagator.ts +8 -26
- package/src/prover/smt/solver/lp/constraints.ts +2 -8
- package/src/prover/smt/solver/lp/containers.ts +12 -30
- package/src/prover/smt/solver/lp/core-solver.ts +10 -31
- package/src/prover/smt/solver/lp/cross-nested.ts +6 -20
- package/src/prover/smt/solver/lp/dep-intervals.ts +7 -22
- package/src/prover/smt/solver/lp/dependency.ts +1 -4
- package/src/prover/smt/solver/lp/dioph-eq.ts +9 -102
- package/src/prover/smt/solver/lp/explanation.ts +1 -6
- package/src/prover/smt/solver/lp/gomory.ts +9 -22
- package/src/prover/smt/solver/lp/hnf-cutter.ts +17 -23
- package/src/prover/smt/solver/lp/hnf.ts +11 -26
- package/src/prover/smt/solver/lp/int-cube.ts +15 -36
- package/src/prover/smt/solver/lp/int-solver.ts +4 -34
- package/src/prover/smt/solver/lp/lar-solver.ts +32 -81
- package/src/prover/smt/solver/lp/lar-term.ts +1 -5
- package/src/prover/smt/solver/lp/lp-settings.ts +1 -14
- package/src/prover/smt/solver/lp/maximize-term.ts +20 -45
- package/src/prover/smt/solver/lp/nex-creator.ts +5 -28
- package/src/prover/smt/solver/lp/nex.ts +1 -6
- package/src/prover/smt/solver/lp/nla-backoff.ts +1 -4
- package/src/prover/smt/solver/lp/nla-basics.ts +5 -30
- package/src/prover/smt/solver/lp/nla-core.ts +36 -135
- package/src/prover/smt/solver/lp/nla-divisions.ts +32 -42
- package/src/prover/smt/solver/lp/nla-emonics.ts +4 -21
- package/src/prover/smt/solver/lp/nla-factorization.ts +1 -4
- package/src/prover/smt/solver/lp/nla-grobner.ts +15 -69
- package/src/prover/smt/solver/lp/nla-horner.ts +3 -11
- package/src/prover/smt/solver/lp/nla-intervals.ts +2 -12
- package/src/prover/smt/solver/lp/nla-monomial-bounds.ts +16 -41
- package/src/prover/smt/solver/lp/nla-monotone.ts +2 -6
- package/src/prover/smt/solver/lp/nla-order.ts +2 -13
- package/src/prover/smt/solver/lp/nla-patcher.ts +4 -7
- package/src/prover/smt/solver/lp/nla-tangents.ts +1 -9
- package/src/prover/smt/solver/lp/nla-throttle.ts +1 -6
- package/src/prover/smt/solver/lp/nla-types.ts +1 -11
- package/src/prover/smt/solver/lp/nla-var-eqs.ts +4 -25
- package/src/prover/smt/solver/lp/nra-solver.ts +5 -52
- package/src/prover/smt/solver/lp/numeric-pair.ts +1 -4
- package/src/prover/smt/solver/lp/pdd-interval.ts +1 -3
- package/src/prover/smt/solver/lp/pdd-simplifier.ts +2 -14
- package/src/prover/smt/solver/lp/pdd-solver.ts +4 -33
- package/src/prover/smt/solver/lp/pdd.ts +7 -70
- package/src/prover/smt/solver/lp/random-updater.ts +1 -8
- package/src/prover/smt/solver/lp/static-matrix.ts +9 -19
- package/src/prover/smt/solver/lp/union-find.ts +1 -6
- package/src/prover/smt/solver/mam-compiler.ts +18 -58
- package/src/prover/smt/solver/mam-interpreter.ts +1 -21
- package/src/prover/smt/solver/maximize-ac-sharing.ts +2 -17
- package/src/prover/smt/solver/model-checker.ts +3 -37
- package/src/prover/smt/solver/model-evaluator.ts +3 -29
- package/src/prover/smt/solver/model-finder.ts +15 -32
- package/src/prover/smt/solver/model-generator.ts +1 -12
- package/src/prover/smt/solver/model-macro-solver.ts +23 -88
- package/src/prover/smt/solver/nlsat/algebraic.ts +63 -159
- package/src/prover/smt/solver/nlsat/atoms.ts +25 -23
- package/src/prover/smt/solver/nlsat/evaluator.ts +17 -22
- package/src/prover/smt/solver/nlsat/explain.ts +10 -69
- package/src/prover/smt/solver/nlsat/interval-set.ts +9 -50
- package/src/prover/smt/solver/nlsat/levelwise.ts +49 -135
- package/src/prover/smt/solver/nlsat/mpbq.ts +3 -14
- package/src/prover/smt/solver/nlsat/polynomial.ts +29 -159
- package/src/prover/smt/solver/nlsat/solver.ts +18 -90
- package/src/prover/smt/solver/nlsat/types.ts +1 -8
- package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +2 -45
- package/src/prover/smt/solver/nlsat/upolynomial.ts +11 -92
- package/src/prover/smt/solver/nnf.ts +3 -38
- package/src/prover/smt/solver/pattern-inference.ts +2 -15
- package/src/prover/smt/solver/poly-rewriter.ts +3 -23
- package/src/prover/smt/solver/propagate-values.ts +1 -10
- package/src/prover/smt/solver/proto-model.ts +3 -52
- package/src/prover/smt/solver/pull-quant.ts +1 -12
- package/src/prover/smt/solver/qe-lite-der.ts +1 -29
- package/src/prover/smt/solver/qe-lite-fm.ts +2 -25
- package/src/prover/smt/solver/qe-lite.ts +3 -33
- package/src/prover/smt/solver/qi-queue.ts +1 -16
- package/src/prover/smt/solver/quant-tactics.ts +5 -22
- package/src/prover/smt/solver/quantifier-analyzer.ts +27 -47
- package/src/prover/smt/solver/quantifier-manager.ts +2 -13
- package/src/prover/smt/solver/random-gen.ts +1 -2
- package/src/prover/smt/solver/rational.ts +1 -8
- package/src/prover/smt/solver/ref-vector.ts +1 -6
- package/src/prover/smt/solver/relevancy.ts +2 -15
- package/src/prover/smt/solver/rewriter-tpl.ts +3 -147
- package/src/prover/smt/solver/rewriter.ts +3 -85
- package/src/prover/smt/solver/rlimit.ts +2 -20
- package/src/prover/smt/solver/smtlib-parser.ts +80 -131
- package/src/prover/smt/solver/solver.ts +23 -34
- package/src/prover/smt/solver/sort.ts +1 -5
- package/src/prover/smt/solver/sticky-generations.ts +0 -5
- package/src/prover/smt/solver/theory-lra-axioms.ts +3 -24
- package/src/prover/smt/solver/theory-lra-bounds.ts +1 -7
- package/src/prover/smt/solver/theory-lra-final-check.ts +4 -22
- package/src/prover/smt/solver/theory-lra-internalize.ts +6 -43
- package/src/prover/smt/solver/theory-lra-model.ts +4 -19
- package/src/prover/smt/solver/theory-lra-propagate.ts +1 -15
- package/src/prover/smt/solver/theory-lra-state.ts +3 -8
- package/src/prover/smt/solver/theory-lra.ts +1 -8
- package/src/prover/smt/solver/var-subst.ts +2 -26
- package/src/prover/smt/table.ts +0 -8
- package/src/prover/tlapm/cache.ts +45 -40
- package/src/prover/tlapm/ocaml-marshal.ts +19 -21
- package/src/prover/tlapm/tlapm.ts +21 -20
- package/src/prover/verdict.ts +7 -2
- package/src/prover/zenon/check/check.ts +1 -11
- package/src/prover/zenon/check/definitions.ts +5 -15
- package/src/prover/zenon/check/equality.ts +0 -8
- package/src/prover/zenon/check/functions.ts +0 -4
- package/src/prover/zenon/check/keys.ts +0 -7
- package/src/prover/zenon/check/propositional.ts +0 -3
- package/src/prover/zenon/check/records.ts +1 -6
- package/src/prover/zenon/check/relations.ts +2 -14
- package/src/prover/zenon/check/rewrites.ts +2 -21
- package/src/prover/zenon/check/sets.ts +40 -61
- package/src/prover/zenon/check/terms.ts +1 -19
- package/src/prover/zenon/check/tla.ts +0 -6
- package/src/prover/zenon/decide.ts +0 -12
- package/src/prover/zenon/encode.ts +1 -8
- package/src/prover/zenon/eqrel.ts +2 -13
- package/src/prover/zenon/equality-rules.ts +0 -4
- package/src/prover/zenon/expr.ts +8 -26
- package/src/prover/zenon/index-table.ts +26 -57
- package/src/prover/zenon/isar-case.ts +9 -19
- package/src/prover/zenon/isar.ts +36 -64
- package/src/prover/zenon/limits.ts +0 -4
- package/src/prover/zenon/llproof.ts +2 -20
- package/src/prover/zenon/mltoll.ts +66 -104
- package/src/prover/zenon/node.ts +1 -11
- package/src/prover/zenon/ocaml.ts +1 -17
- package/src/prover/zenon/parse.ts +4 -12
- package/src/prover/zenon/phrase.ts +1 -11
- package/src/prover/zenon/proof.ts +0 -9
- package/src/prover/zenon/propositional-rules.ts +0 -5
- package/src/prover/zenon/rules.ts +2 -6
- package/src/prover/zenon/search.ts +5 -31
- package/src/prover/zenon/tla/functions.ts +59 -31
- package/src/prover/zenon/tla/llproof.ts +67 -76
- package/src/prover/zenon/tla/records.ts +57 -33
- package/src/prover/zenon/tla/rewrites.ts +12 -19
- package/src/prover/zenon/tla/sets.ts +83 -53
- package/src/prover/zenon/tla/terms.ts +0 -6
- package/src/prover/zenon/tla/tla.ts +66 -64
- package/src/randomization.ts +81 -35
- package/src/resolve.ts +67 -184
- package/src/runtime.ts +22 -22
- package/src/sany/builtins.ts +2 -5
- package/src/sany/generation.ts +394 -0
- package/src/sany/generator-def-entries.ts +210 -0
- package/src/sany/generator-definitions.ts +686 -0
- package/src/sany/generator-expressions.ts +1100 -0
- package/src/sany/generator-proofs.ts +662 -0
- package/src/sany/generator.ts +191 -2764
- package/src/sany/levels.ts +6 -34
- package/src/sany/lexer.ts +58 -77
- package/src/sany/linter.ts +1 -9
- package/src/sany/modules.ts +1 -5
- package/src/sany/nodes.ts +5 -43
- package/src/sany/parse-error.ts +39 -117
- package/src/sany/report.ts +32 -69
- package/src/sany/selectors.ts +49 -76
- package/src/sany/source.ts +1 -17
- package/src/sany/xml.ts +35 -117
- package/src/search.ts +541 -163
- package/src/simulate.ts +709 -0
- package/src/spec-description.ts +192 -100
- package/src/standard-definitions.ts +0 -4
- package/src/standard-modules.ts +264 -95
- package/src/state-graph.ts +52 -31
- package/src/subexpressions.ts +69 -52
- package/src/substitution-levels.ts +7 -7
- package/src/successors.ts +266 -99
- package/src/symmetry.ts +33 -25
- package/src/tableau.ts +27 -24
- package/src/tlc/fingerprint.ts +183 -67
- package/src/tlc/jar-data.ts +112 -6
- package/src/tlc/messages.ts +125 -54
- package/src/tlc/order.ts +39 -69
- package/src/tlc/random.ts +37 -49
- package/src/tlc/replay.ts +553 -228
- package/src/tlc/summary.ts +36 -47
- package/src/tlc/tlc-operators.ts +78 -44
- package/src/tlc/tlcext-operators.ts +139 -122
- package/src/tlc/trace-spec.ts +249 -0
- package/src/tlc/value-stream.ts +139 -0
- package/src/tlc/version.ts +1 -4
- package/src/transfer.ts +22 -25
- package/src/typescript/actions.ts +479 -0
- package/src/typescript/collections.ts +614 -0
- package/src/typescript/compile.ts +63 -0
- package/src/typescript/context.ts +94 -0
- package/src/typescript/emit.ts +121 -0
- package/src/typescript/expressions.ts +496 -0
- package/src/typescript/formula.ts +154 -0
- package/src/typescript/functions.ts +284 -0
- package/src/typescript/model.ts +162 -0
- package/src/typescript/names.ts +114 -0
- package/src/typescript/program.ts +48 -0
- package/src/typescript/properties.ts +139 -0
- package/src/typescript/scope.ts +112 -0
- package/src/typescript/steps.ts +167 -0
- package/src/typescript/types.ts +171 -0
- package/src/values.ts +832 -484
- package/src/worker.ts +7 -8
package/src/tlc/jar-data.ts
CHANGED
|
@@ -430,6 +430,16 @@ export const TLC_RUNTIME_STRINGS = [
|
|
|
430
430
|
"levelmean",
|
|
431
431
|
"levelvariance",
|
|
432
432
|
"bfs",
|
|
433
|
+
"beginLine",
|
|
434
|
+
"beginColumn",
|
|
435
|
+
"endLine",
|
|
436
|
+
"endColumn",
|
|
437
|
+
"module",
|
|
438
|
+
"name",
|
|
439
|
+
"location",
|
|
440
|
+
"context",
|
|
441
|
+
"parameters",
|
|
442
|
+
"_action",
|
|
433
443
|
];
|
|
434
444
|
|
|
435
445
|
export const SANY_NODE_NAMES = [
|
|
@@ -550,10 +560,6 @@ export const SANY_NODE_NAMES = [
|
|
|
550
560
|
"N_AssertStep",
|
|
551
561
|
];
|
|
552
562
|
|
|
553
|
-
// The standard modules that a spec may ship its own file of, such as CommunityModules' Json.tla,
|
|
554
|
-
// which SANY reads in place of its own.
|
|
555
|
-
export const USER_STANDARD_MODULES = new Set(["Bags", "Json", "Randomization", "TLCExt"]);
|
|
556
|
-
|
|
557
563
|
export const TLC_MODULE_SOURCES = new Map([
|
|
558
564
|
[
|
|
559
565
|
"Naturals",
|
|
@@ -925,9 +931,56 @@ _PrintCounts == PrintT(_Counts)
|
|
|
925
931
|
],
|
|
926
932
|
]);
|
|
927
933
|
|
|
928
|
-
// The Java methods that override standard module operators, as java.lang.reflect.Method prints
|
|
929
|
-
// them in TLC's errors.
|
|
930
934
|
export const TLC_JAVA_METHODS = new Map([
|
|
935
|
+
[
|
|
936
|
+
"Bags",
|
|
937
|
+
new Map([
|
|
938
|
+
[
|
|
939
|
+
"IsABag",
|
|
940
|
+
"public static tlc2.value.IBoolValue tlc2.module.Bags.IsABag(tlc2.value.impl.Value)",
|
|
941
|
+
],
|
|
942
|
+
[
|
|
943
|
+
"BagCardinality",
|
|
944
|
+
"public static tlc2.value.impl.IntValue tlc2.module.Bags.BagCardinality(tlc2.value.impl.Value)",
|
|
945
|
+
],
|
|
946
|
+
[
|
|
947
|
+
"BagIn",
|
|
948
|
+
"public static tlc2.value.IBoolValue tlc2.module.Bags.BagIn(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
949
|
+
],
|
|
950
|
+
[
|
|
951
|
+
"CopiesIn",
|
|
952
|
+
"public static tlc2.value.impl.IntValue tlc2.module.Bags.CopiesIn(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
953
|
+
],
|
|
954
|
+
[
|
|
955
|
+
"\\oplus",
|
|
956
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagCup(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
957
|
+
],
|
|
958
|
+
[
|
|
959
|
+
"\\ominus",
|
|
960
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagDiff(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
961
|
+
],
|
|
962
|
+
[
|
|
963
|
+
"BagUnion",
|
|
964
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagUnion(tlc2.value.impl.Value)",
|
|
965
|
+
],
|
|
966
|
+
[
|
|
967
|
+
"\\sqsubseteq",
|
|
968
|
+
"public static tlc2.value.IBoolValue tlc2.module.Bags.SqSubseteq(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
969
|
+
],
|
|
970
|
+
[
|
|
971
|
+
"BagOfAll",
|
|
972
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagOfAll(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
973
|
+
],
|
|
974
|
+
[
|
|
975
|
+
"BagToSet",
|
|
976
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagToSet(tlc2.value.impl.Value)",
|
|
977
|
+
],
|
|
978
|
+
[
|
|
979
|
+
"SetToBag",
|
|
980
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.SetToBag(tlc2.value.impl.Value)",
|
|
981
|
+
],
|
|
982
|
+
]),
|
|
983
|
+
],
|
|
931
984
|
[
|
|
932
985
|
"FiniteSets",
|
|
933
986
|
new Map([
|
|
@@ -1023,4 +1076,57 @@ export const TLC_JAVA_METHODS = new Map([
|
|
|
1023
1076
|
],
|
|
1024
1077
|
]),
|
|
1025
1078
|
],
|
|
1079
|
+
[
|
|
1080
|
+
"TLCExt",
|
|
1081
|
+
new Map([
|
|
1082
|
+
[
|
|
1083
|
+
"AssertError",
|
|
1084
|
+
"public static synchronized tlc2.value.impl.Value tlc2.module.TLCExt.assertError(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1085
|
+
],
|
|
1086
|
+
[
|
|
1087
|
+
"PickSuccessor",
|
|
1088
|
+
"public static synchronized tlc2.value.impl.Value tlc2.module.TLCExt.pickSuccessor(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1089
|
+
],
|
|
1090
|
+
[
|
|
1091
|
+
"ToTrace",
|
|
1092
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.lassoOrdinal(tlc2.value.impl.Value)",
|
|
1093
|
+
],
|
|
1094
|
+
[
|
|
1095
|
+
"CounterExample",
|
|
1096
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.error(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel) throws java.io.IOException",
|
|
1097
|
+
],
|
|
1098
|
+
[
|
|
1099
|
+
"Trace",
|
|
1100
|
+
"public static tlc2.value.impl.TupleValue tlc2.module.TLCExt.getTrace(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel) throws java.io.IOException",
|
|
1101
|
+
],
|
|
1102
|
+
[
|
|
1103
|
+
"TLCDefer",
|
|
1104
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcDefer(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1105
|
+
],
|
|
1106
|
+
[
|
|
1107
|
+
"TLCNoOp",
|
|
1108
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcNoOp(tlc2.value.impl.Value)",
|
|
1109
|
+
],
|
|
1110
|
+
[
|
|
1111
|
+
"TLCModelValue",
|
|
1112
|
+
"public static synchronized tlc2.value.impl.Value tlc2.module.TLCExt.tlcModelValue(tlc2.value.impl.Value)",
|
|
1113
|
+
],
|
|
1114
|
+
[
|
|
1115
|
+
"TLCCache",
|
|
1116
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcEval2(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1117
|
+
],
|
|
1118
|
+
[
|
|
1119
|
+
"TLCFP",
|
|
1120
|
+
"public static synchronized tlc2.value.impl.IntValue tlc2.module.TLCExt.tlcFingerprint(tlc2.value.impl.Value)",
|
|
1121
|
+
],
|
|
1122
|
+
[
|
|
1123
|
+
"TLCEvalDefinition",
|
|
1124
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcDefByName(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1125
|
+
],
|
|
1126
|
+
[
|
|
1127
|
+
"TLCGetOrDefault",
|
|
1128
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcGetOrDefault(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
1129
|
+
],
|
|
1130
|
+
]),
|
|
1131
|
+
],
|
|
1026
1132
|
]);
|
package/src/tlc/messages.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getErrorExitCode,
|
|
3
|
+
getUnexpectedException,
|
|
3
4
|
STACK_OVERFLOW_MESSAGE,
|
|
4
5
|
TlaEvaluationError,
|
|
5
6
|
TlaModuleError,
|
|
7
|
+
TlaSetBoundError,
|
|
8
|
+
TlaStackOverflowError,
|
|
9
|
+
TlaUncodedError,
|
|
10
|
+
TlaWarningAsError,
|
|
11
|
+
TOO_MANY_STATES_MESSAGE,
|
|
6
12
|
UNEXPECTED_EVAL_EXCEPTION,
|
|
7
13
|
UNEXPECTED_EXCEPTION,
|
|
8
14
|
} from "../errors";
|
|
9
15
|
import { setExitCode } from "../exit-codes";
|
|
10
16
|
import type { TlcVersion } from "./version";
|
|
11
17
|
|
|
12
|
-
// TLC's codes for the messages it prints, from tlc2.output.EC.
|
|
13
18
|
export const MESSAGE_CODE = {
|
|
14
19
|
general: 1000,
|
|
20
|
+
stackOverflow: 1005,
|
|
15
21
|
commandLineError: 1102,
|
|
16
22
|
initialState: 2102,
|
|
17
23
|
nestedExpression: 2103,
|
|
18
24
|
assumptionFalse: 2104,
|
|
19
25
|
assumptionEvaluationError: 2105,
|
|
26
|
+
unchangedVariableChanged: 2143,
|
|
20
27
|
exceptAppliedToUnknownField: 2144,
|
|
21
28
|
fingerprintFailed: 2147,
|
|
29
|
+
initialStateIncomplete: 2106,
|
|
22
30
|
invariantViolatedInitial: 2107,
|
|
23
31
|
incompleteSuccessor: 2109,
|
|
24
32
|
propertyViolatedInitial: 2108,
|
|
@@ -28,13 +36,20 @@ export const MESSAGE_CODE = {
|
|
|
28
36
|
actionPropertyEvaluationFailed: 2113,
|
|
29
37
|
deadlockReached: 2114,
|
|
30
38
|
temporalPropertyViolated: 2116,
|
|
39
|
+
noInitialStates: 2118,
|
|
40
|
+
errorState: 2120,
|
|
31
41
|
behaviorUpToThisPoint: 2121,
|
|
32
42
|
backToState: 2122,
|
|
43
|
+
subscriptUndetermined: 2139,
|
|
44
|
+
subscriptMissingVariable: 2140,
|
|
33
45
|
constantLevelInvariant: 2149,
|
|
34
46
|
javaOverrideLoaded: 2168,
|
|
35
47
|
starting: 2185,
|
|
36
48
|
modelChecking: 2187,
|
|
49
|
+
simulating: 2188,
|
|
37
50
|
finished: 2186,
|
|
51
|
+
traceSpecWritten: 2501,
|
|
52
|
+
traceSpecFailed: 2502,
|
|
38
53
|
computingInit: 2189,
|
|
39
54
|
initGenerated1: 2190,
|
|
40
55
|
initGenerated2: 2191,
|
|
@@ -43,14 +58,27 @@ export const MESSAGE_CODE = {
|
|
|
43
58
|
searchDepth: 2194,
|
|
44
59
|
stats: 2199,
|
|
45
60
|
progress: 2200,
|
|
61
|
+
coverageStart: 2201,
|
|
62
|
+
coverageEnd: 2202,
|
|
63
|
+
coverageValue: 2221,
|
|
64
|
+
depthFirstStats: 2204,
|
|
65
|
+
depthFirstLevel: 2205,
|
|
66
|
+
depthFirstProgress: 2206,
|
|
67
|
+
depthFirstInitGenerated: 2208,
|
|
68
|
+
simulationProgress: 2209,
|
|
69
|
+
simulationStats: 2210,
|
|
46
70
|
temporalBranches: 2212,
|
|
71
|
+
statePrint1: 2216,
|
|
47
72
|
statePrint2: 2217,
|
|
48
73
|
statePrint3: 2218,
|
|
49
74
|
sanyFinished: 2219,
|
|
50
75
|
startingSany: 2220,
|
|
51
76
|
stateLevelProperty: 2255,
|
|
77
|
+
noInitialStatesInModel: 2256,
|
|
52
78
|
version: 2262,
|
|
79
|
+
depthFirstModelChecking: 2271,
|
|
53
80
|
noSpecificationButProperty: 2257,
|
|
81
|
+
fairnessTautology: 2258,
|
|
54
82
|
noFairnessButProperty: 2259,
|
|
55
83
|
counterExample: 2264,
|
|
56
84
|
checkingTemporalEnd: 2267,
|
|
@@ -62,17 +90,23 @@ export const MESSAGE_CODE = {
|
|
|
62
90
|
javaOverrideMismatch: 2400,
|
|
63
91
|
postconditionFalse: 2404,
|
|
64
92
|
postconditionFailed: 2405,
|
|
93
|
+
coverageNext: 2772,
|
|
94
|
+
coverageInit: 2773,
|
|
95
|
+
coverageProperty: 2774,
|
|
96
|
+
coverageValueCost: 2775,
|
|
97
|
+
coverageEndOverhead: 2777,
|
|
98
|
+
coverageConstraint: 2778,
|
|
99
|
+
coverageVariable: 2779,
|
|
65
100
|
possibleUnwitnessed: 2780,
|
|
66
101
|
parsingFailed: 3002,
|
|
67
102
|
configFileError: 5001,
|
|
103
|
+
moduleOverrideStdout: 20000,
|
|
68
104
|
} as const;
|
|
69
105
|
|
|
70
|
-
// TLC's message levels, from tlc2.output.MP.
|
|
71
106
|
export const MESSAGE_LEVEL = { none: 0, error: 1, warning: 3, state: 4 } as const;
|
|
72
107
|
|
|
73
108
|
type MessageLevel = (typeof MESSAGE_LEVEL)[keyof typeof MESSAGE_LEVEL];
|
|
74
109
|
|
|
75
|
-
// Without -tool, TLC starts a message with the prefix of its level.
|
|
76
110
|
const LEVEL_PREFIXES: Record<MessageLevel, string> = {
|
|
77
111
|
0: "",
|
|
78
112
|
1: "Error: ",
|
|
@@ -82,33 +116,43 @@ const LEVEL_PREFIXES: Record<MessageLevel, string> = {
|
|
|
82
116
|
|
|
83
117
|
export interface MessagePrinter {
|
|
84
118
|
isTool: boolean;
|
|
119
|
+
isDiffTrace: boolean;
|
|
85
120
|
version: TlcVersion;
|
|
86
121
|
print: (code: number, level: MessageLevel, text: string) => void;
|
|
87
122
|
}
|
|
88
123
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
124
|
+
interface MessagePrinterOptions {
|
|
125
|
+
isTool: boolean;
|
|
126
|
+
isWarningEnabled?: boolean;
|
|
127
|
+
isDiffTrace?: boolean;
|
|
128
|
+
version?: TlcVersion;
|
|
129
|
+
suppressedCodes?: number[];
|
|
130
|
+
errorCodes?: number[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const formatMessage = (isTool: boolean, code: number, level: MessageLevel, text: string) =>
|
|
134
|
+
isTool
|
|
135
|
+
? `@!@!@STARTMSG ${code}:${level} @!@!@\n${text}\n@!@!@ENDMSG ${code} @!@!@`
|
|
136
|
+
: `${LEVEL_PREFIXES[level]}${text}`;
|
|
137
|
+
|
|
138
|
+
export const createMessagePrinter = (options: MessagePrinterOptions): MessagePrinter => {
|
|
98
139
|
const warnings = new Set<string>();
|
|
99
140
|
return {
|
|
100
|
-
isTool,
|
|
101
|
-
|
|
141
|
+
isTool: options.isTool,
|
|
142
|
+
isDiffTrace: options.isDiffTrace ?? false,
|
|
143
|
+
version: options.version ?? "master",
|
|
102
144
|
print: (code, level, text) => {
|
|
103
145
|
const isWarning = level === MESSAGE_LEVEL.warning;
|
|
104
|
-
if (isWarning &&
|
|
146
|
+
if (isWarning && options.errorCodes?.includes(code)) {
|
|
147
|
+
throw new TlaWarningAsError(code, text);
|
|
148
|
+
}
|
|
149
|
+
if (isWarning && options.isWarningEnabled === false) return;
|
|
150
|
+
if (level !== MESSAGE_LEVEL.error && options.suppressedCodes?.includes(code)) return;
|
|
105
151
|
const hint =
|
|
106
|
-
isWarning && !isTool && warnings.size === 0
|
|
152
|
+
isWarning && !options.isTool && warnings.size === 0
|
|
107
153
|
? "\n(Use the -nowarning option to disable this warning.)"
|
|
108
154
|
: "";
|
|
109
|
-
const message = isTool
|
|
110
|
-
? `@!@!@STARTMSG ${code}:${level} @!@!@\n${text}\n@!@!@ENDMSG ${code} @!@!@`
|
|
111
|
-
: `${LEVEL_PREFIXES[level]}${text}${hint}`;
|
|
155
|
+
const message = formatMessage(options.isTool, code, level, `${text}${hint}`);
|
|
112
156
|
if (isWarning && warnings.has(message)) return;
|
|
113
157
|
if (isWarning) warnings.add(message);
|
|
114
158
|
console.log(message);
|
|
@@ -116,19 +160,22 @@ export const createMessagePrinter = (
|
|
|
116
160
|
};
|
|
117
161
|
};
|
|
118
162
|
|
|
119
|
-
// TLC 1.7.4's message for a missing initial predicate, which blames a parameterized INSTANCE as
|
|
120
|
-
// well.
|
|
121
163
|
export const MISSING_INIT_174 =
|
|
122
164
|
"The configuration file did not specify the initial state predicate.\nCan also be caused by trying to run TLC on a specification from\na module imported with a parameterized INSTANCE statement.";
|
|
123
165
|
|
|
124
|
-
// The messages that TLC builds from a message code, from tlc2.output.MP, by their code and
|
|
125
|
-
// template, with whether TLC throws them as an EvalException rather than a TLCRuntimeException.
|
|
126
|
-
// TLC's -tool output wraps such a message in its own markers even inside another message.
|
|
127
166
|
const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean][] = [
|
|
128
167
|
[1005, STACK_OVERFLOW_MESSAGE, false],
|
|
168
|
+
[
|
|
169
|
+
1000,
|
|
170
|
+
"In evaluating TLCExt!Trace, the state is not completely specified yet (variable%1% %2% undefined).",
|
|
171
|
+
false,
|
|
172
|
+
],
|
|
173
|
+
[1000, "Could not find operator: %1% in module: %2%", false],
|
|
129
174
|
[2117, "Failed to recover the next state from its fingerprint.", true],
|
|
130
175
|
[2123, "Failed to recover the initial state from its fingerprint.", true],
|
|
131
176
|
[2132, "The first argument of Assert evaluated to FALSE; the second argument was:\n%1%", true],
|
|
177
|
+
[2143, "The variable %1% was changed while it is specified as UNCHANGED at\n%2%", false],
|
|
178
|
+
[2144, "The EXCEPT was applied to non-existing fields of the value at\n%1%", false],
|
|
132
179
|
[2145, "TLCGet(%1%) was undefined.", true],
|
|
133
180
|
[
|
|
134
181
|
2154,
|
|
@@ -147,8 +194,13 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
147
194
|
"Attempted to apply TransitiveClosure to a set containing\nthe following value:\n%1%",
|
|
148
195
|
true,
|
|
149
196
|
],
|
|
197
|
+
[2156, "TLC supports at most %1% model values, but model value %2% exceeds this limit.", false],
|
|
198
|
+
[2156, "tla-ts can't recover a model check from the checkpoint in %1%.", false],
|
|
150
199
|
[2165, "Choose can only deal with numbers up to %1%", false],
|
|
151
200
|
[2169, "The %1% argument of %2% should be a %3%, but instead it is:\n%4%", true],
|
|
201
|
+
[2170, "Argument mismatch in operator application.%1%", false],
|
|
202
|
+
[2171, "Parsing or semantic analysis failed.%1%", false],
|
|
203
|
+
[2172, TOO_MANY_STATES_MESSAGE, false],
|
|
152
204
|
[2176, "Applying %1% to the following value,\nwhich is not %2%:\n%3%", true],
|
|
153
205
|
[
|
|
154
206
|
2177,
|
|
@@ -207,12 +259,23 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
207
259
|
[2233, "The %1% %2% cannot be a constant.", false],
|
|
208
260
|
[2234, "The operator %1% cannot take any argument.", false],
|
|
209
261
|
[2235, "The operator %1% is not defined in the spec.", false],
|
|
262
|
+
[2236, "The operator %1%, which equals %2%,\ncannot be used as a %3%", false],
|
|
210
263
|
[2237, "The spec is trivially false because %1% is false.", false],
|
|
211
264
|
[2238, "TLC cannot handle subscript %1%", false],
|
|
212
265
|
[2239, "TLC cannot handle this conjunct of the spec:\n%1%", false],
|
|
266
|
+
[
|
|
267
|
+
2240,
|
|
268
|
+
"The specification contains more than one conjunct of the form [][Next]_v,\nbut TLC can handle only specifications with one next-state relation.",
|
|
269
|
+
false,
|
|
270
|
+
],
|
|
213
271
|
[2241, "The property %1% is not correctly defined.", false],
|
|
214
272
|
[2242, "The arity of the operator %1% is inconsistent in the configuration file.", false],
|
|
215
273
|
[2244, "TLC can't handle real numbers.\n%1%", false],
|
|
274
|
+
[
|
|
275
|
+
2245,
|
|
276
|
+
"In the configuration file, the module name %1% is not a module in the specification.",
|
|
277
|
+
false,
|
|
278
|
+
],
|
|
216
279
|
[2247, "In computing %1%, TLC expected a %2% expression,\nbut instead found %3%.\n%4%", false],
|
|
217
280
|
[2248, "In computing %1%, TLC expected a %2% expression,\nbut didn't find one.\n%3%", false],
|
|
218
281
|
[2260, "In computing ENABLED, TLC encountered a temporal formula (%1%).\n%2%", false],
|
|
@@ -223,6 +286,21 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
223
286
|
],
|
|
224
287
|
[2265, "TLC can't handle a number this big.\n%1%", false],
|
|
225
288
|
[2266, "The %1% argument of %2% should be an %3%, but instead it is:\n%4%", true],
|
|
289
|
+
[
|
|
290
|
+
2272,
|
|
291
|
+
"The formula %1% at %2% is an action-level formula (i.e., it contains no temporal operators). Only temporal-level (or state-level) formulas are allowed under PROPERTY or PROPERTIES. To check that action %1% holds in *every* step of the behavior, define a temporal property: Let A be the formula at %2%; rewrite A as [][A]_v, where v is a state function (typically the tuple of variables) (compare page 90 of Specifying Systems at https://lamport.azurewebsites.net/tla/book.html).",
|
|
292
|
+
false,
|
|
293
|
+
],
|
|
294
|
+
[
|
|
295
|
+
2273,
|
|
296
|
+
'The formula %1% at %2% is an action-level formula (i.e., it contains no temporal operators). Only temporal-level (or state-level) formulas are allowed under PROPERTY or PROPERTIES. To check that action %1% holds in *every* step of the behavior, define a temporal property by applying the "always" temporal operator ([]) to the formula at %2% (compare page 90 of Specifying Systems at https://lamport.azurewebsites.net/tla/book.html).',
|
|
297
|
+
false,
|
|
298
|
+
],
|
|
299
|
+
[
|
|
300
|
+
2274,
|
|
301
|
+
'The formula %1% at %2% is an action-level formula (i.e., it contains no temporal operators). Only temporal-level (or state-level) formulas are allowed under PROPERTY or PROPERTIES. To check that infinitely many %1% steps occur, define a temporal property by applying the "always eventually" temporal operator combination ([]<>) to the formula at %2% (compare page 91 of Specifying Systems at https://lamport.azurewebsites.net/tla/book.html).',
|
|
302
|
+
false,
|
|
303
|
+
],
|
|
226
304
|
[2280, "In evaluation, the identifier %1% is either undefined or not an operator.\n%2%", false],
|
|
227
305
|
[2281, "The configuration file substitutes constant %1% with non-constant %2%%3%", false],
|
|
228
306
|
[2283, "The argument of %1% should be a %2%, but instead it is:\n%3%", true],
|
|
@@ -249,6 +327,8 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
249
327
|
[5007, "TLC found an error in the configuration file:\n%1%", false],
|
|
250
328
|
// The general message is a prefix of the others above.
|
|
251
329
|
[5002, "TLC found an error in the configuration file at line %1%\n", false],
|
|
330
|
+
[2250, "A state predicate was evaluated to a non-boolean value.", false],
|
|
331
|
+
[2252, "Encountered an action predicate that's not a boolean.", false],
|
|
252
332
|
[2253, "Temporal formula is a tautology (its negation is unsatisfiable).", false],
|
|
253
333
|
[
|
|
254
334
|
2301,
|
|
@@ -262,12 +342,10 @@ interface CodedMessage {
|
|
|
262
342
|
isEvalException: boolean;
|
|
263
343
|
}
|
|
264
344
|
|
|
265
|
-
|
|
266
|
-
value: undefined as { pattern: RegExp; message: CodedMessage }[] | undefined,
|
|
267
|
-
};
|
|
345
|
+
let codedMessagePatterns: { pattern: RegExp; message: CodedMessage }[] | undefined;
|
|
268
346
|
|
|
269
347
|
const getCodedMessagePatterns = () =>
|
|
270
|
-
(codedMessagePatterns
|
|
348
|
+
(codedMessagePatterns ??= CODED_MESSAGES.map(([code, template, isEvalException]) => ({
|
|
271
349
|
pattern: new RegExp(
|
|
272
350
|
`^${template
|
|
273
351
|
.split(/%\d+%/)
|
|
@@ -277,33 +355,27 @@ const getCodedMessagePatterns = () =>
|
|
|
277
355
|
message: { code, isEvalException },
|
|
278
356
|
})));
|
|
279
357
|
|
|
280
|
-
// The overflows of SetOfFcnsValue and SetOfTuplesValue, which TLC raises with a plain message that
|
|
281
|
-
// reads like the coded overflow of SetOfRcdsValue and SubsetValue.
|
|
282
358
|
const UNCODED_MESSAGE_PATTERN =
|
|
283
|
-
/^Overflow when computing the number of elements in( |:\n\[(?![A-Za-z0-9_]
|
|
359
|
+
/^Overflow when computing the number of elements in( |:\n\[(?![A-Za-z0-9_]+: ))|\nis an element of a set of \d+-tuples\.$|^In computing ENABLED, TLC encountered a temporal formula \(a (~> b|-\+-> formula)\)\./;
|
|
284
360
|
|
|
285
361
|
export const getCodedMessage = (text: string): CodedMessage | undefined =>
|
|
286
362
|
UNCODED_MESSAGE_PATTERN.test(text)
|
|
287
363
|
? undefined
|
|
288
364
|
: getCodedMessagePatterns().find((item) => item.pattern.test(text))?.message;
|
|
289
365
|
|
|
290
|
-
// Whether TLC raises an error as an EvalException, which only a standard module's Java code throws,
|
|
291
|
-
// rather than as the TLCRuntimeException of every Assert.fail.
|
|
292
366
|
export const isEvalException = (error: TlaEvaluationError) =>
|
|
293
367
|
error instanceof TlaModuleError || getCodedMessage(error.message)?.isEvalException === true;
|
|
294
368
|
|
|
295
|
-
// The messages that end with the message of the error they report, after this text.
|
|
296
369
|
const INNER_MESSAGE_PREFIXES = new Map([
|
|
297
|
-
// "The exception was a <class>\n: "
|
|
298
370
|
[1000, "\n: "],
|
|
299
371
|
[2105, "failed.\n"],
|
|
300
372
|
[2154, "but it produced the following error:\n"],
|
|
373
|
+
[2171, "Parsing or semantic analysis failed."],
|
|
301
374
|
[2213, ":\n"],
|
|
302
375
|
[2281, " - specifically: "],
|
|
376
|
+
[2405, "failed.\n"],
|
|
303
377
|
]);
|
|
304
378
|
|
|
305
|
-
// The text of a coded message with the message of the error it reports marked in -tool output, as
|
|
306
|
-
// TLC's message holds that error's text as TLC printed it.
|
|
307
379
|
export const formatInnerMessage = (code: number, text: string, isTool: boolean) => {
|
|
308
380
|
const prefix = isTool ? INNER_MESSAGE_PREFIXES.get(code) : undefined;
|
|
309
381
|
const index = prefix === undefined ? -1 : text.indexOf(prefix);
|
|
@@ -312,7 +384,6 @@ export const formatInnerMessage = (code: number, text: string, isTool: boolean)
|
|
|
312
384
|
return `${text.slice(0, end)}${formatNestedMessage(text.slice(end), isTool)}`;
|
|
313
385
|
};
|
|
314
386
|
|
|
315
|
-
// The text of an error's message as TLC prints it inside another message.
|
|
316
387
|
export const formatNestedMessage = (text: string, isTool: boolean): string => {
|
|
317
388
|
const code = isTool ? getCodedMessage(text)?.code : undefined;
|
|
318
389
|
return code === undefined
|
|
@@ -320,9 +391,8 @@ export const formatNestedMessage = (text: string, isTool: boolean): string => {
|
|
|
320
391
|
: `@!@!@STARTMSG ${code}:${MESSAGE_LEVEL.none} @!@!@\n${formatInnerMessage(code, text, isTool)}\n@!@!@ENDMSG ${code} @!@!@`;
|
|
321
392
|
};
|
|
322
393
|
|
|
323
|
-
const zeroPad = (value: number) => String(value).padStart(
|
|
394
|
+
export const zeroPad = (value: number, length = 2) => String(value).padStart(length, "0");
|
|
324
395
|
|
|
325
|
-
// TLC's convertRuntimeToHumanReadable: a duration in its two largest units.
|
|
326
396
|
export const formatTlcDuration = (milliseconds: number) => {
|
|
327
397
|
const seconds = Math.floor(milliseconds / 1000) % 60;
|
|
328
398
|
const minutes = Math.floor(milliseconds / 60_000) % 60;
|
|
@@ -334,12 +404,9 @@ export const formatTlcDuration = (milliseconds: number) => {
|
|
|
334
404
|
: `${zeroPad(seconds)}s`;
|
|
335
405
|
};
|
|
336
406
|
|
|
337
|
-
// TLC's SimpleDateFormat("yyyy-MM-dd HH:mm:ss") in the local time zone.
|
|
338
407
|
export const formatTlcDate = (date: Date) =>
|
|
339
408
|
`${date.getFullYear()}-${zeroPad(date.getMonth() + 1)}-${zeroPad(date.getDate())} ${zeroPad(date.getHours())}:${zeroPad(date.getMinutes())}:${zeroPad(date.getSeconds())}`;
|
|
340
409
|
|
|
341
|
-
// An error that TLC reports with a message of its own, by that message's code and first line, and
|
|
342
|
-
// the error whose message follows.
|
|
343
410
|
interface HeadedError {
|
|
344
411
|
code: number;
|
|
345
412
|
headline: string;
|
|
@@ -360,18 +427,16 @@ export const withHeadline = (error: unknown, code: number, headline: string) =>
|
|
|
360
427
|
|
|
361
428
|
export const isHeadedError = (error: Error) => headedErrors.has(error);
|
|
362
429
|
|
|
430
|
+
const WRONG_INVOCATION_EXCEPTION = getUnexpectedException("util.WrongInvocationException");
|
|
431
|
+
|
|
363
432
|
const UNEXPECTED_HEADLINE = UNEXPECTED_EXCEPTION.slice(0, UNEXPECTED_EXCEPTION.indexOf("\n"));
|
|
364
433
|
|
|
365
|
-
// TLC 1.7.4's Worker wraps an error in adding a successor in a RuntimeException, whose message
|
|
366
|
-
// names the class of the error.
|
|
367
434
|
const WRAPPED_EVAL_EXCEPTION = `${UNEXPECTED_EXCEPTION}tlc2.tool.EvalException: `;
|
|
368
435
|
const WRAPPED_RUNTIME_EXCEPTION = `${UNEXPECTED_EXCEPTION}util.Assert$TLCRuntimeException: `;
|
|
369
436
|
|
|
370
437
|
export const getWrappedException = (error: TlaEvaluationError) =>
|
|
371
438
|
isEvalException(error) ? WRAPPED_EVAL_EXCEPTION : WRAPPED_RUNTIME_EXCEPTION;
|
|
372
439
|
|
|
373
|
-
// TLC reports an EvalException, or a TLCRuntimeException without a message of its own, as an
|
|
374
|
-
// exception it didn't expect.
|
|
375
440
|
export const withUnexpectedException = <Result>(compute: () => Result) => {
|
|
376
441
|
try {
|
|
377
442
|
return compute();
|
|
@@ -392,19 +457,15 @@ const UNEXPECTED_EXCEPTION_PREFIXES = [
|
|
|
392
457
|
UNEXPECTED_EVAL_EXCEPTION,
|
|
393
458
|
];
|
|
394
459
|
|
|
395
|
-
// The text of an error's message, with the message of a coded error inside it marked in -tool
|
|
396
|
-
// output as TLC marks it.
|
|
397
460
|
const formatErrorMessage = (error: TlaEvaluationError, isTool: boolean): string => {
|
|
398
461
|
const headed = headedErrors.get(error);
|
|
399
462
|
if (headed) return `${headed.headline}\n${formatErrorMessage(headed.inner, isTool)}`;
|
|
400
463
|
const message = error.message;
|
|
464
|
+
if (error instanceof TlaUncodedError) return message;
|
|
401
465
|
const prefix = UNEXPECTED_EXCEPTION_PREFIXES.find((start) => message.startsWith(start)) ?? "";
|
|
402
466
|
return `${prefix}${formatNestedMessage(message.slice(prefix.length), isTool)}`;
|
|
403
467
|
};
|
|
404
468
|
|
|
405
|
-
// How TLC reports an error: with the code of its own message for an error that it reports with a
|
|
406
|
-
// headline; and, when the error escapes the computation of next states, with the code of an
|
|
407
|
-
// EvalException, or as an unexpected exception for any other error.
|
|
408
469
|
export interface FailureMessage {
|
|
409
470
|
code: number;
|
|
410
471
|
message: string;
|
|
@@ -424,6 +485,13 @@ export const getFailureMessage = (
|
|
|
424
485
|
toolMessage: formatErrorMessage(error, true),
|
|
425
486
|
};
|
|
426
487
|
}
|
|
488
|
+
if (error instanceof TlaStackOverflowError) {
|
|
489
|
+
return {
|
|
490
|
+
code: isNextState ? MESSAGE_CODE.stackOverflow : MESSAGE_CODE.general,
|
|
491
|
+
message,
|
|
492
|
+
toolMessage: message,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
427
495
|
if (isNextState && isEvalException(error)) {
|
|
428
496
|
return {
|
|
429
497
|
code: getCodedMessage(message)?.code ?? MESSAGE_CODE.general,
|
|
@@ -431,8 +499,11 @@ export const getFailureMessage = (
|
|
|
431
499
|
toolMessage: message,
|
|
432
500
|
};
|
|
433
501
|
}
|
|
434
|
-
const isUnexpected =
|
|
435
|
-
|
|
502
|
+
const isUnexpected =
|
|
503
|
+
isNextState && !message.startsWith(UNEXPECTED_HEADLINE) && !(error instanceof TlaUncodedError);
|
|
504
|
+
const exception =
|
|
505
|
+
error instanceof TlaSetBoundError ? WRONG_INVOCATION_EXCEPTION : UNEXPECTED_EXCEPTION;
|
|
506
|
+
const prefix = isUnexpected ? exception : "";
|
|
436
507
|
return {
|
|
437
508
|
code: MESSAGE_CODE.general,
|
|
438
509
|
message: `${prefix}${message}`,
|