universal-physics-tensor 10.0.0 → 11.0.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 (720) hide show
  1. package/README.md +4 -3
  2. package/bin/upt.mjs +13 -1
  3. package/data/atlas/atlas.json +25 -25
  4. package/data/atlas/atlas.jsonld +1 -1
  5. package/data/atlas/diffusion.json +6 -6
  6. package/data/atlas/oscillators.json +7 -7
  7. package/data/atlas/waves.json +14 -14
  8. package/data/atlas/witness-results.json +11 -11
  9. package/data/bridge-catalog.json +371 -228
  10. package/data/bridge-catalog.schema.json +45 -7
  11. package/dist/atlas/applicability.d.ts.map +1 -1
  12. package/dist/atlas/applicability.js +21 -15
  13. package/dist/atlas/applicability.js.map +1 -1
  14. package/dist/atlas/benchmark/hybrid-retrieval.d.ts +9 -1
  15. package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
  16. package/dist/atlas/benchmark/hybrid-retrieval.js +15 -13
  17. package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
  18. package/dist/atlas/benchmark/loader.js +2 -2
  19. package/dist/atlas/benchmark/loader.js.map +1 -1
  20. package/dist/atlas/benchmark/stats.d.ts +2 -2
  21. package/dist/atlas/benchmark/stats.d.ts.map +1 -1
  22. package/dist/atlas/benchmark/stats.js +15 -7
  23. package/dist/atlas/benchmark/stats.js.map +1 -1
  24. package/dist/atlas/catalog-formal-ref.d.ts +26 -3
  25. package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
  26. package/dist/atlas/catalog-formal-ref.js +52 -5
  27. package/dist/atlas/catalog-formal-ref.js.map +1 -1
  28. package/dist/atlas/chain-pipeline.d.ts.map +1 -1
  29. package/dist/atlas/chain-pipeline.js +7 -8
  30. package/dist/atlas/chain-pipeline.js.map +1 -1
  31. package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
  32. package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
  33. package/dist/atlas/diffusion/bridges-closure.js +8 -12
  34. package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
  35. package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
  36. package/dist/atlas/diffusion/bridges.js +27 -39
  37. package/dist/atlas/diffusion/bridges.js.map +1 -1
  38. package/dist/atlas/diffusion/dimensions.d.ts +6 -14
  39. package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
  40. package/dist/atlas/diffusion/dimensions.js +8 -16
  41. package/dist/atlas/diffusion/dimensions.js.map +1 -1
  42. package/dist/atlas/diffusion/models.d.ts +3 -3
  43. package/dist/atlas/diffusion/models.d.ts.map +1 -1
  44. package/dist/atlas/diffusion/models.js +5 -10
  45. package/dist/atlas/diffusion/models.js.map +1 -1
  46. package/dist/atlas/diffusion/numerics.d.ts +16 -4
  47. package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
  48. package/dist/atlas/diffusion/numerics.js +38 -24
  49. package/dist/atlas/diffusion/numerics.js.map +1 -1
  50. package/dist/atlas/link-prediction.d.ts +106 -3
  51. package/dist/atlas/link-prediction.d.ts.map +1 -1
  52. package/dist/atlas/link-prediction.js +212 -66
  53. package/dist/atlas/link-prediction.js.map +1 -1
  54. package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
  55. package/dist/atlas/oscillators/bridges-coarse.js +7 -11
  56. package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
  57. package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
  58. package/dist/atlas/oscillators/bridges-exact.js +6 -7
  59. package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
  60. package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
  61. package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
  62. package/dist/atlas/oscillators/bridges-limits.js +23 -34
  63. package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
  64. package/dist/atlas/oscillators/dimensions.d.ts +9 -21
  65. package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
  66. package/dist/atlas/oscillators/dimensions.js +9 -21
  67. package/dist/atlas/oscillators/dimensions.js.map +1 -1
  68. package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
  69. package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
  70. package/dist/atlas/oscillators/limit-witnesses.js +17 -15
  71. package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
  72. package/dist/atlas/oscillators/models.d.ts.map +1 -1
  73. package/dist/atlas/oscillators/models.js +2 -6
  74. package/dist/atlas/oscillators/models.js.map +1 -1
  75. package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
  76. package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
  77. package/dist/atlas/oscillators/pendulum-motion.js +60 -40
  78. package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
  79. package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
  80. package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
  81. package/dist/atlas/oscillators/phase-translation.js +3 -4
  82. package/dist/atlas/oscillators/phase-translation.js.map +1 -1
  83. package/dist/atlas/oscillators/position-translation.d.ts +68 -7
  84. package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
  85. package/dist/atlas/oscillators/position-translation.js +123 -12
  86. package/dist/atlas/oscillators/position-translation.js.map +1 -1
  87. package/dist/atlas/oscillators/rejections.d.ts +0 -2
  88. package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
  89. package/dist/atlas/oscillators/rejections.js +0 -7
  90. package/dist/atlas/oscillators/rejections.js.map +1 -1
  91. package/dist/atlas/physjs-entries.generated.d.ts +25 -24
  92. package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
  93. package/dist/atlas/physjs-entries.generated.js +25 -24
  94. package/dist/atlas/physjs-entries.generated.js.map +1 -1
  95. package/dist/atlas/physjs-ref.d.ts +34 -31
  96. package/dist/atlas/physjs-ref.d.ts.map +1 -1
  97. package/dist/atlas/physjs-ref.js +55 -53
  98. package/dist/atlas/physjs-ref.js.map +1 -1
  99. package/dist/atlas/physjs-reviewed.d.ts +1 -1
  100. package/dist/atlas/physjs-reviewed.js +15 -15
  101. package/dist/atlas/physjs-reviewed.js.map +1 -1
  102. package/dist/atlas/poster/statements.d.ts +0 -19
  103. package/dist/atlas/poster/statements.d.ts.map +1 -1
  104. package/dist/atlas/poster/statements.js +1 -1
  105. package/dist/atlas/poster/statements.js.map +1 -1
  106. package/dist/atlas/proof-target.d.ts +1 -1
  107. package/dist/atlas/proof-target.js +1 -1
  108. package/dist/atlas/proof-target.js.map +1 -1
  109. package/dist/atlas/regime.d.ts +1 -1
  110. package/dist/atlas/regime.d.ts.map +1 -1
  111. package/dist/atlas/regime.js +1 -1
  112. package/dist/atlas/regime.js.map +1 -1
  113. package/dist/atlas/text-overlap.d.ts +23 -0
  114. package/dist/atlas/text-overlap.d.ts.map +1 -0
  115. package/dist/atlas/text-overlap.js +41 -0
  116. package/dist/atlas/text-overlap.js.map +1 -0
  117. package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
  118. package/dist/atlas/waves/bridges-closure.js +2 -6
  119. package/dist/atlas/waves/bridges-closure.js.map +1 -1
  120. package/dist/atlas/waves/bridges.d.ts.map +1 -1
  121. package/dist/atlas/waves/bridges.js +32 -48
  122. package/dist/atlas/waves/bridges.js.map +1 -1
  123. package/dist/atlas/waves/models.d.ts +5 -6
  124. package/dist/atlas/waves/models.d.ts.map +1 -1
  125. package/dist/atlas/waves/models.js +7 -13
  126. package/dist/atlas/waves/models.js.map +1 -1
  127. package/dist/atlas/waves/numerics.d.ts.map +1 -1
  128. package/dist/atlas/waves/numerics.js +10 -3
  129. package/dist/atlas/waves/numerics.js.map +1 -1
  130. package/dist/atlas/witness-numeric.d.ts +30 -0
  131. package/dist/atlas/witness-numeric.d.ts.map +1 -1
  132. package/dist/atlas/witness-numeric.js +53 -0
  133. package/dist/atlas/witness-numeric.js.map +1 -1
  134. package/dist/atlas/witness-specs.d.ts.map +1 -1
  135. package/dist/atlas/witness-specs.js +19 -0
  136. package/dist/atlas/witness-specs.js.map +1 -1
  137. package/dist/atlas/witness-symbolic.d.ts +75 -3
  138. package/dist/atlas/witness-symbolic.d.ts.map +1 -1
  139. package/dist/atlas/witness-symbolic.js +116 -10
  140. package/dist/atlas/witness-symbolic.js.map +1 -1
  141. package/dist/bridges/catalog-load.d.ts.map +1 -1
  142. package/dist/bridges/catalog-load.js +13 -8
  143. package/dist/bridges/catalog-load.js.map +1 -1
  144. package/dist/bridges/catalog-types.d.ts +26 -2
  145. package/dist/bridges/catalog-types.d.ts.map +1 -1
  146. package/dist/bridges/catalog-types.js +11 -1
  147. package/dist/bridges/catalog-types.js.map +1 -1
  148. package/dist/bridges/evaluation-errors.d.ts +31 -1
  149. package/dist/bridges/evaluation-errors.d.ts.map +1 -1
  150. package/dist/bridges/evaluation-errors.js +20 -2
  151. package/dist/bridges/evaluation-errors.js.map +1 -1
  152. package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
  153. package/dist/bridges/evaluator-inputs.js +7 -5
  154. package/dist/bridges/evaluator-inputs.js.map +1 -1
  155. package/dist/bridges/evaluators.d.ts.map +1 -1
  156. package/dist/bridges/evaluators.js +27 -12
  157. package/dist/bridges/evaluators.js.map +1 -1
  158. package/dist/bridges/expr-parse.d.ts +11 -0
  159. package/dist/bridges/expr-parse.d.ts.map +1 -1
  160. package/dist/bridges/expr-parse.js +14 -5
  161. package/dist/bridges/expr-parse.js.map +1 -1
  162. package/dist/bridges/holds.d.ts +35 -3
  163. package/dist/bridges/holds.d.ts.map +1 -1
  164. package/dist/bridges/holds.js +117 -23
  165. package/dist/bridges/holds.js.map +1 -1
  166. package/dist/bridges/notices.d.ts.map +1 -1
  167. package/dist/bridges/notices.js +5 -5
  168. package/dist/bridges/notices.js.map +1 -1
  169. package/dist/bridges/relation-eval.d.ts +4 -4
  170. package/dist/bridges/relation-eval.d.ts.map +1 -1
  171. package/dist/bridges/relation-eval.js +15 -16
  172. package/dist/bridges/relation-eval.js.map +1 -1
  173. package/dist/bridges/sensitivity.d.ts.map +1 -1
  174. package/dist/bridges/sensitivity.js +3 -3
  175. package/dist/bridges/sensitivity.js.map +1 -1
  176. package/dist/bridges/validity.d.ts +33 -0
  177. package/dist/bridges/validity.d.ts.map +1 -0
  178. package/dist/bridges/validity.js +67 -0
  179. package/dist/bridges/validity.js.map +1 -0
  180. package/dist/canonical/entries/atomic.js +1 -3
  181. package/dist/canonical/entries/atomic.js.map +1 -1
  182. package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
  183. package/dist/canonical/entries/condensed-matter.js +4 -5
  184. package/dist/canonical/entries/condensed-matter.js.map +1 -1
  185. package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
  186. package/dist/canonical/entries/dimensional-classics.js +3 -4
  187. package/dist/canonical/entries/dimensional-classics.js.map +1 -1
  188. package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
  189. package/dist/canonical/entries/electromagnetism.js +4 -10
  190. package/dist/canonical/entries/electromagnetism.js.map +1 -1
  191. package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
  192. package/dist/canonical/entries/fluids-waves.js +3 -7
  193. package/dist/canonical/entries/fluids-waves.js.map +1 -1
  194. package/dist/canonical/entries/mechanics.d.ts.map +1 -1
  195. package/dist/canonical/entries/mechanics.js +4 -6
  196. package/dist/canonical/entries/mechanics.js.map +1 -1
  197. package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
  198. package/dist/canonical/entries/nonmonomial.js +9 -17
  199. package/dist/canonical/entries/nonmonomial.js.map +1 -1
  200. package/dist/canonical/entries/relativity.d.ts.map +1 -1
  201. package/dist/canonical/entries/relativity.js +6 -6
  202. package/dist/canonical/entries/relativity.js.map +1 -1
  203. package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
  204. package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
  205. package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
  206. package/dist/canonical/fixed-points.d.ts +94 -0
  207. package/dist/canonical/fixed-points.d.ts.map +1 -0
  208. package/dist/canonical/fixed-points.js +81 -0
  209. package/dist/canonical/fixed-points.js.map +1 -0
  210. package/dist/canonical/linkage.d.ts.map +1 -1
  211. package/dist/canonical/linkage.js +25 -44
  212. package/dist/canonical/linkage.js.map +1 -1
  213. package/dist/canonical/normal-form.d.ts.map +1 -1
  214. package/dist/canonical/normal-form.js +5 -11
  215. package/dist/canonical/normal-form.js.map +1 -1
  216. package/dist/canonical/structural.d.ts +21 -21
  217. package/dist/canonical/structural.d.ts.map +1 -1
  218. package/dist/canonical/structural.js +40 -19
  219. package/dist/canonical/structural.js.map +1 -1
  220. package/dist/cases/brownian-sphere.d.ts +3 -3
  221. package/dist/cases/brownian-sphere.d.ts.map +1 -1
  222. package/dist/cases/brownian-sphere.js +6 -5
  223. package/dist/cases/brownian-sphere.js.map +1 -1
  224. package/dist/cases/damped-resonator.d.ts.map +1 -1
  225. package/dist/cases/damped-resonator.js +6 -9
  226. package/dist/cases/damped-resonator.js.map +1 -1
  227. package/dist/cases/kepler-rv.d.ts +1 -1
  228. package/dist/cases/kepler-rv.d.ts.map +1 -1
  229. package/dist/cases/kepler-rv.js +3 -2
  230. package/dist/cases/kepler-rv.js.map +1 -1
  231. package/dist/cases/lumped-cooling.d.ts +8 -3
  232. package/dist/cases/lumped-cooling.d.ts.map +1 -1
  233. package/dist/cases/lumped-cooling.js +21 -23
  234. package/dist/cases/lumped-cooling.js.map +1 -1
  235. package/dist/cases/quadrature.d.ts +7 -9
  236. package/dist/cases/quadrature.d.ts.map +1 -1
  237. package/dist/cases/quadrature.js +28 -32
  238. package/dist/cases/quadrature.js.map +1 -1
  239. package/dist/cases/resistor-noise.js +4 -4
  240. package/dist/cases/resistor-noise.js.map +1 -1
  241. package/dist/cases/skin-depth.d.ts +0 -4
  242. package/dist/cases/skin-depth.d.ts.map +1 -1
  243. package/dist/cases/skin-depth.js +3 -7
  244. package/dist/cases/skin-depth.js.map +1 -1
  245. package/dist/cli/args.d.ts +23 -1
  246. package/dist/cli/args.d.ts.map +1 -1
  247. package/dist/cli/args.js +30 -8
  248. package/dist/cli/args.js.map +1 -1
  249. package/dist/cli/bindings.d.ts.map +1 -1
  250. package/dist/cli/bindings.js +5 -4
  251. package/dist/cli/bindings.js.map +1 -1
  252. package/dist/cli/command.d.ts +8 -1
  253. package/dist/cli/command.d.ts.map +1 -1
  254. package/dist/cli/command.js.map +1 -1
  255. package/dist/cli/commands/_atlas-map.d.ts +0 -9
  256. package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
  257. package/dist/cli/commands/_atlas-map.js +8 -18
  258. package/dist/cli/commands/_atlas-map.js.map +1 -1
  259. package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
  260. package/dist/cli/commands/_atlas-route.js +6 -2
  261. package/dist/cli/commands/_atlas-route.js.map +1 -1
  262. package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
  263. package/dist/cli/commands/_discovery-opts.js +8 -9
  264. package/dist/cli/commands/_discovery-opts.js.map +1 -1
  265. package/dist/cli/commands/atlas.d.ts.map +1 -1
  266. package/dist/cli/commands/atlas.js +8 -5
  267. package/dist/cli/commands/atlas.js.map +1 -1
  268. package/dist/cli/commands/audit.d.ts.map +1 -1
  269. package/dist/cli/commands/audit.js +8 -1
  270. package/dist/cli/commands/audit.js.map +1 -1
  271. package/dist/cli/commands/axes.d.ts.map +1 -1
  272. package/dist/cli/commands/axes.js +20 -1
  273. package/dist/cli/commands/axes.js.map +1 -1
  274. package/dist/cli/commands/confront.d.ts.map +1 -1
  275. package/dist/cli/commands/confront.js +8 -14
  276. package/dist/cli/commands/confront.js.map +1 -1
  277. package/dist/cli/commands/derive.d.ts.map +1 -1
  278. package/dist/cli/commands/derive.js +22 -22
  279. package/dist/cli/commands/derive.js.map +1 -1
  280. package/dist/cli/commands/discover.d.ts.map +1 -1
  281. package/dist/cli/commands/discover.js +6 -2
  282. package/dist/cli/commands/discover.js.map +1 -1
  283. package/dist/cli/commands/eval.d.ts.map +1 -1
  284. package/dist/cli/commands/eval.js +1 -0
  285. package/dist/cli/commands/eval.js.map +1 -1
  286. package/dist/cli/commands/evaluate.d.ts.map +1 -1
  287. package/dist/cli/commands/evaluate.js +65 -37
  288. package/dist/cli/commands/evaluate.js.map +1 -1
  289. package/dist/cli/commands/explain.d.ts.map +1 -1
  290. package/dist/cli/commands/explain.js +2 -1
  291. package/dist/cli/commands/explain.js.map +1 -1
  292. package/dist/cli/commands/ground.d.ts.map +1 -1
  293. package/dist/cli/commands/ground.js +1 -0
  294. package/dist/cli/commands/ground.js.map +1 -1
  295. package/dist/cli/commands/map.d.ts.map +1 -1
  296. package/dist/cli/commands/map.js +75 -5
  297. package/dist/cli/commands/map.js.map +1 -1
  298. package/dist/cli/commands/metric.d.ts.map +1 -1
  299. package/dist/cli/commands/metric.js +12 -9
  300. package/dist/cli/commands/metric.js.map +1 -1
  301. package/dist/cli/commands/path.d.ts +10 -0
  302. package/dist/cli/commands/path.d.ts.map +1 -1
  303. package/dist/cli/commands/path.js +25 -3
  304. package/dist/cli/commands/path.js.map +1 -1
  305. package/dist/cli/commands/probe.d.ts.map +1 -1
  306. package/dist/cli/commands/probe.js +59 -16
  307. package/dist/cli/commands/probe.js.map +1 -1
  308. package/dist/cli/commands/regime.d.ts.map +1 -1
  309. package/dist/cli/commands/regime.js +1 -0
  310. package/dist/cli/commands/regime.js.map +1 -1
  311. package/dist/cli/commands/retrieve.d.ts.map +1 -1
  312. package/dist/cli/commands/retrieve.js +1 -0
  313. package/dist/cli/commands/retrieve.js.map +1 -1
  314. package/dist/cli/commands/search.d.ts.map +1 -1
  315. package/dist/cli/commands/search.js +1 -0
  316. package/dist/cli/commands/search.js.map +1 -1
  317. package/dist/cli/commands/symbolic.d.ts.map +1 -1
  318. package/dist/cli/commands/symbolic.js +19 -28
  319. package/dist/cli/commands/symbolic.js.map +1 -1
  320. package/dist/cli/commands/testplan.d.ts.map +1 -1
  321. package/dist/cli/commands/testplan.js +4 -2
  322. package/dist/cli/commands/testplan.js.map +1 -1
  323. package/dist/cli/expr-print.d.ts +0 -2
  324. package/dist/cli/expr-print.d.ts.map +1 -1
  325. package/dist/cli/expr-print.js +7 -31
  326. package/dist/cli/expr-print.js.map +1 -1
  327. package/dist/cli/main.d.ts +7 -0
  328. package/dist/cli/main.d.ts.map +1 -1
  329. package/dist/cli/main.js +18 -3
  330. package/dist/cli/main.js.map +1 -1
  331. package/dist/cli/numeric-flag.d.ts +12 -0
  332. package/dist/cli/numeric-flag.d.ts.map +1 -0
  333. package/dist/cli/numeric-flag.js +44 -0
  334. package/dist/cli/numeric-flag.js.map +1 -0
  335. package/dist/cli/output.d.ts +20 -0
  336. package/dist/cli/output.d.ts.map +1 -1
  337. package/dist/cli/output.js +15 -0
  338. package/dist/cli/output.js.map +1 -1
  339. package/dist/cli/record-reach.js +2 -2
  340. package/dist/cli/record-reach.js.map +1 -1
  341. package/dist/cli/record-tables.d.ts.map +1 -1
  342. package/dist/cli/record-tables.js +6 -5
  343. package/dist/cli/record-tables.js.map +1 -1
  344. package/dist/cli/record.d.ts +1 -5
  345. package/dist/cli/record.d.ts.map +1 -1
  346. package/dist/cli/record.js +9 -8
  347. package/dist/cli/record.js.map +1 -1
  348. package/dist/cli/search-index.d.ts.map +1 -1
  349. package/dist/cli/search-index.js +7 -6
  350. package/dist/cli/search-index.js.map +1 -1
  351. package/dist/cli/statuses.d.ts +0 -2
  352. package/dist/cli/statuses.d.ts.map +1 -1
  353. package/dist/cli/statuses.js +0 -7
  354. package/dist/cli/statuses.js.map +1 -1
  355. package/dist/cli/stored-results.d.ts +7 -0
  356. package/dist/cli/stored-results.d.ts.map +1 -0
  357. package/dist/cli/stored-results.js +23 -0
  358. package/dist/cli/stored-results.js.map +1 -0
  359. package/dist/cli/version.d.ts.map +1 -1
  360. package/dist/cli/version.js +7 -5
  361. package/dist/cli/version.js.map +1 -1
  362. package/dist/cli-api.d.ts +34 -5
  363. package/dist/cli-api.d.ts.map +1 -1
  364. package/dist/cli-api.js +28 -4
  365. package/dist/cli-api.js.map +1 -1
  366. package/dist/composition/algebraic-equivalence.d.ts +43 -0
  367. package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
  368. package/dist/composition/algebraic-equivalence.js +115 -0
  369. package/dist/composition/algebraic-equivalence.js.map +1 -0
  370. package/dist/composition/axes.d.ts +0 -6
  371. package/dist/composition/axes.d.ts.map +1 -1
  372. package/dist/composition/axes.js +6 -6
  373. package/dist/composition/axes.js.map +1 -1
  374. package/dist/composition/axis-audit.d.ts +47 -20
  375. package/dist/composition/axis-audit.d.ts.map +1 -1
  376. package/dist/composition/axis-audit.js +82 -9
  377. package/dist/composition/axis-audit.js.map +1 -1
  378. package/dist/composition/bridge-analysis.d.ts +17 -0
  379. package/dist/composition/bridge-analysis.d.ts.map +1 -1
  380. package/dist/composition/bridge-analysis.js +102 -55
  381. package/dist/composition/bridge-analysis.js.map +1 -1
  382. package/dist/composition/canonical-compare.d.ts +40 -0
  383. package/dist/composition/canonical-compare.d.ts.map +1 -1
  384. package/dist/composition/canonical-compare.js +122 -24
  385. package/dist/composition/canonical-compare.js.map +1 -1
  386. package/dist/composition/canonical-graph.d.ts +1 -1
  387. package/dist/composition/canonical-graph.d.ts.map +1 -1
  388. package/dist/composition/canonical-graph.js +9 -36
  389. package/dist/composition/canonical-graph.js.map +1 -1
  390. package/dist/composition/canonical-json.js +2 -2
  391. package/dist/composition/canonical-json.js.map +1 -1
  392. package/dist/composition/catalog-graph.d.ts.map +1 -1
  393. package/dist/composition/catalog-graph.js +2 -5
  394. package/dist/composition/catalog-graph.js.map +1 -1
  395. package/dist/composition/chain-candidate.d.ts +8 -0
  396. package/dist/composition/chain-candidate.d.ts.map +1 -1
  397. package/dist/composition/chain-candidate.js +9 -2
  398. package/dist/composition/chain-candidate.js.map +1 -1
  399. package/dist/composition/chain-match.d.ts +6 -3
  400. package/dist/composition/chain-match.d.ts.map +1 -1
  401. package/dist/composition/chain-match.js +4 -1
  402. package/dist/composition/chain-match.js.map +1 -1
  403. package/dist/composition/chain-result.d.ts.map +1 -1
  404. package/dist/composition/chain-result.js +2 -14
  405. package/dist/composition/chain-result.js.map +1 -1
  406. package/dist/composition/compose-symbolic.d.ts.map +1 -1
  407. package/dist/composition/compose-symbolic.js +3 -2
  408. package/dist/composition/compose-symbolic.js.map +1 -1
  409. package/dist/composition/compose.d.ts.map +1 -1
  410. package/dist/composition/compose.js +13 -5
  411. package/dist/composition/compose.js.map +1 -1
  412. package/dist/composition/composition-recovery.d.ts.map +1 -1
  413. package/dist/composition/composition-recovery.js +4 -7
  414. package/dist/composition/composition-recovery.js.map +1 -1
  415. package/dist/composition/discovery.d.ts +56 -0
  416. package/dist/composition/discovery.d.ts.map +1 -1
  417. package/dist/composition/discovery.js +114 -60
  418. package/dist/composition/discovery.js.map +1 -1
  419. package/dist/composition/edge.d.ts +21 -2
  420. package/dist/composition/edge.d.ts.map +1 -1
  421. package/dist/composition/edge.js +23 -1
  422. package/dist/composition/edge.js.map +1 -1
  423. package/dist/composition/enumerate.d.ts.map +1 -1
  424. package/dist/composition/enumerate.js +18 -3
  425. package/dist/composition/enumerate.js.map +1 -1
  426. package/dist/composition/evaluate-relation.d.ts +35 -11
  427. package/dist/composition/evaluate-relation.d.ts.map +1 -1
  428. package/dist/composition/evaluate-relation.js +60 -39
  429. package/dist/composition/evaluate-relation.js.map +1 -1
  430. package/dist/composition/explain.d.ts +3 -12
  431. package/dist/composition/explain.d.ts.map +1 -1
  432. package/dist/composition/explain.js +7 -20
  433. package/dist/composition/explain.js.map +1 -1
  434. package/dist/composition/expr-eval.d.ts.map +1 -1
  435. package/dist/composition/expr-eval.js +2 -11
  436. package/dist/composition/expr-eval.js.map +1 -1
  437. package/dist/composition/expr-simplify.d.ts +16 -0
  438. package/dist/composition/expr-simplify.d.ts.map +1 -1
  439. package/dist/composition/expr-simplify.js +15 -20
  440. package/dist/composition/expr-simplify.js.map +1 -1
  441. package/dist/composition/formula-shape.d.ts +23 -4
  442. package/dist/composition/formula-shape.d.ts.map +1 -1
  443. package/dist/composition/formula-shape.js +57 -17
  444. package/dist/composition/formula-shape.js.map +1 -1
  445. package/dist/composition/graph-structure.d.ts +98 -0
  446. package/dist/composition/graph-structure.d.ts.map +1 -0
  447. package/dist/composition/graph-structure.js +167 -0
  448. package/dist/composition/graph-structure.js.map +1 -0
  449. package/dist/composition/graph-viz-svg.d.ts.map +1 -1
  450. package/dist/composition/graph-viz-svg.js +1 -1
  451. package/dist/composition/graph-viz-svg.js.map +1 -1
  452. package/dist/composition/graph-viz.d.ts.map +1 -1
  453. package/dist/composition/graph-viz.js +8 -37
  454. package/dist/composition/graph-viz.js.map +1 -1
  455. package/dist/composition/identifiability.d.ts +91 -4
  456. package/dist/composition/identifiability.d.ts.map +1 -1
  457. package/dist/composition/identifiability.js +363 -6
  458. package/dist/composition/identifiability.js.map +1 -1
  459. package/dist/composition/index.d.ts +8 -4
  460. package/dist/composition/index.d.ts.map +1 -1
  461. package/dist/composition/index.js +3 -2
  462. package/dist/composition/index.js.map +1 -1
  463. package/dist/composition/mathts-quiet.d.ts +4 -3
  464. package/dist/composition/mathts-quiet.d.ts.map +1 -1
  465. package/dist/composition/mathts-quiet.js +4 -3
  466. package/dist/composition/mathts-quiet.js.map +1 -1
  467. package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
  468. package/dist/composition/mathts-scalar-symbols.js +2 -1
  469. package/dist/composition/mathts-scalar-symbols.js.map +1 -1
  470. package/dist/composition/probe/corpus.d.ts +4 -2
  471. package/dist/composition/probe/corpus.d.ts.map +1 -1
  472. package/dist/composition/probe/corpus.js +20 -9
  473. package/dist/composition/probe/corpus.js.map +1 -1
  474. package/dist/composition/probe/dataset.d.ts +17 -0
  475. package/dist/composition/probe/dataset.d.ts.map +1 -1
  476. package/dist/composition/probe/dataset.js +95 -50
  477. package/dist/composition/probe/dataset.js.map +1 -1
  478. package/dist/composition/probe/experiment-design.d.ts +5 -1
  479. package/dist/composition/probe/experiment-design.d.ts.map +1 -1
  480. package/dist/composition/probe/experiment-design.js +44 -24
  481. package/dist/composition/probe/experiment-design.js.map +1 -1
  482. package/dist/composition/probe/falsify.d.ts.map +1 -1
  483. package/dist/composition/probe/falsify.js +2 -0
  484. package/dist/composition/probe/falsify.js.map +1 -1
  485. package/dist/composition/probe/fit.d.ts +6 -0
  486. package/dist/composition/probe/fit.d.ts.map +1 -1
  487. package/dist/composition/probe/fit.js +46 -22
  488. package/dist/composition/probe/fit.js.map +1 -1
  489. package/dist/composition/probe/frontier.d.ts.map +1 -1
  490. package/dist/composition/probe/frontier.js +33 -15
  491. package/dist/composition/probe/frontier.js.map +1 -1
  492. package/dist/composition/probe/generator.d.ts +27 -1
  493. package/dist/composition/probe/generator.d.ts.map +1 -1
  494. package/dist/composition/probe/generator.js +53 -30
  495. package/dist/composition/probe/generator.js.map +1 -1
  496. package/dist/composition/probe/index.d.ts +14 -0
  497. package/dist/composition/probe/index.d.ts.map +1 -1
  498. package/dist/composition/probe/index.js +6 -0
  499. package/dist/composition/probe/index.js.map +1 -1
  500. package/dist/composition/probe/limits.d.ts +24 -1
  501. package/dist/composition/probe/limits.d.ts.map +1 -1
  502. package/dist/composition/probe/limits.js +53 -11
  503. package/dist/composition/probe/limits.js.map +1 -1
  504. package/dist/composition/probe/pipeline.d.ts.map +1 -1
  505. package/dist/composition/probe/pipeline.js +10 -4
  506. package/dist/composition/probe/pipeline.js.map +1 -1
  507. package/dist/composition/probe/power-law.d.ts +121 -0
  508. package/dist/composition/probe/power-law.d.ts.map +1 -0
  509. package/dist/composition/probe/power-law.js +255 -0
  510. package/dist/composition/probe/power-law.js.map +1 -0
  511. package/dist/composition/probe/problem.d.ts +7 -4
  512. package/dist/composition/probe/problem.d.ts.map +1 -1
  513. package/dist/composition/probe/problem.js +177 -49
  514. package/dist/composition/probe/problem.js.map +1 -1
  515. package/dist/composition/probe/report.js +1 -1
  516. package/dist/composition/probe/report.js.map +1 -1
  517. package/dist/composition/probe/residual.d.ts +6 -1
  518. package/dist/composition/probe/residual.d.ts.map +1 -1
  519. package/dist/composition/probe/residual.js +9 -7
  520. package/dist/composition/probe/residual.js.map +1 -1
  521. package/dist/composition/probe/structure.d.ts +82 -17
  522. package/dist/composition/probe/structure.d.ts.map +1 -1
  523. package/dist/composition/probe/structure.js +129 -55
  524. package/dist/composition/probe/structure.js.map +1 -1
  525. package/dist/composition/probe/study.d.ts +31 -9
  526. package/dist/composition/probe/study.d.ts.map +1 -1
  527. package/dist/composition/probe/study.js +236 -181
  528. package/dist/composition/probe/study.js.map +1 -1
  529. package/dist/composition/probe/t-tail.d.ts +17 -0
  530. package/dist/composition/probe/t-tail.d.ts.map +1 -0
  531. package/dist/composition/probe/t-tail.js +32 -0
  532. package/dist/composition/probe/t-tail.js.map +1 -0
  533. package/dist/composition/probe/types.d.ts +3 -0
  534. package/dist/composition/probe/types.d.ts.map +1 -1
  535. package/dist/composition/probe/types.js.map +1 -1
  536. package/dist/composition/proposed-bridges.d.ts +41 -10
  537. package/dist/composition/proposed-bridges.d.ts.map +1 -1
  538. package/dist/composition/proposed-bridges.js +100 -55
  539. package/dist/composition/proposed-bridges.js.map +1 -1
  540. package/dist/composition/quantity-clusters.d.ts +48 -0
  541. package/dist/composition/quantity-clusters.d.ts.map +1 -0
  542. package/dist/composition/quantity-clusters.js +98 -0
  543. package/dist/composition/quantity-clusters.js.map +1 -0
  544. package/dist/composition/rational-exponent.d.ts +40 -0
  545. package/dist/composition/rational-exponent.d.ts.map +1 -0
  546. package/dist/composition/rational-exponent.js +65 -0
  547. package/dist/composition/rational-exponent.js.map +1 -0
  548. package/dist/composition/representative-values.d.ts +22 -0
  549. package/dist/composition/representative-values.d.ts.map +1 -1
  550. package/dist/composition/representative-values.js +23 -0
  551. package/dist/composition/representative-values.js.map +1 -1
  552. package/dist/composition/retrodiction.d.ts.map +1 -1
  553. package/dist/composition/retrodiction.js +2 -1
  554. package/dist/composition/retrodiction.js.map +1 -1
  555. package/dist/composition/user-equation.d.ts.map +1 -1
  556. package/dist/composition/user-equation.js +2 -2
  557. package/dist/composition/user-equation.js.map +1 -1
  558. package/dist/core/assignment.d.ts +19 -0
  559. package/dist/core/assignment.d.ts.map +1 -0
  560. package/dist/core/assignment.js +19 -0
  561. package/dist/core/assignment.js.map +1 -0
  562. package/dist/core/compare.d.ts +32 -0
  563. package/dist/core/compare.d.ts.map +1 -0
  564. package/dist/core/compare.js +46 -0
  565. package/dist/core/compare.js.map +1 -0
  566. package/dist/core/constants.d.ts +30 -30
  567. package/dist/core/constants.d.ts.map +1 -1
  568. package/dist/core/constants.js +47 -30
  569. package/dist/core/constants.js.map +1 -1
  570. package/dist/core/data-file.d.ts +7 -0
  571. package/dist/core/data-file.d.ts.map +1 -1
  572. package/dist/core/data-file.js +17 -0
  573. package/dist/core/data-file.js.map +1 -1
  574. package/dist/core/format.d.ts +36 -0
  575. package/dist/core/format.d.ts.map +1 -0
  576. package/dist/core/format.js +39 -0
  577. package/dist/core/format.js.map +1 -0
  578. package/dist/core/hash.d.ts +14 -0
  579. package/dist/core/hash.d.ts.map +1 -0
  580. package/dist/core/hash.js +17 -0
  581. package/dist/core/hash.js.map +1 -0
  582. package/dist/core/json-schema.d.ts +2 -0
  583. package/dist/core/json-schema.d.ts.map +1 -1
  584. package/dist/core/json-schema.js +14 -13
  585. package/dist/core/json-schema.js.map +1 -1
  586. package/dist/core/labeled-tensor.d.ts.map +1 -1
  587. package/dist/core/labeled-tensor.js +0 -8
  588. package/dist/core/labeled-tensor.js.map +1 -1
  589. package/dist/core/mathts-read.d.ts +25 -0
  590. package/dist/core/mathts-read.d.ts.map +1 -0
  591. package/dist/core/mathts-read.js +51 -0
  592. package/dist/core/mathts-read.js.map +1 -0
  593. package/dist/core/tensor.d.ts.map +1 -1
  594. package/dist/core/tensor.js +24 -0
  595. package/dist/core/tensor.js.map +1 -1
  596. package/dist/core/types.d.ts +5 -5
  597. package/dist/diff/bridge-gradient.d.ts +19 -6
  598. package/dist/diff/bridge-gradient.d.ts.map +1 -1
  599. package/dist/diff/bridge-gradient.js +19 -11
  600. package/dist/diff/bridge-gradient.js.map +1 -1
  601. package/dist/diff/bridge-specs.d.ts.map +1 -1
  602. package/dist/diff/bridge-specs.js +3 -0
  603. package/dist/diff/bridge-specs.js.map +1 -1
  604. package/dist/dimensional/algebra.d.ts +18 -0
  605. package/dist/dimensional/algebra.d.ts.map +1 -1
  606. package/dist/dimensional/algebra.js +41 -1
  607. package/dist/dimensional/algebra.js.map +1 -1
  608. package/dist/dimensional/ast-builders.d.ts +7 -0
  609. package/dist/dimensional/ast-builders.d.ts.map +1 -1
  610. package/dist/dimensional/ast-builders.js +11 -0
  611. package/dist/dimensional/ast-builders.js.map +1 -1
  612. package/dist/dimensional/ast-leaves.d.ts +81 -0
  613. package/dist/dimensional/ast-leaves.d.ts.map +1 -0
  614. package/dist/dimensional/ast-leaves.js +146 -0
  615. package/dist/dimensional/ast-leaves.js.map +1 -0
  616. package/dist/dimensional/buckingham.d.ts.map +1 -1
  617. package/dist/dimensional/buckingham.js +15 -27
  618. package/dist/dimensional/buckingham.js.map +1 -1
  619. package/dist/dimensional/constant-rows.js +9 -9
  620. package/dist/dimensional/constant-rows.js.map +1 -1
  621. package/dist/dimensional/dimension-inference.d.ts.map +1 -1
  622. package/dist/dimensional/dimension-inference.js +1 -2
  623. package/dist/dimensional/dimension-inference.js.map +1 -1
  624. package/dist/dimensional/errors.d.ts +1 -1
  625. package/dist/dimensional/errors.d.ts.map +1 -1
  626. package/dist/dimensional/errors.js +1 -15
  627. package/dist/dimensional/errors.js.map +1 -1
  628. package/dist/dimensional/exact-scale.d.ts +0 -17
  629. package/dist/dimensional/exact-scale.d.ts.map +1 -1
  630. package/dist/dimensional/exact-scale.js +8 -8
  631. package/dist/dimensional/exact-scale.js.map +1 -1
  632. package/dist/dimensional/gauge-field.d.ts.map +1 -1
  633. package/dist/dimensional/gauge-field.js +2 -2
  634. package/dist/dimensional/gauge-field.js.map +1 -1
  635. package/dist/dimensional/hyphen-names.d.ts +12 -2
  636. package/dist/dimensional/hyphen-names.d.ts.map +1 -1
  637. package/dist/dimensional/hyphen-names.js +44 -19
  638. package/dist/dimensional/hyphen-names.js.map +1 -1
  639. package/dist/dimensional/metric.d.ts.map +1 -1
  640. package/dist/dimensional/metric.js +0 -1
  641. package/dist/dimensional/metric.js.map +1 -1
  642. package/dist/dimensional/symbolic-constants.d.ts +9 -0
  643. package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
  644. package/dist/dimensional/symbolic-constants.js +13 -1
  645. package/dist/dimensional/symbolic-constants.js.map +1 -1
  646. package/dist/dimensional/types.d.ts +36 -0
  647. package/dist/dimensional/types.d.ts.map +1 -1
  648. package/dist/dimensional/types.js +45 -7
  649. package/dist/dimensional/types.js.map +1 -1
  650. package/dist/dimensional/unit-data.js +2 -2
  651. package/dist/dimensional/unit-data.js.map +1 -1
  652. package/dist/index.d.ts +9 -3
  653. package/dist/index.d.ts.map +1 -1
  654. package/dist/index.js +10 -4
  655. package/dist/index.js.map +1 -1
  656. package/dist/numerical/christoffel-flat.d.ts.map +1 -1
  657. package/dist/numerical/christoffel-flat.js +3 -2
  658. package/dist/numerical/christoffel-flat.js.map +1 -1
  659. package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
  660. package/dist/numerical/covariant-eikonal.js +34 -11
  661. package/dist/numerical/covariant-eikonal.js.map +1 -1
  662. package/dist/numerical/curvature-lowering-helpers.js +3 -2
  663. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  664. package/dist/numerical/errors.d.ts.map +1 -1
  665. package/dist/numerical/errors.js +0 -3
  666. package/dist/numerical/errors.js.map +1 -1
  667. package/dist/numerical/finite-difference.d.ts +22 -0
  668. package/dist/numerical/finite-difference.d.ts.map +1 -0
  669. package/dist/numerical/finite-difference.js +27 -0
  670. package/dist/numerical/finite-difference.js.map +1 -0
  671. package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
  672. package/dist/numerical/geodesic-integrator.js +22 -14
  673. package/dist/numerical/geodesic-integrator.js.map +1 -1
  674. package/dist/numerical/geometrized.d.ts.map +1 -1
  675. package/dist/numerical/geometrized.js +0 -1
  676. package/dist/numerical/geometrized.js.map +1 -1
  677. package/dist/numerical/mathts-engine.d.ts.map +1 -1
  678. package/dist/numerical/mathts-engine.js +10 -24
  679. package/dist/numerical/mathts-engine.js.map +1 -1
  680. package/dist/numerical/metric-inverse.d.ts.map +1 -1
  681. package/dist/numerical/metric-inverse.js +83 -46
  682. package/dist/numerical/metric-inverse.js.map +1 -1
  683. package/dist/numerical/null-ray-integrator.d.ts +2 -1
  684. package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
  685. package/dist/numerical/null-ray-integrator.js +12 -12
  686. package/dist/numerical/null-ray-integrator.js.map +1 -1
  687. package/dist/numerical/painleve-gullstrand-metric.js +2 -2
  688. package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
  689. package/dist/numerical/perihelion-finder.d.ts +0 -36
  690. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  691. package/dist/numerical/perihelion-finder.js +41 -87
  692. package/dist/numerical/perihelion-finder.js.map +1 -1
  693. package/dist/numerical/quadrature.d.ts.map +1 -1
  694. package/dist/numerical/quadrature.js +8 -10
  695. package/dist/numerical/quadrature.js.map +1 -1
  696. package/dist/numerical/rk4-trajectory.d.ts +10 -0
  697. package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
  698. package/dist/numerical/rk4-trajectory.js +37 -0
  699. package/dist/numerical/rk4-trajectory.js.map +1 -0
  700. package/dist/numerical/schwarzschild.d.ts +14 -0
  701. package/dist/numerical/schwarzschild.d.ts.map +1 -0
  702. package/dist/numerical/schwarzschild.js +17 -0
  703. package/dist/numerical/schwarzschild.js.map +1 -0
  704. package/dist/numerical/spacetime-metrics.d.ts +12 -0
  705. package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
  706. package/dist/numerical/spacetime-metrics.js +72 -56
  707. package/dist/numerical/spacetime-metrics.js.map +1 -1
  708. package/dist/numerical/statistics.d.ts +24 -0
  709. package/dist/numerical/statistics.d.ts.map +1 -0
  710. package/dist/numerical/statistics.js +52 -0
  711. package/dist/numerical/statistics.js.map +1 -0
  712. package/dist/numerical/tensor-engine.d.ts +21 -0
  713. package/dist/numerical/tensor-engine.d.ts.map +1 -1
  714. package/dist/numerical/tensor-engine.js +12 -0
  715. package/dist/numerical/tensor-engine.js.map +1 -1
  716. package/dist/relations/regime.d.ts +10 -0
  717. package/dist/relations/regime.d.ts.map +1 -1
  718. package/dist/relations/regime.js +18 -1
  719. package/dist/relations/regime.js.map +1 -1
  720. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"frontier.js","sourceRoot":"","sources":["../../../src/composition/probe/frontier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIpE,MAAM,WAAW,GAAG,IAAI,GAAG,CACzB,wBAAwB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAClE,CAAC;AAEF;;;;GAIG;AACH,SAAS,YAAY,CAAC,CAAS,EAAE,CAAS;IACxC,MAAM,IAAI,GAAG,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxC,OA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AAM,EAAE,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB;gBACnF,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC7B,WAAW,EAAE,IAAI;gBACjB,wBAAwB,EAAE,IAAI;gBAC9B,OAAO,EAAE,YAAY;oBACnB,CAAC,CAAC,CAAC,GAAG,IAAI,oBAAoB,IAAI,iBAAiB,CAAC;oBACpD,CAAC,CAAC,CAAC,kDAAkD,CAAC;aACzD;SACF;QACD,aAAa,EAAE;YACb,UAAU,EAAE,YAAY,IAAI,IAAI,KAAK,CAAC;YACtC,OAAO,EAAE,YAAY;gBACnB,CAAC,CAAC,CAAC,qDAAqD,CAAC;gBACzD,CAAC,CAAC,IAAI,KAAK,CAAC;oBACV,CAAC,CAAC,CAAC,4EAA4E,CAAC;oBAChF,CAAC,CAAC,CAAC,kCAAkC,CAAC;SAC3C;QACD,MAAM,EAAE,YAAY,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB;KACtE,CAAC;IACF,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,MAAM;QACN,SAAS;QACT,WAAW;QACX,OAAO;QACP,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Frontier scanners — wrap Product A surfaces; residual gaps are Product B.\n *\n * @module composition/probe/frontier\n */\n\nimport { proposeLinkCandidates, proposeOrphanConnectors } from '../bridge-analysis.js';\nimport { predictMissingBridges } from '../bridge-prediction.js';\nimport { QUANTITY_IDENTIFICATIONS } from '../compose.js';\nimport { candidateId, candidateIdIfSlug } from '../adjudication.js';\nimport type { BridgeEdge } from '../edge.js';\nimport type { FrontierGap, ProbeDataset, SearchProblem } from './types.js';\n\nconst ALIAS_PAIRS = new Set(\n QUANTITY_IDENTIFICATIONS.map((id) => candidateId(id.from, id.to)),\n);\n\n/**\n * Stable pair token. Slug pairs keep the ledger id. Other symbols are\n * length-prefixed under `raw:` so a `~` inside a name cannot alias two\n * pairs, and the token cannot collide with a kebab `candidateId`.\n */\nfunction gapPairToken(a: string, b: string): string {\n const slug = candidateIdIfSlug(a, b);\n if (slug !== undefined) return slug;\n const [x, y] = a <= b ? [a, b] : [b, a];\n return `raw:${x.length}:${x}~${y.length}:${y}`;\n}\n\nfunction linkGapId(a: string, b: string): string {\n return `fg-link-${gapPairToken(a, b)}`;\n}\n\n/**\n * Project Product A link candidates to `relation-link` gaps.\n * Registered quantity identifications are not gaps.\n *\n * @internal\n */\nexport function wrapRelationLinkGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n const out: FrontierGap[] = [];\n for (const c of proposeLinkCandidates(edges)) {\n const slug = candidateIdIfSlug(c.a, c.b);\n if (slug !== undefined && ALIAS_PAIRS.has(slug)) continue;\n out.push({\n id: linkGapId(c.a, c.b),\n kind: 'relation-link',\n participants: [\n { kind: 'quantity-identification', id: c.a },\n { kind: 'quantity-identification', id: c.b },\n ],\n observations: [],\n regimes: [],\n assumptions: [],\n constraints: [`dim:${c.dim}`],\n evidence: {\n summary: `${c.a} ≟ ${c.b} share ${c.dim}`,\n sourceIds: ['upt candidates'],\n },\n identifiability: {\n kind: 'graph-structural',\n parametric: {\n status: 'unknown',\n reasons: ['identification gaps are Product A — use upt discover'],\n },\n },\n searchability: {\n searchable: false,\n reasons: ['relation-link gaps are reviewed by upt discover, not probe search'],\n },\n status: 'identified',\n });\n }\n return out.sort((x, y) => x.id.localeCompare(y.id));\n}\n\n/** Isolated-bridge connectors as relation-link gaps. @internal */\nexport function wrapConnectorGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n const report = proposeOrphanConnectors(edges);\n return report.connectors.map((c) => ({\n id: `fg-conn-${gapPairToken(c.orphanQuantity, c.coreQuantity)}`,\n kind: 'relation-link' as const,\n participants: [\n { kind: 'quantity-identification' as const, id: c.orphanQuantity },\n { kind: 'quantity-identification' as const, id: c.coreQuantity },\n ],\n observations: [],\n regimes: [c.orphanEdge, c.coreEdge],\n assumptions: [],\n constraints: [`dim:${c.dim}`],\n evidence: {\n summary: `orphan ${c.orphanEdge} ≟ core via ${c.orphanQuantity}~${c.coreQuantity}`,\n sourceIds: ['upt connectors'],\n },\n identifiability: {\n kind: 'graph-structural' as const,\n parametric: { status: 'unknown' as const, reasons: ['Product A connector'] },\n },\n searchability: {\n searchable: false,\n reasons: ['connectors are Product A review surfaces'],\n },\n status: 'identified' as const,\n }));\n}\n\n/** Empty (scale×force) cells as regime-transition gaps. @internal */\nexport function wrapRegimeGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n const report = predictMissingBridges(edges);\n return report.predictions.map((p, i) => ({\n id: `fg-regime-${i}-${hashSlug(p.regimeA)}-${hashSlug(p.regimeB)}`,\n kind: 'regime-transition' as const,\n participants: [],\n observations: [],\n regimes: [p.regimeA, p.regimeB],\n assumptions: [],\n constraints: [`sharedNeighbors:${p.sharedNeighbors}`],\n evidence: {\n summary: `empty regime pair ${p.regimeA} ↔ ${p.regimeB} via ${p.via.join(',')}`,\n sourceIds: ['upt predict'],\n },\n identifiability: {\n kind: 'graph-structural' as const,\n parametric: { status: 'unknown' as const, reasons: ['structural triadic closure only'] },\n },\n searchability: {\n searchable: false,\n reasons: ['regime predictions are structural hypotheses, not expression searches'],\n },\n status: 'identified' as const,\n }));\n}\n\nfunction hashSlug(s: string): string {\n return s.replace(/[^a-z0-9]+/gi, '-').replace(/^-|-$/g, '').slice(0, 40);\n}\n\n/** Combined read-only frontier (Product A wrappers). @internal */\nexport function scanFrontier(edges: readonly BridgeEdge[]): FrontierGap[] {\n return [...wrapRelationLinkGaps(edges), ...wrapConnectorGaps(edges), ...wrapRegimeGaps(edges)];\n}\n\n/** Look up a wrapped gap by id. @internal */\nexport function findFrontierGap(\n edges: readonly BridgeEdge[],\n id: string,\n): FrontierGap | undefined {\n return scanFrontier(edges).find((g) => g.id === id);\n}\n\n/**\n * Build a Product B search problem for an unexplained-observation /\n * prediction-residual gap. Relation-link and regime-transition gaps are\n * refused; the error names `upt discover`.\n *\n * @internal\n */\nexport function problemFromResidualGap(\n gap: FrontierGap,\n target: SearchProblem['target'],\n governing: SearchProblem['governing'],\n exploratory?: ProbeDataset,\n holdout?: ProbeDataset,\n): SearchProblem {\n if (gap.kind === 'relation-link' || gap.kind === 'regime-transition') {\n throw new RangeError(\n `problemFromResidualGap: ${gap.kind} is not a Product B search target; use upt discover`,\n );\n }\n const nObs = exploratory?.rows.length ?? 0;\n const nPar = 1;\n const identifiable = nObs >= nPar && nObs > 0;\n const enriched: FrontierGap = {\n ...gap,\n identifiability: {\n kind: 'parametric',\n parametric: {\n status: identifiable ? 'identifiable' : nObs === 0 ? 'unknown' : 'non-identifiable',\n rank: identifiable ? nPar : 0,\n nParameters: nPar,\n nIndependentObservations: nObs,\n reasons: identifiable\n ? [`${nObs} observations vs ${nPar} free prefactor`]\n : ['insufficient observations for a unique prefactor'],\n },\n },\n searchability: {\n searchable: identifiable || nObs === 0,\n reasons: identifiable\n ? ['parametric rank sufficient for a monomial prefactor']\n : nObs === 0\n ? ['no data — structural generation only; status will be insufficient-evidence']\n : ['non-identifiable — do not search'],\n },\n status: identifiable || nObs === 0 ? 'searchable' : 'underdetermined',\n };\n return {\n gap: enriched,\n target,\n governing,\n exploratory,\n holdout,\n discrepancy: gap.discrepancy,\n assumptions: gap.assumptions,\n };\n}\n"]}
