# 1. Mental Model: How Plumb Thinks Plumb is a **formal verification language and strict referee for empirical and theoretical physics**. In real physics, major errors rarely come from basic arithmetic. They happen in the **hidden plumbing** around a calculation: - Smuggling a theory's ontology (such as cold dark matter or a fiducial cosmological template) into a "raw" measurement, then testing a competing theory against it. - Adding a deterministic worst-case systematic bound ($|\delta| \le 0.02\text{ mag}$) in quadrature with random Gaussian noise. - Forgetting that two measurements share a calibration zero-point — or double-counting a nuisance already baked into a covariance matrix. - Testing a model on data that was already used to calibrate it (**circular calibration**), or combining two published marginals from the same posterior as if they were independent. - Quietly dropping rows based on the observed outcome (Malmquist / selection bias) under a plain Gaussian likelihood, or permuting data table rows out of order. - Missing an **indirect contradiction** where every pair of measurements agrees, yet no single shared set of parameters satisfies the whole network at once. Plumb makes assumptions, error models, theories, predictions, and comparisons explicit in **`.plumb` files** that can build on the standard library (`std/`). ## The Three-File Separation Plumb keeps **scientific meaning**, **raw numbers**, and **integrity hashes** strictly separate: | Layer | File type | What belongs here | | --- | --- | --- | | **Scientific meaning** | `*.plumb`, `*.lean` | Units, physical constants, assumptions, shared nuisances, bounded systematics, declared roles, measurements, model-conditioned inferences, theories, predictions, rules, claims, comparisons, scopes, and optional Lean 4 proof sources (including inside `std/`). | | **Raw numeric data** | `*.json` | Strictly raw bulk data: ordered axis manifests (`Axes`), numeric data tables (`Table`), and covariance matrices (`Matrix`). No prose or hidden physics assumptions. | | **Integrity lockfile** | `plumb.lock` / `std/lock.json` | Exact-byte SHA-256 digests and byte lengths for every `.plumb` module, referenced Lean proof source, and data artifact, generated and checked with `plumb lock`. | Your `.plumb` files stay readable and clean (`artifact desi_values : Table from "data/desi.table.json" ...`), while `plumb lock` freezes the exact bytes so nothing can drift silently. ## Four Non-Negotiable Rules Plumb Enforces 1. **State the ontology explicitly.** Declare model-dependent summaries with `inference ... conditioned on ... requires ...`. A comparison must satisfy those premises through the theory's `assume`, a prediction's `assuming`, or an evaluated rule's `grants`. Raw `measurement` declarations exclude `PhysicalOntology` premises. 2. **Random noise $\ne$ deterministic bounds.** Statistical uncertainties (`noise`, `nuisance`) combine via exact covariance algebra ($LDL^T$). Deterministic worst-case bounds (`bounded`) are never added in quadrature to a covariance; they are evaluated across their full interval box. 3. **Track lineage, cancel shared biases, refuse loops.** Shared biases pool coherently when measurements are combined and cancel cleanly when measurements are differenced. Structural cycles, circular calibration, and aliased/shared-posterior double counting are caught and refused automatically. 4. **One verdict per check.** The receipt records whether each check is `Compared`, `ConditionalResult`, `Conflict`, `NonIdentifiable`, `SystematicsLimited`, `Blocked`, `Unassessed`, or `Unresolved`. ## Built-In Checkers, Lean 4, and External Fitters Plumb stays fast and lightweight by focusing its own core on physics verification while connecting cleanly to established tools: - **Built-in Plumb checkers** handle empirical comparisons, shared-bias algebra, epistemic/cycle auditing, certified intervals, quadrature, symbolic derivatives, piecewise/trig/hyperbolic expressions, and targeted polynomial/radical/scaling/SOS claims. - **Lean 4 (`by lean`)** checks proofs of closed comparisons that Plumb can translate to Lean. A proof can use locally vendored libraries such as **Mathlib** or **Physlib**. Write `by lean "proofs/c.lean"` or reference a local Lake theorem (`by lean theorem Mod.thm from lake "formal" module Mod`; local Lake projects build offline in the sandbox from pinned local sources), and optionally discharge a `MathematicalPremise` with `states ... discharged by `. Plumb generates the authoritative Lean target, checks statement agreement and transitive axioms (isolated `lake comparator` export verification when available, or kernel-environment replay), pins `.lean` sources in `plumb.lock`, and caches verified proofs locally so warm runs take milliseconds (`plumb doctor --lean` reports backend and cache status; see `plumb doc lean`). - **External MCMC & optimizers** (Cobaya, emcee, NumPyro, Stan, SciPy, etc.) stay outside Plumb's kernel: use `plumb parity` before sampling to confirm exact per-block $\chi^2$ and log-likelihood agreement at fixed parameter points, run your sampler as usual, and pass joint draws back through `plumb audit --witness` for independent certification. ## Built-In Documentation for Humans and AI Agents Everything in this guide is embedded directly into the `plumb` CLI: ```sh plumb doc # list all topics plumb doc language # print the complete .plumb syntax reference plumb doc --search "mus" # search all documentation sections plumb doc --all # export the entire guide as one Markdown stream plumb doc --json # structured JSON export for tools and agents ``` --- # 2. Quickstart & Everyday Workflow ## Your First `.plumb` File Save the following as `demo.plumb`. It declares a speed, records its Gaussian uncertainty in one line, and checks two predictions against the same $\chi^2$ budget. ```plumb assumption stat.gaussian_demo: StatisticalModel "Independent Gaussian measurement error." role demo.speed: km/s "Speed of the demo carrier." measurement obs_speed: demo.speed = 300 +- 10 km/s assuming stat.gaussian_demo theory constant_speed { v: km/s predict demo.speed = v } compare check_consistent: obs_speed ~ constant_speed at v = 305 km/s accept chi2 <= 4 expect compared by gaussian_ldlt compare check_conflict: obs_speed ~ constant_speed at v = 350 km/s accept chi2 <= 4 expect conflict declared_budget_exceeded by gaussian_ldlt ``` Run `plumb check` to see both verdicts. ```sh plumb check demo.plumb ``` - `check_consistent` evaluates $\chi^2 = ((300 - 305)/10)^2 = 1/4 \le 4$ -> **`compared`**. - `check_conflict` evaluates $\chi^2 = ((300 - 350)/10)^2 = 25 > 4$ -> **`conflict (declared_budget_exceeded)`**. - The command exits with code `0`. Both verdicts are completed checks. - The prediction applies to any measurement of `demo.speed`. ## Everyday CLI Workflow ### 1. Format canonically ```sh plumb fmt demo.plumb # rewrite in canonical Plumb style plumb fmt --check demo.plumb # fail (exit 2) if not formatted ``` ### 2. Lock a workspace (`plumb.lock`) Whenever your workspace has `.plumb` files and/or external JSON data files (`artifact ... from "..."`), generate or verify `plumb.lock`: ```sh plumb lock my_project # creates or updates my_project/plumb.lock plumb lock --check my_project # verifies exact-byte SHA-256 of every module & artifact ``` If you edit a `.plumb` module or a data file, `plumb lock --check` fails with exit code `2` until you deliberately re-run `plumb lock` (which bumps the module's revision and records `supersedes`). ### 3. Check and emit an immutable receipt ```sh plumb check my_project/analysis.plumb --out runs/attempt-1 ``` This writes two files atomically inside `runs/attempt-1/`: - `receipt.json` (`plumb.receipt/v1`) — full machine-readable audit record with digests, verdicts, witnesses, and assumption ledgers. - `report.md` — human-readable Markdown summary. Plumb **refuses to overwrite** an existing attempt directory (exit code `2`), preserving append-only audit history. ### 4. Inspect transitive assumptions (`plumb trace`) ```sh plumb trace runs/attempt-1/receipt.json plumb trace runs/attempt-1/receipt.json my_compare_name ``` `plumb trace` prints every assumption and active bias stage that contributed to a finding — transitively across all imported modules and `derived from` chains. ### 5. Compare two receipts safely (`plumb compare`) To compare two candidate models against the exact same dataset, put your shared data and observables in `data_module.plumb`, then create two model modules (`model_a.plumb`, `model_b.plumb`) that `import data_module` and define the same `compare` check name(s) targeting the same observable(s). Importing `data_module` brings in its declarations without re-running its own checks. ```sh plumb check my_project/model_a.plumb --out runs/model-a plumb check my_project/model_b.plumb --out runs/model-b plumb compare runs/model-a/receipt.json runs/model-b/receipt.json ``` `plumb compare` allows the candidate predictions (`prediction_sha256`) to differ while refusing if the two receipts differ in axis order, observation digest, covariance digest, conditioning, metric, units, active bias stack, or check set. ### 6. Validate an entire locked project (`plumb validate`) ```sh plumb validate . # validate the locked project in the current directory plumb validate my_project # verifies plumb.lock, strict JSON schemas, every module, and every `expect` ``` ### 7. Explore docs, `std` modules, checkers, and error codes ```sh plumb doc # built-in user guide topics plumb doc language # syntax reference plumb doc std.astronomy.ladder.cepheids # inspect any built-in std module source verbatim plumb doc --search "bias" # search built-in docs plumb list checkers # list all built-in `by ` verification checkers plumb explain P0312 # explain a specific diagnostic code ``` --- # 3. The `.plumb` Language Reference This is the complete syntax reference for `.plumb` modules. ## Lexical Rules & Comments - Line comments start with `--` and run to the end of the line. - Identifiers use ASCII letters, digits, and `_` (cannot start with a digit). - Qualified names join identifiers with `.` (e.g., `ontology.cold_dark_matter`, `std.core.c`). - Numbers support integers (`42`), decimals (`73.04`), and scientific notation (`6.67430e-11`). Use `inf` for infinity. - Always write explicit `*` between a number and an identifier or function call (`2 * pi`, never `2 pi` — juxtaposition is rejected as `P0107`). - Attach unit exponents directly to the unit (`2 kpc^2`), or parenthesize the whole quantity (`(2 kpc)^2`). Writing `2 kpc ^ 2` with spaces is rejected (`P0109`). ## Imports Place `import` statements at the top of a file, before any declarations. ```plumb -- Import everything exported by a module import std.core import std.cosmology.cmb.planck_2018 import std.cosmology.lss.desi_dr2_bao -- Selective import (only specific names, with optional `as` alias) import std.astronomy.ladder.parallax (lmc_deb, lmc_deb_sys as lmc_anchor_scale) import std.gauge (sm_family_charges, math.sm_three_weyl_families) ``` Workspace modules resolve relative to the workspace root (e.g., `import helpers.models` loads `helpers/models.plumb`). Standard library modules always begin with `std.` and cannot be shadowed by workspace files. - Imports are **transitive** and **diamond-safe** (if module `C` imports `B` which imports `A`, `C` sees `A`'s exports, and importing both `A` and `B` deduplicates cleanly without `P0121`). - Selective imports accept simple and dotted names. Each selection also loads the declarations it depends on. An alias after `as` is a single identifier. - Importing a module makes its declarations available. Reference upstream checks through `derived from` or `scope ... after` to make their results prerequisites. ## Built-In Units (Closed Table) Plumb accepts the unit symbols in this table. For a prefix absent from the table, write the scale explicitly, such as `1e-3 s` for a millisecond. | Dimension | Allowed unit symbols | | --- | --- | | Dimensionless | `1` (use `Dimensionless` in type annotations) | | Length | `m`, `cm`, `km`, `um`, `nm`, `AU`, `pc`, `kpc`, `Mpc`, `l_Pl` | | Time | `s`, `d` (86400 s), `yr` (Julian year, 31557600 s), `Gyr` (a billion Julian years) | | Frequency | `Hz`, `MHz`, `GHz` | | Mass | `kg`, `g`, `Msun` | | Energy | `J`, `eV`, `MeV`, `GeV`, `TeV` | | Force / Power / Pressure | `N`, `W`, `Pa` | | Electromagnetism | `A`, `C`, `V`, `Ohm`, `T` | | Amount | `mol` | | Magnitude | `mag` | | Temperature | `K` | | Angle | `arcsec`, `mas`, `uas`, `deg` (`3600 arcsec`), `rad` (`648000 / pi` arcsec) | Join compound unit symbols without spaces, as in `km/s/Mpc`, `kg*m^2/s`, or `m/s^2`. Write reciprocal units as `1/yr` or `yr^-1`, for example `2 1/yr` or `2 yr^-1`. The `Msun` scale is the IAU 2015 nominal `GM_sun` divided by the adopted CODATA 2022 value of `G`. ### Expressions, Built-In Functions & Control Forms - **Elementary functions:** - `abs(x)`, `sqrt(x)`, `min(a, b)`, `max(a, b)`, `mod(a, b)` - `exp(x)`, `ln(x)`, `log10(x)`, `sinh(x)`, `cosh(x)`, `tanh(x)` (`Dimensionless -> Dimensionless`) - `sin(a)`, `cos(a)`, `tan(a)` (`Angle -> Dimensionless`; pass a dimensionless phase as `sin(p * 1 rad)`) - `atan(x)`, `asin(x)`, `acos(x)` (`Dimensionless -> Angle`; divide by `1 rad` for a dimensionless radian count) - **Local lexical bindings:** `let y = e in b` (nonrecursive; `e` resolves in the outer scope, `b` in the extended scope, shared within the same evaluation environment). - **Piecewise expressions:** `if p then a else b` (mandatory `else`; `p` must be a comparison/boolean predicate; both arms must have compatible scalar dimensions; derivative/quadrature kernels enforce local smoothness across branch boundaries). - **Symbolic derivatives:** `deriv(x, e)` differentiates with respect to an independent scalar coordinate `x` (formal parameter, quantified variable, integral variable, or typed theory parameter) before call-site substitution, with dimension `dim(e) / dim(x)`. - **Folds & integrals:** `sum(r in tbl, ...)`, `prod(r in tbl, ...)`, `integral(u in range(lo, hi), ...)`. - **Bracketed roots:** `certified_root(x in range(lo, hi), residual)` encloses the unique zero of a scalar residual and returns a quantity in the units of the bracket. ## Declarations ### `convention` — Exact Adopted Constants ```plumb convention c : m/s = 299792458 m/s "SI 2019 exact definition" convention H100 : km/s/Mpc = 100 km/s/Mpc "Reference Hubble scale" ``` Conventions are exact point values (no uncertainty propagated). For empirical physical constants with uncertainties, use `measurement` (like `m_e_codata2022` and `G_codata2022` in `std.core`). ### `assumption` — Typed Epistemic Premises Each assumption has one of five kinds. - `PhysicalOntology` — postulates physical entities or couplings (forbidden on raw `measurement`!) - `RegimeApproximation` — validity regime (flat FLRW, weak field, low redshift, etc.) - `CalibrationAndInstrument` — telescope/detector/anchor calibration model - `StatisticalModel` — likelihood or error distribution assumption - `MathematicalPremise` — mathematical regularity or remainder premise ```plumb assumption ontology.cold_dark_matter : PhysicalOntology "Pressureless cold dark matter." assumption regime.low_z_cosmography : RegimeApproximation assumption calibration.hst_wfc3 : CalibrationAndInstrument assumption stat.gaussian_errors : StatisticalModel assumption math.smooth_integrand : MathematicalPremise -- Optional: discharge a MathematicalPremise from a verified claim (Lean or built-in): assumption math.hypercharge_sum : MathematicalPremise "Multiplicity-weighted hypercharges sum to zero." states sum(f in sm_family_charges, f["d3"] * f["d2"] * f["Y"]) == 0 discharged by grav_u1 assumptions StatisticalModel { stat.gaussian_clock "Gaussian laboratory clock uncertainty" stat.independent_clocks "Independent laboratory clock readings" } ``` Use `assumptions { ... }` to group assumptions of one kind. Each entry keeps its full name and can carry a short description. ### `artifact` — External Raw Data Files External data files are declared by path relative to the workspace root (or `std/` for standard-library modules). Exact-byte SHA-256 digests are stored in `plumb.lock` via `plumb lock`, never inline. ```plumb artifact my_axes : Axes from "data/my.axes.json" rows 3 artifact my_table : Table from "data/my.table.json" axes my_axes rows 3 artifact my_cov : Matrix from "data/my.cov.json" axes my_axes -- Optional: declare nuisances already baked into a covariance matrix: artifact full_cov : Matrix from "data/full.cov.json" axes my_axes includes zp_cal ``` #### Strict JSON Schemas for Data Artifacts All JSON artifacts reject duplicate keys and unknown fields. **All numeric entries in tables and matrices must be quoted decimal or rational strings** (e.g., `"0.3473"`, `"1/4"`) so exact rational parsing suffers zero floating-point drift. Both `Table` and `Matrix` must set `axis_manifest_sha256` to the exact SHA-256 hex digest of the referenced `Axes` file (compute it with `sha256sum data/my.axes.json`, then run `plumb lock `). **1. `Axes` (`plumb.axis_manifest/v1`):** ```json { "schema_version": "plumb.axis_manifest/v1", "id": "demo_3", "items": [ {"id": "r1", "role": "demo.flux", "unit": "mag", "coordinate": "z=0.1"}, {"id": "r2", "role": "demo.flux", "unit": "mag", "coordinate": "z=0.2"}, {"id": "r3", "role": "demo.flux", "unit": "mag", "coordinate": "z=0.3"} ] } ``` Two fields connect a row to the model side: - `"role"` names a **declared `role`** (see below). Write its full dotted path (`"demo.flux"`). A bare name without a dot (`"flux"`, `"Flux"`) is also accepted when it is the last segment of exactly one declared role, compared without regard to ASCII case. A row whose role is not declared, or whose bare name fits several declared roles, is `P0302`; a role whose dimension differs from the observable's unit is `P0301`. - `"coordinate"` (`"z=0.1"`) supplies the row's coordinate: the name before `=` (`z`) is the variable a prediction arm binds (`demo.flux(z) = ...`). **2. `Table` (`plumb.table/v1`):** ```json { "schema_version": "plumb.table/v1", "id": "demo_values", "axis_manifest_sha256": "", "columns": ["z", "m_B"], "rows": [ {"label": "r1", "values": {"z": "0.1", "m_B": "18.50"}}, {"label": "r2", "values": {"z": "0.2", "m_B": "20.10"}}, {"label": "r3", "values": {"z": "0.3", "m_B": "21.05"}} ] } ``` **3. `Matrix` (`plumb.matrix/v1`):** ```json { "schema_version": "plumb.matrix/v1", "id": "demo_cov", "axis_manifest_sha256": "", "labels": ["r1", "r2", "r3"], "includes": [], "entries": [ ["0.01", "0.002", "0.002"], ["0.002", "0.01", "0.002"], ["0.002", "0.002", "0.01"] ] } ``` ### Finite Artifact Sums and Products An `exact_rational` or `interval_enclosure` claim can fold over the rows of a pinned `Table` artifact. Declare one unit per column in the artifact type, in the JSON `columns` order. For the `z` and `m_B` columns above, write `Table[Dimensionless, mag]`. ```plumb artifact my_axes: Axes from "data/my.axes.json" rows 3 artifact my_table: Table[Dimensionless, mag] from "data/my.table.json" axes my_axes rows 3 claim magnitude_checksum: sum(r in my_table, r["m_B"]) == 59.65 mag by exact_rational claim normalized_product: prod(r in my_table, r["m_B"] / r["m_B"]) == 1 by exact_rational ``` The column units are declarations supplied by the author from the data release. The numeric JSON contains no column units to check them against. Each cell is scaled by its declared column unit. A vector observable on the same manifest can read a column in its `value` expression, for example `value my_table["m_B"]`. The column is converted from its declared unit to the observable unit. A vector's `select mask covariate` may read typed columns on the same pinned manifest. Coordinate thresholds and comparison bindings must carry the column's physical dimension. Reading an observed response to select rows gives `blocked unconsumed_bias`, including when another declaration names the same column or the compared profile supplies the response. The row binder exposes the column names with those fixed units, so adding a redshift to a magnitude is a dimension error. Products require a dimensionless body, such as the ratio above. Sums and products traverse the exact manifest row order, and nested folds are supported within the evaluation budget. Table row labels, the axis digest and every declared column are checked before evaluation, including columns the expression does not use. The axis manifest must use one uniform row unit spelling. Artifact folds currently require a direct `claim` goal with `by exact_rational` or `by interval_enclosure`. Use the latter for certified bounds on sums such as `sum(r in spectrum, ln(r["ratio"]) + sqrt(r["ratio"]) / pi)`. A bare `Table` needs column types before it can be folded. Definitions, comparisons and other claim methods refuse artifact folds. The table must contain at least one row and column. Each fold table may contain at most 65,536 cells, each numeric cell may contain at most 1,024 bytes, and the parsed numerators and denominators together may contain at most 16,777,216 bits. A claim has a shared evaluation budget of 750,000 expression steps, including nested folds. A passing checksum certifies arithmetic on the pinned central values. With `interval_enclosure`, the reported endpoints bound numerical error. Statistical uncertainty propagation requires an explicit error model and the applicable covariance, including its off-diagonal entries. Fold inputs retain their shared data lineage when claims are used downstream. Running `plumb lock` after changing source or data records new pins, and each check verifies those pins again. ### Inline `table` — Small Tables Directly in `.plumb` For small symbolic or exact rational tables (e.g., particle quantum numbers), you can declare an inline `table`: ```plumb table sm_generation(mult, Y) | Q_L => 6, 1 / 6 | u_c => 3, -2 / 3 | d_c => 3, 1 / 3 | L_L => 2, -1 / 2 | e_c => 1, 1 ``` ### `role` — What a Quantity Is A `role` identifies a measurable quantity by name. For example, $D_M/r_d$ and $D_H/r_d$ are distinct roles with the same dimension. Observables record roles. Predictions and rules produce them. A role has an optional unit and description and defaults to `Dimensionless`. ```plumb role cosmo.hubble_constant : km/s/Mpc "Present-day expansion rate H0." roles bao { d_m_over_r_d "Transverse comoving distance over drag horizon" d_h_over_r_d "Hubble distance over drag horizon" } ``` `roles { ... }` adds the prefix to each entry, giving `bao.d_m_over_r_d` and `bao.d_h_over_r_d` above. An imported role keeps its identity under aliases. Use `plumb doc std` to find roles in the standard library. ### `nuisance` and Top-Level `bounded` ```plumb -- Synthetic shared Gaussian nuisance for a magnitude zero-point. nuisance zp_phot : mag ~ gaussian(sigma = 0.015 mag) assuming calibration.synthetic_photometric_offset, stat.gaussian_errors -- Synthetic deterministic bound for a common magnitude shift. bounded ceph_metal_sys : abs(delta) <= 0.020 mag assuming calibration.synthetic_metallicity_shift ``` ### `measurement`, `inference`, and `prediction` All three declare observables with shape ``, ` as `, or `Vector[, ]`: - `` takes its unit from the declared role. ` as ` states the unit, which may be any unit of the role's dimension (a `Mpc` role recorded in `kpc`); another dimension is `P0301`. - `Vector[, ]` has one row per item of the axis manifest, and every row names its own declared role. - **`measurement`**: Raw empirical data. **Cannot** carry `PhysicalOntology` assumptions (`P0322`). - **`inference`**: Model-conditioned or derived summary. **May** carry `PhysicalOntology` via `conditioned on ... requires ...`. - **`prediction`**: Benchmark or synthetic prediction. **Must** declare `derived from ...` (`P0321`). Write a scalar Gaussian reading as `value +- sigma Unit` so one unit applies to both numbers. Append `assuming` to name the statistical premise. Omit the unit for a dimensionless quantity. Add a braced block after the reading when you need extra clauses such as `conditioned on`, `derived from`, or `bounded`. ```plumb measurement length: lab.length = 2.4 +- 0.1 m assuming stat.gaussian_errors ``` Available stages inside an observable block (order matters — it is the forward model from physical truth to recorded data): ```plumb inference example_obs : Vector[my_axes, mag] { value my_table["m_B"] transform x => x - 0.012 mag shared zp_phot along ones shared ceph_metal_sys along 1 bounded local_dust : abs(delta) <= 0.02 mag along my_table["dust"] noise gaussian(cov = my_cov) assuming stat.gaussian_errors select mask covariate my_table["z"] > 0.05 derived from upstream_anchor conditioned on fiducial_fit requires ontology.cold_dark_matter, regime.near_fiducial valid when abs(predicted / fiducial - 1) <= 0.1 assuming calibration.synthetic_photometric_offset } ``` Key stage notes: - `noise` supports `gaussian(sigma = )`, `gaussian(cov = )`, `published_null(sigma = , p_value =

)`, `published_limit(confidence =

)`, and `published_interval(lower = , upper = , level =

) assuming `. Post-selected coincidence efficiency is declared with `select truncate latent coincidence(efficiency = )`. - `select` supports: - `select mask covariate ` — ignorable selection on independent covariates (e.g., `my_table["z"] > 0.05`). - `select model coordinate curve["rest_energy"] == wimp.rest_energy` selects the tabulated row at the compared theory's predicted rest energy. - `select truncate observed ` — non-ignorable outcome selection (e.g., `select truncate observed x < 24.5 mag`, where `x` is the implicit variable denoting the current observed value at that stage, or a table column like `my_table["m_B"] < 24.5 mag`). - **Stage order:** `transform`, `bounded`, and `select` are applied in declared order (for example, placing `transform x => x - 0.012 mag` before vs after `select truncate observed x < 24.5 mag` changes which rows survive, and a `transform` after a `bounded` stage scales that systematic!). `noise` and `shared` Gaussian nuisances commute in the pooled covariance. - `supersedes_for when not ` marks a deeper-tier `measurement` or `inference` that replaces a compressed summary when an audited candidate does not satisfy one of the listed assumptions. Each listed assumption must appear in the summary's `conditioned on ... requires` clause, and neither side may be a `prediction` (`P0323`). The clause only matters under `plumb audit`; see [Verdicts & Receipts](06-verdicts-and-receipts.md). - `derived from benchmark.common` names an opaque data source. Reusing the same tag across observations blocks an independence assumption. Reusing it across a model and its observation blocks circular calibration. - Use `CSV layout table` with a header and one axis. The optional `labels "id"` and `objects "object_id"` pins check row identities against the manifest. `layout matrix` reads numeric rows. `layout count_prefixed` reads the dimension followed by its square in entries. Declare matrix axes in order. A square CSV covariance can name its common axis once. Use comma (default) or space as the delimiter. Nonzero decimal covariance entries must fit the normal binary64 range. - A `FITS` artifact reads one finite binary32 or binary64 primary image. Use `axes A` for a value vector and `axes A, A` for a square covariance in row-major order. The coordinates in each manifest follow the on-disk data order. - Declare a catalogue of stable object IDs with `catalogue sky: "Survey object identifiers"`. Declare a data release with `release dr1: "First public data release" objects sky`. Bind an Axes artifact to it with `release dr1`. Each manifest item may give an `object` string from that catalogue. Rows with the same ID in the same release must agree on role, unit, coordinate and object. A release can declare `covariance C` over a manifest covering all its registered rows. A scalar can name the entire release in `derived from dr1`. - Comparisons report shared release rows as `Duplicate`, repeated lineage as `SharedLineage`, common catalogue objects as `SharedObjects`, and nonzero cross-covariance between disjoint release rows as `ReleaseCoupled`. The receipt records the class, count and up to eight identifiers. - A **lineage-only** `inference` (no `value` stage) can represent a shared posterior origin (like `planck_2018_base_lcdm_posterior` in `std.cosmology.cmb.planck_2018`) so downstream marginals (`planck_2018_h0`, `planck_2018_rd`) share a common `derived from` parent and cannot be combined as independent Gaussians. For a published upper-limit curve declared as `Table[GeV, cm^2]`, the vector inference can select by the candidate's rest energy: ```plumb value curve["upper_limit"] select model coordinate curve["rest_energy"] == wimp.rest_energy noise published_limit(confidence = 0.9) ``` A candidate that predicts `wimp.rest_energy = 9000 MeV` selects the 9 GeV row, even with a separate binding `at wimp_rest_energy = 40 GeV`. An imported alias denotes the same role. The role must have one certified value across the supplied point or box, and the selection must identify exactly one row. With `exclusion_contour`, an off-grid prediction yields `unassessed no_applicable_checker`. Selecting an observed response column through an alias of the same table yields `blocked unconsumed_bias`. For a deliberate lookup at a user-supplied energy, write `select mask covariate curve["rest_energy"] == query_energy` and bind `at query_energy = 40 GeV`. ### `def` — Pure Functions & Expressions ```plumb def E_flat(z : Dimensionless, Omega_m : Dimensionless) : Dimensionless = sqrt(1 + Omega_m * ((1 + z)^3 - 1)) def I_flat(z : Dimensionless, Omega_m : Dimensionless) : Dimensionless = integral(u in range(0, z), 1 / E_flat(u, Omega_m)) ``` Supported expression forms: - Arithmetic: `+`, `-`, `*`, `/`, `^`, unary `-` - Comparisons & logic: `==`, `!=`, `<`, `<=`, `>`, `>=`, `and`, `or`, `not` - Built-in constants & math: `pi`, `inf`, `ones`, `sqrt(x)`, `abs(x)`, `exp(x)`, `ln(x)`, `log10(x)` - Indexing: `my_table["col_name"]` - Binders & aggregations: `integral(u in range(a, b), body)`, `sum(row in my_table, body)`, `prod(...)`, `let x = e1 in e2`, `if cond then e1 else e2` Circular functions take an angle. For example, `sin(90 deg)` is exactly `1`, and one degree equals 3600 arcseconds. `tan(a)` requires an angle range free of poles. The principal inverse functions `asin`, `acos`, and `atan` return angles. The hyperbolic functions `sinh`, `cosh`, and `tanh` take and return dimensionless values. Use `deriv(x, e)` for a partial derivative with respect to an independent scalar coordinate. Its unit is the unit of `e` divided by the unit of `x`. For example, `deriv(a, sin(a)) * 1 rad` equals `cos(a)`. A derivative at a pole, a domain hole, or an unresolved branch boundary cannot be certified. In predictions, integration limits may vary across a parameter box. The enclosure covers the integrals for every pair of limits in the evaluated ranges, including reversed limits. Claim-based `certified_quadrature` requires closed limits that evaluate exactly. Use `certified_root` when a model defines a coordinate implicitly. The bracket endpoints must be strictly ordered with compatible units. Plumb checks that the residual has a derivative of one strict sign throughout the bracket and that the endpoint values enclose zero. An endpoint may itself be the root. For parameter boxes these conditions must hold for every assignment in the box being evaluated. The result encloses all corresponding roots. Its width can reflect parameter variation as well as numerical precision. ```plumb def implicit_coordinate(p : Dimensionless) = certified_root(x in range(1, 2), x^6 + p * x^3 - 18) claim coordinate_bound : forall p in [1, 2], 1.4 < implicit_coordinate(p) < 1.7 expect conditional_result by interval_enclosure ``` Root enclosures can be used in interval claims and theory predictions checked by `consistency_graph`. Use a bracket on which the residual is differentiable with a derivative bounded away from zero. Plumb currently requires an explicit formula if you need derivatives of the root as a function of other parameters. ### `theory` — Parameters, Assumptions, Definitions, and `extends` ```plumb theory flat_lcdm { H0 in [50, 90] km/s/Mpc Omega_m r_d : Mpc assume ontology.cold_dark_matter, regime.flat_lcdm_background def H_at(z : Dimensionless) : km/s/Mpc = H0 * E_flat(z, Omega_m) } ``` - Declare a free parameter as `name` or `name: Unit`. Give it a default box with `name in [lo, hi]` for dimensionless values or `name in [lo, hi] Unit` for a shared unit. A `consistency_graph` comparison uses the default box when it has no explicit `at` binding for that parameter. - `assume , ...` lists the premises the theory itself vouches for. - `def` members are functions and constants of the theory. A theory may **extend** another: ```plumb theory early_shift extends flat_lcdm { eps : Dimensionless in [0, 0.1] assume ontology.cand.early_shift def H_at(z : Dimensionless) : km/s/Mpc = (1 + eps) * H0 * E_flat(z, Omega_m) } ``` The child inherits the parent's parameters, definitions, assumptions, and predictions. A replacement keeps the inherited member's argument count and dimension (`P0301`). A definition can replace a parameter or vice versa. - An inherited prediction is evaluated **in the child**: it reads the child's members, including the ones the child replaced. - If the child replaces a member that a prediction reads, the child must supply any required premises that came from that prediction's `assuming` clause. Narrowing a parameter box with the same type preserves those premises. - A child prediction for a role takes precedence over the parent's prediction and premises for that role. - `extends` chains must not cycle (`P0330`). ### `predict` — From a Theory to Roles Write `predict = ` inside a theory to supply a value for that role. A named group can predict several roles together. ```plumb theory background extends flat_lcdm { predict cosmo.hubble_constant = H0 assuming regime.low_z_cosmography predict lcdm_bao assuming regime.template_near_fiducial { bao.d_m_over_r_d(z) = c * I_flat(z, Omega_m) / (H0 * r_d) bao.d_h_over_r_d(z) = c / (H0 * E_flat(z, Omega_m) * r_d) bao.d_v_over_r_d(z) = (z * d_m_over_r_d(z)^2 * d_h_over_r_d(z))^(1/3) } } ``` - Every target is a declared role, every arm is labelled with one target (by its full path or its last segment), and every target has exactly one arm (`P0302`, `P0121`). - An arm's body has the dimension of its role (`P0301`). - A binder takes the row's coordinate of the same name (a lone binder takes the row's only coordinate); any other binder takes the `at` binding of that name. - An arm may read a sibling role by its last segment or full path, as a value or applied to binders (`d_m_over_r_d(z)`). A binder or theory parameter of the same name takes precedence; write the full path to read the role. - A prediction's `assuming` clause satisfies `conditioned on ... requires` and enters the ledger only when that prediction is evaluated. ### `rule` — Reviewed Role-to-Role Maps A rule derives roles from other roles independently of the theory. `requires` lists premises that must already hold. `grants` lists premises the rule contributes when applied. ```plumb rule alpha_drift_from_log_slope: (atomic.alpha_log_slope, cosmo.hubble_constant) -> atomic.alpha_drift grants regime.alpha_log_slope_today = -alpha_log_slope * hubble_constant rule brans_dicke_ppn: (gravity.scalar_tensor_omega) -> gravity.ppn_gamma_minus_one requires regime.unscreened_solar_system grants regime.ppn_metric = -1 / (2 + scalar_tensor_omega) rule product_from_background : (cosmo.hubble_constant, cosmo.drag_horizon) -> cosmo.h0_rd, cosmo.rd_over_h0 { cosmo.h0_rd = hubble_constant * drag_horizon cosmo.rd_over_h0 = drag_horizon / hubble_constant } ``` A rule can limit its numeric domain with one or more `valid when` clauses after `requires` and `grants`. Each clause compares a declared input role to a numeric literal of the same dimension. For example, a rule with a lifetime input can specify a closed interval: ```plumb rule local_response: (neutron.total_mean_life) -> bbn.helium_mass_fraction requires ontology.sbbn_beta_decay, regime.yeh_2023_local_helium valid when total_mean_life >= 868.4 s valid when total_mean_life <= 888.4 s = yeh_2023_helium(total_mean_life) ``` Plumb checks the inputs supplied by the selected prediction or rule chain on each selected row. Every bound must hold over the entire declared comparison box, even if a proposed witness satisfies it. A failed or uncertifiable bound produces `blocked domain_violation`. Guarded inputs require scalar expressions with known dimensions throughout. Use the compared theory’s parameters and unqualified members. Coordinate-taking arms, implicit table rows, and theory-qualified member references cannot certify an input bound. Calling a `def` directly uses only its defining expression. Inside an arm each input role is in scope by its last segment or full path (and applied to binders when the role's producer takes them). Arms follow the same rules as prediction arms. For a role without a theory prediction, Plumb looks for a chain of up to six rules whose starting inputs the theory can predict. Each evaluated rule's grants enter the ledger and count toward conditioning. The receipt records the chain in `bridge_id`. - A prediction of the theory always outranks a rule. - No chain: `Blocked(MissingBridge)`. Two chains (two predictions of the same theory onto the role, or two rules that both reach it): `Blocked(AmbiguousBridge)` — Plumb never picks one for you. - Rules must not form a cycle (`P0330`). ### `condition` ```plumb -- Condition defines a reusable correspondence requirement over any theory `T : Theory` condition weak_field_limit(T : Theory, delta : Dimensionless) = forall x in (0, delta], 0 <= T.support_ratio(x) - 1 <= (1 - delta)^(-1/2) - 1 ``` ### `claim` and `compare` **`claim`** verifies pure mathematical, symbolic, quadrature, scaling, or Lean-certified statements: ```plumb claim scaling_degeneracy : forall s in (0, inf), invariant background.lcdm_bao under (H0, r_d) -> (s * H0, r_d / s) expect conditional_result by exact_scaling claim my_identity : 1 + 1 == 2 expect conditional_result by exact_rational -- Sidecar Lean 4 proof (target generated by `plumb lean goal`, scaffolded by `plumb lean init`): claim grav_u1 : sum(f in sm_family_charges, f["d3"] * f["d2"] * f["Y"]) == 0 assuming math.sm_three_weyl_families by lean "particle/proofs/grav_u1.lean" -- Existing local Lake project theorem: claim balance : 1 / 2 + 1 / 2 == 1 by lean theorem Model.balance from lake "formal" module Model ``` Claims can also test theory-condition correspondence (`T supports cond(...)` / `T conflicts cond(...)`), supply explicit `witness x = ...`, and declare `assuming ...`. **`compare`** tests one or more observables against a model: a `theory` (each observed role is produced by the theory's one prediction onto it, or by a chain of rules), a named prediction group (which must target every observed role), another observable `obs1 ~ obs2`, or a `condition`: ```plumb -- Point evaluation with exact `at` bindings compare single_point : obs_a ~ my_theory at H0 = 70 km/s/Mpc, Omega_m = 0.3 accept chi2 <= 16 expect compared by gaussian_ldlt -- Joint multi-observable consistency over a compact parameter BOX (`in [lo, hi]`) compare network_check : obs_a, obs_b, obs_c ~ my_theory at H0 in [60 km/s/Mpc, 80 km/s/Mpc], r_d in [140 Mpc, 155 Mpc], Omega_m = 0.3 accept chi2 <= 25 expect compared by consistency_graph ``` Supported `accept` budgets include `chi2 <= B`, `chi2 < B`, and `abs(pull) <= B` (and reversed forms like `B >= chi2`). Always supply a dimensionless budget; dimensional budgets are refused. Notes on `compare` bindings and multi-observable comparisons: - `at` only needs to bind parameters the evaluated arms actually read. Under `consistency_graph`, a parameter left unbound takes the default box its theory declares (`name in [lo, hi]`). - For a unitful interval in `at`, write the unit on both endpoints. The trailing-unit form belongs to theory parameter declarations. - A comparison against a theory resolves each observed role separately, so the observables may record distinct roles and units, and several observables of one role share one prediction (under `gaussian_ldlt`, `bounded_gaussian`, and `consistency_graph`). - Naming a prediction as the model selects that prediction even when its theory has another prediction onto the same role. - Run `plumb fmt ...` to normalize layout and decimal spelling. Scientific notation such as `2.1e-5` keeps its exponent. ### `scope` — Grouping, Sequential Gating (`after`), and `open` Phenomena ```plumb scope hubble_audit { check first_check check second_check after first_check open cluster_lensing "Not yet catalogued in this workspace." } ``` If `first_check` does not pass (`Blocked`, `Conflict`, `NonIdentifiable`, `Unresolved`, etc.), `second_check` is automatically gated as `Blocked(BlockedByUpstream)`. A referee can freeze observations, acceptance budgets, and audit policies before selecting a theory. A block can depend on a structural claim or another block in the same scope. In a multi-observation block, `obs.chi2` names the score for that observation and `chi2` names the joint score. ```plumb scope distance_tests { baseline reference_theory limit price <= 3, free_parameters <= 3 alpha 0.05 allow calibration.reviewed check anchor: local_distance accept chi2 <= 9 check pair: local_distance, distant_distance accept local_distance.chi2 <= 9, distant_distance.chi2 <= 4, chi2 <= 10 after anchor } ``` Frozen scope policies: - `baseline ` — sets the reference theory used to measure a candidate's added `free_parameters` (when the candidate extends the baseline) and `dropped_assumptions`. - `limit price <= N, free_parameters <= M` — caps candidate complexity (`price = free_parameters + numeric_literals + dropped_assumptions`) and added free parameters. `plumb fmt` normalizes each limit onto its own `limit ...` clause. - `alpha

