tla-ts 0.0.4-dev.a0009b7 → 0.0.4-dev.b254db0
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 +33 -143
- package/dist/deciders.cjs +366 -0
- package/dist/deciders.js +366 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +37 -1
- package/dist/index.d.ts +37 -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 +63 -20
- package/src/index.ts +10 -0
- package/src/{obligation-action.ts → obligations/action.ts} +265 -55
- package/src/{obligation-anon.ts → obligations/anon.ts} +47 -37
- package/src/obligations/ctx.ts +64 -0
- package/src/{obligation-deref.ts → obligations/deref.ts} +38 -61
- package/src/{obligation-expression.ts → obligations/expression.ts} +78 -45
- package/src/{obligation-format.ts → obligations/format.ts} +7 -8
- package/src/{obligation-generate.ts → obligations/generate.ts} +147 -74
- package/src/{obligations.ts → obligations/index.ts} +29 -13
- package/src/{obligation-levels.ts → obligations/levels.ts} +14 -5
- package/src/{obligation-module.ts → obligations/module.ts} +56 -33
- 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 -1
- package/src/{obligation-source.ts → obligations/source.ts} +159 -97
- package/src/obligations/temporal.ts +319 -0
- package/src/{obligation-tuples.ts → obligations/tuples.ts} +1 -1
- 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 +100 -0
- package/src/prove/deciders.ts +33 -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 +503 -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 +521 -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 +557 -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 +25 -0
- package/src/prove/prove.ts +505 -0
- package/src/prove/ptl/decide.ts +68 -0
- package/src/prove/ptl/encode.ts +256 -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 +222 -0
- package/src/prove/smt/context.ts +108 -0
- package/src/prove/smt/data.ts +636 -0
- package/src/prove/smt/encode.ts +166 -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 +182 -0
- package/src/prove/smt/rewrite.ts +773 -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 +437 -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 +334 -75
- package/src/standard-modules.ts +5 -2
- package/src/successors.ts +24 -5
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// A port of tlapm's proof simplification (Proof.Simplify) and obligation generation (Proof.Gen):
|
|
2
2
|
// leaf proofs become obligations whose context is everything the proof may use at that point.
|
|
3
3
|
|
|
4
|
-
import { TlapmBugError, TlaProofError } from "
|
|
4
|
+
import { TlapmBugError, TlaProofError } from "../errors";
|
|
5
5
|
import {
|
|
6
6
|
applyBuiltin,
|
|
7
7
|
at,
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
getErrorNote,
|
|
11
11
|
isEqualExpr,
|
|
12
12
|
mapAccumulate,
|
|
13
|
+
mapChildren,
|
|
13
14
|
normalizeApply,
|
|
14
15
|
shift,
|
|
15
16
|
shiftExpr,
|
|
16
17
|
substituteBounds,
|
|
17
18
|
substituteExpr,
|
|
19
|
+
stripProps,
|
|
18
20
|
type Bound,
|
|
19
21
|
type Builtin,
|
|
20
22
|
type Expr,
|
|
@@ -22,12 +24,13 @@ import {
|
|
|
22
24
|
type Locus,
|
|
23
25
|
type ObligationWarning,
|
|
24
26
|
type Sequent,
|
|
27
|
+
type Time,
|
|
25
28
|
type Visibility,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from "./
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
29
|
+
} from "./expression";
|
|
30
|
+
import { format, renderDoc, type Doc } from "./format";
|
|
31
|
+
import { printExpression } from "./printer";
|
|
32
|
+
import type { OldMethod } from "./pragma";
|
|
33
|
+
import { getScopeTime } from "./temporal";
|
|
31
34
|
import {
|
|
32
35
|
getStepName,
|
|
33
36
|
getUnique,
|
|
@@ -39,7 +42,7 @@ import {
|
|
|
39
42
|
type StepNumber,
|
|
40
43
|
type UseDef,
|
|
41
44
|
type Usable,
|
|
42
|
-
} from "./
|
|
45
|
+
} from "./proof";
|
|
43
46
|
|
|
44
47
|
const AT_NOWHERE: Expr = { kind: "At", isExcept: false };
|
|
45
48
|
|
|
@@ -48,6 +51,7 @@ const getProps = (from: Step) => ({
|
|
|
48
51
|
location: from.location,
|
|
49
52
|
step: from.step,
|
|
50
53
|
isSuppressed: from.isSuppressed,
|
|
54
|
+
method: from.method,
|
|
51
55
|
});
|
|
52
56
|
|
|
53
57
|
const isAnonymous = (step: StepNumber | undefined) => step?.kind === "Named" && step.isAnonymous;
|
|
@@ -101,24 +105,27 @@ const getAssumedFacts = (offset: number, sequent: Sequent) =>
|
|
|
101
105
|
: [],
|
|
102
106
|
);
|
|
103
107
|
|
|
104
|
-
const getStepDefinition = (step: Step, body: Expr): Hyp => {
|
|
108
|
+
const getStepDefinition = (step: Step, body: Expr, time: Time): Hyp => {
|
|
105
109
|
if (!step.step) throw new TlapmBugError();
|
|
106
110
|
return {
|
|
107
111
|
kind: "Defn",
|
|
108
112
|
definition: { kind: "Operator", name: getStepName(step.step), body, location: step.location },
|
|
109
|
-
whereDefined: "Proof",
|
|
113
|
+
whereDefined: { kind: "Proof", time },
|
|
110
114
|
visibility: "Visible",
|
|
111
115
|
isLocal: true,
|
|
112
116
|
location: step.location,
|
|
113
117
|
};
|
|
114
118
|
};
|
|
115
119
|
|
|
116
|
-
|
|
120
|
+
// The proof of an assertion leaves the always scope when the assertion assumes a fact that holds
|
|
121
|
+
// only now.
|
|
122
|
+
const proveAssertion = (context: Hyp[], sequent: Sequent, step: Step, time: Time) => {
|
|
117
123
|
const visibility: Visibility = isAnonymous(step.step) ? "Visible" : "Hidden";
|
|
118
124
|
const hyps = sequent.context.map((hyp): Hyp =>
|
|
119
125
|
hyp.kind === "Fact" ? { ...hyp, visibility } : hyp,
|
|
120
126
|
);
|
|
121
127
|
const body = at({ kind: "List", bullet: "Refs", items: getAssumedFacts(2, sequent) }, step);
|
|
128
|
+
const scopeTime = getScopeTime(sequent.context, time);
|
|
122
129
|
return {
|
|
123
130
|
context: [
|
|
124
131
|
...context,
|
|
@@ -127,17 +134,20 @@ const proveAssertion = (context: Hyp[], sequent: Sequent, step: Step) => {
|
|
|
127
134
|
kind: "Fact",
|
|
128
135
|
expression: getTrue(step),
|
|
129
136
|
visibility: "Hidden",
|
|
137
|
+
time,
|
|
130
138
|
location: step.location,
|
|
131
139
|
},
|
|
132
|
-
getStepDefinition(step, body),
|
|
140
|
+
getStepDefinition(step, body, scopeTime),
|
|
133
141
|
{
|
|
134
142
|
kind: "Fact",
|
|
135
143
|
expression: at({ kind: "Ix", index: 1 }, step),
|
|
136
144
|
visibility: "Hidden",
|
|
145
|
+
time: scopeTime,
|
|
137
146
|
location: step.location,
|
|
138
147
|
},
|
|
139
148
|
] satisfies Hyp[],
|
|
140
149
|
active: shiftExpr(3, sequent.active),
|
|
150
|
+
time: scopeTime,
|
|
141
151
|
};
|
|
142
152
|
};
|
|
143
153
|
|
|
@@ -147,16 +157,18 @@ const useAssertion = (
|
|
|
147
157
|
goal: Expr,
|
|
148
158
|
sequent: Sequent,
|
|
149
159
|
step: Step,
|
|
160
|
+
time: Time,
|
|
150
161
|
) => {
|
|
151
162
|
const visibility: Visibility = isSuffices || isAnonymous(step.step) ? "Visible" : "Hidden";
|
|
152
163
|
return {
|
|
153
164
|
context: [
|
|
154
165
|
...context,
|
|
155
|
-
getStepDefinition(step, at(exprifySequent(sequent), step)),
|
|
166
|
+
getStepDefinition(step, at(exprifySequent(sequent), step), time),
|
|
156
167
|
{
|
|
157
168
|
kind: "Fact",
|
|
158
169
|
expression: at({ kind: "Ix", index: 1 }, step),
|
|
159
170
|
visibility,
|
|
171
|
+
time,
|
|
160
172
|
location: step.location,
|
|
161
173
|
},
|
|
162
174
|
] satisfies Hyp[],
|
|
@@ -164,6 +176,17 @@ const useAssertion = (
|
|
|
164
176
|
};
|
|
165
177
|
};
|
|
166
178
|
|
|
179
|
+
// A cited step or definition keeps the scope it was proved in, and any other fact takes the
|
|
180
|
+
// current one.
|
|
181
|
+
const getFactTime = (context: Hyp[], fact: Expr, time: Time): Time => {
|
|
182
|
+
if (fact.kind !== "Ix") return time;
|
|
183
|
+
const hyp = context[context.length - fact.index];
|
|
184
|
+
if (hyp?.kind === "Fact") return hyp.time;
|
|
185
|
+
return hyp?.kind === "Defn" && typeof hyp.whereDefined === "object"
|
|
186
|
+
? hyp.whereDefined.time
|
|
187
|
+
: "Always";
|
|
188
|
+
};
|
|
189
|
+
|
|
167
190
|
const setDefinition = (visibility: Visibility, context: Hyp[], def: UseDef): Hyp[] => {
|
|
168
191
|
if (def.kind !== "Dx") throw new TlaProofError(`Unknown definition ${def.name}`);
|
|
169
192
|
const index = context.length - def.index;
|
|
@@ -196,7 +219,9 @@ const setExpression = (
|
|
|
196
219
|
if (hyp.kind === "Fact" && isEqualExpr(hyp.expression, current)) {
|
|
197
220
|
isFound = true;
|
|
198
221
|
result[index] = { ...hyp, visibility };
|
|
199
|
-
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (hyp.kind === "Fresh" && hyp.domain && isDomainMatch(current, hyp.domain)) {
|
|
200
225
|
isFound = true;
|
|
201
226
|
result[index] = { ...hyp, domainVisibility: visibility };
|
|
202
227
|
}
|
|
@@ -216,7 +241,7 @@ export interface LineRange {
|
|
|
216
241
|
}
|
|
217
242
|
|
|
218
243
|
export interface Generator {
|
|
219
|
-
generate: (sequent: Sequent, proof: Proof) => Proof;
|
|
244
|
+
generate: (sequent: Sequent, proof: Proof, time: Time) => Proof;
|
|
220
245
|
collect: (proof: Proof) => Obligation[];
|
|
221
246
|
mutate: (
|
|
222
247
|
context: Hyp[],
|
|
@@ -224,7 +249,7 @@ export interface Generator {
|
|
|
224
249
|
usable: Usable,
|
|
225
250
|
location: Locus | undefined,
|
|
226
251
|
) => [Hyp[], Obligation[]];
|
|
227
|
-
simplify: (context: Hyp[], goal: Expr, proof: Proof) => Proof;
|
|
252
|
+
simplify: (context: Hyp[], goal: Expr, proof: Proof, time: Time) => Proof;
|
|
228
253
|
}
|
|
229
254
|
|
|
230
255
|
// The bounds after a witnessed one, where a ditto takes the witnessed domain.
|
|
@@ -254,6 +279,7 @@ const getWitnessProof = (step: Step, aux: Expr[]): Proof => {
|
|
|
254
279
|
usable: { facts: [shiftExpr(3, active)], defs: [] },
|
|
255
280
|
isOnly: false,
|
|
256
281
|
location: item.location,
|
|
282
|
+
method: step.method,
|
|
257
283
|
},
|
|
258
284
|
location: item.location,
|
|
259
285
|
};
|
|
@@ -262,11 +288,13 @@ const getWitnessProof = (step: Step, aux: Expr[]): Proof => {
|
|
|
262
288
|
at({ kind: "Ix", index: 2 * aux.length + 2 }, step),
|
|
263
289
|
...aux.map((_item, index) => at({ kind: "Ix", index: 2 * (aux.length - index) }, step)),
|
|
264
290
|
];
|
|
291
|
+
// tlapm removes the method from the QED.
|
|
265
292
|
const qedProof: Proof = {
|
|
266
293
|
kind: "By",
|
|
267
294
|
usable: { facts, defs: [] },
|
|
268
295
|
isOnly: true,
|
|
269
296
|
...getProps(step),
|
|
297
|
+
method: undefined,
|
|
270
298
|
};
|
|
271
299
|
return {
|
|
272
300
|
kind: "Steps",
|
|
@@ -278,9 +306,9 @@ const getWitnessProof = (step: Step, aux: Expr[]): Proof => {
|
|
|
278
306
|
|
|
279
307
|
const obligate = (
|
|
280
308
|
sequent: Sequent,
|
|
281
|
-
from: { location?: Locus },
|
|
309
|
+
from: { location?: Locus; method?: OldMethod },
|
|
282
310
|
kind: ObligationKind,
|
|
283
|
-
): Obligation => ({ sequent, location: from.location, kind });
|
|
311
|
+
): Obligation => ({ sequent, location: from.location, kind, method: from.method });
|
|
284
312
|
|
|
285
313
|
export interface ProofSummary {
|
|
286
314
|
total: number;
|
|
@@ -336,7 +364,7 @@ export const createGenerator = (
|
|
|
336
364
|
lines: LineRange,
|
|
337
365
|
onWarning: (warning: ObligationWarning) => void,
|
|
338
366
|
): Generator => {
|
|
339
|
-
const generate = (sequent: Sequent, proof: Proof): Proof => {
|
|
367
|
+
const generate = (sequent: Sequent, proof: Proof, time: Time): Proof => {
|
|
340
368
|
const location = proof.location;
|
|
341
369
|
if (
|
|
342
370
|
!location ||
|
|
@@ -361,14 +389,17 @@ export const createGenerator = (
|
|
|
361
389
|
case "By":
|
|
362
390
|
throw new TlaProofError("Proof.Gen.generate");
|
|
363
391
|
case "Steps": {
|
|
364
|
-
const [inner, steps] = mapAccumulate(sequent, proof.steps,
|
|
365
|
-
|
|
392
|
+
const [inner, steps] = mapAccumulate({ sequent, time }, proof.steps, (state, step) => {
|
|
393
|
+
const [next, generated, nextTime] = generateStep(state.sequent, step, state.time);
|
|
394
|
+
return [{ sequent: next, time: nextTime }, generated];
|
|
395
|
+
});
|
|
396
|
+
const qedProof = generate(inner.sequent, proof.qed.proof, inner.time);
|
|
366
397
|
return { ...proof, steps, qed: { ...proof.qed, proof: qedProof } };
|
|
367
398
|
}
|
|
368
399
|
}
|
|
369
400
|
};
|
|
370
401
|
|
|
371
|
-
const generateStep = (sequent: Sequent, step: Step): [Sequent, Step] => {
|
|
402
|
+
const generateStep = (sequent: Sequent, step: Step, time: Time): [Sequent, Step, Time] => {
|
|
372
403
|
switch (step.kind) {
|
|
373
404
|
case "Forget": {
|
|
374
405
|
const count = sequent.context.length;
|
|
@@ -377,7 +408,7 @@ export const createGenerator = (
|
|
|
377
408
|
? { ...hyp, visibility: "Hidden" }
|
|
378
409
|
: hyp,
|
|
379
410
|
);
|
|
380
|
-
return [{ ...sequent, context }, step];
|
|
411
|
+
return [{ ...sequent, context }, step, time];
|
|
381
412
|
}
|
|
382
413
|
case "Use": {
|
|
383
414
|
const usable = step.usable;
|
|
@@ -388,11 +419,19 @@ export const createGenerator = (
|
|
|
388
419
|
{
|
|
389
420
|
context: [
|
|
390
421
|
...sequent.context,
|
|
391
|
-
{
|
|
422
|
+
{
|
|
423
|
+
kind: "Fact",
|
|
424
|
+
expression: fact,
|
|
425
|
+
visibility: "Visible",
|
|
426
|
+
time: getFactTime(sequent.context, fact, time),
|
|
427
|
+
location: fact.location,
|
|
428
|
+
useLocation: step.useLocation,
|
|
429
|
+
},
|
|
392
430
|
],
|
|
393
431
|
active: shiftExpr(1, sequent.active),
|
|
394
432
|
},
|
|
395
433
|
{ ...step, obligations: [obligation] },
|
|
434
|
+
time,
|
|
396
435
|
];
|
|
397
436
|
}
|
|
398
437
|
if (usable.facts.length > 0)
|
|
@@ -401,7 +440,7 @@ export const createGenerator = (
|
|
|
401
440
|
(current, def) => setDefinition("Visible", current, def),
|
|
402
441
|
sequent.context,
|
|
403
442
|
);
|
|
404
|
-
return [{ ...sequent, context }, step];
|
|
443
|
+
return [{ ...sequent, context }, step, time];
|
|
405
444
|
}
|
|
406
445
|
case "Hide": {
|
|
407
446
|
const hidden = step.usable.defs.reduce(
|
|
@@ -412,7 +451,7 @@ export const createGenerator = (
|
|
|
412
451
|
(current, fact) => setExpression(onWarning, "Hidden", fact, current),
|
|
413
452
|
hidden,
|
|
414
453
|
);
|
|
415
|
-
return [{ ...sequent, context }, step];
|
|
454
|
+
return [{ ...sequent, context }, step, time];
|
|
416
455
|
}
|
|
417
456
|
case "Define":
|
|
418
457
|
return [
|
|
@@ -431,22 +470,27 @@ export const createGenerator = (
|
|
|
431
470
|
active: shiftExpr(step.definitions.length, sequent.active),
|
|
432
471
|
},
|
|
433
472
|
step,
|
|
473
|
+
time,
|
|
434
474
|
];
|
|
435
475
|
case "Assert": {
|
|
436
|
-
const
|
|
476
|
+
const inner = proveAssertion(sequent.context, step.sequent, step, time);
|
|
477
|
+
const proof = generate(inner, step.proof, inner.time);
|
|
437
478
|
const generated: Step = { ...step, proof };
|
|
438
479
|
return [
|
|
439
|
-
useAssertion(false, sequent.context, sequent.active, step.sequent, generated),
|
|
480
|
+
useAssertion(false, sequent.context, sequent.active, step.sequent, generated, time),
|
|
440
481
|
generated,
|
|
482
|
+
time,
|
|
441
483
|
];
|
|
442
484
|
}
|
|
443
485
|
case "Suffices": {
|
|
444
486
|
const proof = generate(
|
|
445
|
-
useAssertion(true, sequent.context, sequent.active, step.sequent, step),
|
|
487
|
+
useAssertion(true, sequent.context, sequent.active, step.sequent, step, time),
|
|
446
488
|
step.proof,
|
|
489
|
+
time,
|
|
447
490
|
);
|
|
448
491
|
const generated: Step = { ...step, proof };
|
|
449
|
-
|
|
492
|
+
const next = proveAssertion(sequent.context, step.sequent, generated, time);
|
|
493
|
+
return [next, generated, next.time];
|
|
450
494
|
}
|
|
451
495
|
default:
|
|
452
496
|
throw new TlaProofError("Proof.Gen.gen_step");
|
|
@@ -463,8 +507,9 @@ export const createGenerator = (
|
|
|
463
507
|
const [sequent, generated] = generateStep(
|
|
464
508
|
{ context, active: { ...AT_NOWHERE, location } },
|
|
465
509
|
mode === "Use"
|
|
466
|
-
? { kind: "Use", usable, isOnly: false, location, step }
|
|
510
|
+
? { kind: "Use", usable, isOnly: false, location, step, useLocation: location }
|
|
467
511
|
: { kind: "Hide", usable, location, step },
|
|
512
|
+
"Always",
|
|
468
513
|
);
|
|
469
514
|
return [sequent.context, generated.obligations ?? []];
|
|
470
515
|
};
|
|
@@ -626,7 +671,7 @@ export const createGenerator = (
|
|
|
626
671
|
return { ...proof, steps };
|
|
627
672
|
};
|
|
628
673
|
|
|
629
|
-
const simplify = (context: Hyp[], goal: Expr, original: Proof): Proof => {
|
|
674
|
+
const simplify = (context: Hyp[], goal: Expr, original: Proof, time: Time): Proof => {
|
|
630
675
|
const proof = expandAt(original);
|
|
631
676
|
switch (proof.kind) {
|
|
632
677
|
case "Obvious":
|
|
@@ -652,6 +697,7 @@ export const createGenerator = (
|
|
|
652
697
|
isOnly: false,
|
|
653
698
|
location: fact.location,
|
|
654
699
|
isSuppressed: proof.isSuppressed,
|
|
700
|
+
useLocation: proof.location,
|
|
655
701
|
}));
|
|
656
702
|
const forget: Step[] = proof.isOnly
|
|
657
703
|
? [{ kind: "Forget", count: usable.facts.length, location: proof.location }]
|
|
@@ -666,6 +712,7 @@ export const createGenerator = (
|
|
|
666
712
|
location: proof.location,
|
|
667
713
|
step: getAnonymous(level),
|
|
668
714
|
isSuppressed: proof.isSuppressed,
|
|
715
|
+
method: proof.method,
|
|
669
716
|
};
|
|
670
717
|
return {
|
|
671
718
|
kind: "Steps",
|
|
@@ -677,46 +724,52 @@ export const createGenerator = (
|
|
|
677
724
|
};
|
|
678
725
|
}
|
|
679
726
|
case "Steps": {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
727
|
+
const [inner, steps] = mapAccumulate(
|
|
728
|
+
{ context, goal, time },
|
|
729
|
+
proof.steps,
|
|
730
|
+
(state, step) => {
|
|
731
|
+
const [nextContext, nextGoal, simplified, nextTime] = simplifyStep(
|
|
732
|
+
state.context,
|
|
733
|
+
state.goal,
|
|
734
|
+
step,
|
|
735
|
+
state.time,
|
|
736
|
+
);
|
|
737
|
+
return [{ context: nextContext, goal: nextGoal, time: nextTime }, simplified];
|
|
738
|
+
},
|
|
739
|
+
);
|
|
740
|
+
const qedProof = simplify(inner.context, inner.goal, proof.qed.proof, inner.time);
|
|
741
|
+
return { ...proof, steps: steps.flat(), qed: { ...proof.qed, proof: qedProof } };
|
|
694
742
|
}
|
|
695
743
|
}
|
|
696
744
|
};
|
|
697
745
|
|
|
698
|
-
const simplifyStep = (
|
|
746
|
+
const simplifyStep = (
|
|
747
|
+
context: Hyp[],
|
|
748
|
+
goal: Expr,
|
|
749
|
+
step: Step,
|
|
750
|
+
time: Time,
|
|
751
|
+
): [Hyp[], Expr, Step[], Time] => {
|
|
699
752
|
const level = getLevel(step.step);
|
|
700
753
|
switch (step.kind) {
|
|
701
754
|
case "Forget":
|
|
702
|
-
return [context, goal, [step]];
|
|
755
|
+
return [context, goal, [step], time];
|
|
703
756
|
case "Assert": {
|
|
704
|
-
const inner = proveAssertion(context, step.sequent, step);
|
|
757
|
+
const inner = proveAssertion(context, step.sequent, step, time);
|
|
705
758
|
const simplified: Step = {
|
|
706
759
|
...step,
|
|
707
|
-
proof: simplify(inner.context, inner.active, step.proof),
|
|
760
|
+
proof: simplify(inner.context, inner.active, step.proof, inner.time),
|
|
708
761
|
};
|
|
709
|
-
const next = useAssertion(false, context, goal, step.sequent, simplified);
|
|
710
|
-
return [next.context, next.active, [simplified]];
|
|
762
|
+
const next = useAssertion(false, context, goal, step.sequent, simplified, time);
|
|
763
|
+
return [next.context, next.active, [simplified], time];
|
|
711
764
|
}
|
|
712
765
|
case "Suffices": {
|
|
713
|
-
const inner = useAssertion(true, context, goal, step.sequent, step);
|
|
766
|
+
const inner = useAssertion(true, context, goal, step.sequent, step, time);
|
|
714
767
|
const simplified: Step = {
|
|
715
768
|
...step,
|
|
716
|
-
proof: simplify(inner.context, inner.active, step.proof),
|
|
769
|
+
proof: simplify(inner.context, inner.active, step.proof, time),
|
|
717
770
|
};
|
|
718
|
-
const next = proveAssertion(context, step.sequent, simplified);
|
|
719
|
-
return [next.context, next.active, [simplified]];
|
|
771
|
+
const next = proveAssertion(context, step.sequent, simplified, time);
|
|
772
|
+
return [next.context, next.active, [simplified], next.time];
|
|
720
773
|
}
|
|
721
774
|
case "Use": {
|
|
722
775
|
const byProof: Proof = {
|
|
@@ -726,20 +779,23 @@ export const createGenerator = (
|
|
|
726
779
|
location: step.location,
|
|
727
780
|
step: step.step,
|
|
728
781
|
isSuppressed: step.isSuppressed,
|
|
782
|
+
method: step.method,
|
|
729
783
|
};
|
|
730
|
-
const simplified = simplify(context, goal, byProof);
|
|
784
|
+
const simplified = simplify(context, goal, byProof, time);
|
|
731
785
|
if (simplified.kind !== "Steps")
|
|
732
786
|
throw new TlaProofError("simplifying BY does not produce a non-leaf proof!");
|
|
733
787
|
const assumed = step.usable.facts.map((): Hyp => ({
|
|
734
788
|
kind: "Fact",
|
|
735
789
|
expression: AT_NOWHERE,
|
|
736
790
|
visibility: "Visible",
|
|
791
|
+
time,
|
|
737
792
|
location: step.location,
|
|
738
793
|
}));
|
|
739
794
|
return [
|
|
740
795
|
[...context, ...assumed],
|
|
741
796
|
shiftExpr(step.usable.facts.length, goal),
|
|
742
797
|
simplified.steps,
|
|
798
|
+
time,
|
|
743
799
|
];
|
|
744
800
|
}
|
|
745
801
|
case "Hide": {
|
|
@@ -759,7 +815,7 @@ export const createGenerator = (
|
|
|
759
815
|
: entry,
|
|
760
816
|
);
|
|
761
817
|
}, context);
|
|
762
|
-
return [hidden, goal, [step]];
|
|
818
|
+
return [hidden, goal, [step], time];
|
|
763
819
|
}
|
|
764
820
|
case "Define":
|
|
765
821
|
return [
|
|
@@ -768,7 +824,7 @@ export const createGenerator = (
|
|
|
768
824
|
...step.definitions.map((definition): Hyp => ({
|
|
769
825
|
kind: "Defn",
|
|
770
826
|
definition,
|
|
771
|
-
whereDefined: "Proof",
|
|
827
|
+
whereDefined: { kind: "Proof", time },
|
|
772
828
|
visibility: "Visible",
|
|
773
829
|
isLocal: true,
|
|
774
830
|
location: step.location,
|
|
@@ -776,6 +832,7 @@ export const createGenerator = (
|
|
|
776
832
|
],
|
|
777
833
|
shiftExpr(step.definitions.length, goal),
|
|
778
834
|
[step],
|
|
835
|
+
time,
|
|
779
836
|
];
|
|
780
837
|
case "Have": {
|
|
781
838
|
const connective = exposeConnective(context, goal);
|
|
@@ -783,6 +840,7 @@ export const createGenerator = (
|
|
|
783
840
|
kind: "Fact",
|
|
784
841
|
expression: step.expression,
|
|
785
842
|
visibility: "Visible",
|
|
843
|
+
time,
|
|
786
844
|
location: step.location,
|
|
787
845
|
};
|
|
788
846
|
const isImplication = isBinary(connective, "Implies");
|
|
@@ -814,19 +872,21 @@ export const createGenerator = (
|
|
|
814
872
|
location: step.location,
|
|
815
873
|
step: step.step,
|
|
816
874
|
});
|
|
817
|
-
return simplifyStep(context, goal, suffices);
|
|
875
|
+
return simplifyStep(context, goal, suffices, time);
|
|
818
876
|
}
|
|
819
877
|
case "Take":
|
|
820
878
|
return simplifyStep(
|
|
821
879
|
context,
|
|
822
880
|
goal,
|
|
823
881
|
renumberStep(level, getTakeSuffices(context, goal, step)),
|
|
882
|
+
time,
|
|
824
883
|
);
|
|
825
884
|
case "Witness":
|
|
826
885
|
return simplifyStep(
|
|
827
886
|
context,
|
|
828
887
|
goal,
|
|
829
888
|
renumberStep(level, getWitnessSuffices(context, goal, step)),
|
|
889
|
+
time,
|
|
830
890
|
);
|
|
831
891
|
case "Pcase": {
|
|
832
892
|
const assertion: Step = {
|
|
@@ -837,6 +897,7 @@ export const createGenerator = (
|
|
|
837
897
|
kind: "Fact",
|
|
838
898
|
expression: step.expression,
|
|
839
899
|
visibility: "Visible",
|
|
900
|
+
time,
|
|
840
901
|
location: step.location,
|
|
841
902
|
},
|
|
842
903
|
],
|
|
@@ -845,7 +906,7 @@ export const createGenerator = (
|
|
|
845
906
|
proof: step.proof,
|
|
846
907
|
...getProps(step),
|
|
847
908
|
};
|
|
848
|
-
return simplifyStep(context, goal, renumberStep(level, assertion));
|
|
909
|
+
return simplifyStep(context, goal, renumberStep(level, assertion), time);
|
|
849
910
|
}
|
|
850
911
|
case "Pick": {
|
|
851
912
|
const existential: Expr = at(
|
|
@@ -853,13 +914,18 @@ export const createGenerator = (
|
|
|
853
914
|
step,
|
|
854
915
|
);
|
|
855
916
|
const salted = getSalted(step.step, "ex");
|
|
856
|
-
const [assertContext, assertGoal, asserted] = simplifyStep(
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
917
|
+
const [assertContext, assertGoal, asserted, assertTime] = simplifyStep(
|
|
918
|
+
context,
|
|
919
|
+
goal,
|
|
920
|
+
{
|
|
921
|
+
kind: "Assert",
|
|
922
|
+
sequent: { context: [], active: existential },
|
|
923
|
+
proof: step.proof,
|
|
924
|
+
...getProps(step),
|
|
925
|
+
step: salted,
|
|
926
|
+
},
|
|
927
|
+
time,
|
|
928
|
+
);
|
|
863
929
|
const shifted = shiftExpr(2, existential);
|
|
864
930
|
if (shifted.kind !== "Quant") throw new TlaProofError("Proof.Simplify.simplify_step/PICK");
|
|
865
931
|
const hyps = [
|
|
@@ -868,16 +934,22 @@ export const createGenerator = (
|
|
|
868
934
|
kind: "Fact",
|
|
869
935
|
expression: shifted.body,
|
|
870
936
|
visibility: "Visible",
|
|
937
|
+
time: assertTime,
|
|
871
938
|
location: shifted.body.location,
|
|
872
939
|
} satisfies Hyp,
|
|
873
940
|
];
|
|
874
|
-
const [nextContext, nextGoal, sufficed] = simplifyStep(
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
941
|
+
const [nextContext, nextGoal, sufficed, nextTime] = simplifyStep(
|
|
942
|
+
assertContext,
|
|
943
|
+
assertGoal,
|
|
944
|
+
{
|
|
945
|
+
kind: "Suffices",
|
|
946
|
+
sequent: { context: hyps, active: shiftExpr(hyps.length, assertGoal) },
|
|
947
|
+
proof: { kind: "Omitted", omission: "Elsewhere", ...getProps(step) },
|
|
948
|
+
...getProps(step),
|
|
949
|
+
},
|
|
950
|
+
assertTime,
|
|
951
|
+
);
|
|
952
|
+
return [nextContext, nextGoal, [...asserted, ...sufficed], nextTime];
|
|
881
953
|
}
|
|
882
954
|
}
|
|
883
955
|
};
|
|
@@ -974,6 +1046,7 @@ export const createGenerator = (
|
|
|
974
1046
|
kind: "Fact",
|
|
975
1047
|
expression: getTrue(goal),
|
|
976
1048
|
visibility: "Visible",
|
|
1049
|
+
time: "Now",
|
|
977
1050
|
location: step.location,
|
|
978
1051
|
},
|
|
979
1052
|
],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generates the proof obligations tlapm prints for a module, in tlapm's order and layout.
|
|
2
2
|
|
|
3
|
-
import { TlaProofError, TlaSyntaxError, type SyntaxFailure } from "
|
|
4
|
-
import { createAnonymizer } from "./
|
|
3
|
+
import { TlaProofError, TlaSyntaxError, type SyntaxFailure } from "../errors";
|
|
4
|
+
import { createAnonymizer } from "./anon";
|
|
5
5
|
import {
|
|
6
6
|
getAtPrefix,
|
|
7
7
|
getErrorNote,
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
getLocusPrefix,
|
|
10
10
|
type Locus,
|
|
11
11
|
type ObligationWarning,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
type Sequent,
|
|
13
|
+
} from "./expression";
|
|
14
|
+
import { createGenerator, type LineRange } from "./generate";
|
|
14
15
|
import {
|
|
15
16
|
compareNames,
|
|
16
17
|
expandInstance,
|
|
@@ -23,15 +24,16 @@ import {
|
|
|
23
24
|
type Mule,
|
|
24
25
|
type TheoremSummary,
|
|
25
26
|
type Pipeline,
|
|
26
|
-
} from "./
|
|
27
|
-
import { formatObligation } from "./
|
|
28
|
-
import type { Counter } from "./
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
27
|
+
} from "./module";
|
|
28
|
+
import { formatObligation } from "./printer";
|
|
29
|
+
import type { Counter, ObligationKind } from "./proof";
|
|
30
|
+
import type { OldMethod } from "./pragma";
|
|
31
|
+
import { createSource } from "./source";
|
|
32
|
+
import { tokenize } from "../lexer";
|
|
33
|
+
import { parseTlapmModule } from "../parser";
|
|
34
|
+
import type { Module } from "../ast";
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
interface ObligationSource {
|
|
35
37
|
file: string;
|
|
36
38
|
source: string;
|
|
37
39
|
}
|
|
@@ -39,7 +41,11 @@ export interface ObligationSource {
|
|
|
39
41
|
export interface PrintedObligation {
|
|
40
42
|
id: number;
|
|
41
43
|
location: string;
|
|
44
|
+
locus: Locus | undefined;
|
|
42
45
|
text: string;
|
|
46
|
+
kind: ObligationKind;
|
|
47
|
+
sequent: Sequent;
|
|
48
|
+
method?: OldMethod;
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
export interface ModuleObligations {
|
|
@@ -307,7 +313,17 @@ export const getObligations = (
|
|
|
307
313
|
obligation.kind.kind === "Error"
|
|
308
314
|
? obligation.kind.message
|
|
309
315
|
: `${formatObligation(obligation.sequent)}\n`;
|
|
310
|
-
return [
|
|
316
|
+
return [
|
|
317
|
+
{
|
|
318
|
+
id: index + 1,
|
|
319
|
+
location: formatLocus(location),
|
|
320
|
+
locus: location,
|
|
321
|
+
text,
|
|
322
|
+
kind: obligation.kind,
|
|
323
|
+
sequent: obligation.sequent,
|
|
324
|
+
method: obligation.method,
|
|
325
|
+
},
|
|
326
|
+
];
|
|
311
327
|
});
|
|
312
328
|
return [
|
|
313
329
|
{ name: module.name, location: module.location, obligations, summary: generated.summary },
|