universal-physics-tensor 9.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 (1109) hide show
  1. package/README.md +21 -17
  2. package/bin/upt.mjs +13 -1
  3. package/data/atlas/atlas.json +79 -68
  4. package/data/atlas/atlas.jsonld +1 -1
  5. package/data/atlas/diffusion.json +24 -23
  6. package/data/atlas/oscillators.json +21 -16
  7. package/data/atlas/waves.json +36 -31
  8. package/data/atlas/witness-results.json +11 -11
  9. package/data/bridge-catalog.json +1192 -1636
  10. package/data/bridge-catalog.schema.json +390 -135
  11. package/data/quantities.json +53 -19
  12. package/data/schemas/atlas-record.v0.json +184 -46
  13. package/data/units.json +33 -4
  14. package/dist/atlas/applicability.d.ts.map +1 -1
  15. package/dist/atlas/applicability.js +35 -18
  16. package/dist/atlas/applicability.js.map +1 -1
  17. package/dist/atlas/association.js.map +1 -1
  18. package/dist/atlas/benchmark/backend-shapes.d.ts.map +1 -1
  19. package/dist/atlas/benchmark/backend-shapes.js +5 -1
  20. package/dist/atlas/benchmark/backend-shapes.js.map +1 -1
  21. package/dist/atlas/benchmark/baselines.d.ts.map +1 -1
  22. package/dist/atlas/benchmark/baselines.js +8 -0
  23. package/dist/atlas/benchmark/baselines.js.map +1 -1
  24. package/dist/atlas/benchmark/hybrid-retrieval.d.ts +12 -3
  25. package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
  26. package/dist/atlas/benchmark/hybrid-retrieval.js +30 -21
  27. package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
  28. package/dist/atlas/benchmark/leakage.js.map +1 -1
  29. package/dist/atlas/benchmark/loader.js +2 -2
  30. package/dist/atlas/benchmark/loader.js.map +1 -1
  31. package/dist/atlas/benchmark/run-atlas.d.ts.map +1 -1
  32. package/dist/atlas/benchmark/run-atlas.js +14 -2
  33. package/dist/atlas/benchmark/run-atlas.js.map +1 -1
  34. package/dist/atlas/benchmark/stats.d.ts +3 -3
  35. package/dist/atlas/benchmark/stats.d.ts.map +1 -1
  36. package/dist/atlas/benchmark/stats.js +16 -8
  37. package/dist/atlas/benchmark/stats.js.map +1 -1
  38. package/dist/atlas/benchmark/study.js.map +1 -1
  39. package/dist/atlas/benchmark/types.js.map +1 -1
  40. package/dist/atlas/bridge-record.d.ts +4 -4
  41. package/dist/atlas/bridge-record.d.ts.map +1 -1
  42. package/dist/atlas/bridge-record.js +6 -6
  43. package/dist/atlas/bridge-record.js.map +1 -1
  44. package/dist/atlas/catalog-formal-ref.d.ts +26 -3
  45. package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
  46. package/dist/atlas/catalog-formal-ref.js +52 -5
  47. package/dist/atlas/catalog-formal-ref.js.map +1 -1
  48. package/dist/atlas/chain-pipeline.d.ts +0 -11
  49. package/dist/atlas/chain-pipeline.d.ts.map +1 -1
  50. package/dist/atlas/chain-pipeline.js +12 -24
  51. package/dist/atlas/chain-pipeline.js.map +1 -1
  52. package/dist/atlas/composition-table.js.map +1 -1
  53. package/dist/atlas/conventions.js.map +1 -1
  54. package/dist/atlas/coverage.d.ts +2 -2
  55. package/dist/atlas/coverage.js.map +1 -1
  56. package/dist/atlas/derivation.js.map +1 -1
  57. package/dist/atlas/derive-evidence.d.ts +6 -4
  58. package/dist/atlas/derive-evidence.d.ts.map +1 -1
  59. package/dist/atlas/derive-evidence.js +7 -2
  60. package/dist/atlas/derive-evidence.js.map +1 -1
  61. package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
  62. package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
  63. package/dist/atlas/diffusion/bridges-closure.js +8 -17
  64. package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
  65. package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
  66. package/dist/atlas/diffusion/bridges.js +27 -42
  67. package/dist/atlas/diffusion/bridges.js.map +1 -1
  68. package/dist/atlas/diffusion/dimensions.d.ts +6 -14
  69. package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
  70. package/dist/atlas/diffusion/dimensions.js +8 -16
  71. package/dist/atlas/diffusion/dimensions.js.map +1 -1
  72. package/dist/atlas/diffusion/index.d.ts +1 -1
  73. package/dist/atlas/diffusion/index.d.ts.map +1 -1
  74. package/dist/atlas/diffusion/index.js.map +1 -1
  75. package/dist/atlas/diffusion/models.d.ts +3 -3
  76. package/dist/atlas/diffusion/models.d.ts.map +1 -1
  77. package/dist/atlas/diffusion/models.js +5 -10
  78. package/dist/atlas/diffusion/models.js.map +1 -1
  79. package/dist/atlas/diffusion/numerics.d.ts +16 -4
  80. package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
  81. package/dist/atlas/diffusion/numerics.js +38 -24
  82. package/dist/atlas/diffusion/numerics.js.map +1 -1
  83. package/dist/atlas/error-algebra.d.ts +6 -0
  84. package/dist/atlas/error-algebra.d.ts.map +1 -1
  85. package/dist/atlas/error-algebra.js +26 -0
  86. package/dist/atlas/error-algebra.js.map +1 -1
  87. package/dist/atlas/export.d.ts +18 -2
  88. package/dist/atlas/export.d.ts.map +1 -1
  89. package/dist/atlas/export.js +9 -3
  90. package/dist/atlas/export.js.map +1 -1
  91. package/dist/atlas/families.d.ts +19 -2
  92. package/dist/atlas/families.d.ts.map +1 -1
  93. package/dist/atlas/families.js +26 -3
  94. package/dist/atlas/families.js.map +1 -1
  95. package/dist/atlas/family.d.ts +27 -0
  96. package/dist/atlas/family.d.ts.map +1 -0
  97. package/dist/atlas/family.js +12 -0
  98. package/dist/atlas/family.js.map +1 -0
  99. package/dist/atlas/index.d.ts +3 -2
  100. package/dist/atlas/index.d.ts.map +1 -1
  101. package/dist/atlas/index.js +2 -1
  102. package/dist/atlas/index.js.map +1 -1
  103. package/dist/atlas/link-prediction.d.ts +107 -4
  104. package/dist/atlas/link-prediction.d.ts.map +1 -1
  105. package/dist/atlas/link-prediction.js +212 -66
  106. package/dist/atlas/link-prediction.js.map +1 -1
  107. package/dist/atlas/model.js.map +1 -1
  108. package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
  109. package/dist/atlas/oscillators/bridges-coarse.js +7 -12
  110. package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
  111. package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
  112. package/dist/atlas/oscillators/bridges-exact.js +6 -10
  113. package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
  114. package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
  115. package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
  116. package/dist/atlas/oscillators/bridges-limits.js +23 -36
  117. package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
  118. package/dist/atlas/oscillators/dimensions.d.ts +9 -21
  119. package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
  120. package/dist/atlas/oscillators/dimensions.js +9 -21
  121. package/dist/atlas/oscillators/dimensions.js.map +1 -1
  122. package/dist/atlas/oscillators/index.d.ts +1 -16
  123. package/dist/atlas/oscillators/index.d.ts.map +1 -1
  124. package/dist/atlas/oscillators/index.js.map +1 -1
  125. package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
  126. package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
  127. package/dist/atlas/oscillators/limit-witnesses.js +17 -15
  128. package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
  129. package/dist/atlas/oscillators/models.d.ts.map +1 -1
  130. package/dist/atlas/oscillators/models.js +2 -6
  131. package/dist/atlas/oscillators/models.js.map +1 -1
  132. package/dist/atlas/oscillators/norm-transport-witness.js.map +1 -1
  133. package/dist/atlas/oscillators/norm-transport.js.map +1 -1
  134. package/dist/atlas/oscillators/norms.js.map +1 -1
  135. package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
  136. package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
  137. package/dist/atlas/oscillators/pendulum-motion.js +60 -40
  138. package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
  139. package/dist/atlas/oscillators/phase-carriage.js.map +1 -1
  140. package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
  141. package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
  142. package/dist/atlas/oscillators/phase-translation.js +3 -4
  143. package/dist/atlas/oscillators/phase-translation.js.map +1 -1
  144. package/dist/atlas/oscillators/position-translation.d.ts +68 -7
  145. package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
  146. package/dist/atlas/oscillators/position-translation.js +123 -12
  147. package/dist/atlas/oscillators/position-translation.js.map +1 -1
  148. package/dist/atlas/oscillators/rejections.d.ts +0 -2
  149. package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
  150. package/dist/atlas/oscillators/rejections.js +0 -7
  151. package/dist/atlas/oscillators/rejections.js.map +1 -1
  152. package/dist/atlas/path-bound.js.map +1 -1
  153. package/dist/atlas/physjs-entries.generated.d.ts +25 -24
  154. package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
  155. package/dist/atlas/physjs-entries.generated.js +25 -24
  156. package/dist/atlas/physjs-entries.generated.js.map +1 -1
  157. package/dist/atlas/physjs-ref.d.ts +107 -70
  158. package/dist/atlas/physjs-ref.d.ts.map +1 -1
  159. package/dist/atlas/physjs-ref.js +184 -101
  160. package/dist/atlas/physjs-ref.js.map +1 -1
  161. package/dist/atlas/physjs-reviewed.d.ts +31 -0
  162. package/dist/atlas/physjs-reviewed.d.ts.map +1 -0
  163. package/dist/atlas/physjs-reviewed.js +194 -0
  164. package/dist/atlas/physjs-reviewed.js.map +1 -0
  165. package/dist/atlas/poster/associations.js.map +1 -1
  166. package/dist/atlas/poster/derivations.js.map +1 -1
  167. package/dist/atlas/poster/statements.d.ts +0 -19
  168. package/dist/atlas/poster/statements.d.ts.map +1 -1
  169. package/dist/atlas/poster/statements.js +1 -1
  170. package/dist/atlas/poster/statements.js.map +1 -1
  171. package/dist/atlas/proof-target.d.ts +1 -1
  172. package/dist/atlas/proof-target.js +1 -1
  173. package/dist/atlas/proof-target.js.map +1 -1
  174. package/dist/atlas/public.d.ts +2 -1
  175. package/dist/atlas/public.d.ts.map +1 -1
  176. package/dist/atlas/public.js +2 -1
  177. package/dist/atlas/public.js.map +1 -1
  178. package/dist/atlas/regime.d.ts +1 -1
  179. package/dist/atlas/regime.d.ts.map +1 -1
  180. package/dist/atlas/regime.js +1 -1
  181. package/dist/atlas/regime.js.map +1 -1
  182. package/dist/atlas/serialize.d.ts +18 -12
  183. package/dist/atlas/serialize.d.ts.map +1 -1
  184. package/dist/atlas/serialize.js +28 -18
  185. package/dist/atlas/serialize.js.map +1 -1
  186. package/dist/atlas/statement.js.map +1 -1
  187. package/dist/atlas/text-overlap.d.ts +23 -0
  188. package/dist/atlas/text-overlap.d.ts.map +1 -0
  189. package/dist/atlas/text-overlap.js +41 -0
  190. package/dist/atlas/text-overlap.js.map +1 -0
  191. package/dist/atlas/translation-registry.js.map +1 -1
  192. package/dist/atlas/translation.js.map +1 -1
  193. package/dist/atlas/types.d.ts +9 -2
  194. package/dist/atlas/types.d.ts.map +1 -1
  195. package/dist/atlas/types.js +1 -1
  196. package/dist/atlas/types.js.map +1 -1
  197. package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
  198. package/dist/atlas/waves/bridges-closure.js +2 -9
  199. package/dist/atlas/waves/bridges-closure.js.map +1 -1
  200. package/dist/atlas/waves/bridges.d.ts.map +1 -1
  201. package/dist/atlas/waves/bridges.js +32 -52
  202. package/dist/atlas/waves/bridges.js.map +1 -1
  203. package/dist/atlas/waves/index.d.ts +1 -1
  204. package/dist/atlas/waves/index.d.ts.map +1 -1
  205. package/dist/atlas/waves/index.js.map +1 -1
  206. package/dist/atlas/waves/models.d.ts +5 -6
  207. package/dist/atlas/waves/models.d.ts.map +1 -1
  208. package/dist/atlas/waves/models.js +7 -13
  209. package/dist/atlas/waves/models.js.map +1 -1
  210. package/dist/atlas/waves/numerics.d.ts.map +1 -1
  211. package/dist/atlas/waves/numerics.js +10 -3
  212. package/dist/atlas/waves/numerics.js.map +1 -1
  213. package/dist/atlas/witness-artifact.js.map +1 -1
  214. package/dist/atlas/witness-dominance.d.ts +4 -3
  215. package/dist/atlas/witness-dominance.d.ts.map +1 -1
  216. package/dist/atlas/witness-dominance.js +15 -5
  217. package/dist/atlas/witness-dominance.js.map +1 -1
  218. package/dist/atlas/witness-numeric.d.ts +38 -4
  219. package/dist/atlas/witness-numeric.d.ts.map +1 -1
  220. package/dist/atlas/witness-numeric.js +80 -2
  221. package/dist/atlas/witness-numeric.js.map +1 -1
  222. package/dist/atlas/witness-result.d.ts +7 -1
  223. package/dist/atlas/witness-result.d.ts.map +1 -1
  224. package/dist/atlas/witness-result.js.map +1 -1
  225. package/dist/atlas/witness-specs.d.ts.map +1 -1
  226. package/dist/atlas/witness-specs.js +19 -0
  227. package/dist/atlas/witness-specs.js.map +1 -1
  228. package/dist/atlas/witness-symbolic.d.ts +75 -3
  229. package/dist/atlas/witness-symbolic.d.ts.map +1 -1
  230. package/dist/atlas/witness-symbolic.js +116 -10
  231. package/dist/atlas/witness-symbolic.js.map +1 -1
  232. package/dist/atlas/witnesses/quantum-support.js.map +1 -1
  233. package/dist/bridges/caller-table.d.ts +1 -1
  234. package/dist/bridges/caller-table.d.ts.map +1 -1
  235. package/dist/bridges/caller-table.js.map +1 -1
  236. package/dist/bridges/carrier-sign.d.ts.map +1 -1
  237. package/dist/bridges/carrier-sign.js +8 -3
  238. package/dist/bridges/carrier-sign.js.map +1 -1
  239. package/dist/bridges/catalog-adapter.d.ts +12 -3
  240. package/dist/bridges/catalog-adapter.d.ts.map +1 -1
  241. package/dist/bridges/catalog-adapter.js +17 -9
  242. package/dist/bridges/catalog-adapter.js.map +1 -1
  243. package/dist/bridges/catalog-load.d.ts +12 -2
  244. package/dist/bridges/catalog-load.d.ts.map +1 -1
  245. package/dist/bridges/catalog-load.js +181 -13
  246. package/dist/bridges/catalog-load.js.map +1 -1
  247. package/dist/bridges/catalog-types.d.ts +74 -26
  248. package/dist/bridges/catalog-types.d.ts.map +1 -1
  249. package/dist/bridges/catalog-types.js +11 -1
  250. package/dist/bridges/catalog-types.js.map +1 -1
  251. package/dist/bridges/coefficient-statement.js +1 -5
  252. package/dist/bridges/coefficient-statement.js.map +1 -1
  253. package/dist/bridges/confrontation-coverage.js.map +1 -1
  254. package/dist/bridges/confrontations.d.ts +1 -1
  255. package/dist/bridges/confrontations.d.ts.map +1 -1
  256. package/dist/bridges/confrontations.js +1 -1
  257. package/dist/bridges/confrontations.js.map +1 -1
  258. package/dist/bridges/evaluation-errors.d.ts +46 -3
  259. package/dist/bridges/evaluation-errors.d.ts.map +1 -1
  260. package/dist/bridges/evaluation-errors.js +40 -4
  261. package/dist/bridges/evaluation-errors.js.map +1 -1
  262. package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
  263. package/dist/bridges/evaluator-inputs.js +7 -5
  264. package/dist/bridges/evaluator-inputs.js.map +1 -1
  265. package/dist/bridges/evaluators.d.ts +17 -2
  266. package/dist/bridges/evaluators.d.ts.map +1 -1
  267. package/dist/bridges/evaluators.js +76 -28
  268. package/dist/bridges/evaluators.js.map +1 -1
  269. package/dist/bridges/expr-parse.d.ts +38 -4
  270. package/dist/bridges/expr-parse.d.ts.map +1 -1
  271. package/dist/bridges/expr-parse.js +101 -12
  272. package/dist/bridges/expr-parse.js.map +1 -1
  273. package/dist/bridges/holds.d.ts +40 -4
  274. package/dist/bridges/holds.d.ts.map +1 -1
  275. package/dist/bridges/holds.js +128 -19
  276. package/dist/bridges/holds.js.map +1 -1
  277. package/dist/bridges/index.d.ts +15 -14
  278. package/dist/bridges/index.d.ts.map +1 -1
  279. package/dist/bridges/index.js +14 -15
  280. package/dist/bridges/index.js.map +1 -1
  281. package/dist/bridges/input-contract.js.map +1 -1
  282. package/dist/bridges/membership.d.ts +5 -3
  283. package/dist/bridges/membership.d.ts.map +1 -1
  284. package/dist/bridges/membership.js +5 -6
  285. package/dist/bridges/membership.js.map +1 -1
  286. package/dist/bridges/notices.d.ts.map +1 -1
  287. package/dist/bridges/notices.js +5 -5
  288. package/dist/bridges/notices.js.map +1 -1
  289. package/dist/bridges/observations/types.js.map +1 -1
  290. package/dist/bridges/rejected.d.ts +11 -17
  291. package/dist/bridges/rejected.d.ts.map +1 -1
  292. package/dist/bridges/rejected.js +13 -68
  293. package/dist/bridges/rejected.js.map +1 -1
  294. package/dist/bridges/relation-eval.d.ts +6 -7
  295. package/dist/bridges/relation-eval.d.ts.map +1 -1
  296. package/dist/bridges/relation-eval.js +20 -50
  297. package/dist/bridges/relation-eval.js.map +1 -1
  298. package/dist/bridges/rhs-registry.js.map +1 -1
  299. package/dist/bridges/sensitivity.d.ts +11 -3
  300. package/dist/bridges/sensitivity.d.ts.map +1 -1
  301. package/dist/bridges/sensitivity.js +27 -13
  302. package/dist/bridges/sensitivity.js.map +1 -1
  303. package/dist/bridges/tensor-index.js.map +1 -1
  304. package/dist/bridges/types.d.ts +1 -7
  305. package/dist/bridges/types.d.ts.map +1 -1
  306. package/dist/bridges/types.js +1 -4
  307. package/dist/bridges/types.js.map +1 -1
  308. package/dist/bridges/validity.d.ts +33 -0
  309. package/dist/bridges/validity.d.ts.map +1 -0
  310. package/dist/bridges/validity.js +67 -0
  311. package/dist/bridges/validity.js.map +1 -0
  312. package/dist/canonical/canonical-equation.js.map +1 -1
  313. package/dist/canonical/dimensional-fields.js.map +1 -1
  314. package/dist/canonical/entries/_l1-build.js.map +1 -1
  315. package/dist/canonical/entries/atomic.js +1 -3
  316. package/dist/canonical/entries/atomic.js.map +1 -1
  317. package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
  318. package/dist/canonical/entries/condensed-matter.js +8 -9
  319. package/dist/canonical/entries/condensed-matter.js.map +1 -1
  320. package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
  321. package/dist/canonical/entries/dimensional-classics.js +5 -6
  322. package/dist/canonical/entries/dimensional-classics.js.map +1 -1
  323. package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
  324. package/dist/canonical/entries/electromagnetism.js +6 -12
  325. package/dist/canonical/entries/electromagnetism.js.map +1 -1
  326. package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
  327. package/dist/canonical/entries/fluids-waves.js +3 -7
  328. package/dist/canonical/entries/fluids-waves.js.map +1 -1
  329. package/dist/canonical/entries/mechanics.d.ts.map +1 -1
  330. package/dist/canonical/entries/mechanics.js +4 -6
  331. package/dist/canonical/entries/mechanics.js.map +1 -1
  332. package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
  333. package/dist/canonical/entries/nonmonomial.js +38 -39
  334. package/dist/canonical/entries/nonmonomial.js.map +1 -1
  335. package/dist/canonical/entries/relativity.d.ts.map +1 -1
  336. package/dist/canonical/entries/relativity.js +6 -6
  337. package/dist/canonical/entries/relativity.js.map +1 -1
  338. package/dist/canonical/entries/statistical-mechanics.js +5 -5
  339. package/dist/canonical/entries/statistical-mechanics.js.map +1 -1
  340. package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
  341. package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
  342. package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
  343. package/dist/canonical/fixed-points.d.ts +94 -0
  344. package/dist/canonical/fixed-points.d.ts.map +1 -0
  345. package/dist/canonical/fixed-points.js +81 -0
  346. package/dist/canonical/fixed-points.js.map +1 -0
  347. package/dist/canonical/linkage.d.ts +29 -4
  348. package/dist/canonical/linkage.d.ts.map +1 -1
  349. package/dist/canonical/linkage.js +47 -64
  350. package/dist/canonical/linkage.js.map +1 -1
  351. package/dist/canonical/normal-form.d.ts +0 -8
  352. package/dist/canonical/normal-form.d.ts.map +1 -1
  353. package/dist/canonical/normal-form.js +22 -23
  354. package/dist/canonical/normal-form.js.map +1 -1
  355. package/dist/canonical/registry.js.map +1 -1
  356. package/dist/canonical/residual.js.map +1 -1
  357. package/dist/canonical/seed-l-layer.d.ts +7 -1
  358. package/dist/canonical/seed-l-layer.d.ts.map +1 -1
  359. package/dist/canonical/seed-l-layer.js +7 -1
  360. package/dist/canonical/seed-l-layer.js.map +1 -1
  361. package/dist/canonical/structural.d.ts +42 -21
  362. package/dist/canonical/structural.d.ts.map +1 -1
  363. package/dist/canonical/structural.js +64 -23
  364. package/dist/canonical/structural.js.map +1 -1
  365. package/dist/cases/brownian-sphere.d.ts +3 -3
  366. package/dist/cases/brownian-sphere.d.ts.map +1 -1
  367. package/dist/cases/brownian-sphere.js +10 -9
  368. package/dist/cases/brownian-sphere.js.map +1 -1
  369. package/dist/cases/damped-resonator.d.ts.map +1 -1
  370. package/dist/cases/damped-resonator.js +8 -11
  371. package/dist/cases/damped-resonator.js.map +1 -1
  372. package/dist/cases/index.js.map +1 -1
  373. package/dist/cases/kepler-rv.d.ts +1 -1
  374. package/dist/cases/kepler-rv.d.ts.map +1 -1
  375. package/dist/cases/kepler-rv.js +3 -2
  376. package/dist/cases/kepler-rv.js.map +1 -1
  377. package/dist/cases/lumped-cooling.d.ts +8 -3
  378. package/dist/cases/lumped-cooling.d.ts.map +1 -1
  379. package/dist/cases/lumped-cooling.js +22 -24
  380. package/dist/cases/lumped-cooling.js.map +1 -1
  381. package/dist/cases/quadrature.d.ts +7 -9
  382. package/dist/cases/quadrature.d.ts.map +1 -1
  383. package/dist/cases/quadrature.js +28 -32
  384. package/dist/cases/quadrature.js.map +1 -1
  385. package/dist/cases/resistor-noise.js +7 -7
  386. package/dist/cases/resistor-noise.js.map +1 -1
  387. package/dist/cases/skin-depth.d.ts +0 -4
  388. package/dist/cases/skin-depth.d.ts.map +1 -1
  389. package/dist/cases/skin-depth.js +3 -7
  390. package/dist/cases/skin-depth.js.map +1 -1
  391. package/dist/cases/types.js.map +1 -1
  392. package/dist/cli/args.d.ts +30 -3
  393. package/dist/cli/args.d.ts.map +1 -1
  394. package/dist/cli/args.js +47 -9
  395. package/dist/cli/args.js.map +1 -1
  396. package/dist/cli/bindings.d.ts +13 -0
  397. package/dist/cli/bindings.d.ts.map +1 -0
  398. package/dist/cli/bindings.js +33 -0
  399. package/dist/cli/bindings.js.map +1 -0
  400. package/dist/cli/closed-form-range.js.map +1 -1
  401. package/dist/cli/command.d.ts +8 -1
  402. package/dist/cli/command.d.ts.map +1 -1
  403. package/dist/cli/command.js.map +1 -1
  404. package/dist/cli/commands/_atlas-map.d.ts +2 -11
  405. package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
  406. package/dist/cli/commands/_atlas-map.js +50 -35
  407. package/dist/cli/commands/_atlas-map.js.map +1 -1
  408. package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
  409. package/dist/cli/commands/_atlas-route.js +6 -2
  410. package/dist/cli/commands/_atlas-route.js.map +1 -1
  411. package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
  412. package/dist/cli/commands/_discovery-opts.js +48 -14
  413. package/dist/cli/commands/_discovery-opts.js.map +1 -1
  414. package/dist/cli/commands/atlas.d.ts.map +1 -1
  415. package/dist/cli/commands/atlas.js +9 -8
  416. package/dist/cli/commands/atlas.js.map +1 -1
  417. package/dist/cli/commands/audit.d.ts.map +1 -1
  418. package/dist/cli/commands/audit.js +20 -20
  419. package/dist/cli/commands/audit.js.map +1 -1
  420. package/dist/cli/commands/axes.d.ts.map +1 -1
  421. package/dist/cli/commands/axes.js +20 -1
  422. package/dist/cli/commands/axes.js.map +1 -1
  423. package/dist/cli/commands/candidates.d.ts.map +1 -1
  424. package/dist/cli/commands/candidates.js +16 -8
  425. package/dist/cli/commands/candidates.js.map +1 -1
  426. package/dist/cli/commands/canonical.js.map +1 -1
  427. package/dist/cli/commands/chain.js +1 -1
  428. package/dist/cli/commands/chain.js.map +1 -1
  429. package/dist/cli/commands/confront.d.ts.map +1 -1
  430. package/dist/cli/commands/confront.js +22 -20
  431. package/dist/cli/commands/confront.js.map +1 -1
  432. package/dist/cli/commands/connectors.js.map +1 -1
  433. package/dist/cli/commands/coverage.js.map +1 -1
  434. package/dist/cli/commands/derive.d.ts.map +1 -1
  435. package/dist/cli/commands/derive.js +60 -35
  436. package/dist/cli/commands/derive.js.map +1 -1
  437. package/dist/cli/commands/discover.d.ts.map +1 -1
  438. package/dist/cli/commands/discover.js +20 -10
  439. package/dist/cli/commands/discover.js.map +1 -1
  440. package/dist/cli/commands/eval.d.ts.map +1 -1
  441. package/dist/cli/commands/eval.js +14 -10
  442. package/dist/cli/commands/eval.js.map +1 -1
  443. package/dist/cli/commands/evaluate.d.ts.map +1 -1
  444. package/dist/cli/commands/evaluate.js +108 -58
  445. package/dist/cli/commands/evaluate.js.map +1 -1
  446. package/dist/cli/commands/explain.d.ts.map +1 -1
  447. package/dist/cli/commands/explain.js +16 -8
  448. package/dist/cli/commands/explain.js.map +1 -1
  449. package/dist/cli/commands/frontier.js.map +1 -1
  450. package/dist/cli/commands/ground.d.ts.map +1 -1
  451. package/dist/cli/commands/ground.js +41 -10
  452. package/dist/cli/commands/ground.js.map +1 -1
  453. package/dist/cli/commands/index.js.map +1 -1
  454. package/dist/cli/commands/map.d.ts.map +1 -1
  455. package/dist/cli/commands/map.js +155 -92
  456. package/dist/cli/commands/map.js.map +1 -1
  457. package/dist/cli/commands/metric.d.ts.map +1 -1
  458. package/dist/cli/commands/metric.js +58 -20
  459. package/dist/cli/commands/metric.js.map +1 -1
  460. package/dist/cli/commands/path.d.ts +10 -0
  461. package/dist/cli/commands/path.d.ts.map +1 -1
  462. package/dist/cli/commands/path.js +29 -7
  463. package/dist/cli/commands/path.js.map +1 -1
  464. package/dist/cli/commands/predict.js.map +1 -1
  465. package/dist/cli/commands/priority.js.map +1 -1
  466. package/dist/cli/commands/probe.d.ts.map +1 -1
  467. package/dist/cli/commands/probe.js +105 -38
  468. package/dist/cli/commands/probe.js.map +1 -1
  469. package/dist/cli/commands/recover.js +1 -1
  470. package/dist/cli/commands/recover.js.map +1 -1
  471. package/dist/cli/commands/regime.d.ts +5 -4
  472. package/dist/cli/commands/regime.d.ts.map +1 -1
  473. package/dist/cli/commands/regime.js +25 -26
  474. package/dist/cli/commands/regime.js.map +1 -1
  475. package/dist/cli/commands/retrieve.d.ts.map +1 -1
  476. package/dist/cli/commands/retrieve.js +23 -14
  477. package/dist/cli/commands/retrieve.js.map +1 -1
  478. package/dist/cli/commands/search.d.ts.map +1 -1
  479. package/dist/cli/commands/search.js +9 -4
  480. package/dist/cli/commands/search.js.map +1 -1
  481. package/dist/cli/commands/symbolic.js +31 -36
  482. package/dist/cli/commands/symbolic.js.map +1 -1
  483. package/dist/cli/commands/testplan.d.ts.map +1 -1
  484. package/dist/cli/commands/testplan.js +5 -3
  485. package/dist/cli/commands/testplan.js.map +1 -1
  486. package/dist/cli/conventions.js.map +1 -1
  487. package/dist/cli/determination.js.map +1 -1
  488. package/dist/cli/errors.js.map +1 -1
  489. package/dist/cli/euler-guard.js.map +1 -1
  490. package/dist/cli/eval-numbers.js.map +1 -1
  491. package/dist/cli/expr-print.d.ts +28 -3
  492. package/dist/cli/expr-print.d.ts.map +1 -1
  493. package/dist/cli/expr-print.js +42 -22
  494. package/dist/cli/expr-print.js.map +1 -1
  495. package/dist/cli/flag-help.js.map +1 -1
  496. package/dist/cli/graphs.js.map +1 -1
  497. package/dist/cli/library-defaults.d.ts +19 -0
  498. package/dist/cli/library-defaults.d.ts.map +1 -0
  499. package/dist/cli/library-defaults.js +22 -0
  500. package/dist/cli/library-defaults.js.map +1 -0
  501. package/dist/cli/main.d.ts +7 -0
  502. package/dist/cli/main.d.ts.map +1 -1
  503. package/dist/cli/main.js +25 -6
  504. package/dist/cli/main.js.map +1 -1
  505. package/dist/cli/map-evidence.js.map +1 -1
  506. package/dist/cli/numeric-flag.d.ts +12 -0
  507. package/dist/cli/numeric-flag.d.ts.map +1 -0
  508. package/dist/cli/numeric-flag.js +44 -0
  509. package/dist/cli/numeric-flag.js.map +1 -0
  510. package/dist/cli/output.d.ts +23 -6
  511. package/dist/cli/output.d.ts.map +1 -1
  512. package/dist/cli/output.js +15 -0
  513. package/dist/cli/output.js.map +1 -1
  514. package/dist/cli/published-url.js.map +1 -1
  515. package/dist/cli/record-reach.d.ts +6 -0
  516. package/dist/cli/record-reach.d.ts.map +1 -1
  517. package/dist/cli/record-reach.js +17 -11
  518. package/dist/cli/record-reach.js.map +1 -1
  519. package/dist/cli/record-tables.d.ts.map +1 -1
  520. package/dist/cli/record-tables.js +7 -6
  521. package/dist/cli/record-tables.js.map +1 -1
  522. package/dist/cli/record.d.ts +1 -5
  523. package/dist/cli/record.d.ts.map +1 -1
  524. package/dist/cli/record.js +40 -20
  525. package/dist/cli/record.js.map +1 -1
  526. package/dist/cli/search-index.d.ts +5 -0
  527. package/dist/cli/search-index.d.ts.map +1 -1
  528. package/dist/cli/search-index.js +19 -7
  529. package/dist/cli/search-index.js.map +1 -1
  530. package/dist/cli/statuses.d.ts +0 -2
  531. package/dist/cli/statuses.d.ts.map +1 -1
  532. package/dist/cli/statuses.js +0 -7
  533. package/dist/cli/statuses.js.map +1 -1
  534. package/dist/cli/stored-results.d.ts +7 -0
  535. package/dist/cli/stored-results.d.ts.map +1 -0
  536. package/dist/cli/stored-results.js +23 -0
  537. package/dist/cli/stored-results.js.map +1 -0
  538. package/dist/cli/top-level-help.js.map +1 -1
  539. package/dist/cli/version.d.ts.map +1 -1
  540. package/dist/cli/version.js +7 -5
  541. package/dist/cli/version.js.map +1 -1
  542. package/dist/cli-api.d.ts +49 -14
  543. package/dist/cli-api.d.ts.map +1 -1
  544. package/dist/cli-api.js +42 -17
  545. package/dist/cli-api.js.map +1 -1
  546. package/dist/composition/adjudication.js.map +1 -1
  547. package/dist/composition/algebraic-equivalence.d.ts +43 -0
  548. package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
  549. package/dist/composition/algebraic-equivalence.js +115 -0
  550. package/dist/composition/algebraic-equivalence.js.map +1 -0
  551. package/dist/composition/aliases.js.map +1 -1
  552. package/dist/composition/audit-coverage.d.ts +2 -0
  553. package/dist/composition/audit-coverage.d.ts.map +1 -1
  554. package/dist/composition/audit-coverage.js.map +1 -1
  555. package/dist/composition/axes.d.ts +6 -0
  556. package/dist/composition/axes.d.ts.map +1 -1
  557. package/dist/composition/axes.js +18 -6
  558. package/dist/composition/axes.js.map +1 -1
  559. package/dist/composition/axis-audit.d.ts +47 -20
  560. package/dist/composition/axis-audit.d.ts.map +1 -1
  561. package/dist/composition/axis-audit.js +82 -9
  562. package/dist/composition/axis-audit.js.map +1 -1
  563. package/dist/composition/bridge-analysis.d.ts +14 -15
  564. package/dist/composition/bridge-analysis.d.ts.map +1 -1
  565. package/dist/composition/bridge-analysis.js +148 -91
  566. package/dist/composition/bridge-analysis.js.map +1 -1
  567. package/dist/composition/bridge-prediction.d.ts +5 -1
  568. package/dist/composition/bridge-prediction.d.ts.map +1 -1
  569. package/dist/composition/bridge-prediction.js +12 -16
  570. package/dist/composition/bridge-prediction.js.map +1 -1
  571. package/dist/composition/buckingham-filter.js.map +1 -1
  572. package/dist/composition/canonical-compare.d.ts +40 -0
  573. package/dist/composition/canonical-compare.d.ts.map +1 -1
  574. package/dist/composition/canonical-compare.js +134 -26
  575. package/dist/composition/canonical-compare.js.map +1 -1
  576. package/dist/composition/canonical-graph.d.ts +9 -10
  577. package/dist/composition/canonical-graph.d.ts.map +1 -1
  578. package/dist/composition/canonical-graph.js +33 -102
  579. package/dist/composition/canonical-graph.js.map +1 -1
  580. package/dist/composition/canonical-json.js +2 -2
  581. package/dist/composition/canonical-json.js.map +1 -1
  582. package/dist/composition/canonical-prefactors.js.map +1 -1
  583. package/dist/composition/catalog-graph.d.ts.map +1 -1
  584. package/dist/composition/catalog-graph.js +8 -25
  585. package/dist/composition/catalog-graph.js.map +1 -1
  586. package/dist/composition/chain-candidate.d.ts +10 -0
  587. package/dist/composition/chain-candidate.d.ts.map +1 -1
  588. package/dist/composition/chain-candidate.js +11 -2
  589. package/dist/composition/chain-candidate.js.map +1 -1
  590. package/dist/composition/chain-match.d.ts +6 -3
  591. package/dist/composition/chain-match.d.ts.map +1 -1
  592. package/dist/composition/chain-match.js +4 -1
  593. package/dist/composition/chain-match.js.map +1 -1
  594. package/dist/composition/chain-regime.js.map +1 -1
  595. package/dist/composition/chain-result.d.ts.map +1 -1
  596. package/dist/composition/chain-result.js +2 -14
  597. package/dist/composition/chain-result.js.map +1 -1
  598. package/dist/composition/compose-surface.js.map +1 -1
  599. package/dist/composition/compose-symbolic.d.ts.map +1 -1
  600. package/dist/composition/compose-symbolic.js +3 -2
  601. package/dist/composition/compose-symbolic.js.map +1 -1
  602. package/dist/composition/compose.d.ts.map +1 -1
  603. package/dist/composition/compose.js +166 -41
  604. package/dist/composition/compose.js.map +1 -1
  605. package/dist/composition/composition-recovery.d.ts.map +1 -1
  606. package/dist/composition/composition-recovery.js +4 -7
  607. package/dist/composition/composition-recovery.js.map +1 -1
  608. package/dist/composition/consequence.d.ts.map +1 -1
  609. package/dist/composition/consequence.js +15 -6
  610. package/dist/composition/consequence.js.map +1 -1
  611. package/dist/composition/consistency.js.map +1 -1
  612. package/dist/composition/descriptor.d.ts +1 -1
  613. package/dist/composition/descriptor.d.ts.map +1 -1
  614. package/dist/composition/descriptor.js.map +1 -1
  615. package/dist/composition/dimension-adjacency.js.map +1 -1
  616. package/dist/composition/discovery.d.ts +77 -11
  617. package/dist/composition/discovery.d.ts.map +1 -1
  618. package/dist/composition/discovery.js +194 -80
  619. package/dist/composition/discovery.js.map +1 -1
  620. package/dist/composition/edge.d.ts +40 -10
  621. package/dist/composition/edge.d.ts.map +1 -1
  622. package/dist/composition/edge.js +47 -12
  623. package/dist/composition/edge.js.map +1 -1
  624. package/dist/composition/enumerate.d.ts +2 -2
  625. package/dist/composition/enumerate.d.ts.map +1 -1
  626. package/dist/composition/enumerate.js +18 -3
  627. package/dist/composition/enumerate.js.map +1 -1
  628. package/dist/composition/evaluate-relation.d.ts +35 -11
  629. package/dist/composition/evaluate-relation.d.ts.map +1 -1
  630. package/dist/composition/evaluate-relation.js +60 -39
  631. package/dist/composition/evaluate-relation.js.map +1 -1
  632. package/dist/composition/explain.d.ts +5 -9
  633. package/dist/composition/explain.d.ts.map +1 -1
  634. package/dist/composition/explain.js +38 -18
  635. package/dist/composition/explain.js.map +1 -1
  636. package/dist/composition/expr-eval.d.ts.map +1 -1
  637. package/dist/composition/expr-eval.js +2 -11
  638. package/dist/composition/expr-eval.js.map +1 -1
  639. package/dist/composition/expr-simplify.d.ts +16 -0
  640. package/dist/composition/expr-simplify.d.ts.map +1 -1
  641. package/dist/composition/expr-simplify.js +24 -59
  642. package/dist/composition/expr-simplify.js.map +1 -1
  643. package/dist/composition/expr-subst.js.map +1 -1
  644. package/dist/composition/formula-shape.d.ts +28 -0
  645. package/dist/composition/formula-shape.d.ts.map +1 -1
  646. package/dist/composition/formula-shape.js +96 -2
  647. package/dist/composition/formula-shape.js.map +1 -1
  648. package/dist/composition/frontier-account.d.ts +3 -2
  649. package/dist/composition/frontier-account.d.ts.map +1 -1
  650. package/dist/composition/frontier-account.js +7 -3
  651. package/dist/composition/frontier-account.js.map +1 -1
  652. package/dist/composition/graph-structure.d.ts +98 -0
  653. package/dist/composition/graph-structure.d.ts.map +1 -0
  654. package/dist/composition/graph-structure.js +167 -0
  655. package/dist/composition/graph-structure.js.map +1 -0
  656. package/dist/composition/graph-viz-svg.d.ts.map +1 -1
  657. package/dist/composition/graph-viz-svg.js +1 -1
  658. package/dist/composition/graph-viz-svg.js.map +1 -1
  659. package/dist/composition/graph-viz.d.ts.map +1 -1
  660. package/dist/composition/graph-viz.js +8 -37
  661. package/dist/composition/graph-viz.js.map +1 -1
  662. package/dist/composition/grounding.js.map +1 -1
  663. package/dist/composition/identifiability.d.ts +91 -4
  664. package/dist/composition/identifiability.d.ts.map +1 -1
  665. package/dist/composition/identifiability.js +363 -6
  666. package/dist/composition/identifiability.js.map +1 -1
  667. package/dist/composition/index.d.ts +14 -8
  668. package/dist/composition/index.d.ts.map +1 -1
  669. package/dist/composition/index.js +7 -5
  670. package/dist/composition/index.js.map +1 -1
  671. package/dist/composition/mathts-quiet.d.ts +29 -0
  672. package/dist/composition/mathts-quiet.d.ts.map +1 -0
  673. package/dist/composition/mathts-quiet.js +57 -0
  674. package/dist/composition/mathts-quiet.js.map +1 -0
  675. package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
  676. package/dist/composition/mathts-scalar-symbols.js +20 -35
  677. package/dist/composition/mathts-scalar-symbols.js.map +1 -1
  678. package/dist/composition/not-composable-seeds.d.ts +3 -1
  679. package/dist/composition/not-composable-seeds.d.ts.map +1 -1
  680. package/dist/composition/not-composable-seeds.js +2 -0
  681. package/dist/composition/not-composable-seeds.js.map +1 -1
  682. package/dist/composition/probe/backend-protocol.js.map +1 -1
  683. package/dist/composition/probe/candidate-store.js.map +1 -1
  684. package/dist/composition/probe/corpus.d.ts +4 -2
  685. package/dist/composition/probe/corpus.d.ts.map +1 -1
  686. package/dist/composition/probe/corpus.js +20 -9
  687. package/dist/composition/probe/corpus.js.map +1 -1
  688. package/dist/composition/probe/dataset.d.ts +17 -0
  689. package/dist/composition/probe/dataset.d.ts.map +1 -1
  690. package/dist/composition/probe/dataset.js +95 -50
  691. package/dist/composition/probe/dataset.js.map +1 -1
  692. package/dist/composition/probe/experiment-design.d.ts +5 -1
  693. package/dist/composition/probe/experiment-design.d.ts.map +1 -1
  694. package/dist/composition/probe/experiment-design.js +44 -24
  695. package/dist/composition/probe/experiment-design.js.map +1 -1
  696. package/dist/composition/probe/expression-gaps.js.map +1 -1
  697. package/dist/composition/probe/falsify.d.ts +14 -3
  698. package/dist/composition/probe/falsify.d.ts.map +1 -1
  699. package/dist/composition/probe/falsify.js +16 -27
  700. package/dist/composition/probe/falsify.js.map +1 -1
  701. package/dist/composition/probe/fingerprint.js.map +1 -1
  702. package/dist/composition/probe/fit.d.ts +7 -1
  703. package/dist/composition/probe/fit.d.ts.map +1 -1
  704. package/dist/composition/probe/fit.js +48 -23
  705. package/dist/composition/probe/fit.js.map +1 -1
  706. package/dist/composition/probe/frontier.d.ts.map +1 -1
  707. package/dist/composition/probe/frontier.js +33 -15
  708. package/dist/composition/probe/frontier.js.map +1 -1
  709. package/dist/composition/probe/generator.d.ts +27 -1
  710. package/dist/composition/probe/generator.d.ts.map +1 -1
  711. package/dist/composition/probe/generator.js +53 -30
  712. package/dist/composition/probe/generator.js.map +1 -1
  713. package/dist/composition/probe/index.d.ts +18 -2
  714. package/dist/composition/probe/index.d.ts.map +1 -1
  715. package/dist/composition/probe/index.js +10 -2
  716. package/dist/composition/probe/index.js.map +1 -1
  717. package/dist/composition/probe/limits.d.ts +24 -1
  718. package/dist/composition/probe/limits.d.ts.map +1 -1
  719. package/dist/composition/probe/limits.js +53 -11
  720. package/dist/composition/probe/limits.js.map +1 -1
  721. package/dist/composition/probe/metadata.js.map +1 -1
  722. package/dist/composition/probe/pipeline.d.ts +5 -0
  723. package/dist/composition/probe/pipeline.d.ts.map +1 -1
  724. package/dist/composition/probe/pipeline.js +22 -9
  725. package/dist/composition/probe/pipeline.js.map +1 -1
  726. package/dist/composition/probe/power-law.d.ts +121 -0
  727. package/dist/composition/probe/power-law.d.ts.map +1 -0
  728. package/dist/composition/probe/power-law.js +255 -0
  729. package/dist/composition/probe/power-law.js.map +1 -0
  730. package/dist/composition/probe/problem.d.ts +12 -1
  731. package/dist/composition/probe/problem.d.ts.map +1 -1
  732. package/dist/composition/probe/problem.js +242 -48
  733. package/dist/composition/probe/problem.js.map +1 -1
  734. package/dist/composition/probe/report.js +1 -1
  735. package/dist/composition/probe/report.js.map +1 -1
  736. package/dist/composition/probe/residual.d.ts +6 -1
  737. package/dist/composition/probe/residual.d.ts.map +1 -1
  738. package/dist/composition/probe/residual.js +9 -7
  739. package/dist/composition/probe/residual.js.map +1 -1
  740. package/dist/composition/probe/run-manifest.js +2 -2
  741. package/dist/composition/probe/run-manifest.js.map +1 -1
  742. package/dist/composition/probe/scoring.d.ts +2 -1
  743. package/dist/composition/probe/scoring.d.ts.map +1 -1
  744. package/dist/composition/probe/scoring.js +21 -7
  745. package/dist/composition/probe/scoring.js.map +1 -1
  746. package/dist/composition/probe/search-budget.js.map +1 -1
  747. package/dist/composition/probe/serialize.js.map +1 -1
  748. package/dist/composition/probe/structure.d.ts +82 -17
  749. package/dist/composition/probe/structure.d.ts.map +1 -1
  750. package/dist/composition/probe/structure.js +129 -55
  751. package/dist/composition/probe/structure.js.map +1 -1
  752. package/dist/composition/probe/study.d.ts +35 -12
  753. package/dist/composition/probe/study.d.ts.map +1 -1
  754. package/dist/composition/probe/study.js +241 -184
  755. package/dist/composition/probe/study.js.map +1 -1
  756. package/dist/composition/probe/t-tail.d.ts +17 -0
  757. package/dist/composition/probe/t-tail.d.ts.map +1 -0
  758. package/dist/composition/probe/t-tail.js +32 -0
  759. package/dist/composition/probe/t-tail.js.map +1 -0
  760. package/dist/composition/probe/types.d.ts +6 -1
  761. package/dist/composition/probe/types.d.ts.map +1 -1
  762. package/dist/composition/probe/types.js +2 -0
  763. package/dist/composition/probe/types.js.map +1 -1
  764. package/dist/composition/proposed-bridges.d.ts +51 -13
  765. package/dist/composition/proposed-bridges.d.ts.map +1 -1
  766. package/dist/composition/proposed-bridges.js +110 -58
  767. package/dist/composition/proposed-bridges.js.map +1 -1
  768. package/dist/composition/quantities.d.ts +0 -4
  769. package/dist/composition/quantities.d.ts.map +1 -1
  770. package/dist/composition/quantities.js +5 -5
  771. package/dist/composition/quantities.js.map +1 -1
  772. package/dist/composition/quantity-clusters.d.ts +48 -0
  773. package/dist/composition/quantity-clusters.d.ts.map +1 -0
  774. package/dist/composition/quantity-clusters.js +98 -0
  775. package/dist/composition/quantity-clusters.js.map +1 -0
  776. package/dist/composition/quantity.d.ts +18 -2
  777. package/dist/composition/quantity.d.ts.map +1 -1
  778. package/dist/composition/quantity.js +35 -6
  779. package/dist/composition/quantity.js.map +1 -1
  780. package/dist/composition/rational-exponent.d.ts +40 -0
  781. package/dist/composition/rational-exponent.d.ts.map +1 -0
  782. package/dist/composition/rational-exponent.js +65 -0
  783. package/dist/composition/rational-exponent.js.map +1 -0
  784. package/dist/composition/representative-values.d.ts +22 -0
  785. package/dist/composition/representative-values.d.ts.map +1 -1
  786. package/dist/composition/representative-values.js +23 -0
  787. package/dist/composition/representative-values.js.map +1 -1
  788. package/dist/composition/retrodiction.d.ts +16 -6
  789. package/dist/composition/retrodiction.d.ts.map +1 -1
  790. package/dist/composition/retrodiction.js +36 -10
  791. package/dist/composition/retrodiction.js.map +1 -1
  792. package/dist/composition/uncertainty.js.map +1 -1
  793. package/dist/composition/user-equation.d.ts.map +1 -1
  794. package/dist/composition/user-equation.js +2 -2
  795. package/dist/composition/user-equation.js.map +1 -1
  796. package/dist/core/assignment.d.ts +19 -0
  797. package/dist/core/assignment.d.ts.map +1 -0
  798. package/dist/core/assignment.js +19 -0
  799. package/dist/core/assignment.js.map +1 -0
  800. package/dist/core/axes-registry.d.ts +8 -5
  801. package/dist/core/axes-registry.d.ts.map +1 -1
  802. package/dist/core/axes-registry.js.map +1 -1
  803. package/dist/core/cell.js.map +1 -1
  804. package/dist/core/compare.d.ts +32 -0
  805. package/dist/core/compare.d.ts.map +1 -0
  806. package/dist/core/compare.js +46 -0
  807. package/dist/core/compare.js.map +1 -0
  808. package/dist/core/constants.d.ts +35 -35
  809. package/dist/core/constants.d.ts.map +1 -1
  810. package/dist/core/constants.js +52 -37
  811. package/dist/core/constants.js.map +1 -1
  812. package/dist/core/data-file.d.ts +7 -0
  813. package/dist/core/data-file.d.ts.map +1 -1
  814. package/dist/core/data-file.js +17 -0
  815. package/dist/core/data-file.js.map +1 -1
  816. package/dist/core/flux-rules.js +1 -1
  817. package/dist/core/flux-rules.js.map +1 -1
  818. package/dist/core/format.d.ts +36 -0
  819. package/dist/core/format.d.ts.map +1 -0
  820. package/dist/core/format.js +39 -0
  821. package/dist/core/format.js.map +1 -0
  822. package/dist/core/hash.d.ts +14 -0
  823. package/dist/core/hash.d.ts.map +1 -0
  824. package/dist/core/hash.js +17 -0
  825. package/dist/core/hash.js.map +1 -0
  826. package/dist/core/json-schema.d.ts +3 -1
  827. package/dist/core/json-schema.d.ts.map +1 -1
  828. package/dist/core/json-schema.js +41 -16
  829. package/dist/core/json-schema.js.map +1 -1
  830. package/dist/core/labeled-tensor.d.ts +6 -1
  831. package/dist/core/labeled-tensor.d.ts.map +1 -1
  832. package/dist/core/labeled-tensor.js +18 -16
  833. package/dist/core/labeled-tensor.js.map +1 -1
  834. package/dist/core/mathts-read.d.ts +25 -0
  835. package/dist/core/mathts-read.d.ts.map +1 -0
  836. package/dist/core/mathts-read.js +51 -0
  837. package/dist/core/mathts-read.js.map +1 -0
  838. package/dist/core/regime-registry.d.ts +6 -2
  839. package/dist/core/regime-registry.d.ts.map +1 -1
  840. package/dist/core/regime-registry.js.map +1 -1
  841. package/dist/core/regime-rule-install.js.map +1 -1
  842. package/dist/core/regimes-builtins.js.map +1 -1
  843. package/dist/core/tensor.d.ts +7 -4
  844. package/dist/core/tensor.d.ts.map +1 -1
  845. package/dist/core/tensor.js +64 -8
  846. package/dist/core/tensor.js.map +1 -1
  847. package/dist/core/types.d.ts +5 -5
  848. package/dist/core/types.js.map +1 -1
  849. package/dist/core/universal-index.js.map +1 -1
  850. package/dist/diff/bridge-ast-gradient.d.ts +4 -5
  851. package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
  852. package/dist/diff/bridge-ast-gradient.js +10 -6
  853. package/dist/diff/bridge-ast-gradient.js.map +1 -1
  854. package/dist/diff/bridge-gradient.d.ts +43 -86
  855. package/dist/diff/bridge-gradient.d.ts.map +1 -1
  856. package/dist/diff/bridge-gradient.js +40 -109
  857. package/dist/diff/bridge-gradient.js.map +1 -1
  858. package/dist/diff/bridge-specs.d.ts +16 -5
  859. package/dist/diff/bridge-specs.d.ts.map +1 -1
  860. package/dist/diff/bridge-specs.js +19 -4
  861. package/dist/diff/bridge-specs.js.map +1 -1
  862. package/dist/dimensional/algebra.d.ts +18 -0
  863. package/dist/dimensional/algebra.d.ts.map +1 -1
  864. package/dist/dimensional/algebra.js +41 -1
  865. package/dist/dimensional/algebra.js.map +1 -1
  866. package/dist/dimensional/ast-builders.d.ts +12 -4
  867. package/dist/dimensional/ast-builders.d.ts.map +1 -1
  868. package/dist/dimensional/ast-builders.js +17 -5
  869. package/dist/dimensional/ast-builders.js.map +1 -1
  870. package/dist/dimensional/ast-leaves.d.ts +81 -0
  871. package/dist/dimensional/ast-leaves.d.ts.map +1 -0
  872. package/dist/dimensional/ast-leaves.js +146 -0
  873. package/dist/dimensional/ast-leaves.js.map +1 -0
  874. package/dist/dimensional/ast-types.js.map +1 -1
  875. package/dist/dimensional/bridge-check.js.map +1 -1
  876. package/dist/dimensional/buckingham.d.ts.map +1 -1
  877. package/dist/dimensional/buckingham.js +15 -27
  878. package/dist/dimensional/buckingham.js.map +1 -1
  879. package/dist/dimensional/connection-validators.d.ts +2 -1
  880. package/dist/dimensional/connection-validators.d.ts.map +1 -1
  881. package/dist/dimensional/connection-validators.js.map +1 -1
  882. package/dist/dimensional/connection.js.map +1 -1
  883. package/dist/dimensional/constant-rows.d.ts.map +1 -1
  884. package/dist/dimensional/constant-rows.js +17 -13
  885. package/dist/dimensional/constant-rows.js.map +1 -1
  886. package/dist/dimensional/constants.d.ts +5 -6
  887. package/dist/dimensional/constants.d.ts.map +1 -1
  888. package/dist/dimensional/constants.js +5 -6
  889. package/dist/dimensional/constants.js.map +1 -1
  890. package/dist/dimensional/curvature-composite.js.map +1 -1
  891. package/dist/dimensional/curvature-invariants.js.map +1 -1
  892. package/dist/dimensional/curvature.js.map +1 -1
  893. package/dist/dimensional/dimension-inference.d.ts.map +1 -1
  894. package/dist/dimensional/dimension-inference.js +1 -2
  895. package/dist/dimensional/dimension-inference.js.map +1 -1
  896. package/dist/dimensional/dimension-spec.d.ts +13 -7
  897. package/dist/dimensional/dimension-spec.d.ts.map +1 -1
  898. package/dist/dimensional/dimension-spec.js +49 -23
  899. package/dist/dimensional/dimension-spec.js.map +1 -1
  900. package/dist/dimensional/einstein-equation.js.map +1 -1
  901. package/dist/dimensional/errors.d.ts +4 -2
  902. package/dist/dimensional/errors.d.ts.map +1 -1
  903. package/dist/dimensional/errors.js +3 -17
  904. package/dist/dimensional/errors.js.map +1 -1
  905. package/dist/dimensional/exact-scale.d.ts +0 -17
  906. package/dist/dimensional/exact-scale.d.ts.map +1 -1
  907. package/dist/dimensional/exact-scale.js +8 -8
  908. package/dist/dimensional/exact-scale.js.map +1 -1
  909. package/dist/dimensional/field-equation-helpers.js.map +1 -1
  910. package/dist/dimensional/formula-names.js.map +1 -1
  911. package/dist/dimensional/fresh-label.js.map +1 -1
  912. package/dist/dimensional/friedmann-equation.d.ts +3 -3
  913. package/dist/dimensional/friedmann-equation.js +3 -3
  914. package/dist/dimensional/friedmann-equation.js.map +1 -1
  915. package/dist/dimensional/gauge-field.d.ts +2 -3
  916. package/dist/dimensional/gauge-field.d.ts.map +1 -1
  917. package/dist/dimensional/gauge-field.js +2 -3
  918. package/dist/dimensional/gauge-field.js.map +1 -1
  919. package/dist/dimensional/hyphen-names.d.ts +12 -2
  920. package/dist/dimensional/hyphen-names.d.ts.map +1 -1
  921. package/dist/dimensional/hyphen-names.js +45 -12
  922. package/dist/dimensional/hyphen-names.js.map +1 -1
  923. package/dist/dimensional/killing-validators.js.map +1 -1
  924. package/dist/dimensional/klein-gordon-equation.js.map +1 -1
  925. package/dist/dimensional/metric-validators.d.ts +2 -1
  926. package/dist/dimensional/metric-validators.d.ts.map +1 -1
  927. package/dist/dimensional/metric-validators.js.map +1 -1
  928. package/dist/dimensional/metric.d.ts.map +1 -1
  929. package/dist/dimensional/metric.js +0 -1
  930. package/dist/dimensional/metric.js.map +1 -1
  931. package/dist/dimensional/natural-units.js.map +1 -1
  932. package/dist/dimensional/quantity-registry.d.ts +13 -0
  933. package/dist/dimensional/quantity-registry.d.ts.map +1 -1
  934. package/dist/dimensional/quantity-registry.js +14 -6
  935. package/dist/dimensional/quantity-registry.js.map +1 -1
  936. package/dist/dimensional/rg-flow.js.map +1 -1
  937. package/dist/dimensional/stress-energy-validators.js.map +1 -1
  938. package/dist/dimensional/symbolic-constants.d.ts +9 -0
  939. package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
  940. package/dist/dimensional/symbolic-constants.js +20 -3
  941. package/dist/dimensional/symbolic-constants.js.map +1 -1
  942. package/dist/dimensional/tensor-trace.js.map +1 -1
  943. package/dist/dimensional/tensor.js.map +1 -1
  944. package/dist/dimensional/types.d.ts +36 -0
  945. package/dist/dimensional/types.d.ts.map +1 -1
  946. package/dist/dimensional/types.js +45 -7
  947. package/dist/dimensional/types.js.map +1 -1
  948. package/dist/dimensional/unit-convention.d.ts +0 -2
  949. package/dist/dimensional/unit-convention.d.ts.map +1 -1
  950. package/dist/dimensional/unit-convention.js +2 -2
  951. package/dist/dimensional/unit-convention.js.map +1 -1
  952. package/dist/dimensional/unit-data.d.ts.map +1 -1
  953. package/dist/dimensional/unit-data.js +11 -7
  954. package/dist/dimensional/unit-data.js.map +1 -1
  955. package/dist/dimensional/units.d.ts.map +1 -1
  956. package/dist/dimensional/units.js +38 -20
  957. package/dist/dimensional/units.js.map +1 -1
  958. package/dist/dimensional/validator-registry.js.map +1 -1
  959. package/dist/dimensional/validator.d.ts +0 -16
  960. package/dist/dimensional/validator.d.ts.map +1 -1
  961. package/dist/dimensional/validator.js +65 -29
  962. package/dist/dimensional/validator.js.map +1 -1
  963. package/dist/dimensional/weyl-validators.js.map +1 -1
  964. package/dist/index.d.ts +59 -8
  965. package/dist/index.d.ts.map +1 -1
  966. package/dist/index.js +22 -24
  967. package/dist/index.js.map +1 -1
  968. package/dist/numerical/bianchi-residual.js.map +1 -1
  969. package/dist/numerical/binding-value.d.ts +11 -6
  970. package/dist/numerical/binding-value.d.ts.map +1 -1
  971. package/dist/numerical/binding-value.js +126 -122
  972. package/dist/numerical/binding-value.js.map +1 -1
  973. package/dist/numerical/christoffel-flat.d.ts.map +1 -1
  974. package/dist/numerical/christoffel-flat.js +3 -2
  975. package/dist/numerical/christoffel-flat.js.map +1 -1
  976. package/dist/numerical/connection-lowering-helpers.js.map +1 -1
  977. package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
  978. package/dist/numerical/covariant-eikonal.js +36 -13
  979. package/dist/numerical/covariant-eikonal.js.map +1 -1
  980. package/dist/numerical/curvature-lowering-helpers.d.ts +20 -0
  981. package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
  982. package/dist/numerical/curvature-lowering-helpers.js +9 -5
  983. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  984. package/dist/numerical/derivative-lowering.js.map +1 -1
  985. package/dist/numerical/einstein-equation.js.map +1 -1
  986. package/dist/numerical/engine-registry.js.map +1 -1
  987. package/dist/numerical/errors.d.ts +7 -3
  988. package/dist/numerical/errors.d.ts.map +1 -1
  989. package/dist/numerical/errors.js +5 -8
  990. package/dist/numerical/errors.js.map +1 -1
  991. package/dist/numerical/evaluator-uncertainty.d.ts.map +1 -1
  992. package/dist/numerical/evaluator-uncertainty.js +19 -2
  993. package/dist/numerical/evaluator-uncertainty.js.map +1 -1
  994. package/dist/numerical/finite-difference.d.ts +22 -0
  995. package/dist/numerical/finite-difference.d.ts.map +1 -0
  996. package/dist/numerical/finite-difference.js +27 -0
  997. package/dist/numerical/finite-difference.js.map +1 -0
  998. package/dist/numerical/formula-contract.d.ts +63 -7
  999. package/dist/numerical/formula-contract.d.ts.map +1 -1
  1000. package/dist/numerical/formula-contract.js +61 -42
  1001. package/dist/numerical/formula-contract.js.map +1 -1
  1002. package/dist/numerical/formula-dimension.d.ts +8 -7
  1003. package/dist/numerical/formula-dimension.d.ts.map +1 -1
  1004. package/dist/numerical/formula-dimension.js +58 -36
  1005. package/dist/numerical/formula-dimension.js.map +1 -1
  1006. package/dist/numerical/formula-mathts.d.ts.map +1 -1
  1007. package/dist/numerical/formula-mathts.js +5 -2
  1008. package/dist/numerical/formula-mathts.js.map +1 -1
  1009. package/dist/numerical/formula-registry.d.ts +13 -3
  1010. package/dist/numerical/formula-registry.d.ts.map +1 -1
  1011. package/dist/numerical/formula-registry.js +7 -2
  1012. package/dist/numerical/formula-registry.js.map +1 -1
  1013. package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
  1014. package/dist/numerical/geodesic-integrator.js +22 -14
  1015. package/dist/numerical/geodesic-integrator.js.map +1 -1
  1016. package/dist/numerical/geometrized.d.ts.map +1 -1
  1017. package/dist/numerical/geometrized.js +0 -1
  1018. package/dist/numerical/geometrized.js.map +1 -1
  1019. package/dist/numerical/gl4-integrator.d.ts +28 -27
  1020. package/dist/numerical/gl4-integrator.d.ts.map +1 -1
  1021. package/dist/numerical/gl4-integrator.js +41 -42
  1022. package/dist/numerical/gl4-integrator.js.map +1 -1
  1023. package/dist/numerical/grid-field.js.map +1 -1
  1024. package/dist/numerical/index.js.map +1 -1
  1025. package/dist/numerical/input-validation.d.ts +3 -6
  1026. package/dist/numerical/input-validation.d.ts.map +1 -1
  1027. package/dist/numerical/input-validation.js +4 -8
  1028. package/dist/numerical/input-validation.js.map +1 -1
  1029. package/dist/numerical/killing.d.ts +8 -5
  1030. package/dist/numerical/killing.d.ts.map +1 -1
  1031. package/dist/numerical/killing.js.map +1 -1
  1032. package/dist/numerical/klein-gordon.js.map +1 -1
  1033. package/dist/numerical/kretschmann.js.map +1 -1
  1034. package/dist/numerical/lowering-utils.js.map +1 -1
  1035. package/dist/numerical/lowering.d.ts.map +1 -1
  1036. package/dist/numerical/lowering.js +7 -17
  1037. package/dist/numerical/lowering.js.map +1 -1
  1038. package/dist/numerical/mathts-engine.d.ts.map +1 -1
  1039. package/dist/numerical/mathts-engine.js +16 -25
  1040. package/dist/numerical/mathts-engine.js.map +1 -1
  1041. package/dist/numerical/metric-inverse.d.ts.map +1 -1
  1042. package/dist/numerical/metric-inverse.js +83 -46
  1043. package/dist/numerical/metric-inverse.js.map +1 -1
  1044. package/dist/numerical/null-ic.js.map +1 -1
  1045. package/dist/numerical/null-ray-integrator.d.ts +2 -1
  1046. package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
  1047. package/dist/numerical/null-ray-integrator.js +12 -12
  1048. package/dist/numerical/null-ray-integrator.js.map +1 -1
  1049. package/dist/numerical/painleve-gullstrand-metric.js +2 -2
  1050. package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
  1051. package/dist/numerical/pderiv.d.ts.map +1 -1
  1052. package/dist/numerical/pderiv.js +9 -2
  1053. package/dist/numerical/pderiv.js.map +1 -1
  1054. package/dist/numerical/perihelion-finder.d.ts +0 -36
  1055. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  1056. package/dist/numerical/perihelion-finder.js +41 -87
  1057. package/dist/numerical/perihelion-finder.js.map +1 -1
  1058. package/dist/numerical/quadrature.d.ts +5 -2
  1059. package/dist/numerical/quadrature.d.ts.map +1 -1
  1060. package/dist/numerical/quadrature.js +19 -4
  1061. package/dist/numerical/quadrature.js.map +1 -1
  1062. package/dist/numerical/rk4-trajectory.d.ts +10 -0
  1063. package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
  1064. package/dist/numerical/rk4-trajectory.js +37 -0
  1065. package/dist/numerical/rk4-trajectory.js.map +1 -0
  1066. package/dist/numerical/schwarzschild.d.ts +14 -0
  1067. package/dist/numerical/schwarzschild.d.ts.map +1 -0
  1068. package/dist/numerical/schwarzschild.js +17 -0
  1069. package/dist/numerical/schwarzschild.js.map +1 -0
  1070. package/dist/numerical/spacetime-metrics.d.ts +25 -19
  1071. package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
  1072. package/dist/numerical/spacetime-metrics.js +180 -286
  1073. package/dist/numerical/spacetime-metrics.js.map +1 -1
  1074. package/dist/numerical/statistics.d.ts +24 -0
  1075. package/dist/numerical/statistics.d.ts.map +1 -0
  1076. package/dist/numerical/statistics.js +52 -0
  1077. package/dist/numerical/statistics.js.map +1 -0
  1078. package/dist/numerical/strides.js.map +1 -1
  1079. package/dist/numerical/tensor-engine.d.ts +30 -5
  1080. package/dist/numerical/tensor-engine.d.ts.map +1 -1
  1081. package/dist/numerical/tensor-engine.js +12 -0
  1082. package/dist/numerical/tensor-engine.js.map +1 -1
  1083. package/dist/numerical/types.js.map +1 -1
  1084. package/dist/numerical/weyl-lowering.js.map +1 -1
  1085. package/dist/relations/category.js.map +1 -1
  1086. package/dist/relations/composition-table.d.ts +4 -4
  1087. package/dist/relations/composition-table.js +4 -4
  1088. package/dist/relations/composition-table.js.map +1 -1
  1089. package/dist/relations/conventions.js.map +1 -1
  1090. package/dist/relations/domain-regimes.js.map +1 -1
  1091. package/dist/relations/regime-registration.js.map +1 -1
  1092. package/dist/relations/regime-vocabularies.js.map +1 -1
  1093. package/dist/relations/regime.d.ts +28 -8
  1094. package/dist/relations/regime.d.ts.map +1 -1
  1095. package/dist/relations/regime.js +44 -15
  1096. package/dist/relations/regime.js.map +1 -1
  1097. package/dist/relations/types.d.ts +18 -5
  1098. package/dist/relations/types.d.ts.map +1 -1
  1099. package/dist/relations/types.js +5 -3
  1100. package/dist/relations/types.js.map +1 -1
  1101. package/package.json +16 -20
  1102. package/dist/bridges/registry.d.ts +0 -60
  1103. package/dist/bridges/registry.d.ts.map +0 -1
  1104. package/dist/bridges/registry.js +0 -87
  1105. package/dist/bridges/registry.js.map +0 -1
  1106. package/dist/cli/poster-source.d.ts +0 -154
  1107. package/dist/cli/poster-source.d.ts.map +0 -1
  1108. package/dist/cli/poster-source.js +0 -184
  1109. package/dist/cli/poster-source.js.map +0 -1