1
+ {"version":3,"file":"frontier.js","sourceRoot":"","sources":["../../../src/composition/probe/frontier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,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,CAAC,cAAc,CAAC;IAChF,MAAM,OAAO,GACX,MAAM,KAAK,SAAS;QAClB,CAAC,CAAC,CAAC,+CAA+C,CAAC;QACnD,CAAC,CAAC,MAAM,KAAK,cAAc;YACzB,CAAC,CAAC,CAAC,QAAQ,IAAI,2BAA2B,MAAM,CAAC,IAAI,qBAAqB,IAAI,KAAK,UAAU,eAAe,CAAC;YAC7G,CAAC,CAAC;gBACE,QAAQ,IAAI,2BAA2B,MAAM,CAAC,IAAI,qBAAqB,IAAI,KAAK,MAAM,CAAC,OAAO,iCAAiC;oBAC7H,WAAW,IAAI,gBAAgB,UAAU,8FAA8F;aAC1I,CAAC;IACV,MAAM,QAAQ,GAAgB;QAC5B,GAAG,GAAG;QACN,eAAe,EAAE;YACf,IAAI,EAAE,YAAY;YAClB,UAAU,EAAE;gBACV,MAAM;gBACN,IAAI;gBACJ,WAAW,EAAE,IAAI;gBACjB,wBAAwB,EAAE,IAAI;gBAC9B,aAAa,EAAE,IAAI;gBACnB,OAAO;aACR;SACF;QACD,aAAa,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,OAAO,EACL,MAAM,KAAK,SAAS;gBAClB,CAAC,CAAC,CAAC,4EAA4E,CAAC;gBAChF,CAAC,CAAC,MAAM,KAAK,cAAc;oBACzB,CAAC,CAAC,CAAC,+EAA+E,CAAC;oBACnF,CAAC,CAAC,CAAC,yGAAyG,CAAC;SACpH;QACD,MAAM,EAAE,YAAY;KACrB,CAAC;IACF,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,MAAM;QACN,SAAS;QACT,WAAW;QACX,OAAO;QACP,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Frontier scanners — wrap Product A surfaces; residual gaps are Product B.\n *\n * @module composition/probe/frontier\n */\n\nimport { proposeLinkCandidates, proposeOrphanConnectors } from '../bridge-analysis.js';\nimport { predictMissingBridges } from '../bridge-prediction.js';\nimport { QUANTITY_IDENTIFICATIONS } from '../compose.js';\nimport { candidateId, candidateIdIfSlug } from '../adjudication.js';\nimport type { BridgeEdge } from '../edge.js';\nimport type { FrontierGap, ProbeDataset, SearchProblem } from './types.js';\nimport { logDesign, logDesignRank, piStructure } from './power-law.js';\n\nconst ALIAS_PAIRS = new Set(\n QUANTITY_IDENTIFICATIONS.map((id) => candidateId(id.from, id.to)),\n);\n\n/**\n * Stable pair token. Slug pairs keep the ledger id. Other symbols are\n * length-prefixed under `raw:` so a `~` inside a name cannot alias two\n * pairs, and the token cannot collide with a kebab `candidateId`.\n */\nfunction gapPairToken(a: string, b: string): string {\n const slug = candidateIdIfSlug(a, b);\n if (slug !== undefined) return slug;\n const [x, y] = a <= b ? [a, b] : [b, a];\n return `raw:${x.length}:${x}~${y.length}:${y}`;\n}\n\nfunction linkGapId(a: string, b: string): string {\n return `fg-link-${gapPairToken(a, b)}`;\n}\n\n/**\n * Project Product A link candidates to `relation-link` gaps.\n * Registered quantity identifications are not gaps.\n *\n * @internal\n */\nexport function wrapRelationLinkGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n const out: FrontierGap[] = [];\n for (const c of proposeLinkCandidates(edges)) {\n const slug = candidateIdIfSlug(c.a, c.b);\n if (slug !== undefined && ALIAS_PAIRS.has(slug)) continue;\n out.push({\n id: linkGapId(c.a, c.b),\n kind: 'relation-link',\n participants: [\n { kind: 'quantity-identification', id: c.a },\n { kind: 'quantity-identification', id: c.b },\n ],\n observations: [],\n regimes: [],\n assumptions: [],\n constraints: [`dim:${c.dim}`],\n evidence: {\n summary: `${c.a} ≟ ${c.b} share ${c.dim}`,\n sourceIds: ['upt candidates'],\n },\n identifiability: {\n kind: 'graph-structural',\n parametric: {\n status: 'unknown',\n reasons: ['identification gaps are Product A — use upt discover'],\n },\n },\n searchability: {\n searchable: false,\n reasons: ['relation-link gaps are reviewed by upt discover, not probe search'],\n },\n status: 'identified',\n });\n }\n return out.sort((x, y) => x.id.localeCompare(y.id));\n}\n\n/** Isolated-bridge connectors as relation-link gaps. @internal */\nexport function wrapConnectorGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n const report = proposeOrphanConnectors(edges);\n return report.connectors.map((c) => ({\n id: `fg-conn-${gapPairToken(c.orphanQuantity, c.coreQuantity)}`,\n kind: 'relation-link' as const,\n participants: [\n { kind: 'quantity-identification' as const, id: c.orphanQuantity },\n { kind: 'quantity-identification' as const, id: c.coreQuantity },\n ],\n observations: [],\n regimes: [c.orphanEdge, c.coreEdge],\n assumptions: [],\n constraints: [`dim:${c.dim}`],\n evidence: {\n summary: `orphan ${c.orphanEdge} ≟ core via ${c.orphanQuantity}~${c.coreQuantity}`,\n sourceIds: ['upt connectors'],\n },\n identifiability: {\n kind: 'graph-structural' as const,\n parametric: { status: 'unknown' as const, reasons: ['Product A connector'] },\n },\n searchability: {\n searchable: false,\n reasons: ['connectors are Product A review surfaces'],\n },\n status: 'identified' as const,\n }));\n}\n\n/** Empty (scale×force) cells as regime-transition gaps. @internal */\nexport function wrapRegimeGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n const report = predictMissingBridges(edges);\n return report.predictions.map((p, i) => ({\n id: `fg-regime-${i}-${hashSlug(p.regimeA)}-${hashSlug(p.regimeB)}`,\n kind: 'regime-transition' as const,\n participants: [],\n observations: [],\n regimes: [p.regimeA, p.regimeB],\n assumptions: [],\n constraints: [`sharedNeighbors:${p.sharedNeighbors}`],\n evidence: {\n summary: `empty regime pair ${p.regimeA} ↔ ${p.regimeB} via ${p.via.join(',')}`,\n sourceIds: ['upt predict'],\n },\n identifiability: {\n kind: 'graph-structural' as const,\n parametric: { status: 'unknown' as const, reasons: ['structural triadic closure only'] },\n },\n searchability: {\n searchable: false,\n reasons: ['regime predictions are structural hypotheses, not expression searches'],\n },\n status: 'identified' as const,\n }));\n}\n\nfunction hashSlug(s: string): string {\n return s.replace(/[^a-z0-9]+/gi, '-').replace(/^-|-$/g, '').slice(0, 40);\n}\n\n/** Combined read-only frontier (Product A wrappers). @internal */\nexport function scanFrontier(edges: readonly BridgeEdge[]): FrontierGap[] {\n return [...wrapRelationLinkGaps(edges), ...wrapConnectorGaps(edges), ...wrapRegimeGaps(edges)];\n}\n\n/** Look up a wrapped gap by id. @internal */\nexport function findFrontierGap(\n edges: readonly BridgeEdge[],\n id: string,\n): FrontierGap | undefined {\n return scanFrontier(edges).find((g) => g.id === id);\n}\n\n/**\n * Build a Product B search problem for an unexplained-observation /\n * prediction-residual gap. Relation-link and regime-transition gaps are\n * refused; the error names `upt discover`.\n *\n * @internal\n */\nexport function problemFromResidualGap(\n gap: FrontierGap,\n target: SearchProblem['target'],\n governing: SearchProblem['governing'],\n exploratory?: ProbeDataset,\n holdout?: ProbeDataset,\n): SearchProblem {\n if (gap.kind === 'relation-link' || gap.kind === 'regime-transition') {\n throw new RangeError(\n `problemFromResidualGap: ${gap.kind} is not a Product B search target; use upt discover`,\n );\n }\n // Identifiability is the rank of the log-design [1, log π₁, …, log πₖ] over the exploratory\n // rows (MathTS `matrixRank`), against the k + 1 parameters of a rational power law: a\n // prefactor and one exponent per π-group of the governing set. The row count is kept under\n // its own name; it is not a count of independent observations (six rows with c/d = (a/b)²\n // on every one of them carry two).\n const nObs = exploratory?.rows.length ?? 0;\n const { groups } = piStructure(target, governing);\n const k = groups.length;\n const nPar = 1 + k;\n const design = nObs > 0 ? logDesign(groups, exploratory!.rows) : { rows: [], used: 0, skipped: 0 };\n const rank = logDesignRank(design);\n const status: NonNullable<FrontierGap['identifiability']['parametric']>['status'] =\n nObs === 0 ? 'unknown' : rank >= nPar ? 'identifiable' : 'partially-identifiable';\n const parameters = k === 0 ? 'a prefactor' : `a prefactor and ${k} exponent(s)`;\n const reasons =\n status === 'unknown'\n ? ['no observations: identifiability not assessed']\n : status === 'identifiable'\n ? [`rank ${rank} of the log-design over ${design.used} usable row(s) of ${nObs}: ${parameters} identifiable`]\n : [\n `rank ${rank} of the log-design over ${design.used} usable row(s) of ${nObs} (${design.skipped} with a non-positive π-group), ` +\n `against ${nPar} parameters (${parameters}): the exponents are not all identifiable; the monomial prefactor is fit on the linear scale`,\n ];\n const enriched: FrontierGap = {\n ...gap,\n identifiability: {\n kind: 'parametric',\n parametric: {\n status,\n rank,\n nParameters: nPar,\n nIndependentObservations: rank,\n nObservations: nObs,\n reasons,\n },\n },\n searchability: {\n searchable: true,\n reasons:\n status === 'unknown'\n ? ['no data — structural generation only; status will be insufficient-evidence']\n : status === 'identifiable'\n ? ['parametric rank sufficient for a monomial prefactor and the π-group exponents']\n : ['the monomial prefactor is identifiable; the power-law fit abstains by itself on a rank-deficient design'],\n },\n status: 'searchable',\n };\n return {\n gap: enriched,\n target,\n governing,\n exploratory,\n holdout,\n discrepancy: gap.discrepancy,\n assumptions: gap.assumptions,\n };\n}\n"]}
@@ -8,17 +8,43 @@ import type { ExprNode } from '../../dimensional/ast-types.js';
8
8
  import { type DimensionalDeterminationResult } from '../../dimensional/buckingham.js';
