Expand description
Unified theorem verification — the single door.
Every public theorem entry point in the workspace funnels through
prove_certify_check, so they all share one trust guarantee:
A proof is
verifiediff the backward chainer produced a derivation, the certifier turned it into a kernel term, and the kernel type-checked that term.
A derivation alone never counts as verified — verified == true is always
backed by a [Term] that re-checks under [infer_type] in the returned
[Context]. This core lives in the proof crate (not the compile crate) so
both logicaffeine_language and logicaffeine_compile can reach it without
a dependency cycle.
Structs§
- Conflict
Report - The result of checking a rule set for an internal contradiction.
- Definition
- A user-introduced predicate definition (Rung 0a), expressed in the proof
layer’s own vocabulary so
logicaffeine_proofkeeps its no-language-dependency invariant. Read asname(params) :↔ definiens. - Dependency
Graph - The
usesdependency graph among definitions and from a theorem to its definitions — the Rung 0b graph seed (each node a definition/theorem, each edge auses). Direct edges only; transitive use is a query over this. This is the structure amathscrapesnode/edge compiles into. - Library
Result - The outcome of proving one theorem in a library.
- Library
Theorem - One theorem in a dependency-ordered library: proved from its own
premisesplus the conclusions of the theorems itcites. This is the unit the multi-theorem driver discharges in citation order (the Euclid-graph engine). - Verified
Proof - Outcome of running a goal through prove → certify → kernel type-check.
Functions§
- check_
derivation - Certify and kernel-check a derivation built EXTERNALLY (e.g. by the fast grid
solver) against
premises ⊢ goal, WITHOUT running the backward chainer. The trust guarantee is identical toprove_certify_check:verifiedis true only when the certifier produced a kernel term whose inferred type IS the goal type. So an external solver sits OUTSIDE the trusted base — it hands us aDerivationTree, the kernel re-checks it, and a wrong tree yieldsverified == false, never a false claim. - check_
derivation_ with_ defs - Like
check_derivationbut with userDefinitions in scope (Rung 0a), so an externally-built derivation of a definiens can certify against a goal stated with the definiendum — δ reconciles them at the root. - dependency_
graph - Build the
DependencyGraphfor a set of definitions plus a theorem (premises + goal), recording which definitions each definiens uses and which the theorem uses. Pure, allocation-light, O(total expression size). - detect_
conflict - Detect whether
premisesare jointly inconsistent, returning a kernel-checked proof ofFalseand the indices of the clashing premises. - prove_
certify_ check - Prove
goalfrompremises, certify the derivation, and kernel-check it. - prove_
certify_ check_ bounded - Like
prove_certify_checkbut caps the backward-chainer search depth, so a goal the kernel cannot reach fails FAST instead of exhausting the default depth. Keeps “prove-with-ours-first” cheap when answering a grid cell by cell: a shallow kernel attempt certifies what it can, then falls through to the oracle. - prove_
certify_ check_ bounded_ with_ defs - The depth-bounded pipeline with user definitions (Rung 0a). Definitions are
validated (recursion + lowering) up front, registered as δ-unfoldable kernel
definitions in the context, then the goal is proved and kernel-checked. The
engine still treats the definiendum opaquely during search (Stride 3 adds
expand-for-search); δ reconciles the certified term with the folded goal type
at the [
finish_check] root. - prove_
certify_ check_ with_ defs - Like
prove_certify_checkbut with userDefinitions in scope (Rung 0a). - prove_
library - Discharge a library of theorems in citation order. Each theorem is proved from its own premises plus the conclusions of the (already-proved) theorems it cites, so a citation graph is walked exactly like the scraped Euclid dependency graph. Results are returned in the INPUT order. A citation of an unproved/failed theorem simply isn’t available as a premise (so the dependent proof fails too).
- prove_
library_ with_ axioms - Like
prove_librarybut with a sharedaxiomsbase in scope for every theorem — a named theory (e.g. the Tarski geometry axioms) on which the whole dependency graph is discharged.