If I had to describe formal verification in a single word, it would be proof.

It took me a while to realize that’s what the field is all about: the search for a proof, and the process of checking one is correct. But this simple answer immediately raises two important questions:

  1. What exactly is a proof?
  2. Why do we need a proof?

What is a proof?

Readers with some math backgrounds are likely already familiar with the term proof, as it appears ubiquitously in textbooks, homework, and exams. Over centuries of development, the mathematical community has formed a globally understood vocabulary and style for what constitutes a valid proof.

This is why, despite language barriers, a mathematician in any country can read, understand, and “verify” the same proof. However, this proof could be very different from the proof that formal verification community cares about. I now make the distinction that the former is informal and the latter is formal.

Informal proof are written in natural languages such as English. The key characteristic of any natural language is ambiguity; a single sentence such as "I saw a man on a hill with a telescope” can have multiple interpretations. Formal language, on the other hand, eliminates this ambiguity through a strict set of rules (syntax) and a precisely defined alphabet. Every well-formed expression has exactly one syntactic structure (parse), leaving no room for the kind of structural ambiguity found in natural language. Common formal languages include first-order logic (FOL) and nearly all programming languages, such as C++ and Python.

But writing in a formal language alone is not sufficient. To constitute a formal proof, one must also follow a proof system — a set of axioms and inference rules that dictate which steps are permitted. The formal language tells you what you can say; the proof system tells you what you can conclude.

I like to picture a proof system as an upside-down tree: the roots at the top are the axioms — statements the system accepts as true without justification, e.g. “a straight line can be drawn between any two points” as in Euclidean geometry. A proof system also specifies inference rules — the permitted ways of deriving new statements from existing ones. The most famous example is probably the syllogism, popularized by Aristotle: if "All men are mortal" and "Socrates is a man," then "Socrates is mortal."

Now, with a finite set of axioms and inference rules, you can grow the tree! Every new statement derived from axioms and inference rules becomes a theorem — a statement considered true because it can be justified by the axioms and rules of the system. These theorems can then serve as roots to derive further theorems, growing the tree ever deeper. This is in fact what is called a proof tree. The subtree above any theorem, tracing all branches back to the axioms, corresponds to its proof.

Proof System Tree.svg

Side note: "Formal" here does not mean "formal" as in wearing a suit. It means pertaining to form — logical structure. A formal proof cares about the shape of the reasoning, not the actual domain of interpretation. For example, this syllogism is perfectly valid: "All cats have two tails; Socrates is a cat; therefore Socrates has two tails." The content is absurd, but the reasoning is structurally correct, i.e. the form is sound. I didn't fully appreciate this distinction until I encountered the Chinese translation of "formal verification": 形式化验证 — literally "form-ification verification" — rather than the more intuitive but incorrect 正式验证 (meaning "official verification").

Why do we need a proof?

It's natural to wonder why we should care about any of this. The elaborate definitions above seem very far from everyday life. But proofs are more relevant than you might think — and there's a simple philosophical motivation for needing them.

Proof is evidence; it's justification for your statements. Imagine you make a claim, but nobody believes you. What would they say? Prove it.

image.png

A statement (or proposition) describes some claim about reality, and the definitive way to establish that claim is to provide a corresponding proof. For most occasions, informal proofs suffice. Even within the mathematics community, informal proofs have been the standard for thousands of years. So perhaps a more sophisticated question to ask is: why do we care about formal proof?

There are two primary reasons: