Lectures onType Theory
Chapter 65
Chapter 65Optional

Classical Simple Type Theory and HOL

Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.

Curry–Howard type theories identify a proposition with a type of its proofs. HOL does something deliberately different. It uses the simply typed lambda calculus as a language of mathematical objects, reserves one type for truth values, and puts proofs behind an abstract theorem interface. Classical reasoning, extensionality, and choice are principles of that logic; a theorem is not definitionally a program of its proposition, as it is in the propositions-as-types reading of chapter 2. The control-operator account of classical proofs in chapter 17 is another system, not an operational semantics for this HOL kernel.

This chapter fixes one HOL family member closely enough to prove things about it. The logical core is a compact Church-style presentation of the HOL rules documented by Gordon and in the HOL4 teaching packet [Gor85, Tue19]; slides 29–36 of the latter display the selected kernel. The definition principles and model follow the machine-checked account of Kumar, Arthan, Myreen, and Owens [KAMO14]. Historical LCF supplies the kernel architecture [Mil79]. Other HOL implementations make different small choices, so every theorem below is scoped to this frozen core.

The Church signature

Types and terms are τ,σ::=αboolindτσ,t,u::=xτcτtuλxτ.t. Type variables are schematic. The type operator associates to the right, and application to the left. Every type is inhabited. A term of type bool is a formula; a sequent Γp has a finite set of Boolean assumptions and a Boolean conclusion.

The primitive logical constants are polymorphic equality and choice: (=)α:ααbool,(@)α:(αbool)α. Truth, connectives, and quantifiers are definitions. One convenient basis is :=(λx.x)=(λx.x),pq:=(λf.fpq)=(λf.f),x.Px:=P=(λx.). Negation, disjunction, implication, and existential quantification can then be defined classically. These encodings are not intended as a pleasant surface syntax. They show that equality plus the lambda calculus is a complete logical basis.

The primitive inference rules are as follows. Substitutions in INST are capture-avoiding simultaneous term substitutions; those in INST-TYPE substitute types throughout a theorem. Xt=tREFL Γs=tΔt=uΓΔs=uTRANS Γf=gΔx=yΓΔfx=gyCOMB Γs=txFV(Γ)Γ(λx.s)=(λx.t)ABSX(λx.t)x=tBETA General beta conversion at an argument u is derived by first choosing the bound variable fresh and then applying INST. X{p}pASSUMEΓp=qΔpΓΔqEQMP ΓpΔq(Γ{q})(Δ{p})p=qDEDUCTANTISYM ΓpθΓθpINST ΓpρΓρpINSTTYPE. In DEDUCT-ANTISYM, the first premise is understood to use q as a possible assumption and the second to use p. Writing the set differences in the conclusion makes assumption discharge explicit.

Three closed axioms complete the selected signature: ETA:(λx.fx)=f(xFV(f)), SELECT:PxP(@P), INFINITY:f:indind.inj(f)¬surj(f). The last formula is one common infinity axiom; equivalent HOL presentations may instead postulate an injective non-surjective successor directly.

Which principles enter where?

The following ledger prevents several common conflations. Beta is a primitive inference rule, justified by function application. Eta is a closed axiom, valid because functions are extensional. Propositional extensionality and classical logic are derived theorems of the Boolean encoding, whose model interprets bool by exactly {0,1}. Choice is a closed axiom using @, interpreted by a choice function on every nonempty type. Infinity is a closed axiom, interpreted by choosing ind infinite. Equality is primitive at every type. Functional extensionality follows from η and congruence. Propositional extensionality is stronger than merely having equality at bool: the Boolean encoding proves that logically equivalent formulas denote the same Boolean. Classical excluded middle is a theorem of this logical basis, not a normalization consequence of the term calculus.

Exercise 65.1

★★☆ Using ETA, ABS, COMB, and transitivity, derive (x.fx=gx)f=g. Mark the single step that depends on the definition of , rather than on a kernel rule. (Twelve lines.)

A set model

Fix a set-theoretic universe containing a two-element set and a countably infinite set. A valuation ν assigns every type variable a nonempty set. Interpret types by [[bool]]ν={0,1},[[ind]]ν=N,[[στ]]ν=[[τ]]ν[[σ]]ν. Constants receive elements of their denoted sets. Application and abstraction are interpreted by application and set-theoretic function formation. Equality denotes the diagonal characteristic function.

