universal-physics-tensor 9.0.0 → 11.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 +21 -17
- package/bin/upt.mjs +13 -1
- package/data/atlas/atlas.json +79 -68
- package/data/atlas/atlas.jsonld +1 -1
- package/data/atlas/diffusion.json +24 -23
- package/data/atlas/oscillators.json +21 -16
- package/data/atlas/waves.json +36 -31
- package/data/atlas/witness-results.json +11 -11
- package/data/bridge-catalog.json +1192 -1636
- package/data/bridge-catalog.schema.json +390 -135
- package/data/quantities.json +53 -19
- package/data/schemas/atlas-record.v0.json +184 -46
- package/data/units.json +33 -4
- package/dist/atlas/applicability.d.ts.map +1 -1
- package/dist/atlas/applicability.js +35 -18
- package/dist/atlas/applicability.js.map +1 -1
- package/dist/atlas/association.js.map +1 -1
- package/dist/atlas/benchmark/backend-shapes.d.ts.map +1 -1
- package/dist/atlas/benchmark/backend-shapes.js +5 -1
- package/dist/atlas/benchmark/backend-shapes.js.map +1 -1
- package/dist/atlas/benchmark/baselines.d.ts.map +1 -1
- package/dist/atlas/benchmark/baselines.js +8 -0
- package/dist/atlas/benchmark/baselines.js.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts +12 -3
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.js +30 -21
- package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
- package/dist/atlas/benchmark/leakage.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/run-atlas.d.ts.map +1 -1
- package/dist/atlas/benchmark/run-atlas.js +14 -2
- package/dist/atlas/benchmark/run-atlas.js.map +1 -1
- package/dist/atlas/benchmark/stats.d.ts +3 -3
- package/dist/atlas/benchmark/stats.d.ts.map +1 -1
- package/dist/atlas/benchmark/stats.js +16 -8
- package/dist/atlas/benchmark/stats.js.map +1 -1
- package/dist/atlas/benchmark/study.js.map +1 -1
- package/dist/atlas/benchmark/types.js.map +1 -1
- package/dist/atlas/bridge-record.d.ts +4 -4
- package/dist/atlas/bridge-record.d.ts.map +1 -1
- package/dist/atlas/bridge-record.js +6 -6
- package/dist/atlas/bridge-record.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 +0 -11
- package/dist/atlas/chain-pipeline.d.ts.map +1 -1
- package/dist/atlas/chain-pipeline.js +12 -24
- package/dist/atlas/chain-pipeline.js.map +1 -1
- package/dist/atlas/composition-table.js.map +1 -1
- package/dist/atlas/conventions.js.map +1 -1
- package/dist/atlas/coverage.d.ts +2 -2
- package/dist/atlas/coverage.js.map +1 -1
- package/dist/atlas/derivation.js.map +1 -1
- package/dist/atlas/derive-evidence.d.ts +6 -4
- package/dist/atlas/derive-evidence.d.ts.map +1 -1
- package/dist/atlas/derive-evidence.js +7 -2
- package/dist/atlas/derive-evidence.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 -17
- 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 -42
- 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/index.d.ts +1 -1
- package/dist/atlas/diffusion/index.d.ts.map +1 -1
- package/dist/atlas/diffusion/index.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/error-algebra.d.ts +6 -0
- package/dist/atlas/error-algebra.d.ts.map +1 -1
- package/dist/atlas/error-algebra.js +26 -0
- package/dist/atlas/error-algebra.js.map +1 -1
- package/dist/atlas/export.d.ts +18 -2
- package/dist/atlas/export.d.ts.map +1 -1
- package/dist/atlas/export.js +9 -3
- package/dist/atlas/export.js.map +1 -1
- package/dist/atlas/families.d.ts +19 -2
- package/dist/atlas/families.d.ts.map +1 -1
- package/dist/atlas/families.js +26 -3
- package/dist/atlas/families.js.map +1 -1
- package/dist/atlas/family.d.ts +27 -0
- package/dist/atlas/family.d.ts.map +1 -0
- package/dist/atlas/family.js +12 -0
- package/dist/atlas/family.js.map +1 -0
- package/dist/atlas/index.d.ts +3 -2
- package/dist/atlas/index.d.ts.map +1 -1
- package/dist/atlas/index.js +2 -1
- package/dist/atlas/index.js.map +1 -1
- package/dist/atlas/link-prediction.d.ts +107 -4
- 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/model.js.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.js +7 -12
- 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 -10
- 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 -36
- 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/index.d.ts +1 -16
- package/dist/atlas/oscillators/index.d.ts.map +1 -1
- package/dist/atlas/oscillators/index.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/norm-transport-witness.js.map +1 -1
- package/dist/atlas/oscillators/norm-transport.js.map +1 -1
- package/dist/atlas/oscillators/norms.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-carriage.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/path-bound.js.map +1 -1
- package/dist/atlas/physjs-entries.generated.d.ts +25 -24
- package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
- package/dist/atlas/physjs-entries.generated.js +25 -24
- package/dist/atlas/physjs-entries.generated.js.map +1 -1
- package/dist/atlas/physjs-ref.d.ts +107 -70
- package/dist/atlas/physjs-ref.d.ts.map +1 -1
- package/dist/atlas/physjs-ref.js +184 -101
- package/dist/atlas/physjs-ref.js.map +1 -1
- package/dist/atlas/physjs-reviewed.d.ts +31 -0
- package/dist/atlas/physjs-reviewed.d.ts.map +1 -0
- package/dist/atlas/physjs-reviewed.js +194 -0
- package/dist/atlas/physjs-reviewed.js.map +1 -0
- package/dist/atlas/poster/associations.js.map +1 -1
- package/dist/atlas/poster/derivations.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/public.d.ts +2 -1
- package/dist/atlas/public.d.ts.map +1 -1
- package/dist/atlas/public.js +2 -1
- package/dist/atlas/public.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/serialize.d.ts +18 -12
- package/dist/atlas/serialize.d.ts.map +1 -1
- package/dist/atlas/serialize.js +28 -18
- package/dist/atlas/serialize.js.map +1 -1
- package/dist/atlas/statement.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/translation-registry.js.map +1 -1
- package/dist/atlas/translation.js.map +1 -1
- package/dist/atlas/types.d.ts +9 -2
- package/dist/atlas/types.d.ts.map +1 -1
- package/dist/atlas/types.js +1 -1
- package/dist/atlas/types.js.map +1 -1
- package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/waves/bridges-closure.js +2 -9
- 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 -52
- package/dist/atlas/waves/bridges.js.map +1 -1
- package/dist/atlas/waves/index.d.ts +1 -1
- package/dist/atlas/waves/index.d.ts.map +1 -1
- package/dist/atlas/waves/index.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-artifact.js.map +1 -1
- package/dist/atlas/witness-dominance.d.ts +4 -3
- package/dist/atlas/witness-dominance.d.ts.map +1 -1
- package/dist/atlas/witness-dominance.js +15 -5
- package/dist/atlas/witness-dominance.js.map +1 -1
- package/dist/atlas/witness-numeric.d.ts +38 -4
- package/dist/atlas/witness-numeric.d.ts.map +1 -1
- package/dist/atlas/witness-numeric.js +80 -2
- package/dist/atlas/witness-numeric.js.map +1 -1
- package/dist/atlas/witness-result.d.ts +7 -1
- package/dist/atlas/witness-result.d.ts.map +1 -1
- package/dist/atlas/witness-result.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/atlas/witnesses/quantum-support.js.map +1 -1
- package/dist/bridges/caller-table.d.ts +1 -1
- package/dist/bridges/caller-table.d.ts.map +1 -1
- package/dist/bridges/caller-table.js.map +1 -1
- package/dist/bridges/carrier-sign.d.ts.map +1 -1
- package/dist/bridges/carrier-sign.js +8 -3
- package/dist/bridges/carrier-sign.js.map +1 -1
- package/dist/bridges/catalog-adapter.d.ts +12 -3
- package/dist/bridges/catalog-adapter.d.ts.map +1 -1
- package/dist/bridges/catalog-adapter.js +17 -9
- package/dist/bridges/catalog-adapter.js.map +1 -1
- package/dist/bridges/catalog-load.d.ts +12 -2
- package/dist/bridges/catalog-load.d.ts.map +1 -1
- package/dist/bridges/catalog-load.js +181 -13
- package/dist/bridges/catalog-load.js.map +1 -1
- package/dist/bridges/catalog-types.d.ts +74 -26
- 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/coefficient-statement.js +1 -5
- package/dist/bridges/coefficient-statement.js.map +1 -1
- package/dist/bridges/confrontation-coverage.js.map +1 -1
- package/dist/bridges/confrontations.d.ts +1 -1
- package/dist/bridges/confrontations.d.ts.map +1 -1
- package/dist/bridges/confrontations.js +1 -1
- package/dist/bridges/confrontations.js.map +1 -1
- package/dist/bridges/evaluation-errors.d.ts +46 -3
- package/dist/bridges/evaluation-errors.d.ts.map +1 -1
- package/dist/bridges/evaluation-errors.js +40 -4
- 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 +17 -2
- package/dist/bridges/evaluators.d.ts.map +1 -1
- package/dist/bridges/evaluators.js +76 -28
- package/dist/bridges/evaluators.js.map +1 -1
- package/dist/bridges/expr-parse.d.ts +38 -4
- package/dist/bridges/expr-parse.d.ts.map +1 -1
- package/dist/bridges/expr-parse.js +101 -12
- package/dist/bridges/expr-parse.js.map +1 -1
- package/dist/bridges/holds.d.ts +40 -4
- package/dist/bridges/holds.d.ts.map +1 -1
- package/dist/bridges/holds.js +128 -19
- package/dist/bridges/holds.js.map +1 -1
- package/dist/bridges/index.d.ts +15 -14
- package/dist/bridges/index.d.ts.map +1 -1
- package/dist/bridges/index.js +14 -15
- package/dist/bridges/index.js.map +1 -1
- package/dist/bridges/input-contract.js.map +1 -1
- package/dist/bridges/membership.d.ts +5 -3
- package/dist/bridges/membership.d.ts.map +1 -1
- package/dist/bridges/membership.js +5 -6
- package/dist/bridges/membership.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/observations/types.js.map +1 -1
- package/dist/bridges/rejected.d.ts +11 -17
- package/dist/bridges/rejected.d.ts.map +1 -1
- package/dist/bridges/rejected.js +13 -68
- package/dist/bridges/rejected.js.map +1 -1
- package/dist/bridges/relation-eval.d.ts +6 -7
- package/dist/bridges/relation-eval.d.ts.map +1 -1
- package/dist/bridges/relation-eval.js +20 -50
- package/dist/bridges/relation-eval.js.map +1 -1
- package/dist/bridges/rhs-registry.js.map +1 -1
- package/dist/bridges/sensitivity.d.ts +11 -3
- package/dist/bridges/sensitivity.d.ts.map +1 -1
- package/dist/bridges/sensitivity.js +27 -13
- package/dist/bridges/sensitivity.js.map +1 -1
- package/dist/bridges/tensor-index.js.map +1 -1
- package/dist/bridges/types.d.ts +1 -7
- package/dist/bridges/types.d.ts.map +1 -1
- package/dist/bridges/types.js +1 -4
- package/dist/bridges/types.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/canonical-equation.js.map +1 -1
- package/dist/canonical/dimensional-fields.js.map +1 -1
- package/dist/canonical/entries/_l1-build.js.map +1 -1
- 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 +8 -9
- 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 +5 -6
- 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 +6 -12
- 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 +38 -39
- 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/statistical-mechanics.js +5 -5
- package/dist/canonical/entries/statistical-mechanics.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 +29 -4
- package/dist/canonical/linkage.d.ts.map +1 -1
- package/dist/canonical/linkage.js +47 -64
- package/dist/canonical/linkage.js.map +1 -1
- package/dist/canonical/normal-form.d.ts +0 -8
- package/dist/canonical/normal-form.d.ts.map +1 -1
- package/dist/canonical/normal-form.js +22 -23
- package/dist/canonical/normal-form.js.map +1 -1
- package/dist/canonical/registry.js.map +1 -1
- package/dist/canonical/residual.js.map +1 -1
- package/dist/canonical/seed-l-layer.d.ts +7 -1
- package/dist/canonical/seed-l-layer.d.ts.map +1 -1
- package/dist/canonical/seed-l-layer.js +7 -1
- package/dist/canonical/seed-l-layer.js.map +1 -1
- package/dist/canonical/structural.d.ts +42 -21
- package/dist/canonical/structural.d.ts.map +1 -1
- package/dist/canonical/structural.js +64 -23
- package/dist/canonical/structural.js.map +1 -1
- package/dist/cases/brownian-sphere.d.ts +3 -3
- package/dist/cases/brownian-sphere.d.ts.map +1 -1
- package/dist/cases/brownian-sphere.js +10 -9
- package/dist/cases/brownian-sphere.js.map +1 -1
- package/dist/cases/damped-resonator.d.ts.map +1 -1
- package/dist/cases/damped-resonator.js +8 -11
- package/dist/cases/damped-resonator.js.map +1 -1
- package/dist/cases/index.js.map +1 -1
- package/dist/cases/kepler-rv.d.ts +1 -1
- package/dist/cases/kepler-rv.d.ts.map +1 -1
- package/dist/cases/kepler-rv.js +3 -2
- package/dist/cases/kepler-rv.js.map +1 -1
- package/dist/cases/lumped-cooling.d.ts +8 -3
- package/dist/cases/lumped-cooling.d.ts.map +1 -1
- package/dist/cases/lumped-cooling.js +22 -24
- package/dist/cases/lumped-cooling.js.map +1 -1
- 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/resistor-noise.js +7 -7
- package/dist/cases/resistor-noise.js.map +1 -1
- package/dist/cases/skin-depth.d.ts +0 -4
- package/dist/cases/skin-depth.d.ts.map +1 -1
- package/dist/cases/skin-depth.js +3 -7
- package/dist/cases/skin-depth.js.map +1 -1
- package/dist/cases/types.js.map +1 -1
- package/dist/cli/args.d.ts +30 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +47 -9
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/bindings.d.ts +13 -0
- package/dist/cli/bindings.d.ts.map +1 -0
- package/dist/cli/bindings.js +33 -0
- package/dist/cli/bindings.js.map +1 -0
- package/dist/cli/closed-form-range.js.map +1 -1
- package/dist/cli/command.d.ts +8 -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 +2 -11
- package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-map.js +50 -35
- 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.map +1 -1
- package/dist/cli/commands/_discovery-opts.js +48 -14
- 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 +9 -8
- 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 +20 -20
- 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/candidates.d.ts.map +1 -1
- package/dist/cli/commands/candidates.js +16 -8
- package/dist/cli/commands/candidates.js.map +1 -1
- package/dist/cli/commands/canonical.js.map +1 -1
- package/dist/cli/commands/chain.js +1 -1
- package/dist/cli/commands/chain.js.map +1 -1
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +22 -20
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/connectors.js.map +1 -1
- package/dist/cli/commands/coverage.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +60 -35
- 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 +20 -10
- 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 +14 -10
- 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 +108 -58
- 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 +16 -8
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/frontier.js.map +1 -1
- package/dist/cli/commands/ground.d.ts.map +1 -1
- package/dist/cli/commands/ground.js +41 -10
- package/dist/cli/commands/ground.js.map +1 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +155 -92
- 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 +58 -20
- 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 +29 -7
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/predict.js.map +1 -1
- package/dist/cli/commands/priority.js.map +1 -1
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +105 -38
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/recover.js +1 -1
- package/dist/cli/commands/recover.js.map +1 -1
- package/dist/cli/commands/regime.d.ts +5 -4
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +25 -26
- 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 +23 -14
- 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 +9 -4
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/symbolic.js +31 -36
- 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 +5 -3
- package/dist/cli/commands/testplan.js.map +1 -1
- package/dist/cli/conventions.js.map +1 -1
- package/dist/cli/determination.js.map +1 -1
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/euler-guard.js.map +1 -1
- package/dist/cli/eval-numbers.js.map +1 -1
- package/dist/cli/expr-print.d.ts +28 -3
- package/dist/cli/expr-print.d.ts.map +1 -1
- package/dist/cli/expr-print.js +42 -22
- package/dist/cli/expr-print.js.map +1 -1
- package/dist/cli/flag-help.js.map +1 -1
- package/dist/cli/graphs.js.map +1 -1
- package/dist/cli/library-defaults.d.ts +19 -0
- package/dist/cli/library-defaults.d.ts.map +1 -0
- package/dist/cli/library-defaults.js +22 -0
- package/dist/cli/library-defaults.js.map +1 -0
- package/dist/cli/main.d.ts +7 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +25 -6
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/map-evidence.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 +23 -6
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +15 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/published-url.js.map +1 -1
- package/dist/cli/record-reach.d.ts +6 -0
- package/dist/cli/record-reach.d.ts.map +1 -1
- package/dist/cli/record-reach.js +17 -11
- 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 +7 -6
- 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 +40 -20
- package/dist/cli/record.js.map +1 -1
- package/dist/cli/search-index.d.ts +5 -0
- package/dist/cli/search-index.d.ts.map +1 -1
- package/dist/cli/search-index.js +19 -7
- 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 +0 -7
- 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/top-level-help.js.map +1 -1
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +7 -5
- package/dist/cli/version.js.map +1 -1
- package/dist/cli-api.d.ts +49 -14
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +42 -17
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/adjudication.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/aliases.js.map +1 -1
- package/dist/composition/audit-coverage.d.ts +2 -0
- package/dist/composition/audit-coverage.d.ts.map +1 -1
- package/dist/composition/audit-coverage.js.map +1 -1
- package/dist/composition/axes.d.ts +6 -0
- package/dist/composition/axes.d.ts.map +1 -1
- package/dist/composition/axes.js +18 -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 +14 -15
- package/dist/composition/bridge-analysis.d.ts.map +1 -1
- package/dist/composition/bridge-analysis.js +148 -91
- package/dist/composition/bridge-analysis.js.map +1 -1
- package/dist/composition/bridge-prediction.d.ts +5 -1
- package/dist/composition/bridge-prediction.d.ts.map +1 -1
- package/dist/composition/bridge-prediction.js +12 -16
- package/dist/composition/bridge-prediction.js.map +1 -1
- package/dist/composition/buckingham-filter.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 +134 -26
- package/dist/composition/canonical-compare.js.map +1 -1
- package/dist/composition/canonical-graph.d.ts +9 -10
- package/dist/composition/canonical-graph.d.ts.map +1 -1
- package/dist/composition/canonical-graph.js +33 -102
- 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/canonical-prefactors.js.map +1 -1
- package/dist/composition/catalog-graph.d.ts.map +1 -1
- package/dist/composition/catalog-graph.js +8 -25
- package/dist/composition/catalog-graph.js.map +1 -1
- package/dist/composition/chain-candidate.d.ts +10 -0
- package/dist/composition/chain-candidate.d.ts.map +1 -1
- package/dist/composition/chain-candidate.js +11 -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-regime.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-surface.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 +166 -41
- 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.map +1 -1
- package/dist/composition/consequence.js +15 -6
- package/dist/composition/consequence.js.map +1 -1
- package/dist/composition/consistency.js.map +1 -1
- package/dist/composition/descriptor.d.ts +1 -1
- package/dist/composition/descriptor.d.ts.map +1 -1
- package/dist/composition/descriptor.js.map +1 -1
- package/dist/composition/dimension-adjacency.js.map +1 -1
- package/dist/composition/discovery.d.ts +77 -11
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +194 -80
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/edge.d.ts +40 -10
- package/dist/composition/edge.d.ts.map +1 -1
- package/dist/composition/edge.js +47 -12
- package/dist/composition/edge.js.map +1 -1
- package/dist/composition/enumerate.d.ts +2 -2
- 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 +5 -9
- package/dist/composition/explain.d.ts.map +1 -1
- package/dist/composition/explain.js +38 -18
- package/dist/composition/explain.js.map +1 -1
- package/dist/composition/expr-eval.d.ts.map +1 -1
- package/dist/composition/expr-eval.js +2 -11
- package/dist/composition/expr-eval.js.map +1 -1
- package/dist/composition/expr-simplify.d.ts +16 -0
- package/dist/composition/expr-simplify.d.ts.map +1 -1
- package/dist/composition/expr-simplify.js +24 -59
- package/dist/composition/expr-simplify.js.map +1 -1
- package/dist/composition/expr-subst.js.map +1 -1
- package/dist/composition/formula-shape.d.ts +28 -0
- package/dist/composition/formula-shape.d.ts.map +1 -1
- package/dist/composition/formula-shape.js +96 -2
- package/dist/composition/formula-shape.js.map +1 -1
- package/dist/composition/frontier-account.d.ts +3 -2
- package/dist/composition/frontier-account.d.ts.map +1 -1
- package/dist/composition/frontier-account.js +7 -3
- package/dist/composition/frontier-account.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.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 +14 -8
- package/dist/composition/index.d.ts.map +1 -1
- package/dist/composition/index.js +7 -5
- package/dist/composition/index.js.map +1 -1
- package/dist/composition/mathts-quiet.d.ts +29 -0
- package/dist/composition/mathts-quiet.d.ts.map +1 -0
- package/dist/composition/mathts-quiet.js +57 -0
- package/dist/composition/mathts-quiet.js.map +1 -0
- package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
- package/dist/composition/mathts-scalar-symbols.js +20 -35
- package/dist/composition/mathts-scalar-symbols.js.map +1 -1
- package/dist/composition/not-composable-seeds.d.ts +3 -1
- package/dist/composition/not-composable-seeds.d.ts.map +1 -1
- package/dist/composition/not-composable-seeds.js +2 -0
- package/dist/composition/not-composable-seeds.js.map +1 -1
- package/dist/composition/probe/backend-protocol.js.map +1 -1
- package/dist/composition/probe/candidate-store.js.map +1 -1
- package/dist/composition/probe/corpus.d.ts +4 -2
- package/dist/composition/probe/corpus.d.ts.map +1 -1
- package/dist/composition/probe/corpus.js +20 -9
- package/dist/composition/probe/corpus.js.map +1 -1
- package/dist/composition/probe/dataset.d.ts +17 -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 +5 -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/expression-gaps.js.map +1 -1
- package/dist/composition/probe/falsify.d.ts +14 -3
- package/dist/composition/probe/falsify.d.ts.map +1 -1
- package/dist/composition/probe/falsify.js +16 -27
- package/dist/composition/probe/falsify.js.map +1 -1
- package/dist/composition/probe/fingerprint.js.map +1 -1
- package/dist/composition/probe/fit.d.ts +7 -1
- package/dist/composition/probe/fit.d.ts.map +1 -1
- package/dist/composition/probe/fit.js +48 -23
- 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 +27 -1
- package/dist/composition/probe/generator.d.ts.map +1 -1
- package/dist/composition/probe/generator.js +53 -30
- package/dist/composition/probe/generator.js.map +1 -1
- package/dist/composition/probe/index.d.ts +18 -2
- package/dist/composition/probe/index.d.ts.map +1 -1
- package/dist/composition/probe/index.js +10 -2
- package/dist/composition/probe/index.js.map +1 -1
- package/dist/composition/probe/limits.d.ts +24 -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/metadata.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 +22 -9
- 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 +255 -0
- package/dist/composition/probe/power-law.js.map +1 -0
- package/dist/composition/probe/problem.d.ts +12 -1
- package/dist/composition/probe/problem.d.ts.map +1 -1
- package/dist/composition/probe/problem.js +242 -48
- 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 +6 -1
- package/dist/composition/probe/residual.d.ts.map +1 -1
- package/dist/composition/probe/residual.js +9 -7
- package/dist/composition/probe/residual.js.map +1 -1
- package/dist/composition/probe/run-manifest.js +2 -2
- package/dist/composition/probe/run-manifest.js.map +1 -1
- package/dist/composition/probe/scoring.d.ts +2 -1
- package/dist/composition/probe/scoring.d.ts.map +1 -1
- package/dist/composition/probe/scoring.js +21 -7
- package/dist/composition/probe/scoring.js.map +1 -1
- package/dist/composition/probe/search-budget.js.map +1 -1
- package/dist/composition/probe/serialize.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 +35 -12
- package/dist/composition/probe/study.d.ts.map +1 -1
- package/dist/composition/probe/study.js +241 -184
- package/dist/composition/probe/study.js.map +1 -1
- package/dist/composition/probe/t-tail.d.ts +17 -0
- package/dist/composition/probe/t-tail.d.ts.map +1 -0
- package/dist/composition/probe/t-tail.js +32 -0
- package/dist/composition/probe/t-tail.js.map +1 -0
- package/dist/composition/probe/types.d.ts +6 -1
- package/dist/composition/probe/types.d.ts.map +1 -1
- package/dist/composition/probe/types.js +2 -0
- package/dist/composition/probe/types.js.map +1 -1
- package/dist/composition/proposed-bridges.d.ts +51 -13
- package/dist/composition/proposed-bridges.d.ts.map +1 -1
- package/dist/composition/proposed-bridges.js +110 -58
- package/dist/composition/proposed-bridges.js.map +1 -1
- package/dist/composition/quantities.d.ts +0 -4
- package/dist/composition/quantities.d.ts.map +1 -1
- package/dist/composition/quantities.js +5 -5
- package/dist/composition/quantities.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/quantity.d.ts +18 -2
- package/dist/composition/quantity.d.ts.map +1 -1
- package/dist/composition/quantity.js +35 -6
- package/dist/composition/quantity.js.map +1 -1
- 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 +23 -0
- package/dist/composition/representative-values.js.map +1 -1
- package/dist/composition/retrodiction.d.ts +16 -6
- package/dist/composition/retrodiction.d.ts.map +1 -1
- package/dist/composition/retrodiction.js +36 -10
- package/dist/composition/retrodiction.js.map +1 -1
- package/dist/composition/uncertainty.js.map +1 -1
- package/dist/composition/user-equation.d.ts.map +1 -1
- package/dist/composition/user-equation.js +2 -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/axes-registry.d.ts +8 -5
- package/dist/core/axes-registry.d.ts.map +1 -1
- package/dist/core/axes-registry.js.map +1 -1
- package/dist/core/cell.js.map +1 -1
- 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 +35 -35
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +52 -37
- 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/flux-rules.js +1 -1
- package/dist/core/flux-rules.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 +3 -1
- package/dist/core/json-schema.d.ts.map +1 -1
- package/dist/core/json-schema.js +41 -16
- package/dist/core/json-schema.js.map +1 -1
- package/dist/core/labeled-tensor.d.ts +6 -1
- package/dist/core/labeled-tensor.d.ts.map +1 -1
- package/dist/core/labeled-tensor.js +18 -16
- 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/regime-registry.d.ts +6 -2
- package/dist/core/regime-registry.d.ts.map +1 -1
- package/dist/core/regime-registry.js.map +1 -1
- package/dist/core/regime-rule-install.js.map +1 -1
- package/dist/core/regimes-builtins.js.map +1 -1
- package/dist/core/tensor.d.ts +7 -4
- package/dist/core/tensor.d.ts.map +1 -1
- package/dist/core/tensor.js +64 -8
- package/dist/core/tensor.js.map +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js.map +1 -1
- package/dist/core/universal-index.js.map +1 -1
- package/dist/diff/bridge-ast-gradient.d.ts +4 -5
- package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-ast-gradient.js +10 -6
- package/dist/diff/bridge-ast-gradient.js.map +1 -1
- package/dist/diff/bridge-gradient.d.ts +43 -86
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +40 -109
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/diff/bridge-specs.d.ts +16 -5
- package/dist/diff/bridge-specs.d.ts.map +1 -1
- package/dist/diff/bridge-specs.js +19 -4
- 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 +12 -4
- package/dist/dimensional/ast-builders.d.ts.map +1 -1
- package/dist/dimensional/ast-builders.js +17 -5
- 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.js.map +1 -1
- package/dist/dimensional/bridge-check.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/connection-validators.d.ts +2 -1
- package/dist/dimensional/connection-validators.d.ts.map +1 -1
- package/dist/dimensional/connection-validators.js.map +1 -1
- package/dist/dimensional/connection.js.map +1 -1
- package/dist/dimensional/constant-rows.d.ts.map +1 -1
- package/dist/dimensional/constant-rows.js +17 -13
- package/dist/dimensional/constant-rows.js.map +1 -1
- package/dist/dimensional/constants.d.ts +5 -6
- package/dist/dimensional/constants.d.ts.map +1 -1
- package/dist/dimensional/constants.js +5 -6
- package/dist/dimensional/constants.js.map +1 -1
- package/dist/dimensional/curvature-composite.js.map +1 -1
- package/dist/dimensional/curvature-invariants.js.map +1 -1
- package/dist/dimensional/curvature.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/dimension-spec.d.ts +13 -7
- package/dist/dimensional/dimension-spec.d.ts.map +1 -1
- package/dist/dimensional/dimension-spec.js +49 -23
- package/dist/dimensional/dimension-spec.js.map +1 -1
- package/dist/dimensional/einstein-equation.js.map +1 -1
- package/dist/dimensional/errors.d.ts +4 -2
- package/dist/dimensional/errors.d.ts.map +1 -1
- package/dist/dimensional/errors.js +3 -17
- package/dist/dimensional/errors.js.map +1 -1
- package/dist/dimensional/exact-scale.d.ts +0 -17
- package/dist/dimensional/exact-scale.d.ts.map +1 -1
- package/dist/dimensional/exact-scale.js +8 -8
- package/dist/dimensional/exact-scale.js.map +1 -1
- package/dist/dimensional/field-equation-helpers.js.map +1 -1
- package/dist/dimensional/formula-names.js.map +1 -1
- package/dist/dimensional/fresh-label.js.map +1 -1
- package/dist/dimensional/friedmann-equation.d.ts +3 -3
- package/dist/dimensional/friedmann-equation.js +3 -3
- package/dist/dimensional/friedmann-equation.js.map +1 -1
- package/dist/dimensional/gauge-field.d.ts +2 -3
- package/dist/dimensional/gauge-field.d.ts.map +1 -1
- package/dist/dimensional/gauge-field.js +2 -3
- 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 +45 -12
- package/dist/dimensional/hyphen-names.js.map +1 -1
- package/dist/dimensional/killing-validators.js.map +1 -1
- package/dist/dimensional/klein-gordon-equation.js.map +1 -1
- package/dist/dimensional/metric-validators.d.ts +2 -1
- package/dist/dimensional/metric-validators.d.ts.map +1 -1
- package/dist/dimensional/metric-validators.js.map +1 -1
- 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/natural-units.js.map +1 -1
- package/dist/dimensional/quantity-registry.d.ts +13 -0
- package/dist/dimensional/quantity-registry.d.ts.map +1 -1
- package/dist/dimensional/quantity-registry.js +14 -6
- package/dist/dimensional/quantity-registry.js.map +1 -1
- package/dist/dimensional/rg-flow.js.map +1 -1
- package/dist/dimensional/stress-energy-validators.js.map +1 -1
- 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 +20 -3
- package/dist/dimensional/symbolic-constants.js.map +1 -1
- package/dist/dimensional/tensor-trace.js.map +1 -1
- package/dist/dimensional/tensor.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-convention.d.ts +0 -2
- package/dist/dimensional/unit-convention.d.ts.map +1 -1
- package/dist/dimensional/unit-convention.js +2 -2
- package/dist/dimensional/unit-convention.js.map +1 -1
- package/dist/dimensional/unit-data.d.ts.map +1 -1
- package/dist/dimensional/unit-data.js +11 -7
- package/dist/dimensional/unit-data.js.map +1 -1
- package/dist/dimensional/units.d.ts.map +1 -1
- package/dist/dimensional/units.js +38 -20
- package/dist/dimensional/units.js.map +1 -1
- package/dist/dimensional/validator-registry.js.map +1 -1
- package/dist/dimensional/validator.d.ts +0 -16
- package/dist/dimensional/validator.d.ts.map +1 -1
- package/dist/dimensional/validator.js +65 -29
- package/dist/dimensional/validator.js.map +1 -1
- package/dist/dimensional/weyl-validators.js.map +1 -1
- package/dist/index.d.ts +59 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -24
- package/dist/index.js.map +1 -1
- package/dist/numerical/bianchi-residual.js.map +1 -1
- package/dist/numerical/binding-value.d.ts +11 -6
- package/dist/numerical/binding-value.d.ts.map +1 -1
- package/dist/numerical/binding-value.js +126 -122
- package/dist/numerical/binding-value.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.js.map +1 -1
- package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
- package/dist/numerical/covariant-eikonal.js +36 -13
- package/dist/numerical/covariant-eikonal.js.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.d.ts +20 -0
- package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +9 -5
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/derivative-lowering.js.map +1 -1
- package/dist/numerical/einstein-equation.js.map +1 -1
- package/dist/numerical/engine-registry.js.map +1 -1
- package/dist/numerical/errors.d.ts +7 -3
- package/dist/numerical/errors.d.ts.map +1 -1
- package/dist/numerical/errors.js +5 -8
- package/dist/numerical/errors.js.map +1 -1
- package/dist/numerical/evaluator-uncertainty.d.ts.map +1 -1
- package/dist/numerical/evaluator-uncertainty.js +19 -2
- package/dist/numerical/evaluator-uncertainty.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/formula-contract.d.ts +63 -7
- package/dist/numerical/formula-contract.d.ts.map +1 -1
- package/dist/numerical/formula-contract.js +61 -42
- package/dist/numerical/formula-contract.js.map +1 -1
- package/dist/numerical/formula-dimension.d.ts +8 -7
- package/dist/numerical/formula-dimension.d.ts.map +1 -1
- package/dist/numerical/formula-dimension.js +58 -36
- package/dist/numerical/formula-dimension.js.map +1 -1
- package/dist/numerical/formula-mathts.d.ts.map +1 -1
- package/dist/numerical/formula-mathts.js +5 -2
- package/dist/numerical/formula-mathts.js.map +1 -1
- package/dist/numerical/formula-registry.d.ts +13 -3
- package/dist/numerical/formula-registry.d.ts.map +1 -1
- package/dist/numerical/formula-registry.js +7 -2
- package/dist/numerical/formula-registry.js.map +1 -1
- 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/gl4-integrator.d.ts +28 -27
- package/dist/numerical/gl4-integrator.d.ts.map +1 -1
- package/dist/numerical/gl4-integrator.js +41 -42
- package/dist/numerical/gl4-integrator.js.map +1 -1
- package/dist/numerical/grid-field.js.map +1 -1
- package/dist/numerical/index.js.map +1 -1
- package/dist/numerical/input-validation.d.ts +3 -6
- package/dist/numerical/input-validation.d.ts.map +1 -1
- package/dist/numerical/input-validation.js +4 -8
- package/dist/numerical/input-validation.js.map +1 -1
- package/dist/numerical/killing.d.ts +8 -5
- package/dist/numerical/killing.d.ts.map +1 -1
- package/dist/numerical/killing.js.map +1 -1
- package/dist/numerical/klein-gordon.js.map +1 -1
- package/dist/numerical/kretschmann.js.map +1 -1
- package/dist/numerical/lowering-utils.js.map +1 -1
- package/dist/numerical/lowering.d.ts.map +1 -1
- package/dist/numerical/lowering.js +7 -17
- package/dist/numerical/lowering.js.map +1 -1
- package/dist/numerical/mathts-engine.d.ts.map +1 -1
- package/dist/numerical/mathts-engine.js +16 -25
- 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-ic.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 +9 -2
- 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 +5 -2
- package/dist/numerical/quadrature.d.ts.map +1 -1
- package/dist/numerical/quadrature.js +19 -4
- 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 +25 -19
- package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
- package/dist/numerical/spacetime-metrics.js +180 -286
- 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.js.map +1 -1
- package/dist/numerical/tensor-engine.d.ts +30 -5
- 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/numerical/types.js.map +1 -1
- package/dist/numerical/weyl-lowering.js.map +1 -1
- package/dist/relations/category.js.map +1 -1
- package/dist/relations/composition-table.d.ts +4 -4
- package/dist/relations/composition-table.js +4 -4
- package/dist/relations/composition-table.js.map +1 -1
- package/dist/relations/conventions.js.map +1 -1
- package/dist/relations/domain-regimes.js.map +1 -1
- package/dist/relations/regime-registration.js.map +1 -1
- package/dist/relations/regime-vocabularies.js.map +1 -1
- package/dist/relations/regime.d.ts +28 -8
- package/dist/relations/regime.d.ts.map +1 -1
- package/dist/relations/regime.js +44 -15
- package/dist/relations/regime.js.map +1 -1
- package/dist/relations/types.d.ts +18 -5
- package/dist/relations/types.d.ts.map +1 -1
- package/dist/relations/types.js +5 -3
- package/dist/relations/types.js.map +1 -1
- package/package.json +16 -20
- package/dist/bridges/registry.d.ts +0 -60
- package/dist/bridges/registry.d.ts.map +0 -1
- package/dist/bridges/registry.js +0 -87
- package/dist/bridges/registry.js.map +0 -1
- package/dist/cli/poster-source.d.ts +0 -154
- package/dist/cli/poster-source.d.ts.map +0 -1
- package/dist/cli/poster-source.js +0 -184
- package/dist/cli/poster-source.js.map +0 -1
|
@@ -5,10 +5,60 @@
|
|
|
5
5
|
* that tree is Product A's confrontation ledger and must stay cycle-free
|
|
6
6
|
* from probe.
|
|
7
7
|
*
|
|
8
|
+
* A cell is a finite number or a non-empty string in the strict decimal
|
|
9
|
+
* grammar (`1`, `-0.5`, `.5`, `2.`, `1e-3`). Nothing is coerced: an empty
|
|
10
|
+
* cell, `null`, `true`, `false`, a list and `"0x10"` are refused by column
|
|
11
|
+
* and row, with {@link DatasetError}. `Number(v)` once read all of those as
|
|
12
|
+
* 0, 1 or 16, which also defeated the missing-observation guard of the
|
|
13
|
+
* declared-limit check (a missing observation scored as 0).
|
|
14
|
+
*
|
|
8
15
|
* @internal
|
|
9
16
|
*/
|
|
10
17
|
import { readFileSync } from 'node:fs';
|
|
18
|
+
import { readJsonFile } from '../../core/data-file.js';
|
|
11
19
|
import { SCHEMA_VERSION } from './types.js';
|
|
20
|
+
/** A dataset file or object that is not a dataset: the message names the row and the column. @internal */
|
|
21
|
+
export class DatasetError extends Error {
|
|
22
|
+
constructor(message) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = 'DatasetError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** The strict decimal grammar a string cell must match: sign, digits with an optional fraction, an optional exponent. */
|
|
28
|
+
const DECIMAL = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
|
|
29
|
+
/** What a JSON value is, in the words a file author would use. */
|
|
30
|
+
function kindOf(v) {
|
|
31
|
+
if (v === null)
|
|
32
|
+
return 'null';
|
|
33
|
+
if (Array.isArray(v))
|
|
34
|
+
return 'a list';
|
|
35
|
+
if (typeof v === 'boolean')
|
|
36
|
+
return String(v);
|
|
37
|
+
if (typeof v === 'string')
|
|
38
|
+
return `'${v}'`;
|
|
39
|
+
return typeof v === 'object' ? 'an object' : typeof v;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A cell as a number: a finite number, or a non-empty string in the strict
|
|
43
|
+
* decimal grammar. Anything else is refused at `where` (the dataset, row and
|
|
44
|
+
* column). @internal
|
|
45
|
+
*/
|
|
46
|
+
export function readDatasetNumber(v, where) {
|
|
47
|
+
if (typeof v === 'number') {
|
|
48
|
+
if (!Number.isFinite(v))
|
|
49
|
+
throw new DatasetError(`${where}: ${v} is not a finite number`);
|
|
50
|
+
return v;
|
|
51
|
+
}
|
|
52
|
+
if (typeof v === 'string') {
|
|
53
|
+
if (v.trim() === '')
|
|
54
|
+
throw new DatasetError(`${where}: an empty cell is not a number`);
|
|
55
|
+
const n = DECIMAL.test(v.trim()) ? Number(v.trim()) : NaN;
|
|
56
|
+
if (!Number.isFinite(n))
|
|
57
|
+
throw new DatasetError(`${where}: ${kindOf(v)} is not a finite decimal number`);
|
|
58
|
+
return n;
|
|
59
|
+
}
|
|
60
|
+
throw new DatasetError(`${where}: ${kindOf(v)} is not a number`);
|
|
61
|
+
}
|
|
12
62
|
/** Build an in-memory dataset. @internal */
|
|
13
63
|
export function datasetFromRows(rows, observable, role, id = 'inline', sigma) {
|
|
14
64
|
return { id, role, rows, observable, ...(sigma !== undefined ? { sigma } : {}), schemaVersion: SCHEMA_VERSION };
|
|
@@ -16,33 +66,29 @@ export function datasetFromRows(rows, observable, role, id = 'inline', sigma) {
|
|
|
16
66
|
/** Coerce unknown JSON into a ProbeDataset. @internal */
|
|
17
67
|
export function asDatasetSafe(raw, fallbackId, fallbackRole) {
|
|
18
68
|
if (!raw || typeof raw !== 'object') {
|
|
19
|
-
throw new
|
|
69
|
+
throw new DatasetError(`dataset JSON is not an object (${fallbackId})`);
|
|
20
70
|
}
|
|
21
71
|
const obj = raw;
|
|
22
72
|
if (!Array.isArray(obj.rows)) {
|
|
23
|
-
throw new
|
|
73
|
+
throw new DatasetError(`dataset at ${fallbackId} is missing rows[]`);
|
|
24
74
|
}
|
|
25
75
|
if (typeof obj.observable !== 'string' || obj.observable.length === 0) {
|
|
26
|
-
throw new
|
|
76
|
+
throw new DatasetError(`dataset at ${fallbackId} is missing observable`);
|
|
27
77
|
}
|
|
28
78
|
const role = (typeof obj.role === 'string' ? obj.role : fallbackRole);
|
|
29
79
|
if (role !== 'exploratory-fit' &&
|
|
30
80
|
role !== 'validation-holdout' &&
|
|
31
81
|
role !== 'external-replication' &&
|
|
32
82
|
role !== 'falsification-only') {
|
|
33
|
-
throw new
|
|
83
|
+
throw new DatasetError(`dataset at ${fallbackId} has invalid role '${String(obj.role)}'`);
|
|
34
84
|
}
|
|
35
85
|
const rows = obj.rows.map((row, i) => {
|
|
36
86
|
if (!row || typeof row !== 'object' || Array.isArray(row)) {
|
|
37
|
-
throw new
|
|
87
|
+
throw new DatasetError(`dataset ${fallbackId} row ${i} is not an object`);
|
|
38
88
|
}
|
|
39
89
|
const out = {};
|
|
40
90
|
for (const [k, v] of Object.entries(row)) {
|
|
41
|
-
|
|
42
|
-
if (!Number.isFinite(n)) {
|
|
43
|
-
throw new Error(`dataset ${fallbackId} row ${i} column ${k}: not a finite number`);
|
|
44
|
-
}
|
|
45
|
-
out[k] = n;
|
|
91
|
+
out[k] = readDatasetNumber(v, `dataset ${fallbackId} row ${i} column ${k}`);
|
|
46
92
|
}
|
|
47
93
|
return out;
|
|
48
94
|
});
|
|
@@ -57,12 +103,12 @@ export function asDatasetSafe(raw, fallbackId, fallbackRole) {
|
|
|
57
103
|
}
|
|
58
104
|
/** Load a single ProbeDataset JSON object. @internal */
|
|
59
105
|
export function loadDatasetFromJson(path, fallbackRole) {
|
|
60
|
-
const raw =
|
|
106
|
+
const raw = readJsonFile(path);
|
|
61
107
|
return asDatasetSafe(raw, path, fallbackRole);
|
|
62
108
|
}
|
|
63
109
|
/** Load `{ exploratory, holdout }` JSON. @internal */
|
|
64
110
|
export function loadSplitDatasetsFromJson(path) {
|
|
65
|
-
const raw =
|
|
111
|
+
const raw = readJsonFile(path);
|
|
66
112
|
if (raw.exploratory || raw.holdout) {
|
|
67
113
|
return {
|
|
68
114
|
exploratory: raw.exploratory
|
|
@@ -78,7 +124,35 @@ export function loadSplitDatasetsFromJson(path) {
|
|
|
78
124
|
exploratory: asDatasetSafe({ ...raw.observations, role: 'exploratory-fit' }, `${path}#observations`, 'exploratory-fit'),
|
|
79
125
|
};
|
|
80
126
|
}
|
|
81
|
-
throw new
|
|
127
|
+
throw new DatasetError(`JSON at ${path} needs exploratory/holdout or observations`);
|
|
128
|
+
}
|
|
129
|
+
/** The header and the data lines of a CSV file; the file needs both. */
|
|
130
|
+
function csvLines(path) {
|
|
131
|
+
const text = readFileSync(path, 'utf8').trim();
|
|
132
|
+
const lines = text.split(/\r?\n/).filter((l) => l.length > 0);
|
|
133
|
+
if (lines.length < 2) {
|
|
134
|
+
throw new DatasetError(`CSV dataset at ${path} needs a header and at least one row`);
|
|
135
|
+
}
|
|
136
|
+
const headers = lines[0].split(',').map((h) => h.trim());
|
|
137
|
+
return { headers, lines };
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* One CSV data line as a row of numbers. A line with fewer cells than the
|
|
141
|
+
* header is refused by the first column it lacks; `skip` names the header
|
|
142
|
+
* column (if any) that is not a number column. `line` is the 1-based line
|
|
143
|
+
* number of the file, so a message points at the file.
|
|
144
|
+
*/
|
|
145
|
+
function csvRow(cells, headers, line, path, skip) {
|
|
146
|
+
if (cells.length < headers.length) {
|
|
147
|
+
throw new DatasetError(`CSV ${path} row ${line} has ${cells.length} cell(s); the header has ${headers.length} (column ${headers[cells.length]} is missing)`);
|
|
148
|
+
}
|
|
149
|
+
const row = {};
|
|
150
|
+
for (let c = 0; c < headers.length; c++) {
|
|
151
|
+
if (c === skip)
|
|
152
|
+
continue;
|
|
153
|
+
row[headers[c]] = readDatasetNumber(cells[c], `CSV ${path} row ${line} column ${headers[c]}`);
|
|
154
|
+
}
|
|
155
|
+
return row;
|
|
82
156
|
}
|
|
83
157
|
/**
|
|
84
158
|
* Minimal CSV: first row headers, remaining rows numeric values.
|
|
@@ -88,66 +162,37 @@ export function loadSplitDatasetsFromJson(path) {
|
|
|
88
162
|
* @internal
|
|
89
163
|
*/
|
|
90
164
|
export function loadDatasetFromCsv(path, observable, role, id = path) {
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
if (lines.length < 2) {
|
|
94
|
-
throw new Error(`CSV dataset at ${path} needs a header and at least one row`);
|
|
95
|
-
}
|
|
96
|
-
const headers = lines[0].split(',').map((h) => h.trim());
|
|
165
|
+
const { headers, lines } = csvLines(path);
|
|
166
|
+
const splitIdx = headers.indexOf('split');
|
|
97
167
|
const rows = [];
|
|
98
168
|
for (let i = 1; i < lines.length; i++) {
|
|
99
169
|
const cells = lines[i].split(',').map((c) => c.trim());
|
|
100
|
-
|
|
101
|
-
for (let c = 0; c < headers.length; c++) {
|
|
102
|
-
const h = headers[c];
|
|
103
|
-
if (h === 'split')
|
|
104
|
-
continue;
|
|
105
|
-
const n = Number(cells[c] ?? '');
|
|
106
|
-
if (!Number.isFinite(n)) {
|
|
107
|
-
throw new Error(`CSV ${path} row ${i + 1} column ${h}: not a finite number`);
|
|
108
|
-
}
|
|
109
|
-
row[h] = n;
|
|
110
|
-
}
|
|
111
|
-
rows.push(row);
|
|
170
|
+
rows.push(csvRow(cells, headers, i + 1, path, splitIdx));
|
|
112
171
|
}
|
|
113
172
|
if (!(observable in (rows[0] ?? {}))) {
|
|
114
|
-
throw new
|
|
173
|
+
throw new DatasetError(`CSV ${path} is missing observable column '${observable}'`);
|
|
115
174
|
}
|
|
116
175
|
return datasetFromRows(rows, observable, role, id);
|
|
117
176
|
}
|
|
118
177
|
/** Partition a mixed-split CSV (uses a `split` column). @internal */
|
|
119
178
|
export function loadSplitCsv(path, observable) {
|
|
120
|
-
const
|
|
121
|
-
const lines = text.split(/\r?\n/).filter((l) => l.length > 0);
|
|
122
|
-
if (lines.length < 2) {
|
|
123
|
-
throw new Error(`CSV dataset at ${path} needs a header and at least one row`);
|
|
124
|
-
}
|
|
125
|
-
const headers = lines[0].split(',').map((h) => h.trim());
|
|
179
|
+
const { headers, lines } = csvLines(path);
|
|
126
180
|
const splitIdx = headers.indexOf('split');
|
|
127
181
|
if (splitIdx < 0) {
|
|
128
|
-
throw new
|
|
182
|
+
throw new DatasetError(`CSV ${path} has no split column`);
|
|
129
183
|
}
|
|
130
184
|
const exploratoryRows = [];
|
|
131
185
|
const holdoutRows = [];
|
|
132
186
|
for (let i = 1; i < lines.length; i++) {
|
|
133
187
|
const cells = lines[i].split(',').map((c) => c.trim());
|
|
134
|
-
const row =
|
|
135
|
-
for (let c = 0; c < headers.length; c++) {
|
|
136
|
-
if (c === splitIdx)
|
|
137
|
-
continue;
|
|
138
|
-
const n = Number(cells[c] ?? '');
|
|
139
|
-
if (!Number.isFinite(n)) {
|
|
140
|
-
throw new Error(`CSV ${path} row ${i + 1} column ${headers[c]}: not a finite number`);
|
|
141
|
-
}
|
|
142
|
-
row[headers[c]] = n;
|
|
143
|
-
}
|
|
188
|
+
const row = csvRow(cells, headers, i + 1, path, splitIdx);
|
|
144
189
|
const split = cells[splitIdx];
|
|
145
190
|
if (split === 'holdout' || split === 'blind')
|
|
146
191
|
holdoutRows.push(row);
|
|
147
192
|
else if (split === 'exploratory')
|
|
148
193
|
exploratoryRows.push(row);
|
|
149
194
|
else
|
|
150
|
-
throw new
|
|
195
|
+
throw new DatasetError(`CSV ${path} row ${i + 1} has invalid split '${split}'`);
|
|
151
196
|
}
|
|
152
197
|
return {
|
|
153
198
|
exploratory: datasetFromRows(exploratoryRows, observable, 'exploratory-fit', `${path}#exploratory`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset.js","sourceRoot":"","sources":["../../../src/composition/probe/dataset.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,UAAU,eAAe,CAC7B,IAA+B,EAC/B,UAAkB,EAClB,IAAiB,EACjB,EAAE,GAAG,QAAQ,EACb,KAAc;IAEd,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;AAClH,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAAC,GAAY,EAAE,UAAkB,EAAE,YAA0B;IACxF,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,GAAG,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,GAAG,GAAG,GAOX,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,cAAc,UAAU,oBAAoB,CAAC,CAAC;IAChE,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,cAAc,UAAU,wBAAwB,CAAC,CAAC;IACpE,CAAC;IACD,M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AAY,CAAC,OAAO,IAAI,sBAAsB,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM,eAAe,GAAqB,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAqB,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,OAAO;YAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAC/D,IAAI,KAAK,KAAK,aAAa;YAAE,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;YACvD,MAAM,IAAI,YAAY,CAAC,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,uBAAuB,KAAK,GAAG,CAAC,CAAC;IACvF,CAAC;IACD,OAAO;QACL,WAAW,EAAE,eAAe,CAAC,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAI,cAAc,CAAC;QACnG,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,IAAI,UAAU,CAAC;KAC3F,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Observation adapters for Product B.\n *\n * In-memory / JSON / CSV. Does not live in `src/bridges/observations/` —\n * that tree is Product A's confrontation ledger and must stay cycle-free\n * from probe.\n *\n * A cell is a finite number or a non-empty string in the strict decimal\n * grammar (`1`, `-0.5`, `.5`, `2.`, `1e-3`). Nothing is coerced: an empty\n * cell, `null`, `true`, `false`, a list and `\"0x10\"` are refused by column\n * and row, with {@link DatasetError}. `Number(v)` once read all of those as\n * 0, 1 or 16, which also defeated the missing-observation guard of the\n * declared-limit check (a missing observation scored as 0).\n *\n * @internal\n */\n\nimport { readFileSync } from 'node:fs';\nimport { readJsonFile } from '../../core/data-file.js';\nimport type { DatasetRole, ObservationRow, ProbeDataset } from './types.js';\nimport { SCHEMA_VERSION } from './types.js';\n\n/** A dataset file or object that is not a dataset: the message names the row and the column. @internal */\nexport class DatasetError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'DatasetError';\n }\n}\n\n/** The strict decimal grammar a string cell must match: sign, digits with an optional fraction, an optional exponent. */\nconst DECIMAL = /^[+-]?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/;\n\n/** What a JSON value is, in the words a file author would use. */\nfunction kindOf(v: unknown): string {\n if (v === null) return 'null';\n if (Array.isArray(v)) return 'a list';\n if (typeof v === 'boolean') return String(v);\n if (typeof v === 'string') return `'${v}'`;\n return typeof v === 'object' ? 'an object' : typeof v;\n}\n\n/**\n * A cell as a number: a finite number, or a non-empty string in the strict\n * decimal grammar. Anything else is refused at `where` (the dataset, row and\n * column). @internal\n */\nexport function readDatasetNumber(v: unknown, where: string): number {\n if (typeof v === 'number') {\n if (!Number.isFinite(v)) throw new DatasetError(`${where}: ${v} is not a finite number`);\n return v;\n }\n if (typeof v === 'string') {\n if (v.trim() === '') throw new DatasetError(`${where}: an empty cell is not a number`);\n const n = DECIMAL.test(v.trim()) ? Number(v.trim()) : NaN;\n if (!Number.isFinite(n)) throw new DatasetError(`${where}: ${kindOf(v)} is not a finite decimal number`);\n return n;\n }\n throw new DatasetError(`${where}: ${kindOf(v)} is not a number`);\n}\n\n/** Build an in-memory dataset. @internal */\nexport function datasetFromRows(\n rows: readonly ObservationRow[],\n observable: string,\n role: DatasetRole,\n id = 'inline',\n sigma?: number,\n): ProbeDataset {\n return { id, role, rows, observable, ...(sigma !== undefined ? { sigma } : {}), schemaVersion: SCHEMA_VERSION };\n}\n\n/** Coerce unknown JSON into a ProbeDataset. @internal */\nexport function asDatasetSafe(raw: unknown, fallbackId: string, fallbackRole?: DatasetRole): ProbeDataset {\n if (!raw || typeof raw !== 'object') {\n throw new DatasetError(`dataset JSON is not an object (${fallbackId})`);\n }\n const obj = raw as {\n id?: unknown;\n role?: unknown;\n rows?: unknown;\n observable?: unknown;\n sigma?: unknown;\n schemaVersion?: unknown;\n };\n if (!Array.isArray(obj.rows)) {\n throw new DatasetError(`dataset at ${fallbackId} is missing rows[]`);\n }\n if (typeof obj.observable !== 'string' || obj.observable.length === 0) {\n throw new DatasetError(`dataset at ${fallbackId} is missing observable`);\n }\n const role = (typeof obj.role === 'string' ? obj.role : fallbackRole) as DatasetRole | undefined;\n if (\n role !== 'exploratory-fit' &&\n role !== 'validation-holdout' &&\n role !== 'external-replication' &&\n role !== 'falsification-only'\n ) {\n throw new DatasetError(`dataset at ${fallbackId} has invalid role '${String(obj.role)}'`);\n }\n const rows: ObservationRow[] = obj.rows.map((row, i) => {\n if (!row || typeof row !== 'object' || Array.isArray(row)) {\n throw new DatasetError(`dataset ${fallbackId} row ${i} is not an object`);\n }\n const out: Record<string, number> = {};\n for (const [k, v] of Object.entries(row as Record<string, unknown>)) {\n out[k] = readDatasetNumber(v, `dataset ${fallbackId} row ${i} column ${k}`);\n }\n return out;\n });\n return {\n id: typeof obj.id === 'string' ? obj.id : fallbackId,\n role,\n rows,\n observable: obj.observable,\n ...(typeof obj.sigma === 'number' && Number.isFinite(obj.sigma) ? { sigma: obj.sigma } : {}),\n schemaVersion: typeof obj.schemaVersion === 'string' ? obj.schemaVersion : SCHEMA_VERSION,\n };\n}\n\n/** Load a single ProbeDataset JSON object. @internal */\nexport function loadDatasetFromJson(path: string, fallbackRole?: DatasetRole): ProbeDataset {\n const raw = readJsonFile(path);\n return asDatasetSafe(raw, path, fallbackRole);\n}\n\nexport interface SplitFileDatasets {\n readonly exploratory?: ProbeDataset;\n readonly holdout?: ProbeDataset;\n}\n\n/** Load `{ exploratory, holdout }` JSON. @internal */\nexport function loadSplitDatasetsFromJson(path: string): SplitFileDatasets {\n const raw = readJsonFile(path) as {\n exploratory?: unknown;\n holdout?: unknown;\n observations?: unknown;\n };\n if (raw.exploratory || raw.holdout) {\n return {\n exploratory: raw.exploratory\n ? asDatasetSafe(raw.exploratory, `${path}#exploratory`, 'exploratory-fit')\n : undefined,\n holdout: raw.holdout\n ? asDatasetSafe(raw.holdout, `${path}#holdout`, 'validation-holdout')\n : undefined,\n };\n }\n if (raw.observations) {\n return {\n exploratory: asDatasetSafe(\n { ...(raw.observations as object), role: 'exploratory-fit' },\n `${path}#observations`,\n 'exploratory-fit',\n ),\n };\n }\n throw new DatasetError(`JSON at ${path} needs exploratory/holdout or observations`);\n}\n\n/** The header and the data lines of a CSV file; the file needs both. */\nfunction csvLines(path: string): { headers: string[]; lines: string[] } {\n const text = readFileSync(path, 'utf8').trim();\n const lines = text.split(/\\r?\\n/).filter((l) => l.length > 0);\n if (lines.length < 2) {\n throw new DatasetError(`CSV dataset at ${path} needs a header and at least one row`);\n }\n const headers = lines[0]!.split(',').map((h) => h.trim());\n return { headers, lines };\n}\n\n/**\n * One CSV data line as a row of numbers. A line with fewer cells than the\n * header is refused by the first column it lacks; `skip` names the header\n * column (if any) that is not a number column. `line` is the 1-based line\n * number of the file, so a message points at the file.\n */\nfunction csvRow(cells: readonly string[], headers: readonly string[], line: number, path: string, skip: number): Record<string, number> {\n if (cells.length < headers.length) {\n throw new DatasetError(\n `CSV ${path} row ${line} has ${cells.length} cell(s); the header has ${headers.length} (column ${headers[cells.length]} is missing)`,\n );\n }\n const row: Record<string, number> = {};\n for (let c = 0; c < headers.length; c++) {\n if (c === skip) continue;\n row[headers[c]!] = readDatasetNumber(cells[c], `CSV ${path} row ${line} column ${headers[c]}`);\n }\n return row;\n}\n\n/**\n * Minimal CSV: first row headers, remaining rows numeric values.\n * Optional `split` column (`exploratory`/`holdout`/`blind`).\n * `blind` rows are withheld with holdout data, never fit.\n *\n * @internal\n */\nexport function loadDatasetFromCsv(\n path: string,\n observable: string,\n role: DatasetRole,\n id = path,\n): ProbeDataset {\n const { headers, lines } = csvLines(path);\n const splitIdx = headers.indexOf('split');\n const rows: ObservationRow[] = [];\n for (let i = 1; i < lines.length; i++) {\n const cells = lines[i]!.split(',').map((c) => c.trim());\n rows.push(csvRow(cells, headers, i + 1, path, splitIdx));\n }\n if (!(observable in (rows[0] ?? {}))) {\n throw new DatasetError(`CSV ${path} is missing observable column '${observable}'`);\n }\n return datasetFromRows(rows, observable, role, id);\n}\n\n/** Partition a mixed-split CSV (uses a `split` column). @internal */\nexport function loadSplitCsv(\n path: string,\n observable: string,\n): { exploratory: ProbeDataset; holdout: ProbeDataset } {\n const { headers, lines } = csvLines(path);\n const splitIdx = headers.indexOf('split');\n if (splitIdx < 0) {\n throw new DatasetError(`CSV ${path} has no split column`);\n }\n const exploratoryRows: ObservationRow[] = [];\n const holdoutRows: ObservationRow[] = [];\n for (let i = 1; i < lines.length; i++) {\n const cells = lines[i]!.split(',').map((c) => c.trim());\n const row = csvRow(cells, headers, i + 1, path, splitIdx);\n const split = cells[splitIdx];\n if (split === 'holdout' || split === 'blind') holdoutRows.push(row);\n else if (split === 'exploratory') exploratoryRows.push(row);\n else throw new DatasetError(`CSV ${path} row ${i + 1} has invalid split '${split}'`);\n }\n return {\n exploratory: datasetFromRows(exploratoryRows, observable, 'exploratory-fit', `${path}#exploratory`),\n holdout: datasetFromRows(holdoutRows, observable, 'validation-holdout', `${path}#holdout`),\n };\n}\n"]}
|
|
@@ -19,7 +19,11 @@ export interface DesignBounds {
|
|
|
19
19
|
}>>[];
|
|
20
20
|
readonly sigma?: number;
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Coerce unknown JSON into {@link DesignBounds}. Every bound is a finite
|
|
24
|
+
* number and `steps` a positive integer; a value of another kind is refused,
|
|
25
|
+
* naming the field and what was found. @internal
|
|
26
|
+
*/
|
|
23
27
|
export declare function parseDesignBounds(raw: unknown, source: string): DesignBounds;
|
|
24
28
|
export interface DesignSuggestion {
|
|
25
29
|
readonly point: Readonly<Record<string, number>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiment-design.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/experiment-design.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3F,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,EAAE,CAAC;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"experiment-design.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/experiment-design.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3F,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,EAAE,CAAC;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAyBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CA4D5E;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAeD,6FAA6F;AAC7F,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,QAAQ,EACZ,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,YAAY,GACnB,gBAAgB,CAkElB"}
|
|
@@ -7,7 +7,36 @@
|
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
import { evalExpr } from '../expr-eval.js';
|
|
10
|
-
/**
|
|
10
|
+
/** What a JSON value is, in the words a file author would use. */
|
|
11
|
+
function kindOf(v) {
|
|
12
|
+
if (v === null)
|
|
13
|
+
return 'null';
|
|
14
|
+
if (Array.isArray(v))
|
|
15
|
+
return 'a list';
|
|
16
|
+
if (typeof v === 'string')
|
|
17
|
+
return 'text';
|
|
18
|
+
if (typeof v === 'number')
|
|
19
|
+
return Number.isFinite(v) ? 'a number' : String(v);
|
|
20
|
+
if (typeof v === 'boolean')
|
|
21
|
+
return 'true or false';
|
|
22
|
+
return typeof v === 'object' ? 'an object' : typeof v;
|
|
23
|
+
}
|
|
24
|
+
/** A finite number, or null: nothing is coerced (`null`, `""` and `"0"` once read as 0). */
|
|
25
|
+
const finite = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : null);
|
|
26
|
+
/** `{min, max}` as two finite numbers, located by `where` in any refusal. */
|
|
27
|
+
function readRange(spec, where) {
|
|
28
|
+
const min = finite(spec.min);
|
|
29
|
+
const max = finite(spec.max);
|
|
30
|
+
if (min === null || max === null) {
|
|
31
|
+
throw new Error(`${where} needs finite min/max numbers (found ${kindOf(spec.min)} and ${kindOf(spec.max)})`);
|
|
32
|
+
}
|
|
33
|
+
return { min, max };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Coerce unknown JSON into {@link DesignBounds}. Every bound is a finite
|
|
37
|
+
* number and `steps` a positive integer; a value of another kind is refused,
|
|
38
|
+
* naming the field and what was found. @internal
|
|
39
|
+
*/
|
|
11
40
|
export function parseDesignBounds(raw, source) {
|
|
12
41
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
13
42
|
throw new Error(`design bounds at ${source} is not an object`);
|
|
@@ -21,22 +50,18 @@ export function parseDesignBounds(raw, source) {
|
|
|
21
50
|
if (!spec || typeof spec !== 'object' || Array.isArray(spec)) {
|
|
22
51
|
throw new Error(`design bounds at ${source}: variables.${name} is not an object`);
|
|
23
52
|
}
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
throw new Error(`design bounds at ${source}: variables.${name} needs finite min/max`);
|
|
29
|
-
}
|
|
30
|
-
if (minN > maxN) {
|
|
31
|
-
throw new Error(`design bounds at ${source}: variables.${name} has min > max`);
|
|
53
|
+
const where = `design bounds at ${source}: variables.${name}`;
|
|
54
|
+
const { min, max } = readRange(spec, where);
|
|
55
|
+
if (min > max) {
|
|
56
|
+
throw new Error(`${where} has min > max`);
|
|
32
57
|
}
|
|
33
|
-
const entry = { min
|
|
58
|
+
const entry = { min, max };
|
|
59
|
+
const { steps } = spec;
|
|
34
60
|
if (steps !== undefined) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
throw new Error(`design bounds at ${source}: variables.${name}.steps must be positive`);
|
|
61
|
+
if (typeof steps !== 'number' || !Number.isInteger(steps) || steps < 1) {
|
|
62
|
+
throw new Error(`${where}.steps must be a positive integer (found ${typeof steps === 'number' ? steps : kindOf(steps)})`);
|
|
38
63
|
}
|
|
39
|
-
entry.steps =
|
|
64
|
+
entry.steps = steps;
|
|
40
65
|
}
|
|
41
66
|
variables[name] = entry;
|
|
42
67
|
}
|
|
@@ -54,23 +79,18 @@ export function parseDesignBounds(raw, source) {
|
|
|
54
79
|
if (!r || typeof r !== 'object' || Array.isArray(r)) {
|
|
55
80
|
throw new Error(`design bounds at ${source}: forbidden[${i}].${k} is not an object`);
|
|
56
81
|
}
|
|
57
|
-
|
|
58
|
-
const minN = typeof min === 'number' ? min : Number(min);
|
|
59
|
-
const maxN = typeof max === 'number' ? max : Number(max);
|
|
60
|
-
if (!Number.isFinite(minN) || !Number.isFinite(maxN)) {
|
|
61
|
-
throw new Error(`design bounds at ${source}: forbidden[${i}].${k} needs finite min/max`);
|
|
62
|
-
}
|
|
63
|
-
out[k] = { min: minN, max: maxN };
|
|
82
|
+
out[k] = readRange(r, `design bounds at ${source}: forbidden[${i}].${k}`);
|
|
64
83
|
}
|
|
65
84
|
return out;
|
|
66
85
|
});
|
|
67
86
|
}
|
|
68
87
|
let sigma;
|
|
69
88
|
if (obj.sigma !== undefined) {
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
throw new Error(`design bounds at ${source}: sigma must be a positive number`);
|
|
89
|
+
const s = finite(obj.sigma);
|
|
90
|
+
if (s === null || s <= 0) {
|
|
91
|
+
throw new Error(`design bounds at ${source}: sigma must be a positive number (found ${s === null ? kindOf(obj.sigma) : s})`);
|
|
73
92
|
}
|
|
93
|
+
sigma = s;
|
|
74
94
|
}
|
|
75
95
|
return { variables, ...(forbidden ? { forbidden } : {}), ...(sigma !== undefined ? { sigma } : {}) };
|
|
76
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiment-design.js","sourceRoot":"","sources":["../../../src/composition/probe/experiment-design.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQ3C,+DAA+D;AAC/D,MAAM,UAAU,iBAAiB,CAAC,GAAY,EAAE,MAAc;IAC5D,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,mBAAmB,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,GAAG,GAAG,GAIX,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACxF,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,uBAAuB,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,SAAS,GAAiE,EAAE,CAAC;IACnF,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAoC,CAAC,EAAE,CAAC;QACpF,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,eAAe,IAAI,mBAAmB,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAyD,CAAC;QACtF,MAAM,IAAI,GAAG,OAA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CAAC;AACd,CAAC","sourcesContent":["/**\n * Cheap experiment-design suggestions for two competing hypotheses.\n *\n * Grid-search max |H1−H2|/σ under declared bounds. Never recommend a\n * forbidden region.\n *\n * @internal\n */\n\nimport type { ExprNode } from '../../dimensional/ast-types.js';\nimport { evalExpr } from '../expr-eval.js';\n\nexport interface DesignBounds {\n readonly variables: Readonly<Record<string, { min: number; max: number; steps?: number }>>;\n readonly forbidden?: readonly Readonly<Record<string, { min: number; max: number }>>[];\n readonly sigma?: number;\n}\n\n/** What a JSON value is, in the words a file author would use. */\nfunction kindOf(v: unknown): string {\n if (v === null) return 'null';\n if (Array.isArray(v)) return 'a list';\n if (typeof v === 'string') return 'text';\n if (typeof v === 'number') return Number.isFinite(v) ? 'a number' : String(v);\n if (typeof v === 'boolean') return 'true or false';\n return typeof v === 'object' ? 'an object' : typeof v;\n}\n\n/** A finite number, or null: nothing is coerced (`null`, `\"\"` and `\"0\"` once read as 0). */\nconst finite = (v: unknown): number | null => (typeof v === 'number' && Number.isFinite(v) ? v : null);\n\n/** `{min, max}` as two finite numbers, located by `where` in any refusal. */\nfunction readRange(spec: Record<string, unknown>, where: string): { min: number; max: number } {\n const min = finite(spec.min);\n const max = finite(spec.max);\n if (min === null || max === null) {\n throw new Error(`${where} needs finite min/max numbers (found ${kindOf(spec.min)} and ${kindOf(spec.max)})`);\n }\n return { min, max };\n}\n\n/**\n * Coerce unknown JSON into {@link DesignBounds}. Every bound is a finite\n * number and `steps` a positive integer; a value of another kind is refused,\n * naming the field and what was found. @internal\n */\nexport function parseDesignBounds(raw: unknown, source: string): DesignBounds {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {\n throw new Error(`design bounds at ${source} is not an object`);\n }\n const obj = raw as {\n variables?: unknown;\n forbidden?: unknown;\n sigma?: unknown;\n };\n if (!obj.variables || typeof obj.variables !== 'object' || Array.isArray(obj.variables)) {\n throw new Error(`design bounds at ${source} is missing variables`);\n }\n const variables: Record<string, { min: number; max: number; steps?: number }> = {};\n for (const [name, spec] of Object.entries(obj.variables as Record<string, unknown>)) {\n if (!spec || typeof spec !== 'object' || Array.isArray(spec)) {\n throw new Error(`design bounds at ${source}: variables.${name} is not an object`);\n }\n const where = `design bounds at ${source}: variables.${name}`;\n const { min, max } = readRange(spec as Record<string, unknown>, where);\n if (min > max) {\n throw new Error(`${where} has min > max`);\n }\n const entry: { min: number; max: number; steps?: number } = { min, max };\n const { steps } = spec as { steps?: unknown };\n if (steps !== undefined) {\n if (typeof steps !== 'number' || !Number.isInteger(steps) || steps < 1) {\n throw new Error(`${where}.steps must be a positive integer (found ${typeof steps === 'number' ? steps : kindOf(steps)})`);\n }\n entry.steps = steps;\n }\n variables[name] = entry;\n }\n let forbidden: DesignBounds['forbidden'];\n if (obj.forbidden !== undefined) {\n if (!Array.isArray(obj.forbidden)) {\n throw new Error(`design bounds at ${source}: forbidden must be an array`);\n }\n forbidden = obj.forbidden.map((region, i) => {\n if (!region || typeof region !== 'object' || Array.isArray(region)) {\n throw new Error(`design bounds at ${source}: forbidden[${i}] is not an object`);\n }\n const out: Record<string, { min: number; max: number }> = {};\n for (const [k, r] of Object.entries(region as Record<string, unknown>)) {\n if (!r || typeof r !== 'object' || Array.isArray(r)) {\n throw new Error(`design bounds at ${source}: forbidden[${i}].${k} is not an object`);\n }\n out[k] = readRange(r as Record<string, unknown>, `design bounds at ${source}: forbidden[${i}].${k}`);\n }\n return out;\n });\n }\n let sigma: number | undefined;\n if (obj.sigma !== undefined) {\n const s = finite(obj.sigma);\n if (s === null || s <= 0) {\n throw new Error(`design bounds at ${source}: sigma must be a positive number (found ${s === null ? kindOf(obj.sigma) : s})`);\n }\n sigma = s;\n }\n return { variables, ...(forbidden ? { forbidden } : {}), ...(sigma !== undefined ? { sigma } : {}) };\n}\n\nexport interface DesignSuggestion {\n readonly point: Readonly<Record<string, number>>;\n readonly discrimination: number;\n readonly h1: number;\n readonly h2: number;\n readonly abstained?: boolean;\n readonly reason?: string;\n}\n\nfunction inForbidden(\n point: Record<string, number>,\n forbidden: readonly Readonly<Record<string, { min: number; max: number }>>[] | undefined,\n): boolean {\n if (!forbidden) return false;\n return forbidden.some((region) =>\n Object.entries(region).every(([k, r]) => {\n const v = point[k];\n return v !== undefined && v >= r.min && v <= r.max;\n }),\n );\n}\n\n/** Suggest the grid point that maximises |H1−H2|/σ, skipping forbidden regions. @internal */\nexport function suggestDiscriminatingPoint(\n h1: ExprNode,\n h2: ExprNode,\n bounds: DesignBounds,\n): DesignSuggestion {\n const names = Object.keys(bounds.variables);\n if (names.length === 0) {\n return {\n point: {},\n discrimination: 0,\n h1: NaN,\n h2: NaN,\n abstained: true,\n reason: 'no free variables in bounds',\n };\n }\n\n const sigma = bounds.sigma ?? 1;\n let best: DesignSuggestion | null = null;\n\n const grids = names.map((n) => {\n const b = bounds.variables[n]!;\n const steps = Math.max(2, b.steps ?? 8);\n const out: number[] = [];\n for (let i = 0; i < steps; i++) {\n const t = i / (steps - 1);\n out.push(b.min + t * (b.max - b.min));\n }\n return out;\n });\n\n const idx = new Array(names.length).fill(0);\n const rec = (d: number): void => {\n if (d === names.length) {\n const point: Record<string, number> = {};\n for (let i = 0; i < names.length; i++) point[names[i]!] = grids[i]![idx[i]!]!;\n if (inForbidden(point, bounds.forbidden)) return;\n let y1: number;\n let y2: number;\n try {\n y1 = evalExpr(h1, point);\n y2 = evalExpr(h2, point);\n } catch {\n return;\n }\n if (!Number.isFinite(y1) || !Number.isFinite(y2)) return;\n const disc = Math.abs(y1 - y2) / sigma;\n if (!best || disc > best.discrimination) {\n best = { point, discrimination: disc, h1: y1, h2: y2 };\n }\n return;\n }\n for (let i = 0; i < grids[d]!.length; i++) {\n idx[d] = i;\n rec(d + 1);\n }\n };\n rec(0);\n\n if (!best) {\n return {\n point: {},\n discrimination: 0,\n h1: NaN,\n h2: NaN,\n abstained: true,\n reason: 'every grid point was forbidden or non-finite',\n };\n }\n return best;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression-gaps.js","sourceRoot":"","sources":["../../../src/composition/probe/expression-gaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C;;;;GAIG;AACH,MAAM,4BAA4B,GAChC,8MAA8M,CAAC;AAEjN,yEAAyE;AACzE,MAAM,UAAU,oBAAoB;IAClC,OAAO,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,qBAAqB,CAAC,CAAC;QAC7F,OAAO;YACL,GAAG,GAAG;YACN,YAAY,EAAE,EAAW;YACzB,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,4BAA4B,CAAC,EAAE;SAC7E,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAA4B;IACjE,OAAO,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,EAAE,GAAG,oBAAoB,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
|
1
|
+
{"version":3,"file":"expression-gaps.js","sourceRoot":"","sources":["../../../src/composition/probe/expression-gaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C;;;;GAIG;AACH,MAAM,4BAA4B,GAChC,8MAA8M,CAAC;AAEjN,yEAAyE;AACzE,MAAM,UAAU,oBAAoB;IAClC,OAAO,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,qBAAqB,CAAC,CAAC;QAC7F,OAAO;YACL,GAAG,GAAG;YACN,YAAY,EAAE,EAAW;YACzB,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,4BAA4B,CAAC,EAAE;SAC7E,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAA4B;IACjE,OAAO,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,EAAE,GAAG,oBAAoB,EAAE,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/**\n * Expression gaps a `upt probe scan` can hand to Product B.\n *\n * Product A wrappers (relation-link, connectors, regime-transition) stay\n * `searchable: false`. These gaps are a separate list, concatenated by the\n * CLI, so `scanFrontier`'s length is unchanged.\n *\n * `searchable: true` here is the Tier 8 scan-list flag. Each record is built\n * from an applied-case id and title. Observations are empty. There is no\n * named baseline and no dataset. Scientific-Bridge-Discovery-v1 admits a\n * prediction-residual scanner only when both exist, so this list is not a\n * detected prediction residual and not a problem file.\n *\n * @module composition/probe/expression-gaps\n * @internal\n */\n\nimport { APPLIED_CASES } from '../../cases/index.js';\nimport { scanFrontier } from './frontier.js';\nimport { makeResidualGap } from './problem.js';\nimport type { FrontierGap } from './types.js';\nimport type { BridgeEdge } from '../edge.js';\n\n/**\n * Why an expression gap is listed as searchable.\n * The flag stays true because the Tier 8 contract lists these handles.\n * The sentence states the inputs a detected residual would have required.\n */\nconst EXPRESSION_GAP_SEARCH_REASON =\n 'listed as searchable by the Tier 8 expression-gap contract; observations are empty, and this record has no named baseline and no dataset, so it is not a detected prediction residual and not a problem file';\n\n/** One searchable prediction-residual gap per applied case. @internal */\nexport function expressionSearchGaps(): FrontierGap[] {\n return [...APPLIED_CASES.values()]\n .map((c) => {\n const gap = makeResidualGap(`fg-expr-${c.id}`, `${c.id}: ${c.title}`, 'prediction-residual');\n return {\n ...gap,\n observations: [] as const,\n searchability: { searchable: true, reasons: [EXPRESSION_GAP_SEARCH_REASON] },\n };\n })\n .sort((a, b) => a.id.localeCompare(b.id));\n}\n\n/**\n * Product A wrappers plus the expression gaps. Relation-link gaps stay\n * not-searchable; the expression gaps are searchable.\n * @internal\n */\nexport function scanWithExpressionGaps(edges: readonly BridgeEdge[]): FrontierGap[] {\n return [...scanFrontier(edges), ...expressionSearchGaps()];\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Persist counterexamples. Failed limits are fatal only when the candidate
|
|
5
5
|
* claims that domain (see limits.ts). Catalog retrodiction is Product A and
|
|
6
|
-
* is not
|
|
6
|
+
* is not a battery here.
|
|
7
7
|
*
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
@@ -15,7 +15,6 @@ export interface FalsifyInput {
|
|
|
15
15
|
readonly prefactor?: number;
|
|
16
16
|
readonly claimedRegimes?: Readonly<Record<string, string>>;
|
|
17
17
|
readonly limits?: readonly DeclaredLimit[];
|
|
18
|
-
readonly observationalBoundIds?: readonly string[];
|
|
19
18
|
readonly skipDimensional?: boolean;
|
|
20
19
|
}
|
|
21
20
|
export interface FalsifyResult {
|
|
@@ -23,7 +22,19 @@ export interface FalsifyResult {
|
|
|
23
22
|
readonly survived: boolean;
|
|
24
23
|
readonly counterexamples: readonly Readonly<Record<string, number>>[];
|
|
25
24
|
}
|
|
26
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Run the Product B falsification batteries: dimensional, finiteness, limits.
|
|
27
|
+
*
|
|
28
|
+
* Every listed battery can fail. Two batteries once listed here, `retrodiction`
|
|
29
|
+
* and `observational-bounds`, returned `inconclusive` by construction (catalog
|
|
30
|
+
* retrodiction is Product A, and no bound was ever evaluated), so "survived
|
|
31
|
+
* five batteries" overstated what was checked; they are not listed until they
|
|
32
|
+
* are real (9.0.0 audit §4 Low). A problem's `observationalBoundIds` stay
|
|
33
|
+
* recorded on the problem and are not a battery.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
27
37
|
export declare function runFalsification(input: FalsifyInput): FalsifyResult;
|
|
38
|
+
/** The batteries `runFalsification` runs, in order; each one can fail. @internal */
|
|
28
39
|
export declare const DEFAULT_BATTERIES: readonly FalsificationBattery[];
|
|
29
40
|
//# sourceMappingURL=falsify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"falsify.d.ts","sourceRoot":"","sources":["../../../src/composition/probe/falsify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,CAAC,EA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3
3
|
*
|
|
4
4
|
* Persist counterexamples. Failed limits are fatal only when the candidate
|
|
5
5
|
* claims that domain (see limits.ts). Catalog retrodiction is Product A and
|
|
6
|
-
* is not
|
|
6
|
+
* is not a battery here.
|
|
7
7
|
*
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
@@ -77,6 +77,8 @@ function limitsBattery(checks) {
|
|
|
77
77
|
detail: fatal.map((c) => c.detail).join('; '),
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
+
// A non-fatal failure (domain not claimed) and an undecided limit (too few evaluable rows)
|
|
81
|
+
// both leave the battery inconclusive; neither is a pass.
|
|
80
82
|
const failedNonFatal = checks.filter((c) => !c.passed && !c.fatal);
|
|
81
83
|
if (failedNonFatal.length > 0) {
|
|
82
84
|
return {
|
|
@@ -93,28 +95,18 @@ function limitsBattery(checks) {
|
|
|
93
95
|
: 'declared limits held or were out of claimed domain',
|
|
94
96
|
};
|
|
95
97
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
detail: 'no observational bound ids supplied',
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
battery: 'observational-bounds',
|
|
113
|
-
outcome: 'inconclusive',
|
|
114
|
-
detail: `bound ids ${ids.join(', ')} recorded; candidate-level bound evaluation is data-specific`,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
/** Run the Product B falsification batteries. @internal */
|
|
98
|
+
/**
|
|
99
|
+
* Run the Product B falsification batteries: dimensional, finiteness, limits.
|
|
100
|
+
*
|
|
101
|
+
* Every listed battery can fail. Two batteries once listed here, `retrodiction`
|
|
102
|
+
* and `observational-bounds`, returned `inconclusive` by construction (catalog
|
|
103
|
+
* retrodiction is Product A, and no bound was ever evaluated), so "survived
|
|
104
|
+
* five batteries" overstated what was checked; they are not listed until they
|
|
105
|
+
* are real (9.0.0 audit §4 Low). A problem's `observationalBoundIds` stay
|
|
106
|
+
* recorded on the problem and are not a battery.
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
118
110
|
export function runFalsification(input) {
|
|
119
111
|
const prefactor = input.prefactor ?? 1;
|
|
120
112
|
const records = [];
|
|
@@ -127,16 +119,13 @@ export function runFalsification(input) {
|
|
|
127
119
|
counterexamples.push(...fin.counterexamples);
|
|
128
120
|
const limitChecks = checkDeclaredLimits(input.expr, input.dataset, prefactor, input.limits ?? [], input.claimedRegimes ?? {});
|
|
129
121
|
records.push(limitsBattery(limitChecks));
|
|
130
|
-
records.push(retrodictionBattery());
|
|
131
|
-
records.push(observationalBoundsBattery(input.observationalBoundIds));
|
|
132
122
|
const survived = records.every((r) => r.outcome !== 'fail');
|
|
133
123
|
return { records, survived, counterexamples };
|
|
134
124
|
}
|
|
125
|
+
/** The batteries `runFalsification` runs, in order; each one can fail. @internal */
|
|
135
126
|
export const DEFAULT_BATTERIES = [
|
|
136
127
|
'dimensional',
|
|
137
128
|
'finiteness',
|
|
138
129
|
'limits',
|
|
139
|
-
'retrodiction',
|
|
140
|
-
'observational-bounds',
|
|
141
130
|
];
|
|
142
131
|
//# sourceMappingURL=falsify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"falsify.js","sourceRoot":"","sources":["../../../src/composition/probe/falsify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAyB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"falsify.js","sourceRoot":"","sources":["../../../src/composition/probe/falsify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,QAAQ,EA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AED,oFAAoF;AACpF,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,aAAa;IACb,YAAY;IACZ,QAAQ;CACT,CAAC","sourcesContent":["/**\n * Falsification batteries for probe candidates.\n *\n * Persist counterexamples. Failed limits are fatal only when the candidate\n * claims that domain (see limits.ts). Catalog retrodiction is Product A and\n * is not a battery here.\n *\n * @internal\n */\n\nimport type { ExprNode } from '../../dimensional/ast-types.js';\nimport { validate } from '../../dimensional/validator.js';\nimport { evalExpr } from '../expr-eval.js';\nimport { checkDeclaredLimits, type LimitCheckResult } from './limits.js';\nimport type {\n DeclaredLimit,\n FalsificationBattery,\n FalsificationRecord,\n ProbeDataset,\n} from './types.js';\n\nexport interface FalsifyInput {\n readonly expr: ExprNode;\n readonly dataset?: ProbeDataset;\n readonly prefactor?: number;\n readonly claimedRegimes?: Readonly<Record<string, string>>;\n readonly limits?: readonly DeclaredLimit[];\n readonly skipDimensional?: boolean;\n}\n\nexport interface FalsifyResult {\n readonly records: readonly FalsificationRecord[];\n readonly survived: boolean;\n readonly counterexamples: readonly Readonly<Record<string, number>>[];\n}\n\nfunction dimBattery(expr: ExprNode): FalsificationRecord {\n const v = validate(expr);\n if (!v.ok || v.inferredDimension === null) {\n return {\n battery: 'dimensional',\n outcome: 'fail',\n detail: 'expression is dimensionally inconsistent',\n };\n }\n return {\n battery: 'dimensional',\n outcome: 'pass',\n detail: 'expression is dimensionally consistent',\n };\n}\n\nfunction finitenessBattery(\n expr: ExprNode,\n dataset: ProbeDataset | undefined,\n prefactor: number,\n): { record: FalsificationRecord; counterexamples: Record<string, number>[] } {\n if (!dataset || dataset.rows.length === 0) {\n return {\n record: {\n battery: 'finiteness',\n outcome: 'pass',\n detail: 'no rows to evaluate',\n },\n counterexamples: [],\n };\n }\n const counterexamples: Record<string, number>[] = [];\n for (const row of dataset.rows) {\n let y: number;\n try {\n y = prefactor * evalExpr(expr, row);\n } catch {\n counterexamples.push({ ...row });\n continue;\n }\n if (!Number.isFinite(y)) counterexamples.push({ ...row });\n }\n if (counterexamples.length > 0) {\n return {\n record: {\n battery: 'finiteness',\n outcome: 'fail',\n detail: `${counterexamples.length} observation(s) produced non-finite predictions`,\n },\n counterexamples,\n };\n }\n return {\n record: {\n battery: 'finiteness',\n outcome: 'pass',\n detail: 'all predictions finite',\n },\n counterexamples: [],\n };\n}\n\nfunction limitsBattery(checks: readonly LimitCheckResult[]): FalsificationRecord {\n const fatal = checks.filter((c) => c.fatal);\n if (fatal.length > 0) {\n return {\n battery: 'limits',\n outcome: 'fail',\n detail: fatal.map((c) => c.detail).join('; '),\n };\n }\n // A non-fatal failure (domain not claimed) and an undecided limit (too few evaluable rows)\n // both leave the battery inconclusive; neither is a pass.\n const failedNonFatal = checks.filter((c) => !c.passed && !c.fatal);\n if (failedNonFatal.length > 0) {\n return {\n battery: 'limits',\n outcome: 'inconclusive',\n detail: failedNonFatal.map((c) => c.detail).join('; '),\n };\n }\n return {\n battery: 'limits',\n outcome: 'pass',\n detail:\n checks.length === 0\n ? 'no declared limits'\n : 'declared limits held or were out of claimed domain',\n };\n}\n\n/**\n * Run the Product B falsification batteries: dimensional, finiteness, limits.\n *\n * Every listed battery can fail. Two batteries once listed here, `retrodiction`\n * and `observational-bounds`, returned `inconclusive` by construction (catalog\n * retrodiction is Product A, and no bound was ever evaluated), so \"survived\n * five batteries\" overstated what was checked; they are not listed until they\n * are real (9.0.0 audit §4 Low). A problem's `observationalBoundIds` stay\n * recorded on the problem and are not a battery.\n *\n * @internal\n */\nexport function runFalsification(input: FalsifyInput): FalsifyResult {\n const prefactor = input.prefactor ?? 1;\n const records: FalsificationRecord[] = [];\n const counterexamples: Record<string, number>[] = [];\n\n if (!input.skipDimensional) {\n records.push(dimBattery(input.expr));\n }\n\n const fin = finitenessBattery(input.expr, input.dataset, prefactor);\n records.push(fin.record);\n counterexamples.push(...fin.counterexamples);\n\n const limitChecks = checkDeclaredLimits(\n input.expr,\n input.dataset,\n prefactor,\n input.limits ?? [],\n input.claimedRegimes ?? {},\n );\n records.push(limitsBattery(limitChecks));\n\n const survived = records.every((r) => r.outcome !== 'fail');\n return { records, survived, counterexamples };\n}\n\n/** The batteries `runFalsification` runs, in order; each one can fail. @internal */\nexport const DEFAULT_BATTERIES: readonly FalsificationBattery[] = [\n 'dimensional',\n 'finiteness',\n 'limits',\n];\n"]}
|