tla-ts 0.0.10-dev.99796fe03 → 0.0.10-dev.a17d6d9fa
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/dist/compile.cjs +3 -3
- package/dist/compile.js +1 -1
- package/dist/deciders.cjs +36 -36
- package/dist/deciders.js +54 -54
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove-worker.cjs +1 -1
- package/dist/prove-worker.js +1 -1
- package/dist/prove.cjs +60 -60
- package/dist/prove.js +78 -78
- package/dist/run.cjs +42 -44
- package/dist/run.js +44 -46
- package/dist/tlapm.cjs +1 -1
- package/dist/tlapm.js +2 -2
- package/dist/transfer.cjs +43 -43
- package/dist/transfer.js +39 -39
- package/dist/worker.cjs +6 -6
- package/dist/worker.js +6 -6
- package/package.json +1 -1
- package/src/ast.ts +1 -0
- package/src/bags.ts +50 -29
- package/src/builtins.ts +4 -3
- package/src/check-failure.ts +1 -1
- package/src/check-trace.ts +90 -51
- package/src/check.ts +367 -178
- package/src/cli/runtime-invariants.ts +20 -56
- package/src/cli/tlc-arguments.ts +2 -2
- package/src/cli/tlc-output.ts +1 -2
- package/src/cli/tlc.ts +16 -10
- package/src/cli/xml-exporter.ts +1 -1
- package/src/codegen.ts +26 -9
- package/src/dependencies.ts +49 -9
- package/src/dfid.ts +22 -10
- package/src/environment.ts +58 -33
- package/src/errors.ts +7 -0
- package/src/evaluate.ts +117 -41
- package/src/exit-codes.ts +4 -2
- package/src/instances.ts +5 -5
- package/src/java-hash.ts +14 -0
- package/src/java-overrides.ts +2 -2
- package/src/levels.ts +138 -90
- package/src/liveness-checker.ts +81 -33
- package/src/liveness.ts +49 -11
- package/src/obligations/index.ts +1 -1
- package/src/obligations/normalize.ts +1 -4
- package/src/obligations/printer.ts +5 -5
- package/src/parallel-worker.ts +8 -2
- package/src/parallel.ts +5 -0
- package/src/parser.ts +112 -145
- package/src/prover/isabelle/isar/attrib.ts +4 -4
- package/src/prover/isabelle/isar/rule-cases.ts +8 -6
- package/src/prover/isabelle/provers/clasimp.ts +1 -1
- package/src/prover/isabelle/provers/hypsubst.ts +2 -2
- package/src/prover/isabelle/pure/rewriter.ts +3 -3
- package/src/prover/isabelle/pure/term.ts +3 -3
- package/src/prover/prep/md5.ts +26 -29
- package/src/prover/smt/rewrite.ts +2 -7
- package/src/prover/smt/simplify.ts +1 -1
- package/src/prover/smt/solver/arith-rewriter.ts +11 -3
- package/src/prover/smt/solver/array-rewriter.ts +12 -2
- package/src/prover/smt/solver/asserted-formulas.ts +169 -58
- package/src/prover/smt/solver/ast-lt.ts +1 -1
- package/src/prover/smt/solver/ast.ts +63 -14
- package/src/prover/smt/solver/auf-solver.ts +23 -12
- package/src/prover/smt/solver/bit-blast-tactic.ts +26 -0
- package/src/prover/smt/solver/blast-term-ite.ts +47 -0
- package/src/prover/smt/solver/bound-simplifier.ts +11 -13
- package/src/prover/smt/solver/bv-decl-plugin.ts +13 -10
- package/src/prover/smt/solver/bv-rewriter.ts +1 -1
- package/src/prover/smt/solver/card2bv.ts +32 -18
- package/src/prover/smt/solver/cofactor-elim-term-ite.ts +39 -24
- package/src/prover/smt/solver/context.ts +47 -9
- package/src/prover/smt/solver/ctx-simplify.ts +1 -2
- package/src/prover/smt/solver/datatype-decl-plugin.ts +15 -7
- package/src/prover/smt/solver/dependent-expr-state.ts +9 -4
- package/src/prover/smt/solver/diff-neq.ts +1 -2
- package/src/prover/smt/solver/elim-bounds.ts +89 -0
- package/src/prover/smt/solver/elim-term-ite-tactic.ts +48 -0
- package/src/prover/smt/solver/elim-uncnstr.ts +5 -8
- package/src/prover/smt/solver/euf/arith-internalize.ts +1 -1
- package/src/prover/smt/solver/euf/array-internalize.ts +1 -1
- package/src/prover/smt/solver/euf/bv-internalize.ts +1 -1
- package/src/prover/smt/solver/euf/egraph.ts +4 -11
- package/src/prover/smt/solver/euf/euf-solver.ts +1 -2
- package/src/prover/smt/solver/euf/mam.ts +1 -5
- package/src/prover/smt/solver/euf/q-ematch.ts +1 -2
- package/src/prover/smt/solver/euf/th-solver.ts +0 -7
- package/src/prover/smt/solver/expr2polynomial.ts +204 -79
- package/src/prover/smt/solver/factor.ts +36 -14
- package/src/prover/smt/solver/fd-solver.ts +2 -0
- package/src/prover/smt/solver/fix-dl-var.ts +1 -2
- package/src/prover/smt/solver/fpa-rewriter.ts +1 -2
- package/src/prover/smt/solver/fpa2bv-converter.ts +3 -1
- package/src/prover/smt/solver/fpa2bv-rewriter.ts +1 -0
- package/src/prover/smt/solver/goal.ts +6 -3
- package/src/prover/smt/solver/goal2nlsat.ts +57 -30
- package/src/prover/smt/solver/hashtable.ts +4 -0
- package/src/prover/smt/solver/internalizer.ts +1 -1
- package/src/prover/smt/solver/logic-tactics.ts +9 -2
- package/src/prover/smt/solver/lp/lp-settings.ts +5 -1
- package/src/prover/smt/solver/lp/nla-core.ts +1 -1
- package/src/prover/smt/solver/lp/nla-grobner.ts +2 -2
- package/src/prover/smt/solver/lp/nra-solver.ts +45 -39
- package/src/prover/smt/solver/lp/pdd.ts +2 -3
- package/src/prover/smt/solver/lp/union-find.ts +1 -1
- package/src/prover/smt/solver/mam-compiler.ts +1 -1
- package/src/prover/smt/solver/model-based-opt.ts +1 -1
- package/src/prover/smt/solver/model-evaluator.ts +2 -0
- package/src/prover/smt/solver/model-generator.ts +85 -43
- package/src/prover/smt/solver/mpf.ts +2 -4
- package/src/prover/smt/solver/mus.ts +2 -3
- package/src/prover/smt/solver/muz/dl-context.ts +10 -4
- package/src/prover/smt/solver/muz/dl-mk-slice.ts +3 -3
- package/src/prover/smt/solver/muz/dl-rule.ts +2 -2
- package/src/prover/smt/solver/muz/horn-subsume-model-converter.ts +1 -1
- package/src/prover/smt/solver/muz/horn-tactic.ts +1 -1
- package/src/prover/smt/solver/muz/spacer-context.ts +2 -4
- package/src/prover/smt/solver/muz/spacer-pdr.ts +1 -0
- package/src/prover/smt/solver/nlqsat.ts +1 -1
- package/src/prover/smt/solver/nlsat/algebraic.ts +196 -92
- package/src/prover/smt/solver/nlsat/atoms.ts +52 -33
- package/src/prover/smt/solver/nlsat/explain.ts +375 -217
- package/src/prover/smt/solver/nlsat/levelwise.ts +460 -240
- package/src/prover/smt/solver/nlsat/polynomial.ts +2366 -681
- package/src/prover/smt/solver/nlsat/solver.ts +74 -64
- package/src/prover/smt/solver/nlsat/transcendentals.ts +41 -17
- package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +8 -4
- package/src/prover/smt/solver/nlsat/upolynomial.ts +41 -18
- package/src/prover/smt/solver/nlsat-tactic.ts +1 -1
- package/src/prover/smt/solver/nnf.ts +6 -2
- package/src/prover/smt/solver/opt-context.ts +20 -7
- package/src/prover/smt/solver/opt-nlsat.ts +29 -18
- package/src/prover/smt/solver/opt-pareto.ts +19 -0
- package/src/prover/smt/solver/opt-preprocess.ts +1 -1
- package/src/prover/smt/solver/opt-solver.ts +9 -5
- package/src/prover/smt/solver/optsmt.ts +1 -1
- package/src/prover/smt/solver/pb-rewriter.ts +1 -4
- package/src/prover/smt/solver/poly-rewriter.ts +75 -18
- package/src/prover/smt/solver/probes.ts +88 -23
- package/src/prover/smt/solver/proto-model.ts +8 -8
- package/src/prover/smt/solver/push-app-ite.ts +37 -0
- package/src/prover/smt/solver/qe-arith-plugin.ts +2 -4
- package/src/prover/smt/solver/qe-lite.ts +2 -2
- package/src/prover/smt/solver/qe.ts +3 -2
- package/src/prover/smt/solver/qsat.ts +16 -6
- package/src/prover/smt/solver/quantifier-manager.ts +14 -9
- package/src/prover/smt/solver/recfun-decl-plugin.ts +2 -1
- package/src/prover/smt/solver/rewriter.ts +31 -25
- package/src/prover/smt/solver/rlimit.ts +4 -0
- package/src/prover/smt/solver/sat/config.ts +1 -1
- package/src/prover/smt/solver/sat/goal2sat.ts +0 -1
- package/src/prover/smt/solver/sat/inc-sat-solver.ts +39 -5
- package/src/prover/smt/solver/sat/model-converter.ts +1 -1
- package/src/prover/smt/solver/sat/pb-solver.ts +1 -1
- package/src/prover/smt/solver/sat/sat-tactic.ts +13 -5
- package/src/prover/smt/solver/sat/simplifier.ts +1 -1
- package/src/prover/smt/solver/sat/solver.ts +25 -47
- package/src/prover/smt/solver/seq-axioms.ts +20 -35
- package/src/prover/smt/solver/seq-decl-plugin.ts +1 -1
- package/src/prover/smt/solver/seq-derive.ts +2 -2
- package/src/prover/smt/solver/seq-eq-solver.ts +2 -2
- package/src/prover/smt/solver/seq-monadic.ts +7 -5
- package/src/prover/smt/solver/seq-re-rewriter.ts +2 -1
- package/src/prover/smt/solver/seq-re-util.ts +1 -1
- package/src/prover/smt/solver/seq-regex-bisim.ts +1 -1
- package/src/prover/smt/solver/seq-regex-live.ts +2 -2
- package/src/prover/smt/solver/seq-rewriter.ts +31 -29
- package/src/prover/smt/solver/seq-skolem.ts +0 -23
- package/src/prover/smt/solver/seq-view-witness.ts +4 -4
- package/src/prover/smt/solver/smt-kernel.ts +39 -5
- package/src/prover/smt/solver/smt-setup.ts +96 -10
- package/src/prover/smt/solver/smtlib-parser.ts +584 -223
- package/src/prover/smt/solver/smtlib-script.ts +509 -154
- package/src/prover/smt/solver/solve-eqs.ts +36 -37
- package/src/prover/smt/solver/solver.ts +18 -3
- package/src/prover/smt/solver/tactic.ts +284 -168
- package/src/prover/smt/solver/theory-bv.ts +13 -3
- package/src/prover/smt/solver/theory-fpa.ts +1 -1
- package/src/prover/smt/solver/theory-lra-final-check.ts +1 -0
- package/src/prover/smt/solver/theory-lra-internalize.ts +2 -0
- package/src/prover/smt/solver/theory-lra-propagate.ts +11 -3
- package/src/prover/smt/solver/theory-lra.ts +1 -1
- package/src/prover/smt/solver/theory-pb.ts +24 -7
- package/src/prover/smt/solver/theory-seq-solve.ts +1 -1
- package/src/prover/smt/solver/theory-seq-state.ts +2 -21
- package/src/prover/smt/solver/tseitin-cnf.ts +1 -0
- package/src/prover/tlapm/cache.ts +8 -8
- package/src/prover/zenon/index-table.ts +5 -2
- package/src/prover/zenon/isar-case.ts +1 -1
- package/src/prover/zenon/isar.ts +2 -2
- package/src/prover/zenon/phrase.ts +1 -1
- package/src/resolve.ts +959 -243
- package/src/runtime.ts +7 -1
- package/src/sany/builtins.ts +10 -10
- package/src/sany/generation.ts +2 -13
- package/src/sany/generator-definitions.ts +3 -1
- package/src/sany/generator-expressions.ts +36 -30
- package/src/sany/generator-proofs.ts +5 -3
- package/src/sany/generator.ts +2 -1
- package/src/sany/lexer.ts +3 -3
- package/src/sany/modules.ts +4 -2
- package/src/sany/nodes.ts +1 -1
- package/src/sany/selectors.ts +11 -6
- package/src/sany/xml.ts +2 -3
- package/src/search.ts +166 -101
- package/src/simulate.ts +110 -50
- package/src/spec-description.ts +5 -6
- package/src/standard-modules.ts +15 -6
- package/src/subexpressions.ts +398 -108
- package/src/successors.ts +4 -2
- package/src/symmetry.ts +1 -1
- package/src/tlc/jar-data.ts +10 -0
- package/src/tlc/messages.ts +3 -3
- package/src/tlc/order.ts +14 -3
- package/src/tlc/random.ts +2 -1
- package/src/tlc/replay.ts +3 -2
- package/src/tlc/tlc-operators.ts +10 -8
- package/src/tlc/tlcext-operators.ts +44 -15
- package/src/tlc/trace-spec.ts +9 -22
- package/src/typed-tier.ts +32 -25
- package/src/typescript/types.ts +2 -2
- package/src/values.ts +135 -78
package/dist/worker.cjs
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>{let t=o(e);return t&&{branches:t.branches,solutions:t.solutions,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),storeState:t.storeState,findViolation:()=>o(()=>t.findViolation()),getViolatedProperties:(e,n)=>o(()=>t.getViolatedProperties(e,n))}},c=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,l=c(`java.lang.RuntimeException`),u=c(`tlc2.tool.EvalException`),ee=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var d=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},f=class extends d{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},p=class extends f{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},te=class extends p{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const m=(e,t=!1,n,r=[])=>new f(e.map(e=>`${e.location}\n\n${e.message}`).join(`
|
|
9
|
+
const e={success:0,abort:1,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>{let t=o(e);return t&&{branches:t.branches,solutions:t.solutions,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),storeState:t.storeState,getStateCounts:t.getStateCounts,findViolation:()=>o(()=>t.findViolation()),getViolatedProperties:(e,n)=>o(()=>t.getViolatedProperties(e,n))}},c=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,l=c(`java.lang.RuntimeException`),u=c(`tlc2.tool.EvalException`),ee=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var d=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},f=class extends d{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},p=class extends f{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},te=class extends p{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const m=(e,t=!1,n,r=[])=>new f(e.map(e=>`${e.location}\n\n${e.message}`).join(`
|
|
10
10
|
|
|
11
11
|
`),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),h=(e,t)=>m([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),g=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
|
|
12
|
-
`)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,
|
|
12
|
+
`)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,v=(e,t)=>m([{location:_(t),message:e}]);var y=class extends d{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},b=class extends d{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const x=`This was a Java StackOverflowError. It was probably the result
|
|
13
13
|
of an incorrect recursive function definition that caused TLC to enter
|
|
14
14
|
an infinite loop when trying to compute the function or its application
|
|
15
|
-
to an element in its putative domain.`;var
|
|
15
|
+
to an element in its putative domain.`;var S=class extends b{constructor(){super(x)}};const C=()=>i(new S,e.error);var w=class extends b{},T=class extends b{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},E=class extends b{variable;constructor(e,t){super(e),this.variable=t}},D=class extends b{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},O=class extends b{constructor(t){super(t),i(this,e.error)}},k=class extends w{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},A=class extends b{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},j=class extends b{},M=class extends b{};const N=`Too many possible next states for the last state in the trace.`;var P=class extends b{constructor(){super(N)}},F=class extends b{code;constructor(e,t){super(t),this.code=e}},I=class extends b{state;constructor(e){super(`current state is not a legal state`),this.state=e}},L=class extends d{failure;exception;locus;constructor(e,t={}){super(e),this.locus=t.locus,this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},R=class extends L{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},z=class extends d{constructor(e,t){super(e,t),this.name=`TlaProverError`}},B=class extends z{locus;constructor(e,t){super(e),this.name=`TlaMethodError`,this.locus=t}},V=class extends d{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},H=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const ne=(e,t)=>e instanceof H&&e.exception===t;var U=class extends d{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},W=class extends d{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},G=class extends d{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},K=class extends d{constructor(e){super(e),this.name=`SmtDefaultError`}},q=class extends d{constructor(e){super(e),this.name=`SmtInvariantError`}},J=class extends d{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},Y=class extends d{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},X=class extends d{line;column;constructor(e,t){super(e),this.name=`SmtParseError`,this.line=t.line,this.column=t.column}},Z=class extends U{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const re=t=>a(t)??(t instanceof f?e.specParseError:t instanceof y?e.configParseError:t instanceof b?e.specEvaluationFailure:e.error);var ie=class extends d{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},ae=class extends d{constructor(e){super(e),this.name=`PcalRuntimeError`}},oe=class extends d{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}},se=class extends d{constructor(e,t){let n=t?.getSourceFile(),r=n?.getLineAndCharacterOfPosition(t?.getStart()??0);super(n===void 0||r===void 0?e:`${n.fileName}:${r.line+1}:${r.character+1} ${e}`),this.name=`TlaTypeScriptError`}};const Q=`node:worker_threads`,ce=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,le=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
|
|
16
16
|
/* @vite-ignore */
|
|
17
17
|
/* webpackIgnore: true */
|
|
18
|
-
Q))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}}
|
|
18
|
+
Q))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},$=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
19
19
|
/* @vite-ignore */
|
|
20
20
|
/* webpackIgnore: true */
|
|
21
|
-
Q)).parentPort,
|
|
21
|
+
Q)).parentPort,ue=()=>{let e=`Bun`in globalThis?import(
|
|
22
22
|
/* @vite-ignore */
|
|
23
23
|
/* webpackIgnore: true */
|
|
24
|
-
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return
|
|
24
|
+
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return E}});
|
package/dist/worker.js
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
const e={success:0,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>{let t=o(e);return t&&{branches:t.branches,solutions:t.solutions,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),storeState:t.storeState,findViolation:()=>o(()=>t.findViolation()),getViolatedProperties:(e,n)=>o(()=>t.getViolatedProperties(e,n))}},c=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,l=c(`java.lang.RuntimeException`),u=c(`tlc2.tool.EvalException`),ee=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var d=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},f=class extends d{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},p=class extends f{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},te=class extends p{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const m=(e,t=!1,n,r=[])=>new f(e.map(e=>`${e.location}\n\n${e.message}`).join(`
|
|
9
|
+
const e={success:0,abort:1,assumptionViolation:10,deadlock:11,safetyViolation:12,livenessViolation:13,assertViolation:14,specEvaluationFailure:75,safetyEvaluationFailure:76,livenessEvaluationFailure:77,specParseError:150,configParseError:151,error:255},t=new Map([...[...Array.from({length:24},(e,t)=>2222+t),2272,2273,2274,2280,2281,...Array.from({length:7},(e,t)=>5001+t)].map(t=>[t,e.configParseError]),[2253,e.livenessEvaluationFailure],[2109,e.specEvaluationFailure],[2115,e.specEvaluationFailure],[2103,e.specEvaluationFailure],[2147,e.specEvaluationFailure],[2111,e.safetyEvaluationFailure],[2146,e.safetyEvaluationFailure],[2107,e.safetyViolation],[2110,e.safetyViolation],[2112,e.livenessViolation],[2113,e.livenessViolation],[2116,e.livenessViolation],[2108,e.livenessViolation],[2114,e.deadlock],[2104,e.assumptionViolation],[2105,e.assumptionViolation],[2404,e.assumptionViolation],[2405,e.assumptionViolation],[2780,e.assumptionViolation],[2132,e.assertViolation],[2171,e.specParseError],[3002,e.specParseError]]),n=n=>t.get(n)??e.error,r=/* @__PURE__ */ new WeakMap,i=(e,t)=>(e instanceof Error&&!r.has(e)&&r.set(e,t),e),a=e=>r.get(e),o=t=>{try{return t()}catch(t){throw i(t,e.error)}},s=e=>{let t=o(e);return t&&{branches:t.branches,solutions:t.solutions,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),storeState:t.storeState,getStateCounts:t.getStateCounts,findViolation:()=>o(()=>t.findViolation()),getViolatedProperties:(e,n)=>o(()=>t.getViolatedProperties(e,n))}},c=e=>`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a ${e}\n: `,l=c(`java.lang.RuntimeException`),u=c(`tlc2.tool.EvalException`),ee=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var d=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},f=class extends d{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},p=class extends f{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},te=class extends p{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const m=(e,t=!1,n,r=[])=>new f(e.map(e=>`${e.location}\n\n${e.message}`).join(`
|
|
10
10
|
|
|
11
11
|
`),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),h=(e,t)=>m([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),g=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
|
|
12
|
-
`)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,
|
|
12
|
+
`)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,v=(e,t)=>m([{location:_(t),message:e}]);var y=class extends d{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},b=class extends d{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const x=`This was a Java StackOverflowError. It was probably the result
|
|
13
13
|
of an incorrect recursive function definition that caused TLC to enter
|
|
14
14
|
an infinite loop when trying to compute the function or its application
|
|
15
|
-
to an element in its putative domain.`;var
|
|
15
|
+
to an element in its putative domain.`;var S=class extends b{constructor(){super(x)}};const C=()=>i(new S,e.error);var w=class extends b{},T=class extends b{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},E=class extends b{variable;constructor(e,t){super(e),this.variable=t}},D=class extends b{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},O=class extends b{constructor(t){super(t),i(this,e.error)}},k=class extends w{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},A=class extends b{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},j=class extends b{},M=class extends b{};const N=`Too many possible next states for the last state in the trace.`;var P=class extends b{constructor(){super(N)}},F=class extends b{code;constructor(e,t){super(t),this.code=e}},I=class extends b{state;constructor(e){super(`current state is not a legal state`),this.state=e}},L=class extends d{failure;exception;locus;constructor(e,t={}){super(e),this.locus=t.locus,this.name=`TlaProofError`,this.failure=t.exception===void 0?t.failure??e:void 0,this.exception=t.exception??`Failure(${JSON.stringify(this.failure)})`}},R=class extends L{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},z=class extends d{constructor(e,t){super(e,t),this.name=`TlaProverError`}},B=class extends z{locus;constructor(e,t){super(e),this.name=`TlaMethodError`,this.locus=t}},V=class extends d{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},H=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const ne=(e,t)=>e instanceof H&&e.exception===t;var U=class extends d{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},W=class extends d{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},G=class extends d{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},K=class extends d{constructor(e){super(e),this.name=`SmtDefaultError`}},q=class extends d{constructor(e){super(e),this.name=`SmtInvariantError`}},J=class extends d{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},Y=class extends d{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},X=class extends d{line;column;constructor(e,t){super(e),this.name=`SmtParseError`,this.line=t.line,this.column=t.column}},Z=class extends U{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const re=t=>a(t)??(t instanceof f?e.specParseError:t instanceof y?e.configParseError:t instanceof b?e.specEvaluationFailure:e.error);var ie=class extends d{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},ae=class extends d{constructor(e){super(e),this.name=`PcalRuntimeError`}},oe=class extends d{constructor(e){super(`You have discovered a bug in pcal.trans.\nSend the following information and the\ninput file to the current maintainer(s).\n\n -- ${e}.`),this.name=`PcalBugError`}},se=class extends d{constructor(e,t){let n=t?.getSourceFile(),r=n?.getLineAndCharacterOfPosition(t?.getStart()??0);super(n===void 0||r===void 0?e:`${n.fileName}:${r.line+1}:${r.character+1} ${e}`),this.name=`TlaTypeScriptError`}};const Q=`node:worker_threads`,ce=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,le=async(e,t,n)=>{if(typeof Worker==`function`){let r=new Worker(e,{type:`module`});return r.addEventListener(`message`,e=>t(e.data)),r.addEventListener(`error`,n),r}let r=new(await(import(
|
|
16
16
|
/* @vite-ignore */
|
|
17
17
|
/* webpackIgnore: true */
|
|
18
|
-
Q))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}}
|
|
18
|
+
Q))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},$=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
19
19
|
/* @vite-ignore */
|
|
20
20
|
/* webpackIgnore: true */
|
|
21
|
-
Q)).parentPort,
|
|
21
|
+
Q)).parentPort,ue=()=>{let e=`Bun`in globalThis?import(
|
|
22
22
|
/* @vite-ignore */
|
|
23
23
|
/* webpackIgnore: true */
|
|
24
|
-
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};export{
|
|
24
|
+
`bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};export{re as $,D as A,w as B,I as C,B as D,Z as E,S as F,u as G,F as H,f as I,m as J,l as K,P as L,z as M,p as N,A as O,M as P,g as Q,se as R,O as S,H as T,V as U,U as V,R as W,C as X,v as Y,_ as Z,j as _,J as a,n as at,d as b,ae as c,G as d,c as et,K as f,N as g,W as h,le as i,a as it,L as j,te as k,Y as l,X as m,$ as n,ee as nt,oe as o,i as ot,q as p,h as q,ce as r,e as rt,ie as s,s as st,ue as t,ne as tt,x as u,y as v,T as w,b as x,k as y,E as z};
|
package/package.json
CHANGED
package/src/ast.ts
CHANGED
package/src/bags.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
defineConstant,
|
|
5
5
|
defineHigherOrderOperator,
|
|
6
6
|
defineOperator,
|
|
7
|
-
getJavaClassName,
|
|
8
7
|
getKindString,
|
|
9
8
|
getOperator,
|
|
10
9
|
getValue,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
} from "./builtins";
|
|
13
12
|
import { TlaEvaluationError, TlaModuleError } from "./errors";
|
|
14
13
|
import type { Builtin, BuiltinArgument } from "./evaluate";
|
|
14
|
+
import { prettyPrint } from "./pretty-print";
|
|
15
15
|
import {
|
|
16
16
|
createEnumeratedSet,
|
|
17
17
|
createFunction,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
|
|
32
32
|
const createWrongValueError = (name: string, expected: string, value: Value) =>
|
|
33
33
|
new TlaModuleError(
|
|
34
|
-
`Applying ${name} to the following value,\nwhich is not ${expected}:\n${formatValue(value)}`,
|
|
34
|
+
`Applying ${name} to the following value,\nwhich is not ${expected}:\n${prettyPrint(formatValue(value))}`,
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const toFunction = (value: Value) => (isFunctionValue(value) ? toFiniteFunction(value) : undefined);
|
|
@@ -45,6 +45,7 @@ const getFunction = (args: BuiltinArgument[], index: number, name: string) => {
|
|
|
45
45
|
return functionValue;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
// Deviation from TLC: Bags#BagIn and Bags#CopiesIn read the null that toFcnRcd gives for a value that isn't a function and leak a NullPointerException, where tla-ts reports the argument as not a bag.
|
|
48
49
|
const getCount = (args: BuiltinArgument[], name: string) => {
|
|
49
50
|
const bag = getValue(args, 1, name);
|
|
50
51
|
const functionValue = toFunction(bag);
|
|
@@ -55,6 +56,7 @@ const getCount = (args: BuiltinArgument[], name: string) => {
|
|
|
55
56
|
return count;
|
|
56
57
|
};
|
|
57
58
|
|
|
59
|
+
// Deviation from TLC: Bags#BagCup passes the null that toFcnRcd gives for a value that isn't a function to IsABag and leaks a NullPointerException, where tla-ts reports the argument as not a bag.
|
|
58
60
|
const getAddedBag = (
|
|
59
61
|
args: BuiltinArgument[],
|
|
60
62
|
functions: (FunctionValue | undefined)[],
|
|
@@ -85,34 +87,44 @@ const findCount = (functionValue: FunctionValue, element: Value) => {
|
|
|
85
87
|
return position === -1 ? undefined : functionValue.range[position];
|
|
86
88
|
};
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
// Deviation from TLC: Bags.java casts a count to IntValue and leaks the ClassCastException, where tla-ts reports the argument as not a bag.
|
|
91
|
+
const toCount = (value: Value, createError: () => TlaModuleError) => {
|
|
89
92
|
if (typeof value === "number") return value;
|
|
90
|
-
|
|
91
|
-
throw new TlaEvaluationError(
|
|
92
|
-
`class ${javaClass} cannot be cast to class tlc2.value.impl.IntValue (${javaClass} and tlc2.value.impl.IntValue are in unnamed module of loader 'app')`,
|
|
93
|
-
);
|
|
93
|
+
throw createError();
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
const addCounts = (left: Value, right: Value) => {
|
|
97
|
-
const sum = toCount(left) + toCount(right);
|
|
96
|
+
const addCounts = (left: Value, right: Value, createError: () => TlaModuleError) => {
|
|
97
|
+
const sum = toCount(left, createError) + toCount(right, createError);
|
|
98
98
|
if (isOutOfRange(sum)) throw createOverflowError(`${left}+${right}`);
|
|
99
99
|
return sum;
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
// Deviation from TLC: Bags
|
|
103
|
-
const subtractCounts = (
|
|
104
|
-
|
|
102
|
+
// Deviation from TLC: Bags#BagDiff subtracts counts as Java ints that wrap, where tla-ts reports the overflow as - does.
|
|
103
|
+
const subtractCounts = (
|
|
104
|
+
functionValue: FunctionValue,
|
|
105
|
+
index: number,
|
|
106
|
+
other: FunctionValue,
|
|
107
|
+
createLeftError: () => TlaModuleError,
|
|
108
|
+
createRightError: () => TlaModuleError,
|
|
109
|
+
) => {
|
|
110
|
+
const count = toCount(functionValue.range[index], createLeftError);
|
|
105
111
|
const removed = findCount(other, functionValue.domain[index]);
|
|
106
112
|
if (removed === undefined) return count;
|
|
107
|
-
const difference = count - toCount(removed);
|
|
113
|
+
const difference = count - toCount(removed, createRightError);
|
|
108
114
|
if (isOutOfRange(difference)) throw createOverflowError(`${count}-${removed}`);
|
|
109
115
|
return difference;
|
|
110
116
|
};
|
|
111
117
|
|
|
112
118
|
// BagCup looks up a key of its second bag only among the keys of its first.
|
|
113
|
-
const addToBag = (
|
|
119
|
+
const addToBag = (
|
|
120
|
+
pairs: [Value, Value][],
|
|
121
|
+
key: Value,
|
|
122
|
+
count: Value,
|
|
123
|
+
createError: () => TlaModuleError,
|
|
124
|
+
end = pairs.length,
|
|
125
|
+
) => {
|
|
114
126
|
const existing = pairs.slice(0, end).find((pair) => isEqualLikeTlc(key, pair[0]));
|
|
115
|
-
if (existing) existing[1] = addCounts(existing[1], count);
|
|
127
|
+
if (existing) existing[1] = addCounts(existing[1], count, createError);
|
|
116
128
|
else pairs.push([key, count]);
|
|
117
129
|
};
|
|
118
130
|
|
|
@@ -130,11 +142,10 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
130
142
|
defineOperator("BagCardinality", 1, (args) => {
|
|
131
143
|
const bag = getValue(args, 0, "BagCardinality");
|
|
132
144
|
const functionValue = getFunction(args, 0, "BagCardinality");
|
|
145
|
+
const createError = () => createWrongValueError("BagCardinality", "a bag", bag);
|
|
133
146
|
return functionValue.range.reduce<number>((total, count) => {
|
|
134
|
-
if (typeof count !== "number" || count <= 0)
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
return addCounts(total, count);
|
|
147
|
+
if (typeof count !== "number" || count <= 0) throw createError();
|
|
148
|
+
return addCounts(total, count, createError);
|
|
138
149
|
}, 0);
|
|
139
150
|
}),
|
|
140
151
|
defineOperator("BagIn", 2, (args) => {
|
|
@@ -147,8 +158,10 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
147
158
|
const left = getAddedBag(args, functions, 0);
|
|
148
159
|
const right = getAddedBag(args, functions, 1);
|
|
149
160
|
const pairs = getPairs(left);
|
|
161
|
+
const createError = () =>
|
|
162
|
+
createModuleArgumentError("second", "(+)", "bag", getValue(args, 1, "(+)"));
|
|
150
163
|
right.domain.forEach((key, index) =>
|
|
151
|
-
addToBag(pairs, key, right.range[index], left.domain.length),
|
|
164
|
+
addToBag(pairs, key, right.range[index], createError, left.domain.length),
|
|
152
165
|
);
|
|
153
166
|
return createFunction(pairs);
|
|
154
167
|
}),
|
|
@@ -159,9 +172,11 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
159
172
|
const right = toFunction(rightValue);
|
|
160
173
|
if (!left) throw createModuleArgumentError("first", "(-)", "bag", leftValue);
|
|
161
174
|
if (!right) throw createModuleArgumentError("second", "(-)", "bag", rightValue);
|
|
175
|
+
const createLeftError = () => createModuleArgumentError("first", "(-)", "bag", leftValue);
|
|
176
|
+
const createRightError = () => createModuleArgumentError("second", "(-)", "bag", rightValue);
|
|
162
177
|
return createFunction(
|
|
163
178
|
left.domain.flatMap((key, index): [Value, Value][] => {
|
|
164
|
-
const count = subtractCounts(left, index, right);
|
|
179
|
+
const count = subtractCounts(left, index, right, createLeftError, createRightError);
|
|
165
180
|
return count > 0 ? [[key, count]] : [];
|
|
166
181
|
}),
|
|
167
182
|
);
|
|
@@ -172,20 +187,20 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
172
187
|
createWrongValueError("BagUnion", "a finite enumerable set", set),
|
|
173
188
|
);
|
|
174
189
|
if (elements.length < 2) return elements[0] ?? EMPTY_BAG;
|
|
190
|
+
const createUnionError = () =>
|
|
191
|
+
new TlaModuleError(
|
|
192
|
+
`Attempted to apply BagUnion to the following set, whose\nelement is not a bag:\n${prettyPrint(formatValue(set))}`,
|
|
193
|
+
);
|
|
175
194
|
const getBag = (element: Value) => {
|
|
176
195
|
const functionValue = toFunction(element);
|
|
177
|
-
if (!functionValue)
|
|
178
|
-
throw new TlaModuleError(
|
|
179
|
-
`Attempted to apply BagUnion to the following set, whose\nelement is not a bag:\n${formatValue(set)}`,
|
|
180
|
-
);
|
|
181
|
-
}
|
|
196
|
+
if (!functionValue) throw createUnionError();
|
|
182
197
|
return functionValue;
|
|
183
198
|
};
|
|
184
199
|
const pairs = getPairs(getBag(elements[0]));
|
|
185
200
|
elements.slice(1).forEach((element) => {
|
|
186
201
|
const functionValue = getBag(element);
|
|
187
202
|
functionValue.domain.forEach((key, index) =>
|
|
188
|
-
addToBag(pairs, key, functionValue.range[index]),
|
|
203
|
+
addToBag(pairs, key, functionValue.range[index], createUnionError),
|
|
189
204
|
);
|
|
190
205
|
});
|
|
191
206
|
return createFunction(pairs);
|
|
@@ -197,9 +212,14 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
197
212
|
const right = toFunction(rightValue);
|
|
198
213
|
if (!left) throw createWrongValueError("\\sqsubseteq", FINITE_FUNCTION, leftValue);
|
|
199
214
|
if (!right) throw createWrongValueError("\\sqsubseteq", FINITE_FUNCTION, rightValue);
|
|
215
|
+
const createLeftError = () => createWrongValueError("\\sqsubseteq", "a bag", leftValue);
|
|
216
|
+
const createRightError = () => createWrongValueError("\\sqsubseteq", "a bag", rightValue);
|
|
200
217
|
return left.domain.every((key, index) => {
|
|
201
218
|
const count = findCount(right, key);
|
|
202
|
-
return
|
|
219
|
+
return (
|
|
220
|
+
toCount(left.range[index], createLeftError) <=
|
|
221
|
+
(count === undefined ? 0 : toCount(count, createRightError))
|
|
222
|
+
);
|
|
203
223
|
});
|
|
204
224
|
}),
|
|
205
225
|
defineHigherOrderOperator("BagOfAll", 2, (args) => {
|
|
@@ -210,8 +230,9 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
|
|
|
210
230
|
throw createModuleArgumentError("second", "BagOfAll", "function with a finite domain", value);
|
|
211
231
|
}
|
|
212
232
|
const pairs: [Value, Value][] = [];
|
|
233
|
+
const createError = () => createModuleArgumentError("second", "BagOfAll", "bag", value);
|
|
213
234
|
functionValue.domain.forEach((key, index) =>
|
|
214
|
-
addToBag(pairs, operator.call([key]), functionValue.range[index]),
|
|
235
|
+
addToBag(pairs, operator.call([key]), functionValue.range[index], createError),
|
|
215
236
|
);
|
|
216
237
|
return createFunction(pairs);
|
|
217
238
|
}),
|
package/src/builtins.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TlaEndOfInputError, TlaEvaluationError, TlaModuleError } from "./errors";
|
|
2
2
|
import type { Builtin, BuiltinArgument, Context, OperatorValue } from "./evaluate";
|
|
3
|
+
import { prettyPrint } from "./pretty-print";
|
|
3
4
|
import {
|
|
4
5
|
formatValue,
|
|
5
6
|
getFunctionClass,
|
|
@@ -51,13 +52,13 @@ export const createModuleArgumentError = (
|
|
|
51
52
|
value: Value,
|
|
52
53
|
) =>
|
|
53
54
|
new TlaModuleError(
|
|
54
|
-
`The ${position} argument of ${name} should be a ${expected}, but instead it is:\n${formatValue(value)}`,
|
|
55
|
+
`The ${position} argument of ${name} should be a ${expected}, but instead it is:\n${prettyPrint(formatValue(value))}`,
|
|
55
56
|
);
|
|
56
57
|
|
|
57
58
|
export const toEnumeratedSet = (value: Value, name: string, reported = value) => {
|
|
58
59
|
if (!isSetValue(value) || isOverriddenSet(value)) {
|
|
59
60
|
throw new TlaModuleError(
|
|
60
|
-
`Applying ${name} to the following value,\nwhich is not a finite set:\n${formatValue(reported)}`,
|
|
61
|
+
`Applying ${name} to the following value,\nwhich is not a finite set:\n${prettyPrint(formatValue(reported))}`,
|
|
61
62
|
);
|
|
62
63
|
}
|
|
63
64
|
return toFiniteSet(value);
|
|
@@ -290,7 +291,7 @@ export const defineArithmetic = (
|
|
|
290
291
|
const getIntegerArgument = (value: Value, position: string, name: string) => {
|
|
291
292
|
if (typeof value !== "number") {
|
|
292
293
|
throw new TlaModuleError(
|
|
293
|
-
`The ${position} argument of ${name} should be an integer, but instead it is:\n${formatValue(value)}`,
|
|
294
|
+
`The ${position} argument of ${name} should be an integer, but instead it is:\n${prettyPrint(formatValue(value))}`,
|
|
294
295
|
);
|
|
295
296
|
}
|
|
296
297
|
return value;
|
package/src/check-failure.ts
CHANGED
|
@@ -57,7 +57,7 @@ export const getFailureExitCode = (
|
|
|
57
57
|
getExitCode(error) ?? (error instanceof TlaModuleError ? error.exitCode : EXIT_STATUS.error)
|
|
58
58
|
);
|
|
59
59
|
case "liveness":
|
|
60
|
-
return getErrorExitCode(error);
|
|
60
|
+
return error instanceof TlaModuleError ? error.exitCode : getErrorExitCode(error);
|
|
61
61
|
default:
|
|
62
62
|
if (!isReplayed) return getErrorExitCode(error);
|
|
63
63
|
return failureOptions.fingerprint
|
package/src/check-trace.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CheckOptions, OutputLine, TraceStep } from "./check";
|
|
2
2
|
import type { ModelConfig } from "./config";
|
|
3
3
|
import { TlaEvaluationError } from "./errors";
|
|
4
|
-
import { isImpure, type Environment } from "./evaluate";
|
|
5
|
-
import { isSameState } from "./fingerprints";
|
|
4
|
+
import { isImpure, type Environment, type State } from "./evaluate";
|
|
5
|
+
import { getStateHash, isSameState } from "./fingerprints";
|
|
6
6
|
import type { Search } from "./search";
|
|
7
7
|
import { getActionLabel, type SpecAction } from "./spec-description";
|
|
8
8
|
import { getSuccessors, type Successor } from "./successors";
|
|
9
|
-
import type
|
|
9
|
+
import { createModelValue, type Value } from "./values";
|
|
10
10
|
|
|
11
11
|
export interface Behavior {
|
|
12
12
|
trace: TraceStep[];
|
|
@@ -16,6 +16,7 @@ export interface Behavior {
|
|
|
16
16
|
interface TraceOptions {
|
|
17
17
|
loopStart?: number;
|
|
18
18
|
known?: number;
|
|
19
|
+
incomplete?: State;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
interface RebuiltState {
|
|
@@ -35,6 +36,7 @@ export interface SearchPosition {
|
|
|
35
36
|
export interface TracedStep {
|
|
36
37
|
state: Record<string, Value>;
|
|
37
38
|
action: SpecAction | undefined;
|
|
39
|
+
alias?: Record<string, Value>;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
interface TraceContext {
|
|
@@ -59,7 +61,7 @@ interface TraceContext {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
const INITIAL_RECOVERY_FAILURE = "Failed to recover the initial state from its fingerprint.";
|
|
62
|
-
const NEXT_RECOVERY_FAILURE = "Failed to recover the next state from its fingerprint.";
|
|
64
|
+
export const NEXT_RECOVERY_FAILURE = "Failed to recover the next state from its fingerprint.";
|
|
63
65
|
|
|
64
66
|
export const createTraceBuilder = (context: TraceContext) => {
|
|
65
67
|
const config = context.config;
|
|
@@ -78,34 +80,31 @@ export const createTraceBuilder = (context: TraceContext) => {
|
|
|
78
80
|
|
|
79
81
|
const getAliasState = (
|
|
80
82
|
alias: string,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
state: State,
|
|
84
|
+
successor: State,
|
|
85
|
+
level: number,
|
|
86
|
+
getBehavior: () => Value[][],
|
|
84
87
|
) => {
|
|
85
88
|
const searchLevel = runtime.getLevel;
|
|
86
89
|
const searchBehavior = runtime.getBehavior;
|
|
87
|
-
runtime.getLevel = () =>
|
|
88
|
-
runtime.getBehavior =
|
|
90
|
+
runtime.getLevel = () => level;
|
|
91
|
+
runtime.getBehavior = getBehavior;
|
|
89
92
|
try {
|
|
90
|
-
return search.evaluateAlias(
|
|
91
|
-
alias,
|
|
92
|
-
steps[position].state,
|
|
93
|
-
(steps[position + 1] ?? steps[loopStart ?? position]).state,
|
|
94
|
-
options.isTool ?? false,
|
|
95
|
-
);
|
|
93
|
+
return search.evaluateAlias(alias, state, successor, options.isTool ?? false);
|
|
96
94
|
} finally {
|
|
97
95
|
runtime.getLevel = searchLevel;
|
|
98
96
|
runtime.getBehavior = searchBehavior;
|
|
99
97
|
}
|
|
100
98
|
};
|
|
99
|
+
// Deviation from TLC: TLCTrace#printTrace rebuilds a step with the generator that already drew for its state, so it misses the step and leaks a NullPointerException.
|
|
100
|
+
const rebuildFrom = (state: Value[], level: number) => {
|
|
101
|
+
current.rebuilt = { state, level };
|
|
102
|
+
runtime.reseedRandom();
|
|
103
|
+
};
|
|
101
104
|
const findStepAction = (index: number, previous: Value[], state: Value[], isHeld: boolean) => {
|
|
102
105
|
const expanding = { ...current };
|
|
103
|
-
Object.assign(current, {
|
|
104
|
-
|
|
105
|
-
isExpanding: true,
|
|
106
|
-
candidate: undefined,
|
|
107
|
-
rebuilt: { state: previous, level: depths[index] },
|
|
108
|
-
});
|
|
106
|
+
Object.assign(current, { index, isExpanding: true, candidate: undefined });
|
|
107
|
+
rebuildFrom(previous, depths[index]);
|
|
109
108
|
const getKey = isHeld ? (values: Value[]) => values : getFingerprintState;
|
|
110
109
|
const key = getKey(state);
|
|
111
110
|
try {
|
|
@@ -166,7 +165,15 @@ export const createTraceBuilder = (context: TraceContext) => {
|
|
|
166
165
|
state:
|
|
167
166
|
alias === undefined
|
|
168
167
|
? toRecord(step.state)
|
|
169
|
-
: getAliasState(
|
|
168
|
+
: getAliasState(
|
|
169
|
+
alias,
|
|
170
|
+
step.state,
|
|
171
|
+
steps[position + 1]?.state ??
|
|
172
|
+
traceOptions.incomplete ??
|
|
173
|
+
steps[loopStart ?? position].state,
|
|
174
|
+
position + 1,
|
|
175
|
+
() => steps.slice(0, position + 1).map((inner) => inner.state),
|
|
176
|
+
),
|
|
170
177
|
output: position === 0 ? prefixOutput : position < rebuilt ? [] : outputs[position],
|
|
171
178
|
};
|
|
172
179
|
if (alias !== undefined || action) {
|
|
@@ -187,10 +194,24 @@ export const createTraceBuilder = (context: TraceContext) => {
|
|
|
187
194
|
}
|
|
188
195
|
return undefined;
|
|
189
196
|
}).result;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
// TLC's Tool#getState fingerprints each state it rebuilds, which sorts its records in place.
|
|
198
|
+
const hasFingerprint = (state: Value[], index: number) => {
|
|
199
|
+
const fingerprintState = getFingerprintState(state);
|
|
200
|
+
const stored = context.fingerprintStates[index];
|
|
201
|
+
return (
|
|
202
|
+
getStateHash(fingerprintState) === getStateHash(stored) &&
|
|
203
|
+
isSameState(fingerprintState, stored)
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
const findSuccessorWithFingerprint = (state: Value[], source: number, target: number) => {
|
|
207
|
+
const rebuilt = current.rebuilt;
|
|
208
|
+
rebuildFrom(state, depths[source]);
|
|
209
|
+
const successor = findTraceSuccessor(state, (candidate) =>
|
|
210
|
+
hasFingerprint(candidate.state, target),
|
|
211
|
+
);
|
|
212
|
+
current.rebuilt = rebuilt;
|
|
213
|
+
return successor;
|
|
214
|
+
};
|
|
194
215
|
const getPathStates = (path: number[], nextFailure: string) => {
|
|
195
216
|
const initial = captureOutput(() =>
|
|
196
217
|
isReducing || isImpure(environment)
|
|
@@ -205,16 +226,13 @@ export const createTraceBuilder = (context: TraceContext) => {
|
|
|
205
226
|
steps.push({ state: previous, action: "Stuttering" });
|
|
206
227
|
continue;
|
|
207
228
|
}
|
|
208
|
-
const
|
|
209
|
-
current.rebuilt = { state: previous, level: depths[path[position - 1]] };
|
|
210
|
-
const successor = findSuccessorWithFingerprint(previous, path[position]);
|
|
211
|
-
current.rebuilt = rebuilt;
|
|
229
|
+
const successor = findSuccessorWithFingerprint(previous, path[position - 1], path[position]);
|
|
212
230
|
if (!successor) throw new TlaEvaluationError(nextFailure);
|
|
213
231
|
steps.push(successor);
|
|
214
232
|
}
|
|
215
233
|
return steps;
|
|
216
234
|
};
|
|
217
|
-
const getTrace = (index: number, lastSuccessor?: Successor) => {
|
|
235
|
+
const getTrace = (index: number, lastSuccessor?: Successor, incomplete?: State) => {
|
|
218
236
|
const path: number[] = [];
|
|
219
237
|
for (let position = index; position !== -1; position = context.parents[position]) {
|
|
220
238
|
path.unshift(position);
|
|
@@ -226,7 +244,7 @@ export const createTraceBuilder = (context: TraceContext) => {
|
|
|
226
244
|
state: states[position],
|
|
227
245
|
action: context.actions[position],
|
|
228
246
|
}));
|
|
229
|
-
if (!lastSuccessor) return toTrace(steps, path);
|
|
247
|
+
if (!lastSuccessor) return toTrace(steps, path, { incomplete });
|
|
230
248
|
const action = isReducing
|
|
231
249
|
? findTraceSuccessor(states[index], (successor) =>
|
|
232
250
|
isSameState(successor.state, lastSuccessor.state),
|
|
@@ -234,34 +252,55 @@ export const createTraceBuilder = (context: TraceContext) => {
|
|
|
234
252
|
: lastSuccessor.action;
|
|
235
253
|
return toTrace([...steps, { state: lastSuccessor.state, action }], path, { known: 2 });
|
|
236
254
|
};
|
|
237
|
-
// TLCTrace#printTrace
|
|
238
|
-
const getStateTrace = (index: number): Behavior =>
|
|
239
|
-
context.parents[index]
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
255
|
+
// TLCTrace#printTrace applies the alias to every state but an initial one it prints without a successor.
|
|
256
|
+
const getStateTrace = (index: number, incomplete?: State): Behavior => {
|
|
257
|
+
if (context.parents[index] !== -1) return getTrace(index, undefined, incomplete);
|
|
258
|
+
const traceOutput = is174 ? [] : captureOutput(context.getInitialStates).lines;
|
|
259
|
+
const state = states[index];
|
|
260
|
+
if (incomplete !== undefined) {
|
|
261
|
+
return {
|
|
262
|
+
trace: toTrace([{ state, action: undefined }], [index], { incomplete }).trace,
|
|
263
|
+
traceOutput,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const step = { action: undefined, label: undefined, state: toRecord(state) };
|
|
267
|
+
const alias = config.alias;
|
|
268
|
+
if (alias !== undefined) {
|
|
269
|
+
context.tracedSteps.set(step, {
|
|
270
|
+
state: step.state,
|
|
271
|
+
action: undefined,
|
|
272
|
+
alias: getAliasState(alias, state, state, 1, () => [state]),
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return { trace: [step], traceOutput };
|
|
276
|
+
};
|
|
277
|
+
const getIncompleteStep = (
|
|
278
|
+
incomplete: State,
|
|
279
|
+
level: number,
|
|
280
|
+
step: Omit<TraceStep, "state">,
|
|
281
|
+
action: SpecAction | undefined,
|
|
282
|
+
): TraceStep => {
|
|
283
|
+
const state = toRecord(incomplete.map((value) => value ?? createModelValue("null")));
|
|
284
|
+
const alias = config.alias;
|
|
285
|
+
const traceStep = {
|
|
286
|
+
...step,
|
|
287
|
+
state:
|
|
288
|
+
alias === undefined ? state : getAliasState(alias, incomplete, incomplete, level, () => []),
|
|
289
|
+
};
|
|
290
|
+
context.tracedSteps.set(traceStep, { state, action });
|
|
291
|
+
return traceStep;
|
|
292
|
+
};
|
|
245
293
|
const getFailedTrace = (index: number, successor: Successor): Behavior => ({
|
|
246
294
|
trace: getTrace(index, successor).trace,
|
|
247
295
|
});
|
|
248
|
-
const getPathSteps = (path: number[]
|
|
249
|
-
const steps = getPathStates(path, NEXT_RECOVERY_FAILURE);
|
|
250
|
-
const lastState = steps[steps.length - 1].state;
|
|
251
|
-
const isClosed =
|
|
252
|
-
!isReducing ||
|
|
253
|
-
loopStart === undefined ||
|
|
254
|
-
loopStart === path.length - 1 ||
|
|
255
|
-
findSuccessorWithFingerprint(lastState, path[loopStart]) !== undefined;
|
|
256
|
-
if (!isClosed) throw new TlaEvaluationError(NEXT_RECOVERY_FAILURE);
|
|
257
|
-
return steps;
|
|
258
|
-
};
|
|
296
|
+
const getPathSteps = (path: number[]) => getPathStates(path, NEXT_RECOVERY_FAILURE);
|
|
259
297
|
return {
|
|
260
298
|
toTrace,
|
|
261
299
|
findStepAction,
|
|
262
300
|
findSuccessorWithFingerprint,
|
|
263
301
|
getTrace,
|
|
264
302
|
getStateTrace,
|
|
303
|
+
getIncompleteStep,
|
|
265
304
|
getFailedTrace,
|
|
266
305
|
getPathSteps,
|
|
267
306
|
};
|