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
@@ -1,9 +1,27 @@
1
+ import { traceNow as countedTraceNow } from "./wall.js";
1
2
  // UNTRUSTED relative-CTI proposals, not a proof, finite cover, or drop decision.
2
3
  // The consumer MUST independently check m.pre, ALL m.facts, the WHOLE current
3
4
  // family, the source interpreter's enabled step, and each reported post-law. This module owns no
4
5
  // solver/kernel policy and never extends the enclosing cooperative wall.
5
- import { cpair, cunpair, walk } from "./machine.js";
6
+ import { cpair, cunpair, hasFinite, walk, compileFunction } from "./machine.js";
6
7
  import { checkWall, WallExpired } from "./wall.js";
8
+ import { tinyNode, tinyTerm, tinyBlock } from "./work-observe.js";
9
+ import { completeWorkProfile } from "./work-profile.js";
10
+ // Only closed generated operators enter this helper. Its lexical tick counts
11
+ // an executed predicate node, interval binding or transition binding; native
12
+ // short-circuit branches that were not executed are not charged.
13
+ const tinyPrefix = completeWorkProfile.enabled ? '__tinyWork();' : '';
14
+ const tinyExpression = (code) => completeWorkProfile.enabled ? `(__tinyWork(),${code})` : code;
15
+ const originalSize = (code) => code.length - (code.split('(__tinyWork(),').length - 1) * ('(__tinyWork(),'.length + 1);
16
+ const tinyCheck = (phase) => { tinyTerm(); checkWall(phase); };
17
+ function tinyNative(body) {
18
+ if (!completeWorkProfile.enabled)
19
+ return compileFunction(['v', 'd'], body);
20
+ const code = tinyPrefix + body;
21
+ const maximum = code.split('__tinyWork()').length - 1;
22
+ const execute = compileFunction(['v', 'd', '__tinyWork'], code);
23
+ return ((v, d) => tinyBlock(maximum, () => execute(v, d, tinyTerm)));
24
+ }
7
25
  const unique = (xs) => [...new Set(xs)];
