tla-ts 0.0.10-dev.a17d6d9fa → 0.0.10-dev.a5705bfbf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deciders.cjs +31 -31
- package/dist/deciders.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove.cjs +64 -64
- package/dist/prove.js +76 -76
- package/dist/run.cjs +42 -42
- package/dist/run.js +44 -44
- package/dist/transfer.cjs +37 -35
- package/dist/transfer.js +43 -41
- package/dist/worker.cjs +7 -7
- package/dist/worker.js +7 -7
- package/package.json +1 -1
- package/src/ast.ts +10 -1
- package/src/check-failure.ts +12 -10
- package/src/check-trace.ts +36 -23
- package/src/check.ts +182 -135
- package/src/cli/tlc-output.ts +17 -2
- package/src/cli/tlc.ts +2 -2
- package/src/codegen.ts +15 -19
- package/src/coverage.ts +190 -1
- package/src/dependencies.ts +19 -6
- package/src/dfid.ts +80 -27
- package/src/environment.ts +30 -1
- package/src/evaluate.ts +254 -59
- package/src/exit-codes.ts +25 -13
- package/src/instances.ts +11 -1
- package/src/levels.ts +48 -7
- package/src/liveness-checker.ts +98 -27
- package/src/liveness.ts +4 -1
- package/src/obligations/source.ts +2 -0
- package/src/parser.ts +3 -0
- package/src/prover/smt/solver/card2bv.ts +7 -4
- package/src/prover/smt/solver/context.ts +20 -4
- package/src/prover/smt/solver/dependent-expr-state.ts +18 -12
- package/src/prover/smt/solver/dt2bv-tactic.ts +36 -20
- package/src/prover/smt/solver/fd-solver.ts +146 -39
- package/src/prover/smt/solver/maxcore.ts +2 -1
- package/src/prover/smt/solver/maxsmt-base.ts +1 -0
- package/src/prover/smt/solver/model-checker.ts +1 -1
- package/src/prover/smt/solver/muz/dl-context.ts +12 -40
- package/src/prover/smt/solver/muz/dl-mk-coi-filter.ts +1 -1
- package/src/prover/smt/solver/muz/dl-rule.ts +6 -7
- package/src/prover/smt/solver/muz/hnf.ts +2 -2
- package/src/prover/smt/solver/muz/horn-tactic.ts +14 -1
- package/src/prover/smt/solver/muz/rule-properties.ts +22 -0
- package/src/prover/smt/solver/muz/spacer-prop-solver.ts +1 -1
- package/src/prover/smt/solver/opt-context.ts +1 -0
- package/src/prover/smt/solver/opt-solver.ts +1 -1
- package/src/prover/smt/solver/parallel-tactic.ts +1 -1
- package/src/prover/smt/solver/qsat.ts +7 -2
- package/src/prover/smt/solver/rewriter-tpl.ts +7 -6
- package/src/prover/smt/solver/sat/inc-sat-solver.ts +45 -26
- package/src/prover/smt/solver/sat/sat-tactic.ts +4 -2
- package/src/prover/smt/solver/sat/sat2goal.ts +10 -7
- package/src/prover/smt/solver/smt-consequences.ts +1 -1
- package/src/prover/smt/solver/smt-kernel.ts +9 -2
- package/src/prover/smt/solver/smtlib-parser.ts +6 -2
- package/src/prover/smt/solver/smtlib-script.ts +197 -73
- package/src/prover/smt/solver/tactic.ts +64 -37
- package/src/resolve.ts +143 -39
- package/src/sany/generator-expressions.ts +2 -0
- package/src/sany/generator-proofs.ts +1 -0
- package/src/search.ts +156 -37
- package/src/simulate.ts +143 -150
- package/src/spec-description.ts +3 -0
- package/src/standard-modules.ts +41 -16
- package/src/subexpressions.ts +168 -63
- package/src/successors.ts +33 -11
- package/src/symmetry.ts +1 -0
- package/src/tlc/replay.ts +64 -41
- package/src/trace-liveness.ts +529 -0
- package/src/typed-tier.ts +20 -6
- package/src/values.ts +15 -1
package/dist/index.cjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
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
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./worker.cjs"),t=require("./transfer.cjs"),n=require("./prove.cjs");exports.TlaConfigError=e.v,exports.TlaError=e.b,exports.TlaEvaluationError=e.x,exports.TlaSyntaxError=e.I,exports.TlaUnsupportedError=e.V,exports.check=n.S,exports.formatValue=t.
|
|
9
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./worker.cjs"),t=require("./transfer.cjs"),n=require("./prove.cjs");exports.TlaConfigError=e.v,exports.TlaError=e.b,exports.TlaEvaluationError=e.x,exports.TlaSyntaxError=e.I,exports.TlaUnsupportedError=e.V,exports.check=n.S,exports.formatValue=t.qt,exports.parseConfig=t.wn,exports.parseModule=t.bt,exports.prove=n.o;
|
package/dist/index.d.cts
CHANGED
|
@@ -290,7 +290,12 @@ interface SubexpressionExpression {
|
|
|
290
290
|
argumentRanges?: (SourceRange | undefined)[];
|
|
291
291
|
location: SourceLocation;
|
|
292
292
|
}
|
|
293
|
-
|
|
293
|
+
interface SelectionExpression {
|
|
294
|
+
kind: "Selection";
|
|
295
|
+
expression: Expression;
|
|
296
|
+
location: SourceLocation;
|
|
297
|
+
}
|
|
298
|
+
type Expression = NumberExpression | DecimalExpression | StringExpression | IdentifierExpression | ApplyExpression | OperatorReferenceExpression | LambdaExpression | JunctionExpression | PrimeExpression | UnchangedExpression | EnabledExpression | IfExpression | CaseExpression | LetExpression | QuantifierExpression | UnboundedQuantifierExpression | ChooseExpression | SetEnumerationExpression | SetFilterExpression | SetMapExpression | TupleExpression | FunctionConstructionExpression | FunctionSetExpression | RecordExpression | ExceptExpression | ExceptAtExpression | FunctionApplicationExpression | BracketExpression | FieldAccessExpression | ProductExpression | TemporalExpression | ActionExpression | FairnessExpression | LabelExpression | SubexpressionExpression | SelectionExpression;
|
|
294
299
|
interface OperatorParam {
|
|
295
300
|
name: string;
|
|
296
301
|
arity: number;
|
|
@@ -651,6 +656,7 @@ interface FilteredSetValue extends LazySet {
|
|
|
651
656
|
kind: "FilteredSet";
|
|
652
657
|
base: Value;
|
|
653
658
|
test: (element: Value, isMember: boolean) => boolean;
|
|
659
|
+
startPass?: (isMaterialized: boolean) => (element: Value) => boolean;
|
|
654
660
|
source?: FilteredSetSource;
|
|
655
661
|
}
|
|
656
662
|
interface UnionValue extends LazySet {
|
|
@@ -873,6 +879,10 @@ interface Postcondition {
|
|
|
873
879
|
message: string;
|
|
874
880
|
counts?: string;
|
|
875
881
|
}
|
|
882
|
+
interface TraceFailure extends FailureMessage {
|
|
883
|
+
/** What the spec prints as TLC rebuilds the step it then fails to print. */
|
|
884
|
+
output: OutputLine[];
|
|
885
|
+
}
|
|
876
886
|
/** An evaluation that failed during the search, with the behavior up to the state TLC was working on. */
|
|
877
887
|
interface EvaluationFailure {
|
|
878
888
|
code: number;
|
|
@@ -889,7 +899,7 @@ interface EvaluationFailure {
|
|
|
889
899
|
/** The FingerprintException the replay raises, which TLC reports in place of the call stack. */
|
|
890
900
|
fingerprint?: FingerprintFailure;
|
|
891
901
|
/** How TLC reports failing again as it prints the trace, since it can't fingerprint the state. */
|
|
892
|
-
traceFailure?:
|
|
902
|
+
traceFailure?: TraceFailure;
|
|
893
903
|
/** A POSTCONDITION that is false or fails after the trace, which TLC checks as it prints one. */
|
|
894
904
|
postcondition?: Postcondition;
|
|
895
905
|
/** Whether TLC stops before it prints the statistics, as it does for an illegal initial state. */
|
package/dist/index.d.ts
CHANGED
|
@@ -290,7 +290,12 @@ interface SubexpressionExpression {
|
|
|
290
290
|
argumentRanges?: (SourceRange | undefined)[];
|
|
291
291
|
location: SourceLocation;
|
|
292
292
|
}
|
|
293
|
-
|
|
293
|
+
interface SelectionExpression {
|
|
294
|
+
kind: "Selection";
|
|
295
|
+
expression: Expression;
|
|
296
|
+
location: SourceLocation;
|
|
297
|
+
}
|
|
298
|
+
type Expression = NumberExpression | DecimalExpression | StringExpression | IdentifierExpression | ApplyExpression | OperatorReferenceExpression | LambdaExpression | JunctionExpression | PrimeExpression | UnchangedExpression | EnabledExpression | IfExpression | CaseExpression | LetExpression | QuantifierExpression | UnboundedQuantifierExpression | ChooseExpression | SetEnumerationExpression | SetFilterExpression | SetMapExpression | TupleExpression | FunctionConstructionExpression | FunctionSetExpression | RecordExpression | ExceptExpression | ExceptAtExpression | FunctionApplicationExpression | BracketExpression | FieldAccessExpression | ProductExpression | TemporalExpression | ActionExpression | FairnessExpression | LabelExpression | SubexpressionExpression | SelectionExpression;
|
|
294
299
|
interface OperatorParam {
|
|
295
300
|
name: string;
|
|
296
301
|
arity: number;
|
|
@@ -651,6 +656,7 @@ interface FilteredSetValue extends LazySet {
|
|
|
651
656
|
kind: "FilteredSet";
|
|
652
657
|
base: Value;
|
|
653
658
|
test: (element: Value, isMember: boolean) => boolean;
|
|
659
|
+
startPass?: (isMaterialized: boolean) => (element: Value) => boolean;
|
|
654
660
|
source?: FilteredSetSource;
|
|
655
661
|
}
|
|
656
662
|
interface UnionValue extends LazySet {
|
|
@@ -873,6 +879,10 @@ interface Postcondition {
|
|
|
873
879
|
message: string;
|
|
874
880
|
counts?: string;
|
|
875
881
|
}
|
|
882
|
+
interface TraceFailure extends FailureMessage {
|
|
883
|
+
/** What the spec prints as TLC rebuilds the step it then fails to print. */
|
|
884
|
+
output: OutputLine[];
|
|
885
|
+
}
|
|
876
886
|
/** An evaluation that failed during the search, with the behavior up to the state TLC was working on. */
|
|
877
887
|
interface EvaluationFailure {
|
|
878
888
|
code: number;
|
|
@@ -889,7 +899,7 @@ interface EvaluationFailure {
|
|
|
889
899
|
/** The FingerprintException the replay raises, which TLC reports in place of the call stack. */
|
|
890
900
|
fingerprint?: FingerprintFailure;
|
|
891
901
|
/** How TLC reports failing again as it prints the trace, since it can't fingerprint the state. */
|
|
892
|
-
traceFailure?:
|
|
902
|
+
traceFailure?: TraceFailure;
|
|
893
903
|
/** A POSTCONDITION that is false or fails after the trace, which TLC checks as it prints one. */
|
|
894
904
|
postcondition?: Postcondition;
|
|
895
905
|
/** Whether TLC stops before it prints the statistics, as it does for an illegal initial state. */
|
package/dist/index.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
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
|
-
import{I as e,V as t,b as n,v as r,x as i}from"./worker.js";import{
|
|
9
|
+
import{I as e,V as t,b as n,v as r,x as i}from"./worker.js";import{bt as a,qt as o,wn as s}from"./transfer.js";import{S as c,o as l}from"./prove.js";export{r as TlaConfigError,n as TlaError,i as TlaEvaluationError,e as TlaSyntaxError,t as TlaUnsupportedError,c as check,o as formatValue,s as parseConfig,a as parseModule,l as prove};
|
package/dist/parallel-worker.cjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
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=require("./worker.cjs"),t=require("./transfer.cjs"),n=(n,r)=>{let i=new Map(n.modules),a=e=>i.get(e),o=new Map(n.classes),s=t.
|
|
9
|
+
const e=require("./worker.cjs"),t=require("./transfer.cjs"),n=(n,r)=>{let i=new Map(n.modules),a=e=>i.get(e),o=new Map(n.classes),s=t.u(n.config,{...n,loadModule:a,loadClass:e=>o.get(e),seed:void 0},()=>{},!0),c=s.specification,l=c.environment,u=t.f(n.config,l,c.variableLocations,()=>s.order.getDeclarationOrder(`variable`),void 0,[],c.runtimeInvariants),d=u?.spec.next;if(!u||d===void 0)return r.postMessage({type:`abort`});let f=n.index,p=t.Lt(),m=t.t(l.variables.length),h=n.fingerprints,g=n.requests,_=n.remaining,v=u.isSymmetric?t.N():void 0,y=/* @__PURE__ */ new Int32Array(2),b=()=>{},x=e=>{};n.ports.forEach(e=>{e?.addEventListener(`message`,e=>x(e.data)),e?.start?.()});let S=m(n.seed).map(p),C=e.t(),w=(e,r)=>{let i=Atomics.load(g,f)-1,a=Math.floor((e.end-e.origin-1)/2),o=t.n(),s=e.states.slice(e.end-a,e.end),c=a>0&&s.every(o.encode);c&&(e.end-=a);let l=c?o.finish():t.n().finish();n.ports[i]?.postMessage(l,[l.words.buffer]),Atomics.store(g,f,r),Atomics.notify(g,f)},T=e=>{Atomics.store(_,f,0),Atomics.compareExchange(g,f,0,-1)!==0&&w(e,-1)},E=e=>{Atomics.store(_,f,e.end-e.origin),Atomics.store(g,f,0)},D=e=>{for(;e.origin<e.end;e.origin++){let r=e.states[e.origin];if(!e.successors){if(performance.now()>=e.breakAt)return`break`;if(Atomics.load(g,f)>0&&w(e,0),Atomics.store(_,f,e.end-e.origin-1),e.successors=t.nt(d,r,l,u.spec.scope),e.generated+=e.successors.length,e.successors.length===0&&n.config.checkDeadlock)return}let i=e.successors;for(;e.index<i.length;e.index++){if(t.V(h))return`paused`;let n=i[e.index];if(u.findViolatedActionProperty(r,n.state))return;if(!u.satisfiesActionConstraints(r,n.state)){if(u.findViolatedInvariant(n.state,r))return;continue}if(v&&(t.U(n.state,y),!v.insert(y[0],y[1])))continue;p(n.state);let a=u.getFingerprintState(n.state);if(t.U(a,y),t.z(h,y[0],y[1])){if(u.findViolatedInvariant(n.state,r))return;u.satisfiesConstraints(n.state,r)&&(e.next.push(n.state),e.fingerprintStates.push(a),e.added++)}}e.outDegrees[Math.min(e.added,31)]++,e.successors=void 0,e.index=0,e.added=0}return`done`},O=async e=>{let t=/* @__PURE__ */ new Set;for(;;){let r=n.ports.reduce((e,n,r)=>!n||t.has(r)||Atomics.load(_,r)<2?e:e===void 0||Atomics.load(_,r)>Atomics.load(_,e)?r:e,void 0);if(r===void 0)return!1;let i=Atomics.compareExchange(g,r,0,f+1);if(i===-1&&t.add(r),i>0&&Atomics.wait(g,r,i),i!==0)continue;let a=await new Promise(e=>x=e);if(a.count===0)t.add(r);else return e.states=m(a).map(p),e.origin=0,e.end=e.states.length,E(e),!0}},k=e=>r.postMessage(e,e.type===`level`?[e.fingerprints.buffer]:[]),A=async()=>{let e={states:S,origin:0,end:S.length,successors:void 0,index:0,added:0,generated:0,outDegrees:Array.from({length:32},()=>0),next:[],fingerprintStates:[],breakAt:performance.now()+100};for(;;){let t=D(e);if(t===void 0)return;if(t===`break`)await C(),e.breakAt=performance.now()+100;else if(T(e),t===`paused`){let t=new Promise(e=>b=e);k({type:`paused`}),await t,E(e)}else if(!await O(e))break}let n=t.en();return n===void 0?(S=e.next,Atomics.store(_,f,S.length),{type:`level`,generated:e.generated,added:e.next.length,outDegrees:e.outDegrees,fingerprints:u.getStoredFingerprints(e.next,e.fingerprintStates)}):{type:`abort`,string:n}},j=()=>{A().then(e=>k(e??{type:`abort`}),()=>k({type:`abort`}))};r.addEventListener(`message`,e=>{let t=e.data;t.type===`level`&&j(),t.type===`resize`&&(h=t.fingerprints,b())}),Atomics.store(_,f,S.length),k({type:`ready`})};e.n().then(e=>{let t=r=>{let i=r.data;if(i.type===`start`){e.removeEventListener?.(`message`,t);try{n(i,e)}catch{e.postMessage({type:`abort`})}}};e.addEventListener(`message`,t),e.start?.()});
|
package/dist/parallel-worker.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
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
|
-
import{n as e,t}from"./worker.js";import{
|
|
9
|
+
import{n as e,t}from"./worker.js";import{Lt as n,N as r,U as i,V as a,en as o,f as s,n as c,nt as l,t as u,u as d,z as f}from"./transfer.js";const p=(e,p)=>{let m=new Map(e.modules),h=e=>m.get(e),g=new Map(e.classes),_=d(e.config,{...e,loadModule:h,loadClass:e=>g.get(e),seed:void 0},()=>{},!0),v=_.specification,y=v.environment,b=s(e.config,y,v.variableLocations,()=>_.order.getDeclarationOrder(`variable`),void 0,[],v.runtimeInvariants),x=b?.spec.next;if(!b||x===void 0)return p.postMessage({type:`abort`});let S=e.index,C=n(),w=u(y.variables.length),T=e.fingerprints,E=e.requests,D=e.remaining,O=b.isSymmetric?r():void 0,k=/* @__PURE__ */ new Int32Array(2),A=()=>{},j=e=>{};e.ports.forEach(e=>{e?.addEventListener(`message`,e=>j(e.data)),e?.start?.()});let M=w(e.seed).map(C),N=t(),P=(t,n)=>{let r=Atomics.load(E,S)-1,i=Math.floor((t.end-t.origin-1)/2),a=c(),o=t.states.slice(t.end-i,t.end),s=i>0&&o.every(a.encode);s&&(t.end-=i);let l=s?a.finish():c().finish();e.ports[r]?.postMessage(l,[l.words.buffer]),Atomics.store(E,S,n),Atomics.notify(E,S)},F=e=>{Atomics.store(D,S,0),Atomics.compareExchange(E,S,0,-1)!==0&&P(e,-1)},I=e=>{Atomics.store(D,S,e.end-e.origin),Atomics.store(E,S,0)},L=t=>{for(;t.origin<t.end;t.origin++){let n=t.states[t.origin];if(!t.successors){if(performance.now()>=t.breakAt)return`break`;if(Atomics.load(E,S)>0&&P(t,0),Atomics.store(D,S,t.end-t.origin-1),t.successors=l(x,n,y,b.spec.scope),t.generated+=t.successors.length,t.successors.length===0&&e.config.checkDeadlock)return}let r=t.successors;for(;t.index<r.length;t.index++){if(a(T))return`paused`;let e=r[t.index];if(b.findViolatedActionProperty(n,e.state))return;if(!b.satisfiesActionConstraints(n,e.state)){if(b.findViolatedInvariant(e.state,n))return;continue}if(O&&(i(e.state,k),!O.insert(k[0],k[1])))continue;C(e.state);let o=b.getFingerprintState(e.state);if(i(o,k),f(T,k[0],k[1])){if(b.findViolatedInvariant(e.state,n))return;b.satisfiesConstraints(e.state,n)&&(t.next.push(e.state),t.fingerprintStates.push(o),t.added++)}}t.outDegrees[Math.min(t.added,31)]++,t.successors=void 0,t.index=0,t.added=0}return`done`},R=async t=>{let n=/* @__PURE__ */ new Set;for(;;){let r=e.ports.reduce((e,t,r)=>!t||n.has(r)||Atomics.load(D,r)<2?e:e===void 0||Atomics.load(D,r)>Atomics.load(D,e)?r:e,void 0);if(r===void 0)return!1;let i=Atomics.compareExchange(E,r,0,S+1);if(i===-1&&n.add(r),i>0&&Atomics.wait(E,r,i),i!==0)continue;let a=await new Promise(e=>j=e);if(a.count===0)n.add(r);else return t.states=w(a).map(C),t.origin=0,t.end=t.states.length,I(t),!0}},z=e=>p.postMessage(e,e.type===`level`?[e.fingerprints.buffer]:[]),B=async()=>{let e={states:M,origin:0,end:M.length,successors:void 0,index:0,added:0,generated:0,outDegrees:Array.from({length:32},()=>0),next:[],fingerprintStates:[],breakAt:performance.now()+100};for(;;){let t=L(e);if(t===void 0)return;if(t===`break`)await N(),e.breakAt=performance.now()+100;else if(F(e),t===`paused`){let t=new Promise(e=>A=e);z({type:`paused`}),await t,I(e)}else if(!await R(e))break}let t=o();return t===void 0?(M=e.next,Atomics.store(D,S,M.length),{type:`level`,generated:e.generated,added:e.next.length,outDegrees:e.outDegrees,fingerprints:b.getStoredFingerprints(e.next,e.fingerprintStates)}):{type:`abort`,string:t}},V=()=>{B().then(e=>z(e??{type:`abort`}),()=>z({type:`abort`}))};p.addEventListener(`message`,e=>{let t=e.data;t.type===`level`&&V(),t.type===`resize`&&(T=t.fingerprints,A())}),Atomics.store(D,S,M.length),z({type:`ready`})};e().then(e=>{let t=n=>{let r=n.data;if(r.type===`start`){e.removeEventListener?.(`message`,t);try{p(r,e)}catch{e.postMessage({type:`abort`})}}};e.addEventListener(`message`,t),e.start?.()});
|