universal-physics-tensor 0.7.3 → 0.14.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 (293) 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/dimensional/buckingham.d.ts +103 -0
  203. package/dist/dimensional/buckingham.d.ts.map +1 -0
  204. package/dist/dimensional/buckingham.js +284 -0
  205. package/dist/dimensional/buckingham.js.map +1 -0
  206. package/dist/dimensional/dimension-spec.d.ts +24 -0
  207. package/dist/dimensional/dimension-spec.d.ts.map +1 -0
  208. package/dist/dimensional/dimension-spec.js +110 -0
  209. package/dist/dimensional/dimension-spec.js.map +1 -0
  210. package/dist/dimensional/field-equation-helpers.d.ts +1 -1
  211. package/dist/dimensional/field-equation-helpers.js +1 -1
  212. package/dist/dimensional/friedmann-equation.d.ts +1 -1
  213. package/dist/dimensional/friedmann-equation.js +1 -1
  214. package/dist/dimensional/gauge-field.d.ts +1 -1
  215. package/dist/dimensional/gauge-field.js +1 -1
  216. package/dist/dimensional/klein-gordon-equation.d.ts +8 -5
  217. package/dist/dimensional/klein-gordon-equation.d.ts.map +1 -1
  218. package/dist/dimensional/klein-gordon-equation.js +8 -5
  219. package/dist/dimensional/klein-gordon-equation.js.map +1 -1
  220. package/dist/dimensional/tensor-trace.d.ts +1 -1
  221. package/dist/dimensional/tensor-trace.js +1 -1
  222. package/dist/dimensional/validator.d.ts +13 -3
  223. package/dist/dimensional/validator.d.ts.map +1 -1
  224. package/dist/dimensional/validator.js +129 -42
  225. package/dist/dimensional/validator.js.map +1 -1
  226. package/dist/index.d.ts +32 -2
  227. package/dist/index.d.ts.map +1 -1
  228. package/dist/index.js +63 -2
  229. package/dist/index.js.map +1 -1
  230. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
  231. package/dist/numerical/be37-covariant-eikonal.js +15 -18
  232. package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
  233. package/dist/numerical/curvature-lowering-helpers.d.ts +7 -13
  234. package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
  235. package/dist/numerical/curvature-lowering-helpers.js +1 -1
  236. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  237. package/dist/numerical/derivative-lowering.d.ts +2 -1
  238. package/dist/numerical/derivative-lowering.d.ts.map +1 -1
  239. package/dist/numerical/formula-dimension.d.ts +40 -0
  240. package/dist/numerical/formula-dimension.d.ts.map +1 -0
  241. package/dist/numerical/formula-dimension.js +199 -0
  242. package/dist/numerical/formula-dimension.js.map +1 -0
  243. package/dist/numerical/formula-mathts.d.ts +27 -0
  244. package/dist/numerical/formula-mathts.d.ts.map +1 -0
  245. package/dist/numerical/formula-mathts.js +98 -0
  246. package/dist/numerical/formula-mathts.js.map +1 -0
  247. package/dist/numerical/formula-registry.d.ts +30 -0
  248. package/dist/numerical/formula-registry.d.ts.map +1 -0
  249. package/dist/numerical/formula-registry.js +88 -0
  250. package/dist/numerical/formula-registry.js.map +1 -0
  251. package/dist/numerical/formula.d.ts +75 -0
  252. package/dist/numerical/formula.d.ts.map +1 -0
  253. package/dist/numerical/formula.js +275 -0
  254. package/dist/numerical/formula.js.map +1 -0
  255. package/dist/numerical/geometrized.d.ts +51 -0
  256. package/dist/numerical/geometrized.d.ts.map +1 -0
  257. package/dist/numerical/geometrized.js +66 -0
  258. package/dist/numerical/geometrized.js.map +1 -0
  259. package/dist/numerical/gl4-integrator.d.ts +8 -6
  260. package/dist/numerical/gl4-integrator.d.ts.map +1 -1
  261. package/dist/numerical/gl4-integrator.js +6 -6
  262. package/dist/numerical/gl4-integrator.js.map +1 -1
  263. package/dist/numerical/klein-gordon.d.ts +145 -0
  264. package/dist/numerical/klein-gordon.d.ts.map +1 -0
  265. package/dist/numerical/klein-gordon.js +145 -0
  266. package/dist/numerical/klein-gordon.js.map +1 -0
  267. package/dist/numerical/kretschmann.d.ts +43 -12
  268. package/dist/numerical/kretschmann.d.ts.map +1 -1
  269. package/dist/numerical/kretschmann.js +116 -29
  270. package/dist/numerical/kretschmann.js.map +1 -1
  271. package/dist/numerical/lowering.d.ts +18 -0
  272. package/dist/numerical/lowering.d.ts.map +1 -1
  273. package/dist/numerical/lowering.js +54 -42
  274. package/dist/numerical/lowering.js.map +1 -1
  275. package/dist/numerical/null-ic.d.ts +1 -1
  276. package/dist/numerical/null-ic.d.ts.map +1 -1
  277. package/dist/numerical/null-ic.js +3 -2
  278. package/dist/numerical/null-ic.js.map +1 -1
  279. package/dist/numerical/painleve-gullstrand-metric.d.ts +18 -6
  280. package/dist/numerical/painleve-gullstrand-metric.d.ts.map +1 -1
  281. package/dist/numerical/painleve-gullstrand-metric.js +31 -16
  282. package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
  283. package/dist/numerical/perihelion-finder.d.ts +4 -3
  284. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  285. package/dist/numerical/perihelion-finder.js +5 -4
  286. package/dist/numerical/perihelion-finder.js.map +1 -1
  287. package/dist/numerical/types.d.ts +6 -3
  288. package/dist/numerical/types.d.ts.map +1 -1
  289. package/dist/numerical/weyl-lowering.d.ts +4 -4
  290. package/dist/numerical/weyl-lowering.d.ts.map +1 -1
  291. package/dist/numerical/weyl-lowering.js +14 -1
  292. package/dist/numerical/weyl-lowering.js.map +1 -1
  293. package/package.json +19 -8
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Composition graph — shared-source consistency relations (v0.8.0
3
+ * CT-2, per docs/planning/v0.8.0-Design.md §2).
4
+ *
5
+ * `consistencyRatio` is a PARALLEL graph operation, honestly distinct
6
+ * from sequential composition: two edges that share source quantities
7
+ * are evaluated on the same inputs and their quotient taken. When the
8
+ * shared quantities cancel algebraically (as G, M, c do between BE-51
9
+ * lensing and BE-52 perihelion precession), the ratio is a
10
+ * parameter-free consistency relation — varying the shared inputs must
11
+ * leave it invariant.
12
+ *
13
+ * @module composition/consistency
14
+ */
15
+ import type { BridgeEdge } from './edge.js';
16
+ /**
17
+ * Domain-checked quotient `a(inputs) / b(inputs)` of two edges sharing
18
+ * source quantities. Throws {@link DomainViolationError} if either
19
+ * edge's validity domain rejects the inputs.
20
+ *
21
+ * @public
22
+ */
23
+ export declare function consistencyRatio(a: BridgeEdge, b: BridgeEdge, inputs: Record<string, number>): number;
24
+ //# sourceMappingURL=consistency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consistency.d.ts","sourceRoot":"","sources":["../../src/composition/consistency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,MAAM,CAER"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Composition graph — shared-source consistency relations (v0.8.0
3
+ * CT-2, per docs/planning/v0.8.0-Design.md §2).
4
+ *
5
+ * `consistencyRatio` is a PARALLEL graph operation, honestly distinct
6
+ * from sequential composition: two edges that share source quantities
7
+ * are evaluated on the same inputs and their quotient taken. When the
8
+ * shared quantities cancel algebraically (as G, M, c do between BE-51
9
+ * lensing and BE-52 perihelion precession), the ratio is a
10
+ * parameter-free consistency relation — varying the shared inputs must
11
+ * leave it invariant.
12
+ *
13
+ * @module composition/consistency
14
+ */
15
+ import { evaluateEdge } from './edge.js';
16
+ /**
17
+ * Domain-checked quotient `a(inputs) / b(inputs)` of two edges sharing
18
+ * source quantities. Throws {@link DomainViolationError} if either
19
+ * edge's validity domain rejects the inputs.
20
+ *
21
+ * @public
22
+ */
23
+ export function consistencyRatio(a, b, inputs) {
24
+ return evaluateEdge(a, inputs) / evaluateEdge(b, inputs);
25
+ }
26
+ //# sourceMappingURL=consistency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consistency.js","sourceRoot":"","sources":["../../src/composition/consistency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,CAAa,EACb,CAAa,EACb,MAA8B;IAE9B,OAAO,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Discovery loop — vet link candidates through the verification primitives
3
+ * (Direction 2).
4
+ *
5
+ * `proposeLinkCandidates` surfaces cross-cluster quantity pairs that share a
6
+ * dimension (132 → 36 → ~3) and hands the raw coincidences to a human. This
7
+ * module closes the loop: it HYPOTHESIZES each candidate identification
8
+ * `a ≡ b` and tests it with the machinery that already exists —
9
+ *
10
+ * - mergesComponents — does identifying a≡b connect two previously
11
+ * disconnected parts of the graph? (structural
12
+ * significance)
13
+ * - unlocksFromAnchor — what becomes determinable from an anchor input
14
+ * set WITH the identification that was not before?
15
+ * (`forwardClosure`)
16
+ * - numericallyConsistent — does retrodiction over the graph stay
17
+ * all-consistent once the identification is
18
+ * added, or does it introduce a contradiction?
19
+ * (`retrodict` — the STRONG filter)
20
+ *
21
+ * so the physicist adjudicates a handful of VETTED, provenance-traced
22
+ * candidates instead of dimensional noise.
23
+ *
24
+ * ⚠ Still a REVIEW SURFACE, never automated discovery (Part-VI §XXVII-B). A
25
+ * shared dimension is a weak prior; the weight is on the numeric and
26
+ * structural signals, and the numeric check only exercises the part of the
27
+ * graph reachable from the anchor. `promising` means "worth a physicist's
28
+ * minute", not "true".
29
+ *
30
+ * INTERNAL — not on the public surface (mirrors bridge-analysis.ts);
31
+ * surfaced via `upt discover`.
32
+ *
33
+ * @module composition/discovery
34
+ */
35
+ import type { BridgeEdge } from './edge.js';
36
+ import type { QuantityIdentification } from './compose.js';
37
+ import type { LinkCandidate } from './bridge-analysis.js';
38
+ /** A candidate after vetting against the inference suite. @hypothesis */
39
+ export interface VettedCandidate {
40
+ readonly a: string;
41
+ readonly b: string;
42
+ /** Shared SI dimension (from the proposer). */
43
+ readonly dim: string;
44
+ /** One endpoint is in the anchored (established) cluster. */
45
+ readonly touchesCore: boolean;
46
+ /** The names share a word token (same physical KIND). */
47
+ readonly sameKind: boolean;
48
+ /**
49
+ * Identifying a≡b merges two distinct connected components of the
50
+ * quantity graph — it connects physics the catalog keeps separate.
51
+ */
52
+ readonly mergesComponents: boolean;
53
+ /**
54
+ * Quantities newly determinable from the anchor known-set once the
55
+ * identification is added (structural unlock). Sorted.
56
+ */
57
+ readonly unlocksFromAnchor: readonly string[];
58
+ /**
59
+ * Retrodiction over the graph WITH the hypothesized identification stays
60
+ * all-consistent (introduces no numerical contradiction in the
61
+ * anchor-reachable subgraph). The strong filter.
62
+ */
63
+ readonly numericallyConsistent: boolean;
64
+ /** Nodes that became inconsistent under the identification (the
65
+ * falsification, when `numericallyConsistent` is false). Sorted. */
66
+ readonly inconsistentNodes: readonly string[];
67
+ /**
68
+ * - `contradictory` — breaks numerical consistency (a falsification).
69
+ * - `promising` — consistent AND connects disconnected physics AND
70
+ * unlocks ≥1 quantity. Worth physicist review.
71
+ * - `inert` — consistent but structurally/numerically idle (a
72
+ * dimensional coincidence with no consequence).
73
+ */
74
+ readonly verdict: 'promising' | 'inert' | 'contradictory';
75
+ /** Composite ranking score (higher = more worth review). */
76
+ readonly score: number;
77
+ }
78
+ /** Options for the discovery loop. @internal */
79
+ export interface DiscoveryOptions {
80
+ /**
81
+ * Numeric anchor for the consistency check (and the closure unlock).
82
+ * Default `{ mass: M_sun }` — the pre-registered retrodiction anchor.
83
+ */
84
+ readonly groundTruth?: Readonly<Record<string, number>>;
85
+ /** Extra identifications honored as the baseline (default registered). */
86
+ readonly identifications?: readonly QuantityIdentification[];
87
+ }
88
+ /**
89
+ * Vet one link candidate by hypothesizing the identification a≡b and
90
+ * measuring its structural and numerical consequences. See module docs.
91
+ *
92
+ * @internal
93
+ */
94
+ export declare function vetLinkCandidate(edges: readonly BridgeEdge[], candidate: LinkCandidate, opts?: DiscoveryOptions): VettedCandidate;
95
+ /**
96
+ * Run the full discovery funnel: propose cross-cluster candidates, vet each
97
+ * against the inference suite, and rank — `promising` first, then by score.
98
+ * The output is the physicist's worklist (vetted, provenance-traced), not a
99
+ * list of discoveries.
100
+ *
101
+ * @internal
102
+ */
103
+ export declare function rankDiscoveries(edges: readonly BridgeEdge[], opts?: DiscoveryOptions): VettedCandidate[];
104
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/composition/discovery.ts"],"names":[],"mappings":"AAAA;;;;;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AS,UAAU,EAAE,EAC5B,SAAS,EAAE,aAAa,EACxB,IAAI,GAAE,gBAAqB,GAC1B,eAAe,CAkEjB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,IAAI,GAAE,gBAAqB,GAC1B,eAAe,EAAE,CAgBnB"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Discovery loop — vet link candidates through the verification primitives
3
+ * (Direction 2).
4
+ *
5
+ * `proposeLinkCandidates` surfaces cross-cluster quantity pairs that share a
6
+ * dimension (132 → 36 → ~3) and hands the raw coincidences to a human. This
7
+ * module closes the loop: it HYPOTHESIZES each candidate identification
8
+ * `a ≡ b` and tests it with the machinery that already exists —
9
+ *
10
+ * - mergesComponents — does identifying a≡b connect two previously
11
+ * disconnected parts of the graph? (structural
12
+ * significance)
13
+ * - unlocksFromAnchor — what becomes determinable from an anchor input
14
+ * set WITH the identification that was not before?
15
+ * (`forwardClosure`)
16
+ * - numericallyConsistent — does retrodiction over the graph stay
17
+ * all-consistent once the identification is
18
+ * added, or does it introduce a contradiction?
19
+ * (`retrodict` — the STRONG filter)
20
+ *
21
+ * so the physicist adjudicates a handful of VETTED, provenance-traced
22
+ * candidates instead of dimensional noise.
23
+ *
24
+ * ⚠ Still a REVIEW SURFACE, never automated discovery (Part-VI §XXVII-B). A
25
+ * shared dimension is a weak prior; the weight is on the numeric and
26
+ * structural signals, and the numeric check only exercises the part of the
27
+ * graph reachable from the anchor. `promising` means "worth a physicist's
28
+ * minute", not "true".
29
+ *
30
+ * INTERNAL — not on the public surface (mirrors bridge-analysis.ts);
31
+ * surfaced via `upt discover`.
32
+ *
33
+ * @module composition/discovery
34
+ */
35
+ import { QUANTITY_IDENTIFICATIONS } from './compose.js';
36
+ import { forwardClosure } from './identifiability.js';
37
+ import { retrodict } from './retrodiction.js';
38
+ import { proposeLinkCandidates } from './bridge-analysis.js';
39
+ import { M_SUN_KG } from './edges/calibration.js';
40
+ /** Union-find over quantity names; merges each edge's endpoints and every
41
+ * identification's from↔to. Returns name → component-root. */
42
+ function quantityComponents(edges, idents) {
43
+ const parent = new Map();
44
+ const find = (x) => {
45
+ if (!parent.has(x))
46
+ parent.set(x, x);
47
+ let r = x;
48
+ while (parent.get(r) !== r)
49
+ r = parent.get(r);
50
+ let cur = x;
51
+ while (parent.get(cur) !== r) {
52
+ const next = parent.get(cur);
53
+ parent.set(cur, r);
54
+ cur = next;
55
+ }
56
+ return r;
57
+ };
58
+ const union = (a, b) => {
59
+ parent.set(find(a), find(b));
60
+ };
61
+ for (const e of edges) {
62
+ const names = [...e.sources.map((s) => s.name), e.target.name];
63
+ for (let i = 1; i < names.length; i++)
64
+ union(names[0], names[i]);
65
+ }
66
+ for (const id of idents)
67
+ union(id.from, id.to);
68
+ const roots = new Map();
69
+ for (const name of parent.keys())
70
+ roots.set(name, find(name));
71
+ return roots;
72
+ }
73
+ const ANCHOR_DEFAULT = { mass: M_SUN_KG };
74
+ /**
75
+ * Vet one link candidate by hypothesizing the identification a≡b and
76
+ * measuring its structural and numerical consequences. See module docs.
77
+ *
78
+ * @internal
79
+ */
80
+ export function vetLinkCandidate(edges, candidate, opts = {}) {
81
+ const baseIdents = opts.identifications ?? QUANTITY_IDENTIFICATIONS;
82
+ const groundTruth = opts.groundTruth ?? ANCHOR_DEFAULT;
83
+ const anchor = Object.keys(groundTruth);
84
+ // The hypothesized identification, added in both directions so a≡b is a
85
+ // full merge (identifications are directional in the engine).
86
+ const rationale = `HYPOTHESIS (unadjudicated): ${candidate.a} ≡ ${candidate.b} — same dimension ${candidate.dim}`;
87
+ const hypothesis = [
88
+ { from: candidate.a, to: candidate.b, rationale },
89
+ { from: candidate.b, to: candidate.a, rationale },
90
+ ];
91
+ const withHyp = [...baseIdents, ...hypothesis];
92
+ // Structural: does a≡b merge two components?
93
+ const comps = quantityComponents(edges, baseIdents);
94
+ const mergesComponents = comps.has(candidate.a) &&
95
+ comps.has(candidate.b) &&
96
+ comps.get(candidate.a) !== comps.get(candidate.b);
97
+ // Closure unlock: forward closure from the anchor, with vs without.
98
+ const closureBase = forwardClosure(edges, anchor, baseIdents);
99
+ const closureHyp = forwardClosure(edges, anchor, withHyp);
100
+ const unlocksFromAnchor = [...closureHyp]
101
+ .filter((q) => !closureBase.has(q))
102
+ .sort();
103
+ // Numeric: retrodiction must stay all-consistent under the hypothesis.
104
+ const report = retrodict(edges, groundTruth, { identifications: withHyp });
105
+ const numericallyConsistent = report.allConsistent;
106
+ const inconsistentNodes = report.results
107
+ .filter((r) => r.outcome === 'inconsistent')
108
+ .map((r) => r.target)
109
+ .sort();
110
+ let verdict;
111
+ if (!numericallyConsistent)
112
+ verdict = 'contradictory';
113
+ else if (mergesComponents && unlocksFromAnchor.length > 0)
114
+ verdict = 'promising';
115
+ else
116
+ verdict = 'inert';
117
+ // Score: contradictory sinks to the bottom; otherwise reward structural
118
+ // merges, unlocks, and the proposer's weak priors.
119
+ let score = 0;
120
+ if (numericallyConsistent) {
121
+ score += mergesComponents ? 4 : 0;
122
+ score += Math.min(unlocksFromAnchor.length, 4);
123
+ score += candidate.touchesCore ? 1 : 0;
124
+ score += candidate.sameKind ? 1 : 0;
125
+ }
126
+ else {
127
+ score = -1;
128
+ }
129
+ return {
130
+ a: candidate.a,
131
+ b: candidate.b,
132
+ dim: candidate.dim,
133
+ touchesCore: candidate.touchesCore,
134
+ sameKind: candidate.sameKind,
135
+ mergesComponents,
136
+ unlocksFromAnchor,
137
+ numericallyConsistent,
138
+ inconsistentNodes,
139
+ verdict,
140
+ score,
141
+ };
142
+ }
143
+ /**
144
+ * Run the full discovery funnel: propose cross-cluster candidates, vet each
145
+ * against the inference suite, and rank — `promising` first, then by score.
146
+ * The output is the physicist's worklist (vetted, provenance-traced), not a
147
+ * list of discoveries.
148
+ *
149
+ * @internal
150
+ */
151
+ export function rankDiscoveries(edges, opts = {}) {
152
+ const VERDICT_RANK = {
153
+ promising: 0,
154
+ inert: 1,
155
+ contradictory: 2,
156
+ };
157
+ const candidates = proposeLinkCandidates(edges);
158
+ const vetted = candidates.map((c) => vetLinkCandidate(edges, c, opts));
159
+ vetted.sort((x, y) => VERDICT_RANK[x.verdict] - VERDICT_RANK[y.verdict] ||
160
+ y.score - x.score ||
161
+ x.a.localeCompare(y.a) ||
162
+ x.b.localeCompare(y.b));
163
+ return vetted;
164
+ }
165
+ //# sourceMappingURL=discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/composition/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAsDlD;+DAC+D;AAC/D,SAAS,kBAAkB,CACzB,KAA4B,EAC5B,MAAyC;IAEzC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE;QACjC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;YAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC;QAC/C,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,MAAM,CAA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CAAC,CAAC;QACd,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,gBAAgB;QAChB,iBAAiB;QACjB,qBAAqB;QACrB,iBAAiB;QACjB,OAAO;QACP,KAAK;KACN,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,KAA4B,EAC5B,OAAyB,EAAE;IAE3B,MAAM,YAAY,GAA+C;QAC/D,SAAS,EAAE,CAAC;QACZ,KAAK,EAAE,CAAC;QACR,aAAa,EAAE,CAAC;KACjB,CAAC;IACF,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IACvE,MAAM,CAAC,IAAI,CACT,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC;QACjD,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QACjB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Composition graph — edges (bridges and laws) + validity domains
3
+ * (v0.8.0 T1+T2+T3, per docs/planning/v0.8.0-Design.md §3).
4
+ *
5
+ * A `BridgeEdge` is an edge in the composition graph: n-ary source
6
+ * quantities → one target quantity, carrying a closed-form evaluator,
7
+ * a first-class validity domain (G-8), a confidence grade, and a
8
+ * literature citation. `kind: 'law'` marks diagonal-law edges (P-1) —
9
+ * edges whose endpoints share regime attributes, serving as the
10
+ * connective tissue composition chains pass through.
11
+ *
12
+ * @module composition/edge
13
+ */
14
+ import type { Quantity } from './quantity.js';
15
+ import type { ExprNode } from '../dimensional/validator.js';
16
+ /**
17
+ * First-class validity domain (v0.8.0 G-8). The predicate receives the
18
+ * same keyed inputs as `evaluate` and returns whether the edge's
19
+ * formula applies there (e.g. weak-field, positive mass, bound orbit).
20
+ *
21
+ * @public
22
+ */
23
+ export interface ValidityDomain {
24
+ /** Human-readable statement, e.g. 'M > 0 and b ≫ r_s (weak field)'. */
25
+ readonly description: string;
26
+ /** Machine-checkable form of the same statement. */
27
+ readonly predicate: (inputs: Record<string, number>) => boolean;
28
+ }
29
+ /**
30
+ * Confidence grade — mirrors the catalog's status taxonomy. Composition
31
+ * demotes via {@link minConfidence}; it never promotes.
32
+ *
33
+ * @public
34
+ */
35
+ export type EdgeConfidence = 'established' | 'speculative' | 'highly-speculative';
36
+ /**
37
+ * An edge in the composition graph.
38
+ *
39
+ * `evaluate` is keyed by source-quantity `name`s. For catalog-backed
40
+ * edges, `beId` cross-references `BRIDGE_EQUATIONS`; diagonal-law
41
+ * edges have `beId: null` (BE-1–10 are not individually catalogued).
42
+ *
43
+ * @public
44
+ */
45
+ export interface BridgeEdge {
46
+ /** Graph id, e.g. 'be-42', 'law-schwarzschild-radius'. */
47
+ readonly id: string;
48
+ /** Catalog cross-reference; null for diagonal laws. */
49
+ readonly beId: number | null;
50
+ /** Bridge (endpoints differ in regime) vs law (endpoints share regime). */
51
+ readonly kind: 'bridge' | 'law';
52
+ /** Human-readable label. */
53
+ readonly label: string;
54
+ /** Input quantities (n-ary). */
55
+ readonly sources: readonly Quantity[];
56
+ /** Output quantity. */
57
+ readonly target: Quantity;
58
+ readonly confidence: EdgeConfidence;
59
+ readonly domain: ValidityDomain;
60
+ /** Closed-form evaluator; keys are source-quantity names. */
61
+ readonly evaluate: (inputs: Record<string, number>) => number;
62
+ /**
63
+ * OPTIONAL symbolic form of the target (v0.12 symbolic composition): an
64
+ * `ExprNode` whose leaf symbols are EITHER this edge's source-quantity
65
+ * NAMES (graph vocabulary, e.g. `'mass'`) or registered constant symbols
66
+ * (`hbar`, `c`, `G`, `k_B`, `8pi`, `ln2`, …). When present, `composeSymbolic`
67
+ * can thread it through a junction by AST substitution; a drift-guard test
68
+ * binds it to `evaluate`. Absent on numeric-only edges (the default).
69
+ */
70
+ readonly symbolic?: ExprNode;
71
+ readonly citation: string;
72
+ /**
73
+ * Provenance: the quantity identification the junction used, when a
74
+ * composed edge was formed via `QUANTITY_IDENTIFICATIONS` rather than
75
+ * a name match. Absent on primitive edges and name-matched
76
+ * compositions. (v0.8.0 punch-list: surfaced from the previously
77
+ * unused `findJunction` return.)
78
+ */
79
+ readonly identificationUsed?: {
80
+ readonly from: string;
81
+ readonly to: string;
82
+ readonly rationale: string;
83
+ readonly citation?: string;
84
+ };
85
+ /**
86
+ * Provenance: alias dispositions consumed at composition (v0.11
87
+ * Option D) — which duplicate-name collisions were resolved, and how.
88
+ */
89
+ readonly aliasDispositionsUsed?: ReadonlyArray<{
90
+ readonly name: string;
91
+ readonly treatAs: 'shared' | {
92
+ readonly renameSecond: string;
93
+ };
94
+ readonly rationale: string;
95
+ readonly citation?: string;
96
+ }>;
97
+ }
98
+ /** Composition failed: no junction quantity matched. @public */
99
+ export declare class CompositionJunctionError extends Error {
100
+ constructor(message: string);
101
+ }
102
+ /** Composition failed: junction dimensions are not exactly equal. @public */
103
+ export declare class CompositionDimensionError extends Error {
104
+ constructor(message: string);
105
+ }
106
+ /**
107
+ * Evaluation refused: inputs fall outside an edge's validity domain.
108
+ *
109
+ * Honest deviation from design D-3's "domain-incompatible at compose
110
+ * time": domain predicates are opaque functions, so incompatibility is
111
+ * detectable only at evaluation — this error is thrown by
112
+ * {@link evaluateEdge} (and by composed edges internally), not by
113
+ * `composeEdges`.
114
+ *
115
+ * @public
116
+ */
117
+ export declare class DomainViolationError extends Error {
118
+ constructor(message: string);
119
+ }
120
+ /**
121
+ * Composition refused: the composed sources would contain a duplicate
122
+ * quantity NAME across operands without a recorded disposition (v0.11
123
+ * namespacing gate, Option D — pure name-collision rule per the Adam
124
+ * vet A-1: object identity cannot distinguish wrong-physics aliasing
125
+ * from deliberate sharing).
126
+ *
127
+ * @public
128
+ */
129
+ export declare class CompositionAliasError extends Error {
130
+ constructor(message: string);
131
+ }
132
+ /**
133
+ * Domain-checked evaluation: throws {@link DomainViolationError} when
134
+ * `inputs` violate `edge.domain`, otherwise returns `edge.evaluate`.
135
+ *
136
+ * @public
137
+ */
138
+ export declare function evaluateEdge(edge: BridgeEdge, inputs: Record<string, number>): number;
139
+ //# sourceMappingURL=edge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/composition/edge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC;CACjE;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,aAAa,GACb,oBAAoB,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ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6E;AAC7E,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,MAAM,CAOR"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Composition graph — edges (bridges and laws) + validity domains
3
+ * (v0.8.0 T1+T2+T3, per docs/planning/v0.8.0-Design.md §3).
4
+ *
5
+ * A `BridgeEdge` is an edge in the composition graph: n-ary source
6
+ * quantities → one target quantity, carrying a closed-form evaluator,
7
+ * a first-class validity domain (G-8), a confidence grade, and a
8
+ * literature citation. `kind: 'law'` marks diagonal-law edges (P-1) —
9
+ * edges whose endpoints share regime attributes, serving as the
10
+ * connective tissue composition chains pass through.
11
+ *
12
+ * @module composition/edge
13
+ */
14
+ /** Composition failed: no junction quantity matched. @public */
15
+ export class CompositionJunctionError extends Error {
16
+ constructor(message) {
17
+ super(message);
18
+ this.name = 'CompositionJunctionError';
19
+ }
20
+ }
21
+ /** Composition failed: junction dimensions are not exactly equal. @public */
22
+ export class CompositionDimensionError extends Error {
23
+ constructor(message) {
24
+ super(message);
25
+ this.name = 'CompositionDimensionError';
26
+ }
27
+ }
28
+ /**
29
+ * Evaluation refused: inputs fall outside an edge's validity domain.
30
+ *
31
+ * Honest deviation from design D-3's "domain-incompatible at compose
32
+ * time": domain predicates are opaque functions, so incompatibility is
33
+ * detectable only at evaluation — this error is thrown by
34
+ * {@link evaluateEdge} (and by composed edges internally), not by
35
+ * `composeEdges`.
36
+ *
37
+ * @public
38
+ */
39
+ export class DomainViolationError extends Error {
40
+ constructor(message) {
41
+ super(message);
42
+ this.name = 'DomainViolationError';
43
+ }
44
+ }
45
+ /**
46
+ * Composition refused: the composed sources would contain a duplicate
47
+ * quantity NAME across operands without a recorded disposition (v0.11
48
+ * namespacing gate, Option D — pure name-collision rule per the Adam
49
+ * vet A-1: object identity cannot distinguish wrong-physics aliasing
50
+ * from deliberate sharing).
51
+ *
52
+ * @public
53
+ */
54
+ export class CompositionAliasError extends Error {
55
+ constructor(message) {
56
+ super(message);
57
+ this.name = 'CompositionAliasError';
58
+ }
59
+ }
60
+ /**
61
+ * Domain-checked evaluation: throws {@link DomainViolationError} when
62
+ * `inputs` violate `edge.domain`, otherwise returns `edge.evaluate`.
63
+ *
64
+ * @public
65
+ */
66
+ export function evaluateEdge(edge, inputs) {
67
+ if (!edge.domain.predicate(inputs)) {
68
+ throw new DomainViolationError(`${edge.id}: inputs violate validity domain (${edge.domain.description})`);
69
+ }
70
+ return edge.evaluate(inputs);
71
+ }
72
+ //# sourceMappingURL=edge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge.js","sourceRoot":"","sources":["../../src/composition/edge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA2FH,gEAAgE;AAChE,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED,6EAA6E;AAC7E,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAgB,EAChB,MAA8B;IAE9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,oBAAoB,CAC5B,GAAG,IAAI,CAAC,EAAE,qCAAqC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,CAC1E,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}