Formal Methods with Isabelle

From logic and discrete mathematics to machine-checked proof. Learn the mathematics that formal methods rest on, then prove programs and system models correct in Isabelle/HOL, with every proof checked by Isabelle2026.

14 modulesabout 51 hoursIsabelle2026EN · 中文
Start with Module 1 →

Who this series is for

You can program a little in some language and remember school algebra. You have not studied logic or proof, and you have never used a proof assistant. You may be a student of computer science or software engineering, or an engineer who wants to verify designs rather than only test them. The series assumes nothing else and explains every idea on paper before Isabelle checks it.

What you will be able to do

How it works

Fourteen modules in four parts, about 50 hours in all. Each module has worked examples, exercises at three levels with full solutions, and a short quiz. Every Isabelle output on these pages, including every error message, was produced by Isabelle2026 from the text shown, and every proof, including the exercise solutions, is checked by Isabelle. Start with Module 1, which also installs Isabelle.

Part I · Foundations

Module 12.5 h
Formal methods, what and why
What formal methods can establish about software, how specifications and proofs work together, where Isabelle fits among the other methods, and how to write your first theory in Isabelle/HOL.
Module 23.5 h
Propositional logic
Read and write formulas built with ¬, ∧, ∨, ⟶ and ⟷, decide with truth tables whether they are tautologies, equivalences or valid arguments, put them into normal forms, and use Isabelle to check requirements written as formulas.
Module 34 h
Predicate logic
Say what holds for every object or for some, work out whether a formula is true in a structure, find countermodels, and turn requirements into precise formulas, on paper and in Isabelle.
Module 43.5 h
Sets, relations and functions
Describe collections with sets, connect their elements with relations, find the states a system can reach, compare the sizes of sets with functions, and see why some infinite sets are larger than others, with examples and proofs checked in Isabelle.
Module 54 h
Induction and recursion
Define functions on numbers, lists and trees by recursion and evaluate them step by step; prove general claims by induction, on paper and in Isabelle; and see why Isabelle’s fun requires a termination proof.

Part II · Formal proof

Module 63.7 h
What is a proof? Natural deduction
What turns an argument into a proof, and how to write proofs that a machine can check. You will learn the rules of natural deduction for every connective, both quantifiers and equality, build derivations by hand, and find them by working backwards from the goal, as Isabelle does.
Module 74 h
Natural deduction in Isabelle
Turn the paper proofs of Module 6 into Isabelle proof scripts, rule by rule, read every proof state on the way, and recognise what went wrong when a step fails.

Part III · Isabelle/HOL in practice

Module 83.5 h
Functional programming in HOL
Use Isabelle/HOL as a typed functional programming language. Define your own data types and functions, compute with them, read the types and messages Isabelle prints, see why recursive definitions need termination proofs, and turn executable definitions into Haskell code.
Module 93.5 h
Proof automation
Use Isabelle’s automatic tools with understanding. Steer the simplifier, choose the right method for logic, sets and arithmetic, find lemmas and counterexamples, call Sledgehammer, and know what to do when automation fails.
Module 103.7 h
Structured proofs in Isar
Write proofs that a reader can follow line by line and Isabelle checks step by step. You will state each step of a proof in Isar, pass facts from one step to the next, calculate with chains of equations and inequalities, and split proofs into cases and induction steps.
Module 113.7 h
Induction in depth
Learn what to do when the obvious induction gets stuck. You will read a failed induction from its proof state, generalise or strengthen the claim, find the missing lemma, follow a function’s own recursion, prove facts about predicates defined by rules, and choose the right kind of induction for each goal.

Part IV · Verification

Module 123.8 h
Verifying functional programs
Prove that a program does what its specification says, for every input. You will verify insertion sort, a binary search tree and a queue made of two lists, see why a specification needs each of its parts, and turn the verified functions into Haskell code.
Module 133.8 h
Modelling systems: state machines and invariants
Describe a system as a state machine and prove in Isabelle that nothing bad ever happens in it. You will model states, events, guards and effects, define the reachable states, prove safety properties with invariants, strengthen an invariant that is not inductive, turn a counterexample into a trace, and carry what you proved about an abstract model over to a more concrete one.
Module 144 h
Capstone: a verified compiler
Build a small compiler in Isabelle, from arithmetic expressions to code for a stack machine, test it, and prove that the code it produces is right for every expression. Then verify an optimisation, export the compiler as Haskell code, and extend it with subtraction, conditionals and jumps.

Applied project

Isabelle for model verification builds on Module 13 and Module 14. Use a small lid model to write a guard, prove an invariant and check that a translation preserves meaning. The project includes an interactive guard explorer, eight worked exercises and an Isabelle2025-2 theory download.

Reference and downloads

The cheat sheet collects symbols, commands, proof methods and rules; troubleshooting explains Isabelle’s common messages with their causes and fixes; the glossary defines every term, with its Chinese equivalent. All the Isabelle theories of the series and the checked exercise solutions are in one download, formal-methods-theories.zip.

Going further

Isabelle comes with its own documentation (the Documentation panel in Isabelle/jEdit). Programming and Proving in Isabelle/HOL by Tobias Nipkow is the official tutorial; the book Concrete Semantics by Tobias Nipkow and Gerwin Klein continues it with the semantics of programming languages. The Archive of Formal Proofs holds hundreds of checked Isabelle developments. On this site, Mathematical Foundations gives more practice in the mathematics of Part I.