universal-physics-tensor 0.4.6 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/dimensional/connection-validators.d.ts +59 -1
  2. package/dist/dimensional/connection-validators.d.ts.map +1 -1
  3. package/dist/dimensional/connection-validators.js +75 -1
  4. package/dist/dimensional/connection-validators.js.map +1 -1
  5. package/dist/dimensional/curvature.d.ts +336 -0
  6. package/dist/dimensional/curvature.d.ts.map +1 -0
  7. package/dist/dimensional/curvature.js +291 -0
  8. package/dist/dimensional/curvature.js.map +1 -0
  9. package/dist/dimensional/validator.d.ts +5 -3
  10. package/dist/dimensional/validator.d.ts.map +1 -1
  11. package/dist/dimensional/validator.js +58 -1
  12. package/dist/dimensional/validator.js.map +1 -1
  13. package/dist/index.d.ts +8 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +19 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/numerical/be37-covariant-eikonal.d.ts +96 -39
  18. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
  19. package/dist/numerical/be37-covariant-eikonal.js +202 -40
  20. package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
  21. package/dist/numerical/curvature-lowering-helpers.d.ts +162 -0
  22. package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -0
  23. package/dist/numerical/curvature-lowering-helpers.js +378 -0
  24. package/dist/numerical/curvature-lowering-helpers.js.map +1 -0
  25. package/dist/numerical/errors.d.ts +16 -0
  26. package/dist/numerical/errors.d.ts.map +1 -1
  27. package/dist/numerical/errors.js +20 -0
  28. package/dist/numerical/errors.js.map +1 -1
  29. package/dist/numerical/gl4-integrator.d.ts +167 -0
  30. package/dist/numerical/gl4-integrator.d.ts.map +1 -0
  31. package/dist/numerical/gl4-integrator.js +276 -0
  32. package/dist/numerical/gl4-integrator.js.map +1 -0
  33. package/dist/numerical/index.d.ts +8 -0
  34. package/dist/numerical/index.d.ts.map +1 -1
  35. package/dist/numerical/index.js +4 -0
  36. package/dist/numerical/index.js.map +1 -1
  37. package/dist/numerical/lowering.d.ts.map +1 -1
  38. package/dist/numerical/lowering.js +170 -0
  39. package/dist/numerical/lowering.js.map +1 -1
  40. package/dist/numerical/perihelion-finder.d.ts +84 -0
  41. package/dist/numerical/perihelion-finder.d.ts.map +1 -0
  42. package/dist/numerical/perihelion-finder.js +261 -0
  43. package/dist/numerical/perihelion-finder.js.map +1 -0
  44. package/package.json +1 -1
@@ -11,8 +11,16 @@
11
11
  * @module dimensional/connection-validators
12
12
  */
13
13
  import type { Dimension } from './types.js';
14
- import type { Role } from './tensor.js';
14
+ import type { Role, TensorSymbolNode } from './tensor.js';
15
15
  import type { MetricTensorNode, CovariantIndex, PartialDerivativeChildResult } from './metric-validators.js';
16
+ /**
17
+ * v0.5.0: upper-only index marker (mirror of CovariantIndex). Used by
18
+ * RiemannTensorNode to type-pin the ρ slot at compile time.
19
+ */
20
+ export interface UpperIndex {
21
+ readonly label: string;
22
+ readonly variance: 'upper';
23
+ }
16
24
  /**
17
25
  * ExprNode-like — uses `unknown` for `of`/`wrt` because connection-validators.ts
18
26
  * MUST NOT import from validator.ts (module cycle). The validator's case arm
@@ -50,4 +58,54 @@ export interface CovariantDerivativeValidationResult {
50
58
  * (same structural rule as tensor-partial-derivative).
51
59
  */
52
60
  export declare function validateCovariantDerivative(node: CovariantDerivativeNode, validateChild: (child: unknown) => PartialDerivativeChildResult): CovariantDerivativeValidationResult;