` — records a decimal significance level strictly in `(0, 1)` on the frozen scope. - `allow ` — explicitly authorizes listed library assumptions when asserted by a candidate theory or prediction under audit. Any library `MathematicalPremise` that is `discharged by` a passing library claim is also admitted automatically into conditioned audit blocks without requiring an `allow` entry. A candidate can declare its theory and referee immediately after the imports. Use the imported scope's full name. ```plumb import std.atomic audit proposal against std.atomic.alpha_variation ``` Define `theory proposal` in the same module. Both `plumb check` and `plumb validate` evaluate the candidate's claims and the frozen scope. A linear fit declares its observation vector and a design matrix whose first axis names parameters and whose second axis names observations. Inside the fit, index a parameter by its axis item ID. ```plumb fit ladder: magnitudes ~ linear(design) as q emit (anchor: sn.absolute_magnitude = q["M_B"]) accept chi2 <= 12 by validated_gls ``` Each emitted label has a declared role. An emission can include exact affine combinations of the parameter coordinates. A named `view label(axis_a, axis_b)` groups emitted labels in the stated order. --- # 4. Uncertainties, Biases & Selection Every observable in Plumb carries an explicit affine forward model from physical truth to recorded numbers: $$x = \mu + A\epsilon + S u + W \delta$$ - $\mu$ is the central value (after any deterministic `transform`). - $A\epsilon$ is independent statistical noise (`noise gaussian(...)`). - $S u$ are **shared Gaussian nuisances** (`nuisance` attached via `shared ... along ...`). - $W \delta$ are **deterministic bounded systematics** (`bounded` attached inline or via top-level `shared ... along ...`). ## Published centres and fixed covariates A published centre or event count can be recorded with `value` alone. To score it statistically, declare the applicable uncertainty model. A shared or bounded term can supply the entire declared uncertainty. When a comparison reads a bare empirical centre on either side, including through a derived `value`, Plumb reports `blocked unspecified_uncertainty` and names the source. Adding Gaussian noise downstream leaves that source unresolved. When a definition transforms an observable, pass the observable as an argument, for example `value normalize(reading)`. This carries its uncertainty through the calculation. When a scalar or vector is a fixed input for a particular test, state the premise at its declaration. For example, a test may use the tabulated ordinates of a published likelihood scan exactly as released. ```plumb role scan.statistic: Dimensionless assumption stat.use_printed_grid: StatisticalModel "Use q at the precision tabulated for this grid point." inference released_ordinate: scan.statistic { value 2.71 noise none assuming stat.use_printed_grid } measurement cutoff: scan.statistic { value 5.99 noise published_limit(confidence = 0.95) } compare inside: cutoff ~ released_ordinate expect compared by exclusion_contour ``` The assumption appears in the comparison ledger. A noiseless theoretical prediction can still be written as a `prediction`. For a separate analysis that supplies a distribution for a published centre, declare the centre and its noise together in a new inference, name the model assumption, and record the original summary with `derived from`. This records provenance and leaves the original record available on its own terms. ## Two-sided published intervals Use `published_interval` when a source supplies both scalar endpoints, the interval level, and its statistical construction. Express the endpoints in the observable's physical dimension and the level as a fraction strictly between zero and one. Give the construction a `StatisticalModel` name. For a confidence interval, describe how the source established coverage. For a credible interval, state its prior and posterior construction. A likelihood-profile quantile can be reported in the source's own terms. A quoted pair of asymmetric errors alone does not specify any of these constructions. ```plumb role illustration.distance: m assumption stat.illustrative_posterior: StatisticalModel "Illustrative central 90% credible interval from a posterior with a uniform prior on distance between 0 and 10 m." inference released_distance: illustration.distance { noise published_interval(lower = 2 m, upper = 5 m, level = 0.9) assuming stat.illustrative_posterior } theory reference_distance { d: m predict illustration.distance = d } compare upper_endpoint: released_distance ~ reference_distance at d = 5 m expect compared by exclusion_contour ``` A source may also supply a `value` within the interval. Both endpoints are included at their declared precision. The checker compares one scalar prediction with one published set. A bounded shift shared by the endpoints translates the entire interval coherently. Shared shifts on the prediction pool with those on the interval. The receipt records `interval.lower`, `interval.upper`, `interval.level` and the prediction relative to those endpoint shifts. An entire predicted range inside the set gives `compared`, and a disjoint range gives `conflict`. Attainable bounded shifts on both sides of the membership decision give `systematics_limited`. Uncertified numerical overlap gives `unresolved`. Use a separate observation with a source-backed likelihood for Gaussian scoring or joint fits. ## Rule 1: Deterministic Bounds Never Enter Statistical Covariance (`P0312`) If a systematic error only has a worst-case limit ("this calibration drift is at most $\pm 0.02\text{ mag}$"), it is **not** a Gaussian random variable. Plumb forbids placing a `bounded` symbol inside a `gaussian(...)` covariance (`P0312`). Instead: - Use `gaussian_ldlt` when there are no bounded systematics (only statistical noise + shared Gaussian nuisances). - Use `bounded_gaussian` (or `consistency_graph`) when bounded systematics are present. Plumb evaluates the exact best-case and worst-case $\chi^2$ across the bounded box: - If **every** point in the box satisfies the budget -> **`compared`**. - If **no** point in the box satisfies the budget -> **`conflict`**. - If the box **straddles** the budget (some systematic shifts pass, others fail) -> **`systematics_limited`**, naming the exact `limited_by` systematic(s)! ## Rule 2: Shared Biases Pool Coherently and Cancel Exactly Plumb tracks every shared `nuisance` and top-level `bounded` systematic by its **canonical defining symbol** (even across module imports and `as` aliases). - **When combining two measurements jointly (`compare obs_a, obs_b ~ theory`):** Shared Gaussian nuisances add the full rank-1 cross-covariance $\sigma^2 S S^T$ across both blocks (including off-diagonal terms!). Shared bounded systematics share one single $\delta$ coordinate across both observables. - **When differencing two measurements (`inference diff ... value obs_b - obs_a` or `compare obs_b ~ obs_a`):** Their response vectors subtract! If both carry `shared zp_phot along 1` and `shared ceph_metal_sys along 1`, then $1 - 1 = 0$: **both shared systematics cancel completely and exactly**. This runnable example uses two synthetic Cepheid magnitudes and locally declared biases to demonstrate pooling, exact cancellation and a `systematics_limited` result. The nuisance scales are chosen for the example. ```plumb assumption calibration.synthetic_photometric_offset: CalibrationAndInstrument "Simulated shared magnitude zero-point." assumption calibration.synthetic_metallicity_shift: CalibrationAndInstrument "Simulated shared abundance-related magnitude shift." assumption stat.synthetic_cepheid_scatter: StatisticalModel "Simulated independent Gaussian magnitude errors." nuisance zp_phot: mag ~ gaussian(sigma = 0.015 mag) assuming calibration.synthetic_photometric_offset, stat.synthetic_cepheid_scatter bounded ceph_metal_sys: abs(delta) <= 0.020 mag assuming calibration.synthetic_metallicity_shift roles ceph { anchor_mag: mag host_mag: mag delta_mag: mag } measurement anchor_ceph: ceph.anchor_mag = 12.583 +- 0.01 mag { assuming stat.synthetic_cepheid_scatter shared zp_phot along 1 shared ceph_metal_sys along 1 } measurement host_ceph: ceph.host_mag = 22.583 +- 0.01 mag { assuming stat.synthetic_cepheid_scatter shared zp_phot along 1 shared ceph_metal_sys along 1 } -- Taking the differential magnitude cancels BOTH zp_phot and ceph_metal_sys exactly! inference delta_ceph: ceph.delta_mag { value host_ceph - anchor_ceph } theory ceph_model { mu_anchor: mag mu_host: mag M_W: mag predict anchor_prediction { ceph.anchor_mag = mu_anchor + M_W } predict ceph.host_mag = mu_host + M_W predict ceph.delta_mag = mu_host - mu_anchor } -- 1. Coherent pooling: zp_phot pools across both rows, and ceph_metal_sys shares one box coordinate. compare joint_pooled_passes: anchor_ceph, host_ceph ~ ceph_model at mu_anchor = 18.477 mag, mu_host = 28.477 mag, M_W = -5.894 mag accept chi2 <= 2 expect compared by bounded_gaussian -- 2. Exact cancellation: because both shared biases cancelled, plain gaussian_ldlt succeeds! compare differential_cancels_biases: delta_ceph ~ ceph_model at mu_anchor = 18.477 mag, mu_host = 28.477 mag accept chi2 <= 1 expect compared by gaussian_ldlt -- 3. Systematics-limited: shifting M_W by +0.03 mag makes the bounded systematic box straddle chi2 <= 4. compare joint_systematics_limited: anchor_ceph, host_ceph ~ ceph_model at mu_anchor = 18.477 mag, mu_host = 28.477 mag, M_W = -5.864 mag accept chi2 <= 4 expect systematics_limited by bounded_gaussian ``` ## Rule 3: Never Double-Count Nuisances (`includes` vs `shared`) Sometimes a published covariance matrix already marginalizes over a calibration nuisance. Declare that on the matrix artifact (and/or inside the JSON matrix's `"includes"` array): ```plumb artifact cov_with_zp : Matrix from "data/sn.cov_full.json" axes sn_axes includes zp_cal ``` Plumb then enforces two automatic protections: 1. **Same observable (`P0315`):** Declaring `shared zp_cal` on an observable whose covariance already `includes zp_cal` is a compile-time error. 2. **Cross-observable (`UnknownDatasetDependence`):** Combining, stacking, or directly comparing Observable A (whose covariance `includes zp_cal`, hiding its sensitivity vector) with Observable B (which either `shared zp_cal` or also `includes zp_cal`) is refused because the cross-covariance between A and B cannot be reconstructed. To combine them honestly, use statistical-only covariances plus explicit `shared zp_cal along ...` on both! ## Rule 4: Selection Stages — Covariate Masks vs Outcome Truncation Plumb enforces stage ordering and distinguishes two kinds of row selection: 1. **Covariate mask (`select mask covariate `):** Drops rows based only on independent covariates (e.g., `R > 2 kpc` or `z < 1.5`). Safe for Gaussian likelihoods — unless the mask secretly reads the measured outcome column (directly, through a `def`, or through an aliased table file), in which case Plumb detects the leak and refuses with `UnconsumedBias`! 2. **Outcome truncation (`select truncate observed `):** Drops rows based on the noisy measured value itself (e.g., Malmquist magnitude cut `x < 24.5 mag`). A plain Gaussian likelihood (`gaussian_ldlt` / `bounded_gaussian`) cannot ignore outcome truncation and refuses with `Blocked(UnconsumedBias)`. ## Correlations between observations Declare the cross-covariance when comparing two observations from a shared release or posterior. ```plumb correlated cal_flow: sn_cal, sn_flow cov survey_cov assuming stat.joint_gaussian ``` The checker matches selected rows against the matrix axes by release and row ID. A full covariance must also agree with each observation's own statistical covariance on the rows it covers. The assembled joint statistical covariance must be positive definite. A repeated data row still blocks the comparison. For two scalars, the covariance may be a quantity in the product of their units. A covariance between a speed per distance and a distance therefore has units of speed. Declare the source and conditioning premises of that covariance with `assuming`. A linear fit propagates the signed responses to each shared Gaussian nuisance and bounded systematic into its emitted coordinates. The statistical covariance stays separate. If the residuals also constrain a systematic, the receipt lists its symbol in `residual_constrained_systematics`. A joint check that shares this symbol needs the original observations in one fit. --- # 5. Stacking Modules, Lineage & Indirect Contradictions Plumb is built so scientific knowledge stacks cleanly across modules — just like theorems stack in a proof assistant. ## Compositional Stacking Across Modules A module can import verified upstream modules, reuse their constants, formulas, assumptions, shared systematics, and observables, and stack new derived observables or comparisons on top: - **Affine observable stacking:** Write `value obs_b - obs_a` or `value 2 * obs_a + obs_b`. Plumb automatically propagates noise covariances, pools or cancels shared nuisances and bounded systematics, and inherits every upstream assumption and `valid when` premise. - **Explicit lineage (`derived from`):** When a published summary (like SH0ES `shoes_2022_h0`) was inferred from earlier rungs (`shoes_2022_mb0`, `shoes_hubble_flow_aB`, `ngc4258_maser`, `lmc_deb`), declare `derived from ...`. Plumb transitively collects every upstream assumption into the finding's `AssumptionLedger` and blocks downstream checks if an upstream check failed or was blocked. - **Conditioning.** To compare against a conditioned inference, satisfy every premise in `requires` through the theory's `assume`, an evaluated prediction's `assuming`, or an evaluated rule's `grants`. Otherwise the result is `blocked incompatible_conditioning`. Plumb checks `valid when` row by row and over the full parameter box in `consistency_graph`. It reports `domain_violation` if it cannot certify the predicate. ## Roles Connect Models to Data A theory's prediction applies to every record of the role it targets. Declare a new record with that role to compare it against the same theory. ### Chaining rules to reach a role Plumb can chain up to six rules from the roles a theory predicts to the role a check needs. The ledger includes each applied rule's `grants`, and `bridge_id` records the chain. Here two rules derive the product $H_0 r_d$ from the expansion rate and excess radiation. ```plumb assumption stat.g: StatisticalModel assumption ontology.recomb: PhysicalOntology "Standard recombination history." assumption regime.background: RegimeApproximation "Flat background expansion." role particle.delta_neff: Dimensionless role early.drag_horizon: Mpc role early.rate: km/s/Mpc role early.rate_times_drag: km/s inference product_fit: early.rate_times_drag = 10187.1 +- 10 km/s { assuming stat.g conditioned on background_fit requires ontology.recomb, regime.background } theory early_universe { H0: km/s/Mpc dneff in [0, 2] predict early.rate = H0 predict particle.delta_neff = dneff } rule drag_from_neff: (particle.delta_neff) -> early.drag_horizon grants ontology.recomb = 147 Mpc * (1 - delta_neff / 100) rule product_from_background: (early.rate, early.drag_horizon) -> early.rate_times_drag grants regime.background = rate * drag_horizon -- No prediction targets `early.rate_times_drag`: the chain is composed, and `dneff` takes its declared box. compare product_through_rules: product_fit ~ early_universe at H0 = 70 km/s/Mpc accept chi2 <= 4 expect compared by consistency_graph -- Three or more extra species shorten the ruler too far for any point of the box. compare product_excludes_large_neff: product_fit ~ early_universe at H0 = 70 km/s/Mpc, dneff in [3, 5] accept chi2 <= 4 expect conflict certified_enclosure by consistency_graph ``` A prediction of the theory always outranks a rule; two rules that both reach the role are refused as `ambiguous_bridge`, and a cycle of rules is `P0330`. ### Inheritance: Variants That Face Their Consequences `theory Child extends Parent` inherits parameters, definitions, assumptions, and predictions. An inherited prediction reads the child's version of each member. Replacing a member the prediction reads clears its inherited `assuming` premises. ```plumb assumption stat.g: StatisticalModel assumption regime.standard: RegimeApproximation "The standard response." role demo.signal: Dimensionless inference signal_fit: demo.signal = 6 +- 1 { assuming stat.g conditioned on standard_fit requires regime.standard } theory standard { amp in [0, 10] def gain = 2 predict demo.signal = amp * gain assuming regime.standard } -- Replaces nothing the prediction reads: the prediction and its grant are inherited. theory relabelled extends standard { def note = 1 } -- Replaces `gain`, which the prediction reads: the prediction still predicts, but no longer grants. theory boosted extends standard { def gain = 3 } compare standard_fits: signal_fit ~ standard accept chi2 <= 1 expect compared by consistency_graph compare relabelled_inherits: signal_fit ~ relabelled accept chi2 <= 1 expect compared by consistency_graph compare boosted_must_grant_for_itself: signal_fit ~ boosted accept chi2 <= 1 expect blocked incompatible_conditioning from regime.standard by consistency_graph ``` Declare `assume regime.standard` inside `boosted` to run the comparison with the inherited prediction and the new `gain`. ## Automatic Graph Protections Before running statistics, Plumb builds a unified dependency graph across all loaded modules and enforces three strict guards: ### 1. Structural Cycles (`P0330`) Imports, `def`s, conventions, theories (including `extends`), predictions, rules, observables, `derived from`, `invariant` claim targets, and `scope ... after` dependencies must form a DAG. Any loop — direct or spanning multiple files — is rejected at check time with `P0330`. ### 2. Circular Calibration (`CircularCalibration`) You cannot test a theory or observable against data that already fed into the model side. Plumb traces every underlying **data leaf** (exact content SHA-256 + column for tables, or defining symbol origin for literal observables) on both the observed side and the model side. If they overlap (for example, comparing `cal_anchor` against a `prediction` or an inline `predict` arm derived from `cal_anchor`), Plumb refuses with `Blocked(CircularCalibration)`: ```plumb assumption stat.cal_gaussian: StatisticalModel role cal.flux: mag measurement cal_anchor: cal.flux = 12 +- 0.05 mag assuming stat.cal_gaussian prediction cal_self_model: cal.flux { value 12 mag derived from cal_anchor } compare circular_calibration_refused: cal_anchor ~ cal_self_model accept chi2 <= 4 expect blocked circular_calibration by gaussian_ldlt ``` ### 3. Aliased Data & Shared-Posterior Double Counting (`UnknownDatasetDependence`) Two observables in a joint `compare obs_a, obs_b ~ theory` (or two inputs stacked into one observable) must not read the same underlying data leaf: - Copying a JSON table to a second file name does not fool Plumb — data leaves are keyed by **content SHA-256**. - Combining an upstream rung with a downstream summary derived from it (e.g., `shoes_2022_h0` alongside `ngc4258_maser`) is refused. - Combining two published marginals from the **same posterior** (e.g., `planck_2018_h0` and `planck_2018_rd`, which both declare `derived from planck_2018_base_lcdm_posterior`) is refused so they can never be falsely treated as independent Gaussians. ## Indirect Contradictions & Minimal Conflict Cores (`consistency_graph`) When testing a network of measurements against a multi-parameter theory over a compact parameter box (`at p in [lo, hi], ...`), `consistency_graph` checks whether **one single shared parameter point** satisfies all measurements simultaneously within the budget: - **Feasible -> `Compared`:** Plumb finds and certifies a concrete witness point `(p_1, p_2, ...)` inside the box whose certified upper bound $\chi^2_{\text{hi}} \le \text{budget}$, and records the witness and bounds in the receipt's `measures`: - `chi2_min.lo` and `chi2_min.hi` — two-sided certified enclosure of the minimum joint $\chi^2$ over the box (refined past the first feasible witness). - `witness.

