universal-physics-tensor 0.7.3 → 0.15.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 (297) hide show
  1. package/README.md +147 -109
  2. package/bin/upt.mjs +508 -0
  3. package/dist/bridges/be23-planckian-confrontation.d.ts +162 -0
  4. package/dist/bridges/be23-planckian-confrontation.d.ts.map +1 -0
  5. package/dist/bridges/be23-planckian-confrontation.js +196 -0
  6. package/dist/bridges/be23-planckian-confrontation.js.map +1 -0
  7. package/dist/bridges/be36-gw170817-confrontation.d.ts +111 -0
  8. package/dist/bridges/be36-gw170817-confrontation.d.ts.map +1 -0
  9. package/dist/bridges/be36-gw170817-confrontation.js +100 -0
  10. package/dist/bridges/be36-gw170817-confrontation.js.map +1 -0
  11. package/dist/bridges/bridge-equations.d.ts +129 -0
  12. package/dist/bridges/bridge-equations.d.ts.map +1 -0
  13. package/dist/bridges/bridge-equations.js +130 -0
  14. package/dist/bridges/bridge-equations.js.map +1 -0
  15. package/dist/bridges/catalog-adapter.d.ts +1 -1
  16. package/dist/bridges/catalog-adapter.js +1 -1
  17. package/dist/bridges/confrontation-coverage.d.ts +67 -0
  18. package/dist/bridges/confrontation-coverage.d.ts.map +1 -0
  19. package/dist/bridges/confrontation-coverage.js +83 -0
  20. package/dist/bridges/confrontation-coverage.js.map +1 -0
  21. package/dist/bridges/equations/_be-helpers.d.ts +2 -1
  22. package/dist/bridges/equations/_be-helpers.d.ts.map +1 -1
  23. package/dist/bridges/equations/be-12-coherence-length.d.ts +1 -1
  24. package/dist/bridges/equations/be-13-einstein-trace.d.ts +2 -2
  25. package/dist/bridges/equations/be-13-einstein-trace.js +1 -1
  26. package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts +2 -2
  27. package/dist/bridges/equations/be-15-emergence.d.ts +19 -5
  28. package/dist/bridges/equations/be-15-emergence.d.ts.map +1 -1
  29. package/dist/bridges/equations/be-15-emergence.js +18 -4
  30. package/dist/bridges/equations/be-15-emergence.js.map +1 -1
  31. package/dist/bridges/equations/be-16-landauer.d.ts +1 -1
  32. package/dist/bridges/equations/be-17-einstein-cartan.d.ts +1 -1
  33. package/dist/bridges/equations/be-18-higgs-mass.d.ts +1 -1
  34. package/dist/bridges/equations/be-19-quantum-bounce.d.ts +1 -1
  35. package/dist/bridges/equations/be-20-vacuum-energy.d.ts +4 -4
  36. package/dist/bridges/equations/be-20-vacuum-energy.d.ts.map +1 -1
  37. package/dist/bridges/equations/be-20-vacuum-energy.js +4 -2
  38. package/dist/bridges/equations/be-20-vacuum-energy.js.map +1 -1
  39. package/dist/bridges/equations/be-22-topological-entanglement.d.ts +1 -1
  40. package/dist/bridges/equations/be-23-syk-planckian.d.ts +1 -1
  41. package/dist/bridges/equations/be-24-foerster-fret.d.ts +1 -1
  42. package/dist/bridges/equations/be-25-iit-phi.d.ts +1 -1
  43. package/dist/bridges/equations/be-25-orch-or.d.ts +13 -1
  44. package/dist/bridges/equations/be-25-orch-or.d.ts.map +1 -1
  45. package/dist/bridges/equations/be-25-orch-or.js +12 -0
  46. package/dist/bridges/equations/be-25-orch-or.js.map +1 -1
  47. package/dist/bridges/equations/be-26-dna-tunneling.d.ts +2 -2
  48. package/dist/bridges/equations/be-26-dna-tunneling.js +1 -1
  49. package/dist/bridges/equations/be-27-effective-temperature.d.ts +1 -1
  50. package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts +1 -1
  51. package/dist/bridges/equations/be-29-jarzynski.d.ts +1 -1
  52. package/dist/bridges/equations/be-30-flm-first-law.d.ts +2 -2
  53. package/dist/bridges/equations/be-31-causal-set-bd.d.ts +1 -1
  54. package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts +1 -1
  55. package/dist/bridges/equations/be-33-hertz-millis.d.ts +1 -1
  56. package/dist/bridges/equations/be-34-kibble-zurek.d.ts +1 -1
  57. package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts +1 -1
  58. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts +12 -5
  59. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts.map +1 -1
  60. package/dist/bridges/equations/be-36-gw-speed-bound.js +11 -4
  61. package/dist/bridges/equations/be-36-gw-speed-bound.js.map +1 -1
  62. package/dist/bridges/equations/be-38-mond.d.ts +1 -1
  63. package/dist/bridges/equations/be-39-asymptotic-safety.d.ts +2 -2
  64. package/dist/bridges/equations/be-40-composite-higgs.d.ts +1 -1
  65. package/dist/bridges/equations/be-41-swampland.d.ts +1 -1
  66. package/dist/bridges/equations/be-43-er-epr.d.ts +1 -1
  67. package/dist/bridges/equations/be-44-soft-hair.d.ts +1 -1
  68. package/dist/bridges/equations/be-45-tcc.d.ts +1 -1
  69. package/dist/bridges/equations/be-46-multiverse-measure.d.ts +1 -1
  70. package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts +1 -1
  71. package/dist/bridges/equations/be-48-grw-localization.d.ts +1 -1
  72. package/dist/bridges/equations/be-49-quantum-darwinism.d.ts +1 -1
  73. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts +1 -1
  74. package/dist/bridges/index.d.ts +10 -7
  75. package/dist/bridges/index.d.ts.map +1 -1
  76. package/dist/bridges/index.js +47 -34
  77. package/dist/bridges/index.js.map +1 -1
  78. package/dist/bridges/membership.d.ts +44 -0
  79. package/dist/bridges/membership.d.ts.map +1 -0
  80. package/dist/bridges/membership.js +59 -0
  81. package/dist/bridges/membership.js.map +1 -0
  82. package/dist/bridges/rejected.d.ts +40 -0
  83. package/dist/bridges/rejected.d.ts.map +1 -0
  84. package/dist/bridges/rejected.js +81 -0
  85. package/dist/bridges/rejected.js.map +1 -0
  86. package/dist/composition/bridge-analysis.d.ts +189 -0
  87. package/dist/composition/bridge-analysis.d.ts.map +1 -0
  88. package/dist/composition/bridge-analysis.js +445 -0
  89. package/dist/composition/bridge-analysis.js.map +1 -0
  90. package/dist/composition/bridge-prediction.d.ts +95 -0
  91. package/dist/composition/bridge-prediction.d.ts.map +1 -0
  92. package/dist/composition/bridge-prediction.js +0 -0
  93. package/dist/composition/bridge-prediction.js.map +1 -0
  94. package/dist/composition/catalog-graph.d.ts +20 -0
  95. package/dist/composition/catalog-graph.d.ts.map +1 -0
  96. package/dist/composition/catalog-graph.js +39 -0
  97. package/dist/composition/catalog-graph.js.map +1 -0
  98. package/dist/composition/compose-surface.d.ts +12 -0
  99. package/dist/composition/compose-surface.d.ts.map +1 -0
  100. package/dist/composition/compose-surface.js +10 -0
  101. package/dist/composition/compose-surface.js.map +1 -0
  102. package/dist/composition/compose-symbolic.d.ts +75 -0
  103. package/dist/composition/compose-symbolic.d.ts.map +1 -0
  104. package/dist/composition/compose-symbolic.js +157 -0
  105. package/dist/composition/compose-symbolic.js.map +1 -0
  106. package/dist/composition/compose.d.ts +110 -0
  107. package/dist/composition/compose.d.ts.map +1 -0
  108. package/dist/composition/compose.js +231 -0
  109. package/dist/composition/compose.js.map +1 -0
  110. package/dist/composition/consistency.d.ts +24 -0
  111. package/dist/composition/consistency.d.ts.map +1 -0
  112. package/dist/composition/consistency.js +26 -0
  113. package/dist/composition/consistency.js.map +1 -0
  114. package/dist/composition/discovery.d.ts +104 -0
  115. package/dist/composition/discovery.d.ts.map +1 -0
  116. package/dist/composition/discovery.js +165 -0
  117. package/dist/composition/discovery.js.map +1 -0
  118. package/dist/composition/edge.d.ts +139 -0
  119. package/dist/composition/edge.d.ts.map +1 -0
  120. package/dist/composition/edge.js +72 -0
  121. package/dist/composition/edge.js.map +1 -0
  122. package/dist/composition/edges/calibration.d.ts +107 -0
  123. package/dist/composition/edges/calibration.d.ts.map +1 -0
  124. package/dist/composition/edges/calibration.js +373 -0
  125. package/dist/composition/edges/calibration.js.map +1 -0
  126. package/dist/composition/edges/catalog-full.d.ts +299 -0
  127. package/dist/composition/edges/catalog-full.d.ts.map +1 -0
  128. package/dist/composition/edges/catalog-full.js +989 -0
  129. package/dist/composition/edges/catalog-full.js.map +1 -0
  130. package/dist/composition/edges/catalog-tranche.d.ts +112 -0
  131. package/dist/composition/edges/catalog-tranche.d.ts.map +1 -0
  132. package/dist/composition/edges/catalog-tranche.js +241 -0
  133. package/dist/composition/edges/catalog-tranche.js.map +1 -0
  134. package/dist/composition/enumerate.d.ts +67 -0
  135. package/dist/composition/enumerate.d.ts.map +1 -0
  136. package/dist/composition/enumerate.js +78 -0
  137. package/dist/composition/enumerate.js.map +1 -0
  138. package/dist/composition/explain.d.ts +102 -0
  139. package/dist/composition/explain.d.ts.map +1 -0
  140. package/dist/composition/explain.js +244 -0
  141. package/dist/composition/explain.js.map +1 -0
  142. package/dist/composition/expr-eval.d.ts +33 -0
  143. package/dist/composition/expr-eval.d.ts.map +1 -0
  144. package/dist/composition/expr-eval.js +95 -0
  145. package/dist/composition/expr-eval.js.map +1 -0
  146. package/dist/composition/expr-simplify.d.ts +60 -0
  147. package/dist/composition/expr-simplify.d.ts.map +1 -0
  148. package/dist/composition/expr-simplify.js +330 -0
  149. package/dist/composition/expr-simplify.js.map +1 -0
  150. package/dist/composition/expr-subst.d.ts +29 -0
  151. package/dist/composition/expr-subst.d.ts.map +1 -0
  152. package/dist/composition/expr-subst.js +60 -0
  153. package/dist/composition/expr-subst.js.map +1 -0
  154. package/dist/composition/identifiability.d.ts +103 -0
  155. package/dist/composition/identifiability.d.ts.map +1 -0
  156. package/dist/composition/identifiability.js +148 -0
  157. package/dist/composition/identifiability.js.map +1 -0
  158. package/dist/composition/index.d.ts +37 -0
  159. package/dist/composition/index.d.ts.map +1 -0
  160. package/dist/composition/index.js +27 -0
  161. package/dist/composition/index.js.map +1 -0
  162. package/dist/composition/quantities.d.ts +297 -0
  163. package/dist/composition/quantities.d.ts.map +1 -0
  164. package/dist/composition/quantities.js +1017 -0
  165. package/dist/composition/quantities.js.map +1 -0
  166. package/dist/composition/quantity.d.ts +59 -0
  167. package/dist/composition/quantity.d.ts.map +1 -0
  168. package/dist/composition/quantity.js +36 -0
  169. package/dist/composition/quantity.js.map +1 -0
  170. package/dist/composition/retrodiction.d.ts +94 -0
  171. package/dist/composition/retrodiction.d.ts.map +1 -0
  172. package/dist/composition/retrodiction.js +171 -0
  173. package/dist/composition/retrodiction.js.map +1 -0
  174. package/dist/composition/symbolic-constants.d.ts +33 -0
  175. package/dist/composition/symbolic-constants.d.ts.map +1 -0
  176. package/dist/composition/symbolic-constants.js +50 -0
  177. package/dist/composition/symbolic-constants.js.map +1 -0
  178. package/dist/composition/uncertainty.d.ts +45 -0
  179. package/dist/composition/uncertainty.d.ts.map +1 -0
  180. package/dist/composition/uncertainty.js +59 -0
  181. package/dist/composition/uncertainty.js.map +1 -0
  182. package/dist/core/axes-registry.d.ts +1 -1
  183. package/dist/core/axes-registry.js +1 -1
  184. package/dist/core/cell.d.ts +0 -8
  185. package/dist/core/cell.d.ts.map +1 -1
  186. package/dist/core/cell.js +1 -1
  187. package/dist/core/cell.js.map +1 -1
  188. package/dist/core/constants.d.ts +15 -1
  189. package/dist/core/constants.d.ts.map +1 -1
  190. package/dist/core/constants.js +15 -1
  191. package/dist/core/constants.js.map +1 -1
  192. package/dist/core/flux-rules.d.ts +10 -13
  193. package/dist/core/flux-rules.d.ts.map +1 -1
  194. package/dist/core/flux-rules.js +19 -10
  195. package/dist/core/flux-rules.js.map +1 -1
  196. package/dist/core/labeled-tensor.d.ts +80 -1
  197. package/dist/core/labeled-tensor.d.ts.map +1 -1
  198. package/dist/core/labeled-tensor.js +263 -17
  199. package/dist/core/labeled-tensor.js.map +1 -1
  200. package/dist/core/universal-index.d.ts +1 -1
  201. package/dist/core/universal-index.js +1 -1
  202. package/dist/diff/bridge-gradient.d.ts +51 -8
  203. package/dist/diff/bridge-gradient.d.ts.map +1 -1
  204. package/dist/diff/bridge-gradient.js +75 -8
  205. package/dist/diff/bridge-gradient.js.map +1 -1
  206. package/dist/dimensional/buckingham.d.ts +103 -0
  207. package/dist/dimensional/buckingham.d.ts.map +1 -0
  208. package/dist/dimensional/buckingham.js +284 -0
  209. package/dist/dimensional/buckingham.js.map +1 -0
  210. package/dist/dimensional/dimension-spec.d.ts +24 -0
  211. package/dist/dimensional/dimension-spec.d.ts.map +1 -0
  212. package/dist/dimensional/dimension-spec.js +110 -0
  213. package/dist/dimensional/dimension-spec.js.map +1 -0
  214. package/dist/dimensional/field-equation-helpers.d.ts +1 -1
  215. package/dist/dimensional/field-equation-helpers.js +1 -1
  216. package/dist/dimensional/friedmann-equation.d.ts +1 -1
  217. package/dist/dimensional/friedmann-equation.js +1 -1
  218. package/dist/dimensional/gauge-field.d.ts +1 -1
  219. package/dist/dimensional/gauge-field.js +1 -1
  220. package/dist/dimensional/klein-gordon-equation.d.ts +8 -5
  221. package/dist/dimensional/klein-gordon-equation.d.ts.map +1 -1
  222. package/dist/dimensional/klein-gordon-equation.js +8 -5
  223. package/dist/dimensional/klein-gordon-equation.js.map +1 -1
  224. package/dist/dimensional/tensor-trace.d.ts +1 -1
  225. package/dist/dimensional/tensor-trace.js +1 -1
  226. package/dist/dimensional/validator.d.ts +13 -3
  227. package/dist/dimensional/validator.d.ts.map +1 -1
  228. package/dist/dimensional/validator.js +129 -42
  229. package/dist/dimensional/validator.js.map +1 -1
  230. package/dist/index.d.ts +34 -4
  231. package/dist/index.d.ts.map +1 -1
  232. package/dist/index.js +64 -3
  233. package/dist/index.js.map +1 -1
  234. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
  235. package/dist/numerical/be37-covariant-eikonal.js +15 -18
  236. package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
  237. package/dist/numerical/curvature-lowering-helpers.d.ts +7 -13
  238. package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
  239. package/dist/numerical/curvature-lowering-helpers.js +1 -1
  240. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  241. package/dist/numerical/derivative-lowering.d.ts +2 -1
  242. package/dist/numerical/derivative-lowering.d.ts.map +1 -1
  243. package/dist/numerical/formula-dimension.d.ts +40 -0
  244. package/dist/numerical/formula-dimension.d.ts.map +1 -0
  245. package/dist/numerical/formula-dimension.js +199 -0
  246. package/dist/numerical/formula-dimension.js.map +1 -0
  247. package/dist/numerical/formula-mathts.d.ts +27 -0
  248. package/dist/numerical/formula-mathts.d.ts.map +1 -0
  249. package/dist/numerical/formula-mathts.js +98 -0
  250. package/dist/numerical/formula-mathts.js.map +1 -0
  251. package/dist/numerical/formula-registry.d.ts +30 -0
  252. package/dist/numerical/formula-registry.d.ts.map +1 -0
  253. package/dist/numerical/formula-registry.js +88 -0
  254. package/dist/numerical/formula-registry.js.map +1 -0
  255. package/dist/numerical/formula.d.ts +75 -0
  256. package/dist/numerical/formula.d.ts.map +1 -0
  257. package/dist/numerical/formula.js +275 -0
  258. package/dist/numerical/formula.js.map +1 -0
  259. package/dist/numerical/geometrized.d.ts +51 -0
  260. package/dist/numerical/geometrized.d.ts.map +1 -0
  261. package/dist/numerical/geometrized.js +66 -0
  262. package/dist/numerical/geometrized.js.map +1 -0
  263. package/dist/numerical/gl4-integrator.d.ts +8 -6
  264. package/dist/numerical/gl4-integrator.d.ts.map +1 -1
  265. package/dist/numerical/gl4-integrator.js +6 -6
  266. package/dist/numerical/gl4-integrator.js.map +1 -1
  267. package/dist/numerical/klein-gordon.d.ts +145 -0
  268. package/dist/numerical/klein-gordon.d.ts.map +1 -0
  269. package/dist/numerical/klein-gordon.js +145 -0
  270. package/dist/numerical/klein-gordon.js.map +1 -0
  271. package/dist/numerical/kretschmann.d.ts +43 -12
  272. package/dist/numerical/kretschmann.d.ts.map +1 -1
  273. package/dist/numerical/kretschmann.js +116 -29
  274. package/dist/numerical/kretschmann.js.map +1 -1
  275. package/dist/numerical/lowering.d.ts +18 -0
  276. package/dist/numerical/lowering.d.ts.map +1 -1
  277. package/dist/numerical/lowering.js +54 -42
  278. package/dist/numerical/lowering.js.map +1 -1
  279. package/dist/numerical/null-ic.d.ts +1 -1
  280. package/dist/numerical/null-ic.d.ts.map +1 -1
  281. package/dist/numerical/null-ic.js +3 -2
  282. package/dist/numerical/null-ic.js.map +1 -1
  283. package/dist/numerical/painleve-gullstrand-metric.d.ts +18 -6
  284. package/dist/numerical/painleve-gullstrand-metric.d.ts.map +1 -1
  285. package/dist/numerical/painleve-gullstrand-metric.js +31 -16
  286. package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
  287. package/dist/numerical/perihelion-finder.d.ts +4 -3
  288. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  289. package/dist/numerical/perihelion-finder.js +5 -4
  290. package/dist/numerical/perihelion-finder.js.map +1 -1
  291. package/dist/numerical/types.d.ts +6 -3
  292. package/dist/numerical/types.d.ts.map +1 -1
  293. package/dist/numerical/weyl-lowering.d.ts +4 -4
  294. package/dist/numerical/weyl-lowering.d.ts.map +1 -1
  295. package/dist/numerical/weyl-lowering.js +14 -1
  296. package/dist/numerical/weyl-lowering.js.map +1 -1
  297. package/package.json +19 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-graph.js","sourceRoot":"","sources":["../../src/composition/catalog-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,sBAAsB;IACtB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,GAAG,kBAAkB;CACtB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * v0.11 surface barrel for the namespacing-gate symbols (keeps
3
+ * src/index.ts one-import-per-area while the implementations live in
4
+ * compose.ts / edge.ts / enumerate.ts).
5
+ *
6
+ * @module composition/compose-surface
7
+ */
8
+ export { CompositionAliasError } from './edge.js';
9
+ export { SOURCE_ALIAS_DISPOSITIONS } from './compose.js';
10
+ export type { AliasDisposition } from './compose.js';
11
+ export type { DispositionRequired } from './enumerate.js';
12
+ //# sourceMappingURL=compose-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-surface.d.ts","sourceRoot":"","sources":["../../src/composition/compose-surface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * v0.11 surface barrel for the namespacing-gate symbols (keeps
3
+ * src/index.ts one-import-per-area while the implementations live in
4
+ * compose.ts / edge.ts / enumerate.ts).
5
+ *
6
+ * @module composition/compose-surface
7
+ */
8
+ export { CompositionAliasError } from './edge.js';
9
+ export { SOURCE_ALIAS_DISPOSITIONS } from './compose.js';
10
+ //# sourceMappingURL=compose-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-surface.js","sourceRoot":"","sources":["../../src/composition/compose-surface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Symbolic bridge composition (v0.12 — the Observable contract).
3
+ *
4
+ * Resolves the Part-IX §4 "Observable contract" deferral with a fourth
5
+ * option the spec did not enumerate: an OPTIONAL `symbolic` ExprNode on a
6
+ * bridge edge (leaves = source-quantity names + the `CONSTANTS` registry),
7
+ * composed by AST SUBSTITUTION. `composeSymbolic(first, second)` substitutes
8
+ * `first`'s symbolic form into the junction leaf of `second`'s, producing a
9
+ * new ExprNode that is dimensionally validated and numerically evaluable —
10
+ * not the black-box numeric closure `composeEdges` chains.
11
+ *
12
+ * Non-breaking (the field is optional), no per-pair adapters, and it retains
13
+ * dimensional type-safety. Edges without a `symbolic` form fall back to
14
+ * numeric `composeEdges` (unchanged).
15
+ *
16
+ * @module composition/compose-symbolic
17
+ */
18
+ import type { ExprNode } from '../dimensional/validator.js';
19
+ import type { Dimension } from '../dimensional/types.js';
20
+ import type { BridgeEdge } from './edge.js';
21
+ import type { QuantityIdentification } from './compose.js';
22
+ /**
23
+ * A composed quantity carrying its SYMBOLIC form and an executable
24
+ * evaluator — the shared return contract Part-IX §4 said was missing.
25
+ *
26
+ * @public
27
+ */
28
+ export interface Observable {
29
+ /** Target quantity name (from `second.target`). */
30
+ readonly name: string;
31
+ /** Display symbol. */
32
+ readonly symbol: string;
33
+ /** Dimensionally-validated SI dimension. */
34
+ readonly dim: Dimension;
35
+ /** The composed (substituted) AST. */
36
+ readonly expr: ExprNode;
37
+ /** Free leaf symbols = the required inputs (constants/literals excluded). */
38
+ readonly leaves: readonly string[];
39
+ /**
40
+ * Numerically evaluate the composed form. STRICT input (Eve EVE-1): every
41
+ * `leaves` key must be supplied and no extra key is accepted. PURE symbolic
42
+ * value — NOT domain-checked (unlike `composeEdges`, which throws
43
+ * `DomainViolationError`); use `composeEdges` for domain-checked values.
44
+ */
45
+ evaluate(values: Readonly<Record<string, number>>): number;
46
+ }
47
+ /** Symbolic composition is undefined (no junction / missing `symbolic` /
48
+ * zero-occurrence substitution / dimensional mismatch). @public */
49
+ export declare class SymbolicCompositionError extends Error {
50
+ constructor(message: string);
51
+ }
52
+ /** Options for {@link composeSymbolic}. @public */
53
+ export interface ComposeSymbolicOptions {
54
+ /** Extra identifications consulted after the registered ones. */
55
+ readonly identifications?: readonly QuantityIdentification[];
56
+ }
57
+ /**
58
+ * Build an {@link Observable} from a composed/simplified expression: computes
59
+ * the free `leaves` and a STRICT `evaluate` closure over THIS `expr` + leaves.
60
+ * Shared by `composeSymbolic` and `simplifyObservable` so a simplified
61
+ * Observable gets a fresh closure (never the stale unsimplified one).
62
+ *
63
+ * @internal
64
+ */
65
+ export declare function makeObservable(name: string, symbol: string, dim: Dimension, expr: ExprNode): Observable;
66
+ /**
67
+ * Compose two bridges SYMBOLICALLY: substitute `first`'s `symbolic` form into
68
+ * the junction leaf of `second`'s, validate the composed AST's dimension, and
69
+ * return an {@link Observable}. Both operands must carry a `symbolic` form
70
+ * (else throws — fall back to `composeEdges` for numeric-only composition).
71
+ *
72
+ * @public
73
+ */
74
+ export declare function composeSymbolic(first: BridgeEdge, second: BridgeEdge, opts?: ComposeSymbolicOptions): Observable;
75
+ //# sourceMappingURL=compose-symbolic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-symbolic.d.ts","sourceRoot":"","sources":["../../src/composition/compose-symbolic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAM3D;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;CAC5D;AAED;oEACoE;AACpE,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAED,mDAAmD;AACnD,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAC9D;AA6DD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,QAAQ,GACb,UAAU,CA4BZ;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE,sBAA2B,GAChC,UAAU,CAmDZ"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Symbolic bridge composition (v0.12 — the Observable contract).
3
+ *
4
+ * Resolves the Part-IX §4 "Observable contract" deferral with a fourth
5
+ * option the spec did not enumerate: an OPTIONAL `symbolic` ExprNode on a
6
+ * bridge edge (leaves = source-quantity names + the `CONSTANTS` registry),
7
+ * composed by AST SUBSTITUTION. `composeSymbolic(first, second)` substitutes
8
+ * `first`'s symbolic form into the junction leaf of `second`'s, producing a
9
+ * new ExprNode that is dimensionally validated and numerically evaluable —
10
+ * not the black-box numeric closure `composeEdges` chains.
11
+ *
12
+ * Non-breaking (the field is optional), no per-pair adapters, and it retains
13
+ * dimensional type-safety. Edges without a `symbolic` form fall back to
14
+ * numeric `composeEdges` (unchanged).
15
+ *
16
+ * @module composition/compose-symbolic
17
+ */
18
+ import { equals, format } from '../dimensional/algebra.js';
19
+ import { validate } from '../dimensional/validator.js';
20
+ import { QUANTITY_IDENTIFICATIONS } from './compose.js';
21
+ import { substitute } from './expr-subst.js';
22
+ import { evalExpr, SymbolicEvalError } from './expr-eval.js';
23
+ import { CONSTANTS } from './symbolic-constants.js';
24
+ /** Symbolic composition is undefined (no junction / missing `symbolic` /
25
+ * zero-occurrence substitution / dimensional mismatch). @public */
26
+ export class SymbolicCompositionError extends Error {
27
+ constructor(message) {
28
+ super(message);
29
+ this.name = 'SymbolicCompositionError';
30
+ }
31
+ }
32
+ /** Find the junction source of `second` matching `first.target` (by name or
33
+ * identification). Returns the source whose NAME is the substitution leaf —
34
+ * `junction.name` is correct in BOTH the name-match and identification cases
35
+ * (Eve EVE-4), avoiding the always-`ident.to` trap. */
36
+ function findJunctionName(first, second, identifications) {
37
+ for (const src of second.sources) {
38
+ if (src.name === first.target.name)
39
+ return src.name;
40
+ }
41
+ for (const ident of identifications) {
42
+ if (ident.from !== first.target.name)
43
+ continue;
44
+ for (const src of second.sources) {
45
+ if (src.name === ident.to)
46
+ return src.name;
47
+ }
48
+ }
49
+ throw new SymbolicCompositionError(`Cannot symbolically compose ${first.id} -> ${second.id}: target ` +
50
+ `'${first.target.name}' matches none of [${second.sources
51
+ .map((s) => `'${s.name}'`)
52
+ .join(', ')}] by name or registered identification.`);
53
+ }
54
+ /** Collect the distinct leaf-symbol names of a scalar ExprNode. */
55
+ function collectSymbols(expr, out) {
56
+ switch (expr.kind) {
57
+ case 'symbol':
58
+ out.add(expr.name);
59
+ return;
60
+ case 'op':
61
+ for (const a of expr.args)
62
+ collectSymbols(a, out);
63
+ return;
64
+ case 'integral':
65
+ collectSymbols(expr.over, out);
66
+ collectSymbols(expr.integrand, out);
67
+ return;
68
+ case 'derivative':
69
+ collectSymbols(expr.of, out);
70
+ collectSymbols(expr.wrt, out);
71
+ return;
72
+ default:
73
+ // Tensor arms cannot reach here (substitute would have thrown first).
74
+ return;
75
+ }
76
+ }
77
+ /** Free leaves = symbols that are neither registered constants nor numeric
78
+ * literals (those are not inputs). */
79
+ function freeLeaves(expr) {
80
+ const all = new Set();
81
+ collectSymbols(expr, all);
82
+ return [...all]
83
+ .filter((n) => !(n in CONSTANTS) && !Number.isFinite(Number(n)))
84
+ .sort();
85
+ }
86
+ /**
87
+ * Build an {@link Observable} from a composed/simplified expression: computes
88
+ * the free `leaves` and a STRICT `evaluate` closure over THIS `expr` + leaves.
89
+ * Shared by `composeSymbolic` and `simplifyObservable` so a simplified
90
+ * Observable gets a fresh closure (never the stale unsimplified one).
91
+ *
92
+ * @internal
93
+ */
94
+ export function makeObservable(name, symbol, dim, expr) {
95
+ const leaves = freeLeaves(expr);
96
+ return {
97
+ name,
98
+ symbol,
99
+ dim,
100
+ expr,
101
+ leaves,
102
+ evaluate(values) {
103
+ for (const leaf of leaves) {
104
+ if (!Object.prototype.hasOwnProperty.call(values, leaf)) {
105
+ throw new SymbolicEvalError(`Observable(${name}).evaluate: missing required input '${leaf}' ` +
106
+ `(leaves: ${leaves.join(', ')}).`);
107
+ }
108
+ }
109
+ for (const key of Object.keys(values)) {
110
+ if (!leaves.includes(key)) {
111
+ throw new SymbolicEvalError(`Observable(${name}).evaluate: unexpected input '${key}' (this ` +
112
+ `Observable's inputs are exactly: ${leaves.join(', ') || '(none)'}).`);
113
+ }
114
+ }
115
+ return evalExpr(expr, values);
116
+ },
117
+ };
118
+ }
119
+ /**
120
+ * Compose two bridges SYMBOLICALLY: substitute `first`'s `symbolic` form into
121
+ * the junction leaf of `second`'s, validate the composed AST's dimension, and
122
+ * return an {@link Observable}. Both operands must carry a `symbolic` form
123
+ * (else throws — fall back to `composeEdges` for numeric-only composition).
124
+ *
125
+ * @public
126
+ */
127
+ export function composeSymbolic(first, second, opts = {}) {
128
+ const identifications = [
129
+ ...QUANTITY_IDENTIFICATIONS,
130
+ ...(opts.identifications ?? []),
131
+ ];
132
+ if (!first.symbolic || !second.symbolic) {
133
+ const missing = !first.symbolic ? first.id : second.id;
134
+ throw new SymbolicCompositionError(`Cannot symbolically compose ${first.id} -> ${second.id}: edge ` +
135
+ `'${missing}' has no symbolic form (numeric-only edge — use ` +
136
+ `composeEdges).`);
137
+ }
138
+ const junctionName = findJunctionName(first, second, identifications);
139
+ const { expr, count } = substitute(second.symbolic, junctionName, first.symbolic);
140
+ if (count === 0) {
141
+ throw new SymbolicCompositionError(`Cannot symbolically compose ${first.id} -> ${second.id}: junction ` +
142
+ `'${junctionName}' does not appear as a leaf of ${second.id}'s ` +
143
+ `symbolic form — substitution would silently ignore ${first.id}.`);
144
+ }
145
+ const v = validate(expr);
146
+ if (!v.ok || v.inferredDimension === null) {
147
+ throw new SymbolicCompositionError(`Composed symbolic form of ${first.id} -> ${second.id} failed ` +
148
+ `dimensional validation: ${v.violations[0]?.note ?? 'not homogeneous'}.`);
149
+ }
150
+ if (!equals(v.inferredDimension, second.target.dim)) {
151
+ throw new SymbolicCompositionError(`Composed symbolic form of ${first.id} -> ${second.id} has dimension ` +
152
+ `${format(v.inferredDimension)} but ${second.target.name} is ` +
153
+ `${format(second.target.dim)}.`);
154
+ }
155
+ return makeObservable(second.target.name, second.target.symbol, second.target.dim, expr);
156
+ }
157
+ //# sourceMappingURL=compose-symbolic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-symbolic.js","sourceRoot":"","sources":["../../src/composition/compose-symbolic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AA4BpD;oEACoE;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**
2
+ * Composition graph — the composition operator (v0.8.0 T2/T4, per
3
+ * docs/planning/v0.8.0-Design.md §3 + r2 deltas).
4
+ *
5
+ * `composeEdges(first, second)` pipes `first`'s output quantity into a
6
+ * matching source of `second`, producing a NEW `BridgeEdge` (design
7
+ * D-2 — composition closes over the edge type, so chains nest
8
+ * arbitrarily). Defined iff:
9
+ *
10
+ * 1. `first.target` matches one of `second.sources` — by canonical
11
+ * name, or via an explicit {@link QuantityIdentification} (the
12
+ * reviewable physics judgments, e.g. "the Hawking temperature IS
13
+ * the temperature in Landauer's bound");
14
+ * 2. the junction dimensions are EXACTLY equal (the dimension-functor
15
+ * check — ℤ⁷ integer-vector equality via the dimensional
16
+ * calculus's `equals`);
17
+ * 3. domains conjoin THROUGH the pipe (design D-5): the composed
18
+ * domain checks `first`'s domain on the outer inputs and
19
+ * `second`'s domain on the piped intermediate value. This
20
+ * evaluates `first.evaluate` inside the predicate — acceptable
21
+ * for scalar closed forms.
22
+ *
23
+ * Confidence demotes: `min(first, second)` on
24
+ * established > speculative > highly-speculative. Composition never
25
+ * launders credibility (improvement-plan confidence algebra).
26
+ *
27
+ * Operator is named `composeEdges` (NOT `compose`) — `compose` is the
28
+ * public v0.7 Cell factory in `src/core/cell.ts` (Adam A-1).
29
+ *
30
+ * @module composition/compose
31
+ */
32
+ import type { BridgeEdge, EdgeConfidence } from './edge.js';
33
+ /**
34
+ * A reviewable quantity-identification judgment: the assertion that
35
+ * the quantity named `from` (an edge's target) IS the quantity named
36
+ * `to` (another edge's source), with the physics rationale on record.
37
+ *
38
+ * @public
39
+ */
40
+ export interface QuantityIdentification {
41
+ readonly from: string;
42
+ readonly to: string;
43
+ readonly rationale: string;
44
+ readonly citation?: string;
45
+ }
46
+ /**
47
+ * Registered identifications (v0.8.0 CT-1). Each entry is a physics
48
+ * judgment intended for review — see CONTRIBUTING.md.
49
+ *
50
+ * @public
51
+ */
52
+ export declare const QUANTITY_IDENTIFICATIONS: readonly QuantityIdentification[];
53
+ /**
54
+ * A recorded aliasing judgment for one duplicate source name in a
55
+ * composition (v0.11 Option D). `'shared'` = one input deliberately
56
+ * feeds both slots (e.g. ST-2: one M is both the lens and the r_s
57
+ * source). `renameSecond` = split the collision: the SECOND operand's
58
+ * quantity is renamed, and the composed evaluator remaps the renamed
59
+ * input key back to the operand's internal name (vet A-4 — without the
60
+ * remap the rename is a no-op).
61
+ *
62
+ * @public
63
+ */
64
+ export interface AliasDisposition {
65
+ readonly name: string;
66
+ readonly treatAs: 'shared' | {
67
+ readonly renameSecond: string;
68
+ };
69
+ readonly rationale: string;
70
+ readonly citation?: string;
71
+ }
72
+ /**
73
+ * Registered alias dispositions, keyed by composed id
74
+ * (`first.id>>second.id`) — judgments live in reviewable registry
75
+ * data, mirroring {@link QUANTITY_IDENTIFICATIONS} (vet A-6.2).
76
+ *
77
+ * @public
78
+ */
79
+ export declare const SOURCE_ALIAS_DISPOSITIONS: Readonly<Record<string, readonly AliasDisposition[]>>;
80
+ /**
81
+ * Confidence demotion: the min of the two grades on the ordering
82
+ * established > speculative > highly-speculative.
83
+ *
84
+ * @public
85
+ */
86
+ export declare function minConfidence(a: EdgeConfidence, b: EdgeConfidence): EdgeConfidence;
87
+ /** Options for {@link composeEdges}. @public */
88
+ export interface ComposeOptions {
89
+ /** Extra identifications, consulted after the registered ones. */
90
+ readonly identifications?: readonly QuantityIdentification[];
91
+ /**
92
+ * Alias dispositions for duplicate source names (v0.11 Option D);
93
+ * consulted after {@link SOURCE_ALIAS_DISPOSITIONS} entries for the
94
+ * composed id.
95
+ */
96
+ readonly aliases?: readonly AliasDisposition[];
97
+ }
98
+ /**
99
+ * Compose two edges into a new edge (sequential composition through a
100
+ * shared quantity). See module docs for the definedness conditions.
101
+ *
102
+ * The composed edge's `sources` are `first.sources` followed by
103
+ * `second`'s remaining (non-junction) sources; `kind` is `'law'` only
104
+ * when both operands are laws; `beId` is null (a derived relation has
105
+ * no single catalog row).
106
+ *
107
+ * @public
108
+ */
109
+ export declare function composeEdges(first: BridgeEdge, second: BridgeEdge, opts?: ComposeOptions): BridgeEdge;
110
+ //# sourceMappingURL=compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/composition/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAS5D;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,sBAAsB,EAYrE,CAAC;AAGF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG;QAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAC9C,MAAM,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC,CAe5C,CAAC;AAQF;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,cAAc,EACjB,CAAC,EAAE,cAAc,GAChB,cAAc,CAEhB;AAED,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC7D;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAChD;AA4BD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE,cAAmB,GACxB,UAAU,CA6IZ"}
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Composition graph — the composition operator (v0.8.0 T2/T4, per
3
+ * docs/planning/v0.8.0-Design.md §3 + r2 deltas).
4
+ *
5
+ * `composeEdges(first, second)` pipes `first`'s output quantity into a
6
+ * matching source of `second`, producing a NEW `BridgeEdge` (design
7
+ * D-2 — composition closes over the edge type, so chains nest
8
+ * arbitrarily). Defined iff:
9
+ *
10
+ * 1. `first.target` matches one of `second.sources` — by canonical
11
+ * name, or via an explicit {@link QuantityIdentification} (the
12
+ * reviewable physics judgments, e.g. "the Hawking temperature IS
13
+ * the temperature in Landauer's bound");
14
+ * 2. the junction dimensions are EXACTLY equal (the dimension-functor
15
+ * check — ℤ⁷ integer-vector equality via the dimensional
16
+ * calculus's `equals`);
17
+ * 3. domains conjoin THROUGH the pipe (design D-5): the composed
18
+ * domain checks `first`'s domain on the outer inputs and
19
+ * `second`'s domain on the piped intermediate value. This
20
+ * evaluates `first.evaluate` inside the predicate — acceptable
21
+ * for scalar closed forms.
22
+ *
23
+ * Confidence demotes: `min(first, second)` on
24
+ * established > speculative > highly-speculative. Composition never
25
+ * launders credibility (improvement-plan confidence algebra).
26
+ *
27
+ * Operator is named `composeEdges` (NOT `compose`) — `compose` is the
28
+ * public v0.7 Cell factory in `src/core/cell.ts` (Adam A-1).
29
+ *
30
+ * @module composition/compose
31
+ */
32
+ import { equals, format } from '../dimensional/algebra.js';
33
+ import { CompositionAliasError, CompositionDimensionError, CompositionJunctionError, DomainViolationError, } from './edge.js';
34
+ /**
35
+ * Registered identifications (v0.8.0 CT-1). Each entry is a physics
36
+ * judgment intended for review — see CONTRIBUTING.md.
37
+ *
38
+ * @public
39
+ */
40
+ export const QUANTITY_IDENTIFICATIONS = [
41
+ {
42
+ from: 'hawking-temperature',
43
+ to: 'temperature',
44
+ rationale: 'The Hawking temperature of a black-hole horizon is a genuine ' +
45
+ 'thermodynamic temperature — the temperature appearing in ' +
46
+ "Landauer's bound for erasure at the horizon. This is the " +
47
+ 'standard identification underlying black-hole thermodynamics ' +
48
+ '(the horizon radiates as a black body at T_H).',
49
+ citation: 'Hawking 1975 CMP 43:199; Bekenstein 1973 PRD 7:2333',
50
+ },
51
+ ];
52
+ /**
53
+ * Registered alias dispositions, keyed by composed id
54
+ * (`first.id>>second.id`) — judgments live in reviewable registry
55
+ * data, mirroring {@link QUANTITY_IDENTIFICATIONS} (vet A-6.2).
56
+ *
57
+ * @public
58
+ */
59
+ export const SOURCE_ALIAS_DISPOSITIONS = {
60
+ // ST-2 (stress test, pre-registered v0.10.0 plan §T2): the photon
61
+ // grazes AT r_s of the SAME mass that bends it — one M is both the
62
+ // lensing mass and the r_s source. Deliberate, physical sharing.
63
+ 'law-schwarzschild-radius>>be-51': [
64
+ {
65
+ name: 'mass',
66
+ treatAs: 'shared',
67
+ rationale: 'One gravitating mass M is simultaneously the lens (BE-51) and ' +
68
+ 'the source of the Schwarzschild radius the photon grazes — ' +
69
+ 'the sharing IS the stress-test physics (ST-2).',
70
+ },
71
+ ],
72
+ };
73
+ const CONFIDENCE_RANK = {
74
+ established: 2,
75
+ speculative: 1,
76
+ 'highly-speculative': 0,
77
+ };
78
+ /**
79
+ * Confidence demotion: the min of the two grades on the ordering
80
+ * established > speculative > highly-speculative.
81
+ *
82
+ * @public
83
+ */
84
+ export function minConfidence(a, b) {
85
+ return CONFIDENCE_RANK[a] <= CONFIDENCE_RANK[b] ? a : b;
86
+ }
87
+ function findJunction(first, second, identifications) {
88
+ for (const src of second.sources) {
89
+ if (src.name === first.target.name) {
90
+ return { junction: src, viaIdentification: null };
91
+ }
92
+ }
93
+ for (const ident of identifications) {
94
+ if (ident.from !== first.target.name)
95
+ continue;
96
+ for (const src of second.sources) {
97
+ if (src.name === ident.to) {
98
+ return { junction: src, viaIdentification: ident };
99
+ }
100
+ }
101
+ }
102
+ throw new CompositionJunctionError(`Cannot compose ${first.id} -> ${second.id}: target quantity ` +
103
+ `'${first.target.name}' matches none of [${second.sources
104
+ .map((s) => `'${s.name}'`)
105
+ .join(', ')}] by name or registered identification`);
106
+ }
107
+ /**
108
+ * Compose two edges into a new edge (sequential composition through a
109
+ * shared quantity). See module docs for the definedness conditions.
110
+ *
111
+ * The composed edge's `sources` are `first.sources` followed by
112
+ * `second`'s remaining (non-junction) sources; `kind` is `'law'` only
113
+ * when both operands are laws; `beId` is null (a derived relation has
114
+ * no single catalog row).
115
+ *
116
+ * @public
117
+ */
118
+ export function composeEdges(first, second, opts = {}) {
119
+ const identifications = [
120
+ ...QUANTITY_IDENTIFICATIONS,
121
+ ...(opts.identifications ?? []),
122
+ ];
123
+ const { junction, viaIdentification } = findJunction(first, second, identifications);
124
+ if (!equals(first.target.dim, junction.dim)) {
125
+ throw new CompositionDimensionError(`Cannot compose ${first.id} -> ${second.id}: junction dimension ` +
126
+ `mismatch — ${first.target.name} is ${format(first.target.dim)} ` +
127
+ `but ${junction.name} is ${format(junction.dim)}`);
128
+ }
129
+ const remainingSources = second.sources.filter((s) => s !== junction);
130
+ // v0.11 Option D (namespacing gate): pure name-collision rule across
131
+ // operands. Intra-operand duplicates (e.g. ['mass','mass'] inherited
132
+ // from a prior 'shared' disposition) are exempt by construction —
133
+ // only names present in BOTH first.sources and second's remaining
134
+ // sources are collisions, and each needs a recorded disposition.
135
+ const firstNames = new Set(first.sources.map((s) => s.name));
136
+ const collisionNames = [
137
+ ...new Set(remainingSources
138
+ .filter((s) => firstNames.has(s.name))
139
+ .map((s) => s.name)),
140
+ ];
141
+ const composedId = `${first.id}>>${second.id}`;
142
+ const dispositions = [
143
+ ...(SOURCE_ALIAS_DISPOSITIONS[composedId] ?? []),
144
+ ...(opts.aliases ?? []),
145
+ ];
146
+ const renameMap = {}; // renamed key -> operand-internal name
147
+ const dispositionsUsed = [];
148
+ let finalRemaining = [...remainingSources];
149
+ for (const name of collisionNames) {
150
+ const d = dispositions.find((x) => x.name === name);
151
+ if (!d) {
152
+ throw new CompositionAliasError(`Cannot compose ${composedId}: source quantity '${name}' appears ` +
153
+ `in BOTH operands (first: [${[...firstNames].join(', ')}]; ` +
154
+ `second remaining: [${remainingSources
155
+ .map((s) => s.name)
156
+ .join(', ')}]). Same name does not imply same physical ` +
157
+ `quantity — record an AliasDisposition ('shared' or ` +
158
+ `{renameSecond}) in SOURCE_ALIAS_DISPOSITIONS or opts.aliases.`);
159
+ }
160
+ dispositionsUsed.push(d);
161
+ if (d.treatAs === 'shared')
162
+ continue; // one input key feeds both slots
163
+ const renamed = d.treatAs.renameSecond;
164
+ if (firstNames.has(renamed) ||
165
+ second.sources.some((s) => s.name === renamed)) {
166
+ throw new CompositionAliasError(`Cannot compose ${composedId}: renameSecond target '${renamed}' ` +
167
+ `collides with an existing source name of an operand (vet A-4).`);
168
+ }
169
+ finalRemaining = finalRemaining.map((s) => s.name === name ? { ...s, name: renamed, symbol: s.symbol } : s);
170
+ renameMap[renamed] = name;
171
+ }
172
+ /** Build the second operand's input map: remap renamed keys back to
173
+ * the operand-internal names (shadowing the first operand's value
174
+ * for that name — vet A-4's required remap), then pipe the junction. */
175
+ const buildSecondInputs = (inputs, intermediate) => {
176
+ const si = { ...inputs };
177
+ for (const [renamed, original] of Object.entries(renameMap)) {
178
+ si[original] = inputs[renamed];
179
+ delete si[renamed];
180
+ }
181
+ si[junction.name] = intermediate;
182
+ return si;
183
+ };
184
+ const composedDomain = {
185
+ description: `(${first.domain.description}) AND, on the piped ` +
186
+ `${junction.name}, (${second.domain.description})`,
187
+ // Standalone domain queries evaluate `first` to obtain the piped
188
+ // intermediate (design D-5; acceptable for scalar closed forms).
189
+ // The composed `evaluate` below does NOT call this predicate — it
190
+ // computes the intermediate once and checks both domains inline
191
+ // (v0.8.0 punch-list: removed the double evaluation of `first`).
192
+ predicate: (inputs) => {
193
+ if (!first.domain.predicate(inputs))
194
+ return false;
195
+ const intermediate = first.evaluate(inputs);
196
+ return second.domain.predicate(buildSecondInputs(inputs, intermediate));
197
+ },
198
+ };
199
+ const id = `${first.id}>>${second.id}`;
200
+ return {
201
+ id,
202
+ beId: null,
203
+ kind: first.kind === 'law' && second.kind === 'law' ? 'law' : 'bridge',
204
+ label: `${first.label} ∘ ${second.label}`,
205
+ sources: [...first.sources, ...finalRemaining],
206
+ target: second.target,
207
+ confidence: minConfidence(first.confidence, second.confidence),
208
+ domain: composedDomain,
209
+ evaluate: (inputs) => {
210
+ if (!first.domain.predicate(inputs)) {
211
+ throw new DomainViolationError(`${id}: inputs violate composed validity domain ` +
212
+ `(${composedDomain.description})`);
213
+ }
214
+ const intermediate = first.evaluate(inputs);
215
+ const pipedInputs = buildSecondInputs(inputs, intermediate);
216
+ if (!second.domain.predicate(pipedInputs)) {
217
+ throw new DomainViolationError(`${id}: inputs violate composed validity domain ` +
218
+ `(${composedDomain.description})`);
219
+ }
220
+ return second.evaluate(pipedInputs);
221
+ },
222
+ citation: `${first.citation} | ${second.citation}`,
223
+ ...(viaIdentification !== null
224
+ ? { identificationUsed: viaIdentification }
225
+ : {}),
226
+ ...(dispositionsUsed.length > 0
227
+ ? { aliasDispositionsUsed: dispositionsUsed }
228
+ : {}),
229
+ };
230
+ }
231
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/composition/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAgBnB;;;;;GAKG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