tla-ts 0.0.4-dev.702eb98 → 0.0.4-dev.7714e32
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 +32 -6
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/deciders.cjs +27 -27
- package/dist/deciders.js +34 -34
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -14
- package/dist/index.d.ts +12 -14
- 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 +516 -25
- package/dist/prove.js +518 -27
- package/dist/run.cjs +45 -0
- package/dist/run.js +45 -0
- package/dist/tlapm.cjs +2 -2
- package/dist/tlapm.js +2 -2
- package/dist/transfer.cjs +76 -86
- package/dist/transfer.js +73 -83
- package/dist/worker.cjs +6 -6
- package/dist/worker.js +6 -6
- package/package.json +1 -1
- package/src/ast.ts +2 -2
- package/src/bags.ts +22 -23
- package/src/builtins.ts +16 -8
- package/src/check.ts +131 -1154
- package/src/{cli-options.ts → cli/options.ts} +54 -9
- package/src/cli/run.ts +63 -0
- package/src/cli/shared.ts +106 -0
- package/src/cli/tlapm.ts +374 -0
- package/src/{run-cli.ts → cli/tlc.ts} +112 -761
- package/src/cli/xml-exporter.ts +221 -0
- package/src/cli.ts +1 -1
- package/src/codegen.ts +17 -15
- package/src/config.ts +5 -5
- package/src/dependencies.ts +4 -6
- package/src/environment.ts +55 -60
- package/src/errors.ts +12 -36
- package/src/evaluate.ts +81 -101
- package/src/exit-codes.ts +1 -1
- package/src/fingerprints.ts +3 -3
- package/src/index.ts +2 -2
- package/src/instances.ts +56 -46
- package/src/java-overrides.ts +79 -41
- package/src/json.ts +31 -36
- package/src/levels.ts +10 -13
- package/src/{live-check.ts → liveness-checker.ts} +169 -142
- package/src/liveness.ts +38 -34
- package/src/obligations/action.ts +58 -105
- package/src/obligations/{anon.ts → anonymize.ts} +44 -52
- package/src/obligations/equality.ts +260 -0
- package/src/obligations/expression.ts +42 -530
- package/src/obligations/format.ts +7 -8
- package/src/obligations/generate.ts +93 -783
- package/src/obligations/index.ts +23 -23
- package/src/obligations/levels.ts +38 -44
- package/src/obligations/module.ts +106 -729
- package/src/obligations/normalize.ts +554 -0
- package/src/obligations/operators.ts +176 -0
- package/src/obligations/pragma.ts +35 -29
- package/src/obligations/printer.ts +98 -209
- package/src/obligations/proof.ts +0 -1
- package/src/obligations/regroup.ts +100 -0
- package/src/obligations/simplify.ts +668 -0
- package/src/obligations/source.ts +92 -192
- package/src/obligations/{deref.ts → subexpression.ts} +82 -113
- package/src/obligations/substitution.ts +261 -0
- package/src/obligations/temporal.ts +32 -30
- package/src/obligations/tuples.ts +37 -53
- package/src/parallel-worker.ts +37 -33
- package/src/parallel.ts +30 -24
- package/src/parser.ts +67 -74
- package/src/{pcal-ast.ts → pcal/ast.ts} +2 -17
- package/src/{pcal-parse.ts → pcal/parse.ts} +28 -64
- package/src/{pcal-tokenize.ts → pcal/tokenize.ts} +10 -39
- package/src/{pcal-translate.ts → pcal/translate.ts} +30 -109
- package/src/{pcal-validate.ts → pcal/validate.ts} +10 -20
- package/src/{prove → prover}/decide-pool.ts +14 -19
- package/src/{prove → prover}/deciders.ts +7 -1
- package/src/{obligations/pickle.ts → prover/first-order.ts} +79 -4
- package/src/{prove → prover}/isabelle/decide.ts +3 -6
- package/src/{prove → prover}/isabelle/encode.ts +106 -138
- package/src/{prove → prover}/isabelle/isar/inner-syntax.ts +1 -1
- package/src/{prove → prover}/isabelle/isar/method.ts +3 -3
- package/src/{prove → prover}/isabelle/isar/type-check.ts +1 -1
- package/src/{prove → prover}/isabelle/provers/blast/blast.ts +1 -1
- package/src/{prove → prover}/isabelle/provers/blast/branch.ts +1 -1
- package/src/{prove → prover}/isabelle/provers/blast/term.ts +3 -4
- package/src/{prove → prover}/isabelle/provers/clasimp.ts +1 -1
- package/src/{prove → prover}/isabelle/provers/classical.ts +3 -3
- package/src/{prove → prover}/isabelle/provers/hypsubst.ts +1 -9
- package/src/{prove → prover}/isabelle/pure/conv.ts +1 -1
- package/src/{prove → prover}/isabelle/pure/drule.ts +2 -2
- package/src/{prove → prover}/isabelle/pure/envir.ts +3 -35
- package/src/{prove → prover}/isabelle/pure/logic.ts +4 -76
- package/src/{prove → prover}/isabelle/pure/name.ts +1 -13
- package/src/{prove → prover}/isabelle/pure/net.ts +2 -49
- package/src/{prove → prover}/isabelle/pure/pattern.ts +3 -22
- package/src/{prove → prover}/isabelle/pure/raw-simplifier.ts +3 -18
- package/src/{prove → prover}/isabelle/pure/seq.ts +0 -23
- package/src/{prove → prover}/isabelle/pure/simplifier.ts +2 -8
- package/src/{prove → prover}/isabelle/pure/table.ts +1 -8
- package/src/{prove → prover}/isabelle/pure/tactic.ts +5 -113
- package/src/{prove → prover}/isabelle/pure/tactical.ts +1 -84
- package/src/{prove → prover}/isabelle/pure/term-ord.ts +1 -55
- package/src/{prove → prover}/isabelle/pure/term.ts +8 -128
- package/src/{prove → prover}/isabelle/pure/thm.ts +4 -27
- package/src/{prove → prover}/isabelle/pure/type.ts +0 -12
- package/src/{prove → prover}/isabelle/pure/unify.ts +1 -1
- package/src/{prove → prover}/isabelle/tla/classical-setup.ts +1 -1
- package/src/{prove → prover}/ocaml.ts +1 -1
- package/src/{prove → prover}/prep/action.ts +54 -66
- package/src/{prove → prover}/prep/enabled-axioms.ts +2 -2
- package/src/{prove → prover}/prep/fingerprint.ts +3 -3
- package/src/{prove → prover}/prep/level-comparison.ts +15 -38
- package/src/{prove → prover}/prep/md5.ts +2 -9
- package/src/{prove/prep/pragma.ts → prover/prep/methods.ts} +4 -4
- package/src/prover/prep/normalize.ts +309 -0
- package/src/{prove → prover}/prove-worker.ts +4 -11
- package/src/prover/prove.ts +492 -0
- package/src/{prove → prover}/ptl/encode.ts +19 -31
- package/src/{prove → prover}/smt/axioms.ts +78 -79
- package/src/{prove → prover}/smt/data.ts +16 -45
- package/src/{prove → prover}/smt/encode.ts +134 -28
- package/src/{prove → prover}/smt/extensionality.ts +14 -12
- package/src/{prove → prover}/smt/flatten.ts +3 -18
- package/src/{prove → prover}/smt/format.ts +14 -3
- package/src/{prove → prover}/smt/instances.ts +4 -5
- package/src/{prove → prover}/smt/rewrite.ts +41 -59
- package/src/{prove → prover}/smt/solver/ast-util.ts +0 -56
- package/src/{prove → prover}/smt/solver/case-split-queue.ts +1 -1
- package/src/{prove → prover}/smt/solver/enode.ts +1 -1
- package/src/{prove → prover}/smt/solver/lp/dep-intervals.ts +0 -14
- package/src/{prove → prover}/smt/solver/model-macro-solver.ts +1 -1
- package/src/{prove → prover}/smt/solver/nlsat/algebraic.ts +3 -3
- package/src/{prove → prover}/smt/solver/nlsat/atoms.ts +1 -1
- package/src/{prove → prover}/smt/solver/nlsat/explain.ts +1 -1
- package/src/{prove → prover}/smt/solver/nlsat/interval-set.ts +1 -1
- package/src/{prove → prover}/smt/solver/nlsat/levelwise.ts +4 -7
- package/src/{prove → prover}/smt/solver/nlsat/polynomial.ts +4 -4
- package/src/{prove → prover}/smt/solver/nlsat/upolynomial.ts +2 -2
- package/src/{prove → prover}/smt/solver/pattern-inference.ts +1 -1
- package/src/{prove → prover}/smt/solver/relevancy.ts +2 -2
- package/src/{prove → prover}/smt/solver/rewriter.ts +1 -1
- package/src/{prove → prover}/smt/solver/solver.ts +2 -2
- package/src/prover/tlapm/cache.ts +236 -0
- package/src/prover/tlapm/ocaml-marshal.ts +166 -0
- package/src/{prove → prover}/tlapm/tlapm.ts +1 -2
- package/src/prover/verdict.ts +13 -0
- package/src/{prove → prover}/zenon/decide.ts +5 -11
- package/src/{prove → prover}/zenon/encode.ts +40 -106
- package/src/{prove → prover}/zenon/eqrel.ts +1 -1
- package/src/{prove → prover}/zenon/equality-rules.ts +1 -1
- package/src/{prove → prover}/zenon/expr.ts +2 -2
- package/src/{prove → prover}/zenon/index-table.ts +1 -1
- package/src/{prove → prover}/zenon/isar.ts +1 -1
- package/src/{prove → prover}/zenon/llproof.ts +1 -1
- package/src/{prove → prover}/zenon/mltoll.ts +1 -1
- package/src/{prove → prover}/zenon/node.ts +1 -1
- package/src/{prove → prover}/zenon/search.ts +1 -1
- package/src/{prove → prover}/zenon/tla/terms.ts +1 -20
- package/src/{prove → prover}/zenon/tla/tla.ts +1 -1
- package/src/randomization.ts +19 -24
- package/src/resolve.ts +15 -22
- package/src/runtime.ts +8 -8
- package/src/{sany-builtins.ts → sany/builtins.ts} +1 -1
- package/src/{sany-generator.ts → sany/generator.ts} +38 -55
- package/src/{sany-levels.ts → sany/levels.ts} +45 -48
- package/src/{sany-lexer.ts → sany/lexer.ts} +2 -3
- package/src/{sany-linter.ts → sany/linter.ts} +1 -1
- package/src/{sany-modules.ts → sany/modules.ts} +2 -2
- package/src/{sany-nodes.ts → sany/nodes.ts} +2 -2
- package/src/{sany-parse-error.ts → sany/parse-error.ts} +2 -2
- package/src/{sany-report.ts → sany/report.ts} +16 -17
- package/src/{sany-selectors.ts → sany/selectors.ts} +3 -5
- package/src/{sany-source.ts → sany/source.ts} +6 -7
- package/src/{sany-xml.ts → sany/xml.ts} +5 -6
- package/src/search.ts +969 -0
- package/src/spec-description.ts +26 -20
- package/src/{standard-levels.ts → standard-definitions.ts} +118 -2
- package/src/standard-modules.ts +16 -20
- package/src/state-graph.ts +9 -8
- package/src/substitution-levels.ts +2 -2
- package/src/successors.ts +16 -19
- package/src/symmetry.ts +1 -1
- package/src/tableau.ts +6 -7
- package/src/tlc/fingerprint.ts +214 -0
- package/src/{tlc-messages.ts → tlc/messages.ts} +119 -7
- package/src/{tlc-order.ts → tlc/order.ts} +7 -7
- package/src/{tlc-random.ts → tlc/random.ts} +3 -213
- package/src/{tlc-replay.ts → tlc/replay.ts} +40 -36
- package/src/{tlc-module.ts → tlc/tlc-operators.ts} +9 -9
- package/src/{tlc-ext.ts → tlc/tlcext-operators.ts} +30 -25
- package/src/transfer.ts +32 -32
- package/src/values.ts +72 -67
- package/src/worker.ts +1 -4
- package/dist/run-cli.cjs +0 -38
- package/dist/run-cli.js +0 -38
- package/src/canonical.ts +0 -40
- package/src/obligations/ctx.ts +0 -64
- package/src/prove/prep/defs.ts +0 -27
- package/src/prove/prep/elab.ts +0 -156
- package/src/prove/prep/enabled.ts +0 -43
- package/src/prove/prep/flatten.ts +0 -70
- package/src/prove/prep/trivial.ts +0 -22
- package/src/prove/prove.ts +0 -417
- package/src/prove/smt/axiomatize.ts +0 -69
- package/src/prove/smt/simplify.ts +0 -57
- package/src/prove/verdict.ts +0 -13
- package/src/standard-ranges.ts +0 -116
- package/src/value-sources.ts +0 -29
- /package/src/{prove → prover}/isabelle/LICENSE +0 -0
- /package/src/{prove → prover}/isabelle/LICENSE-tlapm +0 -0
- /package/src/{prove → prover}/isabelle/isar/proof.ts +0 -0
- /package/src/{prove → prover}/isabelle/isar/statement.ts +0 -0
- /package/src/{prove → prover}/isabelle/isar/theory.ts +0 -0
- /package/src/{prove → prover}/isabelle/provers/blast/prove.ts +0 -0
- /package/src/{prove → prover}/isabelle/provers/blast/rules.ts +0 -0
- /package/src/{prove → prover}/isabelle/provers/blast/state.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/bicompose.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/consts.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/goal.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/interrupt.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/list.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/object-logic.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/rewriter.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/search.ts +0 -0
- /package/src/{prove → prover}/isabelle/pure/variable.ts +0 -0
- /package/src/{prove → prover}/isabelle/tla/context.ts +0 -0
- /package/src/{prove → prover}/isabelle/tla/logic-data.ts +0 -0
- /package/src/{prove → prover}/isabelle/tla/logic.ts +0 -0
- /package/src/{prove → prover}/isabelle/tla/simpdata.ts +0 -0
- /package/src/{prove → prover}/isabelle/tools/intuitionistic.ts +0 -0
- /package/src/{prove → prover}/ptl/decide.ts +0 -0
- /package/src/{prove → prover}/ptl/sat.ts +0 -0
- /package/src/{prove → prover}/ptl/tableau.ts +0 -0
- /package/src/{prove → prover}/smt/context.ts +0 -0
- /package/src/{prove → prover}/smt/solver/act-cache.ts +0 -0
- /package/src/{prove → prover}/smt/solver/arith-rewriter.ts +0 -0
- /package/src/{prove → prover}/smt/solver/array.ts +0 -0
- /package/src/{prove → prover}/smt/solver/asserted-formulas.ts +0 -0
- /package/src/{prove → prover}/smt/solver/ast-lt.ts +0 -0
- /package/src/{prove → prover}/smt/solver/ast.ts +0 -0
- /package/src/{prove → prover}/smt/solver/auf-solver.ts +0 -0
- /package/src/{prove → prover}/smt/solver/cg-table.ts +0 -0
- /package/src/{prove → prover}/smt/solver/clause.ts +0 -0
- /package/src/{prove → prover}/smt/solver/conflict-resolution.ts +0 -0
- /package/src/{prove → prover}/smt/solver/context.ts +0 -0
- /package/src/{prove → prover}/smt/solver/ctx-simplify.ts +0 -0
- /package/src/{prove → prover}/smt/solver/der.ts +0 -0
- /package/src/{prove → prover}/smt/solver/dyn-ack.ts +0 -0
- /package/src/{prove → prover}/smt/solver/e-matching.ts +0 -0
- /package/src/{prove → prover}/smt/solver/expr-ref.ts +0 -0
- /package/src/{prove → prover}/smt/solver/expr-safe-replace.ts +0 -0
- /package/src/{prove → prover}/smt/solver/fingerprints.ts +0 -0
- /package/src/{prove → prover}/smt/solver/flat-literals.ts +0 -0
- /package/src/{prove → prover}/smt/solver/goal.ts +0 -0
- /package/src/{prove → prover}/smt/solver/hash.ts +0 -0
- /package/src/{prove → prover}/smt/solver/hashtable.ts +0 -0
- /package/src/{prove → prover}/smt/solver/internalizer.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lbool.ts +0 -0
- /package/src/{prove → prover}/smt/solver/literal.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/bound-propagator.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/constraints.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/containers.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/core-solver.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/cross-nested.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/dependency.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/dioph-eq.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/explanation.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/gomory.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/hnf-cutter.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/hnf.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/int-cube.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/int-solver.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/lar-solver.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/lar-term.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/lp-settings.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/maximize-term.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nex-creator.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nex.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-backoff.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-basics.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-core.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-divisions.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-emonics.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-factorization.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-grobner.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-horner.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-intervals.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-monomial-bounds.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-monotone.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-order.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-patcher.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-tangents.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-throttle.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-types.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nla-var-eqs.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/nra-solver.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/numeric-pair.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/pdd-interval.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/pdd-simplifier.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/pdd-solver.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/pdd.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/random-updater.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/static-matrix.ts +0 -0
- /package/src/{prove → prover}/smt/solver/lp/union-find.ts +0 -0
- /package/src/{prove → prover}/smt/solver/mam-compiler.ts +0 -0
- /package/src/{prove → prover}/smt/solver/mam-interpreter.ts +0 -0
- /package/src/{prove → prover}/smt/solver/maximize-ac-sharing.ts +0 -0
- /package/src/{prove → prover}/smt/solver/model-checker.ts +0 -0
- /package/src/{prove → prover}/smt/solver/model-evaluator.ts +0 -0
- /package/src/{prove → prover}/smt/solver/model-finder.ts +0 -0
- /package/src/{prove → prover}/smt/solver/model-generator.ts +0 -0
- /package/src/{prove → prover}/smt/solver/nlsat/evaluator.ts +0 -0
- /package/src/{prove → prover}/smt/solver/nlsat/mpbq.ts +0 -0
- /package/src/{prove → prover}/smt/solver/nlsat/solver.ts +0 -0
- /package/src/{prove → prover}/smt/solver/nlsat/types.ts +0 -0
- /package/src/{prove → prover}/smt/solver/nlsat/upolynomial-factorization.ts +0 -0
- /package/src/{prove → prover}/smt/solver/nnf.ts +0 -0
- /package/src/{prove → prover}/smt/solver/poly-rewriter.ts +0 -0
- /package/src/{prove → prover}/smt/solver/propagate-values.ts +0 -0
- /package/src/{prove → prover}/smt/solver/proto-model.ts +0 -0
- /package/src/{prove → prover}/smt/solver/pull-quant.ts +0 -0
- /package/src/{prove → prover}/smt/solver/qe-lite-der.ts +0 -0
- /package/src/{prove → prover}/smt/solver/qe-lite-fm.ts +0 -0
- /package/src/{prove → prover}/smt/solver/qe-lite.ts +0 -0
- /package/src/{prove → prover}/smt/solver/qi-queue.ts +0 -0
- /package/src/{prove → prover}/smt/solver/quant-tactics.ts +0 -0
- /package/src/{prove → prover}/smt/solver/quantifier-analyzer.ts +0 -0
- /package/src/{prove → prover}/smt/solver/quantifier-manager.ts +0 -0
- /package/src/{prove → prover}/smt/solver/random-gen.ts +0 -0
- /package/src/{prove → prover}/smt/solver/rational.ts +0 -0
- /package/src/{prove → prover}/smt/solver/ref-vector.ts +0 -0
- /package/src/{prove → prover}/smt/solver/rewriter-tpl.ts +0 -0
- /package/src/{prove → prover}/smt/solver/rlimit.ts +0 -0
- /package/src/{prove → prover}/smt/solver/smtlib-parser.ts +0 -0
- /package/src/{prove → prover}/smt/solver/sort.ts +0 -0
- /package/src/{prove → prover}/smt/solver/sticky-generations.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra-axioms.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra-bounds.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra-final-check.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra-internalize.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra-model.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra-propagate.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra-state.ts +0 -0
- /package/src/{prove → prover}/smt/solver/theory-lra.ts +0 -0
- /package/src/{prove → prover}/smt/solver/var-subst.ts +0 -0
- /package/src/{prove → prover}/smt/solver/z3-license.txt +0 -0
- /package/src/{prove → prover}/smt/table.ts +0 -0
- /package/src/{prove → prover}/tlaps-module.ts +0 -0
- /package/src/{prove → prover}/zenon/LICENSE +0 -0
- /package/src/{prove → prover}/zenon/check/check.ts +0 -0
- /package/src/{prove → prover}/zenon/check/definitions.ts +0 -0
- /package/src/{prove → prover}/zenon/check/equality.ts +0 -0
- /package/src/{prove → prover}/zenon/check/functions.ts +0 -0
- /package/src/{prove → prover}/zenon/check/keys.ts +0 -0
- /package/src/{prove → prover}/zenon/check/propositional.ts +0 -0
- /package/src/{prove → prover}/zenon/check/records.ts +0 -0
- /package/src/{prove → prover}/zenon/check/relations.ts +0 -0
- /package/src/{prove → prover}/zenon/check/rewrites.ts +0 -0
- /package/src/{prove → prover}/zenon/check/sets.ts +0 -0
- /package/src/{prove → prover}/zenon/check/terms.ts +0 -0
- /package/src/{prove → prover}/zenon/check/tla.ts +0 -0
- /package/src/{prove → prover}/zenon/isar-case.ts +0 -0
- /package/src/{prove → prover}/zenon/limits.ts +0 -0
- /package/src/{prove → prover}/zenon/ocaml.ts +0 -0
- /package/src/{prove → prover}/zenon/parse.ts +0 -0
- /package/src/{prove → prover}/zenon/phrase.ts +0 -0
- /package/src/{prove → prover}/zenon/proof.ts +0 -0
- /package/src/{prove → prover}/zenon/propositional-rules.ts +0 -0
- /package/src/{prove → prover}/zenon/rules.ts +0 -0
- /package/src/{prove → prover}/zenon/tla/functions.ts +0 -0
- /package/src/{prove → prover}/zenon/tla/llproof.ts +0 -0
- /package/src/{prove → prover}/zenon/tla/records.ts +0 -0
- /package/src/{prove → prover}/zenon/tla/rewrites.ts +0 -0
- /package/src/{prove → prover}/zenon/tla/sets.ts +0 -0
- /package/src/{tlc-modules.ts → tlc/jar-data.ts} +0 -0
- /package/src/{tlc-summary.ts → tlc/summary.ts} +0 -0
- /package/src/{tlc-version.ts → tlc/version.ts} +0 -0
|
@@ -17,14 +17,12 @@ import {
|
|
|
17
17
|
type Table,
|
|
18
18
|
} from "./table";
|
|
19
19
|
import {
|
|
20
|
-
binderTypes as plainBinderTypes,
|
|
21
20
|
flagsOf,
|
|
22
21
|
funT,
|
|
23
22
|
HAS_ETA_REDEX,
|
|
24
23
|
HAS_REDEX,
|
|
25
24
|
HAS_VAR,
|
|
26
25
|
isDependent,
|
|
27
|
-
listComb,
|
|
28
26
|
maxidxOfTerm,
|
|
29
27
|
mkAbs,
|
|
30
28
|
mkApp,
|
|
@@ -33,8 +31,6 @@ import {
|
|
|
33
31
|
substBound,
|
|
34
32
|
updateAbs,
|
|
35
33
|
updateApp,
|
|
36
|
-
incrBoundvars,
|
|
37
|
-
fastypeOf1,
|
|
38
34
|
aconv,
|
|
39
35
|
type Term,
|
|
40
36
|
type Typ,
|
|
@@ -63,7 +59,7 @@ export const emptyEnvir = (maxidx: number): Envir => ({
|
|
|
63
59
|
tyenv: emptyTyEnv,
|
|
64
60
|
});
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
const initEnvir = emptyEnvir(-1);
|
|
67
63
|
|
|
68
64
|
export const isEmptyEnvir = (envir: Envir) => isEmptyTable(envir.tenv) && isEmptyTable(envir.tyenv);
|
|
69
65
|
|
|
@@ -146,7 +142,7 @@ export const vupdate = (variable: Var, term: Term, envir: Envir): Envir => {
|
|
|
146
142
|
return update(variable, term, envir);
|
|
147
143
|
};
|
|
148
144
|
|
|
149
|
-
|
|
145
|
+
const couldBetaContract = (term: Term) => (flagsOf(term) & HAS_REDEX) !== 0;
|
|
150
146
|
|
|
151
147
|
const normTerm1 = (tenv: TEnv, term: Term): Term => {
|
|
152
148
|
if ((flagsOf(term) & (HAS_VAR | HAS_REDEX)) === 0) return term;
|
|
@@ -224,32 +220,6 @@ export const headNorm = (envir: Envir, term: Term): Term => {
|
|
|
224
220
|
}
|
|
225
221
|
};
|
|
226
222
|
|
|
227
|
-
export const etaLong = (types: readonly Typ[], term: Term): Term => {
|
|
228
|
-
if (term.kind === "Abs")
|
|
229
|
-
return mkAbs(term.name, term.type, etaLong([term.type, ...types], term.body));
|
|
230
|
-
const [head, args] = stripCombLocal(term);
|
|
231
|
-
if (head.kind === "Abs") return etaLong(types, betaNorm(term));
|
|
232
|
-
const binders = plainBinderTypes(fastypeOf1(types, term));
|
|
233
|
-
const count = binders.length;
|
|
234
|
-
const inner = [...binders].reverse().concat(types);
|
|
235
|
-
const long = (current: Term) => etaLong(inner, current);
|
|
236
|
-
const body = listComb(incrBoundvars(count, head), [
|
|
237
|
-
...args.map((arg) => long(incrBoundvars(count, arg))),
|
|
238
|
-
...binders.map((_type, position) => long(mkBound(count - 1 - position))),
|
|
239
|
-
]);
|
|
240
|
-
return binders.reduceRight((result, type) => mkAbs("x", type, result), body);
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
const stripCombLocal = (term: Term): [Term, Term[]] => {
|
|
244
|
-
const args: Term[] = [];
|
|
245
|
-
let current = term;
|
|
246
|
-
while (current.kind === "App") {
|
|
247
|
-
args.unshift(current.arg);
|
|
248
|
-
current = current.fun;
|
|
249
|
-
}
|
|
250
|
-
return [current, args];
|
|
251
|
-
};
|
|
252
|
-
|
|
253
223
|
const decrementLoose = (term: Term, level: number): Term => {
|
|
254
224
|
switch (term.kind) {
|
|
255
225
|
case "Bound":
|
|
@@ -263,7 +233,7 @@ const decrementLoose = (term: Term, level: number): Term => {
|
|
|
263
233
|
}
|
|
264
234
|
};
|
|
265
235
|
|
|
266
|
-
|
|
236
|
+
const couldEtaContract = (term: Term) => (flagsOf(term) & HAS_ETA_REDEX) !== 0;
|
|
267
237
|
|
|
268
238
|
const etaSame = (term: Term): Term => {
|
|
269
239
|
if (!couldEtaContract(term)) return term;
|
|
@@ -283,8 +253,6 @@ const etaSame = (term: Term): Term => {
|
|
|
283
253
|
// Envir.eta_contract
|
|
284
254
|
export const etaContract = (term: Term) => (couldEtaContract(term) ? etaSame(term) : term);
|
|
285
255
|
|
|
286
|
-
export const betaEtaContract = (term: Term) => etaContract(betaNorm(term));
|
|
287
|
-
|
|
288
256
|
export const aeconv = (left: Term, right: Term) =>
|
|
289
257
|
aconv(left, right) || aconv(etaContract(left), etaContract(right));
|
|
290
258
|
|
|
@@ -3,17 +3,13 @@
|
|
|
3
3
|
// LICENSE.
|
|
4
4
|
|
|
5
5
|
import { TlaIsabelleError } from "../../../errors";
|
|
6
|
-
import {
|
|
6
|
+
import { variantList } from "./name";
|
|
7
7
|
import {
|
|
8
8
|
aconv,
|
|
9
|
-
addFreeNames,
|
|
10
9
|
fastypeOf,
|
|
11
10
|
funT,
|
|
12
11
|
funTs,
|
|
13
12
|
incrBoundvars,
|
|
14
|
-
isDependent,
|
|
15
|
-
abstractOver,
|
|
16
|
-
termName,
|
|
17
13
|
mapAtyps,
|
|
18
14
|
mkAbs,
|
|
19
15
|
mkApp,
|
|
@@ -24,7 +20,6 @@ import {
|
|
|
24
20
|
mkVar,
|
|
25
21
|
mayOccur,
|
|
26
22
|
propT,
|
|
27
|
-
substBounds,
|
|
28
23
|
type App,
|
|
29
24
|
type Term,
|
|
30
25
|
type Typ,
|
|
@@ -45,12 +40,6 @@ export interface Binder {
|
|
|
45
40
|
|
|
46
41
|
export const allConst = (type: Typ) => mkConst("Pure.all", funT(funT(type, propT), propT));
|
|
47
42
|
|
|
48
|
-
export const isAll = (term: Term) =>
|
|
49
|
-
term.kind === "App" &&
|
|
50
|
-
term.fun.kind === "Const" &&
|
|
51
|
-
term.fun.name === "Pure.all" &&
|
|
52
|
-
term.arg.kind === "Abs";
|
|
53
|
-
|
|
54
43
|
export const listAll = (vars: readonly Binder[], body: Term): Term =>
|
|
55
44
|
vars.reduceRight<Term>(
|
|
56
45
|
(result, variable) =>
|
|
@@ -58,15 +47,6 @@ export const listAll = (vars: readonly Binder[], body: Term): Term =>
|
|
|
58
47
|
body,
|
|
59
48
|
);
|
|
60
49
|
|
|
61
|
-
// Logic.dependent_all_name
|
|
62
|
-
export const dependentAllName = (name: string, variable: Term, body: Term) => {
|
|
63
|
-
const abstracted = abstractOver(variable, body);
|
|
64
|
-
const type = fastypeOf(variable);
|
|
65
|
-
return isDependent(abstracted)
|
|
66
|
-
? mkApp(allConst(type), mkAbs(name === "" ? termName(variable) : name, type, abstracted))
|
|
67
|
-
: body;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
50
|
export const mkEquals = (left: Term, right: Term) => {
|
|
71
51
|
const type = fastypeOf(left);
|
|
72
52
|
return mkApp(mkApp(mkConst("Pure.eq", funTs([type, type], propT)), left), right);
|
|
@@ -134,25 +114,13 @@ export const stripPrems = (
|
|
|
134
114
|
|
|
135
115
|
export const countPrems = (term: Term) => stripImpPrems(term).length;
|
|
136
116
|
|
|
137
|
-
|
|
138
|
-
const premise = stripImpPrems(term)[index - 1];
|
|
139
|
-
if (index < 1 || premise === undefined) throw new TlaIsabelleError("TERM", "nth_prem");
|
|
140
|
-
return premise;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export const protectConst = mkConst("Pure.prop", funT(propT, propT));
|
|
117
|
+
const protectConst = mkConst("Pure.prop", funT(propT, propT));
|
|
144
118
|
|
|
145
119
|
export const protect = (term: Term) => mkApp(protectConst, term);
|
|
146
120
|
|
|
147
121
|
export const isProtected = (term: Term) =>
|
|
148
122
|
term.kind === "App" && term.fun.kind === "Const" && term.fun.name === "Pure.prop";
|
|
149
123
|
|
|
150
|
-
export const unprotect = (term: Term) => {
|
|
151
|
-
if (term.kind !== "App" || term.fun.kind !== "Const" || term.fun.name !== "Pure.prop")
|
|
152
|
-
throw new TlaIsabelleError("TERM", "unprotect");
|
|
153
|
-
return term.arg;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
124
|
export const mkTerm = (term: Term) =>
|
|
157
125
|
mkApp(mkConst("Pure.term", funT(fastypeOf(term), propT)), term);
|
|
158
126
|
|
|
@@ -174,7 +142,7 @@ const incrTVar = (increment: number, type: Typ) =>
|
|
|
174
142
|
);
|
|
175
143
|
|
|
176
144
|
// Logic.incr_indexes_operation: lifts the variables over the types and increments their indexes.
|
|
177
|
-
|
|
145
|
+
const incrIndexesFixed = (
|
|
178
146
|
fixed: readonly string[],
|
|
179
147
|
types: readonly Typ[],
|
|
180
148
|
increment: number,
|
|
@@ -336,17 +304,6 @@ export const flattenParams = (index: number, term: Term) => {
|
|
|
336
304
|
return listAll(vars, removeParams(vars.length, index, term));
|
|
337
305
|
};
|
|
338
306
|
|
|
339
|
-
export const listRenameParams = (names: readonly string[], term: Term): Term => {
|
|
340
|
-
if (isConstApp2(term, "Pure.imp"))
|
|
341
|
-
return mkImplies(term.fun.arg, listRenameParams(names, term.arg));
|
|
342
|
-
if (names.length > 0 && isAllAbs(term))
|
|
343
|
-
return mkApp(
|
|
344
|
-
term.fun,
|
|
345
|
-
mkAbs(names[0], term.arg.type, listRenameParams(names.slice(1), term.arg.body)),
|
|
346
|
-
);
|
|
347
|
-
return term;
|
|
348
|
-
};
|
|
349
|
-
|
|
350
307
|
// Logic.strip_assums_imp: strips at most count premises.
|
|
351
308
|
const stripAssumsImp = (count: number, hyps: Term[], term: Term): [Term[], Term] => {
|
|
352
309
|
if (count === 0) return [hyps, term];
|
|
@@ -360,15 +317,7 @@ const stripAssumsAll = (params: Binder[], term: Term): [Binder[], Term] =>
|
|
|
360
317
|
? stripAssumsAll([{ name: term.arg.name, type: term.arg.type }, ...params], term.arg.body)
|
|
361
318
|
: [params, term];
|
|
362
319
|
|
|
363
|
-
|
|
364
|
-
export const assumPairs = (count: number, term: Term): [Term, Term][] => {
|
|
365
|
-
const [params, body] = stripAssumsAll([], term);
|
|
366
|
-
const [hyps, conclusion] = stripAssumsImp(count, [], body);
|
|
367
|
-
const target = rlistAbs(params, conclusion);
|
|
368
|
-
return [...hyps].reverse().map((hyp): [Term, Term] => [rlistAbs(params, hyp), target]);
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
export interface AssumProblems {
|
|
320
|
+
interface AssumProblems {
|
|
372
321
|
readonly abstract: (term: Term) => Term;
|
|
373
322
|
readonly hyps: Term[];
|
|
374
323
|
readonly conclusion: Term;
|
|
@@ -379,24 +328,3 @@ export const assumProblems = (count: number, term: Term): AssumProblems => {
|
|
|
379
328
|
const [hyps, conclusion] = stripAssumsImp(count, [], body);
|
|
380
329
|
return { abstract: (inner) => rlistAbs(params, inner), hyps: [...hyps].reverse(), conclusion };
|
|
381
330
|
};
|
|
382
|
-
|
|
383
|
-
// Logic.goal_params
|
|
384
|
-
export const goalParams = (state: Term, index: number): [Term, Term[]] => {
|
|
385
|
-
const goal = nthPrem(index, state);
|
|
386
|
-
const params = stripParams(goal);
|
|
387
|
-
const names = variantNames(
|
|
388
|
-
params.map((param) => param.name),
|
|
389
|
-
makeNameContext(addFreeNames(goal, [])),
|
|
390
|
-
);
|
|
391
|
-
return [goal, params.map((param, position) => mkFree(names[position], param.type)).reverse()];
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
export const conclOfGoal = (state: Term, index: number) => {
|
|
395
|
-
const [goal, frees] = goalParams(state, index);
|
|
396
|
-
return substBounds(frees, stripAssumsConcl(goal));
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
export const premsOfGoal = (state: Term, index: number) => {
|
|
400
|
-
const [goal, frees] = goalParams(state, index);
|
|
401
|
-
return stripAssumsHyp(goal).map((hyp) => substBounds(frees, hyp));
|
|
402
|
-
};
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
// contributors, see LICENSE.
|
|
4
4
|
|
|
5
5
|
// Symbol.explode: \<name> symbols count as one symbol.
|
|
6
|
-
|
|
7
|
-
text.match(/\\<\^?[A-Za-z0-9_']*>|[^]/gu) ?? [];
|
|
6
|
+
const explodeSymbols = (text: string): string[] => text.match(/\\<\^?[A-Za-z0-9_']*>|[^]/gu) ?? [];
|
|
8
7
|
|
|
9
8
|
const isRawSymbolic = (symbol: string) => symbol.startsWith("\\<") && !symbol.startsWith("\\<^");
|
|
10
9
|
|
|
@@ -92,17 +91,6 @@ export const variantNames = (names: readonly string[], context: NameContext) =>
|
|
|
92
91
|
export const variantList = (used: readonly string[], names: readonly string[]) =>
|
|
93
92
|
variantNames(names, makeNameContext(used));
|
|
94
93
|
|
|
95
|
-
// Name.invent: count fresh names starting from name.
|
|
96
|
-
export const inventNames = (context: NameContext, name: string, count: number) => {
|
|
97
|
-
const names: string[] = [];
|
|
98
|
-
let current = cleanName(name);
|
|
99
|
-
while (names.length < count) {
|
|
100
|
-
if (!context.has(current)) names.push(current);
|
|
101
|
-
current = bumpString(current);
|
|
102
|
-
}
|
|
103
|
-
return names;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
94
|
// Name.is_bound and Name.bound: the names of loose bound variables in nets and printing.
|
|
107
95
|
// Name.is_bound: the names the simplifier gives the free variables standing for bound ones.
|
|
108
96
|
export const isBoundName = (name: string) => name.startsWith(":");
|
|
@@ -8,14 +8,13 @@ import {
|
|
|
8
8
|
foldTable,
|
|
9
9
|
isEmptyTable,
|
|
10
10
|
lookupTable,
|
|
11
|
-
tableEntries,
|
|
12
11
|
updateTable,
|
|
13
12
|
deleteTable,
|
|
14
13
|
type Table,
|
|
15
14
|
} from "./table";
|
|
16
15
|
import { headOf, type Term } from "./term";
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
type NetKey =
|
|
19
18
|
| { readonly kind: "Comb" }
|
|
20
19
|
| { readonly kind: "Var" }
|
|
21
20
|
| { readonly kind: "Atom"; readonly name: string };
|
|
@@ -105,18 +104,11 @@ export const insertNet = <Item>(
|
|
|
105
104
|
export const insertTermNet = <Item>(term: Term, item: Item, net: Net<Item>) =>
|
|
106
105
|
insertNet(() => false, keyOfTerm(term), item, net) ?? net;
|
|
107
106
|
|
|
108
|
-
export const insertTermSafe = <Item>(
|
|
109
|
-
isEqual: (left: Item, right: Item) => boolean,
|
|
110
|
-
term: Term,
|
|
111
|
-
item: Item,
|
|
112
|
-
net: Net<Item>,
|
|
113
|
-
) => insertNet(isEqual, keyOfTerm(term), item, net) ?? net;
|
|
114
|
-
|
|
115
107
|
const newNet = <Item>(node: Extract<Net<Item>, { kind: "Net" }>): Net<Item> =>
|
|
116
108
|
isEmptyNet(node.comb) && isEmptyNet(node.var) && isEmptyTable(node.atoms) ? emptyNet : node;
|
|
117
109
|
|
|
118
110
|
// Net.delete: undefined where Isabelle raises DELETE.
|
|
119
|
-
|
|
111
|
+
const deleteNet = <Item>(
|
|
120
112
|
isEqual: (left: Item, right: Item) => boolean,
|
|
121
113
|
keys: readonly NetKey[],
|
|
122
114
|
item: Item,
|
|
@@ -221,42 +213,3 @@ export const matchTermNet = <Item>(net: Net<Item>, term: Term) =>
|
|
|
221
213
|
|
|
222
214
|
export const unifyTermNet = <Item>(net: Net<Item>, term: Term) =>
|
|
223
215
|
extractLeaves(matching(true, term, net, undefined));
|
|
224
|
-
|
|
225
|
-
// Net.content: every item, by the order of Net.dest.
|
|
226
|
-
export const netContent = <Item>(net: Net<Item>): Item[] => {
|
|
227
|
-
if (net.kind === "Leaf") return [...net.items];
|
|
228
|
-
return [
|
|
229
|
-
...netContent(net.comb),
|
|
230
|
-
...netContent(net.var),
|
|
231
|
-
...tableEntries(net.atoms).flatMap((entry) => netContent(entry[1])),
|
|
232
|
-
];
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
// Net.subtract: the items of second that are not in first.
|
|
236
|
-
export const subtractNet = <Item>(
|
|
237
|
-
isEqual: (left: Item, right: Item) => boolean,
|
|
238
|
-
first: Net<Item>,
|
|
239
|
-
second: Net<Item>,
|
|
240
|
-
) => {
|
|
241
|
-
const subtr = (left: Net<Item>, right: Net<Item>, result: Item[]): Item[] => {
|
|
242
|
-
if (right.kind === "Leaf") {
|
|
243
|
-
if (left.kind === "Net") return [...right.items, ...result];
|
|
244
|
-
return right.items.reduceRight(
|
|
245
|
-
(accumulated, item) =>
|
|
246
|
-
left.items.some((other) => isEqual(other, item)) ? accumulated : [item, ...accumulated],
|
|
247
|
-
result,
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
if (left.kind === "Leaf") return subtr(makeNode(), right, result);
|
|
251
|
-
const afterComb = subtr(left.comb, right.comb, result);
|
|
252
|
-
const afterVar = subtr(left.var, right.var, afterComb);
|
|
253
|
-
return tableEntries(right.atoms).reduce(
|
|
254
|
-
(accumulated, entry) =>
|
|
255
|
-
subtr(lookupTable(left.atoms, entry[0]) ?? makeNode(), entry[1], accumulated),
|
|
256
|
-
afterVar,
|
|
257
|
-
);
|
|
258
|
-
};
|
|
259
|
-
return subtr(first, second, []);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
export const netEntries = <Item>(net: Net<Item>) => subtractNet(() => false, emptyNet, net);
|
|
@@ -6,18 +6,7 @@
|
|
|
6
6
|
// functions return undefined instead.
|
|
7
7
|
|
|
8
8
|
import { TlaIsabelleError } from "../../../errors";
|
|
9
|
-
import {
|
|
10
|
-
aeconv,
|
|
11
|
-
emptyTEnv,
|
|
12
|
-
genvar,
|
|
13
|
-
headNorm,
|
|
14
|
-
lookup,
|
|
15
|
-
lookup1,
|
|
16
|
-
substTerm,
|
|
17
|
-
update,
|
|
18
|
-
type Envir,
|
|
19
|
-
type TEnv,
|
|
20
|
-
} from "./envir";
|
|
9
|
+
import { aeconv, genvar, headNorm, lookup, lookup1, update, type Envir, type TEnv } from "./envir";
|
|
21
10
|
import { hasKey, indexnameOrd, updateTable } from "./table";
|
|
22
11
|
import {
|
|
23
12
|
eqTyp,
|
|
@@ -31,14 +20,13 @@ import {
|
|
|
31
20
|
mkAbs,
|
|
32
21
|
mkApp,
|
|
33
22
|
mkBound,
|
|
34
|
-
renameAbs,
|
|
35
23
|
stripComb,
|
|
36
24
|
aconv,
|
|
37
25
|
type Term,
|
|
38
26
|
type Typ,
|
|
39
27
|
type Var,
|
|
40
28
|
} from "./term";
|
|
41
|
-
import {
|
|
29
|
+
import { matchTypes, normType, substType, unifyTypes, type TyEnv } from "./type";
|
|
42
30
|
|
|
43
31
|
class Unif {}
|
|
44
32
|
class NotPattern {}
|
|
@@ -427,7 +415,7 @@ const flexRigid = (
|
|
|
427
415
|
return update(variable, mkAbsOver(binders, indexes, projected), updated);
|
|
428
416
|
};
|
|
429
417
|
|
|
430
|
-
|
|
418
|
+
type PatternUnifyResult =
|
|
431
419
|
| { kind: "unified"; envir: Envir }
|
|
432
420
|
| { kind: "clash" }
|
|
433
421
|
| { kind: "not a pattern" };
|
|
@@ -641,10 +629,3 @@ export const isFirstOrder = (term: Term): boolean => {
|
|
|
641
629
|
return term.fun.kind !== "Var" && isFirstOrder(term.fun) && isFirstOrder(term.arg);
|
|
642
630
|
return true;
|
|
643
631
|
};
|
|
644
|
-
|
|
645
|
-
// Pattern.match_rew
|
|
646
|
-
export const matchRew = (term: Term, lhs: Term, rhs: Term): [Term, Term] | undefined => {
|
|
647
|
-
const renamed = renameAbs(lhs, term, rhs) ?? rhs;
|
|
648
|
-
const env = matchPattern(lhs, term, { tyenv: emptyTyEnv, tenv: emptyTEnv });
|
|
649
|
-
return env === undefined ? undefined : [substTerm(env.tyenv, env.tenv, renamed), renamed];
|
|
650
|
-
};
|
|
@@ -8,7 +8,7 @@ import { TlaIsabelleError } from "../../../errors";
|
|
|
8
8
|
import { etaContract } from "./envir";
|
|
9
9
|
import { symmetricThm } from "./drule";
|
|
10
10
|
import { destEquals, isEquals, occs, stripImpConcl, stripImpPrems } from "./logic";
|
|
11
|
-
import {
|
|
11
|
+
import { emptyNet, insertNet, keyOfTerm, type Net } from "./net";
|
|
12
12
|
import { isFirstOrder, isPattern, matches } from "./pattern";
|
|
13
13
|
import { emptyTable, type Table } from "./table";
|
|
14
14
|
import { emptyTEnv } from "./envir";
|
|
@@ -118,11 +118,7 @@ const hasNewTVar = (type: Typ, keys: ReadonlySet<string>): boolean => {
|
|
|
118
118
|
|
|
119
119
|
// rewrite_rule_extra_vars: whether the right-hand sides have variables outside the left-hand side
|
|
120
120
|
// and the premises.
|
|
121
|
-
|
|
122
|
-
prems: readonly Term[],
|
|
123
|
-
elhs: Term,
|
|
124
|
-
erhss: readonly Term[],
|
|
125
|
-
) => {
|
|
121
|
+
const rewriteRuleExtraVars = (prems: readonly Term[], elhs: Term, erhss: readonly Term[]) => {
|
|
126
122
|
const terms = [elhs, ...prems];
|
|
127
123
|
const vars = terms.flatMap(varsOf);
|
|
128
124
|
const tvars = new Set<string>();
|
|
@@ -205,7 +201,7 @@ interface Decomposed {
|
|
|
205
201
|
readonly perm: boolean;
|
|
206
202
|
}
|
|
207
203
|
|
|
208
|
-
|
|
204
|
+
const decompSimp = (thm: Thm): Decomposed => {
|
|
209
205
|
const prems = stripImpPrems(thm.prop);
|
|
210
206
|
const concl = stripImpConcl(thm.prop);
|
|
211
207
|
if (!isEquals(concl)) throw new TlaIsabelleError("ERROR", "Rewrite rule not a meta-equality");
|
|
@@ -293,23 +289,12 @@ export const insertRrule = (raw: RawRrule, simpset: Simpset): Simpset => {
|
|
|
293
289
|
return rules === undefined ? simpset : { ...simpset, rules };
|
|
294
290
|
};
|
|
295
291
|
|
|
296
|
-
export const delRrule = (raw: RawRrule, simpset: Simpset): Simpset => {
|
|
297
|
-
const rrule = mkRrule2(raw.thm, raw.lhs, raw.elhs, raw.perm);
|
|
298
|
-
return { ...simpset, rules: deleteTermSafe(eqRrule, rrule.elhs, rrule, simpset.rules) };
|
|
299
|
-
};
|
|
300
|
-
|
|
301
292
|
export const addSimps = (context: SimpContext, thms: readonly Thm[]): Simpset =>
|
|
302
293
|
thms
|
|
303
294
|
.flatMap((thm) => context.simpset.mkRews.mk(thm, context))
|
|
304
295
|
.flatMap((rew) => mkRrule(context, rew))
|
|
305
296
|
.reduce((simpset, raw) => insertRrule(raw, simpset), context.simpset);
|
|
306
297
|
|
|
307
|
-
export const delSimps = (context: SimpContext, thms: readonly Thm[]): Simpset =>
|
|
308
|
-
thms
|
|
309
|
-
.flatMap((thm) => context.simpset.mkRews.mk(thm, context))
|
|
310
|
-
.flatMap((rew) => mkRrule(context, rew))
|
|
311
|
-
.reduce((simpset, raw) => delRrule(raw, simpset), context.simpset);
|
|
312
|
-
|
|
313
298
|
// mk_procrule: the rewrite rule a simplification procedure proves.
|
|
314
299
|
export const mkProcrule = (thm: Thm): Rrule[] => {
|
|
315
300
|
const decomposed = decompSimp(thm);
|
|
@@ -91,12 +91,6 @@ export const mappSeq = <Item, Result>(
|
|
|
91
91
|
return copy(first);
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
export const interleaveSeq = <Item>(first: Seq<Item>, second: Seq<Item>): Seq<Item> =>
|
|
95
|
-
deferSeq(() => {
|
|
96
|
-
const cell = first.pull();
|
|
97
|
-
return cell === undefined ? second : [cell[0], interleaveSeq(second, cell[1])];
|
|
98
|
-
});
|
|
99
|
-
|
|
100
94
|
export const filterSeq = <Item>(predicate: (item: Item) => boolean, seq: Seq<Item>): Seq<Item> => {
|
|
101
95
|
const copy = (current: Seq<Item>): Seq<Item> =>
|
|
102
96
|
makeSeq(() => {
|
|
@@ -124,15 +118,6 @@ export const mapsSeq = <Item, Result>(
|
|
|
124
118
|
return cell === undefined ? undefined : appendSeq(map(cell[0]), mapsSeq(map, cell[1]));
|
|
125
119
|
});
|
|
126
120
|
|
|
127
|
-
export const mapFilterSeq = <Item, Result>(
|
|
128
|
-
map: (item: Item) => Result | undefined,
|
|
129
|
-
seq: Seq<Item>,
|
|
130
|
-
): Seq<Result> =>
|
|
131
|
-
mapsSeq((item) => {
|
|
132
|
-
const result = map(item);
|
|
133
|
-
return result === undefined ? emptySeq : singleSeq(result);
|
|
134
|
-
}, seq);
|
|
135
|
-
|
|
136
121
|
// Seq.it_right: accumulates lazily from the right.
|
|
137
122
|
export const itRightSeq = <Item, Result>(
|
|
138
123
|
combine: (item: Item, rest: Seq<Result>) => Seq<Result>,
|
|
@@ -146,11 +131,3 @@ export const itRightSeq = <Item, Result>(
|
|
|
146
131
|
});
|
|
147
132
|
return its(seq);
|
|
148
133
|
};
|
|
149
|
-
|
|
150
|
-
export const takeSeq = <Item>(count: number, seq: Seq<Item>): Seq<Item> =>
|
|
151
|
-
count <= 0
|
|
152
|
-
? emptySeq
|
|
153
|
-
: makeSeq(() => {
|
|
154
|
-
const cell = seq.pull();
|
|
155
|
-
return cell === undefined ? undefined : [cell[0], takeSeq(count - 1, cell[1])];
|
|
156
|
-
});
|
|
@@ -48,7 +48,7 @@ const singleProver =
|
|
|
48
48
|
solveAllTac(solvers, context)(thm).pull()?.[0];
|
|
49
49
|
|
|
50
50
|
// generic_simp_tac
|
|
51
|
-
|
|
51
|
+
const genericSimpTac =
|
|
52
52
|
(isSafe: boolean, mode: RewriteMode) =>
|
|
53
53
|
(context: SimpContext): GoalTactic =>
|
|
54
54
|
(index) => {
|
|
@@ -62,10 +62,7 @@ export const genericSimpTac =
|
|
|
62
62
|
);
|
|
63
63
|
return preferGoal(simpLoopTac(1))(index);
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
export const simpTac = genericSimpTac(false, { simprem: false, useprem: false, mutsimp: false });
|
|
67
65
|
export const asmSimpTac = genericSimpTac(false, { simprem: false, useprem: true, mutsimp: false });
|
|
68
|
-
export const fullSimpTac = genericSimpTac(false, { simprem: true, useprem: false, mutsimp: false });
|
|
69
66
|
export const asmLrSimpTac = genericSimpTac(false, { simprem: true, useprem: true, mutsimp: false });
|
|
70
67
|
export const asmFullSimpTac = genericSimpTac(false, {
|
|
71
68
|
simprem: true,
|
|
@@ -79,7 +76,7 @@ export const safeAsmFullSimpTac = genericSimpTac(true, {
|
|
|
79
76
|
});
|
|
80
77
|
|
|
81
78
|
// Simplifier.simp_thm: simplifies a theorem's proposition.
|
|
82
|
-
|
|
79
|
+
const simpThm = (mode: RewriteMode, context: SimpContext, thm: Thm): Thm => {
|
|
83
80
|
const prover = singleProver([...context.simpset.unsafeSolvers].reverse());
|
|
84
81
|
return fconvRule((term) => rewriteCterm(mode, prover, context, term), thm);
|
|
85
82
|
};
|
|
@@ -87,9 +84,6 @@ export const simpThm = (mode: RewriteMode, context: SimpContext, thm: Thm): Thm
|
|
|
87
84
|
export const simplify = (context: SimpContext, thm: Thm) =>
|
|
88
85
|
simpThm({ simprem: false, useprem: false, mutsimp: false }, context, thm);
|
|
89
86
|
|
|
90
|
-
export const fullSimplify = (context: SimpContext, thm: Thm) =>
|
|
91
|
-
simpThm({ simprem: true, useprem: false, mutsimp: false }, context, thm);
|
|
92
|
-
|
|
93
87
|
// Raw_Simplifier.norm_hhf: moves the quantifiers of a theorem left of its implications, then makes
|
|
94
88
|
// the outermost ones schematic. Drule.sort_constraint_eq, the other rule of hhf_ss, never applies:
|
|
95
89
|
// tlapm's terms carry no sort constraints.
|
|
@@ -175,12 +175,6 @@ export const tableEntries = <Key, Value>(table: Table<Key, Value>) =>
|
|
|
175
175
|
[],
|
|
176
176
|
);
|
|
177
177
|
|
|
178
|
-
export const tableSize = <Key, Value>(table: Table<Key, Value>): number => {
|
|
179
|
-
const count = (node: Node<Key, Value>): number =>
|
|
180
|
-
node ? 1 + count(node.left) + count(node.right) : 0;
|
|
181
|
-
return count(table.root);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
178
|
// fast_string_ord: shorter strings first, then by code units.
|
|
185
179
|
export const fastStringOrd = (left: string, right: string) =>
|
|
186
180
|
left === right
|
|
@@ -191,8 +185,7 @@ export const fastStringOrd = (left: string, right: string) =>
|
|
|
191
185
|
? -1
|
|
192
186
|
: 1;
|
|
193
187
|
|
|
194
|
-
|
|
195
|
-
left === right ? 0 : left < right ? -1 : 1;
|
|
188
|
+
const stringOrd = (left: string, right: string) => (left === right ? 0 : left < right ? -1 : 1);
|
|
196
189
|
|
|
197
190
|
export interface IndexKey {
|
|
198
191
|
readonly name: string;
|