Because every type denotes a nonempty set, fix a global choice operation χX:(X{0,1})X with (xX.P(x)=1)P(χX(P))=1. Interpret (@)τ by χ[[τ]]. This is the semantic strength used by SELECT; it is not smuggled into the lambda-calculus clauses. Interpret ind by N, with successor witnessing INFINITY.

Lemma 65.1 — Semantic substitution

For a well-typed term t, term substitution θ, environment η, and compatible type valuation ν, [[θt]]ν,η=[[t]]ν,ηθ,ηθ(x)=[[θx]]ν,η. Type substitution satisfies the same equation after reindexing ν.

Proof of Lemma 65.1 — Semantic substitution

Proof. Induct on t. Variables are the definition of ηθ; constants are fixed by the interpretation. Application uses the two induction hypotheses. For abstraction, rename its binder fresh for θ, apply the induction hypothesis to the body in an extended environment, and use extensional equality of set-theoretic functions. ◻

Write (ν,η)Γ when every member of Γ denotes 1, and Γallp when this implies [[p]]ν,η=1 for every valuation and environment.

Theorem 65.2 — Kernel soundness

If Γp is built from the rules and axioms above, then Γallp.

Proof of Theorem 65.2 — Kernel soundness

Proof. Induct on the theorem object. REFL, TRANS, and COMB are reflexivity, transitivity, and congruence of set equality. ABS uses function extensionality; its freshness condition keeps the assumption interpretations fixed. BETA is the semantic substitution lemma. For ASSUME, satisfaction of {p} gives [[p]]=1. Rule EQ-MP replaces equal Boolean values. For DEDUCT-ANTISYM, inspect the four possible truth-value pairs for p,q: the premises exclude (1,0) and (0,1) under the undischarged assumptions, hence the values agree. The substitution rules use lemma 65.1. Finally ETA holds for functions, SELECT by χ, and INFINITY in N. ◻

Corollary 65.3

There is no kernel derivation of , where is the defined false Boolean.

Proof of Corollary 65.3

Proof. The model gives [[]]=0. Soundness would give value 1 to any closed theorem. ◻

This is a relative consistency argument in the stated set theory. It neither proves that an arbitrary implementation is bug-free nor covers later oracle axioms. Kumar et al. prove a corresponding soundness and consistency theorem for their formal HOL semantics [KAMO14].

Exercise 65.2

★★☆ Write the missing semantic cases for abstraction and deduction antisymmetry. Give a countermodel after deleting abstraction’s freshness condition, and enumerate the Boolean pairs excluded by deduction antisymmetry. (Half a page.)

Definitions, new types, and quotients

A constant definition introduces fresh c:τ with equation c=t, where t:τ is closed and contains no type variable absent from τ. Its model interpretation is forced to be [[t]], so it creates notation, not a new axiom about old constants.

A type definition starts with an old-type predicate P:σbool and a theorem x.Px. It introduces fresh α, abs:σα, and rep:ασ, with characteristic equations abs(repa)=a,Prrep(absr)=r. Semantically, take [[α]]={x[[σ]]P(x)=1}. Nonemptiness is exactly what HOL’s inhabited-type discipline needs. Let rep be inclusion and let abs map members to themselves and nonmembers to one fixed witness. The equations follow. Extending every old model in this way proves conservativity for formulas in the old signature.

For a concrete quotient, let List(A) be an already defined HOL type and put xsysa:A.count(a,xs)=count(a,ys). This is an equivalence relation, and concatenation respects it: xsxsysysxs++ysxs++ys. A quotient package first constructs a nonempty representation of equivalence classes, then uses the type-definition principle to introduce Bag(A). Lift [] and (++) to and . The representative equations give B=B,(AB)C=A(BC),AB=BA. Only the last law is new relative to lists; its proof is pointwise commutativity of natural-number addition. The package automates respectfulness and lifting, but its theorems still pass through the same kernel.

Exercise 65.3

★★★ Prove transitivity of , prove concatenation respectful, and derive commutativity of by applying rep and comparing counts. List exactly where nonemptiness of the quotient representation is used. (One page.)

The LCF trust boundary

