Skip to content

Typed results and certificate inspection

The existing workflow return values stay available. Call .typed() to obtain an explicit evidence type:

import twindex as tw

result = tw.identify_ode(model, measurements, epsilon, box, target)
evidence = result.typed()
if isinstance(evidence, tw.CertifiedResult):
    print(evidence.kind, evidence.lower, evidence.upper, evidence.sha256)
else:
    print(evidence.verdict.value, evidence.code, evidence.reasons)

CertifiedResult(certificate, depth=6) snapshots a certificate and freshly replays it. Construction raises ValueError unless the replay is VALID. Cached workflow statuses, claimed bounds and numerical audit results cannot authorize construction. certificate returns a copy of the verified snapshot; subsequent mutation of the original input or a returned copy does not change the result. The result is frozen and carries kind, verdict, lower, upper, certificate and sha256. to_dict() gives a JSON-ready record with exact rational strings.

lower is the claimed pair gap or paving lower bound, where present. upper is present only for a full-prior paving. Witnesses and box exclusions have neither bound. A zero pair gap proves no positive ambiguity. A zero paving upper bound does not, by itself, distinguish emptiness from a singleton; inspect the checker details. Every quantity is conditional on that certificate's exact model, prior, observations, target and noise assumptions.

identify_ode(...).typed(depth=6) returns CertifiedResult or Inconclusive. design_ode(...).typed() delegates to its identification result; the ranking of future experiments remains heuristic. certify_audit(...).typed() returns one such outcome per audited coordinate, freshly replaying each available candidate. No endpoints or failed candidate generation produces an unproved outcome. Inconclusive means no certified result was obtained: its verdict preserves INVALID versus INCONCLUSIVE for the attempted certificate, and its code and reasons explain that attempt. It makes no claim about the entire prior.

audit_model(...).typed() returns NumericalEvidence. Its fixed top-level evidence label is always numerical_only; it has no checker verdict and cannot be passed to CertifiedResult. The original numerical snapshot is under data. A small sampled range or unsuccessful search proves no uniqueness or emptiness.

Stable report codes

Report.code and Report.to_dict()['code'] are additive metadata. Existing verdict, reasons and mathematical decision rules are unchanged. The public twindex.REASON_CODES set contains:

code meaning
VALID_PROVED The certificate's exact claim verified.
INVALID_MALFORMED Schema, candidate or hypothesis violation, including encoded input size limits.
INVALID_FALSE_CLAIM A measurement is proved incompatible or an exact quantitative/status claim fails.
INCONCLUSIVE_INSUFFICIENT_BOUND Sufficient residual, tube or measurement bounds did not close.
INCONCLUSIVE_RESOURCE_LIMIT ODE uniform expansion exceeded the checking budget.
INCONCLUSIVE_UNDECIDABLE_INITIAL A lifted initial enclosure or denominator could not be decided.
UNSUPPORTED_MODEL The requested certificate kind has no checker; verdict remains INVALID.

Composite pairs and ODE pavings preserve the first child code with the decisive verdict. Codes come from explicit decision sites and structured child reports, never from parsing human-readable messages. Read verdict first: a code does not replace it or change any proof decision. Resource caps on encoded input are malformed-input failures; resource exhaustion during uniform ODE proof expansion is inconclusive.

Inspect a certificate

twindex inspect certificate.json
twindex inspect certificate.json --json --depth 6

Inspection prints the kind, theorem dependencies from the architecture table, declared model and prior, observation map and data, noise source (global epsilon or per-measurement overrides), claimed quantities, fresh replay with code, and SHA256. JSON output also includes local box, transform, provenance and full replay details. Theorem dependencies describe the kind; a malformed certificate has not established those hypotheses. Physical noise validity is assumed, never inferred. The exit statuses match check: 0 VALID, 1 INVALID, 2 INCONCLUSIVE.

Both inspection and typed results hash canonical UTF-8 JSON: sorted keys, compact separators, ASCII escaping and no NaN. Whitespace and object key order do not change this digest; changing certificate content, including provenance, does. This is a content identity, not a hash of the original file bytes or a signature. Malformed JSON or unreadable files have no canonical digest and report null.