Why HOL?¶
judgment uses polymorphic simple type theory (higher-order logic, HOL) rather
than dependent type theory (as in Lean 4 or Rocq).
We chose HOL for three main reasons:
- Interoperable proofs and independent verification: HOL provers share a standard proof-interchange format, OpenTheory, which prevents vendor lock-in and lets other provers verify proofs independently.
- Stronger automation and simpler rewriting: In simple type theory, rewriting a subterm with an equal term of the same type is always well-typed. That makes proof automation and symbolic rewriting much easier to build.
- Sufficient for pure mathematics: HOL covers mainstream pure mathematics without the bookkeeping of dependent types. Even in dependent-type libraries such as Lean's Mathlib, contributors routinely avoid dependent types where simple types and explicit hypotheses work instead.
1. Interoperability and independent verification (OpenTheory)¶
Most proof assistants lock proofs into a single tool's kernel and binary format. In the HOL family (HOL4, HOL Light, ProofPower, Isabelle/HOL), provers share a small, well-defined foundation and a common interchange format: OpenTheory.
judgment supports OpenTheory version 6 articles for both import and export
(OpenTheory theory,
Lesson 5.7, and
Lesson 5.8: Verify an exported proof in Isabelle/HOL):
- No vendor lock-in: checked proofs in the supported HOL fragment can be
exported as
.artarticles rather than staying trapped insidejudgment. - Independent verification: you do not have to trust
judgment's kernel alone. Exported articles can be re-checked by an independent HOL prover, and external OpenTheory articles can be imported and re-checked locally byjudgment_core.
2. Automation and symbolic rewriting¶
Simple types provide a substantial advantage for proof automation and symbolic rewriting.
In simple type theory, types are generated from type variables (α), declared
type constructors (List(α)), and function arrows (α → β). Terms such as a
symbolic dimension n + 1 or a polynomial degree d do not appear inside
types; dimensions, degrees, moduli, and domain guards remain ordinary values and
propositions.
Because types do not depend on terms, replacing a subterm with a provably equal term of the same type always preserves well-typedness:
- With dependent types, a matrix type may be indexed by its width
(
Matrix m (n + 1)). Rewritingn + 1to1 + nyieldsMatrix m (1 + n), which need not be definitionally equal to the expected type; restoring well-typedness requires an equality proof and transport along it. Rewrite tactics, simplifiers, and external solver bridges must propagate or discharge those transport obligations. - With simple types, the carrier (
Matrix) stays fixed and the width is constrained by a predicate. Rewritingn + 1to1 + nupdates the term and its side condition without affecting the typing of enclosing expressions.
This property directly simplifies general-purpose proof automation. HOL goals
translate cleanly to first-order automated theorem provers and SMT solvers, and
returned proofs reconstruct without dependent-type transport. That is a major
reason HOL systems support mature general-purpose hammers such as Isabelle's
Sledgehammer; at the time of writing, dependent-type provers have not achieved
comparable general automation. judgment does not ship an ATP hammer itself,
but adopting HOL preserves that structure for symbolic engines, tactics, and
external solvers built on top of it.
Side conditions remain explicit
Simple types do not elide domain obligations. Dimension compatibility, nonzero denominators, and similar preconditions must still be proved before applying a law. Expressing them as ordinary propositions allows symbolic engines and guard checkers to inspect, combine, and simplify them uniformly.
3. Predictable type checking and conversion¶
Because types contain no arbitrary term computations, checking an application reduces to structural type comparison and sort-constraint verification. The type checker never reduces symbolic terms to establish well-typedness.
For a symbolic engine rewriting subterms, substituting variables, and hash-consing shared DAG nodes, two properties follow:
- Substituting an equal subterm of the same type never requires a type cast.
- Well-formedness checking has predictable cost. Ill-typed applications, unsatisfied sort constraints, and illegal overloading are rejected immediately, and every kernel check runs under an explicit work budget.
Definitional vs. proved equality¶
Like Lean and Isabelle, judgment distinguishes definitional equality (checked
by conversion) from proved equality (established by a derivation).
Conversion in judgment covers β- and let-reduction, unfolding of permitted
transparent definitions, declared ACU (associative-commutative-unit)
canonicalization, and registered exact literal arithmetic (integers, rationals,
and formal polynomials). η-conversion is excluded. See
conversion theory for the exact specification.
Scope of the trusted base
Placing exact arithmetic and ACU normalization inside conversion keeps proof terms compact and rewrites fast, at the cost of a larger trusted base. Those components are validated against independent reference implementations (trusted base). Simple types exclude this computation from typing, and conversion bounds it under the session work budget.
4. Compatibility with Isabelle/HOL¶
Beyond OpenTheory, judgment implements HOL's nonempty subset type definitions,
order-sorted type classes, and checked overloading
(type and class theory), enabling imports from
Isabelle/HOL via judgment_mathlib.
judgment does not parse .thy files directly and does not admit imported
theorems without tracking. Every imported result passes four checks:
- Statement translation: preserve types, constants, definitions, class constraints, and theory identities.
- Assumption tracking: record every axiom and imported statement in the result's dependency closure.
- Explicit provenance: distinguish statement-only imports (recording
Isabelle provenance) from full proof-DAG rechecks verified locally by
judgment_core. - Semantic bridges: keep differing conventions separate. For example,
Isabelle/HOL defines total division with \(x / 0 = 0\), whereas
Scalarmodels extended complex numbers with \(1 / 0 = \tilde{\infty}\) and \(0 / 0 = \mathrm{indet}\). Checked bridge theorems relate the two only on the domain where they agree.
5. Trade-offs compared to dependent types¶
HOL is sufficient for mainstream pure mathematics, including real and complex analysis, algebra, topology, probability, and number theory. In practice, even dependent-type libraries such as Lean's Mathlib discourage unnecessary dependent types (for example, length-indexed vectors or value-indexed matrices) in favor of unindexed carriers with explicit hypotheses, to avoid transport and rewriting overhead.
Choosing simple type theory over dependent type theory nonetheless gives up several mechanisms that dependent types support natively:
- Value-indexed types: Dependent type theory allows types to depend on
values, such as length-indexed vectors (
Vec α n), bounded indices (Fin n), or dimension-checked matrices (Matrix m n), encoding preconditions directly in function signatures. In HOL, types cannot depend on terms; dimension and bounds constraints are carried as explicit propositions over unindexed carriers. - First-class types and universe polymorphism: Dependent type theory places types in a universe hierarchy, allowing quantification over types inside propositions, value-indexed type families (such as \(\mathbb{R}^n\) for arbitrary \(n\)), and bundled algebraic structures as dependent records over arbitrary carriers. In HOL, polymorphism is rank-1 (top-level) and types are strictly separate from terms. Abstract algebra uses type classes (at most one instance per type constructor) or explicit carrier sets, which is less direct for category-theoretic constructions or multiple distinct algebraic structures on one carrier type.
- Proof terms inside expressions: Under Curry-Howard, dependent type theory treats proofs as terms, allowing subtype witnesses (such as \(\{x \mid x \neq 0\}\)) inside expressions and verified decision procedures via kernel reduction. In HOL, proofs are derivations external to the term language: a well-typed expression such as \(\frac{x^2 - 1}{x - 1}\) may still lie outside a law's domain (at \(x = 1\)), and domain conditions appear explicitly as theorem guards rather than being enforced by expression typing.
Further reading¶
- Concepts and theory: judgments, contexts, and the
three kinds of equality in
judgment - OpenTheory interchange and Lesson 5.7: Exchange proofs with OpenTheory
- The logic used by judgment and Formal theory