tla-ts 0.0.10-dev.8aec06f77 → 0.0.10-dev.94c3dd828
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/deciders.cjs +37 -36
- package/dist/deciders.js +55 -54
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove.cjs +146 -58
- package/dist/prove.js +142 -54
- package/dist/run.cjs +45 -43
- package/dist/run.js +47 -45
- package/dist/transfer.cjs +39 -36
- package/dist/transfer.js +23 -20
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/src/ast.ts +3 -3
- package/src/check.ts +203 -33
- package/src/cli/tlapm.ts +261 -68
- package/src/dependencies.ts +23 -2
- package/src/errors.ts +1 -1
- package/src/exit-codes.ts +1 -0
- package/src/liveness-checker.ts +530 -201
- package/src/liveness.ts +47 -32
- package/src/obligations/anonymize.ts +2 -4
- package/src/obligations/index.ts +5 -3
- package/src/obligations/pragma.ts +2 -2
- package/src/parallel.ts +2 -2
- package/src/parser.ts +151 -42
- package/src/prover/deciders.ts +1 -8
- package/src/prover/isabelle/isar/attrib.ts +86 -45
- package/src/prover/isabelle/isar/context.ts +25 -22
- package/src/prover/isabelle/isar/induct.ts +2 -5
- package/src/prover/isabelle/isar/method.ts +5 -7
- package/src/prover/isabelle/isar/proof.ts +33 -16
- package/src/prover/isabelle/isar/rule-cases.ts +6 -14
- package/src/prover/isabelle/isar/theory.ts +16 -17
- package/src/prover/isabelle/isar/toplevel.ts +46 -52
- package/src/prover/isabelle/provers/classical.ts +1 -1
- package/src/prover/ocaml.ts +4 -1
- package/src/prover/prep/action.ts +1 -0
- package/src/prover/prep/methods.ts +50 -3
- package/src/prover/prep/normalize.ts +4 -1
- package/src/prover/prove.ts +58 -32
- package/src/prover/ptl/decide.ts +43 -63
- package/src/prover/smt/data.ts +51 -45
- package/src/prover/smt/encode.ts +1 -2
- package/src/prover/smt/rewrite.ts +1 -0
- package/src/prover/smt/solver/aig-tactic.ts +25 -15
- package/src/prover/smt/solver/arith-rewriter.ts +3 -5
- package/src/prover/smt/solver/asserted-formulas.ts +1 -1
- package/src/prover/smt/solver/ast-util.ts +3 -1
- package/src/prover/smt/solver/ast.ts +110 -152
- package/src/prover/smt/solver/bound-manager.ts +39 -28
- package/src/prover/smt/solver/bv-bound-chk.ts +2 -8
- package/src/prover/smt/solver/bv-rewriter.ts +14 -16
- package/src/prover/smt/solver/bv1-blast.ts +1 -9
- package/src/prover/smt/solver/cg-table.ts +19 -14
- package/src/prover/smt/solver/check-logic.ts +6 -1
- package/src/prover/smt/solver/context.ts +20 -10
- package/src/prover/smt/solver/demodulator.ts +2 -2
- package/src/prover/smt/solver/dependent-expr-state.ts +16 -0
- package/src/prover/smt/solver/distribute-forall.ts +1 -10
- package/src/prover/smt/solver/dom-simplify.ts +1 -1
- package/src/prover/smt/solver/dt2bv-tactic.ts +2 -7
- package/src/prover/smt/solver/e-matching.ts +6 -6
- package/src/prover/smt/solver/elim-uncnstr.ts +3 -14
- package/src/prover/smt/solver/enode.ts +15 -1
- package/src/prover/smt/solver/euf/array-internalize.ts +19 -8
- package/src/prover/smt/solver/euf/dt-solver.ts +19 -19
- package/src/prover/smt/solver/euf/egraph.ts +65 -32
- package/src/prover/smt/solver/euf/euf-solver.ts +35 -18
- package/src/prover/smt/solver/euf/fpa-solver.ts +37 -51
- package/src/prover/smt/solver/euf/mam.ts +6 -48
- package/src/prover/smt/solver/euf/q-ematch.ts +21 -94
- package/src/prover/smt/solver/euf/q-mbi.ts +4 -2
- package/src/prover/smt/solver/euf/q-model-fixer.ts +1 -1
- package/src/prover/smt/solver/euf/q-solver.ts +2 -0
- package/src/prover/smt/solver/euf/th-solver.ts +1 -1
- package/src/prover/smt/solver/factor.ts +1 -11
- package/src/prover/smt/solver/fd-solver.ts +1 -2
- package/src/prover/smt/solver/fm-tactic.ts +19 -13
- package/src/prover/smt/solver/fpa-rewriter.ts +3 -1
- package/src/prover/smt/solver/fpa2bv-converter.ts +10 -6
- package/src/prover/smt/solver/internalizer.ts +41 -2
- package/src/prover/smt/solver/lia2pb.ts +18 -4
- package/src/prover/smt/solver/lp/lar-solver.ts +1 -1
- package/src/prover/smt/solver/lp/nla-powers.ts +144 -107
- package/src/prover/smt/solver/lp/nla-transcendentals.ts +50 -17
- package/src/prover/smt/solver/macro-finder.ts +1 -1
- package/src/prover/smt/solver/mam-compiler.ts +13 -13
- package/src/prover/smt/solver/max-bv-sharing-tactic.ts +1 -11
- package/src/prover/smt/solver/maxcore.ts +4 -12
- package/src/prover/smt/solver/maxlex.ts +0 -7
- package/src/prover/smt/solver/maxsmt-base.ts +7 -0
- package/src/prover/smt/solver/mbp/mbp-arith.ts +2 -11
- package/src/prover/smt/solver/mbp/mbp-plugin.ts +9 -0
- package/src/prover/smt/solver/mbp/mbp-solve-plugin.ts +1 -9
- package/src/prover/smt/solver/model-evaluator.ts +9 -5
- package/src/prover/smt/solver/model-macro-solver.ts +3 -3
- package/src/prover/smt/solver/muz/dl-context.ts +57 -3
- package/src/prover/smt/solver/muz/dl-mk-coi-filter.ts +68 -20
- package/src/prover/smt/solver/muz/dl-mk-elim-term-ite.ts +7 -1
- package/src/prover/smt/solver/muz/dl-mk-rule-inliner.ts +39 -10
- package/src/prover/smt/solver/muz/dl-mk-slice.ts +76 -13
- package/src/prover/smt/solver/muz/dl-mk-subsumption-checker.ts +9 -2
- package/src/prover/smt/solver/muz/dl-rule-transformer.ts +0 -2
- package/src/prover/smt/solver/muz/dl-rule.ts +93 -29
- package/src/prover/smt/solver/muz/hnf.ts +6 -5
- package/src/prover/smt/solver/muz/horn-subsume-model-converter.ts +178 -0
- package/src/prover/smt/solver/muz/horn-tactic.ts +14 -3
- package/src/prover/smt/solver/muz/rule-properties.ts +194 -36
- package/src/prover/smt/solver/muz/spacer-context.ts +102 -84
- package/src/prover/smt/solver/muz/spacer-dl-interface.ts +15 -2
- package/src/prover/smt/solver/muz/spacer-pdr.ts +3 -3
- package/src/prover/smt/solver/muz/spacer-prop-solver.ts +2 -7
- package/src/prover/smt/solver/muz/spacer-util.ts +2 -2
- package/src/prover/smt/solver/muz/substitution.ts +88 -37
- package/src/prover/smt/solver/nlqsat.ts +2 -2
- package/src/prover/smt/solver/nlsat/algebraic.ts +1 -2
- package/src/prover/smt/solver/nlsat/explain.ts +5 -0
- package/src/prover/smt/solver/nlsat/solver.ts +36 -25
- package/src/prover/smt/solver/opt-context.ts +9 -8
- package/src/prover/smt/solver/opt-nlsat.ts +68 -58
- package/src/prover/smt/solver/opt-solver.ts +16 -7
- package/src/prover/smt/solver/optsmt.ts +12 -9
- package/src/prover/smt/solver/pattern-inference.ts +2 -2
- package/src/prover/smt/solver/pb-rewriter.ts +13 -13
- package/src/prover/smt/solver/poly-rewriter.ts +2 -2
- package/src/prover/smt/solver/probes.ts +1 -1
- package/src/prover/smt/solver/propagate-values.ts +4 -0
- package/src/prover/smt/solver/proto-model.ts +5 -5
- package/src/prover/smt/solver/purify-arith.ts +50 -15
- package/src/prover/smt/solver/qe-arith-plugin.ts +2 -1
- package/src/prover/smt/solver/qe-mbp.ts +13 -23
- package/src/prover/smt/solver/qe.ts +45 -53
- package/src/prover/smt/solver/qsat.ts +70 -90
- package/src/prover/smt/solver/quantifier-analyzer.ts +9 -9
- package/src/prover/smt/solver/quasi-macros.ts +9 -18
- package/src/prover/smt/solver/rational.ts +17 -0
- package/src/prover/smt/solver/recfun-decl-plugin.ts +33 -19
- package/src/prover/smt/solver/recfun-rewriter.ts +1 -1
- package/src/prover/smt/solver/rewriter-tpl.ts +6 -2
- package/src/prover/smt/solver/rewriter.ts +1 -1
- package/src/prover/smt/solver/sat/asymm-branch.ts +59 -46
- package/src/prover/smt/solver/sat/clause-use-list.ts +0 -6
- package/src/prover/smt/solver/sat/clause.ts +1 -3
- package/src/prover/smt/solver/sat/config.ts +3 -3
- package/src/prover/smt/solver/sat/consequences.ts +1 -1
- package/src/prover/smt/solver/sat/goal2sat.ts +1 -1
- package/src/prover/smt/solver/sat/inc-sat-solver.ts +4 -12
- package/src/prover/smt/solver/sat/model-converter.ts +1 -15
- package/src/prover/smt/solver/sat/pb-solver.ts +49 -23
- package/src/prover/smt/solver/sat/probing.ts +22 -19
- package/src/prover/smt/solver/sat/sat2goal.ts +9 -10
- package/src/prover/smt/solver/sat/simplifier.ts +15 -56
- package/src/prover/smt/solver/sat/solver.ts +20 -19
- package/src/prover/smt/solver/sat/watch-list.ts +7 -0
- package/src/prover/smt/solver/seq-decl-plugin.ts +7 -7
- package/src/prover/smt/solver/seq-derive.ts +6 -7
- package/src/prover/smt/solver/seq-eq-solver.ts +7 -7
- package/src/prover/smt/solver/seq-range-predicate.ts +14 -1
- package/src/prover/smt/solver/seq-re-rewriter.ts +1 -10
- package/src/prover/smt/solver/seq-re-util.ts +1 -2
- package/src/prover/smt/solver/seq-regex-bisim.ts +1 -1
- package/src/prover/smt/solver/seq-regex-live.ts +4 -4
- package/src/prover/smt/solver/seq-rewriter.ts +1 -4
- package/src/prover/smt/solver/smt-setup.ts +15 -9
- package/src/prover/smt/solver/smtlib-parser.ts +1174 -579
- package/src/prover/smt/solver/smtlib-script.ts +866 -728
- package/src/prover/smt/solver/tactic.ts +66 -14
- package/src/prover/smt/solver/theory-array.ts +25 -58
- package/src/prover/smt/solver/theory-bv.ts +13 -50
- package/src/prover/smt/solver/theory-fpa.ts +46 -78
- package/src/prover/smt/solver/theory-pb.ts +10 -6
- package/src/prover/smt/solver/theory-recfun.ts +2 -2
- package/src/prover/smt/solver/theory-seq-regex.ts +3 -6
- package/src/prover/smt/solver/theory-seq-solve.ts +5 -5
- package/src/prover/smt/solver/theory-seq-state.ts +6 -3
- package/src/prover/smt/solver/theory-seq.ts +32 -54
- package/src/prover/smt/solver/theory.ts +16 -1
- package/src/prover/smt/solver/tseitin-cnf.ts +3 -3
- package/src/prover/smt/solver/var-subst.ts +2 -2
- package/src/prover/smt/table.ts +3 -2
- package/src/prover/zenon/decide.ts +9 -11
- package/src/prover/zenon/node.ts +12 -11
- package/src/prover/zenon/tla/sets.ts +1 -1
- package/src/search.ts +131 -16
- package/src/successors.ts +1 -1
- package/src/symmetry.ts +2 -2
- package/src/tableau.ts +2 -2
- package/src/tlc/fingerprint.ts +81 -9
- package/src/tlc/summary.ts +29 -14
- package/src/typed-tier.ts +6535 -0
- package/src/prover/smt/solver/seq-regex-witness.ts +0 -100
package/dist/worker.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),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,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)),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
12
|
`)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,ne=(e,t)=>m([{location:_(t),message:e}]);var v=class extends d{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},y=class extends d{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const b=`This was a Java StackOverflowError. It was probably the result
|
package/dist/worker.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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,addInitialState:(e,n,r)=>o(()=>t.addInitialState(e,n,r)),addState:(e,n,r,i)=>o(()=>t.addState(e,n,r,i)),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,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)),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
12
|
`)}`,_=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,ne=(e,t)=>m([{location:_(t),message:e}]);var v=class extends d{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},y=class extends d{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const b=`This was a Java StackOverflowError. It was probably the result
|
package/package.json
CHANGED
package/src/ast.ts
CHANGED
|
@@ -42,7 +42,7 @@ interface IdentifierExpression {
|
|
|
42
42
|
resolution?: LocalResolution;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
interface ApplyExpression {
|
|
45
|
+
export interface ApplyExpression {
|
|
46
46
|
kind: "Apply";
|
|
47
47
|
operator: string;
|
|
48
48
|
spelling?: string;
|
|
@@ -118,7 +118,7 @@ interface CaseExpression {
|
|
|
118
118
|
location: SourceLocation;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
interface LetExpression {
|
|
121
|
+
export interface LetExpression {
|
|
122
122
|
kind: "Let";
|
|
123
123
|
definitions: Definition[];
|
|
124
124
|
instances?: Instance[];
|
|
@@ -186,7 +186,7 @@ interface TupleExpression {
|
|
|
186
186
|
location: SourceLocation;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
interface FunctionConstructionExpression {
|
|
189
|
+
export interface FunctionConstructionExpression {
|
|
190
190
|
kind: "FunctionConstruction";
|
|
191
191
|
bounds: Bound[];
|
|
192
192
|
body: Expression;
|
package/src/check.ts
CHANGED
|
@@ -109,6 +109,7 @@ import {
|
|
|
109
109
|
import { getFingerprintDistance, OUT_DEGREE_BUCKETS } from "./tlc/summary";
|
|
110
110
|
import { createActionRecord, createCounterExample } from "./tlc/tlcext-operators";
|
|
111
111
|
import type { TlcVersion } from "./tlc/version";
|
|
112
|
+
import { runTypedSearch, type TypedResult } from "./typed-tier";
|
|
112
113
|
import {
|
|
113
114
|
createCanonicalizer,
|
|
114
115
|
createModelValue,
|
|
@@ -148,6 +149,8 @@ export interface CheckOptions {
|
|
|
148
149
|
isTool?: boolean;
|
|
149
150
|
/** TLC's -continue: reports each violation through onProgress and goes on. */
|
|
150
151
|
isContinued?: boolean;
|
|
152
|
+
/** Skips fingerprintDistance, which takes fingerprinting every state again after the search. */
|
|
153
|
+
isFingerprintDistanceSkipped?: boolean;
|
|
151
154
|
moduleOperators?: ModuleOperator[];
|
|
152
155
|
/** TLC's trace exploration spec, and the binary trace TLC records for it unless -noTEBin. */
|
|
153
156
|
traceSpec?: TraceSpecOptions;
|
|
@@ -457,14 +460,15 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
457
460
|
const createSuccess = (): CheckResult => ({
|
|
458
461
|
...createResult("success"),
|
|
459
462
|
outDegrees: [...outDegrees],
|
|
460
|
-
fingerprintDistance:
|
|
461
|
-
|
|
462
|
-
runtime.generatedStates,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
463
|
+
fingerprintDistance: options.isFingerprintDistanceSkipped
|
|
464
|
+
? undefined
|
|
465
|
+
: getFingerprintDistance(runtime.distinctStates, runtime.generatedStates, (visit) =>
|
|
466
|
+
visit(
|
|
467
|
+
search
|
|
468
|
+
? search.getStoredFingerprints(states, fingerprintStates)
|
|
469
|
+
: BigInt64Array.from(states, runtime.getFingerprint),
|
|
470
|
+
),
|
|
471
|
+
),
|
|
468
472
|
});
|
|
469
473
|
|
|
470
474
|
const search = createSearch(
|
|
@@ -994,6 +998,22 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
994
998
|
addState(state, fingerprintState, -1, undefined);
|
|
995
999
|
return undefined;
|
|
996
1000
|
};
|
|
1001
|
+
// Looks a successor up, where the constraints keep it in the model, as the search does before it
|
|
1002
|
+
// checks the successor.
|
|
1003
|
+
const lookUpSuccessor = (state: Value[], successor: Successor) => {
|
|
1004
|
+
const fingerprintState = getFingerprintState(successor.state);
|
|
1005
|
+
const hash = getStateHash(fingerprintState);
|
|
1006
|
+
const foundIndex = findStateIndex(seenStates, hash, fingerprintState);
|
|
1007
|
+
const isStateInModel = search.satisfiesConstraints(successor.state, state);
|
|
1008
|
+
if (isStateInModel) search.trackStatePossible(successor.state);
|
|
1009
|
+
const isInModel = isStateInModel && search.satisfiesActionConstraints(state, successor.state);
|
|
1010
|
+
if (isInModel) {
|
|
1011
|
+
search.trackActionPossible(state, successor.state);
|
|
1012
|
+
fingerprintModelState(fingerprintState);
|
|
1013
|
+
successor.state.forEach(markFingerprinted);
|
|
1014
|
+
}
|
|
1015
|
+
return { fingerprintState, hash, isInModel, existing: isInModel ? foundIndex : -1 };
|
|
1016
|
+
};
|
|
997
1017
|
const visitSuccessor = (
|
|
998
1018
|
index: number,
|
|
999
1019
|
successor: Successor,
|
|
@@ -1006,27 +1026,16 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1006
1026
|
current.candidate = successor.state;
|
|
1007
1027
|
current.candidateLevel = depths[index] + 1;
|
|
1008
1028
|
if (isCanonicalizedFirst) canonicalizeState(successor.state);
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1011
|
-
const foundIndex = findStateIndex(seenStates, hash, fingerprintState);
|
|
1012
|
-
const isStateInModel = search.satisfiesConstraints(successor.state, state);
|
|
1013
|
-
if (isStateInModel) search.trackStatePossible(successor.state);
|
|
1014
|
-
const isInModel = isStateInModel && search.satisfiesActionConstraints(state, successor.state);
|
|
1015
|
-
if (isInModel) {
|
|
1016
|
-
search.trackActionPossible(state, successor.state);
|
|
1017
|
-
fingerprintModelState(fingerprintState);
|
|
1018
|
-
successor.state.forEach(markFingerprinted);
|
|
1019
|
-
}
|
|
1020
|
-
const existing = isInModel ? foundIndex : -1;
|
|
1021
|
-
if (source && isInModel) {
|
|
1029
|
+
const found = lookUpSuccessor(state, successor);
|
|
1030
|
+
if (source && found.isInModel) {
|
|
1022
1031
|
stateWriter?.writeSuccessor(
|
|
1023
1032
|
source,
|
|
1024
1033
|
getGraphState(successor.state, depths[index] + 1),
|
|
1025
|
-
existing !== -1,
|
|
1034
|
+
found.existing !== -1,
|
|
1026
1035
|
action && getGraphAction(action),
|
|
1027
1036
|
);
|
|
1028
1037
|
}
|
|
1029
|
-
if (source && !isInModel && options.dump?.constrained) {
|
|
1038
|
+
if (source && !found.isInModel && options.dump?.constrained) {
|
|
1030
1039
|
const excluded = getGraphState(successor.state, depths[index] + 1);
|
|
1031
1040
|
search
|
|
1032
1041
|
.getExcludingConstraints(state, successor.state)
|
|
@@ -1039,20 +1048,20 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1039
1048
|
),
|
|
1040
1049
|
);
|
|
1041
1050
|
}
|
|
1042
|
-
if (existing !== -1 && liveness) {
|
|
1043
|
-
const stored = states[existing];
|
|
1051
|
+
if (found.existing !== -1 && liveness) {
|
|
1052
|
+
const stored = states[found.existing];
|
|
1044
1053
|
const isStored = stored.every((value, position) => value === successor.state[position]);
|
|
1045
|
-
liveSuccessors.push({ index: existing, state: isStored ? stored : successor.state });
|
|
1054
|
+
liveSuccessors.push({ index: found.existing, state: isStored ? stored : successor.state });
|
|
1046
1055
|
}
|
|
1047
|
-
const isNew = isInModel && existing === -1;
|
|
1056
|
+
const isNew = found.isInModel && found.existing === -1;
|
|
1048
1057
|
if (isNew && liveness) liveSuccessors.push({ index: states.length, state: successor.state });
|
|
1049
|
-
unstoredFingerprint = isNew ? fingerprintState : undefined;
|
|
1058
|
+
unstoredFingerprint = isNew ? found.fingerprintState : undefined;
|
|
1050
1059
|
if (isNew) {
|
|
1051
1060
|
countDistinctState(depths[index] + 1);
|
|
1052
1061
|
newStateCount++;
|
|
1053
1062
|
if (coverage) coverage.secondary[coveredNode]++;
|
|
1054
1063
|
}
|
|
1055
|
-
if (existing === -1) {
|
|
1064
|
+
if (found.existing === -1) {
|
|
1056
1065
|
try {
|
|
1057
1066
|
const violated = search.findViolatedInvariant(successor.state, state);
|
|
1058
1067
|
const violation = violated && { name: violated.name, ...traces.getTrace(index, successor) };
|
|
@@ -1082,8 +1091,8 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1082
1091
|
if (!isNew) return undefined;
|
|
1083
1092
|
if (coverage) countCoverageVariables(coverage, successor.state);
|
|
1084
1093
|
if (!isCanonicalizedFirst) canonicalizeState(successor.state);
|
|
1085
|
-
markSeenState(seenStates, hash, states.length);
|
|
1086
|
-
addState(successor.state, fingerprintState, index, successor.action);
|
|
1094
|
+
markSeenState(seenStates, found.hash, states.length);
|
|
1095
|
+
addState(successor.state, found.fingerprintState, index, successor.action);
|
|
1087
1096
|
runtime.queueSize++;
|
|
1088
1097
|
return undefined;
|
|
1089
1098
|
};
|
|
@@ -1096,6 +1105,57 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1096
1105
|
const assumptionViolation = findViolatedAssumption();
|
|
1097
1106
|
if (assumptionViolation) return createResult("assumption-violation", assumptionViolation);
|
|
1098
1107
|
options.onProgress?.({ kind: "initial-states-started" });
|
|
1108
|
+
const typedChecks =
|
|
1109
|
+
!options.isContinued &&
|
|
1110
|
+
options.dump === undefined &&
|
|
1111
|
+
// A set of small integers on the tier is a 31-bit mask, which a lower bound could overflow.
|
|
1112
|
+
options.maxSetSize === undefined &&
|
|
1113
|
+
!hasPostconditions
|
|
1114
|
+
? search.getTypedChecks(liveness?.solutions)
|
|
1115
|
+
: undefined;
|
|
1116
|
+
const typed =
|
|
1117
|
+
typedChecks &&
|
|
1118
|
+
runTypedSearch(environment, {
|
|
1119
|
+
...typedChecks,
|
|
1120
|
+
isDeadlockChecked: config.checkDeadlock,
|
|
1121
|
+
isFingerprinted: !options.isFingerprintDistanceSkipped,
|
|
1122
|
+
livenessCheck: options.livenessCheck ?? "default",
|
|
1123
|
+
});
|
|
1124
|
+
if (typed && !typed.deadlock && !typed.violation && !typed.lasso) {
|
|
1125
|
+
for (let count = 2; count < typed.initialStates.generated; count *= 2) {
|
|
1126
|
+
reportInitialStatesProgress(count, options.onProgress);
|
|
1127
|
+
}
|
|
1128
|
+
options.onProgress?.({ kind: "initial-states-computed", initialStates: typed.initialStates });
|
|
1129
|
+
const statistics = {
|
|
1130
|
+
...createResult("success"),
|
|
1131
|
+
generatedStates: typed.generatedStates,
|
|
1132
|
+
distinctStates: typed.distinctStates,
|
|
1133
|
+
queuedStates: 0,
|
|
1134
|
+
depth: typed.generatedStates === 0 ? 0 : Math.max(typed.depth, 1),
|
|
1135
|
+
initialStates: typed.initialStates,
|
|
1136
|
+
};
|
|
1137
|
+
if (liveness && options.livenessCheck !== "off") {
|
|
1138
|
+
options.onProgress?.({
|
|
1139
|
+
kind: "liveness-started",
|
|
1140
|
+
branches: liveness.branches,
|
|
1141
|
+
isComplete: true,
|
|
1142
|
+
states: typed.distinctStates,
|
|
1143
|
+
statistics,
|
|
1144
|
+
});
|
|
1145
|
+
options.onProgress?.({ kind: "liveness-finished" });
|
|
1146
|
+
}
|
|
1147
|
+
return {
|
|
1148
|
+
...statistics,
|
|
1149
|
+
outDegrees: typed.outDegrees,
|
|
1150
|
+
fingerprintDistance: options.isFingerprintDistanceSkipped
|
|
1151
|
+
? undefined
|
|
1152
|
+
: getFingerprintDistance(
|
|
1153
|
+
typed.distinctStates,
|
|
1154
|
+
typed.generatedStates,
|
|
1155
|
+
typed.forEachFingerprintRun,
|
|
1156
|
+
),
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1099
1159
|
if (spec.init !== undefined) {
|
|
1100
1160
|
let overflowState: Value[] | undefined;
|
|
1101
1161
|
const reportInitialFailure = (error: unknown, state: Value[]) => {
|
|
@@ -1489,7 +1549,109 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1489
1549
|
periodic.time += performance.now() - now;
|
|
1490
1550
|
return lasso;
|
|
1491
1551
|
};
|
|
1492
|
-
|
|
1552
|
+
const adoptTypedSearch = (searched: TypedResult) => {
|
|
1553
|
+
runtime.generatedStates = searched.generatedStates;
|
|
1554
|
+
runtime.distinctStates = searched.distinctStates;
|
|
1555
|
+
runtime.queueSize = searched.queuedStates;
|
|
1556
|
+
runtime.diameter = searched.depth;
|
|
1557
|
+
searchDepth = searched.depth;
|
|
1558
|
+
outDegrees.splice(0, outDegrees.length, ...searched.outDegrees);
|
|
1559
|
+
newStateCount = 0;
|
|
1560
|
+
};
|
|
1561
|
+
// The tier found a state without successors, or a successor that violates an invariant or an
|
|
1562
|
+
// action property. The interpreter rebuilds the tier's path to it and reports it, as it would after
|
|
1563
|
+
// its own search.
|
|
1564
|
+
const path = typed?.deadlock ?? typed?.violation;
|
|
1565
|
+
const initialIndex = path ? states.findIndex((state) => path.isPathState(0, state)) : -1;
|
|
1566
|
+
if (typed && path && initialIndex !== -1) {
|
|
1567
|
+
const steps: { successor: Successor; action: SpecAction | undefined }[] = [];
|
|
1568
|
+
const getLastState = () => steps.at(-1)?.successor.state ?? states[initialIndex];
|
|
1569
|
+
for (let position = 1; position === steps.length + 1 && position < path.length; position++) {
|
|
1570
|
+
// The interpreter expands only the states it stores, which it has canonicalized.
|
|
1571
|
+
canonicalizeState(getLastState());
|
|
1572
|
+
forEachActionSuccessor(getLastState(), undefined, (successor, action) => {
|
|
1573
|
+
if (!path.isPathState(position, successor.state)) return false;
|
|
1574
|
+
steps.push({ successor, action });
|
|
1575
|
+
return true;
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
const isRebuilt = steps.length === path.length - 1;
|
|
1579
|
+
const violating = typed.violation && isRebuilt ? steps.pop() : undefined;
|
|
1580
|
+
if (violating && isCanonicalizedFirst) canonicalizeState(violating.successor.state);
|
|
1581
|
+
const violatedInvariant =
|
|
1582
|
+
violating && search.findViolatedInvariant(violating.successor.state, getLastState());
|
|
1583
|
+
const violatedProperty =
|
|
1584
|
+
violating &&
|
|
1585
|
+
!violatedInvariant &&
|
|
1586
|
+
search.findViolatedActionProperty(getLastState(), violating.successor.state);
|
|
1587
|
+
const violated = violatedInvariant ?? violatedProperty;
|
|
1588
|
+
const isDeadlocked =
|
|
1589
|
+
typed.deadlock !== undefined &&
|
|
1590
|
+
isRebuilt &&
|
|
1591
|
+
forEachActionSuccessor(getLastState(), undefined, () => true) === 0;
|
|
1592
|
+
if (isDeadlocked || violated) {
|
|
1593
|
+
const parent = { index: initialIndex };
|
|
1594
|
+
for (const step of steps) {
|
|
1595
|
+
visitSuccessor(parent.index, step.successor, [], undefined, step.action);
|
|
1596
|
+
parent.index = states.length - 1;
|
|
1597
|
+
}
|
|
1598
|
+
adoptTypedSearch(typed);
|
|
1599
|
+
Object.assign(current, { index: parent.index, candidate: undefined, isExpanding: true });
|
|
1600
|
+
if (violating && violated) {
|
|
1601
|
+
lookUpSuccessor(states[parent.index], violating.successor);
|
|
1602
|
+
current.candidate = violating.successor.state;
|
|
1603
|
+
current.candidateLevel = depths[parent.index] + 1;
|
|
1604
|
+
return withOutDegrees(
|
|
1605
|
+
reportViolation(violatedInvariant ? "invariant-violation" : "liveness-violation", {
|
|
1606
|
+
name: violated.name,
|
|
1607
|
+
...traces.getTrace(parent.index, violating.successor),
|
|
1608
|
+
}),
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
const result = expandState(parent.index, []);
|
|
1612
|
+
if (result) return result;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
// The tier found a behavior that violates a temporal property after its whole search. The
|
|
1616
|
+
// interpreter stores the paths to the lasso's states and reports it, as it would after its own.
|
|
1617
|
+
const lassoSteps = new Map<number, { successor: Successor; action: SpecAction | undefined }>();
|
|
1618
|
+
for (const entry of typed?.lasso?.states ?? []) {
|
|
1619
|
+
const initial = entry.parent === -1 ? states.find(entry.isState) : undefined;
|
|
1620
|
+
if (initial) {
|
|
1621
|
+
lassoSteps.set(entry.index, {
|
|
1622
|
+
successor: { state: initial, action: undefined },
|
|
1623
|
+
action: undefined,
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
const parent = lassoSteps.get(entry.parent)?.successor.state;
|
|
1627
|
+
if (!parent) continue;
|
|
1628
|
+
// The interpreter expands only the states it stores, which it has canonicalized.
|
|
1629
|
+
canonicalizeState(parent);
|
|
1630
|
+
forEachActionSuccessor(parent, undefined, (successor, action) => {
|
|
1631
|
+
if (!entry.isState(successor.state)) return false;
|
|
1632
|
+
lassoSteps.set(entry.index, { successor, action });
|
|
1633
|
+
return true;
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
const lassoIndexes = new Map<number, number>();
|
|
1637
|
+
const typedLasso =
|
|
1638
|
+
typed?.lasso && lassoSteps.size === typed.lasso.states.length ? typed.lasso : undefined;
|
|
1639
|
+
typedLasso?.states.forEach((entry) => {
|
|
1640
|
+
const step = lassoSteps.get(entry.index);
|
|
1641
|
+
const parent = lassoIndexes.get(entry.parent);
|
|
1642
|
+
if (step && parent !== undefined)
|
|
1643
|
+
visitSuccessor(parent, step.successor, [], undefined, step.action);
|
|
1644
|
+
lassoIndexes.set(
|
|
1645
|
+
entry.index,
|
|
1646
|
+
parent === undefined ? states.findIndex(entry.isState) : states.length - 1,
|
|
1647
|
+
);
|
|
1648
|
+
});
|
|
1649
|
+
if (typed && typedLasso) adoptTypedSearch(typed);
|
|
1650
|
+
for (
|
|
1651
|
+
let index = typedLasso ? states.length : 0;
|
|
1652
|
+
index < states.length && !runtime.isStopped;
|
|
1653
|
+
index++
|
|
1654
|
+
) {
|
|
1493
1655
|
current.index = index;
|
|
1494
1656
|
current.candidate = undefined;
|
|
1495
1657
|
runtime.queueSize = states.length - index - 1;
|
|
@@ -1534,7 +1696,15 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1534
1696
|
statistics: createResult("success"),
|
|
1535
1697
|
});
|
|
1536
1698
|
}
|
|
1537
|
-
const
|
|
1699
|
+
const getLassoIndexes = (indexes: number[]) =>
|
|
1700
|
+
indexes.map((index) => lassoIndexes.get(index) ?? -1);
|
|
1701
|
+
const lasso = typedLasso
|
|
1702
|
+
? {
|
|
1703
|
+
prefix: getLassoIndexes(typedLasso.prefix),
|
|
1704
|
+
cycle: getLassoIndexes(typedLasso.cycle),
|
|
1705
|
+
isCycleConstrained: typedLasso.isCycleConstrained,
|
|
1706
|
+
}
|
|
1707
|
+
: finalLiveness?.findViolation();
|
|
1538
1708
|
if (finalLiveness && lasso) return reportLasso(finalLiveness, lasso);
|
|
1539
1709
|
|
|
1540
1710
|
if (finalLiveness) options.onProgress?.({ kind: "liveness-finished" });
|