Cubist

SYNTAX, MEANING, AND CHECKED EVIDENCE

Language reference

Write terms and proofs in dependent type theory. Cubist elaborates each declaration into instructions checked by the C kernel.

The reference describes the mathematical .cubist language in the chapters below. The test suite checks every complete example, including the rejected ones and their error messages. The few partial sketches are marked as such in the page source.

One principle runs through the whole language. The elaborator is written in JavaScript and may be arbitrarily clever: it expands notation, finds rewrite positions and selects simplification rules. It is not trusted. Everything it produces is an ordinary kernel term, and the C kernel checks every one of them. A convenience that the kernel cannot check makes the declaration fail. It never becomes an assumption.

Using Cubist

Chapters

  1. Types and valuesThe basic types and their values: numbers, Unit and Void, pairs, alternatives, functions, types themselves, equality, and forall and exists.
  2. A first proof and filesFirst proofs about pairs, alternatives and numbers, then how a source file is laid out: imports, names, comments and declarations.
  3. Functions, pairs and sumsEach basic type in full: how to build its values and how to use them, expected types, and precedence.
  4. Proof blocksA proof block builds a term one statement at a time. Each statement extends the context, changes the goal, or closes it.
  5. Computation and conversionWhen two terms are equal by computation, which is how the checker compares types, and how definitions unfold.
  6. UniversesTypes of types, universe variables, and declarations checked once for every universe.
  7. Equality and pathsIdentity types and their operations, transport, path induction, and propositions and sets.
  8. Natural numbers and inductive typesInductive declarations, constructors, pattern matching, recursive functions and proofs, induction, and binary numbers.
  9. Equational reasoning and simplificationChains of equalities, rewriting with checked lemmas, and simplification.
  10. Theories and modelsTheories of algebraic structures: sorts, operations with notation and laws, their models, extension and open.
  11. Cubical paths and higher inductive typesPaths as functions of an interval, dependent paths, composition, and types with path constructors: the circle, truncations, set quotients, pushouts and suspensions.
  12. Excluded middle, choice and computabilityThe two classical assumptions, excluded middle and choice, the mere existence they conclude, univalence and extensionality, which compute, and how a result states and checks that it computes.
  13. Checking and inspectionWhere to check a proof, and how to read what the checker found.
  14. The kernel: judgements, derivations and trustThe C kernel that checks every declaration: its judgements and contexts, the derivation graph, definitions, checkpoints, what is trusted, and how to read a derivation.
  15. Kernel terms: the arena and its primitivesThe kernel's syntax: the term arena and its handles, interval and face formulas, every primitive node with its children, payload and binder scope, substitution, restriction and comparison.
  16. Kernel instructions: the typing rulesEvery kernel instruction: the premises it checks, the judgement it publishes, and the name it is shown under in a derivation.
  17. Kernel computation: reduction, elimination and compositionWhat the kernel computes when asked: the single-step rules, weak-head and normal forms, elimination of declared types, and composition, transport and filling at every type former.
  18. Error messagesEvery error message shown in this reference, what it means, and what to do.

Library examples

The library, under library/, is built in today's language, and a module imports it by name:

The first library, archived under archive/first-library/, is kept as a reference:

For the exact accepted grammar and elaboration, see parser.mjs and cubical-elaborator.mjs. Library definitions are ordinary checked source; their signatures remain the authority for their particular arguments and universes.