tla-ts 0.0.4-dev.4819fb7 → 0.0.4-dev.55f2117
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/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/deciders.cjs +366 -0
- package/dist/deciders.js +366 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -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.cjs +45 -0
- package/dist/run.js +45 -0
- 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/ast.ts +2 -2
- package/src/check.ts +8 -7
- package/src/{cli-options.ts → cli/options.ts} +1 -1
- package/src/{run-cli.ts → cli/run.ts} +302 -100
- package/src/cli.ts +1 -1
- package/src/codegen.ts +26 -7
- package/src/config.ts +2 -2
- package/src/environment.ts +9 -9
- package/src/errors.ts +89 -30
- package/src/evaluate.ts +58 -23
- package/src/index.ts +10 -0
- package/src/levels.ts +1 -1
- package/src/live-check.ts +1 -1
- package/src/liveness.ts +1 -1
- 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/parallel-worker.ts +4 -20
- package/src/parallel.ts +13 -46
- package/src/parser.ts +1 -1
- package/src/{pcal-ast.ts → pcal/ast.ts} +2 -2
- package/src/{pcal-parse.ts → pcal/parse.ts} +3 -3
- package/src/{pcal-tokenize.ts → pcal/tokenize.ts} +2 -2
- package/src/{pcal-translate.ts → pcal/translate.ts} +2 -2
- package/src/{pcal-validate.ts → pcal/validate.ts} +6 -6
- 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 +546 -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 +433 -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 +331 -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 +330 -0
- package/src/prove/isabelle/pure/name.ts +98 -0
- package/src/prove/isabelle/pure/net.ts +215 -0
- package/src/prove/isabelle/pure/object-logic.ts +41 -0
- package/src/prove/isabelle/pure/pattern.ts +631 -0
- package/src/prove/isabelle/pure/raw-simplifier.ts +338 -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 +133 -0
- package/src/prove/isabelle/pure/simplifier.ts +106 -0
- package/src/prove/isabelle/pure/table.ts +201 -0
- package/src/prove/isabelle/pure/tactic.ts +168 -0
- package/src/prove/isabelle/pure/tactical.ts +264 -0
- package/src/prove/isabelle/pure/term-ord.ts +105 -0
- package/src/prove/isabelle/pure/term.ts +688 -0
- package/src/prove/isabelle/pure/thm.ts +783 -0
- package/src/prove/isabelle/pure/type.ts +121 -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 +91 -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 +642 -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 +737 -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/cache.ts +236 -0
- package/src/prove/tlapm/ocaml-marshal.ts +166 -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 +162 -0
- package/src/prove/zenon/tla/tla.ts +506 -0
- package/src/randomization.ts +1 -1
- package/src/resolve.ts +1 -1
- package/src/runtime.ts +2 -2
- package/src/{sany-builtins.ts → sany/builtins.ts} +1 -1
- package/src/{sany-generator.ts → sany/generator.ts} +14 -14
- package/src/{sany-levels.ts → sany/levels.ts} +2 -2
- package/src/{sany-lexer.ts → sany/lexer.ts} +1 -1
- package/src/{sany-linter.ts → sany/linter.ts} +1 -1
- package/src/{sany-modules.ts → sany/modules.ts} +2 -2
- package/src/{sany-parse-error.ts → sany/parse-error.ts} +2 -2
- package/src/{sany-report.ts → sany/report.ts} +15 -15
- package/src/{sany-selectors.ts → sany/selectors.ts} +3 -3
- package/src/{sany-source.ts → sany/source.ts} +6 -6
- package/src/{sany-xml.ts → sany/xml.ts} +5 -5
- package/src/spec-description.ts +1 -1
- package/src/{standard-levels.ts → standard/levels.ts} +1 -1
- package/src/{standard-modules.ts → standard/modules.ts} +17 -14
- package/src/{standard-ranges.ts → standard/ranges.ts} +1 -1
- package/src/state-graph.ts +1 -1
- package/src/successors.ts +25 -6
- package/src/symmetry.ts +1 -1
- package/src/{tlc-messages.ts → tlc/messages.ts} +2 -2
- package/src/{tlc-order.ts → tlc/order.ts} +7 -7
- package/src/{tlc-random.ts → tlc/random.ts} +58 -35
- package/src/{tlc-replay.ts → tlc/replay.ts} +5 -5
- package/src/{tlc-module.ts → tlc/tlc-operators.ts} +9 -9
- package/src/{tlc-ext.ts → tlc/tlcext-operators.ts} +14 -8
- package/src/{tlc-version.ts → tlc/version.ts} +8 -7
- package/src/values.ts +81 -36
- package/src/worker.ts +65 -0
- package/dist/parallel.cjs +0 -12
- package/dist/parallel.js +0 -12
- package/dist/run-cli.cjs +0 -55
- package/dist/run-cli.js +0 -55
- package/src/value-sources.ts +0 -29
- /package/src/{sany-nodes.ts → sany/nodes.ts} +0 -0
- /package/src/{tlc-modules.ts → tlc/jar-data.ts} +0 -0
- /package/src/{tlc-summary.ts → tlc/summary.ts} +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
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,
|
|
8
8
|
getLocusPosition,
|
|
9
9
|
getLocusPrefix,
|
|
10
10
|
type Locus,
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
type Warn,
|
|
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 {
|
|
@@ -53,7 +59,7 @@ export const WHOLE_MODULE: LineRange = { start: 0, end: Infinity };
|
|
|
53
59
|
|
|
54
60
|
interface ObligationOptions {
|
|
55
61
|
lines?: LineRange;
|
|
56
|
-
onWarning?:
|
|
62
|
+
onWarning?: Warn;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
const MODULE_HEADER = /-{4,} *MODULE/;
|
|
@@ -122,7 +128,7 @@ const loadMule = (
|
|
|
122
128
|
input: ObligationSource,
|
|
123
129
|
counter: Counter,
|
|
124
130
|
isMain: boolean,
|
|
125
|
-
onWarning:
|
|
131
|
+
onWarning: Warn,
|
|
126
132
|
citation: string,
|
|
127
133
|
): Mule => {
|
|
128
134
|
if (!MODULE_HEADER.test(input.source)) throw new TlaProofError("No tokens in file");
|
|
@@ -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 },
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// level depends on.
|
|
1
|
+
// Expr.Levels: the level of an expression (0 constant, 1 state, 2 action, 3 temporal, 4 undefined),
|
|
2
|
+
// the weights of an operator's arguments, and the declared names the level depends on.
|
|
4
3
|
|
|
5
|
-
import { TlaProofError, TlapmBugError } from "
|
|
4
|
+
import { TlaProofError, TlapmBugError } from "../errors";
|
|
6
5
|
import {
|
|
7
6
|
adjoin,
|
|
7
|
+
adjoinAll,
|
|
8
8
|
getBoundedFresh,
|
|
9
|
+
getBoundFresh,
|
|
9
10
|
getFresh,
|
|
11
|
+
getLocalDefn,
|
|
12
|
+
getParamFresh,
|
|
10
13
|
getScopeAt,
|
|
14
|
+
isBuiltinApply,
|
|
11
15
|
mapAccumulate,
|
|
12
16
|
type Bound,
|
|
13
17
|
type Builtin,
|
|
14
18
|
type Expr,
|
|
15
19
|
type Level,
|
|
16
20
|
type Scope,
|
|
17
|
-
} from "./
|
|
21
|
+
} from "./expression";
|
|
18
22
|
|
|
19
23
|
interface LevelInfo {
|
|
20
24
|
level: number;
|
|
@@ -152,11 +156,7 @@ const getBoundsLevel = (scope: Scope | undefined, bounds: Bound[], body: Expr) =
|
|
|
152
156
|
const domains = bounds.flatMap((bound) =>
|
|
153
157
|
bound.domain.kind === "Domain" ? [getLevelInfo(scope, bound.domain.expression)] : [],
|
|
154
158
|
);
|
|
155
|
-
|
|
156
|
-
(current, bound) => adjoin(current, getFresh(bound.name, bound.level)),
|
|
157
|
-
scope,
|
|
158
|
-
);
|
|
159
|
-
return combine([getLevelInfo(inner, body), ...domains]);
|
|
159
|
+
return combine([getLevelInfo(adjoinAll(scope, bounds.map(getBoundFresh)), body), ...domains]);
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
const applyOperator = (operator: LevelInfo, args: LevelInfo[]): LevelInfo => {
|
|
@@ -189,11 +189,10 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
|
|
|
189
189
|
case "Num":
|
|
190
190
|
return getInfo(0);
|
|
191
191
|
case "Lambda": {
|
|
192
|
-
const
|
|
193
|
-
(
|
|
194
|
-
|
|
192
|
+
const body = getLevelInfo(
|
|
193
|
+
adjoinAll(scope, expression.params.map(getParamFresh)),
|
|
194
|
+
expression.body,
|
|
195
195
|
);
|
|
196
|
-
const body = getLevelInfo(inner, expression.body);
|
|
197
196
|
const names = new Set(expression.params.map((param) => param.name));
|
|
198
197
|
return {
|
|
199
198
|
level: body.level,
|
|
@@ -203,6 +202,11 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
|
|
|
203
202
|
}
|
|
204
203
|
case "Apply": {
|
|
205
204
|
const operator = expression.operator;
|
|
205
|
+
// The action frontend commutes a prime onto an operator, and tlapm keeps the level that
|
|
206
|
+
// the application had.
|
|
207
|
+
if (isBuiltinApply(operator, "Prime") && operator.args.length === 1) {
|
|
208
|
+
return recurse({ ...expression, operator: operator.args[0] });
|
|
209
|
+
}
|
|
206
210
|
if (operator.kind === "Opaque") {
|
|
207
211
|
return applyOperator(getInfo(0, expression.args.length), expression.args.map(recurse));
|
|
208
212
|
}
|
|
@@ -246,20 +250,11 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
|
|
|
246
250
|
case "Dot":
|
|
247
251
|
case "Parens":
|
|
248
252
|
return recurse(expression.expression);
|
|
249
|
-
case "Let":
|
|
250
|
-
|
|
251
|
-
(
|
|
252
|
-
|
|
253
|
-
kind: "Defn",
|
|
254
|
-
definition,
|
|
255
|
-
whereDefined: "User",
|
|
256
|
-
visibility: "Visible",
|
|
257
|
-
isLocal: true,
|
|
258
|
-
}),
|
|
259
|
-
scope,
|
|
253
|
+
case "Let":
|
|
254
|
+
return getLevelInfo(
|
|
255
|
+
adjoinAll(scope, expression.definitions.map(getLocalDefn)),
|
|
256
|
+
expression.body,
|
|
260
257
|
);
|
|
261
|
-
return getLevelInfo(inner, expression.body);
|
|
262
|
-
}
|
|
263
258
|
case "If":
|
|
264
259
|
return combine(
|
|
265
260
|
[expression.condition, expression.consequent, expression.alternative].map(recurse),
|
|
@@ -273,7 +268,10 @@ export const getLevelInfo = (scope: Scope | undefined, expression: Expr): LevelI
|
|
|
273
268
|
return getBoundsLevel(scope, expression.bounds, expression.element);
|
|
274
269
|
case "Tquant":
|
|
275
270
|
getLevelInfo(
|
|
276
|
-
|
|
271
|
+
adjoinAll(
|
|
272
|
+
scope,
|
|
273
|
+
expression.names.map((name) => ({ kind: "Flex", name })),
|
|
274
|
+
),
|
|
277
275
|
expression.body,
|
|
278
276
|
);
|
|
279
277
|
return getInfo(3);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// A port of tlapm's module pipeline: flattening EXTENDS (Module.Flatten), normalization
|
|
2
2
|
// (Module.Elab.normalize) and obligation generation (Module.Gen).
|
|
3
3
|
|
|
4
|
-
import { TlaProofError, TlapmBugError } from "
|
|
5
|
-
import { lambdify } from "./
|
|
6
|
-
import type { Anonymizer } from "./
|
|
4
|
+
import { TlaProofError, TlapmBugError } from "../errors";
|
|
5
|
+
import { lambdify } from "./action";
|
|
6
|
+
import type { Anonymizer } from "./anon";
|
|
7
7
|
import {
|
|
8
8
|
adjoinAll,
|
|
9
9
|
at,
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
exprifySequent,
|
|
14
14
|
findNamed,
|
|
15
15
|
getAtPrefix,
|
|
16
|
-
|
|
16
|
+
getFact,
|
|
17
|
+
getLocationText,
|
|
17
18
|
getLocusPrefix,
|
|
18
19
|
getScopeHyps,
|
|
19
20
|
mapAccumulate,
|
|
@@ -32,27 +33,22 @@ import {
|
|
|
32
33
|
type Hyp,
|
|
33
34
|
type InstanceDefinition,
|
|
34
35
|
type Locus,
|
|
35
|
-
type
|
|
36
|
+
type Warn,
|
|
36
37
|
type Scope,
|
|
37
38
|
type Sequent,
|
|
38
39
|
type Substitution,
|
|
39
40
|
type Visibility,
|
|
40
41
|
type WhereDefined,
|
|
41
|
-
} from "./
|
|
42
|
+
} from "./expression";
|
|
42
43
|
import {
|
|
43
44
|
EMPTY_SUMMARY,
|
|
44
45
|
getProofSummary,
|
|
45
46
|
joinSummaries,
|
|
46
47
|
type Generator,
|
|
47
48
|
type ProofSummary,
|
|
48
|
-
} from "./
|
|
49
|
-
import {
|
|
50
|
-
|
|
51
|
-
type Counter,
|
|
52
|
-
type Obligation,
|
|
53
|
-
type Proof,
|
|
54
|
-
type Usable,
|
|
55
|
-
} from "./obligation-proof";
|
|
49
|
+
} from "./generate";
|
|
50
|
+
import { getUnique, type Counter, type Obligation, type Proof, type Usable } from "./proof";
|
|
51
|
+
import { getScopeTime } from "./temporal";
|
|
56
52
|
|
|
57
53
|
export type ModuleUnit = ModuleUnitCore & { location?: Locus };
|
|
58
54
|
|
|
@@ -75,7 +71,7 @@ type ModuleUnitCore =
|
|
|
75
71
|
proof: Proof;
|
|
76
72
|
}
|
|
77
73
|
| { kind: "Submod"; module: Mule }
|
|
78
|
-
| { kind: "Mutate"; mode: "Use" | "Hide";
|
|
74
|
+
| { kind: "Mutate"; mode: "Use" | "Hide"; usable: Usable }
|
|
79
75
|
| { kind: "Anoninst"; instance: InstanceDefinition; isLocal: boolean };
|
|
80
76
|
|
|
81
77
|
// depth is the size of the context the module was normalized in, which instantiation shifts
|
|
@@ -91,34 +87,29 @@ export interface Mule {
|
|
|
91
87
|
location?: Locus;
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
const
|
|
95
|
-
kind: "Definition",
|
|
96
|
-
definition: { kind: "Operator", name, body: { kind: "Internal", builtin } },
|
|
97
|
-
whereDefined: "Builtin",
|
|
98
|
-
visibility: "Visible",
|
|
99
|
-
isLocal: false,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const getBuiltinOperator = (arity: number, name: string, builtin: Builtin): ModuleUnit => ({
|
|
90
|
+
const getBuiltin = (arity: number, name: string, builtin: Builtin): ModuleUnit => ({
|
|
103
91
|
kind: "Definition",
|
|
104
92
|
definition: {
|
|
105
93
|
kind: "Operator",
|
|
106
94
|
name,
|
|
107
|
-
body:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
95
|
+
body:
|
|
96
|
+
arity === 0
|
|
97
|
+
? { kind: "Internal", builtin }
|
|
98
|
+
: {
|
|
99
|
+
kind: "Lambda",
|
|
100
|
+
params: Array.from({ length: arity }, (_item, index) => ({
|
|
101
|
+
name: `x${index + 1}`,
|
|
102
|
+
shape: 0,
|
|
103
|
+
})),
|
|
104
|
+
body: {
|
|
105
|
+
kind: "Apply",
|
|
106
|
+
operator: { kind: "Internal", builtin },
|
|
107
|
+
args: Array.from({ length: arity }, (_item, index) => ({
|
|
108
|
+
kind: "Ix",
|
|
109
|
+
index: arity - index,
|
|
110
|
+
})),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
122
113
|
},
|
|
123
114
|
whereDefined: "Builtin",
|
|
124
115
|
visibility: "Visible",
|
|
@@ -126,59 +117,55 @@ const getBuiltinOperator = (arity: number, name: string, builtin: Builtin): Modu
|
|
|
126
117
|
});
|
|
127
118
|
|
|
128
119
|
const NATURALS: ModuleUnit[] = [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
120
|
+
getBuiltin(0, "Nat", "Nat"),
|
|
121
|
+
getBuiltin(2, "+", "Plus"),
|
|
122
|
+
getBuiltin(2, "-", "Minus"),
|
|
123
|
+
getBuiltin(2, "*", "Times"),
|
|
124
|
+
getBuiltin(2, "^", "Exp"),
|
|
125
|
+
getBuiltin(2, "<", "Lt"),
|
|
126
|
+
getBuiltin(2, ">", "Gt"),
|
|
127
|
+
getBuiltin(2, "=<", "Lteq"),
|
|
128
|
+
getBuiltin(2, ">=", "Gteq"),
|
|
129
|
+
getBuiltin(2, "%", "Remainder"),
|
|
130
|
+
getBuiltin(2, "\\div", "Quotient"),
|
|
131
|
+
getBuiltin(2, "..", "Range"),
|
|
141
132
|
];
|
|
142
133
|
|
|
143
|
-
const INTEGERS = [
|
|
144
|
-
...NATURALS,
|
|
145
|
-
getBuiltinConstant("Int", "Int"),
|
|
146
|
-
getBuiltinOperator(1, "-.", "Uminus"),
|
|
147
|
-
];
|
|
134
|
+
const INTEGERS = [...NATURALS, getBuiltin(0, "Int", "Int"), getBuiltin(1, "-.", "Uminus")];
|
|
148
135
|
|
|
149
136
|
const REALS = [
|
|
150
137
|
...INTEGERS,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
138
|
+
getBuiltin(0, "Real", "Real"),
|
|
139
|
+
getBuiltin(2, "/", "Ratio"),
|
|
140
|
+
getBuiltin(0, "Infinity", "Infinity"),
|
|
154
141
|
];
|
|
155
142
|
|
|
156
143
|
const SEQUENCES = [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
144
|
+
getBuiltin(1, "Seq", "Seq"),
|
|
145
|
+
getBuiltin(1, "Len", "Len"),
|
|
146
|
+
getBuiltin(2, "BSeq", "BSeq"),
|
|
147
|
+
getBuiltin(2, "\\o", "Cat"),
|
|
148
|
+
getBuiltin(2, "Append", "Append"),
|
|
149
|
+
getBuiltin(1, "Head", "Head"),
|
|
150
|
+
getBuiltin(1, "Tail", "Tail"),
|
|
151
|
+
getBuiltin(3, "SubSeq", "SubSeq"),
|
|
152
|
+
getBuiltin(2, "SelectSeq", "SelectSeq"),
|
|
166
153
|
];
|
|
167
154
|
|
|
168
155
|
const TLC = [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
156
|
+
getBuiltin(2, "Print", "Print"),
|
|
157
|
+
getBuiltin(1, "PrintT", "PrintT"),
|
|
158
|
+
getBuiltin(2, "Assert", "Assert"),
|
|
159
|
+
getBuiltin(0, "JavaTime", "JavaTime"),
|
|
160
|
+
getBuiltin(1, "TLCGet", "TLCGet"),
|
|
161
|
+
getBuiltin(2, "TLCSet", "TLCSet"),
|
|
162
|
+
getBuiltin(2, ":>", "OneArg"),
|
|
163
|
+
getBuiltin(2, "@@", "Extend"),
|
|
164
|
+
getBuiltin(1, "Permutations", "Permutations"),
|
|
165
|
+
getBuiltin(2, "SortSeq", "SortSeq"),
|
|
166
|
+
getBuiltin(1, "RandomElement", "RandomElement"),
|
|
167
|
+
getBuiltin(0, "Any", "Any"),
|
|
168
|
+
getBuiltin(1, "ToString", "ToString"),
|
|
182
169
|
];
|
|
183
170
|
|
|
184
171
|
const getStandard = (name: string, body: ModuleUnit[]): Mule => ({
|
|
@@ -241,27 +228,28 @@ const getUnitHyps = (unit: ModuleUnit): Hyp[] => {
|
|
|
241
228
|
},
|
|
242
229
|
];
|
|
243
230
|
case "Axiom":
|
|
244
|
-
return unit.name === undefined
|
|
245
|
-
? [{ kind: "Fact", expression: unit.expression, visibility: "Hidden", location }]
|
|
246
|
-
: getNamedFact(unit.name, unit.expression, location);
|
|
247
231
|
case "Theorem": {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
232
|
+
const expression =
|
|
233
|
+
unit.kind === "Axiom"
|
|
234
|
+
? unit.expression
|
|
235
|
+
: at(
|
|
236
|
+
exprifySequent(
|
|
237
|
+
substituteSequent(shift(-unit.axiomCount), {
|
|
238
|
+
...unit.sequent,
|
|
239
|
+
context: unit.sequent.context.slice(unit.axiomCount),
|
|
240
|
+
}),
|
|
241
|
+
),
|
|
242
|
+
unit,
|
|
243
|
+
);
|
|
253
244
|
return unit.name === undefined
|
|
254
|
-
? [
|
|
255
|
-
: getNamedFact(unit.name,
|
|
245
|
+
? [getFact(expression, "Hidden", "Always", location)]
|
|
246
|
+
: getNamedFact(unit.name, expression, location);
|
|
256
247
|
}
|
|
257
248
|
case "Mutate":
|
|
258
249
|
return unit.mode === "Use"
|
|
259
|
-
? unit.usable.facts.map((fact, index) =>
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
visibility: "Visible",
|
|
263
|
-
location,
|
|
264
|
-
}))
|
|
250
|
+
? unit.usable.facts.map((fact, index) =>
|
|
251
|
+
getFact(shiftExpr(index, fact), "Visible", "Always", location),
|
|
252
|
+
)
|
|
265
253
|
: [];
|
|
266
254
|
case "Submod":
|
|
267
255
|
case "Anoninst":
|
|
@@ -285,7 +273,7 @@ const getNamedFact = (name: string, expression: Expr, location: Locus | undefine
|
|
|
285
273
|
isLocal: false,
|
|
286
274
|
location,
|
|
287
275
|
},
|
|
288
|
-
{ kind: "
|
|
276
|
+
getFact({ kind: "Ix", index: 1, location }, "Hidden", "Always", location),
|
|
289
277
|
];
|
|
290
278
|
|
|
291
279
|
// Module.Flatten.exports: what an extending module sees, with local definitions inlined like
|
|
@@ -353,11 +341,12 @@ export const getDependencies = (module: Mule) => {
|
|
|
353
341
|
}
|
|
354
342
|
Object.values(value).forEach(addInstances);
|
|
355
343
|
};
|
|
356
|
-
//
|
|
344
|
+
// Leaves out the proofs of theorems.
|
|
357
345
|
const visit = (unit: ModuleUnit) => {
|
|
358
|
-
if (unit.kind
|
|
359
|
-
|
|
360
|
-
|
|
346
|
+
if (unit.kind !== "Submod") {
|
|
347
|
+
addInstances(unit.kind === "Theorem" ? unit.sequent : unit);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
361
350
|
locals.add(unit.module.name);
|
|
362
351
|
submodules.set(unit.module.name, unit.module);
|
|
363
352
|
addExtendees(unit.module);
|
|
@@ -390,7 +379,7 @@ export interface Pipeline {
|
|
|
390
379
|
generator: Generator;
|
|
391
380
|
salts: Counter;
|
|
392
381
|
latestModules: Map<string, Mule>;
|
|
393
|
-
onWarning:
|
|
382
|
+
onWarning: Warn;
|
|
394
383
|
}
|
|
395
384
|
|
|
396
385
|
const substituteUsable = (substitution: Substitution, usable: Usable): Usable => ({
|
|
@@ -479,7 +468,7 @@ const lambdifyTheorem = (
|
|
|
479
468
|
} catch (error) {
|
|
480
469
|
if (!(error instanceof TlaProofError) || error.failure === undefined) throw error;
|
|
481
470
|
const location = sequent.active.location;
|
|
482
|
-
const message = `${error.failure}\nCould not instantiate the theorem ${name === undefined ? "" : `named: ${name}, `}at: ${
|
|
471
|
+
const message = `${error.failure}\nCould not instantiate the theorem ${name === undefined ? "" : `named: ${name}, `}at: ${getLocationText(location)}`;
|
|
483
472
|
pipeline.onWarning({ text: `${getAtPrefix(location)}[ERROR]${message}`, channel: "stdout" });
|
|
484
473
|
pipeline.onWarning({ text: message, channel: "toolboxOnly" });
|
|
485
474
|
return { context: [], active: at({ kind: "Internal", builtin: "TRUE" }, sequent.active) };
|
|
@@ -681,21 +670,18 @@ const localizeAxioms = (units: ModuleUnit[]) => {
|
|
|
681
670
|
body.push({
|
|
682
671
|
kind: "Definition",
|
|
683
672
|
definition: { kind: "Operator", name: unit.name, body: unit.expression, location },
|
|
684
|
-
whereDefined: "Proof",
|
|
673
|
+
whereDefined: { kind: "Proof", time: "Always" },
|
|
685
674
|
visibility: "Visible",
|
|
686
675
|
isLocal: false,
|
|
687
676
|
location,
|
|
688
677
|
});
|
|
689
678
|
}
|
|
690
|
-
const hyp
|
|
691
|
-
kind: "
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
? shiftExpr(1, unit.expression)
|
|
695
|
-
: at({ kind: "Ix", index: 2 }, unit),
|
|
696
|
-
visibility: "Visible",
|
|
679
|
+
const hyp = getFact(
|
|
680
|
+
unit.name === undefined ? shiftExpr(1, unit.expression) : at({ kind: "Ix", index: 2 }, unit),
|
|
681
|
+
"Visible",
|
|
682
|
+
"Always",
|
|
697
683
|
location,
|
|
698
|
-
|
|
684
|
+
);
|
|
699
685
|
let distance = 0;
|
|
700
686
|
const inserted = tail.map((next): ModuleUnit => {
|
|
701
687
|
const size = distance;
|
|
@@ -808,7 +794,7 @@ const bindTheoremName = (
|
|
|
808
794
|
body: at(exprifySequent(sequent), { location }),
|
|
809
795
|
location,
|
|
810
796
|
},
|
|
811
|
-
whereDefined: "Proof",
|
|
797
|
+
whereDefined: { kind: "Proof", time: "Always" },
|
|
812
798
|
visibility: "Visible",
|
|
813
799
|
isLocal: false,
|
|
814
800
|
location,
|
|
@@ -950,13 +936,20 @@ export const normalize = (
|
|
|
950
936
|
pipeline.latestModules = new Map(modules);
|
|
951
937
|
const sequent = pipeline.anonymizer.sequent(current, unit.sequent);
|
|
952
938
|
const binding = bindTheoremName(name, sequent, unit.location);
|
|
953
|
-
const proofScope = adjoinAll(
|
|
939
|
+
const proofScope = adjoinAll(
|
|
940
|
+
adjoinAll(
|
|
941
|
+
current,
|
|
942
|
+
binding.hyps.map((hyp) => ({ ...hyp, isConstnessUnset: true })),
|
|
943
|
+
),
|
|
944
|
+
binding.sequent.context,
|
|
945
|
+
);
|
|
954
946
|
const anonymized = pipeline.anonymizer.proof(proofScope, proof);
|
|
955
947
|
const simplified = module.isImportant
|
|
956
948
|
? pipeline.generator.simplify(
|
|
957
949
|
getScopeHyps(proofScope),
|
|
958
950
|
binding.sequent.active,
|
|
959
951
|
anonymized,
|
|
952
|
+
getScopeTime(binding.sequent.context, "Always"),
|
|
960
953
|
)
|
|
961
954
|
: anonymized;
|
|
962
955
|
emit({ ...unit, name, sequent, proof: simplified });
|
|
@@ -984,7 +977,7 @@ export interface ModuleSummary extends ProofSummary {
|
|
|
984
977
|
theorems: TheoremSummary[];
|
|
985
978
|
}
|
|
986
979
|
|
|
987
|
-
// Module.Gen.generate
|
|
980
|
+
// Module.Gen.generate.
|
|
988
981
|
export const generate = (
|
|
989
982
|
pipeline: Pipeline,
|
|
990
983
|
context: Hyp[],
|
|
@@ -999,9 +992,11 @@ export const generate = (
|
|
|
999
992
|
case "Theorem": {
|
|
1000
993
|
const binding = bindTheoremName(unit.name, unit.sequent, unit.location);
|
|
1001
994
|
const named = [...current, ...binding.hyps];
|
|
995
|
+
const context = [...named, ...binding.sequent.context];
|
|
1002
996
|
const proof = pipeline.generator.generate(
|
|
1003
|
-
{ context
|
|
997
|
+
{ context, active: binding.sequent.active },
|
|
1004
998
|
unit.proof,
|
|
999
|
+
getScopeTime(context, "Always"),
|
|
1005
1000
|
);
|
|
1006
1001
|
obligations.push(...pipeline.generator.collect(proof));
|
|
1007
1002
|
const theorem = getProofSummary(proof);
|
|
@@ -1011,10 +1006,7 @@ export const generate = (
|
|
|
1011
1006
|
unit.name === undefined
|
|
1012
1007
|
? at(exprifySequent(unit.sequent), unit)
|
|
1013
1008
|
: { kind: "Ix", index: 1, location: unit.location };
|
|
1014
|
-
current = [
|
|
1015
|
-
...named,
|
|
1016
|
-
{ kind: "Fact", expression: fact, visibility: "Hidden", location: unit.location },
|
|
1017
|
-
];
|
|
1009
|
+
current = [...named, getFact(fact, "Hidden", "Always", unit.location)];
|
|
1018
1010
|
continue;
|
|
1019
1011
|
}
|
|
1020
1012
|
case "Submod": {
|