61
+ /**
62
+ * v0.5.0 (Task 1c-i): Riemann curvature tensor AST node R^ρ_{σμν}.
63
+ *
64
+ * Index convention per Carroll Ch. 3 §3.4 (Adam+Eve F4/S3):
65
+ * R^ρ_σμν = ∂_μ Γ^ρ_σν − ∂_ν Γ^ρ_σμ + Γ^ρ_λμ Γ^λ_σν − Γ^ρ_λν Γ^λ_σμ
66
+ * (σ in SECOND lower slot of each Γ.)
67
+ *
68
+ * Dimension F8/I3: Riemann is 1/L² (inverse length squared), NOT
69
+ * dimensionless. Carroll Ch. 3 §3.4: R^ρ_σμν has units of (∂Γ) where
70
+ * Γ ~ 1/L and ∂ ~ 1/L → R ~ 1/L².
71
+ *
72
+ * H1 (v0.4.0 pattern): gLower, gInverse, xCoord sub-nodes are present for
73
+ * downstream consumers (numerical lowering at Task 6), but their free
74
+ * indices are NOT propagated — the Riemann formula's contractions consume
75
+ * them internally. Same rule as CovariantDerivativeNode.
76
+ */
77
+ export interface RiemannTensorNode {
78
+ readonly kind: 'riemann-tensor';
79
+ readonly upperIndex: UpperIndex;
80
+ readonly lowerIndices: readonly [CovariantIndex, CovariantIndex, CovariantIndex];
81
+ readonly gLower: MetricTensorNode;
82
+ readonly gInverse: MetricTensorNode;
83
+ readonly xCoord: TensorSymbolNode;
84
+ }
85
+ export interface RiemannTensorValidationResult {
86
+ readonly dim: Dimension;
87
+ readonly freeIndices: Map<string, {
88
+ upper: number;
89
+ lower: number;
90
+ }>;
91
+ }
92
+ /**
93
+ * Validate a riemann-tensor node.
94
+ *
95
+ * Throws:
96
+ * - PartialDerivativeIndexVarianceError if upperIndex.variance !== 'upper'
97
+ * or any lowerIndices[i].variance !== 'lower'
98
+ * - MetricSignatureError if gLower / gInverse signature is wrong (reuses
99
+ * CovariantDerivativeNode's structural checks)
100
+ * - IndexLabelCollisionError if the 4 free-index labels {ρ, σ, μ, ν} are
101
+ * not pairwise distinct (M9: disjointness only on the riemann node's
102
+ * own free labels; raise/lower aliasing in surrounding algebra remains
103
+ * legal — we do NOT compare against gLower/gInverse/xCoord labels).
104
+ *
105
+ * H1 (v0.4.0 pattern): gLower/gInverse/xCoord are NOT validated via the
106
+ * validateChild callback, so their free indices do not propagate. They are
107
+ * signature-checked here for early structural error reporting; their
108
+ * numerical contents are consumed by Task 6's lowering helper.
109
+ */
110
+ export declare function validateRiemannTensor(node: RiemannTensorNode): RiemannTensorValidationResult;
53
111
  //# sourceMappingURL=connection-validators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection-validators.d.ts","sourceRoot":"","sources":["../../src/dimensional/connection-validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,4BAA4B,EAC7B,MAAM,wBAAwB,CAAC;AAOhC;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;CACrC;AAED,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,uBAAuB,EAC7B,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,4BAA4B,GAC9D,mCAAmC,CAqErC"}
