tla-ts 0.0.9 → 0.0.10-dev.63a6693bd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -1
- package/dist/compile.cjs +23 -0
- package/dist/compile.js +23 -0
- package/dist/deciders.cjs +29 -29
- package/dist/deciders.js +42 -42
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +106 -10
- package/dist/index.d.ts +106 -10
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove-worker.cjs +1 -1
- package/dist/prove-worker.js +1 -1
- package/dist/prove.cjs +117 -37
- package/dist/prove.js +116 -36
- package/dist/run.cjs +143 -31
- package/dist/run.js +143 -31
- package/dist/tlapm.cjs +2 -2
- package/dist/tlapm.js +2 -2
- package/dist/transfer.cjs +129 -104
- package/dist/transfer.js +129 -104
- package/dist/worker.cjs +7 -7
- package/dist/worker.js +7 -7
- package/package.json +3 -1
- package/src/ast.ts +48 -62
- package/src/bags.ts +99 -102
- package/src/builtins.ts +28 -75
- package/src/bundled-modules.ts +1 -8
- package/src/check-failure.ts +116 -0
- package/src/check-trace.ts +282 -0
- package/src/check.ts +599 -754
- package/src/cli/options.ts +12 -32
- package/src/cli/run.ts +0 -2
- package/src/cli/runtime-invariants.ts +136 -0
- package/src/cli/shared.ts +19 -12
- package/src/cli/tlapm.ts +14 -25
- package/src/cli/tlc-arguments.ts +652 -0
- package/src/cli/tlc-output.ts +687 -0
- package/src/cli/tlc-usage.ts +361 -0
- package/src/cli/tlc.ts +309 -658
- package/src/cli/typescript.ts +23 -0
- package/src/cli/xml-exporter.ts +27 -49
- package/src/cli.ts +0 -1
- package/src/codegen.ts +196 -74
- package/src/config.ts +140 -109
- package/src/coverage.ts +830 -0
- package/src/dependencies.ts +14 -53
- package/src/dfid.ts +618 -0
- package/src/environment-config.ts +315 -0
- package/src/environment.ts +169 -335
- package/src/errors.ts +71 -55
- package/src/evaluate.ts +598 -340
- package/src/exit-codes.ts +37 -3
- package/src/fingerprints.ts +75 -11
- package/src/index.ts +3 -0
- package/src/instances.ts +126 -21
- package/src/java-hash.ts +7 -0
- package/src/java-overrides.ts +4 -19
- package/src/json-reader.ts +455 -0
- package/src/json.ts +252 -139
- package/src/levels.ts +46 -58
- package/src/lexer.ts +80 -100
- package/src/liveness-checker.ts +103 -153
- package/src/liveness.ts +150 -109
- package/src/obligations/action.ts +8 -39
- package/src/obligations/anonymize.ts +88 -82
- package/src/obligations/equality.ts +1 -1
- package/src/obligations/expression.ts +20 -21
- package/src/obligations/format.ts +1 -9
- package/src/obligations/generate.ts +46 -49
- package/src/obligations/index.ts +2 -13
- package/src/obligations/levels.ts +4 -8
- package/src/obligations/module.ts +28 -53
- package/src/obligations/normalize.ts +7 -25
- package/src/obligations/operators.ts +1 -2
- package/src/obligations/pragma.ts +1 -10
- package/src/obligations/printer.ts +47 -46
- package/src/obligations/proof.ts +1 -5
- package/src/obligations/regroup.ts +1 -4
- package/src/obligations/simplify.ts +42 -58
- package/src/obligations/source.ts +48 -78
- package/src/obligations/subexpression.ts +5 -11
- package/src/obligations/substitution.ts +1 -3
- package/src/obligations/temporal.ts +13 -19
- package/src/obligations/tuples.ts +3 -9
- package/src/parallel-worker.ts +30 -60
- package/src/parallel.ts +57 -71
- package/src/parser.ts +584 -316
- package/src/pcal/ast.ts +53 -86
- package/src/pcal/parse.ts +144 -219
- package/src/pcal/tokenize.ts +91 -131
- package/src/pcal/translate.ts +83 -130
- package/src/pcal/validate.ts +48 -68
- package/src/pretty-print.ts +7 -8
- package/src/prover/decide-pool.ts +8 -13
- package/src/prover/deciders.ts +3 -7
- package/src/prover/first-order.ts +0 -11
- package/src/prover/isabelle/decide.ts +0 -6
- package/src/prover/isabelle/encode.ts +11 -23
- package/src/prover/isabelle/isar/inner-syntax.ts +114 -115
- package/src/prover/isabelle/isar/method.ts +29 -53
- package/src/prover/isabelle/isar/proof.ts +1 -10
- package/src/prover/isabelle/isar/statement.ts +1 -6
- package/src/prover/isabelle/isar/theory.ts +26 -36
- package/src/prover/isabelle/isar/type-check.ts +17 -31
- package/src/prover/isabelle/provers/blast/blast.ts +17 -104
- package/src/prover/isabelle/provers/blast/branch.ts +1 -32
- package/src/prover/isabelle/provers/blast/prove.ts +1 -35
- package/src/prover/isabelle/provers/blast/rules.ts +6 -44
- package/src/prover/isabelle/provers/blast/state.ts +2 -28
- package/src/prover/isabelle/provers/blast/term.ts +9 -36
- package/src/prover/isabelle/provers/clasimp.ts +1 -13
- package/src/prover/isabelle/provers/classical.ts +14 -42
- package/src/prover/isabelle/provers/hypsubst.ts +28 -51
- package/src/prover/isabelle/pure/bicompose.ts +25 -38
- package/src/prover/isabelle/pure/consts.ts +1 -7
- package/src/prover/isabelle/pure/conv.ts +3 -17
- package/src/prover/isabelle/pure/drule.ts +33 -42
- package/src/prover/isabelle/pure/envir.ts +3 -52
- package/src/prover/isabelle/pure/goal.ts +1 -7
- package/src/prover/isabelle/pure/interrupt.ts +0 -5
- package/src/prover/isabelle/pure/list.ts +0 -3
- package/src/prover/isabelle/pure/logic.ts +2 -15
- package/src/prover/isabelle/pure/name.ts +2 -9
- package/src/prover/isabelle/pure/net.ts +3 -59
- package/src/prover/isabelle/pure/object-logic.ts +3 -10
- package/src/prover/isabelle/pure/pattern.ts +2 -19
- package/src/prover/isabelle/pure/raw-simplifier.ts +17 -62
- package/src/prover/isabelle/pure/rewriter.ts +31 -67
- package/src/prover/isabelle/pure/search.ts +3 -10
- package/src/prover/isabelle/pure/seq.ts +1 -10
- package/src/prover/isabelle/pure/simplifier.ts +4 -12
- package/src/prover/isabelle/pure/table.ts +3 -32
- package/src/prover/isabelle/pure/tactic.ts +12 -22
- package/src/prover/isabelle/pure/tactical.ts +48 -47
- package/src/prover/isabelle/pure/term-ord.ts +2 -6
- package/src/prover/isabelle/pure/term.ts +2 -43
- package/src/prover/isabelle/pure/thm.ts +27 -47
- package/src/prover/isabelle/pure/type.ts +2 -15
- package/src/prover/isabelle/pure/unify.ts +20 -30
- package/src/prover/isabelle/pure/variable.ts +3 -7
- package/src/prover/isabelle/tla/classical-setup.ts +17 -24
- package/src/prover/isabelle/tla/context.ts +15 -18
- package/src/prover/isabelle/tla/logic.ts +14 -32
- package/src/prover/isabelle/tla/simpdata.ts +46 -43
- package/src/prover/isabelle/tools/intuitionistic.ts +1 -10
- package/src/prover/ocaml.ts +0 -6
- package/src/prover/prep/action.ts +14 -54
- package/src/prover/prep/enabled-axioms.ts +12 -19
- package/src/prover/prep/fingerprint.ts +2 -21
- package/src/prover/prep/level-comparison.ts +8 -12
- package/src/prover/prep/md5.ts +0 -2
- package/src/prover/prep/methods.ts +33 -39
- package/src/prover/prep/normalize.ts +4 -28
- package/src/prover/prove-worker.ts +0 -2
- package/src/prover/prove.ts +87 -100
- package/src/prover/ptl/decide.ts +7 -12
- package/src/prover/ptl/encode.ts +14 -36
- package/src/prover/ptl/sat.ts +24 -32
- package/src/prover/ptl/tableau.ts +12 -26
- package/src/prover/smt/axioms.ts +0 -7
- package/src/prover/smt/context.ts +20 -28
- package/src/prover/smt/data.ts +433 -424
- package/src/prover/smt/encode.ts +43 -52
- package/src/prover/smt/extensionality.ts +0 -10
- package/src/prover/smt/flatten.ts +3 -22
- package/src/prover/smt/format.ts +5 -10
- package/src/prover/smt/instances.ts +0 -10
- package/src/prover/smt/rewrite.ts +663 -667
- package/src/prover/smt/solver/act-cache.ts +0 -15
- package/src/prover/smt/solver/arith-rewriter.ts +3 -48
- package/src/prover/smt/solver/array.ts +1 -3
- package/src/prover/smt/solver/asserted-formulas.ts +1 -43
- package/src/prover/smt/solver/ast-lt.ts +1 -11
- package/src/prover/smt/solver/ast-util.ts +1 -6
- package/src/prover/smt/solver/ast.ts +1 -165
- package/src/prover/smt/solver/auf-solver.ts +8 -44
- package/src/prover/smt/solver/case-split-queue.ts +1 -9
- package/src/prover/smt/solver/cg-table.ts +1 -18
- package/src/prover/smt/solver/clause.ts +1 -27
- package/src/prover/smt/solver/conflict-resolution.ts +0 -9
- package/src/prover/smt/solver/context.ts +7 -64
- package/src/prover/smt/solver/ctx-simplify.ts +14 -41
- package/src/prover/smt/solver/der.ts +2 -21
- package/src/prover/smt/solver/dyn-ack.ts +1 -11
- package/src/prover/smt/solver/e-matching.ts +4 -35
- package/src/prover/smt/solver/enode.ts +1 -21
- package/src/prover/smt/solver/expr-ref.ts +1 -5
- package/src/prover/smt/solver/expr-safe-replace.ts +1 -6
- package/src/prover/smt/solver/fingerprints.ts +1 -12
- package/src/prover/smt/solver/flat-literals.ts +1 -9
- package/src/prover/smt/solver/goal.ts +2 -14
- package/src/prover/smt/solver/hash.ts +0 -8
- package/src/prover/smt/solver/hashtable.ts +1 -12
- package/src/prover/smt/solver/internalizer.ts +7 -100
- package/src/prover/smt/solver/lbool.ts +1 -2
- package/src/prover/smt/solver/literal.ts +0 -3
- package/src/prover/smt/solver/lp/bound-propagator.ts +8 -26
- package/src/prover/smt/solver/lp/constraints.ts +2 -8
- package/src/prover/smt/solver/lp/containers.ts +12 -30
- package/src/prover/smt/solver/lp/core-solver.ts +10 -31
- package/src/prover/smt/solver/lp/cross-nested.ts +6 -20
- package/src/prover/smt/solver/lp/dep-intervals.ts +7 -22
- package/src/prover/smt/solver/lp/dependency.ts +1 -4
- package/src/prover/smt/solver/lp/dioph-eq.ts +9 -102
- package/src/prover/smt/solver/lp/explanation.ts +1 -6
- package/src/prover/smt/solver/lp/gomory.ts +9 -22
- package/src/prover/smt/solver/lp/hnf-cutter.ts +17 -23
- package/src/prover/smt/solver/lp/hnf.ts +11 -26
- package/src/prover/smt/solver/lp/int-cube.ts +15 -36
- package/src/prover/smt/solver/lp/int-solver.ts +4 -34
- package/src/prover/smt/solver/lp/lar-solver.ts +32 -81
- package/src/prover/smt/solver/lp/lar-term.ts +1 -5
- package/src/prover/smt/solver/lp/lp-settings.ts +1 -14
- package/src/prover/smt/solver/lp/maximize-term.ts +20 -45
- package/src/prover/smt/solver/lp/nex-creator.ts +5 -28
- package/src/prover/smt/solver/lp/nex.ts +1 -6
- package/src/prover/smt/solver/lp/nla-backoff.ts +1 -4
- package/src/prover/smt/solver/lp/nla-basics.ts +5 -30
- package/src/prover/smt/solver/lp/nla-core.ts +36 -135
- package/src/prover/smt/solver/lp/nla-divisions.ts +32 -42
- package/src/prover/smt/solver/lp/nla-emonics.ts +4 -21
- package/src/prover/smt/solver/lp/nla-factorization.ts +1 -4
- package/src/prover/smt/solver/lp/nla-grobner.ts +15 -69
- package/src/prover/smt/solver/lp/nla-horner.ts +3 -11
- package/src/prover/smt/solver/lp/nla-intervals.ts +2 -12
- package/src/prover/smt/solver/lp/nla-monomial-bounds.ts +16 -41
- package/src/prover/smt/solver/lp/nla-monotone.ts +2 -6
- package/src/prover/smt/solver/lp/nla-order.ts +2 -13
- package/src/prover/smt/solver/lp/nla-patcher.ts +4 -7
- package/src/prover/smt/solver/lp/nla-tangents.ts +1 -9
- package/src/prover/smt/solver/lp/nla-throttle.ts +1 -6
- package/src/prover/smt/solver/lp/nla-types.ts +1 -11
- package/src/prover/smt/solver/lp/nla-var-eqs.ts +4 -25
- package/src/prover/smt/solver/lp/nra-solver.ts +5 -52
- package/src/prover/smt/solver/lp/numeric-pair.ts +1 -4
- package/src/prover/smt/solver/lp/pdd-interval.ts +1 -3
- package/src/prover/smt/solver/lp/pdd-simplifier.ts +2 -14
- package/src/prover/smt/solver/lp/pdd-solver.ts +4 -33
- package/src/prover/smt/solver/lp/pdd.ts +7 -70
- package/src/prover/smt/solver/lp/random-updater.ts +1 -8
- package/src/prover/smt/solver/lp/static-matrix.ts +9 -19
- package/src/prover/smt/solver/lp/union-find.ts +1 -6
- package/src/prover/smt/solver/mam-compiler.ts +18 -58
- package/src/prover/smt/solver/mam-interpreter.ts +1 -21
- package/src/prover/smt/solver/maximize-ac-sharing.ts +2 -17
- package/src/prover/smt/solver/model-checker.ts +3 -37
- package/src/prover/smt/solver/model-evaluator.ts +3 -29
- package/src/prover/smt/solver/model-finder.ts +15 -32
- package/src/prover/smt/solver/model-generator.ts +1 -12
- package/src/prover/smt/solver/model-macro-solver.ts +23 -88
- package/src/prover/smt/solver/nlsat/algebraic.ts +63 -159
- package/src/prover/smt/solver/nlsat/atoms.ts +25 -23
- package/src/prover/smt/solver/nlsat/evaluator.ts +17 -22
- package/src/prover/smt/solver/nlsat/explain.ts +10 -69
- package/src/prover/smt/solver/nlsat/interval-set.ts +9 -50
- package/src/prover/smt/solver/nlsat/levelwise.ts +49 -135
- package/src/prover/smt/solver/nlsat/mpbq.ts +3 -14
- package/src/prover/smt/solver/nlsat/polynomial.ts +29 -159
- package/src/prover/smt/solver/nlsat/solver.ts +18 -90
- package/src/prover/smt/solver/nlsat/types.ts +1 -8
- package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +2 -45
- package/src/prover/smt/solver/nlsat/upolynomial.ts +11 -92
- package/src/prover/smt/solver/nnf.ts +3 -38
- package/src/prover/smt/solver/pattern-inference.ts +2 -15
- package/src/prover/smt/solver/poly-rewriter.ts +3 -23
- package/src/prover/smt/solver/propagate-values.ts +1 -10
- package/src/prover/smt/solver/proto-model.ts +3 -52
- package/src/prover/smt/solver/pull-quant.ts +1 -12
- package/src/prover/smt/solver/qe-lite-der.ts +1 -29
- package/src/prover/smt/solver/qe-lite-fm.ts +2 -25
- package/src/prover/smt/solver/qe-lite.ts +3 -33
- package/src/prover/smt/solver/qi-queue.ts +1 -16
- package/src/prover/smt/solver/quant-tactics.ts +5 -22
- package/src/prover/smt/solver/quantifier-analyzer.ts +27 -47
- package/src/prover/smt/solver/quantifier-manager.ts +2 -13
- package/src/prover/smt/solver/random-gen.ts +1 -2
- package/src/prover/smt/solver/rational.ts +1 -8
- package/src/prover/smt/solver/ref-vector.ts +1 -6
- package/src/prover/smt/solver/relevancy.ts +2 -15
- package/src/prover/smt/solver/rewriter-tpl.ts +3 -147
- package/src/prover/smt/solver/rewriter.ts +3 -85
- package/src/prover/smt/solver/rlimit.ts +2 -20
- package/src/prover/smt/solver/smtlib-parser.ts +80 -131
- package/src/prover/smt/solver/solver.ts +23 -34
- package/src/prover/smt/solver/sort.ts +1 -5
- package/src/prover/smt/solver/sticky-generations.ts +0 -5
- package/src/prover/smt/solver/theory-lra-axioms.ts +3 -24
- package/src/prover/smt/solver/theory-lra-bounds.ts +1 -7
- package/src/prover/smt/solver/theory-lra-final-check.ts +4 -22
- package/src/prover/smt/solver/theory-lra-internalize.ts +6 -43
- package/src/prover/smt/solver/theory-lra-model.ts +4 -19
- package/src/prover/smt/solver/theory-lra-propagate.ts +1 -15
- package/src/prover/smt/solver/theory-lra-state.ts +3 -8
- package/src/prover/smt/solver/theory-lra.ts +1 -8
- package/src/prover/smt/solver/var-subst.ts +2 -26
- package/src/prover/smt/table.ts +0 -8
- package/src/prover/tlapm/cache.ts +45 -40
- package/src/prover/tlapm/ocaml-marshal.ts +19 -21
- package/src/prover/tlapm/tlapm.ts +21 -20
- package/src/prover/verdict.ts +7 -2
- package/src/prover/zenon/check/check.ts +1 -11
- package/src/prover/zenon/check/definitions.ts +5 -15
- package/src/prover/zenon/check/equality.ts +0 -8
- package/src/prover/zenon/check/functions.ts +0 -4
- package/src/prover/zenon/check/keys.ts +0 -7
- package/src/prover/zenon/check/propositional.ts +0 -3
- package/src/prover/zenon/check/records.ts +1 -6
- package/src/prover/zenon/check/relations.ts +2 -14
- package/src/prover/zenon/check/rewrites.ts +2 -21
- package/src/prover/zenon/check/sets.ts +40 -61
- package/src/prover/zenon/check/terms.ts +1 -19
- package/src/prover/zenon/check/tla.ts +0 -6
- package/src/prover/zenon/decide.ts +0 -12
- package/src/prover/zenon/encode.ts +1 -8
- package/src/prover/zenon/eqrel.ts +2 -13
- package/src/prover/zenon/equality-rules.ts +0 -4
- package/src/prover/zenon/expr.ts +8 -26
- package/src/prover/zenon/index-table.ts +26 -57
- package/src/prover/zenon/isar-case.ts +9 -19
- package/src/prover/zenon/isar.ts +36 -64
- package/src/prover/zenon/limits.ts +0 -4
- package/src/prover/zenon/llproof.ts +2 -20
- package/src/prover/zenon/mltoll.ts +66 -104
- package/src/prover/zenon/node.ts +1 -11
- package/src/prover/zenon/ocaml.ts +1 -17
- package/src/prover/zenon/parse.ts +4 -12
- package/src/prover/zenon/phrase.ts +1 -11
- package/src/prover/zenon/proof.ts +0 -9
- package/src/prover/zenon/propositional-rules.ts +0 -5
- package/src/prover/zenon/rules.ts +2 -6
- package/src/prover/zenon/search.ts +5 -31
- package/src/prover/zenon/tla/functions.ts +59 -31
- package/src/prover/zenon/tla/llproof.ts +67 -76
- package/src/prover/zenon/tla/records.ts +57 -33
- package/src/prover/zenon/tla/rewrites.ts +12 -19
- package/src/prover/zenon/tla/sets.ts +83 -53
- package/src/prover/zenon/tla/terms.ts +0 -6
- package/src/prover/zenon/tla/tla.ts +66 -64
- package/src/randomization.ts +81 -35
- package/src/resolve.ts +67 -184
- package/src/runtime.ts +22 -22
- package/src/sany/builtins.ts +2 -5
- package/src/sany/generation.ts +394 -0
- package/src/sany/generator-def-entries.ts +210 -0
- package/src/sany/generator-definitions.ts +686 -0
- package/src/sany/generator-expressions.ts +1100 -0
- package/src/sany/generator-proofs.ts +662 -0
- package/src/sany/generator.ts +191 -2764
- package/src/sany/levels.ts +6 -34
- package/src/sany/lexer.ts +58 -77
- package/src/sany/linter.ts +1 -9
- package/src/sany/modules.ts +1 -5
- package/src/sany/nodes.ts +5 -43
- package/src/sany/parse-error.ts +39 -117
- package/src/sany/report.ts +32 -69
- package/src/sany/selectors.ts +49 -76
- package/src/sany/source.ts +1 -17
- package/src/sany/xml.ts +35 -117
- package/src/search.ts +541 -163
- package/src/simulate.ts +709 -0
- package/src/spec-description.ts +192 -100
- package/src/standard-definitions.ts +0 -4
- package/src/standard-modules.ts +264 -95
- package/src/state-graph.ts +52 -31
- package/src/subexpressions.ts +69 -52
- package/src/substitution-levels.ts +7 -7
- package/src/successors.ts +266 -99
- package/src/symmetry.ts +33 -25
- package/src/tableau.ts +27 -24
- package/src/tlc/fingerprint.ts +183 -67
- package/src/tlc/jar-data.ts +112 -6
- package/src/tlc/messages.ts +125 -54
- package/src/tlc/order.ts +39 -69
- package/src/tlc/random.ts +37 -49
- package/src/tlc/replay.ts +553 -228
- package/src/tlc/summary.ts +36 -47
- package/src/tlc/tlc-operators.ts +78 -44
- package/src/tlc/tlcext-operators.ts +139 -122
- package/src/tlc/trace-spec.ts +249 -0
- package/src/tlc/value-stream.ts +139 -0
- package/src/tlc/version.ts +1 -4
- package/src/transfer.ts +22 -25
- package/src/typescript/actions.ts +479 -0
- package/src/typescript/collections.ts +614 -0
- package/src/typescript/compile.ts +63 -0
- package/src/typescript/context.ts +94 -0
- package/src/typescript/emit.ts +121 -0
- package/src/typescript/expressions.ts +496 -0
- package/src/typescript/formula.ts +154 -0
- package/src/typescript/functions.ts +284 -0
- package/src/typescript/model.ts +162 -0
- package/src/typescript/names.ts +114 -0
- package/src/typescript/program.ts +48 -0
- package/src/typescript/properties.ts +139 -0
- package/src/typescript/scope.ts +112 -0
- package/src/typescript/steps.ts +167 -0
- package/src/typescript/types.ts +171 -0
- package/src/values.ts +832 -484
- package/src/worker.ts +7 -8
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
// Ported from Zenon's lexzen.mll and parsezen.mly, as shipped in tlapm. Copyright 2005 INRIA, see
|
|
2
|
-
// LICENSE.
|
|
3
|
-
//
|
|
4
|
-
// Reads Zenon's native input format, the .znn files that tlapm writes.
|
|
1
|
+
// Ported from Zenon's lexzen.mll and parsezen.mly, as shipped in tlapm. Copyright 2005 INRIA, see LICENSE.
|
|
5
2
|
|
|
6
3
|
import { TlaZenonError } from "../../errors";
|
|
7
4
|
import {
|
|
@@ -109,7 +106,6 @@ const tokenize = (text: string) => {
|
|
|
109
106
|
return tokens;
|
|
110
107
|
};
|
|
111
108
|
|
|
112
|
-
// Zenon's myfold: an n-ary connective nests to the right.
|
|
113
109
|
const foldRight = (combine: (left: Expr, right: Expr) => Expr, first: Expr, rest: Expr[]): Expr =>
|
|
114
110
|
rest.length === 0 ? first : combine(first, foldRight(combine, rest[0], rest.slice(1)));
|
|
115
111
|
|
|
@@ -127,18 +123,14 @@ export const parseZenon = (exprs: Expressions, text: string): Phrase[] => {
|
|
|
127
123
|
};
|
|
128
124
|
const tokens = tokenize(text);
|
|
129
125
|
let position = 0;
|
|
130
|
-
const peek = (offset = 0) => tokens[position + offset];
|
|
131
126
|
const next = () => tokens[position++];
|
|
132
|
-
const expect = (kind: TokenKind
|
|
127
|
+
const expect = (kind: TokenKind) => {
|
|
133
128
|
const token = next();
|
|
134
|
-
if (token.kind !== kind
|
|
135
|
-
throw new TlaZenonError(`Zenon: line ${token.line}: syntax error`);
|
|
129
|
+
if (token.kind !== kind) throw new TlaZenonError(`Zenon: line ${token.line}: syntax error`);
|
|
136
130
|
return token;
|
|
137
131
|
};
|
|
138
|
-
const isAt = (kind: TokenKind
|
|
139
|
-
peek().kind === kind && (value === undefined || peek().text === value);
|
|
132
|
+
const isAt = (kind: TokenKind) => tokens[position].kind === kind;
|
|
140
133
|
|
|
141
|
-
// A lambda after its first parenthesis: ((x y "type") body).
|
|
142
134
|
const parseLambda = () => {
|
|
143
135
|
expect("open");
|
|
144
136
|
const names: string[] = [];
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
// Ported from Zenon's phrase.ml, as shipped in tlapm. Copyright 2004 INRIA, see LICENSE.
|
|
2
|
-
//
|
|
3
|
-
// Splits the input into definitions and hypotheses. A hypothesis that defines a symbol, such as
|
|
4
|
-
// x = e or \A a, b : f(a, b) <=> e, becomes a definition that the prover unfolds.
|
|
5
2
|
|
|
6
3
|
import type { Expr } from "./expr";
|
|
7
4
|
import type { Definition, Phrase } from "./parse";
|
|
@@ -13,7 +10,6 @@ export interface Hypothesis {
|
|
|
13
10
|
|
|
14
11
|
const hasName = (env: Expr[], name: string) => env.some((variable) => variable.symbol === name);
|
|
15
12
|
|
|
16
|
-
// Zenon's check_args: the arguments are variables, and exactly the quantified ones.
|
|
17
13
|
const isParameterList = (env: Expr[], args: Expr[]) => {
|
|
18
14
|
if (!args.every((arg) => arg.kind === "var")) return false;
|
|
19
15
|
const envNames = env.map((variable) => variable.symbol).sort();
|
|
@@ -50,8 +46,6 @@ interface Shape {
|
|
|
50
46
|
body: Expr;
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
// The ways a formula can define a symbol, in the order Zenon tries them: a definiendum that is an
|
|
54
|
-
// application with its parameters, or a constant.
|
|
55
49
|
const getShapes = (expression: Expr): Shape[] => {
|
|
56
50
|
const sides =
|
|
57
51
|
expression.kind === "equiv" || (expression.kind === "app" && expression.symbol === "=")
|
|
@@ -79,8 +73,7 @@ const stripForall = (expression: Expr, env: Expr[]): { env: Expr[]; body: Expr }
|
|
|
79
73
|
? stripForall(expression.args[1], [expression.args[0], ...env])
|
|
80
74
|
: { env, body: expression };
|
|
81
75
|
|
|
82
|
-
// Zenon's is_def
|
|
83
|
-
// that defines the symbol can differ from the one that qualifies the formula.
|
|
76
|
+
// Zenon's is_def and make_def try the shapes with different conditions, so the defining shape can differ from the qualifying one.
|
|
84
77
|
const getDefinition = (
|
|
85
78
|
predefined: string[],
|
|
86
79
|
hypothesis: Hypothesis,
|
|
@@ -145,8 +138,6 @@ const isLooping = (symbol: string, symbols: string[], dependencies: Dependency[]
|
|
|
145
138
|
(symbols.includes(symbol) ||
|
|
146
139
|
isLooping(symbol, followDependencies(symbols, dependencies), dependencies));
|
|
147
140
|
|
|
148
|
-
// Zenon's separate. Definitions come before hypotheses, each in input order, except where a
|
|
149
|
-
// symbol is defined twice: then neither formula defines it.
|
|
150
141
|
export const separate = (predefined: string[], phrases: Phrase[]) => {
|
|
151
142
|
let dependencies: Dependency[] = [];
|
|
152
143
|
const multiple: string[] = [];
|
|
@@ -165,7 +156,6 @@ export const separate = (predefined: string[], phrases: Phrase[]) => {
|
|
|
165
156
|
}
|
|
166
157
|
const symbol = definition.symbol;
|
|
167
158
|
const dependency: Dependency = [symbol, getFreeSymbols(definition.params, [], definition.body)];
|
|
168
|
-
// The lists are reversed, as in Zenon, so a definition's index 0 is the latest.
|
|
169
159
|
const previous = definitions.findIndex(
|
|
170
160
|
(existing) => existing.kind === "pseudo" && existing.symbol === symbol,
|
|
171
161
|
);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
// Ported from Zenon's mlproof.ml, as shipped in tlapm. Copyright 2004 INRIA, see LICENSE.
|
|
2
|
-
//
|
|
3
|
-
// The proofs that the search builds and the checker reads. Each rule takes a fixed number of
|
|
4
|
-
// arguments, or at least a fixed number, so a rule application can't have the wrong arity. The
|
|
5
|
-
// rules of the TLA+ extension, Zenon's Ext, sit beside the core rules: their names don't clash.
|
|
6
2
|
|
|
7
3
|
import type { Expr } from "./expr";
|
|
8
4
|
import type { Definition } from "./parse";
|
|
@@ -14,7 +10,6 @@ type Five<Term> = [Term, Term, Term, Term, Term];
|
|
|
14
10
|
type Six<Term> = [Term, Term, Term, Term, Term, Term];
|
|
15
11
|
type Seven<Term> = [Term, Term, Term, Term, Term, Term, Term];
|
|
16
12
|
|
|
17
|
-
// The arguments of each rule that names neither a relation nor a definition.
|
|
18
13
|
interface PlainRuleArgs<Term> {
|
|
19
14
|
close: [Term];
|
|
20
15
|
false: [];
|
|
@@ -141,7 +136,6 @@ interface PlainRuleArgs<Term> {
|
|
|
141
136
|
tuple_len: Five<Term>;
|
|
142
137
|
}
|
|
143
138
|
|
|
144
|
-
// The rules that hold for any relation that the hypotheses make reflexive or symmetric.
|
|
145
139
|
interface RelationRuleArgs<Term> {
|
|
146
140
|
close_refl: [Term];
|
|
147
141
|
close_sym: Two<Term>;
|
|
@@ -167,14 +161,11 @@ type RelationRules<Term> = {
|
|
|
167
161
|
};
|
|
168
162
|
};
|
|
169
163
|
|
|
170
|
-
// A rule application, as in Zenon's Mlproof.rule. "definition" unfolds `definition`.
|
|
171
164
|
export type Rule<Term = Expr> =
|
|
172
165
|
| PlainRules<Term>[PlainRuleName]
|
|
173
166
|
| RelationRules<Term>[RelationRuleName]
|
|
174
167
|
| { name: "definition"; definition: Definition; args: Two<Term> };
|
|
175
168
|
|
|
176
|
-
// A proof of the formulas in `conclusions`: the node's rule applied to `uses`, with a subproof for
|
|
177
|
-
// each of its branches.
|
|
178
169
|
export interface Proof<Term = Expr> {
|
|
179
170
|
conclusions: Term[];
|
|
180
171
|
rule: Rule<Term>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
// Ported from Zenon's prove.ml, as shipped in tlapm. Copyright 2002 INRIA, see LICENSE.
|
|
2
|
-
//
|
|
3
|
-
// The rules for connectives and quantifiers, closing a branch, and unfolding definitions.
|
|
4
2
|
|
|
5
3
|
import { getStringValue } from "./equality-rules";
|
|
6
4
|
import { isApp, type Expr, type Expressions } from "./expr";
|
|
@@ -9,7 +7,6 @@ import type { Definition } from "./parse";
|
|
|
9
7
|
import { makeRelationRule, makeRule, type Rule } from "./proof";
|
|
10
8
|
import { makeNode, type RuleResult, type SearchRule } from "./rules";
|
|
11
9
|
|
|
12
|
-
// Zenon's is_conj and is_disj: how many more conjuncts or disjuncts a formula needs to reach m.
|
|
13
10
|
const countConjuncts = (formula: Expr, needed: number): number => {
|
|
14
11
|
if (needed <= 0) return 0;
|
|
15
12
|
if (formula.kind === "and")
|
|
@@ -350,8 +347,6 @@ export const addUnfold: SearchRule = (context, queue, formula, goalness) => {
|
|
|
350
347
|
wrap,
|
|
351
348
|
);
|
|
352
349
|
};
|
|
353
|
-
// Zenon tries applications before variables, each first as the formula itself, then as either
|
|
354
|
-
// side of a relation that is reflexive, symmetric or transitive.
|
|
355
350
|
for (const kind of ["app", "var"]) {
|
|
356
351
|
if (atom.kind === kind) {
|
|
357
352
|
const result = tryUnfold(atom, negate);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
// Ported from Zenon's prove.ml, as shipped in tlapm. Copyright 2002 INRIA, see LICENSE.
|
|
2
|
-
//
|
|
3
|
-
// Zenon's newnodes: each rule in turn suggests nodes for a formula added to a branch, until one
|
|
4
|
-
// says that the rest don't apply.
|
|
5
2
|
|
|
6
3
|
import type { Relations } from "./eqrel";
|
|
7
4
|
import {
|
|
@@ -12,7 +9,7 @@ import {
|
|
|
12
9
|
addSymmetricMatches,
|
|
13
10
|
addTransitivity,
|
|
14
11
|
} from "./equality-rules";
|
|
15
|
-
import {
|
|
12
|
+
import type { Expr, Expressions } from "./expr";
|
|
16
13
|
import type { Index } from "./index-table";
|
|
17
14
|
import { insertNode, type Node, type Priority, type Queue } from "./node";
|
|
18
15
|
import type { Rule } from "./proof";
|
|
@@ -62,8 +59,7 @@ const addExtensions: SearchRule = (context, queue, formula, goalness) => {
|
|
|
62
59
|
return [insertAll(queue, result.nodes), result.isStopped];
|
|
63
60
|
};
|
|
64
61
|
|
|
65
|
-
// Zenon
|
|
66
|
-
// formula with its negation, whose heads always differ.
|
|
62
|
+
// Deviation from Zenon: newnodes_preunif is left out because it never adds a node.
|
|
67
63
|
const RULES: SearchRule[] = [
|
|
68
64
|
addAbsurd,
|
|
69
65
|
addClosure,
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
// Ported from Zenon's prove.ml, as shipped in tlapm. Copyright 2002 INRIA, see LICENSE.
|
|
2
|
-
//
|
|
3
|
-
// The tableau search. Each formula added to a branch suggests nodes, which wait in the queue by
|
|
4
|
-
// priority. The search takes the next node, and refutes each of its branches in turn. A branch is
|
|
5
|
-
// closed when it holds a formula and its negation. Zenon's mutually recursive search functions are
|
|
6
|
-
// one loop here, with an explicit stack of frames.
|
|
7
2
|
|
|
8
3
|
import { TlaZenonError } from "../../errors";
|
|
9
|
-
import { difference, isApp, isDisjoint, isMeta, union, type Expr } from "./expr";
|
|
4
|
+
import { difference, isApp, isDisjoint, isMeta, isRelation, union, type Expr } from "./expr";
|
|
10
5
|
import { getLimitFailure, type Limits } from "./limits";
|
|
11
6
|
import { EMPTY_QUEUE, getQueueHead, removeNode, type Node, type Queue } from "./node";
|
|
12
7
|
import { stableSort } from "./ocaml";
|
|
@@ -18,12 +13,10 @@ import { addNodes, type SearchContext } from "./rules";
|
|
|
18
13
|
const isTrivial = (context: SearchContext, formula: Expr) =>
|
|
19
14
|
formula.kind === "true" ||
|
|
20
15
|
(formula.kind === "not" && formula.args[0].kind === "false") ||
|
|
21
|
-
(formula
|
|
22
|
-
formula.args.length === 2 &&
|
|
16
|
+
(isRelation(formula) &&
|
|
23
17
|
formula.args[0] === formula.args[1] &&
|
|
24
18
|
context.relations.isReflexive(formula.symbol));
|
|
25
19
|
|
|
26
|
-
// Zenon's reduce_list: drops the formulas a branch already has, and reverses the rest.
|
|
27
20
|
const reduceBranch = (context: SearchContext, branch: Expr[]) => {
|
|
28
21
|
const exprs = context.exprs;
|
|
29
22
|
const index = context.index;
|
|
@@ -32,8 +25,7 @@ const reduceBranch = (context: SearchContext, branch: Expr[]) => {
|
|
|
32
25
|
const isKnown = (formula: Expr) => index.isMember(formula) || kept.includes(formula);
|
|
33
26
|
for (const formula of branch) {
|
|
34
27
|
if (
|
|
35
|
-
formula
|
|
36
|
-
(formula.kind === "not" && formula.args[0].kind === "false") ||
|
|
28
|
+
isTrivial(context, formula) ||
|
|
37
29
|
(formula.kind === "not" &&
|
|
38
30
|
isApp(formula.args[0], "TLA.in", 2) &&
|
|
39
31
|
formula.args[0].args[1].kind === "var" &&
|
|
@@ -41,15 +33,7 @@ const reduceBranch = (context: SearchContext, branch: Expr[]) => {
|
|
|
41
33
|
)
|
|
42
34
|
continue;
|
|
43
35
|
const atom = formula.kind === "not" ? formula.args[0] : formula;
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
formula.kind === "app" &&
|
|
47
|
-
isRelation &&
|
|
48
|
-
formula.args[0] === formula.args[1] &&
|
|
49
|
-
relations.isReflexive(formula.symbol)
|
|
50
|
-
)
|
|
51
|
-
continue;
|
|
52
|
-
if (isRelation && relations.isSymmetric(atom.symbol)) {
|
|
36
|
+
if (isRelation(atom) && relations.isSymmetric(atom.symbol)) {
|
|
53
37
|
const swapped = exprs.eapp(atom.symbol, [atom.args[1], atom.args[0]]);
|
|
54
38
|
const reversed = formula.kind === "not" ? exprs.enot(swapped) : swapped;
|
|
55
39
|
if (!isKnown(formula) && !isKnown(reversed)) kept.unshift(formula);
|
|
@@ -138,19 +122,14 @@ interface Frame {
|
|
|
138
122
|
interface SearchStatistics {
|
|
139
123
|
inferences: number;
|
|
140
124
|
proofNodes: number;
|
|
141
|
-
// The proofs that closed another branch from the lemma cache. Zenon counts the uses in mlrefc and
|
|
142
|
-
// prints each of these proofs once, as a lemma.
|
|
143
125
|
reusedProofs: Set<Proof>;
|
|
144
126
|
}
|
|
145
127
|
|
|
146
128
|
export type SearchFailure = "exhausted" | "time limit" | "memory limit" | "aborted";
|
|
147
129
|
|
|
148
|
-
// Zenon gives up
|
|
149
|
-
// current branch hold instead. On the corpus files where Zenon runs out of memory, its heap passes
|
|
150
|
-
// 1 GB with 1.9 to 5.5 million of them, and no proof that Zenon finds needs more than 1.3 million.
|
|
130
|
+
// Deviation from Zenon, which gives up at a 1 GB heap: its heap passes that with 1.9 million queued nodes.
|
|
151
131
|
const MAX_QUEUED_NODES = 1_900_000;
|
|
152
132
|
|
|
153
|
-
// The proof of the hypotheses' inconsistency, or why the search gave up.
|
|
154
133
|
export const search = (
|
|
155
134
|
context: SearchContext,
|
|
156
135
|
definitions: Definition[],
|
|
@@ -192,8 +171,6 @@ export const search = (
|
|
|
192
171
|
return proof;
|
|
193
172
|
};
|
|
194
173
|
|
|
195
|
-
// Zenon's next_branch and unwind: descend into the next open branch of a node, or close the node
|
|
196
|
-
// and pop frames until one has an open branch left.
|
|
197
174
|
const advance = (
|
|
198
175
|
searchNode: Node,
|
|
199
176
|
nodeQueue: Queue,
|
|
@@ -227,8 +204,6 @@ export const search = (
|
|
|
227
204
|
}
|
|
228
205
|
};
|
|
229
206
|
|
|
230
|
-
// Pops the frames that the proof closes. Returns the proof when it closes the root, and leaves the
|
|
231
|
-
// frame to continue on top of the stack otherwise, with the proof recorded.
|
|
232
207
|
const unwind = (proof: Proof): Proof | undefined => {
|
|
233
208
|
for (;;) {
|
|
234
209
|
const frame = stack.pop();
|
|
@@ -267,7 +242,6 @@ export const search = (
|
|
|
267
242
|
if (result !== undefined) return result;
|
|
268
243
|
continue;
|
|
269
244
|
}
|
|
270
|
-
// Zenon's next_node: the next node whose branches all add something new.
|
|
271
245
|
for (;;) {
|
|
272
246
|
statistics.inferences++;
|
|
273
247
|
const removed = removeNode(queue);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// Ported from Zenon's ext_tla.ml, as shipped in tlapm. Copyright 2008 INRIA, see LICENSE.
|
|
2
|
-
//
|
|
3
|
-
// The rules for functions: membership in a function set, isAFcn and function equality.
|
|
4
2
|
|
|
5
|
-
import { isApp
|
|
3
|
+
import { isApp } from "../expr";
|
|
6
4
|
import type { Priority } from "../node";
|
|
7
|
-
import { makeRule
|
|
5
|
+
import { makeRule } from "../proof";
|
|
8
6
|
import {
|
|
9
7
|
domain,
|
|
10
8
|
equal,
|
|
@@ -22,8 +20,6 @@ export const getFunctionSetNodes = (literal: Literal): Item[] | undefined => {
|
|
|
22
20
|
const formula = literal.formula;
|
|
23
21
|
const isNegated = literal.isNegated;
|
|
24
22
|
const relation = literal.relation;
|
|
25
|
-
const node = (priority: Priority, rule: Rule, branches: Expr[][]) =>
|
|
26
|
-
makeExtensionNode(literal, priority, rule, branches);
|
|
27
23
|
if (relation?.symbol === "TLA.in") {
|
|
28
24
|
const element = relation.args[0];
|
|
29
25
|
const set = relation.args[1];
|
|
@@ -31,8 +27,8 @@ export const getFunctionSetNodes = (literal: Literal): Item[] | undefined => {
|
|
|
31
27
|
const fcn = element;
|
|
32
28
|
const source = set.args[0];
|
|
33
29
|
const target = set.args[1];
|
|
34
|
-
const
|
|
35
|
-
const
|
|
30
|
+
const fcnFormula = exprs.eapp("TLA.isAFcn", [fcn]);
|
|
31
|
+
const domainFormula = equal(exprs, domain(exprs, fcn), source);
|
|
36
32
|
const bound = exprs.newVar();
|
|
37
33
|
const maps = exprs.eall(
|
|
38
34
|
bound,
|
|
@@ -43,25 +39,36 @@ export const getFunctionSetNodes = (literal: Literal): Item[] | undefined => {
|
|
|
43
39
|
),
|
|
44
40
|
);
|
|
45
41
|
if (!isNegated) {
|
|
46
|
-
const rule = makeRule("in_funcset", [
|
|
42
|
+
const rule = makeRule("in_funcset", [
|
|
43
|
+
formula,
|
|
44
|
+
fcnFormula,
|
|
45
|
+
domainFormula,
|
|
46
|
+
maps,
|
|
47
|
+
fcn,
|
|
48
|
+
source,
|
|
49
|
+
target,
|
|
50
|
+
]);
|
|
47
51
|
return [
|
|
48
|
-
...
|
|
49
|
-
...
|
|
52
|
+
...makeExtensionNode(literal, "arity", rule, [[fcnFormula, domainFormula]]),
|
|
53
|
+
...makeExtensionNode(literal, { instance: maps }, rule, [
|
|
54
|
+
[fcnFormula, domainFormula, maps],
|
|
55
|
+
]),
|
|
50
56
|
];
|
|
51
57
|
}
|
|
52
|
-
const notFcn = exprs.enot(
|
|
53
|
-
const notDomain = exprs.enot(
|
|
58
|
+
const notFcn = exprs.enot(fcnFormula);
|
|
59
|
+
const notDomain = exprs.enot(domainFormula);
|
|
54
60
|
const notMaps = exprs.enot(maps);
|
|
55
61
|
const priority: Priority =
|
|
56
62
|
fcn.kind === "app" && FUNCTION_CONSTRUCTORS.includes(fcn.symbol)
|
|
57
63
|
? "arity"
|
|
58
64
|
: { instance: notMaps };
|
|
59
65
|
const shortcut = isApp(fcn, "TLA.except", 3)
|
|
60
|
-
?
|
|
66
|
+
? makeExtensionNode(
|
|
67
|
+
literal,
|
|
61
68
|
"arity",
|
|
62
69
|
makeRule("except_notin_funcset", [
|
|
63
70
|
formula,
|
|
64
|
-
exprs.enot(member(exprs, fcn.args[0],
|
|
71
|
+
exprs.enot(member(exprs, fcn.args[0], set)),
|
|
65
72
|
exprs.enot(member(exprs, fcn.args[2], target)),
|
|
66
73
|
fcn.args[0],
|
|
67
74
|
fcn.args[1],
|
|
@@ -70,14 +77,15 @@ export const getFunctionSetNodes = (literal: Literal): Item[] | undefined => {
|
|
|
70
77
|
target,
|
|
71
78
|
]),
|
|
72
79
|
[
|
|
73
|
-
[exprs.enot(member(exprs, fcn.args[0],
|
|
80
|
+
[exprs.enot(member(exprs, fcn.args[0], set))],
|
|
74
81
|
[exprs.enot(member(exprs, fcn.args[2], target))],
|
|
75
82
|
],
|
|
76
83
|
)
|
|
77
84
|
: [];
|
|
78
85
|
return [
|
|
79
86
|
...shortcut,
|
|
80
|
-
...
|
|
87
|
+
...makeExtensionNode(
|
|
88
|
+
literal,
|
|
81
89
|
priority,
|
|
82
90
|
makeRule("notin_funcset", [formula, notFcn, notDomain, notMaps, fcn, source, target]),
|
|
83
91
|
[[notFcn], [notDomain], [notMaps]],
|
|
@@ -94,22 +102,36 @@ export const getFunctionNodes = (literal: Literal): Item[] | undefined => {
|
|
|
94
102
|
const isNegated = literal.isNegated;
|
|
95
103
|
const atom = literal.atom;
|
|
96
104
|
const relation = literal.relation;
|
|
97
|
-
const node = (priority: Priority, rule: Rule, branches: Expr[][]) =>
|
|
98
|
-
makeExtensionNode(literal, priority, rule, branches);
|
|
99
105
|
if (isNegated && isApp(atom, "TLA.isAFcn", 1)) {
|
|
100
106
|
const fcn = atom.args[0];
|
|
101
107
|
if (isApp(fcn, "TLA.Fcn", 2))
|
|
102
|
-
return
|
|
108
|
+
return makeExtensionNode(
|
|
109
|
+
literal,
|
|
110
|
+
"prop",
|
|
111
|
+
makeRule("notisafcn_fcn", [formula, fcn.args[0], fcn.args[1]]),
|
|
112
|
+
[],
|
|
113
|
+
);
|
|
103
114
|
if (isApp(fcn, "TLA.except", 3))
|
|
104
|
-
return
|
|
115
|
+
return makeExtensionNode(
|
|
116
|
+
literal,
|
|
105
117
|
"prop",
|
|
106
118
|
makeRule("notisafcn_except", [formula, fcn.args[0], fcn.args[1], fcn.args[2]]),
|
|
107
119
|
[],
|
|
108
120
|
);
|
|
109
121
|
if (isApp(fcn, "TLA.oneArg", 2))
|
|
110
|
-
return
|
|
122
|
+
return makeExtensionNode(
|
|
123
|
+
literal,
|
|
124
|
+
"prop",
|
|
125
|
+
makeRule("notisafcn_onearg", [formula, fcn.args[0], fcn.args[1]]),
|
|
126
|
+
[],
|
|
127
|
+
);
|
|
111
128
|
if (isApp(fcn, "TLA.extend", 2))
|
|
112
|
-
return
|
|
129
|
+
return makeExtensionNode(
|
|
130
|
+
literal,
|
|
131
|
+
"prop",
|
|
132
|
+
makeRule("notisafcn_extend", [formula, fcn.args[0], fcn.args[1]]),
|
|
133
|
+
[],
|
|
134
|
+
);
|
|
113
135
|
}
|
|
114
136
|
if (relation?.symbol !== "=") return undefined;
|
|
115
137
|
const left = relation.args[0];
|
|
@@ -119,15 +141,18 @@ export const getFunctionNodes = (literal: Literal): Item[] | undefined => {
|
|
|
119
141
|
const sameDomain = equal(exprs, domain(exprs, left), domain(exprs, right));
|
|
120
142
|
const sameValue = equal(exprs, fapply(exprs, left, bound), fapply(exprs, right, bound));
|
|
121
143
|
if (!isNegated) {
|
|
122
|
-
const
|
|
144
|
+
const fcnEquivalence = exprs.eequiv(
|
|
123
145
|
exprs.eapp("TLA.isAFcn", [left]),
|
|
124
146
|
exprs.eapp("TLA.isAFcn", [right]),
|
|
125
147
|
);
|
|
126
148
|
const values = exprs.eall(bound, "", sameValue);
|
|
127
|
-
const result = exprs.eand(exprs.eand(
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
const result = exprs.eand(exprs.eand(fcnEquivalence, sameDomain), values);
|
|
150
|
+
return makeExtensionNode(
|
|
151
|
+
literal,
|
|
152
|
+
{ instance: values },
|
|
153
|
+
makeRule("funequal", [formula, result, left, right]),
|
|
154
|
+
[[result]],
|
|
155
|
+
);
|
|
131
156
|
}
|
|
132
157
|
const values = exprs.eall(
|
|
133
158
|
bound,
|
|
@@ -143,9 +168,12 @@ export const getFunctionNodes = (literal: Literal): Item[] | undefined => {
|
|
|
143
168
|
values,
|
|
144
169
|
),
|
|
145
170
|
);
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
|
|
171
|
+
return makeExtensionNode(
|
|
172
|
+
literal,
|
|
173
|
+
{ instance: values },
|
|
174
|
+
makeRule("notfunequal", [formula, result, left, right]),
|
|
175
|
+
[[result]],
|
|
176
|
+
);
|
|
149
177
|
}
|
|
150
178
|
return undefined;
|
|
151
179
|
};
|