tla-ts 0.0.10-dev.1ebc153bd → 0.0.10-dev.22f7435d3

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.
Files changed (108) hide show
  1. package/dist/deciders.cjs +31 -31
  2. package/dist/deciders.js +30 -30
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.cts +6 -2
  5. package/dist/index.d.ts +6 -2
  6. package/dist/index.js +1 -1
  7. package/dist/parallel-worker.cjs +1 -1
  8. package/dist/parallel-worker.js +1 -1
  9. package/dist/prove.cjs +68 -68
  10. package/dist/prove.js +61 -61
  11. package/dist/run.cjs +42 -42
  12. package/dist/run.js +44 -44
  13. package/dist/transfer.cjs +38 -38
  14. package/dist/transfer.js +29 -29
  15. package/dist/worker.cjs +7 -7
  16. package/dist/worker.js +7 -7
  17. package/package.json +1 -1
  18. package/src/bags.ts +5 -2
  19. package/src/builtins.ts +4 -3
  20. package/src/check-failure.ts +9 -6
  21. package/src/check-trace.ts +116 -64
  22. package/src/check.ts +343 -166
  23. package/src/cli/tlc-output.ts +1 -0
  24. package/src/cli/tlc.ts +3 -2
  25. package/src/codegen.ts +23 -8
  26. package/src/dependencies.ts +5 -4
  27. package/src/dfid.ts +13 -8
  28. package/src/environment.ts +1 -0
  29. package/src/evaluate.ts +58 -23
  30. package/src/exit-codes.ts +27 -13
  31. package/src/java-hash.ts +14 -0
  32. package/src/liveness-checker.ts +131 -81
  33. package/src/liveness.ts +48 -10
  34. package/src/parser.ts +6 -1
  35. package/src/prover/smt/solver/arith-rewriter.ts +11 -3
  36. package/src/prover/smt/solver/array-rewriter.ts +12 -2
  37. package/src/prover/smt/solver/asserted-formulas.ts +109 -63
  38. package/src/prover/smt/solver/ast.ts +5 -3
  39. package/src/prover/smt/solver/auf-solver.ts +23 -12
  40. package/src/prover/smt/solver/bit-blast-tactic.ts +26 -0
  41. package/src/prover/smt/solver/bound-simplifier.ts +10 -11
  42. package/src/prover/smt/solver/card2bv.ts +34 -15
  43. package/src/prover/smt/solver/cofactor-elim-term-ite.ts +39 -23
  44. package/src/prover/smt/solver/context.ts +44 -11
  45. package/src/prover/smt/solver/dependent-expr-state.ts +19 -13
  46. package/src/prover/smt/solver/dt2bv-tactic.ts +36 -20
  47. package/src/prover/smt/solver/elim-bounds.ts +89 -0
  48. package/src/prover/smt/solver/elim-uncnstr.ts +1 -1
  49. package/src/prover/smt/solver/fd-solver.ts +146 -39
  50. package/src/prover/smt/solver/internalizer.ts +1 -1
  51. package/src/prover/smt/solver/lp/lp-settings.ts +4 -0
  52. package/src/prover/smt/solver/maxcore.ts +2 -1
  53. package/src/prover/smt/solver/maxsmt-base.ts +1 -0
  54. package/src/prover/smt/solver/model-checker.ts +1 -1
  55. package/src/prover/smt/solver/model-evaluator.ts +2 -0
  56. package/src/prover/smt/solver/model-generator.ts +82 -42
  57. package/src/prover/smt/solver/muz/dl-context.ts +12 -40
  58. package/src/prover/smt/solver/muz/dl-mk-coi-filter.ts +1 -1
  59. package/src/prover/smt/solver/muz/dl-rule.ts +6 -7
  60. package/src/prover/smt/solver/muz/hnf.ts +2 -2
  61. package/src/prover/smt/solver/muz/horn-tactic.ts +14 -1
  62. package/src/prover/smt/solver/muz/rule-properties.ts +22 -0
  63. package/src/prover/smt/solver/muz/spacer-prop-solver.ts +1 -1
  64. package/src/prover/smt/solver/opt-context.ts +12 -4
  65. package/src/prover/smt/solver/opt-pareto.ts +19 -0
  66. package/src/prover/smt/solver/opt-solver.ts +4 -3
  67. package/src/prover/smt/solver/parallel-tactic.ts +1 -1
  68. package/src/prover/smt/solver/poly-rewriter.ts +1 -0
  69. package/src/prover/smt/solver/proto-model.ts +4 -2
  70. package/src/prover/smt/solver/push-app-ite.ts +37 -0
  71. package/src/prover/smt/solver/qsat.ts +23 -8
  72. package/src/prover/smt/solver/rewriter-tpl.ts +7 -6
  73. package/src/prover/smt/solver/rewriter.ts +31 -25
  74. package/src/prover/smt/solver/sat/goal2sat.ts +0 -1
  75. package/src/prover/smt/solver/sat/inc-sat-solver.ts +56 -28
  76. package/src/prover/smt/solver/sat/sat-tactic.ts +13 -4
  77. package/src/prover/smt/solver/sat/sat2goal.ts +10 -7
  78. package/src/prover/smt/solver/smt-consequences.ts +1 -1
  79. package/src/prover/smt/solver/smt-kernel.ts +39 -4
  80. package/src/prover/smt/solver/smt-setup.ts +28 -4
  81. package/src/prover/smt/solver/smtlib-parser.ts +31 -4
  82. package/src/prover/smt/solver/smtlib-script.ts +219 -82
  83. package/src/prover/smt/solver/solve-eqs.ts +24 -17
  84. package/src/prover/smt/solver/solver.ts +18 -3
  85. package/src/prover/smt/solver/tactic.ts +132 -78
  86. package/src/prover/smt/solver/theory-bv.ts +11 -1
  87. package/src/prover/smt/solver/theory-fpa.ts +1 -1
  88. package/src/prover/smt/solver/theory-lra-final-check.ts +1 -0
  89. package/src/prover/smt/solver/theory-lra-internalize.ts +1 -0
  90. package/src/prover/smt/solver/theory-lra-propagate.ts +7 -1
  91. package/src/prover/smt/solver/theory-lra.ts +1 -0
  92. package/src/prover/smt/solver/tseitin-cnf.ts +1 -0
  93. package/src/resolve.ts +446 -167
  94. package/src/runtime.ts +4 -0
  95. package/src/search.ts +161 -92
  96. package/src/simulate.ts +165 -102
  97. package/src/spec-description.ts +3 -4
  98. package/src/standard-modules.ts +56 -22
  99. package/src/subexpressions.ts +168 -49
  100. package/src/successors.ts +6 -3
  101. package/src/symmetry.ts +1 -0
  102. package/src/tlc/random.ts +2 -1
  103. package/src/tlc/replay.ts +22 -14
  104. package/src/tlc/tlc-operators.ts +7 -7
  105. package/src/tlc/tlcext-operators.ts +26 -10
  106. package/src/tlc/trace-spec.ts +6 -20
  107. package/src/typed-tier.ts +9 -4
  108. package/src/values.ts +95 -57
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,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(`
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=>({branches:e.branches,solutions:e.solutions,addInitialState:(t,n,r)=>o(()=>e.addInitialState(t,n,r)),addState:(t,n,r,i)=>o(()=>e.addState(t,n,r,i)),storeState:e.storeState,getStateCounts:e.getStateCounts,findViolation:()=>o(()=>e.findViolation()),getViolatedProperties:(t,n)=>o(()=>e.getViolatedProperties(t,n))}),ee=e=>{let t=o(e);return t&&s(t)},c=e=>{let t=o(e);return t&&{solutions:t.solutions,createChecker:(e,n)=>s(t.createChecker(e,n))}},l=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: `,te=l(`java.lang.RuntimeException`),u=l(`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}},h=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 g=(e,t=!1,n,r=[])=>new p(e.map(e=>`${e.location}\n\n${e.message}`).join(`
10
10
 
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}`,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
11
+ `),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),_=(e,t)=>g([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),v=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
12
+ `)}`,y=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)=>g([{location:y(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 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(
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)})`}},z=class extends R{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},B=class extends f{constructor(e,t){super(e,t),this.name=`TlaProverError`}},V=class extends B{locus;constructor(e,t){super(e),this.name=`TlaMethodError`,this.locus=t}},H=class extends f{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},U=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const W=(e,t)=>e instanceof U&&e.exception===t;var G=class extends f{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},K=class extends f{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},q=class extends f{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},J=class extends f{constructor(e){super(e),this.name=`SmtDefaultError`}},Y=class extends f{constructor(e){super(e),this.name=`SmtInvariantError`}},X=class extends f{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},Z=class extends f{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},re=class extends f{line;column;constructor(e,t){super(e),this.name=`SmtParseError`,this.line=t.line,this.column=t.column}},ie=class extends G{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const ae=t=>a(t)??(t instanceof p?e.specParseError:t instanceof b?e.configParseError:t instanceof x?e.specEvaluationFailure:e.error);var oe=class extends f{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},se=class extends f{constructor(e){super(e),this.name=`PcalRuntimeError`}},Q=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`}},ce=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`,le=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,ue=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()}},$=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
18
+ $))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},de=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
19
19
  /* @vite-ignore */
20
20
  /* webpackIgnore: true */
21
- Q)).parentPort,ue=()=>{let e=`Bun`in globalThis?import(
21
+ $)).parentPort,fe=()=>{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 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}});
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 ae}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return D}});
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,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(`
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=>({branches:e.branches,solutions:e.solutions,addInitialState:(t,n,r)=>o(()=>e.addInitialState(t,n,r)),addState:(t,n,r,i)=>o(()=>e.addState(t,n,r,i)),storeState:e.storeState,getStateCounts:e.getStateCounts,findViolation:()=>o(()=>e.findViolation()),getViolatedProperties:(t,n)=>o(()=>e.getViolatedProperties(t,n))}),ee=e=>{let t=o(e);return t&&s(t)},c=e=>{let t=o(e);return t&&{solutions:t.solutions,createChecker:(e,n)=>s(t.createChecker(e,n))}},l=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: `,te=l(`java.lang.RuntimeException`),u=l(`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}},h=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 g=(e,t=!1,n,r=[])=>new p(e.map(e=>`${e.location}\n\n${e.message}`).join(`
10
10
 
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}`,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
11
+ `),void 0,void 0,{errors:e,warnings:r,isFatal:t,parseError:n}),_=(e,t)=>g([{location:`In module ${t}`,message:`Cannot find source file for module ${e} imported in module ${t}.`}],!0),v=e=>`*** Warnings: ${e.length}\n\n${e.map(e=>`${e.location}\n\n${e.message}\n\n\n`).join(`
12
+ `)}`,y=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)=>g([{location:y(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 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(
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)})`}},z=class extends R{constructor(e=`Assert_failure`){super(`Oops, this seems to be a bug in TLAPM.`,{exception:e})}},B=class extends f{constructor(e,t){super(e,t),this.name=`TlaProverError`}},V=class extends B{locus;constructor(e,t){super(e),this.name=`TlaMethodError`,this.locus=t}},H=class extends f{constructor(e,t){super(e,t),this.name=`TlaZenonError`}},U=class{name=`TlaIsabelleError`;exception;message;constructor(e,t){this.exception=e,this.message=t}};const W=(e,t)=>e instanceof U&&e.exception===t;var G=class extends f{constructor(e,t){super(e,t),this.name=`TlaUnsupportedError`}},K=class extends f{constructor(e,t){super(e,t),this.name=`SmtUnsupportedError`}},q=class extends f{constructor(){super(`the SMT solver was canceled`),this.name=`SmtCanceledError`}},J=class extends f{constructor(e){super(e),this.name=`SmtDefaultError`}},Y=class extends f{constructor(e){super(e),this.name=`SmtInvariantError`}},X=class extends f{constructor(e){super(`nlsat does not implement ${e}`),this.name=`NlsatUnsupportedError`}},Z=class extends f{constructor(){super(`the pdd manager ran out of nodes`),this.name=`PddMemoryOutError`}},re=class extends f{line;column;constructor(e,t){super(e),this.name=`SmtParseError`,this.line=t.line,this.column=t.column}},ie=class extends G{unwound;constructor(e,t){super(e),this.name=`TlaJavaException`,this.unwound=t}};const ae=t=>a(t)??(t instanceof p?e.specParseError:t instanceof b?e.configParseError:t instanceof x?e.specEvaluationFailure:e.error);var oe=class extends f{node;constructor(e,t){super(e),this.name=`PcalError`,this.node=t}},se=class extends f{constructor(e){super(e),this.name=`PcalRuntimeError`}},Q=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`}},ce=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`,le=()=>typeof Worker==`function`||typeof process<`u`&&process.versions?.node!==void 0,ue=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()}},$=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
18
+ $))).Worker(e);return r.on(`message`,t),r.on(`error`,n),{postMessage:(e,t)=>r.postMessage(e,t),terminate:()=>void r.terminate()}},de=async()=>typeof globalThis.postMessage==`function`?globalThis:(await import(
19
19
  /* @vite-ignore */
20
20
  /* webpackIgnore: true */
21
- Q)).parentPort,ue=()=>{let e=`Bun`in globalThis?import(
21
+ $)).parentPort,fe=()=>{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{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};
24
+ `bun:jsc`):void 0;return async()=>{(await e)?.edenGC(),await new Promise(e=>typeof setImmediate==`function`?setImmediate(e):setTimeout(e,0))}};export{ae as $,O as A,T as B,L as C,V as D,ie as E,C as F,u as G,I as H,p as I,g as J,te as K,F as L,B as M,m as N,j as O,N as P,v as Q,ce as R,k as S,U as T,H as U,G as V,z as W,w as X,ne as Y,y as Z,M as _,X as a,n as at,f as b,se as c,ee as ct,q as d,l as et,J as f,P as g,K as h,ue as i,a as it,R as j,h as k,Z as l,re as m,de as n,d as nt,Q as o,i as ot,Y as p,_ as q,le as r,e as rt,oe as s,c as st,fe as t,W as tt,S as u,b as v,E as w,x,A as y,D as z};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tla-ts",
3
- "version": "0.0.10-dev.1ebc153bd",
3
+ "version": "0.0.10-dev.22f7435d3",
4
4
  "description": "A TLA+ interpreter and model checker in TypeScript, 2× faster than TLC",
