universal-physics-tensor 10.0.0 → 12.0.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 +39 -36
- package/bin/upt.mjs +13 -1
- package/data/applied-cases.json +1892 -0
- package/data/applied-cases.schema.json +194 -0
- package/data/atlas/atlas.json +25 -25
- package/data/atlas/atlas.jsonld +1 -1
- package/data/atlas/diffusion.json +6 -6
- package/data/atlas/oscillators.json +7 -7
- package/data/atlas/waves.json +14 -14
- package/data/atlas/witness-results.json +11 -11
- package/data/bridge-catalog.json +389 -230
- package/data/bridge-catalog.schema.json +45 -7
- package/data/units.json +6 -25
- package/dist/atlas/applicability.d.ts.map +1 -1
- package/dist/atlas/applicability.js +21 -15
- package/dist/atlas/applicability.js.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts +9 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.js +15 -13
- package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
- package/dist/atlas/benchmark/loader.js +2 -2
- package/dist/atlas/benchmark/loader.js.map +1 -1
- package/dist/atlas/benchmark/stats.d.ts +2 -2
- package/dist/atlas/benchmark/stats.d.ts.map +1 -1
- package/dist/atlas/benchmark/stats.js +9 -15
- package/dist/atlas/benchmark/stats.js.map +1 -1
- package/dist/atlas/catalog-formal-ref.d.ts +26 -3
- package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
- package/dist/atlas/catalog-formal-ref.js +52 -5
- package/dist/atlas/catalog-formal-ref.js.map +1 -1
- package/dist/atlas/chain-pipeline.d.ts.map +1 -1
- package/dist/atlas/chain-pipeline.js +7 -8
- package/dist/atlas/chain-pipeline.js.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
- package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.js +8 -12
- package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
- package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges.js +27 -39
- package/dist/atlas/diffusion/bridges.js.map +1 -1
- package/dist/atlas/diffusion/dimensions.d.ts +6 -14
- package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
- package/dist/atlas/diffusion/dimensions.js +8 -16
- package/dist/atlas/diffusion/dimensions.js.map +1 -1
- package/dist/atlas/diffusion/models.d.ts +3 -3
- package/dist/atlas/diffusion/models.d.ts.map +1 -1
- package/dist/atlas/diffusion/models.js +5 -10
- package/dist/atlas/diffusion/models.js.map +1 -1
- package/dist/atlas/diffusion/numerics.d.ts +16 -4
- package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
- package/dist/atlas/diffusion/numerics.js +38 -24
- package/dist/atlas/diffusion/numerics.js.map +1 -1
- package/dist/atlas/link-prediction.d.ts +106 -3
- package/dist/atlas/link-prediction.d.ts.map +1 -1
- package/dist/atlas/link-prediction.js +212 -66
- package/dist/atlas/link-prediction.js.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.js +7 -11
- package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.js +6 -7
- package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
- package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.js +23 -34
- package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
- package/dist/atlas/oscillators/dimensions.d.ts +9 -21
- package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
- package/dist/atlas/oscillators/dimensions.js +9 -21
- package/dist/atlas/oscillators/dimensions.js.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
- package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.js +17 -15
- package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
- package/dist/atlas/oscillators/models.d.ts.map +1 -1
- package/dist/atlas/oscillators/models.js +2 -6
- package/dist/atlas/oscillators/models.js.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
- package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.js +60 -40
- package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
- package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
- package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/phase-translation.js +3 -4
- package/dist/atlas/oscillators/phase-translation.js.map +1 -1
- package/dist/atlas/oscillators/position-translation.d.ts +68 -7
- package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/position-translation.js +123 -12
- package/dist/atlas/oscillators/position-translation.js.map +1 -1
- package/dist/atlas/oscillators/rejections.d.ts +0 -2
- package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
- package/dist/atlas/oscillators/rejections.js +0 -7
- package/dist/atlas/oscillators/rejections.js.map +1 -1
- package/dist/atlas/physjs-entries.generated.d.ts +35 -25
- package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
- package/dist/atlas/physjs-entries.generated.js +37 -25
- package/dist/atlas/physjs-entries.generated.js.map +1 -1
- package/dist/atlas/physjs-ref.d.ts +34 -31
- package/dist/atlas/physjs-ref.d.ts.map +1 -1
- package/dist/atlas/physjs-ref.js +55 -53
- package/dist/atlas/physjs-ref.js.map +1 -1
- package/dist/atlas/physjs-reviewed.d.ts +1 -1
- package/dist/atlas/physjs-reviewed.js +15 -15
- package/dist/atlas/physjs-reviewed.js.map +1 -1
- package/dist/atlas/poster/statements.d.ts +0 -19
- package/dist/atlas/poster/statements.d.ts.map +1 -1
- package/dist/atlas/poster/statements.js +1 -1
- package/dist/atlas/poster/statements.js.map +1 -1
- package/dist/atlas/proof-target.d.ts +1 -1
- package/dist/atlas/proof-target.js +1 -1
- package/dist/atlas/proof-target.js.map +1 -1
- package/dist/atlas/regime.d.ts +1 -1
- package/dist/atlas/regime.d.ts.map +1 -1
- package/dist/atlas/regime.js +1 -1
- package/dist/atlas/regime.js.map +1 -1
- package/dist/atlas/text-overlap.d.ts +23 -0
- package/dist/atlas/text-overlap.d.ts.map +1 -0
- package/dist/atlas/text-overlap.js +41 -0
- package/dist/atlas/text-overlap.js.map +1 -0
- package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/waves/bridges-closure.js +2 -6
- 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 +32 -48
- package/dist/atlas/waves/bridges.js.map +1 -1
- package/dist/atlas/waves/models.d.ts +5 -6
- package/dist/atlas/waves/models.d.ts.map +1 -1
- package/dist/atlas/waves/models.js +7 -13
- package/dist/atlas/waves/models.js.map +1 -1
- package/dist/atlas/waves/numerics.d.ts.map +1 -1
- package/dist/atlas/waves/numerics.js +10 -3
- package/dist/atlas/waves/numerics.js.map +1 -1
- package/dist/atlas/witness-numeric.d.ts +30 -0
- package/dist/atlas/witness-numeric.d.ts.map +1 -1
- package/dist/atlas/witness-numeric.js +53 -0
- package/dist/atlas/witness-numeric.js.map +1 -1
- package/dist/atlas/witness-specs.d.ts.map +1 -1
- package/dist/atlas/witness-specs.js +19 -0
- package/dist/atlas/witness-specs.js.map +1 -1
- package/dist/atlas/witness-symbolic.d.ts +75 -3
- package/dist/atlas/witness-symbolic.d.ts.map +1 -1
- package/dist/atlas/witness-symbolic.js +116 -10
- package/dist/atlas/witness-symbolic.js.map +1 -1
- package/dist/bridges/catalog-load.d.ts.map +1 -1
- package/dist/bridges/catalog-load.js +13 -8
- package/dist/bridges/catalog-load.js.map +1 -1
- package/dist/bridges/catalog-types.d.ts +26 -2
- package/dist/bridges/catalog-types.d.ts.map +1 -1
- package/dist/bridges/catalog-types.js +11 -1
- package/dist/bridges/catalog-types.js.map +1 -1
- package/dist/bridges/evaluation-errors.d.ts +31 -1
- package/dist/bridges/evaluation-errors.d.ts.map +1 -1
- package/dist/bridges/evaluation-errors.js +20 -2
- package/dist/bridges/evaluation-errors.js.map +1 -1
- package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
- package/dist/bridges/evaluator-inputs.js +7 -5
- package/dist/bridges/evaluator-inputs.js.map +1 -1
- package/dist/bridges/evaluators.d.ts.map +1 -1
- package/dist/bridges/evaluators.js +27 -12
- package/dist/bridges/evaluators.js.map +1 -1
- package/dist/bridges/expr-parse.d.ts +11 -0
- package/dist/bridges/expr-parse.d.ts.map +1 -1
- package/dist/bridges/expr-parse.js +14 -5
- package/dist/bridges/expr-parse.js.map +1 -1
- package/dist/bridges/holds.d.ts +35 -3
- package/dist/bridges/holds.d.ts.map +1 -1
- package/dist/bridges/holds.js +117 -23
- package/dist/bridges/holds.js.map +1 -1
- package/dist/bridges/notices.d.ts.map +1 -1
- package/dist/bridges/notices.js +5 -5
- package/dist/bridges/notices.js.map +1 -1
- package/dist/bridges/relation-eval.d.ts +4 -4
- package/dist/bridges/relation-eval.d.ts.map +1 -1
- package/dist/bridges/relation-eval.js +15 -16
- package/dist/bridges/relation-eval.js.map +1 -1
- package/dist/bridges/sensitivity.d.ts.map +1 -1
- package/dist/bridges/sensitivity.js +3 -3
- package/dist/bridges/sensitivity.js.map +1 -1
- package/dist/bridges/validity.d.ts +33 -0
- package/dist/bridges/validity.d.ts.map +1 -0
- package/dist/bridges/validity.js +67 -0
- package/dist/bridges/validity.js.map +1 -0
- package/dist/canonical/entries/atomic.js +1 -3
- package/dist/canonical/entries/atomic.js.map +1 -1
- package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
- package/dist/canonical/entries/condensed-matter.js +4 -5
- package/dist/canonical/entries/condensed-matter.js.map +1 -1
- package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
- package/dist/canonical/entries/dimensional-classics.js +3 -4
- package/dist/canonical/entries/dimensional-classics.js.map +1 -1
- package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
- package/dist/canonical/entries/electromagnetism.js +4 -10
- package/dist/canonical/entries/electromagnetism.js.map +1 -1
- package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
- package/dist/canonical/entries/fluids-waves.js +3 -7
- package/dist/canonical/entries/fluids-waves.js.map +1 -1
- package/dist/canonical/entries/mechanics.d.ts.map +1 -1
- package/dist/canonical/entries/mechanics.js +4 -6
- package/dist/canonical/entries/mechanics.js.map +1 -1
- package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
- package/dist/canonical/entries/nonmonomial.js +9 -17
- package/dist/canonical/entries/nonmonomial.js.map +1 -1
- package/dist/canonical/entries/relativity.d.ts.map +1 -1
- package/dist/canonical/entries/relativity.js +6 -6
- package/dist/canonical/entries/relativity.js.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
- package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
- package/dist/canonical/fixed-points.d.ts +94 -0
- package/dist/canonical/fixed-points.d.ts.map +1 -0
- package/dist/canonical/fixed-points.js +81 -0
- package/dist/canonical/fixed-points.js.map +1 -0
- package/dist/canonical/linkage.d.ts.map +1 -1
- package/dist/canonical/linkage.js +25 -44
- package/dist/canonical/linkage.js.map +1 -1
- package/dist/canonical/normal-form.d.ts.map +1 -1
- package/dist/canonical/normal-form.js +5 -11
- package/dist/canonical/normal-form.js.map +1 -1
- package/dist/canonical/structural.d.ts +21 -21
- package/dist/canonical/structural.d.ts.map +1 -1
- package/dist/canonical/structural.js +40 -19
- package/dist/canonical/structural.js.map +1 -1
- package/dist/cases/catalog-checks.d.ts +10 -0
- package/dist/cases/catalog-checks.d.ts.map +1 -0
- package/dist/cases/catalog-checks.js +241 -0
- package/dist/cases/catalog-checks.js.map +1 -0
- package/dist/cases/catalog.d.ts +83 -0
- package/dist/cases/catalog.d.ts.map +1 -0
- package/dist/cases/catalog.js +118 -0
- package/dist/cases/catalog.js.map +1 -0
- package/dist/cases/engine.d.ts +13 -0
- package/dist/cases/engine.d.ts.map +1 -0
- package/dist/cases/engine.js +179 -0
- package/dist/cases/engine.js.map +1 -0
- package/dist/cases/index.d.ts.map +1 -1
- package/dist/cases/index.js +5 -7
- package/dist/cases/index.js.map +1 -1
- package/dist/cases/methods.d.ts +215 -0
- package/dist/cases/methods.d.ts.map +1 -0
- package/dist/cases/methods.js +743 -0
- package/dist/cases/methods.js.map +1 -0
- package/dist/cases/quadrature.d.ts +7 -9
- package/dist/cases/quadrature.d.ts.map +1 -1
- package/dist/cases/quadrature.js +28 -32
- package/dist/cases/quadrature.js.map +1 -1
- package/dist/cases/types.d.ts +12 -0
- package/dist/cases/types.d.ts.map +1 -1
- package/dist/cases/types.js.map +1 -1
- package/dist/cli/args.d.ts +25 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +30 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/bindings.d.ts.map +1 -1
- package/dist/cli/bindings.js +5 -4
- package/dist/cli/bindings.js.map +1 -1
- package/dist/cli/command.d.ts +11 -1
- package/dist/cli/command.d.ts.map +1 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/_atlas-map.d.ts +0 -9
- package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-map.js +8 -18
- package/dist/cli/commands/_atlas-map.js.map +1 -1
- package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-route.js +6 -2
- package/dist/cli/commands/_atlas-route.js.map +1 -1
- package/dist/cli/commands/_discovery-opts.d.ts +1 -0
- package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
- package/dist/cli/commands/_discovery-opts.js +9 -9
- package/dist/cli/commands/_discovery-opts.js.map +1 -1
- package/dist/cli/commands/atlas.d.ts.map +1 -1
- package/dist/cli/commands/atlas.js +8 -5
- package/dist/cli/commands/atlas.js.map +1 -1
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +8 -1
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/axes.d.ts.map +1 -1
- package/dist/cli/commands/axes.js +20 -1
- package/dist/cli/commands/axes.js.map +1 -1
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +8 -14
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +22 -22
- 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 +122 -73
- package/dist/cli/commands/discover.js.map +1 -1
- package/dist/cli/commands/eval.d.ts.map +1 -1
- package/dist/cli/commands/eval.js +1 -0
- package/dist/cli/commands/eval.js.map +1 -1
- package/dist/cli/commands/evaluate.d.ts.map +1 -1
- package/dist/cli/commands/evaluate.js +67 -39
- 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 +24 -3
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/ground.d.ts.map +1 -1
- package/dist/cli/commands/ground.js +7 -1
- package/dist/cli/commands/ground.js.map +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +84 -11
- package/dist/cli/commands/map.js.map +1 -1
- package/dist/cli/commands/metric.d.ts.map +1 -1
- package/dist/cli/commands/metric.js +12 -9
- package/dist/cli/commands/metric.js.map +1 -1
- package/dist/cli/commands/path.d.ts +10 -0
- package/dist/cli/commands/path.d.ts.map +1 -1
- package/dist/cli/commands/path.js +25 -3
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +59 -16
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +1 -0
- package/dist/cli/commands/regime.js.map +1 -1
- package/dist/cli/commands/retrieve.d.ts.map +1 -1
- package/dist/cli/commands/retrieve.js +1 -0
- package/dist/cli/commands/retrieve.js.map +1 -1
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/search.js +1 -0
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/symbolic.d.ts.map +1 -1
- package/dist/cli/commands/symbolic.js +19 -28
- package/dist/cli/commands/symbolic.js.map +1 -1
- package/dist/cli/commands/testplan.d.ts.map +1 -1
- package/dist/cli/commands/testplan.js +4 -2
- package/dist/cli/commands/testplan.js.map +1 -1
- package/dist/cli/determination.d.ts +1 -0
- package/dist/cli/determination.d.ts.map +1 -1
- package/dist/cli/determination.js.map +1 -1
- package/dist/cli/expr-print.d.ts +0 -2
- package/dist/cli/expr-print.d.ts.map +1 -1
- package/dist/cli/expr-print.js +7 -31
- package/dist/cli/expr-print.js.map +1 -1
- package/dist/cli/flag-help.d.ts +1 -0
- package/dist/cli/flag-help.d.ts.map +1 -1
- package/dist/cli/flag-help.js +1 -0
- package/dist/cli/flag-help.js.map +1 -1
- package/dist/cli/graphs.d.ts +2 -0
- package/dist/cli/graphs.d.ts.map +1 -1
- package/dist/cli/graphs.js +1 -0
- package/dist/cli/graphs.js.map +1 -1
- package/dist/cli/main.d.ts +8 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +19 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/numeric-flag.d.ts +12 -0
- package/dist/cli/numeric-flag.d.ts.map +1 -0
- package/dist/cli/numeric-flag.js +44 -0
- package/dist/cli/numeric-flag.js.map +1 -0
- package/dist/cli/output.d.ts +28 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +23 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/record-reach.js +2 -2
- package/dist/cli/record-reach.js.map +1 -1
- package/dist/cli/record-tables.d.ts.map +1 -1
- package/dist/cli/record-tables.js +6 -5
- package/dist/cli/record-tables.js.map +1 -1
- package/dist/cli/record.d.ts +1 -5
- package/dist/cli/record.d.ts.map +1 -1
- package/dist/cli/record.js +9 -8
- package/dist/cli/record.js.map +1 -1
- package/dist/cli/search-index.d.ts.map +1 -1
- package/dist/cli/search-index.js +7 -6
- package/dist/cli/search-index.js.map +1 -1
- package/dist/cli/statuses.d.ts +0 -2
- package/dist/cli/statuses.d.ts.map +1 -1
- package/dist/cli/statuses.js +12 -9
- package/dist/cli/statuses.js.map +1 -1
- package/dist/cli/stored-results.d.ts +7 -0
- package/dist/cli/stored-results.d.ts.map +1 -0
- package/dist/cli/stored-results.js +23 -0
- package/dist/cli/stored-results.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +8 -5
- package/dist/cli/version.js.map +1 -1
- package/dist/cli-api.d.ts +36 -5
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +30 -4
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/algebraic-equivalence.d.ts +43 -0
- package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
- package/dist/composition/algebraic-equivalence.js +115 -0
- package/dist/composition/algebraic-equivalence.js.map +1 -0
- package/dist/composition/axes.d.ts +0 -6
- package/dist/composition/axes.d.ts.map +1 -1
- package/dist/composition/axes.js +6 -6
- package/dist/composition/axes.js.map +1 -1
- package/dist/composition/axis-audit.d.ts +47 -20
- package/dist/composition/axis-audit.d.ts.map +1 -1
- package/dist/composition/axis-audit.js +82 -9
- package/dist/composition/axis-audit.js.map +1 -1
- package/dist/composition/bridge-analysis.d.ts +17 -0
- package/dist/composition/bridge-analysis.d.ts.map +1 -1
- package/dist/composition/bridge-analysis.js +102 -55
- package/dist/composition/bridge-analysis.js.map +1 -1
- package/dist/composition/canonical-compare.d.ts +40 -0
- package/dist/composition/canonical-compare.d.ts.map +1 -1
- package/dist/composition/canonical-compare.js +122 -24
- package/dist/composition/canonical-compare.js.map +1 -1
- package/dist/composition/canonical-graph.d.ts +3 -3
- package/dist/composition/canonical-graph.d.ts.map +1 -1
- package/dist/composition/canonical-graph.js +11 -38
- package/dist/composition/canonical-graph.js.map +1 -1
- package/dist/composition/canonical-json.js +2 -2
- package/dist/composition/canonical-json.js.map +1 -1
- package/dist/composition/catalog-graph.d.ts.map +1 -1
- package/dist/composition/catalog-graph.js +2 -5
- package/dist/composition/catalog-graph.js.map +1 -1
- package/dist/composition/chain-candidate.d.ts +8 -0
- package/dist/composition/chain-candidate.d.ts.map +1 -1
- package/dist/composition/chain-candidate.js +9 -2
- package/dist/composition/chain-candidate.js.map +1 -1
- package/dist/composition/chain-match.d.ts +6 -3
- package/dist/composition/chain-match.d.ts.map +1 -1
- package/dist/composition/chain-match.js +4 -1
- package/dist/composition/chain-match.js.map +1 -1
- package/dist/composition/chain-result.d.ts.map +1 -1
- package/dist/composition/chain-result.js +2 -14
- package/dist/composition/chain-result.js.map +1 -1
- package/dist/composition/compose-symbolic.d.ts.map +1 -1
- package/dist/composition/compose-symbolic.js +3 -2
- package/dist/composition/compose-symbolic.js.map +1 -1
- package/dist/composition/compose.d.ts.map +1 -1
- package/dist/composition/compose.js +13 -5
- package/dist/composition/compose.js.map +1 -1
- package/dist/composition/composition-recovery.d.ts.map +1 -1
- package/dist/composition/composition-recovery.js +4 -7
- package/dist/composition/composition-recovery.js.map +1 -1
- package/dist/composition/consequence.d.ts +15 -5
- package/dist/composition/consequence.d.ts.map +1 -1
- package/dist/composition/consequence.js +6 -4
- package/dist/composition/consequence.js.map +1 -1
- package/dist/composition/discovery.d.ts +129 -9
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +171 -67
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/edge.d.ts +21 -2
- package/dist/composition/edge.d.ts.map +1 -1
- package/dist/composition/edge.js +23 -1
- package/dist/composition/edge.js.map +1 -1
- package/dist/composition/enumerate.d.ts.map +1 -1
- package/dist/composition/enumerate.js +18 -3
- package/dist/composition/enumerate.js.map +1 -1
- package/dist/composition/evaluate-relation.d.ts +35 -11
- package/dist/composition/evaluate-relation.d.ts.map +1 -1
- package/dist/composition/evaluate-relation.js +60 -39
- package/dist/composition/evaluate-relation.js.map +1 -1
- package/dist/composition/explain.d.ts +3 -12
- package/dist/composition/explain.d.ts.map +1 -1
- package/dist/composition/explain.js +7 -20
- package/dist/composition/explain.js.map +1 -1
- package/dist/composition/expr-eval.d.ts +1 -1
- package/dist/composition/expr-eval.d.ts.map +1 -1
- package/dist/composition/expr-eval.js +6 -15
- package/dist/composition/expr-eval.js.map +1 -1
- package/dist/composition/expr-simplify.d.ts +26 -14
- package/dist/composition/expr-simplify.d.ts.map +1 -1
- package/dist/composition/expr-simplify.js +64 -72
- package/dist/composition/expr-simplify.js.map +1 -1
- package/dist/composition/formula-shape.d.ts +23 -4
- package/dist/composition/formula-shape.d.ts.map +1 -1
- package/dist/composition/formula-shape.js +57 -17
- package/dist/composition/formula-shape.js.map +1 -1
- package/dist/composition/graph-structure.d.ts +98 -0
- package/dist/composition/graph-structure.d.ts.map +1 -0
- package/dist/composition/graph-structure.js +167 -0
- package/dist/composition/graph-structure.js.map +1 -0
- package/dist/composition/graph-viz-svg.d.ts.map +1 -1
- package/dist/composition/graph-viz-svg.js +1 -1
- package/dist/composition/graph-viz-svg.js.map +1 -1
- package/dist/composition/graph-viz.d.ts.map +1 -1
- package/dist/composition/graph-viz.js +8 -37
- package/dist/composition/graph-viz.js.map +1 -1
- package/dist/composition/grounding.d.ts.map +1 -1
- package/dist/composition/grounding.js +19 -7
- package/dist/composition/grounding.js.map +1 -1
- package/dist/composition/identifiability.d.ts +91 -4
- package/dist/composition/identifiability.d.ts.map +1 -1
- package/dist/composition/identifiability.js +363 -6
- package/dist/composition/identifiability.js.map +1 -1
- package/dist/composition/index.d.ts +8 -4
- package/dist/composition/index.d.ts.map +1 -1
- package/dist/composition/index.js +3 -2
- package/dist/composition/index.js.map +1 -1
- package/dist/composition/mathts-quiet.d.ts +7 -8
- package/dist/composition/mathts-quiet.d.ts.map +1 -1
- package/dist/composition/mathts-quiet.js +7 -16
- package/dist/composition/mathts-quiet.js.map +1 -1
- package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
- package/dist/composition/mathts-scalar-symbols.js +2 -1
- package/dist/composition/mathts-scalar-symbols.js.map +1 -1
- package/dist/composition/own-equation-magnitude.d.ts +95 -0
- package/dist/composition/own-equation-magnitude.d.ts.map +1 -0
- package/dist/composition/own-equation-magnitude.js +270 -0
- package/dist/composition/own-equation-magnitude.js.map +1 -0
- package/dist/composition/probe/backend-protocol.d.ts +3 -0
- package/dist/composition/probe/backend-protocol.d.ts.map +1 -1
- package/dist/composition/probe/backend-protocol.js.map +1 -1
- package/dist/composition/probe/candidate-store.d.ts +1 -0
- package/dist/composition/probe/candidate-store.d.ts.map +1 -1
- package/dist/composition/probe/candidate-store.js +1 -0
- package/dist/composition/probe/candidate-store.js.map +1 -1
- package/dist/composition/probe/corpus.d.ts +8 -4
- package/dist/composition/probe/corpus.d.ts.map +1 -1
- package/dist/composition/probe/corpus.js +23 -12
- package/dist/composition/probe/corpus.js.map +1 -1
- package/dist/composition/probe/dataset.d.ts +18 -0
- package/dist/composition/probe/dataset.d.ts.map +1 -1
- package/dist/composition/probe/dataset.js +95 -50
- package/dist/composition/probe/dataset.js.map +1 -1
- package/dist/composition/probe/experiment-design.d.ts +7 -1
- package/dist/composition/probe/experiment-design.d.ts.map +1 -1
- package/dist/composition/probe/experiment-design.js +44 -24
- package/dist/composition/probe/experiment-design.js.map +1 -1
- package/dist/composition/probe/falsify.d.ts +2 -0
- package/dist/composition/probe/falsify.d.ts.map +1 -1
- package/dist/composition/probe/falsify.js +2 -0
- package/dist/composition/probe/falsify.js.map +1 -1
- package/dist/composition/probe/fit.d.ts +7 -0
- package/dist/composition/probe/fit.d.ts.map +1 -1
- package/dist/composition/probe/fit.js +46 -22
- package/dist/composition/probe/fit.js.map +1 -1
- package/dist/composition/probe/frontier.d.ts.map +1 -1
- package/dist/composition/probe/frontier.js +33 -15
- package/dist/composition/probe/frontier.js.map +1 -1
- package/dist/composition/probe/generator.d.ts +30 -1
- package/dist/composition/probe/generator.d.ts.map +1 -1
- package/dist/composition/probe/generator.js +58 -36
- package/dist/composition/probe/generator.js.map +1 -1
- package/dist/composition/probe/index.d.ts +14 -0
- package/dist/composition/probe/index.d.ts.map +1 -1
- package/dist/composition/probe/index.js +6 -0
- package/dist/composition/probe/index.js.map +1 -1
- package/dist/composition/probe/limits.d.ts +25 -1
- package/dist/composition/probe/limits.d.ts.map +1 -1
- package/dist/composition/probe/limits.js +53 -11
- package/dist/composition/probe/limits.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 +73 -24
- package/dist/composition/probe/pipeline.js.map +1 -1
- package/dist/composition/probe/power-law.d.ts +121 -0
- package/dist/composition/probe/power-law.d.ts.map +1 -0
- package/dist/composition/probe/power-law.js +251 -0
- package/dist/composition/probe/power-law.js.map +1 -0
- package/dist/composition/probe/problem.d.ts +8 -4
- package/dist/composition/probe/problem.d.ts.map +1 -1
- package/dist/composition/probe/problem.js +177 -49
- package/dist/composition/probe/problem.js.map +1 -1
- package/dist/composition/probe/report.js +1 -1
- package/dist/composition/probe/report.js.map +1 -1
- package/dist/composition/probe/residual.d.ts +7 -1
- package/dist/composition/probe/residual.d.ts.map +1 -1
- package/dist/composition/probe/residual.js +10 -7
- package/dist/composition/probe/residual.js.map +1 -1
- package/dist/composition/probe/run-manifest.d.ts +1 -0
- package/dist/composition/probe/run-manifest.d.ts.map +1 -1
- package/dist/composition/probe/run-manifest.js.map +1 -1
- package/dist/composition/probe/scalar-search.d.ts +50 -0
- package/dist/composition/probe/scalar-search.d.ts.map +1 -0
- package/dist/composition/probe/scalar-search.js +169 -0
- package/dist/composition/probe/scalar-search.js.map +1 -0
- package/dist/composition/probe/scoring.d.ts +1 -0
- package/dist/composition/probe/scoring.d.ts.map +1 -1
- package/dist/composition/probe/scoring.js.map +1 -1
- package/dist/composition/probe/structure.d.ts +82 -17
- package/dist/composition/probe/structure.d.ts.map +1 -1
- package/dist/composition/probe/structure.js +129 -55
- package/dist/composition/probe/structure.js.map +1 -1
- package/dist/composition/probe/study.d.ts +31 -9
- package/dist/composition/probe/study.d.ts.map +1 -1
- package/dist/composition/probe/study.js +235 -184
- package/dist/composition/probe/study.js.map +1 -1
- package/dist/composition/probe/t-tail.d.ts +16 -0
- package/dist/composition/probe/t-tail.d.ts.map +1 -0
- package/dist/composition/probe/t-tail.js +29 -0
- package/dist/composition/probe/t-tail.js.map +1 -0
- package/dist/composition/probe/types.d.ts +3 -0
- package/dist/composition/probe/types.d.ts.map +1 -1
- package/dist/composition/probe/types.js.map +1 -1
- package/dist/composition/proposed-bridges.d.ts +52 -12
- package/dist/composition/proposed-bridges.d.ts.map +1 -1
- package/dist/composition/proposed-bridges.js +107 -60
- package/dist/composition/proposed-bridges.js.map +1 -1
- package/dist/composition/quantity-clusters.d.ts +48 -0
- package/dist/composition/quantity-clusters.d.ts.map +1 -0
- package/dist/composition/quantity-clusters.js +98 -0
- package/dist/composition/quantity-clusters.js.map +1 -0
- package/dist/composition/rational-exponent.d.ts +40 -0
- package/dist/composition/rational-exponent.d.ts.map +1 -0
- package/dist/composition/rational-exponent.js +65 -0
- package/dist/composition/rational-exponent.js.map +1 -0
- package/dist/composition/representative-values.d.ts +22 -0
- package/dist/composition/representative-values.d.ts.map +1 -1
- package/dist/composition/representative-values.js +29 -0
- package/dist/composition/representative-values.js.map +1 -1
- package/dist/composition/retrodiction.d.ts +15 -0
- package/dist/composition/retrodiction.d.ts.map +1 -1
- package/dist/composition/retrodiction.js +12 -4
- package/dist/composition/retrodiction.js.map +1 -1
- package/dist/composition/user-equation.d.ts +1 -0
- package/dist/composition/user-equation.d.ts.map +1 -1
- package/dist/composition/user-equation.js +3 -2
- package/dist/composition/user-equation.js.map +1 -1
- package/dist/core/assignment.d.ts +19 -0
- package/dist/core/assignment.d.ts.map +1 -0
- package/dist/core/assignment.js +19 -0
- package/dist/core/assignment.js.map +1 -0
- package/dist/core/compare.d.ts +32 -0
- package/dist/core/compare.d.ts.map +1 -0
- package/dist/core/compare.js +46 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/constants.d.ts +42 -41
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +71 -51
- package/dist/core/constants.js.map +1 -1
- package/dist/core/data-file.d.ts +7 -0
- package/dist/core/data-file.d.ts.map +1 -1
- package/dist/core/data-file.js +17 -0
- package/dist/core/data-file.js.map +1 -1
- package/dist/core/format.d.ts +36 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/format.js +39 -0
- package/dist/core/format.js.map +1 -0
- package/dist/core/hash.d.ts +14 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +17 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/json-schema.d.ts +2 -0
- package/dist/core/json-schema.d.ts.map +1 -1
- package/dist/core/json-schema.js +14 -13
- package/dist/core/json-schema.js.map +1 -1
- package/dist/core/labeled-tensor.d.ts.map +1 -1
- package/dist/core/labeled-tensor.js +0 -8
- package/dist/core/labeled-tensor.js.map +1 -1
- package/dist/core/mathts-read.d.ts +25 -0
- package/dist/core/mathts-read.d.ts.map +1 -0
- package/dist/core/mathts-read.js +51 -0
- package/dist/core/mathts-read.js.map +1 -0
- package/dist/core/tensor.d.ts.map +1 -1
- package/dist/core/tensor.js +24 -0
- package/dist/core/tensor.js.map +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/diff/bridge-ast-gradient.d.ts +27 -23
- package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-ast-gradient.js +75 -173
- package/dist/diff/bridge-ast-gradient.js.map +1 -1
- package/dist/diff/bridge-gradient.d.ts +19 -6
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +19 -11
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/diff/bridge-specs.d.ts.map +1 -1
- package/dist/diff/bridge-specs.js +3 -0
- package/dist/diff/bridge-specs.js.map +1 -1
- package/dist/dimensional/algebra.d.ts +18 -0
- package/dist/dimensional/algebra.d.ts.map +1 -1
- package/dist/dimensional/algebra.js +41 -1
- package/dist/dimensional/algebra.js.map +1 -1
- package/dist/dimensional/ast-builders.d.ts +7 -0
- package/dist/dimensional/ast-builders.d.ts.map +1 -1
- package/dist/dimensional/ast-builders.js +11 -0
- package/dist/dimensional/ast-builders.js.map +1 -1
- package/dist/dimensional/ast-leaves.d.ts +81 -0
- package/dist/dimensional/ast-leaves.d.ts.map +1 -0
- package/dist/dimensional/ast-leaves.js +146 -0
- package/dist/dimensional/ast-leaves.js.map +1 -0
- package/dist/dimensional/ast-types.d.ts +15 -0
- package/dist/dimensional/ast-types.d.ts.map +1 -1
- package/dist/dimensional/ast-types.js.map +1 -1
- package/dist/dimensional/buckingham.d.ts.map +1 -1
- package/dist/dimensional/buckingham.js +15 -27
- package/dist/dimensional/buckingham.js.map +1 -1
- package/dist/dimensional/constant-rows.js +9 -9
- package/dist/dimensional/constant-rows.js.map +1 -1
- package/dist/dimensional/curvature-composite.d.ts +1 -1
- package/dist/dimensional/curvature-composite.js.map +1 -1
- package/dist/dimensional/dimension-inference.d.ts.map +1 -1
- package/dist/dimensional/dimension-inference.js +1 -2
- package/dist/dimensional/dimension-inference.js.map +1 -1
- package/dist/dimensional/errors.d.ts +1 -1
- package/dist/dimensional/errors.d.ts.map +1 -1
- package/dist/dimensional/errors.js +1 -15
- package/dist/dimensional/errors.js.map +1 -1
- package/dist/dimensional/exact-scale.d.ts +24 -11
- package/dist/dimensional/exact-scale.d.ts.map +1 -1
- package/dist/dimensional/exact-scale.js +122 -130
- package/dist/dimensional/exact-scale.js.map +1 -1
- package/dist/dimensional/gauge-field.d.ts.map +1 -1
- package/dist/dimensional/gauge-field.js +2 -2
- package/dist/dimensional/gauge-field.js.map +1 -1
- package/dist/dimensional/hyphen-names.d.ts +12 -2
- package/dist/dimensional/hyphen-names.d.ts.map +1 -1
- package/dist/dimensional/hyphen-names.js +44 -19
- package/dist/dimensional/hyphen-names.js.map +1 -1
- package/dist/dimensional/mathts-unit-delegation.d.ts +29 -0
- package/dist/dimensional/mathts-unit-delegation.d.ts.map +1 -0
- package/dist/dimensional/mathts-unit-delegation.js +187 -0
- package/dist/dimensional/mathts-unit-delegation.js.map +1 -0
- package/dist/dimensional/mathts-unit-wrapper.d.ts +33 -0
- package/dist/dimensional/mathts-unit-wrapper.d.ts.map +1 -0
- package/dist/dimensional/mathts-unit-wrapper.js +190 -0
- package/dist/dimensional/mathts-unit-wrapper.js.map +1 -0
- package/dist/dimensional/metric.d.ts.map +1 -1
- package/dist/dimensional/metric.js +0 -1
- package/dist/dimensional/metric.js.map +1 -1
- package/dist/dimensional/scalar-lowering.d.ts +21 -0
- package/dist/dimensional/scalar-lowering.d.ts.map +1 -0
- package/dist/dimensional/scalar-lowering.js +45 -0
- package/dist/dimensional/scalar-lowering.js.map +1 -0
- package/dist/dimensional/symbolic-constants.d.ts +9 -0
- package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
- package/dist/dimensional/symbolic-constants.js +13 -1
- package/dist/dimensional/symbolic-constants.js.map +1 -1
- package/dist/dimensional/types.d.ts +36 -0
- package/dist/dimensional/types.d.ts.map +1 -1
- package/dist/dimensional/types.js +45 -7
- package/dist/dimensional/types.js.map +1 -1
- package/dist/dimensional/unit-data.d.ts +5 -1
- package/dist/dimensional/unit-data.d.ts.map +1 -1
- package/dist/dimensional/unit-data.js +30 -6
- package/dist/dimensional/unit-data.js.map +1 -1
- package/dist/dimensional/units.d.ts +2 -0
- package/dist/dimensional/units.d.ts.map +1 -1
- package/dist/dimensional/units.js +59 -3
- package/dist/dimensional/units.js.map +1 -1
- package/dist/dimensional/validator.d.ts +2 -0
- package/dist/dimensional/validator.d.ts.map +1 -1
- package/dist/dimensional/validator.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/numerical/christoffel-flat.d.ts.map +1 -1
- package/dist/numerical/christoffel-flat.js +3 -2
- package/dist/numerical/christoffel-flat.js.map +1 -1
- package/dist/numerical/connection-lowering-helpers.d.ts +3 -1
- package/dist/numerical/connection-lowering-helpers.d.ts.map +1 -1
- package/dist/numerical/connection-lowering-helpers.js +11 -15
- package/dist/numerical/connection-lowering-helpers.js.map +1 -1
- package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
- package/dist/numerical/covariant-eikonal.js +34 -11
- package/dist/numerical/covariant-eikonal.js.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +3 -2
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/errors.d.ts.map +1 -1
- package/dist/numerical/errors.js +0 -3
- package/dist/numerical/errors.js.map +1 -1
- package/dist/numerical/finite-difference.d.ts +22 -0
- package/dist/numerical/finite-difference.d.ts.map +1 -0
- package/dist/numerical/finite-difference.js +27 -0
- package/dist/numerical/finite-difference.js.map +1 -0
- package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
- package/dist/numerical/geodesic-integrator.js +22 -14
- package/dist/numerical/geodesic-integrator.js.map +1 -1
- package/dist/numerical/geometrized.d.ts.map +1 -1
- package/dist/numerical/geometrized.js +0 -1
- package/dist/numerical/geometrized.js.map +1 -1
- package/dist/numerical/mathts-engine.d.ts.map +1 -1
- package/dist/numerical/mathts-engine.js +10 -24
- package/dist/numerical/mathts-engine.js.map +1 -1
- package/dist/numerical/metric-inverse.d.ts.map +1 -1
- package/dist/numerical/metric-inverse.js +83 -46
- package/dist/numerical/metric-inverse.js.map +1 -1
- package/dist/numerical/null-ray-integrator.d.ts +2 -1
- package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
- package/dist/numerical/null-ray-integrator.js +12 -12
- package/dist/numerical/null-ray-integrator.js.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.js +2 -2
- package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
- package/dist/numerical/pderiv.d.ts.map +1 -1
- package/dist/numerical/pderiv.js +2 -6
- package/dist/numerical/pderiv.js.map +1 -1
- package/dist/numerical/perihelion-finder.d.ts +0 -36
- package/dist/numerical/perihelion-finder.d.ts.map +1 -1
- package/dist/numerical/perihelion-finder.js +41 -87
- package/dist/numerical/perihelion-finder.js.map +1 -1
- package/dist/numerical/quadrature.d.ts.map +1 -1
- package/dist/numerical/quadrature.js +11 -13
- package/dist/numerical/quadrature.js.map +1 -1
- package/dist/numerical/rk4-trajectory.d.ts +10 -0
- package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
- package/dist/numerical/rk4-trajectory.js +37 -0
- package/dist/numerical/rk4-trajectory.js.map +1 -0
- package/dist/numerical/schwarzschild.d.ts +14 -0
- package/dist/numerical/schwarzschild.d.ts.map +1 -0
- package/dist/numerical/schwarzschild.js +17 -0
- package/dist/numerical/schwarzschild.js.map +1 -0
- package/dist/numerical/spacetime-metrics.d.ts +12 -0
- package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
- package/dist/numerical/spacetime-metrics.js +72 -56
- package/dist/numerical/spacetime-metrics.js.map +1 -1
- package/dist/numerical/statistics.d.ts +24 -0
- package/dist/numerical/statistics.d.ts.map +1 -0
- package/dist/numerical/statistics.js +52 -0
- package/dist/numerical/statistics.js.map +1 -0
- package/dist/numerical/strides.d.ts +3 -2
- package/dist/numerical/strides.d.ts.map +1 -1
- package/dist/numerical/strides.js +3 -10
- package/dist/numerical/strides.js.map +1 -1
- package/dist/numerical/tensor-engine.d.ts +21 -0
- package/dist/numerical/tensor-engine.d.ts.map +1 -1
- package/dist/numerical/tensor-engine.js +12 -0
- package/dist/numerical/tensor-engine.js.map +1 -1
- package/dist/relations/regime.d.ts +10 -0
- package/dist/relations/regime.d.ts.map +1 -1
- package/dist/relations/regime.js +18 -1
- package/dist/relations/regime.js.map +1 -1
- package/package.json +9 -12
- package/dist/cases/brownian-sphere.d.ts +0 -68
- package/dist/cases/brownian-sphere.d.ts.map +0 -1
- package/dist/cases/brownian-sphere.js +0 -354
- package/dist/cases/brownian-sphere.js.map +0 -1
- package/dist/cases/damped-resonator.d.ts +0 -23
- package/dist/cases/damped-resonator.d.ts.map +0 -1
- package/dist/cases/damped-resonator.js +0 -224
- package/dist/cases/damped-resonator.js.map +0 -1
- package/dist/cases/kepler-rv.d.ts +0 -13
- package/dist/cases/kepler-rv.d.ts.map +0 -1
- package/dist/cases/kepler-rv.js +0 -172
- package/dist/cases/kepler-rv.js.map +0 -1
- package/dist/cases/lumped-cooling.d.ts +0 -46
- package/dist/cases/lumped-cooling.d.ts.map +0 -1
- package/dist/cases/lumped-cooling.js +0 -261
- package/dist/cases/lumped-cooling.js.map +0 -1
- package/dist/cases/resistor-noise.d.ts +0 -14
- package/dist/cases/resistor-noise.d.ts.map +0 -1
- package/dist/cases/resistor-noise.js +0 -215
- package/dist/cases/resistor-noise.js.map +0 -1
- package/dist/cases/skin-depth.d.ts +0 -21
- package/dist/cases/skin-depth.d.ts.map +0 -1
- package/dist/cases/skin-depth.js +0 -174
- package/dist/cases/skin-depth.js.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one component owner: items that share a (canonical) quantity are one cluster.
|
|
3
|
+
*
|
|
4
|
+
* `linkageMap` (equations sharing a quantity), `buildVizModel` (junctions sharing a quantity,
|
|
5
|
+
* with a proposed or user overlay) and the discovery funnel (quantities sharing an equation or
|
|
6
|
+
* an identification) each once ran their own union-find with the same ordering. This module is
|
|
7
|
+
* that partition, computed through MathTS `connectedComponents` over an adjacency of item
|
|
8
|
+
* indices, with the ordering every caller used: a cluster keeps its items in input order, and
|
|
9
|
+
* clusters come largest first, then by the id of their first item. The anchoring rules differ
|
|
10
|
+
* between callers on purpose (`graph-viz.ts` anchors on `law` or `established` status,
|
|
11
|
+
* `bridge-analysis.ts` on `established` confidence) and stay with each caller.
|
|
12
|
+
*
|
|
13
|
+
* @module composition/quantity-clusters
|
|
14
|
+
*/
|
|
15
|
+
import { connectedComponents } from '@danielsimonjr/mathts-functions';
|
|
16
|
+
import { QUANTITY_IDENTIFICATIONS } from './compose.js';
|
|
17
|
+
/**
|
|
18
|
+
* Quantity-name canonicalizer honouring `QUANTITY_IDENTIFICATIONS`: maps each name to its
|
|
19
|
+
* identified representative (`hawking-temperature` → `temperature`) and leaves every other
|
|
20
|
+
* name alone. The linkage substrate of `linkageMap`, `proposeLinkCandidates` and the visual
|
|
21
|
+
* map. `anchoringDistance` deliberately does NOT use it (it links on raw names; its 0/∞
|
|
22
|
+
* distance contract is pinned).
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export function quantityCanonicalizer() {
|
|
27
|
+
const alias = new Map(QUANTITY_IDENTIFICATIONS.map((id) => [id.from, id.to]));
|
|
28
|
+
return (n) => alias.get(n) ?? n;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Group items by one key, keys in first-seen order, members in input order. The group-by
|
|
32
|
+
* every cluster consumer once re-inlined as `if (!m.has(k)) m.set(k, []); m.get(k)!.push(v)`.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export function groupInto(items, keyOf) {
|
|
37
|
+
const out = new Map();
|
|
38
|
+
for (const item of items) {
|
|
39
|
+
const k = keyOf(item);
|
|
40
|
+
const group = out.get(k);
|
|
41
|
+
if (group === undefined)
|
|
42
|
+
out.set(k, [item]);
|
|
43
|
+
else
|
|
44
|
+
group.push(item);
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Partition `items` into clusters of items that share at least one key (transitively): the
|
|
50
|
+
* connected components, through MathTS `connectedComponents`, of the graph whose nodes are item
|
|
51
|
+
* indices and whose links join items with a key in common. Each cluster lists its items in
|
|
52
|
+
* input order; clusters come largest first, then by `idOf` of their first item (by that item's
|
|
53
|
+
* input position when no `idOf` is given). An item with no key is a cluster of its own; an
|
|
54
|
+
* empty input is no cluster.
|
|
55
|
+
*
|
|
56
|
+
* Cost: `connectedComponents` takes a dense n×n adjacency matrix, so memory is O(n²) in the
|
|
57
|
+
* number of items (8·n² bytes as numbers: about 4 MB at n = 700, the order of the quantity
|
|
58
|
+
* names one discovery context clusters, once per context; 800 MB at n = 10 000). A caller with
|
|
59
|
+
* thousands of items should expect that, or cluster with a union-find over the key lists.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export function clusterBySharedKeys(items, keysOf, idOf) {
|
|
64
|
+
const n = items.length;
|
|
65
|
+
if (n === 0)
|
|
66
|
+
return [];
|
|
67
|
+
// Items sharing a key: the first holder of the key is linked to every later holder, which is
|
|
68
|
+
// enough for connectivity (a star joins the whole set).
|
|
69
|
+
const holders = new Map();
|
|
70
|
+
items.forEach((item, i) => {
|
|
71
|
+
for (const key of keysOf(item)) {
|
|
72
|
+
const list = holders.get(key);
|
|
73
|
+
if (list === undefined)
|
|
74
|
+
holders.set(key, [i]);
|
|
75
|
+
else
|
|
76
|
+
list.push(i);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const adjacency = Array.from({ length: n }, () => new Array(n).fill(0));
|
|
80
|
+
for (const idxs of holders.values()) {
|
|
81
|
+
for (let k = 1; k < idxs.length; k++) {
|
|
82
|
+
adjacency[idxs[0]][idxs[k]] = 1;
|
|
83
|
+
adjacency[idxs[k]][idxs[0]] = 1;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const components = connectedComponents(adjacency);
|
|
87
|
+
const clusters = components.map((idxs) => [...idxs].sort((a, b) => a - b));
|
|
88
|
+
const first = (c) => idOf === undefined ? String(c[0]).padStart(12, '0') : idOf(items[c[0]]);
|
|
89
|
+
clusters.sort((a, b) => b.length - a.length || first(a).localeCompare(first(b)));
|
|
90
|
+
// Every item is placed exactly once: a component listing that dropped or repeated an index
|
|
91
|
+
// would be the instrument reporting its own breakage, so say so rather than render it.
|
|
92
|
+
const placed = clusters.reduce((acc, c) => acc + c.length, 0);
|
|
93
|
+
if (placed !== n || new Set(clusters.flat()).size !== n) {
|
|
94
|
+
throw new Error(`clusterBySharedKeys: ${placed} placements over ${n} items`);
|
|
95
|
+
}
|
|
96
|
+
return clusters.map((c) => c.map((i) => items[i]));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=quantity-clusters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantity-clusters.js","sourceRoot":"","sources":["../../src/composition/quantity-clusters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAiB,wBAAwB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9F,OAAO,CAAC,CAAS,EAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAO,KAAmB,EAAE,KAAqB;IACxE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,C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Q,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,wBAAwB,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * The one component owner: items that share a (canonical) quantity are one cluster.\n *\n * `linkageMap` (equations sharing a quantity), `buildVizModel` (junctions sharing a quantity,\n * with a proposed or user overlay) and the discovery funnel (quantities sharing an equation or\n * an identification) each once ran their own union-find with the same ordering. This module is\n * that partition, computed through MathTS `connectedComponents` over an adjacency of item\n * indices, with the ordering every caller used: a cluster keeps its items in input order, and\n * clusters come largest first, then by the id of their first item. The anchoring rules differ\n * between callers on purpose (`graph-viz.ts` anchors on `law` or `established` status,\n * `bridge-analysis.ts` on `established` confidence) and stay with each caller.\n *\n * @module composition/quantity-clusters\n */\n\nimport { connectedComponents } from '@danielsimonjr/mathts-functions';\nimport { QUANTITY_IDENTIFICATIONS } from './compose.js';\n\n/**\n * Quantity-name canonicalizer honouring `QUANTITY_IDENTIFICATIONS`: maps each name to its\n * identified representative (`hawking-temperature` → `temperature`) and leaves every other\n * name alone. The linkage substrate of `linkageMap`, `proposeLinkCandidates` and the visual\n * map. `anchoringDistance` deliberately does NOT use it (it links on raw names; its 0/∞\n * distance contract is pinned).\n *\n * @internal\n */\nexport function quantityCanonicalizer(): (name: string) => string {\n const alias = new Map<string, string>(QUANTITY_IDENTIFICATIONS.map((id) => [id.from, id.to]));\n return (n: string): string => alias.get(n) ?? n;\n}\n\n/**\n * Group items by one key, keys in first-seen order, members in input order. The group-by\n * every cluster consumer once re-inlined as `if (!m.has(k)) m.set(k, []); m.get(k)!.push(v)`.\n *\n * @internal\n */\nexport function groupInto<K, V>(items: readonly V[], keyOf: (item: V) => K): Map<K, V[]> {\n const out = new Map<K, V[]>();\n for (const item of items) {\n const k = keyOf(item);\n const group = out.get(k);\n if (group === undefined) out.set(k, [item]);\n else group.push(item);\n }\n return out;\n}\n\n/**\n * Partition `items` into clusters of items that share at least one key (transitively): the\n * connected components, through MathTS `connectedComponents`, of the graph whose nodes are item\n * indices and whose links join items with a key in common. Each cluster lists its items in\n * input order; clusters come largest first, then by `idOf` of their first item (by that item's\n * input position when no `idOf` is given). An item with no key is a cluster of its own; an\n * empty input is no cluster.\n *\n * Cost: `connectedComponents` takes a dense n×n adjacency matrix, so memory is O(n²) in the\n * number of items (8·n² bytes as numbers: about 4 MB at n = 700, the order of the quantity\n * names one discovery context clusters, once per context; 800 MB at n = 10 000). A caller with\n * thousands of items should expect that, or cluster with a union-find over the key lists.\n *\n * @internal\n */\nexport function clusterBySharedKeys<T>(\n items: readonly T[],\n keysOf: (item: T) => readonly string[],\n idOf?: (item: T) => string,\n): T[][] {\n const n = items.length;\n if (n === 0) return [];\n // Items sharing a key: the first holder of the key is linked to every later holder, which is\n // enough for connectivity (a star joins the whole set).\n const holders = new Map<string, number[]>();\n items.forEach((item, i) => {\n for (const key of keysOf(item)) {\n const list = holders.get(key);\n if (list === undefined) holders.set(key, [i]);\n else list.push(i);\n }\n });\n const adjacency: number[][] = Array.from({ length: n }, () => new Array<number>(n).fill(0));\n for (const idxs of holders.values()) {\n for (let k = 1; k < idxs.length; k++) {\n adjacency[idxs[0]][idxs[k]] = 1;\n adjacency[idxs[k]][idxs[0]] = 1;\n }\n }\n const components = connectedComponents(adjacency);\n const clusters = components.map((idxs) => [...idxs].sort((a, b) => a - b));\n const first = (c: readonly number[]): string =>\n idOf === undefined ? String(c[0]).padStart(12, '0') : idOf(items[c[0]]);\n clusters.sort((a, b) => b.length - a.length || first(a).localeCompare(first(b)));\n // Every item is placed exactly once: a component listing that dropped or repeated an index\n // would be the instrument reporting its own breakage, so say so rather than render it.\n const placed = clusters.reduce((acc, c) => acc + c.length, 0);\n if (placed !== n || new Set(clusters.flat()).size !== n) {\n throw new Error(`clusterBySharedKeys: ${placed} placements over ${n} items`);\n }\n return clusters.map((c) => c.map((i) => items[i]));\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact rationals from doubles, for exponents and prefactors.
|
|
3
|
+
*
|
|
4
|
+
* A monomial exponent read from an AST literal (`0.5`, `0.3333333333333333`)
|
|
5
|
+
* and a prefactor recovered by a fit are doubles that stand for small
|
|
6
|
+
* rationals. This module turns one into a core `Fraction` when a rational
|
|
7
|
+
* with a bounded denominator reproduces it to a stated relative tolerance,
|
|
8
|
+
* and refuses otherwise, so an irrational is never approximated into a
|
|
9
|
+
* rational and a rounding error never becomes a denominator of 10¹⁶.
|
|
10
|
+
*
|
|
11
|
+
* `Fraction.fromNumber(x, cap)` is asked first. Before `@danielsimonjr/mathts-core`
|
|
12
|
+
* 0.18.1 it could return a denominator above its cap; the cap and the tolerance
|
|
13
|
+
* are still checked here, which costs nothing and catches a regression. When that answer is refused, a bounded-denominator scan (the one
|
|
14
|
+
* `dimensional/buckingham.ts` uses for dimension exponents) is the second
|
|
15
|
+
* method, so a rational the continued fraction stepped past is still found.
|
|
16
|
+
*
|
|
17
|
+
* @module composition/rational-exponent
|
|
18
|
+
*/
|
|
19
|
+
import { Fraction } from '@danielsimonjr/mathts-core';
|
|
20
|
+
/** The denominator cap the Buckingham enumerator uses for exponents. @internal */
|
|
21
|
+
export declare const DEFAULT_MAX_DENOMINATOR = 720;
|
|
22
|
+
/** Options of {@link rationalize}. @internal */
|
|
23
|
+
export interface RationalizeOptions {
|
|
24
|
+
/** Largest denominator accepted (default {@link DEFAULT_MAX_DENOMINATOR}). */
|
|
25
|
+
readonly maxDenominator?: number;
|
|
26
|
+
/** Relative tolerance `|n/d − x| ≤ tolerance·|x|` (default 1e-9); for `x = 0` the match is exact. */
|
|
27
|
+
readonly tolerance?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The rational with denominator ≤ `maxDenominator` that reproduces `x` to
|
|
31
|
+
* the tolerance, or `undefined` when there is none.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare function rationalize(x: number, options?: RationalizeOptions): Fraction | undefined;
|
|
36
|
+
/** The double a fraction stands for, MathTS `Fraction#toNumber`. @internal */
|
|
37
|
+
export declare function fractionToNumber(f: Fraction): number;
|
|
38
|
+
/** `9/8`, `2`, `-1/3`: the fraction in lowest terms, no sign on the denominator; MathTS `Fraction#toString`. @internal */
|
|
39
|
+
export declare function formatRational(f: Fraction): string;
|
|
40
|
+
//# sourceMappingURL=rational-exponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rational-exponent.d.ts","sourceRoot":"","sources":["../../src/composition/rational-exponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,qGAAqG;IACrG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAQD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,QAAQ,GAAG,SAAS,CAiB7F;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,GAAG,MAAM,CAEpD;AAED,0HAA0H;AAC1H,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact rationals from doubles, for exponents and prefactors.
|
|
3
|
+
*
|
|
4
|
+
* A monomial exponent read from an AST literal (`0.5`, `0.3333333333333333`)
|
|
5
|
+
* and a prefactor recovered by a fit are doubles that stand for small
|
|
6
|
+
* rationals. This module turns one into a core `Fraction` when a rational
|
|
7
|
+
* with a bounded denominator reproduces it to a stated relative tolerance,
|
|
8
|
+
* and refuses otherwise, so an irrational is never approximated into a
|
|
9
|
+
* rational and a rounding error never becomes a denominator of 10¹⁶.
|
|
10
|
+
*
|
|
11
|
+
* `Fraction.fromNumber(x, cap)` is asked first. Before `@danielsimonjr/mathts-core`
|
|
12
|
+
* 0.18.1 it could return a denominator above its cap; the cap and the tolerance
|
|
13
|
+
* are still checked here, which costs nothing and catches a regression. When that answer is refused, a bounded-denominator scan (the one
|
|
14
|
+
* `dimensional/buckingham.ts` uses for dimension exponents) is the second
|
|
15
|
+
* method, so a rational the continued fraction stepped past is still found.
|
|
16
|
+
*
|
|
17
|
+
* @module composition/rational-exponent
|
|
18
|
+
*/
|
|
19
|
+
import { Fraction } from '@danielsimonjr/mathts-core';
|
|
20
|
+
/** The denominator cap the Buckingham enumerator uses for exponents. @internal */
|
|
21
|
+
export const DEFAULT_MAX_DENOMINATOR = 720;
|
|
22
|
+
function within(candidate, x, tolerance) {
|
|
23
|
+
const value = fractionToNumber(candidate);
|
|
24
|
+
if (x === 0)
|
|
25
|
+
return value === 0;
|
|
26
|
+
return Math.abs(value - x) <= tolerance * Math.abs(x);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The rational with denominator ≤ `maxDenominator` that reproduces `x` to
|
|
30
|
+
* the tolerance, or `undefined` when there is none.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export function rationalize(x, options = {}) {
|
|
35
|
+
if (!Number.isFinite(x))
|
|
36
|
+
return undefined;
|
|
37
|
+
const maxDenominator = options.maxDenominator ?? DEFAULT_MAX_DENOMINATOR;
|
|
38
|
+
const tolerance = options.tolerance ?? 1e-9;
|
|
39
|
+
if (Number.isInteger(x))
|
|
40
|
+
return new Fraction(x, 1);
|
|
41
|
+
const guess = Fraction.fromNumber(x, BigInt(maxDenominator));
|
|
42
|
+
if (guess.denominator <= BigInt(maxDenominator) && within(guess, x, tolerance))
|
|
43
|
+
return guess;
|
|
44
|
+
for (let d = 1; d <= maxDenominator; d++) {
|
|
45
|
+
const n = Math.round(x * d);
|
|
46
|
+
// A safe-integer n/d is the same correctly rounded quotient as the reduced
|
|
47
|
+
// fraction's, so a miss is decided on doubles and no Fraction is built for it
|
|
48
|
+
// (the clean-prefactor rule asks this 43,200 times for one miss).
|
|
49
|
+
if (Number.isSafeInteger(n) && !(Math.abs(n / d - x) <= tolerance * Math.abs(x)))
|
|
50
|
+
continue;
|
|
51
|
+
const candidate = new Fraction(n, d);
|
|
52
|
+
if (within(candidate, x, tolerance))
|
|
53
|
+
return candidate;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
/** The double a fraction stands for, MathTS `Fraction#toNumber`. @internal */
|
|
58
|
+
export function fractionToNumber(f) {
|
|
59
|
+
return f.toNumber();
|
|
60
|
+
}
|
|
61
|
+
/** `9/8`, `2`, `-1/3`: the fraction in lowest terms, no sign on the denominator; MathTS `Fraction#toString`. @internal */
|
|
62
|
+
export function formatRational(f) {
|
|
63
|
+
return f.toString();
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=rational-exponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rational-exponent.js","sourceRoot":"","sources":["../../src/composition/rational-exponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,kFAAkF;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAU3C,SAAS,MAAM,CAAC,SAAmB,EAAE,CA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CAAC,CAAC,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAAE,SAAS;QAC3F,MAAM,SAAS,GAAG,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACrC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;IACxD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAAC,CAAW;IAC1C,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC;AAED,0HAA0H;AAC1H,MAAM,UAAU,cAAc,CAAC,CAAW;IACxC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC","sourcesContent":["/**\n * Exact rationals from doubles, for exponents and prefactors.\n *\n * A monomial exponent read from an AST literal (`0.5`, `0.3333333333333333`)\n * and a prefactor recovered by a fit are doubles that stand for small\n * rationals. This module turns one into a core `Fraction` when a rational\n * with a bounded denominator reproduces it to a stated relative tolerance,\n * and refuses otherwise, so an irrational is never approximated into a\n * rational and a rounding error never becomes a denominator of 10¹⁶.\n *\n * `Fraction.fromNumber(x, cap)` is asked first. Before `@danielsimonjr/mathts-core`\n * 0.18.1 it could return a denominator above its cap; the cap and the tolerance\n * are still checked here, which costs nothing and catches a regression. When that answer is refused, a bounded-denominator scan (the one\n * `dimensional/buckingham.ts` uses for dimension exponents) is the second\n * method, so a rational the continued fraction stepped past is still found.\n *\n * @module composition/rational-exponent\n */\n\nimport { Fraction } from '@danielsimonjr/mathts-core';\n\n/** The denominator cap the Buckingham enumerator uses for exponents. @internal */\nexport const DEFAULT_MAX_DENOMINATOR = 720;\n\n/** Options of {@link rationalize}. @internal */\nexport interface RationalizeOptions {\n /** Largest denominator accepted (default {@link DEFAULT_MAX_DENOMINATOR}). */\n readonly maxDenominator?: number;\n /** Relative tolerance `|n/d − x| ≤ tolerance·|x|` (default 1e-9); for `x = 0` the match is exact. */\n readonly tolerance?: number;\n}\n\nfunction within(candidate: Fraction, x: number, tolerance: number): boolean {\n const value = fractionToNumber(candidate);\n if (x === 0) return value === 0;\n return Math.abs(value - x) <= tolerance * Math.abs(x);\n}\n\n/**\n * The rational with denominator ≤ `maxDenominator` that reproduces `x` to\n * the tolerance, or `undefined` when there is none.\n *\n * @internal\n */\nexport function rationalize(x: number, options: RationalizeOptions = {}): Fraction | undefined {\n if (!Number.isFinite(x)) return undefined;\n const maxDenominator = options.maxDenominator ?? DEFAULT_MAX_DENOMINATOR;\n const tolerance = options.tolerance ?? 1e-9;\n if (Number.isInteger(x)) return new Fraction(x, 1);\n const guess = Fraction.fromNumber(x, BigInt(maxDenominator));\n if (guess.denominator <= BigInt(maxDenominator) && within(guess, x, tolerance)) return guess;\n for (let d = 1; d <= maxDenominator; d++) {\n const n = Math.round(x * d);\n // A safe-integer n/d is the same correctly rounded quotient as the reduced\n // fraction's, so a miss is decided on doubles and no Fraction is built for it\n // (the clean-prefactor rule asks this 43,200 times for one miss).\n if (Number.isSafeInteger(n) && !(Math.abs(n / d - x) <= tolerance * Math.abs(x))) continue;\n const candidate = new Fraction(n, d);\n if (within(candidate, x, tolerance)) return candidate;\n }\n return undefined;\n}\n\n/** The double a fraction stands for, MathTS `Fraction#toNumber`. @internal */\nexport function fractionToNumber(f: Fraction): number {\n return f.toNumber();\n}\n\n/** `9/8`, `2`, `-1/3`: the fraction in lowest terms, no sign on the denominator; MathTS `Fraction#toString`. @internal */\nexport function formatRational(f: Fraction): string {\n return f.toString();\n}\n"]}
|
|
@@ -34,7 +34,29 @@ export interface RepresentativeValue {
|
|
|
34
34
|
readonly value: number;
|
|
35
35
|
/** Provenance — how the estimate is obtained (a citation or a one-liner). */
|
|
36
36
|
readonly source: string;
|
|
37
|
+
/**
|
|
38
|
+
* The value's stated uncertainty, as a standard deviation in decades of `log10|value|`.
|
|
39
|
+
* Absent means {@link DEFAULT_SIGMA_DECADES}, the table's "good to about one order"; a row
|
|
40
|
+
* states another only with a source for it. The graded magnitude gate
|
|
41
|
+
* (`discovery.ts`, `magnitudeP`) reads it; the verdict threshold does not.
|
|
42
|
+
*/
|
|
43
|
+
readonly sigmaDecades?: number;
|
|
37
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* The σ in decades a representative value carries when its row states none: one decade, the
|
|
47
|
+
* precision this table has always claimed ("good to ~1 order"). Not a per-row measurement.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare const DEFAULT_SIGMA_DECADES = 1;
|
|
52
|
+
/**
|
|
53
|
+
* The σ in decades of a representative value: its own `sigmaDecades`, else the default. A stated
|
|
54
|
+
* σ that is not a finite number > 0 is refused with a `RangeError` naming the row's source: σ = 0
|
|
55
|
+
* would make the falsifier's strength 0 (certain) and a negative or NaN σ would make it NaN.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export declare function sigmaDecadesOf(rv: RepresentativeValue): number;
|
|
38
60
|
/**
|
|
39
61
|
* Scale-specific quantities only. Keyed by the canonical quantity name used in
|
|
40
62
|
* the composition graph. Generic quantities are intentionally omitted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"representative-values.d.ts","sourceRoot":"","sources":["../../src/composition/representative-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"representative-values.d.ts","sourceRoot":"","sources":["../../src/composition/representative-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,mBAAmB,GAAG,MAAM,CAS9D;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAC1C,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAiEpC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GACX,mBAAmB,GAAG,SAAS,CAEjC"}
|
|
@@ -28,6 +28,29 @@
|
|
|
28
28
|
*
|
|
29
29
|
* @module composition/representative-values
|
|
30
30
|
*/
|
|
31
|
+
/**
|
|
32
|
+
* The σ in decades a representative value carries when its row states none: one decade, the
|
|
33
|
+
* precision this table has always claimed ("good to ~1 order"). Not a per-row measurement.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export const DEFAULT_SIGMA_DECADES = 1;
|
|
38
|
+
/**
|
|
39
|
+
* The σ in decades of a representative value: its own `sigmaDecades`, else the default. A stated
|
|
40
|
+
* σ that is not a finite number > 0 is refused with a `RangeError` naming the row's source: σ = 0
|
|
41
|
+
* would make the falsifier's strength 0 (certain) and a negative or NaN σ would make it NaN.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export function sigmaDecadesOf(rv) {
|
|
46
|
+
const sigma = rv.sigmaDecades;
|
|
47
|
+
if (sigma === undefined)
|
|
48
|
+
return DEFAULT_SIGMA_DECADES;
|
|
49
|
+
if (!(Number.isFinite(sigma) && sigma > 0)) {
|
|
50
|
+
throw new RangeError(`representative value sigmaDecades ${String(sigma)} (source: ${rv.source}) must be a finite number > 0 decades`);
|
|
51
|
+
}
|
|
52
|
+
return sigma;
|
|
53
|
+
}
|
|
31
54
|
/**
|
|
32
55
|
* Scale-specific quantities only. Keyed by the canonical quantity name used in
|
|
33
56
|
* the composition graph. Generic quantities are intentionally omitted.
|
|
@@ -76,6 +99,12 @@ export const REPRESENTATIVE_VALUES = {
|
|
|
76
99
|
source: 'BE-26 DNA H-bond proton-tunneling distance ~1 Å (Löwdin 1963)',
|
|
77
100
|
},
|
|
78
101
|
'planck-length': { value: 1.616e-35, source: 'ℓ_P = √(ℏG/c³)' },
|
|
102
|
+
// The Hubble distance is a definite cosmological scale, not a generic length: c over the
|
|
103
|
+
// hubble-rate row above (a test pins the two rows together, so one cannot move alone).
|
|
104
|
+
'hubble-distance': {
|
|
105
|
+
value: 1.363e26,
|
|
106
|
+
source: 'D_H = c/H0 = 2.998e8 m/s / 2.2e-18 s^-1 ≈ 1.363e26 m, with H0 ≈ 67 km/s/Mpc (Planck 2018), the hubble-rate row',
|
|
107
|
+
},
|
|
79
108
|
// Canonical-graph atomic length scales — sourced so the gate compares real
|
|
80
109
|
// magnitudes instead of falling back to the {mass: M_sun} anchor, which makes
|
|
81
110
|
// a 1/mass quantity like the Compton wavelength absurdly small (~10⁻⁷³ m) and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"representative-values.js","sourceRoot":"","sources":["../../src/composition/representative-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;
|
|
1
|
+
{"version":3,"file":"representative-values.js","sourceRoot":"","sources":["../../src/composition/representative-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAiBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAAuB;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KAC5C;IACD,yBAAyB,EAAE;QACzB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,iEAAiE;KAC1E;IACD,eAAe,EAAE;QACf,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,+DAA+D;KACxE;IACD,eAAe,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAC/D,yFAAyF;IACzF,uFAAuF;IACvF,iBAAiB,EAAE;QACjB,KAAK,EAAE,QAAQ;QACf,MAAM,EACJ,gHAAgH;KACnH;IACD,2EAA2E;IAC3E,8EAA8E;IAC9E,8EAA8E;IAC9E,6DAA6D;IAC7D,oBAAoB,EAAE;QACpB,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,mEAAmE;KAC5E;IACD,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,uCAAuC,EAAE;IAEpF,2EAA2E;IAC3E,aAAa,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE;CAC7D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY;IAEZ,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC","sourcesContent":["/**\n * Order-of-magnitude representative values for the discovery falsifier.\n *\n * The discovery loop (`discovery.ts`) vets a hypothesised identification a≡b,\n * but its numeric check (`retrodict`) runs from a single anchor and cannot\n * evaluate the quantities a dimensional coincidence \"unlocks\" — so it never\n * contradicts them, and they surface as `promising` (e.g.\n * `landauer-erasure-energy ≟ planck-mass-energy`, ~30 orders apart). The graph\n * structurally CANNOT supply the magnitudes that would falsify these.\n *\n * This table injects that missing ground truth: a sourced, order-of-magnitude\n * value for quantities that have a WELL-DEFINED physical scale. Two classes are\n * deliberately ABSENT:\n * - generic quantities (`mass`, `energy`, `length`, …) — no single scale (the\n * discovery gate now reads these from the graph at the anchor instead, see\n * `discovery.ts`); and\n * - speculative-physics quantities with no agreed scale (`dark-fermion-mass`,\n * `scalar-field-value`, `inflation-hubble-energy`, `boundary-length`, the\n * time-dependent `coarsening-length`) — a value would be fabrication, so the\n * gate correctly abstains on them.\n * When a value is absent the gate abstains; it never false-rejects on unknowns.\n *\n * Values are order-of-magnitude estimates (good to ~1 order), each carrying its\n * provenance. Nothing here is fabricated; coarse by design. When the canonical-\n * equation registry lands it can supply these centrally and this table folds in.\n *\n * INTERNAL — surfaced via `upt discover`.\n *\n * @module composition/representative-values\n */\n\n/** A sourced order-of-magnitude value for one quantity. @internal */\nexport interface RepresentativeValue {\n /** Order-of-magnitude value in the quantity's SI unit (good to ~1 order). */\n readonly value: number;\n /** Provenance — how the estimate is obtained (a citation or a one-liner). */\n readonly source: string;\n /**\n * The value's stated uncertainty, as a standard deviation in decades of `log10|value|`.\n * Absent means {@link DEFAULT_SIGMA_DECADES}, the table's \"good to about one order\"; a row\n * states another only with a source for it. The graded magnitude gate\n * (`discovery.ts`, `magnitudeP`) reads it; the verdict threshold does not.\n */\n readonly sigmaDecades?: number;\n}\n\n/**\n * The σ in decades a representative value carries when its row states none: one decade, the\n * precision this table has always claimed (\"good to ~1 order\"). Not a per-row measurement.\n *\n * @internal\n */\nexport const DEFAULT_SIGMA_DECADES = 1;\n\n/**\n * The σ in decades of a representative value: its own `sigmaDecades`, else the default. A stated\n * σ that is not a finite number > 0 is refused with a `RangeError` naming the row's source: σ = 0\n * would make the falsifier's strength 0 (certain) and a negative or NaN σ would make it NaN.\n *\n * @internal\n */\nexport function sigmaDecadesOf(rv: RepresentativeValue): number {\n const sigma = rv.sigmaDecades;\n if (sigma === undefined) return DEFAULT_SIGMA_DECADES;\n if (!(Number.isFinite(sigma) && sigma > 0)) {\n throw new RangeError(\n `representative value sigmaDecades ${String(sigma)} (source: ${rv.source}) must be a finite number > 0 decades`,\n );\n }\n return sigma;\n}\n\n/**\n * Scale-specific quantities only. Keyed by the canonical quantity name used in\n * the composition graph. Generic quantities are intentionally omitted.\n *\n * @internal\n */\nexport const REPRESENTATIVE_VALUES: Readonly<\n Record<string, RepresentativeValue>\n> = {\n // ── frequencies / rates [s^-1] ──────────────────────────────────────────\n 'hubble-rate': { value: 2.2e-18, source: 'H0 ≈ 67 km/s/Mpc (Planck 2018)' },\n 'grw-localization-rate': {\n value: 1e-16,\n source: 'GRW collapse rate λ ≈ 10^-16 s^-1 (Ghirardi–Rimini–Weber 1986)',\n },\n 'attempt-frequency': {\n value: 1e13,\n source: 'Debye/phonon attempt frequency ~10^13 Hz',\n },\n\n // ── energies [J] ────────────────────────────────────────────────────────\n 'landauer-erasure-energy': { value: 2.9e-21, source: 'kT·ln2 at T = 300 K' },\n 'planck-mass-energy': { value: 1.96e9, source: 'm_P·c² (m_P = √(ℏc/G))' },\n 'vacuum-expectation-value': {\n value: 3.94e-8,\n source: 'Higgs VEV v ≈ 246 GeV',\n },\n 'barrier-height': {\n value: 3.2e-20,\n source: 'BE-26 Löwdin DNA proton-transfer barrier V−E ~0.2 eV',\n },\n\n // ── masses [kg] ─────────────────────────────────────────────────────────\n 'planck-mass': { value: 2.176e-8, source: 'm_P = √(ℏc/G)' },\n 'tunneling-mass': {\n value: 1.673e-27,\n source: 'BE-26 tunneling particle is the proton, m_p = 1.673e-27 kg',\n },\n\n // ── lengths [m] ─────────────────────────────────────────────────────────\n 'foerster-radius': {\n value: 5e-9,\n source: 'typical FRET Förster radius ~5 nm',\n },\n 'donor-acceptor-distance': {\n value: 5e-9,\n source: 'BE-24 FRET donor–acceptor separation ~5 nm (same regime as R_0)',\n },\n 'barrier-width': {\n value: 1e-10,\n source: 'BE-26 DNA H-bond proton-tunneling distance ~1 Å (Löwdin 1963)',\n },\n 'planck-length': { value: 1.616e-35, source: 'ℓ_P = √(ℏG/c³)' },\n // The Hubble distance is a definite cosmological scale, not a generic length: c over the\n // hubble-rate row above (a test pins the two rows together, so one cannot move alone).\n 'hubble-distance': {\n value: 1.363e26,\n source:\n 'D_H = c/H0 = 2.998e8 m/s / 2.2e-18 s^-1 ≈ 1.363e26 m, with H0 ≈ 67 km/s/Mpc (Planck 2018), the hubble-rate row',\n },\n // Canonical-graph atomic length scales — sourced so the gate compares real\n // magnitudes instead of falling back to the {mass: M_sun} anchor, which makes\n // a 1/mass quantity like the Compton wavelength absurdly small (~10⁻⁷³ m) and\n // produces a spurious clash against the (fixed) Bohr radius.\n 'compton-wavelength': {\n value: 2.426e-12,\n source: 'electron Compton wavelength λ_C = h/(m_e c) = 2.43e-12 m (CODATA)',\n },\n 'bohr-radius': { value: 5.292e-11, source: 'Bohr radius a_0 = 5.29e-11 m (CODATA)' },\n\n // ── times [s] ───────────────────────────────────────────────────────────\n 'planck-time': { value: 5.39e-44, source: 't_P = √(ℏG/c⁵)' },\n};\n\n/**\n * The sourced order-of-magnitude value for `name`, or `undefined` when the\n * quantity has no well-defined representative scale (the gate then abstains).\n *\n * @internal\n */\nexport function representativeValue(\n name: string,\n): RepresentativeValue | undefined {\n return REPRESENTATIVE_VALUES[name];\n}\n"]}
|
|
@@ -30,6 +30,15 @@
|
|
|
30
30
|
*/
|
|
31
31
|
import type { BridgeEdge } from './edge.js';
|
|
32
32
|
import type { QuantityIdentification } from './compose.js';
|
|
33
|
+
/**
|
|
34
|
+
* Source values, plus a dimensionless group the edge multiplies when the
|
|
35
|
+
* ground truth names it. The group is not a source: Buckingham cannot see
|
|
36
|
+
* it, and a missing group is the unset coefficient, not a missing input.
|
|
37
|
+
* Exported for the own-equation magnitudes (`own-equation-magnitude.ts`),
|
|
38
|
+
* which evaluate an edge the same way.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare function evaluationInputs(edge: BridgeEdge, values: ReadonlyMap<string, number>): Record<string, number>;
|
|
33
42
|
/** Outcome of retrodicting one node. @public */
|
|
34
43
|
export type RetrodictionOutcome = 'consistent' | 'inconsistent' | 'single' | 'unrecoverable';
|
|
35
44
|
/** One derivation's recovered value for a masked node. @public */
|
|
@@ -94,6 +103,12 @@ export interface RetrodictionReport {
|
|
|
94
103
|
/** The headline gate: no inconsistent node was found. */
|
|
95
104
|
readonly allConsistent: boolean;
|
|
96
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* True when the error says the edge does not fire here (or at all, for an unset coefficient).
|
|
108
|
+
* Exported so the own-equation magnitudes read an edge's refusal by this one rule.
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
export declare function refusesThePoint(err: unknown): boolean;
|
|
97
112
|
/**
|
|
98
113
|
* Monotone forward EVALUATION: propagate values from `groundTruth` through
|
|
99
114
|
* the graph (domain-checked; identifications supply identified names;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrodiction.d.ts","sourceRoot":"","sources":["../../src/composition/retrodiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"retrodiction.d.ts","sourceRoot":"","sources":["../../src/composition/retrodiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAO5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAK3D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS9G;AAED,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAC3B,YAAY,GACZ,cAAc,GACd,QAAQ,GACR,eAAe,CAAC;AAEpB,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,uCA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AuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAChD,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAWD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC7C,MAAM,EAAE,SAAS,sBAAsB,EAAE,GACxC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA+CrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC7C,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,mBAAwB,GAC7B,kBAAkB,CAyEpB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC7C,IAAI,GAAE,mBAAwB,GAC7B,kBAAkB,CA2BpB"}
|
|
@@ -33,6 +33,7 @@ import { CoefficientUnsetError, evaluateEdge } from './edge.js';
|
|
|
33
33
|
import { DomainViolationError } from '../bridges/evaluation-errors.js';
|
|
34
34
|
import { CarrierSignError } from '../bridges/carrier-sign.js';
|
|
35
35
|
import { FormulaError } from '../numerical/formula-contract.js';
|
|
36
|
+
import { meanOf } from '../numerical/statistics.js';
|
|
36
37
|
import { QUANTITY_IDENTIFICATIONS } from './compose.js';
|
|
37
38
|
import { conventionFactor } from '../dimensional/unit-convention.js';
|
|
38
39
|
import { classifyAll } from './identifiability.js';
|
|
@@ -40,8 +41,11 @@ import { classifyAll } from './identifiability.js';
|
|
|
40
41
|
* Source values, plus a dimensionless group the edge multiplies when the
|
|
41
42
|
* ground truth names it. The group is not a source: Buckingham cannot see
|
|
42
43
|
* it, and a missing group is the unset coefficient, not a missing input.
|
|
44
|
+
* Exported for the own-equation magnitudes (`own-equation-magnitude.ts`),
|
|
45
|
+
* which evaluate an edge the same way.
|
|
46
|
+
* @internal
|
|
43
47
|
*/
|
|
44
|
-
function evaluationInputs(edge, values) {
|
|
48
|
+
export function evaluationInputs(edge, values) {
|
|
45
49
|
const inputs = {};
|
|
46
50
|
for (const s of edge.sources)
|
|
47
51
|
inputs[s.name] = values.get(s.name);
|
|
@@ -65,8 +69,12 @@ function refusalKind(err) {
|
|
|
65
69
|
return 'formula';
|
|
66
70
|
return undefined;
|
|
67
71
|
}
|
|
68
|
-
/**
|
|
69
|
-
|
|
72
|
+
/**
|
|
73
|
+
* True when the error says the edge does not fire here (or at all, for an unset coefficient).
|
|
74
|
+
* Exported so the own-equation magnitudes read an edge's refusal by this one rule.
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export function refusesThePoint(err) {
|
|
70
78
|
return refusalKind(err) !== undefined;
|
|
71
79
|
}
|
|
72
80
|
/**
|
|
@@ -201,7 +209,7 @@ export function retrodictNode(edges, groundTruth, target, opts = {}) {
|
|
|
201
209
|
};
|
|
202
210
|
const ref = opts.references?.[target];
|
|
203
211
|
if (ref !== undefined && predictions.length >= 1) {
|
|
204
|
-
const mean = predictions.
|
|
212
|
+
const mean = meanOf(predictions.map((p) => p.value));
|
|
205
213
|
const referenceRelError = Math.abs(mean - ref) / (Math.abs(ref) || 1);
|
|
206
214
|
return {
|
|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AC;IAE1E,MAAM,cAAc,GAAG,UAAU;SAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,iBAAiB,CAAC;SAC9C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,cAAc,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAExE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAChC,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,CAAC,CAC3C,CAAC;IAEF,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,YAAY,CAAC,CAAC,MAAM,CAAC;IAC5E,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CACjC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,cAAc,CACpC,CAAC,MAAM,CAAC;IAET,OAAO;QACL,OAAO;QACP,OAAO,EAAE,UAAU,GAAG,YAAY;QAClC,UAAU;QACV,YAAY;QACZ,aAAa,EAAE,YAAY,KAAK,CAAC;KAClC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Retrodiction harness (Consequence 2 of\n * docs/planning/Bridge-Inference-Epistemics-Note.md, designed in\n * docs/planning/Retrodiction-Harness-Design-Note.md).\n *\n * The framework's own falsification benchmark. Mask a quantity the graph\n * can compute, recompute it from ground-truth inputs via EACH independent\n * derivation, and check the predictions agree. This operationalizes the\n * identifiability classifier's OVER-DETERMINED verdict: the surplus\n * derivations of an over-determined node are PREDICTED to be consistency\n * constraints; the harness evaluates them and checks that numerically.\n *\n * - consistent — ≥2 derivations agree within tolerance.\n * - inconsistent — ≥2 derivations DISAGREE (a falsification: two\n * encodings of one quantity-name are not the same\n * physics).\n * - single — exactly one derivation fired (recovered, no check).\n * - unrecoverable — no derivation fired from the ground truth.\n *\n * \"Mask\" = compute source values over the graph with every edge INTO the\n * target removed (the classifier's target-removed closure — so the node\n * is genuinely hidden, never read back through its own derivation).\n * Forward evaluation honors `QUANTITY_IDENTIFICATIONS` and is\n * domain-checked (an edge that refuses its domain contributes no\n * prediction). The consistency check needs no external truth and is the\n * re-runnable core; an optional `references` map adds external-value\n * scoring. Pass bar pre-registered in the design note (spread ≤ 1e-6).\n *\n * @module composition/retrodiction\n */\n\nimport type { BridgeEdge } from './edge.js';\nimport { CANONICAL_GROUP_PREFACTORS } from './canonical-prefactors.js';\nimport { CoefficientUnsetError, evaluateEdge } from './edge.js';\nimport { DomainViolationError } from '../bridges/evaluation-errors.js';\nimport { CarrierSignError } from '../bridges/carrier-sign.js';\nimport { FormulaError } from '../numerical/formula-contract.js';\nimport type { QuantityIdentification } from './compose.js';\nimport { QUANTITY_IDENTIFICATIONS } from './compose.js';\nimport { conventionFactor } from '../dimensional/unit-convention.js';\nimport { classifyAll } from './identifiability.js';\n\n/**\n * Source values, plus a dimensionless group the edge multiplies when the\n * ground truth names it. The group is not a source: Buckingham cannot see\n * it, and a missing group is the unset coefficient, not a missing input.\n */\nfunction evaluationInputs(edge: BridgeEdge, values: ReadonlyMap<string, number>): Record<string, number> {\n const inputs: Record<string, number> = {};\n for (const s of edge.sources) inputs[s.name] = values.get(s.name)!;\n const group = CANONICAL_GROUP_PREFACTORS.find((g) => g.id === edge.id);\n if (group !== undefined) {\n const g = values.get(group.group);\n if (g !== undefined) inputs[group.group] = g;\n }\n return inputs;\n}\n\n/** Outcome of retrodicting one node. @public */\nexport type RetrodictionOutcome =\n | 'consistent'\n | 'inconsistent'\n | 'single'\n | 'unrecoverable';\n\n/** One derivation's recovered value for a masked node. @public */\nexport interface RetrodictionPrediction {\n /** The edge id that produced this value. */\n readonly edge: string;\n readonly value: number;\n}\n\n/** Options for the harness. @public */\nexport interface RetrodictionOptions {\n /** Identifications honored in forward evaluation (default registered). */\n readonly identifications?: readonly QuantityIdentification[];\n /** Relative-spread tolerance for `consistent` (default 1e-6). */\n readonly tolerance?: number;\n /** External (textbook) values to score recovered nodes against. */\n readonly references?: Readonly<Record<string, number>>;\n /** Relative-error tolerance for reference scoring (default 1e-3). */\n readonly referenceTolerance?: number;\n}\n\n/** One refused edge in a retrodiction, with the kind of refusal. @public */\nexport interface RetrodictionRefusal {\n readonly edge: string;\n /**\n * `domain`: the validity domain rejected the point. `coefficient-unset`: the edge has no\n * sourced prefactor, whatever the values. `carrier-sign`: the carrier charge and the\n * mobility had opposite signs. `formula`: the relation's formula did not evaluate at the\n * point (a 0/0, say). Four facts, kept apart (AGENTS law 4).\n */\n readonly kind: 'domain' | 'coefficient-unset' | 'carrier-sign' | 'formula';\n readonly reason: string;\n}\n\n/** The result of retrodicting one node. @public */\nexport interface RetrodictionResult {\n readonly target: string;\n readonly outcome: RetrodictionOutcome;\n /** Recovered values, one per derivation that fired. */\n readonly predictions: readonly RetrodictionPrediction[];\n /** (max − min)/|mean| across predictions; 0 when fewer than two. */\n readonly relativeSpread: number;\n readonly tolerance: number;\n /**\n * Edges that refused the supplied values. `kind` keeps the refusals apart (AGENTS law 4):\n * `domain`, `carrier-sign` and `formula` are the point (the edge does not fire there);\n * `coefficient-unset` is the edge's own state (no sourced prefactor), whatever the values.\n */\n readonly refusals?: readonly RetrodictionRefusal[];\n /** `outcome !== 'inconsistent'` — the falsification gate. */\n readonly pass: boolean;\n /** Supplied external value, when scored. */\n readonly referenceValue?: number;\n /** |mean(predictions) − reference| / |reference|, when scored. */\n readonly referenceRelError?: number;\n readonly referencePass?: boolean;\n}\n\n/** Aggregate report across the swept nodes. @public */\nexport interface RetrodictionReport {\n readonly results: readonly RetrodictionResult[];\n /** Nodes with ≥2 derivations (consistent + inconsistent). */\n readonly checked: number;\n readonly consistent: number;\n readonly inconsistent: number;\n /** The headline gate: no inconsistent node was found. */\n readonly allConsistent: boolean;\n}\n\n/** The refusal an evaluator error is, or `undefined` when it is not a refusal at all. */\nfunction refusalKind(err: unknown): RetrodictionRefusal['kind'] | undefined {\n if (err instanceof DomainViolationError) return 'domain';\n if (err instanceof CoefficientUnsetError) return 'coefficient-unset';\n if (err instanceof CarrierSignError) return 'carrier-sign';\n if (err instanceof FormulaError) return 'formula';\n return undefined;\n}\n\n/** True when the error says the edge does not fire here (or at all, for an unset coefficient). */\nfunction refusesThePoint(err: unknown): boolean {\n return refusalKind(err) !== undefined;\n}\n\n/**\n * Monotone forward EVALUATION: propagate values from `groundTruth` through\n * the graph (domain-checked; identifications supply identified names;\n * non-finite or domain-refused edges do not fire). Each node is assigned\n * the value of the first edge that fires for it.\n *\n * Exported `@internal` so the discovery magnitude-gate can read a quantity's\n * value AT THE REGISTERED ANCHOR when the static representative-value table\n * has no entry for it (graph-derived quantities like `schwarzschild-radius`).\n *\n * @internal\n */\nexport function forwardEvaluate(\n edges: readonly BridgeEdge[],\n groundTruth: Readonly<Record<string, number>>,\n idents: readonly QuantityIdentification[],\n): Map<string, number> {\n // Finite-seed guard (matches the computed-value guard below and the\n // library-wide finiteness discipline): a NaN/∞ seed would propagate silently\n // through the graph and spoof downstream magnitude/consistency checks.\n for (const [name, v] of Object.entries(groundTruth)) {\n if (!Number.isFinite(v)) {\n throw new TypeError(\n `forwardEvaluate: ground-truth seed '${name}' must be a finite number, got ${v}.`,\n );\n }\n }\n const values = new Map<string, number>(Object.entries(groundTruth));\n let changed = true;\n while (changed) {\n changed = false;\n for (const id of idents) {\n const fromVal = values.get(id.from);\n if (fromVal !== undefined && !values.has(id.to)) {\n const converted = fromVal * conventionFactor(id.from, id.to);\n if (Number.isFinite(converted)) {\n values.set(id.to, converted);\n changed = true;\n }\n }\n }\n for (const e of edges) {\n if (values.has(e.target.name)) continue;\n if (!e.sources.every((s) => values.has(s.name))) continue;\n const inputs = evaluationInputs(e, values);\n let v: number;\n try {\n v = evaluateEdge(e, inputs);\n } catch (err) {\n // The edge refusing this point (a domain miss, opposite carrier signs, a formula\n // that has no finite value there) or an unset coefficient is \"the edge does not\n // fire\". Anything else (an alias conflict, a TypeError in an evaluator) is a\n // different fact and is not hidden as a non-derivation (9.0.0 audit §4 C6).\n if (!refusesThePoint(err)) throw err;\n continue;\n }\n if (Number.isFinite(v)) {\n values.set(e.target.name, v);\n changed = true;\n }\n }\n }\n return values;\n}\n\n/**\n * Retrodict one node: mask it (source values from the target-removed\n * graph), recover it via each incoming edge, and score the spread.\n *\n * @public\n */\nexport function retrodictNode(\n edges: readonly BridgeEdge[],\n groundTruth: Readonly<Record<string, number>>,\n target: string,\n opts: RetrodictionOptions = {},\n): RetrodictionResult {\n const idents = opts.identifications ?? QUANTITY_IDENTIFICATIONS;\n const tolerance = opts.tolerance ?? 1e-6;\n\n // Masked source values: never let the target be assigned (so no\n // derivation reads it back — circular self-support excluded).\n const edgesMinusIntoTarget = edges.filter((e) => e.target.name !== target);\n const values = forwardEvaluate(edgesMinusIntoTarget, groundTruth, idents);\n\n const predictions: RetrodictionPrediction[] = [];\n const refusals: RetrodictionRefusal[] = [];\n for (const e of edges) {\n if (e.target.name !== target) continue;\n if (!e.sources.every((s) => values.has(s.name))) continue;\n const inputs = evaluationInputs(e, values);\n let v: number;\n try {\n v = evaluateEdge(e, inputs);\n } catch (err) {\n // A refusal of the point or an unset coefficient is a recorded refusal of\n // this edge, under its own kind. Any other error (an alias conflict, a\n // TypeError in an evaluator) is a different fact and propagates instead of\n // reading as \"unrecoverable\" (§4 C6).\n const kind = refusalKind(err);\n if (kind === undefined) throw err;\n refusals.push({ edge: e.id, kind, reason: (err as Error).message });\n continue;\n }\n if (Number.isFinite(v)) predictions.push({ edge: e.id, value: v });\n }\n\n let relativeSpread = 0;\n if (predictions.length >= 2) {\n const vals = predictions.map((p) => p.value);\n const max = Math.max(...vals);\n const min = Math.min(...vals);\n // Normalize the (max − min) span by the largest MAGNITUDE, not the mean:\n // opposite-sign predictions (e.g. +6 and −6) cancel in the mean → a ~0\n // denominator → spurious Infinity, even though the true relative spread is\n // finite (12/6 = 2). `maxAbs === 0` only when every value is 0 (max = min),\n // so the span is 0 too.\n const maxAbs = Math.max(...vals.map(Math.abs));\n relativeSpread = maxAbs > 0 ? (max - min) / maxAbs : 0;\n }\n\n let outcome: RetrodictionOutcome;\n if (predictions.length === 0) outcome = 'unrecoverable';\n else if (predictions.length === 1) outcome = 'single';\n else outcome = relativeSpread <= tolerance ? 'consistent' : 'inconsistent';\n\n const result: RetrodictionResult = {\n target,\n outcome,\n predictions,\n relativeSpread,\n tolerance,\n ...(refusals.length > 0 ? { refusals } : {}),\n pass: outcome !== 'inconsistent',\n };\n\n const ref = opts.references?.[target];\n if (ref !== undefined && predictions.length >= 1) {\n const mean =\n predictions.reduce((a, p) => a + p.value, 0) / predictions.length;\n const referenceRelError = Math.abs(mean - ref) / (Math.abs(ref) || 1);\n return {\n ...result,\n referenceValue: ref,\n referenceRelError,\n referencePass: referenceRelError <= (opts.referenceTolerance ?? 1e-3),\n };\n }\n\n return result;\n}\n\n/**\n * Sweep the graph: retrodict every over-determined node (the classifier\n * is the feeder), plus any node with a supplied reference value. Returns\n * the per-node results and the headline `allConsistent` gate.\n *\n * @public\n */\nexport function retrodict(\n edges: readonly BridgeEdge[],\n groundTruth: Readonly<Record<string, number>>,\n opts: RetrodictionOptions = {},\n): RetrodictionReport {\n const idents = opts.identifications ?? QUANTITY_IDENTIFICATIONS;\n const known = Object.keys(groundTruth);\n const classified = classifyAll(edges, known, { identifications: idents });\n\n const overDetermined = classified\n .filter((r) => r.verdict === 'over-determined')\n .map((r) => r.target);\n const refTargets = opts.references ? Object.keys(opts.references) : [];\n const targets = [...new Set([...overDetermined, ...refTargets])].sort();\n\n const results = targets.map((t) =>\n retrodictNode(edges, groundTruth, t, opts),\n );\n\n const consistent = results.filter((r) => r.outcome === 'consistent').length;\n const inconsistent = results.filter(\n (r) => r.outcome === 'inconsistent',\n ).length;\n\n return {\n results,\n checked: consistent + inconsistent,\n consistent,\n inconsistent,\n allConsistent: inconsistent === 0,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"retrodiction.js","sourceRoot":"","sources":["../../src/composition/retrodiction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB,EAAE,MAAmC;IACpF,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO;QAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAE,CAAC;IACnE,MAAM,KAAK,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC;IAC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;AACJ,CAAC","sourcesContent":["/**\n * Retrodiction harness (Consequence 2 of\n * docs/planning/Bridge-Inference-Epistemics-Note.md, designed in\n * docs/planning/Retrodiction-Harness-Design-Note.md).\n *\n * The framework's own falsification benchmark. Mask a quantity the graph\n * can compute, recompute it from ground-truth inputs via EACH independent\n * derivation, and check the predictions agree. This operationalizes the\n * identifiability classifier's OVER-DETERMINED verdict: the surplus\n * derivations of an over-determined node are PREDICTED to be consistency\n * constraints; the harness evaluates them and checks that numerically.\n *\n * - consistent — ≥2 derivations agree within tolerance.\n * - inconsistent — ≥2 derivations DISAGREE (a falsification: two\n * encodings of one quantity-name are not the same\n * physics).\n * - single — exactly one derivation fired (recovered, no check).\n * - unrecoverable — no derivation fired from the ground truth.\n *\n * \"Mask\" = compute source values over the graph with every edge INTO the\n * target removed (the classifier's target-removed closure — so the node\n * is genuinely hidden, never read back through its own derivation).\n * Forward evaluation honors `QUANTITY_IDENTIFICATIONS` and is\n * domain-checked (an edge that refuses its domain contributes no\n * prediction). The consistency check needs no external truth and is the\n * re-runnable core; an optional `references` map adds external-value\n * scoring. Pass bar pre-registered in the design note (spread ≤ 1e-6).\n *\n * @module composition/retrodiction\n */\n\nimport type { BridgeEdge } from './edge.js';\nimport { CANONICAL_GROUP_PREFACTORS } from './canonical-prefactors.js';\nimport { CoefficientUnsetError, evaluateEdge } from './edge.js';\nimport { DomainViolationError } from '../bridges/evaluation-errors.js';\nimport { CarrierSignError } from '../bridges/carrier-sign.js';\nimport { FormulaError } from '../numerical/formula-contract.js';\nimport { meanOf } from '../numerical/statistics.js';\nimport type { QuantityIdentification } from './compose.js';\nimport { QUANTITY_IDENTIFICATIONS } from './compose.js';\nimport { conventionFactor } from '../dimensional/unit-convention.js';\nimport { classifyAll } from './identifiability.js';\n\n/**\n * Source values, plus a dimensionless group the edge multiplies when the\n * ground truth names it. The group is not a source: Buckingham cannot see\n * it, and a missing group is the unset coefficient, not a missing input.\n * Exported for the own-equation magnitudes (`own-equation-magnitude.ts`),\n * which evaluate an edge the same way.\n * @internal\n */\nexport function evaluationInputs(edge: BridgeEdge, values: ReadonlyMap<string, number>): Record<string, number> {\n const inputs: Record<string, number> = {};\n for (const s of edge.sources) inputs[s.name] = values.get(s.name)!;\n const group = CANONICAL_GROUP_PREFACTORS.find((g) => g.id === edge.id);\n if (group !== undefined) {\n const g = values.get(group.group);\n if (g !== undefined) inputs[group.group] = g;\n }\n return inputs;\n}\n\n/** Outcome of retrodicting one node. @public */\nexport type RetrodictionOutcome =\n | 'consistent'\n | 'inconsistent'\n | 'single'\n | 'unrecoverable';\n\n/** One derivation's recovered value for a masked node. @public */\nexport interface RetrodictionPrediction {\n /** The edge id that produced this value. */\n readonly edge: string;\n readonly value: number;\n}\n\n/** Options for the harness. @public */\nexport interface RetrodictionOptions {\n /** Identifications honored in forward evaluation (default registered). */\n readonly identifications?: readonly QuantityIdentification[];\n /** Relative-spread tolerance for `consistent` (default 1e-6). */\n readonly tolerance?: number;\n /** External (textbook) values to score recovered nodes against. */\n readonly references?: Readonly<Record<string, number>>;\n /** Relative-error tolerance for reference scoring (default 1e-3). */\n readonly referenceTolerance?: number;\n}\n\n/** One refused edge in a retrodiction, with the kind of refusal. @public */\nexport interface RetrodictionRefusal {\n readonly edge: string;\n /**\n * `domain`: the validity domain rejected the point. `coefficient-unset`: the edge has no\n * sourced prefactor, whatever the values. `carrier-sign`: the carrier charge and the\n * mobility had opposite signs. `formula`: the relation's formula did not evaluate at the\n * point (a 0/0, say). Four facts, kept apart (AGENTS law 4).\n */\n readonly kind: 'domain' | 'coefficient-unset' | 'carrier-sign' | 'formula';\n readonly reason: string;\n}\n\n/** The result of retrodicting one node. @public */\nexport interface RetrodictionResult {\n readonly target: string;\n readonly outcome: RetrodictionOutcome;\n /** Recovered values, one per derivation that fired. */\n readonly predictions: readonly RetrodictionPrediction[];\n /** (max − min)/|mean| across predictions; 0 when fewer than two. */\n readonly relativeSpread: number;\n readonly tolerance: number;\n /**\n * Edges that refused the supplied values. `kind` keeps the refusals apart (AGENTS law 4):\n * `domain`, `carrier-sign` and `formula` are the point (the edge does not fire there);\n * `coefficient-unset` is the edge's own state (no sourced prefactor), whatever the values.\n */\n readonly refusals?: readonly RetrodictionRefusal[];\n /** `outcome !== 'inconsistent'` — the falsification gate. */\n readonly pass: boolean;\n /** Supplied external value, when scored. */\n readonly referenceValue?: number;\n /** |mean(predictions) − reference| / |reference|, when scored. */\n readonly referenceRelError?: number;\n readonly referencePass?: boolean;\n}\n\n/** Aggregate report across the swept nodes. @public */\nexport interface RetrodictionReport {\n readonly results: readonly RetrodictionResult[];\n /** Nodes with ≥2 derivations (consistent + inconsistent). */\n readonly checked: number;\n readonly consistent: number;\n readonly inconsistent: number;\n /** The headline gate: no inconsistent node was found. */\n readonly allConsistent: boolean;\n}\n\n/** The refusal an evaluator error is, or `undefined` when it is not a refusal at all. */\nfunction refusalKind(err: unknown): RetrodictionRefusal['kind'] | undefined {\n if (err instanceof DomainViolationError) return 'domain';\n if (err instanceof CoefficientUnsetError) return 'coefficient-unset';\n if (err instanceof CarrierSignError) return 'carrier-sign';\n if (err instanceof FormulaError) return 'formula';\n return undefined;\n}\n\n/**\n * True when the error says the edge does not fire here (or at all, for an unset coefficient).\n * Exported so the own-equation magnitudes read an edge's refusal by this one rule.\n * @internal\n */\nexport function refusesThePoint(err: unknown): boolean {\n return refusalKind(err) !== undefined;\n}\n\n/**\n * Monotone forward EVALUATION: propagate values from `groundTruth` through\n * the graph (domain-checked; identifications supply identified names;\n * non-finite or domain-refused edges do not fire). Each node is assigned\n * the value of the first edge that fires for it.\n *\n * Exported `@internal` so the discovery magnitude-gate can read a quantity's\n * value AT THE REGISTERED ANCHOR when the static representative-value table\n * has no entry for it (graph-derived quantities like `schwarzschild-radius`).\n *\n * @internal\n */\nexport function forwardEvaluate(\n edges: readonly BridgeEdge[],\n groundTruth: Readonly<Record<string, number>>,\n idents: readonly QuantityIdentification[],\n): Map<string, number> {\n // Finite-seed guard (matches the computed-value guard below and the\n // library-wide finiteness discipline): a NaN/∞ seed would propagate silently\n // through the graph and spoof downstream magnitude/consistency checks.\n for (const [name, v] of Object.entries(groundTruth)) {\n if (!Number.isFinite(v)) {\n throw new TypeError(\n `forwardEvaluate: ground-truth seed '${name}' must be a finite number, got ${v}.`,\n );\n }\n }\n const values = new Map<string, number>(Object.entries(groundTruth));\n let changed = true;\n while (changed) {\n changed = false;\n for (const id of idents) {\n const fromVal = values.get(id.from);\n if (fromVal !== undefined && !values.has(id.to)) {\n const converted = fromVal * conventionFactor(id.from, id.to);\n if (Number.isFinite(converted)) {\n values.set(id.to, converted);\n changed = true;\n }\n }\n }\n for (const e of edges) {\n if (values.has(e.target.name)) continue;\n if (!e.sources.every((s) => values.has(s.name))) continue;\n const inputs = evaluationInputs(e, values);\n let v: number;\n try {\n v = evaluateEdge(e, inputs);\n } catch (err) {\n // The edge refusing this point (a domain miss, opposite carrier signs, a formula\n // that has no finite value there) or an unset coefficient is \"the edge does not\n // fire\". Anything else (an alias conflict, a TypeError in an evaluator) is a\n // different fact and is not hidden as a non-derivation (9.0.0 audit §4 C6).\n if (!refusesThePoint(err)) throw err;\n continue;\n }\n if (Number.isFinite(v)) {\n values.set(e.target.name, v);\n changed = true;\n }\n }\n }\n return values;\n}\n\n/**\n * Retrodict one node: mask it (source values from the target-removed\n * graph), recover it via each incoming edge, and score the spread.\n *\n * @public\n */\nexport function retrodictNode(\n edges: readonly BridgeEdge[],\n groundTruth: Readonly<Record<string, number>>,\n target: string,\n opts: RetrodictionOptions = {},\n): RetrodictionResult {\n const idents = opts.identifications ?? QUANTITY_IDENTIFICATIONS;\n const tolerance = opts.tolerance ?? 1e-6;\n\n // Masked source values: never let the target be assigned (so no\n // derivation reads it back — circular self-support excluded).\n const edgesMinusIntoTarget = edges.filter((e) => e.target.name !== target);\n const values = forwardEvaluate(edgesMinusIntoTarget, groundTruth, idents);\n\n const predictions: RetrodictionPrediction[] = [];\n const refusals: RetrodictionRefusal[] = [];\n for (const e of edges) {\n if (e.target.name !== target) continue;\n if (!e.sources.every((s) => values.has(s.name))) continue;\n const inputs = evaluationInputs(e, values);\n let v: number;\n try {\n v = evaluateEdge(e, inputs);\n } catch (err) {\n // A refusal of the point or an unset coefficient is a recorded refusal of\n // this edge, under its own kind. Any other error (an alias conflict, a\n // TypeError in an evaluator) is a different fact and propagates instead of\n // reading as \"unrecoverable\" (§4 C6).\n const kind = refusalKind(err);\n if (kind === undefined) throw err;\n refusals.push({ edge: e.id, kind, reason: (err as Error).message });\n continue;\n }\n if (Number.isFinite(v)) predictions.push({ edge: e.id, value: v });\n }\n\n let relativeSpread = 0;\n if (predictions.length >= 2) {\n const vals = predictions.map((p) => p.value);\n const max = Math.max(...vals);\n const min = Math.min(...vals);\n // Normalize the (max − min) span by the largest MAGNITUDE, not the mean:\n // opposite-sign predictions (e.g. +6 and −6) cancel in the mean → a ~0\n // denominator → spurious Infinity, even though the true relative spread is\n // finite (12/6 = 2). `maxAbs === 0` only when every value is 0 (max = min),\n // so the span is 0 too.\n const maxAbs = Math.max(...vals.map(Math.abs));\n relativeSpread = maxAbs > 0 ? (max - min) / maxAbs : 0;\n }\n\n let outcome: RetrodictionOutcome;\n if (predictions.length === 0) outcome = 'unrecoverable';\n else if (predictions.length === 1) outcome = 'single';\n else outcome = relativeSpread <= tolerance ? 'consistent' : 'inconsistent';\n\n const result: RetrodictionResult = {\n target,\n outcome,\n predictions,\n relativeSpread,\n tolerance,\n ...(refusals.length > 0 ? { refusals } : {}),\n pass: outcome !== 'inconsistent',\n };\n\n const ref = opts.references?.[target];\n if (ref !== undefined && predictions.length >= 1) {\n const mean = meanOf(predictions.map((p) => p.value));\n const referenceRelError = Math.abs(mean - ref) / (Math.abs(ref) || 1);\n return {\n ...result,\n referenceValue: ref,\n referenceRelError,\n referencePass: referenceRelError <= (opts.referenceTolerance ?? 1e-3),\n };\n }\n\n return result;\n}\n\n/**\n * Sweep the graph: retrodict every over-determined node (the classifier\n * is the feeder), plus any node with a supplied reference value. Returns\n * the per-node results and the headline `allConsistent` gate.\n *\n * @public\n */\nexport function retrodict(\n edges: readonly BridgeEdge[],\n groundTruth: Readonly<Record<string, number>>,\n opts: RetrodictionOptions = {},\n): RetrodictionReport {\n const idents = opts.identifications ?? QUANTITY_IDENTIFICATIONS;\n const known = Object.keys(groundTruth);\n const classified = classifyAll(edges, known, { identifications: idents });\n\n const overDetermined = classified\n .filter((r) => r.verdict === 'over-determined')\n .map((r) => r.target);\n const refTargets = opts.references ? Object.keys(opts.references) : [];\n const targets = [...new Set([...overDetermined, ...refTargets])].sort();\n\n const results = targets.map((t) =>\n retrodictNode(edges, groundTruth, t, opts),\n );\n\n const consistent = results.filter((r) => r.outcome === 'consistent').length;\n const inconsistent = results.filter(\n (r) => r.outcome === 'inconsistent',\n ).length;\n\n return {\n results,\n checked: consistent + inconsistent,\n consistent,\n inconsistent,\n allConsistent: inconsistent === 0,\n };\n}\n"]}
|
|
@@ -64,6 +64,7 @@ export interface AnalyzeUserEquationOptions {
|
|
|
64
64
|
/** Reconcile a dimension difference by powers of c, ħ, and (geometrized) G. */
|
|
65
65
|
readonly units?: Exclude<UnitMode, 'si'>;
|
|
66
66
|
}
|
|
67
|
+
/** Parse a `TARGET = EXPR` equation into its target and source quantities. A malformed equation throws. */
|
|
67
68
|
export declare function parseUserEquation(equation: string, catalogNames?: ReadonlySet<string> | Iterable<string>): Promise<UserEquation>;
|
|
68
69
|
/**
|
|
69
70
|
* Up to `k` catalog names most similar to `name` — the "did you mean?" set for an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-equation.d.ts","sourceRoot":"","sources":["../../src/composition/user-equation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,OAAO,EAA8B,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAI5F,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EA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AAE,KAAK,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,SAAS,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3C,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IAChD;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,EAC3C,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,gBAAgB,CAAC,CAgI3B"}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { getFormulaParser, parsePhysics } from '../numerical/formula-registry.js';
|
|
22
22
|
import { formulaSymbolDimension } from '../numerical/formula-dimension.js';
|
|
23
23
|
import { CONSTANT_SPELLINGS } from '../dimensional/dimension-spec.js';
|
|
24
|
-
import { CONSTANTS } from '../dimensional/symbolic-constants.js';
|
|
24
|
+
import { CONSTANTS, isRegisteredConstant } from '../dimensional/symbolic-constants.js';
|
|
25
25
|
import { formulaNameDimensions } from '../dimensional/formula-names.js';
|
|
26
26
|
import { naturalNote, naturalPowers } from '../dimensional/natural-units.js';
|
|
27
27
|
import { aliasesForTarget, editDistance } from './aliases.js';
|
|
@@ -104,6 +104,7 @@ function withFormulaNames(catalog) {
|
|
|
104
104
|
}
|
|
105
105
|
return out;
|
|
106
106
|
}
|
|
107
|
+
/** Parse a `TARGET = EXPR` equation into its target and source quantities. A malformed equation throws. */
|
|
107
108
|
export async function parseUserEquation(equation, catalogNames) {
|
|
108
109
|
if (equation.length > MAX_USER_EQUATION_LEN) {
|
|
109
110
|
throw new UserEquationError(`equation exceeds ${MAX_USER_EQUATION_LEN} characters (${equation.length})`);
|
|
@@ -131,7 +132,7 @@ export async function parseUserEquation(equation, catalogNames) {
|
|
|
131
132
|
// No parse tree, so no subtraction was read: the hyphen hint needs the parsed variables.
|
|
132
133
|
throw new UserEquationError(`could not parse the right-hand side '${rhs}': ${e.message}`);
|
|
133
134
|
}
|
|
134
|
-
const sources = variables.filter((v) => !
|
|
135
|
+
const sources = variables.filter((v) => !isRegisteredConstant(v));
|
|
135
136
|
// An all-constant right-hand side (the Planck length) is an equation about a catalog quantity
|
|
136
137
|
// only when its target is one; otherwise it names nothing to check (persona finding W5).
|
|
137
138
|
const targetIsCatalog = names !== undefined && resolveQuantityName(target, names) !== null;
|