universal-physics-tensor 0.29.0 → 0.30.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 (362) hide show
  1. package/bin/upt.mjs +9 -830
  2. package/dist/bridges/confrontation-coverage.d.ts +15 -0
  3. package/dist/bridges/confrontation-coverage.d.ts.map +1 -1
  4. package/dist/bridges/confrontation-coverage.js +6 -1
  5. package/dist/bridges/confrontation-coverage.js.map +1 -1
  6. package/dist/bridges/descriptor.d.ts +54 -0
  7. package/dist/bridges/descriptor.d.ts.map +1 -0
  8. package/dist/bridges/descriptor.js +67 -0
  9. package/dist/bridges/descriptor.js.map +1 -0
  10. package/dist/bridges/equations/_be-helpers.d.ts +1 -2
  11. package/dist/bridges/equations/_be-helpers.d.ts.map +1 -1
  12. package/dist/bridges/equations/_be-helpers.js +3 -3
  13. package/dist/bridges/equations/_be-helpers.js.map +1 -1
  14. package/dist/bridges/equations/be-20-vacuum-energy.d.ts +1 -1
  15. package/dist/bridges/equations/be-20-vacuum-energy.d.ts.map +1 -1
  16. package/dist/bridges/equations/be-20-vacuum-energy.js +5 -3
  17. package/dist/bridges/equations/be-20-vacuum-energy.js.map +1 -1
  18. package/dist/bridges/equations/be-21-kss-bound.d.ts +1 -1
  19. package/dist/bridges/equations/be-21-kss-bound.js +1 -1
  20. package/dist/bridges/equations/be-25-iit-phi.d.ts +12 -16
  21. package/dist/bridges/equations/be-25-iit-phi.d.ts.map +1 -1
  22. package/dist/bridges/equations/be-25-iit-phi.js +12 -16
  23. package/dist/bridges/equations/be-25-iit-phi.js.map +1 -1
  24. package/dist/bridges/equations/be-26-dna-tunneling.d.ts +6 -6
  25. package/dist/bridges/equations/be-26-dna-tunneling.js +6 -6
  26. package/dist/bridges/equations/be-40-composite-higgs.d.ts +9 -7
  27. package/dist/bridges/equations/be-40-composite-higgs.d.ts.map +1 -1
  28. package/dist/bridges/equations/be-40-composite-higgs.js +9 -7
  29. package/dist/bridges/equations/be-40-composite-higgs.js.map +1 -1
  30. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts +0 -34
  31. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts.map +1 -1
  32. package/dist/bridges/equations/be-50-wheeler-feynman.js +1 -1
  33. package/dist/bridges/equations/be-50-wheeler-feynman.js.map +1 -1
  34. package/dist/canonical/entries/_l1-build.d.ts +4 -5
  35. package/dist/canonical/entries/_l1-build.d.ts.map +1 -1
  36. package/dist/canonical/entries/_l1-build.js +3 -11
  37. package/dist/canonical/entries/_l1-build.js.map +1 -1
  38. package/dist/canonical/entries/atomic.d.ts +6 -5
  39. package/dist/canonical/entries/atomic.d.ts.map +1 -1
  40. package/dist/canonical/entries/atomic.js +61 -1
  41. package/dist/canonical/entries/atomic.js.map +1 -1
  42. package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
  43. package/dist/canonical/entries/dimensional-classics.js +1 -10
  44. package/dist/canonical/entries/dimensional-classics.js.map +1 -1
  45. package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
  46. package/dist/canonical/entries/electromagnetism.js +49 -1
  47. package/dist/canonical/entries/electromagnetism.js.map +1 -1
  48. package/dist/canonical/entries/relativity.d.ts +0 -3
  49. package/dist/canonical/entries/relativity.d.ts.map +1 -1
  50. package/dist/canonical/entries/relativity.js +51 -3
  51. package/dist/canonical/entries/relativity.js.map +1 -1
  52. package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts +7 -4
  53. package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
  54. package/dist/canonical/entries/thermo-nuclear-cosmo.js +117 -1
  55. package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
  56. package/dist/canonical/linkage.d.ts +5 -0
  57. package/dist/canonical/linkage.d.ts.map +1 -1
  58. package/dist/canonical/linkage.js +54 -24
  59. package/dist/canonical/linkage.js.map +1 -1
  60. package/dist/canonical/registry.d.ts +6 -1
  61. package/dist/canonical/registry.d.ts.map +1 -1
  62. package/dist/canonical/registry.js +6 -5
  63. package/dist/canonical/registry.js.map +1 -1
  64. package/dist/cli/args.d.ts +23 -0
  65. package/dist/cli/args.d.ts.map +1 -0
  66. package/dist/cli/args.js +74 -0
  67. package/dist/cli/args.js.map +1 -0
  68. package/dist/cli/command.d.ts +46 -0
  69. package/dist/cli/command.d.ts.map +1 -0
  70. package/dist/cli/command.js +51 -0
  71. package/dist/cli/command.js.map +1 -0
  72. package/dist/cli/commands/_discovery-opts.d.ts +16 -0
  73. package/dist/cli/commands/_discovery-opts.d.ts.map +1 -0
  74. package/dist/cli/commands/_discovery-opts.js +33 -0
  75. package/dist/cli/commands/_discovery-opts.js.map +1 -0
  76. package/dist/cli/commands/audit.d.ts +3 -0
  77. package/dist/cli/commands/audit.d.ts.map +1 -0
  78. package/dist/cli/commands/audit.js +71 -0
  79. package/dist/cli/commands/audit.js.map +1 -0
  80. package/dist/cli/commands/candidates.d.ts +3 -0
  81. package/dist/cli/commands/candidates.d.ts.map +1 -0
  82. package/dist/cli/commands/candidates.js +46 -0
  83. package/dist/cli/commands/candidates.js.map +1 -0
  84. package/dist/cli/commands/canonical.d.ts +3 -0
  85. package/dist/cli/commands/canonical.d.ts.map +1 -0
  86. package/dist/cli/commands/canonical.js +38 -0
  87. package/dist/cli/commands/canonical.js.map +1 -0
  88. package/dist/cli/commands/connectors.d.ts +3 -0
  89. package/dist/cli/commands/connectors.d.ts.map +1 -0
  90. package/dist/cli/commands/connectors.js +51 -0
  91. package/dist/cli/commands/connectors.js.map +1 -0
  92. package/dist/cli/commands/coverage.d.ts +3 -0
  93. package/dist/cli/commands/coverage.d.ts.map +1 -0
  94. package/dist/cli/commands/coverage.js +39 -0
  95. package/dist/cli/commands/coverage.js.map +1 -0
  96. package/dist/cli/commands/derive.d.ts +3 -0
  97. package/dist/cli/commands/derive.d.ts.map +1 -0
  98. package/dist/cli/commands/derive.js +143 -0
  99. package/dist/cli/commands/derive.js.map +1 -0
  100. package/dist/cli/commands/discover.d.ts +3 -0
  101. package/dist/cli/commands/discover.d.ts.map +1 -0
  102. package/dist/cli/commands/discover.js +137 -0
  103. package/dist/cli/commands/discover.js.map +1 -0
  104. package/dist/cli/commands/eval.d.ts +3 -0
  105. package/dist/cli/commands/eval.d.ts.map +1 -0
  106. package/dist/cli/commands/eval.js +64 -0
  107. package/dist/cli/commands/eval.js.map +1 -0
  108. package/dist/cli/commands/explain.d.ts +3 -0
  109. package/dist/cli/commands/explain.d.ts.map +1 -0
  110. package/dist/cli/commands/explain.js +81 -0
  111. package/dist/cli/commands/explain.js.map +1 -0
  112. package/dist/cli/commands/index.d.ts +21 -0
  113. package/dist/cli/commands/index.d.ts.map +1 -0
  114. package/dist/cli/commands/index.js +21 -0
  115. package/dist/cli/commands/index.js.map +1 -0
  116. package/dist/cli/commands/map.d.ts +3 -0
  117. package/dist/cli/commands/map.d.ts.map +1 -0
  118. package/dist/cli/commands/map.js +245 -0
  119. package/dist/cli/commands/map.js.map +1 -0
  120. package/dist/cli/commands/predict.d.ts +3 -0
  121. package/dist/cli/commands/predict.d.ts.map +1 -0
  122. package/dist/cli/commands/predict.js +54 -0
  123. package/dist/cli/commands/predict.js.map +1 -0
  124. package/dist/cli/commands/priority.d.ts +3 -0
  125. package/dist/cli/commands/priority.d.ts.map +1 -0
  126. package/dist/cli/commands/priority.js +63 -0
  127. package/dist/cli/commands/priority.js.map +1 -0
  128. package/dist/cli/commands/recover.d.ts +3 -0
  129. package/dist/cli/commands/recover.d.ts.map +1 -0
  130. package/dist/cli/commands/recover.js +51 -0
  131. package/dist/cli/commands/recover.js.map +1 -0
  132. package/dist/cli/commands/symbolic.d.ts +3 -0
  133. package/dist/cli/commands/symbolic.d.ts.map +1 -0
  134. package/dist/cli/commands/symbolic.js +110 -0
  135. package/dist/cli/commands/symbolic.js.map +1 -0
  136. package/dist/cli/errors.d.ts +14 -0
  137. package/dist/cli/errors.d.ts.map +1 -0
  138. package/dist/cli/errors.js +20 -0
  139. package/dist/cli/errors.js.map +1 -0
  140. package/dist/cli/graphs.d.ts +16 -0
  141. package/dist/cli/graphs.d.ts.map +1 -0
  142. package/dist/cli/graphs.js +30 -0
  143. package/dist/cli/graphs.js.map +1 -0
  144. package/dist/cli/main.d.ts +33 -0
  145. package/dist/cli/main.d.ts.map +1 -0
  146. package/dist/cli/main.js +219 -0
  147. package/dist/cli/main.js.map +1 -0
  148. package/dist/cli/output.d.ts +19 -0
  149. package/dist/cli/output.d.ts.map +1 -0
  150. package/dist/cli/output.js +57 -0
  151. package/dist/cli/output.js.map +1 -0
  152. package/dist/cli/version.d.ts +11 -0
  153. package/dist/cli/version.d.ts.map +1 -0
  154. package/dist/cli/version.js +16 -0
  155. package/dist/cli/version.js.map +1 -0
  156. package/dist/cli-api.d.ts +28 -0
  157. package/dist/cli-api.d.ts.map +1 -0
  158. package/dist/cli-api.js +31 -0
  159. package/dist/cli-api.js.map +1 -0
  160. package/dist/composition/bridge-analysis.d.ts +13 -15
  161. package/dist/composition/bridge-analysis.d.ts.map +1 -1
  162. package/dist/composition/bridge-analysis.js +54 -39
  163. package/dist/composition/bridge-analysis.js.map +1 -1
  164. package/dist/composition/bridge-prediction.d.ts +4 -3
  165. package/dist/composition/bridge-prediction.d.ts.map +1 -1
  166. package/dist/composition/compose-symbolic.d.ts.map +1 -1
  167. package/dist/composition/compose-symbolic.js +12 -0
  168. package/dist/composition/compose-symbolic.js.map +1 -1
  169. package/dist/composition/discovery.d.ts.map +1 -1
  170. package/dist/composition/discovery.js +40 -12
  171. package/dist/composition/discovery.js.map +1 -1
  172. package/dist/composition/edges/_catalog-helpers.d.ts +34 -0
  173. package/dist/composition/edges/_catalog-helpers.d.ts.map +1 -0
  174. package/dist/composition/edges/_catalog-helpers.js +75 -0
  175. package/dist/composition/edges/_catalog-helpers.js.map +1 -0
  176. package/dist/composition/edges/calibration.d.ts.map +1 -1
  177. package/dist/composition/edges/calibration.js +1 -1
  178. package/dist/composition/edges/calibration.js.map +1 -1
  179. package/dist/composition/edges/catalog-condensed-matter.d.ts +64 -0
  180. package/dist/composition/edges/catalog-condensed-matter.d.ts.map +1 -0
  181. package/dist/composition/edges/catalog-condensed-matter.js +226 -0
  182. package/dist/composition/edges/catalog-condensed-matter.js.map +1 -0
  183. package/dist/composition/edges/catalog-fields.d.ts +68 -0
  184. package/dist/composition/edges/catalog-fields.d.ts.map +1 -0
  185. package/dist/composition/edges/catalog-fields.js +206 -0
  186. package/dist/composition/edges/catalog-fields.js.map +1 -0
  187. package/dist/composition/edges/catalog-full.d.ts +5 -263
  188. package/dist/composition/edges/catalog-full.d.ts.map +1 -1
  189. package/dist/composition/edges/catalog-full.js +9 -959
  190. package/dist/composition/edges/catalog-full.js.map +1 -1
  191. package/dist/composition/edges/catalog-gravitation-cosmology.d.ts +80 -0
  192. package/dist/composition/edges/catalog-gravitation-cosmology.d.ts.map +1 -0
  193. package/dist/composition/edges/catalog-gravitation-cosmology.js +245 -0
  194. package/dist/composition/edges/catalog-gravitation-cosmology.js.map +1 -0
  195. package/dist/composition/edges/catalog-quantum.d.ts +85 -0
  196. package/dist/composition/edges/catalog-quantum.d.ts.map +1 -0
  197. package/dist/composition/edges/catalog-quantum.js +252 -0
  198. package/dist/composition/edges/catalog-quantum.js.map +1 -0
  199. package/dist/composition/expr-simplify.d.ts +2 -6
  200. package/dist/composition/expr-simplify.d.ts.map +1 -1
  201. package/dist/composition/expr-simplify.js +1 -1
  202. package/dist/composition/expr-simplify.js.map +1 -1
  203. package/dist/composition/expr-subst.d.ts +2 -1
  204. package/dist/composition/expr-subst.d.ts.map +1 -1
  205. package/dist/composition/proposed-bridges.d.ts +4 -4
  206. package/dist/composition/proposed-bridges.d.ts.map +1 -1
  207. package/dist/composition/proposed-bridges.js +1 -3
  208. package/dist/composition/proposed-bridges.js.map +1 -1
  209. package/dist/composition/quantities/_dims.d.ts +35 -0
  210. package/dist/composition/quantities/_dims.d.ts.map +1 -0
  211. package/dist/composition/quantities/_dims.js +45 -0
  212. package/dist/composition/quantities/_dims.js.map +1 -0
  213. package/dist/composition/quantities/common.d.ts +69 -0
  214. package/dist/composition/quantities/common.d.ts.map +1 -0
  215. package/dist/composition/quantities/common.js +200 -0
  216. package/dist/composition/quantities/common.js.map +1 -0
  217. package/dist/composition/quantities/condensed-matter.d.ts +63 -0
  218. package/dist/composition/quantities/condensed-matter.d.ts.map +1 -0
  219. package/dist/composition/quantities/condensed-matter.js +185 -0
  220. package/dist/composition/quantities/condensed-matter.js.map +1 -0
  221. package/dist/composition/quantities/fields.d.ts +59 -0
  222. package/dist/composition/quantities/fields.d.ts.map +1 -0
  223. package/dist/composition/quantities/fields.js +171 -0
  224. package/dist/composition/quantities/fields.js.map +1 -0
  225. package/dist/composition/quantities/gravitation-cosmology.d.ts +67 -0
  226. package/dist/composition/quantities/gravitation-cosmology.d.ts.map +1 -0
  227. package/dist/composition/quantities/gravitation-cosmology.js +199 -0
  228. package/dist/composition/quantities/gravitation-cosmology.js.map +1 -0
  229. package/dist/composition/quantities/quantum.d.ts +61 -0
  230. package/dist/composition/quantities/quantum.d.ts.map +1 -0
  231. package/dist/composition/quantities/quantum.js +178 -0
  232. package/dist/composition/quantities/quantum.js.map +1 -0
  233. package/dist/composition/quantities.d.ts +5 -263
  234. package/dist/composition/quantities.d.ts.map +1 -1
  235. package/dist/composition/quantities.js +7 -983
  236. package/dist/composition/quantities.js.map +1 -1
  237. package/dist/composition/retrodiction.d.ts.map +1 -1
  238. package/dist/composition/retrodiction.js +15 -3
  239. package/dist/composition/retrodiction.js.map +1 -1
  240. package/dist/composition/symbolic-constants.d.ts +3 -2
  241. package/dist/composition/symbolic-constants.d.ts.map +1 -1
  242. package/dist/core/tensor.d.ts +6 -0
  243. package/dist/core/tensor.d.ts.map +1 -1
  244. package/dist/core/tensor.js +6 -0
  245. package/dist/core/tensor.js.map +1 -1
  246. package/dist/diff/bridge-ast-gradient.js +1 -1
  247. package/dist/diff/bridge-ast-gradient.js.map +1 -1
  248. package/dist/diff/bridge-gradient.d.ts.map +1 -1
  249. package/dist/diff/bridge-gradient.js +15 -4
  250. package/dist/diff/bridge-gradient.js.map +1 -1
  251. package/dist/dimensional/algebra.d.ts +24 -0
  252. package/dist/dimensional/algebra.d.ts.map +1 -1
  253. package/dist/dimensional/algebra.js +31 -5
  254. package/dist/dimensional/algebra.js.map +1 -1
  255. package/dist/dimensional/ast-builders.d.ts +25 -0
  256. package/dist/dimensional/ast-builders.d.ts.map +1 -0
  257. package/dist/dimensional/ast-builders.js +27 -0
  258. package/dist/dimensional/ast-builders.js.map +1 -0
  259. package/dist/dimensional/ast-types.d.ts +193 -0
  260. package/dist/dimensional/ast-types.d.ts.map +1 -0
  261. package/dist/dimensional/ast-types.js +20 -0
  262. package/dist/dimensional/ast-types.js.map +1 -0
  263. package/dist/dimensional/buckingham.d.ts.map +1 -1
  264. package/dist/dimensional/buckingham.js +7 -4
  265. package/dist/dimensional/buckingham.js.map +1 -1
  266. package/dist/dimensional/connection-validators.d.ts +3 -38
  267. package/dist/dimensional/connection-validators.d.ts.map +1 -1
  268. package/dist/dimensional/connection-validators.js.map +1 -1
  269. package/dist/dimensional/connection.d.ts.map +1 -1
  270. package/dist/dimensional/connection.js +9 -0
  271. package/dist/dimensional/connection.js.map +1 -1
  272. package/dist/dimensional/curvature-composite.d.ts +2 -1
  273. package/dist/dimensional/curvature-composite.d.ts.map +1 -1
  274. package/dist/dimensional/curvature-invariants.d.ts +2 -11
  275. package/dist/dimensional/curvature-invariants.d.ts.map +1 -1
  276. package/dist/dimensional/curvature-invariants.js.map +1 -1
  277. package/dist/dimensional/curvature.d.ts +5 -24
  278. package/dist/dimensional/curvature.d.ts.map +1 -1
  279. package/dist/dimensional/curvature.js.map +1 -1
  280. package/dist/dimensional/dimension-inference.d.ts.map +1 -1
  281. package/dist/dimensional/dimension-inference.js +11 -5
  282. package/dist/dimensional/dimension-inference.js.map +1 -1
  283. package/dist/dimensional/einstein-equation.d.ts +2 -11
  284. package/dist/dimensional/einstein-equation.d.ts.map +1 -1
  285. package/dist/dimensional/einstein-equation.js.map +1 -1
  286. package/dist/dimensional/killing-validators.d.ts +2 -19
  287. package/dist/dimensional/killing-validators.d.ts.map +1 -1
  288. package/dist/dimensional/killing-validators.js.map +1 -1
  289. package/dist/dimensional/metric-validators.d.ts +5 -39
  290. package/dist/dimensional/metric-validators.d.ts.map +1 -1
  291. package/dist/dimensional/metric-validators.js.map +1 -1
  292. package/dist/dimensional/stress-energy-validators.d.ts +2 -21
  293. package/dist/dimensional/stress-energy-validators.d.ts.map +1 -1
  294. package/dist/dimensional/stress-energy-validators.js.map +1 -1
  295. package/dist/dimensional/tensor.d.ts +2 -32
  296. package/dist/dimensional/tensor.d.ts.map +1 -1
  297. package/dist/dimensional/tensor.js.map +1 -1
  298. package/dist/dimensional/validator.d.ts +12 -58
  299. package/dist/dimensional/validator.d.ts.map +1 -1
  300. package/dist/dimensional/validator.js +12 -9
  301. package/dist/dimensional/validator.js.map +1 -1
  302. package/dist/dimensional/weyl-validators.d.ts +2 -18
  303. package/dist/dimensional/weyl-validators.d.ts.map +1 -1
  304. package/dist/dimensional/weyl-validators.js.map +1 -1
  305. package/dist/numerical/be37-covariant-eikonal.d.ts +12 -11
  306. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
  307. package/dist/numerical/be37-covariant-eikonal.js +23 -8
  308. package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
  309. package/dist/numerical/christoffel-flat.d.ts +10 -1
  310. package/dist/numerical/christoffel-flat.d.ts.map +1 -1
  311. package/dist/numerical/christoffel-flat.js +11 -2
  312. package/dist/numerical/christoffel-flat.js.map +1 -1
  313. package/dist/numerical/curvature-lowering-helpers.d.ts +4 -1
  314. package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
  315. package/dist/numerical/curvature-lowering-helpers.js +72 -14
  316. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  317. package/dist/numerical/engine-registry.d.ts.map +1 -1
  318. package/dist/numerical/engine-registry.js +11 -0
  319. package/dist/numerical/engine-registry.js.map +1 -1
  320. package/dist/numerical/float64-engine.d.ts.map +1 -1
  321. package/dist/numerical/float64-engine.js +20 -28
  322. package/dist/numerical/float64-engine.js.map +1 -1
  323. package/dist/numerical/formula-dimension.d.ts.map +1 -1
  324. package/dist/numerical/formula-dimension.js +1 -1
  325. package/dist/numerical/formula-dimension.js.map +1 -1
  326. package/dist/numerical/formula.d.ts +0 -2
  327. package/dist/numerical/formula.d.ts.map +1 -1
  328. package/dist/numerical/formula.js +7 -3
  329. package/dist/numerical/formula.js.map +1 -1
  330. package/dist/numerical/geodesic-integrator.d.ts +6 -1
  331. package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
  332. package/dist/numerical/geodesic-integrator.js +14 -6
  333. package/dist/numerical/geodesic-integrator.js.map +1 -1
  334. package/dist/numerical/gl4-integrator.d.ts.map +1 -1
  335. package/dist/numerical/gl4-integrator.js +106 -43
  336. package/dist/numerical/gl4-integrator.js.map +1 -1
  337. package/dist/numerical/lowering.d.ts.map +1 -1
  338. package/dist/numerical/lowering.js +8 -5
  339. package/dist/numerical/lowering.js.map +1 -1
  340. package/dist/numerical/null-ic.d.ts +4 -3
  341. package/dist/numerical/null-ic.d.ts.map +1 -1
  342. package/dist/numerical/null-ic.js +4 -3
  343. package/dist/numerical/null-ic.js.map +1 -1
  344. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  345. package/dist/numerical/perihelion-finder.js +15 -1
  346. package/dist/numerical/perihelion-finder.js.map +1 -1
  347. package/dist/numerical/quadrature.d.ts +3 -2
  348. package/dist/numerical/quadrature.d.ts.map +1 -1
  349. package/dist/numerical/quadrature.js +8 -1
  350. package/dist/numerical/quadrature.js.map +1 -1
  351. package/dist/numerical/weyl-lowering.d.ts.map +1 -1
  352. package/dist/numerical/weyl-lowering.js +28 -2
  353. package/dist/numerical/weyl-lowering.js.map +1 -1
  354. package/package.json +3 -2
  355. package/dist/canonical/entries/l1-gravity-thermo.d.ts +0 -12
  356. package/dist/canonical/entries/l1-gravity-thermo.d.ts.map +0 -1
  357. package/dist/canonical/entries/l1-gravity-thermo.js +0 -165
  358. package/dist/canonical/entries/l1-gravity-thermo.js.map +0 -1
  359. package/dist/canonical/entries/l1-quantum-em.d.ts +0 -10
  360. package/dist/canonical/entries/l1-quantum-em.d.ts.map +0 -1
  361. package/dist/canonical/entries/l1-quantum-em.js +0 -141
  362. package/dist/canonical/entries/l1-quantum-em.js.map +0 -1