An LCF implementation makes the host-language type thm abstract. Only kernel functions construct values of that type. A tactic has shape goal(goal1,,goaln,thmnthm). The validation function must rebuild the promised theorem from subtheorems. A buggy tactic can fail, loop, or choose a poor proof; absent an unsafe escape hatch, it cannot forge a thm. This is the central LCF separation between a small trusted kernel and untrusted proof search.

For an exact tactic-to-kernel trace, consider the goal (λx.(λy.y)y)=(λx.y). A derived abstraction tactic replaces it by the subgoal (λy.y)y=y and stores a validation that calls ABS on the returned theorem. A beta tactic closes that subgoal by the primitive BETA constructor. Composing the validations yields the complete primitive trace X(λy.y)y=yBETA(λx.(λy.y)y)=(λx.y)ABS. The empty assumption set discharges ABS’s freshness condition. The HOL4 course’s longer forward trace for p.pp uses derived DISCH and GEN at the interface [Tue19]; replaying that trace in the frozen core must additionally expand the connective definitions and record all type and term instantiations.

Theorem 65.4 — LCF confinement

Suppose the host language enforces abstraction of thm, and every exported kernel constructor implements one sound inference rule. Every theorem returned by any composition of tactics is semantically valid.

Proof of Theorem 65.4 — LCF confinement

Proof. By representation independence, a tactic can obtain a theorem value only as an input or as the result of an exported constructor. Induction on the finite constructor trace reduces validity to theorem 65.2. ◻

The premise is operational, not ornamental. Unsafe casts, mutable corruption, or an oracle constructor enlarge the trusted base and require a new soundness argument.

Comparison with proof-relevant type theory

Under Curry–Howard, a judgment p:P exposes a proof term whose type is the proposition. In HOL, P:bool, while a kernel theorem asserting P lives at the implementation level. HOL proof objects may be recorded and replayed, but bool is not definitionally the host type thm, and arbitrary inhabitants of a HOL type are not proofs.

Jacobs and Melham encode dependent types in HOL by predicates. A dependent type over A becomes a predicate on an underlying HOL type; dependent functions carry closure obligations saying that admissible inputs are sent to admissible outputs. Their Theorem 4.8 gives a translation of derivable judgments of the selected dependent type theory into HOL [JM93]. The paper also says that a full formal metatheoretic treatment is future work. We therefore use its stated derivability translation as a comparison, not as a claim that HOL and dependent type theory are definitionally equivalent or that every HOL axiom has computational proof content.

Exercise 65.4

★★☆ Encode the family Vec(A,n) as an HOL predicate on lists, and state the closure obligation for a predicate-encoded dependent function that takes v:Vec(A,n) to a list of length n+1. Explain why the result is a theorem about membership, not a dependent HOL typing judgment. (Half a page.)

Seminar and practical

Suggested first pass.

Begin with exercise 65.5; then replay exercise 65.7.

Exercise 65.5

★★☆ For each of β, η, choice, infinity, functional extensionality, and propositional extensionality, classify it as syntax, rule, axiom, derived theorem, or semantic construction. Defend every answer with one exact rule or model clause. (One page.)

Exercise 65.6

★★☆ An implementation adds oracle:stringthm. Draw the new trust boundary. State the weakest specification of oracle that makes theorem 65.4 true again. (Ten lines and one diagram.)

Exercise 65.7

★★★ Practical project.hol-kernel-trace-checker The companion artifact hol-kernel-trace-checker represents formulas by a small equality fragment and theorem values by replayable kernel traces. Add the missing side-condition check for ABS; then extend the valid equality-symmetry trace and one mutation that illegally abstracts over a free assumption. Record the Kappa commands and explain why rejection is a kernel property rather than a tactic property. (One page plus code.)

Sources and theorem boundary

The kernel presentation and set-model picture are drawn from Gordon’s report, the HOL4 course packet, and the formal semantics of Kumar et al. [Gor85, Tue19, KAMO14]. The course’s slides 29–36 display the kernel and definition boundary; Kumar et al.’s Theorems 2–3 state soundness and consistency. The abstract theorem type and validation architecture originate in LCF [Mil79]. The predicate encoding is bounded by Jacobs and Melham’s stated translation theorem [JM93]. No claim here transfers normalization, proof relevance, or computational canonicity from a dependent type theory into classical HOL.

Search the book

Type to search the local edition.