`, `witness.

.unit`, `at.

.unit`, and `param.

.lo` / `param.

.hi` / `param.

.unit` — witnesses and surviving parameter ranges converted back to each parameter's declared unit (`km/s/Mpc`, `Mpc`, `deg`, `rad`, `mag`, etc.). Systematic shift witnesses (`witness.systematic.

` so fixed-point refutations explicitly show what was held constant without polluting passing ledgers. Here is a runnable example where `obs_x`, `obs_y`, and `obs_sum` form an indirect contradiction (forcing `x + y = 0` vs `x = 5, y = 5`) while `obs_bystander` is completely consistent — and Plumb isolates the exact 3-observable minimal conflict core (`conflict_core = "obs_x,obs_y,obs_sum"`): ```plumb assumption stat.g: StatisticalModel role demo.x: Dimensionless role demo.y: Dimensionless role demo.s: Dimensionless role demo.b: Dimensionless measurement obs_x: demo.x { value 5 noise gaussian(sigma = 1) assuming stat.g } measurement obs_y: demo.y { value 5 noise gaussian(sigma = 1) assuming stat.g } measurement obs_sum: demo.s { value 0 noise gaussian(sigma = 1) assuming stat.g } measurement obs_bystander: demo.b { value 1 noise gaussian(sigma = 1) assuming stat.g } theory linear_net { x: Dimensionless y: Dimensionless b: Dimensionless predict demo.x = x predict demo.y = y predict demo.s = x + y predict demo.b = b } compare indirect_tension: obs_x, obs_y, obs_sum, obs_bystander ~ linear_net at x in [-10, 10], y in [-10, 10], b in [-10, 10] accept chi2 <= 9 expect conflict certified_enclosure by consistency_graph ``` A linear fit can add an upstream estimate with `pin p from upstream.p`. Use `pin (a, b) from upstream.view` for coordinates with joint covariance. Declare each upstream fit in one pin. Plumb checks parameter roles, the full data identity, nuisance pooling, and conditioning before using these rows. A fit factor's `mean` and `cov_stat` describe the estimate with the named systematic shifts fixed at zero. Signed loadings and bounded responses describe how the estimate moves with those shifts. When the residuals constrain a nuisance, comparing this conditional summary alone can give a different center, variance and verdict from a Gaussian-marginalized fit of the original data. Its center and variance can depend on how a published covariance was split into statistical noise and named loadings. Use the original data for the full joint fit. Plumb refuses to pin a factor carrying a residual constraint. It also blocks a comparison with another observation that shares the constrained nuisance. The consumer reports the upstream fit's chi-square separately. --- # 6. Verdicts, Receipts & CLI Reference Plumb reports a disposition for each claim, comparison, and open scope entry. ## Complete Table of Dispositions & `expect` Syntax You can assert the expected disposition right inside a `claim` or `compare` with `expect ...` (checked automatically by `plumb validate`): | Disposition / Outcome | `expect` syntax | Meaning | | --- | --- | --- | | `Evaluated(Compared)` | `expect compared` | Empirical comparison succeeded and stayed within the acceptance budget. | | `Evaluated(ConditionalResult)` | `expect conditional_result` | Theoretical or mathematical `claim` certified under its declared assumptions. | | `Evaluated(Conflict)` | `expect conflict exact_witness`
`expect conflict certified_enclosure`
`expect conflict declared_budget_exceeded` | Proven contradiction (exact point witness, certified enclosure across the full domain/box, or fixed-point budget exceeded). | | `Evaluated(NonIdentifiable)` | `expect non_identifiable` | Exact structural degeneracy / unbounded direction along a nonzero response. | | `Evaluated(SystematicsLimited)` | `expect systematics_limited [from , ...]` | Deterministic bounded systematic box straddles the acceptance budget. | | `Evaluated(Unresolved)` | `expect unresolved bound_too_loose`
`expect unresolved optimizer_inconclusive` | Checker could not certify pass or conflict within its precision/node budget. | | `Blocked` | `expect blocked [from ]` | Scientific prerequisite failed (see refusal reasons below). | | `OutOfScope` | `expect out_of_scope out_of_claimed_scope`
`expect out_of_scope regime_not_applicable` | Reserved for explicit scope exclusions. Current checks do not emit this disposition. | | `Unassessed` | `expect unassessed no_catalogue_entry`
`expect unassessed no_applicable_checker` | Declared `open` or no applicable checker exists. | The receipt format also reserves `unresolved timeout` and `unresolved insufficient_power` for future checkers. ### `RefusalReason` Values (for `expect blocked `) | Reason | When Plumb emits it | | --- | --- | | `missing_bridge` | No prediction of the theory (own or inherited) targets an observed role and no chain of at most six rules reaches it, or the named prediction does not target the role. | | `ambiguous_bridge` | Two predictions of the same theory target an observed role, or two rules both reach it. Name one prediction as the model, or remove the duplicate route. | | `missing_asset` | Referenced artifact is missing bytes or not pinned in the lockfile. | | `missing_assumption` | Required statistical/calibration premise is absent. | | `backend_unavailable` | A Lean obligation was reached on a host without a capable Lean/Lake backend (or with `PLUMB_LEAN_DISABLE=1`). | | `domain_violation` | Expression undefined on domain (e.g. division by zero, `log` of non-positive), empty quantifier box, or `valid when` premise failed / could not be certified. | | `incompatible_conditioning` | Observable's `conditioned on ... requires ...` assumption is not granted by the theory or by a prediction or rule the comparison evaluates (an inherited prediction stops granting once the child theory replaces something it reads). | | `unknown_dataset_dependence` | Two combined observables share a data leaf (same file SHA-256 + column or shared posterior origin), share a hidden `includes` covariance nuisance, or multiple alternative models share one observation (`joint(...)`). | | `unspecified_uncertainty` | A measurement or inference supplies a numerical value to a statistical comparison without a declared uncertainty model. The finding names the source. | | `axis_mismatch` | Row labels, row order, lengths, physical dimensions, or axis manifest digests do not match. | | `non_positive_definite_covariance` | Covariance matrix fails exact $LDL^T$ SPD check or has non-positive $\sigma$. | | `unconsumed_bias` | Outcome truncation (`select truncate observed`), outcome-dependent covariate mask, unconsumed bounded systematic under `gaussian_ldlt`, or post-selected Bell bound below Larsson threshold. | | `blocked_by_upstream` | An upstream check referenced via `scope ... after` or `derived from` did not pass. | | `circular_calibration` | The model side reads a data leaf that is also measured on the observed side. | ## Receipt Format (`plumb.receipt/v1`) Run `plumb check target.plumb --out runs/attempt-1` to write `receipt.json` and `report.md` in the attempt directory. - The `envelope` records the attempt ID, optional `predecessor_attempt_id`, time, Plumb version, target, execution state, and evidence digests. Passing `--parent ` on `plumb check` or `plumb audit` verifies the parent receipt's digests, completed execution state, and matching scope before linking `predecessor_attempt_id` (exiting `2` if tampered, missing, incomplete, or from a different scope). When `--parent` is passed with `--json` (even without `--out`), stdout emits the full `Receipt` JSON so the attempt chain stays intact. - The `body` records coverage counts, findings, expectation checks, and (for audits) `audit_summary`. Each finding gives its disposition, assumptions, active biases, checker and relevant measures. The `bridge_id` field identifies the prediction or rule chain when applicable. ## Auditing a candidate theory `plumb audit candidate.plumb --theory my_theory --scope std.cosmology.expansion` runs the frozen scope checks against the candidate's parameter boxes. The scope supplies observations, budgets, and policies (`baseline`, `limit`, `alpha`, `allow`). The candidate supplies assumptions (`*.cand.*`), theories, predictions and claims. An audit records candidate assertions in the assumption ledger. A conditioned observation needs a referee premise granted by the trusted theory, by an explicitly `allow`ed candidate grant, by a library `MathematicalPremise` discharged by a passing library claim, or by the predictions and rules that produce its own rows. Declare `audit my_theory against std.cosmology.expansion` in the module to run the same scope with `plumb check`. Every audit receipt and Markdown report includes a machine-readable `audit_summary`: - `status` — closed-enum overall audit verdict: `contradicted`, `vacuous`, `uncovered`, `unresolved`, `systematics_limited`, `accommodation`, or `not_contradicted`. - `next_action` — closed-enum next step for automated loops: `retire`, `reduce_freedom`, `provide_bridge`, `escalate_tier`, `supply_witness`, `tighten_or_justify`, or `hold_for_promotion`. - `complexity` — `{ free_parameters, numeric_literals, candidate_assumptions, dropped_assumptions, price }`: - `free_parameters` counts non-degenerate parameter boxes added beyond `baseline` (when the candidate extends `baseline`), or all free parameters otherwise; physical box endpoints are not double-charged as literals, while degenerate point-pinned boxes `[v, v]` are priced once. - `numeric_literals` evaluates pure candidate constant subexpressions (including arithmetic chains, unit ratios such as `1 Mpc / 1 km`, non-zero dimensionful literals, and 0-argument candidate `def`s) and charges every value outside the structural dimensionless set `{0, ±1, ±2, ±1/2}` (and exact `0` in any unit). - `dropped_assumptions` counts baseline grants absent from the candidate; `price = free_parameters + numeric_literals + dropped_assumptions`. - `exceeded_limits` — any `limit price <= N` or `limit free_parameters <= M` policies breached by the candidate (classifying the audit as `vacuous` / `reduce_freedom`). - `unused_parameters` — candidate-added free parameters that vanish after algebraic simplification across the planned scope blocks (catching cancelled knobs such as `0 * fudge` or `fudge - fudge`). An added parameter absent from this scope can be measured by another frozen scope that the audit loads. Inherited reference parameters are excluded. When all blocks are covered, unused parameters classify the audit as `vacuous` / `reduce_freedom`; when blocks are `Blocked`, `uncovered` (`provide_bridge` / `escalate_tier`) takes precedence. - `unsatisfied_conditioning` — conditioning requirements that still block a scope block after tier routing (below). They classify the audit as `uncovered` / `escalate_tier`. - `accommodation` — the predictive-surplus gate. When the scope declares a `baseline` and the candidate would otherwise be `not_contradicted`, Plumb evaluates the baseline against the same blocks and collects the observations of every certified conflict core. A parameter the candidate adds beyond the baseline that only conflict-core observations read (after algebraic simplification) explains nothing outside the conflict it absorbs. The audit is then classified `accommodation` / `reduce_freedom`, and `accommodation` lists the offending `parameters`, the baseline `conflict_core` and the `relabeled_assumptions` of the core observations the parameters act on. A parameter that also moves an observation outside the core keeps `not_contradicted`. Without a baseline, or when the baseline does not conflict, the gate does not apply. ### Tier routing with `supersedes_for` A candidate that drops an observation's conditioning premise is never excused from that observation. If the referee library declares a deeper-tier observation that supersedes it, the scope block faces that observation instead: ```plumb assumption ontology.lcdm_early : PhysicalOntology role cosmo.rd : Dimensionless role cosmo.theta : Dimensionless inference rd_planck : cosmo.rd = 147 +- 1 { conditioned on lcdm_fit requires ontology.lcdm_early } measurement cmb_early : cosmo.theta = 1.0411 +- 0.0003 { supersedes_for rd_planck when not ontology.lcdm_early } ``` When a candidate that does not grant `ontology.lcdm_early` reaches a block checking `rd_planck`, the block is evaluated against `cmb_early`. The candidate then needs a prediction for `cosmo.theta`, and it can pass or conflict there. The finding records the substitution in its `supersession` measure, for example `rd_planck -> cmb_early when not ontology.lcdm_early`, and the global joint uses the substituted observations. Only observations in the modules the scope's own module imports, directly or transitively, can supersede. A candidate cannot declare observations (`P0342`), so it cannot choose its own deeper tier. When no observation supersedes the summary, the block stays `blocked incompatible_conditioning`, and the audit is `uncovered` / `escalate_tier` with the requirement in `unsatisfied_conditioning`. The `global_joint` finding tests the covered blocks at one shared parameter assignment and retains each block's cuts. Its `joint.blocks` measure identifies the included blocks. If some blocks share a data source, `joint.excluded` explains each exclusion (and keeps `audit_summary.status` at `uncovered` / `escalate_tier` rather than claiming full joint coverage). If every pair overlaps, the joint finding reports the dependence. A successful check reports `param..lo`, `param..hi`, and `param..unit` in the parameter's declared unit. Use `--witness point.json` to propose a point such as `{"H0":"70.02 km/s/Mpc","Omega_m":"0.285"}`. Supply all free parameters used by the tested blocks. The receipt records the outcome for each block, including missing predictions, missing conditioning grants and explicitly open phenomena. ## External MCMC & Fitter Parity (`plumb parity`) Before launching an external MCMC sampler (Cobaya, emcee, NumPyro, Stan) or numerical optimizer, export Plumb's exact per-block $\chi^2$ and Gaussian log-likelihood (`-0.5 * chi2`, excluding the normalization constant) at a few fixed parameter points (including an off-optimum point with nonzero shared nuisance response): ```sh plumb parity candidate.plumb --theory my_theory --scope std.cosmology.expansion --points points.json --json ``` `points.json` accepts either a single JSON parameter map (`{"H0": "70 km/s/Mpc", "Omega_m": "0.3"}`) or an array of maps. Every point must specify all declared parameters of the theory as quoted quantity strings and stay inside each parameter's declared `[lo, hi]` box (missing or out-of-box parameters are refused with exit code `2`). Unlike `plumb audit --witness`, `plumb parity` evaluates **strictly at each fixed point** without searching parameter boxes, so external scripts can confirm zero unit, sign, axis-order, or shared-nuisance drift before running chains. ## Comparing Two Receipts (`plumb compare`) `plumb compare left/receipt.json right/receipt.json` checks the union of all check IDs across both receipts (exiting `0` with per-check `COMPARABLE` or `REFUSED` lines, or structured JSON with `--json`). A check is `Comparable` when both receipts evaluated it to `Compared` on the exact same dataset (matching `axis_sha256`, `observation_sha256`, `covariance_sha256`, `conditioning`, `metric`, `unit`, and `active_biases`), while allowing candidate predictions (`prediction_sha256`) to differ. Typical 2-model pattern: 1. Put shared artifacts and observables in `data_module.plumb`. 2. Create `model_a.plumb` and `model_b.plumb`, each doing `import data_module` and declaring `compare main_fit: my_obs ~ ...` with the same check name `main_fit`. 3. Run `plumb check model_a.plumb --out runs/a`, `plumb check model_b.plumb --out runs/b`, and `plumb compare runs/a/receipt.json runs/b/receipt.json`. ## CLI Reference & Exit Codes All commands support `--json` for machine-readable output. | Command | Purpose | | --- | --- | | `plumb check [--out

] [--parent ] [--std ]` | Check a `.plumb` module, optionally chain to a verified parent receipt, and write an atomic receipt + report. | | `plumb audit --theory --scope [--witness ] [--parent ] [--out ] [--std ]` | Test a theory against a frozen library scope and emit `audit_summary` (`status`, `next_action`, `complexity`). | | `plumb parity --theory --scope --points [--std ]` | Export exact per-block $\chi^2$ and Gaussian log-likelihood at fixed parameter points for external MCMC/fitter parity checks. | | `plumb fmt ... [--check]` | Format one or more `.plumb` modules into canonical layout. | | `plumb lock [path] [--check]` | Generate or verify `plumb.lock` (or `std/lock.json` for `std`), automatically pinning referenced `.lean` proofs and local Lake inputs. | | `plumb validate [path]` | Verify lockfiles, strict JSON schemas, every module, and every `expect`. | | `plumb trace [check]` | Print the full transitive assumption, bias, and discharged-premise/Lean-axiom chain for a receipt. | | `plumb compare ` | Run the comparability gate across two receipts. | | `plumb show >` | Summarize a receipt, describe a checker, or print a `std` module verbatim. | | `plumb list checkers` | List all 19 built-in `by ` verification checkers. | | `plumb explain ` | Explain a diagnostic code (e.g., `plumb explain P0315`). | | `plumb lean goal [--claim ]` | Print the Plumb-generated Lean 4 theorem target for the selected claim. | | `plumb lean init --claim [--force]` | Scaffold a sidecar `.lean` proof file for a `by lean "..."` claim. | | `plumb doctor [--lean]` | Show Plumb’s version. Use `--lean` for backend and cache diagnostics. The JSON report includes those diagnostics with either spelling. | | `plumb doc [topic \| std. \| --all \| --search \| --llms]` | Read, search, or export this built-in user guide or any `std` module. | ### Exit Codes - **`0`** — Completed cleanly. Note that scientific `Conflict`, `Blocked`, `NonIdentifiable`, `SystematicsLimited`, and `Unresolved` dispositions are valid audit outcomes and exit **`0`**! - **`2`** — Preflight or input error: bad CLI usage, syntax/type/cycle diagnostic, malformed JSON or duplicate JSON key, lockfile or SHA-256 mismatch, missing file, failed `expect` during `validate`, or refusing to overwrite an existing `--out` attempt directory. - **`3`** — Internal or I/O execution error. Dense covariance checks can reuse an authenticated positive-definiteness certificate in your private cache. The attempt envelope lists reused certificate keys in `certificate_memo_hits`. The checker recomputes residuals and test statistics on every attempt. Use `--no-cache` with `check`, `audit`, or `parity` to reproduce a cold check. Set `PLUMB_CACHE_DIR` to choose an owner-only cache directory outside the workspace. A successful linear fit writes its emitted views under `body.emitted`. Each view includes named axes with roles and units, certified mean and statistical covariance intervals, input digests, assumptions, and the minimum chi-square of the upstream fit. A comparison uses one joint view when it needs multiple coordinates from the same fit. Two separate projections share the fit's data identity and would count the same evidence twice. A factor produced using a pin also carries the upstream data identity and assumption ledger. Its downstream chi-square measures the agreement of the new data with the pinned estimates. --- # 7. Built-In Checkers & Diagnostics ## Built-In Claim Checkers (`claim ... by `) | Method | Best for | What it certifies | | --- | --- | --- | | `exact_rational` | Exact arithmetic identities and finite sums/products over inline tables and typed `Table` artifacts | Exact rational arithmetic (`Q`) with zero rounding error. | | `exact_enumeration` | Finite discrete checks (e.g., Bell/CHSH local vertices) | Exhaustive exact evaluation over finite sets. | | `exact_symbolic` | Polynomial, radical-field, and domain-guarded transcendental identities | Symbolic equality/inequality in exact polynomial/radical form, symbolic `deriv`, and domain-checked `exp`/`ln`/`sqrt` reductions. | | `exact_scaling` | Structural non-identifiability (`forall s in (0, inf), invariant prediction under ...`) | Exact multiplicative scaling invariance (even through integrals like `I_flat`). | | `exact_witness` | Existential or counterexample witnesses (`witness x = ...`) | Exact evaluation of the supplied witness point. | | `sos_certificate` | Global polynomial positivity | Sum-of-squares positivity certificate. | | `finite_monotone_bound` | Theory correspondence on finite intervals (`T supports cond(...)` / `T conflicts cond(...)`) | Certified finite-domain enclosure and monotone error bounds. | | `interval_enclosure` | Inequalities involving `sin`/`cos`/`tan`, `sinh`/`cosh`/`tanh`, `atan`/`asin`/`acos`, `log10`/`ln`/`exp`/`sqrt`, `let`, `if`, `deriv`, `certified_root`, `pi`, `pc` | Outward-rounded validated interval arithmetic, including finite sums and products over pinned typed tables in claim goals. | | `exact_quadrature` | Exact polynomial integrals | Exact integration of polynomial integrands. | | `certified_quadrature` | Transcendental integrals (e.g., `r_d_comoving`, `I_flat`) | Certified adaptive Gauss-Legendre quadrature with rigorous remainder bounds. | | `asymptotic_ratio` | Limit ratios with explicit remainder premises | Asymptotic limit ratio verification. | | `lean` | External machine-checked Lean 4 proofs | Verifies a sidecar proof (`by lean "proofs/file.lean"`) or local Lake theorem (`by lean theorem Mod.thm from lake "formal" module Mod`) against the Plumb-generated target and audits exact transitive axioms. | ### When & How to Use Lean 4 (`by lean`) Plumb's built-in checkers intentionally cover a compact set of exact rational, polynomial/radical, scaling, SOS, interval, derivative, quadrature, and asymptotic shapes. Whenever a closed comparison `claim` (rational arithmetic, table folds, or identities lowered by Plumb) needs a machine-checked proof — or draws on a general Lean proof inside a locally vendored **Mathlib** / **Physlib** or custom Lake project to prove that target and discharge a `MathematicalPremise` — **use Lean 4** rather than hacking around `Unresolved`: - **Sidecar proofs (`by lean "proofs/file.lean"`):** Run `plumb lean goal model.plumb --claim balance` to inspect the exact Lean theorem target Plumb generates, and `plumb lean init model.plumb --claim balance` to scaffold the sidecar proof file. For closed rational arithmetic and table folds, `by decide +kernel` checks the decision procedure in Lean's kernel. Paths are relative to the workspace root (or `std/` for standard-library proofs). Run `plumb lock` after changing a proof in a locked workspace. - **Existing Lake projects:** Write `by lean theorem Model.balance from lake "formal" module Model`. Plumb auto-pins the local Lake sources and builds them offline in the sandbox before verifying the theorem against its independently generated target. Because builds run offline without network access, external dependencies such as Mathlib or Physlib must already be locally vendored/staged inside the pinned Lake project rather than fetched during `plumb check`. - **System Lean, verification modes, caching, and diagnostics:** Plumb automatically discovers system Lean / `~/.elan` (honoring `lean-toolchain` when present). When `lake comparator` and sandboxing are available, Plumb verifies exported proof terms in isolation without loading untrusted `.olean` files; on older toolchains without `lake comparator`, Plumb compiles in the sandbox and replays the kernel environment without loading untrusted extensions (cross-checking `#print axioms`). Verification subprocesses are bounded by a timeout (`PLUMB_LEAN_TIMEOUT_SECS`, default `120` seconds). Verified results are cached in a private (`0700`) user cache outside the workspace and project git repositories so warm checks run in milliseconds. Run `plumb doctor --lean` to inspect backend mode and whether the local cache is active (or why it is disabled). A machine without Lean reports `blocked backend_unavailable` only on reachable Lean checks. - **Discharging premises:** A `MathematicalPremise` can declare `states ` followed by `discharged by `. The supplying claim must establish the same proposition; its own assumptions and exact Lean axioms remain visible in `receipt.json` and `plumb trace`. ## Built-In Compare Checkers (`compare ... by `) | Method | Best for | What it certifies | | --- | --- | --- | | `gaussian_ldlt` | Point comparisons with Gaussian noise and shared Gaussian nuisances | Checks positive definiteness and evaluates $\chi^2$ with shared nuisances. Large and decimal covariance blocks support certified enclosures with bounded offsets. | | `bounded_gaussian` | Point comparisons with Gaussian noise + deterministic `bounded` systematics | Exact $LDL^T$ combined with box/vertex evaluation over bounded systematics (`compared`, `conflict`, or `systematics_limited`). | | `consistency_graph` | Multi-observable networks over compact parameter boxes (`at p in [lo, hi]`) | Certified joint feasibility witness with two-sided $\chi^2_{\min}$ enclosure, declared-unit bounds/witnesses, and `q_dmap` partition tension — OR proven `Conflict(CertifiedEnclosure)` with MARCO all-MUS minimal conflict cores (`conflict_cores`). | | `gaussian_bound` | Scalar Gaussian upper/lower bound tests (e.g., Bell/CHSH without post-selection) | Certified Gaussian bound comparison. | | `postselected_bound` | Post-selected Bell/CHSH tests (`select truncate latent coincidence(efficiency = eta)`) | Enforces Larsson's post-selected local bound $4/\eta - 2$ before testing. | | `published_null_test` | Comparing a theory against a published null interval/bound | Certified null-bound test. | | `exclusion_contour` | Testing a prediction against a published upper limit or a scalar `published_interval` | Membership in the released set, including its endpoints. | For Gaussian comparisons, covariance blocks with more than 64 rows and decimal CSV covariance matrices produce certified bounds `chi2.lo` and `chi2.hi`. For a joint budget `chi2 <= B`, an upper bound at or below `B` establishes agreement and a lower bound above `B` establishes conflict. A bound that straddles the budget can leave the result `unresolved bound_too_loose`, as can a covariance too close to singularity to certify. Shared Gaussian uncertainties enter once per declared nuisance. Bounded offsets retain their declared ranges. ## Common Diagnostic Codes (`plumb explain `) | Code | Name | Quick fix | | --- | --- | --- | | `P0107` | `Juxtaposition` | Insert `*` between a number and an identifier or call (`2 * pi`, not `2 pi`). | | `P0108` | `MixedChain` | Keep comparison chains monotonic (`0 <= x <= 1`) or join with `and`. | | `P0109` | `LooseUnit` | Attach exponents directly to the unit (`2 kpc^2`) or parenthesize (`(2 kpc)^2`). | | `P0120` | `UnresolvedName` | Check spelling/qualification or add the missing `import`. A `...` role, prediction target, or rule input must be a declared `role`. | | `P0121` | `DuplicateDefinition` | Rename the colliding symbol (watch out for `std.core` constants like `c`, `h`, `G` when `import std.core` is active — or use selective imports!). | | `P0124` | `UnknownUnit` | Use a symbol from the unit table in `plumb doc language`. For unlisted prefixes, write the scale explicitly, as in `1e-3 s`. | | `P0207` | `MethodGoalMismatch` | Pick a verification method matching your goal shape (see tables above). | | `P0301` | `DimensionMismatch` | Fix unit arithmetic so both sides of `==`, `<=`, `+`, `-`, or parameter/return annotations have matching physical dimensions. Also raised when an observable's unit, a prediction or rule arm, a parameter's default box, or a member that replaces an inherited one does not have the dimension it must. | | `P0302` | `RoleMismatch` | Compare observables with matching roles, or connect a theory via an inline prediction. Also raised when an axis manifest row names a role that is not declared (or a bare name several roles share), an arm is labelled with a role that is not a target, or a target has no arm. | | `P0312` | `BoundedInCovariance` | Keep `bounded` systematics out of `gaussian(...)`; attach them with `bounded` or `shared` and use `bounded_gaussian` / `consistency_graph`. | | `P0315` | `NuisanceDoubleCounted` | Do not declare `shared u` on an observable whose covariance already `includes u` (or duplicate `shared u`). | | `P0321` | `PredictionWithoutLineage` | Add `derived from ` to every `prediction`. | | `P0322` | `OntologyInMeasurement` | Move `PhysicalOntology` assumptions off `measurement`; declare the model-conditioned quantity as `inference ... conditioned on ... requires ...`. | | `P0323` | `InvalidSupersession` | Declare `supersedes_for` on a `measurement` or `inference` that replaces a different `measurement` or `inference`, naming only assumptions from that observation's `conditioned on ... requires` clause. | | `P0330` | `DependencyCycle` | Break the circular dependency in imports, `def`s, observables, predictions, rules, `extends`, or `scope after`. | | `P0341` | `CandidateShadowing` | Give a candidate declaration or import alias a name distinct from the referee and standard library. | | `P0342` | `CandidateForbiddenItem` | Keep observations, rules, acceptance budgets and the audit scope in the referee library. | | `P0343` | `CandidateAssumptionNamespace` | Declare each new candidate premise under `.cand.`. | | `P0401` | `RowCountMismatch` | Match the `rows N` pin on `artifact` with the actual number of rows in the JSON file. | | `P0402` | `ArtifactHashMismatch` | File bytes differ from `plumb.lock`; verify the change and re-run `plumb lock`. | | `P0403` | `HashHole` | Run `plumb lock` so the artifact's SHA-256 is recorded in `plumb.lock`. | | `P0404` | `InvalidDataArtifact` | Supply complete bytes in the declared format. For a Git LFS pointer, run `git lfs pull`. | | `P0405` | `ArtifactShapeMismatch` | Check covariance dimensions, manifest identity and axis order. | | `P0406` | `ReleaseRowConflict` | Check the release statement, object catalogue, duplicate IDs and metadata for repeated rows. | | `P0407` | `InvalidFoldTable` | Supply a pinned, nonempty typed `Table` with matching axes, complete numeric columns and values within the fold resource limits. | `validated_gls` is the method for a linear `fit`. P0316 flags an emission that cannot be expressed as an affine function of the named fitted coordinates with exact rational coefficients. A linear fit reports a certified interval for the minimum chi-square, its degrees of freedom and each fitted coordinate. The `qhat` receipt measures and `q["axis_id"]` in acceptance conditions use the same Gaussian-marginalized covariance as the minimum chi-square. With bounded shifts they enclose the fitted coordinate over all allowed shifts. A dependent design returns `non_identifiable`. If a covariance null direction carries a data contrast, inspect `nullspace.contrast`. A declared `projected by B` fits the projected data and design after checking the range basis against the covariance. The receipt identifies the basis and its rank. `P0317` identifies split pins from one fit. Declare the needed coordinates in one upstream view and pin that view once. `P0302` identifies a role mismatch between a pinned axis and the consuming parameter. --- # 8. Standard Library (`std/`) Reference Use `plumb doc std.` to inspect the declarations and their sources. You can import the bundled modules directly in your own checks. ```sh plumb doc std.astroparticle.solar_neutrinos plumb doc std.particle.z_pole plumb doc std.condensed.hall_fractional ``` ## Comparisons using published data - **SNO salt-phase solar neutrinos.** The module transcribes the shape-constrained charged-current, neutral-current and elastic-scattering fluxes and reconstructs their statistical covariance. A single pair of electron and muon-plus-tau fluxes meets the joint budget `chi2 <= 25`. The electron-only null conflicts over the declared flux range without a solar production normalization prior. Both results use the undistorted boron-8 shape, nominal calibration and statistical covariance only. A systematics-inclusive comparison, spectral distortions and oscillation-parameter fits require further evidence. - **LEP-I Z line shape.** The module contains the joint LEP-I summary for the Z mass, hadronic peak cross section and hadronic-to-leptonic width ratio. At `chi2 <= 25`, the width relation admits three light neutrinos and excludes four. The comparison lets the shared mass and hadronic-to-leptonic ratio vary over five published standard deviations on either side of their central values, with $\Gamma_\nu/\Gamma_\ell$ from 1.99042 to 1.99208. The exclusion applies to an extra light species with the Standard Model Z coupling under the published extraction. The updated invisible-width inference reuses the same LEP data. - **Fractional quantum Hall resistance.** Six Ahlers et al. bridge readings test applying the ideal 6:1 fractional-to-integer resistance ratio at finite current. With nominal statistical errors and the declared systematic bounds, 82 nA is compatible, 161.5 nA is systematics-limited, and the four readings from 326 to 1302.5 nA conflict at `chi2 <= 25`. The separate published 95% interval extrapolated to zero longitudinal resistance includes the ideal difference. The finite-current conflicts concern the current-independent prediction and are sensitive to the assumed noise scale. - **Optical clock ratios.** The BACON closing point meets `chi2 <= 9`. Shifting Al⁺/Sr alone by $4 \times 10^{-18}$ at the same point gives $\chi^2 \approx 18.78$ with the published correlations and $\chi^2 \approx 2.97$ with only the marginal variances. This tests closure at a fixed point of the published Gaussian summary. - **MICROSCOPE free fall.** Equal Ti/Pt free fall passes for every allowed systematic shift at `chi2 <= 4` and is systematics-limited at `chi2 <= 1`. This uses the published Earth-signal fit and the adopted systematic envelope. ### Run the SNO comparison Save this as `sno_salt.plumb` and run `plumb check sno_salt.plumb`. The standard library supplies the data, assumptions and detector response rules. ```plumb import std.astroparticle.solar_neutrinos theory sno_boron8_fluxes { electron_flux: cm^-2/s mu_tau_flux: cm^-2/s assume ontology.sno_weak_response, regime.sno_boron8_undistorted, calibration.sno_salt_signal_extraction predict solar_neutrino.boron8_e_flux = electron_flux predict solar_neutrino.boron8_mu_tau_flux = mu_tau_flux } compare active_appearance: sno_salt_fluxes_stat ~ sno_boron8_fluxes at electron_flux = 1.72e6 cm^-2/s, mu_tau_flux = 3.09e6 cm^-2/s accept chi2 <= 25 expect compared by gaussian_ldlt compare electron_only_null: sno_salt_fluxes_stat ~ sno_boron8_fluxes at electron_flux in [0 cm^-2/s, 10e6 cm^-2/s], mu_tau_flux = 0 cm^-2/s accept chi2 <= 25 expect conflict certified_enclosure by consistency_graph ``` ## Module index ### Constants, roles and mathematical tools | Module | What it provides | | --- | --- | | `std.core` | SI and IAU constants including `c`, `h`, `hbar`, `k_B`, `e_charge: C`, `N_A: 1/mol`, `R_gas: J/mol/K`, `AU`, `pc`, and `GM_sun: m^3/s^2`. Supplies adopted `m_e` and `G` and the uncertainty-bearing CODATA 2022 records `m_e_codata2022` and `G_codata2022`. | | `std.math.correlated_estimates` | Two-input best linear unbiased estimation (BLUE), its covariance conditions and variance identities. | | `std.math.rational` | `equal_half_weights`, a Lean proof that two equal half-weights sum to one. | | `std.metrology.gravitational_constant` | The correlated CODATA 2022 adjustment of Newton’s constant and its common uncertainty expansion. | | `std.statistics` | The dimensionless common-mean role, the Birge ratio and chi-square under a common uncertainty scale. | ### Astronomy, cosmology and solar physics | Module | What it provides | | --- | --- | | `std.astronomy.galaxies.rotation` | Line-of-sight and in-plane speeds, disk projection, radius rescaling and baryonic force contributions. | | `std.astronomy.galaxies.sparc` | SPARC rotation curves for UGC 6930 and UGC 7577 and the published flat-speed selection. | | `std.astronomy.ladder.cepheids` | Near-infrared Wesenheit period–luminosity–metallicity relation and conditioned Magellanic Cloud period and iron-abundance slopes. | | `std.astronomy.ladder.h0dn` | H0DN V00 projected local distance scale. | | `std.astronomy.ladder.mw_parallax` | Milky Way Cepheid parallaxes and photometry, a residual Gaia zero-point model and shared fit lineage. | | `std.astronomy.ladder.overlap` | TRGB-based supernova calibrations from Anand et al., host-covariance sensitivity and shared SH0ES events. | | `std.astronomy.ladder.parallax` | NGC 4258 and LMC geometric anchors with shared systematic uncertainty scales, plus angular parallax and distance modulus functions. | | `std.astronomy.ladder.same_host` | Matched stellar-indicator host distances. | | `std.astronomy.ladder.trgb` | NGC 4258 outer-halo blue TRGB calibration and uncertainty propagation from the maser distance. | | `std.astronomy.photometry` | Rest-frame B-band peak magnitude, photon-counting flux conversions and ST, AB and Vega magnitudes. | | `std.astronomy.photometry.bolometry` | IAU bolometric magnitude zero points and conversions from luminosity and irradiance. | | `std.astronomy.photometry.differential` | Same-exposure magnitude differences and cancellation of an additive photometric zero point. | | `std.astronomy.photometry.ogle_q2237` | Six OGLE Huchra’s Lens observations and the contrast between two image light curves. | | `std.astronomy.photometry.wfc3_f814w` | HST WFC3/UVIS F814W inverse sensitivities and transfer between detector chip calibrations. | | `std.astronomy.sirens.gw170817` | GW170817 host velocities, fixed-sky distance and prior-conditioned Hubble constant and inclination summaries. | | `std.astronomy.stars.helioseismology` | BiSON p-mode spacing curvature from activity-corrected and solar-minimum frequency summaries. | | `std.astronomy.stars.solar_cno` | Borexino CNO rate profile and model-conditioned photospheric carbon-plus-nitrogen abundance. | | `std.astronomy.supernovae` | Type Ia magnitude, luminosity distance and intercept functions. | | `std.astronomy.supernovae.des_dovekie` | DES-Dovekie survey-separated magnitude compression. | | `std.astronomy.supernovae.pantheon_plus` | SH0ES-disjoint Pantheon+ magnitude compression. | | `std.astronomy.supernovae.shoes_2022` | SH0ES 2022 calibrator magnitude, Hubble-flow intercept and local Hubble constant with shared fit lineage. | | `std.cosmology` | Eight expansion blocks plus DES Y6 shear, evaluated at one shared point. | | `std.cosmology.age` | Globular-cluster age constraints. | | `std.cosmology.bbn` | Cooke primordial deuterium and Aver helium. | | `std.cosmology.bbn.deuterium` | Primordial deuterium from metal-poor absorbers, CMB-calibrated BBN predictions and baryon-density comparisons. | | `std.cosmology.bbn.helium` | Local primordial helium response to neutron lifetime at fixed baryon density and nuclear rates. | | `std.cosmology.bbn.primordial` | Cooke deuterium and Aver helium, excess-radiation rules and central-rate abundance responses. | | `std.cosmology.chronometers` | Correlated cosmic chronometer rates. | | `std.cosmology.cmb.firas` | The 43-channel COBE/FIRAS monopole table and reproduction of its peak-normalized post-fit residual RMS. | | `std.cosmology.cmb.firas_fit_rank` | Local design-rank checks for the FIRAS temperature and Galactic foreground fit at zero distortion. | | `std.cosmology.cmb.firas_residual_metric` | The covariance-weighted quadratic of the 43 released FIRAS residuals at the published fit. | | `std.cosmology.cmb.early_lcdm` | Early-CMB compression using PR4 CamSpec spectra, PR4 lensing and the PR3 SimAll low-E likelihood. | | `std.cosmology.cmb.planck_2018` | Planck 2018 marginals and shared likelihood lineage. | | `std.cosmology.cmb.temperature_scaling` | CMB temperature as a function of redshift under adiabatic expansion. | | `std.cosmology.cpl` | Time-varying equation-of-state background functions. | | `std.cosmology.duality` | Artola distance-duality tilt. | | `std.cosmology.expansion` | SH0ES, Pantheon+, BAO, early CMB, deuterium, helium, chronometers and cluster age. | | `std.cosmology.expansion.dovekie` | DES-Dovekie, DESI DR2 BAO and SH0ES magnitude. | | `std.cosmology.expansion.h0dn` | H0DN joint magnitude and Hubble scale, early CMB and DESI DR2 BAO. | | `std.cosmology.flrw` | Flat-background functions `E_flat(z, Omega_m)` and `I_flat(z, Omega_m)`, with roles for the Hubble constant, drag horizon, matter density and BAO ratios. | | `std.cosmology.growth` | DESI DR1 LRG2 growth and DES Y6 shear. | | `std.cosmology.lcdm` | Reference theories flat_lcdm_background and flat_lcdm_growth. | | `std.cosmology.lss.desi_dr2_bao` | DESI DR2 compressed BAO, covariance and the free-ruler scaling claim. | | `std.cosmology.lss.growth` | The eBOSS DR16 LRG consensus on transverse distance, radial distance and the growth rate, with their joint covariance. | | `std.cosmology.lss.lensing` | ACT CMB lensing and DES cosmic shear amplitude summaries, with conditioning and BAO lineage. | | `std.cosmology.particle_cosmo` | Muon anomaly, helium, free radiation, ruler, deuterium and CCFR trident production. | | `std.cosmology.propagation` | Etherington distance duality and the measured tilt. | | `std.cosmology.recombination` | Baryon–photon ratio, plasma sound speed, and a certified integral for the drag horizon in scale factor. | | `std.cosmology.same_host` | Cepheid and TRGB differences in ten paired hosts. | | `std.plasma.qtn_density` | Parker Solar Probe electron densities from quasi-thermal noise and time-matched proton densities. | | `std.plasma.solar_wind` | Parker Solar Probe co-sampled field and proton window means and tests of the isotropic Walén relation. | ### Gravity, orbits and geophysics | Module | What it provides | | --- | --- | | `std.geophysics.clock_levelling` | Skytree height and gravity survey, terrestrial geopotential redshift and strontium clock comparisons. | | `std.geophysics.earth_energy_budget` | Earth-system heat uptake and matched CERES radiation and ocean heat-content trends. | | `std.geophysics.earth_inertia` | PREM density integrals for Earth’s mass and inertia, with geodetic and orbital reference summaries. | | `std.geophysics.geoneutrinos` | KamLAND prompt-energy data, KamLAND and Borexino fit summaries, and radiogenic heat under a mantle model. | | `std.geophysics.normal_gravity` | WGS 84 normal gravity on the rotating reference ellipsoid. | | `std.geophysics.seismic_elasticity` | PREM middle lower-mantle profiles and isotropic elastic wave-speed relations. | | `std.gravity` | Cassini and MESSENGER PPN inferences, Brans–Dicke rules, and scopes `std.gravity.cassini` and `std.gravity.solar_and_cosmo`. | | `std.gravity.antimatter` | BASE antiproton charge-to-mass and solar clock constraints, alongside the ALPHA-g antihydrogen acceleration summary. | | `std.gravity.horizon_scale` | Sagittarius A* emission ring and shadow summaries with VLTI and Keck orbital conditioning. | | `std.gravity.mass_sheet` | Single-plane lensing and the mass-sheet transformation of image shapes and magnifications. | | `std.gravity.microscope` | Final MICROSCOPE Ti/Pt Eötvös ratio with its statistical error and an explicit residual systematic envelope. | | `std.gravity.roles` | `gravity.ppn_gamma_minus_one` and `gravity.yukawa_range_limit_unit_strength: um`. | | `std.gravity.weak_field` | Weak-field clock redshift and the combined Galileo hydrogen-maser fit. | | `std.orbital` | Keplerian sidereal-year check, Mercury perihelion advance and PSR B1913+16 orbital decay with a bounded Galactic correction. | | `std.orbital.binary_motion` | Mass ratio from the two velocity semi-amplitudes of a double-lined spectroscopic binary. | | `std.orbital.pulsar_j0737_3039` | Double Pulsar orbital decay, external acceleration corrections and intrinsic timing inference. | | `std.orbital.pulsar_timing` | Secular binary-pulsar timing, apparent proper-motion decay and Galactic acceleration corrections. | | `std.relativity` | `grb.lag_high_minus_low: s`, the high-minus-low photon arrival lag role, plus a photon–GW propagation rule and the GW170817 / GRB 170817A geocentric timing record. | ### Particle, nuclear and neutrino physics | Module | What it provides | | --- | --- | | `std.astroparticle.cosmic_electrons.calet_2018` | CALET electron-plus-positron flux near 1.4 TeV in bins matched to DAMPE. | | `std.astroparticle.cosmic_electrons.dampe_2017` | The 38-bin DAMPE electron-plus-positron spectrum with separate statistical and systematic uncertainties. | | `std.astroparticle.cosmic_electrons.dampe_shape` | Tests of unbroken power laws under pointwise DAMPE flux excursions. | | `std.astroparticle.dark_matter_recoil` | LZ and XENONnT spin-independent WIMP scattering upper limits with their halo and interaction assumptions. | | `std.astroparticle.heavy_ion_flow` | ALICE Xe–Xe and Pb–Pb elliptic-flow summaries and the sign of the four-particle cumulant. | | `std.astroparticle.heavy_ion_flow.ratio` | Published Xe–Xe/Pb–Pb four-particle elliptic-flow ratios by matched centrality. | | `std.astroparticle.high_energy_photons.hess_crab_2024` | The H.E.S.S. CT5 mono Crab Nebula spectrum with its statistical errors. | | `std.astroparticle.neutron_star_matter` | J0740+6620 timing and X-ray radius summaries and mass–radius sequences for rotating dense matter. | | `std.astroparticle.sno_three_phase` | Statistical summary of the combined SNO survival and day–night fit, which reuses the salt-phase events. | | `std.astroparticle.solar_neutrinos` | SNO salt-phase CC, NC and ES fluxes with statistical covariance and boron-8 flavour response rules. | | `std.astroparticle.thermal_relics` | Thermal relic contribution to effective radiation density and the `std.astroparticle.light_relics` scope for LEP and Planck summaries. | | `std.astroparticle.ultrahigh_energy_neutrinos` | KM3NeT, IceCube and Auger selected counts and detector exposures for a diffuse spectrum. | | `std.gauge` | Standard Model Weyl charges, anomaly checks and the CDF, ATLAS and CMS W-mass comparison. | | `std.leptons` | Muon g-2 world average, WP20 and WP25 Standard Model predictions and residuals, pure vector one-loop function `delta_a_mu_vector(g, m_med)` and `std.leptons.wp20`. | | `std.neutrino.majorana_mass` | Effective Majorana mass, KamLAND-Zen and GERDA half-life limits, and paired nuclear matrix elements. | | `std.neutrino.mass_ordering` | NuFIT mass splittings and DESI mass-sum limits, with mass relations for oscillations, beta decay and cosmology. | | `std.nuclear.capture_combination` | Daya Bay neutron-capture combination using the shared covariance of the hydrogen and gadolinium results. | | `std.nuclear.coherent_limit` | CONUS Runs 1–2 coherent-scattering count limit and rate normalization. | | `std.nuclear.coherent_signal` | CONUS+ Run 1 detector exposures and the reported joint coherent-scattering yield and uncertainty. | | `std.nuclear.daya_bay` | First six-detector Daya Bay reactor sample and its far-to-near rate comparison. | | `std.nuclear.gamma_calibration` | Potassium-40 photon emission probability from the normalized decay branches. | | `std.nuclear.lifetime` | Radioactive survival and activity relations, with two fluorine-18 half-life determinations. | | `std.nuclear.reactor_off` | Double Chooz both-reactors-off candidate count and background summary. | | `std.nuclear.reno` | RENO 3800-day near and far candidate rates, backgrounds and rate-ratio summary. | | `std.particle.beta_endpoint` | Three-active-neutrino endpoint mass relation and the published KATRIN KNM1–5 confidence set. | | `std.particle.charm_cp` | Correlated direct CP asymmetry summaries for neutral charm decays to charged kaon and pion pairs. | | `std.particle.higgs_rates` | CMS Run 2 diphoton likelihood profile and signal strengths for effective Higgs loop couplings. | | `std.particle.hvp_running` | Correlated projections of the same BESIII two-pion spectrum into muon g-2 and the running electromagnetic coupling. | | `std.particle.invisible_width` | Updated LEP invisible-width inference with lineage shared by the original line-shape analysis. | | `std.particle.kaon_leptonic` | Charged-kaon leptonic width ratio and the NA62 inferences in the stated radiative convention. | | `std.particle.kloe_two_pion` | The matched energy window of the combined KLOE two-pion spectrum and covariance for both dispersion integrals. | | `std.particle.lepton_universality` | Tree-level W branching ratio into tau and muon flavours, with conditioned ATLAS and CMS summaries. | | `std.particle.muon_decay` | Michel spectrum shape, local vector-interaction predictions and TWIST results. | | `std.particle.neutral_b_phase` | CMS and LHCb $B_s$ mixing–decay interference summaries with their published correlations. | | `std.particle.neutrino_trident` | CCFR muonic trident cross section and a heavy-mediator contact prediction. | | `std.particle.proton_weak_charge` | Qweak elastic asymmetry and proton weak charge, plus the cesium sensitivity region for common quark couplings. | | `std.particle.qcd_colour_factors` | Correlated OPAL colour-factor estimates and their SU(N) prediction. | | `std.particle.top_helicity` | Joint W helicity fractions from top-quark decays and the leading-order prediction. | | `std.particle.two_pion_spectrum` | BESIII bare two-pion spectrum, statistical covariance and projection to the leading-order hadronic vacuum-polarization term in muon g-2. | | `std.particle.z_pole` | Correlated LEP-I line-shape summary and light-neutrino invisible-width prediction. | | `std.weak.ckm_row` | First-row CKM unitarity using kaon decay summaries, lattice inputs and superallowed beta decay. | | `std.weak.neutron_beta` | PERKEO III asymmetry and axial-vector ratio, plus the proton-tagged neutron continuum lifetime. | | `std.weak.nuclear_form_factors` | PREX-II and CREX helicity asymmetries and weak form-factor summaries for lead-208 and calcium-48. | | `std.weak.semileptonic` | Superallowed Fermi normalization and the relation between neutron beta lifetime, axial coupling and the vector-current strength. | ### Atomic, molecular, optical and quantum physics | Module | What it provides | | --- | --- | | `std.atomic` | Hydrogen Lamb interval role; fine-structure constant records, their consistency checks and the `std.atomic.alpha_variation` scope. | | `std.atomic.electron_moment` | Measured electron anomaly, QED predictions from caesium and rubidium recoil, and shared lineage with the electron-anomaly inference of $\alpha$. | | `std.atomic.hydrogen_radius_network` | Electronic hydrogen frequency and radius summaries, with a common radius and Rydberg-constant model. | | `std.atomic.muonic_hydrogen` | Muonic hydrogen singlet and triplet lines, Lamb and hyperfine intervals, and conditioned proton radii. | | `std.atomic.optical_clocks` | The 2025 BACON Al⁺, Yb and Sr frequency-ratio summary, joint covariance and ratio closure rule. | | `std.atomic.positronium` | Triplet positronium optical and microwave intervals and bound-state QED predictions. | | `std.atomic.proton_radius` | The 2010 muonic hydrogen transition and proton radius, plus the PRad electron-scattering radius. | | `std.atomic.spectroscopy` | Hydrogen 4P fine and hyperfine splitting, with a comparison to the resolved F=1 interval. | | `std.molecular.co_rotation` | Six carbon monoxide rotational frequencies, with rigid-rotor and centrifugal-distortion predictions. | | `std.molecular.electron_dipole` | ThO and HfF⁺ reversal channels and their electron dipole and scalar-coupling responses. | | `std.optics.fresnel` | S- and P-polarized first-surface reflectance at a lossless dielectric interface. | | `std.optics.fused_silica` | Bulk fused-silica phase and group indices and standard-air wavelength conversion. | | `std.quantum` | CHSH local and quantum bounds, `chsh_within(S, B)`, and the Storz 2023 loophole-free record and checks. | | `std.quantum.bell_trials` | Finite-sample CHSH win probabilities for event-ready trials with bounded setting bias. | | `std.quantum.heralded_anticorrelation` | Herald-conditioned click statistics and bounds on coincidence deficits. | | `std.quantum.neutron_gravity` | Neutron transition frequencies and predictions for gravitational levels above a reflecting plane. | ### Detectors and radiation metrology | Module | What it provides | | --- | --- | | `std.detectors.germanium_ionization` | Germanium nuclear-recoil quenching, the calibrated Lindhard response and lineage shared with the CONUS+ fit. | | `std.detectors.silicon_ionization` | Mean energy per collected electron–hole pair and full-energy manganese X-ray charge yields in silicon. | | `std.nuclear.dosimetry` | BIPM comparison of the NPL and BIPM absorbed-dose-to-water standards for their 10 MV photon beams. | | `std.nuclear.gamma_energy` | HPGe reference peaks and channel-to-energy calibration. | | `std.nuclear.residential_radon` | Health Canada home radon survey counts and exceedance summaries. | | `std.radiation.detector_response` | Fermi GBM NaI pulse-height widths and energy-dependent response models from ground calibration. | | `std.radiation.environmental_activity` | IAEA radiocaesium comparisons on preserved Irish Sea water, with decay corrections and reported limits. | ### Condensed matter, materials and electrical metrology | Module | What it provides | | --- | --- | | `std.condensed.cubic_diffraction` | First-order Bragg angles and interplanar spacings for indexed cubic reflections. | | `std.condensed.elastic_sto` | Room-temperature SrTiO₃ echo times and cubic elastic predictions for two specimen directions. | | `std.condensed.flux_quantization` | Fluxoid winding step and the Deaver–Fairbank tin first trapped-flux plateau. | | `std.condensed.graphene_transport` | Graphene sheet transport from Johnson-noise thermometry and the elastic Wiedemann–Franz reference. | | `std.condensed.hall_fractional` | Six finite-current Hall bridge readings, leakage and rectification bounds, and the zero-dissipation fit interval. | | `std.condensed.little_parks` | Fluxoid field-period prediction and calorimetric period for aluminium rings. | | `std.condensed.low_dimensional_graphene` | Suspended monolayer graphene transmittance and its Dirac-sheet optical prediction. | | `std.condensed.magnetic_criticality` | Ultrathin Fe/W(110) susceptibility exponent and Ising and Curie–Weiss predictions. | | `std.condensed.neutron_bragg_edge` | Paired nickel diffraction spacings and transmission edges with a common cubic lattice parameter. | | `std.condensed.oxygen_host_shift` | Infrared oxygen line shift between two silicon isotope hosts and a volume-shift estimate. | | `std.condensed.semiconductor_bandgap` | Silicon absorption edges over 11 temperatures and a Varshni temperature-dependence model. | | `std.condensed.silicon_640g` | NIST SRM 640g silicon lattice-parameter table, Type A uncertainty and Bragg line positions. | | `std.condensed.silicon_640g_bottles` | One-way ANOVA reconstruction for the NIST silicon bottle preparations. | | `std.condensed.superfluid_helium` | Helium-4 heat capacity and second-sound summaries near the lambda transition, with Josephson hyperscaling checks. | | `std.condensed.thermal_conductance_quantum` | Single-mode ballistic heat current at finite bias and the differential thermal conductance quantum. | | `std.materials` | Exact `R_K: Ohm` and `K_J: Hz/V`, quantum Hall universality, superconducting gap ratios and diamond heat capacity. | | `std.materials.polymer_rheology` | NIST SRM 2490 steady-shear viscosity and coverage intervals across shear rates. | | `std.materials.thermal_response` | Free thermal expansion and the 62.5–350 K strain spline for the NIST SRM 736 copper reference. | | `std.materials.thermoelasticity` | Same-state relations among expansion, compressibility and heat capacities. | | `std.metrology.electrical` | Josephson voltage, integer quantum Hall resistance and current transfer using the SI defining constants. | | `std.metrology.planck_determinations` | Pre-2019 determinations of the Planck constant using silicon spheres and Kibble balances, with adjustment lineage. | | `std.radiation.steel_toughness` | Charpy impact energies from matched NIST reference lots and independent ATMS tests. | | `std.radiation.steel_toughness.ll198_production` | NIST reference lot LL-198 impact energies by production machine. | ### Thermodynamics, fluids and soft matter | Module | What it provides | | --- | --- | | `std.acoustics.gas_thermometry` | Acoustic gas constant from the zero-density, zero-frequency sound-speed intercept. | | `std.fluids.hfe7300` | HFE-7300 density, calorimetry and compressibility relations for acoustic closure. | | `std.fluids.oscillatory_rheology` | NIST SRM 2490 complex viscosity and comparison with steady viscosity at matched rates. | | `std.fluids.superpipe` | Smooth-pipe friction observations, Darcy and Fanning conversions, and friction correlations. | | `std.fluids.wave_dispersion` | Deep-water capillary–gravity dispersion, surface-tension inputs and optical reductions. | | `std.nuclear.insulation_reference` | NIST SRM 1450e fibrous glass thermal conductivity from guarded-hot-plate data and the certificate fit. | | `std.nuclear.water_calorimetry` | Saturated-water enthalpy rise and midpoint heat capacity reconstructed from 31 calorimeter runs. | | `std.nuclear.water_density` | Hydrostatic-weighing density data for liquid water, with relative dilatation and a shared absolute density scale. | | `std.soft_matter.brownian_diffusion` | Stokes–Einstein diffusion and tracking corrections for exposure and localization variance. | | `std.soft_matter.capillarity` | Static Young–Laplace pressure, Jurin rise and the projected surface tension. | | `std.statphys.fluctuation_work` | Jarzynski weights and Crooks ratios for published forward and reverse work in a driven harmonic trap. | | `std.statphys.gas_compression` | Boyle’s air compression table and pressure–volume ratios. | | `std.statphys.magnet_3c90` | Cycle-integrated magnetic loss for a published Princeton MagNet 3C90 recording. | | `std.statphys.magnetic_loss` | Signed work and power loss from a closed magnetic hysteresis loop. | | `std.statphys.unitary_fermi` | Spin-balanced lithium-6 equation-of-state and virial thermometry comparisons. | | `std.thermo` | Stefan–Boltzmann and radiation constants, Carnot and Curzon–Ahlborn claims, and the CMB temperature to photon-density rule. | | `std.thermo.absolute_thermometry` | Three historical FIRAS temperature determinations, shared calibrator lineage and the WMAP velocity-fit table. | | `std.thermo.firas_covariance` | FIRAS frequency noise covariance reconstructed from the published lag correlations and channel uncertainties. | ## The Astronomical & Cosmological Distance Ladder The ladder brings geometric and early-universe evidence for $H_0$ into one comparison network using published summaries. ```text std.astronomy.ladder.parallax NGC 4258 maser and LMC eclipsing binaries std.astronomy.ladder.mw_parallax Gaia parallaxes of Milky Way Cepheids std.astronomy.ladder.cepheids Cepheid period–luminosity–metallicity relation └── std.astronomy.supernovae.shoes_2022 SH0ES 2022 supernova distance-ladder summary std.cosmology.recombination Baryon–photon sound speed and drag-horizon integral ├── std.cosmology.cmb.planck_2018 Planck 2018 H0 and r_d └── std.cosmology.lss.desi_dr2_bao DESI DR2 BAO examples/cosmology/hubble_tension.plumb Comparisons using the distance ladder and CMB/BAO summaries ``` ### `std.astronomy.ladder.parallax` - **Gaia sensitivity scenario.** `gaia_edr3_zp` supplies an assumed bound of 0.015 mas for sensitivity studies. - **Functions:** - `parallax_from_mu(mu: mag): mas` - `distance_from_mu(mu: mag): Mpc` - **Roles:** `astro.distance_megamaser : Mpc`, `astro.modulus_lmc : mag`. - **Measurements (zero `PhysicalOntology`):** - `ngc4258_maser: astro.distance_megamaser` gives $7.576 \pm 0.082\text{ (stat)} \pm 0.076\text{ (sys) Mpc}$. - `lmc_deb: astro.modulus_lmc` gives $18.477 \pm 0.004\text{ (stat)} \pm 0.026\text{ (sys) mag}$. - The disk-model and eclipsing-binary systematic scales are represented as separate Gaussian nuisances, each shared by uses of its anchor. ### `std.astronomy.ladder.mw_parallax` The 67 Riess et al. (2021) Table 1 entries with usable parallaxes support comparisons between Gaia EDR3 measurements and predictions from HST Wesenheit magnitudes. The row comparison assumes fixed slopes and weights and lets one residual Gaia offset vary across the sample. The separate Table 2 absolute-magnitude and residual-offset marginals share a fit, so a joint score requires their covariance. ### `std.astronomy.ladder.cepheids` `wesenheit_plz(mu: mag, M_H_W: mag, b_W: mag, Z_W: mag, P: d, dOH): mag` gives the near-infrared Wesenheit magnitude at a supplied distance modulus. The period term uses a 10-day pivot and the metallicity term uses the supplied abundance offset. Breuval et al. (2024) report an SMC H-band Wesenheit period slope of $-3.31 \pm 0.05$ mag per dex of period. The fixed earlier LMC value of $-3.26$ gives $\chi^2=1$ against that scalar summary, given the LMC-informed sample selection and the SMC depth correction. The H-band and optical iron-abundance slopes are $-0.234 \pm 0.052$ and $-0.264 \pm 0.058$ mag per dex of [Fe/H]. These two fits share Cepheids, passband data and geometric anchors. A joint score requires their cross-covariance. ### `std.astronomy.supernovae.shoes_2022` - **Assumptions:** `calibration.shoes_2022_baseline`, `calibration.sn_standardization`, `regime.low_z_cosmography`, `stat.gaussian_shoes` (plus all `std.astronomy.ladder.cepheids` exports). - **Function:** `h0_from_mb_ab(M_B: mag, a_B): km/s/Mpc`. - **Roles:** `astro.joint_fit_lineage`, `astro.hubble_intercept` (both `Dimensionless`), `astro.sn_ia_fiducial_mB : mag`; `shoes_2022_h0` records `cosmo.hubble_constant` from `std.cosmology.flrw`. - **Lineage origin.** `shoes_2022_joint_fit` traces the NGC 4258 and LMC geometric anchors, Riess et al. Milky Way Cepheid inputs, the separate HST spatial-scan constraint and eight supernovae also used by Anand et al. - **Inferences (zero `PhysicalOntology` — calibration + low-$z$ cosmography only):** - `shoes_hubble_flow_aB`: $0.714158 \pm 0.001769$ (`derived from shoes_2022_joint_fit`). - `shoes_2022_mb0`: $-19.253 \pm 0.027\text{ mag}$ (`derived from shoes_2022_joint_fit`). - `shoes_2022_h0`: $73.04 \pm 1.01\text{ km/s/Mpc}$ (`derived from shoes_2022_mb0, shoes_hubble_flow_aB`). - Because `shoes_2022_mb0` and `shoes_hubble_flow_aB` share `shoes_2022_joint_fit`, Plumb refuses to treat them as independent Gaussians in a joint compare! ### `std.astronomy.ladder.trgb` The selected NGC 4258 outer-halo tip, its extinction correction and the maser distance reproduce the published blue F814W TRGB zero point of about $-4.050\text{ mag}$. The locally linearized inference inherits the maser uncertainty. Combining this zero point with its input distance therefore requires their dependence to be accounted for. `std.astronomy.ladder.overlap` reproduces the published Anand et al. calibrator means and tests the effect of covariance shared by supernovae in the same host. The SH0ES and Anand summaries reuse eight explosions. Their common event identities survive changes in the photometric reduction. ### `std.cosmology.recombination` - **Explicit `PhysicalOntology` & regime assumptions:** `ontology.cold_dark_matter`, `ontology.standard_neutrinos_neff3046`, `ontology.standard_bbn_recombination`, `regime.flat_lcdm_background`. - **Convention:** `H100: km/s/Mpc = 100 km/s/Mpc`. - **Functions:** - `baryon_photon_ratio(a, omega_b, omega_gamma)` - `sound_speed_over_c(a, omega_b, omega_gamma)` - `r_d_comoving(a_d, omega_b, omega_m, omega_r, omega_gamma, h): Mpc` ### `std.cosmology.cmb.planck_2018` and `std.cosmology.lss.desi_dr2_bao` - **Assumptions:** `regime.template_near_fiducial`, `calibration.supplied_ruler`, `stat.gaussian_compressed` (plus all `std.cosmology.recombination` exports). - **Pinned DESI DR2 13-row `ALL_GCcomb` artifacts:** `desi_dr2_axes`, `desi_dr2_values`, `desi_dr2_cov` (`std/data/desi_dr2_bao.*.json`). - **Inferences:** - `desi_dr2_bao: Vector[desi_dr2_axes, Dimensionless]`: conditioned on `fiducial_lcdm_template` (`ontology.cold_dark_matter`, `regime.template_near_fiducial`). - `planck_2018_base_lcdm_posterior`: shared lineage origin for Planck 2018 VI base-$\Lambda$CDM marginals, under general relativity with constant Newtonian $G$. - `planck_2018_rd: cosmo.drag_horizon`: $147.09 \pm 0.26\text{ Mpc}$ (`derived from planck_2018_base_lcdm_posterior`). - `planck_2018_h0: cosmo.hubble_constant`: $67.36 \pm 0.54\text{ km/s/Mpc}$ (`derived from planck_2018_base_lcdm_posterior`). - **Theory & prediction:** `flat_flrw_free_ruler` with `desi_dr2_free_ruler_bridge` onto the three `bao.*` roles. - **Scaling claim:** `desi_dr2_free_ruler_scaling` proves BAO ratios alone constrain only the product $H_0 \cdot r_d$. ### Hubble tension example - **Theory:** `flat_lcdm_hubble_network`, which uses `assume` for `ontology.cold_dark_matter` and `regime.flat_lcdm_background`. - **Predictions with their own `assuming` premises.** - The `cosmo.hubble_constant` prediction serves both records. Its premises cover standard neutrinos and BBN, constant-$G$ general relativity, SH0ES calibration and low-redshift cosmography. - The `cosmo.drag_horizon` prediction uses standard neutrinos and BBN and constant-$G$ general relativity. - `lcdm_bao` predicts the three `bao.*` ratios under `regime.template_near_fiducial`. - `planck_vs_shoes_h0` evaluates the Hubble constant prediction and records its premises. - **Verified comparisons:** - `planck_vs_shoes_h0`: certified `conflict (certified_enclosure)` ($\chi^2 = 322624 / 13117 \approx 24.60 > 16$). - `desi_shoes_rd_honest`: a certified shared witness meets the total $\chi^2 \le 25$ budget for DESI DR2 BAO, SH0ES $H_0$ and Planck $r_d$. ### Testing a proposal against the expansion data The scope `std.cosmology.expansion` combines the SH0ES R22 full-fit absolute-magnitude marginal, 20-bin Pantheon+ with SH0ES objects removed, DESI DR2 BAO, early CMB, Cooke deuterium, Aver helium, 15 correlated chronometers and the Valcin cluster age. The CMB and each abundance have separate budgets, so a model that changes recombination can still be tested against primordial abundances. Residual calibration covariance between R22 and the retained Pantheon+ sample is unverified. The reference model uses Fields et al. central-rate deuterium and helium responses and point-checked distance, age and acoustic-angle approximations. Save the following as `candidate.plumb` to run the flat ΛCDM control. ```plumb import std.cosmology.expansion theory baseline_lcdm extends flat_lcdm_background { } ``` ```sh plumb audit candidate.plumb --theory baseline_lcdm --scope std.cosmology.expansion plumb doc std.cosmology ``` Use `std.cosmology` to test expansion and DES Y6 shear at one shared point. DESI DR1 growth shares tracers with DR2 BAO, so the combined scope excludes it. Run the growth, duality, same-host and expansion-swap scopes separately when their data overlap. Inspect the joint finding to see whether a common parameter point clears all budgets. ## Atoms, Heat and Materials ### `std.atomic` - **Records of $1/\alpha$ (role `atomic.fine_structure_alpha_inv`):** - `parker_2018_alpha_inv` (measurement, Cs recoil): $137.035999046(27)$. - `morel_2020_alpha_inv` (measurement, Rb recoil): $137.035999206(11)$. - `fan_2023_alpha_inv` (inference, electron $g-2$): $137.035999166(15)$, conditioned on `ontology.qed_electron_moment`. It uses the same trapped-electron data as the anomaly measurement in `std.atomic.electron_moment`. - `alpha_codata2022: atomic.fine_structure_alpha`: $7.2973525643(11) \times 10^{-3}$, `derived from` the three records above. - **Theories:** `universal_alpha` (one `alpha_inv`) and `universal_alpha_qed`, which extends it and declares the QED premise with `assume`. - **Verified comparisons:** - `cs_vs_rb_recoil_alpha`: certified `conflict (certified_enclosure)`, $\chi^2_{\min} = 512/17 \approx 30.1$ ($5.49\sigma$). - `alpha_triad`: all three records conflict, and the minimal conflict core is the recoil pair. - `electron_moment_without_qed`: `blocked incompatible_conditioning`. - **Variation of $\alpha$:** - `espresso_he0515_alpha: atomic.alpha_ratio_espresso` gives $\Delta\alpha/\alpha = 1.31 \pm 1.29\text{ (stat)} \pm 0.43\text{ (sys) ppm}$ at $z=1.1508$. The analysis assumes terrestrial isotope abundances and represents the systematic uncertainty with the Gaussian nuisance `he0515_espresso_systematic` under the published quadrature convention. Changes in isotope abundance require a separate analysis. - `filzinger_2023_alpha_drift: atomic.alpha_drift`: $(1.8 \pm 2.5) \times 10^{-19}\text{ /yr}$. - Rule `alpha_drift_from_log_slope: (atomic.alpha_log_slope, cosmo.hubble_constant) -> atomic.alpha_drift`, $\dot\alpha/\alpha = -\zeta H_0$, granting `regime.alpha_log_slope_today`. - **Frozen scope `std.atomic.alpha_variation`:** blocks `espresso` and `clocks` (each `chi2 <= 9`) and the open phenomenon `oklo_natural_reactor`. A theory that predicts `atomic.alpha_log_slope` and `cosmo.hubble_constant` reaches the clock block through the rule. ### `std.thermo` - **Present-day CMB temperature.** `cmb_temperature_fixsen2009` gives $2.72548 \pm 0.00057\text{ K}$, the published inverse-variance weighted mean of 16 literature measurements, including the three FIRAS methods. The weighting treats the inputs as independent. The thermometer, colour and velocity results share lineage through the FIRAS external calibrator. A joint score with the literature mean and any of those FIRAS inputs requires their cross-covariance. - **Exact claims:** `stefan_boltzmann_lower` / `_upper` ($5.670374419 \times 10^{-8} < \sigma_{\text{SB}} < 5.670374420 \times 10^{-8}\text{ W/m}^2\text{/K}^4$), `radiation_constant_lower` / `_upper`, `molar_gas_constant_value`. - **Heat engines** as functions of $r = T_{\text{cold}} / T_{\text{hot}}$: theories `carnot_engine`, `curzon_ahlborn_engine`, `super_carnot_engine`; condition `within_carnot`; `curzon_ahlborn_within_carnot` certifies $\eta_{\text{CA}} \le \eta_C$ and `super_carnot_refuted` is a `conflict (exact_witness)`. - **Function:** `omega_gamma_of(T: K): Dimensionless` $= a_{\text{rad}} T^4 / (c^2 \rho_{c,100})$, used by the rule `omega_gamma_from_tcmb: (cosmo.cmb_temperature) -> cosmo.omega_gamma` (grants `regime.blackbody_photon_gas`, `calibration.codata_2022`). ### `std.materials` - **Electrical standards:** `von_klitzing_lower` / `_upper` ($R_K \approx 25812.80746\ \Omega$), `josephson_lower` / `_upper`, and the exact `quantum_metrology_triangle` ($K_J R_K e = 2$). - **Circular calibration:** `mu_0_codata2022` is `derived from alpha_codata2022`, so `alpha_from_mu_0_is_circular` is `blocked circular_calibration`. - **Quantum Hall universality:** `ribeiro_palau_2015_qhe` ($(-0.9 \pm 8.2) \times 10^{-11}$, graphene against GaAs) passes `universal_quantum_hall` and excludes a host correction of 1 to 10 parts in $10^9$. - **Superconducting gap ratio** (`materials.bcs_gap_ratio`). The Giaever–Megerle Al inference uses the extrapolated zero-temperature ratio $4.2 \pm 0.6$. The Sn and Pb comparisons use the near-1 K ratios $3.46 \pm 0.10$ and $4.33 \pm 0.10$ as zero-temperature estimates. The checks use bulk critical temperatures and take the quoted errors as Gaussian standard deviations. `lead_vs_bcs_weak` conflicts with the weak-coupling value $2\pi e^{-\gamma} \approx 3.52775$. Under the adopted Pb spectrum assumptions, `lead_strong_coupling_table_residual` bounds the interpolation’s excess over the fitted table value to 0.021–0.022. `lead_gap_reuses_spectral_input` refuses an independent comparison because the input spectrum and the calculated table gap share the same calibration. - **Heat capacity (role `materials.diamond_cp_298k`):** `victor_1962_diamond_cp` ($6.117\text{ J/(mol K)}$). `classical_dulong_petit` ($3R$) conflicts; `debye_solid` extends it with `theta_D` and passes at $1860\text{ K}$ but conflicts at the low-temperature $2230\text{ K}$. - **Functions:** `debye_heat_capacity(T: K, theta: K): J/mol/K`, valid for $\Theta_D / T \ge 5$, with `debye_integrand`, `debye_tail`, `debye_integral`. ## Stacking Your Own Check on `std/` You can import any `std/` module directly without copying numbers or data files: ```plumb import std.cosmology.cmb.planck_2018 import std.astronomy.supernovae.shoes_2022 theory common_h0 { H0: km/s/Mpc assume ontology.cold_dark_matter, regime.flat_lcdm_background, ontology.standard_neutrinos_neff3046, ontology.standard_bbn_recombination, ontology.planck_base_gravity predict cosmo.hubble_constant = H0 assuming calibration.shoes_2022_baseline, calibration.sn_standardization, regime.low_z_cosmography } compare custom_h0_box_check: planck_2018_h0, shoes_2022_h0 ~ common_h0 at H0 in [65 km/s/Mpc, 75 km/s/Mpc] accept chi2 <= 20 expect conflict certified_enclosure by consistency_graph ```