Relating Complexity and Precision
in Control Flow Analysis.

David Van Horn and Harry G. Mairson.

In *Proceedings of the Twelth ACM SIGPLAN International
Conference on Functional Programming (ICFP'07)*, Freiburg,
Germany, October, 2007.

[ PDF ]

We analyze the computational complexity of kCFA, a hierarchy of control flow analyses that determine which functions may be applied at a given call-site. This hierarchy specifies related decision problems, quite apart from any algorithms that may implement their solutions. We identify a simple decision problem answered by this analysis and prove that in the 0CFA case, the problem is complete for polynomial time. The proof is based on a nonstandard, symmetric implementation of Boolean logic within multiplicative linear logic (MLL). We also identify a simpler version of 0CFA related to eta-expansion, and prove that it is complete for LOGSPACE, using arguments based on computing paths and permutations.

For any fixed k>0, it is known that kCFA (and the analogous decision problem) can be computed in time exponential in the program size. For k=1, we show that the decision problem is NP-hard, and sketch why this remains true for larger fixed values of k. The proof technique depends on using the approximation of CFA as an essentially nondeterministic computing mechanism, as distinct from the exactness of normalization. When k=n, so that the ``depth'' of the control flow analysis grows linearly in the program length, we show that the decision problem is complete for EXPTIME.

In addition, we sketch how the analysis presented here may be extended naturally to languages with control operators. All of the insights presented give clear examples of how straightforward observations about linearity, and linear logic, may in turn be used to give a greater understanding of functional programming and program analysis.

@INPROCEEDINGS{vanhorn-mairson-icfp07, AUTHOR = {David {Van Horn} and Harry G. Mairson}, TITLE = {Relating complexity and precision in control flow analysis}, BOOKTITLE = {ICFP '07: Proceedings of the 2007 ACM SIGPLAN International Conference on Functional Programming}, YEAR = {2007}, ISBN = {978-1-59593-815-2}, PAGES = {85--96}, LOCATION = {Freiburg, Germany}, DOI = {http://doi.acm.org/10.1145/1291151.1291166}, PUBLISHER = {ACM}, ADDRESS = {New York, NY, USA}, PDF = {http://www.cs.brandeis.edu/~dvanhorn/pubs/vanhorn-mairson-icfp07.pdf} }