1
+ {"version":3,"file":"connection-validators.d.ts","sourceRoot":"","sources":["../../src/dimensional/connection-validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,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BAAgB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACnC;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,iBAAiB,GACtB,6BAA6B,CAyE/B"}
@@ -11,7 +11,7 @@
11
11
  * @module dimensional/connection-validators
12
12
  */
13
13
  import { divide } from './algebra.js';
14
- import { PartialDerivativeIndexVarianceError, MetricSignatureError, DuplicateCoordinateWarning, } from './errors.js';
14
+ import { PartialDerivativeIndexVarianceError, MetricSignatureError, DuplicateCoordinateWarning, IndexLabelCollisionError, } from './errors.js';
15
15
  /**
16
16
  * Validate a covariant-derivative node. Pure-function module-cycle-free
17
17
  * pattern (matches validatePartialDerivative). Recursion via the
@@ -80,4 +80,78 @@ export function validateCovariantDerivative(node, validateChild) {
80
80
  ? { dim, freeIndices, role: ofResult.role }
81
81
  : { dim, freeIndices };
82
82
  }
83
+ /**
84
+ * Validate a riemann-tensor node.
85
+ *
86
+ * Throws:
87
+ * - PartialDerivativeIndexVarianceError if upperIndex.variance !== 'upper'
88
+ * or any lowerIndices[i].variance !== 'lower'
89
+ * - MetricSignatureError if gLower / gInverse signature is wrong (reuses
90
+ * CovariantDerivativeNode's structural checks)
91
+ * - IndexLabelCollisionError if the 4 free-index labels {ρ, σ, μ, ν} are
92
+ * not pairwise distinct (M9: disjointness only on the riemann node's
93
+ * own free labels; raise/lower aliasing in surrounding algebra remains
94
+ * legal — we do NOT compare against gLower/gInverse/xCoord labels).
95
+ *
96
+ * H1 (v0.4.0 pattern): gLower/gInverse/xCoord are NOT validated via the
97
+ * validateChild callback, so their free indices do not propagate. They are
98
+ * signature-checked here for early structural error reporting; their
99
+ * numerical contents are consumed by Task 6's lowering helper.
100
+ */
101
+ export function validateRiemannTensor(node) {
102
+ if (node.upperIndex.variance !== 'upper') {
103
+ throw new PartialDerivativeIndexVarianceError(`riemann-tensor: upperIndex '${node.upperIndex.label}' must be 'upper', ` +
104
+ `got '${node.upperIndex.variance}'`);
105
+ }
106
+ for (let i = 0; i < 3; i++) {
107
+ const idx = node.lowerIndices[i];
108
+ if (idx.variance !== 'lower') {
109
+ throw new PartialDerivativeIndexVarianceError(`riemann-tensor: lowerIndices[${i}] '${idx.label}' must be 'lower', ` +
110
+ `got '${idx.variance}'`);
111
+ }
112
+ }
113
+ if (node.gLower.indices[0].variance !== 'lower' ||
114
+ node.gLower.indices[1].variance !== 'lower') {
115
+ throw new MetricSignatureError(node.gLower.name, `riemann-tensor requires gLower to be both-lower (got ` +
116
+ `[${node.gLower.indices[0].variance}, ${node.gLower.indices[1].variance}])`);
117
+ }
118
+ if (node.gInverse.indices[0].variance !== 'upper' ||
119
+ node.gInverse.indices[1].variance !== 'upper') {
120
+ throw new MetricSignatureError(node.gInverse.name, `riemann-tensor requires gInverse to be both-upper (got ` +
121
+ `[${node.gInverse.indices[0].variance}, ${node.gInverse.indices[1].variance}])`);
122
+ }
123
+ // M9: disjointness on the riemann-tensor's own 4 free labels only.
124
+ // Repeated labels across {ρ, σ, μ, ν} would imply an implicit contraction
125
+ // (e.g. R^μ_μνλ = R_νλ), which is the Ricci-tensor node's job — not the
126
+ // bare Riemann node's. We deliberately do NOT compare against gLower /
127
+ // gInverse / xCoord labels: those are H1-suppressed dummies, and legal
128
+ // post-raise/lower algebra may reuse those labels (see plan §M9).
129
+ const labels = [
130
+ node.upperIndex.label,
131
+ node.lowerIndices[0].label,
132
+ node.lowerIndices[1].label,
133
+ node.lowerIndices[2].label,
134
+ ];
135
+ const seen = new Set();
136
+ for (const label of labels) {
137
+ if (seen.has(label)) {
138
+ throw new IndexLabelCollisionError(label, 2, ['riemann-tensor']);
139
+ }
140
+ seen.add(label);
141
+ }
142
+ const freeIndices = new Map();
143
+ freeIndices.set(node.upperIndex.label, { upper: 1, lower: 0 });
144
+ for (const idx of node.lowerIndices) {
145
+ freeIndices.set(idx.label, { upper: 0, lower: 1 });
146
+ }
147
+ // F8/I3: Riemann carries inverse-length-squared. Hard-coded — same shape
148
+ // as the dim is structurally fixed for every Riemann tensor regardless of
149
+ // metric dim. (The metric is treated as dimensionless per our convention.)
150
+ const dim = { L: -2, M: 0, T: 0, I: 0, Theta: 0, N: 0, J: 0 };
151
+ // Role intentionally omitted — Riemann is a derived curvature object,
152
+ // not a primary field; downstream tensor-product / equation consumers
153
+ // don't need a role tag here. Mirrors CovariantDerivativeNode's
154
+ // role-on-passthrough-only pattern.
155
+ return { dim, freeIndices };
156
+ }
83
157
  //# sourceMappingURL=connection-validators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection-validators.js","sourceRoot":"","sources":["../../src/dimensional/connection-validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAMtC,OAAO,EACL,mCAAmC,EACnC,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAsBrB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAA6B,EAC7B,aAA+D;IAE/D,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACvC,MAAM,IAAI,mCAAmC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IACD,IACE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO;QAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO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E,CAAC,EAAE,CAAC,CAAC;IAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACpC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,yEAAyE;IACzE,0EAA0E;IAC1E,2EAA2E;IAC3E,MAAM,GAAG,GAAc,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAEzE,sEAAsE;IACtE,sEAAsE;IACtE,gEAAgE;IAChE,oCAAoC;IACpC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,336 @@
1
+ /**
2
+ * Curvature-derived helpers — Ricci, Einstein, Bianchi (v0.5.0 Phase 1d).
3
+ *
4
+ * Module hosts the layer of GR objects derived by contraction of a
5
+ * `RiemannTensorNode`:
6
+ *
7
+ * - `ricci(R)` → R_μν = R^λ_{λμν} (this file, Task 7)
8
+ * - `einstein(R)` → G_μν = R_μν − ½ g_μν R (Task 8 — TBD)
9
+ * - `bianchiResidual(R)` → ∇_λ G^{λμ} (Task 9 — TBD)
10
+ *
11
+ * Separation rationale (Design §3 Task 1d): the bare `RiemannTensorNode`
12
+ * stays in `connection-validators.ts` next to `CovariantDerivativeNode`
13
+ * (both are *primary* curvature objects: connection + first-derivative).
14
+ * Everything *contracted from* Riemann lives here — keeps the module
15
+ * graph: tensor → metric → connection-validators → curvature.
16
+ *
17
+ * @module dimensional/curvature
18
+ */
19
+ import type { Dimension } from './types.js';
20
+ import type { ExprNode } from './validator.js';
21
+ import type { RiemannTensorNode } from './connection-validators.js';
22
+ import type { MetricTensorNode } from './metric-validators.js';
23
+ /**
24
+ * v0.5.0 Task 7: Ricci tensor AST node R_μν.
25
+ *
26
+ * Internally wraps a RiemannTensorNode and represents the contraction
27
+ * R_μν = R^λ_{λμν}. The wrapped Riemann's `upperIndex.label` and
28
+ * `lowerIndices[0].label` are the dummy contraction indices (the λ slot);
29
+ * the output free indices are `mu` and `nu` (cloned from
30
+ * `R.lowerIndices[1]` and `R.lowerIndices[2]` respectively).
31
+ *
32
+ * The node is its own validation arm in validator.ts and its own lowering
33
+ * arm in numerical/lowering.ts — same pattern as RiemannTensorNode (no
34
+ * AST-rewrite; the contraction is a single primitive walked directly).
35
+ *
36
+ * @public
37
+ */
38
+ export interface RicciTensorNode {
39
+ readonly kind: 'ricci-tensor';
40
+ /** The Riemann tensor whose first two slots are contracted. */
41
+ readonly riemann: RiemannTensorNode;
42
+ }
43
+ /**
44
+ * Result of validating a RicciTensorNode.
45
+ * @public
46
+ */
47
+ export interface RicciTensorValidationResult {
48
+ readonly dim: Dimension;
49
+ readonly freeIndices: Map<string, {
50
+ upper: number;
51
+ lower: number;
52
+ }>;
53
+ }
54
+ /**
55
+ * Validate a `ricci-tensor` node.
56
+ *
57
+ * Throws:
58
+ * - IndexLabelCollisionError if the embedded Riemann's two free output
59
+ * labels (the σ slot — lowerIndices[0] — and the ν slot —
60
+ * lowerIndices[2]) collide. (The contracted middle slot
61
+ * lowerIndices[1] is invisible to this check; any label is allowed
62
+ * there because it's a dummy.)
63
+ *
64
+ * The Riemann sub-node is validated structurally by re-entering its own
65
+ * validator via the `validateRiemannChild` callback (so its signature
66
+ * checks fire), but its free indices are NOT propagated — the ρ slot
67
+ * collapses into the contraction with the μ slot (Carroll Eq. 3.91:
68
+ * `R_μν = R^λ_{μλν}`), and the surviving σ / ν slots become the new
69
+ * free indices of the Ricci tensor.
70
+ */
71
+ export declare function validateRicciTensor(node: RicciTensorNode, validateRiemannChild: (child: RiemannTensorNode) => {
72
+ dim: Dimension;
73
+ freeIndices: Map<string, {
74
+ upper: number;
75
+ lower: number;
76
+ }>;
77
+ }): RicciTensorValidationResult;
78
+ /**
79
+ * Build the Ricci tensor R_μν = R^λ_{μλν} as a composite ExprNode.
80
+ *
81
+ * **Convention (Carroll Eq. 3.91).** Contract upper-ρ against the SECOND
82
+ * lower slot — the μ position in R^ρ_σμν, i.e., `lowerIndices[1]` in the
83
+ * RiemannTensorNode storage. The surviving free indices are the σ slot
84
+ * (`lowerIndices[0]`) → Ricci's first free output μ_out, and the ν slot
85
+ * (`lowerIndices[2]`) → Ricci's second free output ν_out.
86
+ *
87
+ * Index mapping after contraction:
88
+ * - upperIndex (ρ) → contracted with lowerIndices[1] (the μ slot, λ dummy)
89
+ * - lowerIndices[0] (σ) → Ricci's free output index 0 (μ_out)
90
+ * - lowerIndices[2] (ν) → Ricci's free output index 1 (ν_out)
91
+ * Result: R_μν with free indices {σ_label: lower, ν_label: lower}
92
+ *
93
+ * Index-map diagram:
94
+ * R^ρ _ σ _ μ _ ν (RiemannTensorNode slots)
95
+ * ↑ ↑
96
+ * upper lower[1] <- contract these two (ρ = μ = λ)
97
+ * lower[0] lower[2] <- become R_μν free indices
98
+ *
99
+ * **Why not "upper ↔ lowerIndices[0]" (the first-lower trace)?** The trace
100
+ * `R^λ_{λμν}` over the first pair (ρ ↔ σ) is identically zero by the
101
+ * first-pair antisymmetry of the (lowered) Riemann tensor — for any
102
+ * metric, including non-vacuum solutions like de Sitter. The
103
+ * constant-curvature identity `R_μν = (n-1) K g_μν` (Carroll §8.1,
104
+ * `R = 4Λ` in n=4) only matches the upper↔second-lower contraction.
105
+ * The de-Sitter Ricci-scalar test in `tests/dimensional/ricci.test.ts`
106
+ * is the discriminating fixture that pins this convention.
107
+ *
108
+ * The returned tree is a single `ricci-tensor` node wrapping the supplied
109
+ * Riemann. Validator and numerical lowering each have a dedicated arm —
110
+ * no AST rewrite into a `tensor-product`-of-Riemann happens here (the
111
+ * RiemannTensorNode is not contractable in the v0.3.5 tensor-product
112
+ * einsum sense; the contraction is a primitive operation walked directly).
113
+ *
114
+ * @public
115
+ */
116
+ export declare function ricci(R: RiemannTensorNode): ExprNode;
117
+ /**
118
+ * v0.5.0 Task 8: Einstein tensor AST node G_μν = R_μν − ½ R g_μν.
119
+ *
120
+ * Wraps a `RiemannTensorNode` (contracted via the same Carroll-Eq.-3.91
121
+ * convention as `RicciTensorNode` — see ricci()'s JSDoc) plus the metric
122
+ * pair needed for the scalar trace `R = g^μν R_μν` and the `½ R g_μν`
123
+ * subtraction term. Storage mirrors the `RicciTensorNode` pattern: own
124
+ * validator + lowering arms, no AST rewrite into op('-', ricci, scale·g).
125
+ *
126
+ * Free indices match `R.lowerIndices[0]` and `R.lowerIndices[2]` — same as
127
+ * ricci(R), with the same Carroll-Eq.-3.91 contraction; the embedded
128
+ * Riemann's middle slot lowerIndices[1] is the dummy λ.
129
+ *
130
+ * Dim: {L: -2} — inherited from Riemann/Ricci (both `R_μν` and `R · g_μν`
131
+ * carry 1/L²; subtraction preserves dim).
132
+ *
133
+ * @public
134
+ */
135
+ export interface EinsteinTensorNode {
136
+ readonly kind: 'einstein-tensor';
137
+ /** The Riemann tensor whose contraction yields the inner Ricci R_μν. */
138
+ readonly riemann: RiemannTensorNode;
139
+ /** Lower metric g_μν — supplies the `½ R g_μν` subtraction tensor. */
140
+ readonly gLower: MetricTensorNode;
141
+ /** Upper metric g^μν — supplies the scalar trace `R = g^μν R_μν`. */
142
+ readonly gInverse: MetricTensorNode;
143
+ }
144
+ /**
145
+ * Result of validating an EinsteinTensorNode.
146
+ * @public
147
+ */
148
+ export interface EinsteinTensorValidationResult {
149
+ readonly dim: Dimension;
150
+ readonly freeIndices: Map<string, {
151
+ upper: number;
152
+ lower: number;
153
+ }>;
154
+ }
155
+ /**
156
+ * Validate an `einstein-tensor` node.
157
+ *
158
+ * Delegates structural checks to the embedded Riemann via the
159
+ * `validateRiemannChild` callback (same pattern as `validateRicciTensor`)
160
+ * and reuses `validateRicciTensor` for the surviving free-index labels —
161
+ * an Einstein tensor's free indices are exactly the Ricci tensor's free
162
+ * indices (subtracting `½ R g_μν` with matching {μ_out, ν_out} labels
163
+ * preserves the index structure).
164
+ *
165
+ * The `gLower` / `gInverse` sub-nodes are deliberately NOT propagated as
166
+ * free indices — they are consumed internally by the scalar-trace
167
+ * contraction and the `½ R g_μν` multiplication (same H1 discipline as
168
+ * RiemannTensorNode for its gLower/gInverse fields).
169
+ *
170
+ * Throws:
171
+ * - Everything `validateRicciTensor` throws (IndexLabelCollisionError on
172
+ * surviving free-index collision; MetricSignatureError /
173
+ * PartialDerivativeIndexVarianceError from the inner Riemann).
174
+ */
175
+ export declare function validateEinsteinTensor(node: EinsteinTensorNode, validateRiemannChild: (child: RiemannTensorNode) => {
176
+ dim: Dimension;
177
+ freeIndices: Map<string, {
178
+ upper: number;
179
+ lower: number;
180
+ }>;
181
+ }): EinsteinTensorValidationResult;
182
+ /**
183
+ * Build the Einstein tensor G_μν = R_μν − ½ R g_μν as a composite ExprNode.
184
+ *
185
+ * **Convention.** Inherits Carroll Eq. 3.91 from `ricci(R)` — the inner
186
+ * Ricci is computed by contracting upper-ρ of the wrapped Riemann against
187
+ * `lowerIndices[1]` (the middle/μ slot in R^ρ_σμν). The scalar trace is
188
+ * `R = g^μν R_μν` and the subtraction term is `½ R · g_μν`. The result
189
+ * `G_μν` shares free indices {μ_out, ν_out} with `ricci(R)`.
190
+ *
191
+ * **Algebra (sanity check).**
192
+ * - de Sitter (n=4): `R_μν = Λ g_μν`, `R = 4Λ` ⇒
193
+ * `G_μν = Λ g_μν − ½·4Λ·g_μν = −Λ g_μν`. Vacuum Einstein equation
194
+ * `G_μν + Λ g_μν = 0` holds.
195
+ * - Schwarzschild (vacuum): `R_μν ≡ 0`, `R = 0` ⇒ `G_μν ≡ 0`.
196
+ * - Trace identity (any metric, n=4): `g^μν G_μν = R − ½·R·4 = −R`.
197
+ *
198
+ * **AST shape.** Single `einstein-tensor` node wrapping `R`, `gLower`,
199
+ * `gInverse`. Validator and numerical lowering each have a dedicated arm;
200
+ * no AST rewrite into `ricci(R) − ½ R g_μν` happens (the subtraction term
201
+ * would need a tensor-valued scalar-multiply that the v0.3.5 tensor-product
202
+ * einsum does not support directly). Same walk-directly pattern as Ricci.
203
+ *
204
+ * **Matter coupling is out of scope.** The vacuum / cosmological-constant
205
+ * tests pin G_μν only; `G_μν = κ T_μν` (Einstein field equations with a
206
+ * stress-energy source) is deferred to v0.6.0+.
207
+ *
208
+ * @public
209
+ */
210
+ export declare function einstein(R: RiemannTensorNode, g: MetricTensorNode, gInverse: MetricTensorNode): ExprNode;
211
+ /**
212
+ * v0.5.0 Task 9: Second-Bianchi-identity residual AST node.
213
+ *
214
+ * Represents the cyclic-over-first-three-indices sum that vanishes by the
215
+ * second Bianchi identity (Carroll Eq. 3.95):
216
+ *
217
+ * B_{λμνρσ} = ∇_λ R_{μνρσ} + ∇_μ R_{νλρσ} + ∇_ν R_{λμρσ} ≡ 0
218
+ *
219
+ * Storage: wraps the originating RiemannTensorNode. Lowering computes B
220
+ * numerically by:
221
+ * 1. Lowering the upper-ρ of the Riemann tensor JS-side via g_{aρ}.
222
+ * 2. Computing ∂_λ R_{αβγδ} via a 4th-order centered FD (one MORE layer
223
+ * on top of the Riemann lowering's already-FD-laden Γ + ∂Γ stack).
224
+ * 3. Adding Christoffel-correction terms to form ∇_λ R_{μνρσ} (Approach 1:
225
+ * canonical, not partial-only).
226
+ * 4. Summing cyclically over (λ, μ, ν) with (ρ, σ) fixed.
227
+ *
228
+ * **Dim L⁻³.** R_{μνρσ} has dim L⁻² (inherited from R^ρ_{σμν}, since lowering
229
+ * with the dimensionless metric preserves dim per our convention). One ∂/∂x
230
+ * divides by L, giving L⁻³ on ∇R and on the cyclic sum B.
231
+ *
232
+ * **Free indices (5 lower):** λ, μ, ν, ρ, σ — taken from the same axis
233
+ * convention as RiemannTensorNode.lowerIndices plus a fresh λ slot. To avoid
234
+ * label collisions we synthesise `lambda` as the 5th index and reuse
235
+ * R.lowerIndices[0..2] for {μ_out, ν_out, ρ_out}; the 4th wrapped slot
236
+ * surfaces as `sigma_out`. (See `validateBianchiResidual` below for the
237
+ * label-collision rule.)
238
+ *
239
+ * **Why not lower via the v0.3.0 `lower()` AST function?** lower() returns a
240
+ * `tensor-product` node referencing the metric and operand by label/free-
241
+ * index merge, intended for compositional expressions. The lowered Riemann
242
+ * here is consumed point-wise by the FD stencil; building an AST product +
243
+ * re-validating + re-lowering on every of the 25 FD samples is needless
244
+ * machinery for a closed JS-side contraction. Matches the walk-directly
245
+ * philosophy of Tasks 6, 7, 8.
246
+ *
247
+ * @public
248
+ */
249
+ export interface BianchiResidualNode {
250
+ readonly kind: 'bianchi-residual';
251
+ /** The Riemann tensor whose cyclic-derivative identity is checked. */
252
+ readonly riemann: RiemannTensorNode;
253
+ }
254
+ /**
255
+ * Result of validating a BianchiResidualNode.
256
+ * @public
257
+ */
258
+ export interface BianchiResidualValidationResult {
259
+ readonly dim: Dimension;
260
+ readonly freeIndices: Map<string, {
261
+ upper: number;
262
+ lower: number;
263
+ }>;
264
+ }
265
+ /**
266
+ * Validate a `bianchi-residual` node.
267
+ *
268
+ * Inherits all structural checks from the embedded Riemann via
269
+ * `validateRiemannChild`. The output freeIndices are 5 lower labels:
270
+ *
271
+ * - `lambda` — the synthesised FIRST cyclic-derivative axis (a new label;
272
+ * must not collide with the wrapped Riemann's free labels)
273
+ * - The Riemann's `lowerIndices[0]` label → μ_out
274
+ * - The Riemann's `lowerIndices[1]` label → ν_out
275
+ * - The Riemann's `lowerIndices[2]` label → ρ_out
276
+ * - A synthesised `sigma_out` — the fourth Riemann index after lowering ρ.
277
+ *
278
+ * Throws:
279
+ * - IndexLabelCollisionError if the synthesised `lambda` / `sigma_out`
280
+ * labels collide with any wrapped-Riemann label.
281
+ */
282
+ export declare function validateBianchiResidual(node: BianchiResidualNode, validateRiemannChild: (child: RiemannTensorNode) => {
283
+ dim: Dimension;
284
+ freeIndices: Map<string, {
285
+ upper: number;
286
+ lower: number;
287
+ }>;
288
+ }): BianchiResidualValidationResult;
289
+ /**
290
+ * Imported lazily inside `bianchiResidual()` to avoid pulling the numerical
291
+ * lowering layer into the dimensional module's import graph at module load.
292
+ * Mirrors the runtime contract — `bianchiResidual()` returns closures that
293
+ * call `evaluateNumerical`, but the function itself is pure-symbolic until
294
+ * the closures are invoked.
295
+ */
296
+ type LazyEvaluator = (engine: any, inputs: any) => Promise<any>;
297
+ /**
298
+ * Build the second-Bianchi-identity residual `B_{λμνρσ}` as a composite
299
+ * object with both an AST representation and evaluator closures.
300
+ *
301
+ * **Return shape (deviates from `ricci()`/`einstein()`'s plain-ExprNode
302
+ * return):** Bianchi is a 5-index residual tensor whose primary purpose is
303
+ * to be EVALUATED and reduced to its max-absolute value. Callers that just
304
+ * want the scalar self-consistency check use `evaluateMax`; callers that
305
+ * want to inspect per-component residual structure use `evaluate`. The
306
+ * underlying `residual: ExprNode` is exposed for downstream symbolic
307
+ * consumers (validator, equation-homogeneity checks).
308
+ *
309
+ * **Convention.** Carroll Eq. 3.95 cyclic form on the first three lower
310
+ * indices of the all-lower Riemann:
311
+ *
312
+ * B_{λμνρσ} = ∇_λ R_{μνρσ} + ∇_μ R_{νλρσ} + ∇_ν R_{λμρσ} = 0
313
+ *
314
+ * **Implementation (Approach 1 — full ∇, not raw ∂).** Lowering computes
315
+ * each `∇_λ R_{μνρσ}` term with full Christoffel corrections (one per lower
316
+ * index of R), then sums cyclically. The lowered Riemann itself is computed
317
+ * by lowering the upper-ρ of R^ρ_{σμν} on the JS side after the Riemann
318
+ * lowering pipeline (Task 6) — no v0.3.0 `lower()` AST round-trip per FD
319
+ * sample.
320
+ *
321
+ * **Numerical-noise discussion.** The cyclic sum involves one extra
322
+ * coordinate-derivative on R_{μνρσ}, which itself sits on a ∂g→Γ→∂Γ→R FD
323
+ * stack. Schwarzschild + de Sitter empirical residuals are reported in
324
+ * `tests/dimensional/bianchi-residual.test.ts`; expected per-component
325
+ * noise floor is ~1e-7 to 1e-8 — much looser than the Task 6 Riemann floor
326
+ * (~8e-10) because of the extra FD layer.
327
+ *
328
+ * @public
329
+ */
330
+ export declare function bianchiResidual(R: RiemannTensorNode): {
331
+ residual: ExprNode;
332
+ evaluate: LazyEvaluator;
333
+ evaluateMax: (engine: any, inputs: any) => Promise<number>;
334
+ };
335
+ export {};
336
+ //# sourceMappingURL=curvature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"curvature.d.ts","sourceRoot":"","sources":["../../src/dimensional/curvature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO/D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,oBAAoB,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK;IAClD,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;K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