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:

  1. Inductivity: For every transition , the Hoare triple is valid.
  2. Initial: For initial states , .
  3. 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

  1. Step 1: Pick an Error Trace. Find a path in the program’s CFG that leads to an error.
  2. Step 2: Prove Infeasibility. Show that is infeasible.
  3. 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.
  4. 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

  1. Trace Abstraction treats verification as an automata-theoretic problem.
  2. Alphabet: The program’s statements.
  3. Floyd-Hoare Automata: Automata that only accept infeasible traces.
  4. Proof of Safety: A program is safe if all its error traces can be covered by a finite set of Floyd-Hoare automata.
  5. Ultimate Automizer: This is the core algorithm used in one of the most successful modern verifiers.

Self-Check

  1. What is the alphabet over which program traces are words in trace abstraction?
  1. State the three conditions that make an annotation a Floyd-Hoare annotation for an automaton.
  1. Why does the Floyd-Hoare automaton accepting a trace prove that trace infeasible?
  1. Outline the trace-abstraction algorithm.
  1. Use the blanket analogy to describe what “safety” means in trace abstraction.

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