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
- In the browser: write and check proofs in the proof workspace. Chapter 13 explains editing, checking and the inspector, and the workspace’s quick reference summarizes the syntax.
- From the command line:
node cli/repl.mjs check FILE.cubistchecks a file with the same kernel. See the command-line checker and the CLI guide for setup and commands. - In the REPL: try terms and declarations one at a time, each checked by the kernel: on the REPL page, in the console under every proof in the workspace, where the proof’s names are loaded, or in the REPL bar at the bottom of these pages.
let x := 7;defines,typeof x;shows a type andevaluate x;a value. - Kernel terms: the kernel workbench shows checked terms, their context, reductions, the kernel’s abstract syntax tree of native nodes, and the judgement graph it derives. Chapters 14 to 17 describe the kernel: its judgements, its terms, its instructions and its computation rules.
- New to Cubist: start with chapter 1, types and values, then a first proof. Every example in this reference is checked by the test suite; incorrect examples show their error message as a
// Error:comment. - Inspect any example: examples are also checked in your browser as you read. Click a name in one to see its checked kernel term, type and context, in the same inspector as the proof workspace; Open in workspace lets you edit and run it.
Chapters
- Types and valuesThe basic types and their values: numbers, Unit and Void, pairs, alternatives, functions, types themselves, equality, and forall and exists.
- A first proof and filesFirst proofs about pairs, alternatives and numbers, then how a source file is laid out: imports, names, comments and declarations.
- Functions, pairs and sumsEach basic type in full: how to build its values and how to use them, expected types, and precedence.
- Proof blocksA proof block builds a term one statement at a time. Each statement extends the context, changes the goal, or closes it.
- Computation and conversionWhen two terms are equal by computation, which is how the checker compares types, and how definitions unfold.
- UniversesTypes of types, universe variables, and declarations checked once for every universe.
- Equality and pathsIdentity types and their operations, transport, path induction, and propositions and sets.
- Natural numbers and inductive typesInductive declarations, constructors, pattern matching, recursive functions and proofs, induction, and binary numbers.
- Equational reasoning and simplificationChains of equalities, rewriting with checked lemmas, and simplification.
- Theories and modelsTheories of algebraic structures: sorts, operations with notation and laws, their models, extension and open.
- 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.
- 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.
- Checking and inspectionWhere to check a proof, and how to read what the checker found.
- 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.
- 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.
- 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.
- 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.
- 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:
- nat: the natural numbers, their arithmetic and order, and their laws, by
matchandcalc. - hlevels: contractible types, propositions and sets in every universe, Hedberg's theorem, and the lemmas
hlevelbuilds its proofs from. - univalence and propositions: univalence from Glue types, and propositional extensionality.
- quotients: set quotients, their universal property and effectiveness.
- algebra: the magma-to-group lattice, rings and fields as theories, with lemmas in sections; ordered_algebra adds ordered rings and constructive ordered fields.
- integers and rationals: a commutative ring and a field, built as quotients, whose arithmetic computes.
- euclid: Euclid's theorem over binary numbers, by an introduction, a destructured witness, a local claim decided by cases, and a pair witness.
- least_elements: the least element of a decidable predicate, searched from 0 up to a witness by Peano recursion on binary numbers.
The first library, archived under archive/first-library/, is kept as a reference:
- Paths: identity induction, symmetry, composition, congruence,
path i =>andapd_path. - Ring laws and ordered fields:
simp onlyandsimpa onlyon algebraic identities. - Group operations: chains of
rw. - Field extensionality: pair paths built with
over. - Right inverses of surjections: set assumptions, choice, and mere existence.
- The circle’s fundamental group: suspension paths, equivalences, and univalence.
- Complete ordered field interface: explicit universes and constructive hypotheses.
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.