- Base: Intensional MLTT with Id types (
Id,refl,J) - Cubical features (always enabled as of v1.6.0):
- Interval type
Iwith endpointsi0,i1 - Path types:
Path A x y,PathP A x y - Composition:
comp,hcomp,fill - Glue types:
Glue A [φ ↦ (T, e)] - Univalence:
ua A B e : Path Type A B
- Interval type
- Universes: predicative, cumulative tower
Type0 : Type1 : …. NoType : Type. Explicit level arithmetic; no impredicativity.
- Core terms use de Bruijn indices; surface syntax keeps user names.
- Raw (surface) AST elaborates to Core AST; kernel only sees Core AST.
- Normalization-by-Evaluation (NbE) for β-δι and optional η (Π/Σ) behind a feature flag. Conversion reduces both sides to WHNF via NbE and compares structurally. No ad-hoc reductions outside the documented rules.
- The kernel is minimal, total, and panic-free. Only accepts well-formed core commands:
Axiom(name, type)Def(name, type, body, transparency)Inductive(spec)(strict positivity checked)- (Phase 7+)
HIT(spec)
- Everything else (parsing, name resolution, implicits, tactics, pattern matching, typeclass-ish search) lives outside the kernel and is re-checked after expansion.
internal/ast— Core and Raw AST definitions, levels.internal/eval— NbE evaluator, reify/reflect.internal/core— Definitional equality, small logical glue.internal/check— Bidirectional type checker for core terms.internal/kernel— Trusted object layer and global env checks.pkg/env— Untrusted convenience environment used by front-end.cmd/hottgo— CLI entry point.docs/— design notes, contributing, and invariants.
- Kernel never panics; returns typed errors with stable messages.
- No rule exists unless it’s documented here or in
docs/rules/*.md. - Error messages are deterministic (sorted map iteration, etc.).
- Golden tests pin pretty-printed normal forms and diagnostics.
DESIGN.mdchecked in with decisions above.- Skeleton packages compile with
go test ./...(smoke tests). - Kernel exposes a tiny API surface with typed "unimplemented" errors to be filled in later phases.
The elaboration system transforms surface syntax with implicit arguments and holes into fully explicit core terms.
Surface syntax extends core syntax with:
- Implicit arguments marked with
{} - Holes:
_(anonymous) and?name(named) - User-friendly names instead of de Bruijn indices
MetaStoremanages metavariables created during elaboration- Each metavariable tracks: ID, expected type, context, solution (if solved)
- States:
Unsolved,Solved,Frozen
Bidirectional type checking:
synth: Synthesize type from termcheck: Check term against expected type Key operations:- Hole → Fresh metavariable
- Implicit Pi application → Auto-insert
{?α} - Implicit lambda inference when checking against implicit Pi
Miller pattern unification:
- Solves constraints of form
?α[σ] =? t - Patterns: metavariable applied to distinct bound variables
- Occurs check prevents cyclic solutions
- Defers non-pattern constraints
Substitutes solved metavariables with their solutions throughout a term.
Ltac-style proof scripting for interactive theorem proving.
Goal: Single proof obligation with hypotheses and goal typeProofState: Collection of goals, metastore, undo history- Focus management for working on specific goals
A tactic transforms a proof state:
type Tactic func(*proofstate.ProofState) TacticResultCombinators (combinators.go):
Seq: Sequential compositionOrElse: Try first, fallback to secondTry: Succeed even on failureRepeat: Apply until failureFirst: First successful tacticAll: Apply to all goals
Core Tactics (core.go):
Intro: Introduce hypothesis from Pi typeExact: Provide exact proof termAssumption: Solve from hypothesisReflexivity: Prove Id/Path reflexivitySplit: Split sigma typesRewrite: Use equality for rewritingAuto: Automatic proof search
prover := tactics.NewProver(goalType)
prover.Intro_("x").Intro_("y").Assumption_()
term, err := prover.Extract()internal/
├── ast/ — Core and Raw AST
├── elab/ — Elaboration system
│ ├── surface.go — Surface syntax types
│ ├── meta.go — Metavariable store
│ ├── context.go — Elaboration context
│ ├── elab.go — Elaboration algorithm
│ └── zonk.go — Zonking
├── unify/ — Unification
│ └── unify.go — Miller pattern unification
├── eval/ — NbE evaluator
├── parser/ — Parsing
│ ├── sexpr.go — Core term parser
│ └── surface.go — Surface syntax parser
└── ...
tactics/
├── proofstate/
│ └── state.go — Proof state management
├── tactic.go — Tactic type
├── combinators.go — Tactic combinators
├── core.go — Core tactics
└── prover.go — Go API