9
9
  import type { DimensionalVariableRef, SearchBudget, SearchProblem } from './types.js';
10
10
  import { type BudgetState } from './search-budget.js';
11
+ import { type PowerLawFit } from './power-law.js';
12
+ /** The power-law fit over the π-groups, re-exported beside the generator that emits it. */
13
+ export { powerLawDetermination, powerLawWording, rationalizeExponent } from './power-law.js';
14
+ /** The power-law fit's result types: the determination, one fitted exponent, and a recovered fit. */
15
+ export type { PowerLawDetermination, PowerLawExponent, PowerLawFit } from './power-law.js';
11
16
  export interface RawCandidate {
12
17
  readonly expression: ExprNode;
13
18
  readonly monomial: Readonly<Record<string, number>> | null;
14
19
  readonly originNote: string;
20
+ /** Set on a candidate the power-law fit produced: its exponents, their errors and R². */
21
+ readonly powerLaw?: PowerLawFit;
15
22
  }
16
- /** Build `Π governing^exp` as an `ExprNode`. @internal */
23
+ /**
24
+ * Build `Π governing^exp` as an `ExprNode`: ONE product, negative exponents kept, names in
25
+ * code-unit order (`sort()`).
26
+ *
27
+ * This is not merged with `fromMonomial` (composition/proposed-bridges.ts), which writes a
28
+ * numerator over a denominator with positive exponents and orders names by `localeCompare`.
29
+ * The two trees differ for the same monomial (`Z·a^-0.5` against `Z/a^0.5`, and `Z` before `a`
30
+ * here, after it there), and both are printed (`upt probe` candidates, `upt discover --derive`
31
+ * proposals) and hashed, so one builder would move printed text. They share `symbolPower`, the
32
+ * one factor that is the same in both (tests/composition/monomial-builders.test.ts).
33
+ *
34
+ * @internal
35
+ */
17
36
  export declare function monomialToExpr(monomial: Readonly<Record<string, number>>, vars: readonly DimensionalVariableRef[]): ExprNode;
