universal-physics-tensor 0.4.5

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 (299) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +377 -0
  3. package/dist/bridges/equations/be-11-decoherence-master.d.ts +83 -0
  4. package/dist/bridges/equations/be-11-decoherence-master.d.ts.map +1 -0
  5. package/dist/bridges/equations/be-11-decoherence-master.js +116 -0
  6. package/dist/bridges/equations/be-11-decoherence-master.js.map +1 -0
  7. package/dist/bridges/equations/be-12-coherence-length.d.ts +80 -0
  8. package/dist/bridges/equations/be-12-coherence-length.d.ts.map +1 -0
  9. package/dist/bridges/equations/be-12-coherence-length.js +128 -0
  10. package/dist/bridges/equations/be-12-coherence-length.js.map +1 -0
  11. package/dist/bridges/equations/be-13-einstein-trace.d.ts +89 -0
  12. package/dist/bridges/equations/be-13-einstein-trace.d.ts.map +1 -0
  13. package/dist/bridges/equations/be-13-einstein-trace.js +143 -0
  14. package/dist/bridges/equations/be-13-einstein-trace.js.map +1 -0
  15. package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts +67 -0
  16. package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts.map +1 -0
  17. package/dist/bridges/equations/be-14-ryu-takayanagi.js +112 -0
  18. package/dist/bridges/equations/be-14-ryu-takayanagi.js.map +1 -0
  19. package/dist/bridges/equations/be-15-emergence.d.ts +164 -0
  20. package/dist/bridges/equations/be-15-emergence.d.ts.map +1 -0
  21. package/dist/bridges/equations/be-15-emergence.js +204 -0
  22. package/dist/bridges/equations/be-15-emergence.js.map +1 -0
  23. package/dist/bridges/equations/be-16-landauer.d.ts +180 -0
  24. package/dist/bridges/equations/be-16-landauer.d.ts.map +1 -0
  25. package/dist/bridges/equations/be-16-landauer.js +206 -0
  26. package/dist/bridges/equations/be-16-landauer.js.map +1 -0
  27. package/dist/bridges/equations/be-17-einstein-cartan.d.ts +245 -0
  28. package/dist/bridges/equations/be-17-einstein-cartan.d.ts.map +1 -0
  29. package/dist/bridges/equations/be-17-einstein-cartan.js +304 -0
  30. package/dist/bridges/equations/be-17-einstein-cartan.js.map +1 -0
  31. package/dist/bridges/equations/be-18-higgs-mass.d.ts +65 -0
  32. package/dist/bridges/equations/be-18-higgs-mass.d.ts.map +1 -0
  33. package/dist/bridges/equations/be-18-higgs-mass.js +86 -0
  34. package/dist/bridges/equations/be-18-higgs-mass.js.map +1 -0
  35. package/dist/bridges/equations/be-19-quantum-bounce.d.ts +72 -0
  36. package/dist/bridges/equations/be-19-quantum-bounce.d.ts.map +1 -0
  37. package/dist/bridges/equations/be-19-quantum-bounce.js +151 -0
  38. package/dist/bridges/equations/be-19-quantum-bounce.js.map +1 -0
  39. package/dist/bridges/equations/be-20-vacuum-energy.d.ts +72 -0
  40. package/dist/bridges/equations/be-20-vacuum-energy.d.ts.map +1 -0
  41. package/dist/bridges/equations/be-20-vacuum-energy.js +115 -0
  42. package/dist/bridges/equations/be-20-vacuum-energy.js.map +1 -0
  43. package/dist/bridges/equations/be-21-kss-bound.d.ts +72 -0
  44. package/dist/bridges/equations/be-21-kss-bound.d.ts.map +1 -0
  45. package/dist/bridges/equations/be-21-kss-bound.js +103 -0
  46. package/dist/bridges/equations/be-21-kss-bound.js.map +1 -0
  47. package/dist/bridges/equations/be-22-topological-entanglement.d.ts +90 -0
  48. package/dist/bridges/equations/be-22-topological-entanglement.d.ts.map +1 -0
  49. package/dist/bridges/equations/be-22-topological-entanglement.js +123 -0
  50. package/dist/bridges/equations/be-22-topological-entanglement.js.map +1 -0
  51. package/dist/bridges/equations/be-23-syk-planckian.d.ts +89 -0
  52. package/dist/bridges/equations/be-23-syk-planckian.d.ts.map +1 -0
  53. package/dist/bridges/equations/be-23-syk-planckian.js +155 -0
  54. package/dist/bridges/equations/be-23-syk-planckian.js.map +1 -0
  55. package/dist/bridges/equations/be-24-foerster-fret.d.ts +81 -0
  56. package/dist/bridges/equations/be-24-foerster-fret.d.ts.map +1 -0
  57. package/dist/bridges/equations/be-24-foerster-fret.js +121 -0
  58. package/dist/bridges/equations/be-24-foerster-fret.js.map +1 -0
  59. package/dist/bridges/equations/be-25-iit-phi.d.ts +220 -0
  60. package/dist/bridges/equations/be-25-iit-phi.d.ts.map +1 -0
  61. package/dist/bridges/equations/be-25-iit-phi.js +259 -0
  62. package/dist/bridges/equations/be-25-iit-phi.js.map +1 -0
  63. package/dist/bridges/equations/be-25-orch-or.d.ts +78 -0
  64. package/dist/bridges/equations/be-25-orch-or.d.ts.map +1 -0
  65. package/dist/bridges/equations/be-25-orch-or.js +121 -0
  66. package/dist/bridges/equations/be-25-orch-or.js.map +1 -0
  67. package/dist/bridges/equations/be-26-dna-tunneling.d.ts +75 -0
  68. package/dist/bridges/equations/be-26-dna-tunneling.d.ts.map +1 -0
  69. package/dist/bridges/equations/be-26-dna-tunneling.js +138 -0
  70. package/dist/bridges/equations/be-26-dna-tunneling.js.map +1 -0
  71. package/dist/bridges/equations/be-27-effective-temperature.d.ts +81 -0
  72. package/dist/bridges/equations/be-27-effective-temperature.d.ts.map +1 -0
  73. package/dist/bridges/equations/be-27-effective-temperature.js +120 -0
  74. package/dist/bridges/equations/be-27-effective-temperature.js.map +1 -0
  75. package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts +175 -0
  76. package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts.map +1 -0
  77. package/dist/bridges/equations/be-28-onsager-entropy-production.js +203 -0
  78. package/dist/bridges/equations/be-28-onsager-entropy-production.js.map +1 -0
  79. package/dist/bridges/equations/be-29-jarzynski.d.ts +86 -0
  80. package/dist/bridges/equations/be-29-jarzynski.d.ts.map +1 -0
  81. package/dist/bridges/equations/be-29-jarzynski.js +132 -0
  82. package/dist/bridges/equations/be-29-jarzynski.js.map +1 -0
  83. package/dist/bridges/equations/be-30-flm-first-law.d.ts +93 -0
  84. package/dist/bridges/equations/be-30-flm-first-law.d.ts.map +1 -0
  85. package/dist/bridges/equations/be-30-flm-first-law.js +109 -0
  86. package/dist/bridges/equations/be-30-flm-first-law.js.map +1 -0
  87. package/dist/bridges/equations/be-31-causal-set-bd.d.ts +96 -0
  88. package/dist/bridges/equations/be-31-causal-set-bd.d.ts.map +1 -0
  89. package/dist/bridges/equations/be-31-causal-set-bd.js +133 -0
  90. package/dist/bridges/equations/be-31-causal-set-bd.js.map +1 -0
  91. package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts +113 -0
  92. package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts.map +1 -0
  93. package/dist/bridges/equations/be-32-quantum-reference-frame.js +155 -0
  94. package/dist/bridges/equations/be-32-quantum-reference-frame.js.map +1 -0
  95. package/dist/bridges/equations/be-33-hertz-millis.d.ts +77 -0
  96. package/dist/bridges/equations/be-33-hertz-millis.d.ts.map +1 -0
  97. package/dist/bridges/equations/be-33-hertz-millis.js +113 -0
  98. package/dist/bridges/equations/be-33-hertz-millis.js.map +1 -0
  99. package/dist/bridges/equations/be-34-kibble-zurek.d.ts +76 -0
  100. package/dist/bridges/equations/be-34-kibble-zurek.d.ts.map +1 -0
  101. package/dist/bridges/equations/be-34-kibble-zurek.js +139 -0
  102. package/dist/bridges/equations/be-34-kibble-zurek.js.map +1 -0
  103. package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts +117 -0
  104. package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts.map +1 -0
  105. package/dist/bridges/equations/be-35-conformal-bootstrap.js +167 -0
  106. package/dist/bridges/equations/be-35-conformal-bootstrap.js.map +1 -0
  107. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts +77 -0
  108. package/dist/bridges/equations/be-36-gw-speed-bound.d.ts.map +1 -0
  109. package/dist/bridges/equations/be-36-gw-speed-bound.js +107 -0
  110. package/dist/bridges/equations/be-36-gw-speed-bound.js.map +1 -0
  111. package/dist/bridges/equations/be-37-shapiro-delay.d.ts +260 -0
  112. package/dist/bridges/equations/be-37-shapiro-delay.d.ts.map +1 -0
  113. package/dist/bridges/equations/be-37-shapiro-delay.js +429 -0
  114. package/dist/bridges/equations/be-37-shapiro-delay.js.map +1 -0
  115. package/dist/bridges/equations/be-38-mond.d.ts +86 -0
  116. package/dist/bridges/equations/be-38-mond.d.ts.map +1 -0
  117. package/dist/bridges/equations/be-38-mond.js +122 -0
  118. package/dist/bridges/equations/be-38-mond.js.map +1 -0
  119. package/dist/bridges/equations/be-39-asymptotic-safety.d.ts +106 -0
  120. package/dist/bridges/equations/be-39-asymptotic-safety.d.ts.map +1 -0
  121. package/dist/bridges/equations/be-39-asymptotic-safety.js +155 -0
  122. package/dist/bridges/equations/be-39-asymptotic-safety.js.map +1 -0
  123. package/dist/bridges/equations/be-40-composite-higgs.d.ts +81 -0
  124. package/dist/bridges/equations/be-40-composite-higgs.d.ts.map +1 -0
  125. package/dist/bridges/equations/be-40-composite-higgs.js +149 -0
  126. package/dist/bridges/equations/be-40-composite-higgs.js.map +1 -0
  127. package/dist/bridges/equations/be-41-swampland.d.ts +67 -0
  128. package/dist/bridges/equations/be-41-swampland.d.ts.map +1 -0
  129. package/dist/bridges/equations/be-41-swampland.js +109 -0
  130. package/dist/bridges/equations/be-41-swampland.js.map +1 -0
  131. package/dist/bridges/equations/be-42-hawking-temperature.d.ts +67 -0
  132. package/dist/bridges/equations/be-42-hawking-temperature.d.ts.map +1 -0
  133. package/dist/bridges/equations/be-42-hawking-temperature.js +109 -0
  134. package/dist/bridges/equations/be-42-hawking-temperature.js.map +1 -0
  135. package/dist/bridges/equations/be-43-er-epr.d.ts +73 -0
  136. package/dist/bridges/equations/be-43-er-epr.d.ts.map +1 -0
  137. package/dist/bridges/equations/be-43-er-epr.js +114 -0
  138. package/dist/bridges/equations/be-43-er-epr.js.map +1 -0
  139. package/dist/bridges/equations/be-44-soft-hair.d.ts +151 -0
  140. package/dist/bridges/equations/be-44-soft-hair.d.ts.map +1 -0
  141. package/dist/bridges/equations/be-44-soft-hair.js +185 -0
  142. package/dist/bridges/equations/be-44-soft-hair.js.map +1 -0
  143. package/dist/bridges/equations/be-45-tcc.d.ts +116 -0
  144. package/dist/bridges/equations/be-45-tcc.d.ts.map +1 -0
  145. package/dist/bridges/equations/be-45-tcc.js +157 -0
  146. package/dist/bridges/equations/be-45-tcc.js.map +1 -0
  147. package/dist/bridges/equations/be-46-multiverse-measure.d.ts +163 -0
  148. package/dist/bridges/equations/be-46-multiverse-measure.d.ts.map +1 -0
  149. package/dist/bridges/equations/be-46-multiverse-measure.js +198 -0
  150. package/dist/bridges/equations/be-46-multiverse-measure.js.map +1 -0
  151. package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts +72 -0
  152. package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts.map +1 -0
  153. package/dist/bridges/equations/be-47-bbn-dark-sector.js +121 -0
  154. package/dist/bridges/equations/be-47-bbn-dark-sector.js.map +1 -0
  155. package/dist/bridges/equations/be-48-grw-localization.d.ts +84 -0
  156. package/dist/bridges/equations/be-48-grw-localization.d.ts.map +1 -0
  157. package/dist/bridges/equations/be-48-grw-localization.js +107 -0
  158. package/dist/bridges/equations/be-48-grw-localization.js.map +1 -0
  159. package/dist/bridges/equations/be-49-quantum-darwinism.d.ts +97 -0
  160. package/dist/bridges/equations/be-49-quantum-darwinism.d.ts.map +1 -0
  161. package/dist/bridges/equations/be-49-quantum-darwinism.js +129 -0
  162. package/dist/bridges/equations/be-49-quantum-darwinism.js.map +1 -0
  163. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts +120 -0
  164. package/dist/bridges/equations/be-50-wheeler-feynman.d.ts.map +1 -0
  165. package/dist/bridges/equations/be-50-wheeler-feynman.js +151 -0
  166. package/dist/bridges/equations/be-50-wheeler-feynman.js.map +1 -0
  167. package/dist/bridges/gravitational-lensing.d.ts +52 -0
  168. package/dist/bridges/gravitational-lensing.d.ts.map +1 -0
  169. package/dist/bridges/gravitational-lensing.js +48 -0
  170. package/dist/bridges/gravitational-lensing.js.map +1 -0
  171. package/dist/bridges/index.d.ts +104 -0
  172. package/dist/bridges/index.d.ts.map +1 -0
  173. package/dist/bridges/index.js +1663 -0
  174. package/dist/bridges/index.js.map +1 -0
  175. package/dist/bridges/perihelion-precession.d.ts +62 -0
  176. package/dist/bridges/perihelion-precession.d.ts.map +1 -0
  177. package/dist/bridges/perihelion-precession.js +68 -0
  178. package/dist/bridges/perihelion-precession.js.map +1 -0
  179. package/dist/core/tensor.d.ts +135 -0
  180. package/dist/core/tensor.d.ts.map +1 -0
  181. package/dist/core/tensor.js +376 -0
  182. package/dist/core/tensor.js.map +1 -0
  183. package/dist/core/types.d.ts +131 -0
  184. package/dist/core/types.d.ts.map +1 -0
  185. package/dist/core/types.js +25 -0
  186. package/dist/core/types.js.map +1 -0
  187. package/dist/dimensional/algebra.d.ts +34 -0
  188. package/dist/dimensional/algebra.d.ts.map +1 -0
  189. package/dist/dimensional/algebra.js +90 -0
  190. package/dist/dimensional/algebra.js.map +1 -0
  191. package/dist/dimensional/bridge-check.d.ts +48 -0
  192. package/dist/dimensional/bridge-check.d.ts.map +1 -0
  193. package/dist/dimensional/bridge-check.js +137 -0
  194. package/dist/dimensional/bridge-check.js.map +1 -0
  195. package/dist/dimensional/connection-validators.d.ts +53 -0
  196. package/dist/dimensional/connection-validators.d.ts.map +1 -0
  197. package/dist/dimensional/connection-validators.js +84 -0
  198. package/dist/dimensional/connection-validators.js.map +1 -0
  199. package/dist/dimensional/connection.d.ts +40 -0
  200. package/dist/dimensional/connection.d.ts.map +1 -0
  201. package/dist/dimensional/connection.js +81 -0
  202. package/dist/dimensional/connection.js.map +1 -0
  203. package/dist/dimensional/constants.d.ts +30 -0
  204. package/dist/dimensional/constants.d.ts.map +1 -0
  205. package/dist/dimensional/constants.js +31 -0
  206. package/dist/dimensional/constants.js.map +1 -0
  207. package/dist/dimensional/errors.d.ts +161 -0
  208. package/dist/dimensional/errors.d.ts.map +1 -0
  209. package/dist/dimensional/errors.js +254 -0
  210. package/dist/dimensional/errors.js.map +1 -0
  211. package/dist/dimensional/fresh-label.d.ts +26 -0
  212. package/dist/dimensional/fresh-label.d.ts.map +1 -0
  213. package/dist/dimensional/fresh-label.js +31 -0
  214. package/dist/dimensional/fresh-label.js.map +1 -0
  215. package/dist/dimensional/metric-validators.d.ts +124 -0
  216. package/dist/dimensional/metric-validators.d.ts.map +1 -0
  217. package/dist/dimensional/metric-validators.js +141 -0
  218. package/dist/dimensional/metric-validators.js.map +1 -0
  219. package/dist/dimensional/metric.d.ts +67 -0
  220. package/dist/dimensional/metric.d.ts.map +1 -0
  221. package/dist/dimensional/metric.js +177 -0
  222. package/dist/dimensional/metric.js.map +1 -0
  223. package/dist/dimensional/tensor.d.ts +153 -0
  224. package/dist/dimensional/tensor.d.ts.map +1 -0
  225. package/dist/dimensional/tensor.js +138 -0
  226. package/dist/dimensional/tensor.js.map +1 -0
  227. package/dist/dimensional/types.d.ts +50 -0
  228. package/dist/dimensional/types.d.ts.map +1 -0
  229. package/dist/dimensional/types.js +66 -0
  230. package/dist/dimensional/types.js.map +1 -0
  231. package/dist/dimensional/validator.d.ts +84 -0
  232. package/dist/dimensional/validator.d.ts.map +1 -0
  233. package/dist/dimensional/validator.js +505 -0
  234. package/dist/dimensional/validator.js.map +1 -0
  235. package/dist/index.d.ts +25 -0
  236. package/dist/index.d.ts.map +1 -0
  237. package/dist/index.js +37 -0
  238. package/dist/index.js.map +1 -0
  239. package/dist/numerical/be37-covariant-eikonal.d.ts +90 -0
  240. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -0
  241. package/dist/numerical/be37-covariant-eikonal.js +79 -0
  242. package/dist/numerical/be37-covariant-eikonal.js.map +1 -0
  243. package/dist/numerical/connection-lowering-helpers.d.ts +107 -0
  244. package/dist/numerical/connection-lowering-helpers.d.ts.map +1 -0
  245. package/dist/numerical/connection-lowering-helpers.js +315 -0
  246. package/dist/numerical/connection-lowering-helpers.js.map +1 -0
  247. package/dist/numerical/engine-registry.d.ts +50 -0
  248. package/dist/numerical/engine-registry.d.ts.map +1 -0
  249. package/dist/numerical/engine-registry.js +82 -0
  250. package/dist/numerical/engine-registry.js.map +1 -0
  251. package/dist/numerical/errors.d.ts +28 -0
  252. package/dist/numerical/errors.d.ts.map +1 -0
  253. package/dist/numerical/errors.js +39 -0
  254. package/dist/numerical/errors.js.map +1 -0
  255. package/dist/numerical/float64-engine.d.ts +53 -0
  256. package/dist/numerical/float64-engine.d.ts.map +1 -0
  257. package/dist/numerical/float64-engine.js +638 -0
  258. package/dist/numerical/float64-engine.js.map +1 -0
  259. package/dist/numerical/geodesic-integrator.d.ts +62 -0
  260. package/dist/numerical/geodesic-integrator.d.ts.map +1 -0
  261. package/dist/numerical/geodesic-integrator.js +103 -0
  262. package/dist/numerical/geodesic-integrator.js.map +1 -0
  263. package/dist/numerical/grid-field.d.ts +24 -0
  264. package/dist/numerical/grid-field.d.ts.map +1 -0
  265. package/dist/numerical/grid-field.js +2 -0
  266. package/dist/numerical/grid-field.js.map +1 -0
  267. package/dist/numerical/index.d.ts +80 -0
  268. package/dist/numerical/index.d.ts.map +1 -0
  269. package/dist/numerical/index.js +75 -0
  270. package/dist/numerical/index.js.map +1 -0
  271. package/dist/numerical/lowering.d.ts +48 -0
  272. package/dist/numerical/lowering.d.ts.map +1 -0
  273. package/dist/numerical/lowering.js +443 -0
  274. package/dist/numerical/lowering.js.map +1 -0
  275. package/dist/numerical/mathts-engine.d.ts +55 -0
  276. package/dist/numerical/mathts-engine.d.ts.map +1 -0
  277. package/dist/numerical/mathts-engine.js +164 -0
  278. package/dist/numerical/mathts-engine.js.map +1 -0
  279. package/dist/numerical/metric-inverse.d.ts +31 -0
  280. package/dist/numerical/metric-inverse.d.ts.map +1 -0
  281. package/dist/numerical/metric-inverse.js +68 -0
  282. package/dist/numerical/metric-inverse.js.map +1 -0
  283. package/dist/numerical/null-ray-integrator.d.ts +13 -0
  284. package/dist/numerical/null-ray-integrator.d.ts.map +1 -0
  285. package/dist/numerical/null-ray-integrator.js +53 -0
  286. package/dist/numerical/null-ray-integrator.js.map +1 -0
  287. package/dist/numerical/pderiv.d.ts +43 -0
  288. package/dist/numerical/pderiv.d.ts.map +1 -0
  289. package/dist/numerical/pderiv.js +121 -0
  290. package/dist/numerical/pderiv.js.map +1 -0
  291. package/dist/numerical/tensor-engine.d.ts +114 -0
  292. package/dist/numerical/tensor-engine.d.ts.map +1 -0
  293. package/dist/numerical/tensor-engine.js +64 -0
  294. package/dist/numerical/tensor-engine.js.map +1 -0
  295. package/dist/numerical/types.d.ts +37 -0
  296. package/dist/numerical/types.d.ts.map +1 -0
  297. package/dist/numerical/types.js +8 -0
  298. package/dist/numerical/types.js.map +1 -0
  299. package/package.json +72 -0