@@ -5,10 +5,60 @@
5
5
  * that tree is Product A's confrontation ledger and must stay cycle-free
6
6
  * from probe.
7
7
  *
8
+ * A cell is a finite number or a non-empty string in the strict decimal
9
+ * grammar (`1`, `-0.5`, `.5`, `2.`, `1e-3`). Nothing is coerced: an empty
10
+ * cell, `null`, `true`, `false`, a list and `"0x10"` are refused by column
11
+ * and row, with {@link DatasetError}. `Number(v)` once read all of those as
12
+ * 0, 1 or 16, which also defeated the missing-observation guard of the
13
+ * declared-limit check (a missing observation scored as 0).
14
+ *
8
15
  * @internal
9
16
  */
10
17
  import { readFileSync } from 'node:fs';
18
+ import { readJsonFile } from '../../core/data-file.js';
11
19
  import { SCHEMA_VERSION } from './types.js';
20
+ /** A dataset file or object that is not a dataset: the message names the row and the column. @internal */
21
+ export class DatasetError extends Error {
22
+ constructor(message) {
23
+ super(message);
24
+ this.name = 'DatasetError';
25
+ }
26
+ }
27
+ /** The strict decimal grammar a string cell must match: sign, digits with an optional fraction, an optional exponent. */
28
+ const DECIMAL = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
29
+ /** What a JSON value is, in the words a file author would use. */
30
+ function kindOf(v) {
31
+ if (v === null)
32
+ return 'null';
33
+ if (Array.isArray(v))
34
+ return 'a list';
35
+ if (typeof v === 'boolean')
36
+ return String(v);
37
+ if (typeof v === 'string')
38
+ return `'${v}'`;
39
+ return typeof v === 'object' ? 'an object' : typeof v;
40
+ }
41
+ /**
42
+ * A cell as a number: a finite number, or a non-empty string in the strict
43
+ * decimal grammar. Anything else is refused at `where` (the dataset, row and
44
+ * column). @internal
45
+ */
46
+ export function readDatasetNumber(v, where) {
47
+ if (typeof v === 'number') {
48
+ if (!Number.isFinite(v))
49
+ throw new DatasetError(`${where}: ${v} is not a finite number`);
50
+ return v;
51
+ }
52
+ if (typeof v === 'string') {
53
+ if (v.trim() === '')
54
+ throw new DatasetError(`${where}: an empty cell is not a number`);
55
+ const n = DECIMAL.test(v.trim()) ? Number(v.trim()) : NaN;
56
+ if (!Number.isFinite(n))
57
+ throw new DatasetError(`${where}: ${kindOf(v)} is not a finite decimal number`);
58
+ return n;
59
+ }
60
+ throw new DatasetError(`${where}: ${kindOf(v)} is not a number`);
61
+ }
12
62
  /** Build an in-memory dataset. @internal */
