gdp-wired 0.43.0 → 0.45.0

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 (79) hide show
  1. package/README.md +8 -3
  2. package/dist/core/c/reader.js +22 -7
  3. package/dist/core/check.js +3 -2
  4. package/dist/core/cli.d.ts +7 -0
  5. package/dist/core/cli.js +184 -12
  6. package/dist/core/counts.d.ts +1 -1
  7. package/dist/core/counts.js +30 -12
  8. package/dist/core/data.d.ts +6 -1
  9. package/dist/core/data.js +894 -152
  10. package/dist/core/dsl.d.ts +2 -0
  11. package/dist/core/dsl.js +88 -10
  12. package/dist/core/effect-prims.d.ts +60 -0
  13. package/dist/core/effect-prims.js +625 -0
  14. package/dist/core/effect.d.ts +17 -1
  15. package/dist/core/effect.js +108 -4
  16. package/dist/core/ex/harness.exs +2 -0
  17. package/dist/core/ex/reader.exs +17 -1
  18. package/dist/core/exists.d.ts +15 -1
  19. package/dist/core/exists.js +263 -41
  20. package/dist/core/extract-c.d.ts +2 -0
  21. package/dist/core/extract-c.js +22 -13
  22. package/dist/core/extract-check.d.ts +7 -0
  23. package/dist/core/extract-check.js +57 -4
  24. package/dist/core/extract-ex.js +5 -5
  25. package/dist/core/extract-go-check.js +22 -17
  26. package/dist/core/extract-go.d.ts +3 -0
  27. package/dist/core/extract-go.js +24 -9
  28. package/dist/core/extract-jvm.js +68 -16
  29. package/dist/core/extract-print.js +3 -0
  30. package/dist/core/extract-py.js +5 -5
  31. package/dist/core/extract-rb.js +5 -5
  32. package/dist/core/extract-read.d.ts +8 -0
  33. package/dist/core/extract-read.js +55 -0
  34. package/dist/core/extract-rs.js +28 -25
  35. package/dist/core/extract-shapes.js +20 -0
  36. package/dist/core/extract-sol.js +23 -12
  37. package/dist/core/extract-step.d.ts +59 -3
  38. package/dist/core/extract-step.js +334 -64
  39. package/dist/core/extract-swift.js +22 -15
  40. package/dist/core/extract.d.ts +1 -0
  41. package/dist/core/extract.js +27 -2
  42. package/dist/core/fresh.d.ts +2 -2
  43. package/dist/core/fresh.js +7 -3
  44. package/dist/core/go/reader.go +7 -1
  45. package/dist/core/infer.js +113 -40
  46. package/dist/core/jvm/Harness.java +8 -1
  47. package/dist/core/jvm/JavaReader.java +10 -2
  48. package/dist/core/jvm/Jvm.java +18 -2
  49. package/dist/core/jvm/KtReader.java +60 -5
  50. package/dist/core/machine.d.ts +2 -0
  51. package/dist/core/machine.js +32 -6
  52. package/dist/core/py/harness.py +128 -24
  53. package/dist/core/py/reader.py +50 -5
  54. package/dist/core/rb/reader.rb +52 -5
  55. package/dist/core/rs/src/main.rs +10 -0
  56. package/dist/core/sol/Replay.sol +52 -0
  57. package/dist/core/sol/harness.py +511 -0
  58. package/dist/core/solver.js +5 -4
  59. package/dist/core/system.d.ts +62 -1
  60. package/dist/core/system.js +274 -6
  61. package/dist/core/transfer.js +17 -0
  62. package/dist/core/watch.js +1 -1
  63. package/dist/interchange/check.d.ts +18 -1
  64. package/dist/interchange/check.js +19 -12
  65. package/dist/interchange/cli.d.ts +2 -0
  66. package/dist/interchange/cli.js +45 -0
  67. package/dist/interchange/format.d.ts +5 -1
  68. package/dist/interchange/format.js +25 -9
  69. package/dist/kernel/cdcl.js +65 -14
  70. package/dist/kernel/epr.js +35 -5
  71. package/dist/kernel/kernel.d.ts +2 -0
  72. package/dist/kernel/kernel.js +67 -40
  73. package/dist/kernel/prove.d.ts +22 -0
  74. package/dist/kernel/prove.js +156 -7
  75. package/dist/kernel/reader.js +3 -2
  76. package/dist/lean-kernel/emit.d.ts +9 -3
  77. package/dist/lean-kernel/emit.js +170 -29
  78. package/dist/lean-kernel/library.js +1 -1
  79. package/package.json +12 -3
