universal-physics-tensor 0.20.0 → 0.22.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.
- package/bin/upt.mjs +75 -4
- package/dist/bridges/equations/be-26-dna-tunneling.d.ts +15 -5
- package/dist/bridges/equations/be-26-dna-tunneling.d.ts.map +1 -1
- package/dist/bridges/equations/be-26-dna-tunneling.js +26 -7
- package/dist/bridges/equations/be-26-dna-tunneling.js.map +1 -1
- package/dist/canonical/canonical-equation.d.ts +79 -0
- package/dist/canonical/canonical-equation.d.ts.map +1 -0
- package/dist/canonical/canonical-equation.js +2 -0
- package/dist/canonical/canonical-equation.js.map +1 -0
- package/dist/canonical/dimensional-fields.d.ts +7 -0
- package/dist/canonical/dimensional-fields.d.ts.map +1 -0
- package/dist/canonical/dimensional-fields.js +31 -0
- package/dist/canonical/dimensional-fields.js.map +1 -0
- package/dist/canonical/entries/_l1-build.d.ts +22 -0
- package/dist/canonical/entries/_l1-build.d.ts.map +1 -0
- package/dist/canonical/entries/_l1-build.js +26 -0
- package/dist/canonical/entries/_l1-build.js.map +1 -0
- package/dist/canonical/entries/dimensional-classics.d.ts +11 -0
- package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -0
- package/dist/canonical/entries/dimensional-classics.js +194 -0
- package/dist/canonical/entries/dimensional-classics.js.map +1 -0
- package/dist/canonical/entries/l1-gravity-thermo.d.ts +12 -0
- package/dist/canonical/entries/l1-gravity-thermo.d.ts.map +1 -0
- package/dist/canonical/entries/l1-gravity-thermo.js +128 -0
- package/dist/canonical/entries/l1-gravity-thermo.js.map +1 -0
- package/dist/canonical/entries/l1-quantum-em.d.ts +10 -0
- package/dist/canonical/entries/l1-quantum-em.d.ts.map +1 -0
- package/dist/canonical/entries/l1-quantum-em.js +141 -0
- package/dist/canonical/entries/l1-quantum-em.js.map +1 -0
- package/dist/canonical/entries/relativity.d.ts +14 -0
- package/dist/canonical/entries/relativity.d.ts.map +1 -0
- package/dist/canonical/entries/relativity.js +114 -0
- package/dist/canonical/entries/relativity.js.map +1 -0
- package/dist/canonical/linkage.d.ts +27 -0
- package/dist/canonical/linkage.d.ts.map +1 -0
- package/dist/canonical/linkage.js +139 -0
- package/dist/canonical/linkage.js.map +1 -0
- package/dist/canonical/normal-form.d.ts +25 -0
- package/dist/canonical/normal-form.d.ts.map +1 -0
- package/dist/canonical/normal-form.js +107 -0
- package/dist/canonical/normal-form.js.map +1 -0
- package/dist/canonical/registry.d.ts +26 -0
- package/dist/canonical/registry.d.ts.map +1 -0
- package/dist/canonical/registry.js +46 -0
- package/dist/canonical/registry.js.map +1 -0
- package/dist/canonical/seed-l-layer.d.ts +20 -0
- package/dist/canonical/seed-l-layer.d.ts.map +1 -0
- package/dist/canonical/seed-l-layer.js +39 -0
- package/dist/canonical/seed-l-layer.js.map +1 -0
- package/dist/composition/discovery.d.ts +40 -6
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +56 -7
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/representative-values.d.ts +46 -0
- package/dist/composition/representative-values.d.ts.map +1 -0
- package/dist/composition/representative-values.js +69 -0
- package/dist/composition/representative-values.js.map +1 -0
- package/dist/composition/symbolic-constants.d.ts.map +1 -1
- package/dist/composition/symbolic-constants.js +15 -1
- package/dist/composition/symbolic-constants.js.map +1 -1
- package/dist/core/constants.d.ts +6 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +6 -0
- package/dist/core/constants.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { metric } from '../../dimensional/metric.js';
|
|
2
|
+
import { tsym } from '../../dimensional/tensor.js';
|
|
3
|
+
import { sym } from '../../bridges/equations/_be-helpers.js';
|
|
4
|
+
import { LENGTH, DIMENSIONLESS } from '../../dimensional/types.js';
|
|
5
|
+
import { dim, op, l1 } from './_l1-build.js';
|
|
6
|
+
// ── EFE node builders (the canonical G_μν + Λg_μν = (8πG/c⁴)T_μν structure) ──
|
|
7
|
+
const L_INV2 = dim(-2); // [L⁻²] — per-component dim of every EFE term
|
|
8
|
+
const ENERGY_DENSITY = dim(-1, 1, -2); // T_μν componentDim [M L⁻¹ T⁻²]
|
|
9
|
+
function buildRiemann(mu = 'mu', nu = 'nu') {
|
|
10
|
+
const gLower = metric('g', [
|
|
11
|
+
{ label: 'a', variance: 'lower' },
|
|
12
|
+
{ label: 'b', variance: 'lower' },
|
|
13
|
+
], DIMENSIONLESS, '+,-,-,-');
|
|
14
|
+
const gInverse = metric('g_inv', [
|
|
15
|
+
{ label: 'a', variance: 'upper' },
|
|
16
|
+
{ label: 'b', variance: 'upper' },
|
|
17
|
+
], DIMENSIONLESS, '+,-,-,-');
|
|
18
|
+
const xCoord = tsym('x', [{ label: 'c', variance: 'upper' }], LENGTH, 'coordinate');
|
|
19
|
+
return {
|
|
20
|
+
kind: 'riemann-tensor',
|
|
21
|
+
upperIndex: { label: 'rho', variance: 'upper' },
|
|
22
|
+
lowerIndices: [
|
|
23
|
+
{ label: mu, variance: 'lower' },
|
|
24
|
+
{ label: 'lambda', variance: 'lower' },
|
|
25
|
+
{ label: nu, variance: 'lower' },
|
|
26
|
+
],
|
|
27
|
+
gLower,
|
|
28
|
+
gInverse,
|
|
29
|
+
xCoord,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function buildEinstein(mu = 'mu', nu = 'nu') {
|
|
33
|
+
const riemann = buildRiemann(mu, nu);
|
|
34
|
+
return {
|
|
35
|
+
kind: 'einstein-tensor',
|
|
36
|
+
riemann,
|
|
37
|
+
gLower: riemann.gLower,
|
|
38
|
+
gInverse: riemann.gInverse,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const buildT = (mu = 'mu', nu = 'nu') => ({
|
|
42
|
+
kind: 'stress-energy',
|
|
43
|
+
symbol: 'T',
|
|
44
|
+
indices: [
|
|
45
|
+
{ label: mu, variance: 'lower' },
|
|
46
|
+
{ label: nu, variance: 'lower' },
|
|
47
|
+
],
|
|
48
|
+
symmetry: 'symmetric',
|
|
49
|
+
componentDim: ENERGY_DENSITY,
|
|
50
|
+
});
|
|
51
|
+
const buildLambda = () => ({
|
|
52
|
+
kind: 'cosmological-constant',
|
|
53
|
+
symbol: 'Λ',
|
|
54
|
+
dim: L_INV2,
|
|
55
|
+
});
|
|
56
|
+
const buildMetric = () => metric('g_metric', [
|
|
57
|
+
{ label: 'mu', variance: 'lower' },
|
|
58
|
+
{ label: 'nu', variance: 'lower' },
|
|
59
|
+
], DIMENSIONLESS, '+,-,-,-');
|
|
60
|
+
/** The canonical Einstein field equation node, G_μν + Λg_μν = (8πG/c⁴)T_μν. */
|
|
61
|
+
export const EFE_NODE = {
|
|
62
|
+
kind: 'einstein-equation',
|
|
63
|
+
lhs: buildEinstein('mu', 'nu'),
|
|
64
|
+
cosmological: buildLambda(),
|
|
65
|
+
metric: buildMetric(),
|
|
66
|
+
rhs: buildT('mu', 'nu'),
|
|
67
|
+
coupling: 'einstein',
|
|
68
|
+
};
|
|
69
|
+
// ── dimensional layer for the EFE (per-component [L⁻²] from 8πG·T/c⁴) ────────
|
|
70
|
+
const GRAV = dim(3, -1, -2);
|
|
71
|
+
const EFE_TARGET = { name: 'efe-curvature', dim: L_INV2 };
|
|
72
|
+
const EFE_GOV = [
|
|
73
|
+
{ name: 'G', dim: GRAV },
|
|
74
|
+
{ name: 'c', dim: dim(1, 0, -1) },
|
|
75
|
+
{ name: 'stress-energy-density', dim: ENERGY_DENSITY },
|
|
76
|
+
];
|
|
77
|
+
// ── Friedmann (flat, matter-dominated): H² = 8πG ρ / 3 ───────────────────────
|
|
78
|
+
const HSQUARED = dim(0, 0, -2); // [T⁻²]
|
|
79
|
+
const DENSITY = dim(-3, 1); // [M L⁻³]
|
|
80
|
+
const FRIEDMANN_TARGET = { name: 'hubble-rate-squared', dim: HSQUARED };
|
|
81
|
+
const FRIEDMANN_GOV = [
|
|
82
|
+
{ name: 'G', dim: GRAV },
|
|
83
|
+
{ name: 'rho', dim: DENSITY },
|
|
84
|
+
];
|
|
85
|
+
export const RELATIVITY = [
|
|
86
|
+
l1(EFE_TARGET, EFE_GOV, {
|
|
87
|
+
id: 'CE-einstein-field-eq',
|
|
88
|
+
name: 'Einstein field equation',
|
|
89
|
+
domain: 'general-relativity',
|
|
90
|
+
formula_latex: 'G_{\\mu\\nu} + \\Lambda g_{\\mu\\nu} = (8\\pi G/c^4) T_{\\mu\\nu}',
|
|
91
|
+
epistemicStatus: 'fully-quantitative',
|
|
92
|
+
fieldEquation: EFE_NODE,
|
|
93
|
+
regime: { force: 'gravitational', symmetry: 'poincare' },
|
|
94
|
+
assumptions: ['classical GR', 'pseudo-Riemannian spacetime'],
|
|
95
|
+
references: ['Einstein 1915'],
|
|
96
|
+
partnerBridges: ['13'], // 13 = Information-Geometry (Jacobson thermodynamic EFE)
|
|
97
|
+
}),
|
|
98
|
+
l1(FRIEDMANN_TARGET, FRIEDMANN_GOV, {
|
|
99
|
+
id: 'CE-friedmann',
|
|
100
|
+
name: 'Friedmann equation (flat, matter-dominated)',
|
|
101
|
+
domain: 'cosmology',
|
|
102
|
+
formula_latex: 'H^2 = 8\\pi G \\rho/3',
|
|
103
|
+
epistemicStatus: 'fully-quantitative',
|
|
104
|
+
scalarAst: op('/', [
|
|
105
|
+
op('*', [sym('8pi', DIMENSIONLESS), sym('G', GRAV), sym('rho', DENSITY)]),
|
|
106
|
+
sym('3', DIMENSIONLESS),
|
|
107
|
+
]),
|
|
108
|
+
regime: { scale: 'cosmological', force: 'gravitational' },
|
|
109
|
+
assumptions: ['flat (k=0)', 'matter-dominated', 'Λ=0', 'FLRW'],
|
|
110
|
+
references: ['Friedmann 1922'],
|
|
111
|
+
partnerBridges: [],
|
|
112
|
+
}),
|
|
113
|
+
];
|
|
114
|
+
//# sourceMappingURL=relativity.js.map
|
|
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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Best-effort numerical-recovery outcome. */
|
|
2
|
+
export interface RecoveryOutcome {
|
|
3
|
+
/** Both ASTs evaluated at every sample (no unresolved leaf). */
|
|
4
|
+
readonly tested: boolean;
|
|
5
|
+
/** Spread of the canonical/bridge value ratio across samples (0 ⇒ they agree
|
|
6
|
+
* up to a single constant factor). `NaN` when not tested. */
|
|
7
|
+
readonly maxRelErr: number;
|
|
8
|
+
}
|
|
9
|
+
/** One bridge↔canonical comparison. */
|
|
10
|
+
export interface LinkageResult {
|
|
11
|
+
readonly canonicalId: string;
|
|
12
|
+
readonly bridgeId: number;
|
|
13
|
+
/** Inferred dimensions agree. */
|
|
14
|
+
readonly dimMatch: boolean;
|
|
15
|
+
/** Same relation up to dimensionless factors (`normalForm`). */
|
|
16
|
+
readonly structuralMatch: boolean;
|
|
17
|
+
readonly recovery: RecoveryOutcome | null;
|
|
18
|
+
readonly classification: 'restates-canonical' | 'recovers' | 'dimensional-only' | 'unrelated';
|
|
19
|
+
}
|
|
20
|
+
/** Compare one canonical entry against one bridge. */
|
|
21
|
+
export declare function classifyLinkage(canonicalId: string, bridgeId: number): LinkageResult;
|
|
22
|
+
/**
|
|
23
|
+
* Scan every canonical entry (with a scalar-AST) against every bridge RHS, and
|
|
24
|
+
* return the non-`unrelated` results — the physicist's linkage worklist.
|
|
25
|
+
*/
|
|
26
|
+
export declare function scanLinkages(): LinkageResult[];
|
|
27
|
+
//# sourceMappingURL=linkage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkage.d.ts","sourceRoot":"","sources":["../../src/canonical/linkage.ts"],"names":[],"mappings":"AAwBA,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;kEAC8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,uCAAuC;AACvC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,cAAc,EACnB,oBAAoB,GACpB,UAAU,GACV,kBAAkB,GAClB,WAAW,CAAC;CACjB;AAwFD,sDAAsD;AACtD,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,aAAa,CAsCf;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAU9C"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { validate } from '../dimensional/validator.js';
|
|
2
|
+
import { evalExpr } from '../composition/expr-eval.js';
|
|
3
|
+
import { CONSTANTS } from '../composition/symbolic-constants.js';
|
|
4
|
+
import { BRIDGE_RHS_BY_ID } from '../bridges/rhs-registry.js';
|
|
5
|
+
import { CANONICAL_EQUATIONS, canonicalById } from './registry.js';
|
|
6
|
+
import { structurallyEqual } from './normal-form.js';
|
|
7
|
+
const dimEqual = (a, b) => a.L === b.L &&
|
|
8
|
+
a.M === b.M &&
|
|
9
|
+
a.T === b.T &&
|
|
10
|
+
a.I === b.I &&
|
|
11
|
+
a.Theta === b.Theta &&
|
|
12
|
+
a.N === b.N &&
|
|
13
|
+
a.J === b.J;
|
|
14
|
+
const isDimensionless = (d) => d.L === 0 &&
|
|
15
|
+
d.M === 0 &&
|
|
16
|
+
d.T === 0 &&
|
|
17
|
+
d.I === 0 &&
|
|
18
|
+
d.Theta === 0 &&
|
|
19
|
+
d.N === 0 &&
|
|
20
|
+
d.J === 0;
|
|
21
|
+
/**
|
|
22
|
+
* Collect leaves `evalExpr` can't resolve (not a registered constant, not a
|
|
23
|
+
* numeric literal), split into physical `vars` (non-dimensionless — varied
|
|
24
|
+
* across samples) and `dimless` (dimensionless — held fixed: they ARE the
|
|
25
|
+
* constant factor "up to" which recovery is measured).
|
|
26
|
+
*/
|
|
27
|
+
function collectLeaves(node, vars, dimless) {
|
|
28
|
+
switch (node.kind) {
|
|
29
|
+
case 'symbol':
|
|
30
|
+
if (!(node.name in CONSTANTS) && Number.isNaN(Number(node.name))) {
|
|
31
|
+
(isDimensionless(node.dim) ? dimless : vars).add(node.name);
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
case 'op':
|
|
35
|
+
for (const a of node.args)
|
|
36
|
+
collectLeaves(a, vars, dimless);
|
|
37
|
+
return;
|
|
38
|
+
case 'transcendental':
|
|
39
|
+
collectLeaves(node.arg, vars, dimless);
|
|
40
|
+
return;
|
|
41
|
+
case 'abs':
|
|
42
|
+
collectLeaves(node.arg, vars, dimless);
|
|
43
|
+
return;
|
|
44
|
+
default:
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const SAMPLE_FACTORS = [1, 2, 3];
|
|
49
|
+
/** Best-effort check that two ASTs agree up to a constant ratio. */
|
|
50
|
+
function numericalRecovery(canon, bridge) {
|
|
51
|
+
const vars = new Set();
|
|
52
|
+
const dimless = new Set();
|
|
53
|
+
collectLeaves(canon, vars, dimless);
|
|
54
|
+
collectLeaves(bridge, vars, dimless);
|
|
55
|
+
const names = [...vars].sort();
|
|
56
|
+
const ratios = [];
|
|
57
|
+
for (const s of SAMPLE_FACTORS) {
|
|
58
|
+
const values = {};
|
|
59
|
+
names.forEach((n, i) => {
|
|
60
|
+
values[n] = (1.3 + 0.7 * i) * s; // distinct positive samples
|
|
61
|
+
});
|
|
62
|
+
// Hold unresolved dimensionless leaves fixed — recovery is "up to" them.
|
|
63
|
+
for (const n of dimless)
|
|
64
|
+
values[n] = 1;
|
|
65
|
+
let cv;
|
|
66
|
+
let bv;
|
|
67
|
+
try {
|
|
68
|
+
cv = evalExpr(canon, values);
|
|
69
|
+
bv = evalExpr(bridge, values);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return { tested: false, maxRelErr: NaN };
|
|
73
|
+
}
|
|
74
|
+
// Guard cv===0 too: with cv===0 the ratio is 0 at every sample, so the
|
|
75
|
+
// relative-spread denominator r0===0 ⇒ NaN — a false "tested" result.
|
|
76
|
+
if (!Number.isFinite(cv) || !Number.isFinite(bv) || bv === 0 || cv === 0) {
|
|
77
|
+
return { tested: false, maxRelErr: NaN };
|
|
78
|
+
}
|
|
79
|
+
ratios.push(cv / bv);
|
|
80
|
+
}
|
|
81
|
+
const r0 = ratios[0];
|
|
82
|
+
const maxRelErr = Math.max(...ratios.map((r) => Math.abs((r - r0) / r0)));
|
|
83
|
+
return { tested: true, maxRelErr };
|
|
84
|
+
}
|
|
85
|
+
/** Compare one canonical entry against one bridge. */
|
|
86
|
+
export function classifyLinkage(canonicalId, bridgeId) {
|
|
87
|
+
const canon = canonicalById(canonicalId);
|
|
88
|
+
const bridgeRhs = BRIDGE_RHS_BY_ID.get(bridgeId);
|
|
89
|
+
const base = { canonicalId, bridgeId };
|
|
90
|
+
if (!canon || !bridgeRhs || !canon.scalarAst) {
|
|
91
|
+
return {
|
|
92
|
+
...base,
|
|
93
|
+
dimMatch: false,
|
|
94
|
+
structuralMatch: false,
|
|
95
|
+
recovery: null,
|
|
96
|
+
classification: 'unrelated',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const bridgeDim = validate(bridgeRhs);
|
|
100
|
+
const dimMatch = bridgeDim.ok &&
|
|
101
|
+
bridgeDim.inferredDimension != null &&
|
|
102
|
+
dimEqual(bridgeDim.inferredDimension, canon.dimensional.target.dim);
|
|
103
|
+
const structuralMatch = structurallyEqual(canon.scalarAst, bridgeRhs);
|
|
104
|
+
const recovery = structuralMatch
|
|
105
|
+
? numericalRecovery(canon.scalarAst, bridgeRhs)
|
|
106
|
+
: null;
|
|
107
|
+
let classification;
|
|
108
|
+
if (structuralMatch) {
|
|
109
|
+
classification =
|
|
110
|
+
canon.restatesBridge === String(bridgeId)
|
|
111
|
+
? 'restates-canonical'
|
|
112
|
+
: 'recovers';
|
|
113
|
+
}
|
|
114
|
+
else if (dimMatch) {
|
|
115
|
+
classification = 'dimensional-only';
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
classification = 'unrelated';
|
|
119
|
+
}
|
|
120
|
+
return { ...base, dimMatch, structuralMatch, recovery, classification };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Scan every canonical entry (with a scalar-AST) against every bridge RHS, and
|
|
124
|
+
* return the non-`unrelated` results — the physicist's linkage worklist.
|
|
125
|
+
*/
|
|
126
|
+
export function scanLinkages() {
|
|
127
|
+
const results = [];
|
|
128
|
+
for (const ce of CANONICAL_EQUATIONS) {
|
|
129
|
+
if (!ce.scalarAst)
|
|
130
|
+
continue;
|
|
131
|
+
for (const bridgeId of BRIDGE_RHS_BY_ID.keys()) {
|
|
132
|
+
const r = classifyLinkage(ce.id, bridgeId);
|
|
133
|
+
if (r.classification !== 'unrelated')
|
|
134
|
+
results.push(r);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return results;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=linkage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkage.js","sourceRoot":"","sources":["../../src/canonical/linkage.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE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S;QAC5B,KAAK,MAAM,QAAQ,IAAI,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC3C,IAAI,CAAC,CAAC,cAAc,KAAK,WAAW;gBAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized structural form of a scalar `ExprNode`, **up to dimensionless
|
|
3
|
+
* multiplicative factors** — the hash the F4 circularity guard uses to decide
|
|
4
|
+
* whether a bridge's RHS and a canonical equation encode the same relation.
|
|
5
|
+
*
|
|
6
|
+
* Two expressions hash equal when they differ only by:
|
|
7
|
+
* - dimensionless multiplicative constants (numeric literals, ln2, 4π, …),
|
|
8
|
+
* - product nesting (`(a·b)·c` vs `a·b·c`),
|
|
9
|
+
* - commutative reordering of `*` / `+` operands.
|
|
10
|
+
*
|
|
11
|
+
* They hash DIFFERENT when an exponent differs (T⁴ ≠ T) or the non-dimensionless
|
|
12
|
+
* factor set differs. Sums keep every term; `^` keeps its exponent; `/` keeps the
|
|
13
|
+
* numerator/denominator split.
|
|
14
|
+
*
|
|
15
|
+
* @module canonical/normal-form
|
|
16
|
+
*/
|
|
17
|
+
import type { ExprNode } from '../dimensional/validator.js';
|
|
18
|
+
/**
|
|
19
|
+
* The normalized structural form of `node`. Equal strings ⇒ same relation up to
|
|
20
|
+
* dimensionless multiplicative factors.
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalForm(node: ExprNode): string;
|
|
23
|
+
/** Whether two scalar ASTs are the same relation up to dimensionless factors. */
|
|
24
|
+
export declare function structurallyEqual(a: ExprNode, b: ExprNode): boolean;
|
|
25
|
+
//# sourceMappingURL=normal-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normal-form.d.ts","sourceRoot":"","sources":["../../src/canonical/normal-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAgD5D;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAsDjD;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const isDimensionless = (d) => d.L === 0 &&
|
|
2
|
+
d.M === 0 &&
|
|
3
|
+
d.T === 0 &&
|
|
4
|
+
d.I === 0 &&
|
|
5
|
+
d.Theta === 0 &&
|
|
6
|
+
d.N === 0 &&
|
|
7
|
+
d.J === 0;
|
|
8
|
+
/** Token for a node that carries no structural content (a dimensionless factor). */
|
|
9
|
+
const UNIT = '1';
|
|
10
|
+
/**
|
|
11
|
+
* Full structural serialization that NEVER drops dimensionless factors — used
|
|
12
|
+
* for `^` exponents, which are structural (T⁴ ≠ T) and must not be treated
|
|
13
|
+
* "up to dimensionless factors". Commutative operands are still sorted so the
|
|
14
|
+
* exponent comparison is robust to reordering.
|
|
15
|
+
*/
|
|
16
|
+
function rawForm(node) {
|
|
17
|
+
switch (node.kind) {
|
|
18
|
+
case 'symbol':
|
|
19
|
+
return `s:${node.name}`;
|
|
20
|
+
case 'op': {
|
|
21
|
+
const parts = node.args.map(rawForm);
|
|
22
|
+
if (node.op === '*' || node.op === '+')
|
|
23
|
+
parts.sort();
|
|
24
|
+
return `${node.op}(${parts.join(',')})`;
|
|
25
|
+
}
|
|
26
|
+
case 'transcendental':
|
|
27
|
+
return `${node.fn}[${rawForm(node.arg)}]`;
|
|
28
|
+
case 'abs':
|
|
29
|
+
return `abs[${rawForm(node.arg)}]`;
|
|
30
|
+
default:
|
|
31
|
+
return `${node.kind}:${JSON.stringify(node)}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Collect the factors of a (possibly nested) `*` product. */
|
|
35
|
+
function flattenProduct(node, out) {
|
|
36
|
+
if (node.kind === 'op' && node.op === '*') {
|
|
37
|
+
for (const a of node.args)
|
|
38
|
+
flattenProduct(a, out);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
out.push(node);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The normalized structural form of `node`. Equal strings ⇒ same relation up to
|
|
46
|
+
* dimensionless multiplicative factors.
|
|
47
|
+
*/
|
|
48
|
+
export function normalForm(node) {
|
|
49
|
+
switch (node.kind) {
|
|
50
|
+
case 'symbol':
|
|
51
|
+
// A dimensionless symbol is a factor with no structural content.
|
|
52
|
+
return isDimensionless(node.dim) ? UNIT : `sym:${node.name}`;
|
|
53
|
+
case 'op': {
|
|
54
|
+
switch (node.op) {
|
|
55
|
+
case '*': {
|
|
56
|
+
const factors = [];
|
|
57
|
+
flattenProduct(node, factors);
|
|
58
|
+
const kept = factors
|
|
59
|
+
.map(normalForm)
|
|
60
|
+
.filter((f) => f !== UNIT) // drop dimensionless factors
|
|
61
|
+
.sort();
|
|
62
|
+
if (kept.length === 0)
|
|
63
|
+
return UNIT;
|
|
64
|
+
if (kept.length === 1)
|
|
65
|
+
return kept[0];
|
|
66
|
+
return `*(${kept.join(',')})`;
|
|
67
|
+
}
|
|
68
|
+
case '/': {
|
|
69
|
+
const num = normalForm(node.args[0]);
|
|
70
|
+
const den = normalForm(node.args[1]);
|
|
71
|
+
if (den === UNIT)
|
|
72
|
+
return num; // ÷ dimensionless ⇒ the numerator
|
|
73
|
+
return `/(${num},${den})`;
|
|
74
|
+
}
|
|
75
|
+
case '^': {
|
|
76
|
+
// The exponent is structural (T⁴ ≠ T) and must NOT be reduced
|
|
77
|
+
// "up to dimensionless factors" — serialize it with rawForm so a
|
|
78
|
+
// dimensionless exponent is never dropped (symmetric for direct
|
|
79
|
+
// symbols and op sub-expressions alike).
|
|
80
|
+
const base = normalForm(node.args[0]);
|
|
81
|
+
return `^(${base},${rawForm(node.args[1])})`;
|
|
82
|
+
}
|
|
83
|
+
case '+':
|
|
84
|
+
case '-': {
|
|
85
|
+
const parts = node.args.map(normalForm);
|
|
86
|
+
if (node.op === '+')
|
|
87
|
+
parts.sort();
|
|
88
|
+
return `${node.op}(${parts.join(',')})`;
|
|
89
|
+
}
|
|
90
|
+
default:
|
|
91
|
+
return `op:${JSON.stringify(node)}`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
case 'transcendental':
|
|
95
|
+
return `${node.fn}(${normalForm(node.arg)})`;
|
|
96
|
+
case 'abs':
|
|
97
|
+
return `abs(${normalForm(node.arg)})`;
|
|
98
|
+
default:
|
|
99
|
+
// integral / derivative / tensor arms: compare structurally by kind+shape.
|
|
100
|
+
return `${node.kind}:${JSON.stringify(node)}`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** Whether two scalar ASTs are the same relation up to dimensionless factors. */
|
|
104
|
+
export function structurallyEqual(a, b) {
|
|
105
|
+
return normalForm(a) === normalForm(b);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=normal-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normal-form.js","sourceRoot":"","sources":["../../src/canonical/normal-form.ts"],"names":[],"mappings":"AAmBA,MAAM,eAAe,GAAG,CAAC,CAAY,EAAW,EAAE,CAChD,CAAC,CAAC,CAAC,KAAK,CAAC;IACT,CAAC,CAAC,CAAC,KAAK,CAAC;IACT,CAAC,CAAC,CAAC,KAAK,CAAC;IACT,CAAC,CAAC,CAAC,KAAK,CAAC;IACT,CAAC,CAAC,KAAK,KAAK,CAAC;IACb,CAAC,CAAC,CAAC,KAAK,CAAC;IACT,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAEZ,oFAAoF;AACpF,MAAM,IAAI,GA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C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtC,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC/C,CAAC;gBACD,KAAK,GAAG,CAAC;gBACT,KAAK,GAAG,CAAC,CAAC,CAAC;oBACT,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;oBACxC,IAAI,IAAI,CAAC,EAAE,KAAK,GAAG;wBAAE,KAAK,CAAC,IAAI,EAAE,CAAC;oBAClC,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAC1C,CAAC;gBACD;oBACE,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,CAAC;QACH,CAAC;QAED,KAAK,gBAAgB;YACnB,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAE/C,KAAK,KAAK;YACR,OAAO,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAExC;YACE,2EAA2E;YAC3E,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IAClD,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAAC,CAAW,EAAE,CAAW;IACxD,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical-equation registry — the queryable index of the L-layer.
|
|
3
|
+
* Seeded incrementally by `entries/*` modules (Tasks 2,4,5,9); this file owns
|
|
4
|
+
* the assembled array, the id map, and the accessors.
|
|
5
|
+
*
|
|
6
|
+
* @module canonical/registry
|
|
7
|
+
*/
|
|
8
|
+
import type { CanonicalEquation, CanonicalDomain } from './canonical-equation.js';
|
|
9
|
+
/** Every canonical equation in the registry. */
|
|
10
|
+
export declare const CANONICAL_EQUATIONS: readonly CanonicalEquation[];
|
|
11
|
+
/** Id → entry. */
|
|
12
|
+
export declare const CANONICAL_BY_ID: Readonly<Record<string, CanonicalEquation>>;
|
|
13
|
+
/** The entry with id `id`, or `undefined`. */
|
|
14
|
+
export declare function canonicalById(id: string): CanonicalEquation | undefined;
|
|
15
|
+
/** Every entry in `domain`. */
|
|
16
|
+
export declare function canonicalByDomain(domain: CanonicalDomain): readonly CanonicalEquation[];
|
|
17
|
+
/** Catalog bridge ids (string form) that at least one canonical entry names as
|
|
18
|
+
* a `partnerBridges` / `restatesBridge` correspondence. */
|
|
19
|
+
export declare function partneredBridgeIds(): Set<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Catalog bridges with NO canonical correspondence partner yet — the explicit,
|
|
22
|
+
* logged coverage gap (review finding F2). Sorted by numeric id. The count is
|
|
23
|
+
* pinned by a test so shrinking it (adding a partner) is a deliberate act.
|
|
24
|
+
*/
|
|
25
|
+
export declare function bridgesWithoutCanonicalPartner(): string[];
|
|
26
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/canonical/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAOlF,gDAAgD;AAChD,eAAO,MAAM,mBAAmB,EAAE,SAAS,iBAAiB,EAK3D,CAAC;AAEF,kBAAkB;AAClB,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CACT,CAAC;AAEhE,8CAA8C;AAC9C,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEvE;AAED,+BAA+B;AAC/B,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,eAAe,GACtB,SAAS,iBAAiB,EAAE,CAE9B;AAED;4DAC4D;AAC5D,wBAAgB,kBAAkB,IAAI,GAAG,CAAC,MAAM,CAAC,CAOhD;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,IAAI,MAAM,EAAE,CAKzD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BRIDGE_EQUATIONS } from '../bridges/index.js';
|
|
2
|
+
import { DIMENSIONAL_CLASSICS } from './entries/dimensional-classics.js';
|
|
3
|
+
import { L1_GRAVITY_THERMO } from './entries/l1-gravity-thermo.js';
|
|
4
|
+
import { L1_QUANTUM_EM } from './entries/l1-quantum-em.js';
|
|
5
|
+
import { RELATIVITY } from './entries/relativity.js';
|
|
6
|
+
/** Every canonical equation in the registry. */
|
|
7
|
+
export const CANONICAL_EQUATIONS = [
|
|
8
|
+
...DIMENSIONAL_CLASSICS,
|
|
9
|
+
...L1_GRAVITY_THERMO,
|
|
10
|
+
...L1_QUANTUM_EM,
|
|
11
|
+
...RELATIVITY,
|
|
12
|
+
];
|
|
13
|
+
/** Id → entry. */
|
|
14
|
+
export const CANONICAL_BY_ID = Object.fromEntries(CANONICAL_EQUATIONS.map((e) => [e.id, e]));
|
|
15
|
+
/** The entry with id `id`, or `undefined`. */
|
|
16
|
+
export function canonicalById(id) {
|
|
17
|
+
return CANONICAL_BY_ID[id];
|
|
18
|
+
}
|
|
19
|
+
/** Every entry in `domain`. */
|
|
20
|
+
export function canonicalByDomain(domain) {
|
|
21
|
+
return CANONICAL_EQUATIONS.filter((e) => e.domain === domain);
|
|
22
|
+
}
|
|
23
|
+
/** Catalog bridge ids (string form) that at least one canonical entry names as
|
|
24
|
+
* a `partnerBridges` / `restatesBridge` correspondence. */
|
|
25
|
+
export function partneredBridgeIds() {
|
|
26
|
+
const ids = new Set();
|
|
27
|
+
for (const e of CANONICAL_EQUATIONS) {
|
|
28
|
+
for (const b of e.partnerBridges)
|
|
29
|
+
ids.add(b);
|
|
30
|
+
if (e.restatesBridge)
|
|
31
|
+
ids.add(e.restatesBridge);
|
|
32
|
+
}
|
|
33
|
+
return ids;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Catalog bridges with NO canonical correspondence partner yet — the explicit,
|
|
37
|
+
* logged coverage gap (review finding F2). Sorted by numeric id. The count is
|
|
38
|
+
* pinned by a test so shrinking it (adding a partner) is a deliberate act.
|
|
39
|
+
*/
|
|
40
|
+
export function bridgesWithoutCanonicalPartner() {
|
|
41
|
+
const partnered = partneredBridgeIds();
|
|
42
|
+
return BRIDGE_EQUATIONS.map((b) => String(b.id))
|
|
43
|
+
.filter((id) => !partnered.has(id))
|
|
44
|
+
.sort((a, b) => Number(a) - Number(b));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/canonical/registry.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,gDAAgD;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAiC;IAC/D,GAAG,oBAAoB;IACvB,GAAG,iBAAiB;IACpB,GAAG,aAAa;IAChB,GAAG,UAAU;CACd,CAAC;AAEF,kBAAkB;AAClB,MAAM,CAAC,MAAM,eAAe,GAC1B,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC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1
|
+
/**
|
|
2
|
+
* Seed the canonical-equation registry into the tensor's L-layer (Π = L + B + E)
|
|
3
|
+
* via the existing `addLaw` path. `canonicalToLaw` maps a registry entry onto the
|
|
4
|
+
* `PhysicalLaw` shape; `seedCanonicalLaws` adds them all and returns the count.
|
|
5
|
+
*
|
|
6
|
+
* @module canonical/seed-l-layer
|
|
7
|
+
*/
|
|
8
|
+
import type { CanonicalEquation } from './canonical-equation.js';
|
|
9
|
+
import type { PhysicalLaw, TensorConfig } from '../core/types.js';
|
|
10
|
+
import { UniversalTensor } from '../core/tensor.js';
|
|
11
|
+
/** A `TensorConfig` whose axes cover every regime the canonical registry uses,
|
|
12
|
+
* so `seedCanonicalLaws` never trips axis-membership validation. */
|
|
13
|
+
export declare const CANONICAL_TENSOR_CONFIG: TensorConfig;
|
|
14
|
+
/** Map a canonical entry onto the `PhysicalLaw` shape the L-layer consumes.
|
|
15
|
+
* Canonical laws are ground truth → `confidence: 1`. Regime axes map to the
|
|
16
|
+
* law's single-valued axis arrays (empty when the regime leaves an axis open). */
|
|
17
|
+
export declare function canonicalToLaw(ce: CanonicalEquation): PhysicalLaw;
|
|
18
|
+
/** Seed every canonical equation into `t`'s L-layer. Returns the count added. */
|
|
19
|
+
export declare function seedCanonicalLaws(t: UniversalTensor): number;
|
|
20
|
+
//# sourceMappingURL=seed-l-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed-l-layer.d.ts","sourceRoot":"","sources":["../../src/canonical/seed-l-layer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;qEACqE;AACrE,eAAO,MAAM,uBAAuB,EAAE,YAMrC,CAAC;AAEF;;mFAEmF;AACnF,wBAAgB,cAAc,CAAC,EAAE,EAAE,iBAAiB,GAAG,WAAW,CAejE;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAM5D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CANONICAL_EQUATIONS } from './registry.js';
|
|
2
|
+
/** A `TensorConfig` whose axes cover every regime the canonical registry uses,
|
|
3
|
+
* so `seedCanonicalLaws` never trips axis-membership validation. */
|
|
4
|
+
export const CANONICAL_TENSOR_CONFIG = {
|
|
5
|
+
rank: 6,
|
|
6
|
+
scales: ['quantum', 'mesoscopic', 'classical', 'cosmological'],
|
|
7
|
+
forces: ['gravitational', 'electromagnetic', 'weak', 'strong', 'emergent'],
|
|
8
|
+
symmetries: ['poincare', 'gauge', 'conformal', 'susy', 'emergent'],
|
|
9
|
+
informationMeasures: ['vonNeumann', 'shannon', 'kolmogorov', 'quantumDiscord'],
|
|
10
|
+
};
|
|
11
|
+
/** Map a canonical entry onto the `PhysicalLaw` shape the L-layer consumes.
|
|
12
|
+
* Canonical laws are ground truth → `confidence: 1`. Regime axes map to the
|
|
13
|
+
* law's single-valued axis arrays (empty when the regime leaves an axis open). */
|
|
14
|
+
export function canonicalToLaw(ce) {
|
|
15
|
+
const r = ce.regime;
|
|
16
|
+
return {
|
|
17
|
+
id: ce.id,
|
|
18
|
+
name: ce.name,
|
|
19
|
+
equation: ce.formula_latex,
|
|
20
|
+
scales: r.scale ? [r.scale] : [],
|
|
21
|
+
forces: r.force ? [r.force] : [],
|
|
22
|
+
symmetries: r.symmetry ? [r.symmetry] : [],
|
|
23
|
+
confidence: 1,
|
|
24
|
+
informationMeasures: r.information ? [r.information] : undefined,
|
|
25
|
+
dimensions: r.dimension !== undefined ? [r.dimension] : undefined,
|
|
26
|
+
topologies: r.topology !== undefined ? [r.topology] : undefined,
|
|
27
|
+
references: [...ce.references],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Seed every canonical equation into `t`'s L-layer. Returns the count added. */
|
|
31
|
+
export function seedCanonicalLaws(t) {
|
|
32
|
+
let added = 0;
|
|
33
|
+
for (const ce of CANONICAL_EQUATIONS) {
|
|
34
|
+
if (t.addLaw(canonicalToLaw(ce)))
|
|
35
|
+
added++;
|
|
36
|
+
}
|
|
37
|
+
return added;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=seed-l-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed-l-layer.js","sourceRoot":"","sources":["../../src/canonical/seed-l-layer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD;qEACqE;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAiB;IACnD,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,CAAC;IAC9D,MAAM,EAAE,CAAC,eAAe,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC;IAC1E,UAAU,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC;IAClE,mBAAmB,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,CAAC;CAC/E,CAAC;AAEF;;mFAEmF;AACnF,MAAM,UAAU,cAAc,CAAC,EAAqB;IAClD,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IACpB,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,EAAE;QACT,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,QAAQ,EAAE,EAAE,CAAC,aAAa;QAC1B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;QAChC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CA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