Back to Program Verification Index | Previous: (y-03) First-Order Logic | Next: (y-05) SMT-LIB
Mental Model for First-Order Theories
- Pure FOL is too broad. It doesn’t know that or that unless we tell it.
- A Theory () constrains the meaning of symbols (like ) using a specific Signature and a set of Axioms.
- Instead of checking if a formula is “valid in all models,” we check if it is -valid (valid in all models that obey the theory’s rules).
- This is how we bridge the gap between abstract logic and actual program variables (integers, arrays, bits).
What is a First-Order Theory?
A Theory () constrains the meaning of symbols (like ) using a specific Signature and a set of Axioms. This allows us to bridge the gap between abstract logic and actual program variables.
Formal Definition

A first-order theory consists of:
- Signature (): A set of constant, function, and predicate symbols.
- Axioms (): A set of closed -formulas.
-Models and -Validity

- -Model: A model is a -model if it satisfies all axioms in .
- -Satisfiable: A formula is -satisfiable if there exists a -model such that .
- -Valid: A formula is -valid (denoted ) if every -model satisfies .
- -Equivalent: and are -equivalent if is -valid.
Example: Rock-Paper-Scissors Theory ()

To define the game Rock-Paper-Scissors, we need a specific theory.
- Signature:
- Axioms:
- (Domain is restricted to these three)
🧠 Deep Dive: Reasoning in
Is the formula (no move wins against all others) -valid?
- Yes. Because move would have to beat , and . But axioms 4, 6, and 8 state that no move beats itself. Is the formula (every move has something it beats) -valid?
- Yes. beats , beats , and beats .
Theory of Equality ()

is the foundation of most SMT reasoning. Its signature includes and all other constant/function/predicate symbols.
Axioms
- Reflexivity:
- Symmetry:
- Transitivity:
- Function Congruence: For each -ary ,
- Predicate Congruence: For each -ary ,
🧠 Deep Dive: Axiom Schemata

Axioms like Function Congruence are actually Axiom Schemata. Since a signature can have infinitely many functions, we cannot list every axiom. Instead, we provide a “template.” For a binary function , the schema generates:
Arithmetic Theories
1. Peano Arithmetic ()

Theory of Natural Numbers () with addition and multiplication.
- Signature:
- Axioms: Successor rules, Plus/Times rules, and the Induction Schema:
🧠 Deep Dive: Expressiveness of
can express almost all of mathematics. Even exponentiation , which is not in the signature, can be encoded using a complex formula .
- Gödel showed that for every recursive function , there is a formula such that .
- This high expressiveness comes at a price: is undecidable.
2. Presburger Arithmetic ()

Natural numbers with addition only (no multiplication).
- Signature:
- Decidability: is decidable. It is the most common theory for loop bounds and simple offsets.
3. Theory of Integers ()

Integers () with .
🧠 Deep Dive: Transforming to
To decide -validity for a formula , we transform its negation into an equisatisfiable formula:
- Replace every integer variable with (where are natural numbers).
- Eliminate subtraction by moving terms to the other side of or .
- Replace with . If the resulting formula is unsatisfiable, then is -valid.
Theory of Arrays ()

Used to model computer memory and data structures. Unlike functions in FOL, arrays are “first-class objects” that can be modified.
- Signature:
- Axioms:
- Reflexivity, Symmetry, Transitivity of .
- Array Congruence:
- Read-over-Write 1:
- Read-over-Write 2:
- Extensionality:
- Intuition: Two arrays are equal if and only if they have the same values at every index.
💡 Application: Modeling Memory
In a verifier, a pointer *ptr is modeled as select(mem, ptr), and an assignment *ptr = v becomes mem' = store(mem, ptr, v).
Summary of Decidability

| Logic / Theory | Satisfiability | Validity |
|---|---|---|
| Propositional Logic (PL) | Decidable | Decidable |
| First-Order Logic (FOL) | Undecidable | Semi-decidable |
| Theory of Equality () | Undecidable (Decidable for QF) | Undecidable |
| Presburger Arithmetic () | Decidable | Decidable |
| Peano Arithmetic () | Undecidable | Undecidable |
In program verification, we usually care about -Satisfiability. If a “bad state” (like an assertion failure) is -satisfiable, it means there is a real execution that leads to a bug.
Summary
- Theories give specific meaning to symbols (e.g., how or `read` behave).
- (Equality) provides the foundation for all reasoning.
- Arithmetic theories range from easy (Presburger) to impossible (Peano).
- Array theory allows us to model computer memory.
- Verification tools combine these theories to reason about complex code.
Self-Check
- What two components define a first-order theory , and what does -validity mean?
Answer
A theory is a pair : a signature of constant, function, and predicate symbols and a set of closed axioms over that signature. A formula is -valid if every -model (every model that satisfies all axioms in ) also satisfies .
- What are the five axioms of the theory of equality ?
Answer
Reflexivity (), symmetry, transitivity, function congruence (equal arguments yield equal results for every ), and predicate congruence (equal arguments yield equivalent atoms for every ). Function and predicate congruence are axiom schemata because the signature can contain infinitely many symbols.
- Why is Presburger arithmetic decidable while Peano arithmetic is not?
Answer
has only addition over the naturals; the resulting structure has elimination procedures (quantifier elimination via Cooper’s algorithm) that decide both satisfiability and validity. adds multiplication, which is enough to encode any recursive function (Gödel), so it can express the halting problem and becomes undecidable. The difference is multiplication.
- State the two read-over-write axioms of and what they say in plain English.
Answer
says reading at the index you just wrote returns the written value. says reading at a different index returns the original array’s value. Together with extensionality they capture how arrays behave.
- Why does verification usually care about -satisfiability of “bad states” rather than validity?
Answer
If the formula expressing “some execution reaches a bad state” is -satisfiable, there is an actual execution (a -model) that exhibits the bug; the satisfying model is the counterexample. Verification is therefore typically framed as showing that the negation (no bad execution exists) is -valid, equivalently the bad-state formula is -unsatisfiable.
Back to Program Verification Index | Previous: (y-03) First-Order Logic | Next: (y-05) SMT-LIB | (y) Return to Notes | (y) Return to Home