package/bin/upt.mjs CHANGED
@@ -1,843 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * upt — a small CLI over the Universal Physics Tensor bridge-inference
4
- * suite, for people who don't read TypeScript.
5
- *
6
- * upt explain <quantity> [name=value | name] ...
7
- * upt priority
8
- * upt audit
9
- * upt help
10
- *
11
- * Run from a built checkout (`npm run build`) via `npm run upt -- <cmd>`,
12
- * or as an installed command (`npx universal-physics-tensor <cmd>`).
3
+ * upt — thin launcher. All logic lives in src/cli/ (compiled to dist/cli/).
4
+ * This shim only resolves dist/, guards the not-built case, and maps the
5
+ * returned code onto process.exitCode (NOT process.exit — a hard exit can
6
+ * truncate piped stdout).
13
7
  */
14
8
  import { fileURLToPath, pathToFileURL } from 'node:url';
15
9
  import { dirname, join } from 'node:path';
16
- import { writeFileSync } from 'node:fs';
17
10
 
18
11
  const here = dirname(fileURLToPath(import.meta.url));
19
- // Return a file:// URL, not a bare path: Node's ESM dynamic import() rejects
20
- // absolute Windows paths ("protocol 'c:'") — it only accepts file/data/node URLs.
21
- const dist = (...p) => pathToFileURL(join(here, '..', 'dist', ...p)).href;
12
+ const entry = pathToFileURL(join(here, '..', 'dist', 'cli', 'main.js')).href;
22
13
 
