gdp-wired 0.48.0 → 0.50.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 (361) hide show
  1. package/README.md +6 -2
  2. package/dist/core/bmc.js +10 -7
  3. package/dist/core/candidate-seeds.d.ts +25 -0
  4. package/dist/core/candidate-seeds.js +90 -0
  5. package/dist/core/check.js +7 -2
  6. package/dist/core/cli.js +3 -0
  7. package/dist/core/count-attempt-work.d.ts +29 -0
  8. package/dist/core/count-attempt-work.js +96 -0
  9. package/dist/core/count-boolean-partition.d.ts +5 -0
  10. package/dist/core/count-boolean-partition.js +47 -0
  11. package/dist/core/count-bounded-quotient.d.ts +2 -0
  12. package/dist/core/count-bounded-quotient.js +13 -0
  13. package/dist/core/count-case-compose.d.ts +20 -0
  14. package/dist/core/count-case-compose.js +289 -0
  15. package/dist/core/count-cases.js +3 -2
  16. package/dist/core/count-cert-rename.d.ts +10 -0
  17. package/dist/core/count-cert-rename.js +69 -0
  18. package/dist/core/count-cert-transport.d.ts +10 -2
  19. package/dist/core/count-cert-transport.js +60 -9
  20. package/dist/core/count-certificate-minimize.d.ts +57 -0
  21. package/dist/core/count-certificate-minimize.js +263 -0
  22. package/dist/core/count-closed-family.d.ts +32 -0
  23. package/dist/core/count-closed-family.js +143 -0
  24. package/dist/core/count-closing-budget.d.ts +10 -0
  25. package/dist/core/count-closing-budget.js +49 -0
  26. package/dist/core/count-closing-needs.d.ts +5 -0
  27. package/dist/core/count-closing-needs.js +9 -0
  28. package/dist/core/count-component-budget.d.ts +5 -0
  29. package/dist/core/count-component-budget.js +9 -0
  30. package/dist/core/count-copy-shape.d.ts +11 -0
  31. package/dist/core/count-copy-shape.js +40 -0
  32. package/dist/core/count-disjoint-funding.d.ts +75 -0
  33. package/dist/core/count-disjoint-funding.js +284 -0
  34. package/dist/core/count-emitter-frame-pool.d.ts +23 -0
  35. package/dist/core/count-emitter-frame-pool.js +87 -0
  36. package/dist/core/count-final-step.d.ts +5 -0
  37. package/dist/core/count-final-step.js +20 -0
  38. package/dist/core/count-fixed-frame.d.ts +4 -0
  39. package/dist/core/count-fixed-frame.js +30 -0
  40. package/dist/core/count-frames.d.ts +25 -0
  41. package/dist/core/count-frames.js +118 -0
  42. package/dist/core/count-frozen-guard.d.ts +2 -0
  43. package/dist/core/count-frozen-guard.js +31 -0
  44. package/dist/core/count-generation-phase.d.ts +7 -0
  45. package/dist/core/count-generation-phase.js +33 -0
  46. package/dist/core/count-guard-composition.d.ts +12 -0
  47. package/dist/core/count-guard-composition.js +48 -0
  48. package/dist/core/count-guard-context.d.ts +11 -0
  49. package/dist/core/count-guard-context.js +50 -0
  50. package/dist/core/count-guard-facts.d.ts +50 -0
  51. package/dist/core/count-guard-facts.js +97 -0
  52. package/dist/core/count-guard-proposals.d.ts +7 -0
  53. package/dist/core/count-guard-proposals.js +106 -0
  54. package/dist/core/count-guard-shape.d.ts +18 -0
  55. package/dist/core/count-guard-shape.js +100 -0
  56. package/dist/core/count-guard-tree.d.ts +17 -0
  57. package/dist/core/count-guard-tree.js +125 -0
  58. package/dist/core/count-leader-facts.d.ts +10 -0
  59. package/dist/core/count-leader-facts.js +52 -0
  60. package/dist/core/count-leader.d.ts +10 -0
  61. package/dist/core/count-leader.js +331 -0
  62. package/dist/core/count-lemma-transport.d.ts +8 -0
  63. package/dist/core/count-lemma-transport.js +47 -0
  64. package/dist/core/count-lifted-budget.d.ts +54 -0
  65. package/dist/core/count-lifted-budget.js +97 -0
  66. package/dist/core/count-lifted-copy.d.ts +3 -0
  67. package/dist/core/count-lifted-copy.js +166 -0
  68. package/dist/core/count-lifted-increment.d.ts +3 -0
  69. package/dist/core/count-lifted-increment.js +146 -0
  70. package/dist/core/count-lifted-load.d.ts +5 -0
  71. package/dist/core/count-lifted-load.js +179 -0
  72. package/dist/core/count-lifted-prerequisite.d.ts +14 -0
  73. package/dist/core/count-lifted-prerequisite.js +53 -0
  74. package/dist/core/count-lifted-replacement.d.ts +3 -0
  75. package/dist/core/count-lifted-replacement.js +540 -0
  76. package/dist/core/count-lifted-shape.d.ts +63 -0
  77. package/dist/core/count-lifted-shape.js +115 -0
  78. package/dist/core/count-lifted-strategy.d.ts +7 -0
  79. package/dist/core/count-lifted-strategy.js +226 -0
  80. package/dist/core/count-lifted-transports.d.ts +32 -0
  81. package/dist/core/count-lifted-transports.js +293 -0
  82. package/dist/core/count-load-shape.d.ts +17 -0
  83. package/dist/core/count-load-shape.js +67 -0
  84. package/dist/core/count-minimal-view.d.ts +26 -0
  85. package/dist/core/count-minimal-view.js +46 -0
  86. package/dist/core/count-operation-observation.d.ts +9 -0
  87. package/dist/core/count-operation-observation.js +22 -0
  88. package/dist/core/count-operation-order.d.ts +5 -0
  89. package/dist/core/count-operation-order.js +4 -0
  90. package/dist/core/count-phase.d.ts +9 -0
  91. package/dist/core/count-phase.js +127 -0
  92. package/dist/core/count-premise-search.d.ts +9 -0
  93. package/dist/core/count-premise-search.js +41 -0
  94. package/dist/core/count-premise-view.d.ts +19 -0
  95. package/dist/core/count-premise-view.js +220 -0
  96. package/dist/core/count-prerequisite-components.d.ts +67 -0
  97. package/dist/core/count-prerequisite-components.js +239 -0
  98. package/dist/core/count-prerequisite-memory.d.ts +24 -0
  99. package/dist/core/count-prerequisite-memory.js +37 -0
  100. package/dist/core/count-prerequisite-plan.d.ts +12 -0
  101. package/dist/core/count-prerequisite-plan.js +88 -0
  102. package/dist/core/count-primitive-budget.d.ts +1 -0
  103. package/dist/core/count-primitive-budget.js +8 -0
  104. package/dist/core/count-project-free.d.ts +3 -0
  105. package/dist/core/count-project-free.js +24 -0
  106. package/dist/core/count-project-witness.d.ts +4 -0
  107. package/dist/core/count-project-witness.js +48 -0
  108. package/dist/core/count-proof-rescope.d.ts +14 -0
  109. package/dist/core/count-proof-rescope.js +71 -0
  110. package/dist/core/count-proof-scope.d.ts +68 -0
  111. package/dist/core/count-proof-scope.js +333 -0
  112. package/dist/core/count-prune-owned-root.d.ts +5 -0
  113. package/dist/core/count-prune-owned-root.js +27 -0
  114. package/dist/core/count-query-context.d.ts +3 -0
  115. package/dist/core/count-query-context.js +7 -0
  116. package/dist/core/count-query.d.ts +15 -0
  117. package/dist/core/count-query.js +59 -0
  118. package/dist/core/count-quorum-leaf.d.ts +9 -0
  119. package/dist/core/count-quorum-leaf.js +38 -0
  120. package/dist/core/count-reachability-budget.d.ts +1 -0
  121. package/dist/core/count-reachability-budget.js +7 -0
  122. package/dist/core/count-reachability-reconcile.d.ts +11 -0
  123. package/dist/core/count-reachability-reconcile.js +19 -0
  124. package/dist/core/count-reachability.d.ts +50 -0
  125. package/dist/core/count-reachability.js +351 -0
  126. package/dist/core/count-rebase-path.d.ts +9 -0
  127. package/dist/core/count-rebase-path.js +68 -0
  128. package/dist/core/count-recipe-context.d.ts +45 -0
  129. package/dist/core/count-recipe-context.js +71 -0
  130. package/dist/core/count-recipe-controller.d.ts +115 -0
  131. package/dist/core/count-recipe-controller.js +417 -0
  132. package/dist/core/count-recipe-graph.d.ts +36 -0
  133. package/dist/core/count-recipe-graph.js +211 -0
  134. package/dist/core/count-recovery/conditional-check-cache.js +3 -2
  135. package/dist/core/count-recovery/conditional-cuts.js +5 -4
  136. package/dist/core/count-recovery/conditional-proof.d.ts +37 -3
  137. package/dist/core/count-recovery/conditional-proof.js +72 -30
  138. package/dist/core/count-recovery/derivability-closure.js +2 -1
  139. package/dist/core/count-recovery/guard-cases.js +2 -1
  140. package/dist/core/count-recovery/reframe-tree.d.ts +2 -0
  141. package/dist/core/count-recovery/reframe-tree.js +24 -0
  142. package/dist/core/count-recovery/replay-linear-skeleton.d.ts +2 -0
  143. package/dist/core/count-recovery/replay-linear-skeleton.js +28 -0
  144. package/dist/core/count-recovery/row-cases.js +2 -1
  145. package/dist/core/count-rejection-budget.d.ts +8 -0
  146. package/dist/core/count-rejection-budget.js +15 -0
  147. package/dist/core/count-replacement.d.ts +5 -0
  148. package/dist/core/count-replacement.js +129 -0
  149. package/dist/core/count-replay-diagnostic.d.ts +21 -0
  150. package/dist/core/count-replay-diagnostic.js +49 -0
  151. package/dist/core/count-replay-skeleton.d.ts +4 -0
  152. package/dist/core/count-replay-skeleton.js +28 -0
  153. package/dist/core/count-rescope-funding.d.ts +3 -0
  154. package/dist/core/count-rescope-funding.js +17 -0
  155. package/dist/core/count-restrictions.d.ts +11 -0
  156. package/dist/core/count-restrictions.js +31 -0
  157. package/dist/core/count-retry-budget.d.ts +67 -0
  158. package/dist/core/count-retry-budget.js +114 -0
  159. package/dist/core/count-retry-round.d.ts +24 -0
  160. package/dist/core/count-retry-round.js +44 -0
  161. package/dist/core/count-row-agreement.d.ts +35 -0
  162. package/dist/core/count-row-agreement.js +270 -0
  163. package/dist/core/count-row-aliases.d.ts +3 -0
  164. package/dist/core/count-row-aliases.js +59 -0
  165. package/dist/core/count-row-composition.d.ts +6 -0
  166. package/dist/core/count-row-composition.js +55 -0
  167. package/dist/core/count-row-copy-linear.d.ts +4 -0
  168. package/dist/core/count-row-copy-linear.js +83 -0
  169. package/dist/core/count-row-copy.d.ts +4 -0
  170. package/dist/core/count-row-copy.js +94 -0
  171. package/dist/core/count-row-policy.d.ts +3 -0
  172. package/dist/core/count-row-policy.js +56 -0
  173. package/dist/core/count-row-reindex.d.ts +11 -0
  174. package/dist/core/count-row-reindex.js +126 -0
  175. package/dist/core/count-row-support.d.ts +9 -0
  176. package/dist/core/count-row-support.js +42 -0
  177. package/dist/core/count-row-symmetry.d.ts +7 -0
  178. package/dist/core/count-row-symmetry.js +100 -0
  179. package/dist/core/count-scope-hyps.d.ts +2 -0
  180. package/dist/core/count-scope-hyps.js +163 -0
  181. package/dist/core/count-scope-row-reuse.d.ts +3 -0
  182. package/dist/core/count-scope-row-reuse.js +92 -0
  183. package/dist/core/count-search-allowance.d.ts +1 -0
  184. package/dist/core/count-search-allowance.js +17 -0
  185. package/dist/core/count-stabilize-tree.d.ts +9 -0
  186. package/dist/core/count-stabilize-tree.js +35 -0
  187. package/dist/core/count-stage-trace.d.ts +8 -0
  188. package/dist/core/count-stage-trace.js +45 -0
  189. package/dist/core/count-strategies.d.ts +16 -0
  190. package/dist/core/count-strategies.js +155 -0
  191. package/dist/core/count-strategy-premises.d.ts +5 -0
  192. package/dist/core/count-strategy-premises.js +14 -0
  193. package/dist/core/count-strategy.d.ts +41 -0
  194. package/dist/core/count-strategy.js +76 -0
  195. package/dist/core/count-support.d.ts +1 -0
  196. package/dist/core/count-support.js +26 -4
  197. package/dist/core/count-tier-budget.d.ts +14 -0
  198. package/dist/core/count-tier-budget.js +64 -0
  199. package/dist/core/count-unwritten-prefix.d.ts +24 -0
  200. package/dist/core/count-unwritten-prefix.js +97 -0
  201. package/dist/core/count-write-shape.d.ts +15 -0
  202. package/dist/core/count-write-shape.js +73 -0
  203. package/dist/core/counted-candidate-seeds.d.ts +12 -0
  204. package/dist/core/counted-candidate-seeds.js +31 -0
  205. package/dist/core/counts.d.ts +37 -13
  206. package/dist/core/counts.js +999 -129
  207. package/dist/core/cycles.js +5 -4
  208. package/dist/core/cyclic.js +11 -10
  209. package/dist/core/data.js +16 -15
  210. package/dist/core/dsl-deadline.d.ts +3 -0
  211. package/dist/core/dsl-deadline.js +27 -0
  212. package/dist/core/dsl.d.ts +32 -2
  213. package/dist/core/dsl.js +202 -64
  214. package/dist/core/evaluation-admission.d.ts +1 -0
  215. package/dist/core/evaluation-admission.js +3 -0
  216. package/dist/core/exists.d.ts +6 -1
  217. package/dist/core/exists.js +53 -10
  218. package/dist/core/field-laws.d.ts +3 -1
  219. package/dist/core/field-laws.js +159 -3
  220. package/dist/core/finite-houdini.d.ts +6 -0
  221. package/dist/core/finite-houdini.js +63 -21
  222. package/dist/core/finite-tiny.js +95 -67
  223. package/dist/core/fixtures/count-completion/paxos-decision.json +1 -0
  224. package/dist/core/fresh.js +5 -1
  225. package/dist/core/infer.js +49 -33
  226. package/dist/core/kind.js +2 -1
  227. package/dist/core/lemma-cuts.js +11 -10
  228. package/dist/core/lift-cli.d.ts +11 -0
  229. package/dist/core/lift-cli.js +113 -0
  230. package/dist/core/linear-admission.d.ts +14 -0
  231. package/dist/core/linear-admission.js +151 -0
  232. package/dist/core/machine.d.ts +5 -2
  233. package/dist/core/machine.js +105 -31
  234. package/dist/core/meter.d.ts +22 -0
  235. package/dist/core/meter.js +34 -0
  236. package/dist/core/nonterm.js +4 -3
  237. package/dist/core/proof-output.d.ts +53 -0
  238. package/dist/core/proof-output.js +38 -0
  239. package/dist/core/prover-row-budget.d.ts +3 -0
  240. package/dist/core/prover-row-budget.js +106 -0
  241. package/dist/core/quorum-laws.d.ts +21 -1
  242. package/dist/core/quorum-laws.js +80 -17
  243. package/dist/core/rationals.js +3 -2
  244. package/dist/core/rejection-discovery.d.ts +34 -0
  245. package/dist/core/rejection-discovery.js +36 -0
  246. package/dist/core/rejection-stage.d.ts +39 -0
  247. package/dist/core/rejection-stage.js +205 -0
  248. package/dist/core/request-quotient.d.ts +8 -0
  249. package/dist/core/request-quotient.js +299 -0
  250. package/dist/core/row-agreement-shape.d.ts +15 -0
  251. package/dist/core/row-agreement-shape.js +68 -0
  252. package/dist/core/runtime-wall.d.ts +2 -0
  253. package/dist/core/search-policy.d.ts +15 -0
  254. package/dist/core/search-policy.js +68 -0
  255. package/dist/core/solver.d.ts +1 -1
  256. package/dist/core/solver.js +40 -6
  257. package/dist/core/step-work.d.ts +12 -0
  258. package/dist/core/step-work.js +14 -0
  259. package/dist/core/strategy-premises.d.ts +8 -0
  260. package/dist/core/strategy-premises.js +64 -0
  261. package/dist/core/system.js +4 -3
  262. package/dist/core/table-admission.d.ts +1 -0
  263. package/dist/core/table-admission.js +3 -0
  264. package/dist/core/trace-clock.d.ts +3 -0
  265. package/dist/core/trace-clock.js +16 -0
  266. package/dist/core/transfer.js +3 -2
  267. package/dist/core/translate.js +16 -3
  268. package/dist/core/wall.d.ts +6 -1
  269. package/dist/core/wall.js +23 -9
  270. package/dist/core/watch.d.ts +1 -1
  271. package/dist/core/watch.js +13 -4
  272. package/dist/core/work-admission.d.ts +164 -0
  273. package/dist/core/work-admission.js +418 -0
  274. package/dist/core/work-amount.d.ts +21 -0
  275. package/dist/core/work-amount.js +80 -0
  276. package/dist/core/work-collections.d.ts +11 -0
  277. package/dist/core/work-collections.js +198 -0
  278. package/dist/core/work-kinds.d.ts +11 -0
  279. package/dist/core/work-kinds.js +9 -0
  280. package/dist/core/work-meter.d.ts +8 -0
  281. package/dist/core/work-meter.js +83 -0
  282. package/dist/core/work-observe.d.ts +12 -0
  283. package/dist/core/work-observe.js +39 -0
  284. package/dist/core/work-profile.d.ts +10 -0
  285. package/dist/core/work-profile.js +21 -0
  286. package/dist/core/work-refusal.d.ts +1 -0
  287. package/dist/core/work-refusal.js +6 -0
  288. package/dist/interchange/format.js +2 -0
  289. package/dist/kernel/cdcl.js +93 -40
  290. package/dist/kernel/epr.js +23 -8
  291. package/dist/kernel/function-instances.d.ts +45 -0
  292. package/dist/kernel/function-instances.js +460 -0
  293. package/dist/kernel/kernel.d.ts +47 -1
  294. package/dist/kernel/kernel.js +417 -68
  295. package/dist/kernel/prove.d.ts +61 -6
  296. package/dist/kernel/prove.js +625 -205
  297. package/dist/kernel/prover-rows.d.ts +1 -0
  298. package/dist/kernel/prover-rows.js +12 -1
  299. package/dist/kernel/reader.d.ts +1 -1
  300. package/dist/kernel/reader.js +57 -12
  301. package/dist/kernel/simplex.js +9 -2
  302. package/dist/lean-kernel/axiom-audit.d.ts +11 -0
  303. package/dist/lean-kernel/axiom-audit.js +50 -0
  304. package/dist/lean-kernel/emit.d.ts +34 -3
  305. package/dist/lean-kernel/emit.js +215 -28
  306. package/dist/lean-kernel/legacy-family-library.d.ts +1 -0
  307. package/dist/lean-kernel/legacy-family-library.js +5 -0
  308. package/dist/lean-kernel/legacy-family-order.d.ts +1 -0
  309. package/dist/lean-kernel/legacy-family-order.js +26 -0
  310. package/dist/lean-kernel/library.js +25 -3
  311. package/dist/lean-kernel/lift/counted-source-data.d.ts +7 -0
  312. package/dist/lean-kernel/lift/counted-source-data.js +78 -0
  313. package/dist/lean-kernel/lift/index.d.ts +82 -0
  314. package/dist/lean-kernel/lift/index.js +116 -0
  315. package/dist/lean-kernel/lift/project.d.ts +4 -0
  316. package/dist/lean-kernel/lift/project.js +15 -0
  317. package/dist/lean-kernel/lift/proof-capture.d.ts +104 -0
  318. package/dist/lean-kernel/lift/proof-capture.js +216 -0
  319. package/dist/lean-kernel/lift/proof-codec.d.ts +28 -0
  320. package/dist/lean-kernel/lift/proof-codec.js +299 -0
  321. package/dist/lean-kernel/lift/proof-counted-source.d.ts +16 -0
  322. package/dist/lean-kernel/lift/proof-counted-source.js +68 -0
  323. package/dist/lean-kernel/lift/proof-frontier.d.ts +19 -0
  324. package/dist/lean-kernel/lift/proof-frontier.js +153 -0
  325. package/dist/lean-kernel/lift/proof-graph.d.ts +17 -0
  326. package/dist/lean-kernel/lift/proof-graph.js +130 -0
  327. package/dist/lean-kernel/lift/proof-parts.d.ts +29 -0
  328. package/dist/lean-kernel/lift/proof-parts.js +131 -0
  329. package/dist/lean-kernel/lift/proof-prelude.d.ts +2 -0
  330. package/dist/lean-kernel/lift/proof-prelude.js +38 -0
  331. package/dist/lean-kernel/lift/proof-witness.d.ts +30 -0
  332. package/dist/lean-kernel/lift/proof-witness.js +283 -0
  333. package/dist/lean-kernel/lift/shape.d.ts +5 -0
  334. package/dist/lean-kernel/lift/shape.js +57 -0
  335. package/dist/lean-kernel/lift/source-projection.d.ts +16 -0
  336. package/dist/lean-kernel/lift/source-projection.js +81 -0
  337. package/dist/lean-kernel/lift/source.d.ts +23 -0
  338. package/dist/lean-kernel/lift/source.js +111 -0
  339. package/dist/lean-kernel/lift/witness-alpha.d.ts +9 -0
  340. package/dist/lean-kernel/lift/witness-alpha.js +31 -0
  341. package/dist/lean-kernel/lift-legacy.d.ts +58 -0
  342. package/dist/lean-kernel/lift-legacy.js +84 -0
  343. package/dist/lean-kernel/lift-names.d.ts +22 -0
  344. package/dist/lean-kernel/lift-names.js +36 -0
  345. package/dist/lean-kernel/lift-simulation/index.d.ts +29 -0
  346. package/dist/lean-kernel/lift-simulation/index.js +352 -0
  347. package/dist/lean-kernel/lift-simulation/shape.d.ts +41 -0
  348. package/dist/lean-kernel/lift-simulation/shape.js +173 -0
  349. package/dist/lean-kernel/lift-special/index.d.ts +36 -0
  350. package/dist/lean-kernel/lift-special/index.js +241 -0
  351. package/dist/lean-kernel/lift-special/structural.d.ts +25 -0
  352. package/dist/lean-kernel/lift-special/structural.js +126 -0
  353. package/dist/lean-kernel/lift-typed/index.d.ts +35 -0
  354. package/dist/lean-kernel/lift-typed/index.js +256 -0
  355. package/dist/lean-kernel/lift-typed/roles.d.ts +17 -0
  356. package/dist/lean-kernel/lift-typed/roles.js +170 -0
  357. package/dist/lean-kernel/lift-typed/shape.d.ts +1 -0
  358. package/dist/lean-kernel/lift-typed/shape.js +12 -0
  359. package/dist/lean-kernel/lift.d.ts +30 -0
  360. package/dist/lean-kernel/lift.js +97 -0
  361. package/package.json +5 -1
