Checking and evidence¶
The surrounding CAS checks proofs at the boundary of a request, before returning or retaining selected results. This page describes that system contract; the kernel API itself is demonstrated in the proof-checking tutorial.
Why not check everything¶
A kernel check of every fact an engine derives would make search pay for proofs it mostly throws away: a simplifier tries many rewrites, and most lead nowhere. Check what you keep, not what you try.
Evidence levels¶
| Level | Where it lives | Created by |
|---|---|---|
| Provisional | inside one request's session, never outside it | any engine: a fact with a recipe |
| Checked | anywhere: returned, stored, exported | the kernel only |
| Unchecked | returned to the caller, labeled, never stored | the explicit fast mode |
A recipe says how to build a proof: which theorems, instantiated how, in which order, citing which other facts. It is cheap to record and is expanded into proof nodes only when the kernel checks it.
Every result carries an evidence label: its level (Checked by default,
Unchecked only on request) and the classes of its dependencies (native
rules, admitted rule bundles, literal kinds, checkers, foreign evidence).
An external decider (an RCF decider, an SMT solver) is an engine like any other. Its answer enters a proof with a certificate the kernel checks, or as a hypothesis: the result is then the checked, guarded theorem claim ⇒ result, and its label names the decider (Proposition B-7). There are no oracles.
The life of a request¶
- Open. The request opens a session. It reads the durable stores (checked theorems and facts) freely.
- Search. Engines derive provisional facts with recipes and share them through the session.
- Select. The coordinator picks the result under the request's objective.
- Check. The kernel checks the proof of the selected result: its recipe and the recipes of the provisional facts it cites. Only this dependency cone is checked.
- Return. The result is returned with its label. Checked lemmas worth keeping may now enter durable stores.
- Close. The session and all its provisional state are dropped.
In unchecked mode, step 4 is skipped, the result is labeled Unchecked,
and step 5 stores nothing.
Three gates¶
Soundness rests on three gates, each enforced by the API, not by convention:
| Gate | Rule | Enforcement |
|---|---|---|
| Return | Nothing is labeled checked unless the kernel produced a checked judgment for it. | The label is computed from the handle type; unchecked results have no handle. |
| Store | Durable and shared stores accept only checked judgments. | Store methods take the checked handle type; provisional facts have another type. A compile-fail test covers the attempt. |
| Confinement | Provisional state belongs to one session and dies with it. | The session owns its workspace; no API passes provisional facts between sessions. |
What can go wrong¶
| Risk | Consequence | Mitigation |
|---|---|---|
| An engine derives a wrong fact | The answer's check fails, or the fact was not used | Recovery, below. Wrong search costs time, never soundness |
| A provisional fact leaks out of its request | Unsound | The confinement and store gates |
| An unchecked result looks checked | Unsound in the user's eyes | The return gate and the label |
| A kernel bug | Unsound | A small kernel, the inventory, adversarial tests, property tests of the conversion theorems, independent HOL auditing through OpenTheory and the Isabelle bridge |
| A wrong literal implementation | Unsound | Differential tests against a reference implementation |
| A wrong admitted rule | Unsound relative to the intended meaning | Require a proof or an explicitly tracked import; numeric tests can only refute candidates |
| A wrong external decider | A guarded result whose guard is false; never a false checked claim | Its answers enter as hypotheses unless certified |
Recovery after a failed check¶
A failed check is a bug report against an untrusted component, not an
error for the user. The coordinator checks the recipe step by step to find
the first failing step, quarantines the rule or engine that produced it for
the rest of the request, reruns the search without it, and returns the best
checked result or NoResult with a diagnostic.
Proofs on demand¶
Runs without wall-clock stops are deterministic, so an answer's proof can be rebuilt by replaying the run, even when it was not kept. This makes it cheap to keep recipes rather than full proofs.
Replaying a whole run needs every engine it used, at its version. A proof
library therefore stores proofs, not recipes: each theorem's PROOF row
with the rows it reaches (ST9). Every load
checks those rows again with the current checker, and Library.recheck
checks a whole version in a fresh bank, so a stored result is re-checked
after a checker fix without any engine (Proposition B-6). A statement-only
import is the one exception: it declares a theorem without its proof and
trusts the version's producer for it
(ST9.8). No replay record or
certificate row is stored: termbank.dag refuses certificate rows, and no
certificate checker is admitted (trusted base).
Measurements¶
Measure search time, checking time, recipe size, proof size, and the ratio of checking time to search time on the assembled system. The working simplification target of 10–20% is a design target, not a kernel benchmark guarantee.