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
@@ -26,4 +26,5 @@ export declare const rowReuseStorage: () => {
26
26
  rowEntries: number;
27
27
  constraints: number;
28
28
  };
29
+ export declare function proverRowsReusingFacts(goal: Goal, path: Path): Constraint[];
29
30
  export declare function proverRows(goal: Goal, path: Path): Constraint[];
@@ -1,5 +1,9 @@
1
1
  import { env } from "../core/solver.js";
2
2
  import { canon, leafConstraintsReusing } from "./kernel.js";
3
+ import { budgetedLeafRows } from "../core/prover-row-budget.js";
4
+ import { completeWorkProfile } from "../core/work-profile.js";
5
+ import { inBudget } from "./prove.js";
6
+ import { withTableAdmission } from "../core/table-admission.js";
3
7
  const originals = new WeakMap(), ids = new WeakMap();
4
8
  const nodes = new Map();
5
9
  let serial = 0, keyChars = 0;
@@ -97,6 +101,13 @@ export class ProverRowsCache {
97
101
  }
98
102
  const rows = new ProverRowsCache(env.GDP_ROWS_UNWEIGHTED === '1' ? Infinity : 250000);
99
103
  export const rowReuseStorage = () => ({ nodes: nodes.size, keyChars, goals: goalPool.size, rowEntries: rows.size, constraints: rows.weight });
104
+ // One-pass reindex keeps interned hypotheses and per-hypothesis facts without
105
+ // retaining complete tables. Preserve the existing full-work row admission.
106
+ export function proverRowsReusingFacts(goal, path) {
107
+ rowReuseStats.rowsBuilt++;
108
+ const build = () => { const shared = env.GDP_ROWS_SHARED === '0' ? goal : sharedGoal(goal); return completeWorkProfile.enabled && inBudget() ? budgetedLeafRows(shared, path) : leafConstraintsReusing(shared, path); };
109
+ return completeWorkProfile.enabled && inBudget() ? withTableAdmission(build) : build();
110
+ }
100
111
  export function proverRows(goal, path) {
101
112
  const shared = sharedGoal(goal);
102
113
  // Path ordering matters for input-row indices. Include the actual atom as
@@ -108,7 +119,7 @@ export function proverRows(goal, path) {
108
119
  return out;
109
120
  }
110
121
  rowReuseStats.rowsBuilt++;
111
- out = leafConstraintsReusing(shared, path);
122
+ out = completeWorkProfile.enabled && inBudget() ? budgetedLeafRows(shared, path) : leafConstraintsReusing(shared, path);
112
123
  rowReuseStats.rowsEvicted += rows.set(key, out);
113
124
  return out;
114
125
  }