package/README.md CHANGED
@@ -20,9 +20,9 @@ If a model is intentionally used at runtime, `fun(...).run()` interprets support
20
20
  `fun(...).compiled()` explicitly opts into generated JavaScript. User-supplied JavaScript helper source requires that opt-in;
21
21
  arithmetic terms, library `divBy`/`modBy` helpers, and source-free `recur` equations work with the default interpreter.
22
22
 
23
- [![How gdp-wired works: certificates, the kernel, the frontier (14 min)](https://raw.githubusercontent.com/monotykamary/gdp-wired/main/static/explainer.jpg)](https://gdpwired.dev/#explainer)
23
+ [![How gdp-wired works: certificates, the kernel, the frontier (15 min)](https://raw.githubusercontent.com/monotykamary/gdp-wired/main/static/explainer.jpg)](https://gdpwired.dev/#explainer)
24
24
 
25
- How it works, in 14 minutes: what a certificate is, why the kernel is small, and the frontier. [Watch it on gdpwired.dev](https://gdpwired.dev/#explainer), with captions.
25
+ How it works, in 15 minutes: what a certificate is, why the kernel is small, and the frontier. [Watch it on gdpwired.dev](https://gdpwired.dev/#explainer), with captions.
26
26
 
27
27
  ```sh
28
28
  npm install --save-dev gdp-wired typescript # or bun add --dev gdp-wired typescript
@@ -578,6 +578,10 @@ const soon = retry.law('the next try is at most 64 after the last request', ({ne
578
578
  `leanProject(file)` a Lake project with the twin, so `lake build` checks them. Each law comes as the twin's theorem and
579
579
  as a plain statement over named variables, e.g. `theorem budget.law0 (h : SReach budget_machine ρ μ) : ρ «s» ≤
580
580
  (ρ «b» + ρ «m»)`, for a Lean development to cite.
581
+ - **Retained proof lifting** (`gdp-wired/lift`): `gdp-wired lift capsule source.json --out proof` generates a fresh
582
+ Lean project from a data-only proof capsule and source model, without invariant search. The default command checks
583
+ the source laws in Lean; `--emit-only` does not claim acceptance. See [the lift guide](docs/lift.md) for supported
584
+ transports, hash-bound receipts, and the boundary between an encoded source theorem and an external specification.
581
585
  - **Composition** (`gdp-wired/compose`): `product(a, b)`, `interleave(a, b)`, `refinement(impl, spec, {relation, witness, stutter})`,
582
586
  `steps(spec, k)` (k spec steps as one, each skippable) and `ghost(m, {name: ever(...) | count(...) | total(m, map, name)})`
583
587
  build plain machines from machines (each side's state named `a_x`, `b_x`). A refinement's laws are the relation, proven
package/dist/core/bmc.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { searchNow as countedSearchNow } from "./wall.js";
1
2
  // Bounded runs: a law broken by a run of k steps from the start, found by the prover's model search. Nothing here is
2
3
  // trusted. The goal of depth k is the kernel's own k-step goal (kernel.ts's stepLawObligations, `steps: k`): its first
3
4
  // `when` is the start (each state variable its start value over the params), its `then` the laws after the last step
@@ -21,7 +22,7 @@
21
22
  //
22
23
  // The budget is read off prove.ts's clock inside `counted` (the cost model's work, bmcRate units a millisecond), so the
23
24
  // search is the same on any machine; a wall-clock stop beside it (`wall`) is for callers under a wall-clock limit.
24
- import { evalC, evalE, interpret, isArithmetic, loadJs, numbersOf } from "./machine.js";
25
+ import { evalC, evalE, hasFinite, interpret, isArithmetic, loadJs, numbersOf } from "./machine.js";
25
26
  import { stepLawObligations, substC, substE } from "../kernel/kernel.js";
26
27
  import { clock, counted, fullRate } from "../kernel/prove.js";
27
28
  import { REFUTED, cdclSession, growCdcl } from "../kernel/cdcl.js";
@@ -31,6 +32,8 @@ import { env, linOfE, plus, vars } from "./solver.js";
31
32
  // Machines whose runs the goals describe as they are: scalars only (no maps, history or carried maps), no quantified
32
33
  // flag, no function but division by a constant (whose facts fix its value); laws plain (no key, no "there exists").
33
34
  export function bmcFits(m, laws) {
35
+ if (hasFinite([m, laws]))
36
+ return false;
34
37
  if (Object.keys(m.maps ?? {}).length || m.history || m.inputMaps?.length)
35
38
  return false;
36
39
  if (Object.values(m.step.flags ?? {}).some(f => f.op === 'all'))
@@ -436,7 +439,7 @@ function forcedRunner(m, laws, opts) {
436
439
  if (over)
437
440
  return 'over';
438
441
  for (; n < opts.steps; n++) {
439
- if (!(n % 256) && performance.now() >= wall)
442
+ if (!(n % 256) && countedSearchNow() >= wall)
440
443
  return 'paused';
441
444
  let next, request, forced = true;
442
445
  for (const [j, input] of requests.entries()) {
@@ -571,7 +574,7 @@ function unrolled(m, laws) {
571
574
  export function findBoundedRun(m, laws, opts) {
572
575
  // A forced run first, within forcedShare of the budget (as wall time: it is the compiled rule's, not the kernel's;
573
576
  // with `steps` and no wall stop, in its steps instead).
574
- const now = performance.now(), end = Math.min(opts.wall ?? Infinity, now + opts.ms), steps = opts.steps && opts.wall === undefined;
577
+ const now = countedSearchNow(), end = Math.min(opts.wall ?? Infinity, now + opts.ms), steps = opts.steps && opts.wall === undefined;
575
578
  const out = boundedSearch(m, laws, { ...opts, full: opts.full ?? false, forcedMs: steps ? Infinity : forcedShare * (end - now), ...(steps ? { forcedSteps: Math.min(forcedSteps, Math.round(forcedShare * forcedRate * opts.ms)) } : {}) })?.run(opts.ms, opts.wall);
576
579
  return typeof out === 'object' ? out : undefined;
577
580
  }
@@ -586,21 +589,21 @@ export function boundedSearch(m, laws, opts) {
586
589
  if (over)
587
590
  return 'over';
588
591
  if (forced && forcedLeft > 0) {
589
- const t0 = performance.now(), out = forced(Math.min(wall ?? Infinity, t0 + forcedLeft));
590
- forcedLeft -= performance.now() - t0;
592
+ const t0 = countedSearchNow(), out = forced(Math.min(wall ?? Infinity, t0 + forcedLeft));
593
+ forcedLeft -= countedSearchNow() - t0;
591
594
  if (typeof out === 'object') {
592
595
  over = true;
593
596
  return out;
594
597
  }
595
598
  if (out === 'over')
596
599
  forcedLeft = 0;
597
- else if (wall !== undefined && performance.now() >= wall)
600
+ else if (wall !== undefined && countedSearchNow() >= wall)
598
601
  return 'paused';
599
602
  }
600
603
  const full = opts.full ?? true;
601
604
  return counted(full ? bmcRate : workRate, () => {
602
605
  const until = clock() + ms;
603
- const late = () => clock() >= until || (wall !== undefined && performance.now() >= wall);
606
+ const late = () => clock() >= until || (wall !== undefined && countedSearchNow() >= wall);
604
607
  if (!made) {
605
608
  made = true;
606
609
  inc = useInc && !(opts.from && opts.from > 1) && !Object.keys(m.fns ?? {}).length && !Object.keys(m.step.flags ?? {}).length ? unrolled(m, laws) : undefined;
@@ -0,0 +1,25 @@
1
+ import { type Law, type Machine, type SomeWitness } from './machine.js';
2
+ import { proveSetFast } from '../kernel/prove.js';
3
+ import { type Ghosted } from '../kernel/kernel.js';
4
+ type Closure = ReturnType<typeof proveSetFast>;
5
+ type Drop = {
6
+ name: string;
7
+ goal: string;
8
+ stuck: 'sat';
9
+ };
10
+ export type SeedGhosts = Pick<Ghosted, 'vars' | 'maps'>;
11
+ export type SeedResult = {
12
+ status: 'checked';
13
+ laws: Law[];
14
+ kept: Law[];
15
+ dropped: Drop[];
16
+ closure: Closure;
17
+ projection?: 'skolem';
18
+ } | {
19
+ status: 'inconclusive';
20
+ kept: Law[];
21
+ dropped: Drop[];
22
+ reason: string;
23
+ };
24
+ export declare function proveCandidateSeeds(machine: Machine, publicLaws: Law[], candidates: Law[], witnesses?: Record<string, SomeWitness>, ghosts?: SeedGhosts): SeedResult;
25
+ export {};
@@ -0,0 +1,90 @@
1
+ // Retained laws, witness terms and ghost definitions are proposals, never facts.
2
+ import { walk } from "./machine.js";
3
+ import { decideLaw, proveLaw, proveSetFast } from "../kernel/prove.js";
4
+ import { checkGhostedLaws, ghostedMachine, ghostedOk, someOfGhostsOk, substC } from "../kernel/kernel.js";
5
+ import { retainFrom } from "./proof-output.js";
6
+ // The caller imposes the deadline. Only the complete checked family is evidence.
7
+ // In particular neither a witness nor a ghost definition is a caller assumption.
8
+ export function proveCandidateSeeds(machine, publicLaws, candidates, witnesses = {}, ghosts = { vars: {}, maps: {} }) {
9
+ const refuse = (reason) => ({ status: 'inconclusive', kept: [], dropped: [], reason });
10
+ if (Object.keys(machine.counts ?? {}).length)
11
+ return refuse('count-bearing machine requires counted candidate admission');
12
+ const names = new Set();
13
+ for (const law of [...publicLaws, ...candidates]) {
14
+ if (!law.name || names.has(law.name))
15
+ throw Error('candidate family requires unique law names');
16
+ names.add(law.name);
17
+ }
18
+ const someKey = (c, positive = true) => c.op === 'all' ? (!positive || someKey(c.c, positive)) : c.op === 'not' ? someKey(c.x, !positive) : c.op === 'and' || c.op === 'or' ? c.xs.some(x => someKey(x, positive)) : false;
19
+ const supported = new Set(['name', 'holds', 'forall', 'keys']);
20
+ const publicSupported = new Set([...supported, 'some', 'witness']);
21
+ if (candidates.some(l => Object.keys(l).some(k => !supported.has(k)) || someKey(l.holds)) ||
22
+ publicLaws.some(l => Object.keys(l).some(k => !publicSupported.has(k)) || someKey(l.holds)))
23
+ return refuse('existential family requires projection');
24
+ if (Object.keys(witnesses).some(name => !publicLaws.some(l => l.name === name && l.some?.length)))
25
+ return refuse('witness provided for unknown existential law');
26
+ const projecting = publicLaws.some(l => l.some?.length) || Object.keys(ghosts.vars).length > 0 || Object.keys(ghosts.maps).length > 0;
27
+ const G = { orig: machine, vars: ghosts.vars, maps: ghosts.maps };
28
+ const gv = new Set(Object.keys(G.vars)), gm = new Set(Object.keys(G.maps));
29
+ const reserved = new Set([...machine.params, ...machine.inputs, ...Object.keys(machine.state), ...Object.keys(machine.maps ?? {}),
30
+ ...(machine.inputMaps ?? []), ...Object.keys(machine.fns ?? {}), ...Object.keys(machine.step.flags ?? {})]);
31
+ if ([...gv, ...gm].some(n => reserved.has(n)) || [...gv].some(n => gm.has(n)))
32
+ return refuse('ghost name collision');
33
+ let publicReadsGhost = false;
34
+ for (const law of publicLaws)
35
+ walk(law.holds, o => {
36
+ if (o.op === 'var' && gv.has(o.name) || o.op === 'get' && gm.has(o.map) ||
37
+ o.op === 'flag' && gv.has(`?${o.name}`))
38
+ publicReadsGhost = true;
39
+ });
40
+ if (publicReadsGhost)
41
+ return refuse('public law reads a proposed ghost');
42
+ if (projecting && !ghostedOk(G))
43
+ return refuse('ghost definitions not qualified');
44
+ const plains = Object.create(null);
45
+ const plainPublic = [];
46
+ for (const law of publicLaws) {
47
+ if (!law.some?.length) {
48
+ plainPublic.push(law);
49
+ continue;
50
+ }
51
+ const w = witnesses[law.name];
52
+ const sub = w?.terms;
53
+ if (!sub || w.ghost || Object.keys(sub).length !== law.some.length || !law.some.every(n => Object.hasOwn(sub, n)))
54
+ return refuse(`complete witness terms required for ${law.name}`);
55
+ const plain = { name: law.name, holds: substC(law.holds, { vars: Object.assign(Object.create(null), sub), maps: {}, flags: {} }),
56
+ ...(law.forall ? { forall: law.forall } : {}), ...(law.keys ? { keys: law.keys } : {}) };
57
+ if (!someOfGhostsOk(G, law, plain, sub))
58
+ return refuse(`existential projection not qualified: ${law.name}`);
59
+ plains[law.name] = { plain, sub };
60
+ plainPublic.push(plain);
61
+ }
62
+ const working = projecting ? ghostedMachine(G) : machine;
63
+ let kept = [...candidates];
64
+ const dropped = [];
65
+ for (;;) {
66
+ const family = [...plainPublic, ...kept];
67
+ let removed = false;
68
+ for (let i = 0; i < kept.length; i++) {
69
+ const decision = decideLaw(working, family, plainPublic.length + i) ?? proveLaw(working, family, plainPublic.length + i);
70
+ if (!decision.proven) {
71
+ if (decision.stuck !== 'sat')
72
+ return { status: 'inconclusive', kept, dropped, reason: `undecided candidate: ${kept[i].name}: ${decision.stuck}${'why' in decision && decision.why ? `: ${decision.why}` : ''}` };
73
+ dropped.push({ name: kept[i].name, goal: decision.goal, stuck: 'sat' });
74
+ kept = kept.filter((_, j) => j !== i);
75
+ removed = true;
76
+ break;
77
+ }
78
+ }
79
+ if (!removed)
80
+ break;
81
+ }
82
+ const family = [...plainPublic, ...kept];
83
+ const whole = proveSetFast(working, family);
84
+ if (!whole.proven || !whole.checked || !whole.proof)
85
+ return { status: 'inconclusive', kept, dropped, reason: whole.failed?.goal ?? 'whole-family proof not checked' };
86
+ if (projecting && !checkGhostedLaws(G, family, whole.proof))
87
+ return { status: 'inconclusive', kept, dropped, reason: 'ghosted whole-family proof not checked' };
88
+ const closure = projecting ? retainFrom({ ...whole }, [whole], { kind: 'skolem', original: machine, laws: publicLaws, G, plains, family }) : whole;
89
+ return { status: 'checked', laws: [...publicLaws, ...kept], kept, dropped, closure, ...(projecting ? { projection: 'skolem' } : {}) };
90
+ }
@@ -1,8 +1,10 @@
1
- const vars = (lin) => Object.keys(lin).filter(key => key !== '1');
2
- const exact = (lin) => Object.values(lin).every(c => Number.isSafeInteger(c));
1
+ import { observeCheckStep, observeTableCells } from "./meter.js";
2
+ const vars = (lin) => Object.keys(lin).filter(key => (observeTableCells(), key !== '1'));
3
+ const exact = (lin) => Object.values(lin).every(c => (observeTableCells(), Number.isSafeInteger(c)));
3
4
  export function checkRefutation(constraints, steps, integral = true) {
4
5
  const rows = [], strict = [];
5
6
  for (const [i, s] of steps.entries()) {
7
+ observeCheckStep();
6
8
  if (s.kind === 'input') {
7
9
  if (!(Number.isInteger(s.index) && s.index >= 0 && s.index < constraints.length))
8
10
  return false;
@@ -22,6 +24,7 @@ export function checkRefutation(constraints, steps, integral = true) {
22
24
  // Each product safe too: a rounded one is past 2^53, but the other row's could bring the sum back under it.
23
25
  for (const [lin, m] of [[rows[s.a], s.ma], [rows[s.b], s.mb]])
24
26
  for (const [key, c] of Object.entries(lin)) {
27
+ observeTableCells();
25
28
  if (!Number.isSafeInteger(m * c))
26
29
  return false;
27
30
  out[key] = (out[key] ?? 0) + m * c;
@@ -47,8 +50,10 @@ export function checkRefutation(constraints, steps, integral = true) {
47
50
  }
48
51
  export function checkWitness(constraints, witness) {
49
52
  return constraints.every(c => {
53
+ observeCheckStep();
50
54
  let sum = 0;
51
55
  for (const [key, a] of Object.entries(c.lin)) {
56
+ observeTableCells();
52
57
  const value = key === '1' ? 1 : Object.hasOwn(witness, key) ? witness[key] : undefined, term = a * value;
53
58
  if (!(Number.isSafeInteger(a) && Number.isSafeInteger(value) && Number.isSafeInteger(term) && Number.isSafeInteger(sum + term)))
54
59
  return false;
package/dist/core/cli.js CHANGED
@@ -1102,6 +1102,7 @@ function printRule(r, o) {
1102
1102
  }
1103
1103
  const label = (n) => (n.role === 'answer' ? `${n.code.split('.').pop()}(...)` : n.role === 'input' && n.method ? `${n.method}(${n.code})` : n.role === 'result' && n.method ? `${n.method}() result` : n.code);
1104
1104
  const USAGE = `gdp-wired check <file|dir>... [--entry X] [--mode standalone] [--methods a,b] [--failures kept] [--on-error discard] [--json] [--ms 10000] [--no-propose] [--clock s|ms] [--cert <dir>] [--from any] [--require-review] [--security]
1105
+ gdp-wired lift <capsule> <source.json> [--out DIR] [--emit-only] [--sha256 HASH] [--json]
1105
1106
  gdp-wired mutate <config.json> [--json]
1106
1107
  gdp-wired draft <file> --clause <text> | --clause-file <file> --cite <ref> [--llm <command> | --answer <file>] [--by <who>]
1107
1108
 
@@ -1178,6 +1179,8 @@ async function draft(target, o) {
1178
1179
  // Every target's rules and their laws, and the exit code (1: a stated law broken; 2: one not checked, or with
1179
1180
  // --require-review, one cited unreviewed).
1180
1181
  export async function main(argv) {
1182
+ if (argv[0] === 'lift')
1183
+ return (await import("./lift-cli.js")).liftMain(argv.slice(1));
1181
1184
  const { cmd, targets, o } = args(argv);
1182
1185
  if (cmd === 'mutate' && targets.length === 1) {
1183
1186
  const { checkMutations } = await import("./mutate.js");
@@ -0,0 +1,29 @@
1
+ import { type LiftedWorkTraceEvent } from './count-lifted-budget.js';
2
+ import { type CountRetryKey, type CountSlice } from './count-retry-budget.js';
3
+ import { type WorkLedger } from './work-admission.js';
4
+ import { type WorkAmount } from './work-amount.js';
5
+ export declare const countLeafSlot = "leaf";
6
+ type Slot = {
7
+ key: string;
8
+ allocation: WorkAmount;
9
+ used: WorkAmount;
10
+ completed: number;
11
+ stopped: number;
12
+ };
13
+ export declare class CountAttemptWork {
14
+ private bank;
15
+ readonly slices: CountSlice[];
16
+ private slots;
17
+ private active;
18
+ private failed;
19
+ private invalid;
20
+ private tick;
21
+ constructor(keys: readonly CountRetryKey[], bank?: WorkLedger);
22
+ trace: (event: LiftedWorkTraceEvent) => void;
23
+ keys(): readonly CountRetryKey[];
24
+ inventory(): readonly Readonly<Slot & {
25
+ unseen: boolean;
26
+ }>[];
27
+ valid(): boolean;
28
+ }
29
+ export {};
@@ -0,0 +1,96 @@
1
+ import { workLedger } from "./work-admission.js";
2
+ import { compareWork, workAdd, zeroWork } from "./work-amount.js";
3
+ export const countLeafSlot = 'leaf';
4
+ export class CountAttemptWork {
5
+ bank;
6
+ slices = [];
7
+ slots = new Map();
8
+ active = new Map();
9
+ failed;
10
+ invalid = false;
11
+ tick(site) { this.bank.start('ticks', 1, 'count attempt ' + site); }
12
+ constructor(keys, bank = workLedger) {
13
+ this.bank = bank;
14
+ this.tick('inventory header');
15
+ if (!keys.length || keys.length > 64)
16
+ throw new RangeError('unbounded count attempt keys');
17
+ for (const key of keys) {
18
+ this.tick('inventory key');
19
+ if (!key.key || key.key.length > 256 || this.slots.has(key.key) || key.allocation.num <= 0n || key.allocation.den <= 0n)
20
+ throw new RangeError('invalid count attempt key');
21
+ this.slots.set(key.key, { ...key, used: zeroWork, completed: 0, stopped: 0 });
22
+ }
23
+ }
24
+ trace = (event) => {
25
+ this.tick('slice event');
26
+ const slice = event.slice, key = slice.kind === 'leaf' ? countLeafSlot : slice.key, slot = this.slots.get(key);
27
+ if (!slot || compareWork(slot.allocation, slice.allocation) !== 0) {
28
+ this.invalid = true;
29
+ this.slices.length = 0;
30
+ return;
31
+ }
32
+ if (event.stage === 'start') {
33
+ if (this.active.has(slice.scopeId) || this.active.size >= 64) {
34
+ this.invalid = true;
35
+ this.slices.length = 0;
36
+ return;
37
+ }
38
+ let parent;
39
+ for (const active of this.active.values()) {
40
+ this.tick('slice parent');
41
+ if (active.kind === 'case')
42
+ parent = active;
43
+ }
44
+ if (slice.kind === 'leaf' && slice.caseKey !== undefined && parent?.key !== slice.caseKey) {
45
+ this.invalid = true;
46
+ this.slices.length = 0;
47
+ return;
48
+ }
49
+ this.active.set(slice.scopeId, { ...slice, key, physicalKey: slice.key, caseKey: parent?.key, renewable: slice.kind === 'case' || !!parent });
50
+ }
51
+ else {
52
+ const active = this.active.get(slice.scopeId);
53
+ if (!this.active.delete(slice.scopeId) || event.used.num < 0n) {
54
+ this.invalid = true;
55
+ this.slices.length = 0;
56
+ return;
57
+ }
58
+ slot.used = workAdd(slot.used, event.used);
59
+ if (event.completed)
60
+ slot.completed++;
61
+ else {
62
+ slot.stopped++;
63
+ const refusal = this.bank.capacityRefusal(event.error);
64
+ if (active?.renewable && refusal?.limiting.length === 1 && refusal.limiting[0].id === slice.scopeId)
65
+ this.failed = active;
66
+ }
67
+ }
68
+ this.slices.length = 0;
69
+ if (this.invalid)
70
+ return;
71
+ for (const active of this.active.values()) {
72
+ this.tick('active slice');
73
+ if (active.renewable)
74
+ this.slices.push(active);
75
+ }
76
+ if (this.failed && !this.active.has(this.failed.scopeId))
77
+ this.slices.push(this.failed);
78
+ };
79
+ keys() {
80
+ const out = [];
81
+ for (const { key, allocation, used } of this.slots.values()) {
82
+ this.tick('key snapshot');
83
+ out.push({ key, allocation, used });
84
+ }
85
+ return out;
86
+ }
87
+ inventory() {
88
+ const out = [];
89
+ for (const slot of this.slots.values()) {
90
+ this.tick('inventory snapshot');
91
+ out.push({ ...slot, unseen: slot.completed + slot.stopped === 0 });
92
+ }
93
+ return out;
94
+ }
95
+ valid() { return !this.invalid; }
96
+ }
@@ -0,0 +1,5 @@
1
+ import { type C } from './machine.js';
2
+ import { type Count, type LinCut } from '../kernel/kernel.js';
3
+ export declare function proveBooleanPartitionCut(counts: Count[], when: C[], terms: [number, string][], until: number, observe?: (event: Record<string, unknown>) => void): {
4
+ cut: LinCut;
5
+ } | undefined;
@@ -0,0 +1,47 @@
1
+ // Untrusted R1 proposer: split the Boolean indicator atoms, not the action's
2
+ // expanded control flow. The ordinary linOk checker accepts or rejects the cut.
3
+ import { less, n, plus, times, x } from "./machine.js";
4
+ import { linOk } from "../kernel/kernel.js";
5
+ import { fullRate, fullWork, late, rowsAt } from "../kernel/prove.js";
6
+ import { solve } from "./solver.js";
7
+ import { countGuardTree } from "./count-guard-tree.js";
8
+ import { traceNow } from "./trace-clock.js";
9
+ export function proveBooleanPartitionCut(counts, when, terms, until, observe) {
10
+ const start = fullWork(), wall = observe ? traceNow() : 0, used = terms.map(([, id]) => counts.find(count => count.v === id));
11
+ if (used.some(count => !count))
12
+ return;
13
+ const first = used[0];
14
+ if (!first || used.some(count => count.key !== first.key || JSON.stringify(count.below) !== JSON.stringify(first.below)))
15
+ return;
16
+ const pos = terms.filter(([k]) => k > 0), neg = terms.filter(([k]) => k < 0).map(([k, id]) => [-k, id]);
17
+ const term = (side) => side.reduce((sum, [k, id]) => plus(sum, times(k, counts.find(count => count.v === id).body)), n(0));
18
+ const goal = { name: 'Boolean partition definition', hyps: [...when, less(x(first.key), first.below), less(term(neg), term(pos))] }, atoms = new Map();
19
+ const visit = (c) => { if (c.op === 'not')
20
+ visit(c.x);
21
+ else if (c.op === 'and' || c.op === 'or')
22
+ c.xs.forEach(visit);
23
+ else
24
+ atoms.set(JSON.stringify(c), c); };
25
+ for (const count of used) {
26
+ const body = count.body;
27
+ if (body.op !== 'if' || body.then.op !== 'const' || body.then.value !== 1 || body.else.op !== 'const' || body.else.value !== 0)
28
+ return;
29
+ visit(body.c);
30
+ }
31
+ if (atoms.size > 8)
32
+ return;
33
+ let leaves = 0;
34
+ const split = countGuardTree(until), list = [...atoms.values()];
35
+ const build = (at, path) => {
36
+ if (late(until))
37
+ return;
38
+ if (at < list.length)
39
+ return split.condition(list[at], path, p => build(at + 1, p), p => build(at + 1, p));
40
+ leaves++;
41
+ const result = solve(rowsAt(goal, path), 500);
42
+ return result.kind === 'refuted' ? { leaf: result.steps } : undefined;
43
+ };
44
+ const tree = build(0, new Map()), cut = tree ? { when, pos, neg, tree } : undefined, checked = !!cut && linOk(counts, cut);
45
+ observe?.({ stage: 'boolean-partition-cut', checked, atoms: atoms.size, leaves, units: (fullWork() - start) / fullRate, wallMs: traceNow() - wall, ...(!checked ? { refusedCut: { kind: 'linear', when, terms, counts: used } } : {}) });
46
+ return checked && !late(until) ? { cut: cut } : undefined;
47
+ }
@@ -0,0 +1,2 @@
1
+ import { type E } from './machine.js';
2
+ export declare function boundedQuotient(value: E, divisor: number, upper: number): E;
@@ -0,0 +1,13 @@
1
+ // An ordinary finite E term, not a division axiom or a new kernel rule.
2
+ import { n } from "./machine.js";
3
+ export function boundedQuotient(value, divisor, upper) {
4
+ if (!Number.isSafeInteger(divisor) || divisor < 1 || !Number.isSafeInteger(upper) || upper < 0 || upper > 4096)
5
+ throw Error('invalid quotient range');
6
+ const build = (lo, hi) => {
7
+ if (lo === hi)
8
+ return n(lo);
9
+ const mid = Math.floor((lo + hi + 1) / 2);
10
+ return { op: 'if', c: { op: '<', a: value, b: n(divisor * mid) }, then: build(lo, mid - 1), else: build(mid, hi) };
11
+ };
12
+ return build(0, Math.floor(upper / divisor));
13
+ }
@@ -0,0 +1,20 @@
1
+ import { type Law } from './machine.js';
2
+ import { type FamilyStepProposal } from './count-final-step.js';
3
+ import { type GuardCountContext } from './count-guard-context.js';
4
+ import { type CountRequestBuilder, type CountStrategyProof } from './count-strategy.js';
5
+ import { type CountStageObserver } from './count-stage-trace.js';
6
+ import { type CountCert } from '../kernel/kernel.js';
7
+ export type FixedOperationProof = {
8
+ value: number;
9
+ proof: CountStrategyProof;
10
+ };
11
+ export declare function composeCountOperationProofs(context: GuardCountContext, family: Law[], law: Law, cases: FixedOperationProof[], until: number, requestFor: CountRequestBuilder, observe?: (stage: string, value?: number) => void, options?: {
12
+ propagateBudgetExpiry?: boolean;
13
+ familyProposal?: FamilyStepProposal;
14
+ reindexMode?: 'offset' | 'exact';
15
+ initial?: CountCert;
16
+ trace?: CountStageObserver;
17
+ minimize?: boolean;
18
+ slicedLemmas?: boolean;
19
+ reindexFactsOnly?: boolean;
20
+ }): CountStrategyProof | undefined;