An exact rational, a series computed to some order, and a critical point obtained by Padé extrapolation may all end up as a single number, but they are not equally trustworthy. Weyl records which kind each value is in its type and propagates that through every operation, so an approximate result cannot be used downstream as if it were exact.
Two components
The error tag is part of the type, written τ @ ε, with
Here is the truncation remainder—a monomial ideal signifying that the value represents , with exact values carrying the zero ideal —while is the set of non-exact sources such as Padé extrapolation, Monte Carlo sampling, or a neural surrogate, which is empty () for exact values. The two components are independent. Exact is , written . A value with only is usually called perturbative, one with only an estimate, and both can be non-trivial at once, for example an exact series multiplied by an extrapolated constant.
The order is componentwise inclusion:
means guarantees at least as much as , so a value of type τ @ ε₁ can be used where τ @ ε₂ is required.
The lattice join is not an arithmetic rule
is used only for subtyping and for merging control-flow branches such as if. Truncation under multiplication is computed by mul_err below; combining numerical variances must account for covariance and is not an idempotent join either.
Truncation: monomial ideals
In the formal power series ring , a truncation remainder is described by a monomial ideal . By Dickson's lemma every monomial ideal has a unique minimal generating set: monomials none of which divides another. Weyl stores the exponent vectors of that set.
Convention: an order always means the first unknown order. A result computed up to and including order 10 has remainder .
| Notation | Ideal | Minimal generators |
|---|---|---|
Exact | none | |
Box{x: n, y: m} | ||
Total{(x, y): n} | ||
| General | reduced exponent vectors |
The lattice operations work directly on these minimal generators: inclusion holds iff every generator of is divisible by some generator of , the sum takes the union of generators and drops any divisible by another, and the intersection takes pairwise $\mathrm{lcm}$s and reduces the resulting set.
Why general ideals are not rounded to Box or Total
In multi-parameter expansions (e.g. in ), multiplication readily produces ideals that are neither Box- nor Total-shaped. In the example below the remainder of the product is . Replacing it by any containing Box or Total ideal (a weaker guarantee) inevitably discards known coefficients: drops the known and terms, drops , , and , and Total: 3 drops every known cubic term. Replacing it by a smaller ideal is simply wrong, because unknown terms would be treated as zero. Weyl therefore always keeps the full minimal generating set, with no cap on its size.
Addition and multiplication
Let and , where are the known polynomial parts and is the ideal generated by the nonzero monomials of . Then
The term cannot be dropped. When or (for example, when all low orders cancel), the first two terms vanish, and omitting would wrongly give Exact. In one variable the formula reduces to the familiar
where is the lowest nonzero order. For with nonzero constant term, the formal inverse , and keep the truncation ideal of . Every compiler pass computes its output tag through add_err and mul_err, never by hand.
A two-parameter example
Take
so , , , and . Under addition, has remainder , which reduces to . Under multiplication, the three contributions to are , , and , whose reduced sum is . By contrast, if and , both known parts vanish and only survives, giving .
Typing rules for expansion and extrapolation
expand introduces a truncation ideal. estimate turns a series into a number, clearing the truncation component and adding the method to the source set. Below, combines the two tags as add_err does:
Sources and runtime uncertainty
The static EpiKind records only the source set and a propagation method, not numbers; otherwise type hashing and interning would depend on floating-point values. The current sources are:
| Source | Meaning |
|---|---|
PadeSpread{family} | dlog-Padé extrapolation; the error is the spread across approximants of one family. The tag stays even if the spread happens to be 0 |
MonteCarlo{samples} | Sampling error |
NeuralPotential{model} | Prediction of a neural surrogate |
External(name) | Result from an external program, e.g. the fallback solver used when a surrogate is rejected |
The numbers live in the runtime RuntimeUncertainty: a variance or a set of samples. The propagation method EpiMethod is one of: keep joint samples (JointEnsemble), first-order delta method (LinearizedDelta), or a conservative bound (ConservativeBound). When one batch of samples feeds several quantities, joint samples are preferred so correlations are kept. For example,
so has variance . When the correlation is unknown, the result either stays "unknown" or gets a Cauchy–Schwarz bound marked ConservativeBound.
Rust definitions
From weyl-types/src/err.rs, with derives and methods omitted:
pub struct Trunc {
pub vars: VarSet,
pub generators: Vec<ExponentVector>, // minimal generators
}
pub enum EpiSource {
PadeSpread { family: String },
TruncationAt { var: SmolStr, order: u32 },
MonteCarlo { samples: u64 },
NeuralPotential { model: String },
External(String),
}
pub enum EpiMethod { Exact, JointEnsemble, LinearizedDelta, ConservativeBound }
pub struct EpiKind {
pub sources: Vec<EpiSource>,
pub method: EpiMethod,
}
pub struct Err {
pub trunc: Trunc,
pub epi: EpiKind,
}
pub struct RuntimeUncertainty {
pub sigma2: Option<f64>,
pub ensemble: Option<Vec<f64>>,
}
pub trait ErrLattice {
fn join(&self, other: &Self) -> Self;
fn leq(&self, other: &Self) -> bool;
}
pub fn add_err(a: &ValueInfo, b: &ValueInfo) -> Err;
pub fn mul_err(a: &ValueInfo, b: &ValueInfo) -> Err;require: accuracy requirements and fallbacks
Source code can state accuracy requirements with require:
-- Checked during type checking: Δ's remainder must be contained in O(x¹¹), else E0331
require Δ known to O(x¹¹)
-- Checked at run time: if x_c's uncertainty is above the threshold, expand further
require uncertainty of x_c < 10⁻³
otherwise expand to higher orderTruncation requirements are checked during type checking as the ideal inclusion , with failure reported as a compile error. Uncertainty requirements are checked at run time once the value is computed: if an otherwise clause is present, the fallback runs and the check repeats until it passes or hits a round limit; without one, failure raises error E0331. The neural runtime's confidence check uses the same mechanism, falling back to an exact solver whenever the predicted variance exceeds the threshold and tagging the resulting value's source as External(...).
Each check is written to a telemetry record (TelemetryRecord in weyl-mcp) with the node name, a status such as pass or not_needed, and the node's error tag, for replay and review.
What error tags do not cover
An error tag says how far off a value may be and why, not whether it was computed correctly; establishing correctness is the job of the independent oracles, and the boundary between the two is strict. Oracles return only Pass, Fail(OracleDiag), or Inconclusive, never producing certificate objects for downstream consumption. Likewise, a numerical comparison against finite-size ED establishes agreement only at the tested sizes—it does not prove a general symbolic identity and never promotes a truncated or estimated value to Exact. The double-double eigenvalues from ED feed solely into residual fits and are never written back as coefficients into H_eff or user expressions; similarly, rewrites proposed by an LLM take effect only after both the deterministic kernel and the oracles verify them, and they remain subject to error tags.