The Complexity of Flow Analysis in Higher-Order Languages.

David Van Horn.

PhD dissertation, Brandeis University, August 2009.

[ PDF ]

This dissertation proves lower bounds on the inherent difficulty of deciding flow analysis problems in higher-order programming languages. We give exact characterizations of the computational complexity of 0CFA, the

kCFA hierarchy, and related analyses. In each case, we precisely capture both theexpressivenessandfeasibilityof the analysis, identifying the elements responsible for the trade-off.0CFA is complete for polynomial time. This result relies on the insight that when a program is linear (each bound variable occurs exactly once), the analysis makes no approximation; abstract and concrete interpretation coincide, and therefore program analysis becomes evaluation under another guise. Moreover, this is true not only for 0CFA, but for a number of

further approximationsto 0CFA. In each case, we derive polynomial time completeness results.For any

k > 0,kCFA is complete for exponential time. Even whenk = 1, the distinction in binding contexts results in a limited form ofclosures, which do not occur in 0CFA. This theorem validates empirical observations thatkCFA is intractably slow for anyk > 0. There is, in the worst case—and plausibly, in practice—no way to tame the cost of the analysis. Exponential time is required. The empirically observed intractability of this analysis can be understood as beinginherent in the approximation problem being solved, rather than reflecting unfortunate gaps in our programming abilities.