tla-ts 0.0.4-dev.2be6058 → 0.0.4-dev.2da24e1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -126
- package/dist/deciders.cjs +366 -0
- package/dist/deciders.js +366 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -4
- package/dist/parallel-worker.js +1 -4
- package/dist/prove-worker.cjs +9 -0
- package/dist/prove-worker.d.cts +9 -0
- package/dist/prove-worker.d.ts +9 -0
- package/dist/prove-worker.js +9 -0
- package/dist/prove.cjs +996 -0
- package/dist/prove.js +996 -0
- package/dist/run-cli.cjs +37 -47
- package/dist/run-cli.js +37 -47
- package/dist/tlapm.cjs +10 -0
- package/dist/tlapm.js +10 -0
- package/dist/transfer.cjs +38 -44
- package/dist/transfer.js +38 -44
- package/dist/worker.cjs +21 -0
- package/dist/worker.js +21 -0
- package/package.json +21 -12
- package/src/check.ts +1 -0
- package/src/codegen.ts +26 -7
- package/src/errors.ts +86 -0
- package/src/evaluate.ts +255 -56
- package/src/index.ts +10 -0
- package/src/{obligation-action.ts → obligations/action.ts} +247 -69
- package/src/{obligation-anon.ts → obligations/anon.ts} +49 -47
- package/src/obligations/ctx.ts +64 -0
- package/src/{obligation-deref.ts → obligations/deref.ts} +51 -92
- package/src/{obligation-expression.ts → obligations/expression.ts} +117 -57
- package/src/{obligation-format.ts → obligations/format.ts} +7 -8
- package/src/{obligation-generate.ts → obligations/generate.ts} +170 -192
- package/src/{obligations.ts → obligations/index.ts} +32 -16
- package/src/{obligation-levels.ts → obligations/levels.ts} +26 -28
- package/src/{obligation-module.ts → obligations/module.ts} +113 -121
- package/src/obligations/pickle.ts +98 -0
- package/src/obligations/pragma.ts +189 -0
- package/src/{obligation-printer.ts → obligations/printer.ts} +22 -80
- package/src/{obligation-proof.ts → obligations/proof.ts} +7 -2
- package/src/{obligation-source.ts → obligations/source.ts} +154 -99
- package/src/obligations/temporal.ts +321 -0
- package/src/{obligation-tuples.ts → obligations/tuples.ts} +38 -54
- package/src/ocaml-marshal.ts +166 -0
- package/src/parallel-worker.ts +2 -18
- package/src/parallel.ts +10 -43
- package/src/prove/decide-pool.ts +95 -0
- package/src/prove/deciders.ts +33 -0
- package/src/prove/first-order.ts +78 -0
- package/src/prove/isabelle/LICENSE +36 -0
- package/src/prove/isabelle/LICENSE-tlapm +26 -0
- package/src/prove/isabelle/decide.ts +47 -0
- package/src/prove/isabelle/encode.ts +446 -0
- package/src/prove/isabelle/isar/inner-syntax.ts +579 -0
- package/src/prove/isabelle/isar/method.ts +367 -0
- package/src/prove/isabelle/isar/proof.ts +28 -0
- package/src/prove/isabelle/isar/statement.ts +57 -0
- package/src/prove/isabelle/isar/theory.ts +192 -0
- package/src/prove/isabelle/isar/type-check.ts +278 -0
- package/src/prove/isabelle/provers/blast/blast.ts +258 -0
- package/src/prove/isabelle/provers/blast/branch.ts +322 -0
- package/src/prove/isabelle/provers/blast/prove.ts +347 -0
- package/src/prove/isabelle/provers/blast/rules.ts +330 -0
- package/src/prove/isabelle/provers/blast/state.ts +180 -0
- package/src/prove/isabelle/provers/blast/term.ts +547 -0
- package/src/prove/isabelle/provers/clasimp.ts +150 -0
- package/src/prove/isabelle/provers/classical.ts +389 -0
- package/src/prove/isabelle/provers/hypsubst.ts +441 -0
- package/src/prove/isabelle/pure/bicompose.ts +174 -0
- package/src/prove/isabelle/pure/consts.ts +32 -0
- package/src/prove/isabelle/pure/conv.ts +79 -0
- package/src/prove/isabelle/pure/drule.ts +264 -0
- package/src/prove/isabelle/pure/envir.ts +363 -0
- package/src/prove/isabelle/pure/goal.ts +53 -0
- package/src/prove/isabelle/pure/interrupt.ts +16 -0
- package/src/prove/isabelle/pure/list.ts +12 -0
- package/src/prove/isabelle/pure/logic.ts +402 -0
- package/src/prove/isabelle/pure/name.ts +110 -0
- package/src/prove/isabelle/pure/net.ts +262 -0
- package/src/prove/isabelle/pure/object-logic.ts +41 -0
- package/src/prove/isabelle/pure/pattern.ts +650 -0
- package/src/prove/isabelle/pure/raw-simplifier.ts +353 -0
- package/src/prove/isabelle/pure/rewriter.ts +602 -0
- package/src/prove/isabelle/pure/search.ts +68 -0
- package/src/prove/isabelle/pure/seq.ts +156 -0
- package/src/prove/isabelle/pure/simplifier.ts +112 -0
- package/src/prove/isabelle/pure/table.ts +208 -0
- package/src/prove/isabelle/pure/tactic.ts +276 -0
- package/src/prove/isabelle/pure/tactical.ts +347 -0
- package/src/prove/isabelle/pure/term-ord.ts +159 -0
- package/src/prove/isabelle/pure/term.ts +808 -0
- package/src/prove/isabelle/pure/thm.ts +806 -0
- package/src/prove/isabelle/pure/type.ts +133 -0
- package/src/prove/isabelle/pure/unify.ts +753 -0
- package/src/prove/isabelle/pure/variable.ts +25 -0
- package/src/prove/isabelle/tla/classical-setup.ts +101 -0
- package/src/prove/isabelle/tla/context.ts +74 -0
- package/src/prove/isabelle/tla/logic-data.ts +5 -0
- package/src/prove/isabelle/tla/logic.ts +215 -0
- package/src/prove/isabelle/tla/simpdata.ts +241 -0
- package/src/prove/isabelle/tools/intuitionistic.ts +132 -0
- package/src/prove/ocaml.ts +22 -0
- package/src/prove/prep/action.ts +508 -0
- package/src/prove/prep/defs.ts +33 -0
- package/src/prove/prep/elab.ts +156 -0
- package/src/prove/prep/enabled-axioms.ts +189 -0
- package/src/prove/prep/enabled.ts +43 -0
- package/src/prove/prep/fingerprint.ts +388 -0
- package/src/prove/prep/flatten.ts +70 -0
- package/src/prove/prep/level-comparison.ts +529 -0
- package/src/prove/prep/md5.ts +67 -0
- package/src/prove/prep/pragma.ts +221 -0
- package/src/prove/prep/trivial.ts +22 -0
- package/src/prove/prove-worker.ts +22 -0
- package/src/prove/prove.ts +498 -0
- package/src/prove/ptl/decide.ts +68 -0
- package/src/prove/ptl/encode.ts +255 -0
- package/src/prove/ptl/sat.ts +151 -0
- package/src/prove/ptl/tableau.ts +276 -0
- package/src/prove/smt/axiomatize.ts +69 -0
- package/src/prove/smt/axioms.ts +209 -0
- package/src/prove/smt/context.ts +108 -0
- package/src/prove/smt/data.ts +636 -0
- package/src/prove/smt/encode.ts +164 -0
- package/src/prove/smt/extensionality.ts +65 -0
- package/src/prove/smt/flatten.ts +112 -0
- package/src/prove/smt/format.ts +154 -0
- package/src/prove/smt/instances.ts +181 -0
- package/src/prove/smt/rewrite.ts +772 -0
- package/src/prove/smt/simplify.ts +57 -0
- package/src/prove/smt/solver/act-cache.ts +265 -0
- package/src/prove/smt/solver/arith-rewriter.ts +962 -0
- package/src/prove/smt/solver/array.ts +22 -0
- package/src/prove/smt/solver/asserted-formulas.ts +469 -0
- package/src/prove/smt/solver/ast-lt.ts +157 -0
- package/src/prove/smt/solver/ast-util.ts +147 -0
- package/src/prove/smt/solver/ast.ts +1315 -0
- package/src/prove/smt/solver/auf-solver.ts +572 -0
- package/src/prove/smt/solver/case-split-queue.ts +178 -0
- package/src/prove/smt/solver/cg-table.ts +175 -0
- package/src/prove/smt/solver/clause.ts +276 -0
- package/src/prove/smt/solver/conflict-resolution.ts +343 -0
- package/src/prove/smt/solver/context.ts +1292 -0
- package/src/prove/smt/solver/ctx-simplify.ts +334 -0
- package/src/prove/smt/solver/der.ts +224 -0
- package/src/prove/smt/solver/dyn-ack.ts +141 -0
- package/src/prove/smt/solver/e-matching.ts +659 -0
- package/src/prove/smt/solver/enode.ts +259 -0
- package/src/prove/smt/solver/expr-ref.ts +21 -0
- package/src/prove/smt/solver/expr-safe-replace.ts +172 -0
- package/src/prove/smt/solver/fingerprints.ts +92 -0
- package/src/prove/smt/solver/flat-literals.ts +51 -0
- package/src/prove/smt/solver/goal.ts +138 -0
- package/src/prove/smt/solver/hash.ts +173 -0
- package/src/prove/smt/solver/hashtable.ts +166 -0
- package/src/prove/smt/solver/internalizer.ts +1381 -0
- package/src/prove/smt/solver/lbool.ts +5 -0
- package/src/prove/smt/solver/literal.ts +24 -0
- package/src/prove/smt/solver/lp/bound-propagator.ts +391 -0
- package/src/prove/smt/solver/lp/constraints.ts +78 -0
- package/src/prove/smt/solver/lp/containers.ts +296 -0
- package/src/prove/smt/solver/lp/core-solver.ts +504 -0
- package/src/prove/smt/solver/lp/cross-nested.ts +224 -0
- package/src/prove/smt/solver/lp/dep-intervals.ts +656 -0
- package/src/prove/smt/solver/lp/dependency.ts +51 -0
- package/src/prove/smt/solver/lp/dioph-eq.ts +1181 -0
- package/src/prove/smt/solver/lp/explanation.ts +46 -0
- package/src/prove/smt/solver/lp/gomory.ts +255 -0
- package/src/prove/smt/solver/lp/hnf-cutter.ts +125 -0
- package/src/prove/smt/solver/lp/hnf.ts +281 -0
- package/src/prove/smt/solver/lp/int-cube.ts +295 -0
- package/src/prove/smt/solver/lp/int-solver.ts +514 -0
- package/src/prove/smt/solver/lp/lar-solver.ts +816 -0
- package/src/prove/smt/solver/lp/lar-term.ts +62 -0
- package/src/prove/smt/solver/lp/lp-settings.ts +91 -0
- package/src/prove/smt/solver/lp/maximize-term.ts +347 -0
- package/src/prove/smt/solver/lp/nex-creator.ts +381 -0
- package/src/prove/smt/solver/lp/nex.ts +120 -0
- package/src/prove/smt/solver/lp/nla-backoff.ts +43 -0
- package/src/prove/smt/solver/lp/nla-basics.ts +398 -0
- package/src/prove/smt/solver/lp/nla-core.ts +968 -0
- package/src/prove/smt/solver/lp/nla-divisions.ts +332 -0
- package/src/prove/smt/solver/lp/nla-emonics.ts +373 -0
- package/src/prove/smt/solver/lp/nla-factorization.ts +30 -0
- package/src/prove/smt/solver/lp/nla-grobner.ts +904 -0
- package/src/prove/smt/solver/lp/nla-horner.ts +126 -0
- package/src/prove/smt/solver/lp/nla-intervals.ts +265 -0
- package/src/prove/smt/solver/lp/nla-monomial-bounds.ts +715 -0
- package/src/prove/smt/solver/lp/nla-monotone.ts +59 -0
- package/src/prove/smt/solver/lp/nla-order.ts +307 -0
- package/src/prove/smt/solver/lp/nla-patcher.ts +112 -0
- package/src/prove/smt/solver/lp/nla-tangents.ts +251 -0
- package/src/prove/smt/solver/lp/nla-throttle.ts +85 -0
- package/src/prove/smt/solver/lp/nla-types.ts +124 -0
- package/src/prove/smt/solver/lp/nla-var-eqs.ts +141 -0
- package/src/prove/smt/solver/lp/nra-solver.ts +440 -0
- package/src/prove/smt/solver/lp/numeric-pair.ts +65 -0
- package/src/prove/smt/solver/lp/pdd-interval.ts +31 -0
- package/src/prove/smt/solver/lp/pdd-simplifier.ts +184 -0
- package/src/prove/smt/solver/lp/pdd-solver.ts +408 -0
- package/src/prove/smt/solver/lp/pdd.ts +971 -0
- package/src/prove/smt/solver/lp/random-updater.ts +138 -0
- package/src/prove/smt/solver/lp/static-matrix.ts +246 -0
- package/src/prove/smt/solver/lp/union-find.ts +96 -0
- package/src/prove/smt/solver/mam-compiler.ts +847 -0
- package/src/prove/smt/solver/mam-interpreter.ts +400 -0
- package/src/prove/smt/solver/maximize-ac-sharing.ts +118 -0
- package/src/prove/smt/solver/model-checker.ts +347 -0
- package/src/prove/smt/solver/model-evaluator.ts +262 -0
- package/src/prove/smt/solver/model-finder.ts +155 -0
- package/src/prove/smt/solver/model-generator.ts +97 -0
- package/src/prove/smt/solver/model-macro-solver.ts +728 -0
- package/src/prove/smt/solver/nlsat/algebraic.ts +1161 -0
- package/src/prove/smt/solver/nlsat/atoms.ts +238 -0
- package/src/prove/smt/solver/nlsat/evaluator.ts +303 -0
- package/src/prove/smt/solver/nlsat/explain.ts +607 -0
- package/src/prove/smt/solver/nlsat/interval-set.ts +351 -0
- package/src/prove/smt/solver/nlsat/levelwise.ts +740 -0
- package/src/prove/smt/solver/nlsat/mpbq.ts +161 -0
- package/src/prove/smt/solver/nlsat/polynomial.ts +1722 -0
- package/src/prove/smt/solver/nlsat/solver.ts +911 -0
- package/src/prove/smt/solver/nlsat/types.ts +43 -0
- package/src/prove/smt/solver/nlsat/upolynomial-factorization.ts +648 -0
- package/src/prove/smt/solver/nlsat/upolynomial.ts +996 -0
- package/src/prove/smt/solver/nnf.ts +469 -0
- package/src/prove/smt/solver/pattern-inference.ts +351 -0
- package/src/prove/smt/solver/poly-rewriter.ts +477 -0
- package/src/prove/smt/solver/propagate-values.ts +83 -0
- package/src/prove/smt/solver/proto-model.ts +551 -0
- package/src/prove/smt/solver/pull-quant.ts +139 -0
- package/src/prove/smt/solver/qe-lite-der.ts +526 -0
- package/src/prove/smt/solver/qe-lite-fm.ts +576 -0
- package/src/prove/smt/solver/qe-lite.ts +381 -0
- package/src/prove/smt/solver/qi-queue.ts +362 -0
- package/src/prove/smt/solver/quant-tactics.ts +117 -0
- package/src/prove/smt/solver/quantifier-analyzer.ts +562 -0
- package/src/prove/smt/solver/quantifier-manager.ts +186 -0
- package/src/prove/smt/solver/random-gen.ts +10 -0
- package/src/prove/smt/solver/rational.ts +165 -0
- package/src/prove/smt/solver/ref-vector.ts +62 -0
- package/src/prove/smt/solver/relevancy.ts +247 -0
- package/src/prove/smt/solver/rewriter-tpl.ts +1159 -0
- package/src/prove/smt/solver/rewriter.ts +843 -0
- package/src/prove/smt/solver/rlimit.ts +79 -0
- package/src/prove/smt/solver/smtlib-parser.ts +526 -0
- package/src/prove/smt/solver/solver.ts +71 -0
- package/src/prove/smt/solver/sort.ts +35 -0
- package/src/prove/smt/solver/sticky-generations.ts +69 -0
- package/src/prove/smt/solver/theory-lra-axioms.ts +340 -0
- package/src/prove/smt/solver/theory-lra-bounds.ts +226 -0
- package/src/prove/smt/solver/theory-lra-final-check.ts +252 -0
- package/src/prove/smt/solver/theory-lra-internalize.ts +476 -0
- package/src/prove/smt/solver/theory-lra-model.ts +243 -0
- package/src/prove/smt/solver/theory-lra-propagate.ts +405 -0
- package/src/prove/smt/solver/theory-lra-state.ts +43 -0
- package/src/prove/smt/solver/theory-lra.ts +56 -0
- package/src/prove/smt/solver/var-subst.ts +258 -0
- package/src/prove/smt/solver/z3-license.txt +10 -0
- package/src/prove/smt/table.ts +170 -0
- package/src/prove/tlapm/tlapm.ts +96 -0
- package/src/prove/tlaps-module.ts +510 -0
- package/src/prove/verdict.ts +18 -0
- package/src/prove/zenon/LICENSE +32 -0
- package/src/prove/zenon/check/check.ts +105 -0
- package/src/prove/zenon/check/definitions.ts +144 -0
- package/src/prove/zenon/check/equality.ts +182 -0
- package/src/prove/zenon/check/functions.ts +62 -0
- package/src/prove/zenon/check/keys.ts +125 -0
- package/src/prove/zenon/check/propositional.ts +104 -0
- package/src/prove/zenon/check/records.ts +188 -0
- package/src/prove/zenon/check/relations.ts +121 -0
- package/src/prove/zenon/check/rewrites.ts +224 -0
- package/src/prove/zenon/check/sets.ts +302 -0
- package/src/prove/zenon/check/terms.ts +127 -0
- package/src/prove/zenon/check/tla.ts +126 -0
- package/src/prove/zenon/decide.ts +113 -0
- package/src/prove/zenon/encode.ts +379 -0
- package/src/prove/zenon/eqrel.ts +300 -0
- package/src/prove/zenon/equality-rules.ts +435 -0
- package/src/prove/zenon/expr.ts +551 -0
- package/src/prove/zenon/index-table.ts +350 -0
- package/src/prove/zenon/isar-case.ts +513 -0
- package/src/prove/zenon/isar.ts +1249 -0
- package/src/prove/zenon/limits.ts +15 -0
- package/src/prove/zenon/llproof.ts +173 -0
- package/src/prove/zenon/mltoll.ts +1566 -0
- package/src/prove/zenon/node.ts +297 -0
- package/src/prove/zenon/ocaml.ts +169 -0
- package/src/prove/zenon/parse.ts +247 -0
- package/src/prove/zenon/phrase.ts +191 -0
- package/src/prove/zenon/proof.ts +198 -0
- package/src/prove/zenon/propositional-rules.ts +387 -0
- package/src/prove/zenon/rules.ts +94 -0
- package/src/prove/zenon/search.ts +288 -0
- package/src/prove/zenon/tla/functions.ts +151 -0
- package/src/prove/zenon/tla/llproof.ts +480 -0
- package/src/prove/zenon/tla/records.ts +225 -0
- package/src/prove/zenon/tla/rewrites.ts +447 -0
- package/src/prove/zenon/tla/sets.ts +304 -0
- package/src/prove/zenon/tla/terms.ts +181 -0
- package/src/prove/zenon/tla/tla.ts +506 -0
- package/src/run-cli.ts +283 -81
- package/src/standard-modules.ts +5 -2
- package/src/successors.ts +25 -6
- package/src/tlapm-cache.ts +236 -0
- package/src/tlc-random.ts +55 -32
- package/src/tlc-version.ts +8 -7
- package/src/values.ts +97 -47
- package/src/worker.ts +65 -0
- package/dist/parallel.cjs +0 -12
- package/dist/parallel.js +0 -12
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
// tlapm's library/TLAPS.tla, verbatim, so that proofs citing pragmas such as SMT load without
|
|
2
|
+
// tlapm installed. tlapm's license follows.
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2008 INRIA and Microsoft Corporation
|
|
5
|
+
// Copyright (c) 2023 Linux Foundation
|
|
6
|
+
//
|
|
7
|
+
// Redistribution and use in source and binary forms, with or without
|
|
8
|
+
// modification, are permitted provided that the following conditions are
|
|
9
|
+
// met:
|
|
10
|
+
//
|
|
11
|
+
// * Redistributions of source code must retain the above copyright
|
|
12
|
+
// notice, this list of conditions and the following disclaimer.
|
|
13
|
+
//
|
|
14
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
15
|
+
// notice, this list of conditions and the following disclaimer in
|
|
16
|
+
// the documentation and/or other materials provided with the
|
|
17
|
+
// distribution.
|
|
18
|
+
//
|
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
export const TLAPS_MODULE = `------------------------------- MODULE TLAPS --------------------------------
|
|
31
|
+
|
|
32
|
+
(* Backend pragmas. *)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
(***************************************************************************)
|
|
36
|
+
(* Each of these pragmas can be cited with a BY or a USE. The pragma that *)
|
|
37
|
+
(* is added to the context of an obligation most recently is the one whose *)
|
|
38
|
+
(* effects are triggered. *)
|
|
39
|
+
(***************************************************************************)
|
|
40
|
+
|
|
41
|
+
(***************************************************************************)
|
|
42
|
+
(* The following pragmas should be used only as a last resource. They are *)
|
|
43
|
+
(* dependent upon the particular backend provers, and are unlikely to have *)
|
|
44
|
+
(* any effect if the set of backend provers changes. Moreover, they are *)
|
|
45
|
+
(* meaningless to a reader of the proof. *)
|
|
46
|
+
(***************************************************************************)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
(**************************************************************************)
|
|
50
|
+
(* Backend pragma: use the SMT solver for arithmetic. *)
|
|
51
|
+
(* *)
|
|
52
|
+
(* This method exists under this name for historical reasons. *)
|
|
53
|
+
(**************************************************************************)
|
|
54
|
+
|
|
55
|
+
SimpleArithmetic == TRUE (*{ by (prover:"smt3") }*)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
(**************************************************************************)
|
|
59
|
+
(* Backend pragma: SMT solver *)
|
|
60
|
+
(* *)
|
|
61
|
+
(* This method translates the proof obligation to SMTLIB2. The supported *)
|
|
62
|
+
(* fragment includes first-order logic, set theory, functions and *)
|
|
63
|
+
(* records. *)
|
|
64
|
+
(* SMT calls the smt-solver with the default timeout of 5 seconds *)
|
|
65
|
+
(* while SMTT(n) calls the smt-solver with a timeout of n seconds. *)
|
|
66
|
+
(* *)
|
|
67
|
+
(* SMTT also accepts a string argument of the form "rN" to bound the *)
|
|
68
|
+
(* underlying Z3 solver by a deterministic \`rlimit\` budget instead of a *)
|
|
69
|
+
(* wall-clock timeout, e.g. SMTT("r5"). N is a multiple of a fixed base *)
|
|
70
|
+
(* resource count, so a small readable budget like "r5" is meaningful. *)
|
|
71
|
+
(* Unlike a wall-clock timeout, an \`rlimit\` budget does not depend on CPU *)
|
|
72
|
+
(* speed or load, so the proof's pass/fail outcome reproduces on any *)
|
|
73
|
+
(* machine and every rerun (for a fixed Z3 build); how long it takes to *)
|
|
74
|
+
(* consume the budget still varies by machine. This is Z3-specific. *)
|
|
75
|
+
(**************************************************************************)
|
|
76
|
+
|
|
77
|
+
SMT == TRUE (*{ by (prover:"smt3") }*)
|
|
78
|
+
SMTT(X) == TRUE (*{ by (prover:"smt3"; timeout:@) }*)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
(**************************************************************************)
|
|
82
|
+
(* Backend pragma: CVC4 SMT solver *)
|
|
83
|
+
(* *)
|
|
84
|
+
(* These methods translate the proof obligation to SMTLIB2 and call CVC4. *)
|
|
85
|
+
(**************************************************************************)
|
|
86
|
+
|
|
87
|
+
(* The CVC3* methods are here for backward compatibility. They call CVC4. *)
|
|
88
|
+
CVC3 == TRUE (*{ by (prover: "cvc33") }*)
|
|
89
|
+
CVC3T(X) == TRUE (*{ by (prover:"cvc33"; timeout:@) }*)
|
|
90
|
+
|
|
91
|
+
CVC4 == TRUE (*{ by (prover: "cvc33") }*)
|
|
92
|
+
CVC4T(X) == TRUE (*{ by (prover:"cvc33"; timeout:@) }*)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
(**************************************************************************)
|
|
96
|
+
(* Backend pragma: Yices SMT solver *)
|
|
97
|
+
(* *)
|
|
98
|
+
(* This method translates the proof obligation to Yices native language. *)
|
|
99
|
+
(**************************************************************************)
|
|
100
|
+
|
|
101
|
+
Yices == TRUE (*{ by (prover: "yices3") }*)
|
|
102
|
+
YicesT(X) == TRUE (*{ by (prover:"yices3"; timeout:@) }*)
|
|
103
|
+
|
|
104
|
+
(**************************************************************************)
|
|
105
|
+
(* Backend pragma: veriT SMT solver *)
|
|
106
|
+
(* *)
|
|
107
|
+
(* This method translates the proof obligation to SMTLIB2 and calls veriT.*)
|
|
108
|
+
(**************************************************************************)
|
|
109
|
+
|
|
110
|
+
veriT == TRUE (*{ by (prover: "verit") }*)
|
|
111
|
+
veriTT(X) == TRUE (*{ by (prover:"verit"; timeout:@) }*)
|
|
112
|
+
|
|
113
|
+
(**************************************************************************)
|
|
114
|
+
(* Backend pragma: Zipperposition solver *)
|
|
115
|
+
(* *)
|
|
116
|
+
(* This method translates the proof obligation to TPTP and *)
|
|
117
|
+
(* calls Zipperposition. *)
|
|
118
|
+
(**************************************************************************)
|
|
119
|
+
|
|
120
|
+
Zipper == TRUE (*{ by (prover: "zipper") }*)
|
|
121
|
+
ZipperT(X) == TRUE (*{ by (prover:"zipper"; timeout:@) }*)
|
|
122
|
+
|
|
123
|
+
(**************************************************************************)
|
|
124
|
+
(* Backend pragma: Z3 SMT solver *)
|
|
125
|
+
(* *)
|
|
126
|
+
(* This method translates the proof obligation to SMTLIB2 and calls Z3. *)
|
|
127
|
+
(* Z3 is used by default but you can also explicitly call it. *)
|
|
128
|
+
(* Z3T(n) bounds Z3 by a wall-clock timeout of n seconds, while Z3T("rN") *)
|
|
129
|
+
(* bounds it by a deterministic \`rlimit\` budget of N base units, which *)
|
|
130
|
+
(* reproduces the same outcome on any machine (see SMTT). *)
|
|
131
|
+
(**************************************************************************)
|
|
132
|
+
|
|
133
|
+
Z3 == TRUE (*{ by (prover: "z33") }*)
|
|
134
|
+
Z3T(X) == TRUE (*{ by (prover:"z33"; timeout:@) }*)
|
|
135
|
+
|
|
136
|
+
(**************************************************************************)
|
|
137
|
+
(* Backend pragma: SPASS superposition prover *)
|
|
138
|
+
(* *)
|
|
139
|
+
(* This method translates the proof obligation to the DFG format language *)
|
|
140
|
+
(* supported by the ATP SPASS. The translation is based on the SMT one. *)
|
|
141
|
+
(**************************************************************************)
|
|
142
|
+
|
|
143
|
+
Spass == TRUE (*{ by (prover: "spass") }*)
|
|
144
|
+
SpassT(X) == TRUE (*{ by (prover:"spass"; timeout:@) }*)
|
|
145
|
+
|
|
146
|
+
(**************************************************************************)
|
|
147
|
+
(* Backend pragma: The PTL propositional linear time temporal logic *)
|
|
148
|
+
(* prover. It currently is the LS4 backend. *)
|
|
149
|
+
(* *)
|
|
150
|
+
(* This method translates the negetation of the proof obligation to *)
|
|
151
|
+
(* Seperated Normal Form (TRP++ format) and checks for unsatisfiability *)
|
|
152
|
+
(**************************************************************************)
|
|
153
|
+
|
|
154
|
+
LS4 == TRUE (*{ by (prover: "ls4") }*)
|
|
155
|
+
LS4T(X) == TRUE (*{ by (prover: "ls4"; timeout:@) }*)
|
|
156
|
+
PTL == TRUE (*{ by (prover: "ls4") }*)
|
|
157
|
+
|
|
158
|
+
(**************************************************************************)
|
|
159
|
+
(* Backend pragma: Zenon with different timeouts (default is 10 seconds) *)
|
|
160
|
+
(* *)
|
|
161
|
+
(**************************************************************************)
|
|
162
|
+
|
|
163
|
+
Zenon == TRUE (*{ by (prover:"zenon") }*)
|
|
164
|
+
ZenonT(X) == TRUE (*{ by (prover:"zenon"; timeout:@) }*)
|
|
165
|
+
|
|
166
|
+
(********************************************************************)
|
|
167
|
+
(* Backend pragma: Isabelle with different timeouts and tactics *)
|
|
168
|
+
(* (default is 30 seconds/auto) *)
|
|
169
|
+
(********************************************************************)
|
|
170
|
+
|
|
171
|
+
Isa == TRUE (*{ by (prover:"isabelle") }*)
|
|
172
|
+
IsaT(X) == TRUE (*{ by (prover:"isabelle"; timeout:@) }*)
|
|
173
|
+
IsaM(X) == TRUE (*{ by (prover:"isabelle"; tactic:@) }*)
|
|
174
|
+
IsaMT(X,Y) == TRUE (*{ by (prover:"isabelle"; tactic:@; timeout:@) }*)
|
|
175
|
+
|
|
176
|
+
(***************************************************************************)
|
|
177
|
+
(* The following theorem expresses the (useful implication of the) law of *)
|
|
178
|
+
(* set extensionality, which can be written as *)
|
|
179
|
+
(* *)
|
|
180
|
+
(* THEOREM \\A S, T : (S = T) <=> (\\A x : (x \\in S) <=> (x \\in T)) *)
|
|
181
|
+
(* *)
|
|
182
|
+
(* Theorem SetExtensionality is sometimes required by the SMT backend for *)
|
|
183
|
+
(* reasoning about sets. It is usually counterproductive to include *)
|
|
184
|
+
(* theorem SetExtensionality in a BY clause for the Zenon or Isabelle *)
|
|
185
|
+
(* backends. Instead, use the pragma IsaWithSetExtensionality to instruct *)
|
|
186
|
+
(* the Isabelle backend to use the rule of set extensionality. *)
|
|
187
|
+
(***************************************************************************)
|
|
188
|
+
IsaWithSetExtensionality == TRUE
|
|
189
|
+
(*{ by (prover:"isabelle"; tactic:"(auto intro: setEqualI)")}*)
|
|
190
|
+
|
|
191
|
+
THEOREM SetExtensionality == \\A S,T : (\\A x : x \\in S <=> x \\in T) => S = T
|
|
192
|
+
OBVIOUS
|
|
193
|
+
|
|
194
|
+
(***************************************************************************)
|
|
195
|
+
(* The following theorem is needed to deduce NotInSetS \\notin SetS from *)
|
|
196
|
+
(* the definition *)
|
|
197
|
+
(* *)
|
|
198
|
+
(* NotInSetS == CHOOSE v : v \\notin SetS *)
|
|
199
|
+
(***************************************************************************)
|
|
200
|
+
THEOREM NoSetContainsEverything == \\A S : \\E x : x \\notin S
|
|
201
|
+
OBVIOUS (*{by (isabelle "(auto intro: inIrrefl)")}*)
|
|
202
|
+
-----------------------------------------------------------------------------
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
(********************************************************************)
|
|
207
|
+
(********************************************************************)
|
|
208
|
+
(********************************************************************)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
(********************************************************************)
|
|
212
|
+
(* Old versions of Zenon and Isabelle pragmas below *)
|
|
213
|
+
(* (kept for compatibility) *)
|
|
214
|
+
(********************************************************************)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
(**************************************************************************)
|
|
218
|
+
(* Backend pragma: Zenon with different timeouts (default is 10 seconds) *)
|
|
219
|
+
(* *)
|
|
220
|
+
(**************************************************************************)
|
|
221
|
+
|
|
222
|
+
SlowZenon == TRUE (*{ by (prover:"zenon"; timeout:20) }*)
|
|
223
|
+
SlowerZenon == TRUE (*{ by (prover:"zenon"; timeout:40) }*)
|
|
224
|
+
VerySlowZenon == TRUE (*{ by (prover:"zenon"; timeout:80) }*)
|
|
225
|
+
SlowestZenon == TRUE (*{ by (prover:"zenon"; timeout:160) }*)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
(********************************************************************)
|
|
230
|
+
(* Backend pragma: Isabelle's automatic search ("auto") *)
|
|
231
|
+
(* *)
|
|
232
|
+
(* This pragma bypasses Zenon. It is useful in situations involving *)
|
|
233
|
+
(* essentially simplification and equational reasoning. *)
|
|
234
|
+
(* Default imeout for all isabelle tactics is 30 seconds. *)
|
|
235
|
+
(********************************************************************)
|
|
236
|
+
Auto == TRUE (*{ by (prover:"isabelle"; tactic:"auto") }*)
|
|
237
|
+
SlowAuto == TRUE (*{ by (prover:"isabelle"; tactic:"auto"; timeout:120) }*)
|
|
238
|
+
SlowerAuto == TRUE (*{ by (prover:"isabelle"; tactic:"auto"; timeout:480) }*)
|
|
239
|
+
SlowestAuto == TRUE (*{ by (prover:"isabelle"; tactic:"auto"; timeout:960) }*)
|
|
240
|
+
|
|
241
|
+
(********************************************************************)
|
|
242
|
+
(* Backend pragma: Isabelle's "force" tactic *)
|
|
243
|
+
(* *)
|
|
244
|
+
(* This pragma bypasses Zenon. It is useful in situations involving *)
|
|
245
|
+
(* quantifier reasoning. *)
|
|
246
|
+
(********************************************************************)
|
|
247
|
+
Force == TRUE (*{ by (prover:"isabelle"; tactic:"force") }*)
|
|
248
|
+
SlowForce == TRUE (*{ by (prover:"isabelle"; tactic:"force"; timeout:120) }*)
|
|
249
|
+
SlowerForce == TRUE (*{ by (prover:"isabelle"; tactic:"force"; timeout:480) }*)
|
|
250
|
+
SlowestForce == TRUE (*{ by (prover:"isabelle"; tactic:"force"; timeout:960) }*)
|
|
251
|
+
|
|
252
|
+
(***********************************************************************)
|
|
253
|
+
(* Backend pragma: Isabelle's "simplification" tactics *)
|
|
254
|
+
(* *)
|
|
255
|
+
(* These tactics simplify the goal before running one of the automated *)
|
|
256
|
+
(* tactics. They are often necessary for obligations involving record *)
|
|
257
|
+
(* or tuple projections. Use the SimplfyAndSolve tactic unless you're *)
|
|
258
|
+
(* sure you can get away with just Simplification *)
|
|
259
|
+
(***********************************************************************)
|
|
260
|
+
SimplifyAndSolve == TRUE
|
|
261
|
+
(*{ by (prover:"isabelle"; tactic:"clarsimp auto?") }*)
|
|
262
|
+
SlowSimplifyAndSolve == TRUE
|
|
263
|
+
(*{ by (prover:"isabelle"; tactic:"clarsimp auto?"; timeout:120) }*)
|
|
264
|
+
SlowerSimplifyAndSolve == TRUE
|
|
265
|
+
(*{ by (prover:"isabelle"; tactic:"clarsimp auto?"; timeout:480) }*)
|
|
266
|
+
SlowestSimplifyAndSolve == TRUE
|
|
267
|
+
(*{ by (prover:"isabelle"; tactic:"clarsimp auto?"; timeout:960) }*)
|
|
268
|
+
|
|
269
|
+
Simplification == TRUE (*{ by (prover:"isabelle"; tactic:"clarsimp") }*)
|
|
270
|
+
SlowSimplification == TRUE
|
|
271
|
+
(*{ by (prover:"isabelle"; tactic:"clarsimp"; timeout:120) }*)
|
|
272
|
+
SlowerSimplification == TRUE
|
|
273
|
+
(*{ by (prover:"isabelle"; tactic:"clarsimp"; timeout:480) }*)
|
|
274
|
+
SlowestSimplification == TRUE
|
|
275
|
+
(*{ by (prover:"isabelle"; tactic:"clarsimp"; timeout:960) }*)
|
|
276
|
+
|
|
277
|
+
(**************************************************************************)
|
|
278
|
+
(* Backend pragma: Isabelle's tableau prover ("blast") *)
|
|
279
|
+
(* *)
|
|
280
|
+
(* This pragma bypasses Zenon and uses Isabelle's built-in theorem *)
|
|
281
|
+
(* prover, Blast. It is almost never better than Zenon by itself, but *)
|
|
282
|
+
(* becomes very useful in combination with the Auto pragma above. The *)
|
|
283
|
+
(* AutoBlast pragma first attempts Auto and then uses Blast to prove what *)
|
|
284
|
+
(* Auto could not prove. (There is currently no way to use Zenon on the *)
|
|
285
|
+
(* results left over from Auto.) *)
|
|
286
|
+
(**************************************************************************)
|
|
287
|
+
Blast == TRUE (*{ by (prover:"isabelle"; tactic:"blast") }*)
|
|
288
|
+
SlowBlast == TRUE (*{ by (prover:"isabelle"; tactic:"blast"; timeout:120) }*)
|
|
289
|
+
SlowerBlast == TRUE (*{ by (prover:"isabelle"; tactic:"blast"; timeout:480) }*)
|
|
290
|
+
SlowestBlast == TRUE (*{ by (prover:"isabelle"; tactic:"blast"; timeout:960) }*)
|
|
291
|
+
|
|
292
|
+
AutoBlast == TRUE (*{ by (prover:"isabelle"; tactic:"auto, blast") }*)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
(**************************************************************************)
|
|
296
|
+
(* Backend pragmas: multi-back-ends *)
|
|
297
|
+
(* *)
|
|
298
|
+
(* These pragmas just run a bunch of back-ends one after the other in the *)
|
|
299
|
+
(* hope that one will succeed. This saves time and effort for the user at *)
|
|
300
|
+
(* the expense of computation time. *)
|
|
301
|
+
(**************************************************************************)
|
|
302
|
+
|
|
303
|
+
(* CVC3 goes first because it's bundled with TLAPS, then the other SMT
|
|
304
|
+
solvers are unlikely to succeed if CVC3 fails, so we run zenon and
|
|
305
|
+
Isabelle before them. *)
|
|
306
|
+
AllProvers == TRUE (*{
|
|
307
|
+
by (prover:"cvc33")
|
|
308
|
+
by (prover:"zenon")
|
|
309
|
+
by (prover:"isabelle"; tactic:"auto")
|
|
310
|
+
by (prover:"spass")
|
|
311
|
+
by (prover:"smt3")
|
|
312
|
+
by (prover:"yices3")
|
|
313
|
+
by (prover:"verit")
|
|
314
|
+
by (prover:"z33")
|
|
315
|
+
by (prover:"isabelle"; tactic:"force")
|
|
316
|
+
by (prover:"isabelle"; tactic:"(auto intro: setEqualI)")
|
|
317
|
+
by (prover:"isabelle"; tactic:"clarsimp auto?")
|
|
318
|
+
by (prover:"isabelle"; tactic:"clarsimp")
|
|
319
|
+
by (prover:"isabelle"; tactic:"auto, blast")
|
|
320
|
+
}*)
|
|
321
|
+
AllProversT(X) == TRUE (*{
|
|
322
|
+
by (prover:"cvc33"; timeout:@)
|
|
323
|
+
by (prover:"zenon"; timeout:@)
|
|
324
|
+
by (prover:"isabelle"; tactic:"auto"; timeout:@)
|
|
325
|
+
by (prover:"spass"; timeout:@)
|
|
326
|
+
by (prover:"smt3"; timeout:@)
|
|
327
|
+
by (prover:"yices3"; timeout:@)
|
|
328
|
+
by (prover:"verit"; timeout:@)
|
|
329
|
+
by (prover:"z33"; timeout:@)
|
|
330
|
+
by (prover:"isabelle"; tactic:"force"; timeout:@)
|
|
331
|
+
by (prover:"isabelle"; tactic:"(auto intro: setEqualI)"; timeout:@)
|
|
332
|
+
by (prover:"isabelle"; tactic:"clarsimp auto?"; timeout:@)
|
|
333
|
+
by (prover:"isabelle"; tactic:"clarsimp"; timeout:@)
|
|
334
|
+
by (prover:"isabelle"; tactic:"auto, blast"; timeout:@)
|
|
335
|
+
}*)
|
|
336
|
+
|
|
337
|
+
AllSMT == TRUE (*{
|
|
338
|
+
by (prover:"cvc33")
|
|
339
|
+
by (prover:"smt3")
|
|
340
|
+
by (prover:"yices3")
|
|
341
|
+
by (prover:"verit")
|
|
342
|
+
by (prover:"z33")
|
|
343
|
+
}*)
|
|
344
|
+
AllSMTT(X) == TRUE (*{
|
|
345
|
+
by (prover:"cvc33"; timeout:@)
|
|
346
|
+
by (prover:"smt3"; timeout:@)
|
|
347
|
+
by (prover:"yices3"; timeout:@)
|
|
348
|
+
by (prover:"verit"; timeout:@)
|
|
349
|
+
by (prover:"z33"; timeout:@)
|
|
350
|
+
}*)
|
|
351
|
+
|
|
352
|
+
AllIsa == TRUE (*{
|
|
353
|
+
by (prover:"isabelle"; tactic:"auto")
|
|
354
|
+
by (prover:"isabelle"; tactic:"force")
|
|
355
|
+
by (prover:"isabelle"; tactic:"(auto intro: setEqualI)")
|
|
356
|
+
by (prover:"isabelle"; tactic:"clarsimp auto?")
|
|
357
|
+
by (prover:"isabelle"; tactic:"clarsimp")
|
|
358
|
+
by (prover:"isabelle"; tactic:"auto, blast")
|
|
359
|
+
}*)
|
|
360
|
+
AllIsaT(X) == TRUE (*{
|
|
361
|
+
by (prover:"isabelle"; tactic:"auto"; timeout:@)
|
|
362
|
+
by (prover:"isabelle"; tactic:"force"; timeout:@)
|
|
363
|
+
by (prover:"isabelle"; tactic:"(auto intro: setEqualI)"; timeout:@)
|
|
364
|
+
by (prover:"isabelle"; tactic:"clarsimp auto?"; timeout:@)
|
|
365
|
+
by (prover:"isabelle"; tactic:"clarsimp"; timeout:@)
|
|
366
|
+
by (prover:"isabelle"; tactic:"auto, blast"; timeout:@)
|
|
367
|
+
}*)
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
(**************************************************************************)
|
|
371
|
+
(* The pragma ExpandEnabled invokes expansion of the operator ENABLED. *)
|
|
372
|
+
(* *)
|
|
373
|
+
(* The pragma ExpandCdot invokes expansion of the operator \\cdot. *)
|
|
374
|
+
(* *)
|
|
375
|
+
(* The pragma AutoUSE invokes automated expansion of definitions, *)
|
|
376
|
+
(* for both of ExpandEnabled and ExpandCdot, when each is present. *)
|
|
377
|
+
(* *)
|
|
378
|
+
(* The pragma Lambdify invokes expansion of the operators *)
|
|
379
|
+
(* ENABLED and \\cdot to an intermediate form with bound VARIABLES, *)
|
|
380
|
+
(* which is a form before introducing rigid quantifiers. *)
|
|
381
|
+
(* The pragma Lambdify is sound for occurrences of ENABLED and \\cdot *)
|
|
382
|
+
(* that are not nested. *)
|
|
383
|
+
(**************************************************************************)
|
|
384
|
+
ExpandENABLED == TRUE (*{ by (prover:"expandenabled") }*)
|
|
385
|
+
ExpandCdot == TRUE (*{ by (prover:"expandcdot") }*)
|
|
386
|
+
AutoUSE == TRUE (*{ by (prover:"autouse") }*)
|
|
387
|
+
Lambdify == TRUE (*{ by (prover:"lambdify") }*)
|
|
388
|
+
ENABLEDaxioms == TRUE (*{ by (prover:"enabledaxioms") }*)
|
|
389
|
+
LevelComparison == TRUE (*{ by (prover:"levelcomparison") }*)
|
|
390
|
+
|
|
391
|
+
(* The operators EnabledWrapper and CdotWrapper occur in an intermediate *)
|
|
392
|
+
(* representation within TLAPM. *)
|
|
393
|
+
EnabledWrapper(Op(_)) == FALSE
|
|
394
|
+
CdotWrapper(Op(_)) == FALSE
|
|
395
|
+
|
|
396
|
+
(***************************************************************************)
|
|
397
|
+
(* The following may be used in a \`BY ONLY ThmName\` for unit testing the *)
|
|
398
|
+
(* triviality checks in TLAPM. *)
|
|
399
|
+
(***************************************************************************)
|
|
400
|
+
Trivial == TRUE (*{ by (prover:"trivial") }*)
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
=============================================================================
|
|
404
|
+
|
|
405
|
+
The material below is obsolete: the TLA proof rules below are superseded by
|
|
406
|
+
the PTL decision procedure, and their formulation is unsound for the semantics
|
|
407
|
+
of temporal reasoning that TLAPS adopts.
|
|
408
|
+
|
|
409
|
+
----------------------------------------------------------------------------
|
|
410
|
+
(***************************************************************************)
|
|
411
|
+
(* TEMPORAL LOGIC *)
|
|
412
|
+
(* *)
|
|
413
|
+
(* The following rules are intended to be used when TLAPS handles temporal *)
|
|
414
|
+
(* logic. They will not work now. Moreover when temporal reasoning is *)
|
|
415
|
+
(* implemented, these rules may be changed or omitted, and additional *)
|
|
416
|
+
(* rules will probably be added. However, they are included mainly so *)
|
|
417
|
+
(* their names will be defined, preventing the use of identifiers that are *)
|
|
418
|
+
(* likely to produce name clashes with future versions of this module. *)
|
|
419
|
+
(***************************************************************************)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
(***************************************************************************)
|
|
423
|
+
(* The following proof rules (and their names) are from the paper "The *)
|
|
424
|
+
(* Temporal Logic of Actions". *)
|
|
425
|
+
(***************************************************************************)
|
|
426
|
+
THEOREM RuleTLA1 == ASSUME STATE P, STATE f,
|
|
427
|
+
P /\\ (f' = f) => P'
|
|
428
|
+
PROVE []P <=> P /\\ [][P => P']_f
|
|
429
|
+
|
|
430
|
+
THEOREM RuleTLA2 == ASSUME STATE P, STATE Q, STATE f, STATE g,
|
|
431
|
+
ACTION A, ACTION B,
|
|
432
|
+
P /\\ [A]_f => Q /\\ [B]_g
|
|
433
|
+
PROVE []P /\\ [][A]_f => []Q /\\ [][B]_g
|
|
434
|
+
|
|
435
|
+
THEOREM RuleINV1 == ASSUME STATE I, STATE F, ACTION N,
|
|
436
|
+
I /\\ [N]_F => I'
|
|
437
|
+
PROVE I /\\ [][N]_F => []I
|
|
438
|
+
|
|
439
|
+
THEOREM RuleINV2 == ASSUME STATE I, STATE f, ACTION N
|
|
440
|
+
PROVE []I => ([][N]_f <=> [][N /\\ I /\\ I']_f)
|
|
441
|
+
|
|
442
|
+
THEOREM RuleWF1 == ASSUME STATE P, STATE Q, STATE f, ACTION N, ACTION A,
|
|
443
|
+
P /\\ [N]_f => (P' \\/ Q'),
|
|
444
|
+
P /\\ <<N /\\ A>>_f => Q',
|
|
445
|
+
P => ENABLED <<A>>_f
|
|
446
|
+
PROVE [][N]_f /\\ WF_f(A) => (P ~> Q)
|
|
447
|
+
|
|
448
|
+
THEOREM RuleSF1 == ASSUME STATE P, STATE Q, STATE f,
|
|
449
|
+
ACTION N, ACTION A, TEMPORAL F,
|
|
450
|
+
P /\\ [N]_f => (P' \\/ Q'),
|
|
451
|
+
P /\\ <<N /\\ A>>_f => Q',
|
|
452
|
+
[]P /\\ [][N]_f /\\ []F => <> ENABLED <<A>>_f
|
|
453
|
+
PROVE [][N]_f /\\ SF_f(A) /\\ []F => (P ~> Q)
|
|
454
|
+
|
|
455
|
+
(***************************************************************************)
|
|
456
|
+
(* The rules WF2 and SF2 in "The Temporal Logic of Actions" are obtained *)
|
|
457
|
+
(* from the following two rules by the following substitutions: \`. *)
|
|
458
|
+
(* *)
|
|
459
|
+
(* ___ ___ _______________ *)
|
|
460
|
+
(* M <- M , g <- g , EM <- ENABLED <<M>>_g .' *)
|
|
461
|
+
(***************************************************************************)
|
|
462
|
+
THEOREM RuleWF2 == ASSUME STATE P, STATE f, STATE g, STATE EM,
|
|
463
|
+
ACTION A, ACTION B, ACTION N, ACTION M,
|
|
464
|
+
TEMPORAL F,
|
|
465
|
+
<<N /\\ B>>_f => <<M>>_g,
|
|
466
|
+
P /\\ P' /\\ <<N /\\ A>>_f /\\ EM => B,
|
|
467
|
+
P /\\ EM => ENABLED A,
|
|
468
|
+
[][N /\\ ~B]_f /\\ WF_f(A) /\\ []F /\\ <>[]EM => <>[]P
|
|
469
|
+
PROVE [][N]_f /\\ WF_f(A) /\\ []F => []<><<M>>_g \\/ []<>(~EM)
|
|
470
|
+
|
|
471
|
+
THEOREM RuleSF2 == ASSUME STATE P, STATE f, STATE g, STATE EM,
|
|
472
|
+
ACTION A, ACTION B, ACTION N, ACTION M,
|
|
473
|
+
TEMPORAL F,
|
|
474
|
+
<<N /\\ B>>_f => <<M>>_g,
|
|
475
|
+
P /\\ P' /\\ <<N /\\ A>>_f /\\ EM => B,
|
|
476
|
+
P /\\ EM => ENABLED A,
|
|
477
|
+
[][N /\\ ~B]_f /\\ SF_f(A) /\\ []F /\\ []<>EM => <>[]P
|
|
478
|
+
PROVE [][N]_f /\\ SF_f(A) /\\ []F => []<><<M>>_g \\/ <>[](~EM)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
(***************************************************************************)
|
|
482
|
+
(* The following rule is a special case of the general temporal logic *)
|
|
483
|
+
(* proof rule STL4 from the paper "The Temporal Logic of Actions". The *)
|
|
484
|
+
(* general rule is for arbitrary temporal formulas F and G, but it cannot *)
|
|
485
|
+
(* yet be handled by TLAPS. *)
|
|
486
|
+
(***************************************************************************)
|
|
487
|
+
THEOREM RuleInvImplication ==
|
|
488
|
+
ASSUME STATE F, STATE G,
|
|
489
|
+
F => G
|
|
490
|
+
PROVE []F => []G
|
|
491
|
+
PROOF OMITTED
|
|
492
|
+
|
|
493
|
+
(***************************************************************************)
|
|
494
|
+
(* The following rule is a special case of rule TLA2 from the paper "The *)
|
|
495
|
+
(* Temporal Logic of Actions". *)
|
|
496
|
+
(***************************************************************************)
|
|
497
|
+
THEOREM RuleStepSimulation ==
|
|
498
|
+
ASSUME STATE I, STATE f, STATE g,
|
|
499
|
+
ACTION M, ACTION N,
|
|
500
|
+
I /\\ I' /\\ [M]_f => [N]_g
|
|
501
|
+
PROVE []I /\\ [][M]_f => [][N]_g
|
|
502
|
+
PROOF OMITTED
|
|
503
|
+
|
|
504
|
+
(***************************************************************************)
|
|
505
|
+
(* The following may be used to invoke a decision procedure for *)
|
|
506
|
+
(* propositional temporal logic. *)
|
|
507
|
+
(***************************************************************************)
|
|
508
|
+
PropositionalTemporalLogic == TRUE
|
|
509
|
+
=============================================================================
|
|
510
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// A backend's answer to an obligation. tlapm frames an obligation as unsatisfiable when the backend
|
|
2
|
+
// proves it.
|
|
3
|
+
export type Verdict = "unsat" | "sat" | "unknown";
|
|
4
|
+
|
|
5
|
+
export interface Decision {
|
|
6
|
+
verdict: Verdict;
|
|
7
|
+
timeUsedMs: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface DecideOptions {
|
|
11
|
+
timeLimitMs: number;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// V8's error when a recursion runs out of stack. The backends run as their own processes, which grow
|
|
16
|
+
// their stacks or fail the obligation alone, so a backend ported in process answers unknown instead.
|
|
17
|
+
export const isStackOverflow = (error: unknown) =>
|
|
18
|
+
error instanceof RangeError && error.message === "Maximum call stack size exceeded";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Copyright (c) 1997-2006, Institut National de Recherche en
|
|
2
|
+
Informatique et en Automatique (INRIA)
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are
|
|
8
|
+
met:
|
|
9
|
+
|
|
10
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
|
15
|
+
documentation and/or other materials provided with the
|
|
16
|
+
distribution.
|
|
17
|
+
|
|
18
|
+
* Neither the name of INRIA nor the names of its contributors may
|
|
19
|
+
be used to endorse or promote products derived from this software
|
|
20
|
+
without specific prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// An independent check of the proofs that the Zenon port finds. It shares no code with the search:
|
|
2
|
+
// formulas compare by their own alpha-equivalence, substitution and unfolding are rebuilt here, and
|
|
3
|
+
// each rule's branches come from the lemma that justifies the rule in tlapm's Zenon.thy rather than
|
|
4
|
+
// from the prover. The check walks the proof bottom up and computes the formulas each subproof
|
|
5
|
+
// needs. A proof is valid when every rule is one of the lemmas and the root needs only hypotheses.
|
|
6
|
+
|
|
7
|
+
import { getLimitFailure, type Limits } from "../limits";
|
|
8
|
+
import type { PlainRuleName, Proof, RuleArgs } from "../proof";
|
|
9
|
+
import { getDefinitionSpec } from "./definitions";
|
|
10
|
+
import { EQUALITY_RULES, getRelationRuleSpec } from "./equality";
|
|
11
|
+
import { FUNCTION_RULES } from "./functions";
|
|
12
|
+
import { createKeys } from "./keys";
|
|
13
|
+
import { PROPOSITIONAL_RULES } from "./propositional";
|
|
14
|
+
import { RECORD_RULES } from "./records";
|
|
15
|
+
import { createRelationProperties } from "./relations";
|
|
16
|
+
import { REWRITE_RULES } from "./rewrites";
|
|
17
|
+
import { SET_RULES } from "./sets";
|
|
18
|
+
import { TLA_RULES } from "./tla";
|
|
19
|
+
import {
|
|
20
|
+
ensure,
|
|
21
|
+
UncheckedError,
|
|
22
|
+
type CheckContext,
|
|
23
|
+
type Checker,
|
|
24
|
+
type RuleSpec,
|
|
25
|
+
type SpecTable,
|
|
26
|
+
type Term,
|
|
27
|
+
} from "./terms";
|
|
28
|
+
|
|
29
|
+
const PLAIN_RULES: SpecTable<PlainRuleName> = {
|
|
30
|
+
...PROPOSITIONAL_RULES,
|
|
31
|
+
...EQUALITY_RULES,
|
|
32
|
+
...SET_RULES,
|
|
33
|
+
...FUNCTION_RULES,
|
|
34
|
+
...RECORD_RULES,
|
|
35
|
+
...REWRITE_RULES,
|
|
36
|
+
...TLA_RULES,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getPlainRuleSpec = <Name extends PlainRuleName>(
|
|
40
|
+
rule: { name: Name; args: RuleArgs<Name, Term> },
|
|
41
|
+
checker: Checker,
|
|
42
|
+
uses: Term[],
|
|
43
|
+
) => PLAIN_RULES[rule.name](rule.args, checker, uses);
|
|
44
|
+
|
|
45
|
+
const getRuleSpec = (proof: Proof<Term>, checker: Checker): RuleSpec => {
|
|
46
|
+
const rule = proof.rule;
|
|
47
|
+
switch (rule.name) {
|
|
48
|
+
case "definition":
|
|
49
|
+
return getDefinitionSpec(rule.definition, rule.args, checker);
|
|
50
|
+
case "close_refl":
|
|
51
|
+
case "close_sym":
|
|
52
|
+
case "refl":
|
|
53
|
+
case "p_not_p_sym":
|
|
54
|
+
return getRelationRuleSpec(rule, checker);
|
|
55
|
+
default:
|
|
56
|
+
return getPlainRuleSpec(rule, checker, proof.uses);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// True when the proof refutes the hypotheses.
|
|
61
|
+
// Whether the proof is valid, or false once the limits pass.
|
|
62
|
+
export const checkProof = (root: Proof<Term>, context: CheckContext, limits: Limits) => {
|
|
63
|
+
const keys = createKeys();
|
|
64
|
+
const hasRelation = createRelationProperties(context);
|
|
65
|
+
const checker: Checker = {
|
|
66
|
+
...keys,
|
|
67
|
+
context,
|
|
68
|
+
ensureRelation: (symbol, properties) => ensure(hasRelation(symbol, properties)),
|
|
69
|
+
};
|
|
70
|
+
const needed = new Map<Proof<Term>, Set<string>>();
|
|
71
|
+
const getNeeded = (proof: Proof<Term>) => {
|
|
72
|
+
const spec = getRuleSpec(proof, checker);
|
|
73
|
+
ensure(spec.branches.length === proof.subproofs.length);
|
|
74
|
+
const result = new Set(spec.premises.map(keys.getTopKey));
|
|
75
|
+
proof.subproofs.forEach((subproof, index) => {
|
|
76
|
+
const branch = new Set(spec.branches[index].map(keys.getTopKey));
|
|
77
|
+
for (const key of needed.get(subproof) ?? []) if (!branch.has(key)) result.add(key);
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
try {
|
|
82
|
+
// Subproofs before their parents, without recursion: proofs can be deep.
|
|
83
|
+
const stack: [Proof<Term>, boolean][] = [[root, false]];
|
|
84
|
+
while (stack.length > 0) {
|
|
85
|
+
if (getLimitFailure(limits) !== undefined) return false;
|
|
86
|
+
const top = stack.pop();
|
|
87
|
+
if (top === undefined) break;
|
|
88
|
+
const proof = top[0];
|
|
89
|
+
if (needed.has(proof)) continue;
|
|
90
|
+
if (top[1]) {
|
|
91
|
+
needed.set(proof, getNeeded(proof));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
stack.push([proof, true]);
|
|
95
|
+
for (const subproof of proof.subproofs)
|
|
96
|
+
if (!needed.has(subproof)) stack.push([subproof, false]);
|
|
97
|
+
}
|
|
98
|
+
const hypotheses = new Set(context.hypotheses.map(keys.getTopKey));
|
|
99
|
+
const missing = [...(needed.get(root) ?? [])].filter((key) => !hypotheses.has(key));
|
|
100
|
+
return missing.length === 0;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (error instanceof UncheckedError) return false;
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
};
|