Lecture. Building up HOL [isa-0002]
- November 25, 2025
- Liam O'Connor
Isabelle and HOL [isa-0003]
- November 25, 2025
- Liam O'Connor
These lectures introduce theorem proving using the proof assistant Isabelle. Isabelle supports many logics, but by far the most popular is Higher Order Logic, the focus of these notes. Isabelle comes pre-packaged with its HOL libraries, as well as a proof editor (based on jEdit) and various other tools.
The proof developments shown in these notes are all developed with Isabelle 2024, but Isabelle 2025 (the latest version at time of writing) is largely backwards compatible with it. I have not upgraded due to some proof automation regressions in Isabelle 2025 that do not affect the content of these notes.
Installing Isabelle [isa-0013]
- November 30, 2025
- Liam O'Connor
Definining Theories [isa-0016]
- December 2, 2025
- Liam O'Connor
An Isabelle file is called a theory, and they consist of mathematical definitions (of types and terms), lemmas and proofs. Isabelle theories start with a theory name and a declaration of all the theories on which it depends. The theory name must match the file name, so the code from this lecture should be saved into a file called HOLFromScratch.thy.
We imported the theory Pure, which contains only the very basic built-in structures that define Isabelle's logic.
HHFs and Isabelle/Pure [isa-0017]
- December 2, 2025
- Liam O'Connor
Isabelle's logical framework consists of terms (t), types (\tau ) and formulae (\varphi ). Each term t must have a type \tau , written t :: \tau .
In the below code, we define a new type called bool, and we declare that terms of type bool can be used as judgments in our formulae. The details of the judgment command are not important for now.
Formulae in Isabelle are hereditary Harrop formulae, defined as:
\begin {array}{lclll} \varphi & ::= & \bigwedge x.\ \varphi & & \textit {(meta-forall)} \\ & \mid & \varphi \implies \varphi & & \textit {(meta-implication)}\\ & \mid & t & \text {where}\ t\ \text {:: \texttt {bool}} & \textit {(judgments)} \end {array}In Isabelle's syntax, formulae, terms, and types are typically surrounded by quote marks "" or cartouches ‹› — the two are equivalent.
ExampleIsabelle's Syntax for HHFs [isa-0018]
- December 2, 2025
- Liam O'Connor
Consider the following rule: \dfrac {A \quad B}{A \land B}{\text {\small conjI}} This is encoded as an Isabelle formula as follows: \bigwedge A. \left (\bigwedge B. (A \implies (B \implies (A \land B)))\right )
Because \implies is right-associative, we can remove some parentheses:
\bigwedge A. \left (\bigwedge B. (A \implies B \implies A \land B)\right )We can also combine the meta-quantifiers:
\bigwedge A\ B.\;\; A \implies B \implies A \land BIsabelle includes special syntax \llbracket A_0; A_1, \dots , A_n \rrbracket \implies C which is equivalent to A_0 \implies A_1 \implies \dots \implies A_n \implies C.
\bigwedge A\ B.\;\; \llbracket A; B\rrbracket \implies A \land BIsabelle will also automatically add quantifiers to unknown variables, so we can drop the meta-quantifiers from the outermost part of the formula:
\llbracket A; B\rrbracket \implies A \land BDefinitionConjunction [isa-0005]
- November 25, 2025
- Liam O'Connor
Isabelle axiomatizations [isa-0019]
- December 2, 2025
- Liam O'Connor
Isabelle's basic mechanism to define new things is the axiomatization command.
This defines the constants (with their types) in the constants section, and assumes the formulae stated in the axioms section.
Problem.
- December 2, 2025
- Liam O'Connor
Isabelle does nothing to stop you from assuming false theorems as axioms in axiomatization commands, which can easily render the logic unsound. We shall later see safer ways to define new constants, which should be preferred over axiomatization in most cases.
Isabelle Terms [isa-001C]
- December 2, 2025
- Liam O'Connor
Terms in Isabelle are essentially terms of the (polymorphic) typed lambda calculus. When we declare a constant like:
We are introducing a new constant called conj that has type bool ⇒ bool ⇒ bool — that is, a function that takes two values of type bool and produces another bool. The infixr annotation on the right hand side lets us use familiar notation A ∧ B instead of writing conj A B, but the meaning of A ∧ B is identical to conj A B.
AsideCurrying
- December 2, 2025
- Liam O'Connor
Functions of multiple parameters in Isabelle are typically curried, meaning that a function of type bool ⇒ bool ⇒ bool is actually a function of type bool ⇒ (bool ⇒ bool) — a function that, given a bool value, produces a function of type bool ⇒ bool.
Proof Methodrule [isa-000Z]
- November 28, 2025
- Liam O'Connor
Given a goal \llbracket A_1 \dots A_n \rrbracket \implies G and a theorem r: \llbracket P_1 \dots P_n \rrbracket \implies G (commonly an introduction rule),
apply (rule r) replaces the goal with subgoals:
- \llbracket A_1 \dots A_n \rrbracket \implies P_1
- \dots
- \llbracket A_1 \dots A_n \rrbracket \implies P_n
Aside.
- November 28, 2025
- Liam O'Connor
Technically, the conclusion of the rule and the goal do not have to be exactly equal, but they must be unifiable – that is, there must be some substitution to schematic variables that makes the conclusion of the rule and the goal equal.
Proof Methodfrule and drule [isa-0010]
- November 28, 2025
- Liam O'Connor
Given a goal \llbracket X; A_1 \dots A_n \rrbracket \implies G and a theorem r: \llbracket X; P_1 \dots P_n \rrbracket \implies Y,
apply (frule r) replaces the goal with subgoals:
- \llbracket X; A_1 \dots A_n \rrbracket \implies P_1
- \dots
- \llbracket X; A_1 \dots A_n \rrbracket \implies P_n
- \llbracket X; Y; A_1 \dots A_n \rrbracket \implies G
The method drule is the same as frule except that it also deletes the assumption X from the last subgoal.
TheoremConjunction Elimination [isa-000C]
- November 25, 2025
- Liam O'Connor
Solution.
- November 25, 2025
- Liam O'Connor
DefinitionImplication [isa-0006]
- November 25, 2025
- Liam O'Connor
TheoremImplication Elimination [isa-000D]
- November 25, 2025
- Liam O'Connor
Solution.
- November 25, 2025
- Liam O'Connor
Proof Methoderule [isa-0011]
- November 28, 2025
- Liam O'Connor
Given a goal \llbracket X; A_1 \dots A_n \rrbracket \implies G and a theorem r: \llbracket X; P_1 \dots P_n \rrbracket \implies G (typically an elimination rule where the conclusion is just a variable, easily unified with G),
apply (erule r) replaces the goal with subgoals:
- \llbracket A_1 \dots A_n \rrbracket \implies P_1
- \dots
- \llbracket A_1 \dots A_n \rrbracket \implies P_n
Example [isa-0009]
- November 25, 2025
- Liam O'Connor
Solution.
- November 25, 2025
- Liam O'Connor
DefinitionFalse and True [isa-0007]
- November 25, 2025
- Liam O'Connor
DefinitionNegation [isa-0008]
- November 25, 2025
- Liam O'Connor
Example [isa-000A]
- November 25, 2025
- Liam O'Connor
Solution.
- November 25, 2025
- Liam O'Connor
DefinitionDisjunction [isa-0004]
- November 25, 2025
- Liam O'Connor
Example [isa-000M]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000B]
- November 25, 2025
- Liam O'Connor
Solution.
- November 25, 2025
- Liam O'Connor
DefinitionClassical Axiom [isa-000E]
- November 27, 2025
- Liam O'Connor
TheoremProof by Contradiction [isa-000F]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Example [isa-000G]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Example [isa-000H]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000I]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000J]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000K]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000L]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
DefinitionUniversal Quantifiers [isa-000N]
- November 25, 2025
- Liam O'Connor
Proof Methodrule_tac, erule_tac, drule_tac, frule_tac [isa-001A]
- November 28, 2025
- Liam O'Connor
The typical rule, erule, drule, frule methods rely entirely on unification to determine how to instantiate the variables in the provided rule. Sometimes, it is useful to state explicitly how to instantiate some variables in the rule, particularly when dealing with quantifiers, or when there are multiple possible candidates.
TheoremUniversal Quantifier Elimination [isa-000P]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
DefinitionExistential Quantifiers [isa-000O]
- November 25, 2025
- Liam O'Connor
Example [isa-000Q]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Example [isa-000R]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Example [isa-000S]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000T]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000U]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000V]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000W]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000X]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor
Exercise [isa-000Y]
- November 27, 2025
- Liam O'Connor
Solution.
- November 27, 2025
- Liam O'Connor