@@ -0,0 +1,505 @@
1
+ /**
2
+ * Validator: walks an ExprNode tree and infers / checks SI dimensions.
3
+ *
4
+ * Honest-claude scope notes:
5
+ * - This MVP does NOT track tensor index structure (rank, contractions).
6
+ * Bridge Eq 17's index-rank mismatch from the spec cannot be caught here.
7
+ * Tier 4.5 follow-up — see README.
8
+ * - Special functions (log, exp, trig) are out of scope; their arguments
9
+ * must be dimensionless but the validator does not yet enforce that.
10
+ *
11
+ * @module dimensional/validator
12
+ */
13
+ import { DIMENSIONLESS, } from './types.js';
14
+ import { multiply, divide, power, add, subtract, equals, format, DimensionMismatchError, } from './algebra.js';
15
+ import { TensorInScalarOpError, FreeIndexMismatchError, TensorProductChildInferenceError, } from './errors.js';
16
+ import { validateTensorSymbol, computeContraction } from './tensor.js';
17
+ import { validateMetricTensor, validateKroneckerDelta, validatePartialDerivative, checkInverseMetricStructure, } from './metric-validators.js';
18
+ import { validateCovariantDerivative } from './connection-validators.js';
19
+ function joinPath(path, segment) {
20
+ return path === '' ? segment : `${path}.${segment}`;
21
+ }
22
+ /**
23
+ * Structural equality for freeIndices maps. Two maps are equal iff they
24
+ * contain the same label set and each label's `{upper, lower}` counts
25
+ * match. Used by `op '+'` / `'-'` (Task 7 / Part-VII §VII.5) to enforce
26
+ * that all operands of a tensor sum share the same free-index signature.
27
+ */
28
+ function freeIndicesEqual(a, b) {
29
+ if (a.size !== b.size)
30
+ return false;
31
+ for (const [label, counts] of a) {
32
+ const other = b.get(label);
33
+ if (!other)
34
+ return false;
35
+ if (other.upper !== counts.upper || other.lower !== counts.lower)
36
+ return false;
37
+ }
38
+ return true;
39
+ }
40
+ /**
41
+ * Human-readable summary of a freeIndices map for use in error messages.
42
+ * Empty map renders as `{}` so a tensor-vs-scalar mismatch is visually
43
+ * obvious in the thrown FreeIndexMismatchError text.
44
+ */
45
+ function formatFreeIndices(m) {
46
+ if (m.size === 0)
47
+ return '{}';
48
+ const parts = [];
49
+ for (const [label, counts] of m) {
50
+ parts.push(`${label}:{upper:${counts.upper},lower:${counts.lower}}`);
51
+ }
52
+ return `{${parts.join(', ')}}`;
53
+ }
54
+ /**
55
+ * Infer an arg's dimension and capture its LOCAL freeIndices map. Used by
56
+ * `op '+'` / `'-'` (to compare maps across args) and by `op '*'` / `'/'` /
57
+ * `'^'` (to reject any tensor-valued operand). The arg's freeIndices are
58
+ * NOT merged into `ctx.freeIndices` here — the caller decides whether to
59
+ * merge (op '+' merges after equality check) or discard (op '*' rejects).
60
+ *
61
+ * Violations from the arg's subtree are forwarded to `ctx.violations`, so
62
+ * error reports stay coherent with the rest of the walker.
63
+ */
64
+ function inferArgLocal(node, ctx, segment) {
65
+ const localFI = new Map();
66
+ const localCtx = {
67
+ path: joinPath(ctx.path, segment),
68
+ violations: ctx.violations,
69
+ freeIndices: localFI,
70
+ };
71
+ const dim = infer(node, localCtx);
72
+ return { dim, freeIndices: localFI };
73
+ }
74
+ /**
75
+ * Resolve a child node for `computeContraction` — returns a LOCAL
76
+ * `{dim, freeIndices}` result with no shared mutable state. This is the
77
+ * cycle-breaker and nested-safety primitive: it lets tensor-product
78
+ * recursion avoid touching `ctx.freeIndices` for any subtree.
79
+ *
80
+ * - tensor-symbol → forwards to `validateTensorSymbol` (returns a local Map).
81
+ * - tensor-product → recurses into `computeContraction` with this same
82
+ * resolver, threading violations + path through `parentCtx` so error
83
+ * reports stay informative.
84
+ * - all other kinds → invoke `infer()` against a throwaway context so the
85
+ * dimension is computed but no free-indices state leaks; non-tensor
86
+ * nodes contribute an empty freeIndices map.
87
+ *
88
+ * Violations from non-tensor children DO get appended to `parentCtx.violations`
89
+ * (via the throwaway ctx's violations array, which we then splice in). This
90
+ * keeps error reporting equivalent to the inline-recursion shape used by
91
+ * the scalar `op` / `integral` / `derivative` cases.
92
+ */
93
+ function resolveChildForContraction(node, parentCtx) {
94
+ if (node.kind === 'tensor-symbol') {
95
+ return validateTensorSymbol(node);
96
+ }
97
+ if (node.kind === 'metric-tensor') {
98
+ return validateMetricTensor(node);
99
+ }
100
+ if (node.kind === 'kronecker-delta') {
101
+ return validateKroneckerDelta(node);
102
+ }
103
+ if (node.kind === 'tensor-product') {
104
+ return computeContraction(node.args, (grandchild) => resolveChildForContraction(grandchild, parentCtx));
105
+ }
106
+ // Non-tensor child: use `infer()` for dimension only. Use a throwaway
107
+ // freeIndices map (discarded) but forward violations to the parent so
108
+ // error reports remain coherent.
109
+ const probe = {
110
+ path: parentCtx.path,
111
+ violations: parentCtx.violations,
112
+ freeIndices: new Map(),
113
+ };
114
+ const dim = infer(node, probe);
115
+ if (dim === null) {
116
+ // Surface as an error rather than silently producing a malformed
117
+ // ContractionResult. The probe already recorded the violation in
118
+ // parentCtx.violations, so the message here is the second signal.
119
+ // Subclass of UPTError (§14.7) so downstream consumers can
120
+ // discriminate UPT-source errors uniformly with `instanceof UPTError`.
121
+ throw new TensorProductChildInferenceError('tensor-product: a non-tensor operand failed dimension inference; ' +
122
+ 'see ValidationResult.violations for the underlying cause.');
123
+ }
124
+ return { dim, freeIndices: probe.freeIndices };
125
+ }
126
+ /**
127
+ * Resolve a child of a tensor-partial-derivative to its local
128
+ * {dim, freeIndices, role?} carrier. Same shape as
129
+ * `resolveChildForContraction` but returns role-aware result so the
130
+ * pderiv validator can pass through `of.role` (Design §13 Q1).
131
+ */
132
+ function resolveChildForPartialDerivative(node, parentCtx) {
133
+ const typed = node;
134
+ if (typed.kind === 'tensor-symbol') {
135
+ const result = validateTensorSymbol(typed);
136
+ return { dim: result.dim, freeIndices: result.freeIndices, role: typed.role };
137
+ }
138
+ if (typed.kind === 'metric-tensor') {
139
+ const result = validateMetricTensor(typed);
140
+ return { dim: result.dim, freeIndices: result.freeIndices };
141
+ }
142
+ if (typed.kind === 'kronecker-delta') {
143
+ const result = validateKroneckerDelta(typed);
144
+ return { dim: result.dim, freeIndices: result.freeIndices };
145
+ }
146
+ if (typed.kind === 'tensor-partial-derivative') {
147
+ const result = validatePartialDerivative(typed, (grandchild) => resolveChildForPartialDerivative(grandchild, parentCtx));
148
+ return result;
149
+ }
150
+ // For scalars / op / integral / derivative / tensor-product nodes, use
151
+ // inferArgLocal for dim + freeIndices, no role.
152
+ const probe = inferArgLocal(typed, parentCtx, '<pderiv-child>');
153
+ if (probe.dim === null) {
154
+ throw new TensorProductChildInferenceError('tensor-partial-derivative child failed dimension inference; ' +
155
+ 'see ValidationResult.violations for cause.');
156
+ }
157
+ return { dim: probe.dim, freeIndices: probe.freeIndices };
158
+ }
159
+ /**
160
+ * Resolve a child of a covariant-derivative to its local {dim, freeIndices, role?}
161
+ * carrier. Same recursion pattern as resolveChildForPartialDerivative — reuses
162
+ * the partial-derivative resolver since the same child kinds appear.
163
+ */
164
+ function resolveChildForCovariantDerivative(node, parentCtx) {
165
+ return resolveChildForPartialDerivative(node, parentCtx);
166
+ }
167
+ /**
168
+ * Recursive dimension inference. On any sub-expression error we record a
169
+ * violation, return `null`, and let parent ops propagate the null up.
170
+ */
171
+ function infer(node, ctx) {
172
+ switch (node.kind) {
173
+ case 'symbol':
174
+ return node.dim;
175
+ case 'op': {
176
+ if (node.op === '^') {
177
+ // a^n — base is an arbitrary expression; exponent must be a numeric symbol
178
+ // (we read its `name` as a number). Non-numeric exponents would require
179
+ // the base to be dimensionless; we don't support that yet.
180
+ if (node.args.length !== 2) {
181
+ ctx.violations.push({
182
+ location: ctx.path,
183
+ expected: DIMENSIONLESS,
184
+ actual: DIMENSIONLESS,
185
+ note: `^ requires exactly 2 args (base, exponent), got ${node.args.length}`,
186
+ });
187
+ return null;
188
+ }
189
+ const [baseNode, expNode] = node.args;
190
+ // Per Part-VII §VII.5: '^' is a scalar operator. Capture the base's
191
+ // local freeIndices and reject if non-empty (tensor base).
192
+ const baseProbe = inferArgLocal(baseNode, ctx, 'args[0]');
193
+ const baseDim = baseProbe.dim;
194
+ if (baseDim === null)
195
+ return null;
196
+ if (baseProbe.freeIndices.size > 0) {
197
+ throw new TensorInScalarOpError('^');
198
+ }
199
+ if (!expNode || expNode.kind !== 'symbol') {
200
+ // Try to recover the exponent expression's inferred dim so the
201
+ // violation is informative (expected ≠ actual). If inference itself
202
+ // fails, fall back to DIMENSIONLESS — but the note still carries
203
+ // the structural reason, so a downstream consumer keying on
204
+ // `equals(expected,actual)` will still see the mismatch in the
205
+ // generic case.
206
+ let actualDim = DIMENSIONLESS;
207
+ if (expNode) {
208
+ // Use a throwaway local violation channel so a deeper
209
+ // inference error doesn't double-report — we only want the
210
+ // dim if it can be inferred cleanly.
211
+ const probeCtx = { path: joinPath(ctx.path, 'args[1]'), violations: [], freeIndices: new Map() };
212
+ const probed = infer(expNode, probeCtx);
213
+ if (probed !== null && probed !== undefined && probeCtx.violations.length === 0) {
214
+ actualDim = probed;
215
+ }
216
+ }
217
+ ctx.violations.push({
218
+ location: joinPath(ctx.path, 'args[1]'),
219
+ expected: DIMENSIONLESS,
220
+ actual: actualDim,
221
+ note: '^ exponent must be a numeric literal symbol in this MVP',
222
+ });
223
+ return null;
224
+ }
225
+ const n = Number(expNode.name);
226
+ if (!Number.isFinite(n)) {
227
+ ctx.violations.push({
228
+ location: joinPath(ctx.path, 'args[1]'),
229
+ expected: DIMENSIONLESS,
230
+ actual: expNode.dim,
231
+ note: `^ exponent "${expNode.name}" is not a finite number`,
232
+ });
233
+ return null;
234
+ }
235
+ return power(baseDim, n);
236
+ }
237
+ if (node.op === '*' || node.op === '/') {
238
+ if (node.args.length === 0)
239
+ return DIMENSIONLESS;
240
+ // Per Part-VII §VII.5: '*' / '/' are scalar-only operators. Any
241
+ // arg with non-empty freeIndices is rejected with
242
+ // TensorInScalarOpError; users must use 'tensor-product' for
243
+ // tensor multiplication. Scalar-only operand lists retain the
244
+ // existing dim-accumulation behavior.
245
+ let acc = null;
246
+ for (let i = 0; i < node.args.length; i++) {
247
+ const probe = inferArgLocal(node.args[i], ctx, `args[${i}]`);
248
+ const childDim = probe.dim;
249
+ if (childDim === null)
250
+ return null;
251
+ if (probe.freeIndices.size > 0) {
252
+ throw new TensorInScalarOpError(node.op);
253
+ }
254
+ if (i === 0)
255
+ acc = childDim;
256
+ else if (node.op === '*')
257
+ acc = multiply(acc, childDim);
258
+ else
259
+ acc = divide(acc, childDim);
260
+ }
261
+ return acc;
262
+ }
263
+ // '+' or '-' — all operands must share a common dimension AND
264
+ // (per Part-VII §VII.5) the same freeIndices signature. Mismatched
265
+ // free-index maps raise FreeIndexMismatchError; this catches both
266
+ // tensor + scalar (one map non-empty, one empty) and tensor + tensor
267
+ // with differing variance / labels / counts.
268
+ if (node.args.length === 0)
269
+ return DIMENSIONLESS;
270
+ let acc = null;
271
+ let firstFI = null;
272
+ for (let i = 0; i < node.args.length; i++) {
273
+ const probe = inferArgLocal(node.args[i], ctx, `args[${i}]`);
274
+ const childDim = probe.dim;
275
+ if (childDim === null)
276
+ return null;
277
+ if (i === 0) {
278
+ acc = childDim;
279
+ firstFI = probe.freeIndices;
280
+ }
281
+ else {
282
+ if (!freeIndicesEqual(firstFI, probe.freeIndices)) {
283
+ throw new FreeIndexMismatchError(`op '${node.op}' args have mismatched freeIndices: ` +
284
+ `args[0] has ${formatFreeIndices(firstFI)} but ` +
285
+ `args[${i}] has ${formatFreeIndices(probe.freeIndices)}. ` +
286
+ `All operands of a tensor sum must share the same free-index signature.`);
287
+ }
288
+ try {
289
+ acc = node.op === '+' ? add(acc, childDim) : subtract(acc, childDim);
290
+ }
291
+ catch (err) {
292
+ if (err instanceof DimensionMismatchError) {
293
+ ctx.violations.push({
294
+ location: joinPath(ctx.path, `args[${i}]`),
295
+ expected: acc,
296
+ actual: childDim,
297
+ note: `Cannot ${node.op === '+' ? 'add' : 'subtract'} ${format(childDim)} with running ${format(acc)} (dimension mismatch).`,
298
+ });
299
+ return null;
300
+ }
301
+ throw err;
302
+ }
303
+ }
304
+ }
305
+ // Propagate the (shared) freeIndices signature to the parent ctx so
306
+ // a tensor-sum can flow into another tensor-aware operator above.
307
+ if (firstFI !== null) {
308
+ for (const [label, counts] of firstFI) {
309
+ ctx.freeIndices.set(label, counts);
310
+ }
311
+ }
312
+ return acc;
313
+ }
314
+ case 'integral': {
315
+ // ∫ f dx — result has dim(f) * dim(x).
316
+ // Guard against malformed nodes loaded from JSON / hand-built test
317
+ // fixtures that omit `integrand` or `over` (TypeScript requires them
318
+ // but `as unknown as ExprNode` casts can bypass the check).
319
+ if (!node.integrand || !node.over) {
320
+ ctx.violations.push({
321
+ location: ctx.path,
322
+ expected: DIMENSIONLESS,
323
+ actual: DIMENSIONLESS,
324
+ note: `integral requires both 'integrand' and 'over' fields`,
325
+ });
326
+ return null;
327
+ }
328
+ // v0.3.1 audit fix: shallow `{ ...ctx, path }` shared ctx.freeIndices
329
+ // (a Map, copied by reference), so a tensor-valued integrand silently
330
+ // leaked its free indices into the parent accumulator. Use
331
+ // inferArgLocal() to give each child a fresh local freeIndices Map.
332
+ // v0.3.0 has no tensor-integral semantics; the operator is dimensional
333
+ // scalar and child free-indices stay local.
334
+ const fProbe = inferArgLocal(node.integrand, ctx, 'integrand');
335
+ const xProbe = inferArgLocal(node.over, ctx, 'over');
336
+ if (fProbe.dim === null || xProbe.dim === null)
337
+ return null;
338
+ return multiply(fProbe.dim, xProbe.dim);
339
+ }
340
+ case 'derivative': {
341
+ // d f / d x — result has dim(f) / dim(x).
342
+ // Same shape guard as `integral` above.
343
+ if (!node.of || !node.wrt) {
344
+ ctx.violations.push({
345
+ location: ctx.path,
346
+ expected: DIMENSIONLESS,
347
+ actual: DIMENSIONLESS,
348
+ note: `derivative requires both 'of' and 'wrt' fields`,
349
+ });
350
+ return null;
351
+ }
352
+ // v0.3.1 audit fix: same shallow-spread ctx.freeIndices leak as the
353
+ // integral case above. Use inferArgLocal() so a tensor-valued `of`
354
+ // doesn't bleed its free indices into the parent. v0.3.0 has no
355
+ // tensor-derivative semantics (tensor-partial-derivative is the
356
+ // dedicated node for that); this `derivative` node stays dimensional
357
+ // scalar.
358
+ const fProbe = inferArgLocal(node.of, ctx, 'of');
359
+ const xProbe = inferArgLocal(node.wrt, ctx, 'wrt');
360
+ if (fProbe.dim === null || xProbe.dim === null)
361
+ return null;
362
+ return divide(fProbe.dim, xProbe.dim);
363
+ }
364
+ case 'tensor-symbol': {
365
+ // Real validation per Part-VII §VII.4. Builds the free-indices map
366
+ // from declared indices and merges into the context accumulator so
367
+ // the root validate() call sees them in its ValidationResult.
368
+ const { dim, freeIndices } = validateTensorSymbol(node);
369
+ for (const [label, counts] of freeIndices) {
370
+ ctx.freeIndices.set(label, counts);
371
+ }
372
+ return dim;
373
+ }
374
+ case 'tensor-product': {
375
+ // Task 6 — Einstein contraction. We delegate the algebra to the
376
+ // pure `computeContraction(args, validateChild)` helper in tensor.ts
377
+ // and inject `validateChild` to break the module cycle that would
378
+ // otherwise arise from tensor.ts importing the validator.
379
+ //
380
+ // CRITICAL: every nested call uses *local* freeIndices maps; we never
381
+ // mutate ctx.freeIndices from inside the recursion. Only the outer-
382
+ // most tensor-product case merges its final residual map into the
383
+ // shared ctx.freeIndices accumulator. This is what makes
384
+ // (A·B)·C-style nested products correct: the inner product's dummy
385
+ // indices stay scoped to the inner call.
386
+ try {
387
+ const result = computeContraction(node.args, (child) => resolveChildForContraction(child, ctx));
388
+ for (const [label, counts] of result.freeIndices) {
389
+ ctx.freeIndices.set(label, counts);
390
+ }
391
+ return result.dim;
392
+ }
393
+ catch (err) {
394
+ // Errors from the contraction (IndexLabelCollisionError,
395
+ // VarianceMismatchError) are part of the public surface — propagate
396
+ // them so callers / tests can catch by type.
397
+ throw err;
398
+ }
399
+ }
400
+ case 'metric-tensor': {
401
+ const { dim, freeIndices } = validateMetricTensor(node);
402
+ for (const [label, counts] of freeIndices) {
403
+ ctx.freeIndices.set(label, counts);
404
+ }
405
+ return dim;
406
+ }
407
+ case 'kronecker-delta': {
408
+ const { dim, freeIndices } = validateKroneckerDelta(node);
409
+ for (const [label, counts] of freeIndices) {
410
+ ctx.freeIndices.set(label, counts);
411
+ }
412
+ return dim;
413
+ }
414
+ case 'tensor-partial-derivative': {
415
+ const result = validatePartialDerivative(node, (child) => resolveChildForPartialDerivative(child, ctx));
416
+ for (const [label, counts] of result.freeIndices) {
417
+ ctx.freeIndices.set(label, counts);
418
+ }
419
+ return result.dim;
420
+ }
421
+ case 'covariant-derivative': {
422
+ const result = validateCovariantDerivative(node, (child) => resolveChildForCovariantDerivative(child, ctx));
423
+ for (const [label, counts] of result.freeIndices) {
424
+ ctx.freeIndices.set(label, counts);
425
+ }
426
+ return result.dim;
427
+ }
428
+ default: {
429
+ // Exhaustiveness guard: if a future ExprNode arm is added but not
430
+ // handled here, this branch records a shape violation rather than
431
+ // silently returning `undefined` (which validate() would coerce to
432
+ // `ok: true, inferredDimension: undefined` — see silent-failure F1).
433
+ const _exhaustive = node;
434
+ void _exhaustive;
435
+ const kind = node?.kind;
436
+ ctx.violations.push({
437
+ location: ctx.path,
438
+ expected: DIMENSIONLESS,
439
+ actual: DIMENSIONLESS,
440
+ note: `Validator: unknown ExprNode.kind ${JSON.stringify(kind)}`,
441
+ });
442
+ return null;
443
+ }
444
+ }
445
+ }
446
+ /**
447
+ * A violation set passes iff it contains no error-severity violation.
448
+ * Violations with `severity` absent default to 'error' (v0.3.5 §4).
449
+ */
450
+ function okFromViolations(violations) {
451
+ return !violations.some((v) => (v.severity ?? 'error') === 'error');
452
+ }
453
+ export function validate(expr) {
454
+ const ctx = { path: '', violations: [], freeIndices: new Map() };
455
+ const dim = infer(expr, ctx);
456
+ return {
457
+ ok: okFromViolations(ctx.violations) && dim !== null && dim !== undefined,
458
+ inferredDimension: dim ?? null,
459
+ freeIndices: ctx.freeIndices,
460
+ violations: ctx.violations,
461
+ };
462
+ }
463
+ /**
464
+ * Opt-in symbolic InverseMetricInconsistencyWarning check. Given a
465
+ * lower/upper metric pair, returns a deduplicated (at most one) warning-
466
+ * severity Violation set. v0.3.5 §7. (Deliberately not folded into
467
+ * validate() — that is the hot path for the whole test suite.)
468
+ */
469
+ export function validateInverseMetricPair(gLower, gUpper) {
470
+ const note = checkInverseMetricStructure(gLower, gUpper);
471
+ if (note === null)
472
+ return [];
473
+ return [{
474
+ location: `${gLower.name}/${gUpper.name}`,
475
+ expected: gLower.dim,
476
+ actual: gUpper.dim,
477
+ note,
478
+ severity: 'warning',
479
+ }];
480
+ }
481
+ export function validateEquation(lhs, rhs) {
482
+ const lhsCtx = { path: 'lhs', violations: [], freeIndices: new Map() };
483
+ const rhsCtx = { path: 'rhs', violations: [], freeIndices: new Map() };
484
+ const lhsDim = infer(lhs, lhsCtx);
485
+ const rhsDim = infer(rhs, rhsCtx);
486
+ const violations = [...lhsCtx.violations, ...rhsCtx.violations];
487
+ if (lhsDim !== null && rhsDim !== null && !equals(lhsDim, rhsDim)) {
488
+ violations.push({
489
+ location: '<equation>',
490
+ expected: lhsDim,
491
+ actual: rhsDim,
492
+ note: `LHS has ${format(lhsDim)} but RHS has ${format(rhsDim)} — equation is not dimensionally homogeneous.`,
493
+ });
494
+ }
495
+ return {
496
+ ok: okFromViolations(violations) && lhsDim !== null && rhsDim !== null,
497
+ inferredDimension: lhsDim, // by convention, LHS dimension is the canonical answer
498
+ // By convention LHS free-indices map is the canonical answer (mirrors
499
+ // inferredDimension's LHS bias). Equation-level free-index agreement
500
+ // checks are deferred to Task 7 (op-tensor boundary rules).
501
+ freeIndices: lhsCtx.freeIndices,
502
+ violations,
503
+ };
504
+ }
505
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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gB,CAAC,GAAa,EAAE,GAAa;IAC3D,MAAM,MAAM,GAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IACrF,MAAM,MAAM,GAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IACrF,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAEhE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QAClE,UAAU,CAAC,IAAI,CAAC;YACd,QAAQ,EAAE,YAAY;YACtB,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW,MAAM,CAAC,MAAM,CAAC,gBAAgB,MAAM,CAAC,MAAM,CAAC,+CAA+C;SAC7G,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,EAAE,EAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI;QACtE,iBAAiB,EAAE,MAAM,EAAE,uDAAuD;QAClF,sEAAsE;QACtE,qEAAqE;QACrE,4DAA4D;QAC5D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Universal Physics Tensor Framework
3
+ *
4
+ * Computational framework for exploring unified physics through tensor formalism
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ export { UniversalTensor } from './core/tensor.js';
9
+ export type { TensorConfig, TensorIndices, PhysicalLaw, BridgeEquation, EmergentPhenomenon, PhysicalScale, Force, Symmetry, InformationMeasure, } from './core/types.js';
10
+ export { PhysicalConstants } from './core/types.js';
11
+ export { BRIDGE_EQUATIONS } from './bridges/index.js';
12
+ export type { BridgeEquationEntry, BridgeEquationStatus, BridgeIssueSeverity, BridgeIssueFixable, KnownIssue, } from './bridges/index.js';
13
+ export { evaluateGravitationalLensing, type GravitationalLensingInputs, type GravitationalLensingResult, evaluatePerihelionPrecession, type PerihelionPrecessionInputs, type PerihelionPrecessionResult, } from './bridges/index.js';
14
+ export { christoffel } from './dimensional/connection.js';
15
+ export type { CovariantDerivativeNode } from './dimensional/validator.js';
16
+ export { integrateGeodesic, type GeodesicIntegratorInputs, type GeodesicIntegratorResult, } from './numerical/geodesic-integrator.js';
17
+ export type { Dimension } from './dimensional/types.js';
18
+ export { DIMENSIONLESS, LENGTH, AREA, TIME, FREQUENCY, MASS, VELOCITY, ACCELERATION, FORCE, ENERGY, POWER, ACTION, TEMPERATURE, ENTROPY, CHARGE, } from './dimensional/types.js';
19
+ export { multiply, divide, power, add, subtract, equals, format, DimensionMismatchError, } from './dimensional/algebra.js';
20
+ export type { ExprNode, ValidationResult, Violation } from './dimensional/validator.js';
21
+ export { validate, validateEquation, validateInverseMetricPair } from './dimensional/validator.js';
22
+ export { inferDimensionForBridge } from './dimensional/bridge-check.js';
23
+ export { evaluateNumerical, evaluateNumericalRaw, evaluateMetricInverse, Float64ReferenceEngine, getActiveEngine, setActiveEngine, NumericalBackendError, DuplicateCoordinateWarning, EngineCapabilityError, hasAutogradSupport, evaluateBE37CovariantEikonalNumerical, } from './numerical/index.js';
24
+ export type { NumericalResult, NumericalRawResult, EvaluateOptions, NumericalInputs, TensorEngine, EngineTensor, EinsumSpec, NestedArray, GridField, ForwardGradResult, ReverseGradResult, } from './numerical/index.js';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
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;AAClC,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAOxE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,qBAAqB,EAErB,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,qCAAqC,GACtC,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EAET,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Universal Physics Tensor Framework
3
+ *
4
+ * Computational framework for exploring unified physics through tensor formalism
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ export { UniversalTensor } from './core/tensor.js';
9
+ export { PhysicalConstants } from './core/types.js';
10
+ // Machine-readable bridge equation index — the 40+ catalogued equations.
11
+ // `BridgeEquationEntry` is intentionally a different shape from the runtime
12
+ // `BridgeEquation` interface above; the entry captures spec-level metadata
13
+ // (status, known issues, references, dependencies), while `BridgeEquation`
14
+ // describes a runtime bridge between two tensor regimes.
15
+ export { BRIDGE_EQUATIONS } from './bridges/index.js';
16
+ // v0.4.0 bridge implementations (evaluator functions beyond the spec catalog)
17
+ export { evaluateGravitationalLensing, evaluatePerihelionPrecession, } from './bridges/index.js';
18
+ // v0.4.0 connection layer — Christoffel formula builder and covariant derivative
19
+ // AST node type. `christoffel` is public because bridge modules and downstream
20
+ // callers compose Γ trees directly; `CovariantDerivativeNode` is the structural
21
+ // type for the new ∇_μ AST kind.
22
+ export { christoffel } from './dimensional/connection.js';
23
+ // v0.4.0 geodesic integrator (RK4 solver — headline feature of v0.4.0)
24
+ export { integrateGeodesic, } from './numerical/geodesic-integrator.js';
25
+ export { DIMENSIONLESS, LENGTH, AREA, TIME, FREQUENCY, MASS, VELOCITY, ACCELERATION, FORCE, ENERGY, POWER, ACTION, TEMPERATURE, ENTROPY, CHARGE, } from './dimensional/types.js';
26
+ export { multiply, divide, power, add, subtract, equals, format, DimensionMismatchError, } from './dimensional/algebra.js';
27
+ export { validate, validateEquation, validateInverseMetricPair } from './dimensional/validator.js';
28
+ export { inferDimensionForBridge } from './dimensional/bridge-check.js';
29
+ // v0.3.5 numerical-contraction backend. See docs/planning/v0.3.5-Design.md.
30
+ // Every symbol below is `@public` — the consumer-facing (TensorJS) surface.
31
+ // `MathTSEngine` is intentionally NOT re-exported here: it lives behind the
32
+ // `@danielsimonjr/mathts-tensor` optionalDependency and is reachable only via
33
+ // the `universal-physics-tensor/numerical/mathts-engine` exports subpath.
34
+ export { evaluateNumerical, evaluateNumericalRaw, evaluateMetricInverse, Float64ReferenceEngine, getActiveEngine, setActiveEngine, NumericalBackendError,
35
+ // v0.4.0 additions to the numerical surface
36
+ DuplicateCoordinateWarning, EngineCapabilityError, hasAutogradSupport, evaluateBE37CovariantEikonalNumerical, } from './numerical/index.js';
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAYnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,yEAAyE;AACzE,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,yDAAyD;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAStD,8EAA8E;AAC9E,OAAO,EACL,4BAA4B,EAG5B,4BAA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