gdp-wired 0.31.1 → 0.33.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 (84) hide show
  1. package/README.md +95 -6
  2. package/dist/core/c/reader.d.ts +86 -0
  3. package/dist/core/c/reader.js +860 -0
  4. package/dist/core/check.js +20 -6
  5. package/dist/core/cli.d.ts +76 -0
  6. package/dist/core/cli.js +636 -0
  7. package/dist/core/dsl.d.ts +6 -4
  8. package/dist/core/dsl.js +30 -16
  9. package/dist/core/effect.d.ts +6 -4
  10. package/dist/core/effect.js +48 -10
  11. package/dist/core/ex/harness.exs +177 -0
  12. package/dist/core/ex/json.exs +46 -0
  13. package/dist/core/ex/reader.exs +462 -0
  14. package/dist/core/exists.d.ts +3 -0
  15. package/dist/core/exists.js +19 -5
  16. package/dist/core/extract-c.d.ts +35 -0
  17. package/dist/core/extract-c.js +424 -0
  18. package/dist/core/extract-check.js +27 -6
  19. package/dist/core/extract-ex.d.ts +16 -0
  20. package/dist/core/extract-ex.js +33 -0
  21. package/dist/core/extract-go-check.d.ts +28 -0
  22. package/dist/core/extract-go-check.js +639 -0
  23. package/dist/core/extract-go.d.ts +231 -0
  24. package/dist/core/extract-go.js +1166 -0
  25. package/dist/core/extract-jvm.d.ts +23 -0
  26. package/dist/core/extract-jvm.js +220 -0
  27. package/dist/core/extract-print.js +17 -7
  28. package/dist/core/extract-py.d.ts +15 -0
  29. package/dist/core/extract-py.js +31 -0
  30. package/dist/core/extract-rb.d.ts +17 -0
  31. package/dist/core/extract-rb.js +31 -0
  32. package/dist/core/extract-read.d.ts +20 -0
  33. package/dist/core/extract-read.js +46 -6
  34. package/dist/core/extract-rs.d.ts +12 -0
  35. package/dist/core/extract-rs.js +306 -0
  36. package/dist/core/extract-shapes.d.ts +2 -0
  37. package/dist/core/extract-shapes.js +6 -5
  38. package/dist/core/extract-step.d.ts +806 -0
  39. package/dist/core/extract-step.js +4141 -0
  40. package/dist/core/extract-swift.d.ts +27 -0
  41. package/dist/core/extract-swift.js +484 -0
  42. package/dist/core/extract-xstate.d.ts +10 -3
  43. package/dist/core/extract-xstate.js +50 -4
  44. package/dist/core/extract.d.ts +22 -3
  45. package/dist/core/extract.js +107 -18
  46. package/dist/core/go/go.mod +3 -0
  47. package/dist/core/go/reader.go +901 -0
  48. package/dist/core/infer.d.ts +4 -0
  49. package/dist/core/infer.js +1838 -69
  50. package/dist/core/jvm/Harness.java +361 -0
  51. package/dist/core/jvm/JavaReader.java +825 -0
  52. package/dist/core/jvm/Jvm.java +332 -0
  53. package/dist/core/jvm/KtReader.java +960 -0
  54. package/dist/core/jvm/Rt.java +10 -0
  55. package/dist/core/laws.d.ts +83 -0
  56. package/dist/core/laws.js +623 -0
  57. package/dist/core/machine.d.ts +2 -0
  58. package/dist/core/machine.js +87 -0
  59. package/dist/core/py/harness.py +328 -0
  60. package/dist/core/py/reader.py +447 -0
  61. package/dist/core/rb/harness.rb +233 -0
  62. package/dist/core/rb/reader.rb +375 -0
  63. package/dist/core/relational.d.ts +49 -0
  64. package/dist/core/relational.js +345 -0
  65. package/dist/core/rs/Cargo.lock +108 -0
  66. package/dist/core/rs/Cargo.toml +14 -0
  67. package/dist/core/rs/src/main.rs +681 -0
  68. package/dist/core/swift/Harness.swift +124 -0
  69. package/dist/core/swift/Main.swift +34 -0
  70. package/dist/core/swift/Package.swift +13 -0
  71. package/dist/core/swift/Sources/gdp-swiftreader/main.swift +1341 -0
  72. package/dist/interchange/check.d.ts +16 -0
  73. package/dist/interchange/check.js +111 -0
  74. package/dist/interchange/format.d.ts +150 -0
  75. package/dist/interchange/format.js +678 -0
  76. package/dist/kernel/epr.d.ts +40 -0
  77. package/dist/kernel/epr.js +1882 -0
  78. package/dist/kernel/kernel.d.ts +45 -1
  79. package/dist/kernel/kernel.js +138 -13
  80. package/dist/kernel/prove.d.ts +45 -0
  81. package/dist/kernel/prove.js +658 -51
  82. package/dist/lean-kernel/emit.d.ts +17 -2
  83. package/dist/lean-kernel/emit.js +87 -7
  84. package/package.json +57 -2