8
26
  const conjunction = (xs) => {
9
27
  if (xs.includes(false))
@@ -22,7 +40,7 @@ const dependencyCache = new WeakMap();
22
40
  const depsOf = (p) => {
23
41
  if (typeof p === 'boolean')
24
42
  return [];
25
- checkWall('tiny dependencies');
43
+ tinyCheck('tiny dependencies');
26
44
  const hit = dependencyCache.get(p);
27
45
  if (hit)
28
46
  return hit;
@@ -72,7 +90,7 @@ class Compiler {
72
90
  ref(t) { return `t${t.id}`; }
73
91
  slot(i) { const vs = this.slots[i].values; return this.term(`v[${i}]`, [], Math.min(...vs), Math.max(...vs), [i]); }
74
92
  binary(op, a, b) {
75
- checkWall('tiny arithmetic compile');
93
+ tinyCheck('tiny arithmetic compile');
76
94
  const finish = (t) => {
77
95
  t.arithmetic = op;
78
96
  if (a.values && b.values && a.values.length * b.values.length <= 256)
@@ -105,7 +123,7 @@ class Compiler {
105
123
  throw new Unsupported('nonconstant tuple');
106
124
  }
107
125
  compare(cmp, a, b) {
108
- checkWall('tiny comparison compile');
126
+ tinyCheck('tiny comparison compile');
109
127
  if (cmp === '=') {
110
128
  if (a.id === b.id)
111
129
  return true;
@@ -158,7 +176,7 @@ class Compiler {
158
176
  return out;
159
177
  }
160
178
  expression(e, env, post = false, stack = []) {
161
- checkWall('tiny compile expression');
179
+ tinyCheck('tiny compile expression');
162
180
  if (stack.length > 48)
163
181
  throw new Unsupported('recursive count/flag');
164
182
  switch (e.op) {
@@ -202,7 +220,7 @@ class Compiler {
202
220
  const keys = key.values ?? Array.from({ length: key.hi - key.lo + 1 }, (_, i) => key.lo + i);
203
221
  let out = this.read(e.map, keys.at(-1), env, post, stack);
204
222
  for (const k of keys.slice(0, -1).reverse()) {
205
- checkWall('tiny dynamic reads');
223
+ tinyCheck('tiny dynamic reads');
206
224
  out = this.conditional(this.compare('=', key, this.constant(k)), this.read(e.map, k, env, post, stack), out);
207
225
  }
208
226
  return out;
@@ -212,7 +230,7 @@ class Compiler {
212
230
  }
213
231
  }
214
232
  read(map, key, env, post, stack) {
215
- checkWall('tiny compile read');
233
+ tinyCheck('tiny compile read');
216
234
  const id = JSON.stringify([map, key, post, this.environmentKey(env)]);
217
235
  const hit = this.reads.get(id);
218
236
  if (hit)
@@ -232,7 +250,7 @@ class Compiler {
232
250
  throw new Unsupported('nonconstant/large count bound');
233
251
  let out = this.constant(0);
234
252
  for (let k = 0; k < bound.hi; k++) {
235
- checkWall('tiny count expansion');
253
+ tinyCheck('tiny count expansion');
236
254
  out = this.binary('add', out, this.expression(d.body, { ...at, [d.key]: k }, post, [...stack, `count:${map}`]));
237
255
  }
238
256
  return out;
@@ -256,7 +274,7 @@ class Compiler {
256
274
  throw new Unsupported(`unknown map ${map}`);
257
275
  }
258
276
  condition(c, env, post = false, stack = []) {
259
- checkWall('tiny compile predicate');
277
+ tinyCheck('tiny compile predicate');
260
278
  if (stack.length > 48)
261
279
  throw new Unsupported('recursive count/flag');
262
280
  switch (c.op) {
@@ -289,21 +307,24 @@ class Compiler {
289
307
  }
290
308
  return value;
291
309
  }
292
- case 'all': return conjunction(bindings([c.key, ...c.keys ?? []], this.binders, env).map(at => this.condition(c.c, at, post, stack)));
310
+ case 'all':
311
+ if (c.finite !== undefined)
312
+ throw new Unsupported('finite sort quantifier: exact enumeration is not supported by the tiny compiler');
313
+ return conjunction(bindings([c.key, ...c.keys ?? []], this.binders, env).map(at => this.condition(c.c, at, post, stack)));
293
314
  }
294
315
  }
295
316
  predicateCode(p, rank, used, polarity = true) {
296
- checkWall('tiny predicate code');
317
+ tinyCheck('tiny predicate code');
297
318
  if (typeof p === 'boolean')
298
- return String(p === polarity);
319
+ return tinyExpression(String(p === polarity));
299
320
  if (p.op === 'not')
300
- return this.predicateCode(p.x, rank, used, !polarity);
321
+ return tinyExpression(this.predicateCode(p.x, rank, used, !polarity));
301
322
  if (p.op === 'and' || p.op === 'or')
302
- return '(' + p.xs.map(x => this.predicateCode(x, rank, used, polarity)).join((p.op === 'and') === polarity ? '&&' : '||') + ')';
323
+ return tinyExpression('(' + p.xs.map(x => this.predicateCode(x, rank, used, polarity)).join((p.op === 'and') === polarity ? '&&' : '||') + ')');
303
324
  used.push(p.a, p.b);
304
325
  const ds = unique([...p.a.deps, ...p.b.deps]), ready = rank ? Math.max(-1, ...ds.map(i => rank[i])) + 1 : 0;
305
326
  const test = `(${this.ref(p.a)}${p.cmp === '=' ? '===' : p.cmp}${this.ref(p.b)})`;
306
- return `(${rank && ready > 0 ? `d<${ready}||` : ''}${polarity ? test : '!' + test})`;
327
+ return tinyExpression(`(${rank && ready > 0 ? `d<${ready}||` : ''}${polarity ? test : '!' + test})`);
307
328
  }
308
329
  // Three-valued interval truth: -1=false, 0=unknown, 1=true. Only a
309
330
  // definitely true target rules out its negation; intersecting bounds stay
@@ -312,14 +333,14 @@ class Compiler {
312
333
  const lines = [], ranges = new Map(), truths = new WeakMap();
313
334
  let chars = 0, next = 0;
314
335
  const emit = (line) => {
315
- checkWall('tiny interval code');
316
- chars += line.length;
336
+ tinyCheck('tiny interval code');
337
+ chars += originalSize(line);
317
338
  if (chars > 65_536)
318
339
  throw new Unsupported('large interval screen');
319
- lines.push(line);
340
+ lines.push(tinyPrefix + line);
320
341
  };
321
342
  const range = (t) => {
322
- checkWall('tiny interval term');
343
+ tinyCheck('tiny interval term');
323
344
  if (t.lo < 0 || t.hi < t.lo)
324
345
  throw new Unsupported('non-natural interval');
325
346
  const hit = ranges.get(t.id);
@@ -363,7 +384,7 @@ class Compiler {
363
384
  return out;
364
385
  };
365
386
  const truth = (q) => {
366
- checkWall('tiny interval predicate');
387
+ tinyCheck('tiny interval predicate');
367
388
  if (typeof q === 'boolean')
368
389
  return q ? '1' : '-1';
369
390
  const hit = truths.get(q);
@@ -390,37 +411,37 @@ class Compiler {
390
411
  const result = truth(p);
391
412
  emit(`return ${result}!==1;`);
392
413
  // oxlint-disable-next-line typescript/no-implied-eval
393
- return new Function('v', 'd', lines.join(''));
414
+ return tinyNative(lines.join(''));
394
415
  }
395
416
  compileValues(values, order) {
396
- checkWall('tiny transition code');
417
+ tinyCheck('tiny transition code');
397
418
  const rank = order ? this.slots.map((_, i) => order.indexOf(i)) : undefined;
398
419
  const seen = new Set(), lines = [];
399
420
  let chars = 0;
400
421
  const emit = (t) => {
401
- checkWall('tiny transition terms');
422
+ tinyCheck('tiny transition terms');
402
423
  if (seen.has(t.id))
403
424
  return;
404
425
  seen.add(t.id);
405
426
  t.args.forEach(emit);
406
427
  const ready = rank ? Math.max(-1, ...t.deps.map(i => rank[i])) + 1 : 0;
407
428
  const line = `const t${t.id}=${ready > 0 ? `d>=${ready}?${t.code}:0` : t.code};`;
408
- chars += line.length;
429
+ chars += originalSize(line);
409
430
  if (chars > 65_536)
410
431
  throw new Unsupported('large transition screen');
411
- lines.push(line);
432
+ lines.push(tinyPrefix + line);
412
433
  };
413
434
  values.forEach(emit);
414
435
  // Only closed AST operators, validated numerical literals and slot indices;
415
436
  // callback replay, never this generated transition, authorizes a CTI.
416
437
  // oxlint-disable-next-line typescript/no-implied-eval
417
- return new Function('v', 'd', `${lines.join('')}return [${values.map(t => this.ref(t)).join(',')}];`);
438
+ return tinyNative(`${lines.join('')}return [${values.map(t => this.ref(t)).join(',')}];`);
418
439
  }
419
440
  // Upper truth bound, not a two-valued evaluation of an incomplete state.
420
441
  // true includes UNKNOWN; false rules out this polarity for every completion.
421
442
  // In particular, polarity=false cannot prune on an unassigned atom.
422
443
  compile(p, order, polarity = true, readyAt) {
423
- checkWall('tiny generate screen');
444
+ tinyCheck('tiny generate screen');
424
445
  // Keep native compilation and hot execution in bounded clauses rather
425
446
  // than one giant predicate. Partial-assignment polarity is unchanged.
426
447
  if (typeof p === 'boolean')
@@ -446,7 +467,7 @@ class Compiler {
446
467
  this.compile({ op: p.op, xs: p.xs.slice(middle) }, order, polarity, readyAt)];
447
468
  return (v, depth) => {
448
469
  for (const test of tests) {
449
- checkWall('tiny predicate clause');
470
+ tinyCheck('tiny predicate clause');
450
471
  if (test(v, depth) !== all)
451
472
  return !all;
452
473
  }
@@ -456,7 +477,7 @@ class Compiler {
456
477
  return this.compileNative(p, order, polarity, readyAt);
457
478
  }
458
479
  compileNative(p, order, polarity = true, readyAt) {
459
- checkWall('tiny native clause');
480
+ tinyCheck('tiny native clause');
460
481
  const rank = readyAt ? readyAt.map(depth => depth - 1) : order ? this.slots.map((_, i) => order.indexOf(i)) : undefined, used = [];
461
482
  // An atomic predicate is unknown until ALL of its dependencies are set.
462
483
  // Its old per-term placeholders could not affect that result, so return
@@ -466,33 +487,33 @@ class Compiler {
466
487
  const ready = rank && atomic ? Math.max(-1, ...depsOf(p).map(i => rank[i])) + 1 : 0;
467
488
  const guard = ready > 0 ? `if(d<${ready})return true;` : '';
468
489
  const code = this.predicateCode(p, atomic ? undefined : rank, used, polarity), seen = new Set(), lines = [];
469
- let chars = guard.length + code.length;
490
+ let chars = guard.length + originalSize(code);
470
491
  if (chars > 65_536)
471
492
  throw new Unsupported('large generated screen');
472
493
  const emit = (t) => {
473
- checkWall('tiny term code');
494
+ tinyCheck('tiny term code');
474
495
  if (seen.has(t.id))
475
496
  return;
476
497
  seen.add(t.id);
477
498
  t.args.forEach(emit);
478
499
  const termReady = rank && !atomic ? Math.max(-1, ...t.deps.map(i => rank[i])) + 1 : 0;
479
500
  const line = `const t${t.id}=${termReady > 0 ? `d>=${termReady}?${t.code}:0` : t.code};`;
480
- chars += line.length;
501
+ chars += originalSize(line);
481
502
  if (chars > 65_536)
482
503
  throw new Unsupported('large generated screen');
483
- lines.push(line);
504
+ lines.push(tinyPrefix + line);
484
505
  };
485
506
  used.forEach(emit);
486
507
  // Closed AST operators, validated numerical literals and slot indices only;
487
508
  // no identifier or external function source is interpolated. This is an
488
509
  // UNTRUSTED screen: the callback must independently replay every proposal.
489
510
  // oxlint-disable-next-line typescript/no-implied-eval
490
- return new Function('v', 'd', `${guard}${lines.join('')}return ${code};`);
511
+ return tinyNative(`${guard}${lines.join('')}return ${code};`);
491
512
  }
492
513
  }
493
514
  const uniqueTerms = (ts) => [...new Map(ts.map(t => [t.id, t])).values()];
494
515
  function bindings(names, domain, env) {
495
- checkWall('tiny bindings');
516
+ tinyCheck('tiny bindings');
496
517
  if (!names.length)
497
518
  return [env];
498
519
  if (names.length > 5)
@@ -507,7 +528,7 @@ function gridKeys(m, size) {
507
528
  cells[name] = Array.from({ length: size }, (_, i) => i);
508
529
  for (const d of Object.values(m.counts ?? {}))
509
530
  walk(d.body, o => {
510
- checkWall('tiny grid inference');
531
+ tinyCheck('tiny grid inference');
511
532
  if (o.op !== 'get' || !Object.hasOwn(cells, String(o.map)))
512
533
  return;
513
534
  const key = o.key;
@@ -525,7 +546,7 @@ function tinyScope(params, stateValues, options) {
525
546
  return { params: { ...params }, scalarValues: [...stateValues], cellValues: [...stateValues], cells: {}, inputValues: {}, inputCells: {}, binderValues: [], postTargetPruning: options.postTargetPruning === true, postTargetIntervals: options.postTargetIntervals === true, seedNeighborhood: options.seedTransitions !== undefined, seedUniformMaps: options.seedTransitions !== undefined && options.seedUniformMaps === true };
526
547
  }
527
548
  function tinyLayout(source, m, params, stateValues, scope) {
528
- checkWall('tiny start');
549
+ tinyCheck('tiny start');
529
550
  if (!stateValues.length || stateValues.length > 4 || stateValues.some(n => !Number.isSafeInteger(n) || n < 0))
530
551
  throw new Unsupported('invalid finite value domain');
531
552
  if (source.history || source.leasts || source.sums)
@@ -543,17 +564,17 @@ function tinyLayout(source, m, params, stateValues, scope) {
543
564
  const slots = Object.keys(source.state).map(name => ({ name, values: stateValues }));
544
565
  for (const name of Object.keys(source.maps ?? {}))
545
566
  for (const key of scope.cells[name] ?? []) {
546
- checkWall('tiny state coordinates');
567
+ tinyCheck('tiny state coordinates');
547
568
  slots.push({ name, key, values: stateValues });
548
569
  }
549
570
  const stateSlots = slots.length;
550
571
  for (const name of source.inputs) {
551
- checkWall('tiny request domains');
572
+ tinyCheck('tiny request domains');
552
573
  // Explicit conjunctive natural bounds are domain hints; other inputs use
553
574
  // 0..size. No domain or quotient is a trusted pruning justification.
554
575
  let hi = 16, bounded = false;
555
576
  for (const c of conjuncts(source.assume ?? { op: 'and', xs: [] })) {
556
- checkWall('tiny numeric bounds');
577
+ tinyCheck('tiny numeric bounds');
557
578
  if ((c.op === '<' || c.op === '<=') && c.a.op === 'var' && c.a.name === name) {
558
579
  const b = c.b.op === 'const' ? c.b.value : c.b.op === 'var' ? params[c.b.name] : undefined;
559
580
  if (b !== undefined) {
@@ -571,7 +592,7 @@ function tinyLayout(source, m, params, stateValues, scope) {
571
592
  slots.push({ name, request: true, values });
572
593
  }
573
594
  for (const name of source.inputMaps ?? []) {
574
- checkWall('tiny carried coordinates');
595
+ tinyCheck('tiny carried coordinates');
575
596
  scope.inputCells[name] = Array.from({ length: size }, (_, i) => i);
576
597
  for (const key of scope.inputCells[name])
577
598
  slots.push({ name, key, request: true, values: [0, 1] });
@@ -584,7 +605,7 @@ function materializeTiny(source, slots, values, fixed = {}) {
584
605
  const preState = { scalars: {}, maps: Object.fromEntries(Object.keys(source.maps ?? {}).map(name => [name, new Map()])) };
585
606
  const request = Object.fromEntries((source.inputMaps ?? []).map(name => [name, new Map()]));
586
607
  for (let i = 0; i < slots.length; i++) {
587
- checkWall('tiny candidate materialization');
608
+ tinyCheck('tiny candidate materialization');
588
609
  const s = slots[i], value = s.request && s.key === undefined && Object.hasOwn(fixed, s.name) ? fixed[s.name] : values[i];
589
610
  if (s.request) {
590
611
  if (s.key === undefined)
@@ -603,7 +624,7 @@ function walkTinySeedVectors(source, params, slots, options, visit) {
603
624
  const bases = [], seen = new Set();
604
625
  let attempts = 0;
605
626
  for (const seed of options.seedTransitions?.slice(-8) ?? []) {
606
- checkWall('tiny seed projection');
627
+ tinyCheck('tiny seed projection');
607
628
  if (!Object.keys(params).every(key => seed.params[key] === params[key]))
608
629
  continue;
609
630
  const values = [];
@@ -620,7 +641,7 @@ function walkTinySeedVectors(source, params, slots, options, visit) {
620
641
  bases.push(values);
621
642
  }
622
643
  const attempt = (values, coupled = false) => {
623
- checkWall('tiny seed attempt');
644
+ tinyCheck('tiny seed attempt');
624
645
  if (attempts >= 256)
625
646
  return false;
626
647
  const key = values.join(',');
@@ -637,7 +658,7 @@ function walkTinySeedVectors(source, params, slots, options, visit) {
637
658
  if (options.seedUniformMaps) {
638
659
  const grouped = new Map();
639
660
  for (const [i, slot] of slots.entries()) {
640
- checkWall('tiny seed map grouping');
661
+ tinyCheck('tiny seed map grouping');
641
662
  if (slot.key === undefined)
642
663
  continue;
643
664
  const key = `${Number(!!slot.request)}:${slot.name}`, group = grouped.get(key) ?? [];
@@ -649,7 +670,7 @@ function walkTinySeedVectors(source, params, slots, options, visit) {
649
670
  for (const group of groups)
650
671
  for (const base of bases)
651
672
  for (const value of slots[group[0]].values) {
652
- checkWall('tiny seed uniform map');
673
+ tinyCheck('tiny seed uniform map');
653
674
  if (!group.every(i => slots[i].values.includes(value)) || group.every(i => base[i] === value))
654
675
  continue;
655
676
  const values = base.slice();
@@ -665,7 +686,7 @@ function walkTinySeedVectors(source, params, slots, options, visit) {
665
686
  for (const i of axes)
666
687
  for (const base of bases)
667
688
  for (const value of slots[i].values) {
668
- checkWall('tiny seed neighbor');
689
+ tinyCheck('tiny seed neighbor');
669
690
  if (value === base[i])
670
691
  continue;
671
692
  const values = base.slice();
@@ -677,10 +698,12 @@ function walkTinySeedVectors(source, params, slots, options, visit) {
677
698
  // Cheap finite-grid proposals only: no predicates or native transition code are
678
699
  // compiled. The supplied checker must establish every removal independently.
679
700
  export function tinySeedCandidates(source, m, params, onCandidate, options = {}) {
680
- const values = unique([...(options.valueDomain ?? [0, 1])]).sort((a, b) => a - b), start = performance.now();
701
+ const values = unique([...(options.valueDomain ?? [0, 1])]).sort((a, b) => a - b), start = countedTraceNow();
681
702
  const stats = { phase: 'seed-only', scope: tinyScope(params, values, options), completed: false, timedOut: false,
682
703
  unsupported: [], models: 0, accepted: 0, coupledModels: 0, coupledAccepted: 0, ms: 0 };
683
704
  try {
705
+ if (hasFinite([source, m]))
706
+ throw new Unsupported('finite sort machine: tiny screening is not supported');
684
707
  const { slots } = tinyLayout(source, m, params, values, stats.scope);
685
708
  walkTinySeedVectors(source, params, slots, options, (vector, coupled) => {
686
709
  stats.models++;
@@ -704,7 +727,7 @@ export function tinySeedCandidates(source, m, params, onCandidate, options = {})
704
727
  throw e;
705
728
  }
706
729
  finally {
707
- stats.ms = performance.now() - start;
730
+ stats.ms = countedTraceNow() - start;
708
731
  }
709
732
  return stats;
710
733
  }
@@ -720,11 +743,13 @@ export function tinySeedCandidates(source, m, params, onCandidate, options = {})
720
743
  */
721
744
  export function tinyFiniteCandidates(source, m, family, params, onCandidate, options = {}) {
722
745
  const stateValues = unique([...(options.valueDomain ?? [0, 1])]).sort((a, b) => a - b);
723
- const start = performance.now(), scope = tinyScope(params, stateValues, options);
746
+ const start = countedTraceNow(), scope = tinyScope(params, stateValues, options);
724
747
  const stats = { scope, completed: false, exhausted: false, timedOut: false, unsupported: [], nodes: 0, states: 0, steps: 0, scenarios: 0, candidates: 0, postStatePrunes: 0, postRequestPrunes: 0, postIntervalFallbacks: 0, seedModels: 0, seedCandidates: 0, seedCoupledModels: 0, seedCoupledCandidates: 0, ms: 0 };
725
748
  const unknown = (e) => { const reason = e instanceof Error ? e.message : String(e); if (!stats.unsupported.includes(reason))
726
749
  stats.unsupported.push(reason); };
727
750
  try {
751
+ if (hasFinite([source, m, family]))
752
+ throw new Unsupported('finite sort machine/law: tiny screening is not supported');
728
753
  const { slots, stateSlots } = tinyLayout(source, m, params, stateValues, scope);
729
754
  const compiler = new Compiler(source, m, params, slots, scope.cells, scope.binderValues);
730
755
  const pres = [];
@@ -732,7 +757,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
732
757
  pres.push(compiler.condition(source.pre, params));
733
758
  const instances = new Map();
734
759
  for (const law of family) {
735
- checkWall('tiny family compile');
760
+ tinyCheck('tiny family compile');
736
761
  if (law.some?.length) {
737
762
  unknown(new Unsupported('existential law'));
738
763
  continue;
@@ -763,7 +788,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
763
788
  // quotients request coordinates irrelevant to that operation slice.
764
789
  const dispatches = new Map();
765
790
  walk(source.step, o => {
766
- checkWall('tiny dispatch inference');
791
+ tinyCheck('tiny dispatch inference');
767
792
  if (o.op !== '=')
768
793
  return;
769
794
  const a = o.a, b = o.b;
@@ -778,7 +803,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
778
803
  const slices = dispatch ? scope.inputValues[dispatch].map(value => ({ ...params, [dispatch]: value })) : [params];
779
804
  const emitted = new Set(), highs = slots.map(s => Math.max(...s.values));
780
805
  const writeFlags = new Set();
781
- walk([source.step.state, source.step.maps], o => { checkWall('tiny write flags'); if (o.op === 'flag')
806
+ walk([source.step.state, source.step.maps], o => { tinyCheck('tiny write flags'); if (o.op === 'flag')
782
807
  writeFlags.add(o.name); });
783
808
  const slotValue = (c, i, env, post) => {
784
809
  const s = slots[i];
@@ -801,7 +826,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
801
826
  const flatPreds = (p) => typeof p !== 'boolean' && p.op === 'and' ? p.xs.flatMap(flatPreds) : [p];
802
827
  const operations = [];
803
828
  for (const fixed of slices) {
804
- checkWall('tiny operation compile');
829
+ tinyCheck('tiny operation compile');
805
830
  try {
806
831
  const outputs = slots.slice(0, stateSlots).map((_, i) => slotValue(compiler, i, fixed, true));
807
832
  if (outputs.every((t, i) => t.id === compiler.slot(i).id))
@@ -815,7 +840,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
815
840
  const degrees = slots.map((_, i) => clauses.reduce((sum, ds) => sum + (ds.includes(i) ? 1 / Math.max(1, ds.length) : 0), 0));
816
841
  const order = slots.map((_, i) => i).filter(i => i >= stateSlots && relevant.has(i)).sort((a, b) => degrees[b] - degrees[a] || a - b);
817
842
  operations.push({ fixed, order, gate: compiler.compile(enabled, order), step: compiler.compileValues(outputs), outputs });
818
- outputs.forEach((t, i) => { checkWall('tiny post ranges'); highs[i] = Math.max(highs[i], t.hi); });
843
+ outputs.forEach((t, i) => { tinyCheck('tiny post ranges'); highs[i] = Math.max(highs[i], t.hi); });
819
844
  stats.scenarios++;
820
845
  }
821
846
  catch (e) {
@@ -828,7 +853,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
828
853
  const postCompiler = new Compiler(source, m, params, postSlots, scope.cells, scope.binderValues);
829
854
  const targets = [], predicates = [];
830
855
  for (const [law, ats] of instances) {
831
- checkWall('tiny shared post predicates');
856
+ tinyCheck('tiny shared post predicates');
832
857
  try {
833
858
  const p = conjunction(ats.map(at => postCompiler.condition(law.holds, at)));
834
859
  if (p === true)
@@ -852,7 +877,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
852
877
  const preTest = compiler.compile(pre, stateOrder), v = slots.map(s => s.values[0]);
853
878
  if (options.postTargetPruning)
854
879
  for (const op of operations) {
855
- checkWall('tiny post-target circuit');
880
+ tinyCheck('tiny post-target circuit');
856
881
  try {
857
882
  const order = [...stateOrder, ...op.order], rank = slots.map((_, i) => order.indexOf(i));
858
883
  // A post coordinate is unknown until every source dependency of its
@@ -861,7 +886,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
861
886
  const changed = new Set(op.outputs.flatMap((t, i) => t.id === compiler.slot(i).id ? [] : [i]));
862
887
  const needed = new Set(), screens = [];
863
888
  for (const [i, law] of targets.entries()) {
864
- checkWall('tiny post-target predicate');
889
+ tinyCheck('tiny post-target predicate');
865
890
  const p = predicates[i], deps = depsOf(p);
866
891
  // Unchanged primitive dependencies preserve this full-family law.
867
892
  if (!deps.some(j => changed.has(j)))
@@ -925,23 +950,24 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
925
950
  stats.candidates++;
926
951
  if (accepted !== false)
927
952
  for (const law of violated) {
928
- checkWall('tiny proposed targets');
953
+ tinyCheck('tiny proposed targets');
929
954
  emitted.add(law);
930
955
  }
931
956
  };
932
957
  const visit = () => {
933
958
  stats.states++;
934
- checkWall('tiny lawful state');
959
+ tinyCheck('tiny lawful state');
935
960
  for (const op of operations) {
936
- checkWall('tiny operation slice');
961
+ tinyCheck('tiny operation slice');
937
962
  for (let i = stateSlots; i < slots.length; i++)
938
963
  v[i] = slots[i].values[0];
939
964
  for (const name of source.inputs)
940
965
  if (Object.hasOwn(op.fixed, name))
941
966
  v[slots.findIndex(s => s.request && s.key === undefined && s.name === name)] = op.fixed[name];
942
967
  const requests = (d) => {
968
+ tinyNode();
943
969
  stats.nodes++;
944
- checkWall('tiny request assignment');
970
+ tinyCheck('tiny request assignment');
945
971
  if (!op.gate(v, d))
946
972
  return;
947
973
  if (op.mayFail && !op.mayFail(v, stateOrder.length + d)) {
@@ -951,7 +977,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
951
977
  if (d < op.order.length) {
952
978
  const i = op.order[d];
953
979
  for (const value of slots[i].values) {
954
- checkWall('tiny request values');
980
+ tinyCheck('tiny request values');
955
981
  v[i] = value;
956
982
  requests(d + 1);
957
983
  }
@@ -972,8 +998,9 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
972
998
  }
973
999
  };
974
1000
  const states = (d) => {
1001
+ tinyNode();
975
1002
  stats.nodes++;
976
- checkWall('tiny state assignment');
1003
+ tinyCheck('tiny state assignment');
977
1004
  if (!preTest(v, d))
978
1005
  return;
979
1006
  if (options.postTargetPruning && operations.every(op => !op.mayFail(v, d))) {
@@ -987,7 +1014,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
987
1014
  const i = stateOrder[d];
988
1015
  // Ones first reaches enabled guards early; both values remain enumerated.
989
1016
  for (const value of [...slots[i].values].reverse()) {
990
- checkWall('tiny state values');
1017
+ tinyCheck('tiny state values');
991
1018
  v[i] = value;
992
1019
  states(d + 1);
993
1020
  }
@@ -998,6 +1025,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
998
1025
  // independent callback. Snapshot before callbacks can add later seeds.
999
1026
  if (options.seedTransitions)
1000
1027
  walkTinySeedVectors(source, params, slots, options, (values, coupled) => {
1028
+ tinyNode();
1001
1029
  stats.seedModels++;
1002
1030
  stats.nodes++;
1003
1031
  if (coupled)
@@ -1007,7 +1035,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
1007
1035
  if (!preTest(v, stateOrder.length))
1008
1036
  return;
1009
1037
  for (const op of operations) {
1010
- checkWall('tiny seed operation');
1038
+ tinyCheck('tiny seed operation');
1011
1039
  if (slots.some((s, i) => s.request && s.key === undefined && Object.hasOwn(op.fixed, s.name) && v[i] !== op.fixed[s.name]))
1012
1040
  continue;
1013
1041
  if (!op.gate(v, op.order.length))
@@ -1045,7 +1073,7 @@ export function tinyFiniteCandidates(source, m, family, params, onCandidate, opt
1045
1073
  throw e;
1046
1074
  }
1047
1075
  finally {
1048
- stats.ms = performance.now() - start;
1076
+ stats.ms = countedTraceNow() - start;
1049
1077
  }
1050
1078
  return stats;
1051
1079
  }