Abstract Interpretation

Abstract interpretation computes sound approximations to program behavior. A widening makes the analysis terminate even when exact iteration keeps producing new bounds.

Source
Anbloq
Language
English
Created
Updated
Chapters
3
Reading time
2 min
In this article3 chapters
  1. Soundness as an order relation
  2. Why plain iteration may fail to terminate
  3. Relational constraints survive some joins

Soundness as an order relation

Take concrete states to be sets and abstract states to be elements of an ordered domain. A concretization \(\gamma(a)\) gives every state represented by an abstract value. When abstraction and concretization form a Galois connection, they obey

\[ \alpha(S)\sqsubseteq a \quad\Longleftrightarrow\quad S\subseteq\gamma(a). \]

An abstract transfer function is sound if applying it and concretizing covers every concrete transition from the old concretization. At a loop head, a post-fixpoint of the abstract transfer joined with the entry states represents an invariant. Induction on the number of loop iterations proves that every reachable state lies in it.

The choice of order and join determines what a merge may forget. Widening changes how a fixpoint search progresses when that order has infinite ascending chains.

Why plain iteration may fail to terminate

Start at zero and repeatedly increment an integer variable without a guard. In the interval domain the upper bound walks through zero, one, two and so on. An interval widening can replace a growing upper endpoint by infinity at once. The result loses precision but is stable under another increment. For loops with guards or tests, a later narrowing can recover useful bounds if supported by sound transfers. Convergence of the abstract iteration is separate from termination of the analyzed program.

Relational constraints survive some joins

If two variables start equal and are incremented together, a convex polyhedral domain can keep the relation \(x=y\) even when both individual ranges become unbounded. Intervals would retain only separate bounds. Polyhedral joins can use a convex hull, which may include states absent from either branch. That precision loss is intentional and needs to be considered when interpreting results. The same distinction between a sound overapproximation and a real violation matters for eBPF verification, verification conditions, and autonomous-system reachability.[1][2]

References

  1. Patrick Cousot and Radhia Cousot, Abstract Interpretation ↩
  2. Patrick Cousot and Nicolas Halbwachs, Automatic Discovery of Linear Restraints Among Variables of a Program ↩