@@ -111,7 +111,7 @@ export declare class Reader {
111
111
  private trailRows;
112
112
  private trailStamps;
113
113
  private pairs;
114
- leafRows(src?: (number | [string, string])[]): Row[];
114
+ leafRows(src?: (number | [string, string])[], beforeRow?: (count: number) => void): Row[];
115
115
  live: Row[];
116
116
  entered: number[];
117
117
  left: number[];
@@ -1,5 +1,10 @@
1
+ import { completeWorkProfile } from "../core/work-profile.js";
2
+ import { checkWorkEndpoint } from "./prove.js";
3
+ import { startWork } from "../core/work-admission.js";
1
4
  import { shareTerms } from "./share.js";
2
- import { add, costs, env, k, scale, sub, v } from "../core/solver.js";
5
+ import { costs, env } from "../core/solver.js";
6
+ import { fundedAdd as add, fundedConstant as k, fundedScale as scale, fundedSub as sub, fundedVariable as v, admittedLinearProduct, everyLinearCell } from "../core/linear-admission.js";
7
+ import { workConcat, workStrings, workJoin } from "../core/work-collections.js";
3
8
  import { atomOf, canon, canonFlip, cellParts, plainMap, columnTerm, factorsOf, isCell, termColumn, tupleAnd } from "./kernel.js";
4
9
  export const none = new Set();
5
10
  export const join = (a, b) => {
@@ -27,6 +32,13 @@ const unfin = (r) => (r.fin ? { w: r.w, pos: r.pos, fin: false } : r);
27
32
  const both = (a, b) => ({ w: join(a.w, b.w), pos: Math.max(a.pos, b.pos), fin: a.fin && b.fin });
28
33
  // The kernel's product of two linear forms (kernel.ts's `times`): each monomial its factors sorted, joined by '*'.
29
34
  export function times(a, b) {
35
+ if (completeWorkProfile.enabled)
36
+ return admittedLinearProduct(a, b, (p, q) => {
37
+ if (p.includes('⟦') || q.includes('⟦'))
38
+ return undefined;
39
+ const fs = workStrings(workConcat(p === '1' ? [] : factorsOf(p), q === '1' ? [] : factorsOf(q), 'reader product:factors'), 'reader product:sort');
40
+ return fs.length ? workJoin(fs, '*', 'reader product:join') : '1';
41
+ }, 'reader product', false);
30
42
  const out = [];
31
43
  for (const [p, cp] of Object.entries(a))
32
44
  for (const [q, cq] of Object.entries(b)) {
@@ -39,7 +51,7 @@ export function times(a, b) {
39
51
  }
40
52
  const one = k(1);
41
53
  const namePair = new WeakMap();
42
- const constantLin = (l) => Object.entries(l).every(([key, c]) => key === '1' || c === 0);
54
+ const constantLin = (l) => everyLinearCell(l, (key, c) => key === '1' || c === 0, 'reader constant branch');
43
55
  const lasts = Array.from({ length: 8 }, () => new WeakMap());
44
56
  function same(site, owner, a, b, c, make) {
45
57
  const m = lasts[site], had = m.get(owner);
@@ -113,8 +125,11 @@ export class Reader {
113
125
  s.set(f.key, f);
114
126
  }
115
127
  within(key, f) {
128
+ if (completeWorkProfile.enabled)
129
+ startWork('values', 1, 'reader value');
116
130
  const was = this.finding, now = { key };
117
- costs.values++;
131
+ if (!completeWorkProfile.enabled)
132
+ costs.values++;
118
133
  this.found.set(key, now);
119
134
  this.finding = now;
120
135
  try {
@@ -130,8 +145,11 @@ export class Reader {
130
145
  const todo = [], seen = new Set(), found = this.found;
131
146
  const walk = (edges) => {
132
147
  if (edges) {
133
- costs.edges += edges.size;
148
+ if (!completeWorkProfile.enabled)
149
+ costs.edges += edges.size;
134
150
  for (const [k, f] of edges) {
151
+ if (completeWorkProfile.enabled)
152
+ startWork('edges', 1, 'reader dependency');
135
153
  if (found.get(k) === f)
136
154
  todo.push(k);
137
155
  else
@@ -165,6 +183,8 @@ export class Reader {
165
183
  this.units.set(name, (w = new Set([name]))); return w; }
166
184
  // Whether lin <= 0 is decided, and by what.
167
185
  dec(lin) {
186
+ if (completeWorkProfile.enabled)
187
+ checkWorkEndpoint('reader decision');
168
188
  let constant = true;
169
189
  for (const key in lin)
170
190
  if (key !== '1') {
@@ -188,6 +208,8 @@ export class Reader {
188
208
  return { t: undefined, w: none, pos: -1, fin: false };
189
209
  }
190
210
  linear(e) {
211
+ if (completeWorkProfile.enabled)
212
+ checkWorkEndpoint('reader expression');
191
213
  e = this.share(e);
192
214
  this.read(e);
193
215
  const had = this.ls.get(e);
@@ -334,6 +356,8 @@ export class Reader {
334
356
  return { when: atoms.when, unless: atoms.unless, r };
335
357
  }
336
358
  truth(c) {
359
+ if (completeWorkProfile.enabled)
360
+ checkWorkEndpoint('reader condition');
337
361
  c = this.share(c);
338
362
  this.read(c);
339
363
  const had = this.ts.get(c);
@@ -423,6 +447,8 @@ export class Reader {
423
447
  }
424
448
  // kernel.ts's facts, each row with its reason; final when nothing it read is open.
425
449
  factsOf(c, positive, out) {
450
+ if (completeWorkProfile.enabled)
451
+ checkWorkEndpoint('reader fact');
426
452
  switch (c.op) {
427
453
  case 'flag': throw new Error('flags are inlined before the kernel sees them');
428
454
  case 'all': return R0;
@@ -637,6 +663,8 @@ export class Reader {
637
663
  termSeen = [];
638
664
  gen = 0;
639
665
  form(lin) {
666
+ if (completeWorkProfile.enabled)
667
+ checkWorkEndpoint('reader form');
640
668
  let f = this.forms.get(lin);
641
669
  if (f)
642
670
  return f;
@@ -673,11 +701,12 @@ export class Reader {
673
701
  pairs = new Map();
674
702
  // The rows in kernel.ts's order, copies kept (a leaf's derivation indexes these).
675
703
  // With `src`, each row's source beside it: the hypothesis whose facts it is, the pair of cells it equates, else -1.
676
- leafRows(src) {
704
+ leafRows(src, beforeRow) {
677
705
  const rows = [];
678
706
  for (let i = 0; i < this.trail.size(); i++) {
679
707
  if (this.trail.quiet?.(i))
680
708
  continue;
709
+ beforeRow?.(1);
681
710
  const s = this.trail.stamp(i);
682
711
  let r = this.trailStamps[i] === s ? this.trailRows[i] : undefined;
683
712
  if (!r) {
@@ -693,6 +722,7 @@ export class Reader {
693
722
  }
694
723
  for (let i = 0; i < this.goal.hyps.length; i++)
695
724
  for (const r of this.facts(i).rows) {
725
+ beforeRow?.(1);
696
726
  rows.push(r);
697
727
  src?.push(i);
698
728
  }
@@ -711,8 +741,12 @@ export class Reader {
711
741
  continue;
712
742
  const f = this.pair(p, q), w = this.equal(f);
713
743
  if (w) {
714
- rows.push({ lin: f.pq, w, label: '' }, { lin: f.qp, w, label: '' });
715
- src?.push([p.name, q.name], [p.name, q.name]);
744
+ beforeRow?.(1);
745
+ rows.push({ lin: f.pq, w, label: '' });
746
+ src?.push([p.name, q.name]);
747
+ beforeRow?.(1);
748
+ rows.push({ lin: f.qp, w, label: '' });
749
+ src?.push([p.name, q.name]);
716
750
  }
717
751
  }
718
752
  const done = this.termSeen, todo = names.filter(j => kind[j] === 1);
@@ -722,6 +756,7 @@ export class Reader {
722
756
  continue;
723
757
  done[j] = g;
724
758
  for (const r of this.termRows(this.nameText[j])) {
759
+ beforeRow?.(1);
725
760
  rows.push(r);
726
761
  src?.push(-1);
727
762
  for (const n of this.form(r.lin).names) {
@@ -735,10 +770,11 @@ export class Reader {
735
770
  }
736
771
  }
737
772
  for (const j of names) {
773
+ beforeRow?.(1);
738
774
  const name = this.nameText[j];
739
775
  let r = this.natRows.get(name);
740
776
  if (!r)
741
- this.natRows.set(name, (r = { lin: { [name]: -1 }, w: none, label: '' }));
777
+ this.natRows.set(name, (r = { lin: completeWorkProfile.enabled ? scale(v(name), -1) : { [name]: -1 }, w: none, label: '' }));
742
778
  rows.push(r);
743
779
  src?.push(-1);
744
780
  }
@@ -792,6 +828,8 @@ export class Reader {
792
828
  cellsChanged = 0;
793
829
  // (`from`: the trail's first position that may have changed since the last sync, where the caller knows it)
794
830
  sync(from = 0) {
831
+ if (completeWorkProfile.enabled)
832
+ checkWorkEndpoint('reader sync');
795
833
  this.syncing = true;
796
834
  this.syncN++;
797
835
  this.changed = [];
@@ -914,8 +952,12 @@ export class Reader {
914
952
  // A copy of a row in (kind 1: from the trail or the facts, 2: a column's term rows, its own name not counted; 0: a
915
953
  // natural's or a pair of cells', whose names it doesn't count).
916
954
  addCopy(r, kind, self = -1) {
917
- const f = this.form(r.lin), id = f.id, cs = (this.copies[id] ??= []);
918
- costs.copies++;
955
+ const f = this.form(r.lin), id = f.id;
956
+ if (completeWorkProfile.enabled)
957
+ startWork('copies', 1, 'reader add copy');
958
+ const cs = (this.copies[id] ??= []);
959
+ if (!completeWorkProfile.enabled)
960
+ costs.copies++;
919
961
  if (!cs.length) {
920
962
  this.mark(id, false);
921
963
  this.slot[id] = this.live.length;
@@ -934,7 +976,10 @@ export class Reader {
934
976
  }
935
977
  removeCopy(r, kind, self = -1) {
936
978
  const f = this.form(r.lin), id = f.id, cs = this.copies[id];
937
- costs.copies++;
979
+ if (completeWorkProfile.enabled)
980
+ startWork('copies', 1, 'reader remove copy');
981
+ else
982
+ costs.copies++;
938
983
  cs.splice(cs.indexOf(r), 1);
939
984
  const at = this.slot[id];
940
985
  if (!cs.length) {
@@ -983,7 +1028,7 @@ export class Reader {
983
1028
  const name = this.nameText[j];
984
1029
  let r = this.natRows.get(name);
985
1030
  if (!r)
986
- this.natRows.set(name, (r = { lin: { [name]: -1 }, w: none, label: '' }));
1031
+ this.natRows.set(name, (r = { lin: completeWorkProfile.enabled ? scale(v(name), -1) : { [name]: -1 }, w: none, label: '' }));
987
1032
  this.inNat[j] = r;
988
1033
  this.addCopy(r, 0);
989
1034
  if (this.nameKind[j] === 2) {
@@ -11,6 +11,8 @@
11
11
  // false) nothing is rounded, and a strict row's bound is moved in by a hair (1e-7, relative): the floats only pick a
12
12
  // conflict's rows, which the exact elimination then refutes, strictness and all, or doesn't.
13
13
  import { costs, gcd } from "../core/solver.js";
14
+ import { completeWorkProfile } from "../core/work-profile.js";
15
+ import { startWork } from "../core/work-admission.js";
14
16
  const eps = 1e-9;
15
17
  // A bound's tolerance: relative past 1 (values drift by a few ulps a pivot).
16
18
  const tol = (b) => 1e-7 * Math.max(1, Math.abs(b));
@@ -407,8 +409,13 @@ export class Simplex {
407
409
  for (const j of ecoef.keys())
408
410
  this.colOf[j].add(r);
409
411
  // Every other row reading x_e: substitute.
410
- costs.pivotRows += this.colOf[e].size;
411
- for (const q of [...this.colOf[e]]) {
412
+ if (!completeWorkProfile.enabled)
413
+ costs.pivotRows += this.colOf[e].size;
414
+ // ecoef excludes e: this traversal only deletes its current member from
415
+ // colOf[e], never inserts a new one. OFF retains its original snapshot.
416
+ for (const q of completeWorkProfile.enabled ? this.colOf[e] : [...this.colOf[e]]) {
417
+ if (completeWorkProfile.enabled)
418
+ startWork('pivotRows', 1, 'simplex pivot substitution');
412
419
  if (q === r)
413
420
  continue;
414
421
  const other = this.rows[q], c = other.coef.get(e), before = other.coef.size;
@@ -0,0 +1,11 @@
1
+ export declare const standard: string[];
2
+ export declare function asked(source: string): string[];
3
+ export declare function answers(out: string): {
4
+ name: string;
5
+ axioms: string[];
6
+ }[];
7
+ export declare function gate(out: string, sources: string[], native?: boolean): string[];
8
+ export declare function auditLiftLog(out: string, sources: string[], required: string[], expectedAxioms?: Record<string, string[]>): {
9
+ name: string;
10
+ axioms: string[];
11
+ }[];
@@ -0,0 +1,50 @@
1
+ // Pure audit of native Lean output. This is not a proof checker or a substitute
2
+ // for executing Lean; callers must bind the log to the exact generated sources.
3
+ export const standard = ['propext', 'Classical.choice', 'Quot.sound'];
4
+ const nativeAxiom = (a) => a === 'Lean.ofReduceBool' || a === 'Lean.trustCompiler' || /native_decide\.ax_/.test(a);
5
+ export function asked(source) {
6
+ const code = source.replace(/\/-[\s\S]*?-\//g, '').replace(/--.*$/gm, '');
7
+ return [...code.matchAll(/^#print axioms\s+(\S+)/gm)].map(m => m[1]);
8
+ }
9
+ export function answers(out) {
10
+ const deps = [...out.matchAll(/^'([^\r\n]+)' depends on axioms: \[([^\]]*)\]\r?$/gm)].map(m => ({ name: m[1], axioms: m[2].split(',').map(a => a.trim()).filter(Boolean) }));
11
+ const none = [...out.matchAll(/^'([^\r\n]+)' does not depend on any axioms\r?$/gm)].map(m => ({ name: m[1], axioms: [] }));
12
+ return [...deps, ...none];
13
+ }
14
+ export function gate(out, sources, native = false) {
15
+ const why = [];
16
+ if (/declaration uses 'sorry'/.test(out))
17
+ why.push("a declaration uses 'sorry'");
18
+ for (const a of answers(out)) {
19
+ const extra = a.axioms.filter(x => !standard.includes(x) && !(native && nativeAxiom(x)));
20
+ if (extra.length)
21
+ why.push(`${a.name} depends on ${extra.join(', ')}`);
22
+ }
23
+ const want = sources.flatMap(asked).length, got = answers(out).length;
24
+ if (got < want)
25
+ why.push(`${want} #print axioms asked, ${got} answered`);
26
+ return why;
27
+ }
28
+ export function auditLiftLog(out, sources, required, expectedAxioms) {
29
+ if (!required.length || required.some(n => !/^[A-Za-z_][A-Za-z0-9_.']*$/.test(n)) || new Set(required).size !== required.length)
30
+ throw Error('invalid or empty source theorem coverage');
31
+ const errors = gate(out, sources, false);
32
+ if (/\berror:/.test(out))
33
+ errors.push('Lean reported an error');
34
+ const rows = answers(out), names = [...new Set([...sources.flatMap(asked), ...required])];
35
+ for (const name of names) {
36
+ const found = rows.filter(r => r.name === name);
37
+ if (found.length !== 1)
38
+ errors.push(`expected one axiom answer for ${name}, got ${found.length}`);
39
+ const expected = expectedAxioms?.[name];
40
+ if (expected && found.length === 1 && JSON.stringify([...expected].sort()) !== JSON.stringify([...found[0].axioms].sort()))
41
+ errors.push(`axiom set changed for ${name}`);
42
+ }
43
+ if (expectedAxioms)
44
+ for (const name of Object.keys(expectedAxioms))
45
+ if (!names.includes(name))
46
+ errors.push(`baseline theorem missing: ${name}`);
47
+ if (errors.length)
48
+ throw Error(errors.join('; '));
49
+ return rows.filter(r => names.includes(r.name));
50
+ }
@@ -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 CountCert, type CountedGoal, type CountInst, type LemmaCut, 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';
3
+ import { type CountCert, type CountDecl, type CountedGoal, type CountInst, type FrameCut, type MonoCut, type LinCut, type LemmaCut, 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';
@@ -20,6 +20,9 @@ export declare function leaves(t: Tree, path: Path, visit: (t: Tree & {
20
20
  export declare function encode(ex: Exported, tamper?: boolean, dropStep?: boolean, globalVars?: string[], globalMaps?: string[], slim?: boolean, reach?: boolean, context?: {
21
21
  path?: Path;
22
22
  lemmas?: LemmaCut[];
23
+ frames?: FrameCut[];
24
+ monos?: MonoCut[];
25
+ lins?: LinCut[];
23
26
  cols?: string[];
24
27
  }): {
25
28
  tab: string;
@@ -35,6 +38,9 @@ export declare function goalToLean(ex: Exported, i: number, tamper?: boolean, dr
35
38
  export declare function encodeCounted(id: string, goal: Goal, cert: {
36
39
  tree: Tree;
37
40
  lemmas?: LemmaCut[];
41
+ frames?: FrameCut[];
42
+ monos?: MonoCut[];
43
+ lins?: LinCut[];
38
44
  }, vars: string[], maps: string[]): {
39
45
  lemmas: string;
40
46
  lemmaList: (entries: LemmaCut[]) => string;
@@ -47,6 +53,7 @@ export declare function encodeCounted(id: string, goal: Goal, cert: {
47
53
  e: (t: E) => string;
48
54
  row: (lin: Lin) => string;
49
55
  };
56
+ export declare function mcToLean(id: string, hyps: C[], decls: CountDecl[], cert: CountCert): string;
50
57
  export declare function countedToLean(id: string, g: CountedGoal, cert: {
51
58
  insts: CountInst[];
52
59
  tree: Tree;
@@ -61,7 +68,19 @@ export declare function cmachineToLean(id: string, m: Machine, laws: Law[], proo
61
68
  }, tampers?: {
62
69
  what: string;
63
70
  certs: Record<string, CountCert>;
64
- }[]): string;
71
+ }[], options?: {
72
+ extraVars?: string[];
73
+ extraMaps?: string[];
74
+ after?: (basis: {
75
+ vars: readonly string[];
76
+ maps: readonly string[];
77
+ ix: (name: string) => number;
78
+ mx: (name: string) => number;
79
+ machine: (m: Machine) => string;
80
+ condition: (c: C) => string;
81
+ decls: (counts: Machine['counts']) => string;
82
+ }) => string;
83
+ }): string;
65
84
  export declare function machineToLean(id: string, m: Machine, laws: Law[], corollary?: string): string;
66
85
  export declare const TRUE = ".le (.const 0) (.const 0)";
67
86
  export declare const grown: (g: Goal) => Tree;
@@ -95,6 +114,8 @@ export declare function readable(id: string, laws: Law[], vars: string[], maps:
95
114
  have?: (j: number) => string;
96
115
  lit?: (c: C) => string;
97
116
  eLit?: (e: E) => string;
117
+ ghosts?: boolean;
118
+ explicitExistentials?: ReadonlySet<string>;
98
119
  }): string;
99
120
  export type ProgressCase = {
100
121
  id: string;
@@ -148,7 +169,7 @@ export declare function smachineToLean(id: string, given: Machine, laws: Law[],
148
169
  simp?: string[];
149
170
  free?: string[];
150
171
  ghosts?: string[];
151
- after?: (ix: (name: string) => number, mx: (name: string) => number, lit: (m: Machine) => string) => string;
172
+ after?: (ix: (name: string) => number, mx: (name: string) => number, lit: (m: Machine) => string, c: (condition: C) => string) => string;
152
173
  historyTampers?: {
153
174
  what: string;
154
175
  relations: {
@@ -168,6 +189,7 @@ export declare function smachineToLean(id: string, given: Machine, laws: Law[],
168
189
  law: string;
169
190
  body: C;
170
191
  sub: Record<string, E>;
192
+ boundGhosts?: boolean;
171
193
  }[];
172
194
  refined?: {
173
195
  impl: Machine;
@@ -200,6 +222,14 @@ export declare function smachineToLean(id: string, given: Machine, laws: Law[],
200
222
  }[];
201
223
  }): string;
202
224
  export declare const seedStepProof: (m: Machine, laws: Law[], stepLaws: StepLaw[], r: ReturnType<typeof proveStepLaws>) => void;
225
+ export declare function retainedCMachineToLean(id: string, m: Machine, laws: Law[], proof: {
226
+ instances: Record<string, Instances>;
227
+ certs: Record<string, CountCert>;
228
+ }, options?: NonNullable<Parameters<typeof cmachineToLean>[5]>): string;
229
+ export declare function retainedSMachineToLean(id: string, m: Machine, laws: Law[], proof: {
230
+ instances: Record<string, Instances>;
231
+ trees: Record<string, Tree>;
232
+ }, projection?: Pick<NonNullable<Parameters<typeof smachineToLean>[3]>, 'ghosts' | 'ghosted' | 'ghostSubst' | 'forallSome' | 'free' | 'after'>): string;
203
233
  export declare const cyclicCerts: () => boolean;
204
234
  export declare const certReport: {
205
235
  cyclic: string[];
@@ -343,6 +373,7 @@ export declare function toLean(items: LeanItem[], opts?: {
343
373
  export { rationalsToLean } from './qlean.js';
344
374
  export declare function leanProject(file: string, opts?: {
345
375
  name?: string;
376
+ currentFamily?: boolean;
346
377
  }): Record<string, string>;
347
378
  export type CycBridge = {
348
379
  machine: Machine;