@@ -244,7 +244,7 @@ export function termRows(name, path) {
244
244
  // Every coefficient, product and partial sum a safe integer, else no product: a rounded product is past 2^53, but a
245
245
  // monomial's other products could bring its sum back under it (and a square's form is the prover's, any float).
246
246
  function times(a, b) {
247
- const out = {};
247
+ const out = Object.create(null);
248
248
  for (const [p, cp] of Object.entries(a))
249
249
  for (const [q, cq] of Object.entries(b)) {
250
250
  if (p.includes('⟦') || q.includes('⟦'))
@@ -504,7 +504,7 @@ function leafRows(goal, path, factsOf) {
504
504
  }
505
505
  const keyOf = (cell) => {
506
506
  const inner = cell.slice(cell.indexOf('[') + 1, -1);
507
- const out = {};
507
+ const out = Object.create(null);
508
508
  // Keys are canonical texts `name:coef` joined by ',' at the outer level; a name may itself be a cell with brackets.
509
509
  let depth = 0, start = 0;
510
510
  const parts = [];
@@ -569,16 +569,20 @@ function natural(e) {
569
569
  }
570
570
  }
571
571
  const naturalC = (c) => c.op === 'flag' ? true : c.op === 'all' ? naturalC(c.c) : c.op === 'not' ? naturalC(c.x) : c.op === 'and' || c.op === 'or' ? c.xs.every(naturalC) : natural(c.a) && natural(c.b);
572
+ // (a substitution's own entries only: a name like `constructor` or `toString` is no entry of {}; terra's review. Every
573
+ // record the kernel reads by a name of the rule or the certificate reads it so, and every Lin is built on no prototype,
574
+ // where a name __proto__ is a key like any other.)
575
+ export const own = (r, k) => (Object.hasOwn(r, k) ? r[k] : undefined);
572
576
  export function substE(e, s) {
573
577
  switch (e.op) {
574
- case 'var': return s.vars[e.name] ?? e;
578
+ case 'var': return own(s.vars, e.name) ?? e;
575
579
  case 'const': return e;
576
580
  case 'mul': return { ...e, a: substE(e.a, s) };
577
581
  case 'prod': return { ...e, a: substE(e.a, s), b: substE(e.b, s) };
578
582
  case 'if': return { op: 'if', c: substC(e.c, s), then: substE(e.then, s), else: substE(e.else, s) };
579
583
  case 'get': {
580
- const key = substE(e.key, s);
581
- return s.maps[e.map] ? s.maps[e.map](key) : { op: 'get', map: e.map, key };
584
+ const key = substE(e.key, s), f = own(s.maps, e.map);
585
+ return f ? f(key) : { op: 'get', map: e.map, key };
582
586
  }
583
587
  case 'add':
584
588
  case 'sub':
@@ -589,7 +593,7 @@ export function substE(e, s) {
589
593
  }
590
594
  export function substC(c, s) {
591
595
  if (c.op === 'flag') {
592
- const f = s.flags[c.name];
596
+ const f = own(s.flags, c.name);
593
597
  if (!f)
594
598
  throw new Error(`unknown flag ${c.name}`);
595
599
  return f;
@@ -623,7 +627,7 @@ const reading = (r, vars, maps = {}) => ({ hyps: r.hyps, at: { ...r.at, vars: {
623
627
  // One step: each name the update sets is its term read where the run is; a map read after it is the written value at
624
628
  // the written key, and what the map held before elsewhere (or, written at every key, its value at the key read).
625
629
  const step = (r, u) => {
626
- const at = r.at, before = (map, key) => (at.maps[map] ? at.maps[map](key) : { op: 'get', map, key });
630
+ const at = r.at, before = (map, key) => { const f = own(at.maps, map); return f ? f(key) : { op: 'get', map, key }; };
627
631
  return { hyps: r.hyps, at: {
628
632
  vars: { ...at.vars, ...Object.fromEntries(Object.entries(u.vars).map(([n, e]) => [n, substE(e, at)])) },
629
633
  maps: { ...at.maps, ...Object.fromEntries(Object.entries(u.maps).map(([map, w]) => [map, 'each' in w
@@ -636,7 +640,7 @@ const step = (r, u) => {
636
640
  // so a run of k steps is k small frames rather than a term nesting each state in the next (which grows as 3^k when a
637
641
  // step reads its state thrice). The names are new to the goal; each equation holds of the run that took the steps.
638
642
  const nameState = (r, state, j) => ({
639
- hyps: [...r.hyps, ...state.map(n => ({ op: '=', a: { op: 'var', name: stateName(n, j) }, b: r.at.vars[n] ?? { op: 'var', name: n } }))],
643
+ hyps: [...r.hyps, ...state.map(n => ({ op: '=', a: { op: 'var', name: stateName(n, j) }, b: own(r.at.vars, n) ?? { op: 'var', name: n } }))],
640
644
  at: { ...r.at, vars: { ...r.at.vars, ...Object.fromEntries(state.map(n => [n, { op: 'var', name: stateName(n, j) }])) } },
641
645
  });
642
646
  export const stateName = (n, j) => `${n}~${j}`;
@@ -645,8 +649,8 @@ const atEnd = (r, c) => substC(c, r.at);
645
649
  // The conclusion read across the run: plain names at the first frame, primed names (s', and M'[k] as a read of the map
646
650
  // named M') at the last; the first step's inputs as it read them, and its flags, decided where it was taken.
647
651
  const across = (r, c, state, maps, first) => substC(c, {
648
- vars: { ...first.inputs, ...Object.fromEntries(state.map(n => [`${n}'`, r.at.vars[n] ?? { op: 'var', name: n }])) },
649
- maps: Object.fromEntries(maps.map(map => [`${map}'`, (key) => (r.at.maps[map] ? r.at.maps[map](key) : { op: 'get', map, key })])),
652
+ vars: { ...first.inputs, ...Object.fromEntries(state.map(n => [`${n}'`, own(r.at.vars, n) ?? { op: 'var', name: n }])) },
653
+ maps: Object.fromEntries(maps.map(map => [`${map}'`, (key) => { const f = own(r.at.maps, map); return f ? f(key) : { op: 'get', map, key }; }])),
650
654
  flags: first.flags,
651
655
  });
652
656
  const goal = (name, r, conclusion) => ({ name, hyps: [...r.hyps, { op: 'not', x: conclusion }] });
@@ -654,7 +658,7 @@ const goal = (name, r, conclusion) => ({ name, hyps: [...r.hyps, { op: 'not', x:
654
658
  // condition (through the flags before it), a quantified flag (one whose condition holds at every key) its 0/1 variable
655
659
  // ?f, which `closing` ties to the condition.
656
660
  const flagsOf = (m) => {
657
- const out = {};
661
+ const out = Object.create(null);
658
662
  for (const [f, c] of Object.entries(m.step.flags ?? {}))
659
663
  out[f] = c.op === 'all' ? { op: '=', a: { op: 'var', name: `?${f}` }, b: { op: 'const', value: 1 } } : substC(c, { vars: {}, maps: {}, flags: out });
660
664
  return out;
@@ -710,7 +714,7 @@ const laterNames = (m, j) => ({
710
714
  });
711
715
  // The laws assumed where the run is: each plain law, and each every-key law at the keys the proof names.
712
716
  export const assumed = (laws, instances) => laws.flatMap(l => {
713
- const keys = instances[l.name] ?? [];
717
+ const keys = own(instances, l.name) ?? [];
714
718
  if (l.keys?.length) {
715
719
  const names = [l.forall, ...l.keys], n = names.length;
716
720
  return Array.from({ length: Math.floor(keys.length / n) }, (_, t) => substC(l.holds, { vars: Object.fromEntries(names.map((name, i) => [name, keys[t * n + i]])), maps: {}, flags: {} }));
@@ -1109,7 +1113,7 @@ export function sumCovers(m) {
1109
1113
  return Object.fromEntries(Object.entries(m.sums ?? {}).map(([s, sum]) => {
1110
1114
  const out = new Map();
1111
1115
  for (const map of [...new Set([...JSON.stringify(sum.term).matchAll(/"op":"get","map":"([^"]+)"/g)].map(x2 => x2[1]))]) {
1112
- const w = m.step.maps?.[map];
1116
+ const w = own(m.step.maps ?? {}, map);
1113
1117
  if (!w)
1114
1118
  continue;
1115
1119
  if ('each' in w)
@@ -1138,21 +1142,21 @@ export function sumMachine(m, given, laws = []) {
1138
1142
  const same = Object.fromEntries(Object.keys(flags).map(f => [f, { op: 'flag', name: f }]));
1139
1143
  // (a sum may be declared in the state, at 0, which no step sets: a state variable the plain machine moves)
1140
1144
  for (const [s] of sums)
1141
- if (s in m.state && JSON.stringify(m.state[s]) !== JSON.stringify(ZERO) || s in (m.step.state ?? {}))
1145
+ if (Object.hasOwn(m.state, s) && JSON.stringify(m.state[s]) !== JSON.stringify(ZERO) || Object.hasOwn(m.step.state ?? {}, s))
1142
1146
  throw new Error(`${m.name}: the sum ${s} starts at 0 and no step sets it`);
1143
1147
  // (every name the machine has, as the Lean twin numbers them: a flag f's variable ?f, a quantified flag's witnesses,
1144
1148
  // the keys writes at every key and quantified flags bind)
1145
- const names = [...m.params, ...m.inputs, ...Object.keys(m.state).filter(n => !(n in m.sums)), ...Object.keys(m.maps ?? {}), ...(m.inputMaps ?? []), ...Object.keys(m.fns ?? {}),
1149
+ const names = [...m.params, ...m.inputs, ...Object.keys(m.state).filter(n => !Object.hasOwn(m.sums, n)), ...Object.keys(m.maps ?? {}), ...(m.inputMaps ?? []), ...Object.keys(m.fns ?? {}),
1146
1150
  ...Object.keys(flags), ...Object.keys(flags).map(f => `?${f}`), ...Object.entries(flags).flatMap(([f, c]) => (c.op === 'all' ? [...witnessesOf(f, c), ...boundOf(c)] : [])),
1147
1151
  ...Object.values(m.step.maps ?? {}).flatMap(w => ('each' in w ? [w.each] : []))];
1148
- const steps = {}, qflags = {}, facts = [], goals = [];
1152
+ const steps = Object.create(null), qflags = Object.create(null), facts = [], goals = [];
1149
1153
  for (const [s, sum] of sums) {
1150
- const { term, key } = sum, { flag, x } = sumParts(s), cs = covers[s];
1154
+ const { term, key } = sum, { flag, x } = sumParts(s), cs = own(covers, s);
1151
1155
  const read = [...new Set([...JSON.stringify(term).matchAll(/"op":"get","map":"([^"]+)"/g)].map(x2 => x2[1]))];
1152
1156
  const bad = (why) => { throw new Error(`${m.name}: the sum ${s}: ${why}`); };
1153
1157
  for (const name of [s, key, flag, x]) {
1154
1158
  plainName(m.name, name);
1155
- if (names.includes(name) || name in (m.sums ?? {}) && name !== s)
1159
+ if (names.includes(name) || Object.hasOwn(m.sums ?? {}, name) && name !== s)
1156
1160
  bad(`${name} is already a name of the machine`);
1157
1161
  }
1158
1162
  if (new Set([s, key, flag, x, `?${flag}`, `w?${flag}`]).size !== 6 || names.includes(`?${flag}`) || names.includes(`w?${flag}`))
@@ -1160,7 +1164,7 @@ export function sumMachine(m, given, laws = []) {
1160
1164
  if (!natural(term) || !sumTermOk(term, key))
1161
1165
  bad(`its term reads the maps at ${key} alone, and no other name`);
1162
1166
  for (const map of read) {
1163
- if ((m.inputMaps ?? []).includes(map) || (m.fns ?? {})[map] || !(map in (m.maps ?? {})))
1167
+ if ((m.inputMaps ?? []).includes(map) || Object.hasOwn(m.fns ?? {}, map) || !Object.hasOwn(m.maps ?? {}, map))
1164
1168
  bad(`${map} is not a map of the machine's state`);
1165
1169
  }
1166
1170
  // 0 where every map holds its start value (Sums.lean's startVal: the term with each read its map's start).
@@ -1172,14 +1176,14 @@ export function sumMachine(m, given, laws = []) {
1172
1176
  bad('a key a step writes it at reads a flag');
1173
1177
  // (Sums.lean's sumOk1: a map the term reads written at one key has that key among the cover keys)
1174
1178
  for (const map of read) {
1175
- const w = m.step.maps?.[map];
1179
+ const w = own(m.step.maps ?? {}, map);
1176
1180
  if (w && !('each' in w) && !cs.some(c => JSON.stringify(c) === JSON.stringify(w.key)))
1177
1181
  bad(`the key ${map} is written at is no cover key`);
1178
1182
  }
1179
1183
  const here = (t) => substE(term, { vars: { [key]: t }, maps: {}, flags: same });
1180
1184
  // A map read after the step, over the step's view (Sums.lean's postRd).
1181
1185
  const post = (map) => (k2) => {
1182
- const w = m.step.maps?.[map];
1186
+ const w = own(m.step.maps ?? {}, map);
1183
1187
  if (!w)
1184
1188
  return { op: 'get', map, key: k2 };
1185
1189
  if ('each' in w)
@@ -1250,14 +1254,15 @@ export function obligations(m, laws, instances = {}, only) {
1250
1254
  return [];
1251
1255
  // At the start: the precondition, and no request. One step: from a state where the laws hold, a request allowed.
1252
1256
  // The facts hold throughout, read where the run begins (they read no state).
1253
- const start = given(m, holds(from(startOf(m)), pre), instances[law.name] ?? {});
1254
- const turn = step(holds(given(m, from(), instances[law.name] ?? {}), [...pre, ...assume, ...assumed(laws, instances[law.name] ?? {}), ...closing(m, instances[law.name] ?? {})]), u);
1257
+ const inst = own(instances, law.name) ?? {};
1258
+ const start = given(m, holds(from(startOf(m)), pre), inst);
1259
+ const turn = step(holds(given(m, from(), inst), [...pre, ...assume, ...assumed(laws, inst), ...closing(m, inst)]), u);
1255
1260
  return [goal(`${law.name} @start`, start, atEnd(start, proven(law))), goal(`${law.name} @step`, turn, atEnd(turn, proven(law)))];
1256
1261
  });
1257
1262
  }
1258
1263
  // The whole set at once: every goal has a tree, and every tree checks.
1259
1264
  export function checkLaws(m, laws, proof) {
1260
- return obligations(m, laws, proof.instances).every(g => proof.trees[g.name] !== undefined && check(g, proof.trees[g.name]));
1265
+ return obligations(m, laws, proof.instances).every(g => { const t = own(proof.trees, g.name); return t !== undefined && check(g, t); });
1261
1266
  }
1262
1267
  // A loop is a machine: its state, a turn's inputs as a request, its body taken where `while` holds and the state kept
1263
1268
  // where it fails. Its invariants are the machine's laws, and that it halts is a liveness: from anywhere, `while` fails
@@ -1279,7 +1284,7 @@ export function loopObligations(l, laws, rank) {
1279
1284
  const names = [...l.params, ...l.inputs, ...Object.keys(l.state)];
1280
1285
  distinct(l.name, names);
1281
1286
  for (const name of Object.keys(l.body))
1282
- if (!(name in l.state))
1287
+ if (!Object.hasOwn(l.state, name))
1283
1288
  throw new Error(`${l.name}'s body sets ${name}, which isn't in its state`);
1284
1289
  inScope(`${l.name}'s start`, Object.values(l.state), l.params);
1285
1290
  inScope(l.name, [...Object.values(l.body), ...(l.assume ? [l.assume] : [])], names);
@@ -1303,7 +1308,7 @@ export function recurGoal(l, r) {
1303
1308
  // Lean's evalE and evalC over naturals with every map cell 0 (NonTerm.lean's noMaps): exact, never rounded.
1304
1309
  const natE = (e, env) => {
1305
1310
  switch (e.op) {
1306
- case 'var': return env[e.name] ?? 0n;
1311
+ case 'var': return own(env, e.name) ?? 0n;
1307
1312
  case 'const': return BigInt(e.value);
1308
1313
  case 'add': return natE(e.a, env) + natE(e.b, env);
1309
1314
  case 'sub': {
@@ -1347,7 +1352,7 @@ function stemOk(l, r) {
1347
1352
  const names = [...l.params, ...l.inputs, ...Object.keys(l.state)], values = (o) => Object.values(o).every(x => Number.isSafeInteger(x) && x >= 0);
1348
1353
  distinct(l.name, names);
1349
1354
  for (const name of Object.keys(l.body))
1350
- if (!(name in l.state))
1355
+ if (!Object.hasOwn(l.state, name))
1351
1356
  throw new Error(`${l.name}'s body sets ${name}, which isn't in its state`);
1352
1357
  inScope(`${l.name}'s start`, Object.values(l.state), l.params);
1353
1358
  inScope(l.name, [...Object.values(l.body), ...(l.assume ? [l.assume] : [])], names);
@@ -1360,13 +1365,13 @@ function stemOk(l, r) {
1360
1365
  throw new Error(`${l.name}: a start names params and a stem's turn inputs, each a natural`);
1361
1366
  if (!Object.keys(r.wit).every(n => l.inputs.includes(n)))
1362
1367
  return false;
1363
- let env = Object.fromEntries(names.map(n => [n, BigInt(r.start[n] ?? 0)]));
1368
+ let env = Object.fromEntries(names.map(n => [n, BigInt(own(r.start, n) ?? 0)]));
1364
1369
  if (!natC(l.pre ?? trueC, env))
1365
1370
  return false;
1366
1371
  const apply = (body, at) => ({ ...at, ...Object.fromEntries(Object.entries(body).map(([n, e]) => [n, natE(e, at)])) });
1367
1372
  env = apply(l.state, env);
1368
1373
  for (const turn of r.stem) {
1369
- const at = { ...env, ...Object.fromEntries(l.inputs.map(n => [n, BigInt(turn[n] ?? 0)])) };
1374
+ const at = { ...env, ...Object.fromEntries(l.inputs.map(n => [n, BigInt(own(turn, n) ?? 0)])) };
1370
1375
  if (!natC(l.while, at) || !natC(l.assume ?? trueC, at))
1371
1376
  return false;
1372
1377
  env = apply(l.body, at);
@@ -1462,7 +1467,7 @@ const substituter = (vars) => {
1462
1467
  let o;
1463
1468
  switch (e.op) {
1464
1469
  case 'var':
1465
- o = vars[e.name] ?? e;
1470
+ o = own(vars, e.name) ?? e;
1466
1471
  break;
1467
1472
  case 'const':
1468
1473
  o = e;
@@ -1540,7 +1545,7 @@ export function checkRecurCases(l, r) {
1540
1545
  export function progressObligations(m0, laws, instances, p) {
1541
1546
  const m = plainOf(m0), own = m0.sums && Object.keys(m0.sums).length ? m0.assume : m.assume;
1542
1547
  scope(m, laws); // (as obligations scopes it: a param ?f would be read as the flag f's variable here too)
1543
- if (!m.inputs.every(i => i in p.request) || !Object.values(p.request).every(natural) || mentions(p.when, m.inputs))
1548
+ if (!m.inputs.every(i => Object.hasOwn(p.request, i)) || !Object.values(p.request).every(natural) || mentions(p.when, m.inputs))
1544
1549
  throw new Error('outside the kernel');
1545
1550
  for (const e of Object.values(p.request))
1546
1551
  if (mentions({ op: '=', a: e, b: e }, m.inputs))
@@ -1671,10 +1676,10 @@ export function stepLawObligations(machine, laws, instances, sl) {
1671
1676
  const lawsOnly = (inst) => Object.fromEntries(Object.entries(inst).filter(([n]) => !n.startsWith('?')));
1672
1677
  export function checkStepLaws(m, laws, stepLaws, proof) {
1673
1678
  return checkLaws(m, laws, proof.laws) && stepLaws.every(sl => {
1674
- const inst = proof.perStep?.[sl.name] ?? proof.instances, plain = plainOf(m);
1679
+ const inst = own(proof.perStep ?? {}, sl.name) ?? proof.instances, plain = plainOf(m);
1675
1680
  const zone = stepZone(plain, sl.steps ?? 1);
1676
1681
  return [...assumed(laws, inst), ...assumed(plain.facts ?? [], inst), ...closing(plain, lawsOnly(inst))].every(c => !mentions(c, zone))
1677
- && stepLawObligations(m, laws, inst, sl).every(g => proof.trees[g.name] !== undefined && check(g, proof.trees[g.name]));
1682
+ && stepLawObligations(m, laws, inst, sl).every(g => { const t = own(proof.trees, g.name); return t !== undefined && check(g, t); });
1678
1683
  });
1679
1684
  }
1680
1685
  // The names a k-step law's run introduces past its first frame: each later step's inputs, quantified flags and their
@@ -1712,8 +1717,9 @@ export const kInductionStart = (machine, kl, instances) => {
1712
1717
  export function checkKInduction(m, laws, kl, proof) {
1713
1718
  const steps = kInductionSteps(m, kl), plain = plainOf(m);
1714
1719
  scope(plain, [...laws, kl.law]);
1715
- const start = kInductionStart(m, kl, proof.perStep?.[`${kl.law.name} @start`] ?? proof.instances);
1716
- return proof.trees[start.name] !== undefined && check(start, proof.trees[start.name]) && checkStepLaws(m, laws, steps, proof);
1720
+ const start = kInductionStart(m, kl, own(proof.perStep ?? {}, `${kl.law.name} @start`) ?? proof.instances);
1721
+ const t = own(proof.trees, start.name);
1722
+ return t !== undefined && check(start, t) && checkStepLaws(m, laws, steps, proof);
1717
1723
  }
1718
1724
  export function foldObligations(f, laws) {
1719
1725
  if (![...Object.values(f.leaf), ...Object.values(f.node)].every(natural) || !laws.every(law => !law.forall && !law.keys?.length && naturalC(law.holds) && !mentions(law.holds, f.inputs)))
@@ -1765,7 +1771,7 @@ export const qdif = (a, b) => radd(rscale(b.den, a.row), rscale(-a.den, b.row));
1765
1771
  // A row as a Lin, its coefficients safe integers (else undefined: a row past 2^53 is not read, so the check is weaker,
1766
1772
  // never wrong); and its key, as `canon` writes a Lin (zero coefficients dropped: Lean's `same` compares by value).
1767
1773
  export const qLin = (r) => {
1768
- const out = {};
1774
+ const out = Object.create(null);
1769
1775
  for (const [x, c] of r.cs) {
1770
1776
  if (c < -(2n ** 53n) + 1n || c > 2n ** 53n - 1n)
1771
1777
  return undefined;
@@ -1968,7 +1974,7 @@ export function checkQMachine(m, laws, trees) {
1968
1974
  if (m.pre && qOccurs(m.pre, assigned))
1969
1975
  return false;
1970
1976
  return laws.every(law => {
1971
- const t = trees[law.name], goals = qObligations(m, laws, law);
1977
+ const t = own(trees, law.name), goals = qObligations(m, laws, law);
1972
1978
  return !!t && !qOccurs(law.holds, m.inputs) && checkQTree(goals.start, t.start) && checkQTree(goals.step, t.step);
1973
1979
  });
1974
1980
  }
@@ -2173,8 +2179,9 @@ export function countedObligations(m, laws, instances = {}, only) {
2173
2179
  return laws.flatMap((law, i) => {
2174
2180
  if (only !== undefined && i !== only)
2175
2181
  return [];
2176
- const start = given(m, holds(from(startOf(m)), pre), instances[law.name] ?? {});
2177
- const turn = step(holds(given(m, from(), instances[law.name] ?? {}), [...pre, ...assume, ...assumed(laws, instances[law.name] ?? {}), ...closing(m, instances[law.name] ?? {})]), u);
2182
+ const inst = own(instances, law.name) ?? {};
2183
+ const start = given(m, holds(from(startOf(m)), pre), inst);
2184
+ const turn = step(holds(given(m, from(), inst), [...pre, ...assume, ...assumed(laws, inst), ...closing(m, inst)]), u);
2178
2185
  return [{ goal: goal(`${law.name} @start`, start, atEnd(start, proven(law))), decls: after(start.at) },
2179
2186
  { goal: goal(`${law.name} @step`, turn, atEnd(turn, proven(law))), decls: [...all, ...after(turn.at)] }];
2180
2187
  });
@@ -2191,7 +2198,7 @@ function witsOk(m, laws, k) {
2191
2198
  }
2192
2199
  // Lean's checkCMachine: every goal has a certificate, its witnesses fresh, and every certificate checks.
2193
2200
  export function checkCountedLaws(m, laws, proof) {
2194
- return countedObligations(m, laws, proof.instances).every(({ goal: g, decls }) => { const k = proof.certs[g.name]; return k !== undefined && witsOk(m, laws, k) && checkMC(g.hyps, decls, k); });
2201
+ return countedObligations(m, laws, proof.instances).every(({ goal: g, decls }) => { const k = own(proof.certs, g.name); return k !== undefined && witsOk(m, laws, k) && checkMC(g.hyps, decls, k); });
2195
2202
  }
2196
2203
  // SGhostedM.full: the original with each ghost's start and step after its own (Lean: lists appended; here records, whose
2197
2204
  // names smghostOk keeps apart from the original's).
@@ -2225,3 +2232,23 @@ export function ghostedOk(g) {
2225
2232
  // The laws of a ghosted machine, checked: the ghosts as smghostOk says, and the laws of the ghosted machine as checkLaws
2226
2233
  // says (Lean: smghostOk and checkSMachine of SGhostedM.full).
2227
2234
  export const checkGhostedLaws = (g, laws, proof) => ghostedOk(g) && checkLaws(ghostedMachine(g), laws, proof);
2235
+ // GhostMap.lean's forall_some_of_ghostsubst, the ∃ reading: a law with "there exists" (`some`, its body c) holds of the
2236
+ // original (Lean's ExHolds: for every value of its keys, some natural for each bound name where c holds) where the
2237
+ // ghosted machine's law `plain` is c with each bound name x replaced by a term sub[x] (Lean's substC σ c: a term over
2238
+ // anything of the ghosted machine, a ghost map at a key, several, the law's keys). The caller has the plain law proven
2239
+ // of ghostedMachine(g) (checkLaws). What Lean takes: the ghosts smghostOk's (ghostedOk); the plain law exactly c with sub
2240
+ // in place, about the law's keys (e.law.key, e.keys2); c reading no ghost variable and no ghost map (avoids, avoidsMaps);
2241
+ // the bound names sub's (σ's names). And where the law's reading and Lean's statement would part: c in Lean's terms (no
2242
+ // quantified condition, no flag), each bound name once, none a key of the law (ExHolds writes the bound names over the
2243
+ // keys' values) nor a name of the original or of a ghost.
2244
+ export function someOfGhostsOk(g, law, plain, sub) {
2245
+ const xs = law.some ?? [], keys = [...(law.forall ? [law.forall] : []), ...(law.keys ?? [])], o = g.orig, r = reads(law.holds), text = JSON.stringify(law.holds);
2246
+ const vs = Object.keys(g.vars), ms = Object.keys(g.maps);
2247
+ const names = [...o.params, ...o.inputs, ...Object.keys(o.state), ...Object.keys(o.maps ?? {}), ...(o.inputMaps ?? []), ...Object.keys(o.fns ?? {}), ...vs, ...ms];
2248
+ return ghostedOk(g) && xs.length > 0 && new Set(xs).size === xs.length && Object.keys(sub).length === xs.length && xs.every(x => Object.hasOwn(sub, x))
2249
+ && !text.includes('"op":"all"') && !text.includes('"op":"flag"') && !plain.some?.length
2250
+ && plain.forall === law.forall && JSON.stringify(plain.keys ?? []) === JSON.stringify(law.keys ?? [])
2251
+ && JSON.stringify(plain.holds) === JSON.stringify(substC(law.holds, { vars: Object.assign(Object.create(null), sub), maps: {}, flags: {} }))
2252
+ && vs.every(v => !r.vars.has(v)) && ms.every(mp => !r.maps.has(mp))
2253
+ && xs.every(x => !keys.includes(x) && !names.includes(x));
2254
+ }
@@ -82,6 +82,28 @@ export declare const eprScope: {
82
82
  patterns?: Patterns;
83
83
  busy?: boolean;
84
84
  };
85
+ export declare const wideScope: {
86
+ judge?: (w: Record<string, number>) => boolean;
87
+ };
88
+ export declare const wideStats: {
89
+ goals: number;
90
+ trees: number;
91
+ models: number;
92
+ rounds: number;
93
+ };
94
+ export declare const wideHook: {
95
+ on?: (part: Goal, out: Outcome) => void;
96
+ };
97
+ export declare const brokenOf: (goal: Goal) => ((w: Record<string, number>, ids?: number[], first?: boolean) => number[]);
98
+ export declare const wideFor: (goal: Goal) => boolean;
99
+ export declare function growWide(goal: Goal, budget: {
100
+ nodes: number;
101
+ until?: number;
102
+ }, ask?: (g: Goal, until: number) => Outcome & {
103
+ core?: number[];
104
+ }): (Outcome & {
105
+ core?: number[];
106
+ }) | undefined;
85
107
  export declare const realModels: {
86
108
  on: boolean;
87
109
  };
@@ -13,7 +13,7 @@ import { add, costs, env, k, refuteFast, scale, solve, sub, v, work } from "../c
13
13
  import { checkRefutation } from "../core/check.js";
14
14
  import { allowNode, allowTranslated, certCyclic, certOn, certSearch, stepCertFloor, translateMs, closingInsts, crossCyclic, cyclicOn, cycLog, hasQuantified, loopNodes, machineNodes, proveCyclic, reqTS, searchedStepNodes, skMachine, timedKind, withWitness, translatedProof, uncovered, uncoveredWhy } from "../core/cyclic.js";
15
15
  import { proveSome, someLaws } from "../core/exists.js";
16
- import { growCdcl } from "./cdcl.js";
16
+ import { REFUTED, growCdcl } from "./cdcl.js";
17
17
  import { decide, pastEprCap, patternsOf } from "./epr.js";
18
18
  import { assumed, atomOf, boundOf, canon, canonFlip, columnTerm, decided, factorsOf, isCell, isMonomial, stepZone, check, checkLaws, checkStepLaws, historyMachine, plainOf, substC, substE, leafConstraints, leafConstraintsReusing, reusing, linear, livenessHelpful, livenessParts, strongly, loopMachine, obligations, plainKey, progressObligations, stepLawObligations, trueC, truth, unreachable, witnessesOf, withProducts } from "./kernel.js";
19
19
  // The atoms the path leaves open, in evaluation order: deciding any of them makes progress.
@@ -466,8 +466,150 @@ function eprFirst(goal, budget, whole = true, late = () => pastWall() || pastEpr
466
466
  eprScope.busy = false;
467
467
  }
468
468
  }
469
+ // Wide goals (GDP_WIDE hypotheses or more, a law at every tuple of a goal's keys, a step's every write, and
470
+ // GDP_WIDE_TERMS terms): each node of the search reads every hypothesis' rows, so a goal of a thousand reaches neither a
471
+ // tree nor a model within its budget, though its refutation reads one or two and a model of a few is often a model of
472
+ // all. Grown first over a part: the conclusion, then the hypotheses a model of the part breaks (the model read as a
473
+ // state: each cell at its key's value, any other name 0), those sharing a cell with the part first, the part doubled a
474
+ // round. A model that breaks none is the goal's (every hypothesis holds at it); a tree is widened to the goal (`widen`),
475
+ // which the kernel checks as any; a model-only query's refutation is the part's, its core the part's hypotheses. Within
476
+ // a share of the goal's budget, each round within what the whole's search would spend on as many nodes; anything else
477
+ // leaves the goal as before. Untrusted.
478
+ const wideAt = Number(env.GDP_WIDE ?? 256), wideTerms = Number(env.GDP_WIDE_TERMS ?? 40_000), wideShare = Number(env.GDP_WIDE_SHARE ?? 0.25), wideTrace = !!env.GDP_WIDE_TRACE;
479
+ let wideBusy = false;
480
+ // (while a part is grown: whether a point holds every hypothesis of the part, read as a state; a node's point that does is
481
+ // the part's model, whatever atoms are still open, and the whole's if it breaks none of the rest)
482
+ export const wideScope = {};
483
+ export const wideStats = { goals: 0, trees: 0, models: 0, rounds: 0 };
484
+ export const wideHook = {};
485
+ const cellsIn = (c) => { const out = new Set(); walkOnce(c, o => { const x = o; if (x.op === 'get')
486
+ out.add(`${x.map}${JSON.stringify(x.key)}`); }); return out; };
487
+ // (the hypotheses a model breaks among `ids` (all where none are given), the model read as a state, the conclusion first;
488
+ // `first`: the first one broken alone)
489
+ export const brokenOf = (goal) => {
490
+ const maps = new Set();
491
+ walkOnce(goal.hyps, o => { const x = o; if (x.op === 'get' && typeof x.map === 'string')
492
+ maps.add(x.map); });
493
+ const mm = { maps: Object.fromEntries([...maps].map(mp => [mp, 0])) };
494
+ return (w0, ids = goal.hyps.map((_, i) => i), first = false) => {
495
+ // (a term column's value is its term's at the point, not the point's own where its choice is open: each cell is put
496
+ // at its key's value with the columns so read, twice, as a column's term may read a cell)
497
+ const w = { ...w0 }, at = new Proxy(w, { get: (t, q) => t[q] ?? 0 }), out = [];
498
+ let st = { scalars: {}, maps: {} };
499
+ for (let pass = 0; pass < 3; pass++) {
500
+ if (pass)
501
+ for (const n in w) {
502
+ const e = n.startsWith('⟦') ? columnTerm(n) : undefined;
503
+ if (e)
504
+ try {
505
+ w[n] = evalE(e, at, st, mm);
506
+ }
507
+ catch { /* left */ }
508
+ }
509
+ st = { scalars: {}, maps: Object.fromEntries([...maps].map(mp => [mp, new Map()])) };
510
+ for (const [cell, value] of Object.entries(w)) {
511
+ const br = cell.indexOf('['), key = br > 0 && cell.endsWith(']') && st.maps[cell.slice(0, br)] ? keyValue(cell, w) : undefined;
512
+ if (key !== undefined)
513
+ st.maps[cell.slice(0, br)].set(key, value);
514
+ }
515
+ }
516
+ for (let q = ids.length - 1; q >= 0 && !(first && out.length); q--) {
517
+ const i = ids[q];
518
+ let ok = false;
519
+ try {
520
+ ok = evalC(goal.hyps[i], at, st, mm);
521
+ }
522
+ catch { /* broken */ }
523
+ if (!ok)
524
+ out.push(i);
525
+ }
526
+ return out.reverse();
527
+ };
528
+ };
529
+ // (`ask`: how a part is asked, a tree wanted by default; kernel/cdcl.ts's model-only queries ask for a model or a
530
+ // refutation, whose core is the part's hypotheses, the whole's by index)
531
+ // (and its terms, each shared part once, past GDP_WIDE_TERMS: what each node of the whole goal's search reads, where the
532
+ // search is costly; under it the whole is asked as before, its model the search's own, which the engine's join reads)
533
+ const termsSeen = new WeakMap();
534
+ const termsOf = (goal) => { let n = termsSeen.get(goal); if (n === undefined) {
535
+ n = 0;
536
+ walkOnce(goal.hyps, () => { n++; });
537
+ termsSeen.set(goal, n);
538
+ } return n; };
539
+ export const wideFor = (goal) => !wideBusy && goal.hyps.length >= wideAt && termsOf(goal) >= wideTerms;
540
+ export function growWide(goal, budget, ask = (g, until) => grow(g, new Map(), { nodes: 0, until })) {
541
+ const hyps = goal.hyps, last = hyps.length - 1, broken = brokenOf(goal), now = clock(), w = fullWork();
542
+ const end = withinDeadline(budget.until ?? Infinity), span = wideShare * (end - now), room = wideShare * (workCap - w), until = now + span;
543
+ const part = new Set([last]), near = new Set(cellsIn(hyps[last])), cells = new Map();
544
+ const cellsAt = (i) => { let c = cells.get(i); if (!c)
545
+ cells.set(i, (c = cellsIn(hyps[i]))); return c; };
546
+ const take = (i) => { part.add(i); for (const x of cellsAt(i))
547
+ near.add(x); };
548
+ wideBusy = true;
549
+ wideStats.goals++;
550
+ try {
551
+ while (!late(until)) {
552
+ wideStats.rounds++;
553
+ // (a part's own budget: what the whole's search spends on as many nodes, four times over (a node of the part reads
554
+ // that much less), at least a sixteenth of the share: a part that a small budget doesn't settle leaves the goal)
555
+ const ids = [...part].sort((a, b) => a - b), g = { name: goal.name, hyps: ids.map(i => hyps[i]) }, f = Math.max(1 / 16, Math.min(1, 4 * part.size / hyps.length));
556
+ const t0 = performance.now(), at = clock();
557
+ wideScope.judge = w => !broken(w, ids, true).length;
558
+ let out;
559
+ try {
560
+ out = withWork(Math.min(w + room, fullWork() + f * room), () => ask(g, Math.min(until, at + f * span)));
561
+ }
562
+ finally {
563
+ wideScope.judge = undefined;
564
+ }
565
+ wideHook.on?.(g, out);
566
+ if (wideTrace)
567
+ console.error(`[wide] ${goal.name.slice(0, 40)}: part ${g.hyps.length} of ${hyps.length}, ${'tree' in out ? 'tree' : out.stuck} in ${Math.round(performance.now() - t0)} ms${'tree' in out ? '' : ` ${out.why?.slice(0, 50) ?? ''}`}`);
568
+ if ('tree' in out) {
569
+ const tree = withWork(w + room, () => withDeadline(until, () => widen(g, goal, out.tree)));
570
+ if (tree)
571
+ wideStats.trees++;
572
+ return tree && { tree, nodes: out.nodes };
573
+ }
574
+ if (out.why === REFUTED)
575
+ return { ...out, ...(out.core ? { core: out.core.map(i => ids[i]) } : {}) };
576
+ if (out.stuck !== 'sat' || !out.witness)
577
+ return undefined;
578
+ const bad = broken(out.witness);
579
+ if (wideTrace)
580
+ console.error(`[wide] breaks ${bad.length}${bad.length ? `: ${bad.slice(0, 12).join(' ')}` : ''}`);
581
+ if (!bad.length) {
582
+ wideStats.models++;
583
+ return { ...out, path: new Map() };
584
+ }
585
+ const more = bad.filter(i => !part.has(i)), size = part.size;
586
+ if (!more.length || 2 * size > hyps.length)
587
+ return undefined;
588
+ // (what the model breaks, those sharing a cell with the part first; then, to twice the part, the hypotheses that share
589
+ // one, then any, in the goal's order: the rounds are as many as the doublings to the part that settles the goal)
590
+ const shared = (i) => [...cellsAt(i)].some(x => near.has(x));
591
+ more.sort((a, b) => Number(shared(b)) - Number(shared(a)));
592
+ for (const i of more.slice(0, Math.max(16, size)))
593
+ take(i);
594
+ for (const any of [false, true])
595
+ for (let i = 0; i < last && part.size < 2 * size; i++)
596
+ if (!part.has(i) && (any || shared(i)))
597
+ take(i);
598
+ }
599
+ return undefined;
600
+ }
601
+ finally {
602
+ wideBusy = false;
603
+ }
604
+ }
469
605
  function growRoot(goal, path, budget) {
470
- if (eprScope.patterns && !eprScope.busy && !path.size && !budget.nodes) {
606
+ if (!path.size && !budget.nodes && wideFor(goal)) {
607
+ const out = growWide(goal, budget);
608
+ if (out)
609
+ return out;
610
+ }
611
+ // (not for a wide goal's part: its abstraction's search reads no judge, and the whole goal is decided by it after)
612
+ if (eprScope.patterns && !eprScope.busy && !wideBusy && !path.size && !budget.nodes) {
471
613
  const out = eprFirst(goal, budget);
472
614
  if (out)
473
615
  return out;
@@ -555,6 +697,8 @@ function growPlain(goal, path, budget) {
555
697
  const verdict = next && rows.length > 60 ? solveP(rows, 2 * rows.length) : solveP(rows);
556
698
  if (verdict.kind === 'refuted')
557
699
  return { tree: leafOf(verdict.steps), nodes: budget.nodes };
700
+ if (next && wideScope.judge && verdict.kind === 'sat' && wideScope.judge(verdict.witness))
701
+ return { stuck: 'sat', witness: verdict.witness, path };
558
702
  // Before a split, the rows the plain search sets aside (those reading a term column) by their Farkas rows: an open
559
703
  // choice's bounds (min(a, c) ≤ c) often refute the case whichever way the choice goes, so its cases need no split.
560
704
  if (next && !columns && full.length > rows.length) {
@@ -1088,7 +1232,7 @@ function withCuts(goal, path, budget) {
1088
1232
  const chain = [];
1089
1233
  let at = new Map(path);
1090
1234
  for (const { n, e } of columns) {
1091
- if (pastWall())
1235
+ if (late(budget.until ?? Infinity))
1092
1236
  return undefined;
1093
1237
  if (e.op !== 'if')
1094
1238
  continue;
@@ -1099,7 +1243,7 @@ function withCuts(goal, path, budget) {
1099
1243
  const id = canon(lemma);
1100
1244
  if (at.has(id) || Object.keys(lemma).every(key => key === '1'))
1101
1245
  continue;
1102
- const no = growFocused(goal, new Map(at).set(id, { lin: lemma, holds: false }), focus, { nodes: 0 });
1246
+ const no = growFocused(goal, new Map(at).set(id, { lin: lemma, holds: false }), focus, { nodes: 0, until: budget.until });
1103
1247
  if ('tree' in no) {
1104
1248
  chain.push({ split: lemma, no: no.tree });
1105
1249
  at = new Map(at).set(id, { lin: lemma, holds: true });
@@ -1127,11 +1271,16 @@ function topAtoms(c, path) {
1127
1271
  const atoms = c.op === '<=' ? [sub(a, b)] : c.op === '<' ? [add(sub(a, b), k(1))] : [sub(a, b), sub(b, a)];
1128
1272
  return atoms.filter(l => Object.keys(l).some(key => key !== '1') && !path.has(canon(l)) && !path.has(canonFlip(l)));
1129
1273
  }
1130
- // A refutation that splits only on these atoms (a cut's failing side), within a small budget.
1274
+ // A refutation that splits only on these atoms (a cut's failing side), within a small budget and the goal's end (past
1275
+ // it the goal is left unknown whatever the cuts find: the search after them stops at its first node).
1131
1276
  function growFocused(goal, path, focus, budget, near = focus) {
1132
- if (++budget.nodes > 64 || pastWall())
1277
+ if (++budget.nodes > 64 || late(budget.until ?? Infinity))
1133
1278
  return { stuck: 'unknown', path };
1134
- const verdict = solveNear(leafConstraints(goal, path), [...near, ...[...path.values()].slice(-1).map(a => a.lin)]);
1279
+ // (each node reads its whole leaf, counted as growPlain counts a node's rows)
1280
+ const leaf = leafConstraints(goal, path);
1281
+ work.n += 1 + leaf.length;
1282
+ costs.plainRows += leaf.length;
1283
+ const verdict = solveNear(leaf, [...near, ...[...path.values()].slice(-1).map(a => a.lin)]);
1135
1284
  if (verdict.kind === 'refuted')
1136
1285
  return { tree: { leaf: verdict.steps }, nodes: budget.nodes };
1137
1286
  const split = focus.find(l => !path.has(canon(l)) && !path.has(canonFlip(l)));
@@ -388,9 +388,10 @@ export class Reader {
388
388
  out.push({ lin: row.lin, w: join(row.w, closed.w), label: '' });
389
389
  // (the last open part's own value is a read: open while it is)
390
390
  const last = this.truth(open[0]);
391
- // (and the facts are kept only while the part's own value is: its reason is theirs, though not their rows')
391
+ // (and the facts are kept only while the part's own value is: its reason is theirs, though not their rows'; and
392
+ // while the closed parts' are: one closed through an open term column opens when the column's choice is decided)
392
393
  const x = both(both(closed, r), last);
393
- return { w: x.w, pos: x.pos, fin: r.fin && last.t !== undefined && last.fin };
394
+ return { w: x.w, pos: x.pos, fin: x.fin && last.t !== undefined };
394
395
  }
395
396
  case '<':
396
397
  case '<=':
@@ -53,13 +53,14 @@ export declare function neverEndsToLean(id: string, l: Loop, r: Recur, tampered?
53
53
  recur: Recur;
54
54
  }[]): string;
55
55
  export declare function neverEndsCasesToLean(id: string, l: Loop, r: RecurCases): string;
56
- export declare function recurCasesLean(id: string, l: Loop): {
56
+ export declare function recurCasesLean(id: string, l: Loop, share?: boolean): {
57
57
  vars: string[];
58
58
  loop: string;
59
- recur: (r: RecurCases) => string;
59
+ recur: (r: RecurCases, names?: string[]) => string;
60
+ caseLit: (r: RecurCases, j: number) => string;
60
61
  defs: string;
61
62
  };
62
- export declare function recurLean(id: string, l: Loop, fallback: Recur | undefined): {
63
+ export declare function recurLean(id: string, l: Loop, fallback: Recur | undefined, share?: boolean): {
63
64
  vars: string[];
64
65
  loop: string;
65
66
  recur: (r: Recur) => string;
@@ -142,6 +143,11 @@ export declare function smachineToLean(id: string, given: Machine, laws: Law[],
142
143
  at: E;
143
144
  as: string;
144
145
  }[];
146
+ ghostSubst?: {
147
+ law: string;
148
+ body: C;
149
+ sub: Record<string, E>;
150
+ }[];
145
151
  refined?: {
146
152
  impl: Machine;
147
153
  spec: Machine;