tla-ts 0.0.6 → 0.0.7-dev.bd12468
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/run.cjs +1 -1
- package/dist/run.js +1 -1
- package/dist/transfer.cjs +12 -12
- package/dist/transfer.js +12 -12
- package/package.json +1 -1
- package/src/search.ts +4 -7
- package/src/successors.ts +81 -21
- package/src/tlc/fingerprint.ts +75 -60
package/dist/run.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
const e=require("./tlapm.cjs"),t=require("./worker.cjs"),n=require("./transfer.cjs"),r=require("./prove.cjs");let i=require("node:path"),a=require("node:fs"),o=require("node:url"),s=require("node:os"),c=require("node:v8");const l=`META-INF/MANIFEST.MF`,u=async e=>{if(e===void 0||!(0,a.existsSync)(e))return`master`;let t=await import(`fflate`),n=t.unzipSync((0,a.readFileSync)(e),{filter:e=>e.name===l})[l];return(n&&/^X-Git-Tag: *(\S*)/m.exec(t.strFromU8(n))?.[1])===`v1.7.4`?`1.7.4`:`master`},d=/[*?[{]/,f=e=>e.flatMap(e=>d.test(e)?(0,a.globSync)(e).sort().map(e=>({path:e,isGlobbed:!0})):[{path:e,isGlobbed:!1}]),p=(e,t)=>e.map(e=>(0,i.join)(e,`${t}.tla`)).find(a.existsSync),m=e=>t=>{let n=p(e,t);return n===void 0?void 0:(0,a.readFileSync)(n,`utf8`)},h=(e,t,n)=>console.error(`File does not exist: ${e}/${t} while looking in these directories: ${e}, ${n.join(`, `)}, classpath:/tla2sany/StandardModules, classpath:/`),g=e=>`jar:file:${(0,o.pathToFileURL)((0,i.resolve)(e)).pathname}!/tla2sany/StandardModules/`,_=(e,r)=>{if(e instanceof t.m||e instanceof t.g){let t=n.yt(e.message),i=t&&!t.isEvalException?t.code:n.ft.general;return r.print(i,n.pt.error,n.ht(i,e.message,r.isTool))}console.error(`${e.name}: ${e.message}`)},v=async(e,r=n.mt(!1))=>{try{return await e()}catch(e){if(!(e instanceof t.h))throw e;return _(e,r),t.B(e)}},y=(e,t,n)=>console.error(`File does not exist: ${(0,i.isAbsolute)(e)?e:`${process.cwd()}/${e}`} while looking in these directories: ${[...t,...n===void 0?[]:[g(n)]].join(`, `)}`),b=e=>e.endsWith(`/`)?e:`${e}/`,x=(e,t)=>r=>{let i=e(r);return i===void 0&&!n.L.has(r)&&t(`${r}.tla`),i},S=e=>e.classPath?.split(i.delimiter).find(e=>e.endsWith(`.jar`));var C=`0.0.
|
|
9
|
+
const e=require("./tlapm.cjs"),t=require("./worker.cjs"),n=require("./transfer.cjs"),r=require("./prove.cjs");let i=require("node:path"),a=require("node:fs"),o=require("node:url"),s=require("node:os"),c=require("node:v8");const l=`META-INF/MANIFEST.MF`,u=async e=>{if(e===void 0||!(0,a.existsSync)(e))return`master`;let t=await import(`fflate`),n=t.unzipSync((0,a.readFileSync)(e),{filter:e=>e.name===l})[l];return(n&&/^X-Git-Tag: *(\S*)/m.exec(t.strFromU8(n))?.[1])===`v1.7.4`?`1.7.4`:`master`},d=/[*?[{]/,f=e=>e.flatMap(e=>d.test(e)?(0,a.globSync)(e).sort().map(e=>({path:e,isGlobbed:!0})):[{path:e,isGlobbed:!1}]),p=(e,t)=>e.map(e=>(0,i.join)(e,`${t}.tla`)).find(a.existsSync),m=e=>t=>{let n=p(e,t);return n===void 0?void 0:(0,a.readFileSync)(n,`utf8`)},h=(e,t,n)=>console.error(`File does not exist: ${e}/${t} while looking in these directories: ${e}, ${n.join(`, `)}, classpath:/tla2sany/StandardModules, classpath:/`),g=e=>`jar:file:${(0,o.pathToFileURL)((0,i.resolve)(e)).pathname}!/tla2sany/StandardModules/`,_=(e,r)=>{if(e instanceof t.m||e instanceof t.g){let t=n.yt(e.message),i=t&&!t.isEvalException?t.code:n.ft.general;return r.print(i,n.pt.error,n.ht(i,e.message,r.isTool))}console.error(`${e.name}: ${e.message}`)},v=async(e,r=n.mt(!1))=>{try{return await e()}catch(e){if(!(e instanceof t.h))throw e;return _(e,r),t.B(e)}},y=(e,t,n)=>console.error(`File does not exist: ${(0,i.isAbsolute)(e)?e:`${process.cwd()}/${e}`} while looking in these directories: ${[...t,...n===void 0?[]:[g(n)]].join(`, `)}`),b=e=>e.endsWith(`/`)?e:`${e}/`,x=(e,t)=>r=>{let i=e(r);return i===void 0&&!n.L.has(r)&&t(`${r}.tla`),i},S=e=>e.classPath?.split(i.delimiter).find(e=>e.endsWith(`.jar`));var C=`0.0.7-dev.bd12468`;const w=2224400062,T={int8:0,int16:1,int32:2,shared8:4,shared16:5,shared32:6,block32:8,string8:9,string32:10,doubleLittle:12},E={smallInt:64,smallString:32,smallBlock:128},D=(e,...t)=>({tag:e,fields:t}),O=e=>typeof e==`object`&&`tag`in e,ee=(e,n)=>{let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<n+20||r.getUint32(n)!==w)throw new t.C(`corrupted fingerprint file`);let i=n+20+r.getUint32(n+4),a=[],o={position:n+20},s=e=>{let n=o.position;if(o.position+=e,o.position>i)throw new t.C(`corrupted fingerprint file`);return n},c=new TextDecoder,l=t=>{let n=s(t),r=c.decode(e.subarray(n,n+t));return a.push(r),r},u=(e,t)=>{let n=D(e);t>0&&a.push(n);for(let e=0;e<t;e++)n.fields.push(f());return n},d=e=>a[a.length-e],f=()=>{let n=e[s(1)];if(n>=E.smallBlock)return u(n&15,n>>4&7);if(n>=E.smallInt)return n&63;if(n>=E.smallString)return l(n&31);switch(n){case T.int8:return r.getInt8(s(1));case T.int16:return r.getInt16(s(2));case T.int32:return r.getInt32(s(4));case T.shared8:return d(r.getUint8(s(1)));case T.shared16:return d(r.getUint16(s(2)));case T.shared32:return d(r.getUint32(s(4)));case T.block32:{let e=r.getUint32(s(4));return u(e&255,e>>>10)}case T.string8:return l(r.getUint8(s(1)));case T.string32:return l(r.getUint32(s(4)));case T.doubleLittle:{let e={float:r.getFloat64(s(8),!0)};return a.push(e),e}}throw new t.C(`corrupted fingerprint file`)};return{value:f(),next:i}},te=e=>{let t=[],n={objects:0,words32:0,words64:0},r=(e,n)=>{for(let r=(n-1)*8;r>=0;r-=8)t.push(e>>>r&255)},i=new TextEncoder,a=e=>{if(typeof e==`number`)return e>=0&&e<64?t.push(E.smallInt+e):e>=-128&&e<128?t.push(T.int8,e&255):e>=-32768&&e<32768?(t.push(T.int16),r(e,2)):(t.push(T.int32),r(e,4));if(n.objects++,typeof e==`string`){let a=i.encode(e);a.length<32?t.push(E.smallString+a.length):a.length<256?t.push(T.string8,a.length):(t.push(T.string32),r(a.length,4)),t.push(...a),n.words32+=1+Math.floor((a.length+4)/4),n.words64+=1+Math.floor((a.length+8)/8);return}if(!O(e)){let r=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));r.setFloat64(0,e.float,!0),t.push(T.doubleLittle,...new Uint8Array(r.buffer)),n.words32+=3,n.words64+=2;return}let o=e.fields.length;o===0?n.objects--:(n.words32+=1+o,n.words64+=1+o),e.tag<16&&o<8?t.push(E.smallBlock+e.tag+(o<<4)):(t.push(T.block32),r(o*1024+e.tag,4)),e.fields.forEach(a)};a(e);let o=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(20));return[w,t.length,n.objects,n.words32,n.words64].forEach((e,t)=>o.setUint32(t*4,e)),new Uint8Array([...new Uint8Array(o.buffer),...t])},k=20210223,A={zenon:{field:1,tag:1},isabelle:{field:2,tag:0},smt:{field:10,tag:8},z3:{field:11,tag:9},ls4:{field:17,tag:16}},j=[`false`,`timeout`],ne=`tla-ts ${C}`,re=/* @__PURE__ */ new Map([[A.zenon.field,3],[A.isabelle.field,4]]),M=(e,t)=>e!==void 0&&O(e)?e.fields[t]:void 0,ie=e=>e!==void 0&&typeof e==`object`&&`float`in e?e.float:1/0,N=e=>{let t=new TextEncoder().encode(e),n=(e,t)=>e<<t|e>>>32-t,r=Array.from({length:Math.ceil(t.length/4)},(e,n)=>t[n*4]|t[n*4+1]<<8|t[n*4+2]<<16|t[n*4+3]<<24).reduce((e,t)=>{let r=Math.imul(n(Math.imul(t,3432918353),15),461845907);return Math.imul(n(e^r,13),5)+3864292196|0},0),i=Math.imul(r^t.length^(r^t.length)>>>16,2246822507),a=Math.imul(i^i>>>13,3266489909);return(a^a>>>16)&1073741823},ae=e=>e!==void 0&&O(e)?[[e.fields[0],e.fields[1]],...ae(e.fields[2])]:[],oe=(e,n,r)=>{let i=(0,a.readFileSync)(n),o=ee(i,0),s=ee(i,o.next).value;if(o.value!==k||!O(s)||s.tag!==0)throw new t.C(`corrupted fingerprint file`);let c=M(M(s,0),1),l=(e,t)=>{let n=re.get(t);return!r||n===void 0||M(M(e,0),n)===ne};e.clear(),(c!==void 0&&O(c)?c.fields:[]).flatMap(e=>ae(e).toReversed()).forEach(([n,r])=>{if(typeof n!=`string`||!O(r))throw new t.C(`corrupted fingerprint file`);e.set(n,r.fields.map((e,t)=>l(e,t)?e:0))})},se=(e,t)=>{let n=M(t,0),r=M(n,0),i=M(M(n,1),0);if(r===void 0||r===1)return;let a=ie(M(e===`isabelle`?M(i,0):i,0)),o=e===`isabelle`?M(i,1):void 0,s=M(M(r,0),0);return{method:{prover:e,timeLimitMs:a*1e3,...typeof o==`string`&&{tactic:o}},isProved:r===0,isReused:!1,...s!==void 0&&{reason:typeof s==`number`?j[s]:String(M(s,0))}}},ce=e=>{let t=/* @__PURE__ */ new Date,n=e.method,r={float:n.rlimit??n.timeLimitMs/1e3},i=n.prover===`zenon`?D(0,r,5):n.prover===`isabelle`?D(0,D(0,r),n.tactic??`auto`):D(0,r),a=j.indexOf(e.reason??``),o=e.reason===void 0?0:D(0,a===-1?D(0,e.reason):a);return D(0,D(0,D(0,e.isProved?0:D(0,o),D(A[n.prover].tag,i)),D(0,t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()),ne,ne,ne))},le=e=>{let t=2**Math.max(9,Math.ceil(Math.log2(e.size/2))),n=Array.from({length:t},()=>0);return e.forEach((e,r)=>{let i=N(r)&t-1;n[i]=D(0,r,D(0,...e),n[i])}),D(0,D(0,e.size,D(0,...n),0,512))},ue=e=>String(e).padStart(2,`0`),de=(e,t)=>{let n=/* @__PURE__ */ new Date,r=`${e}.history`,o=(0,i.join)(r,`${n.getFullYear()}-${ue(n.getMonth()+1)}-${ue(n.getDate())}_${ue(n.getHours())}_${ue(n.getMinutes())}_${ue(n.getSeconds())}`);(0,a.mkdirSync)(o,{recursive:!0}),[e,...t].filter(e=>(0,a.existsSync)(e)).forEach(e=>(0,a.cpSync)(e,(0,i.join)(o,(0,i.basename)(e)),{preserveTimestamps:!0})),(0,a.readdirSync)(r).map(e=>(0,i.join)(r,e)).sort((e,t)=>(0,a.statSync)(t).mtimeMs-(0,a.statSync)(e).mtimeMs).slice(10).forEach(e=>(0,a.rmSync)(e,{recursive:!0,force:!0}))},fe=e=>{let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=new Map([...e].map(([e,r])=>{let i=new Map(Object.entries(A).flatMap(([e,n])=>{let i=se(e,M(r[n.field],0));return i?(t.set(i,r[n.field]),[[e,i]]):[]}));return n.set(i,r),[e,i]}));return{results:r,save:i=>{e.clear(),r.forEach((r,i)=>{let a=[...n.get(r)??Array(23).fill(0)];r.forEach((e,n)=>{a[A[n].field]=t.get(e)??ce(e)}),e.set(i,a)}),(0,a.writeFileSync)(`${i}.tmp`,Buffer.concat([te(k),te(le(e))])),(0,a.renameSync)(`${i}.tmp`,i)}}},pe=(e,t)=>{let n=new Map(t.map(e=>{let[t,...n]=e.flag.split(` `);return[t,e.getArity??(()=>n.length)]}));return{usage:e.replace(`{options}`,t.map(e=>`[${e.flag}]${e.isRepeatable?`...`:``}`).join(` `)),parse:e=>{let t=[],r=[],i=[],a=[];for(let o=0;o<e.length;o++){let s=n.get(e[o]);if(s===void 0){(e[o].startsWith(`-`)?i:r).push(e[o]);continue}let c=s(e.slice(o+1)),l={name:e[o],values:e.slice(o+1,o+1+c)};t.push(l),l.values.length<c&&a.push(l),o+=c}return{options:t,positionals:r,unknown:i,incomplete:a[0],has:e=>t.some(t=>t.name===e),get:e=>t.findLast(t=>t.name===e)?.values}}}},me=pe(`tla-ts <Spec.tla|Spec.cfg|glob>... {options}`,[{flag:`-config <Spec.cfg>`},{flag:`-deadlock`},{flag:`-dump [<format>] <file>`,getArity:e=>e.length>1&&e[0].startsWith(`dot`)?2:1},{flag:`-fp <num>`},{flag:`-lncheck <final|default>`},{flag:`-metadir <directory>`},{flag:`-nowarning`},{flag:`-seed <num>`},{flag:`-tool`},{flag:`-workers <count|auto>`}]),P=pe(`tla-ts tlapm {options} <Module.tla|glob>...`,[{flag:`-N`},{flag:`--summary`},{flag:`--strict`},{flag:`--toolbox <start> <end>`},{flag:`--line <num>`},{flag:`--printallobs`},{flag:`--threads <num>`},{flag:`--version`},{flag:`-I <directory>`,isRepeatable:!0},{flag:`-k`},{flag:`--noproving`},{flag:`--nofp`},{flag:`--nofpl <start> <end>`},{flag:`--safefp`},{flag:`--cleanfp`},{flag:`--usefp <file>`},{flag:`--cache-dir <directory>`}]),F=[`Usage: ${me.usage}`,` ${P.usage}`,` tla-ts [<JVM option>]... tlc2.TLC <TLC option>... <Spec>`,` (-cp tla2tools.jar or -Dtla-ts.tlc=1.7.4 picks the TLC to reproduce)`,` tla-ts [<JVM option>]... tla2sany.xml.XMLExporter [-I <directory>]... [-o] [-t] [-r] [-u] <Module.tla>`].join(`
|
|
10
10
|
`),he=/* @__PURE__ */ new Set([`--toolbox`,`--line`,`--threads`,`--nofpl`]),ge=t=>[`.`,...e.t().map(e=>(0,i.join)((0,i.dirname)((0,i.dirname)((0,a.realpathSync)(e))),`lib/tlapm/stdlib`)).filter(e=>(0,a.existsSync)(e)).slice(0,1),...t.options.flatMap(e=>e.name===`-I`?e.values:[]).toReversed()],_e=e=>console.error(`@!!BEGIN\n${e.map(e=>`@!!${e}\n`).join(``)}@!!END\n`),ve=(e,t,n)=>_e([`type:obligation`,`id:${e.id}`,`loc:${e.location}`,`status:${t}`,...n]),ye=`9ed0376`,be=e=>/^[+,\-./0-9:=@A-Z_a-z]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,xe={failed:10,incomplete:11,emptyTarget:12},Se=(e,t,n)=>{let i=e.summary;n||(i.absent.forEach(e=>console.error(`Missing proof at ${r.p(e)}`)),i.omitted.forEach(e=>console.error(`Omitted proof at ${r.p(e)}`)));let a=i.absent.length+i.omitted.length>0;a&&console.error(`${r.f(e.location)}[ERROR]: Proof incomplete in module ${JSON.stringify(e.name)}: ${i.absent.length} missing, ${i.omitted.length} omitted proof step(s).`);let o=t&&e.obligations.length===0;return o&&console.error(`${r.f(e.location)}[ERROR]: No proof obligation found for the selected target.`),[...a?[xe.incomplete]:[],...o?[xe.emptyTarget]:[]]},Ce=e=>{try{return e()}catch(e){if(!(e instanceof t.C))throw e;console.error(` tlapm ending abnormally with ${e.exception}\n`);return}},we=(e,t)=>{let n=t.method.timeLimitMs,i=t.timeUsedMs===void 0?``:`; time-used: ${(t.timeUsedMs/1e3).toFixed(1)} (${Math.round(100*t.timeUsedMs/n)}%)`,a=n===0?``:`time-limit: ${n===1/0?`inf`:Number((n/1e3).toPrecision(6))}${i}`,o=[t.method.tactic,a].filter(Boolean).join(`; `),s=(t.method.prover===`smt`||t.method.prover===`z3`)&&t.reason===`false`&&t.verdict?`(* SMT failed with status = ${t.verdict}\n *)\n`:``;ve(e,t.isProved?`proved`:`failed`,[`prover:${t.method.prover}`,...o===``?[]:[`meth:${o}`],...t.reason===void 0?[]:[`reason:${t.reason}`],`already:${t.isReused}`,...t.isProved?[]:[`obl:${t.isReused?``:`\n${s}`}${r.n(e,t.isReused)}`]])},Te=(e,t)=>ve(e,`failed`,[`prover:fail`,`meth:time-limit: inf`,`reason:${t}`,`already:false`,`obl:${e.text}`]),Ee=async(e,t,n,i)=>{let o=fe(i.fingerprints),s=await r.i(e.obligations,{workers:i.workers,results:o.results,isFingerprinted:i.isFingerprinted,isProving:i.isProving,onReport:(e,t)=>{if(i.isToolbox){if(e.obligation.status===`trivial`)return ve(t,`trivial`,[`prover:tlapm`,`already:false`]);if(t.kind.kind===`Error`)return Te(t,`user error`);e.attempts.forEach(e=>we(t,e))}}});if((0,a.writeFileSync)(t,r.t(e.name,s,e.obligations)),console.log(`(* created new ${JSON.stringify(t)} *)`),o.save(n),console.log(`(* fingerprints written in ${JSON.stringify(n)} *)`),!i.isProving)return!1;let c=s.flatMap((t,n)=>`reason`in t.obligation?[{report:t,obligation:e.obligations[n]}]:[]);i.isToolbox&&c.filter(e=>e.report.attempts.length===0&&e.obligation.kind.kind!==`Error`).forEach(e=>Te(e.obligation,`unexpected error`)),c.toReversed().forEach(e=>console.error(`${r.f(e.obligation.locus)}${r.d(r.u(`[ERROR]: @[<v2>Could not prove or check:@,%a@]`,r.l(e.obligation.sequent)),35)}`));let l=`${e.obligations.length} obligation${e.obligations.length>1?`s`:``}`;return console.error(c.length===0?`${r.f(e.location)}[INFO]: All ${l} proved.`:`${r.f(e.location)}[ERROR]: ${c.length}/${l} failed.\nThere were backend errors processing module \`${JSON.stringify(e.name)}\`.`),c.length>0},De=async e=>{let o=P.parse(e),c=!o.has(`-N`)&&!o.has(`--summary`),l=o.unknown[0]??(c&&o.has(`--printallobs`)?`--printallobs`:void 0);if(l!==void 0)return console.error(`Error: tla-ts tlapm does not support the tlapm option ${l}.`),1;if(o.incomplete)return console.error(`Error: option '${o.incomplete.name}' needs an argument.`),1;let u=o.options.find(e=>he.has(e.name)&&e.values.some(e=>!/^-?\d+$/.test(e)));if(u)return console.error(`Error: option '${u.name}' expects an integer.`),1;if(o.has(`--version`))return console.log(ye),t.U.success;let d=f(o.positionals).map(e=>e.path),p=d.map(e=>e.endsWith(`.tla`)?e:`${e}.tla`);if(p.length===0)return console.error(F),1;let m=o.has(`--toolbox`)||o.has(`--line`);m&&console.log(`\n\\* TLAPM version ${ye}\n\\* launched at ${n._t(/* @__PURE__ */ new Date)} with command line:\n\\* ${[`tla-ts`,`tlapm`,...e].map(be).join(` `)}\n`);let h=o.options.reduce((e,t)=>{let[n,i]=t.values.map(Number);return t.name===`--toolbox`?{start:n,end:i===0?1/0:i}:t.name===`--line`?n===0?r.o:{start:n,end:n}:e},r.o),g=p.reduce((e,t)=>e.includes((0,i.dirname)(t))?e:[(0,i.dirname)(t),...e],ge(o)),_=/* @__PURE__ */ new Set,v=Ce(()=>{let e=p.findIndex(e=>!(0,a.existsSync)(e));if(e!==-1){let n=d[e];throw console.error(`File "<unknown>":\nError: File ${JSON.stringify(n)} not found`),new t.C(`File ${n} not found`,{failure:`Module.Parser.parse_file`})}return r.c(p.map(e=>({file:`./${e}`,source:(0,a.readFileSync)(e,`utf8`)})),e=>{_.add(e);let t=g.map(t=>`${t}/${e}.tla`).find(e=>(0,a.existsSync)(e));return t===void 0?e===`TLAPS`?{file:`TLAPS.tla`,source:r.a}:void 0:{file:t,source:(0,a.readFileSync)(t,`utf8`)}},{lines:h,onWarning:e=>{if(e.channel===`stdout`)return console.log(e.text);let t=e.channel===`toolbox`||e.channel===`toolboxOnly`;if(m&&t)return _e([`type:warning`,`msg:${e.text}`]);e.channel!==`toolboxOnly`&&console.error(e.text)}})});if(!v)return 3;let y=o.get(`--cache-dir`)?.[0]??process.env.TLAPM_CACHE_DIR??`.tlacache`,b=o.get(`--nofpl`)?.map(Number)??[0,0],x={isToolbox:m,isProving:!o.has(`--noproving`),workers:Math.max(1,Number(o.get(`--threads`)?.[0]??(0,s.availableParallelism)())),isFingerprinted:e=>!o.has(`--nofp`)&&!(e.locus&&e.locus.startLine>=b[0]&&e.locus.endLine<=b[1]),fingerprints:/* @__PURE__ */ new Map},S=[];for(let[e,t]of v.entries()){let n=`${y}/${t.name}.tlaps`,i=`${n}/fingerprints`,s=o.get(`--usefp`)?.[0]??i;if((0,a.mkdirSync)(n,{recursive:!0}),o.has(`--cleanfp`)&&(0,a.existsSync)(i)&&((0,a.rmSync)(i),console.log(`(* fingerprints file ${JSON.stringify(i)} removed *)`)),!o.has(`--cleanfp`)&&(0,a.existsSync)(s)&&t.summary.total!==0&&(console.log(o.has(`--nofp`)?`(* will not use fingerprints (because of option \`--nofp\`), but will now load fingerprints from the file \`${s}\`, in order to overwrite with the new fingerprints, and then save the results at the end. *)`:`(* loading fingerprints in ${JSON.stringify(s)} *)`),oe(x.fingerprints,s,o.has(`--safefp`))),o.has(`--summary`)&&console.log(r.s(t)),m&&(t.obligations.forEach(e=>ve(e,`to be proved`,o.has(`--printallobs`)?[`obl:${e.text}`]:[])),_e([`type:obligationsnumber`,`count:${t.obligations.length}`])),o.has(`--strict`)&&S.push(...Se(t,h.start>0||h.end<1/0,o.has(`--summary`))),!c)continue;de(i,[..._,...v.slice(0,e+1).map(e=>e.name)].map(e=>`${e}.tla`));let l=await Ee(t,`${n}/${t.name}.thy`,i,x);if(l&&o.has(`--strict`)&&S.push(xe.failed),l&&!o.has(`--strict`)&&!m)return console.error(` tlapm ending abnormally with Failure("backend errors: there are unproved obligations")
|
|
11
11
|
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
|
|
12
12
|
Called from Tlapm_lib.process_module in file "src/tlapm_lib.ml", lines 492-493, characters 12-37
|
package/dist/run.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import{t as e}from"./tlapm.js";import{B as t,C as n,D as r,G as i,N as a,T as o,U as s,V as c,a as l,b as u,g as d,h as f,k as p,m,o as h,s as g,x as _}from"./worker.js";import{B as v,G as y,H as b,K as x,Kt as S,L as C,R as w,U as ee,Ut as T,V as E,X as D,Xt as te,Zt as ne,_t as O,f as k,ft as A,gt as re,ht as ie,jt as ae,l as j,mt as oe,p as M,pt as N,qt as se,u as ce,vt as le,yt as ue,z as de}from"./transfer.js";import{a as fe,c as pe,d as me,f as he,h as ge,i as P,l as _e,m as ve,n as ye,o as be,p as xe,s as Se,t as Ce,u as we}from"./prove.js";import{basename as Te,delimiter as Ee,dirname as De,isAbsolute as Oe,join as ke,resolve as Ae}from"node:path";import{cpSync as je,existsSync as F,globSync as I,mkdirSync as Me,readFileSync as Ne,readSync as Pe,readdirSync as Fe,realpathSync as Ie,renameSync as Le,rmSync as Re,statSync as ze,writeFileSync as Be}from"node:fs";import{pathToFileURL as Ve}from"node:url";import{arch as He,availableParallelism as Ue,release as We,tmpdir as Ge,type as Ke}from"node:os";import{getHeapStatistics as qe}from"node:v8";const Je=`META-INF/MANIFEST.MF`,Ye=async e=>{if(e===void 0||!F(e))return`master`;let t=await import(`fflate`),n=t.unzipSync(Ne(e),{filter:e=>e.name===Je})[Je];return(n&&/^X-Git-Tag: *(\S*)/m.exec(t.strFromU8(n))?.[1])===`v1.7.4`?`1.7.4`:`master`},Xe=/[*?[{]/,Ze=e=>e.flatMap(e=>Xe.test(e)?I(e).sort().map(e=>({path:e,isGlobbed:!0})):[{path:e,isGlobbed:!1}]),Qe=(e,t)=>e.map(e=>ke(e,`${t}.tla`)).find(F),$e=e=>t=>{let n=Qe(e,t);return n===void 0?void 0:Ne(n,`utf8`)},et=(e,t,n)=>console.error(`File does not exist: ${e}/${t} while looking in these directories: ${e}, ${n.join(`, `)}, classpath:/tla2sany/StandardModules, classpath:/`),tt=e=>`jar:file:${Ve(Ae(e)).pathname}!/tla2sany/StandardModules/`,nt=(e,t)=>{if(e instanceof m||e instanceof d){let n=ue(e.message),r=n&&!n.isEvalException?n.code:A.general;return t.print(r,N.error,ie(r,e.message,t.isTool))}console.error(`${e.name}: ${e.message}`)},rt=async(e,n=oe(!1))=>{try{return await e()}catch(e){if(!(e instanceof f))throw e;return nt(e,n),t(e)}},it=(e,t,n)=>console.error(`File does not exist: ${Oe(e)?e:`${process.cwd()}/${e}`} while looking in these directories: ${[...t,...n===void 0?[]:[tt(n)]].join(`, `)}`),at=e=>e.endsWith(`/`)?e:`${e}/`,ot=(e,t)=>n=>{let r=e(n);return r===void 0&&!C.has(n)&&t(`${n}.tla`),r},st=e=>e.classPath?.split(Ee).find(e=>e.endsWith(`.jar`));var ct=`0.0.
|
|
9
|
+
import{t as e}from"./tlapm.js";import{B as t,C as n,D as r,G as i,N as a,T as o,U as s,V as c,a as l,b as u,g as d,h as f,k as p,m,o as h,s as g,x as _}from"./worker.js";import{B as v,G as y,H as b,K as x,Kt as S,L as C,R as w,U as ee,Ut as T,V as E,X as D,Xt as te,Zt as ne,_t as O,f as k,ft as A,gt as re,ht as ie,jt as ae,l as j,mt as oe,p as M,pt as N,qt as se,u as ce,vt as le,yt as ue,z as de}from"./transfer.js";import{a as fe,c as pe,d as me,f as he,h as ge,i as P,l as _e,m as ve,n as ye,o as be,p as xe,s as Se,t as Ce,u as we}from"./prove.js";import{basename as Te,delimiter as Ee,dirname as De,isAbsolute as Oe,join as ke,resolve as Ae}from"node:path";import{cpSync as je,existsSync as F,globSync as I,mkdirSync as Me,readFileSync as Ne,readSync as Pe,readdirSync as Fe,realpathSync as Ie,renameSync as Le,rmSync as Re,statSync as ze,writeFileSync as Be}from"node:fs";import{pathToFileURL as Ve}from"node:url";import{arch as He,availableParallelism as Ue,release as We,tmpdir as Ge,type as Ke}from"node:os";import{getHeapStatistics as qe}from"node:v8";const Je=`META-INF/MANIFEST.MF`,Ye=async e=>{if(e===void 0||!F(e))return`master`;let t=await import(`fflate`),n=t.unzipSync(Ne(e),{filter:e=>e.name===Je})[Je];return(n&&/^X-Git-Tag: *(\S*)/m.exec(t.strFromU8(n))?.[1])===`v1.7.4`?`1.7.4`:`master`},Xe=/[*?[{]/,Ze=e=>e.flatMap(e=>Xe.test(e)?I(e).sort().map(e=>({path:e,isGlobbed:!0})):[{path:e,isGlobbed:!1}]),Qe=(e,t)=>e.map(e=>ke(e,`${t}.tla`)).find(F),$e=e=>t=>{let n=Qe(e,t);return n===void 0?void 0:Ne(n,`utf8`)},et=(e,t,n)=>console.error(`File does not exist: ${e}/${t} while looking in these directories: ${e}, ${n.join(`, `)}, classpath:/tla2sany/StandardModules, classpath:/`),tt=e=>`jar:file:${Ve(Ae(e)).pathname}!/tla2sany/StandardModules/`,nt=(e,t)=>{if(e instanceof m||e instanceof d){let n=ue(e.message),r=n&&!n.isEvalException?n.code:A.general;return t.print(r,N.error,ie(r,e.message,t.isTool))}console.error(`${e.name}: ${e.message}`)},rt=async(e,n=oe(!1))=>{try{return await e()}catch(e){if(!(e instanceof f))throw e;return nt(e,n),t(e)}},it=(e,t,n)=>console.error(`File does not exist: ${Oe(e)?e:`${process.cwd()}/${e}`} while looking in these directories: ${[...t,...n===void 0?[]:[tt(n)]].join(`, `)}`),at=e=>e.endsWith(`/`)?e:`${e}/`,ot=(e,t)=>n=>{let r=e(n);return r===void 0&&!C.has(n)&&t(`${n}.tla`),r},st=e=>e.classPath?.split(Ee).find(e=>e.endsWith(`.jar`));var ct=`0.0.7-dev.bd12468`;const lt=2224400062,L={int8:0,int16:1,int32:2,shared8:4,shared16:5,shared32:6,block32:8,string8:9,string32:10,doubleLittle:12},ut={smallInt:64,smallString:32,smallBlock:128},R=(e,...t)=>({tag:e,fields:t}),dt=e=>typeof e==`object`&&`tag`in e,ft=(e,t)=>{let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<t+20||r.getUint32(t)!==lt)throw new n(`corrupted fingerprint file`);let i=t+20+r.getUint32(t+4),a=[],o={position:t+20},s=e=>{let t=o.position;if(o.position+=e,o.position>i)throw new n(`corrupted fingerprint file`);return t},c=new TextDecoder,l=t=>{let n=s(t),r=c.decode(e.subarray(n,n+t));return a.push(r),r},u=(e,t)=>{let n=R(e);t>0&&a.push(n);for(let e=0;e<t;e++)n.fields.push(f());return n},d=e=>a[a.length-e],f=()=>{let t=e[s(1)];if(t>=ut.smallBlock)return u(t&15,t>>4&7);if(t>=ut.smallInt)return t&63;if(t>=ut.smallString)return l(t&31);switch(t){case L.int8:return r.getInt8(s(1));case L.int16:return r.getInt16(s(2));case L.int32:return r.getInt32(s(4));case L.shared8:return d(r.getUint8(s(1)));case L.shared16:return d(r.getUint16(s(2)));case L.shared32:return d(r.getUint32(s(4)));case L.block32:{let e=r.getUint32(s(4));return u(e&255,e>>>10)}case L.string8:return l(r.getUint8(s(1)));case L.string32:return l(r.getUint32(s(4)));case L.doubleLittle:{let e={float:r.getFloat64(s(8),!0)};return a.push(e),e}}throw new n(`corrupted fingerprint file`)};return{value:f(),next:i}},pt=e=>{let t=[],n={objects:0,words32:0,words64:0},r=(e,n)=>{for(let r=(n-1)*8;r>=0;r-=8)t.push(e>>>r&255)},i=new TextEncoder,a=e=>{if(typeof e==`number`)return e>=0&&e<64?t.push(ut.smallInt+e):e>=-128&&e<128?t.push(L.int8,e&255):e>=-32768&&e<32768?(t.push(L.int16),r(e,2)):(t.push(L.int32),r(e,4));if(n.objects++,typeof e==`string`){let a=i.encode(e);a.length<32?t.push(ut.smallString+a.length):a.length<256?t.push(L.string8,a.length):(t.push(L.string32),r(a.length,4)),t.push(...a),n.words32+=1+Math.floor((a.length+4)/4),n.words64+=1+Math.floor((a.length+8)/8);return}if(!dt(e)){let r=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));r.setFloat64(0,e.float,!0),t.push(L.doubleLittle,...new Uint8Array(r.buffer)),n.words32+=3,n.words64+=2;return}let o=e.fields.length;o===0?n.objects--:(n.words32+=1+o,n.words64+=1+o),e.tag<16&&o<8?t.push(ut.smallBlock+e.tag+(o<<4)):(t.push(L.block32),r(o*1024+e.tag,4)),e.fields.forEach(a)};a(e);let o=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(20));return[lt,t.length,n.objects,n.words32,n.words64].forEach((e,t)=>o.setUint32(t*4,e)),new Uint8Array([...new Uint8Array(o.buffer),...t])},mt=20210223,ht={zenon:{field:1,tag:1},isabelle:{field:2,tag:0},smt:{field:10,tag:8},z3:{field:11,tag:9},ls4:{field:17,tag:16}},gt=[`false`,`timeout`],_t=`tla-ts ${ct}`,vt=/* @__PURE__ */ new Map([[ht.zenon.field,3],[ht.isabelle.field,4]]),yt=(e,t)=>e!==void 0&&dt(e)?e.fields[t]:void 0,bt=e=>e!==void 0&&typeof e==`object`&&`float`in e?e.float:1/0,xt=e=>{let t=new TextEncoder().encode(e),n=(e,t)=>e<<t|e>>>32-t,r=Array.from({length:Math.ceil(t.length/4)},(e,n)=>t[n*4]|t[n*4+1]<<8|t[n*4+2]<<16|t[n*4+3]<<24).reduce((e,t)=>{let r=Math.imul(n(Math.imul(t,3432918353),15),461845907);return Math.imul(n(e^r,13),5)+3864292196|0},0),i=Math.imul(r^t.length^(r^t.length)>>>16,2246822507),a=Math.imul(i^i>>>13,3266489909);return(a^a>>>16)&1073741823},St=e=>e!==void 0&&dt(e)?[[e.fields[0],e.fields[1]],...St(e.fields[2])]:[],Ct=(e,t,r)=>{let i=Ne(t),a=ft(i,0),o=ft(i,a.next).value;if(a.value!==mt||!dt(o)||o.tag!==0)throw new n(`corrupted fingerprint file`);let s=yt(yt(o,0),1),c=(e,t)=>{let n=vt.get(t);return!r||n===void 0||yt(yt(e,0),n)===_t};e.clear(),(s!==void 0&&dt(s)?s.fields:[]).flatMap(e=>St(e).toReversed()).forEach(([t,r])=>{if(typeof t!=`string`||!dt(r))throw new n(`corrupted fingerprint file`);e.set(t,r.fields.map((e,t)=>c(e,t)?e:0))})},wt=(e,t)=>{let n=yt(t,0),r=yt(n,0),i=yt(yt(n,1),0);if(r===void 0||r===1)return;let a=bt(yt(e===`isabelle`?yt(i,0):i,0)),o=e===`isabelle`?yt(i,1):void 0,s=yt(yt(r,0),0);return{method:{prover:e,timeLimitMs:a*1e3,...typeof o==`string`&&{tactic:o}},isProved:r===0,isReused:!1,...s!==void 0&&{reason:typeof s==`number`?gt[s]:String(yt(s,0))}}},Tt=e=>{let t=/* @__PURE__ */ new Date,n=e.method,r={float:n.rlimit??n.timeLimitMs/1e3},i=n.prover===`zenon`?R(0,r,5):n.prover===`isabelle`?R(0,R(0,r),n.tactic??`auto`):R(0,r),a=gt.indexOf(e.reason??``),o=e.reason===void 0?0:R(0,a===-1?R(0,e.reason):a);return R(0,R(0,R(0,e.isProved?0:R(0,o),R(ht[n.prover].tag,i)),R(0,t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()),_t,_t,_t))},Et=e=>{let t=2**Math.max(9,Math.ceil(Math.log2(e.size/2))),n=Array.from({length:t},()=>0);return e.forEach((e,r)=>{let i=xt(r)&t-1;n[i]=R(0,r,R(0,...e),n[i])}),R(0,R(0,e.size,R(0,...n),0,512))},Dt=e=>String(e).padStart(2,`0`),Ot=(e,t)=>{let n=/* @__PURE__ */ new Date,r=`${e}.history`,i=ke(r,`${n.getFullYear()}-${Dt(n.getMonth()+1)}-${Dt(n.getDate())}_${Dt(n.getHours())}_${Dt(n.getMinutes())}_${Dt(n.getSeconds())}`);Me(i,{recursive:!0}),[e,...t].filter(e=>F(e)).forEach(e=>je(e,ke(i,Te(e)),{preserveTimestamps:!0})),Fe(r).map(e=>ke(r,e)).sort((e,t)=>ze(t).mtimeMs-ze(e).mtimeMs).slice(10).forEach(e=>Re(e,{recursive:!0,force:!0}))},kt=e=>{let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=new Map([...e].map(([e,r])=>{let i=new Map(Object.entries(ht).flatMap(([e,n])=>{let i=wt(e,yt(r[n.field],0));return i?(t.set(i,r[n.field]),[[e,i]]):[]}));return n.set(i,r),[e,i]}));return{results:r,save:i=>{e.clear(),r.forEach((r,i)=>{let a=[...n.get(r)??Array(23).fill(0)];r.forEach((e,n)=>{a[ht[n].field]=t.get(e)??Tt(e)}),e.set(i,a)}),Be(`${i}.tmp`,Buffer.concat([pt(mt),pt(Et(e))])),Le(`${i}.tmp`,i)}}},At=(e,t)=>{let n=new Map(t.map(e=>{let[t,...n]=e.flag.split(` `);return[t,e.getArity??(()=>n.length)]}));return{usage:e.replace(`{options}`,t.map(e=>`[${e.flag}]${e.isRepeatable?`...`:``}`).join(` `)),parse:e=>{let t=[],r=[],i=[],a=[];for(let o=0;o<e.length;o++){let s=n.get(e[o]);if(s===void 0){(e[o].startsWith(`-`)?i:r).push(e[o]);continue}let c=s(e.slice(o+1)),l={name:e[o],values:e.slice(o+1,o+1+c)};t.push(l),l.values.length<c&&a.push(l),o+=c}return{options:t,positionals:r,unknown:i,incomplete:a[0],has:e=>t.some(t=>t.name===e),get:e=>t.findLast(t=>t.name===e)?.values}}}},jt=At(`tla-ts <Spec.tla|Spec.cfg|glob>... {options}`,[{flag:`-config <Spec.cfg>`},{flag:`-deadlock`},{flag:`-dump [<format>] <file>`,getArity:e=>e.length>1&&e[0].startsWith(`dot`)?2:1},{flag:`-fp <num>`},{flag:`-lncheck <final|default>`},{flag:`-metadir <directory>`},{flag:`-nowarning`},{flag:`-seed <num>`},{flag:`-tool`},{flag:`-workers <count|auto>`}]),Mt=At(`tla-ts tlapm {options} <Module.tla|glob>...`,[{flag:`-N`},{flag:`--summary`},{flag:`--strict`},{flag:`--toolbox <start> <end>`},{flag:`--line <num>`},{flag:`--printallobs`},{flag:`--threads <num>`},{flag:`--version`},{flag:`-I <directory>`,isRepeatable:!0},{flag:`-k`},{flag:`--noproving`},{flag:`--nofp`},{flag:`--nofpl <start> <end>`},{flag:`--safefp`},{flag:`--cleanfp`},{flag:`--usefp <file>`},{flag:`--cache-dir <directory>`}]),Nt=[`Usage: ${jt.usage}`,` ${Mt.usage}`,` tla-ts [<JVM option>]... tlc2.TLC <TLC option>... <Spec>`,` (-cp tla2tools.jar or -Dtla-ts.tlc=1.7.4 picks the TLC to reproduce)`,` tla-ts [<JVM option>]... tla2sany.xml.XMLExporter [-I <directory>]... [-o] [-t] [-r] [-u] <Module.tla>`].join(`
|
|
10
10
|
`),Pt=/* @__PURE__ */ new Set([`--toolbox`,`--line`,`--threads`,`--nofpl`]),Ft=t=>[`.`,...e().map(e=>ke(De(De(Ie(e))),`lib/tlapm/stdlib`)).filter(e=>F(e)).slice(0,1),...t.options.flatMap(e=>e.name===`-I`?e.values:[]).toReversed()],It=e=>console.error(`@!!BEGIN\n${e.map(e=>`@!!${e}\n`).join(``)}@!!END\n`),Lt=(e,t,n)=>It([`type:obligation`,`id:${e.id}`,`loc:${e.location}`,`status:${t}`,...n]),Rt=`9ed0376`,zt=e=>/^[+,\-./0-9:=@A-Z_a-z]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,Bt={failed:10,incomplete:11,emptyTarget:12},Vt=(e,t,n)=>{let r=e.summary;n||(r.absent.forEach(e=>console.error(`Missing proof at ${xe(e)}`)),r.omitted.forEach(e=>console.error(`Omitted proof at ${xe(e)}`)));let i=r.absent.length+r.omitted.length>0;i&&console.error(`${he(e.location)}[ERROR]: Proof incomplete in module ${JSON.stringify(e.name)}: ${r.absent.length} missing, ${r.omitted.length} omitted proof step(s).`);let a=t&&e.obligations.length===0;return a&&console.error(`${he(e.location)}[ERROR]: No proof obligation found for the selected target.`),[...i?[Bt.incomplete]:[],...a?[Bt.emptyTarget]:[]]},Ht=e=>{try{return e()}catch(e){if(!(e instanceof n))throw e;console.error(` tlapm ending abnormally with ${e.exception}\n`);return}},Ut=(e,t)=>{let n=t.method.timeLimitMs,r=t.timeUsedMs===void 0?``:`; time-used: ${(t.timeUsedMs/1e3).toFixed(1)} (${Math.round(100*t.timeUsedMs/n)}%)`,i=n===0?``:`time-limit: ${n===1/0?`inf`:Number((n/1e3).toPrecision(6))}${r}`,a=[t.method.tactic,i].filter(Boolean).join(`; `),o=(t.method.prover===`smt`||t.method.prover===`z3`)&&t.reason===`false`&&t.verdict?`(* SMT failed with status = ${t.verdict}\n *)\n`:``;Lt(e,t.isProved?`proved`:`failed`,[`prover:${t.method.prover}`,...a===``?[]:[`meth:${a}`],...t.reason===void 0?[]:[`reason:${t.reason}`],`already:${t.isReused}`,...t.isProved?[]:[`obl:${t.isReused?``:`\n${o}`}${ye(e,t.isReused)}`]])},Wt=(e,t)=>Lt(e,`failed`,[`prover:fail`,`meth:time-limit: inf`,`reason:${t}`,`already:false`,`obl:${e.text}`]),Gt=async(e,t,n,r)=>{let i=kt(r.fingerprints),a=await P(e.obligations,{workers:r.workers,results:i.results,isFingerprinted:r.isFingerprinted,isProving:r.isProving,onReport:(e,t)=>{if(r.isToolbox){if(e.obligation.status===`trivial`)return Lt(t,`trivial`,[`prover:tlapm`,`already:false`]);if(t.kind.kind===`Error`)return Wt(t,`user error`);e.attempts.forEach(e=>Ut(t,e))}}});if(Be(t,Ce(e.name,a,e.obligations)),console.log(`(* created new ${JSON.stringify(t)} *)`),i.save(n),console.log(`(* fingerprints written in ${JSON.stringify(n)} *)`),!r.isProving)return!1;let o=a.flatMap((t,n)=>`reason`in t.obligation?[{report:t,obligation:e.obligations[n]}]:[]);r.isToolbox&&o.filter(e=>e.report.attempts.length===0&&e.obligation.kind.kind!==`Error`).forEach(e=>Wt(e.obligation,`unexpected error`)),o.toReversed().forEach(e=>console.error(`${he(e.obligation.locus)}${me(we(`[ERROR]: @[<v2>Could not prove or check:@,%a@]`,_e(e.obligation.sequent)),35)}`));let s=`${e.obligations.length} obligation${e.obligations.length>1?`s`:``}`;return console.error(o.length===0?`${he(e.location)}[INFO]: All ${s} proved.`:`${he(e.location)}[ERROR]: ${o.length}/${s} failed.\nThere were backend errors processing module \`${JSON.stringify(e.name)}\`.`),o.length>0},Kt=async e=>{let t=Mt.parse(e),r=!t.has(`-N`)&&!t.has(`--summary`),i=t.unknown[0]??(r&&t.has(`--printallobs`)?`--printallobs`:void 0);if(i!==void 0)return console.error(`Error: tla-ts tlapm does not support the tlapm option ${i}.`),1;if(t.incomplete)return console.error(`Error: option '${t.incomplete.name}' needs an argument.`),1;let a=t.options.find(e=>Pt.has(e.name)&&e.values.some(e=>!/^-?\d+$/.test(e)));if(a)return console.error(`Error: option '${a.name}' expects an integer.`),1;if(t.has(`--version`))return console.log(Rt),s.success;let o=Ze(t.positionals).map(e=>e.path),c=o.map(e=>e.endsWith(`.tla`)?e:`${e}.tla`);if(c.length===0)return console.error(Nt),1;let l=t.has(`--toolbox`)||t.has(`--line`);l&&console.log(`\n\\* TLAPM version ${Rt}\n\\* launched at ${O(/* @__PURE__ */ new Date)} with command line:\n\\* ${[`tla-ts`,`tlapm`,...e].map(zt).join(` `)}\n`);let u=t.options.reduce((e,t)=>{let[n,r]=t.values.map(Number);return t.name===`--toolbox`?{start:n,end:r===0?1/0:r}:t.name===`--line`?n===0?be:{start:n,end:n}:e},be),d=c.reduce((e,t)=>e.includes(De(t))?e:[De(t),...e],Ft(t)),f=/* @__PURE__ */ new Set,p=Ht(()=>{let e=c.findIndex(e=>!F(e));if(e!==-1){let t=o[e];throw console.error(`File "<unknown>":\nError: File ${JSON.stringify(t)} not found`),new n(`File ${t} not found`,{failure:`Module.Parser.parse_file`})}return pe(c.map(e=>({file:`./${e}`,source:Ne(e,`utf8`)})),e=>{f.add(e);let t=d.map(t=>`${t}/${e}.tla`).find(e=>F(e));return t===void 0?e===`TLAPS`?{file:`TLAPS.tla`,source:fe}:void 0:{file:t,source:Ne(t,`utf8`)}},{lines:u,onWarning:e=>{if(e.channel===`stdout`)return console.log(e.text);let t=e.channel===`toolbox`||e.channel===`toolboxOnly`;if(l&&t)return It([`type:warning`,`msg:${e.text}`]);e.channel!==`toolboxOnly`&&console.error(e.text)}})});if(!p)return 3;let m=t.get(`--cache-dir`)?.[0]??process.env.TLAPM_CACHE_DIR??`.tlacache`,h=t.get(`--nofpl`)?.map(Number)??[0,0],g={isToolbox:l,isProving:!t.has(`--noproving`),workers:Math.max(1,Number(t.get(`--threads`)?.[0]??Ue())),isFingerprinted:e=>!t.has(`--nofp`)&&!(e.locus&&e.locus.startLine>=h[0]&&e.locus.endLine<=h[1]),fingerprints:/* @__PURE__ */ new Map},_=[];for(let[e,n]of p.entries()){let i=`${m}/${n.name}.tlaps`,a=`${i}/fingerprints`,o=t.get(`--usefp`)?.[0]??a;if(Me(i,{recursive:!0}),t.has(`--cleanfp`)&&F(a)&&(Re(a),console.log(`(* fingerprints file ${JSON.stringify(a)} removed *)`)),!t.has(`--cleanfp`)&&F(o)&&n.summary.total!==0&&(console.log(t.has(`--nofp`)?`(* will not use fingerprints (because of option \`--nofp\`), but will now load fingerprints from the file \`${o}\`, in order to overwrite with the new fingerprints, and then save the results at the end. *)`:`(* loading fingerprints in ${JSON.stringify(o)} *)`),Ct(g.fingerprints,o,t.has(`--safefp`))),t.has(`--summary`)&&console.log(Se(n)),l&&(n.obligations.forEach(e=>Lt(e,`to be proved`,t.has(`--printallobs`)?[`obl:${e.text}`]:[])),It([`type:obligationsnumber`,`count:${n.obligations.length}`])),t.has(`--strict`)&&_.push(...Vt(n,u.start>0||u.end<1/0,t.has(`--summary`))),!r)continue;Ot(a,[...f,...p.slice(0,e+1).map(e=>e.name)].map(e=>`${e}.tla`));let s=await Gt(n,`${i}/${n.name}.thy`,a,g);if(s&&t.has(`--strict`)&&_.push(Bt.failed),s&&!t.has(`--strict`)&&!l)return console.error(` tlapm ending abnormally with Failure("backend errors: there are unproved obligations")
|
|
11
11
|
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
|
|
12
12
|
Called from Tlapm_lib.process_module in file "src/tlapm_lib.ml", lines 492-493, characters 12-37
|