13
63
  export function datasetFromRows(rows, observable, role, id = 'inline', sigma) {
14
64
  return { id, role, rows, observable, ...(sigma !== undefined ? { sigma } : {}), schemaVersion: SCHEMA_VERSION };
@@ -16,33 +66,29 @@ export function datasetFromRows(rows, observable, role, id = 'inline', sigma) {
16
66
  /** Coerce unknown JSON into a ProbeDataset. @internal */
17
67
  export function asDatasetSafe(raw, fallbackId, fallbackRole) {
18
68
  if (!raw || typeof raw !== 'object') {
19
- throw new Error(`dataset JSON is not an object (${fallbackId})`);
69
+ throw new DatasetError(`dataset JSON is not an object (${fallbackId})`);
20
70
  }
21
71
  const obj = raw;
22
72
  if (!Array.isArray(obj.rows)) {
23
- throw new Error(`dataset at ${fallbackId} is missing rows[]`);
73
+ throw new DatasetError(`dataset at ${fallbackId} is missing rows[]`);
24
74
  }
25
75
  if (typeof obj.observable !== 'string' || obj.observable.length === 0) {
26
- throw new Error(`dataset at ${fallbackId} is missing observable`);
76
+ throw new DatasetError(`dataset at ${fallbackId} is missing observable`);
27
77
  }
28
78
  const role = (typeof obj.role === 'string' ? obj.role : fallbackRole);
29
79
  if (role !== 'exploratory-fit' &&
30
80
  role !== 'validation-holdout' &&
31
81
  role !== 'external-replication' &&
32
82
  role !== 'falsification-only') {
33
- throw new Error(`dataset at ${fallbackId} has invalid role '${String(obj.role)}'`);
83
+ throw new DatasetError(`dataset at ${fallbackId} has invalid role '${String(obj.role)}'`);
34
84
  }
35
85
  const rows = obj.rows.map((row, i) => {
36
86
  if (!row || typeof row !== 'object' || Array.isArray(row)) {
37
- throw new Error(`dataset ${fallbackId} row ${i} is not an object`);
87
+ throw new DatasetError(`dataset ${fallbackId} row ${i} is not an object`);
38
88
  }
39
89
  const out = {};
40
90
  for (const [k, v] of Object.entries(row)) {
41
- const n = typeof v === 'number' ? v : Number(v);
42
- if (!Number.isFinite(n)) {
43
- throw new Error(`dataset ${fallbackId} row ${i} column ${k}: not a finite number`);
44
- }
45
- out[k] = n;
91
+ out[k] = readDatasetNumber(v, `dataset ${fallbackId} row ${i} column ${k}`);
46
92
  }
47
93
  return out;
48
94
  });
@@ -57,12 +103,12 @@ export function asDatasetSafe(raw, fallbackId, fallbackRole) {
57
103
  }
58
104
  /** Load a single ProbeDataset JSON object. @internal */
59
105
  export function loadDatasetFromJson(path, fallbackRole) {
60
- const raw = JSON.parse(readFileSync(path, 'utf8'));
106
+ const raw = readJsonFile(path);
61
107
  return asDatasetSafe(raw, path, fallbackRole);
62
108
  }
63
109
  /** Load `{ exploratory, holdout }` JSON. @internal */
64
110
  export function loadSplitDatasetsFromJson(path) {
65
- const raw = JSON.parse(readFileSync(path, 'utf8'));
111
+ const raw = readJsonFile(path);
66
112
  if (raw.exploratory || raw.holdout) {
67
113
  return {
68
114
  exploratory: raw.exploratory
@@ -78,7 +124,35 @@ export function loadSplitDatasetsFromJson(path) {
78
124
  exploratory: asDatasetSafe({ ...raw.observations, role: 'exploratory-fit' }, `${path}#observations`, 'exploratory-fit'),
79
125
  };
80
126
  }
81
- throw new Error(`JSON at ${path} needs exploratory/holdout or observations`);
127
+ throw new DatasetError(`JSON at ${path} needs exploratory/holdout or observations`);
128
+ }
129
+ /** The header and the data lines of a CSV file; the file needs both. */
130
+ function csvLines(path) {
131
+ const text = readFileSync(path, 'utf8').trim();
132
+ const lines = text.split(/\r?\n/).filter((l) => l.length > 0);
133
+ if (lines.length < 2) {
134
+ throw new DatasetError(`CSV dataset at ${path} needs a header and at least one row`);
135
+ }
136
+ const headers = lines[0].split(',').map((h) => h.trim());
137
+ return { headers, lines };
138
+ }
139
+ /**
140
+ * One CSV data line as a row of numbers. A line with fewer cells than the
141
+ * header is refused by the first column it lacks; `skip` names the header
142
+ * column (if any) that is not a number column. `line` is the 1-based line
143
+ * number of the file, so a message points at the file.
144
+ */
145
+ function csvRow(cells, headers, line, path, skip) {
146
+ if (cells.length < headers.length) {
147
+ throw new DatasetError(`CSV ${path} row ${line} has ${cells.length} cell(s); the header has ${headers.length} (column ${headers[cells.length]} is missing)`);
148
+ }
149
+ const row = {};
150
+ for (let c = 0; c < headers.length; c++) {
151
+ if (c === skip)
152
+ continue;
153
+ row[headers[c]] = readDatasetNumber(cells[c], `CSV ${path} row ${line} column ${headers[c]}`);
154
+ }
155
+ return row;
82
156
  }
83
157
  /**
84
158
  * Minimal CSV: first row headers, remaining rows numeric values.
@@ -88,66 +162,37 @@ export function loadSplitDatasetsFromJson(path) {
88
162
  * @internal
89
163
  */
90
164
  export function loadDatasetFromCsv(path, observable, role, id = path) {
91
- const text = readFileSync(path, 'utf8').trim();
92
- const lines = text.split(/\r?\n/).filter((l) => l.length > 0);
93
- if (lines.length < 2) {
94
- throw new Error(`CSV dataset at ${path} needs a header and at least one row`);
95
- }
96
- const headers = lines[0].split(',').map((h) => h.trim());
165
+ const { headers, lines } = csvLines(path);
166
+ const splitIdx = headers.indexOf('split');
97
167
  const rows = [];
98
168
  for (let i = 1; i < lines.length; i++) {
99
169
  const cells = lines[i].split(',').map((c) => c.trim());
100
- const row = {};
101
- for (let c = 0; c < headers.length; c++) {
102
- const h = headers[c];
103
- if (h === 'split')
104
- continue;
105
- const n = Number(cells[c] ?? '');
106
- if (!Number.isFinite(n)) {
107
- throw new Error(`CSV ${path} row ${i + 1} column ${h}: not a finite number`);
108
- }
109
- row[h] = n;
110
- }
111
- rows.push(row);
170
+ rows.push(csvRow(cells, headers, i + 1, path, splitIdx));
112
171
  }
113
172
  if (!(observable in (rows[0] ?? {}))) {
114
- throw new Error(`CSV ${path} is missing observable column '${observable}'`);
173
+ throw new DatasetError(`CSV ${path} is missing observable column '${observable}'`);
115
174
  }
116
175
  return datasetFromRows(rows, observable, role, id);
117
176
  }
118
177
  /** Partition a mixed-split CSV (uses a `split` column). @internal */
119
178
  export function loadSplitCsv(path, observable) {
120
- const text = readFileSync(path, 'utf8').trim();
121
- const lines = text.split(/\r?\n/).filter((l) => l.length > 0);
122
- if (lines.length < 2) {
123
- throw new Error(`CSV dataset at ${path} needs a header and at least one row`);
124
- }
125
- const headers = lines[0].split(',').map((h) => h.trim());
179
+ const { headers, lines } = csvLines(path);
126
180
  const splitIdx = headers.indexOf('split');
127
181
  if (splitIdx < 0) {
128
- throw new Error(`CSV ${path} has no split column`);
182
+ throw new DatasetError(`CSV ${path} has no split column`);
129
183
  }
130
184
  const exploratoryRows = [];
131
185
  const holdoutRows = [];
132
186
  for (let i = 1; i < lines.length; i++) {
133
187
  const cells = lines[i].split(',').map((c) => c.trim());
134
- const row = {};
135
- for (let c = 0; c < headers.length; c++) {
136
- if (c === splitIdx)
137
- continue;
138
- const n = Number(cells[c] ?? '');
139
- if (!Number.isFinite(n)) {
140
- throw new Error(`CSV ${path} row ${i + 1} column ${headers[c]}: not a finite number`);
141
- }
142
- row[headers[c]] = n;
143
- }
188
+ const row = csvRow(cells, headers, i + 1, path, splitIdx);
144
189
  const split = cells[splitIdx];
145
190
  if (split === 'holdout' || split === 'blind')
146
191
  holdoutRows.push(row);
147
192
  else if (split === 'exploratory')
148
193
  exploratoryRows.push(row);
149
194
  else
150
- throw new Error(`CSV ${path} row ${i + 1} has invalid split '${split}'`);
195
+ throw new DatasetError(`CSV ${path} row ${i + 1} has invalid split '${split}'`);
151
196
  }
152
197
  return {
153
198
  exploratory: datasetFromRows(exploratoryRows, observable, 'exploratory-fit', `${path}#exploratory`),
@@ -1 +1 @@
1
- {"version":3,"file":"dataset.js","sourceRoot":"","sources":["../../../src/composition/probe/dataset.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,UAAU,eAAe,CAC7B,IAA+B,EAC/B,UAAkB,EAClB,IAAiB,EACjB,EAAE,GAAG,QAAQ,EACb,KAAc;IAEd,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;AAClH,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAAC,GAAY,EAAE,UAAkB,EAAE,YAA0B;IACxF,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,GAAG,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,CAAC,CAAC;IACvF,CAAC;IACD,OAAO;QACL,WAAW,EAAE,eAAe,CAAC,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAI,cAAc,CAAC;QACnG,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,IAAI,UAAU,CAAC;KAC3F,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Observation adapters for Product B.\n *\n * In-memory / JSON / CSV. Does not live in `src/bridges/observations/` —\n * that tree is Product A's confrontation ledger and must stay cycle-free\n * from probe.\n *\n * A cell is a finite number or a non-empty string in the strict decimal\n * grammar (`1`, `-0.5`, `.5`, `2.`, `1e-3`). Nothing is coerced: an empty\n * cell, `null`, `true`, `false`, a list and `\"0x10\"` are refused by column\n * and row, with {@link DatasetError}. `Number(v)` once read all of those as\n * 0, 1 or 16, which also defeated the missing-observation guard of the\n * declared-limit check (a missing observation scored as 0).\n *\n * @internal\n */\n\nimport { readFileSync } from 'node:fs';\nimport { readJsonFile } from '../../core/data-file.js';\nimport type { DatasetRole, ObservationRow, ProbeDataset } from './types.js';\nimport { SCHEMA_VERSION } from './types.js';\n\n/** A dataset file or object that is not a dataset: the message names the row and the column. @internal */\nexport class DatasetError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'DatasetError';\n }\n}\n\n/** The strict decimal grammar a string cell must match: sign, digits with an optional fraction, an optional exponent. */\nconst DECIMAL = /^[+-]?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/;\n\n/** What a JSON value is, in the words a file author would use. */\nfunction kindOf(v: unknown): string {\n if (v === null) return 'null';\n if (Array.isArray(v)) return 'a list';\n if (typeof v === 'boolean') return String(v);\n if (typeof v === 'string') return `'${v}'`;\n return typeof v === 'object' ? 'an object' : typeof v;\n}\n\n/**\n * A cell as a number: a finite number, or a non-empty string in the strict\n * decimal grammar. Anything else is refused at `where` (the dataset, row and\n * column). @internal\n */\nexport function readDatasetNumber(v: unknown, where: string): number {\n if (typeof v === 'number') {\n if (!Number.isFinite(v)) throw new DatasetError(`${where}: ${v} is not a finite number`);\n return v;\n }\n if (typeof v === 'string') {\n if (v.trim() === '') throw new DatasetError(`${where}: an empty cell is not a number`);\n const n = DECIMAL.test(v.trim()) ? Number(v.trim()) : NaN;\n if (!Number.isFinite(n)) throw new DatasetError(`${where}: ${kindOf(v)} is not a finite decimal number`);\n return n;\n }\n throw new DatasetError(`${where}: ${kindOf(v)} is not a number`);\n}\n\n/** Build an in-memory dataset. @internal */\nexport function datasetFromRows(\n rows: readonly ObservationRow[],\n observable: string,\n role: DatasetRole,\n id = 'inline',\n sigma?: number,\n): ProbeDataset {\n return { id, role, rows, observable, ...(sigma !== undefined ? { sigma } : {}), schemaVersion: SCHEMA_VERSION };\n}\n\n/** Coerce unknown JSON into a ProbeDataset. @internal */\nexport function asDatasetSafe(raw: unknown, fallbackId: string, fallbackRole?: DatasetRole): ProbeDataset {\n if (!raw || typeof raw !== 'object') {\n throw new DatasetError(`dataset JSON is not an object (${fallbackId})`);\n }\n const obj = raw as {\n id?: unknown;\n role?: unknown;\n rows?: unknown;\n observable?: unknown;\n sigma?: unknown;\n schemaVersion?: unknown;\n };\n if (!Array.isArray(obj.rows)) {\n throw new DatasetError(`dataset at ${fallbackId} is missing rows[]`);\n }\n if (typeof obj.observable !== 'string' || obj.observable.length === 0) {\n throw new DatasetError(`dataset at ${fallbackId} is missing observable`);\n }\n const role = (typeof obj.role === 'string' ? obj.role : fallbackRole) as DatasetRole | undefined;\n if (\n role !== 'exploratory-fit' &&\n role !== 'validation-holdout' &&\n role !== 'external-replication' &&\n role !== 'falsification-only'\n ) {\n throw new DatasetError(`dataset at ${fallbackId} has invalid role '${String(obj.role)}'`);\n }\n const rows: ObservationRow[] = obj.rows.map((row, i) => {\n if (!row || typeof row !== 'object' || Array.isArray(row)) {\n throw new DatasetError(`dataset ${fallbackId} row ${i} is not an object`);\n }\n const out: Record<string, number> = {};\n for (const [k, v] of Object.entries(row as Record<string, unknown>)) {\n out[k] = readDatasetNumber(v, `dataset ${fallbackId} row ${i} column ${k}`);\n }\n return out;\n });\n return {\n id: typeof obj.id === 'string' ? obj.id : fallbackId,\n role,\n rows,\n observable: obj.observable,\n ...(typeof obj.sigma === 'number' && Number.isFinite(obj.sigma) ? { sigma: obj.sigma } : {}),\n schemaVersion: typeof obj.schemaVersion === 'string' ? obj.schemaVersion : SCHEMA_VERSION,\n };\n}\n\n/** Load a single ProbeDataset JSON object. @internal */\nexport function loadDatasetFromJson(path: string, fallbackRole?: DatasetRole): ProbeDataset {\n const raw = readJsonFile(path);\n return asDatasetSafe(raw, path, fallbackRole);\n}\n\nexport interface SplitFileDatasets {\n readonly exploratory?: ProbeDataset;\n readonly holdout?: ProbeDataset;\n}\n\n/** Load `{ exploratory, holdout }` JSON. @internal */\nexport function loadSplitDatasetsFromJson(path: string): SplitFileDatasets {\n const raw = readJsonFile(path) as {\n exploratory?: unknown;\n holdout?: unknown;\n observations?: unknown;\n };\n if (raw.exploratory || raw.holdout) {\n return {\n exploratory: raw.exploratory\n ? asDatasetSafe(raw.exploratory, `${path}#exploratory`, 'exploratory-fit')\n : undefined,\n holdout: raw.holdout\n ? asDatasetSafe(raw.holdout, `${path}#holdout`, 'validation-holdout')\n : undefined,\n };\n }\n if (raw.observations) {\n return {\n exploratory: asDatasetSafe(\n { ...(raw.observations as object), role: 'exploratory-fit' },\n `${path}#observations`,\n 'exploratory-fit',\n ),\n };\n }\n throw new DatasetError(`JSON at ${path} needs exploratory/holdout or observations`);\n}\n\n/** The header and the data lines of a CSV file; the file needs both. */\nfunction csvLines(path: string): { headers: string[]; lines: string[] } {\n const text = readFileSync(path, 'utf8').trim();\n const lines = text.split(/\\r?\\n/).filter((l) => l.length > 0);\n if (lines.length < 2) {\n throw new DatasetError(`CSV dataset at ${path} needs a header and at least one row`);\n }\n const headers = lines[0]!.split(',').map((h) => h.trim());\n return { headers, lines };\n}\n\n/**\n * One CSV data line as a row of numbers. A line with fewer cells than the\n * header is refused by the first column it lacks; `skip` names the header\n * column (if any) that is not a number column. `line` is the 1-based line\n * number of the file, so a message points at the file.\n */\nfunction csvRow(cells: readonly string[], headers: readonly string[], line: number, path: string, skip: number): Record<string, number> {\n if (cells.length < headers.length) {\n throw new DatasetError(\n `CSV ${path} row ${line} has ${cells.length} cell(s); the header has ${headers.length} (column ${headers[cells.length]} is missing)`,\n );\n }\n const row: Record<string, number> = {};\n for (let c = 0; c < headers.length; c++) {\n if (c === skip) continue;\n row[headers[c]!] = readDatasetNumber(cells[c], `CSV ${path} row ${line} column ${headers[c]}`);\n }\n return row;\n}\n\n/**\n * Minimal CSV: first row headers, remaining rows numeric values.\n * Optional `split` column (`exploratory`/`holdout`/`blind`).\n * `blind` rows are withheld with holdout data, never fit.\n *\n * @internal\n */\nexport function loadDatasetFromCsv(\n path: string,\n observable: string,\n role: DatasetRole,\n id = path,\n): ProbeDataset {\n const { headers, lines } = csvLines(path);\n const splitIdx = headers.indexOf('split');\n const rows: ObservationRow[] = [];\n for (let i = 1; i < lines.length; i++) {\n const cells = lines[i]!.split(',').map((c) => c.trim());\n rows.push(csvRow(cells, headers, i + 1, path, splitIdx));\n }\n if (!(observable in (rows[0] ?? {}))) {\n throw new DatasetError(`CSV ${path} is missing observable column '${observable}'`);\n }\n return datasetFromRows(rows, observable, role, id);\n}\n\n/** Partition a mixed-split CSV (uses a `split` column). @internal */\nexport function loadSplitCsv(\n path: string,\n observable: string,\n): { exploratory: ProbeDataset; holdout: ProbeDataset } {\n const { headers, lines } = csvLines(path);\n const splitIdx = headers.indexOf('split');\n if (splitIdx < 0) {\n throw new DatasetError(`CSV ${path} has no split column`);\n }\n const exploratoryRows: ObservationRow[] = [];\n const holdoutRows: ObservationRow[] = [];\n for (let i = 1; i < lines.length; i++) {\n const cells = lines[i]!.split(',').map((c) => c.trim());\n const row = csvRow(cells, headers, i + 1, path, splitIdx);\n const split = cells[splitIdx];\n if (split === 'holdout' || split === 'blind') holdoutRows.push(row);\n else if (split === 'exploratory') exploratoryRows.push(row);\n else throw new DatasetError(`CSV ${path} row ${i + 1} has invalid split '${split}'`);\n }\n return {\n exploratory: datasetFromRows(exploratoryRows, observable, 'exploratory-fit', `${path}#exploratory`),\n holdout: datasetFromRows(holdoutRows, observable, 'validation-holdout', `${path}#holdout`),\n };\n}\n"]}
@@ -19,7 +19,11 @@ export interface DesignBounds {
19
19
  }>>[];
20
20
  readonly sigma?: number;
21
21
  }
22
- /** Coerce unknown JSON into {@link DesignBounds}. @internal */
22
+ /**
23
+ * Coerce unknown JSON into {@link DesignBounds}. Every bound is a finite
24
+ * number and `steps` a positive integer; a value of another kind is refused,
25
+ * naming the field and what was found. @internal
26
+ */
23
27
  export declare function parseDesignBounds(raw: unknown, source: string): DesignBounds;
24
28
  export interface DesignSuggestion {
25
29
  readonly point: Readonly<Record<string, number>>;
@@ -1 +1 @@
1
- {"version":3,"file":"experiment-design.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/experiment-design.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3F,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,EAAE,CAAC;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,M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ED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAeD,6FAA6F;AAC7F,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,QAAQ,EACZ,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,YAAY,GACnB,gBAAgB,CAkElB"}
@@ -7,7 +7,36 @@
7
7
  * @internal
8
8
  */
9
9
  import { evalExpr } from '../expr-eval.js';
10
- /** Coerce unknown JSON into {@link DesignBounds}. @internal */
10
+ /** What a JSON value is, in the words a file author would use. */
11
+ function kindOf(v) {
12
+ if (v === null)
13
+ return 'null';
14
+ if (Array.isArray(v))
15
+ return 'a list';
16
+ if (typeof v === 'string')
17
+ return 'text';
18
+ if (typeof v === 'number')
19
+ return Number.isFinite(v) ? 'a number' : String(v);
20
+ if (typeof v === 'boolean')
21
+ return 'true or false';
22
+ return typeof v === 'object' ? 'an object' : typeof v;
23
+ }
24
+ /** A finite number, or null: nothing is coerced (`null`, `""` and `"0"` once read as 0). */
25
+ const finite = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : null);
26
+ /** `{min, max}` as two finite numbers, located by `where` in any refusal. */
27
+ function readRange(spec, where) {
28
+ const min = finite(spec.min);
29
+ const max = finite(spec.max);
30
+ if (min === null || max === null) {
31
+ throw new Error(`${where} needs finite min/max numbers (found ${kindOf(spec.min)} and ${kindOf(spec.max)})`);
32
+ }
33
+ return { min, max };
34
+ }
35
+ /**
36
+ * Coerce unknown JSON into {@link DesignBounds}. Every bound is a finite
37
+ * number and `steps` a positive integer; a value of another kind is refused,
38
+ * naming the field and what was found. @internal
39
+ */
11
40
  export function parseDesignBounds(raw, source) {
12
41
  if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
13
42
  throw new Error(`design bounds at ${source} is not an object`);
@@ -21,22 +50,18 @@ export function parseDesignBounds(raw, source) {
21
50
  if (!spec || typeof spec !== 'object' || Array.isArray(spec)) {
22
51
  throw new Error(`design bounds at ${source}: variables.${name} is not an object`);
23
52
  }
24
- const { min, max, steps } = spec;
25
- const minN = typeof min === 'number' ? min : Number(min);
26
- const maxN = typeof max === 'number' ? max : Number(max);
27
- if (!Number.isFinite(minN) || !Number.isFinite(maxN)) {
28
- throw new Error(`design bounds at ${source}: variables.${name} needs finite min/max`);
29
- }
30
- if (minN > maxN) {
31
- throw new Error(`design bounds at ${source}: variables.${name} has min > max`);
53
+ const where = `design bounds at ${source}: variables.${name}`;
54
+ const { min, max } = readRange(spec, where);
55
+ if (min > max) {
56
+ throw new Error(`${where} has min > max`);
32
57
  }
33
- const entry = { min: minN, max: maxN };
58
+ const entry = { min, max };
59
+ const { steps } = spec;
34
60
  if (steps !== undefined) {
35
- const stepsN = typeof steps === 'number' ? steps : Number(steps);
36
- if (!Number.isFinite(stepsN) || stepsN <= 0) {
37
- throw new Error(`design bounds at ${source}: variables.${name}.steps must be positive`);
61
+ if (typeof steps !== 'number' || !Number.isInteger(steps) || steps < 1) {
62
+ throw new Error(`${where}.steps must be a positive integer (found ${typeof steps === 'number' ? steps : kindOf(steps)})`);
38
63
  }
39
- entry.steps = stepsN;
64
+ entry.steps = steps;
40
65
  }
41
66
  variables[name] = entry;
42
67
  }
@@ -54,23 +79,18 @@ export function parseDesignBounds(raw, source) {
54
79
  if (!r || typeof r !== 'object' || Array.isArray(r)) {
55
80
  throw new Error(`design bounds at ${source}: forbidden[${i}].${k} is not an object`);
56
81
  }
57
- const { min, max } = r;
58
- const minN = typeof min === 'number' ? min : Number(min);
59
- const maxN = typeof max === 'number' ? max : Number(max);
60
- if (!Number.isFinite(minN) || !Number.isFinite(maxN)) {
61
- throw new Error(`design bounds at ${source}: forbidden[${i}].${k} needs finite min/max`);
62
- }
63
- out[k] = { min: minN, max: maxN };
82
+ out[k] = readRange(r, `design bounds at ${source}: forbidden[${i}].${k}`);
64
83
  }
65
84
  return out;
66
85
  });
67
86
  }
68
87
  let sigma;
69
88
  if (obj.sigma !== undefined) {
70
- sigma = typeof obj.sigma === 'number' ? obj.sigma : Number(obj.sigma);
71
- if (!Number.isFinite(sigma) || sigma <= 0) {
72
- throw new Error(`design bounds at ${source}: sigma must be a positive number`);
89
+ const s = finite(obj.sigma);
90
+ if (s === null || s <= 0) {
91
+ throw new Error(`design bounds at ${source}: sigma must be a positive number (found ${s === null ? kindOf(obj.sigma) : s})`);
73
92
  }
93
+ sigma = s;
74
94
  }
75
95
  return { variables, ...(forbidden ? { forbidden } : {}), ...(sigma !== undefined ? { sigma } : {}) };
76
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"experiment-design.js","sourceRoot":"","sources":["../../../src/composition/probe/experiment-design.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQ3C,+DAA+D;AAC/D,MAAM,UAAU,iBAAiB,CAAC,GAAY,EAAE,MAAc;IAC5D,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,mBAAmB,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,GAAG,GAAG,GAIX,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACxF,MAAM,IAAI,KAAK,CAAC,oBAAoB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OAAO;YACT,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAAE,OAAO;YACzD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;YACvC,IAAI,CAAC,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;gBACxC,IAAI,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;YACzD,CAAC;YACD,OAAO;QACT,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACX,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IACF,GAAG,CAAC,CAAC,CAAC,CAAC;IAEP,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,KAAK,EAAE,EAAE;YACT,cAAc,EAAE,CAAC;YACjB,EAAE,EAAE,GAAG;YACP,EAAE,EAAE,GAAG;YACP,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,8CAA8C;SACvD,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"experiment-design.js","sourceRoot":"","sources":["../../../src/composition/probe/experiment-design.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQ3C,kEAAkE;AAClE,SAAS,MAAM,CAAC,CAAU;IACxB,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAC9B,I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GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACX,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IACF,GAAG,CAAC,CAAC,CAAC,CAAC;IAEP,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,KAAK,EAAE,EAAE;YACT,cAAc,EAAE,CAAC;YACjB,EAAE,EAAE,GAAG;YACP,EAAE,EAAE,GAAG;YACP,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,8CAA8C;SACvD,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Cheap experiment-design suggestions for two competing hypotheses.\n *\n * Grid-search max |H1−H2|/σ under declared bounds. Never recommend a\n * forbidden region.\n *\n * @internal\n */\n\nimport type { ExprNode } from '../../dimensional/ast-types.js';\nimport { evalExpr } from '../expr-eval.js';\n\nexport interface DesignBounds {\n readonly variables: Readonly<Record<string, { min: number; max: number; steps?: number }>>;\n readonly forbidden?: readonly Readonly<Record<string, { min: number; max: number }>>[];\n readonly sigma?: number;\n}\n\n/** What a JSON value is, in the words a file author would use. */\nfunction kindOf(v: unknown): string {\n if (v === null) return 'null';\n if (Array.isArray(v)) return 'a list';\n if (typeof v === 'string') return 'text';\n if (typeof v === 'number') return Number.isFinite(v) ? 'a number' : String(v);\n if (typeof v === 'boolean') return 'true or false';\n return typeof v === 'object' ? 'an object' : typeof v;\n}\n\n/** A finite number, or null: nothing is coerced (`null`, `\"\"` and `\"0\"` once read as 0). */\nconst finite = (v: unknown): number | null => (typeof v === 'number' && Number.isFinite(v) ? v : null);\n\n/** `{min, max}` as two finite numbers, located by `where` in any refusal. */\nfunction readRange(spec: Record<string, unknown>, where: string): { min: number; max: number } {\n const min = finite(spec.min);\n const max = finite(spec.max);\n if (min === null || max === null) {\n throw new Error(`${where} needs finite min/max numbers (found ${kindOf(spec.min)} and ${kindOf(spec.max)})`);\n }\n return { min, max };\n}\n\n/**\n * Coerce unknown JSON into {@link DesignBounds}. Every bound is a finite\n * number and `steps` a positive integer; a value of another kind is refused,\n * naming the field and what was found. @internal\n */\nexport function parseDesignBounds(raw: unknown, source: string): DesignBounds {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {\n throw new Error(`design bounds at ${source} is not an object`);\n }\n const obj = raw as {\n variables?: unknown;\n forbidden?: unknown;\n sigma?: unknown;\n };\n if (!obj.variables || typeof obj.variables !== 'object' || Array.isArray(obj.variables)) {\n throw new Error(`design bounds at ${source} is missing variables`);\n }\n const variables: Record<string, { min: number; max: number; steps?: number }> = {};\n for (const [name, spec] of Object.entries(obj.variables as Record<string, unknown>)) {\n if (!spec || typeof spec !== 'object' || Array.isArray(spec)) {\n throw new Error(`design bounds at ${source}: variables.${name} is not an object`);\n }\n const where = `design bounds at ${source}: variables.${name}`;\n const { min, max } = readRange(spec as Record<string, unknown>, where);\n if (min > max) {\n throw new Error(`${where} has min > max`);\n }\n const entry: { min: number; max: number; steps?: number } = { min, max };\n const { steps } = spec as { steps?: unknown };\n if (steps !== undefined) {\n if (typeof steps !== 'number' || !Number.isInteger(steps) || steps < 1) {\n throw new Error(`${where}.steps must be a positive integer (found ${typeof steps === 'number' ? steps : kindOf(steps)})`);\n }\n entry.steps = steps;\n }\n variables[name] = entry;\n }\n let forbidden: DesignBounds['forbidden'];\n if (obj.forbidden !== undefined) {\n if (!Array.isArray(obj.forbidden)) {\n throw new Error(`design bounds at ${source}: forbidden must be an array`);\n }\n forbidden = obj.forbidden.map((region, i) => {\n if (!region || typeof region !== 'object' || Array.isArray(region)) {\n throw new Error(`design bounds at ${source}: forbidden[${i}] is not an object`);\n }\n const out: Record<string, { min: number; max: number }> = {};\n for (const [k, r] of Object.entries(region as Record<string, unknown>)) {\n if (!r || typeof r !== 'object' || Array.isArray(r)) {\n throw new Error(`design bounds at ${source}: forbidden[${i}].${k} is not an object`);\n }\n out[k] = readRange(r as Record<string, unknown>, `design bounds at ${source}: forbidden[${i}].${k}`);\n }\n return out;\n });\n }\n let sigma: number | undefined;\n if (obj.sigma !== undefined) {\n const s = finite(obj.sigma);\n if (s === null || s <= 0) {\n throw new Error(`design bounds at ${source}: sigma must be a positive number (found ${s === null ? kindOf(obj.sigma) : s})`);\n }\n sigma = s;\n }\n return { variables, ...(forbidden ? { forbidden } : {}), ...(sigma !== undefined ? { sigma } : {}) };\n}\n\nexport interface DesignSuggestion {\n readonly point: Readonly<Record<string, number>>;\n readonly discrimination: number;\n readonly h1: number;\n readonly h2: number;\n readonly abstained?: boolean;\n readonly reason?: string;\n}\n\nfunction inForbidden(\n point: Record<string, number>,\n forbidden: readonly Readonly<Record<string, { min: number; max: number }>>[] | undefined,\n): boolean {\n if (!forbidden) return false;\n return forbidden.some((region) =>\n Object.entries(region).every(([k, r]) => {\n const v = point[k];\n return v !== undefined && v >= r.min && v <= r.max;\n }),\n );\n}\n\n/** Suggest the grid point that maximises |H1−H2|/σ, skipping forbidden regions. @internal */\nexport function suggestDiscriminatingPoint(\n h1: ExprNode,\n h2: ExprNode,\n bounds: DesignBounds,\n): DesignSuggestion {\n const names = Object.keys(bounds.variables);\n if (names.length === 0) {\n return {\n point: {},\n discrimination: 0,\n h1: NaN,\n h2: NaN,\n abstained: true,\n reason: 'no free variables in bounds',\n };\n }\n\n const sigma = bounds.sigma ?? 1;\n let best: DesignSuggestion | null = null;\n\n const grids = names.map((n) => {\n const b = bounds.variables[n]!;\n const steps = Math.max(2, b.steps ?? 8);\n const out: number[] = [];\n for (let i = 0; i < steps; i++) {\n const t = i / (steps - 1);\n out.push(b.min + t * (b.max - b.min));\n }\n return out;\n });\n\n const idx = new Array(names.length).fill(0);\n const rec = (d: number): void => {\n if (d === names.length) {\n const point: Record<string, number> = {};\n for (let i = 0; i < names.length; i++) point[names[i]!] = grids[i]![idx[i]!]!;\n if (inForbidden(point, bounds.forbidden)) return;\n let y1: number;\n let y2: number;\n try {\n y1 = evalExpr(h1, point);\n y2 = evalExpr(h2, point);\n } catch {\n return;\n }\n if (!Number.isFinite(y1) || !Number.isFinite(y2)) return;\n const disc = Math.abs(y1 - y2) / sigma;\n if (!best || disc > best.discrimination) {\n best = { point, discrimination: disc, h1: y1, h2: y2 };\n }\n return;\n }\n for (let i = 0; i < grids[d]!.length; i++) {\n idx[d] = i;\n rec(d + 1);\n }\n };\n rec(0);\n\n if (!best) {\n return {\n point: {},\n discrimination: 0,\n h1: NaN,\n h2: NaN,\n abstained: true,\n reason: 'every grid point was forbidden or non-finite',\n };\n }\n return best;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"expression-gaps.js","sourceRoot":"","sources":["../../../src/composition/probe/expression-gaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C;;;;GAIG;AACH,MAAM,4BAA4B,GAChC,8MAA8M,CAAC;AAEjN,yEAAyE;AACzE,MAAM,UAAU,oBAAoB;IAClC,OAAO,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,qBAAqB,CAAC,CAAC;QAC7F,OAAO;YACL,GAAG,GAAG;YACN,YAAY,EAAE,EAAW;YACzB,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,4BAA4B,CAAC,EAAE;SAC7E,CAAC;IACJ,CAAC,CAAC;SAC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G;AACH,MAAM,UAAU,sBAAsB,CAAC,KAA4B;IACjE,OAAO,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,EAAE,GAAG,oBAAoB,EAAE,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/**\n * Expression gaps a `upt probe scan` can hand to Product B.\n *\n * Product A wrappers (relation-link, connectors, regime-transition) stay\n * `searchable: false`. These gaps are a separate list, concatenated by the\n * CLI, so `scanFrontier`'s length is unchanged.\n *\n * `searchable: true` here is the Tier 8 scan-list flag. Each record is built\n * from an applied-case id and title. Observations are empty. There is no\n * named baseline and no dataset. Scientific-Bridge-Discovery-v1 admits a\n * prediction-residual scanner only when both exist, so this list is not a\n * detected prediction residual and not a problem file.\n *\n * @module composition/probe/expression-gaps\n * @internal\n */\n\nimport { APPLIED_CASES } from '../../cases/index.js';\nimport { scanFrontier } from './frontier.js';\nimport { makeResidualGap } from './problem.js';\nimport type { FrontierGap } from './types.js';\nimport type { BridgeEdge } from '../edge.js';\n\n/**\n * Why an expression gap is listed as searchable.\n * The flag stays true because the Tier 8 contract lists these handles.\n * The sentence states the inputs a detected residual would have required.\n */\nconst EXPRESSION_GAP_SEARCH_REASON =\n 'listed as searchable by the Tier 8 expression-gap contract; observations are empty, and this record has no named baseline and no dataset, so it is not a detected prediction residual and not a problem file';\n\n/** One searchable prediction-residual gap per applied case. @internal */\nexport function expressionSearchGaps(): FrontierGap[] {\n return [...APPLIED_CASES.values()]\n .map((c) => {\n const gap = makeResidualGap(`fg-expr-${c.id}`, `${c.id}: ${c.title}`, 'prediction-residual');\n return {\n ...gap,\n observations: [] as const,\n searchability: { searchable: true, reasons: [EXPRESSION_GAP_SEARCH_REASON] },\n };\n })\n .sort((a, b) => a.id.localeCompare(b.id));\n}\n\n/**\n * Product A wrappers plus the expression gaps. Relation-link gaps stay\n * not-searchable; the expression gaps are searchable.\n * @internal\n */\nexport function scanWithExpressionGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n return [...scanFrontier(edges), ...expressionSearchGaps()];\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Persist counterexamples. Failed limits are fatal only when the candidate
5
5
  * claims that domain (see limits.ts). Catalog retrodiction is Product A and
6
- * is not treated as a candidate-level verdict.
6
+ * is not a battery here.
7
7
  *
8
8
  * @internal
9
9
  */
@@ -15,7 +15,6 @@ export interface FalsifyInput {
15
15
  readonly prefactor?: number;
16
16
  readonly claimedRegimes?: Readonly<Record<string, string>>;
17
17
  readonly limits?: readonly DeclaredLimit[];
18
- readonly observationalBoundIds?: readonly string[];
19
18
  readonly skipDimensional?: boolean;
20
19
  }
21
20
  export interface FalsifyResult {
@@ -23,7 +22,19 @@ export interface FalsifyResult {
23
22
  readonly survived: boolean;
24
23
  readonly counterexamples: readonly Readonly<Record<string, number>>[];
25
24
  }
26
- /** Run the Product B falsification batteries. @internal */
25
+ /**
26
+ * Run the Product B falsification batteries: dimensional, finiteness, limits.
27
+ *
28
+ * Every listed battery can fail. Two batteries once listed here, `retrodiction`
29
+ * and `observational-bounds`, returned `inconclusive` by construction (catalog
30
+ * retrodiction is Product A, and no bound was ever evaluated), so "survived
31
+ * five batteries" overstated what was checked; they are not listed until they
32
+ * are real (9.0.0 audit §4 Low). A problem's `observationalBoundIds` stay
33
+ * recorded on the problem and are not a battery.
34
+ *
35
+ * @internal
36
+ */
27
37
  export declare function runFalsification(input: FalsifyInput): FalsifyResult;
38
+ /** The batteries `runFalsification` runs, in order; each one can fail. @internal */
28
39
  export declare const DEFAULT_BATTERIES: readonly FalsificationBattery[];
29
40
  //# sourceMappingURL=falsify.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"falsify.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/falsify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACb,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AAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;CACvE;AA6FD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,CAwBnE;AAED,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,EAAE,SAAS,oBAAoB,EAI5D,CAAC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Persist counterexamples. Failed limits are fatal only when the candidate
5
5
  * claims that domain (see limits.ts). Catalog retrodiction is Product A and
6
- * is not treated as a candidate-level verdict.
6
+ * is not a battery here.
7
7
  *
8
8
  * @internal
9
9
  */
@@ -77,6 +77,8 @@ function limitsBattery(checks) {
77
77
  detail: fatal.map((c) => c.detail).join('; '),
78
78
  };
79
79
  }
80
+ // A non-fatal failure (domain not claimed) and an undecided limit (too few evaluable rows)
81
+ // both leave the battery inconclusive; neither is a pass.
80
82
  const failedNonFatal = checks.filter((c) => !c.passed && !c.fatal);
81
83
  if (failedNonFatal.length > 0) {
82
84
  return {
@@ -93,28 +95,18 @@ function limitsBattery(checks) {
93
95
  : 'declared limits held or were out of claimed domain',
94
96
  };
95
97
  }
96
- function retrodictionBattery() {
97
- return {
98
- battery: 'retrodiction',
99
- outcome: 'inconclusive',
100
- detail: 'catalog retrodiction is Product A (needs a composition graph + ground truth) — not a probe-candidate verdict',
101
- };
102
- }
103
- function observationalBoundsBattery(ids) {
104
- if (!ids || ids.length === 0) {
105
- return {
106
- battery: 'observational-bounds',
107
- outcome: 'pass',
108
- detail: 'no observational bound ids supplied',
109
- };
110
- }
111
- return {
112
- battery: 'observational-bounds',
113
- outcome: 'inconclusive',
114
- detail: `bound ids ${ids.join(', ')} recorded; candidate-level bound evaluation is data-specific`,
115
- };
116
- }
117
- /** Run the Product B falsification batteries. @internal */
98
+ /**
99
+ * Run the Product B falsification batteries: dimensional, finiteness, limits.
100
+ *
101
+ * Every listed battery can fail. Two batteries once listed here, `retrodiction`
102
+ * and `observational-bounds`, returned `inconclusive` by construction (catalog
103
+ * retrodiction is Product A, and no bound was ever evaluated), so "survived
104
+ * five batteries" overstated what was checked; they are not listed until they
105
+ * are real (9.0.0 audit §4 Low). A problem's `observationalBoundIds` stay
106
+ * recorded on the problem and are not a battery.
107
+ *
108
+ * @internal
109
+ */
118
110
  export function runFalsification(input) {
119
111
  const prefactor = input.prefactor ?? 1;
120
112
  const records = [];
@@ -127,16 +119,13 @@ export function runFalsification(input) {
127
119
  counterexamples.push(...fin.counterexamples);
128
120
  const limitChecks = checkDeclaredLimits(input.expr, input.dataset, prefactor, input.limits ?? [], input.claimedRegimes ?? {});
129
121
  records.push(limitsBattery(limitChecks));
130
- records.push(retrodictionBattery());
131
- records.push(observationalBoundsBattery(input.observationalBoundIds));
132
122
  const survived = records.every((r) => r.outcome !== 'fail');
133
123
  return { records, survived, counterexamples };
134
124
  }
125
+ /** The batteries `runFalsification` runs, in order; each one can fail. @internal */
135
126
  export const DEFAULT_BATTERIES = [
136
127
  'dimensional',
137
128
  'finiteness',
138
129
  'limits',
139
- 'retrodiction',
140
- 'observational-bounds',
141
130
  ];
142
131
  //# sourceMappingURL=falsify.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"falsify.js","sourceRoot":"","sources":["../../../src/composition/probe/falsify.ts"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,IAAI,CAAC,CAAC;IACvC,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,MAAM,eAAe,GAA6B,EAAE,CAAC;IAErD,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,GAAG,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACpE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC;IAE7C,MAAM,WAAW,GAAG,mBAAmB,CACrC,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,OAAO,EACb,SAAS,EACT,KAAK,CAAC,MAAM,IAAI,EAAE,EAClB,KAAK,CAAC,cAAc,IAAI,EAAE,CAC3B,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC;IAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;AAChD,CAAC;AAED,oFAAoF;AACpF,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,aAAa;IACb,YAAY;IACZ,QAAQ;CACT,CAAC","sourcesContent":["/**\n * Falsification batteries for probe candidates.\n *\n * Persist counterexamples. Failed limits are fatal only when the candidate\n * claims that domain (see limits.ts). Catalog retrodiction is Product A and\n * is not a battery here.\n *\n * @internal\n */\n\nimport type { ExprNode } from '../../dimensional/ast-types.js';\nimport { validate } from '../../dimensional/validator.js';\nimport { evalExpr } from '../expr-eval.js';\nimport { checkDeclaredLimits, type LimitCheckResult } from './limits.js';\nimport type {\n DeclaredLimit,\n FalsificationBattery,\n FalsificationRecord,\n ProbeDataset,\n} from './types.js';\n\nexport interface FalsifyInput {\n readonly expr: ExprNode;\n readonly dataset?: ProbeDataset;\n readonly prefactor?: number;\n readonly claimedRegimes?: Readonly<Record<string, string>>;\n readonly limits?: readonly DeclaredLimit[];\n readonly skipDimensional?: boolean;\n}\n\nexport interface FalsifyResult {\n readonly records: readonly FalsificationRecord[];\n readonly survived: boolean;\n readonly counterexamples: readonly Readonly<Record<string, number>>[];\n}\n\nfunction dimBattery(expr: ExprNode): FalsificationRecord {\n const v = validate(expr);\n if (!v.ok || v.inferredDimension === null) {\n return {\n battery: 'dimensional',\n outcome: 'fail',\n detail: 'expression is dimensionally inconsistent',\n };\n }\n return {\n battery: 'dimensional',\n outcome: 'pass',\n detail: 'expression is dimensionally consistent',\n };\n}\n\nfunction finitenessBattery(\n expr: ExprNode,\n dataset: ProbeDataset | undefined,\n prefactor: number,\n): { record: FalsificationRecord; counterexamples: Record<string, number>[] } {\n if (!dataset || dataset.rows.length === 0) {\n return {\n record: {\n battery: 'finiteness',\n outcome: 'pass',\n detail: 'no rows to evaluate',\n },\n counterexamples: [],\n };\n }\n const counterexamples: Record<string, number>[] = [];\n for (const row of dataset.rows) {\n let y: number;\n try {\n y = prefactor * evalExpr(expr, row);\n } catch {\n counterexamples.push({ ...row });\n continue;\n }\n if (!Number.isFinite(y)) counterexamples.push({ ...row });\n }\n if (counterexamples.length > 0) {\n return {\n record: {\n battery: 'finiteness',\n outcome: 'fail',\n detail: `${counterexamples.length} observation(s) produced non-finite predictions`,\n },\n counterexamples,\n };\n }\n return {\n record: {\n battery: 'finiteness',\n outcome: 'pass',\n detail: 'all predictions finite',\n },\n counterexamples: [],\n };\n}\n\nfunction limitsBattery(checks: readonly LimitCheckResult[]): FalsificationRecord {\n const fatal = checks.filter((c) => c.fatal);\n if (fatal.length > 0) {\n return {\n battery: 'limits',\n outcome: 'fail',\n detail: fatal.map((c) => c.detail).join('; '),\n };\n }\n // A non-fatal failure (domain not claimed) and an undecided limit (too few evaluable rows)\n // both leave the battery inconclusive; neither is a pass.\n const failedNonFatal = checks.filter((c) => !c.passed && !c.fatal);\n if (failedNonFatal.length > 0) {\n return {\n battery: 'limits',\n outcome: 'inconclusive',\n detail: failedNonFatal.map((c) => c.detail).join('; '),\n };\n }\n return {\n battery: 'limits',\n outcome: 'pass',\n detail:\n checks.length === 0\n ? 'no declared limits'\n : 'declared limits held or were out of claimed domain',\n };\n}\n\n/**\n * Run the Product B falsification batteries: dimensional, finiteness, limits.\n *\n * Every listed battery can fail. Two batteries once listed here, `retrodiction`\n * and `observational-bounds`, returned `inconclusive` by construction (catalog\n * retrodiction is Product A, and no bound was ever evaluated), so \"survived\n * five batteries\" overstated what was checked; they are not listed until they\n * are real (9.0.0 audit §4 Low). A problem's `observationalBoundIds` stay\n * recorded on the problem and are not a battery.\n *\n * @internal\n */\nexport function runFalsification(input: FalsifyInput): FalsifyResult {\n const prefactor = input.prefactor ?? 1;\n const records: FalsificationRecord[] = [];\n const counterexamples: Record<string, number>[] = [];\n\n if (!input.skipDimensional) {\n records.push(dimBattery(input.expr));\n }\n\n const fin = finitenessBattery(input.expr, input.dataset, prefactor);\n records.push(fin.record);\n counterexamples.push(...fin.counterexamples);\n\n const limitChecks = checkDeclaredLimits(\n input.expr,\n input.dataset,\n prefactor,\n input.limits ?? [],\n input.claimedRegimes ?? {},\n );\n records.push(limitsBattery(limitChecks));\n\n const survived = records.every((r) => r.outcome !== 'fail');\n return { records, survived, counterexamples };\n}\n\n/** The batteries `runFalsification` runs, in order; each one can fail. @internal */\nexport const DEFAULT_BATTERIES: readonly FalsificationBattery[] = [\n 'dimensional',\n 'finiteness',\n 'limits',\n];\n"]}