tla-ts 0.0.9-dev.8298a52 → 0.0.10-dev.28c823e4b
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 +7 -0
- package/dist/compile.cjs +3 -3
- package/dist/compile.js +3 -3
- package/dist/deciders.cjs +28 -28
- package/dist/deciders.js +52 -52
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +105 -10
- package/dist/index.d.ts +105 -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 +116 -36
- package/dist/prove.js +116 -36
- package/dist/run.cjs +143 -31
- package/dist/run.js +143 -31
- package/dist/tlapm.cjs +1 -1
- 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 +1 -1
- package/src/ast.ts +4 -23
- package/src/bags.ts +99 -102
- package/src/builtins.ts +40 -78
- package/src/bundled-modules.ts +1 -8
- package/src/check.ts +564 -366
- package/src/cli/options.ts +10 -5
- package/src/cli/run.ts +0 -2
- package/src/cli/runtime-invariants.ts +136 -0
- package/src/cli/shared.ts +18 -11
- package/src/cli/tlapm.ts +0 -12
- package/src/cli/tlc-arguments.ts +640 -0
- package/src/cli/tlc-usage.ts +361 -0
- package/src/cli/tlc.ts +525 -216
- package/src/cli/typescript.ts +0 -3
- package/src/cli/xml-exporter.ts +4 -16
- package/src/cli.ts +0 -1
- package/src/codegen.ts +191 -64
- package/src/config.ts +140 -109
- package/src/coverage.ts +837 -0
- package/src/dependencies.ts +6 -40
- package/src/dfid.ts +618 -0
- package/src/environment.ts +237 -119
- package/src/errors.ts +56 -56
- package/src/evaluate.ts +543 -341
- package/src/exit-codes.ts +37 -3
- package/src/fingerprints.ts +10 -10
- package/src/index.ts +3 -0
- package/src/instances.ts +38 -31
- package/src/java-overrides.ts +4 -19
- package/src/json-reader.ts +455 -0
- package/src/json.ts +255 -139
- package/src/levels.ts +8 -17
- package/src/lexer.ts +80 -100
- package/src/liveness-checker.ts +77 -117
- package/src/liveness.ts +106 -62
- package/src/obligations/action.ts +4 -28
- package/src/obligations/anonymize.ts +84 -80
- package/src/obligations/equality.ts +1 -1
- package/src/obligations/expression.ts +2 -19
- package/src/obligations/format.ts +1 -9
- package/src/obligations/generate.ts +1 -11
- package/src/obligations/index.ts +0 -11
- package/src/obligations/levels.ts +4 -8
- package/src/obligations/module.ts +1 -15
- package/src/obligations/normalize.ts +5 -24
- 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 +3 -14
- package/src/obligations/source.ts +1 -21
- package/src/obligations/subexpression.ts +5 -11
- package/src/obligations/substitution.ts +1 -3
- package/src/obligations/temporal.ts +8 -14
- package/src/obligations/tuples.ts +3 -9
- package/src/parallel-worker.ts +24 -33
- package/src/parallel.ts +48 -40
- package/src/parser.ts +565 -282
- 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 +5 -10
- package/src/prover/deciders.ts +0 -4
- 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 +108 -114
- package/src/prover/isabelle/isar/method.ts +25 -38
- 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 +15 -26
- package/src/prover/isabelle/isar/type-check.ts +11 -25
- package/src/prover/isabelle/provers/blast/blast.ts +10 -41
- 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 +11 -25
- package/src/prover/isabelle/pure/bicompose.ts +16 -13
- package/src/prover/isabelle/pure/consts.ts +1 -7
- package/src/prover/isabelle/pure/conv.ts +1 -9
- package/src/prover/isabelle/pure/drule.ts +24 -40
- 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 +1 -14
- 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 +13 -49
- package/src/prover/isabelle/pure/rewriter.ts +26 -58
- 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 +1 -31
- package/src/prover/isabelle/pure/tactic.ts +12 -22
- package/src/prover/isabelle/pure/tactical.ts +6 -12
- 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 +13 -36
- 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 +9 -19
- package/src/prover/isabelle/tla/context.ts +8 -16
- package/src/prover/isabelle/tla/logic.ts +4 -11
- package/src/prover/isabelle/tla/simpdata.ts +46 -34
- package/src/prover/isabelle/tools/intuitionistic.ts +1 -10
- package/src/prover/ocaml.ts +0 -6
- package/src/prover/prep/action.ts +4 -36
- package/src/prover/prep/enabled-axioms.ts +12 -19
- package/src/prover/prep/fingerprint.ts +0 -16
- package/src/prover/prep/level-comparison.ts +8 -12
- package/src/prover/prep/md5.ts +0 -2
- package/src/prover/prep/methods.ts +9 -36
- package/src/prover/prep/normalize.ts +4 -28
- package/src/prover/prove-worker.ts +0 -2
- package/src/prover/prove.ts +0 -36
- 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 +19 -26
- package/src/prover/smt/data.ts +51 -54
- package/src/prover/smt/encode.ts +14 -35
- 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 +66 -101
- 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 -143
- package/src/prover/smt/solver/auf-solver.ts +6 -39
- 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 +4 -61
- 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 +3 -34
- 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 +0 -5
- 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 +6 -98
- 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 +12 -98
- 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 +35 -130
- 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 +14 -56
- 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 +2 -36
- package/src/prover/smt/solver/model-evaluator.ts +3 -29
- package/src/prover/smt/solver/model-finder.ts +3 -15
- package/src/prover/smt/solver/model-generator.ts +1 -12
- package/src/prover/smt/solver/model-macro-solver.ts +12 -69
- package/src/prover/smt/solver/nlsat/algebraic.ts +55 -151
- package/src/prover/smt/solver/nlsat/atoms.ts +5 -19
- package/src/prover/smt/solver/nlsat/evaluator.ts +17 -22
- package/src/prover/smt/solver/nlsat/explain.ts +3 -47
- package/src/prover/smt/solver/nlsat/interval-set.ts +9 -50
- package/src/prover/smt/solver/nlsat/levelwise.ts +48 -129
- package/src/prover/smt/solver/nlsat/mpbq.ts +3 -14
- package/src/prover/smt/solver/nlsat/polynomial.ts +17 -156
- package/src/prover/smt/solver/nlsat/solver.ts +7 -67
- package/src/prover/smt/solver/nlsat/types.ts +1 -8
- package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +1 -44
- 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 -48
- 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 +17 -37
- package/src/prover/smt/solver/quantifier-manager.ts +1 -8
- 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 +2 -37
- package/src/prover/smt/solver/solver.ts +1 -16
- 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 +0 -5
- package/src/prover/smt/solver/theory-lra-final-check.ts +4 -22
- package/src/prover/smt/solver/theory-lra-internalize.ts +1 -27
- 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 +20 -25
- package/src/prover/tlapm/ocaml-marshal.ts +19 -21
- package/src/prover/tlapm/tlapm.ts +12 -17
- package/src/prover/verdict.ts +0 -2
- package/src/prover/zenon/check/check.ts +0 -9
- 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 +0 -5
- package/src/prover/zenon/check/relations.ts +0 -13
- package/src/prover/zenon/check/rewrites.ts +0 -6
- package/src/prover/zenon/check/sets.ts +0 -3
- package/src/prover/zenon/check/terms.ts +0 -17
- 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 +0 -13
- package/src/prover/zenon/equality-rules.ts +0 -4
- package/src/prover/zenon/expr.ts +1 -26
- package/src/prover/zenon/index-table.ts +17 -38
- package/src/prover/zenon/isar-case.ts +9 -19
- package/src/prover/zenon/isar.ts +1 -29
- package/src/prover/zenon/limits.ts +0 -4
- package/src/prover/zenon/llproof.ts +0 -9
- package/src/prover/zenon/mltoll.ts +54 -76
- package/src/prover/zenon/node.ts +1 -11
- package/src/prover/zenon/ocaml.ts +1 -17
- package/src/prover/zenon/parse.ts +2 -7
- 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 +1 -17
- package/src/prover/zenon/tla/functions.ts +57 -29
- package/src/prover/zenon/tla/llproof.ts +63 -70
- package/src/prover/zenon/tla/records.ts +56 -27
- package/src/prover/zenon/tla/rewrites.ts +12 -19
- package/src/prover/zenon/tla/sets.ts +68 -39
- package/src/prover/zenon/tla/terms.ts +0 -6
- package/src/prover/zenon/tla/tla.ts +59 -58
- package/src/randomization.ts +81 -35
- package/src/resolve.ts +12 -112
- package/src/runtime.ts +22 -22
- package/src/sany/builtins.ts +2 -5
- package/src/sany/generator.ts +149 -252
- package/src/sany/levels.ts +6 -34
- package/src/sany/lexer.ts +41 -61
- package/src/sany/linter.ts +1 -9
- package/src/sany/modules.ts +1 -5
- package/src/sany/nodes.ts +0 -31
- package/src/sany/parse-error.ts +39 -117
- package/src/sany/report.ts +29 -63
- package/src/sany/selectors.ts +15 -39
- package/src/sany/source.ts +1 -17
- package/src/sany/xml.ts +13 -63
- package/src/search.ts +495 -155
- package/src/simulate.ts +685 -0
- package/src/spec-description.ts +176 -69
- package/src/standard-definitions.ts +0 -4
- package/src/standard-modules.ts +254 -69
- package/src/state-graph.ts +50 -24
- package/src/subexpressions.ts +69 -52
- package/src/substitution-levels.ts +2 -3
- package/src/successors.ts +260 -91
- 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 +110 -44
- package/src/tlc/order.ts +37 -60
- package/src/tlc/random.ts +33 -45
- package/src/tlc/replay.ts +549 -217
- package/src/tlc/summary.ts +36 -47
- package/src/tlc/tlc-operators.ts +76 -41
- package/src/tlc/tlcext-operators.ts +139 -122
- package/src/tlc/trace-spec.ts +269 -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 +8 -21
- package/src/typescript/collections.ts +0 -15
- package/src/typescript/compile.ts +0 -5
- package/src/typescript/context.ts +0 -12
- package/src/typescript/emit.ts +0 -1
- package/src/typescript/expressions.ts +0 -12
- package/src/typescript/formula.ts +4 -12
- package/src/typescript/functions.ts +6 -17
- package/src/typescript/model.ts +10 -11
- package/src/typescript/names.ts +0 -2
- package/src/typescript/program.ts +0 -3
- package/src/typescript/properties.ts +6 -8
- package/src/typescript/scope.ts +0 -5
- package/src/typescript/steps.ts +0 -10
- package/src/typescript/types.ts +1 -8
- package/src/values.ts +749 -330
- package/src/worker.ts +7 -8
package/dist/worker.cjs
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=/* @__PURE__ */ new WeakMap,
|
|
9
|
+
const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>{let t=o(e);return t&&{branches:t.branches,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),findViolation:()=>o(()=>t.findViolation()),getViolatedProperties:(e,n)=>o(()=>t.getViolatedProperties(e,n))}},c=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,l=c(`java.lang.RuntimeException`),ee=c(`tlc2.tool.EvalException`),u=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var d=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},f=class extends d{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},p=class extends f{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},m=class extends p{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const h=(e,t=!1,n,r=[])=>new f(e.map(e=>`${e.location}\n\n${e.message}`).join(`
|
|
10
10
|
|
|
11
|
-
`),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),
|
|
12
|
-
`)}`,
|
|
11
|
+
`),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),g=(e,t)=>h([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),_=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
|
|
12
|
+
`)}`,v=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,y=(e,t)=>h([{location:v(t),message:e}]);var b=class extends d{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},x=class extends d{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const S=`This was a Java StackOverflowError. It was probably the result
|
|
13
13
|
of an incorrect recursive function definition that caused TLC to enter
|
|
14
14
|
an infinite loop when trying to compute the function or its application
|
|
15
|
-
to an element in its putative domain.`;var
|
|
15
|
+
to an element in its putative domain.`;var C=class extends x{constructor(){super(S)}};const w=()=>i(new C,e.error);var T=class extends x{},E=class extends x{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},D=class extends x{variable;constructor(e,t){super(e),this.variable=t}},O=class extends x{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},k=class extends x{constructor(t){super(t),i(this,e.error)}},A=class extends T{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},j=class extends x{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},M=class extends x{},N=class extends x{};const P=`Too many possible next states for the last state in the trace.`;var F=class extends x{constructor(){super(P)}},I=class extends x{code;constructor(e,t){super(t),this.code=e}},L=class extends x{},R=class extends x{state;constructor(e){super(`current state is not a legal state`),this.state=e}},z=class extends d{failure;exception;locus;constructor(e,t={}){super(e),this.locus=t.locus,this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},B=class extends z{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},V=class extends d{constructor(e,t){super(e,t),this.name=`TlaProverError`}},te=class extends d{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},H=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}},U=class extends d{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},W=class extends d{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},G=class extends d{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},K=class extends d{constructor(e){super(e),this.name=`SmtInvariantError`}},q=class extends d{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},J=class extends d{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},Y=class extends d{constructor(e,t){super(e,t),this.name=`SmtParseError`}},X=class extends U{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const Z=t=>a(t)??(t instanceof f?e.specParseError:t instanceof b?e.configParseError:t instanceof x?e.specEvaluationFailure:e.error);var Q=class extends d{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},ne=class extends d{constructor(e){super(e),this.name=`PcalRuntimeError`}},re=class extends d{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}},ie=class extends d{constructor(e,t){let n=t?.getSourceFile(),r=n?.getLineAndCharacterOfPosition(t?.getStart()??0);super(n===void 0||r===void 0?e:`${n.fileName}:${r.line+1}:${r.character+1} ${e}`),this.name=`TlaTypeScriptError`}};const $=`node:worker_threads`,ae=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,oe=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
|
|
16
16
|
/* @vite-ignore */
|
|
17
17
|
/* webpackIgnore: true */
|
|
18
|
-
|
|
18
|
+
$))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},se=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
19
19
|
/* @vite-ignore */
|
|
20
20
|
/* webpackIgnore: true */
|
|
21
|
-
|
|
21
|
+
$)).parentPort,ce=()=>{let e=`Bun`in globalThis?import(
|
|
22
22
|
/* @vite-ignore */
|
|
23
23
|
/* webpackIgnore: true */
|
|
24
|
-
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return
|
|
24
|
+
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return T}});
|
package/dist/worker.js
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=/* @__PURE__ */ new WeakMap,
|
|
9
|
+
const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>{let t=o(e);return t&&{branches:t.branches,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),findViolation:()=>o(()=>t.findViolation()),getViolatedProperties:(e,n)=>o(()=>t.getViolatedProperties(e,n))}},c=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,l=c(`java.lang.RuntimeException`),ee=c(`tlc2.tool.EvalException`),u=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var d=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},f=class extends d{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},p=class extends f{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},m=class extends p{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const h=(e,t=!1,n,r=[])=>new f(e.map(e=>`${e.location}\n\n${e.message}`).join(`
|
|
10
10
|
|
|
11
|
-
`),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),
|
|
12
|
-
`)}`,
|
|
11
|
+
`),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),g=(e,t)=>h([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),_=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
|
|
12
|
+
`)}`,v=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,y=(e,t)=>h([{location:v(t),message:e}]);var b=class extends d{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},x=class extends d{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const S=`This was a Java StackOverflowError. It was probably the result
|
|
13
13
|
of an incorrect recursive function definition that caused TLC to enter
|
|
14
14
|
an infinite loop when trying to compute the function or its application
|
|
15
|
-
to an element in its putative domain.`;var
|
|
15
|
+
to an element in its putative domain.`;var C=class extends x{constructor(){super(S)}};const w=()=>i(new C,e.error);var T=class extends x{},E=class extends x{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},D=class extends x{variable;constructor(e,t){super(e),this.variable=t}},O=class extends x{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},k=class extends x{constructor(t){super(t),i(this,e.error)}},A=class extends T{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},j=class extends x{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},M=class extends x{},N=class extends x{};const P=`Too many possible next states for the last state in the trace.`;var F=class extends x{constructor(){super(P)}},I=class extends x{code;constructor(e,t){super(t),this.code=e}},L=class extends x{},R=class extends x{state;constructor(e){super(`current state is not a legal state`),this.state=e}},z=class extends d{failure;exception;locus;constructor(e,t={}){super(e),this.locus=t.locus,this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},B=class extends z{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},V=class extends d{constructor(e,t){super(e,t),this.name=`TlaProverError`}},te=class extends d{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},H=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}},U=class extends d{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},W=class extends d{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},G=class extends d{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},K=class extends d{constructor(e){super(e),this.name=`SmtInvariantError`}},q=class extends d{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},J=class extends d{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},Y=class extends d{constructor(e,t){super(e,t),this.name=`SmtParseError`}},X=class extends U{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const Z=t=>a(t)??(t instanceof f?e.specParseError:t instanceof b?e.configParseError:t instanceof x?e.specEvaluationFailure:e.error);var Q=class extends d{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},ne=class extends d{constructor(e){super(e),this.name=`PcalRuntimeError`}},re=class extends d{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}},ie=class extends d{constructor(e,t){let n=t?.getSourceFile(),r=n?.getLineAndCharacterOfPosition(t?.getStart()??0);super(n===void 0||r===void 0?e:`${n.fileName}:${r.line+1}:${r.character+1} ${e}`),this.name=`TlaTypeScriptError`}};const $=`node:worker_threads`,ae=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,oe=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
|
|
16
16
|
/* @vite-ignore */
|
|
17
17
|
/* webpackIgnore: true */
|
|
18
|
-
|
|
18
|
+
$))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},se=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
19
19
|
/* @vite-ignore */
|
|
20
20
|
/* webpackIgnore: true */
|
|
21
|
-
|
|
21
|
+
$)).parentPort,ce=()=>{let e=`Bun`in globalThis?import(
|
|
22
22
|
/* @vite-ignore */
|
|
23
23
|
/* webpackIgnore: true */
|
|
24
|
-
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};export{
|
|
24
|
+
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};export{c as $,z as A,U as B,E as C,m as D,j as E,f as F,l as G,te as H,F as I,y as J,g as K,ie as L,p as M,N,O,C as P,Z as Q,D as R,R as S,X as T,B as U,I as V,ee as W,v as X,w as Y,_ as Z,b as _,q as a,s as at,x as b,ne as c,G as d,u as et,K as f,M as g,P as h,oe as i,i as it,V as j,L as k,J as l,W as m,se as n,a as nt,re as o,Y as p,h as q,ae as r,n as rt,Q as s,ce as t,e as tt,S as u,A as v,H as w,k as x,d as y,T as z};
|
package/package.json
CHANGED
package/src/ast.ts
CHANGED
|
@@ -33,8 +33,6 @@ export interface StringExpression {
|
|
|
33
33
|
location: SourceLocation;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
// selectorRanges holds the range of each part of a name such as foo!lab, where SANY reports an
|
|
37
|
-
// error in selecting that part. spelling holds the text of an operator written as a synonym.
|
|
38
36
|
export interface IdentifierExpression {
|
|
39
37
|
kind: "Identifier";
|
|
40
38
|
name: string;
|
|
@@ -44,21 +42,14 @@ export interface IdentifierExpression {
|
|
|
44
42
|
resolution?: LocalResolution;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
// spelling holds the text of an operator written as a synonym, such as (+) for \oplus, which SANY
|
|
48
|
-
// reports as written.
|
|
49
45
|
export interface ApplyExpression {
|
|
50
46
|
kind: "Apply";
|
|
51
47
|
operator: string;
|
|
52
48
|
spelling?: string;
|
|
53
49
|
args: Expression[];
|
|
54
|
-
// The number of args each part of a name like F(x)!l(y) takes, when a part before the last takes
|
|
55
|
-
// some.
|
|
56
50
|
argumentCounts?: number[];
|
|
57
|
-
// The range of the parenthesized arguments of a named operator, or of the whole name when its
|
|
58
|
-
// last part takes none, where SANY reports their count.
|
|
59
51
|
argumentsRange?: SourceRange;
|
|
60
52
|
selectorRanges?: SourceRange[];
|
|
61
|
-
// The range of the arguments of each part of a name like F(x)!l(y), for a part that takes some.
|
|
62
53
|
argumentRanges?: (SourceRange | undefined)[];
|
|
63
54
|
location: SourceLocation;
|
|
64
55
|
resolution?: LocalResolution;
|
|
@@ -71,8 +62,6 @@ export interface OperatorReferenceExpression {
|
|
|
71
62
|
location: SourceLocation;
|
|
72
63
|
}
|
|
73
64
|
|
|
74
|
-
// operator holds the operator, such as SUBSET, that an argument names, which tla-ts reads as a
|
|
75
|
-
// LAMBDA.
|
|
76
65
|
export interface LambdaExpression {
|
|
77
66
|
kind: "Lambda";
|
|
78
67
|
params: string[];
|
|
@@ -86,8 +75,6 @@ export interface JunctionExpression {
|
|
|
86
75
|
kind: "And" | "Or";
|
|
87
76
|
operands: Expression[];
|
|
88
77
|
isBulleted?: boolean;
|
|
89
|
-
// SANY parses an infix chain such as A /\ B /\ C as (A /\ B) /\ C, whose node of each prefix of
|
|
90
|
-
// two or more operands ends after the parentheses of its last operand.
|
|
91
78
|
prefixEnds?: SourceLocation[];
|
|
92
79
|
location: SourceLocation;
|
|
93
80
|
}
|
|
@@ -127,6 +114,7 @@ export interface CaseExpression {
|
|
|
127
114
|
kind: "Case";
|
|
128
115
|
arms: CaseArm[];
|
|
129
116
|
other: Expression | undefined;
|
|
117
|
+
otherRange?: SourceRange;
|
|
130
118
|
location: SourceLocation;
|
|
131
119
|
}
|
|
132
120
|
|
|
@@ -138,7 +126,6 @@ export interface LetExpression {
|
|
|
138
126
|
location: SourceLocation;
|
|
139
127
|
}
|
|
140
128
|
|
|
141
|
-
// ranges holds the range of each name the pattern binds.
|
|
142
129
|
export type BoundPattern =
|
|
143
130
|
| { kind: "Name"; name: string; ranges?: SourceRange[] }
|
|
144
131
|
| { kind: "Tuple"; names: string[]; ranges?: SourceRange[] };
|
|
@@ -254,8 +241,6 @@ export interface FunctionApplicationExpression {
|
|
|
254
241
|
location: SourceLocation;
|
|
255
242
|
}
|
|
256
243
|
|
|
257
|
-
// SANY parses [e1, ..., en] as a function application without the function, and its semantic
|
|
258
|
-
// checker rejects it.
|
|
259
244
|
export interface BracketExpression {
|
|
260
245
|
kind: "Bracket";
|
|
261
246
|
args: Expression[];
|
|
@@ -301,6 +286,7 @@ export interface LabelExpression {
|
|
|
301
286
|
name: string;
|
|
302
287
|
params: string[];
|
|
303
288
|
paramRanges?: SourceRange[];
|
|
289
|
+
head?: SourceRange;
|
|
304
290
|
body: Expression;
|
|
305
291
|
location: SourceLocation;
|
|
306
292
|
}
|
|
@@ -369,6 +355,7 @@ export interface OperatorDefinition {
|
|
|
369
355
|
params: OperatorParam[];
|
|
370
356
|
body: Expression;
|
|
371
357
|
bodyRange?: SourceRange;
|
|
358
|
+
head?: SourceRange;
|
|
372
359
|
isLocal: boolean;
|
|
373
360
|
isRecursive: boolean;
|
|
374
361
|
location: SourceLocation;
|
|
@@ -381,7 +368,6 @@ export interface FunctionDefinition {
|
|
|
381
368
|
body: Expression;
|
|
382
369
|
isLocal: boolean;
|
|
383
370
|
isRecursive: boolean;
|
|
384
|
-
// Whether the body applies the function, which SANY makes a recursive function definition.
|
|
385
371
|
isSelfReferential?: boolean;
|
|
386
372
|
location: SourceLocation;
|
|
387
373
|
}
|
|
@@ -438,7 +424,6 @@ export interface AssumeProve {
|
|
|
438
424
|
|
|
439
425
|
export type Fact = Expression | { kind: "ModuleFact"; name: string; location: SourceLocation };
|
|
440
426
|
|
|
441
|
-
// keyword is the range of the USE or HIDE token and any ONLY after it.
|
|
442
427
|
export interface UseOrHide {
|
|
443
428
|
kind: "Use" | "Hide";
|
|
444
429
|
isOnly: boolean;
|
|
@@ -448,7 +433,6 @@ export interface UseOrHide {
|
|
|
448
433
|
location: SourceLocation;
|
|
449
434
|
}
|
|
450
435
|
|
|
451
|
-
// keyword is the range of the BY, OBVIOUS, or OMITTED token.
|
|
452
436
|
export type Proof =
|
|
453
437
|
| { kind: "Obvious" | "Omitted"; keyword: SourceRange; location: SourceLocation }
|
|
454
438
|
| {
|
|
@@ -490,8 +474,6 @@ export type StepBody =
|
|
|
490
474
|
| { kind: "Assert"; isSuffices: boolean; statement: Expression | AssumeProve }
|
|
491
475
|
| { kind: "Qed" };
|
|
492
476
|
|
|
493
|
-
// head is the range of the step number and its statement, without the proof, and statement is the
|
|
494
|
-
// range of the statement alone.
|
|
495
477
|
export interface ProofStep {
|
|
496
478
|
name: string | undefined;
|
|
497
479
|
token: string;
|
|
@@ -509,10 +491,9 @@ export interface Theorem {
|
|
|
509
491
|
location: SourceLocation;
|
|
510
492
|
}
|
|
511
493
|
|
|
512
|
-
// The units of a module in source order, for consumers that need the order across kinds.
|
|
513
494
|
export type ModuleUnit =
|
|
514
495
|
| { kind: "Constants" | "Variables"; declarations: Declaration[]; location: SourceLocation }
|
|
515
|
-
| { kind: "Recursive"; declarations: Declaration[] }
|
|
496
|
+
| { kind: "Recursive"; declarations: Declaration[]; location: SourceLocation }
|
|
516
497
|
| { kind: "Definition"; definition: Definition }
|
|
517
498
|
| { kind: "Instance"; instance: Instance }
|
|
518
499
|
| { kind: "Assumption"; assumption: Assumption }
|
package/src/bags.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createJavaOverrideError,
|
|
3
2
|
createModuleArgumentError,
|
|
4
3
|
createOverflowError,
|
|
5
4
|
defineConstant,
|
|
6
5
|
defineHigherOrderOperator,
|
|
7
6
|
defineOperator,
|
|
8
7
|
getJavaClassName,
|
|
8
|
+
getKindString,
|
|
9
9
|
getOperator,
|
|
10
10
|
getValue,
|
|
11
11
|
isOutOfRange,
|
|
@@ -13,17 +13,18 @@ import {
|
|
|
13
13
|
import { TlaEvaluationError, TlaModuleError } from "./errors";
|
|
14
14
|
import type { Builtin, BuiltinArgument } from "./evaluate";
|
|
15
15
|
import {
|
|
16
|
+
createEnumeratedSet,
|
|
16
17
|
createFunction,
|
|
17
18
|
createSet,
|
|
18
19
|
createSortedFunction,
|
|
19
20
|
formatValue,
|
|
20
21
|
getDomain,
|
|
21
22
|
isEnumerable,
|
|
23
|
+
isEqualLikeTlc,
|
|
22
24
|
isFunctionValue,
|
|
23
25
|
isSetValue,
|
|
24
26
|
toFiniteFunction,
|
|
25
27
|
toFiniteSet,
|
|
26
|
-
valuesEqual,
|
|
27
28
|
type FunctionValue,
|
|
28
29
|
type Value,
|
|
29
30
|
} from "./values";
|
|
@@ -35,18 +36,39 @@ const createWrongValueError = (name: string, expected: string, value: Value) =>
|
|
|
35
36
|
|
|
36
37
|
const toFunction = (value: Value) => (isFunctionValue(value) ? toFiniteFunction(value) : undefined);
|
|
37
38
|
|
|
39
|
+
const FINITE_FUNCTION = "a function with a finite domain";
|
|
40
|
+
|
|
38
41
|
const getFunction = (args: BuiltinArgument[], index: number, name: string) => {
|
|
39
42
|
const value = getValue(args, index, name);
|
|
40
43
|
const functionValue = toFunction(value);
|
|
41
|
-
if (!functionValue) throw createWrongValueError(name,
|
|
44
|
+
if (!functionValue) throw createWrongValueError(name, FINITE_FUNCTION, value);
|
|
42
45
|
return functionValue;
|
|
43
46
|
};
|
|
44
47
|
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const functionValue = toFunction(
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const getCount = (args: BuiltinArgument[], name: string) => {
|
|
49
|
+
const bag = getValue(args, 1, name);
|
|
50
|
+
const functionValue = toFunction(bag);
|
|
51
|
+
const count = functionValue && findCount(functionValue, getValue(args, 0, name));
|
|
52
|
+
if (!functionValue || (count !== undefined && typeof count !== "number")) {
|
|
53
|
+
throw createModuleArgumentError("second", name, "bag", bag);
|
|
54
|
+
}
|
|
55
|
+
return count;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const getAddedBag = (
|
|
59
|
+
args: BuiltinArgument[],
|
|
60
|
+
functions: (FunctionValue | undefined)[],
|
|
61
|
+
index: number,
|
|
62
|
+
) => {
|
|
63
|
+
const functionValue = functions[index];
|
|
64
|
+
if (!functionValue || !isBag(functionValue)) {
|
|
65
|
+
throw createModuleArgumentError(
|
|
66
|
+
index === 0 ? "first" : "second",
|
|
67
|
+
"(+)",
|
|
68
|
+
"bag",
|
|
69
|
+
getValue(args, index, "(+)"),
|
|
70
|
+
);
|
|
71
|
+
}
|
|
50
72
|
return functionValue;
|
|
51
73
|
};
|
|
52
74
|
|
|
@@ -59,67 +81,46 @@ const isBag = (functionValue: FunctionValue) =>
|
|
|
59
81
|
functionValue.range.every((count) => typeof count === "number" && count > 0);
|
|
60
82
|
|
|
61
83
|
const findCount = (functionValue: FunctionValue, element: Value) => {
|
|
62
|
-
const position = functionValue.domain.findIndex((key) =>
|
|
84
|
+
const position = functionValue.domain.findIndex((key) => isEqualLikeTlc(element, key));
|
|
63
85
|
return position === -1 ? undefined : functionValue.range[position];
|
|
64
86
|
};
|
|
65
87
|
|
|
66
|
-
const
|
|
67
|
-
`public static ${result} tlc2.module.Bags.${name}(${Array.from({ length: arity }, () => "tlc2.value.impl.Value").join(",")})`;
|
|
68
|
-
|
|
69
|
-
const BAG_DIFF_SIGNATURE = getBagsSignature("BagDiff", "tlc2.value.impl.Value", 2);
|
|
70
|
-
const SQ_SUBSETEQ_SIGNATURE = getBagsSignature("SqSubseteq", "tlc2.value.IBoolValue", 2);
|
|
71
|
-
const BAG_UNION_SIGNATURE = getBagsSignature("BagUnion", "tlc2.value.impl.Value", 1);
|
|
72
|
-
const BAG_OF_ALL_SIGNATURE = getBagsSignature("BagOfAll", "tlc2.value.impl.Value", 2);
|
|
73
|
-
const BAG_CUP_SIGNATURE = getBagsSignature("BagCup", "tlc2.value.impl.Value", 2);
|
|
74
|
-
const BAG_CARDINALITY_SIGNATURE = getBagsSignature("BagCardinality", "tlc2.value.impl.IntValue", 1);
|
|
75
|
-
|
|
76
|
-
// Bags.java casts each count to IntValue, so a count that isn't an integer fails with Java's
|
|
77
|
-
// ClassCastException.
|
|
78
|
-
const toCount = (value: Value, method: string) => {
|
|
88
|
+
const toCount = (value: Value) => {
|
|
79
89
|
if (typeof value === "number") return value;
|
|
80
90
|
const javaClass = `tlc2.value.impl.${getJavaClassName(value)}`;
|
|
81
|
-
throw
|
|
82
|
-
method,
|
|
91
|
+
throw new TlaEvaluationError(
|
|
83
92
|
`class ${javaClass} cannot be cast to class tlc2.value.impl.IntValue (${javaClass} and tlc2.value.impl.IntValue are in unnamed module of loader 'app')`,
|
|
84
93
|
);
|
|
85
94
|
};
|
|
86
95
|
|
|
87
|
-
const addCounts = (left: Value, right: Value
|
|
88
|
-
const sum = toCount(left
|
|
96
|
+
const addCounts = (left: Value, right: Value) => {
|
|
97
|
+
const sum = toCount(left) + toCount(right);
|
|
89
98
|
if (isOutOfRange(sum)) throw createOverflowError(`${left}+${right}`);
|
|
90
99
|
return sum;
|
|
91
100
|
};
|
|
92
101
|
|
|
93
|
-
// TLC subtracts counts as Java ints, which wrap
|
|
94
|
-
const subtractCounts = (
|
|
95
|
-
functionValue
|
|
96
|
-
index: number,
|
|
97
|
-
other: FunctionValue,
|
|
98
|
-
method: string,
|
|
99
|
-
) => {
|
|
102
|
+
// Deviation from TLC: Bags.java subtracts counts as Java ints, which wrap; this overflows like -.
|
|
103
|
+
const subtractCounts = (functionValue: FunctionValue, index: number, other: FunctionValue) => {
|
|
104
|
+
const count = toCount(functionValue.range[index]);
|
|
100
105
|
const removed = findCount(other, functionValue.domain[index]);
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
if (removed === undefined) return count;
|
|
107
|
+
const difference = count - toCount(removed);
|
|
108
|
+
if (isOutOfRange(difference)) throw createOverflowError(`${count}-${removed}`);
|
|
109
|
+
return difference;
|
|
103
110
|
};
|
|
104
111
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
pairs.push([key, bag.range[index]]);
|
|
115
|
-
});
|
|
116
|
-
return pairs;
|
|
117
|
-
}, []),
|
|
118
|
-
);
|
|
112
|
+
// BagCup looks up a key of its second bag only among the keys of its first.
|
|
113
|
+
const addToBag = (pairs: [Value, Value][], key: Value, count: Value, end = pairs.length) => {
|
|
114
|
+
const existing = pairs.slice(0, end).find((pair) => isEqualLikeTlc(key, pair[0]));
|
|
115
|
+
if (existing) existing[1] = addCounts(existing[1], count);
|
|
116
|
+
else pairs.push([key, count]);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const getPairs = (functionValue: FunctionValue) =>
|
|
120
|
+
functionValue.domain.map((key, index): [Value, Value] => [key, functionValue.range[index]]);
|
|
119
121
|
|
|
120
122
|
const EMPTY_BAG = createSortedFunction([], []);
|
|
121
123
|
|
|
122
|
-
// SubBag compares the counts with the >= of Naturals, which Integers replaces when TLC loads it.
|
|
123
124
|
export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Builtin[] => [
|
|
124
125
|
defineConstant("EmptyBag", EMPTY_BAG),
|
|
125
126
|
defineOperator("IsABag", 1, (args) => {
|
|
@@ -133,45 +134,34 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
133
134
|
if (typeof count !== "number" || count <= 0) {
|
|
134
135
|
throw createWrongValueError("BagCardinality", "a bag", bag);
|
|
135
136
|
}
|
|
136
|
-
return addCounts(total, count
|
|
137
|
+
return addCounts(total, count);
|
|
137
138
|
}, 0);
|
|
138
139
|
}),
|
|
139
140
|
defineOperator("BagIn", 2, (args) => {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
if (count === undefined) return false;
|
|
143
|
-
if (typeof count !== "number") throw createModuleArgumentError("second", "BagIn", "bag", bag);
|
|
144
|
-
return count > 0;
|
|
145
|
-
}),
|
|
146
|
-
defineOperator("CopiesIn", 2, (args) => {
|
|
147
|
-
const bag = getValue(args, 1, "CopiesIn");
|
|
148
|
-
const count = findCount(getFunction(args, 1, "CopiesIn"), getValue(args, 0, "CopiesIn"));
|
|
149
|
-
if (count === undefined) return 0;
|
|
150
|
-
if (typeof count !== "number")
|
|
151
|
-
throw createModuleArgumentError("second", "CopiesIn", "bag", bag);
|
|
152
|
-
return count;
|
|
141
|
+
const count = getCount(args, "BagIn");
|
|
142
|
+
return count !== undefined && count > 0;
|
|
153
143
|
}),
|
|
144
|
+
defineOperator("CopiesIn", 2, (args) => getCount(args, "CopiesIn") ?? 0),
|
|
154
145
|
defineOperator("\\oplus", 2, (args) => {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
return functionValue;
|
|
166
|
-
});
|
|
167
|
-
return mergeBags(bags, BAG_CUP_SIGNATURE);
|
|
146
|
+
const functions = [0, 1].map((index) => toFunction(getValue(args, index, "(+)")));
|
|
147
|
+
const left = getAddedBag(args, functions, 0);
|
|
148
|
+
const right = getAddedBag(args, functions, 1);
|
|
149
|
+
const pairs = getPairs(left);
|
|
150
|
+
right.domain.forEach((key, index) =>
|
|
151
|
+
addToBag(pairs, key, right.range[index], left.domain.length),
|
|
152
|
+
);
|
|
153
|
+
return createFunction(pairs);
|
|
168
154
|
}),
|
|
169
155
|
defineOperator("\\ominus", 2, (args) => {
|
|
170
|
-
const
|
|
171
|
-
const
|
|
156
|
+
const leftValue = getValue(args, 0, "(-)");
|
|
157
|
+
const rightValue = getValue(args, 1, "(-)");
|
|
158
|
+
const left = toFunction(leftValue);
|
|
159
|
+
const right = toFunction(rightValue);
|
|
160
|
+
if (!left) throw createModuleArgumentError("first", "(-)", "bag", leftValue);
|
|
161
|
+
if (!right) throw createModuleArgumentError("second", "(-)", "bag", rightValue);
|
|
172
162
|
return createFunction(
|
|
173
163
|
left.domain.flatMap((key, index): [Value, Value][] => {
|
|
174
|
-
const count = subtractCounts(left, index, right
|
|
164
|
+
const count = subtractCounts(left, index, right);
|
|
175
165
|
return count > 0 ? [[key, count]] : [];
|
|
176
166
|
}),
|
|
177
167
|
);
|
|
@@ -182,7 +172,7 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
182
172
|
createWrongValueError("BagUnion", "a finite enumerable set", set),
|
|
183
173
|
);
|
|
184
174
|
if (elements.length < 2) return elements[0] ?? EMPTY_BAG;
|
|
185
|
-
const
|
|
175
|
+
const getBag = (element: Value) => {
|
|
186
176
|
const functionValue = toFunction(element);
|
|
187
177
|
if (!functionValue) {
|
|
188
178
|
throw new TlaModuleError(
|
|
@@ -190,43 +180,50 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
190
180
|
);
|
|
191
181
|
}
|
|
192
182
|
return functionValue;
|
|
183
|
+
};
|
|
184
|
+
const pairs = getPairs(getBag(elements[0]));
|
|
185
|
+
elements.slice(1).forEach((element) => {
|
|
186
|
+
const functionValue = getBag(element);
|
|
187
|
+
functionValue.domain.forEach((key, index) =>
|
|
188
|
+
addToBag(pairs, key, functionValue.range[index]),
|
|
189
|
+
);
|
|
193
190
|
});
|
|
194
|
-
return
|
|
191
|
+
return createFunction(pairs);
|
|
195
192
|
}),
|
|
196
193
|
defineOperator("\\sqsubseteq", 2, (args) => {
|
|
197
|
-
const
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
);
|
|
194
|
+
const leftValue = getValue(args, 0, "\\sqsubseteq");
|
|
195
|
+
const rightValue = getValue(args, 1, "\\sqsubseteq");
|
|
196
|
+
const left = toFunction(leftValue);
|
|
197
|
+
const right = toFunction(rightValue);
|
|
198
|
+
if (!left) throw createWrongValueError("\\sqsubseteq", FINITE_FUNCTION, leftValue);
|
|
199
|
+
if (!right) throw createWrongValueError("\\sqsubseteq", FINITE_FUNCTION, rightValue);
|
|
200
|
+
return left.domain.every((key, index) => {
|
|
201
|
+
const count = findCount(right, key);
|
|
202
|
+
return toCount(left.range[index]) <= (count === undefined ? 0 : toCount(count));
|
|
203
|
+
});
|
|
202
204
|
}),
|
|
203
205
|
defineHigherOrderOperator("BagOfAll", 2, (args) => {
|
|
204
206
|
const operator = getOperator(args, 0, "BagOfAll");
|
|
205
|
-
// TLC passes an operator whose body is a number or string literal to Bags.java as that literal.
|
|
206
|
-
if (operator.literalBody !== undefined) {
|
|
207
|
-
throw new TlaModuleError(
|
|
208
|
-
`The first argument of BagOfAll should be an operator, but instead it is:\n${formatValue(operator.literalBody)}`,
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
207
|
const value = getValue(args, 1, "BagOfAll");
|
|
212
208
|
const functionValue = toFunction(value);
|
|
213
209
|
if (!functionValue) {
|
|
214
210
|
throw createModuleArgumentError("second", "BagOfAll", "function with a finite domain", value);
|
|
215
211
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
),
|
|
220
|
-
BAG_OF_ALL_SIGNATURE,
|
|
212
|
+
const pairs: [Value, Value][] = [];
|
|
213
|
+
functionValue.domain.forEach((key, index) =>
|
|
214
|
+
addToBag(pairs, operator.call([key]), functionValue.range[index]),
|
|
221
215
|
);
|
|
216
|
+
return createFunction(pairs);
|
|
222
217
|
}),
|
|
223
218
|
defineOperator("SubBag", 1, (args) => {
|
|
224
219
|
const value = getValue(args, 0, "SubBag");
|
|
225
220
|
if (!isFunctionValue(value)) {
|
|
226
|
-
throw new TlaEvaluationError(
|
|
221
|
+
throw new TlaEvaluationError(
|
|
222
|
+
`Attempted to apply the operator DOMAIN to a non-function\n(${getKindString(value)})\nline 106, col 58 to line 106, col 65 of module Bags`,
|
|
223
|
+
);
|
|
227
224
|
}
|
|
228
225
|
const functionValue = toFiniteFunction(value);
|
|
229
|
-
const range =
|
|
226
|
+
const range = toFiniteSet(createEnumeratedSet(functionValue.range)).elements;
|
|
230
227
|
const invalid = range.find((count) => typeof count !== "number");
|
|
231
228
|
// A count that isn't an integer fails the comparison.
|
|
232
229
|
if (invalid !== undefined) builtins.get(">=")?.evaluateBinary?.(range[0], invalid);
|
|
@@ -242,7 +239,7 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
242
239
|
(subBags, key, index) =>
|
|
243
240
|
subBags.flatMap((entries) => [
|
|
244
241
|
entries,
|
|
245
|
-
...Array.from({ length: counts[index] }, (
|
|
242
|
+
...Array.from({ length: counts[index] }, (_value, copies): [Value, Value][] => [
|
|
246
243
|
...entries,
|
|
247
244
|
[key, copies + 1],
|
|
248
245
|
]),
|
|
@@ -261,7 +258,7 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
261
258
|
defineOperator("SetToBag", 1, (args) => {
|
|
262
259
|
const set = getValue(args, 0, "SetToBag");
|
|
263
260
|
const elements = getFiniteElements(set, () =>
|
|
264
|
-
createWrongValueError("BagToSet",
|
|
261
|
+
createWrongValueError("BagToSet", FINITE_FUNCTION, set),
|
|
265
262
|
);
|
|
266
263
|
return createSortedFunction(
|
|
267
264
|
[...elements],
|