@@ -1,6 +1,6 @@
1
1
  import type { C, E, Law, Machine, Recurrence } from '../core/machine.js';
2
2
  import { type Lin, type Step } from '../core/solver.js';
3
- import { type Fold, type Goal, type Instances, type KInduction, type Liveness, type Loop, type Path, type Recur, type RecurCases, type StepLaw, type Tree } from '../kernel/kernel.js';
3
+ import { type CountedGoal, type CountInst, type Ghosted, type Fold, type Goal, type Instances, type KInduction, type Liveness, type Loop, type Path, type Recur, type RecurCases, type StepLaw, type Tree } from '../kernel/kernel.js';
4
4
  import { proveStepLaws } from '../kernel/prove.js';
5
5
  import { type Cyclic } from '../kernel/cyclic.js';
6
6
  import { leanLibrary } from './library.js';
@@ -27,6 +27,13 @@ export declare function encode(ex: Exported, tamper?: boolean, dropStep?: boolea
27
27
  e: (t: E) => string;
28
28
  };
29
29
  export declare function goalToLean(ex: Exported, i: number, tamper?: boolean, dropStep?: boolean): string;
30
+ export declare function countedToLean(id: string, g: CountedGoal, cert: {
31
+ insts: CountInst[];
32
+ tree: Tree;
33
+ }, tampered?: {
34
+ what: string;
35
+ insts: CountInst[];
36
+ }[]): string;
30
37
  export declare function machineToLean(id: string, m: Machine, laws: Law[], corollary?: string): string;
31
38
  export declare const TRUE = ".le (.const 0) (.const 0)";
32
39
  export declare const grown: (g: Goal) => Tree;
