tla-ts 0.0.10-dev.28c823e4b → 0.0.10-dev.63a6693bd
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 +6 -6
- package/dist/compile.js +10 -10
- package/dist/deciders.cjs +29 -29
- package/dist/deciders.js +40 -40
- package/dist/index.cjs +1 -1
- 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 +54 -54
- package/dist/prove.js +52 -52
- package/dist/run.cjs +42 -42
- package/dist/run.js +44 -44
- package/dist/tlapm.cjs +2 -2
- package/dist/tlapm.js +2 -2
- package/dist/transfer.cjs +39 -39
- package/dist/transfer.js +41 -41
- package/dist/worker.cjs +4 -4
- package/dist/worker.js +4 -4
- package/package.json +1 -1
- package/src/ast.ts +44 -39
- package/src/builtins.ts +4 -13
- package/src/check-failure.ts +116 -0
- package/src/check-trace.ts +282 -0
- package/src/check.ts +152 -518
- package/src/cli/options.ts +6 -31
- package/src/cli/shared.ts +1 -1
- package/src/cli/tlapm.ts +14 -13
- package/src/cli/tlc-arguments.ts +222 -210
- package/src/cli/tlc-output.ts +687 -0
- package/src/cli/tlc-usage.ts +1 -1
- package/src/cli/tlc.ts +34 -701
- package/src/cli/xml-exporter.ts +23 -33
- package/src/codegen.ts +5 -10
- package/src/coverage.ts +3 -10
- package/src/dependencies.ts +8 -13
- package/src/dfid.ts +16 -16
- package/src/environment-config.ts +315 -0
- package/src/environment.ts +45 -333
- package/src/errors.ts +3 -2
- package/src/evaluate.ts +5 -4
- package/src/fingerprints.ts +65 -1
- package/src/instances.ts +47 -10
- package/src/java-hash.ts +7 -0
- package/src/json.ts +4 -7
- package/src/levels.ts +39 -42
- package/src/liveness-checker.ts +24 -37
- package/src/liveness.ts +47 -54
- package/src/obligations/action.ts +4 -11
- package/src/obligations/anonymize.ts +4 -2
- package/src/obligations/expression.ts +18 -2
- package/src/obligations/generate.ts +45 -38
- package/src/obligations/index.ts +2 -2
- package/src/obligations/module.ts +27 -38
- package/src/obligations/normalize.ts +2 -1
- package/src/obligations/simplify.ts +39 -44
- package/src/obligations/source.ts +47 -57
- package/src/obligations/temporal.ts +5 -5
- package/src/parallel-worker.ts +10 -30
- package/src/parallel.ts +22 -45
- package/src/parser.ts +19 -34
- package/src/prover/decide-pool.ts +3 -3
- package/src/prover/deciders.ts +3 -3
- package/src/prover/isabelle/encode.ts +1 -1
- package/src/prover/isabelle/isar/inner-syntax.ts +9 -4
- package/src/prover/isabelle/isar/method.ts +14 -25
- package/src/prover/isabelle/isar/theory.ts +11 -10
- package/src/prover/isabelle/isar/type-check.ts +6 -6
- package/src/prover/isabelle/provers/blast/blast.ts +7 -63
- package/src/prover/isabelle/provers/hypsubst.ts +17 -26
- package/src/prover/isabelle/pure/bicompose.ts +9 -25
- package/src/prover/isabelle/pure/conv.ts +2 -8
- package/src/prover/isabelle/pure/drule.ts +9 -2
- package/src/prover/isabelle/pure/logic.ts +1 -1
- package/src/prover/isabelle/pure/raw-simplifier.ts +4 -13
- package/src/prover/isabelle/pure/rewriter.ts +5 -9
- package/src/prover/isabelle/pure/table.ts +2 -1
- package/src/prover/isabelle/pure/tactical.ts +42 -35
- package/src/prover/isabelle/pure/thm.ts +14 -11
- package/src/prover/isabelle/tla/classical-setup.ts +17 -14
- package/src/prover/isabelle/tla/context.ts +7 -2
- package/src/prover/isabelle/tla/logic.ts +10 -21
- package/src/prover/isabelle/tla/simpdata.ts +1 -10
- package/src/prover/prep/action.ts +11 -19
- package/src/prover/prep/fingerprint.ts +2 -5
- package/src/prover/prep/methods.ts +24 -3
- package/src/prover/prove.ts +87 -64
- package/src/prover/smt/context.ts +1 -2
- package/src/prover/smt/data.ts +418 -406
- package/src/prover/smt/encode.ts +30 -18
- package/src/prover/smt/rewrite.ts +657 -626
- package/src/prover/smt/solver/ast.ts +0 -22
- package/src/prover/smt/solver/auf-solver.ts +2 -5
- package/src/prover/smt/solver/context.ts +3 -3
- package/src/prover/smt/solver/e-matching.ts +1 -1
- package/src/prover/smt/solver/expr-safe-replace.ts +1 -1
- package/src/prover/smt/solver/internalizer.ts +1 -2
- package/src/prover/smt/solver/lp/dioph-eq.ts +1 -8
- package/src/prover/smt/solver/lp/hnf-cutter.ts +1 -1
- package/src/prover/smt/solver/lp/nla-core.ts +2 -6
- package/src/prover/smt/solver/mam-compiler.ts +4 -2
- package/src/prover/smt/solver/model-checker.ts +1 -1
- package/src/prover/smt/solver/model-finder.ts +12 -17
- package/src/prover/smt/solver/model-macro-solver.ts +11 -19
- package/src/prover/smt/solver/nlsat/algebraic.ts +9 -9
- package/src/prover/smt/solver/nlsat/atoms.ts +20 -4
- package/src/prover/smt/solver/nlsat/explain.ts +7 -22
- package/src/prover/smt/solver/nlsat/levelwise.ts +1 -6
- package/src/prover/smt/solver/nlsat/polynomial.ts +12 -3
- package/src/prover/smt/solver/nlsat/solver.ts +12 -24
- package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +1 -1
- package/src/prover/smt/solver/proto-model.ts +0 -4
- package/src/prover/smt/solver/quantifier-analyzer.ts +10 -10
- package/src/prover/smt/solver/quantifier-manager.ts +1 -5
- package/src/prover/smt/solver/smtlib-parser.ts +78 -94
- package/src/prover/smt/solver/theory-lra-bounds.ts +1 -2
- package/src/prover/smt/solver/theory-lra-internalize.ts +5 -16
- package/src/prover/tlapm/cache.ts +28 -18
- package/src/prover/tlapm/tlapm.ts +15 -9
- package/src/prover/verdict.ts +7 -0
- package/src/prover/zenon/check/check.ts +1 -2
- package/src/prover/zenon/check/records.ts +1 -1
- package/src/prover/zenon/check/relations.ts +2 -1
- package/src/prover/zenon/check/rewrites.ts +2 -15
- package/src/prover/zenon/check/sets.ts +40 -58
- package/src/prover/zenon/check/terms.ts +1 -2
- package/src/prover/zenon/eqrel.ts +2 -0
- package/src/prover/zenon/expr.ts +7 -0
- package/src/prover/zenon/index-table.ts +9 -19
- package/src/prover/zenon/isar.ts +35 -35
- package/src/prover/zenon/llproof.ts +2 -11
- package/src/prover/zenon/mltoll.ts +12 -28
- package/src/prover/zenon/parse.ts +3 -6
- package/src/prover/zenon/search.ts +4 -14
- package/src/prover/zenon/tla/functions.ts +2 -2
- package/src/prover/zenon/tla/llproof.ts +9 -11
- package/src/prover/zenon/tla/records.ts +1 -6
- package/src/prover/zenon/tla/sets.ts +15 -14
- package/src/prover/zenon/tla/tla.ts +7 -6
- package/src/resolve.ts +55 -72
- package/src/sany/generation.ts +394 -0
- package/src/sany/generator-def-entries.ts +210 -0
- package/src/sany/generator-definitions.ts +686 -0
- package/src/sany/generator-expressions.ts +1100 -0
- package/src/sany/generator-proofs.ts +662 -0
- package/src/sany/generator.ts +155 -2625
- package/src/sany/lexer.ts +17 -16
- package/src/sany/nodes.ts +6 -13
- package/src/sany/report.ts +3 -6
- package/src/sany/selectors.ts +35 -38
- package/src/sany/xml.ts +23 -55
- package/src/search.ts +65 -27
- package/src/simulate.ts +157 -133
- package/src/spec-description.ts +33 -48
- package/src/standard-modules.ts +16 -32
- package/src/state-graph.ts +2 -7
- package/src/substitution-levels.ts +5 -4
- package/src/successors.ts +5 -7
- package/src/tlc/messages.ts +20 -15
- package/src/tlc/order.ts +2 -9
- package/src/tlc/random.ts +4 -4
- package/src/tlc/replay.ts +8 -15
- package/src/tlc/tlc-operators.ts +2 -3
- package/src/tlc/trace-spec.ts +25 -45
- package/src/typescript/actions.ts +2 -4
- package/src/typescript/collections.ts +34 -20
- package/src/typescript/compile.ts +1 -3
- package/src/typescript/formula.ts +5 -3
- package/src/typescript/model.ts +4 -5
- package/src/typescript/steps.ts +20 -18
- package/src/values.ts +63 -158
package/dist/worker.cjs
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
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`),
|
|
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`),d=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var f=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},p=class extends f{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},m=class extends p{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},ee=class extends m{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const h=(e,t=!1,n,r=[])=>new p(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}),g=(e,t)=>h([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),_=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
|
|
12
|
-
`)}`,v=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,y=(e,t)=>h([{location:v(t),message:e}]);var b=class extends
|
|
12
|
+
`)}`,v=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,y=(e,t)=>h([{location:v(t),message:e}]);var b=class extends f{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},x=class extends f{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const S=`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 C=class extends x{constructor(){super(S)}};const w=()=>i(new C,e.error);var T=class extends x{},E=class extends x{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},D=class extends x{variable;constructor(e,t){super(e),this.variable=t}},O=class extends x{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},k=class extends x{constructor(t){super(t),i(this,e.error)}},A=class extends T{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},j=class extends x{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},M=class extends x{},N=class extends x{};const P=`Too many possible next states for the last state in the trace.`;var F=class extends x{constructor(){super(P)}},I=class extends x{code;constructor(e,t){super(t),this.code=e}},L=class extends x{
|
|
15
|
+
to an element in its putative domain.`;var C=class extends x{constructor(){super(S)}};const w=()=>i(new C,e.error);var T=class extends x{},E=class extends x{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},D=class extends x{variable;constructor(e,t){super(e),this.variable=t}},O=class extends x{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},k=class extends x{constructor(t){super(t),i(this,e.error)}},A=class extends T{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},j=class extends x{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},M=class extends x{},N=class extends x{};const P=`Too many possible next states for the last state in the trace.`;var F=class extends x{constructor(){super(P)}},I=class extends x{code;constructor(e,t){super(t),this.code=e}},L=class extends x{state;constructor(e){super(`current state is not a legal state`),this.state=e}},R=class extends f{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)})`}},te=class extends R{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},z=class extends f{constructor(e,t){super(e,t),this.name=`TlaProverError`}},B=class extends f{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},V=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const H=(e,t)=>e instanceof V&&e.exception===t;var U=class extends f{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},W=class extends f{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},G=class extends f{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},K=class extends f{constructor(e){super(e),this.name=`SmtInvariantError`}},q=class extends f{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},J=class extends f{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},Y=class extends f{constructor(e,t){super(e,t),this.name=`SmtParseError`}},X=class extends U{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const Z=t=>a(t)??(t instanceof p?e.specParseError:t instanceof b?e.configParseError:t instanceof x?e.specEvaluationFailure:e.error);var Q=class extends f{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},ne=class extends f{constructor(e){super(e),this.name=`PcalRuntimeError`}},re=class extends f{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`}},ie=class extends f{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 $=`node:worker_threads`,ae=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,oe=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
18
|
$))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},se=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
@@ -21,4 +21,4 @@ $))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.po
|
|
|
21
21
|
$)).parentPort,ce=()=>{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 H}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return U}});
|
package/dist/worker.js
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
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`),
|
|
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`),d=e=>e instanceof RangeError&&e.message===`Maximum call stack size exceeded`||e instanceof SyntaxError&&e.message.endsWith(`: Stack overflow`);var f=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`TlaError`}},p=class extends f{failure;sany;constructor(e,t,n,r){super(e,t),this.name=`TlaSyntaxError`,this.failure=n,this.sany=r}},m=class extends p{location;parseError;constructor(e,t,n){super(e),this.location=t,this.parseError=n}},ee=class extends m{constructor(e,t,n=!0){super(`Cannot find source file for module ${e} imported in module ${t}.`,n?t:void 0)}};const h=(e,t=!1,n,r=[])=>new p(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}),g=(e,t)=>h([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),_=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
|
|
12
|
-
`)}`,v=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,y=(e,t)=>h([{location:v(t),message:e}]);var b=class extends
|
|
12
|
+
`)}`,v=e=>`line ${e.start.line}, col ${e.start.column} to line ${e.end.line}, col ${e.end.column} of module ${e.module}`,y=(e,t)=>h([{location:v(t),message:e}]);var b=class extends f{constructor(e,t){super(e,t),this.name=`TlaConfigError`}},x=class extends f{constructor(e,t){super(e,t),this.name=`TlaEvaluationError`}};const S=`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 C=class extends x{constructor(){super(S)}};const w=()=>i(new C,e.error);var T=class extends x{},E=class extends x{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},D=class extends x{variable;constructor(e,t){super(e),this.variable=t}},O=class extends x{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},k=class extends x{constructor(t){super(t),i(this,e.error)}},A=class extends T{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},j=class extends x{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},M=class extends x{},N=class extends x{};const P=`Too many possible next states for the last state in the trace.`;var F=class extends x{constructor(){super(P)}},I=class extends x{code;constructor(e,t){super(t),this.code=e}},L=class extends x{
|
|
15
|
+
to an element in its putative domain.`;var C=class extends x{constructor(){super(S)}};const w=()=>i(new C,e.error);var T=class extends x{},E=class extends x{state;action;variables;constructor(e,t,n,r){super(e),this.state=t,this.action=n,this.variables=r}},D=class extends x{variable;constructor(e,t){super(e),this.variable=t}},O=class extends x{exitCode;constructor(t,n=e.error){super(t),this.exitCode=n}},k=class extends x{constructor(t){super(t),i(this,e.error)}},A=class extends T{constructor(){super(`PickSuccessor reached the end of standard input without an answer whether to extend the behavior.`)}},j=class extends x{constructor(t){super(`The directory ${t} holds no checkpoint to recover from.`),i(this,e.error)}},M=class extends x{},N=class extends x{};const P=`Too many possible next states for the last state in the trace.`;var F=class extends x{constructor(){super(P)}},I=class extends x{code;constructor(e,t){super(t),this.code=e}},L=class extends x{state;constructor(e){super(`current state is not a legal state`),this.state=e}},R=class extends f{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)})`}},te=class extends R{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},z=class extends f{constructor(e,t){super(e,t),this.name=`TlaProverError`}},B=class extends f{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},V=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const H=(e,t)=>e instanceof V&&e.exception===t;var U=class extends f{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},W=class extends f{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},G=class extends f{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},K=class extends f{constructor(e){super(e),this.name=`SmtInvariantError`}},q=class extends f{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},J=class extends f{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},Y=class extends f{constructor(e,t){super(e,t),this.name=`SmtParseError`}},X=class extends U{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const Z=t=>a(t)??(t instanceof p?e.specParseError:t instanceof b?e.configParseError:t instanceof x?e.specEvaluationFailure:e.error);var Q=class extends f{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},ne=class extends f{constructor(e){super(e),this.name=`PcalRuntimeError`}},re=class extends f{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`}},ie=class extends f{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 $=`node:worker_threads`,ae=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,oe=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
18
|
$))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},se=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
|
|
@@ -21,4 +21,4 @@ $))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.po
|
|
|
21
21
|
$)).parentPort,ce=()=>{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{H as $,z as A,I as B,E as C,ee as D,j as E,F,g as G,te as H,ie as I,w as J,h as K,D as L,N as M,C as N,O,p as P,c as Q,T as R,L as S,X as T,u as U,B as V,l as W,_ as X,v as Y,Z,b as _,q as a,s as at,x as b,ne as c,G as d,d as et,K as f,M as g,P as h,oe as i,i as it,m as j,R as k,J as l,W as m,se as n,a as nt,re as o,Y as p,y as q,ae as r,n as rt,Q as s,ce as t,e as tt,S as u,A as v,V as w,k as x,f as y,U as z};
|
package/package.json
CHANGED
package/src/ast.ts
CHANGED
|
@@ -27,13 +27,13 @@ export interface DecimalExpression {
|
|
|
27
27
|
location: SourceLocation;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
interface StringExpression {
|
|
31
31
|
kind: "String";
|
|
32
32
|
value: string;
|
|
33
33
|
location: SourceLocation;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
interface IdentifierExpression {
|
|
37
37
|
kind: "Identifier";
|
|
38
38
|
name: string;
|
|
39
39
|
spelling?: string;
|
|
@@ -42,7 +42,7 @@ export interface IdentifierExpression {
|
|
|
42
42
|
resolution?: LocalResolution;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
interface ApplyExpression {
|
|
46
46
|
kind: "Apply";
|
|
47
47
|
operator: string;
|
|
48
48
|
spelling?: string;
|
|
@@ -55,14 +55,14 @@ export interface ApplyExpression {
|
|
|
55
55
|
resolution?: LocalResolution;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
interface OperatorReferenceExpression {
|
|
59
59
|
kind: "OperatorReference";
|
|
60
60
|
operator: string;
|
|
61
61
|
spelling?: string;
|
|
62
62
|
location: SourceLocation;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
interface LambdaExpression {
|
|
66
66
|
kind: "Lambda";
|
|
67
67
|
params: string[];
|
|
68
68
|
paramRanges?: SourceRange[];
|
|
@@ -71,7 +71,7 @@ export interface LambdaExpression {
|
|
|
71
71
|
location: SourceLocation;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
interface JunctionExpression {
|
|
75
75
|
kind: "And" | "Or";
|
|
76
76
|
operands: Expression[];
|
|
77
77
|
isBulleted?: boolean;
|
|
@@ -79,25 +79,25 @@ export interface JunctionExpression {
|
|
|
79
79
|
location: SourceLocation;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
interface PrimeExpression {
|
|
83
83
|
kind: "Prime";
|
|
84
84
|
expression: Expression;
|
|
85
85
|
location: SourceLocation;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
interface UnchangedExpression {
|
|
89
89
|
kind: "Unchanged";
|
|
90
90
|
expression: Expression;
|
|
91
91
|
location: SourceLocation;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
interface EnabledExpression {
|
|
95
95
|
kind: "Enabled";
|
|
96
96
|
expression: Expression;
|
|
97
97
|
location: SourceLocation;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
interface IfExpression {
|
|
101
101
|
kind: "If";
|
|
102
102
|
condition: Expression;
|
|
103
103
|
consequent: Expression;
|
|
@@ -110,7 +110,7 @@ export interface CaseArm {
|
|
|
110
110
|
body: Expression;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
interface CaseExpression {
|
|
114
114
|
kind: "Case";
|
|
115
115
|
arms: CaseArm[];
|
|
116
116
|
other: Expression | undefined;
|
|
@@ -118,7 +118,7 @@ export interface CaseExpression {
|
|
|
118
118
|
location: SourceLocation;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
interface LetExpression {
|
|
122
122
|
kind: "Let";
|
|
123
123
|
definitions: Definition[];
|
|
124
124
|
instances?: Instance[];
|
|
@@ -142,7 +142,7 @@ export interface QuantifierExpression {
|
|
|
142
142
|
location: SourceLocation;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
interface UnboundedQuantifierExpression {
|
|
146
146
|
kind: "UnboundedQuantifier";
|
|
147
147
|
quantifier: "Forall" | "Exists";
|
|
148
148
|
names: string[];
|
|
@@ -152,7 +152,7 @@ export interface UnboundedQuantifierExpression {
|
|
|
152
152
|
location: SourceLocation;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
interface ChooseExpression {
|
|
156
156
|
kind: "Choose";
|
|
157
157
|
pattern: BoundPattern;
|
|
158
158
|
set: Expression | undefined;
|
|
@@ -160,33 +160,33 @@ export interface ChooseExpression {
|
|
|
160
160
|
location: SourceLocation;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
interface SetEnumerationExpression {
|
|
164
164
|
kind: "SetEnumeration";
|
|
165
165
|
elements: Expression[];
|
|
166
166
|
location: SourceLocation;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
interface SetFilterExpression {
|
|
170
170
|
kind: "SetFilter";
|
|
171
171
|
bound: Bound;
|
|
172
172
|
predicate: Expression;
|
|
173
173
|
location: SourceLocation;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
interface SetMapExpression {
|
|
177
177
|
kind: "SetMap";
|
|
178
178
|
expression: Expression;
|
|
179
179
|
bounds: Bound[];
|
|
180
180
|
location: SourceLocation;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
interface TupleExpression {
|
|
184
184
|
kind: "Tuple";
|
|
185
185
|
elements: Expression[];
|
|
186
186
|
location: SourceLocation;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
interface FunctionConstructionExpression {
|
|
190
190
|
kind: "FunctionConstruction";
|
|
191
191
|
bounds: Bound[];
|
|
192
192
|
body: Expression;
|
|
@@ -194,7 +194,7 @@ export interface FunctionConstructionExpression {
|
|
|
194
194
|
isRecursive?: boolean;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
interface FunctionSetExpression {
|
|
198
198
|
kind: "FunctionSet";
|
|
199
199
|
domain: Expression;
|
|
200
200
|
range: Expression;
|
|
@@ -207,7 +207,7 @@ export interface RecordField {
|
|
|
207
207
|
location: SourceLocation;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
interface RecordExpression {
|
|
211
211
|
kind: "Record" | "RecordSet";
|
|
212
212
|
fields: RecordField[];
|
|
213
213
|
location: SourceLocation;
|
|
@@ -222,58 +222,58 @@ interface ExceptUpdate {
|
|
|
222
222
|
value: Expression;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
interface ExceptExpression {
|
|
226
226
|
kind: "Except";
|
|
227
227
|
function: Expression;
|
|
228
228
|
updates: ExceptUpdate[];
|
|
229
229
|
location: SourceLocation;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
interface ExceptAtExpression {
|
|
233
233
|
kind: "ExceptAt";
|
|
234
234
|
location: SourceLocation;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
interface FunctionApplicationExpression {
|
|
238
238
|
kind: "FunctionApplication";
|
|
239
239
|
function: Expression;
|
|
240
240
|
args: Expression[];
|
|
241
241
|
location: SourceLocation;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
interface BracketExpression {
|
|
245
245
|
kind: "Bracket";
|
|
246
246
|
args: Expression[];
|
|
247
247
|
location: SourceLocation;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
interface FieldAccessExpression {
|
|
251
251
|
kind: "FieldAccess";
|
|
252
252
|
record: Expression;
|
|
253
253
|
field: string;
|
|
254
254
|
location: SourceLocation;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
interface ProductExpression {
|
|
258
258
|
kind: "Product";
|
|
259
259
|
factors: Expression[];
|
|
260
260
|
location: SourceLocation;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
interface TemporalExpression {
|
|
264
264
|
kind: "Always" | "Eventually";
|
|
265
265
|
expression: Expression;
|
|
266
266
|
location: SourceLocation;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
|
|
269
|
+
interface ActionExpression {
|
|
270
270
|
kind: "BoxAction" | "AngleAction";
|
|
271
271
|
action: Expression;
|
|
272
272
|
subscript: Expression;
|
|
273
273
|
location: SourceLocation;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
interface FairnessExpression {
|
|
277
277
|
kind: "WeakFairness" | "StrongFairness";
|
|
278
278
|
subscript: Expression;
|
|
279
279
|
action: Expression;
|
|
@@ -298,7 +298,7 @@ export type Selector =
|
|
|
298
298
|
| { kind: "At" }
|
|
299
299
|
| { kind: "Colon" };
|
|
300
300
|
|
|
301
|
-
|
|
301
|
+
interface SubexpressionExpression {
|
|
302
302
|
kind: "Subexpression";
|
|
303
303
|
selectors: Selector[];
|
|
304
304
|
selectorRanges?: SourceRange[];
|
|
@@ -517,6 +517,11 @@ export interface Module {
|
|
|
517
517
|
units: ModuleUnit[];
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
+
export const getDefinitionExpressions = (definition: Definition) =>
|
|
521
|
+
definition.kind === "Function"
|
|
522
|
+
? [...definition.bounds.map((bound) => bound.set), definition.body]
|
|
523
|
+
: [definition.body];
|
|
524
|
+
|
|
520
525
|
export const getChildren = (expression: Expression): Expression[] => {
|
|
521
526
|
switch (expression.kind) {
|
|
522
527
|
case "Number":
|
|
@@ -547,14 +552,7 @@ export const getChildren = (expression: Expression): Expression[] => {
|
|
|
547
552
|
...(expression.other ? [expression.other] : []),
|
|
548
553
|
];
|
|
549
554
|
case "Let":
|
|
550
|
-
return [
|
|
551
|
-
...expression.definitions.flatMap((definition) =>
|
|
552
|
-
definition.kind === "Function"
|
|
553
|
-
? [...definition.bounds.map((bound) => bound.set), definition.body]
|
|
554
|
-
: [definition.body],
|
|
555
|
-
),
|
|
556
|
-
expression.body,
|
|
557
|
-
];
|
|
555
|
+
return [...expression.definitions.flatMap(getDefinitionExpressions), expression.body];
|
|
558
556
|
case "Forall":
|
|
559
557
|
case "Exists":
|
|
560
558
|
return [...expression.bounds.map((bound) => bound.set), expression.body];
|
|
@@ -605,6 +603,13 @@ export const getChildren = (expression: Expression): Expression[] => {
|
|
|
605
603
|
}
|
|
606
604
|
};
|
|
607
605
|
|
|
606
|
+
export const getReferencedName = (expression: Expression) => {
|
|
607
|
+
if (expression.kind === "Identifier") return expression.name;
|
|
608
|
+
if (expression.kind === "Apply" || expression.kind === "OperatorReference")
|
|
609
|
+
return expression.operator;
|
|
610
|
+
return undefined;
|
|
611
|
+
};
|
|
612
|
+
|
|
608
613
|
export const isLocallyResolved = (expression: Expression) =>
|
|
609
614
|
(expression.kind === "Identifier" || expression.kind === "Apply") &&
|
|
610
615
|
expression.resolution?.kind === "Local";
|
package/src/builtins.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TlaEndOfInputError,
|
|
3
|
-
TlaEvaluationError,
|
|
4
|
-
TlaModuleError,
|
|
5
|
-
TlaNullPointerError,
|
|
6
|
-
} from "./errors";
|
|
1
|
+
import { TlaEndOfInputError, TlaEvaluationError, TlaModuleError } from "./errors";
|
|
7
2
|
import type { Builtin, BuiltinArgument, Context, OperatorValue } from "./evaluate";
|
|
8
3
|
import {
|
|
9
4
|
formatValue,
|
|
@@ -224,11 +219,10 @@ export const getJavaClassName = (value: Value) => {
|
|
|
224
219
|
|
|
225
220
|
export const getKindString = (value: Value) => KIND_STRINGS[getJavaClassName(value)];
|
|
226
221
|
|
|
227
|
-
const getJavaOverrideMessage = (signature: string, message: string) =>
|
|
228
|
-
`Attempted to apply the operator overridden by the Java method\n${signature},\nbut it produced the following error:\n${message}`;
|
|
229
|
-
|
|
230
222
|
const createJavaOverrideError = (signature: string, message: string) =>
|
|
231
|
-
new TlaEvaluationError(
|
|
223
|
+
new TlaEvaluationError(
|
|
224
|
+
`Attempted to apply the operator overridden by the Java method\n${signature},\nbut it produced the following error:\n${message}`,
|
|
225
|
+
);
|
|
232
226
|
|
|
233
227
|
export const overrideWithJava = (builtin: Builtin, signature: string): Builtin => {
|
|
234
228
|
const reportAsJavaFailure =
|
|
@@ -246,9 +240,6 @@ export const overrideWithJava = (builtin: Builtin, signature: string): Builtin =
|
|
|
246
240
|
const isWrapped =
|
|
247
241
|
builtin.isLazy === true || !(error instanceof TlaModuleError) || isFingerprinted;
|
|
248
242
|
if (!isWrapped) throw error;
|
|
249
|
-
if (builtin.isLazy !== true && error instanceof TlaNullPointerError) {
|
|
250
|
-
throw new TlaModuleError(getJavaOverrideMessage(signature, error.message));
|
|
251
|
-
}
|
|
252
243
|
throw createJavaOverrideError(signature, error.message);
|
|
253
244
|
}
|
|
254
245
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Expression } from "./ast";
|
|
2
|
+
import { getErrorExitCode, isStackOverflow, TlaEvaluationError, TlaModuleError } from "./errors";
|
|
3
|
+
import {
|
|
4
|
+
createTracingEnvironment,
|
|
5
|
+
type CallStack,
|
|
6
|
+
type Environment,
|
|
7
|
+
type FingerprintFailure,
|
|
8
|
+
} from "./evaluate";
|
|
9
|
+
import { EXIT_STATUS, getExitCode, getMessageExitStatus } from "./exit-codes";
|
|
10
|
+
import { getCodedMessage, type FailureMessage } from "./tlc/messages";
|
|
11
|
+
import { getFingerprintError, getHeldValues, markFingerprinted, type Value } from "./values";
|
|
12
|
+
|
|
13
|
+
export interface ReplayFailure {
|
|
14
|
+
callStack: Expression[];
|
|
15
|
+
fingerprint: FingerprintFailure | undefined;
|
|
16
|
+
replayError?: TlaEvaluationError;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface FailureOptions {
|
|
20
|
+
/** What TLC was doing: "behavior-graph" is a failed next state whose call stack comes from adding the state to the behavior graph, "liveness" a failed liveness check. */
|
|
21
|
+
phase?: "initial" | "next" | "behavior-graph" | "liveness";
|
|
22
|
+
initialState?: Value[];
|
|
23
|
+
outDegrees?: number[];
|
|
24
|
+
callStack?: Expression[];
|
|
25
|
+
fingerprint?: FingerprintFailure;
|
|
26
|
+
replayError?: TlaEvaluationError;
|
|
27
|
+
traceFailure?: FailureMessage;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const getInitialExitCode = (error: TlaEvaluationError) => {
|
|
31
|
+
const coded = getCodedMessage(error.message);
|
|
32
|
+
return coded &&
|
|
33
|
+
!coded.isEvalException &&
|
|
34
|
+
getMessageExitStatus(coded.code) === EXIT_STATUS.configParseError
|
|
35
|
+
? EXIT_STATUS.configParseError
|
|
36
|
+
: getErrorExitCode(error);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getReplayExitCode = (error: TlaEvaluationError): number => {
|
|
40
|
+
const inner = error.cause;
|
|
41
|
+
if (inner instanceof TlaEvaluationError) return getReplayExitCode(inner);
|
|
42
|
+
return error instanceof TlaModuleError ? error.exitCode : EXIT_STATUS.specEvaluationFailure;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const getFailureExitCode = (
|
|
46
|
+
error: TlaEvaluationError,
|
|
47
|
+
failureOptions: FailureOptions,
|
|
48
|
+
is174: boolean,
|
|
49
|
+
) => {
|
|
50
|
+
const isReplayed = failureOptions.callStack !== undefined;
|
|
51
|
+
switch (failureOptions.phase) {
|
|
52
|
+
case "initial":
|
|
53
|
+
if (isReplayed) return EXIT_STATUS.specEvaluationFailure;
|
|
54
|
+
return is174 ? EXIT_STATUS.success : getInitialExitCode(error);
|
|
55
|
+
case "behavior-graph":
|
|
56
|
+
return (
|
|
57
|
+
getExitCode(error) ?? (error instanceof TlaModuleError ? error.exitCode : EXIT_STATUS.error)
|
|
58
|
+
);
|
|
59
|
+
case "liveness":
|
|
60
|
+
return getErrorExitCode(error);
|
|
61
|
+
default:
|
|
62
|
+
if (!isReplayed) return getErrorExitCode(error);
|
|
63
|
+
return failureOptions.fingerprint
|
|
64
|
+
? EXIT_STATUS.specEvaluationFailure
|
|
65
|
+
: getReplayExitCode(failureOptions.replayError ?? error);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const getReplayFailure = (
|
|
70
|
+
environment: Environment,
|
|
71
|
+
replay: (tracing: Environment) => void,
|
|
72
|
+
): ReplayFailure | undefined => {
|
|
73
|
+
const tracing = createTracingEnvironment(environment);
|
|
74
|
+
const callStack = tracing.callStack;
|
|
75
|
+
try {
|
|
76
|
+
replay(tracing);
|
|
77
|
+
return undefined;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (isStackOverflow(error)) return { callStack: [], fingerprint: undefined };
|
|
80
|
+
if (!(error instanceof TlaEvaluationError) || !callStack) return undefined;
|
|
81
|
+
return {
|
|
82
|
+
callStack: callStack.expressions,
|
|
83
|
+
fingerprint: callStack.fingerprint,
|
|
84
|
+
replayError: error,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const findFailedSources = (value: Value, sources: CallStack["sources"]): Expression[] => {
|
|
90
|
+
if (typeof value !== "object") return [];
|
|
91
|
+
const source = sources.get(value);
|
|
92
|
+
const failed = getHeldValues(value).find((held) => getFingerprintError(held) !== undefined);
|
|
93
|
+
return [
|
|
94
|
+
...(source ? [source] : []),
|
|
95
|
+
...(failed === undefined ? [] : findFailedSources(failed, sources)),
|
|
96
|
+
];
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const fingerprintReplayed = (
|
|
100
|
+
state: Value[],
|
|
101
|
+
fingerprintState: Value[],
|
|
102
|
+
callStack: CallStack | undefined,
|
|
103
|
+
) => {
|
|
104
|
+
for (const value of fingerprintState) {
|
|
105
|
+
const error = getFingerprintError(value);
|
|
106
|
+
if (!error) continue;
|
|
107
|
+
const sources = callStack ? findFailedSources(value, callStack.sources) : [];
|
|
108
|
+
if (callStack && sources.length > 0) {
|
|
109
|
+
callStack.expressions.length = 0;
|
|
110
|
+
callStack.isFrozen = true;
|
|
111
|
+
callStack.fingerprint = { sources, reason: error.message };
|
|
112
|
+
}
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
state.forEach(markFingerprinted);
|
|
116
|
+
};
|