Theory¶
For an introduction to the notation and its meaning in the API, read Concepts and theory. The HOL rationale explains the choice of simple types and the intended correspondence with Isabelle/HOL. The chapters below give the formal definitions and arguments.
These pages state the mathematics the implementation realizes: definitions, theorems, and proofs. Every component of the trusted base has a theorem here that says why it is correct. Every untrusted component that returns a certificate has a theorem that says why checking the certificate suffices.
The architecture pages explain the design in prose, and the implementation reference specifies the code. When the three disagree, the disagreement is a bug.
How results are labeled¶
| Label | Meaning |
|---|---|
| Definition | Fixes a notion. The code must implement exactly this. |
| Theorem, Lemma, Proposition | Proved on these pages, with the proof given or, for routine inductions, its decisive cases. |
| Theorem (cited) | A standard result, with a reference. We rely on it and do not reprove it. |
| Requirement | A property of the implementation that the proofs assume. Each one is tested, and the trusted ones are listed in the inventory. |
Results are numbered per page: S for syntax, T for typing, D for deduction, M for semantics, C for conversion, Y for type definitions, overloading, and classes, X for the scalar profile, P for polynomials, B for checking at the boundary, Z for certificates, A for analysis, and NR for natural numbers. On each page, definitions form one sequence and theorems, lemmas, propositions, and corollaries another, so Definition T-1 and Theorem T-1 are different results. A letter suffix (Lemma C-4a) marks a result inserted after its neighbors were numbered; numbers never change. Requirements carry an R (S-R1), except L1 to L5 and O on the conversion page; the semantic lemmas are M-L1 to M-L3, the invariants of checking B-I1 to B-I3, and the order of the scalar carrier is Definition X-P1.
What justifies what¶
| Component | Results | Page |
|---|---|---|
| de Bruijn terms, shifting, substitution, renaming of node ids | Definitions S-1 to S-11; Lemmas S-1, S-2, and S-4 to S-6; Theorem S-3; Requirements S-R1 to S-R3 | Syntax |
| Theories, type inference, variadic ACU spines, version vectors | Definitions T-1 to T-7; Theorems T-1 to T-5; Propositions T-6 and T-7; Lemmas T-8 and T-9 | Typing |
| The inference rules, dependency summaries, export, transport, type instantiation, theory weakening and strengthening, comparison of contexts | Definitions D-1 to D-5; Theorems D-1 to D-8; Corollary D-9 | Deduction |
| Soundness and consistency of the kernel | Definitions M-1 to M-4; Lemmas M-L1 to M-L3; Theorems M-1 to M-4 | Semantics |
| Conservative definitions | Theorem M-5 | Semantics |
| Canonical construction, definitional equality, lifting, conversion elimination | Definitions C-1 to C-4, C-6, and C-7; Theorems C-1, C-5 to C-8, C-10, and C-12; Lemmas C-2, C-3, C-4a, C-9, and C-12a; Corollaries C-4, C-8a, C-9a, and C-12b; Requirement O | Conversion |
| Literal kinds | Requirements L1 to L5; Definition C-5; Theorems C-5 and C-11 | Conversion |
| Type definitions, specifications, overloading, classes, sorts, ACU at a class | Definitions Y-1 to Y-15; Theorems Y-1 to Y-3 and Y-5 to Y-8; Lemmas Y-3b, Y-4, Y-4a, and Y-4b | Type definitions, overloading, and classes |
The scalar carrier, generic answers |
Definitions X-1 to X-6; Lemma X-0; Theorems X-1 to X-6 and X-8; Corollary X-7 | The scalar carrier |
The order of the scalar carrier |
Definition X-P1 | Order and domains |
| Formal-polynomial literals | Definitions P-1, P-2, and C-5P; Proposition P-1; Theorem C-11P; Lemma C-12aP; Requirement P-R1 | Polynomials |
Evaluation of formal polynomials in the scalar carrier, the polynomial theory over Scalar, reification |
Definitions P-3 to P-5; Theorems P-2 to P-6 | Polynomials over Scalar |
| Checking at the boundary | Definitions B-1 to B-3; Requirements B-R1 and B-R2; invariants B-I1 to B-I3; Theorems B-1 and B-2; Corollary B-3; Propositions B-4 to B-7 | Checking at the boundary |
| Sequent rules, closures and the canonical closure | Definitions Q-1 to Q-18 and Q-3d; Lemmas Q-1, Q-2, Q-2b to Q-2e, Q-2g, Q-4 and Q-6 to Q-8; Propositions Q-3, Q-3c, Q-3f and Q-29; Theorems Q-3a, Q-3b, Q-3e, Q-5, Q-9 to Q-26 and Q-28; Corollary Q-27; Requirements Q-R1 to Q-R3 | Sequents |
| Local checking, binding sites | Definitions LC-1 to LC-21; Requirements LC-R1 to LC-R8; Theorems LC-4, LC-10, LC-12, LC-14, LC-16, LC-18, LC-19, LC-21 to LC-23, LC-26, LC-28 and LC-31 to LC-33; Lemmas LC-25, LC-27 and LC-29; Proposition LC-30 | Local checking |
| Certificates: gcd, Farkas, Gröbner, antiderivatives, holonomic functions, WZ pairs | Definitions Z-1 to Z-3; Theorems Z-1 to Z-13 | Certificates |
| Abstract analysis: measures, distributions, Sobolev and BV spaces | Definitions A-1 to A-5; Theorem A-1 | Analysis |
| Natural numbers, induction, primitive recursion, categoricity, arithmetic | Definitions NR-1 to NR-7; Theorems NR-1 to NR-7; Lemma NR-2a; Corollary NR-5a | Natural numbers |
What is not claimed¶
- The proofs here are on paper. The architecture calls for auditing exported kernel proofs with an independent HOL kernel through OpenTheory and with Isabelle. Those integrations are separate from formally verifying the Mojo implementation or machine-checking this theory; neither is claimed here.
- That the implementation meets these definitions is the trusted-base assumption. It is tested (adversarial, differential, and property tests), not proved.
- The logic is incomplete with respect to its standard models, as every sufficiently strong logic is. Only soundness is claimed.
Notation¶
| Symbol | Meaning |
|---|---|
| \(\alpha, \beta\) | type variables |
| \(\kappa\) | a type constructor |
| \(\tau, \sigma\) | types |
| \(\#i\) | the bound variable with de Bruijn index \(i\) |
| \(\ell\) | a local (a fixed parameter of a context) |
| \(c[\bar\tau]\) | the constant \(c\) at type arguments \(\bar\tau\) |
| \(\Gamma \vdash A\) | the judgment that \(A\) holds in context \(\Gamma\) (the theory is implicit) |
| \(\theta\) | a type substitution |
| \(t =_E u\) | equality modulo β, ACU, and literal arithmetic, decided by identity of canonical forms |
| \(t \equiv u\), \(t \equiv_U u\) | definitional equality (conversion), unfolding every transparent definition or those of \(U\) |
| \(N_\Sigma(t)\) | the canonical form of \(t\) for the canonical signature \(\Sigma\) |
| \(\underline v\) | the literal that represents the value \(v\): the bound zero or one, or an atom |
| \(T \sqsubseteq T'\) | theory inclusion |
| \(\langle t\rangle\), \(T^-\) | the plain reading of \(t\), and the plain theory of \(T\) (Definitions C-6 and C-7) |
| \(\sem{t}\) | the denotation of \(t\) in a model |
| \(\hat S\) | the carrier of the scalar profile |
| \(\uplus\) | multiset union |
The references page lists the works cited.