Code language
System architecture
Design principles¶
Every change keeps these principles. The ground rules turn them into checkable rules for the code.
Soundness¶
- Only the kernel says "checked". A checked judgment is created by
judgment_coreand by nothing else. Engines, the coordinator, and the CAS propose; the kernel decides. - Trust follows package boundaries. A package is either part of the trusted base or entirely untrusted. No trait, callback, or registration lets untrusted code extend what the kernel trusts.
- Check results, not algorithms. An algorithm may be as clever and as fast as we like, because its output carries a certificate that the kernel checks cheaply. A certificate checker must be much simpler than the algorithm it checks.
- Axioms are visible. Every result lists the classes of its dependencies: native rules, admitted rule bundles, literal kinds, checkers. Nothing is admitted silently.
- Raw syntax means nothing. A term in
termbankis syntax. Only a kernel constructor turns it into a checked term, and only a proof turns a proposition into knowledge.
Efficiency¶
- Check what you keep, not what you try. Search tries many steps it later abandons; only what leaves a request is checked.
- Rigor at the boundary, speed inside. Inside a request, engines share provisional facts with recipes. At the boundary (a returned answer, a stored fact, an export) the kernel checks a proof.
- Let the kernel compute. Bookkeeping that would dominate proofs (associativity, commutativity, units, exact arithmetic) belongs in the kernel's definitional equality, where it costs nothing.
- Proofs on demand. A deterministic run can be replayed. A proof that was not built for speed can be rebuilt when someone asks for it.
- Measure. Search time, checking time, and proof size are measured separately.
Mathematics¶
- Generic answers are conditional answers. The simplification
x/x → 1holds under the guard "xfinite and nonzero"; the default mode accepts such guards and shows them on request. - Domains are predicates. "Real", "positive", and "integer" are propositions about a symbol, so assumptions can refine them during a computation.
- One logic for computation and abstraction. The same
polymorphic higher-order logic expresses
x/x = 1and theorems about Sobolev spaces.
Engineering¶
- Determinism. No result depends on hashing order, addresses, or timing. Two runs give the same answer and the same proof.
- No recursion. Traversals use explicit stacks, so deep terms cannot overflow the call stack.
- Budgets everywhere. Every loop whose length depends on the input is charged against a budget, and running out is an explicit outcome, never a wrong answer.
- Small packages, explicit graph. One responsibility per package; algorithm packages (computation only) are separate from the engines that turn their results into certificates.