18
37
  /**
19
38
  * Yield dimensionally valid monomials for `problem`, honouring the budget.
20
39
  * Invalid typed constructions are skipped (never evaluated).
21
40
  *
41
+ * Two paths. The unique monomial of {@link nativeDetermination}, when there
42
+ * is one. Then, when the governing set leaves π-groups (the full determination
43
+ * is not unique) and the problem has exploratory rows, the rational power law
44
+ * over those groups that {@link powerLawDetermination} fits on THOSE ROWS
45
+ * ONLY; the holdout rows are never read here. A fit whose exponents all
46
+ * rationalise to 0 is the base monomial again and is kept once.
47
+ *
22
48
  * @internal
23
49
  */
24
50
  export declare function generateNative(problem: SearchProblem, state: BudgetState): Iterable<RawCandidate>;
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAA2B,KAAK,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AAE/G,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM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,UAAU,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC;CACjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC1C,IAAI,EAAE,SAAS,sBAAsB,EAAE,GACtC,QAAQ,CAaV;AAoCD;;;;;;;;;;;;GAYG;AACH,wBAAiB,cAAc,CAC7B,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,WAAW,GACjB,QAAQ,CAAC,YAAY,CAAC,CAmBxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG;IAC3D,GAAG,EAAE,8BAA8B,CAAC;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAYA;AAyCD,gDAAgD;AAChD,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -5,11 +5,27 @@
5
5
  * @module composition/probe/generator
