Built-In Checkers & Diagnostics

Built-In Claim Checkers (claim ... by <method>)

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 <proposition> followed by discharged by <claim>. 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>)

Method Best for What it certifies
gaussian_ldlt Point comparisons with Gaussian noise and shared Gaussian nuisances Checks positive definiteness and evaluates χ2\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 LDLTLDL^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 χmin⁡2\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/η−24/\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>)

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 <inputs> 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, defs, 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 <family>.cand.<name>.
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.