universal-physics-tensor 0.46.0 → 0.47.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/README.md +61 -43
- package/bin/upt.mjs +22 -22
- package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.js +34 -8
- package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.js +6 -3
- package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.js +4 -1
- package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
- package/dist/atlas/types.d.ts +18 -1
- package/dist/atlas/types.d.ts.map +1 -1
- package/dist/atlas/types.js.map +1 -1
- package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/waves/bridges-closure.js +7 -4
- package/dist/atlas/waves/bridges-closure.js.map +1 -1
- package/dist/atlas/waves/bridges.d.ts.map +1 -1
- package/dist/atlas/waves/bridges.js +2 -1
- package/dist/atlas/waves/bridges.js.map +1 -1
- package/dist/bridges/be51-lensing-confrontation.d.ts.map +1 -1
- package/dist/bridges/be51-lensing-confrontation.js +5 -3
- package/dist/bridges/be51-lensing-confrontation.js.map +1 -1
- package/dist/bridges/be52-mercury-confrontation.d.ts.map +1 -1
- package/dist/bridges/be52-mercury-confrontation.js +4 -1
- package/dist/bridges/be52-mercury-confrontation.js.map +1 -1
- package/dist/bridges/bridge-equations.d.ts +1 -2
- package/dist/bridges/bridge-equations.d.ts.map +1 -1
- package/dist/bridges/bridge-equations.js +1 -2
- package/dist/bridges/bridge-equations.js.map +1 -1
- package/dist/bridges/confrontations.d.ts.map +1 -1
- package/dist/bridges/confrontations.js +7 -0
- package/dist/bridges/confrontations.js.map +1 -1
- package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts +2 -45
- package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts.map +1 -1
- package/dist/bridges/equations/be-35-conformal-bootstrap.js +2 -74
- package/dist/bridges/equations/be-35-conformal-bootstrap.js.map +1 -1
- package/dist/bridges/index.js +1 -1
- package/dist/bridges/index.js.map +1 -1
- package/dist/bridges/observations/types.d.ts +14 -0
- package/dist/bridges/observations/types.d.ts.map +1 -1
- package/dist/bridges/observations/types.js.map +1 -1
- package/dist/cli/commands/audit.js +3 -3
- package/dist/cli/commands/candidates.js +3 -3
- package/dist/cli/commands/canonical.js +3 -3
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +8 -1
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/connectors.js +7 -7
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +40 -9
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/discover.d.ts.map +1 -1
- package/dist/cli/commands/discover.js +46 -27
- package/dist/cli/commands/discover.js.map +1 -1
- package/dist/cli/commands/evaluate.d.ts.map +1 -1
- package/dist/cli/commands/evaluate.js +2 -1
- package/dist/cli/commands/evaluate.js.map +1 -1
- package/dist/cli/commands/explain.d.ts.map +1 -1
- package/dist/cli/commands/explain.js +19 -6
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +28 -11
- package/dist/cli/commands/map.js.map +1 -1
- package/dist/cli/commands/path.d.ts.map +1 -1
- package/dist/cli/commands/path.js +90 -7
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/predict.js +4 -4
- package/dist/cli/commands/priority.js +2 -2
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +59 -2
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/regime.d.ts +27 -0
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +57 -3
- package/dist/cli/commands/regime.js.map +1 -1
- package/dist/cli/commands/symbolic.js +5 -5
- package/dist/cli/errors.d.ts +13 -1
- package/dist/cli/errors.d.ts.map +1 -1
- package/dist/cli/errors.js +13 -1
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +10 -5
- package/dist/cli/main.js.map +1 -1
- package/dist/cli-api.d.ts +5 -1
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +5 -1
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/canonical-compare.d.ts +65 -0
- package/dist/composition/canonical-compare.d.ts.map +1 -0
- package/dist/composition/canonical-compare.js +237 -0
- package/dist/composition/canonical-compare.js.map +1 -0
- package/dist/composition/canonical-prefactors.d.ts +32 -0
- package/dist/composition/canonical-prefactors.d.ts.map +1 -0
- package/dist/composition/canonical-prefactors.js +80 -0
- package/dist/composition/canonical-prefactors.js.map +1 -0
- package/dist/composition/discovery.d.ts +20 -3
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +30 -4
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/explain.d.ts +9 -1
- package/dist/composition/explain.d.ts.map +1 -1
- package/dist/composition/explain.js +34 -8
- package/dist/composition/explain.js.map +1 -1
- package/dist/composition/grounding.d.ts.map +1 -1
- package/dist/composition/grounding.js +6 -1
- package/dist/composition/grounding.js.map +1 -1
- package/dist/composition/probe/corpus.d.ts +12 -0
- package/dist/composition/probe/corpus.d.ts.map +1 -1
- package/dist/composition/probe/corpus.js +100 -0
- package/dist/composition/probe/corpus.js.map +1 -1
- package/dist/composition/probe/generator.d.ts +14 -0
- package/dist/composition/probe/generator.d.ts.map +1 -1
- package/dist/composition/probe/generator.js +24 -2
- package/dist/composition/probe/generator.js.map +1 -1
- package/dist/composition/probe/pipeline.d.ts +5 -0
- package/dist/composition/probe/pipeline.d.ts.map +1 -1
- package/dist/composition/probe/pipeline.js +20 -3
- package/dist/composition/probe/pipeline.js.map +1 -1
- package/dist/composition/probe/report.d.ts.map +1 -1
- package/dist/composition/probe/report.js +2 -0
- package/dist/composition/probe/report.js.map +1 -1
- package/dist/core/constants.d.ts +13 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +13 -0
- package/dist/core/constants.js.map +1 -1
- package/dist/diff/bridge-gradient.d.ts +1 -1
- package/dist/diff/bridge-gradient.js +1 -1
- package/package.json +45 -3
package/dist/cli-api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-api.js","sourceRoot":"","sources":["../src/cli-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,oDAAoD;AACpD,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,sBAAsB,EACtB,aAAa,EACb,MAAM,EACN,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,kDAAkD;AAClD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAE1C,yCAAyC;AACzC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,kBAAk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BAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,2EAA2E;AAC3E,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAGhE,6EAA6E;AAC7E,sEAAsE;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare a user's formula with the canonical (textbook) equation it restates.
|
|
3
|
+
*
|
|
4
|
+
* Dimensional analysis cannot see a dimensionless prefactor, so `T = π√(ℓ/g)`
|
|
5
|
+
* and `K = m v²` pass every dimensional check. When the registry holds an
|
|
6
|
+
* equation with the same target and the same variables, this module evaluates
|
|
7
|
+
* both sides at {@link FIXED_POINT_EXPONENTS}, fixed points documented here, and
|
|
8
|
+
* classifies the ratio `yours / canonical`:
|
|
9
|
+
*
|
|
10
|
+
* - `agrees` — constant and equal to 1: the prefactor is checked and right.
|
|
11
|
+
* - `factor` — constant but not 1: the forms agree and the prefactor does not.
|
|
12
|
+
* - `form` — not constant across the points: a different law.
|
|
13
|
+
* - `prefactor-unchecked` — the forms agree, but the registry records the law
|
|
14
|
+
* only up to a constant or only dimensionally, so it holds no prefactor to
|
|
15
|
+
* compare with. That is reported as unchecked, never as agreement.
|
|
16
|
+
* - `not-compared` — the variables could not be aligned, or an evaluation
|
|
17
|
+
* failed; `detail` says which.
|
|
18
|
+
*
|
|
19
|
+
* The points are fixed so the output is identical on every run.
|
|
20
|
+
*
|
|
21
|
+
* INTERNAL — surfaced by `upt map --equation` and `upt derive --formula`.
|
|
22
|
+
*
|
|
23
|
+
* @module composition/canonical-compare
|
|
24
|
+
*/
|
|
25
|
+
import type { Dimension } from '../dimensional/types.js';
|
|
26
|
+
import type { CanonicalEquation } from '../canonical/canonical-equation.js';
|
|
27
|
+
/** How a user formula compares with one canonical equation. @internal */
|
|
28
|
+
export interface CanonicalComparison {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly kind: 'agrees' | 'factor' | 'form' | 'prefactor-unchecked' | 'not-compared';
|
|
32
|
+
/** `yours / canonical`, present only for `agrees` and `factor`. */
|
|
33
|
+
readonly ratio?: number;
|
|
34
|
+
/** Why the prefactor is unchecked, or why no comparison was made. */
|
|
35
|
+
readonly detail?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Compare a user formula with every canonical equation that has the same
|
|
39
|
+
* target and the same non-constant variables (names match after `_` → `-`).
|
|
40
|
+
* `evaluateUser` receives values keyed by the CANONICAL variable names.
|
|
41
|
+
* Returns one comparison per matching entry, in registry order; empty when
|
|
42
|
+
* no entry matches.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare function compareWithCanonical(target: string, sources: readonly string[], evaluateUser: (values: Readonly<Record<string, number>>) => number, entries?: readonly CanonicalEquation[]): CanonicalComparison[];
|
|
47
|
+
/**
|
|
48
|
+
* Compare a `TARGET = EXPR` user equation (the `upt map --equation` input) with
|
|
49
|
+
* the canonical registry. Names resolve onto `catalogDims` the way
|
|
50
|
+
* `analyzeUserEquation` resolves them; `pi` and `tau` are the only named numbers.
|
|
51
|
+
* Returns `[]` when the equation does not parse or no entry matches.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export declare function compareUserEquation(equation: string, catalogDims: ReadonlyMap<string, Dimension>): Promise<CanonicalComparison[]>;
|
|
56
|
+
/**
|
|
57
|
+
* The report lines for a comparison result, shared by `upt map --equation` and
|
|
58
|
+
* `upt derive`. An empty result is itself a line: a dimensional MATCH never
|
|
59
|
+
* checks a prefactor, and the reader must not take silence for a check.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare function describeComparisons(cs: readonly CanonicalComparison[]): string[];
|
|
63
|
+
/** One report line per comparison. @internal */
|
|
64
|
+
export declare function describeComparison(c: CanonicalComparison): string;
|
|
65
|
+
//# sourceMappingURL=canonical-compare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-compare.d.ts","sourceRoot":"","sources":["../../src/composition/canonical-compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAsB5E,yEAAyE;AACzE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,qBAAqB,GAAG,cAAc,CAAC;IACrF,mEAAmE;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAyED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,YAAY,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,MAAM,EAClE,OAAO,GAAE,SAAS,iBAAiB,EAAwB,GAC1D,mBAAmB,EAAE,CA8DvB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,GAC1C,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAqBhC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,SAAS,mBAAmB,EAAE,GAAG,MAAM,EAAE,CAIhF;AAED,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAejE"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare a user's formula with the canonical (textbook) equation it restates.
|
|
3
|
+
*
|
|
4
|
+
* Dimensional analysis cannot see a dimensionless prefactor, so `T = π√(ℓ/g)`
|
|
5
|
+
* and `K = m v²` pass every dimensional check. When the registry holds an
|
|
6
|
+
* equation with the same target and the same variables, this module evaluates
|
|
7
|
+
* both sides at {@link FIXED_POINT_EXPONENTS}, fixed points documented here, and
|
|
8
|
+
* classifies the ratio `yours / canonical`:
|
|
9
|
+
*
|
|
10
|
+
* - `agrees` — constant and equal to 1: the prefactor is checked and right.
|
|
11
|
+
* - `factor` — constant but not 1: the forms agree and the prefactor does not.
|
|
12
|
+
* - `form` — not constant across the points: a different law.
|
|
13
|
+
* - `prefactor-unchecked` — the forms agree, but the registry records the law
|
|
14
|
+
* only up to a constant or only dimensionally, so it holds no prefactor to
|
|
15
|
+
* compare with. That is reported as unchecked, never as agreement.
|
|
16
|
+
* - `not-compared` — the variables could not be aligned, or an evaluation
|
|
17
|
+
* failed; `detail` says which.
|
|
18
|
+
*
|
|
19
|
+
* The points are fixed so the output is identical on every run.
|
|
20
|
+
*
|
|
21
|
+
* INTERNAL — surfaced by `upt map --equation` and `upt derive --formula`.
|
|
22
|
+
*
|
|
23
|
+
* @module composition/canonical-compare
|
|
24
|
+
*/
|
|
25
|
+
import { equals } from '../dimensional/algebra.js';
|
|
26
|
+
import { CANONICAL_EQUATIONS } from '../canonical/registry.js';
|
|
27
|
+
import { CONSTANTS } from './symbolic-constants.js';
|
|
28
|
+
import { evalExpr } from './expr-eval.js';
|
|
29
|
+
import { canonicalPrefactor } from './canonical-prefactors.js';
|
|
30
|
+
import { parseUserEquation, resolveToCatalogName } from './user-equation.js';
|
|
31
|
+
import { parsePhysics } from '../numerical/formula-registry.js';
|
|
32
|
+
import { DIMENSIONLESS } from '../dimensional/types.js';
|
|
33
|
+
/**
|
|
34
|
+
* The comparison points: variable `i` (in sorted name order) takes the value
|
|
35
|
+
* `(1.7 + i)^p` at point `p` of this list, the scheme `upt derive` uses to
|
|
36
|
+
* recover a prefactor. Each variable has its own base, so the RATIOS between
|
|
37
|
+
* variables change from point to point too. A common scale factor would leave
|
|
38
|
+
* every ratio such as ℓ/g fixed, and `T ∝ ℓ/g` would then pass as the form of
|
|
39
|
+
* `T ∝ √(ℓ/g)`.
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
const FIXED_POINT_EXPONENTS = [1, 1.3, 1.6];
|
|
43
|
+
/** Relative tolerance for "the ratio is constant" and "the ratio is 1". @internal */
|
|
44
|
+
const RATIO_TOLERANCE = 1e-9;
|
|
45
|
+
const normalize = (name) => name.replace(/_/g, '-');
|
|
46
|
+
/** A governing variable that is a registered physical constant of the same dimension. */
|
|
47
|
+
function isConstant(v) {
|
|
48
|
+
const c = CONSTANTS[v.name];
|
|
49
|
+
return c !== undefined && equals(c.dim, v.dim);
|
|
50
|
+
}
|
|
51
|
+
/** The free (non-constant, non-literal) symbols of an AST, with their dimensions. */
|
|
52
|
+
function freeSymbols(node, out) {
|
|
53
|
+
if (node.kind === 'symbol') {
|
|
54
|
+
const literal = Number.isFinite(Number(node.name));
|
|
55
|
+
if (!literal && CONSTANTS[node.name] === undefined)
|
|
56
|
+
out.set(node.name, node.dim);
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
const args = node.args ?? [];
|
|
60
|
+
for (const a of args)
|
|
61
|
+
freeSymbols(a, out);
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Map each free AST symbol to a governing variable: by name first, then by a
|
|
66
|
+
* dimension that exactly one unassigned variable carries. `null` when that fails.
|
|
67
|
+
*/
|
|
68
|
+
function alignSymbols(symbols, governing) {
|
|
69
|
+
if (symbols.size !== governing.length)
|
|
70
|
+
return null;
|
|
71
|
+
const assignment = new Map();
|
|
72
|
+
const free = new Set(governing.map((g) => g.name));
|
|
73
|
+
for (const s of [...symbols.keys()].sort()) {
|
|
74
|
+
if (free.has(s)) {
|
|
75
|
+
assignment.set(s, s);
|
|
76
|
+
free.delete(s);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
for (const [s, dim] of [...symbols.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
80
|
+
if (assignment.has(s))
|
|
81
|
+
continue;
|
|
82
|
+
const candidates = governing.filter((g) => free.has(g.name) && equals(g.dim, dim));
|
|
83
|
+
if (candidates.length !== 1)
|
|
84
|
+
return null;
|
|
85
|
+
assignment.set(s, candidates[0].name);
|
|
86
|
+
free.delete(candidates[0].name);
|
|
87
|
+
}
|
|
88
|
+
return assignment;
|
|
89
|
+
}
|
|
90
|
+
function classify(entry, ratios, recordsPrefactor) {
|
|
91
|
+
const base = { id: entry.id, name: entry.name };
|
|
92
|
+
const r0 = ratios[0];
|
|
93
|
+
const constant = ratios.every((r) => Math.abs(r / r0 - 1) <= RATIO_TOLERANCE);
|
|
94
|
+
if (!constant)
|
|
95
|
+
return { ...base, kind: 'form' };
|
|
96
|
+
if (!recordsPrefactor) {
|
|
97
|
+
return {
|
|
98
|
+
...base,
|
|
99
|
+
kind: 'prefactor-unchecked',
|
|
100
|
+
detail: entry.epistemicStatus === 'dimensional'
|
|
101
|
+
? 'the registry records its dimensional form only'
|
|
102
|
+
: 'the registry records it only up to a constant',
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return Math.abs(r0 - 1) <= RATIO_TOLERANCE
|
|
106
|
+
? { ...base, kind: 'agrees', ratio: r0 }
|
|
107
|
+
: { ...base, kind: 'factor', ratio: r0 };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Compare a user formula with every canonical equation that has the same
|
|
111
|
+
* target and the same non-constant variables (names match after `_` → `-`).
|
|
112
|
+
* `evaluateUser` receives values keyed by the CANONICAL variable names.
|
|
113
|
+
* Returns one comparison per matching entry, in registry order; empty when
|
|
114
|
+
* no entry matches.
|
|
115
|
+
*
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
export function compareWithCanonical(target, sources, evaluateUser, entries = CANONICAL_EQUATIONS) {
|
|
119
|
+
const wantTarget = normalize(target);
|
|
120
|
+
const wantSources = [...new Set(sources.map(normalize))].sort();
|
|
121
|
+
const results = [];
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
const d = entry.dimensional;
|
|
124
|
+
if (normalize(d.target.name) !== wantTarget)
|
|
125
|
+
continue;
|
|
126
|
+
const variables = d.governing.filter((g) => !isConstant(g));
|
|
127
|
+
const names = variables.map((g) => normalize(g.name)).sort();
|
|
128
|
+
if (names.length !== wantSources.length || names.some((n, i) => n !== wantSources[i]))
|
|
129
|
+
continue;
|
|
130
|
+
const points = FIXED_POINT_EXPONENTS.map((p) => Object.fromEntries(names.map((n, i) => [n, Math.pow(1.7 + i, p)])));
|
|
131
|
+
// A prefactor the entry does not record may come from the sourced table,
|
|
132
|
+
// which lives outside the pinned src/canonical tree.
|
|
133
|
+
const tabled = entry.epistemicStatus === 'fully-quantitative' ? undefined : canonicalPrefactor(entry.id);
|
|
134
|
+
const factor = tabled ?? 1;
|
|
135
|
+
let canonicalAt;
|
|
136
|
+
if (entry.scalarAst !== undefined) {
|
|
137
|
+
const alignment = alignSymbols(freeSymbols(entry.scalarAst, new Map()), variables);
|
|
138
|
+
if (alignment === null) {
|
|
139
|
+
results.push({
|
|
140
|
+
id: entry.id,
|
|
141
|
+
name: entry.name,
|
|
142
|
+
kind: 'not-compared',
|
|
143
|
+
detail: 'its variables could not be aligned by name or by a unique dimension',
|
|
144
|
+
});
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const ast = entry.scalarAst;
|
|
148
|
+
canonicalAt = (p) => factor * evalExpr(ast, Object.fromEntries([...alignment].map(([sym, g]) => [sym, p[normalize(g)]])));
|
|
149
|
+
}
|
|
150
|
+
else if (d.monomial !== null) {
|
|
151
|
+
const monomial = d.monomial;
|
|
152
|
+
canonicalAt = (p) => factor * Object.entries(monomial).reduce((acc, [n, e]) => acc * Math.pow(p[normalize(n)] ?? 1, e), 1);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
let ratios;
|
|
158
|
+
try {
|
|
159
|
+
ratios = points.map((p) => evaluateUser(p) / canonicalAt(p));
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
results.push({
|
|
163
|
+
id: entry.id,
|
|
164
|
+
name: entry.name,
|
|
165
|
+
kind: 'not-compared',
|
|
166
|
+
detail: `an evaluation failed (${e instanceof Error ? e.message : String(e)})`,
|
|
167
|
+
});
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (!ratios.every((r) => Number.isFinite(r) && r !== 0)) {
|
|
171
|
+
results.push({ id: entry.id, name: entry.name, kind: 'not-compared', detail: 'a ratio was zero or not finite' });
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
results.push(classify(entry, ratios, entry.epistemicStatus === 'fully-quantitative' || tabled !== undefined));
|
|
175
|
+
}
|
|
176
|
+
return results;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Compare a `TARGET = EXPR` user equation (the `upt map --equation` input) with
|
|
180
|
+
* the canonical registry. Names resolve onto `catalogDims` the way
|
|
181
|
+
* `analyzeUserEquation` resolves them; `pi` and `tau` are the only named numbers.
|
|
182
|
+
* Returns `[]` when the equation does not parse or no entry matches.
|
|
183
|
+
*
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
186
|
+
export async function compareUserEquation(equation, catalogDims) {
|
|
187
|
+
const eq = await parseUserEquation(equation);
|
|
188
|
+
const catalogNames = new Set(catalogDims.keys());
|
|
189
|
+
const resolved = new Map(eq.sources.map((s) => [s, resolveToCatalogName(s, catalogNames) ?? s]));
|
|
190
|
+
const target = resolveToCatalogName(eq.target, catalogNames) ?? eq.target;
|
|
191
|
+
const dims = {};
|
|
192
|
+
for (const [name, c] of Object.entries(CONSTANTS))
|
|
193
|
+
dims[name] = c.dim;
|
|
194
|
+
for (const [s, r] of resolved)
|
|
195
|
+
dims[s] = catalogDims.get(r) ?? DIMENSIONLESS;
|
|
196
|
+
let expr;
|
|
197
|
+
try {
|
|
198
|
+
expr = (await parsePhysics(equation.slice(equation.indexOf('=') + 1), dims)).expr;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
203
|
+
return compareWithCanonical(target, [...resolved.values()], (values) => evalExpr(expr, {
|
|
204
|
+
pi: Math.PI,
|
|
205
|
+
tau: 2 * Math.PI,
|
|
206
|
+
...Object.fromEntries([...resolved].map(([s, r]) => [s, values[normalize(r)]])),
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The report lines for a comparison result, shared by `upt map --equation` and
|
|
211
|
+
* `upt derive`. An empty result is itself a line: a dimensional MATCH never
|
|
212
|
+
* checks a prefactor, and the reader must not take silence for a check.
|
|
213
|
+
* @internal
|
|
214
|
+
*/
|
|
215
|
+
export function describeComparisons(cs) {
|
|
216
|
+
return cs.length === 0
|
|
217
|
+
? ['· no canonical equation has this target and these variables, so the prefactor is NOT checked']
|
|
218
|
+
: cs.map(describeComparison);
|
|
219
|
+
}
|
|
220
|
+
/** One report line per comparison. @internal */
|
|
221
|
+
export function describeComparison(c) {
|
|
222
|
+
const who = `${c.id} (${c.name})`;
|
|
223
|
+
const n = FIXED_POINT_EXPONENTS.length;
|
|
224
|
+
switch (c.kind) {
|
|
225
|
+
case 'agrees':
|
|
226
|
+
return `✓ agrees with ${who}, prefactor included: yours/canonical = 1 at ${n} fixed points`;
|
|
227
|
+
case 'factor':
|
|
228
|
+
return `⚠ differs from ${who} by a constant factor: yours/canonical = ${c.ratio.toPrecision(6)} at ${n} fixed points`;
|
|
229
|
+
case 'form':
|
|
230
|
+
return `⚠ differs in FORM from ${who}: yours/canonical is not constant across ${n} fixed points`;
|
|
231
|
+
case 'prefactor-unchecked':
|
|
232
|
+
return `· same form as ${who}, but ${c.detail}, so your prefactor is NOT checked`;
|
|
233
|
+
case 'not-compared':
|
|
234
|
+
return `· ${who} shares your target and variables, but was not compared: ${c.detail}`;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=canonical-compare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-compare.js","sourceRoot":"","sources":["../../src/composition/canonical-compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EA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ical` records only
|
|
3
|
+
* dimensionally or only up to a constant.
|
|
4
|
+
*
|
|
5
|
+
* CE-pendulum-period is a monomial and CE-kinetic-energy's AST is `m·v²`, so a
|
|
6
|
+
* user formula wrong by 2π or ½ could not be caught (persona findings L2, L7).
|
|
7
|
+
* `src/canonical` is a pinned Criterion 3 input tree, so the prefactors live
|
|
8
|
+
* here, outside it (Mothership ruling 2026-09-25). Each prefactor multiplies the
|
|
9
|
+
* entry's AST, or its monomial when it has no AST; a test holds that neither
|
|
10
|
+
* carries a constant of its own.
|
|
11
|
+
*
|
|
12
|
+
* Every quote is verbatim wikitext from the pinned Wikipedia revision in its
|
|
13
|
+
* locator, fetched and matched on 2026-09-25.
|
|
14
|
+
*
|
|
15
|
+
* @module composition/canonical-prefactors
|
|
16
|
+
*/
|
|
17
|
+
/** One sourced prefactor. @internal */
|
|
18
|
+
export interface CanonicalPrefactor {
|
|
19
|
+
/** A `CanonicalEquation.id`. */
|
|
20
|
+
readonly id: string;
|
|
21
|
+
/** The exact dimensionless factor in front of the entry's AST or monomial. */
|
|
22
|
+
readonly prefactor: number;
|
|
23
|
+
/** Verbatim source text the factor is read from. */
|
|
24
|
+
readonly quote: string;
|
|
25
|
+
/** Where the quote is: page, revision id and wikitext line. */
|
|
26
|
+
readonly locator: string;
|
|
27
|
+
}
|
|
28
|
+
/** The sourced prefactors, by canonical id. @internal */
|
|
29
|
+
export declare const CANONICAL_PREFACTORS: readonly CanonicalPrefactor[];
|
|
30
|
+
/** The sourced prefactor of a canonical entry, or `undefined`. @internal */
|
|
31
|
+
export declare function canonicalPrefactor(id: string): number | undefined;
|
|
32
|
+
//# sourceMappingURL=canonical-prefactors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-prefactors.d.ts","sourceRoot":"","sources":["../../src/composition/canonical-prefactors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAyD7D,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact prefactors for canonical equations that `src/canonical` records only
|
|
3
|
+
* dimensionally or only up to a constant.
|
|
4
|
+
*
|
|
5
|
+
* CE-pendulum-period is a monomial and CE-kinetic-energy's AST is `m·v²`, so a
|
|
6
|
+
* user formula wrong by 2π or ½ could not be caught (persona findings L2, L7).
|
|
7
|
+
* `src/canonical` is a pinned Criterion 3 input tree, so the prefactors live
|
|
8
|
+
* here, outside it (Mothership ruling 2026-09-25). Each prefactor multiplies the
|
|
9
|
+
* entry's AST, or its monomial when it has no AST; a test holds that neither
|
|
10
|
+
* carries a constant of its own.
|
|
11
|
+
*
|
|
12
|
+
* Every quote is verbatim wikitext from the pinned Wikipedia revision in its
|
|
13
|
+
* locator, fetched and matched on 2026-09-25.
|
|
14
|
+
*
|
|
15
|
+
* @module composition/canonical-prefactors
|
|
16
|
+
*/
|
|
17
|
+
/** The sourced prefactors, by canonical id. @internal */
|
|
18
|
+
export const CANONICAL_PREFACTORS = [
|
|
19
|
+
{
|
|
20
|
+
id: 'CE-pendulum-period',
|
|
21
|
+
prefactor: 2 * Math.PI,
|
|
22
|
+
quote: String.raw `T_0 = 2\pi\sqrt{\frac \ell g}`,
|
|
23
|
+
locator: "Wikipedia, 'Pendulum (mechanics)', revision 1374595895, wikitext line 171",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'CE-kinetic-energy',
|
|
27
|
+
prefactor: 0.5,
|
|
28
|
+
quote: String.raw `E_\text{k} = \frac{1}{2} mv^2`,
|
|
29
|
+
locator: "Wikipedia, 'Kinetic energy', revision 1370969006, wikitext line 56",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'CE-rotational-kinetic-energy',
|
|
33
|
+
prefactor: 0.5,
|
|
34
|
+
quote: String.raw `E_\text{rotational} = \tfrac{1}{2} I \omega^2`,
|
|
35
|
+
locator: "Wikipedia, 'Rotational energy', revision 1258577842, wikitext line 3",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'CE-capacitor-energy',
|
|
39
|
+
prefactor: 0.5,
|
|
40
|
+
quote: String.raw `W = \frac{1}{2}CV^2`,
|
|
41
|
+
locator: "Wikipedia, 'Capacitor', revision 1375788837, wikitext line 137",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'CE-schwarzschild-radius',
|
|
45
|
+
prefactor: 2,
|
|
46
|
+
quote: String.raw `Schwarzschild radius{{br}}<math display="inline">\frac{2GM}{c^2}</math>`,
|
|
47
|
+
locator: "Wikipedia, 'Schwarzschild radius', revision 1373854769, wikitext line 25",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
// a³/T² = GM/(4π²) for M ≫ m gives T = 2π √(a³/(GM)); the canonical monomial is a^1.5 (GM)^-0.5.
|
|
51
|
+
id: 'CE-kepler-third',
|
|
52
|
+
prefactor: 2 * Math.PI,
|
|
53
|
+
quote: String.raw `\frac{a^3}{T^2} = \frac{G(M + m)}{4\pi^2} \approx \frac{GM}{4\pi^2}`,
|
|
54
|
+
locator: "Wikipedia, 'Kepler's laws of planetary motion', revision 1376360196, wikitext line 232",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'CE-lc-resonance',
|
|
58
|
+
prefactor: 1,
|
|
59
|
+
quote: String.raw `\omega_0 = \frac{1}{\sqrt{LC}},`,
|
|
60
|
+
locator: "Wikipedia, 'LC circuit', revision 1350658867, wikitext line 66",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
// The Stokes friction coefficient ζ = 6πηr; the drag at speed v is F = ζ v.
|
|
64
|
+
id: 'CE-stokes-drag',
|
|
65
|
+
prefactor: 6 * Math.PI,
|
|
66
|
+
quote: String.raw `\zeta = 6 \pi \, \eta \, r,`,
|
|
67
|
+
locator: "Wikipedia, 'Einstein relation (kinetic theory)', revision 1353047788, wikitext line 77",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'CE-stokes-einstein',
|
|
71
|
+
prefactor: 1 / (6 * Math.PI),
|
|
72
|
+
quote: String.raw `D = \frac{k_\text{B} T}{6\pi\,\eta\,r}.`,
|
|
73
|
+
locator: "Wikipedia, 'Einstein relation (kinetic theory)', revision 1353047788, wikitext line 79",
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
/** The sourced prefactor of a canonical entry, or `undefined`. @internal */
|
|
77
|
+
export function canonicalPrefactor(id) {
|
|
78
|
+
return CANONICAL_PREFACTORS.find((p) => p.id === id)?.prefactor;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=canonical-prefactors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-prefactors.js","sourceRoot":"","sources":["../../src/composition/canonical-prefactors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAcH,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE;QACE,EAAE,EAAE,oBAAoB;QACxB,SAAS,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACtB,KAAK,EAAE,MAAM,CAAC,GAAG,CAAA,+BAA+B;QAChD,OAAO,EAAE,2EAA2E;KACrF;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,SAAS,EAAE,GAAG;QACd,KAAK,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C3C,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC;AAClE,CAAC"}
|
|
@@ -80,6 +80,22 @@ export interface VettedCandidate {
|
|
|
80
80
|
/** The magnitude gate read at least one endpoint value from the graph at
|
|
81
81
|
* the anchor (no static table entry) rather than the sourced table. */
|
|
82
82
|
readonly magnitudeUsedAnchor: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The magnitude comparison used an anchor-derived value, and the ratio of the
|
|
85
|
+
* two magnitudes does NOT move when every anchor input is rescaled by
|
|
86
|
+
* {@link ANCHOR_PROBE_FACTOR}. The graph then fixes the ratio at every
|
|
87
|
+
* anchor, so agreement in magnitude is an identity of the graph and not
|
|
88
|
+
* evidence for the identification. The case that exposed it: the anchor sets
|
|
89
|
+
* the temperature to the Hawking temperature of the anchor mass M, and then
|
|
90
|
+
* the thermal wavelength is exactly 4π ℓ_P for EVERY M. Its anchor-derived
|
|
91
|
+
* magnitude is not a representative magnitude of the quantity at all.
|
|
92
|
+
* A quantity whose value really is a constant belongs in the
|
|
93
|
+
* representative-value table, where it is not anchor-derived.
|
|
94
|
+
* A clash stays a clash (the graph itself fixes the two apart); only a pass is
|
|
95
|
+
* withheld, in `describeGrounding`. Optional on the type so hand-built
|
|
96
|
+
* candidates need not state it; the funnel always sets it.
|
|
97
|
+
*/
|
|
98
|
+
readonly magnitudeAnchorInvariant?: boolean;
|
|
83
99
|
/**
|
|
84
100
|
* One endpoint name's hyphen-token set is a strict subset of the other's
|
|
85
101
|
* (`mass` ⊂ `reference-mass`) — a generic↔specific identification of the
|
|
@@ -93,9 +109,10 @@ export interface VettedCandidate {
|
|
|
93
109
|
* single-anchor graph cannot make). Checked first.
|
|
94
110
|
* - `contradictory` — breaks numerical consistency (a graph falsification).
|
|
95
111
|
* - `axis-clash` — the identification's stated `scale`/`force` regime
|
|
96
|
-
* attributes disagree
|
|
97
|
-
*
|
|
98
|
-
*
|
|
112
|
+
* attributes disagree. A regime-LABEL prior against a
|
|
113
|
+
* literal identity (D1), not a physical test: it
|
|
114
|
+
* compares catalog labels and runs no computation, so
|
|
115
|
+
* it is never counted or described as a falsification.
|
|
99
116
|
* - `promising` — consistent AND connects disconnected physics AND
|
|
100
117
|
* unlocks ≥1 quantity. Worth physicist review.
|
|
101
118
|
* - `inert` — consistent but structurally/numerically idle (a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/composition/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAItD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAWtE;4DAC4D;AAC5D,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAS1E,CAAC;AA+BL,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAA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CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC7D;;;;;OAKG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACrE;AA8HD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,aAAa,EACxB,IAAI,GAAE,gBAAqB,GAC1B,eAAe,CAEjB;AA+LD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,IAAI,GAAE,gBAAqB,GAC1B,eAAe,EAAE,CAmBnB"}
|
|
@@ -60,7 +60,7 @@ export const REGISTRY_ATTRIBUTES_BY_NAME = (() => {
|
|
|
60
60
|
}
|
|
61
61
|
return m;
|
|
62
62
|
})();
|
|
63
|
-
// The axes the D1
|
|
63
|
+
// The axes the D1 regime-label gate compares are `GATE_AXES`, imported from the
|
|
64
64
|
// `axes.ts` registry (`AXES.filter(gated)`) at the top of this module. Currently
|
|
65
65
|
// scale + force; the 2026-07-05 extensible-axis expansion added
|
|
66
66
|
// symmetry/topology/statistics as UNGATED attributes (they only abstain until the
|
|
@@ -121,6 +121,15 @@ function quantityComponents(edges, idents) {
|
|
|
121
121
|
return roots;
|
|
122
122
|
}
|
|
123
123
|
const ANCHOR_DEFAULT = { mass: M_SUN_KG };
|
|
124
|
+
/**
|
|
125
|
+
* Factor every anchor input is multiplied by to probe whether a magnitude ratio
|
|
126
|
+
* depends on the anchor at all (persona finding L3). Three decades moves any
|
|
127
|
+
* log-ratio that depends on the anchor far beyond {@link ANCHOR_INVARIANCE_TOL}.
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
const ANCHOR_PROBE_FACTOR = 1e3;
|
|
131
|
+
/** Decades within which a log-ratio counts as unchanged by the probe. @internal */
|
|
132
|
+
const ANCHOR_INVARIANCE_TOL = 1e-9;
|
|
124
133
|
/**
|
|
125
134
|
* One name's hyphen-token set is a STRICT subset of the other's
|
|
126
135
|
* (`mass` ⊂ `reference-mass`, `mass` ⊂ `planck-mass`) — i.e. identifying a
|
|
@@ -157,6 +166,7 @@ function buildDiscoveryContext(edges, opts) {
|
|
|
157
166
|
// Candidate-invariant: the anchor's forward evaluation, the base component
|
|
158
167
|
// partition, and the base forward closure all depend only on (edges, opts).
|
|
159
168
|
anchorValues: forwardEvaluate(edges, groundTruth, baseIdents),
|
|
169
|
+
anchorValuesProbe: forwardEvaluate(edges, Object.fromEntries(Object.entries(groundTruth).map(([k, v]) => [k, v * ANCHOR_PROBE_FACTOR])), baseIdents),
|
|
160
170
|
comps: quantityComponents(edges, baseIdents),
|
|
161
171
|
closureBase: forwardClosure(edges, anchor, baseIdents),
|
|
162
172
|
};
|
|
@@ -179,7 +189,7 @@ export function vetLinkCandidate(edges, candidate, opts = {}) {
|
|
|
179
189
|
* @internal
|
|
180
190
|
*/
|
|
181
191
|
function vetInContext(edges, candidate, ctx) {
|
|
182
|
-
const { baseIdents, groundTruth, anchor, repVals, maxOrders, anchorValues, comps, closureBase, attributesByName, } = ctx;
|
|
192
|
+
const { baseIdents, groundTruth, anchor, repVals, maxOrders, anchorValues, anchorValuesProbe, comps, closureBase, attributesByName, } = ctx;
|
|
183
193
|
// Magnitude gate: an INDEPENDENT falsifier the single-anchor graph can't make.
|
|
184
194
|
// Only fires when both endpoints have a representative value; abstains (and
|
|
185
195
|
// never false-rejects) otherwise. A value comes from the sourced static table
|
|
@@ -206,6 +216,21 @@ function vetInContext(edges, candidate, ctx) {
|
|
|
206
216
|
? Math.abs(Math.log10(Math.abs(va.value)) - Math.log10(Math.abs(vb.value)))
|
|
207
217
|
: null;
|
|
208
218
|
const magnitudeClash = ordersApart !== null && ordersApart > maxOrders;
|
|
219
|
+
// Anchor-invariance probe: re-read each anchor-derived magnitude at the
|
|
220
|
+
// rescaled anchor. A table value is a constant and does not move.
|
|
221
|
+
const probeOf = (name, m) => (m.fromAnchor ? anchorValuesProbe.get(name) : m.value);
|
|
222
|
+
let magnitudeAnchorInvariant = false;
|
|
223
|
+
if (magnitudeUsedAnchor) {
|
|
224
|
+
const pa = probeOf(candidate.a, va);
|
|
225
|
+
const pb = probeOf(candidate.b, vb);
|
|
226
|
+
if (pa !== undefined && pb !== undefined && pa !== 0 && pb !== 0 && Number.isFinite(pa) && Number.isFinite(pb)) {
|
|
227
|
+
const la = Math.log10(Math.abs(va.value));
|
|
228
|
+
const lb = Math.log10(Math.abs(vb.value));
|
|
229
|
+
const lpa = Math.log10(Math.abs(pa));
|
|
230
|
+
const lpb = Math.log10(Math.abs(pb));
|
|
231
|
+
magnitudeAnchorInvariant = Math.abs((lpa - lpb) - (la - lb)) <= ANCHOR_INVARIANCE_TOL;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
209
234
|
// A generic↔specialization identification (mass ≟ reference-mass) is
|
|
210
235
|
// near-tautological — barred from `promising` regardless of structure.
|
|
211
236
|
const subsuming = nameSubsumes(candidate.a, candidate.b);
|
|
@@ -261,8 +286,8 @@ function vetInContext(edges, candidate, ctx) {
|
|
|
261
286
|
.sort();
|
|
262
287
|
// Verdict precedence: a magnitude clash is the most decisive, most
|
|
263
288
|
// interpretable falsification, checked before the graph contradiction;
|
|
264
|
-
// the
|
|
265
|
-
//
|
|
289
|
+
// the regime-label prior (axis-clash) is weaker than both numeric
|
|
290
|
+
// falsifiers and is not one itself, but still outranks promising/inert (D1).
|
|
266
291
|
let verdict;
|
|
267
292
|
if (magnitudeClash)
|
|
268
293
|
verdict = 'magnitude-clash';
|
|
@@ -306,6 +331,7 @@ function vetInContext(edges, candidate, ctx) {
|
|
|
306
331
|
ordersApart,
|
|
307
332
|
magnitudeChecked,
|
|
308
333
|
magnitudeUsedAnchor,
|
|
334
|
+
magnitudeAnchorInvariant,
|
|
309
335
|
subsuming,
|
|
310
336
|
verdict,
|
|
311
337
|
score,
|