5
5
  "keywords": [
6
6
  "formal verification",
package/src/bags.ts CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  } from "./builtins";
12
12
  import { TlaEvaluationError, TlaModuleError } from "./errors";
13
13
  import type { Builtin, BuiltinArgument } from "./evaluate";
14
+ import { prettyPrint } from "./pretty-print";
14
15
  import {
15
16
  createEnumeratedSet,
16
17
  createFunction,
@@ -30,7 +31,7 @@ import {
30
31
 
31
32
  const createWrongValueError = (name: string, expected: string, value: Value) =>
32
33
  new TlaModuleError(
33
- `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))}`,
34
35
  );
35
36
 
36
37
  const toFunction = (value: Value) => (isFunctionValue(value) ? toFiniteFunction(value) : undefined);
@@ -44,6 +45,7 @@ const getFunction = (args: BuiltinArgument[], index: number, name: string) => {
44
45
  return functionValue;
45
46
  };
46
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.
47
49
  const getCount = (args: BuiltinArgument[], name: string) => {
48
50
  const bag = getValue(args, 1, name);
49
51
  const functionValue = toFunction(bag);
@@ -54,6 +56,7 @@ const getCount = (args: BuiltinArgument[], name: string) => {
54
56
  return count;
55
57
  };
56
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.
57
60
  const getAddedBag = (
58
61
  args: BuiltinArgument[],
59
62
  functions: (FunctionValue | undefined)[],
@@ -186,7 +189,7 @@ export const createBagsOperators = (builtins: ReadonlyMap<string, Builtin>): Bui
186
189
  if (elements.length < 2) return elements[0] ?? EMPTY_BAG;
187
190
  const createUnionError = () =>
188
191
  new TlaModuleError(
189
- `Attempted to apply BagUnion to the following set, whose\nelement is not a bag:\n${formatValue(set)}`,
192
+ `Attempted to apply BagUnion to the following set, whose\nelement is not a bag:\n${prettyPrint(formatValue(set))}`,
190
193
  );
191
194
  const getBag = (element: Value) => {
192
195
  const functionValue = toFunction(element);
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;
@@ -7,7 +7,8 @@ import {
7
7
  type FingerprintFailure,
8
8
  } from "./evaluate";
9
9
  import { EXIT_STATUS, getExitCode, getMessageExitStatus } from "./exit-codes";
10
- import { getCodedMessage, type FailureMessage } from "./tlc/messages";
10
+ import type { TraceFailure } from "./check";
11
+ import { getCodedMessage } from "./tlc/messages";
11
12
  import { getFingerprintError, getHeldValues, markFingerprinted, type Value } from "./values";
12
13
 
13
14
  export interface ReplayFailure {
@@ -24,7 +25,7 @@ export interface FailureOptions {
24
25
  callStack?: Expression[];
25
26
  fingerprint?: FingerprintFailure;
26
27
  replayError?: TlaEvaluationError;
27
- traceFailure?: FailureMessage;
28
+ traceFailure?: TraceFailure;
28
29
  }
29
30
 
30
31
  const getInitialExitCode = (error: TlaEvaluationError) => {
@@ -42,6 +43,9 @@ const getReplayExitCode = (error: TlaEvaluationError): number => {
42
43
  return error instanceof TlaModuleError ? error.exitCode : EXIT_STATUS.specEvaluationFailure;
43
44
  };
44
45
 
46
+ const getCodeExitCode = (error: TlaEvaluationError) =>
47
+ getExitCode(error) ?? (error instanceof TlaModuleError ? error.exitCode : EXIT_STATUS.error);
48
+
45
49
  export const getFailureExitCode = (
46
50
  error: TlaEvaluationError,
47
51
  failureOptions: FailureOptions,
@@ -53,12 +57,11 @@ export const getFailureExitCode = (
53
57
  if (isReplayed) return EXIT_STATUS.specEvaluationFailure;
54
58
  return is174 ? EXIT_STATUS.success : getInitialExitCode(error);
55
59
  case "behavior-graph":
56
- return (
57
- getExitCode(error) ?? (error instanceof TlaModuleError ? error.exitCode : EXIT_STATUS.error)
58
- );
60
+ return getCodeExitCode(error);
59
61
  case "liveness":
60
- return getErrorExitCode(error);
62
+ return error instanceof TlaModuleError ? error.exitCode : getErrorExitCode(error);
61
63
  default:
64
+ if (!isReplayed && failureOptions.phase === "next" && !is174) return getCodeExitCode(error);
62
65
  if (!isReplayed) return getErrorExitCode(error);
63
66
  return failureOptions.fingerprint
64
67
  ? EXIT_STATUS.specEvaluationFailure
@@ -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 { Value } from "./values";
9
+ import { createModelValue, getFingerprintError, isSameValue, type Value } from "./values";
10
10
 
11
11
  export interface Behavior {
12
12
  trace: TraceStep[];
@@ -16,6 +16,8 @@ export interface Behavior {
16
16
  interface TraceOptions {
17
17
  loopStart?: number;
18
18
  known?: number;
19
+ incomplete?: State;
20
+ isFailed?: boolean;
19
21
  }
20
22
 
21
23
  interface RebuiltState {
@@ -35,6 +37,7 @@ export interface SearchPosition {
35
37
  export interface TracedStep {
36
38
  state: Record<string, Value>;
37
39
  action: SpecAction | undefined;
40
+ alias?: Record<string, Value>;
38
41
  }
39
42
 
40
43
  interface TraceContext {
@@ -52,6 +55,7 @@ interface TraceContext {
52
55
  tracedSteps: WeakMap<TraceStep, TracedStep>;
53
56
  captureOutput: <Result>(rebuild: () => Result) => { result: Result; lines: OutputLine[] };
54
57
  getInitialStates: () => Value[][];
58
+ getUncoveredInitialStates: () => Value[][];
55
59
  findSuccessorAction: (
56
60
  state: Value[],
57
61
  isMatch: (successor: Successor) => boolean,
@@ -59,7 +63,7 @@ interface TraceContext {
59
63
  }
60
64
 
61
65
  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.";
66
+ export const NEXT_RECOVERY_FAILURE = "Failed to recover the next state from its fingerprint.";
63
67
 
64
68
  export const createTraceBuilder = (context: TraceContext) => {
65
69
  const config = context.config;
@@ -78,39 +82,44 @@ export const createTraceBuilder = (context: TraceContext) => {
78
82
 
79
83
  const getAliasState = (
80
84
  alias: string,
81
- steps: Successor[],
82
- position: number,
83
- loopStart: number | undefined,
85
+ state: State,
86
+ successor: State,
87
+ level: number,
88
+ getBehavior: () => Value[][],
84
89
  ) => {
85
90
  const searchLevel = runtime.getLevel;
86
91
  const searchBehavior = runtime.getBehavior;
87
- runtime.getLevel = () => position + 1;
88
- runtime.getBehavior = () => steps.slice(0, position + 1).map((step) => step.state);
92
+ runtime.getLevel = () => level;
93
+ runtime.getBehavior = getBehavior;
89
94
  try {
90
- return search.evaluateAlias(
91
- alias,
92
- steps[position].state,
93
- (steps[position + 1] ?? steps[loopStart ?? position]).state,
94
- options.isTool ?? false,
95
- );
95
+ return search.evaluateAlias(alias, state, successor, options.isTool ?? false);
96
96
  } finally {
97
97
  runtime.getLevel = searchLevel;
98
98
  runtime.getBehavior = searchBehavior;
99
99
  }
100
100
  };
101
+ // 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.
102
+ const rebuildFrom = (state: Value[], level: number) => {
103
+ current.rebuilt = { state, level };
104
+ runtime.reseedRandom();
105
+ };
106
+ // TLC's TLCStateMut#equals compares the variables in turn, and a lazy value fails as it reaches it.
107
+ const isEqualState = (state: Value[], successor: Value[]) =>
108
+ state.every((value, position) => {
109
+ const error = getFingerprintError(value);
110
+ if (error) throw error;
111
+ return isSameValue(value, successor[position]);
112
+ });
101
113
  const findStepAction = (index: number, previous: Value[], state: Value[], isHeld: boolean) => {
102
114
  const expanding = { ...current };
103
- Object.assign(current, {
104
- index,
105
- isExpanding: true,
106
- candidate: undefined,
107
- rebuilt: { state: previous, level: depths[index] },
108
- });
109
- const getKey = isHeld ? (values: Value[]) => values : getFingerprintState;
110
- const key = getKey(state);
115
+ Object.assign(current, { index, isExpanding: true, candidate: undefined });
116
+ rebuildFrom(previous, depths[index]);
117
+ const key = isHeld ? state : getFingerprintState(state);
111
118
  try {
112
119
  return context.findSuccessorAction(previous, (successor) =>
113
- isSameState(getKey(successor.state), key),
120
+ isHeld
121
+ ? isEqualState(key, successor.state)
122
+ : isSameState(getFingerprintState(successor.state), key),
114
123
  );
115
124
  } finally {
116
125
  Object.assign(current, expanding);
@@ -123,7 +132,13 @@ export const createTraceBuilder = (context: TraceContext) => {
123
132
  ): Behavior => {
124
133
  const alias = config.alias;
125
134
  const known = traceOptions.known ?? 1;
126
- const initialOutput = steps.length > 1 ? captureOutput(context.getInitialStates).lines : [];
135
+ const loopStart = traceOptions.loopStart;
136
+ const rebuilt = is174 && loopStart !== undefined ? loopStart + 1 : steps.length - known;
137
+ const isRebuiltAgain = known > 0 && !is174 && !traceOptions.isFailed;
138
+ const initialOutput =
139
+ known === 0 || (steps.length > 1 && (rebuilt > 0 || isRebuiltAgain || is174))
140
+ ? captureOutput(context.getInitialStates).lines
141
+ : [];
127
142
  const stepActions = steps.map((step, position) =>
128
143
  position === 0 || step.action === "Stuttering"
129
144
  ? { result: undefined, lines: [] }
@@ -137,10 +152,7 @@ export const createTraceBuilder = (context: TraceContext) => {
137
152
  ),
138
153
  );
139
154
  const outputs = stepActions.map((step) => step.lines);
140
- const loopStart = traceOptions.loopStart;
141
- const rebuilt = is174 && loopStart !== undefined ? loopStart + 1 : steps.length - known;
142
155
  if (environment.coverage && steps.length > 1) {
143
- const isRebuiltAgain = known > 0 && !is174;
144
156
  if (rebuilt > 0 && isRebuiltAgain) captureOutput(context.getInitialStates);
145
157
  if (isRebuiltAgain) {
146
158
  steps.slice(1).forEach((step, position) => {
@@ -166,7 +178,15 @@ export const createTraceBuilder = (context: TraceContext) => {
166
178
  state:
167
179
  alias === undefined
168
180
  ? toRecord(step.state)
169
- : getAliasState(alias, steps, position, loopStart),
181
+ : getAliasState(
182
+ alias,
183
+ step.state,
184
+ steps[position + 1]?.state ??
185
+ traceOptions.incomplete ??
186
+ steps[loopStart ?? position].state,
187
+ position + 1,
188
+ () => steps.slice(0, position + 1).map((inner) => inner.state),
189
+ ),
170
190
  output: position === 0 ? prefixOutput : position < rebuilt ? [] : outputs[position],
171
191
  };
172
192
  if (alias !== undefined || action) {
@@ -174,7 +194,7 @@ export const createTraceBuilder = (context: TraceContext) => {
174
194
  }
175
195
  return traceStep;
176
196
  }),
177
- traceOutput: known > 0 && !is174 ? [initialOutput, ...outputs].flat() : [],
197
+ traceOutput: isRebuiltAgain ? [initialOutput, ...outputs].flat() : [],
178
198
  };
179
199
  };
180
200
  const findTraceSuccessor = (state: Value[], isMatch: (successor: Successor) => boolean) =>
@@ -187,14 +207,28 @@ export const createTraceBuilder = (context: TraceContext) => {
187
207
  }
188
208
  return undefined;
189
209
  }).result;
190
- const hasFingerprint = (state: Value[], index: number) =>
191
- isSameState(getFingerprintState(state), context.fingerprintStates[index]);
192
- const findSuccessorWithFingerprint = (state: Value[], index: number) =>
193
- findTraceSuccessor(state, (successor) => hasFingerprint(successor.state, index));
210
+ // TLC's Tool#getState fingerprints each state it rebuilds, which sorts its records in place.
211
+ const hasFingerprint = (state: Value[], index: number) => {
212
+ const fingerprintState = getFingerprintState(state);
213
+ const stored = context.fingerprintStates[index];
214
+ return (
215
+ getStateHash(fingerprintState) === getStateHash(stored) &&
216
+ isSameState(fingerprintState, stored)
217
+ );
218
+ };
219
+ const findSuccessorWithFingerprint = (state: Value[], source: number, target: number) => {
220
+ const rebuilt = current.rebuilt;
221
+ rebuildFrom(state, depths[source]);
222
+ const successor = findTraceSuccessor(state, (candidate) =>
223
+ hasFingerprint(candidate.state, target),
224
+ );
225
+ current.rebuilt = rebuilt;
226
+ return successor;
227
+ };
194
228
  const getPathStates = (path: number[], nextFailure: string) => {
195
229
  const initial = captureOutput(() =>
196
230
  isReducing || isImpure(environment)
197
- ? context.getInitialStates().find((state) => hasFingerprint(state, path[0]))
231
+ ? context.getUncoveredInitialStates().find((state) => hasFingerprint(state, path[0]))
198
232
  : states[path[0]],
199
233
  ).result;
200
234
  if (!initial) throw new TlaEvaluationError(INITIAL_RECOVERY_FAILURE);
@@ -205,16 +239,13 @@ export const createTraceBuilder = (context: TraceContext) => {
205
239
  steps.push({ state: previous, action: "Stuttering" });
206
240
  continue;
207
241
  }
208
- const rebuilt = current.rebuilt;
209
- current.rebuilt = { state: previous, level: depths[path[position - 1]] };
210
- const successor = findSuccessorWithFingerprint(previous, path[position]);
211
- current.rebuilt = rebuilt;
242
+ const successor = findSuccessorWithFingerprint(previous, path[position - 1], path[position]);
212
243
  if (!successor) throw new TlaEvaluationError(nextFailure);
213
244
  steps.push(successor);
214
245
  }
215
246
  return steps;
216
247
  };
217
- const getTrace = (index: number, lastSuccessor?: Successor) => {
248
+ const getTrace = (index: number, lastSuccessor?: Successor, traceOptions: TraceOptions = {}) => {
218
249
  const path: number[] = [];
219
250
  for (let position = index; position !== -1; position = context.parents[position]) {
220
251
  path.unshift(position);
@@ -226,43 +257,64 @@ export const createTraceBuilder = (context: TraceContext) => {
226
257
  state: states[position],
227
258
  action: context.actions[position],
228
259
  }));
229
- if (!lastSuccessor) return toTrace(steps, path);
260
+ if (!lastSuccessor) return toTrace(steps, path, traceOptions);
230
261
  const action = isReducing
231
262
  ? findTraceSuccessor(states[index], (successor) =>
232
263
  isSameState(successor.state, lastSuccessor.state),
233
264
  )?.action
234
265
  : lastSuccessor.action;
235
- return toTrace([...steps, { state: lastSuccessor.state, action }], path, { known: 2 });
266
+ return toTrace([...steps, { state: lastSuccessor.state, action }], path, {
267
+ ...traceOptions,
268
+ known: 2,
269
+ });
236
270
  };
237
- // TLCTrace#printTrace prints a lone initial state without the alias it applies to every other trace.
238
- const getStateTrace = (index: number): Behavior =>
239
- context.parents[index] === -1
240
- ? {
241
- trace: [{ action: undefined, label: undefined, state: toRecord(states[index]) }],
242
- traceOutput: is174 ? [] : captureOutput(context.getInitialStates).lines,
243
- }
244
- : getTrace(index);
245
- const getFailedTrace = (index: number, successor: Successor): Behavior => ({
246
- trace: getTrace(index, successor).trace,
247
- });
248
- const getPathSteps = (path: number[], loopStart?: 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;
271
+ // TLCTrace#printTrace applies the alias to every state but an initial one it prints without a successor.
272
+ const getStateTrace = (index: number, traceOptions: TraceOptions = {}): Behavior => {
273
+ if (context.parents[index] !== -1) return getTrace(index, undefined, traceOptions);
274
+ const traceOutput =
275
+ is174 || traceOptions.isFailed ? [] : captureOutput(context.getInitialStates).lines;
276
+ const state = states[index];
277
+ if (traceOptions.incomplete !== undefined) {
278
+ return {
279
+ trace: toTrace([{ state, action: undefined }], [index], traceOptions).trace,
280
+ traceOutput,
281
+ };
282
+ }
283
+ const step = { action: undefined, label: undefined, state: toRecord(state) };
284
+ const alias = config.alias;
285
+ if (alias !== undefined) {
286
+ context.tracedSteps.set(step, {
287
+ state: step.state,
288
+ action: undefined,
289
+ alias: getAliasState(alias, state, state, 1, () => [state]),
290
+ });
291
+ }
292
+ return { trace: [step], traceOutput };
293
+ };
294
+ const getIncompleteStep = (
295
+ incomplete: State,
296
+ level: number,
297
+ step: Omit<TraceStep, "state">,
298
+ action: SpecAction | undefined,
299
+ ): TraceStep => {
300
+ const state = toRecord(incomplete.map((value) => value ?? createModelValue("null")));
301
+ const alias = config.alias;
302
+ const traceStep = {
303
+ ...step,
304
+ state:
305
+ alias === undefined ? state : getAliasState(alias, incomplete, incomplete, level, () => []),
306
+ };
307
+ context.tracedSteps.set(traceStep, { state, action });
308
+ return traceStep;
258
309
  };
310
+ const getPathSteps = (path: number[]) => getPathStates(path, NEXT_RECOVERY_FAILURE);
259
311
  return {
260
312
  toTrace,
261
313
  findStepAction,
262
314
  findSuccessorWithFingerprint,
263
315
  getTrace,
264
316
  getStateTrace,
265
- getFailedTrace,
317
+ getIncompleteStep,
266
318
  getPathSteps,
267
319
  };
268
320
  };