Back to Program Verification Index | Previous: (y-17) Infeasibility Proofs and CEGAR | Next: (y-19) Constraint-Based Invariant Synthesis
Mental Model for Trace Abstraction
- Code as Language: We can view a program as a Formal Language over an alphabet of statements (e.g., , ).
- Trace: A “word” in this language is a path through the program (a trace).
- Verification via Automata: Proving safety means showing that every “word” that leads to an error is infeasible (no execution can follow it).
- Trace Abstraction: We build an automaton that “covers” (accepts) many infeasible traces. If we can cover all possible error paths, we have a safety proof.
Programs as Automata

- Alphabet (): The set of all primitive statements (assignments, assume, assert) in the program. Each edge in the CFG is labeled with an element from .
- Automaton (): The Control-Flow Graph itself is a finite automaton where locations are states and transitions are edges.
- Error Traces: The set of all “words” (traces) accepted by (those starting from and ending in an error location ).
Floyd-Hoare Automata

A Floyd-Hoare Automaton (FHA) is a way to prove that many traces are infeasible at once.
Definition

An automaton is a Floyd-Hoare automaton if there exists a Floyd-Hoare Annotation mapping each state to a formula such that:
- Inductivity: For every transition , the Hoare triple is valid.
- Initial: For initial states , .
- Safety: For accepting (error) states , .
The Core Theorem

- If a trace is accepted by a Floyd-Hoare automaton, it is infeasible.
- This is because the annotation along the accepting path forms an Infeasibility Proof.
The Trace Abstraction Algorithm

- Step 1: Pick an Error Trace. Find a path in the program’s CFG that leads to an error.
- Step 2: Prove Infeasibility. Show that is infeasible.
- Step 3: Construct a Floyd-Hoare Automaton.
- Build an automaton that accepts .
- Generalize (add extra transitions and states) to accept as many other infeasible traces as possible.
- Step 4: Subtract and Repeat.
- Consider only the remaining error traces: .
- If there are no traces left, the Program is Safe.
- Otherwise, go back to Step 1.
💡 Intuition: The Blanket Analogy

Imagine a field (the set of all possible error traces ).
- Some traces are feasible (real bugs).
- Some are infeasible (safe but hard to analyze).
- Trace Abstraction is like placing “blankets” (Floyd-Hoare Automata) over the field. Each blanket covers a set of infeasible traces.
- The Goal: If you can cover the entire set of potential error traces () with these “blankets” without any of them covering a real bug, you have proven the program safe.
Summary
- Trace Abstraction treats verification as an automata-theoretic problem.
- Alphabet: The program’s statements.
- Floyd-Hoare Automata: Automata that only accept infeasible traces.
- Proof of Safety: A program is safe if all its error traces can be covered by a finite set of Floyd-Hoare automata.
- Ultimate Automizer: This is the core algorithm used in one of the most successful modern verifiers.
Self-Check
- What is the alphabet over which program traces are words in trace abstraction?
Answer
The alphabet is the set of primitive program statements: assignments, havocs, and assumes (including the
assume B/assume !Bproduced by branches and asserts). Each CFG edge is labelled with a letter of , and a trace is a sequence of such letters.
- State the three conditions that make an annotation a Floyd-Hoare annotation for an automaton.
Answer
Initial: for every initial state. Inductivity: for every transition , the Hoare triple is valid. Safety: for every accepting state. Any trace accepted by such an automaton is infeasible.
- Why does the Floyd-Hoare automaton accepting a trace prove that trace infeasible?
Answer
Along an accepting path the annotation forms a sequence . The conditions force , every consecutive pair to be Hoare-valid, and . That is exactly an infeasibility proof for the trace.
- Outline the trace-abstraction algorithm.
Answer
Pick an error trace in the program automaton , prove it infeasible, and build a Floyd-Hoare automaton that accepts and generalizes to other infeasible traces. Then look at the remaining error traces, . If the difference is empty, the program is safe; otherwise pick another remaining trace and repeat.
- Use the blanket analogy to describe what “safety” means in trace abstraction.
Answer
The program automaton’s error language is a field; each Floyd-Hoare automaton is a blanket covering a set of infeasible traces. Safety means the union of all blankets covers the entire error language without any blanket covering a feasible (real bug) trace, so every potential error path is certified infeasible.
Back to Program Verification Index | Previous: (y-17) Infeasibility Proofs and CEGAR | Next: (y-19) Constraint-Based Invariant Synthesis | (y) Return to Notes | (y) Return to Home