universal-physics-tensor 0.5.1 → 0.7.1

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 (378) hide show
  1. package/README.md +66 -105
  2. package/dist/bridges/catalog-adapter.d.ts +116 -0
  3. package/dist/bridges/catalog-adapter.d.ts.map +1 -0
  4. package/dist/bridges/catalog-adapter.js +302 -0
  5. package/dist/bridges/catalog-adapter.js.map +1 -0
  6. package/dist/bridges/equations/_be-helpers.d.ts +145 -0
  7. package/dist/bridges/equations/_be-helpers.d.ts.map +1 -0
  8. package/dist/bridges/equations/_be-helpers.js +179 -0
  9. package/dist/bridges/equations/_be-helpers.js.map +1 -0
  10. package/dist/bridges/equations/be-11-decoherence-master.d.ts +1 -2
  11. package/dist/bridges/equations/be-11-decoherence-master.d.ts.map +1 -1
  12. package/dist/bridges/equations/be-11-decoherence-master.js +9 -20
  13. package/dist/bridges/equations/be-11-decoherence-master.js.map +1 -1
  14. package/dist/bridges/equations/be-12-coherence-length.d.ts +7 -1
  15. package/dist/bridges/equations/be-12-coherence-length.d.ts.map +1 -1
  16. package/dist/bridges/equations/be-12-coherence-length.js +8 -16
  17. package/dist/bridges/equations/be-12-coherence-length.js.map +1 -1
  18. package/dist/bridges/equations/be-13-einstein-trace.d.ts +51 -3
  19. package/dist/bridges/equations/be-13-einstein-trace.d.ts.map +1 -1
  20. package/dist/bridges/equations/be-13-einstein-trace.js +74 -17
  21. package/dist/bridges/equations/be-13-einstein-trace.js.map +1 -1
  22. package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts +10 -4
  23. package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts.map +1 -1
  24. package/dist/bridges/equations/be-14-ryu-takayanagi.js +6 -17
  25. package/dist/bridges/equations/be-14-ryu-takayanagi.js.map +1 -1
  26. package/dist/bridges/equations/be-15-emergence.d.ts +7 -1
  27. package/dist/bridges/equations/be-15-emergence.d.ts.map +1 -1
  28. package/dist/bridges/equations/be-15-emergence.js +12 -22
  29. package/dist/bridges/equations/be-15-emergence.js.map +1 -1
  30. package/dist/bridges/equations/be-16-landauer.d.ts +7 -1
  31. package/dist/bridges/equations/be-16-landauer.d.ts.map +1 -1
  32. package/dist/bridges/equations/be-16-landauer.js +5 -13
  33. package/dist/bridges/equations/be-16-landauer.js.map +1 -1
  34. package/dist/bridges/equations/be-17-einstein-cartan.d.ts +26 -13
  35. package/dist/bridges/equations/be-17-einstein-cartan.d.ts.map +1 -1
  36. package/dist/bridges/equations/be-17-einstein-cartan.js +28 -31
  37. package/dist/bridges/equations/be-17-einstein-cartan.js.map +1 -1
  38. package/dist/bridges/equations/be-18-higgs-mass.d.ts +7 -1
  39. package/dist/bridges/equations/be-18-higgs-mass.d.ts.map +1 -1
  40. package/dist/bridges/equations/be-18-higgs-mass.js +5 -16
  41. package/dist/bridges/equations/be-18-higgs-mass.js.map +1 -1
  42. package/dist/bridges/equations/be-19-quantum-bounce.d.ts +38 -3
  43. package/dist/bridges/equations/be-19-quantum-bounce.d.ts.map +1 -1
  44. package/dist/bridges/equations/be-19-quantum-bounce.js +69 -20
  45. package/dist/bridges/equations/be-19-quantum-bounce.js.map +1 -1
  46. package/dist/bridges/equations/be-20-vacuum-energy.d.ts +20 -1
  47. package/dist/bridges/equations/be-20-vacuum-energy.d.ts.map +1 -1
  48. package/dist/bridges/equations/be-20-vacuum-energy.js +36 -15
  49. package/dist/bridges/equations/be-20-vacuum-energy.js.map +1 -1
  50. package/dist/bridges/equations/be-21-kss-bound.d.ts +2 -0
  51. package/dist/bridges/equations/be-21-kss-bound.d.ts.map +1 -1
  52. package/dist/bridges/equations/be-21-kss-bound.js +4 -10
  53. package/dist/bridges/equations/be-21-kss-bound.js.map +1 -1
  54. package/dist/bridges/equations/be-22-topological-entanglement.d.ts +6 -9
  55. package/dist/bridges/equations/be-22-topological-entanglement.d.ts.map +1 -1
  56. package/dist/bridges/equations/be-22-topological-entanglement.js +9 -21
  57. package/dist/bridges/equations/be-22-topological-entanglement.js.map +1 -1
  58. package/dist/bridges/equations/be-23-syk-planckian.d.ts +7 -1
  59. package/dist/bridges/equations/be-23-syk-planckian.d.ts.map +1 -1
  60. package/dist/bridges/equations/be-23-syk-planckian.js +11 -25
  61. package/dist/bridges/equations/be-23-syk-planckian.js.map +1 -1
  62. package/dist/bridges/equations/be-24-foerster-fret.d.ts +7 -1
  63. package/dist/bridges/equations/be-24-foerster-fret.d.ts.map +1 -1
  64. package/dist/bridges/equations/be-24-foerster-fret.js +8 -16
  65. package/dist/bridges/equations/be-24-foerster-fret.js.map +1 -1
  66. package/dist/bridges/equations/be-25-iit-phi.d.ts +7 -1
  67. package/dist/bridges/equations/be-25-iit-phi.d.ts.map +1 -1
  68. package/dist/bridges/equations/be-25-iit-phi.js +12 -16
  69. package/dist/bridges/equations/be-25-iit-phi.js.map +1 -1
  70. package/dist/bridges/equations/be-25-orch-or.d.ts +6 -3
  71. package/dist/bridges/equations/be-25-orch-or.d.ts.map +1 -1
  72. package/dist/bridges/equations/be-25-orch-or.js +8 -17
  73. package/dist/bridges/equations/be-25-orch-or.js.map +1 -1
  74. package/dist/bridges/equations/be-26-dna-tunneling.d.ts +6 -3
  75. package/dist/bridges/equations/be-26-dna-tunneling.d.ts.map +1 -1
  76. package/dist/bridges/equations/be-26-dna-tunneling.js +11 -26
  77. package/dist/bridges/equations/be-26-dna-tunneling.js.map +1 -1
  78. package/dist/bridges/equations/be-27-effective-temperature.d.ts +7 -1
  79. package/dist/bridges/equations/be-27-effective-temperature.d.ts.map +1 -1
  80. package/dist/bridges/equations/be-27-effective-temperature.js +8 -16
  81. package/dist/bridges/equations/be-27-effective-temperature.js.map +1 -1
  82. package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts +7 -1
  83. package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts.map +1 -1
  84. package/dist/bridges/equations/be-28-onsager-entropy-production.js +9 -13
  85. package/dist/bridges/equations/be-28-onsager-entropy-production.js.map +1 -1
  86. package/dist/bridges/equations/be-29-jarzynski.d.ts +7 -1
  87. package/dist/bridges/equations/be-29-jarzynski.d.ts.map +1 -1
  88. package/dist/bridges/equations/be-29-jarzynski.js +8 -13
  89. package/dist/bridges/equations/be-29-jarzynski.js.map +1 -1
  90. package/dist/bridges/equations/be-30-flm-first-law.d.ts +11 -2
  91. package/dist/bridges/equations/be-30-flm-first-law.d.ts.map +1 -1
  92. package/dist/bridges/equations/be-30-flm-first-law.js +10 -21
  93. package/dist/bridges/equations/be-30-flm-first-law.js.map +1 -1
  94. package/dist/bridges/equations/be-31-causal-set-bd.d.ts +7 -1
  95. package/dist/bridges/equations/be-31-causal-set-bd.d.ts.map +1 -1
  96. package/dist/bridges/equations/be-31-causal-set-bd.js +11 -25
  97. package/dist/bridges/equations/be-31-causal-set-bd.js.map +1 -1
  98. package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts +6 -9
  99. package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts.map +1 -1
  100. package/dist/bridges/equations/be-32-quantum-reference-frame.js +8 -18
  101. package/dist/bridges/equations/be-32-quantum-reference-frame.js.map +1 -1
  102. package/dist/bridges/equations/be-33-hertz-millis.d.ts +53 -28
  103. package/dist/bridges/equations/be-33-hertz-millis.d.ts.map +1 -1
  104. package/dist/bridges/equations/be-33-hertz-millis.js +55 -51
  105. package/dist/bridges/equations/be-33-hertz-millis.js.map +1 -1
  106. package/dist/bridges/equations/be-34-kibble-zurek.d.ts +6 -3
  107. package/dist/bridges/equations/be-34-kibble-zurek.d.ts.map +1 -1
  108. package/dist/bridges/equations/be-34-kibble-zurek.js +15 -26
  109. package/dist/bridges/equations/be-34-kibble-zurek.js.map +1 -1
  110. package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts +6 -9
  111. package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts.map +1 -1
  112. package/dist/bridges/equations/be-35-conformal-bootstrap.js +9 -21
  113. package/dist/bridges/equations/be-35-conformal-bootstrap.js.map +1 -1
  114. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts +7 -1
  115. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts.map +1 -1
  116. package/dist/bridges/equations/be-36-gw-speed-bound.js +5 -13
  117. package/dist/bridges/equations/be-36-gw-speed-bound.js.map +1 -1
  118. package/dist/bridges/equations/be-37-shapiro-delay.d.ts +4 -2
  119. package/dist/bridges/equations/be-37-shapiro-delay.d.ts.map +1 -1
  120. package/dist/bridges/equations/be-37-shapiro-delay.js +15 -28
  121. package/dist/bridges/equations/be-37-shapiro-delay.js.map +1 -1
  122. package/dist/bridges/equations/be-38-mond.d.ts +7 -1
  123. package/dist/bridges/equations/be-38-mond.d.ts.map +1 -1
  124. package/dist/bridges/equations/be-38-mond.js +9 -19
  125. package/dist/bridges/equations/be-38-mond.js.map +1 -1
  126. package/dist/bridges/equations/be-39-asymptotic-safety.d.ts +66 -2
  127. package/dist/bridges/equations/be-39-asymptotic-safety.d.ts.map +1 -1
  128. package/dist/bridges/equations/be-39-asymptotic-safety.js +128 -20
  129. package/dist/bridges/equations/be-39-asymptotic-safety.js.map +1 -1
  130. package/dist/bridges/equations/be-40-composite-higgs.d.ts +7 -1
  131. package/dist/bridges/equations/be-40-composite-higgs.d.ts.map +1 -1
  132. package/dist/bridges/equations/be-40-composite-higgs.js +10 -22
  133. package/dist/bridges/equations/be-40-composite-higgs.js.map +1 -1
  134. package/dist/bridges/equations/be-41-swampland.d.ts +6 -3
  135. package/dist/bridges/equations/be-41-swampland.d.ts.map +1 -1
  136. package/dist/bridges/equations/be-41-swampland.js +11 -23
  137. package/dist/bridges/equations/be-41-swampland.js.map +1 -1
  138. package/dist/bridges/equations/be-42-hawking-temperature.d.ts +2 -0
  139. package/dist/bridges/equations/be-42-hawking-temperature.d.ts.map +1 -1
  140. package/dist/bridges/equations/be-42-hawking-temperature.js +5 -13
  141. package/dist/bridges/equations/be-42-hawking-temperature.js.map +1 -1
  142. package/dist/bridges/equations/be-43-er-epr.d.ts +7 -1
  143. package/dist/bridges/equations/be-43-er-epr.d.ts.map +1 -1
  144. package/dist/bridges/equations/be-43-er-epr.js +5 -13
  145. package/dist/bridges/equations/be-43-er-epr.js.map +1 -1
  146. package/dist/bridges/equations/be-44-soft-hair.d.ts +7 -1
  147. package/dist/bridges/equations/be-44-soft-hair.d.ts.map +1 -1
  148. package/dist/bridges/equations/be-44-soft-hair.js +5 -13
  149. package/dist/bridges/equations/be-44-soft-hair.js.map +1 -1
  150. package/dist/bridges/equations/be-45-tcc.d.ts +7 -1
  151. package/dist/bridges/equations/be-45-tcc.d.ts.map +1 -1
  152. package/dist/bridges/equations/be-45-tcc.js +10 -22
  153. package/dist/bridges/equations/be-45-tcc.js.map +1 -1
  154. package/dist/bridges/equations/be-46-multiverse-measure.d.ts +7 -1
  155. package/dist/bridges/equations/be-46-multiverse-measure.d.ts.map +1 -1
  156. package/dist/bridges/equations/be-46-multiverse-measure.js +9 -19
  157. package/dist/bridges/equations/be-46-multiverse-measure.js.map +1 -1
  158. package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts +7 -1
  159. package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts.map +1 -1
  160. package/dist/bridges/equations/be-47-bbn-dark-sector.js +14 -16
  161. package/dist/bridges/equations/be-47-bbn-dark-sector.js.map +1 -1
  162. package/dist/bridges/equations/be-48-grw-localization.d.ts +7 -1
  163. package/dist/bridges/equations/be-48-grw-localization.d.ts.map +1 -1
  164. package/dist/bridges/equations/be-48-grw-localization.js +15 -20
  165. package/dist/bridges/equations/be-48-grw-localization.js.map +1 -1
  166. package/dist/bridges/equations/be-49-quantum-darwinism.d.ts +7 -1
  167. package/dist/bridges/equations/be-49-quantum-darwinism.d.ts.map +1 -1
  168. package/dist/bridges/equations/be-49-quantum-darwinism.js +10 -22
  169. package/dist/bridges/equations/be-49-quantum-darwinism.js.map +1 -1
  170. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts +42 -12
  171. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts.map +1 -1
  172. package/dist/bridges/equations/be-50-wheeler-feynman.js +84 -20
  173. package/dist/bridges/equations/be-50-wheeler-feynman.js.map +1 -1
  174. package/dist/bridges/equations/be-53-yang-mills-beta.d.ts +158 -0
  175. package/dist/bridges/equations/be-53-yang-mills-beta.d.ts.map +1 -0
  176. package/dist/bridges/equations/be-53-yang-mills-beta.js +175 -0
  177. package/dist/bridges/equations/be-53-yang-mills-beta.js.map +1 -0
  178. package/dist/bridges/equations/be-54-randall-sundrum-brane.d.ts +117 -0
  179. package/dist/bridges/equations/be-54-randall-sundrum-brane.d.ts.map +1 -0
  180. package/dist/bridges/equations/be-54-randall-sundrum-brane.js +213 -0
  181. package/dist/bridges/equations/be-54-randall-sundrum-brane.js.map +1 -0
  182. package/dist/bridges/index.d.ts +40 -1
  183. package/dist/bridges/index.d.ts.map +1 -1
  184. package/dist/bridges/index.js +130 -48
  185. package/dist/bridges/index.js.map +1 -1
  186. package/dist/bridges/perihelion-precession-labeled.d.ts +46 -0
  187. package/dist/bridges/perihelion-precession-labeled.d.ts.map +1 -0
  188. package/dist/bridges/perihelion-precession-labeled.js +54 -0
  189. package/dist/bridges/perihelion-precession-labeled.js.map +1 -0
  190. package/dist/core/axes-registry.d.ts +67 -0
  191. package/dist/core/axes-registry.d.ts.map +1 -0
  192. package/dist/core/axes-registry.js +75 -0
  193. package/dist/core/axes-registry.js.map +1 -0
  194. package/dist/core/cell.d.ts +176 -0
  195. package/dist/core/cell.d.ts.map +1 -0
  196. package/dist/core/cell.js +166 -0
  197. package/dist/core/cell.js.map +1 -0
  198. package/dist/core/flux-rules.d.ts +176 -0
  199. package/dist/core/flux-rules.d.ts.map +1 -0
  200. package/dist/core/flux-rules.js +329 -0
  201. package/dist/core/flux-rules.js.map +1 -0
  202. package/dist/core/labeled-tensor.d.ts +143 -0
  203. package/dist/core/labeled-tensor.d.ts.map +1 -0
  204. package/dist/core/labeled-tensor.js +275 -0
  205. package/dist/core/labeled-tensor.js.map +1 -0
  206. package/dist/core/regime-registry.d.ts +169 -0
  207. package/dist/core/regime-registry.d.ts.map +1 -0
  208. package/dist/core/regime-registry.js +174 -0
  209. package/dist/core/regime-registry.js.map +1 -0
  210. package/dist/core/regime-rule-install.d.ts +26 -0
  211. package/dist/core/regime-rule-install.d.ts.map +1 -0
  212. package/dist/core/regime-rule-install.js +90 -0
  213. package/dist/core/regime-rule-install.js.map +1 -0
  214. package/dist/core/regimes-builtins.d.ts +22 -0
  215. package/dist/core/regimes-builtins.d.ts.map +1 -0
  216. package/dist/core/regimes-builtins.js +96 -0
  217. package/dist/core/regimes-builtins.js.map +1 -0
  218. package/dist/core/tensor.d.ts +112 -0
  219. package/dist/core/tensor.d.ts.map +1 -1
  220. package/dist/core/tensor.js +366 -0
  221. package/dist/core/tensor.js.map +1 -1
  222. package/dist/core/types.d.ts +7 -2
  223. package/dist/core/types.d.ts.map +1 -1
  224. package/dist/core/types.js.map +1 -1
  225. package/dist/core/universal-index.d.ts +97 -0
  226. package/dist/core/universal-index.d.ts.map +1 -0
  227. package/dist/core/universal-index.js +70 -0
  228. package/dist/core/universal-index.js.map +1 -0
  229. package/dist/diff/bridge-gradient.d.ts +94 -0
  230. package/dist/diff/bridge-gradient.d.ts.map +1 -0
  231. package/dist/diff/bridge-gradient.js +83 -0
  232. package/dist/diff/bridge-gradient.js.map +1 -0
  233. package/dist/diff/bridge-specs.d.ts +68 -0
  234. package/dist/diff/bridge-specs.d.ts.map +1 -0
  235. package/dist/diff/bridge-specs.js +96 -0
  236. package/dist/diff/bridge-specs.js.map +1 -0
  237. package/dist/dimensional/bridge-check.d.ts.map +1 -1
  238. package/dist/dimensional/bridge-check.js +8 -0
  239. package/dist/dimensional/bridge-check.js.map +1 -1
  240. package/dist/dimensional/connection-validators.d.ts +12 -5
  241. package/dist/dimensional/connection-validators.d.ts.map +1 -1
  242. package/dist/dimensional/connection-validators.js.map +1 -1
  243. package/dist/dimensional/curvature-composite.d.ts +90 -0
  244. package/dist/dimensional/curvature-composite.d.ts.map +1 -0
  245. package/dist/dimensional/curvature-composite.js +57 -0
  246. package/dist/dimensional/curvature-composite.js.map +1 -0
  247. package/dist/dimensional/curvature-invariants.d.ts +90 -0
  248. package/dist/dimensional/curvature-invariants.d.ts.map +1 -0
  249. package/dist/dimensional/curvature-invariants.js +64 -0
  250. package/dist/dimensional/curvature-invariants.js.map +1 -0
  251. package/dist/dimensional/curvature.d.ts +46 -30
  252. package/dist/dimensional/curvature.d.ts.map +1 -1
  253. package/dist/dimensional/curvature.js.map +1 -1
  254. package/dist/dimensional/einstein-equation.d.ts +126 -0
  255. package/dist/dimensional/einstein-equation.d.ts.map +1 -0
  256. package/dist/dimensional/einstein-equation.js +122 -0
  257. package/dist/dimensional/einstein-equation.js.map +1 -0
  258. package/dist/dimensional/field-equation-helpers.d.ts +82 -0
  259. package/dist/dimensional/field-equation-helpers.d.ts.map +1 -0
  260. package/dist/dimensional/field-equation-helpers.js +123 -0
  261. package/dist/dimensional/field-equation-helpers.js.map +1 -0
  262. package/dist/dimensional/friedmann-equation.d.ts +148 -0
  263. package/dist/dimensional/friedmann-equation.d.ts.map +1 -0
  264. package/dist/dimensional/friedmann-equation.js +150 -0
  265. package/dist/dimensional/friedmann-equation.js.map +1 -0
  266. package/dist/dimensional/gauge-field.d.ts +182 -0
  267. package/dist/dimensional/gauge-field.d.ts.map +1 -0
  268. package/dist/dimensional/gauge-field.js +134 -0
  269. package/dist/dimensional/gauge-field.js.map +1 -0
  270. package/dist/dimensional/killing-validators.d.ts +94 -0
  271. package/dist/dimensional/killing-validators.d.ts.map +1 -0
  272. package/dist/dimensional/killing-validators.js +66 -0
  273. package/dist/dimensional/killing-validators.js.map +1 -0
  274. package/dist/dimensional/klein-gordon-equation.d.ts +113 -0
  275. package/dist/dimensional/klein-gordon-equation.d.ts.map +1 -0
  276. package/dist/dimensional/klein-gordon-equation.js +98 -0
  277. package/dist/dimensional/klein-gordon-equation.js.map +1 -0
  278. package/dist/dimensional/rg-flow.d.ts +156 -0
  279. package/dist/dimensional/rg-flow.d.ts.map +1 -0
  280. package/dist/dimensional/rg-flow.js +150 -0
  281. package/dist/dimensional/rg-flow.js.map +1 -0
  282. package/dist/dimensional/stress-energy-validators.d.ts +74 -0
  283. package/dist/dimensional/stress-energy-validators.d.ts.map +1 -0
  284. package/dist/dimensional/stress-energy-validators.js +47 -0
  285. package/dist/dimensional/stress-energy-validators.js.map +1 -0
  286. package/dist/dimensional/tensor-trace.d.ts +128 -0
  287. package/dist/dimensional/tensor-trace.d.ts.map +1 -0
  288. package/dist/dimensional/tensor-trace.js +95 -0
  289. package/dist/dimensional/tensor-trace.js.map +1 -0
  290. package/dist/dimensional/tensor.d.ts +6 -8
  291. package/dist/dimensional/tensor.d.ts.map +1 -1
  292. package/dist/dimensional/tensor.js +3 -1
  293. package/dist/dimensional/tensor.js.map +1 -1
  294. package/dist/dimensional/validator-registry.d.ts +90 -0
  295. package/dist/dimensional/validator-registry.d.ts.map +1 -0
  296. package/dist/dimensional/validator-registry.js +131 -0
  297. package/dist/dimensional/validator-registry.js.map +1 -0
  298. package/dist/dimensional/validator.d.ts +12 -2
  299. package/dist/dimensional/validator.d.ts.map +1 -1
  300. package/dist/dimensional/validator.js +60 -75
  301. package/dist/dimensional/validator.js.map +1 -1
  302. package/dist/dimensional/weyl-validators.d.ts +84 -0
  303. package/dist/dimensional/weyl-validators.d.ts.map +1 -0
  304. package/dist/dimensional/weyl-validators.js +84 -0
  305. package/dist/dimensional/weyl-validators.js.map +1 -0
  306. package/dist/index.d.ts +37 -0
  307. package/dist/index.d.ts.map +1 -1
  308. package/dist/index.js +41 -0
  309. package/dist/index.js.map +1 -1
  310. package/dist/numerical/be37-covariant-eikonal.d.ts +19 -0
  311. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
  312. package/dist/numerical/be37-covariant-eikonal.js +29 -9
  313. package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
  314. package/dist/numerical/christoffel-flat.d.ts +49 -0
  315. package/dist/numerical/christoffel-flat.d.ts.map +1 -0
  316. package/dist/numerical/christoffel-flat.js +86 -0
  317. package/dist/numerical/christoffel-flat.js.map +1 -0
  318. package/dist/numerical/curvature-lowering-helpers.d.ts +49 -57
  319. package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
  320. package/dist/numerical/curvature-lowering-helpers.js +109 -4
  321. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  322. package/dist/numerical/derivative-lowering.d.ts +67 -0
  323. package/dist/numerical/derivative-lowering.d.ts.map +1 -0
  324. package/dist/numerical/derivative-lowering.js +243 -0
  325. package/dist/numerical/derivative-lowering.js.map +1 -0
  326. package/dist/numerical/einstein-equation.d.ts +106 -0
  327. package/dist/numerical/einstein-equation.d.ts.map +1 -0
  328. package/dist/numerical/einstein-equation.js +172 -0
  329. package/dist/numerical/einstein-equation.js.map +1 -0
  330. package/dist/numerical/geodesic-integrator.d.ts +7 -4
  331. package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
  332. package/dist/numerical/geodesic-integrator.js +5 -1
  333. package/dist/numerical/geodesic-integrator.js.map +1 -1
  334. package/dist/numerical/gl4-integrator.d.ts +4 -2
  335. package/dist/numerical/gl4-integrator.d.ts.map +1 -1
  336. package/dist/numerical/gl4-integrator.js +24 -8
  337. package/dist/numerical/gl4-integrator.js.map +1 -1
  338. package/dist/numerical/killing.d.ts +157 -0
  339. package/dist/numerical/killing.d.ts.map +1 -0
  340. package/dist/numerical/killing.js +242 -0
  341. package/dist/numerical/killing.js.map +1 -0
  342. package/dist/numerical/kretschmann.d.ts +62 -0
  343. package/dist/numerical/kretschmann.d.ts.map +1 -0
  344. package/dist/numerical/kretschmann.js +88 -0
  345. package/dist/numerical/kretschmann.js.map +1 -0
  346. package/dist/numerical/lowering-utils.d.ts +47 -0
  347. package/dist/numerical/lowering-utils.d.ts.map +1 -0
  348. package/dist/numerical/lowering-utils.js +64 -0
  349. package/dist/numerical/lowering-utils.js.map +1 -0
  350. package/dist/numerical/lowering.d.ts +1 -29
  351. package/dist/numerical/lowering.d.ts.map +1 -1
  352. package/dist/numerical/lowering.js +219 -415
  353. package/dist/numerical/lowering.js.map +1 -1
  354. package/dist/numerical/null-ic.d.ts +40 -0
  355. package/dist/numerical/null-ic.d.ts.map +1 -0
  356. package/dist/numerical/null-ic.js +50 -0
  357. package/dist/numerical/null-ic.js.map +1 -0
  358. package/dist/numerical/null-ray-integrator.d.ts +3 -2
  359. package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
  360. package/dist/numerical/painleve-gullstrand-metric.d.ts +74 -0
  361. package/dist/numerical/painleve-gullstrand-metric.d.ts.map +1 -0
  362. package/dist/numerical/painleve-gullstrand-metric.js +121 -0
  363. package/dist/numerical/painleve-gullstrand-metric.js.map +1 -0
  364. package/dist/numerical/pderiv.d.ts +17 -9
  365. package/dist/numerical/pderiv.d.ts.map +1 -1
  366. package/dist/numerical/pderiv.js +6 -3
  367. package/dist/numerical/pderiv.js.map +1 -1
  368. package/dist/numerical/perihelion-finder.d.ts +30 -0
  369. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  370. package/dist/numerical/perihelion-finder.js +30 -0
  371. package/dist/numerical/perihelion-finder.js.map +1 -1
  372. package/dist/numerical/tensor-engine.d.ts +2 -2
  373. package/dist/numerical/tensor-engine.d.ts.map +1 -1
  374. package/dist/numerical/weyl-lowering.d.ts +60 -0
  375. package/dist/numerical/weyl-lowering.d.ts.map +1 -0
  376. package/dist/numerical/weyl-lowering.js +111 -0
  377. package/dist/numerical/weyl-lowering.js.map +1 -0
  378. package/package.json +9 -7
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Typed `Cell` discriminated union for `UniversalTensor`'s cell storage.
3
+ *
4
+ * Three variants — `LawCell`, `BridgeCell`, `EmergenceCell` — each
5
+ * carrying a `kind` discriminator that lets TypeScript narrow to the
6
+ * specific variant at every consumption site. Mirrors the v0.6.1
7
+ * validator-registry's discriminated-union pattern at
8
+ * `src/dimensional/validator-registry.ts`.
9
+ *
10
+ * Design doc: `docs/planning/v0.7-Proposal-3-Design.md`.
11
+ * Review findings: `docs/planning/v0.7-Proposal-3-Review-Findings.md`.
12
+ *
13
+ * Migration relationship to `src/core/types.ts`:
14
+ * - `PhysicalLaw` ↔ `LawCell` (field-shape faithful; `confidence`
15
+ * flips `number` → string-literal union)
16
+ * - `BridgeEquation` ↔ `BridgeCell` (same migration)
17
+ * - `EmergentPhenomenon` ↔ `EmergenceCell` (same migration)
18
+ *
19
+ * The old interfaces are NOT deleted and NOT `@deprecated`-tagged in
20
+ * this sprint (per Eve-R2 + the Phase 0 consumer-import census:
21
+ * 4 in-repo sites still use them). A future v0.7.x sprint migrates
22
+ * those consumers and then adds `@deprecated`.
23
+ *
24
+ * **No `confidenceToStatus` adapter is shipped** (per Eve-R3). The
25
+ * 42-bridge catalog has BOTH a numeric `confidence` AND a curated
26
+ * string `status` field, set independently; an adapter would
27
+ * produce labels that contradict the catalog curation
28
+ * (e.g. `status: 'established'` + `confidence: 0.7` → adapter
29
+ * returns `'speculative'`). Callers must pass the string explicitly
30
+ * at cell-construction sites.
31
+ *
32
+ * @module core/cell
33
+ */
34
+ import { UniversalTensor } from './tensor.js';
35
+ /**
36
+ * Factory: build a populated `UniversalTensor` from three typed cell
37
+ * arrays plus a `TensorConfig`.
38
+ *
39
+ * Makes the "'+' in Π = L + B + E is disjoint union, not algebraic"
40
+ * invariant concrete: the only way to construct a populated
41
+ * `UniversalTensor` from typed cells is to pass three typed arrays.
42
+ * There is no `add(c1: Cell, c2: Cell): Cell` because cells never
43
+ * compose at the cell level — composition happens at the tensor
44
+ * level (Proposals 2 and 6 territory).
45
+ *
46
+ * **Provenance note**: the proposals doc §4.2 line 299 sketches
47
+ * `compose(L, B, E): UniversalTensor` without a `config` argument.
48
+ * This signature closes a proposals-doc gap — `UniversalTensor`'s
49
+ * constructor requires `rank` / `scales` / `forces`, none of which
50
+ * can be inferred from the three cell arrays alone. `compose` is
51
+ * this sprint's invention, not a proposals-doc commitment.
52
+ *
53
+ * @public
54
+ */
55
+ export function compose(laws, bridges, emergences, config) {
56
+ const tensor = new UniversalTensor(config);
57
+ for (const law of laws)
58
+ tensor.addCell(law);
59
+ for (const bridge of bridges)
60
+ tensor.addCell(bridge);
61
+ for (const emergence of emergences)
62
+ tensor.addCell(emergence);
63
+ return tensor;
64
+ }
65
+ // ---------------------------------------------------------------------------
66
+ // Inverse adapters (legacy interface → Cell variant)
67
+ // ---------------------------------------------------------------------------
68
+ // Used by UniversalTensor.populatedCells() (Phase 2 Task 2.1) to resolve
69
+ // stored cell-IDs back to Cell objects. Counterparts to the forward
70
+ // adapters (cellToLaw / cellToBridge / cellToEmergence) at tensor.ts.
71
+ //
72
+ // The numeric `confidence: number` from the legacy interfaces is bucketed
73
+ // back into the string vocabulary via `numberToCellConfidence`. This is
74
+ // the lossy direction Eve-R3 flagged — but in THIS direction, the call
75
+ // site is "we have a legacy entry that was already in the tensor; bucket
76
+ // its numeric confidence into the closest string label". Per Decision #6
77
+ // fan-out semantics, this can only happen for entries that round-tripped
78
+ // through `addCell` (where the original string was authoritative) OR
79
+ // entries added via the legacy `addLaw`/`addBridge`/`addEmergence` paths
80
+ // (where the consumer chose a number directly). The bucketing matches
81
+ // the forward `statusToConfidenceNumber` in tensor.ts: 0.95→established,
82
+ // 0.6→speculative, 0.3→highly-speculative; thresholds chosen to make
83
+ // the standard round-trip exact.
84
+ /**
85
+ * Inverse of `statusToConfidenceNumber` at tensor.ts:48-58. Buckets a
86
+ * numeric confidence in [0,1] back to the string vocabulary. Used by
87
+ * the inverse adapters below.
88
+ *
89
+ * @internal
90
+ */
91
+ export function numberToCellConfidence(n) {
92
+ if (n >= 0.8)
93
+ return 'established';
94
+ if (n >= 0.4)
95
+ return 'speculative';
96
+ return 'highly-speculative';
97
+ }
98
+ /**
99
+ * Adapter: `PhysicalLaw` (legacy) → `LawCell`. Used by
100
+ * `UniversalTensor.populatedCells()`.
101
+ *
102
+ * @internal
103
+ */
104
+ export function lawToCell(law) {
105
+ return {
106
+ kind: 'law',
107
+ id: law.id,
108
+ name: law.name,
109
+ equation: law.equation,
110
+ confidence: numberToCellConfidence(law.confidence),
111
+ scales: law.scales,
112
+ forces: law.forces,
113
+ symmetries: law.symmetries,
114
+ ...(law.informationMeasures ? { informationMeasures: law.informationMeasures } : {}),
115
+ ...(law.dimensions ? { dimensions: law.dimensions } : {}),
116
+ ...(law.topologies ? { topologies: law.topologies } : {}),
117
+ ...(law.references ? { references: law.references } : {}),
118
+ };
119
+ }
120
+ /**
121
+ * Adapter: `BridgeEquation` (legacy) → `BridgeCell`. Used by
122
+ * `UniversalTensor.populatedCells()`.
123
+ *
124
+ * @internal
125
+ */
126
+ export function bridgeToCell(b) {
127
+ return {
128
+ kind: 'bridge',
129
+ id: b.id,
130
+ name: b.name,
131
+ equation: b.equation,
132
+ confidence: numberToCellConfidence(b.confidence),
133
+ source: b.source,
134
+ target: b.target,
135
+ validated: b.validated,
136
+ description: b.description,
137
+ };
138
+ }
139
+ /**
140
+ * Adapter: `EmergentPhenomenon` (legacy) → `EmergenceCell`. The
141
+ * legacy `description` field holds the mathematical content (LaTeX);
142
+ * we surface it as `equation` and leave `description` undefined
143
+ * unless the legacy entry had a "math\n\nprose" split (per the
144
+ * forward `cellToEmergence` adapter convention).
145
+ *
146
+ * @internal
147
+ */
148
+ export function emergenceToCell(p) {
149
+ // Split convention: if description contains "\n\n", treat the part
150
+ // before as equation and after as prose; otherwise the whole field
151
+ // is the equation.
152
+ const splitIdx = p.description.indexOf('\n\n');
153
+ const equation = splitIdx === -1 ? p.description : p.description.slice(0, splitIdx);
154
+ const description = splitIdx === -1 ? undefined : p.description.slice(splitIdx + 2);
155
+ return {
156
+ kind: 'emergence',
157
+ id: p.id,
158
+ name: p.name,
159
+ equation,
160
+ confidence: numberToCellConfidence(p.confidence),
161
+ order: p.order,
162
+ indices: p.indices,
163
+ ...(description ? { description } : {}),
164
+ };
165
+ }
166
+ //# sourceMappingURL=cell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/core/cell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAaH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoG9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,OAAO,CACrB,IAA4B,EAC5B,OAAkC,EAClC,UAAwC,EACxC,MAAoB;IAEpB,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,IAAI;QAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5C,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,KAAK,MAAM,SAAS,IAAI,UAAU;QAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,8EAA8E;AAC9E,qDAAqD;AACrD,8EAA8E;AAC9E,yEAAyE;AACzE,oEAAoE;AACpE,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,uEAAuE;AACvE,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,sEAAsE;AACtE,yEAAyE;AACzE,qEAAqE;AACrE,iCAAiC;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,CAAS;IAC9C,IAAI,CAAC,IAAI,GAAG;QAAE,OAAO,aAAa,CAAC;IACnC,IAAI,CAAC,IAAI,GAAG;QAAE,OAAO,aAAa,CAAC;IACnC,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,GAAgB;IACxC,OAAO;QACL,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,UAAU,EAAE,sBAAsB,CAAC,GAAG,CAAC,UAAU,CAAC;QAClD,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpF,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1D,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,CAAiB;IAC5C,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,UAAU,CAAC;QAChD,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,WAAW,EAAE,CAAC,CAAC,WAAW;KAC3B,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,CAAqB;IACnD,mEAAmE;IACnE,mEAAmE;IACnE,mBAAmB;IACnB,MAAM,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpF,MAAM,WAAW,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;IAEpF,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,QAAQ;QACR,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,UAAU,CAAC;QAChD,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Flux-rule scaffolding for v0.7 Proposal 2 — Sparse Semantic Catalog.
3
+ *
4
+ * Defines:
5
+ * - `FluxRuleKind` discriminated tag (@internal)
6
+ * - `FluxRule`, `FluxRuleResult` registry shapes (@internal)
7
+ * - `FluxDiagnostic`, `FluxReport` consumer shapes (@public)
8
+ * - `FluxViolationError` (@public) thrown on ERROR-tier rule failures
9
+ * - Rule 2 (L/B/E coordinate matching) and Rule 3 (Causality) — pure
10
+ * functions over `Cell` / `BridgeCell`
11
+ * - `runRules(cell, rules)` dispatcher with `_exhaustive: never`
12
+ *
13
+ * Rule 1 (Dimensional Consistency) ships in Phase 3 alongside the
14
+ * catalog adapter — it operates on `BridgeEquationEntry`, not `Cell`,
15
+ * per Decision #3 (resolves Adam-V3).
16
+ *
17
+ * Design: docs/planning/v0.7-Proposal-2-Design.md (redraft commit
18
+ * 01632b5). Decisions #5, #6, #8 are load-bearing here.
19
+ *
20
+ * @module core/flux-rules
21
+ */
22
+ import type { Cell } from './cell.js';
23
+ /**
24
+ * A single rule-evaluation outcome surfaced to consumers via
25
+ * `fluxDiagnostics()` or `FluxViolationError`. Severity follows the
26
+ * info/warning/error tiering pinned in the design.
27
+ *
28
+ * @public
29
+ */
30
+ export interface FluxDiagnostic {
31
+ readonly severity: 'info' | 'warning' | 'error';
32
+ readonly ruleName: FluxRuleKind;
33
+ readonly cellId: string;
34
+ readonly message: string;
35
+ }
36
+ /**
37
+ * Aggregated report returned by `runRules()` / consumer-facing
38
+ * `fluxDiagnostics()`. Per-tier counts are pre-computed for cheap
39
+ * consumer-side branching.
40
+ *
41
+ * @public
42
+ */
43
+ export interface FluxReport {
44
+ readonly diagnostics: ReadonlyArray<FluxDiagnostic>;
45
+ readonly errorCount: number;
46
+ readonly warningCount: number;
47
+ readonly infoCount: number;
48
+ }
49
+ /**
50
+ * Thrown from `UniversalTensor.addCell` (Phase 2) when a Rule 2
51
+ * (L/B/E coordinate-matching) violation fires. Rule 2 is ERROR-tier:
52
+ * a `BridgeCell` with `source === target`, a `LawCell` with empty
53
+ * `scales × forces`, or an `EmergenceCell` with `indices.length < 2`
54
+ * fail-atomic.
55
+ *
56
+ * Rule 3 (Causality) does NOT throw — it's WARNING-tier in v0.7 per
57
+ * the proposals doc §3.3.3 (promotion to ERROR deferred to v0.8).
58
+ *
59
+ * @public
60
+ */
61
+ export declare class FluxViolationError extends Error {
62
+ readonly ruleName: FluxRuleKind;
63
+ readonly cellId: string;
64
+ constructor(ruleName: FluxRuleKind, cellId: string, message: string);
65
+ }
66
+ /**
67
+ * Discriminated tag for the in-tree flux rules. Adding a new rule
68
+ * kind forces a compile-time update to every `switch` over this
69
+ * union via the `_exhaustive: never` discipline.
70
+ *
71
+ * - v0.7 (P2): `'dimensional-consistency' | 'lbe-coordinate' | 'causality'`
72
+ * - v0.8 (P5): adds `'regime-consistency'` — fires from `addCell`
73
+ * when a cell's attached regimes contradict the cell's coordinate
74
+ * axes (e.g., a `LawCell` with `scales: ['classical']` attached
75
+ * to a `quantum` regime via `attachRegimesToCell`).
76
+ *
77
+ * @internal — coupled to the registry's dispatch shape; not part of
78
+ * the v0.7 public-API contract.
79
+ */
80
+ export type FluxRuleKind = 'dimensional-consistency' | 'lbe-coordinate' | 'causality' | 'regime-consistency';
81
+ /**
82
+ * Result returned by a single rule's `check()` body. `ok: true` means
83
+ * the rule passed; `ok: false` means the rule violated. A diagnostic
84
+ * may be attached on either path (`'info'` diagnostics ride with
85
+ * `ok: true`; `'warning'` and `'error'` diagnostics ride with
86
+ * `ok: false`).
87
+ *
88
+ * @internal
89
+ */
90
+ export interface FluxRuleResult {
91
+ readonly ok: boolean;
92
+ readonly diagnostic?: FluxDiagnostic;
93
+ }
94
+ /**
95
+ * A registered rule. The `check()` body is a pure function over
96
+ * `Cell` (or a sub-variant if the rule only fires on one `kind`).
97
+ *
98
+ * @internal
99
+ */
100
+ export interface FluxRule {
101
+ readonly kind: FluxRuleKind;
102
+ readonly check: (cell: Cell) => FluxRuleResult;
103
+ }
104
+ /**
105
+ * Pure dispatcher for Rule 2 over the `Cell` discriminated union.
106
+ * The three arms enforce the cell-shape invariants:
107
+ *
108
+ * - `LawCell` is diagonal: `scales × forces` cross-product must be
109
+ * non-empty.
110
+ * - `BridgeCell` is off-diagonal: `source !== target` by at least
111
+ * one axis (already enforced by the legacy `addBridge` —
112
+ * Rule 2 piggybacks for registry exhaustiveness).
113
+ * - `EmergenceCell` spans multi-coordinate: `indices.length >= 2`.
114
+ *
115
+ * @internal
116
+ */
117
+ export declare function checkLBECoordinate(cell: Cell): FluxRuleResult;
118
+ /**
119
+ * Pure dispatcher for Rule 3 over the `Cell` discriminated union.
120
+ * Rule 3 only fires on `'bridge'`; the other arms always pass.
121
+ *
122
+ * Body for the bridge arm per Decision #5:
123
+ * 1. Read `src = cell.source.scale`, `dst = cell.target.scale`.
124
+ * 2. If either is `undefined`, emit `'info'` ("scale-unspecified
125
+ * skip"); the rule still passes (`ok: true`).
126
+ * 3. If `arrow = classifyArrow(src, dst) === 'reverse'`, emit a
127
+ * `'warning'` diagnostic recommending audit. Rule still passes
128
+ * (Rule 3 is WARNING tier in v0.7; promotion to ERROR deferred
129
+ * to v0.8).
130
+ * 4. Suppression via the private `causalityWhitelist` (empty in
131
+ * v0.7).
132
+ *
133
+ * @internal
134
+ */
135
+ export declare function checkCausality(cell: Cell): FluxRuleResult;
136
+ /**
137
+ * Run a set of rules against a single `cell` and aggregate the
138
+ * diagnostics into a `FluxReport`. Pure function — no I/O, no
139
+ * shared-state mutation.
140
+ *
141
+ * The switch over `FluxRuleKind` is exhaustive via the
142
+ * `_exhaustive: never` default arm (Decision #8). Adding a new rule
143
+ * kind forces a compile-time update here AND at every consumer
144
+ * site that branches on `FluxRuleKind`.
145
+ *
146
+ * @internal
147
+ */
148
+ export declare function runRules(cell: Cell, rules: ReadonlyArray<FluxRule>): FluxReport;
149
+ /**
150
+ * The two v0.7 in-tree rules registered for Phase 2 `addCell`
151
+ * dispatch. Rule 1 (Dimensional Consistency) is NOT here — it
152
+ * operates on `BridgeEquationEntry`, not `Cell`, and ships in
153
+ * Phase 3 alongside the catalog adapter.
154
+ *
155
+ * @internal
156
+ */
157
+ export declare const V07_CELL_RULES: ReadonlyArray<FluxRule>;
158
+ type RegimeRuleBody = (cell: Cell) => FluxRuleResult;
159
+ /**
160
+ * Install P5's regime-consistency rule body. Called by
161
+ * `src/core/regime-rule-install.ts` at its module load. If P5's
162
+ * module is never imported, the regime check stays a no-op
163
+ * (returns `ok: true` silently).
164
+ *
165
+ * @internal
166
+ */
167
+ export declare function installRegimeConsistencyRule(body: RegimeRuleBody): void;
168
+ /**
169
+ * Pure dispatcher for Rule 4 over `Cell`. Delegates to the body
170
+ * installed by P5 if present; otherwise a permissive no-op.
171
+ *
172
+ * @internal
173
+ */
174
+ export declare function checkRegimeConsistency(cell: Cell): FluxRuleResult;
175
+ export {};
176
+ //# sourceMappingURL=flux-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flux-rules.d.ts","sourceRoot":"","sources":["../../src/core/flux-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,IAAI,EAIL,MAAM,WAAW,CAAC;AAOnB;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IACpD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAgB,QAAQ,EAAE,YAAY,CAAC;IACvC,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEnB,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAMpE;AAMD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,YAAY,GACpB,yBAAyB,GACzB,gBAAgB,GAChB,WAAW,GACX,oBAAoB,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;CACtC;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC;CAChD;AAoDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,CAc7D;AAuED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,CAkCzD;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,GAC7B,UAAU,CAgDZ;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,QAAQ,CAIlD,CAAC;AAYF,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC;AAIrD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,CAGjE"}
@@ -0,0 +1,329 @@
1
+ /**
2
+ * Flux-rule scaffolding for v0.7 Proposal 2 — Sparse Semantic Catalog.
3
+ *
4
+ * Defines:
5
+ * - `FluxRuleKind` discriminated tag (@internal)
6
+ * - `FluxRule`, `FluxRuleResult` registry shapes (@internal)
7
+ * - `FluxDiagnostic`, `FluxReport` consumer shapes (@public)
8
+ * - `FluxViolationError` (@public) thrown on ERROR-tier rule failures
9
+ * - Rule 2 (L/B/E coordinate matching) and Rule 3 (Causality) — pure
10
+ * functions over `Cell` / `BridgeCell`
11
+ * - `runRules(cell, rules)` dispatcher with `_exhaustive: never`
12
+ *
13
+ * Rule 1 (Dimensional Consistency) ships in Phase 3 alongside the
14
+ * catalog adapter — it operates on `BridgeEquationEntry`, not `Cell`,
15
+ * per Decision #3 (resolves Adam-V3).
16
+ *
17
+ * Design: docs/planning/v0.7-Proposal-2-Design.md (redraft commit
18
+ * 01632b5). Decisions #5, #6, #8 are load-bearing here.
19
+ *
20
+ * @module core/flux-rules
21
+ */
22
+ /**
23
+ * Thrown from `UniversalTensor.addCell` (Phase 2) when a Rule 2
24
+ * (L/B/E coordinate-matching) violation fires. Rule 2 is ERROR-tier:
25
+ * a `BridgeCell` with `source === target`, a `LawCell` with empty
26
+ * `scales × forces`, or an `EmergenceCell` with `indices.length < 2`
27
+ * fail-atomic.
28
+ *
29
+ * Rule 3 (Causality) does NOT throw — it's WARNING-tier in v0.7 per
30
+ * the proposals doc §3.3.3 (promotion to ERROR deferred to v0.8).
31
+ *
32
+ * @public
33
+ */
34
+ export class FluxViolationError extends Error {
35
+ ruleName;
36
+ cellId;
37
+ constructor(ruleName, cellId, message) {
38
+ super(`FluxRule '${ruleName}' violated for cell '${cellId}': ${message}`);
39
+ this.name = 'FluxViolationError';
40
+ this.ruleName = ruleName;
41
+ this.cellId = cellId;
42
+ }
43
+ }
44
+ // ---------------------------------------------------------------------------
45
+ // SCALE_ARROW — the partial-order on `PhysicalScale` used by Rule 3
46
+ // ---------------------------------------------------------------------------
47
+ /**
48
+ * Ordered list of scales from finest to coarsest. The index encodes
49
+ * the partial-order: lower index = finer (quantum), higher index =
50
+ * coarser (cosmological). Used by Rule 3 (Causality) to classify
51
+ * bridge direction as forward / lateral / reverse.
52
+ */
53
+ const SCALE_ORDER = [
54
+ 'quantum',
55
+ 'mesoscopic',
56
+ 'classical',
57
+ 'cosmological',
58
+ ];
59
+ function scaleIndex(s) {
60
+ return SCALE_ORDER.indexOf(s);
61
+ }
62
+ /**
63
+ * Classify a bridge direction by source/target scale. `'reverse'` =
64
+ * coarser→finer (e.g., classical→quantum), `'forward'` =
65
+ * finer→coarser (the canonical emergent direction), `'lateral'` =
66
+ * same scale. Per Decision #5, `'reverse'` triggers a warning
67
+ * diagnostic.
68
+ */
69
+ function classifyArrow(src, dst) {
70
+ const i = scaleIndex(src);
71
+ const j = scaleIndex(dst);
72
+ if (i === j)
73
+ return 'lateral';
74
+ return i < j ? 'forward' : 'reverse';
75
+ }
76
+ /**
77
+ * Private per-cell-ID suppression list for Rule 3 (Causality). Empty
78
+ * in v0.7; entries earn their place via design review (Decision #5
79
+ * — the original "timeReversalAnnotation: true" on BridgeCell was
80
+ * rejected as public-type contamination per Eve-R12).
81
+ */
82
+ const causalityWhitelist = new Set();
83
+ // ---------------------------------------------------------------------------
84
+ // Rule 2 — L/B/E coordinate matching (ERROR tier)
85
+ // ---------------------------------------------------------------------------
86
+ /**
87
+ * Pure dispatcher for Rule 2 over the `Cell` discriminated union.
88
+ * The three arms enforce the cell-shape invariants:
89
+ *
90
+ * - `LawCell` is diagonal: `scales × forces` cross-product must be
91
+ * non-empty.
92
+ * - `BridgeCell` is off-diagonal: `source !== target` by at least
93
+ * one axis (already enforced by the legacy `addBridge` —
94
+ * Rule 2 piggybacks for registry exhaustiveness).
95
+ * - `EmergenceCell` spans multi-coordinate: `indices.length >= 2`.
96
+ *
97
+ * @internal
98
+ */
99
+ export function checkLBECoordinate(cell) {
100
+ switch (cell.kind) {
101
+ case 'law':
102
+ return checkLawCoordinate(cell);
103
+ case 'bridge':
104
+ return checkBridgeCoordinate(cell);
105
+ case 'emergence':
106
+ return checkEmergenceCoordinate(cell);
107
+ default: {
108
+ const _exhaustive = cell;
109
+ void _exhaustive;
110
+ throw new Error(`checkLBECoordinate: unknown cell kind`);
111
+ }
112
+ }
113
+ }
114
+ function checkLawCoordinate(cell) {
115
+ if (cell.scales.length === 0 || cell.forces.length === 0) {
116
+ return {
117
+ ok: false,
118
+ diagnostic: {
119
+ severity: 'error',
120
+ ruleName: 'lbe-coordinate',
121
+ cellId: cell.id,
122
+ message: `LawCell '${cell.id}' has empty scales × forces cross-product ` +
123
+ `(scales=[${cell.scales.join(',')}], forces=[${cell.forces.join(',')}]). ` +
124
+ `A law must occupy at least one (scale, force) coordinate.`,
125
+ },
126
+ };
127
+ }
128
+ return { ok: true };
129
+ }
130
+ function checkBridgeCoordinate(cell) {
131
+ // A BridgeCell must differ between source and target on at least one
132
+ // populated axis. The legacy `addBridge` at tensor.ts:217-226 already
133
+ // enforces this; we re-implement here for registry exhaustiveness.
134
+ const s = cell.source;
135
+ const t = cell.target;
136
+ const same = s.scale === t.scale &&
137
+ s.force === t.force &&
138
+ s.symmetry === t.symmetry &&
139
+ s.information === t.information &&
140
+ s.dimension === t.dimension &&
141
+ s.topology === t.topology;
142
+ if (same) {
143
+ return {
144
+ ok: false,
145
+ diagnostic: {
146
+ severity: 'error',
147
+ ruleName: 'lbe-coordinate',
148
+ cellId: cell.id,
149
+ message: `BridgeCell '${cell.id}' has identical source and target ` +
150
+ `coordinates. A bridge must connect two distinct regime axes.`,
151
+ },
152
+ };
153
+ }
154
+ return { ok: true };
155
+ }
156
+ function checkEmergenceCoordinate(cell) {
157
+ if (cell.indices.length < 2) {
158
+ return {
159
+ ok: false,
160
+ diagnostic: {
161
+ severity: 'error',
162
+ ruleName: 'lbe-coordinate',
163
+ cellId: cell.id,
164
+ message: `EmergenceCell '${cell.id}' has only ${cell.indices.length} ` +
165
+ `index group(s); emergence requires at least 2 (higher-order ` +
166
+ `correlations span multiple coordinates).`,
167
+ },
168
+ };
169
+ }
170
+ return { ok: true };
171
+ }
172
+ // ---------------------------------------------------------------------------
173
+ // Rule 3 — Causality (WARNING tier in v0.7)
174
+ // ---------------------------------------------------------------------------
175
+ /**
176
+ * Pure dispatcher for Rule 3 over the `Cell` discriminated union.
177
+ * Rule 3 only fires on `'bridge'`; the other arms always pass.
178
+ *
179
+ * Body for the bridge arm per Decision #5:
180
+ * 1. Read `src = cell.source.scale`, `dst = cell.target.scale`.
181
+ * 2. If either is `undefined`, emit `'info'` ("scale-unspecified
182
+ * skip"); the rule still passes (`ok: true`).
183
+ * 3. If `arrow = classifyArrow(src, dst) === 'reverse'`, emit a
184
+ * `'warning'` diagnostic recommending audit. Rule still passes
185
+ * (Rule 3 is WARNING tier in v0.7; promotion to ERROR deferred
186
+ * to v0.8).
187
+ * 4. Suppression via the private `causalityWhitelist` (empty in
188
+ * v0.7).
189
+ *
190
+ * @internal
191
+ */
192
+ export function checkCausality(cell) {
193
+ if (cell.kind !== 'bridge')
194
+ return { ok: true };
195
+ if (causalityWhitelist.has(cell.id))
196
+ return { ok: true };
197
+ const src = cell.source.scale;
198
+ const dst = cell.target.scale;
199
+ if (src === undefined || dst === undefined) {
200
+ return {
201
+ ok: true,
202
+ diagnostic: {
203
+ severity: 'info',
204
+ ruleName: 'causality',
205
+ cellId: cell.id,
206
+ message: `scale axis unspecified; causality check skipped`,
207
+ },
208
+ };
209
+ }
210
+ const arrow = classifyArrow(src, dst);
211
+ if (arrow === 'reverse') {
212
+ return {
213
+ ok: true, // WARNING tier in v0.7; rule does not throw
214
+ diagnostic: {
215
+ severity: 'warning',
216
+ ruleName: 'causality',
217
+ cellId: cell.id,
218
+ message: `BridgeCell '${cell.id}' goes ${src}→${dst} (coarser→finer); ` +
219
+ `the canonical emergence direction is finer→coarser. ` +
220
+ `Recommend audit.`,
221
+ },
222
+ };
223
+ }
224
+ return { ok: true };
225
+ }
226
+ // ---------------------------------------------------------------------------
227
+ // Registry dispatcher
228
+ // ---------------------------------------------------------------------------
229
+ /**
230
+ * Run a set of rules against a single `cell` and aggregate the
231
+ * diagnostics into a `FluxReport`. Pure function — no I/O, no
232
+ * shared-state mutation.
233
+ *
234
+ * The switch over `FluxRuleKind` is exhaustive via the
235
+ * `_exhaustive: never` default arm (Decision #8). Adding a new rule
236
+ * kind forces a compile-time update here AND at every consumer
237
+ * site that branches on `FluxRuleKind`.
238
+ *
239
+ * @internal
240
+ */
241
+ export function runRules(cell, rules) {
242
+ const diagnostics = [];
243
+ let errorCount = 0;
244
+ let warningCount = 0;
245
+ let infoCount = 0;
246
+ for (const rule of rules) {
247
+ // Exhaustive dispatch on rule.kind. Even though `check` is the
248
+ // same shape across kinds, branching here gives us the
249
+ // compile-time guarantee that every kind is handled — a new
250
+ // FluxRuleKind variant forces a compile error.
251
+ let result;
252
+ switch (rule.kind) {
253
+ case 'dimensional-consistency':
254
+ result = rule.check(cell);
255
+ break;
256
+ case 'lbe-coordinate':
257
+ result = rule.check(cell);
258
+ break;
259
+ case 'causality':
260
+ result = rule.check(cell);
261
+ break;
262
+ case 'regime-consistency':
263
+ result = rule.check(cell);
264
+ break;
265
+ default: {
266
+ const _exhaustive = rule.kind;
267
+ void _exhaustive;
268
+ throw new Error(`runRules: unknown rule kind`);
269
+ }
270
+ }
271
+ if (result.diagnostic) {
272
+ diagnostics.push(result.diagnostic);
273
+ switch (result.diagnostic.severity) {
274
+ case 'error':
275
+ errorCount++;
276
+ break;
277
+ case 'warning':
278
+ warningCount++;
279
+ break;
280
+ case 'info':
281
+ infoCount++;
282
+ break;
283
+ }
284
+ }
285
+ }
286
+ return {
287
+ diagnostics,
288
+ errorCount,
289
+ warningCount,
290
+ infoCount,
291
+ };
292
+ }
293
+ /**
294
+ * The two v0.7 in-tree rules registered for Phase 2 `addCell`
295
+ * dispatch. Rule 1 (Dimensional Consistency) is NOT here — it
296
+ * operates on `BridgeEquationEntry`, not `Cell`, and ships in
297
+ * Phase 3 alongside the catalog adapter.
298
+ *
299
+ * @internal
300
+ */
301
+ export const V07_CELL_RULES = [
302
+ { kind: 'lbe-coordinate', check: checkLBECoordinate },
303
+ { kind: 'causality', check: checkCausality },
304
+ { kind: 'regime-consistency', check: checkRegimeConsistency },
305
+ ];
306
+ let registeredRegimeRule = null;
307
+ /**
308
+ * Install P5's regime-consistency rule body. Called by
309
+ * `src/core/regime-rule-install.ts` at its module load. If P5's
310
+ * module is never imported, the regime check stays a no-op
311
+ * (returns `ok: true` silently).
312
+ *
313
+ * @internal
314
+ */
315
+ export function installRegimeConsistencyRule(body) {
316
+ registeredRegimeRule = body;
317
+ }
318
+ /**
319
+ * Pure dispatcher for Rule 4 over `Cell`. Delegates to the body
320
+ * installed by P5 if present; otherwise a permissive no-op.
321
+ *
322
+ * @internal
323
+ */
324
+ export function checkRegimeConsistency(cell) {
325
+ if (registeredRegimeRule)
326
+ return registeredRegimeRule(cell);
327
+ return { ok: true };
328
+ }
329
+ //# sourceMappingURL=flux-rules.js.map