23
- let api, analysis, formulaReg, dimSpecMod, prediction, discovery, coverage, simplifyMod;
24
- let canonicalReg, linkageMod, proposedMod;
14
+ let main;
25
15
  try {
26
- api = await import(dist('index.js'));
27
- analysis = await import(dist('composition', 'bridge-analysis.js'));
28
- formulaReg = await import(dist('numerical', 'formula-registry.js'));
29
- dimSpecMod = await import(dist('dimensional', 'dimension-spec.js'));
30
- prediction = await import(dist('composition', 'bridge-prediction.js'));
31
- discovery = await import(dist('composition', 'discovery.js'));
32
- coverage = await import(dist('bridges', 'confrontation-coverage.js'));
33
- simplifyMod = await import(dist('composition', 'expr-simplify.js'));
34
- canonicalReg = await import(dist('canonical', 'registry.js'));
35
- linkageMod = await import(dist('canonical', 'linkage.js'));
36
- proposedMod = await import(dist('composition', 'proposed-bridges.js'));
16
+ main = await import(entry);
37
17
  } catch (err) {
38
18
  console.error('Could not load the built package. Run `npm run build` first.');
39
- console.error(String(err.message || err));
19
+ console.error(String(err && err.message ? err.message : err));
40
20
  process.exit(1);
41
21
  }