@@ -112,7 +119,7 @@ export declare function smachineToLean(id: string, given: Machine, laws: Law[],
112
119
  simp?: string[];
113
120
  free?: string[];
114
121
  ghosts?: string[];
115
- after?: (ix: (name: string) => number) => string;
122
+ after?: (ix: (name: string) => number, mx: (name: string) => number, lit: (m: Machine) => string) => string;
116
123
  historyTampers?: {
117
124
  what: string;
118
125
  relations: {
@@ -121,6 +128,13 @@ export declare function smachineToLean(id: string, given: Machine, laws: Law[],
121
128
  }[];
122
129
  withRecordTrees: boolean;
123
130
  }[];
131
+ ghosted?: Ghosted;
132
+ forallSome?: {
133
+ law: string;
134
+ map: string;
135
+ at: E;
136
+ as: string;
137
+ }[];
124
138
  refined?: {
125
139
  impl: Machine;
126
140
  spec: Machine;
@@ -160,6 +174,7 @@ export declare const certReport: {
160
174
  why: string;
161
175
  }[];
162
176
  translatedSteps: string[];
177
+ fast: string[];
163
178
  };
164
179
  export declare function cycMachineToLean(id: string, given: Machine, laws: Law[], opts?: {
165
180
  stepLaws?: StepLaw[];
@@ -1,7 +1,7 @@
1
1
  import { atMost, n, not, pointWrite } from "../core/machine.js";
2
2
  import { add, k, scale, sub } from "../core/solver.js";
3
- import { boundOf, caseGoals, check, checkRecur, checkRecurCases, coverGoal, recurGoal, canon, decided, factorsOf, isCell, isMonomial, columnTerm, stateName, termColumn, truth, historyMachine, sumMachine, sumCovers, sumParts, foldObligations, kInductionStart, kInductionSteps, leafConstraints, loopLiveness, loopMachine, linear, livenessHelpful, livenessParts, livenessLevels, livenessRanks, strongly, loopObligations, trueC, obligations, progressObligations, stepLawObligations, substC, witnessesOf, withProducts } from "../kernel/kernel.js";
4
- import { chooseLevels, grow, minimal, proveBuilt, proveLaws, proveStepLaws, withDeadline } from "../kernel/prove.js";
3
+ import { countedGoal, countHyps, boundOf, caseGoals, check, checkRecur, checkRecurCases, coverGoal, recurGoal, canon, decided, factorsOf, isCell, isMonomial, columnTerm, stateName, termColumn, truth, historyMachine, sumMachine, sumCovers, sumParts, foldObligations, kInductionStart, kInductionSteps, leafConstraints, loopLiveness, loopMachine, linear, livenessHelpful, livenessParts, livenessLevels, livenessRanks, strongly, loopObligations, trueC, obligations, progressObligations, stepLawObligations, substC, witnessesOf, withProducts } from "../kernel/kernel.js";
4
+ import { chooseLevels, clock, grow, minimal, proveBuilt, proveLaws, proveSetFast, proveStepLaws, withDeadline } from "../kernel/prove.js";
5
5
  import { refinement, refinementSides } from "../core/compose.js";
6
6
  import { leanSurface, leanTerms } from "./lean-terms.js";
7
7
  import { descentGoal, mainGoal, premiseGoal } from "../kernel/cyclic.js";
@@ -371,6 +371,37 @@ ${body}
371
371
  theorem ${name} : ∀ env maps, ¬ ∀ c ∈ ${name}_goal.hyps, evalC env maps c = true :=
372
372
  sound ${name}_goal ${name}_tree (by ${checkBy})`;
373
373
  }
374
+ // A counted goal (Count.lean's checkCounted, kernel.ts's twin): its hypotheses and counts, the certificate's instances,
375
+ // and the tree encoded against the goal with the instances' hypotheses after the goal's (kernel.ts's countedGoal). Lean
376
+ // builds those hypotheses itself (countHyps); the example states that they are the ones kernel.ts built. `tampered`:
377
+ // certificates Lean computes to false, as kernel.ts refuses them.
378
+ const varsOfE = (t) => [...JSON.stringify(t).matchAll(/"op":"var","name":"([^"]+)"/g)].map(m => m[1]);
379
+ const mapsOf = (t) => [...JSON.stringify(t).matchAll(/"op":"get","map":"([^"]+)"/g)].map(m => m[1]);
380
+ export function countedToLean(id, g, cert, tampered = []) {
381
+ const goal = countedGoal(g, cert.insts);
382
+ if (!goal)
383
+ throw new Error(`${id}: an instance names no count of the goal, or a count of another bound`);
384
+ const vars = [...new Set([...goal.hyps.flatMap(varsOf), ...g.counts.flatMap(cn => [cn.v, cn.key, ...varsOfE(cn.below), ...varsOfE(cn.body)]),
385
+ ...[...cert.insts, ...tampered.flatMap(t => t.insts)].flatMap(i => [i.wit, ...varsOfE(i.below)])])];
386
+ const maps = [...new Set([...goal.hyps, ...g.counts.flatMap(cn => [cn.below, cn.body])].flatMap(mapsOf))];
387
+ const enc = encode({ name: id, goal, tree: cert.tree }, false, true, vars, maps), { e, c } = enc;
388
+ const ix = (name) => vars.indexOf(name);
389
+ const instsLit = (is) => list(is.map(i => `⟨${ix(i.wit)}, ${e(i.below)}, ${list(i.terms.map(([z, v2]) => `(${int(z)}, ${ix(v2)})`))}, ${int(i.unit)}⟩`));
390
+ return `-- ${g.name} (variables ${vars.map((v2, j) => `${j} ${v2}`).join(', ')}; maps ${maps.map((m2, j) => `${j} ${m2}`).join(', ')})
391
+ def ${id}_goal : CGoal := ⟨${list(g.hyps.map(c))},
392
+ ${list(g.counts.map(cn => `⟨${ix(cn.v)}, ${ix(cn.key)}, ${e(cn.below)}, ${e(cn.body)}⟩`))}⟩
393
+ def ${id}_insts : List CInst := ${instsLit(cert.insts)}
394
+ def ${id}_tab : List VDef := ${enc.tab}
395
+ def ${id}_tree : Tree :=
396
+ ${enc.tree}
397
+ -- The instances' hypotheses Lean builds are the ones kernel.ts built.
398
+ example : countHyps ${id}_goal.counts ${id}_insts = some ${list(countHyps(g.counts, cert.insts).map(c))} := by ${checkBy}
399
+ /-- ${g.name}: no naturals and maps where each count is its sum satisfy the hypotheses. -/
400
+ theorem ${id} : ∀ ρ M, (∀ cn ∈ ${id}_goal.counts, cn.Holds ρ M) → ¬ ∀ h ∈ ${id}_goal.hyps, evalC ρ M h = true :=
401
+ counted_sound ${id}_goal ${id}_insts ${id}_tab ${id}_tree (by ${checkBy})${tampered.map(t => `
402
+ -- TAMPERED: ${t.what}. Lean computes the check to false, as kernel.ts refuses it.
403
+ example : checkCounted ${id}_goal ${instsLit(t.insts)} ${id}_tab ${id}_tree = false := by ${checkBy}`).join('')}`;
404
+ }
374
405
  // Whole machines through Kern.machine_sound: Lean builds the goals from the machine; the trees are the kernel's.
375
406
  export function machineToLean(id, m, laws, corollary) {
376
407
  if (m.maps && Object.keys(m.maps).length)
@@ -1111,6 +1142,32 @@ example : (checkSMachine ${id}_tampered ${id}_proof && sliveOk ${id}_tampered ${
1111
1142
  && checkSKStep ${id}_tampered ${id}_proof (sliveStep ${id}_live0 ${id}_live0.pend (liveStayC ${id}_live0) ${id}_live0_sp)
1112
1143
  && checkSKStep ${id}_tampered ${id}_proof (sliveStep ${id}_live0 ${id}_live0.pend (liveCoverC ${id}_live0) ${id}_live0_cp)
1113
1144
  && sliveHelpsOk ${id}_tampered ${id}_proof ${id}_live0 ${id}_live0_hp) = false := by ${checkBy}` : ''}` });
1145
+ // Ghost maps (GhostMap.lean): the laws that read no ghost hold of the original; every law, of the original with some
1146
+ // ghost values and maps (Skolem functions of the keys); and each law read ∀∃.
1147
+ const gm = opts.ghosted;
1148
+ if (gm)
1149
+ claims.push({ steps: [], allows: [], render: () => {
1150
+ const memOf = (j) => (j === 0 ? 'List.mem_cons_self' : `List.mem_cons_of_mem _ (${memOf(j - 1)})`);
1151
+ return `-- The laws that read no ghost hold of the original.
1152
+ theorem ${id}_orig_laws : ∀ ρ M, SReach ${id}_gm.orig ρ M → ∀ e ∈ ${id}_proof, avoids ${id}_gm.vars e.law.holds = true → avoidsMaps ${id}_gm.maps e.law.holds = true → e.Holds ρ M :=
1153
+ smghost_laws ${id}_gm ${id}_gmOk ${id}_proof ${id}_check
1154
+ -- Every law, at every reachable state of the original: some ghost values and ghost maps where it holds.
1155
+ theorem ${id}_skolem : ∀ ρ M, SReach ${id}_gm.orig ρ M → ∃ ρg Mg, Agree ${id}_gm.vars ρg ρ ∧ (∀ mp, mp ∉ ${id}_gm.maps → Mg mp = M mp) ∧ ∀ e ∈ ${id}_proof, e.Holds ρg Mg :=
1156
+ some_of_ghostmap ${id}_gm ${id}_gmOk ${id}_proof ${id}_check${(opts.forallSome ?? []).map((fs, j) => {
1157
+ const li = laws.findIndex(l => l.name === fs.law), law = laws[li];
1158
+ if (!law?.forall || law.keys?.length)
1159
+ throw new Error(`${id}: ${fs.law}: read ∀∃, a law about one key`);
1160
+ const read = substC(law.holds, { vars: {}, maps: { [fs.map]: () => ({ op: 'var', name: fs.as }) }, flags: {} });
1161
+ return `
1162
+ /-- ${law.name}, read ∀∃: for every ${law.forall}, some ${fs.as} (${fs.map} at ${law.forall}, a Skolem function the step keeps) where it holds; no ghost read. -/
1163
+ theorem ${id}_some${j} : ∀ ρ M, SReach ${id}_gm.orig ρ M → ∀ v, ∃ val, evalC (upd (upd ρ ${ix(law.forall)} v) ${ix(fs.as)} val) M
1164
+ (${c(read)}) = true := by
1165
+ have h := forall_some_of_ghostmap ${id}_gm ${id}_gmOk ${id}_proof ${id}_check ${id}_e${li} (${memOf(li)}) ${ix(law.forall)} rfl rfl ${mx(fs.map)} ${ix(fs.as)} (${e(fs.at)})
1166
+ (by ${checkBy}) (by ${checkBy}) (by ${checkBy}) (by ${checkBy})
1167
+ have hr : substRC [] (rdW ${mx(fs.map)} ${ix(fs.as)}) ${id}_e${li}.law.holds = ${c(read)} := by ${checkBy}
1168
+ rw [hr] at h; exact h`;
1169
+ }).join('')}`;
1170
+ } });
1114
1171
  // Ghosts (Ghost.lean's sghost_laws): the laws that read no ghost hold of the machine without its ghosts.
1115
1172
  if (gv.length)
1116
1173
  claims.push({ steps: [], allows: [], render: () => `-- The laws that read no ghost hold of the machine without its ghosts.
@@ -1333,7 +1390,13 @@ ${rf ? `def ${id}_refined : SRefined := ⟨${lit(rf.impl)},
1333
1390
  ${lit(rf.spec)},
1334
1391
  ${list(Object.entries(rf.wit).map(([inp, t]) => `(${ix(`b_${inp}`)}, ${e(t)})`))},
1335
1392
  ${c(rf.stutter)}⟩
1336
- def ${id}_machine : SMachine := ${id}_refined.full` : gv.length ? `def ${id}_ghosted : SGhosted := ⟨${lit(orig)},
1393
+ def ${id}_machine : SMachine := ${id}_refined.full` : gm ? `def ${id}_gm : SGhostedM := ⟨${lit(gm.orig)},
1394
+ ${list(Object.entries(gm.vars).map(([v2, x2]) => `(${ix(v2)}, ${e(x2.start)}, ${e(x2.step)})`))},
1395
+ ${list(Object.entries(gm.maps).map(([mp, x2]) => `(${mx(mp)}, ${x2.start})`))},
1396
+ ${list(Object.entries(gm.maps).flatMap(([mp, x2]) => ('each' in x2.write ? [] : [`(${mx(mp)}, ${e(x2.write.key)}, ${e(x2.write.value)})`])))},
1397
+ ${list(Object.entries(gm.maps).flatMap(([mp, x2]) => ('each' in x2.write ? [`(${mx(mp)}, ${ix(x2.write.each)}, ${e(x2.write.value)})`] : [])))}⟩
1398
+ def ${id}_machine : SMachine := ${id}_gm.full
1399
+ theorem ${id}_gmOk : smghostOk ${id}_gm = true := by ${checkBy}` : gv.length ? `def ${id}_ghosted : SGhosted := ⟨${lit(orig)},
1337
1400
  ${list(gv.map(v2 => `(${ix(v2)}, ${e(m.state[v2])}, ${e(m.step.state?.[v2] ?? { op: 'var', name: v2 })})`))}⟩
1338
1401
  def ${id}_machine : SMachine := ${id}_ghosted.full
1339
1402
  theorem ${id}_ghostOk : sghostOk ${id}_ghosted = true := by ${checkBy}` : hm ? `def ${id}_hist : HMachine := ${hlit(hm.history.relations ?? [])}
@@ -1347,7 +1410,7 @@ theorem ${id}_laws : ∀ ρ M, SReach ${id}_machine ρ M → ∀ e ∈ ${id}_pro
1347
1410
  ${hm ? histBlock() : readable(id, laws, vars, mapNames, { binders: '(ρ : Nat → Nat) (μ : Nat → Nat → Nat)', hyp: `SReach ${id}_machine ρ μ`, call: `${id}_laws ρ μ h`, lit: c, eLit: e })}${sm ? sumsBlock() : ''}${opts.noFacts ? '' : factsProof(id, m, mapNames, vars, opts.simp)}${opts.tamper ? `
1348
1411
  -- TAMPERED: ${opts.tamper.what}. Lean computes the check to false.
1349
1412
  def ${id}_tampered : SMachine := ${lit(opts.tamper.machine)}
1350
- example : checkSMachine ${id}_tampered ${id}_proof = false := by ${checkBy}` : ''}${records.length ? `\n\n${records.join('\n\n')}` : ''}${opts.after ? `\n\n${opts.after(ix)}` : ''}`;
1413
+ example : checkSMachine ${id}_tampered ${id}_proof = false := by ${checkBy}` : ''}${records.length ? `\n\n${records.join('\n\n')}` : ''}${opts.after ? `\n\n${opts.after(ix, mx, lit)}` : ''}`;
1351
1414
  }
1352
1415
  // --- the cyclic certificate's export (GDP_CERT=cyclic) -------------------------------------------------------------
1353
1416
  // By default, or with GDP_CERT=cyclic (core/cyclic.ts's certOn: a covered proof's certificate is its cyclic proof; or toLean's
@@ -1364,11 +1427,24 @@ example : checkSMachine ${id}_tampered ${id}_proof = false := by ${checkBy}` : '
1364
1427
  // is made with no cyclic certificate of its own (quietly): the export makes the certificate it exports from the usual
1365
1428
  // trees (cycMachineProof), and the usual export reads the trees, so a certificate made here is never read.
1366
1429
  const usualMade = new Map();
1430
+ // Where the usual proof fails and there are no step laws, the search's own set proof (proveSetFast: per-law instances
1431
+ // of each law's sort, a refutation's core widened to its goal, its trees checked by checkLaws): the laws the engine
1432
+ // proved that way (ring's) go to Lean from the trees that proof made, which Lean checks as any (`certReport.fast`).
1367
1433
  function proveStepLawsOnce(m, laws, stepLaws) {
1368
1434
  const key = JSON.stringify([m, laws, stepLaws]), had = usualMade.get(key);
1369
1435
  if (had)
1370
1436
  return had;
1371
- const r = quietly(() => proveStepLaws(m, laws, stepLaws));
1437
+ // (with no step laws, the usual proof within usualMs of the cost model's clock (GDP_LEAN_USUAL_MS, 60 s): past it, the
1438
+ // fast one; wo's set with its ghost ran the usual proof 8 minutes and more)
1439
+ const fastToo = !stepLaws.length && !laws.some(l => l.some?.length);
1440
+ let r = quietly(() => (fastToo ? withDeadline(clock() + Number(envOf()?.GDP_LEAN_USUAL_MS ?? 60_000), () => proveStepLaws(m, laws, stepLaws)) : proveStepLaws(m, laws, stepLaws)));
1441
+ if (!r.proven && fastToo) {
1442
+ const f = quietly(() => proveSetFast(m, laws));
1443
+ if (f.proven && f.checked && f.proof) {
1444
+ r = { proven: true, checked: true, nodes: f.nodes, leaves: f.leaves, proof: { laws: f.proof, instances: {}, perStep: {}, trees: {} } };
1445
+ certReport.fast.push(m.name);
1446
+ }
1447
+ }
1372
1448
  usualMade.set(key, r);
1373
1449
  return r;
1374
1450
  }
@@ -1378,7 +1454,7 @@ const envOf = () => globalThis.process?.env;
1378
1454
  export const cyclicCerts = certMode;
1379
1455
  let certsOn = false, cycTexts = 0;
1380
1456
  // What the last toLean exported from cyclic certificates, and what went the usual way (and why).
1381
- export const certReport = { cyclic: [], usual: [], translatedSteps: [] };
1457
+ export const certReport = { cyclic: [], usual: [], translatedSteps: [], fast: [] };
1382
1458
  // Each item's cyclic certificate is made within one deadline (GDP_CERT_MS, 10 s by default), every goal it grows (the
1383
1459
  // translation's leaves grown again, the searched nodes) bounded by it: past it, the item goes the usual way.
1384
1460
  function cycMachineProof(m, laws, allSteps, allows = []) {
@@ -1950,6 +2026,7 @@ export function toLean(items, opts = {}) {
1950
2026
  certReport.cyclic = [];
1951
2027
  certReport.usual = [];
1952
2028
  certReport.translatedSteps = [];
2029
+ certReport.fast = [];
1953
2030
  cycTexts = 0;
1954
2031
  usualMade.clear();
1955
2032
  // The proofs found with only the instances their leaves use: the same laws, from fewer hypotheses for Lean to build.
@@ -1993,7 +2070,10 @@ function toLeanWith(items, opts) {
1993
2070
  // Laws with "there exists" go in as the kernel proved them (core/exists.ts): the machine with the ghosts their
1994
2071
  // witnesses are, each law with its witness terms in place or over its ghosts, each stated again as ∃ (readable).
1995
2072
  if (item.laws.some(l => l.some?.length)) {
1996
- const it = item, r = proveStepLaws(it.machine, it.laws, it.stepLaws ?? []);
2073
+ // (with no step laws, the search's set proof first, proveSome's witnesses with proveSetFast as its whole-set
2074
+ // prover: the same ghosted machine and laws, without the usual proof and certificate the export makes again below)
2075
+ const it = item, fast = it.stepLaws?.length ? undefined : quietly(() => proveSetFast(it.machine, it.laws));
2076
+ const r = fast?.proven && fast.checked && fast.laws ? fast : proveStepLaws(it.machine, it.laws, it.stepLaws ?? []);
1997
2077
  if (!r.proven || !r.laws)
1998
2078
  throw new Error(`${it.id}: not proven (${r.failed?.stuck ?? ''})`);
1999
2079
  const ghosts = [...(it.ghosts ?? []), ...Object.keys(r.machine?.state ?? {}).filter(n => !(n in it.machine.state))];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdp-wired",
3
- "version": "0.31.1",
3
+ "version": "0.33.0",
4
4
  "description": "An automatic prover for stateful rules (budgets, caps, windows, workflows, policies): laws proven with no proof to write, checked again in Lean, counterexamples found on the GPU, the rule shipped as code",
5
5
  "keywords": [
6
6
  "verification",
@@ -100,8 +100,63 @@
100
100
  "types": "./dist/core/effect.d.ts",
101
101
  "default": "./dist/core/effect.js"
102
102
  },
103
+ "./extract-py": {
104
+ "types": "./dist/core/extract-py.d.ts",
105
+ "default": "./dist/core/extract-py.js"
106
+ },
107
+ "./extract-ex": {
108
+ "types": "./dist/core/extract-ex.d.ts",
109
+ "default": "./dist/core/extract-ex.js"
110
+ },
111
+ "./extract-rb": {
112
+ "types": "./dist/core/extract-rb.d.ts",
113
+ "default": "./dist/core/extract-rb.js"
114
+ },
115
+ "./extract-c": {
116
+ "types": "./dist/core/extract-c.d.ts",
117
+ "default": "./dist/core/extract-c.js"
118
+ },
119
+ "./extract-cpp": {
120
+ "types": "./dist/core/extract-c.d.ts",
121
+ "default": "./dist/core/extract-c.js"
122
+ },
123
+ "./extract-java": {
124
+ "types": "./dist/core/extract-jvm.d.ts",
125
+ "default": "./dist/core/extract-jvm.js"
126
+ },
127
+ "./extract-kotlin": {
128
+ "types": "./dist/core/extract-jvm.d.ts",
129
+ "default": "./dist/core/extract-jvm.js"
130
+ },
131
+ "./extract-rs": {
132
+ "types": "./dist/core/extract-rs.d.ts",
133
+ "default": "./dist/core/extract-rs.js"
134
+ },
135
+ "./extract-swift": {
136
+ "types": "./dist/core/extract-swift.d.ts",
137
+ "default": "./dist/core/extract-swift.js"
138
+ },
139
+ "./extract-go": {
140
+ "types": "./dist/core/extract-go.d.ts",
141
+ "default": "./dist/core/extract-go.js"
142
+ },
143
+ "./cli": {
144
+ "types": "./dist/core/cli.d.ts",
145
+ "default": "./dist/core/cli.js"
146
+ },
147
+ "./laws": {
148
+ "types": "./dist/core/laws.d.ts",
149
+ "default": "./dist/core/laws.js"
150
+ },
151
+ "./relational": {
152
+ "types": "./dist/core/relational.d.ts",
153
+ "default": "./dist/core/relational.js"
154
+ },
103
155
  "./package.json": "./package.json"
104
156
  },
157
+ "bin": {
158
+ "gdp-wired": "dist/core/cli.js"
159
+ },
105
160
  "files": [
106
161
  "dist",
107
162
  "README.md",
@@ -130,7 +185,7 @@
130
185
  "prepublishOnly": "bun scripts/build.ts",
131
186
  "smoke": "sh scripts/smoke.sh",
132
187
  "bar": "bun gates/bar.ts",
133
- "test": "bun scripts/gen-lean-library.ts --check && cd core && bun test solver.test.ts dsl.test.ts sums.test.ts arith.test.ts conformance.test.ts compose.test.ts quantifiers.test.ts functions.test.ts keyterms.test.ts lists.test.ts liveness.test.ts sizes.test.ts values.test.ts rationals.test.ts builders.test.ts gdp.test.ts datatypes.test.ts lemmas.test.ts discover.test.ts infer.test.ts cyclic.test.ts cycles.test.ts nonterm.test.ts data.test.ts hypothesis.test.ts seqs.test.ts abstract.test.ts search.test.ts invoices.test.ts folds.test.ts trees.test.ts pairs.test.ts chart.test.ts xstate.test.ts extract.test.ts effect.test.ts && cd ../kernel && bun test tamper.test.ts refusals.test.ts steplaw.test.ts sets.test.ts cdcl.test.ts && cd ../examples && bun test examples.test.ts && cd .. && bun examples/readme.ts && bun examples/guide.ts && bun examples/composition.ts && bun examples/sets.ts && bun examples/quantifiers.ts && bun examples/functions.ts && bun examples/datatypes.ts && bun examples/lemmas.ts && bun examples/discover.ts && bun examples/invoices.ts && bun examples/folds.ts && bun examples/trees.ts && bun examples/pairs.ts && bun examples/groups.ts && bun examples/charts.ts && bun examples/xstate.ts && bun examples/effect.ts && bun examples/infer.ts && bun examples/arith.ts && bun examples/cyclic.ts && bun examples/cycles.ts && bun examples/data.ts && bun examples/abstract.ts && bun test compare/tip/translate.test.ts && bun examples/scopes.ts && bun examples/lists.ts && bun examples/sizes.ts && bun examples/liveness.ts && bun examples/sums.ts && bun examples/nonterm.ts && bun examples/rationals.ts && bun examples/budget.ts && bun examples/gdp.ts && bun examples/steps.ts && bun examples/jev-fabric/run.ts"
188
+ "test": "bun scripts/gen-lean-library.ts --check && cd core && bun test exports.test.ts cli.test.ts solver.test.ts dsl.test.ts sums.test.ts arith.test.ts conformance.test.ts compose.test.ts relational.test.ts quantifiers.test.ts functions.test.ts keyterms.test.ts lists.test.ts liveness.test.ts sizes.test.ts values.test.ts rationals.test.ts builders.test.ts gdp.test.ts datatypes.test.ts lemmas.test.ts discover.test.ts infer.test.ts cyclic.test.ts cycles.test.ts nonterm.test.ts data.test.ts hypothesis.test.ts seqs.test.ts abstract.test.ts search.test.ts invoices.test.ts folds.test.ts trees.test.ts pairs.test.ts chart.test.ts xstate.test.ts extract.test.ts effect.test.ts && cd ../kernel && bun test tamper.test.ts refusals.test.ts steplaw.test.ts sets.test.ts cdcl.test.ts && cd ../examples && bun test examples.test.ts && cd .. && bun examples/readme.ts && bun examples/guide.ts && bun examples/composition.ts && bun examples/sets.ts && bun examples/quantifiers.ts && bun examples/functions.ts && bun examples/datatypes.ts && bun examples/lemmas.ts && bun examples/discover.ts && bun examples/invoices.ts && bun examples/folds.ts && bun examples/trees.ts && bun examples/pairs.ts && bun examples/groups.ts && bun examples/charts.ts && bun examples/xstate.ts && bun examples/effect.ts && bun examples/infer.ts && bun examples/arith.ts && bun examples/cyclic.ts && bun examples/cycles.ts && bun examples/data.ts && bun examples/abstract.ts && bun test compare/tip/translate.test.ts && bun examples/scopes.ts && bun examples/lists.ts && bun examples/sizes.ts && bun examples/liveness.ts && bun examples/sums.ts && bun examples/nonterm.ts && bun examples/rationals.ts && bun examples/budget.ts && bun examples/gdp.ts && bun examples/steps.ts && bun examples/jev-fabric/run.ts"
134
189
  },
135
190
  "devDependencies": {
136
191
  "@gdp-ts/core": "0.1.0",