System architecture

Design principles

Every change keeps these principles. The ground rules turn them into checkable rules for the code.

Soundness

  1. Only the kernel says "checked". A checked judgment is created by judgment_core and by nothing else. Engines, the coordinator, and the CAS propose; the kernel decides.
  2. 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.
  3. 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.
  4. Axioms are visible. Every result lists the classes of its dependencies: native rules, admitted rule bundles, literal kinds, checkers. Nothing is admitted silently.
  5. Raw syntax means nothing. A term in termbank is syntax. Only a kernel constructor turns it into a checked term, and only a proof turns a proposition into knowledge.

Efficiency

  1. Check what you keep, not what you try. Search tries many steps it later abandons; only what leaves a request is checked.
  2. 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.
  3. 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.
  4. 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.
  5. Measure. Search time, checking time, and proof size are measured separately.

Mathematics

  1. Generic answers are conditional answers. The simplification x/x → 1 holds under the guard "x finite and nonzero"; the default mode accepts such guards and shows them on request.
  2. Domains are predicates. "Real", "positive", and "integer" are propositions about a symbol, so assumptions can refine them during a computation.
  3. One logic for computation and abstraction. The same polymorphic higher-order logic expresses x/x = 1 and theorems about Sobolev spaces.

Engineering

  1. Determinism. No result depends on hashing order, addresses, or timing. Two runs give the same answer and the same proof.
  2. No recursion. Traversals use explicit stacks, so deep terms cannot overflow the call stack.
  3. 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.
  4. Small packages, explicit graph. One responsibility per package; algorithm packages (computation only) are separate from the engines that turn their results into certificates.
judgment v1.0.0 for Mojo 1.2 · Apache License 2.0 with LLVM Exceptions · Source on GitHub