42
-
43
- const { explainQuantity, CATALOG_GRAPH, CANONICAL_GRAPH, M_SUN_KG, composeSymbolic,
44
- be42Edge, be16Edge, lawSchwarzschildRadius, be42ViaRsEdge, format,
45
- buildVizModel, renderDotToSvg,
46
- equationLanding, analyzeUserEquation } = api;
47
- const { bridgePriority, attemptDerivation, dimensionalFreedom, dimensionallyDetermines, buckinghamPi, linkageMap, proposeLinkCandidates, proposeOrphanConnectors } = { ...analysis, ...api };
48
- const { getFormulaParser, getFormulaParserKind, getFormulaDimensionChecker } = formulaReg;
49
- const { parseDimensionSpec } = dimSpecMod;
50
- const { predictMissingBridges } = prediction;
51
- const { rankDiscoveries } = discovery;
52
- const { auditCoverage } = coverage;
53
- const { simplifyObservable } = simplifyMod;
54
- const { CANONICAL_EQUATIONS, bridgesWithoutCanonicalPartner } = canonicalReg;
55
- const { scanLinkages } = linkageMod;
56
- const { deriveProposedBridges } = proposedMod;
57
-
58
- const GRAPH = CATALOG_GRAPH;
59
-
60
- // `--source=catalog|canonical|both` selects which graph the analysis commands
61
- // (`discover` / `candidates` / `map`) run over. `catalog` (default) is the
62
- // 44-bridge catalog; `canonical` is the standard-physics L-layer ALONE, with
63
- // the speculative bridges excluded; `both` is the bridges plus the canonical
64
- // established-physics backbone.
65
- function resolveGraph(args) {
66
- const flag = (args || []).find((a) => a.startsWith('--source='));
67
- const src = flag ? flag.slice('--source='.length) : 'catalog';
68
- switch (src) {
69
- case 'catalog':
70
- return { graph: CATALOG_GRAPH, label: 'catalog (44-bridge)' };
71
- case 'canonical':
72
- return { graph: CANONICAL_GRAPH, label: 'canonical (standard-physics L-layer, bridges excluded)' };
73
- case 'both':
74
- return { graph: [...CATALOG_GRAPH, ...CANONICAL_GRAPH], label: 'catalog + canonical' };
75
- default:
76
- console.error(`upt: unknown --source='${src}' (expected: catalog | canonical | both)`);
77
- process.exit(1);
78
- }
79
- }
80
-
81
- // ── help ────────────────────────────────────────────────────────────────
82
- function help() {
83
- console.log(`upt — Universal Physics Tensor bridge-inference CLI
84
-
85
- Usage:
86
- upt explain <quantity> [name=value | name] ...
87
- Explain how the graph determines a quantity: the identifiability
88
- verdict, recovered value, derivation chains, and whether the inputs
89
- are dimensionally sufficient.
90
- e.g. upt explain hawking-temperature mass=1.989e30
91
-
92
- upt priority
93
- Triage the speculative bridges by structural DECIDABILITY against
94
- established physics (Tiers 1-3). NOT a credibility ranking.
95
-
96
- upt audit
97
- Try to derive every built-in bridge equation by dimensions: which
98
- re-derive as a recognized monomial (with the prefactor recovered),
99
- which are decoys, which are dimensionally open.
100
-
101
- upt map [--source=catalog|canonical|both] [--format=text|mermaid|dot|svg]
102
- [--proposed] [--out=PATH] [--equation "TARGET = EXPR"]
103
- Map how the equations LINK: connected components (clusters) of the
104
- graph by shared quantities, the anchored core, the link hubs, and
105
- the isolated tail.
106
- --format=mermaid|dot|svg emits the VISUAL map (quantities = nodes,
107
- equations = junctions colored by status, one subgraph per component).
108
- text (default) is the unchanged linkage printout. svg renders the dot
109
- layout via the optional @viz-js/viz peer (npm i @viz-js/viz; or pipe
110
- dot through "dot -Tsvg"). --proposed overlays the unadjudicated
111
- identity-consequence relations (gray dashed). --out writes to a file
112
- (default stdout).
113
- --equation "TARGET = EXPR" injects YOUR OWN equation as a violet 'user'
114
- node and reports where it lands (which cluster / shared quantities), with
115
- a "did you mean?" hint for names that miss the catalog vocabulary. Use
116
- underscores for multi-word quantities (photon_energy -> photon-energy).
117
- e.g. upt map --equation "period = 2*pi*sqrt(length/gravity)"
118
-
119
- upt candidates [--source=catalog|canonical|both]
120
- Propose candidate cross-cluster links (quantities of the same
121
- dimension in different clusters) for PHYSICIST REVIEW — a
122
- coincidence-heavy surface, not discovered bridges.
123
-
124
- upt predict
125
- Project the catalog onto the (scale × force) regime plane and rank
126
- the EMPTY regime cells as undiscovered-connection hypotheses
127
- (triadic closure). Makes the namesake tensor operational. Review
128
- surface, not discovered bridges.
129
-
130
- upt discover [--source=catalog|canonical|both]
131
- VET the link candidates through the inference suite: hypothesise
132
- each identification a≡b and test whether it merges disconnected
133
- physics, unlocks quantities, and stays numerically consistent.
134
- Ranks promising / inert / contradictory.
135
- --source=canonical runs the funnel on the standard-physics L-layer
136
- ALONE (bridges excluded) — new candidates from established physics,
137
- and a self-consistency check (expect 0 contradictory).
138
- --derive emits, for each 'promising' identification, the ONE algebraic
139
- relation it implies (monomial elimination) as an UNADJUDICATED, math-only
140
- proposal — NOT a bridge (Part-VI §XXVII-B). Pairs with --source=canonical.
141
- --max-orders=N tunes the magnitude-clash threshold (default 3); looser N
142
- keeps more candidates 'promising', tighter N falsifies more as clashes.
143
- --anchor=k=v[,k2=v2] overrides the numeric anchor (default mass=M_sun)
144
- for the consistency/closure check. Both reshape the candidate pool that
145
- --derive consumes.
146
-
147
- upt connectors
148
- Of the 20 ISOLATED bridges, which could connect to the anchored
149
- core via a same-dimension identification? The structural frontier —
150
- same-kind connectors are the motivated set for physicist review.
151
-
152
- upt coverage
153
- Audit the catalog's empirical grounding — which bridges are
154
- data-confronted vs graph-computable vs encoded-only vs thin — to
155
- target the physicist review. Fabricates nothing.
156
-
157
- upt canonical
158
- List the canonical-equation registry — the standard-physics L-layer
159
- (textbook "answer key") with each entry's fidelity (L0/L1/L2),
160
- domain, and bridge partners, plus the coverage gap.
161
-
162
- upt recover
163
- Validate bridges against standard physics: classify each bridge↔
164
- canonical link as restates-canonical (F4 circularity — NOT a
165
- discovery), recovers (undeclared structural match), or
166
- dimensional-only.
167
-
168
- upt symbolic [--simplify]
169
- Compose bridges' SYMBOLIC (AST) forms, not just their numeric
170
- evaluators (the Observable contract). Shows the CT-1 / CT-1b chains
171
- composed by substitution, dimensionally validated and evaluable.
172
- With --simplify, folds the composed AST via MathTS (k_B cancels),
173
- re-validated dimensionally + numerically.
174
-
175
- upt eval "<formula>" name=value ...
176
- Evaluate YOUR OWN scalar formula (safe — arithmetic only). Knows
177
- pi/tau and sqrt/exp/ln/sin/...; any other name must be supplied.
178
- e.g. upt eval "hbar*c^3/(8*pi*G*M*k_B)" hbar=1.054571817e-34 \\
179
- c=299792458 G=6.6743e-11 M=1.989e30 k_B=1.380649e-23
180
-
181
- upt derive <target:dim> <var:dim> ... [--formula "<expr>"]
182
- Derive YOUR OWN equation's dimensional form. <dim> is a named
183
- dimension (length, time, mass, velocity, ...), a constant (hbar, c,
184
- G, k_B, e), or explicit (L^3.M^-1.T^-2). With --formula, also verify
185
- it and recover the dimensionless prefactor.
186
- e.g. upt derive period:time length:length gravity:acceleration \\
187
- --formula "2*pi*sqrt(length/gravity)"
188
-
189
- upt help Show this message.
190
-
191
- Run with no arguments for a short demo.`);
192
- }
193
-
194
- // ── explain ─────────────────────────────────────────────────────────────
195
- function parseKnown(args) {
196
- const values = {};
197
- const names = [];
198
- let hasValue = false;
199
- for (const a of args) {
200
- const eq = a.indexOf('=');
201
- if (eq === -1) { names.push(a); continue; }
202
- const num = Number(a.slice(eq + 1));
203
- if (Number.isNaN(num)) { names.push(a.slice(0, eq)); }
204
- else { values[a.slice(0, eq)] = num; hasValue = true; }
205
- }
206
- return hasValue ? values : names;
207
- }
208
-
209
- function explain(target, rest) {
210
- if (!target) { console.error('upt explain needs a quantity name. See `upt help`.'); process.exit(2); }
211
- const x = explainQuantity(GRAPH, target, parseKnown(rest));
212
- console.log(`\n● ${target}`);
213
- console.log(` ${x.summary}`);
214
- if (x.derivations.length) {
215
- console.log(' derivations:');
216
- for (const d of x.derivations) {
217
- const val = d.value !== undefined ? ` = ${d.value.toExponential(4)}` : '';
218
- const chain = d.leafInputs.join(',') !== d.sources.join(',')
219
- ? ` [from leaves: ${d.leafInputs.join(', ')}]` : '';
220
- console.log(` - ${d.edge} (${d.label})${val}${chain}`);
221
- if (d.dimensionalForm) console.log(` ${d.dimensionalForm.formula}`);
222
- }
223
- }
224
- if (x.blockingFrontier.length) {
225
- console.log(` to determine it, also supply: ${x.blockingFrontier.join(', ')}`);
226
- }
227
- }
228
-
229
- // ── priority ────────────────────────────────────────────────────────────
230
- function priority() {
231
- const board = bridgePriority(GRAPH);
232
- const a = (d) => (d === Infinity ? '∞' : String(d));
233
- console.log('\nBridge triage — structural decidability against established physics');
234
- console.log('(review/confrontation priority — NOT a credibility ranking)\n');
235
- console.log(' tier anchor grounding cplx data bridge status');
236
- console.log(' ' + '─'.repeat(73));
237
- let last = 0;
238
- for (const e of board) {
239
- if (e.tier !== last) {
240
- const label = e.tier === 1 ? 'anchored + grounded/tractable — confront first'
241
- : e.tier === 2 ? 'anchored OR grounded — second pass'
242
- : 'isolated + multi-parameter — needs literature review, not structure';
243
- console.log(`\n ── Tier ${e.tier}: ${label}`);
244
- last = e.tier;
245
- }
246
- console.log(' T' + e.tier, a(e.anchoring).padStart(5), ' ' + e.grounding.padEnd(10),
247
- String(e.complexity).padStart(3), e.hasDataConfrontation ? ' DATA' : ' ',
248
- ' ' + e.id.padEnd(20), e.status);
249
- }
250
- const tiers = board.reduce((m, e) => ((m[e.tier] = (m[e.tier] || 0) + 1), m), {});
251
- console.log(`\n Tiers: ${JSON.stringify(tiers)} (of ${board.length} non-established bridges)`);
252
- console.log(' Reminder: tier ranks decidability/anchoring, not truth.');
253
- }
254
-
255
- // ── audit ───────────────────────────────────────────────────────────────
256
- function audit() {
257
- const derived = [], decoy = [], open = [];
258
- for (const e of GRAPH) {
259
- const d = attemptDerivation(e);
260
- const c = dimensionalFreedom(e);
261
- if (d.status === 'derived') derived.push({ e, d, c });
262
- else if (d.status === 'decoy') decoy.push({ e, c });
263
- else open.push({ e, c });
264
- }
265
- console.log('\nDeriving the bridge equations by dimensions');
266
- console.log('(form by dimensions; the constant is recovered by matching the evaluator)\n');
267
- console.log(` DERIVED (${derived.length}) — recognized monomial, prefactor recovered:`);
268
- for (const { e, d } of derived) {
269
- const tag = d.cleanPrefactor ? '' : ' (empirical/tuned constant)';
270
- console.log(` ${e.id.padEnd(22)} +[${(d.subset || []).join(',')}] ×${d.prefactor.toExponential(3)}${tag}`);
271
- }
272
- console.log(`\n DECOY (${decoy.length}) — dimensionally valid but wrong form:`);
273
- console.log(' ' + decoy.map((x) => x.e.id).join(', '));
274
- console.log(`\n OPEN (${open.length}) — irreducible free dimensionless group(s); by complexity:`);
275
- for (const { e, c } of open.sort((a, b) => a.c - b.c)) {
276
- console.log(` cplx=${c} ${e.id}`);
277
- }
278
- console.log('\n (derivability is ORTHOGONAL to credibility — see the priority command)');
279
- }
280
-
281
- // ── eval (your own formula) ───────────────────────────────────────────────
282
- async function evalCmd(rawArgs) {
283
- const debug = rawArgs.includes('--debug');
284
- const args = rawArgs.filter((a) => a !== '--debug');
285
- const expr = args[0];
286
- if (!expr) { console.error('upt eval needs a formula, e.g. upt eval "a*b^2" a=2 b=3'); process.exit(2); }
287
- const parser = await getFormulaParser();
288
- if (debug) console.error(`[parser: ${await getFormulaParserKind()}]`);
289
- let cf;
290
- try { cf = parser.parse(expr); } catch (e) { console.error('parse error: ' + e.message); process.exit(2); }
291
- const scope = {};
292
- for (const a of args.slice(1)) {
293
- const i = a.indexOf('=');
294
- if (i > 0) scope[a.slice(0, i)] = Number(a.slice(i + 1));
295
- }
296
- const missing = cf.variables.filter((v) => !(v in scope));
297
- if (missing.length) {
298
- console.error(`missing values for: ${missing.join(', ')} (free variables: ${cf.variables.join(', ') || 'none'})`);
299
- process.exit(2);
300
- }
301
- try { console.log(cf.evaluate(scope)); } catch (e) { console.error(e.message); process.exit(2); }
302
- }
303
-
304
- // ── derive (your own equation) ─────────────────────────────────────────────
305
- const fmtMono = (m) => Object.entries(m).filter(([, e]) => Math.abs(e) > 1e-9)
306
- .map(([n, e]) => (e === 1 ? n : `${n}^${e}`)).join('·') || '(dimensionless)';
307
-
308
- const BASES = ['L', 'M', 'T', 'I', 'Theta', 'N', 'J'];
309
- const dimsEqualTol = (a, b) => BASES.every((k) => Math.abs((a[k] || 0) - (b[k] || 0)) < 1e-9);
310
-
311
- async function derive(args) {
312
- let formula = null;
313
- let debug = false;
314
- const rest = [];
315
- for (let i = 0; i < args.length; i++) {
316
- if (args[i] === '--formula') formula = args[++i];
317
- else if (args[i] === '--debug') debug = true;
318
- else rest.push(args[i]);
319
- }
320
- if (rest.length < 1) { console.error('upt derive needs a target spec, e.g. upt derive period:time length:length gravity:acceleration'); process.exit(2); }
321
- let specs;
322
- try {
323
- specs = rest.map((a) => {
324
- const c = a.indexOf(':');
325
- if (c < 1) throw new Error(`'${a}' must be name:dimension (e.g. period:time)`);
326
- return { name: a.slice(0, c), dim: parseDimensionSpec(a.slice(c + 1)) };
327
- });
328
- } catch (e) { console.error(' ' + e.message); process.exit(2); }
329
- const target = specs[0];
330
- const governing = specs.slice(1);
331
- const det = dimensionallyDetermines(target, governing);
332
- console.log(`\n● ${target.name} from {${governing.map((g) => g.name).join(', ')}}`);
333
- if (det.determined) {
334
- console.log(` dimensionally determined up to a constant: ${target.name} ∝ ${fmtMono(det.monomial)}`);
335
- } else {
336
- const full = buckinghamPi([target, ...governing]);
337
- console.log(` NOT a unique monomial — ${full.piGroupCount} free dimensionless group(s) (${full.verdict}):`);
338
- for (const g of full.piGroups) console.log(` ${g.formula}`);
339
- console.log(` (${det.reason})`);
340
- }
341
- if (formula) {
342
- const parser = await getFormulaParser();
343
- if (debug) console.error(` [parser: ${await getFormulaParserKind()}]`);
344
-
345
- // Dimensional check (Phase 2) — homogeneity + dimension of the user's
346
- // formula, independent of whether a unique monomial exists. Always
347
- // available (MathTS AST when present, else the built-in parser's AST).
348
- const checker = await getFormulaDimensionChecker();
349
- const dims = Object.fromEntries(governing.map((g) => [g.name, g.dim]));
350
- const r = checker.check(formula, dims);
351
- if (!r.ok) {
352
- console.log(` formula dimensional check: ✗ ${r.error}`);
353
- } else {
354
- const matches = dimsEqualTol(r.dim, target.dim);
355
- console.log(` formula dimension: ${api.format(r.dim)}` +
356
- (matches ? ` ✓ homogeneous, matches target` : ` ⚠ homogeneous but ≠ target ${api.format(target.dim)}`));
357
- }
358
-
359
- let cf;
360
- try { cf = parser.parse(formula); } catch (e) { console.error(' formula parse error: ' + e.message); process.exit(2); }
361
- if (!det.determined) { console.log(' formula given, but with no unique monomial there is no single prefactor to recover.'); return; }
362
- const ratios = [];
363
- for (let j = 0; j < 3; j++) {
364
- const scope = {};
365
- governing.forEach((g, i) => { scope[g.name] = Math.pow(1.7 + i, 1 + 0.3 * j); });
366
- let cand = 1;
367
- for (const g of governing) cand *= Math.pow(scope[g.name], det.monomial[g.name] || 0);
368
- try { ratios.push(cf.evaluate(scope) / cand); }
369
- catch (e) { console.error(' formula uses an undeclared variable: ' + e.message); process.exit(2); }
370
- }
371
- const mean = ratios.reduce((a, b) => a + b, 0) / ratios.length;
372
- const cv = Math.sqrt(ratios.reduce((a, b) => a + (b - mean) ** 2, 0) / ratios.length) / Math.abs(mean);
373
- console.log(cv < 1e-9
374
- ? ` formula MATCHES the dimensional form — recovered prefactor ≈ ${mean.toExponential(4)}`
375
- : ` formula does NOT match the dimensional monomial (different input-dependence — a decoy or different physics).`);
376
- }
377
- }
378
-
379
- // ── map (how the equations link) ──────────────────────────────────────────
380
- // Convert the derived identity-consequence proposals into viz junctions
381
- // (gray-dashed, status 'proposed'). The library never imports proposed-bridges;
382
- // the CLI does the conversion, keeping the epistemic firewall intact.
383
- function proposedJunctions(graph, args) {
384
- const ranked = rankDiscoveries(graph, parseDiscoveryOpts(args));
385
- return deriveProposedBridges(ranked).map((p) => ({
386
- id: p.id,
387
- label: p.id,
388
- status: 'proposed',
389
- sources: (p.governing || []).map((g) => g.name),
390
- target: p.target.name,
391
- }));
392
- }
393
-
394
- // Parse the --equation flag: `--equation "T = E"` (two tokens) or `--equation=...`.
395
- function parseEquationFlag(a) {
396
- const eqEq = a.find((x) => x.startsWith('--equation='));
397
- if (eqEq) return eqEq.slice('--equation='.length);
398
- const i = a.indexOf('--equation');
399
- return i >= 0 ? (a[i + 1] ?? '') : null;
400
- }
401
-
402
- // Build the catalog quantity name→dimension map for the chosen graph, then run
403
- // the (testable) library analysis: parse + dimensional validation + "did you
404
- // mean?" hints. The library owns the physics (constants' dimensions, inference);
405
- // the CLI only formats.
406
- async function analyzeEquation(equation, graph) {
407
- const catalogDims = new Map();
408
- for (const e of graph) {
409
- for (const q of [...e.sources, e.target]) catalogDims.set(q.name, q.dim);
410
- }
411
- return analyzeUserEquation(equation, catalogDims);
412
- }
413
-
414
- // Print the dimensional verdict, where the equation landed, and any hints.
415
- // `out` is console.log (text mode → stdout) or console.error (visual → stderr).
416
- function printEquationReport(model, user, out) {
417
- out('');
418
- if (user.consistent === true) {
419
- out(` ✓ dimensionally consistent: ${format(user.rhsDimension)}`);
420
- } else if (user.consistent === false) {
421
- out(` ⚠ dimensional MISMATCH: RHS is ${format(user.rhsDimension)} but the target is ${format(user.targetDimension)}`);
422
- } else if (user.rhsDimension) {
423
- out(` · RHS dimension: ${format(user.rhsDimension)} (target not in the catalog, so no comparison)`);
424
- }
425
- const L = equationLanding(model, 'user-equation');
426
- if (L.isolated) {
427
- out(' ⚠ your equation is ISOLATED — it shares no quantity with this graph.');
428
- } else {
429
- out(` ● your equation joins ${L.anchored ? 'the ANCHORED cluster' : 'a cluster'} of ${L.clusterSize} via {${L.sharedQuantities.join(', ')}}`);
430
- if (L.connectedJunctionIds.length) out(` connects to: ${L.connectedJunctionIds.join(', ')}`);
431
- }
432
- for (const h of user.hints ?? []) {
433
- if (!h.suggestions.length) {
434
- out(` ⚠ '${h.name}' did not match a catalog quantity (run \`upt canonical\` for the vocabulary).`);
435
- } else if (h.byDimension) {
436
- out(` ⚠ '${h.name}' is unknown — by its inferred dimension, did you mean: ${h.suggestions.join(', ')}?`);
437
- } else {
438
- out(` ⚠ '${h.name}' did not match a catalog quantity — did you mean: ${h.suggestions.join(', ')}?`);
439
- }
440
- }
441
- }
442
-
443
- async function mapCmd(args) {
444
- const { graph, label } = resolveGraph(args);
445
-
446
- // --format=mermaid|dot|svg emits the visual map; default (text) is unchanged.
447
- const a = args || [];
448
- const fmtFlag = a.find((x) => x.startsWith('--format='));
449
- const fmt = fmtFlag ? fmtFlag.slice('--format='.length) : 'text';
450
-
451
- // --equation injects a user-supplied "TARGET = EXPR" as a 'user' junction.
452
- let user = null;
453
- const equation = parseEquationFlag(a);
454
- if (equation != null) {
455
- if (!equation.trim()) {
456
- console.error('upt: --equation requires "TARGET = EXPR"');
457
- process.exit(2);
458
- }
459
- try {
460
- user = await analyzeEquation(equation, graph); // throws UserEquationError on malformed structure
461
- } catch (e) {
462
- console.error('upt: ' + (e && e.message ? e.message : String(e)));
463
- process.exit(2);
464
- }
465
- if (user.parseError) {
466
- console.error('upt: ' + user.parseError); // dimensionally malformed RHS
467
- process.exit(2);
468
- }
469
- }
470
- const overlay = (extra) => [
471
- ...(a.includes('--proposed') ? proposedJunctions(graph, args) : []),
472
- ...extra,
473
- ];
474
-
475
- if (fmt === 'mermaid' || fmt === 'dot' || fmt === 'svg') {
476
- const extraJunctions = overlay(user ? [user.junction] : []);
477
- const model = buildVizModel(graph, {
478
- title: `UPT physics map — ${label}`,
479
- extraJunctions,
480
- });
481
- // svg is the dot layout rendered by the optional @viz-js/viz peer.
482
- let src;
483
- if (fmt === 'svg') {
484
- try {
485
- src = await renderDotToSvg(model.toDot());
486
- } catch (err) {
487
- console.error(err && err.message ? err.message : String(err));
488
- process.exit(1);
489
- }
490
- } else {
491
- src = fmt === 'mermaid' ? model.toMermaid() : model.toDot();
492
- }
493
- const outFlag = a.find((x) => x.startsWith('--out='));
494
- if (outFlag) {
495
- const path = outFlag.slice('--out='.length);
496
- if (!path) {
497
- console.error('upt: --out= requires a non-empty PATH');
498
- process.exit(1);
499
- }
500
- writeFileSync(path, src);
501
- console.error(`upt: wrote ${fmt} (${model.junctions.length} junctions, ${model.clusters.length} clusters) to ${path}`);
502
- } else {
503
- process.stdout.write(src);
504
- }
505
- // Landing report goes to stderr so stdout/--out stays pure diagram source.
506
- if (user) printEquationReport(model, user, console.error);
507
- return;
508
- }
509
- if (fmt !== 'text') {
510
- console.error(`upt: unknown --format='${fmt}' (expected: text | mermaid | dot | svg)`);
511
- process.exit(1);
512
- }
513
-
514
- const m = linkageMap(graph);
515
- const mix = (s) => Object.entries(s).map(([k, v]) => `${v} ${k}`).join(', ');
516
- console.log(`\nLinkage map — how the equations connect via shared quantities [source: ${label}]`);
517
- console.log(`(${m.componentCount} components over ${graph.length} edges; ${m.compositions} compose into chains)\n`);
518
- for (const c of m.clusters.filter((x) => x.size > 1)) {
519
- console.log(` ● cluster of ${c.size}${c.anchored ? ' [ANCHORED to known physics]' : ''}`);
520
- console.log(` edges: ${c.edges.join(', ')}`);
521
- console.log(` status: ${mix(c.statusMix)}`);
522
- console.log(` link hubs: ${c.hubs.join(', ')}\n`);
523
- }
524
- console.log(` ○ isolated (${m.isolated.length}) — share no quantity with any other edge:`);
525
- console.log(` ${m.isolated.join(', ')}`);
526
- console.log('\n (a structural map — shared-quantity connectivity, NOT a credibility signal)');
527
-
528
- // --equation: where does the user's equation land in this graph?
529
- if (user) {
530
- const model = buildVizModel(graph, {
531
- title: `UPT physics map — ${label}`,
532
- extraJunctions: overlay([user.junction]),
533
- });
534
- console.log(`\nYour equation: ${user.junction.label}`);
535
- printEquationReport(model, user, console.log);
536
- }
537
- }
538
-
539
- // ── candidates (map-proposed links for review) ────────────────────────────
540
- function candidatesCmd(args) {
541
- const { graph, label } = resolveGraph(args);
542
- const cands = proposeLinkCandidates(graph);
543
- const core = cands.filter((c) => c.touchesCore);
544
- const ck = cands.filter((c) => c.touchesCore && c.sameKind);
545
- console.log(`\nLink candidates — cross-cluster quantities sharing a dimension [source: ${label}]`);
546
- console.log('⚠ a coincidence-heavy REVIEW SURFACE, NOT discovered bridges. Same dimension is a');
547
- console.log(' weak signal; each needs a physicist to accept or (far more often) reject.\n');
548
- console.log(` funnel: ${cands.length} total → ${core.length} touch the anchored core → ${ck.length} also same-kind\n`);
549
- console.log(' same-kind + core-touching (the least-implausible set):');
550
- for (const c of ck) console.log(` ${(c.a + ' ≟ ' + c.b).padEnd(56)} [${c.sharedToken}]`);
551
- console.log('\n Most are still coincidences (decoherence-rate ≟ hubble-rate) or pairs the catalog');
552
- console.log(' deliberately keeps distinct (effective-mass ≠ mass). The genuinely motivated few —');
553
- console.log(' e.g. coarsening-length ≟ quantum-correlation-length (links the isolated Model-A');
554
- console.log(' coarsening bridge to the Kibble-Zurek criticality cluster) — are written up in');
555
- console.log(' docs/research/Linkage-Candidate-Proposals.md.');
556
- }
557
-
558
- // ── predict (empty regime cells as bridge hypotheses) ─────────────────────
559
- function predictCmd() {
560
- const r = predictMissingBridges(GRAPH);
561
- const short = (k) => k.replace(/scale=/g, '').replace(/force=/g, '').replace('|', '/');
562
- console.log('\nBridge prediction — empty (scale×force) regime cells as undiscovered-link HYPOTHESES');
563
- console.log('⚠ STRUCTURAL hypotheses for physicist review, NOT discovered bridges. "Two regimes');
564
- console.log(' share bridge-neighbours but are not directly linked" (triadic closure) is a weak prior.\n');
565
- console.log(` projected ${r.placedEdges}/${r.totalEdges} edges onto ${r.occupiedRegimes.length} regimes; ` +
566
- `${r.linkedPairCount} regime-pairs already bridged.\n`);
567
- if (!r.predictions.length) {
568
- console.log(' no empty regime-pair has a shared-neighbour basis — nothing to predict.');
569
- } else {
570
- console.log(' predicted missing bridges (by shared-neighbour count):');
571
- for (const p of r.predictions) {
572
- console.log(` ${(short(p.regimeA) + ' ⟷ ' + short(p.regimeB)).padEnd(46)} ` +
573
- `score ${p.sharedNeighbors} via {${p.via.map(short).join(', ')}}`);
574
- }
575
- }
576
- if (r.unexploredRegimes.length) {
577
- console.log(`\n unexplored regimes adjacent to known ones (the tensor's empty neighbourhoods):`);
578
- console.log(` ${r.unexploredRegimes.map(short).join(', ')}`);
579
- }
580
- console.log('\n (regime coords come from quantity attributes; only regime-tagged edges are placed.)');
581
- }
582
-
583
- // ── discover (vet link candidates through the inference suite) ─────────────
584
- // Parse the discovery knobs (DiscoveryOptions) from CLI flags:
585
- // --max-orders=N magnitude-clash threshold (default 3)
586
- // --anchor=k=v[,k2=v2] numeric anchor for the consistency/closure check
587
- // (default mass=M_sun); repeatable
588
- function parseDiscoveryOpts(args) {
589
- const a = args || [];
590
- const opts = {};
591
- const mo = a.find((x) => x.startsWith('--max-orders='));
592
- if (mo) {
593
- const n = Number(mo.slice('--max-orders='.length));
594
- if (Number.isFinite(n)) opts.maxOrdersOfMagnitude = n;
595
- }
596
- const gt = {};
597
- for (const x of a.filter((x) => x.startsWith('--anchor='))) {
598
- for (const pair of x.slice('--anchor='.length).split(',')) {
599
- const [k, v] = pair.split('=');
600
- const val = Number(v);
601
- if (k && Number.isFinite(val)) gt[k] = val;
602
- }
603
- }
604
- if (Object.keys(gt).length) opts.groundTruth = gt;
605
- return opts;
606
- }
607
-
608
- function discoverCmd(args) {
609
- const { graph, label } = resolveGraph(args);
610
- const opts = parseDiscoveryOpts(args);
611
- const ranked = rankDiscoveries(graph, opts);
612
- if (Object.keys(opts).length) {
613
- const bits = [];
614
- if (opts.maxOrdersOfMagnitude !== undefined) bits.push(`max-orders=${opts.maxOrdersOfMagnitude}`);
615
- if (opts.groundTruth) bits.push(`anchor={${Object.entries(opts.groundTruth).map(([k, v]) => `${k}=${v}`).join(', ')}}`);
616
- console.log(` [discovery options: ${bits.join('; ')}]`);
617
- }
618
- if ((args || []).includes('--derive')) return deriveCmd(ranked, label);
619
- const by = (v) => ranked.filter((r) => r.verdict === v);
620
- const promising = by('promising'), inert = by('inert'), contra = by('contradictory');
621
- const clash = by('magnitude-clash');
622
- console.log(`\nDiscovery — link candidates VETTED through the inference suite [source: ${label}]`);
623
- console.log('⚠ a REVIEW SURFACE: `promising` means "worth a physicist\'s minute", not "true".');
624
- console.log(' Each candidate hypothesises an identification a≡b and tests its consequences.\n');
625
- console.log(` funnel: ${ranked.length} candidates → ${promising.length} promising ` +
626
- `· ${inert.length} inert · ${clash.length} magnitude-clash ` +
627
- `· ${contra.length} contradictory (falsified)\n`);
628
- if (promising.length) {
629
- console.log(' PROMISING (merges disconnected physics, unlocks quantities, stays consistent):');
630
- for (const r of promising) {
631
- console.log(` ${(r.a + ' ≟ ' + r.b).padEnd(52)} [${r.dim}] score ${r.score}`);
632
- console.log(` unlocks: ${r.unlocksFromAnchor.join(', ') || '—'}`);
633
- }
634
- } else {
635
- console.log(' no candidate is `promising` from the default {mass} anchor.');
636
- }
637
- if (clash.length) {
638
- console.log(`\n MAGNITUDE-CLASH (representative values differ by > N orders — a falsifier):`);
639
- for (const r of clash) {
640
- const basis = r.magnitudeUsedAnchor ? ' (anchor-derived)' : '';
641
- console.log(` ${(r.a + ' ≟ ' + r.b).padEnd(52)} ~${r.ordersApart.toFixed(1)} orders apart${basis}`);
642
- }
643
- }
644
- const subsumed = inert.filter((r) => r.subsuming);
645
- if (subsumed.length) {
646
- console.log(`\n SUBSUMING (generic ≟ specialization — tautological, barred from promising):`);
647
- for (const r of subsumed) {
648
- console.log(` ${(r.a + ' ≟ ' + r.b).padEnd(52)} [${r.dim}]`);
649
- }
650
- }
651
- if (contra.length) {
652
- console.log(`\n CONTRADICTORY (the identification falsifies itself numerically):`);
653
- for (const r of contra) {
654
- console.log(` ${(r.a + ' ≟ ' + r.b).padEnd(52)} disagreeing node(s): ${r.inconsistentNodes.join(', ')}`);
655
- }
656
- }
657
- console.log('\n (magnitude gate abstains where a representative value is unknown; weak priors on dimension.)');
658
- }
659
-
660
- // ── discover --derive (identity-consequence proposals) ────────────────────
661
- function deriveCmd(ranked, label) {
662
- const proposals = deriveProposedBridges(ranked);
663
- console.log(`\nDerived identity-consequence PROPOSALS — UNADJUDICATED, math-only [source: ${label}]`);
664
- console.log('⚠ Each is the ALGEBRAIC CONSEQUENCE of an unadjudicated identification — NOT a new');
665
- console.log(' relation and NOT a bridge. No mechanism asserted. Promotion to the catalog needs');
666
- console.log(' adversarial + literature review (Part-VI §XXVII-B). The enumerator proposes; humans dispose.\n');
667
- if (!proposals.length) {
668
- console.log(' no admissible proposal (need two fully-quantitative, monomial canonical targets).');
669
- return;
670
- }
671
- for (const p of proposals) {
672
- let approx = '';
673
- try {
674
- const vals = Object.fromEntries((p.governing || []).map((g) => [g.name, 300]));
675
- const at = (p.governing || []).map((g) => `${g.name}=300`).join(', ');
676
- approx = ` ≈ ${p.evaluate(vals).toExponential(2)}${at ? ` (${at})` : ''}`;
677
- } catch { approx = ''; }
678
- console.log(` ${p.id}`);
679
- console.log(` ${p.formulaLatex} ${p.dimensionalSignature}${approx}`);
680
- console.log(` from: ${p.derivedFrom.identification.a} ≟ ${p.derivedFrom.identification.b}` +
681
- ` (${p.derivedFrom.sourceEquationIds[0]} = ${p.derivedFrom.sourceEquationIds[1]}); solved for ${p.derivedFrom.solvedFor}`);
682
- if (p.alsoDerivableFrom && p.alsoDerivableFrom.length) {
683
- console.log(` also derivable from: ${p.alsoDerivableFrom.join('; ')}`);
684
- }
685
- }
686
- console.log('');
687
- }
688
-
689
- // ── coverage (empirical-spine audit) ──────────────────────────────────────
690
- function coverageCmd() {
691
- const r = auditCoverage();
692
- console.log('\nEmpirical-spine coverage — where the catalog\'s grounding is thin');
693
- console.log('(reads the catalog/graph/confrontation modules; fabricates nothing)\n');
694
- console.log(` ${r.total} bridges by grounding tier:`);
695
- console.log(` data-confronted : ${r.byTier['data-confronted']} (real-data confrontation)`);
696
- console.log(` graph-computable : ${r.byTier['graph-computable']} (graph edge + dimensional signature)`);
697
- console.log(` encoded-only : ${r.byTier['encoded-only']} (dimensional signature, no graph edge)`);
698
- console.log(` thin : ${r.byTier['thin']} (no dimensional signature)`);
699
- console.log(`\n gaps: ${r.withoutDataConfrontation} without a data confrontation · ` +
700
- `${r.withoutCitation} without any citation`);
701
- if (r.thinBridges.length) {
702
- console.log(` thinnest (no dimensional signature): BE-${r.thinBridges.join(', BE-')}`);
703
- }
704
- console.log('\n (a targeting tool for the CONTRIBUTING.md physicist review, not a quality score.)');
705
- }
706
-
707
- // ── symbolic (symbolic bridge composition — the Observable contract) ──────
708
- function exprToString(n) {
709
- if (n.kind === 'symbol') return n.name;
710
- if (n.kind === 'op') {
711
- if (n.op === '^') return `${exprToString(n.args[0])}^${exprToString(n.args[1])}`;
712
- const sep = n.op === '*' ? '·' : ` ${n.op} `;
713
- const inner = n.args.map((a) => {
714
- const s = exprToString(a);
715
- return a.kind === 'op' && (a.op === '+' || a.op === '-' || a.op === '/') ? `(${s})` : s;
716
- }).join(sep);
717
- return inner;
718
- }
719
- return `⟨${n.kind}⟩`;
720
- }
721
-
722
- async function symbolicCmd(rest) {
723
- const doSimplify = rest.includes('--simplify');
724
- const chains = [
725
- { first: be42Edge, second: be16Edge, label: 'CT-1 (be-42 ∘ be-16, via hawking-temperature ≡ temperature)' },
726
- { first: lawSchwarzschildRadius, second: be42ViaRsEdge, label: 'CT-1b (law-r_s ∘ be-42-via-rs, name-match junction)' },
727
- ];
728
- console.log('\nSymbolic bridge composition — composing the SYMBOLIC forms, not just numbers');
729
- console.log('(the Observable contract: composed AST, dimensionally validated + numerically evaluable)\n');
730
- for (const { first, second, label } of chains) {
731
- const obs = composeSymbolic(first, second);
732
- const num = obs.evaluate({ mass: M_SUN_KG });
733
- console.log(` ● ${label}`);
734
- console.log(` composed: ${obs.name}(${obs.leaves.join(',')}) = ${exprToString(obs.expr)}`);
735
- if (doSimplify) {
736
- const s = await simplifyObservable(obs);
737
- const sNum = s.evaluate({ mass: M_SUN_KG });
738
- const tag = s.expr === obs.expr ? ' (unchanged — minimal, MathTS absent, or not reducible here)' : '';
739
- console.log(` simplified: ${s.name}(${s.leaves.join(',')}) = ${exprToString(s.expr)}${tag}`);
740
- console.log(` value @ mass = M_sun: ${sNum.toExponential(4)} (= composed, ${format(s.dim)})`);
741
- } else {
742
- console.log(` dimension: ${format(obs.dim)} (validated on the composed AST)`);
743
- console.log(` value @ mass = M_sun: ${num.toExponential(4)}`);
744
- }
745
- console.log('');
746
- }
747
- console.log(' Both compose by AST substitution at the junction and match the numeric composeEdges');
748
- console.log(' pipeline to float precision.' + (doSimplify
749
- ? ' --simplify folds the composed AST via MathTS (k_B cancels), guarded by re-validation.'
750
- : ' Pass --simplify to fold the composed AST via MathTS.'));
751
- }
752
-
753
- // ── connectors (pull isolated bridges into the core) ──────────────────────
754
- function connectorsCmd() {
755
- const r = proposeOrphanConnectors(GRAPH);
756
- console.log('\nOrphan connectors — same-dimension identifications that would pull an ISOLATED');
757
- console.log('bridge into the anchored core (the catalog\'s structural frontier).');
758
- console.log('⚠ A REVIEW SURFACE: same dimension is a WEAK prior; most are decoys (a Förster');
759
- console.log(' radius is not a Schwarzschild radius). Same-kind (shared name token) = stronger.\n');
760
- console.log(` ${r.connectedOrphans.length} of the isolated bridges have a same-kind connector; ` +
761
- `${r.unconnectedOrphans.length} are truly unconnected.\n`);
762
- console.log(' SAME-KIND connectors (the motivated set — orphan ≟ core via shared token):');
763
- let lastOrphan = '';
764
- for (const c of r.connectors.filter((x) => x.sameKind)) {
765
- if (c.orphanEdge !== lastOrphan) { console.log(` ── ${c.orphanEdge} (isolated):`); lastOrphan = c.orphanEdge; }
766
- console.log(` ${(c.orphanQuantity + ' ≟ ' + c.coreQuantity).padEnd(54)} [${c.dim}] → ${c.coreEdge}`);
767
- }
768
- console.log(`\n truly unconnected (no same-dimension bridge into them): ${r.unconnectedOrphans.join(', ')}`);
769
- console.log('\n Physicist-reasoned ranking + the genuinely-motivated few (e.g. coarsening-length ≟');
770
- console.log(' quantum-correlation-length; tunneling-mass ≟ effective-mass) are written up in');
771
- console.log(' docs/research/Orphan-Connector-Analysis.md and proposed in spec Part-IX §9.');
772
- }
773
-
774
- // ── canonical (the standard-physics L-layer registry) ─────────────────────
775
- function canonicalCmd() {
776
- const fidelity = (e) => (e.fieldEquation ? 'L2' : e.scalarAst ? 'L1' : 'L0');
777
- console.log('\nCanonical-equation registry — the standard-physics L-layer (Π = L + B + E)');
778
- console.log('the textbook "answer key" bridge equations are validated against.\n');
779
- console.log(` ${CANONICAL_EQUATIONS.length} entries:\n`);
780
- console.log(' fid domain id partners');
781
- console.log(' ─────────────────────────────────────────────────────────────────');
782
- for (const e of CANONICAL_EQUATIONS) {
783
- const partners = [...e.partnerBridges, ...(e.restatesBridge ? [`=${e.restatesBridge}`] : [])].join(',') || '—';
784
- console.log(` ${fidelity(e).padEnd(3)} ${e.domain.padEnd(19)} ${e.id.padEnd(24)} ${partners}`);
785
- }
786
- const gap = bridgesWithoutCanonicalPartner();
787
- console.log(`\n coverage: ${gap.length} catalog bridges have no canonical partner yet`);
788
- console.log(` (fidelity: L0 dimensional · L1 scalar-AST · L2 field-equation; "=NN" = restatesBridge)`);
789
- }
790
-
791
- // ── recover (bridge↔canonical linkage; the F4 circularity guard) ──────────
792
- function recoverCmd() {
793
- const all = scanLinkages();
794
- const by = (c) => all.filter((r) => r.classification === c);
795
- const restates = by('restates-canonical'), recovers = by('recovers'), dimOnly = by('dimensional-only');
796
- console.log('\nBridge↔canonical recovery — validating bridges against standard physics');
797
- console.log('⚠ structural match is "same relation UP TO a dimensionless factor"; that factor');
798
- console.log(' may itself be physically substantive (e.g. ⟨e^-βW⟩). A review surface.\n');
799
- console.log(` ${all.length} non-unrelated links → ${restates.length} restates-canonical ` +
800
- `· ${recovers.length} recovers · ${dimOnly.length} dimensional-only\n`);
801
- if (restates.length) {
802
- console.log(' RESTATES-CANONICAL (the bridge IS the canonical law — F4: NOT a discovery):');
803
- for (const r of restates) {
804
- const rec = r.recovery && r.recovery.tested ? ` (recovery exact, err ${r.recovery.maxRelErr.toExponential(0)})` : '';
805
- console.log(` ${r.canonicalId.padEnd(26)} ≡ bridge ${r.bridgeId}${rec}`);
806
- }
807
- }
808
- if (recovers.length) {
809
- console.log('\n RECOVERS (undeclared structural correspondence — worth a physicist\'s look):');
810
- for (const r of recovers) {
811
- console.log(` ${r.canonicalId.padEnd(26)} ~ bridge ${r.bridgeId} (same form up to a dimensionless factor)`);
812
- }
813
- }
814
- console.log(`\n (${dimOnly.length} dimensional-only: same dimension, different form. Run \`upt canonical\` for the registry.)`);
815
- }
816
-
817
- // ── dispatch ──────────────────────────────────────────────────────────────
818
- const [cmd, ...rest] = process.argv.slice(2);
819
- switch (cmd) {
820
- case 'explain': explain(rest[0], rest.slice(1)); break;
821
- case 'priority': case 'prioritize': case 'triage': priority(); break;
822
- case 'audit': audit(); break;
823
- case 'map': case 'linkage': await mapCmd(rest); break;
824
- case 'candidates': case 'propose': candidatesCmd(rest); break;
825
- case 'predict': case 'predictions': predictCmd(); break;
826
- case 'discover': case 'discovery': discoverCmd(rest); break;
827
- case 'connectors': case 'orphans': connectorsCmd(); break;
828
- case 'coverage': case 'grounding': coverageCmd(); break;
829
- case 'canonical': case 'laws': canonicalCmd(); break;
830
- case 'recover': case 'recovery': case 'validate': recoverCmd(); break;
831
- case 'symbolic': case 'compose-symbolic': await symbolicCmd(rest); break;
832
- case 'eval': case 'calc': await evalCmd(rest); break;
833
- case 'derive': case 'dim': await derive(rest); break;
834
- case 'help': case '--help': case '-h': help(); break;
835
- case undefined:
836
- console.log('upt — bridge-inference CLI. Demo (run `upt help` for usage):');
837
- explain('hawking-temperature', ['mass=1.989e30']);
838
- priority();
839
- break;
840
- default:
841
- console.error(`Unknown command '${cmd}'. See \`upt help\`.`);
842
- process.exit(2);
843
- }
22
+ process.exitCode = await main.runCli(process.argv.slice(2));