6
6
  */
7
7
  import { DIMENSIONLESS } from '../../dimensional/types.js';
8
- import { sym } from '../../dimensional/ast-builders.js';
8
+ import { sym, symbolPower } from '../../dimensional/ast-builders.js';
9
9
  import { dimensionallyDetermines } from '../../dimensional/buckingham.js';
10
10
  import { validate } from '../../dimensional/validator.js';
11
+ import { isDimensionless } from '../../dimensional/algebra.js';
11
12
  import { canEmitCandidate } from './search-budget.js';
12
- /** Build `Π governing^exp` as an `ExprNode`. @internal */
13
+ import { powerLawDetermination } from './power-law.js';
14
+ /** The power-law fit over the π-groups, re-exported beside the generator that emits it. */
15
+ export { powerLawDetermination, powerLawWording, rationalizeExponent } from './power-law.js';
16
+ /**
17
+ * Build `Π governing^exp` as an `ExprNode`: ONE product, negative exponents kept, names in
18
+ * code-unit order (`sort()`).
19
+ *
20
+ * This is not merged with `fromMonomial` (composition/proposed-bridges.ts), which writes a
21
+ * numerator over a denominator with positive exponents and orders names by `localeCompare`.
22
+ * The two trees differ for the same monomial (`Z·a^-0.5` against `Z/a^0.5`, and `Z` before `a`
23
+ * here, after it there), and both are printed (`upt probe` candidates, `upt discover --derive`
24
+ * proposals) and hashed, so one builder would move printed text. They share `symbolPower`, the
25
+ * one factor that is the same in both (tests/composition/monomial-builders.test.ts).
26
+ *
27
+ * @internal
28
+ */
13
29
  export function monomialToExpr(monomial, vars) {
14
30
  const byName = new Map(vars.map((v) => [v.name, v.dim]));
15
31
  const factors = [];
@@ -20,16 +36,7 @@ export function monomialToExpr(monomial, vars) {
20
36
  const dim = byName.get(name);
21
37
  if (!dim)
22
38
  throw new RangeError(`monomialToExpr: unknown variable '${name}'`);
23
- const base = sym(name, dim);
24
- if (exp === 1)
25
- factors.push(base);
26
- else {
27
- factors.push({
28
- kind: 'op',
29
- op: '^',
30
- args: [base, sym(String(exp), DIMENSIONLESS)],
31
- });
32
- }
39
+ factors.push(symbolPower(sym(name, dim), exp));
33
40
  }
34
41
  if (factors.length === 0)
35
42
  return sym('1', DIMENSIONLESS);
@@ -43,17 +50,10 @@ function* extraPrefactors(base) {
43
50
  yield { kind: 'op', op: '*', args: [sym('2pi', DIMENSIONLESS), base] };
44
51
  }
45
52
  /**
46
- * Yield dimensionally valid monomials for `problem`, honouring the budget.
47
- * Invalid typed constructions are skipped (never evaluated).
48
- *
49
- * @internal
53
+ * Yield `expr` and its registered prefactor variants that validate and fit the budget's
54
+ * depth and operator caps; `seen` keeps one copy of each construction across the paths.
50
55
  */
51
- export function* generateNative(problem, state) {
52
- const { det } = nativeDetermination(problem);
53
- if (!det.determined || !det.monomial)
54
- return;
55
- const expr = monomialToExpr(det.monomial, [problem.target, ...problem.governing]);
56
- const seen = new Set();
56
+ function* emitWithPrefactors(expr, monomial, originNote, powerLaw, state, seen) {
57
57
  for (const candidate of extraPrefactors(expr)) {
58
58
  if (!canEmitCandidate(state))
59
59
  return;
@@ -71,11 +71,35 @@ export function* generateNative(problem, state) {
71
71
  continue;
72
72
  seen.add(key);
73
73
  state.candidates += 1;
74
- yield {
75
- expression: candidate,
76
- monomial: det.monomial,
77
- originNote: det.reason,
78
- };
74
+ yield { expression: candidate, monomial, originNote, ...(powerLaw ? { powerLaw } : {}) };
75
+ }
76
+ }
77
+ /**
78
+ * Yield dimensionally valid monomials for `problem`, honouring the budget.
79
+ * Invalid typed constructions are skipped (never evaluated).
80
+ *
81
+ * Two paths. The unique monomial of {@link nativeDetermination}, when there
82
+ * is one. Then, when the governing set leaves π-groups (the full determination
83
+ * is not unique) and the problem has exploratory rows, the rational power law
84
+ * over those groups that {@link powerLawDetermination} fits on THOSE ROWS
85
+ * ONLY; the holdout rows are never read here. A fit whose exponents all
86
+ * rationalise to 0 is the base monomial again and is kept once.
87
+ *
88
+ * @internal
89
+ */
90
+ export function* generateNative(problem, state) {
91
+ const vars = [problem.target, ...problem.governing];
92
+ const seen = new Set();
93
+ const { det } = nativeDetermination(problem);
94
+ if (det.determined && det.monomial) {
95
+ yield* emitWithPrefactors(monomialToExpr(det.monomial, vars), det.monomial, det.reason, undefined, state, seen);
96
+ }
97
+ if ((problem.exploratory?.rows.length ?? 0) > 0) {
98
+ const pl = powerLawDetermination(problem);
99
+ if (pl.kind === 'fit') {
100
+ const note = `power-law: ${pl.exponents.map((e) => `${e.group}^(${e.rational.numerator}/${e.rational.denominator})`).join(' · ')}`;
101
+ yield* emitWithPrefactors(monomialToExpr(pl.monomial, vars), pl.monomial, note, pl, state, seen);
102
+ }
79
103
  }
80
104
  if (problem.baseline && problem.discrepancy) {
81
105
  yield* generateCorrections(problem, state, seen);
@@ -94,11 +118,10 @@ export function nativeDetermination(problem) {
94
118
  const det = dimensionallyDetermines(problem.target, problem.governing);
95
119
  if (det.determined)
96
120
  return { det, unsearched: [] };
97
- const isDimensionless = (g) => Object.values(g.dim).every((e) => e === 0);
98
- const dimless = problem.governing.filter(isDimensionless);
121
+ const dimless = problem.governing.filter((g) => isDimensionless(g.dim));
99
122
  if (dimless.length === 0)
100
123
  return { det, unsearched: [] };
101
- const reduced = dimensionallyDetermines(problem.target, problem.governing.filter((g) => !isDimensionless(g)));
124
+ const reduced = dimensionallyDetermines(problem.target, problem.governing.filter((g) => !isDimensionless(g.dim)));
102
125
  return reduced.determined
103
126
  ? { det: reduced, unsearched: dimless.map((g) => g.name) }
104
127
  : { det, unsearched: [] };
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/composition/probe/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAuC,MAAM,iCAAiC,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AAQxE,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAC5B,QAA0C,EAC1C,IAAuC;IAEvC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,GAAG,KAAK,CAAC;YAAE,SAAS;QACxB,MAAM,GAAG,GAAG,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,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IAChH,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,IAAI;QAAE,OAAO;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO;IAC1B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACd,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC;IACtB,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,cAAc,IAAI,EAAE,EAAE,CAAC;AAC3F,CAAC","sourcesContent":["/**\n * Native bounded grammar enumerator — dimensional monomials via Buckingham-π.\n * Deterministic visit order; seed-independent.\n *\n * @module composition/probe/generator\n */\n\nimport type { ExprNode } from '../../dimensional/ast-types.js';\nimport { DIMENSIONLESS } from '../../dimensional/types.js';\nimport { sym } from '../../dimensional/ast-builders.js';\nimport { dimensionallyDetermines, type DimensionalDeterminationResult } from '../../dimensional/buckingham.js';\nimport { validate } from '../../dimensional/validator.js';\nimport type { DimensionalVariableRef, SearchBudget, SearchProblem } from './types.js';\nimport { canEmitCandidate, type BudgetState } from './search-budget.js';\n\nexport interface RawCandidate {\n readonly expression: ExprNode;\n readonly monomial: Readonly<Record<string, number>> | null;\n readonly originNote: string;\n}\n\n/** Build `Π governing^exp` as an `ExprNode`. @internal */\nexport function monomialToExpr(\n monomial: Readonly<Record<string, number>>,\n vars: readonly DimensionalVariableRef[],\n): ExprNode {\n const byName = new Map(vars.map((v) => [v.name, v.dim]));\n const factors: ExprNode[] = [];\n for (const name of Object.keys(monomial).sort()) {\n const exp = monomial[name];\n if (exp === 0) continue;\n const dim = byName.get(name);\n if (!dim) throw new RangeError(`monomialToExpr: unknown variable '${name}'`);\n const base = sym(name, dim);\n if (exp === 1) factors.push(base);\n else {\n factors.push({\n kind: 'op',\n op: '^',\n args: [base, sym(String(exp), DIMENSIONLESS)],\n });\n }\n }\n if (factors.length === 0) return sym('1', DIMENSIONLESS);\n if (factors.length === 1) return factors[0];\n return { kind: 'op', op: '*', args: factors };\n}\n\nfunction* extraPrefactors(base: ExprNode): Iterable<ExprNode> {\n yield base;\n // Registered `2pi` leaf (same normalForm as `base` — dimensionless constant).\n yield { kind: 'op', op: '*', args: [sym('2pi', DIMENSIONLESS), base] };\n}\n\n/**\n * Yield dimensionally valid monomials for `problem`, honouring the budget.\n * Invalid typed constructions are skipped (never evaluated).\n *\n * @internal\n */\nexport function* generateNative(\n problem: SearchProblem,\n state: BudgetState,\n): Iterable<RawCandidate> {\n const { det } = nativeDetermination(problem);\n if (!det.determined || !det.monomial) return;\n\n const expr = monomialToExpr(det.monomial, [problem.target, ...problem.governing]);\n const seen = new Set<string>();\n for (const candidate of extraPrefactors(expr)) {\n if (!canEmitCandidate(state)) return;\n if (validate(candidate).ok !== true) continue;\n // Depth / operator caps\n const depth = astDepth(candidate);\n const ops = opCount(candidate);\n if (depth > state.budget.maxAstDepth) continue;\n if (ops > state.budget.maxOperators) continue;\n const key = JSON.stringify(candidate);\n if (seen.has(key)) continue;\n seen.add(key);\n state.candidates += 1;\n yield {\n expression: candidate,\n monomial: det.monomial,\n originNote: det.reason,\n };\n }\n\n if (problem.baseline && problem.discrepancy) {\n yield* generateCorrections(problem, state, seen);\n }\n}\n\n/**\n * The monomial the native enumerator searches, and the dimensionless inputs it\n * leaves out (persona finding C2). A dimensionless input makes the monomial\n * non-unique, since any f(θ0) can multiply it, and the enumerator used to\n * produce nothing. When the monomial over ALL inputs is not unique, it is taken\n * from the DIMENSIONED inputs; `unsearched` names the dimensionless ones whose\n * function is not searched.\n * @internal\n */\nexport function nativeDetermination(problem: SearchProblem): {\n det: DimensionalDeterminationResult;\n unsearched: string[];\n} {\n const det = dimensionallyDetermines(problem.target, problem.governing);\n if (det.determined) return { det, unsearched: [] };\n const isDimensionless = (g: DimensionalVariableRef) => Object.values(g.dim).every((e) => e === 0);\n const dimless = problem.governing.filter(isDimensionless);\n if (dimless.length === 0) return { det, unsearched: [] };\n const reduced = dimensionallyDetermines(\n problem.target,\n problem.governing.filter((g) => !isDimensionless(g)),\n );\n return reduced.determined\n ? { det: reduced, unsearched: dimless.map((g) => g.name) }\n : { det, unsearched: [] };\n}\n\nfunction astDepth(node: ExprNode): number {\n if (node.kind === 'op') return 1 + Math.max(0, ...node.args.map(astDepth));\n if (node.kind === 'transcendental' || node.kind === 'abs') return 1 + astDepth(node.arg);\n return 1;\n}\n\nfunction opCount(node: ExprNode): number {\n if (node.kind === 'op') return 1 + node.args.reduce((n, a) => n + opCount(a), 0);\n return 0;\n}\n\n/**\n * Additive / relative corrections: search a monomial of the same dimension\n * as the observable to add to (or scale) the baseline.\n */\nfunction* generateCorrections(\n problem: SearchProblem,\n state: BudgetState,\n seen: Set<string>,\n): Iterable<RawCandidate> {\n const kind = problem.discrepancy!.kind;\n if (kind !== 'additive' && kind !== 'relative' && kind !== 'standardized') return;\n const { det } = nativeDetermination(problem);\n if (!det.determined || !det.monomial) return;\n if (!canEmitCandidate(state)) return;\n const corr = monomialToExpr(det.monomial, [problem.target, ...problem.governing]);\n const baseline = problem.baseline!;\n const combined: ExprNode =\n kind === 'additive'\n ? { kind: 'op', op: '+', args: [baseline, corr] }\n : { kind: 'op', op: '*', args: [baseline, { kind: 'op', op: '+', args: [sym('1', DIMENSIONLESS), corr] }] };\n if (validate(combined).ok !== true) return;\n const key = JSON.stringify(combined);\n if (seen.has(key)) return;\n seen.add(key);\n state.candidates += 1;\n yield { expression: combined, monomial: det.monomial, originNote: `correction:${kind}` };\n}\n\n/** Expose budget type for callers. @internal */\nexport type { SearchBudget };\n"]}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/composition/probe/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAuC,MAAM,iCAAiC,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAoB,MAAM,gBAAgB,CAAC;AAEzE,2FAA2F;AAC3F,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAY7F;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAC5B,QAA0C,EAC1C,IAAuC;IAEvC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,GAAG,KAAK,CAAC;YAAE,SAAS;QACxB,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,UAAU,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ensional monomials via Buckingham-π.\n * Deterministic visit order; seed-independent.\n *\n * @module composition/probe/generator\n */\n\nimport type { ExprNode } from '../../dimensional/ast-types.js';\nimport { DIMENSIONLESS } from '../../dimensional/types.js';\nimport { sym, symbolPower } from '../../dimensional/ast-builders.js';\nimport { dimensionallyDetermines, type DimensionalDeterminationResult } from '../../dimensional/buckingham.js';\nimport { validate } from '../../dimensional/validator.js';\nimport { isDimensionless } from '../../dimensional/algebra.js';\nimport type { DimensionalVariableRef, SearchBudget, SearchProblem } from './types.js';\nimport { canEmitCandidate, type BudgetState } from './search-budget.js';\nimport { powerLawDetermination, type PowerLawFit } from './power-law.js';\n\n/** The power-law fit over the π-groups, re-exported beside the generator that emits it. */\nexport { powerLawDetermination, powerLawWording, rationalizeExponent } from './power-law.js';\n/** The power-law fit's result types: the determination, one fitted exponent, and a recovered fit. */\nexport type { PowerLawDetermination, PowerLawExponent, PowerLawFit } from './power-law.js';\n\nexport interface RawCandidate {\n readonly expression: ExprNode;\n readonly monomial: Readonly<Record<string, number>> | null;\n readonly originNote: string;\n /** Set on a candidate the power-law fit produced: its exponents, their errors and R². */\n readonly powerLaw?: PowerLawFit;\n}\n\n/**\n * Build `Π governing^exp` as an `ExprNode`: ONE product, negative exponents kept, names in\n * code-unit order (`sort()`).\n *\n * This is not merged with `fromMonomial` (composition/proposed-bridges.ts), which writes a\n * numerator over a denominator with positive exponents and orders names by `localeCompare`.\n * The two trees differ for the same monomial (`Z·a^-0.5` against `Z/a^0.5`, and `Z` before `a`\n * here, after it there), and both are printed (`upt probe` candidates, `upt discover --derive`\n * proposals) and hashed, so one builder would move printed text. They share `symbolPower`, the\n * one factor that is the same in both (tests/composition/monomial-builders.test.ts).\n *\n * @internal\n */\nexport function monomialToExpr(\n monomial: Readonly<Record<string, number>>,\n vars: readonly DimensionalVariableRef[],\n): ExprNode {\n const byName = new Map(vars.map((v) => [v.name, v.dim]));\n const factors: ExprNode[] = [];\n for (const name of Object.keys(monomial).sort()) {\n const exp = monomial[name];\n if (exp === 0) continue;\n const dim = byName.get(name);\n if (!dim) throw new RangeError(`monomialToExpr: unknown variable '${name}'`);\n factors.push(symbolPower(sym(name, dim), exp));\n }\n if (factors.length === 0) return sym('1', DIMENSIONLESS);\n if (factors.length === 1) return factors[0];\n return { kind: 'op', op: '*', args: factors };\n}\n\nfunction* extraPrefactors(base: ExprNode): Iterable<ExprNode> {\n yield base;\n // Registered `2pi` leaf (same normalForm as `base` — dimensionless constant).\n yield { kind: 'op', op: '*', args: [sym('2pi', DIMENSIONLESS), base] };\n}\n\n/**\n * Yield `expr` and its registered prefactor variants that validate and fit the budget's\n * depth and operator caps; `seen` keeps one copy of each construction across the paths.\n */\nfunction* emitWithPrefactors(\n expr: ExprNode,\n monomial: Readonly<Record<string, number>>,\n originNote: string,\n powerLaw: PowerLawFit | undefined,\n state: BudgetState,\n seen: Set<string>,\n): Iterable<RawCandidate> {\n for (const candidate of extraPrefactors(expr)) {\n if (!canEmitCandidate(state)) return;\n if (validate(candidate).ok !== true) continue;\n // Depth / operator caps\n const depth = astDepth(candidate);\n const ops = opCount(candidate);\n if (depth > state.budget.maxAstDepth) continue;\n if (ops > state.budget.maxOperators) continue;\n const key = JSON.stringify(candidate);\n if (seen.has(key)) continue;\n seen.add(key);\n state.candidates += 1;\n yield { expression: candidate, monomial, originNote, ...(powerLaw ? { powerLaw } : {}) };\n }\n}\n\n/**\n * Yield dimensionally valid monomials for `problem`, honouring the budget.\n * Invalid typed constructions are skipped (never evaluated).\n *\n * Two paths. The unique monomial of {@link nativeDetermination}, when there\n * is one. Then, when the governing set leaves π-groups (the full determination\n * is not unique) and the problem has exploratory rows, the rational power law\n * over those groups that {@link powerLawDetermination} fits on THOSE ROWS\n * ONLY; the holdout rows are never read here. A fit whose exponents all\n * rationalise to 0 is the base monomial again and is kept once.\n *\n * @internal\n */\nexport function* generateNative(\n problem: SearchProblem,\n state: BudgetState,\n): Iterable<RawCandidate> {\n const vars = [problem.target, ...problem.governing];\n const seen = new Set<string>();\n const { det } = nativeDetermination(problem);\n if (det.determined && det.monomial) {\n yield* emitWithPrefactors(monomialToExpr(det.monomial, vars), det.monomial, det.reason, undefined, state, seen);\n }\n\n if ((problem.exploratory?.rows.length ?? 0) > 0) {\n const pl = powerLawDetermination(problem);\n if (pl.kind === 'fit') {\n const note = `power-law: ${pl.exponents.map((e) => `${e.group}^(${e.rational!.numerator}/${e.rational!.denominator})`).join(' · ')}`;\n yield* emitWithPrefactors(monomialToExpr(pl.monomial, vars), pl.monomial, note, pl, state, seen);\n }\n }\n\n if (problem.baseline && problem.discrepancy) {\n yield* generateCorrections(problem, state, seen);\n }\n}\n\n/**\n * The monomial the native enumerator searches, and the dimensionless inputs it\n * leaves out (persona finding C2). A dimensionless input makes the monomial\n * non-unique, since any f(θ0) can multiply it, and the enumerator used to\n * produce nothing. When the monomial over ALL inputs is not unique, it is taken\n * from the DIMENSIONED inputs; `unsearched` names the dimensionless ones whose\n * function is not searched.\n * @internal\n */\nexport function nativeDetermination(problem: SearchProblem): {\n det: DimensionalDeterminationResult;\n unsearched: string[];\n} {\n const det = dimensionallyDetermines(problem.target, problem.governing);\n if (det.determined) return { det, unsearched: [] };\n const dimless = problem.governing.filter((g) => isDimensionless(g.dim));\n if (dimless.length === 0) return { det, unsearched: [] };\n const reduced = dimensionallyDetermines(\n problem.target,\n problem.governing.filter((g) => !isDimensionless(g.dim)),\n );\n return reduced.determined\n ? { det: reduced, unsearched: dimless.map((g) => g.name) }\n : { det, unsearched: [] };\n}\n\nfunction astDepth(node: ExprNode): number {\n if (node.kind === 'op') return 1 + Math.max(0, ...node.args.map(astDepth));\n if (node.kind === 'transcendental' || node.kind === 'abs') return 1 + astDepth(node.arg);\n return 1;\n}\n\nfunction opCount(node: ExprNode): number {\n if (node.kind === 'op') return 1 + node.args.reduce((n, a) => n + opCount(a), 0);\n return 0;\n}\n\n/**\n * Additive / relative corrections: search a monomial of the same dimension\n * as the observable to add to (or scale) the baseline.\n */\nfunction* generateCorrections(\n problem: SearchProblem,\n state: BudgetState,\n seen: Set<string>,\n): Iterable<RawCandidate> {\n const kind = problem.discrepancy!.kind;\n if (kind !== 'additive' && kind !== 'relative' && kind !== 'standardized') return;\n const { det } = nativeDetermination(problem);\n if (!det.determined || !det.monomial) return;\n if (!canEmitCandidate(state)) return;\n const corr = monomialToExpr(det.monomial, [problem.target, ...problem.governing]);\n const baseline = problem.baseline!;\n const combined: ExprNode =\n kind === 'additive'\n ? { kind: 'op', op: '+', args: [baseline, corr] }\n : { kind: 'op', op: '*', args: [baseline, { kind: 'op', op: '+', args: [sym('1', DIMENSIONLESS), corr] }] };\n if (validate(combined).ok !== true) return;\n const key = JSON.stringify(combined);\n if (seen.has(key)) return;\n seen.add(key);\n state.candidates += 1;\n yield { expression: combined, monomial: det.monomial, originNote: `correction:${kind}` };\n}\n\n/** Expose budget type for callers. @internal */\nexport type { SearchBudget };\n"]}
@@ -21,6 +21,10 @@ export { openManifest, closeManifest } from './run-manifest.js';
21
21
  export { canTransition, applyStatus, statusRank, ProbeCandidateStore } from './candidate-store.js';
22
22
  export { monomialToExpr, generateNative } from './generator.js';
23
23
  export type { RawCandidate } from './generator.js';
24
+ /** The rational power law over the π-groups, and the log-design rank the frontier reads. */
25
+ export { powerLawDetermination, powerLawWording, rationalizeExponent, piStructure, logDesign, logDesignRank } from './power-law.js';
26
+ /** The power-law types: the determination, one fitted exponent, a recovered fit, the π-structure and the log-design. */
27
+ export type { PowerLawDetermination, PowerLawExponent, PowerLawFit, PiStructure, LogDesign } from './power-law.js';
24
28
  export { wrapRelationLinkGaps, wrapConnectorGaps, wrapRegimeGaps, scanFrontier, findFrontierGap, problemFromResidualGap, } from './frontier.js';
25
29
  export { expressionSearchGaps, scanWithExpressionGaps } from './expression-gaps.js';
26
30
  export { fitPrefactor } from './fit.js';
@@ -31,14 +35,22 @@ export { compareToCorpus, corpusRelativeWording } from './corpus.js';
31
35
  export type { CorpusMatch, CorpusComparisonResult } from './corpus.js';
32
36
  export { checkDeclaredLimit, checkDeclaredLimits } from './limits.js';
33
37
  export type { LimitCheckResult } from './limits.js';
38
+ /** What a declared-limit check found: held, failed, or undecided on too few evaluable rows. */
39
+ export type { LimitOutcome } from './limits.js';
34
40
  export { runFalsification, DEFAULT_BATTERIES } from './falsify.js';
35
41
  export type { FalsifyInput, FalsifyResult } from './falsify.js';
36
42
  export { datasetFromRows, asDatasetSafe, loadDatasetFromJson, loadSplitDatasetsFromJson, loadDatasetFromCsv, loadSplitCsv, } from './dataset.js';
43
+ /** The strict cell reader (a finite number or a decimal string, never a coercion) and the error a dataset raises by row and column. */
44
+ export { readDatasetNumber, DatasetError } from './dataset.js';
37
45
  export type { SplitFileDatasets } from './dataset.js';
38
46
  export { suggestDiscriminatingPoint, parseDesignBounds } from './experiment-design.js';
39
47
  export type { DesignBounds, DesignSuggestion } from './experiment-design.js';
40
48
  export { detectMeanChangepoint, estimateScaleExponent, probeConservation, } from './structure.js';
41
49
  export type { ChangepointInput, ChangepointResult, ScaleSymmetryInput } from './structure.js';
50
+ /** The scale-exponent result (slope, standard error, direct p) and the conservation verdict (slope against k·stdErr). */
51
+ export type { ScaleExponentResult, ConservationResult } from './structure.js';
52
+ /** The direct two-sided Student t tail the probes consume instead of MathTS's `2·(1 − CDF)`. */
53
+ export { studentTwoSidedP } from './t-tail.js';
42
54
  export { runBackendWorker } from './backend-protocol.js';
43
55
  export type { BackendRequest, BackendCandidate, BackendResponse } from './backend-protocol.js';
44
56
  export { setRelationMetadata, getRelationMetadata, listRelationMetadata, clearRelationMetadata, } from './metadata.js';
@@ -51,4 +63,6 @@ export type { ProbeSearchOptions, ProbeSearchResult } from './pipeline.js';
51
63
  export { formatProbeReport, formatFrontierScan, formatFrontierGap } from './report.js';
52
64
  export { parseStudy, loadStudyFromJson, loadStudyFile, attachReplication, studyCsvToRaw, runProbeStudy, formatProbeStudy, chiSquareSurvival, fSurvival, effectiveSigma, StudyRefusal, } from './study.js';
53
65
  export type { ProbeStudy, ProbeStudyOptions, ProbeStudyResult, StudyVerdict, ReplicationOutcome, StudyRole, StudyProvenance, StudyObservation, StudyBaseline, SetTest, ModelTest, CandidateTest, StudyDesignSuggestion, StudyCorrection, StudyCorrectionReport, CorrectionStep, } from './study.js';
66
+ /** One fitted correction coefficient with its standard error and, when declared, the reference it is compared with. */
67
+ export type { CorrectionCoefficient } from './study.js';
54
68
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpF,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAA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,kBAAkB,EAClB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,OAAO,EACP,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpF,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,a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AACtE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,OAAO,EACP,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,uHAAuH;AACvH,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
@@ -18,6 +18,8 @@ export { scalarDiscrepancy, rmse, ResidualError } from './residual.js';
18
18
  export { openManifest, closeManifest } from './run-manifest.js';
19
19
  export { canTransition, applyStatus, statusRank, ProbeCandidateStore } from './candidate-store.js';
20
20
  export { monomialToExpr, generateNative } from './generator.js';
21
+ /** The rational power law over the π-groups, and the log-design rank the frontier reads. */
22
+ export { powerLawDetermination, powerLawWording, rationalizeExponent, piStructure, logDesign, logDesignRank } from './power-law.js';
21
23
  export { wrapRelationLinkGaps, wrapConnectorGaps, wrapRegimeGaps, scanFrontier, findFrontierGap, problemFromResidualGap, } from './frontier.js';
22
24
  export { expressionSearchGaps, scanWithExpressionGaps } from './expression-gaps.js';
23
25
  export { fitPrefactor } from './fit.js';
@@ -26,8 +28,12 @@ export { compareToCorpus, corpusRelativeWording } from './corpus.js';
26
28
  export { checkDeclaredLimit, checkDeclaredLimits } from './limits.js';
27
29
  export { runFalsification, DEFAULT_BATTERIES } from './falsify.js';
28
30
  export { datasetFromRows, asDatasetSafe, loadDatasetFromJson, loadSplitDatasetsFromJson, loadDatasetFromCsv, loadSplitCsv, } from './dataset.js';
31
+ /** The strict cell reader (a finite number or a decimal string, never a coercion) and the error a dataset raises by row and column. */
32
+ export { readDatasetNumber, DatasetError } from './dataset.js';
29
33
  export { suggestDiscriminatingPoint, parseDesignBounds } from './experiment-design.js';
30
34
  export { detectMeanChangepoint, estimateScaleExponent, probeConservation, } from './structure.js';
35
+ /** The direct two-sided Student t tail the probes consume instead of MathTS's `2·(1 − CDF)`. */
36
+ export { studentTwoSidedP } from './t-tail.js';
31
37
  export { runBackendWorker } from './backend-protocol.js';
32
38
  export { setRelationMetadata, getRelationMetadata, listRelationMetadata, clearRelationMetadata, } from './metadata.js';
33
39
  /** The problem-file readers and the error a file that is not a problem file raises, naming its field. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/composition/probe/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAyCpB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM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iB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC","sourcesContent":["/**\n * Experimental Product B barrel — expression / residual search.\n *\n * Import via `universal-physics-tensor/probe`. Not re-exported from the\n * root `universal-physics-tensor` entry. Orthogonal to Product A\n * (`upt discover` / `VettedCandidate`).\n *\n * All symbols are `@internal`: the subpath exists for CLI and experiments,\n * not as a stability contract.\n *\n * @module composition/probe\n */\n\nexport {\n SCHEMA_VERSION,\n PROBE_SCHEMA_VERSION,\n DEFAULT_SEARCH_BUDGET,\n} from './types.js';\nexport type {\n ProbeCandidateStatus,\n RelationKind,\n AuditState,\n DiscrepancyKind,\n DatasetRole,\n SearchStopReason,\n FrontierGapKind,\n IdentifiabilityKind,\n SearchBudget,\n DiscrepancyDefinition,\n ScientificRelationRef,\n IdentifiabilityAssessment,\n SearchabilityAssessment,\n GapEvidence,\n FrontierGap,\n ProbeCandidateOrigin,\n ProbeCandidateBody,\n StatusEvent,\n CandidateFingerprint,\n ComplexityMetrics,\n ProbeCandidateRecord,\n ProbeRejectionRecord,\n DiscoveryBackendDescriptor,\n EnvironmentFingerprint,\n NondeterminismSource,\n DiscoveryRunManifest,\n DimensionalVariableRef,\n ObservationRow,\n ProbeDataset,\n SearchProblem,\n ScoreVector,\n EvidenceAssessment,\n EvidenceProfile,\n DeclaredLimit,\n FalsificationBattery,\n FalsificationRecord,\n ScientificRelationRecord,\n} from './types.js';\n\nexport { canonicalJson, sha256Hex, hashCanonical, captureEnvironment } from '../canonical-json.js';\nexport { openBudget, budgetStopReason, canEmitCandidate } from './search-budget.js';\nexport type { BudgetState } from './search-budget.js';\nexport {\n bodyExpression,\n countAstNodes,\n countOperators,\n maxPowerOrder,\n complexityOf,\n fingerprintExpr,\n} from './fingerprint.js';\nexport { scalarDiscrepancy, rmse, ResidualError } from './residual.js';\nexport { openManifest, closeManifest } from './run-manifest.js';\nexport { canTransition, applyStatus, statusRank, ProbeCandidateStore } from './candidate-store.js';\nexport { monomialToExpr, generateNative } from './generator.js';\nexport type { RawCandidate } from './generator.js';\nexport {\n wrapRelationLinkGaps,\n wrapConnectorGaps,\n wrapRegimeGaps,\n scanFrontier,\n findFrontierGap,\n problemFromResidualGap,\n} from './frontier.js';\nexport { expressionSearchGaps, scanWithExpressionGaps } from './expression-gaps.js';\nexport { fitPrefactor } from './fit.js';\nexport type { FitResult } from './fit.js';\nexport { scoreCandidate, rankPareto } from './scoring.js';\nexport type { RankedCandidate } from './scoring.js';\nexport { compareToCorpus, corpusRelativeWording } from './corpus.js';\nexport type { CorpusMatch, CorpusComparisonResult } from './corpus.js';\nexport { checkDeclaredLimit, checkDeclaredLimits } from './limits.js';\nexport type { LimitCheckResult } from './limits.js';\nexport { runFalsification, DEFAULT_BATTERIES } from './falsify.js';\nexport type { FalsifyInput, FalsifyResult } from './falsify.js';\nexport {\n datasetFromRows,\n asDatasetSafe,\n loadDatasetFromJson,\n loadSplitDatasetsFromJson,\n loadDatasetFromCsv,\n loadSplitCsv,\n} from './dataset.js';\nexport type { SplitFileDatasets } from './dataset.js';\nexport { suggestDiscriminatingPoint, parseDesignBounds } from './experiment-design.js';\nexport type { DesignBounds, DesignSuggestion } from './experiment-design.js';\nexport {\n detectMeanChangepoint,\n estimateScaleExponent,\n probeConservation,\n} from './structure.js';\nexport type { ChangepointInput, ChangepointResult, ScaleSymmetryInput } from './structure.js';\nexport { runBackendWorker } from './backend-protocol.js';\nexport type { BackendRequest, BackendCandidate, BackendResponse } from './backend-protocol.js';\nexport {\n setRelationMetadata,\n getRelationMetadata,\n listRelationMetadata,\n clearRelationMetadata,\n} from './metadata.js';\n/** The problem-file readers and the error a file that is not a problem file raises, naming its field. */\nexport { makeResidualGap, loadSearchProblemFromJson, searchProblemFromFile, resolveObservationsPath, parseExprJson, ProblemFileError } from './problem.js';\nexport type { ProblemFile } from './problem.js';\n/** The search pipeline and the argv a Node worker is spawned with. */\nexport { runProbeSearch, nodeWorkerArgv } from './pipeline.js';\nexport type { ProbeSearchOptions, ProbeSearchResult } from './pipeline.js';\nexport { formatProbeReport, formatFrontierScan, formatFrontierGap } from './report.js';\nexport {\n parseStudy,\n loadStudyFromJson,\n loadStudyFile,\n attachReplication,\n studyCsvToRaw,\n runProbeStudy,\n formatProbeStudy,\n chiSquareSurvival,\n fSurvival,\n effectiveSigma,\n StudyRefusal,\n} from './study.js';\nexport type {\n ProbeStudy,\n ProbeStudyOptions,\n ProbeStudyResult,\n StudyVerdict,\n ReplicationOutcome,\n StudyRole,\n StudyProvenance,\n StudyObservation,\n StudyBaseline,\n SetTest,\n ModelTest,\n CandidateTest,\n StudyDesignSuggestion,\n StudyCorrection,\n StudyCorrectionReport,\n CorrectionStep,\n} from './study.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/composition/probe/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAyCpB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,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,MAAM,eAAe,CAAC;AACvB,yGAAyG;AACzG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE3J,sEAAsE;AACtE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC","sourcesContent":["/**\n * Experimental Product B barrel — expression / residual search.\n *\n * Import via `universal-physics-tensor/probe`. Not re-exported from the\n * root `universal-physics-tensor` entry. Orthogonal to Product A\n * (`upt discover` / `VettedCandidate`).\n *\n * All symbols are `@internal`: the subpath exists for CLI and experiments,\n * not as a stability contract.\n *\n * @module composition/probe\n */\n\nexport {\n SCHEMA_VERSION,\n PROBE_SCHEMA_VERSION,\n DEFAULT_SEARCH_BUDGET,\n} from './types.js';\nexport type {\n ProbeCandidateStatus,\n RelationKind,\n AuditState,\n DiscrepancyKind,\n DatasetRole,\n SearchStopReason,\n FrontierGapKind,\n IdentifiabilityKind,\n SearchBudget,\n DiscrepancyDefinition,\n ScientificRelationRef,\n IdentifiabilityAssessment,\n SearchabilityAssessment,\n GapEvidence,\n FrontierGap,\n ProbeCandidateOrigin,\n ProbeCandidateBody,\n StatusEvent,\n CandidateFingerprint,\n ComplexityMetrics,\n ProbeCandidateRecord,\n ProbeRejectionRecord,\n DiscoveryBackendDescriptor,\n EnvironmentFingerprint,\n NondeterminismSource,\n DiscoveryRunManifest,\n DimensionalVariableRef,\n ObservationRow,\n ProbeDataset,\n SearchProblem,\n ScoreVector,\n EvidenceAssessment,\n EvidenceProfile,\n DeclaredLimit,\n FalsificationBattery,\n FalsificationRecord,\n ScientificRelationRecord,\n} from './types.js';\n\nexport { canonicalJson, sha256Hex, hashCanonical, captureEnvironment } from '../canonical-json.js';\nexport { openBudget, budgetStopReason, canEmitCandidate } from './search-budget.js';\nexport type { BudgetState } from './search-budget.js';\nexport {\n bodyExpression,\n countAstNodes,\n countOperators,\n maxPowerOrder,\n complexityOf,\n fingerprintExpr,\n} from './fingerprint.js';\nexport { scalarDiscrepancy, rmse, ResidualError } from './residual.js';\nexport { openManifest, closeManifest } from './run-manifest.js';\nexport { canTransition, applyStatus, statusRank, ProbeCandidateStore } from './candidate-store.js';\nexport { monomialToExpr, generateNative } from './generator.js';\nexport type { RawCandidate } from './generator.js';\n/** The rational power law over the π-groups, and the log-design rank the frontier reads. */\nexport { powerLawDetermination, powerLawWording, rationalizeExponent, piStructure, logDesign, logDesignRank } from './power-law.js';\n/** The power-law types: the determination, one fitted exponent, a recovered fit, the π-structure and the log-design. */\nexport type { PowerLawDetermination, PowerLawExponent, PowerLawFit, PiStructure, LogDesign } from './power-law.js';\nexport {\n wrapRelationLinkGaps,\n wrapConnectorGaps,\n wrapRegimeGaps,\n scanFrontier,\n findFrontierGap,\n problemFromResidualGap,\n} from './frontier.js';\nexport { expressionSearchGaps, scanWithExpressionGaps } from './expression-gaps.js';\nexport { fitPrefactor } from './fit.js';\nexport type { FitResult } from './fit.js';\nexport { scoreCandidate, rankPareto } from './scoring.js';\nexport type { RankedCandidate } from './scoring.js';\nexport { compareToCorpus, corpusRelativeWording } from './corpus.js';\nexport type { CorpusMatch, CorpusComparisonResult } from './corpus.js';\nexport { checkDeclaredLimit, checkDeclaredLimits } from './limits.js';\nexport type { LimitCheckResult } from './limits.js';\n/** What a declared-limit check found: held, failed, or undecided on too few evaluable rows. */\nexport type { LimitOutcome } from './limits.js';\nexport { runFalsification, DEFAULT_BATTERIES } from './falsify.js';\nexport type { FalsifyInput, FalsifyResult } from './falsify.js';\nexport {\n datasetFromRows,\n asDatasetSafe,\n loadDatasetFromJson,\n loadSplitDatasetsFromJson,\n loadDatasetFromCsv,\n loadSplitCsv,\n} from './dataset.js';\n/** The strict cell reader (a finite number or a decimal string, never a coercion) and the error a dataset raises by row and column. */\nexport { readDatasetNumber, DatasetError } from './dataset.js';\nexport type { SplitFileDatasets } from './dataset.js';\nexport { suggestDiscriminatingPoint, parseDesignBounds } from './experiment-design.js';\nexport type { DesignBounds, DesignSuggestion } from './experiment-design.js';\nexport {\n detectMeanChangepoint,\n estimateScaleExponent,\n probeConservation,\n} from './structure.js';\nexport type { ChangepointInput, ChangepointResult, ScaleSymmetryInput } from './structure.js';\n/** The scale-exponent result (slope, standard error, direct p) and the conservation verdict (slope against k·stdErr). */\nexport type { ScaleExponentResult, ConservationResult } from './structure.js';\n/** The direct two-sided Student t tail the probes consume instead of MathTS's `2·(1 − CDF)`. */\nexport { studentTwoSidedP } from './t-tail.js';\nexport { runBackendWorker } from './backend-protocol.js';\nexport type { BackendRequest, BackendCandidate, BackendResponse } from './backend-protocol.js';\nexport {\n setRelationMetadata,\n getRelationMetadata,\n listRelationMetadata,\n clearRelationMetadata,\n} from './metadata.js';\n/** The problem-file readers and the error a file that is not a problem file raises, naming its field. */\nexport { makeResidualGap, loadSearchProblemFromJson, searchProblemFromFile, resolveObservationsPath, parseExprJson, ProblemFileError } from './problem.js';\nexport type { ProblemFile } from './problem.js';\n/** The search pipeline and the argv a Node worker is spawned with. */\nexport { runProbeSearch, nodeWorkerArgv } from './pipeline.js';\nexport type { ProbeSearchOptions, ProbeSearchResult } from './pipeline.js';\nexport { formatProbeReport, formatFrontierScan, formatFrontierGap } from './report.js';\nexport {\n parseStudy,\n loadStudyFromJson,\n loadStudyFile,\n attachReplication,\n studyCsvToRaw,\n runProbeStudy,\n formatProbeStudy,\n chiSquareSurvival,\n fSurvival,\n effectiveSigma,\n StudyRefusal,\n} from './study.js';\nexport type {\n ProbeStudy,\n ProbeStudyOptions,\n ProbeStudyResult,\n StudyVerdict,\n ReplicationOutcome,\n StudyRole,\n StudyProvenance,\n StudyObservation,\n StudyBaseline,\n SetTest,\n ModelTest,\n CandidateTest,\n StudyDesignSuggestion,\n StudyCorrection,\n StudyCorrectionReport,\n CorrectionStep,\n} from './study.js';\n/** One fitted correction coefficient with its standard error and, when declared, the reference it is compared with. */\nexport type { CorrectionCoefficient } from './study.js';\n"]}
@@ -2,15 +2,25 @@
2
2
  * Declared-limit checks for probe candidates.
3
3
  *
4
4
  * A failed limit is **not automatically fatal**. It is fatal only when the
5
- * candidate claims the domain in which the limit fails.
5
+ * candidate claims the domain in which the limit fails. A limit whose rows
6
+ * the candidate mostly could not be evaluated on is **undecided**, which is
7
+ * neither a pass nor a failure and is never fatal.
6
8
  *
7
9
  * @internal
8
10
  */
9
11
  import type { ExprNode } from '../../dimensional/ast-types.js';
10
12
  import type { DeclaredLimit, ProbeDataset } from './types.js';
13
+ /** What a limit check found: the limit held, failed, or could not be decided on these rows. @internal */
14
+ export type LimitOutcome = 'held' | 'failed' | 'undecided';
11
15
  export interface LimitCheckResult {
12
16
  readonly id: string;
17
+ /** `outcome === 'held'`. */
13
18
  readonly passed: boolean;
19
+ readonly outcome: LimitOutcome;
20
+ /** Rows the candidate was evaluated on (finite prediction and a finite observation). */
21
+ readonly evaluated: number;
22
+ /** Rows the candidate threw on, or predicted a non-finite value for, or that have no finite observation. */
23
+ readonly skipped: number;
14
24
  readonly claimedDomain: boolean;
15
25
  readonly fatal: boolean;
16
26
  readonly detail: string;
@@ -19,6 +29,19 @@ export interface LimitCheckResult {
19
29
  * Evaluate `prefactor · expr` RMSE on `dataset`. When the candidate does not
20
30
  * claim `limit.regime`, a failure is recorded but not fatal.
21
31
  *
32
+ * A row the candidate throws on, or predicts a non-finite value for, is
33
+ * skipped and COUNTED. When more rows were skipped than evaluated (or none
34
+ * could be evaluated), the outcome is `undecided`: a candidate that throws on
35
+ * nine rows of ten is not judged on the tenth. That threshold, skipped >
36
+ * evaluated, is a choice stated here, not a measured one.
37
+ *
38
+ * The pass rule is LOOSE by design: the limit holds when the RMSE over the
39
+ * evaluated rows is at most half the largest |observation| of the dataset. It
40
+ * catches a candidate that is wrong by its own scale in a regime, not one that
41
+ * is wrong by a few percent; the holdout tolerance is the quantitative test.
42
+ * The RMSE is core `norm2` of the residuals over √n (overflow-safe), so a
43
+ * residual of 1e200 is a number, not `Infinity`.
44
+ *
22
45
  * @internal
23
46
  */
24
47
  export declare function checkDeclaredLimit(expr: ExprNode, dataset: ProbeDataset, prefactor: number, limit: DeclaredLimit, claimsDomain: boolean): LimitCheckResult;
@@ -1 +1 @@
1
- {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG9D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,aAAa,EACpB,YAAY,EAAE,OAAO,GACpB,gBAAgB,CAyClB;AAED,0CAA0C;AAC1C,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,cAAc,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,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S,gBAAgB,EAAE,CAc7B"}
@@ -2,15 +2,31 @@
2
2
  * Declared-limit checks for probe candidates.
3
3
  *
4
4
  * A failed limit is **not automatically fatal**. It is fatal only when the
5
- * candidate claims the domain in which the limit fails.
5
+ * candidate claims the domain in which the limit fails. A limit whose rows
6
+ * the candidate mostly could not be evaluated on is **undecided**, which is
7
+ * neither a pass nor a failure and is never fatal.
6
8
  *
7
9
  * @internal
8
10
  */
11
+ import { norm2 } from '@danielsimonjr/mathts-core';
9
12
  import { evalExpr } from '../expr-eval.js';
10
13
  /**
11
14
  * Evaluate `prefactor · expr` RMSE on `dataset`. When the candidate does not
12
15
  * claim `limit.regime`, a failure is recorded but not fatal.
13
16
  *
17
+ * A row the candidate throws on, or predicts a non-finite value for, is
18
+ * skipped and COUNTED. When more rows were skipped than evaluated (or none
19
+ * could be evaluated), the outcome is `undecided`: a candidate that throws on
20
+ * nine rows of ten is not judged on the tenth. That threshold, skipped >
21
+ * evaluated, is a choice stated here, not a measured one.
22
+ *
23
+ * The pass rule is LOOSE by design: the limit holds when the RMSE over the
24
+ * evaluated rows is at most half the largest |observation| of the dataset. It
25
+ * catches a candidate that is wrong by its own scale in a regime, not one that
26
+ * is wrong by a few percent; the holdout tolerance is the quantitative test.
27
+ * The RMSE is core `norm2` of the residuals over √n (overflow-safe), so a
28
+ * residual of 1e200 is a number, not `Infinity`.
29
+ *
14
30
  * @internal
15
31
  */
16
32
  export function checkDeclaredLimit(expr, dataset, prefactor, limit, claimsDomain) {
@@ -18,40 +34,66 @@ export function checkDeclaredLimit(expr, dataset, prefactor, limit, claimsDomain
18
34
  return {
19
35
  id: limit.id,
20
36
  passed: true,
37
+ outcome: 'held',
38
+ evaluated: 0,
39
+ skipped: 0,
21
40
  claimedDomain: claimsDomain,
22
41
  fatal: false,
23
42
  detail: `no observations for declared-limit ${limit.id}`,
24
43
  };
25
44
  }
26
- let sumSq = 0;
27
- let n = 0;
45
+ const residuals = [];
46
+ let skipped = 0;
28
47
  for (const row of dataset.rows) {
29
48
  let predicted;
30
49
  try {
31
50
  predicted = prefactor * evalExpr(expr, row);
32
51
  }
33
52
  catch {
53
+ skipped += 1;
34
54
  continue;
35
55
  }
36
56
  const observed = row[dataset.observable];
37
- if (!Number.isFinite(predicted) || observed == null || !Number.isFinite(observed))
57
+ if (!Number.isFinite(predicted) || observed === undefined || !Number.isFinite(observed)) {
58
+ skipped += 1;
38
59
  continue;
39
- const err = predicted - observed;
40
- sumSq += err * err;
41
- n += 1;
60
+ }
61
+ residuals.push(predicted - observed);
62
+ }
63
+ const evaluated = residuals.length;
64
+ const total = dataset.rows.length;
65
+ if (evaluated === 0 || skipped > evaluated) {
66
+ return {
67
+ id: limit.id,
68
+ passed: false,
69
+ outcome: 'undecided',
70
+ evaluated,
71
+ skipped,
72
+ claimedDomain: claimsDomain,
73
+ fatal: false,
74
+ detail: `limit ${limit.id} undecided: ${skipped} of ${total} rows could not be evaluated (${evaluated} could); not judged on so few`,
75
+ };
42
76
  }
43
- const rmse = n === 0 ? Number.POSITIVE_INFINITY : Math.sqrt(sumSq / n);
44
- const scale = Math.max(...dataset.rows.map((r) => Math.abs(r[dataset.observable] ?? 0)), 1e-12);
77
+ const rmse = norm2(residuals) / Math.sqrt(evaluated);
78
+ // A reduce, not `Math.max(...rows)`: a spread of a large dataset overflows the call stack.
79
+ const scale = dataset.rows.reduce((m, r) => {
80
+ const v = r[dataset.observable];
81
+ return v !== undefined && Number.isFinite(v) ? Math.max(m, Math.abs(v)) : m;
82
+ }, 1e-12);
45
83
  const passed = Number.isFinite(rmse) && rmse <= 0.5 * scale;
46
84
  const fatal = !passed && claimsDomain;
85
+ const rows = skipped > 0 ? ` on ${evaluated} of ${total} rows (${skipped} skipped)` : '';
47
86
  return {
48
87
  id: limit.id,
49
88
  passed,
89
+ outcome: passed ? 'held' : 'failed',
90
+ evaluated,
91
+ skipped,
50
92
  claimedDomain: claimsDomain,
51
93
  fatal,
52
94
  detail: passed
53
- ? `limit ${limit.id} held (rmse=${rmse})`
54
- : `limit ${limit.id} failed (rmse=${rmse})${fatal ? ' — fatal because candidate claims this domain' : ' — not fatal (domain not claimed)'}`,
95
+ ? `limit ${limit.id} held (rmse=${rmse})${rows}`
96
+ : `limit ${limit.id} failed (rmse=${rmse})${rows}${fatal ? ' — fatal because candidate claims this domain' : ' — not fatal (domain not claimed)'}`,
55
97
  };
56
98
  }
57
99
  /** Run every declared limit. @internal */