This chapter explains how to reason about every possible run of a program without executing them all, and what such reasoning can and cannot prove. It first separates static analysis §3.1, which examines the code, from dynamic analysis §3.2, which observes runs, and uses as a working example the eBPF verifier §3.3, which checks a small program written for eBPF §2.1, an instruction set for programs that a kernel loads while it is running, before the program is accepted. The central idea is abstract interpretation §3.4: the analyzer replaces the exact set of states that a program can reach by a simpler description drawn from an abstract domain §3.6, such as a range of numbers or a word whose bits are only partly known, and computes with those descriptions. Soundness §3.7 and completeness name the two ways in which such an approximation can be right or wrong, and path and context sensitivity §3.12 describe how much detail it keeps.
The middle of the chapter covers the standard machinery: control-flow graphs §3.13 and basic blocks §3.14; data-flow analyses such as reaching definitions §3.16 and def-use chains §3.17; alias, taint, reachability §3.21 and slicing analyses; and the fixed points §3.22, widening and narrowing §3.23, and loop invariants §3.24 that let an analysis finish on programs with loops. The last part turns to stronger methods and their limits: ranking functions §3.25 for proving termination, symbolic execution §3.27, SMT (satisfiability modulo theories) solvers, bounded and unbounded model checking §3.30 with their state explosion §3.26, Hoare triples §3.31 and refinement, and the comparison of two implementations of one semantics. It also explains what a verifier must do with behavior it cannot model, keeping undefined behavior §4.12 apart from unsupported behavior and refusing when in doubt. It ends with compilers: intermediate representations §3.37, static single assignment §3.38 form, optimization, and what it means for a compiler, or for one run of it, to be correct.