ABSTRACT
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 η-expansion, and prove that it is complete for logarithmic space, 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 exponential time.
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.
- Andrea Asperti and Cosimo Laneve. Paths, computations and labels in the lambda-calculus. Theor. Comput. Sci., 142(2): 277--297, 1995. Google ScholarDigital Library
- Andrea Asperti and Harry G. Mairson. Parallel beta reduction is not elementary recursive. In POPL '98: Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 303--315. ACM Press, 1998. Google ScholarDigital Library
- Anindya Banerjee. A modular, polyvariant and type-based closure analysis. In ICFP '97: Proceedings of the second ACM SIGPLAN international conference on Functional programming, pages 1--10. ACM Press, 1997. Google ScholarDigital Library
- Anindya Banerjee and Thomas Jensen. Modular control-flow analysis with rank 2 intersection types. Mathematical Structures in Comp. Sci., 13(1): 87--124, 2003. Google ScholarDigital Library
- Olivier Danvy and Andrzej Filinski. Abstracting control. In LFP '90: Proceedings of the 1990 ACM conference on LISP and functional programming, pages 151-160. ACM Press, 1990. Google ScholarDigital Library
- Karl-Filip Faxén. Polyvariance, polymorphism and flow analysis. In Selected papers from the 5th LOMAPS Workshop on Analysis and Verification of Multiple-Agent Languages, pages 260--278. Springer-Verlag, 1997. Google Scholar
- Karl-Filip Faxén. Optimizing lazy functional programs using flow inference. In SAS '95: Proceedings of the Second International Symposium on Static Analysis, pages 136--153. Springer-Verlag, 1995. Google ScholarDigital Library
- Andrzej Filinski. Declarative continuations: an investigation of duality in programming language semantics. In Category Theory and Computer Science, pages 224--249. Springer-Verlag, 1989. Google ScholarCross Ref
- Jean-Yves Girard. Geometry of interaction I: Interpretation of System F. In C. Bonotto, editor, Logic Colloquium '88, pages 221--260. North Holland, 1989.Google Scholar
- Jean-Yves Girard, Paul Taylor, and Yves Lafont. Proofs and types. Cambridge University Press, New York, NY, USA, 1989. Google ScholarDigital Library
- Timothy G. Griffin. A formulae-as-type notion of control. In POPL '90: Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 47--58. ACM Press, 1990. Google ScholarDigital Library
- Nevin Heintze. Set-based analysis of ML programs. In LFP '94: Proceedings of the 1994 ACM conference on LISP and functional programming, pages 306--317. ACM Press, 1994. Google ScholarDigital Library
- Nevin Heintze. Control-flow analysis and type systems. In SAS '95: Proceedings of the Second International Symposium on Static Analysis, pages 189--206. Springer-Verlag, 1995. Google ScholarDigital Library
- Nevin Heintze and David McAllester. On the cubic bottleneck in subtyping and flow analysis. In LICS '97: Proceedings of the 12th Annual IEEE Symposium on Logic in Computer Science, page 342. IEEE Computer Society, 1997. Google ScholarDigital Library
- Nevin Heintze and David McAllester. Linear-time subtransitive control flow analysis. In PLDI '97: Proceedings of the ACM SIGPLAN 1997 conference on Programming language design and implementation, pages 261--272. ACM Press, 1997. Google ScholarDigital Library
- Fritz Henglein and Harry G. Mairson. The complexity of type inference for higher-order lambda calculi. In POPL '91: Proceedings of the 18th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 119--130. ACM Press, 1991. Google ScholarDigital Library
- Neil D. Jones. Flow analysis of lambda expressions (preliminary version). In Proceedings of the 8th Colloquium on Automata, Languages and Programming, pages 114--128. Springer-Verlag, 1981. Google ScholarDigital Library
- Richard E. Ladner. The circuit value problem is log space complete for P. SIGACT News, 7(1): 18--20, 1975. Google ScholarDigital Library
- Yves Lafont. From proof-nets to interaction nets. In Proceedings of the workshop on Advances in linear logic, pages 225--247. Cambridge University Press, 1995. Google ScholarDigital Library
- Julia L. Lawall and Harry G. Mairson. Sharing continuations: Proofnets for languages with explicit control. In ESOP '00: Proceedings of the 9th European Symposium on Programming Languages and Systems, pages 245--259. Springer-Verlag, 2000. Google ScholarDigital Library
- Jean-Jacques Lévy. Réductions correctes et optimales dans le lambda-calcul. PhD thesis, Paris 7, January 1978. thése d'Etat.Google Scholar
- Harry G. Mairson. From Hilbert spaces to Dilbert spaces: Context semantics made simple. In FST TCS '02: Proceedings of the 22nd Conference Kanpur on Foundations of Software Technology and Theoretical Computer Science, pages 2--17. Springer-Verlag, 2002. Google ScholarDigital Library
- Harry G. Mairson. From Hilbert space to Dilbert space: context semantics as a language for games and flow analysis. In ICFP '03: Proceedings of the eighth ACM SIGPLAN international conference on Functional programming, pages 125--125. ACM Press, 2003. Google ScholarDigital Library
- Harry G. Mairson. Linear lambda calculus and PTIME-completeness. Journal of Functional Programming, 14(6): 623--633, 2004. Google ScholarDigital Library
- Harry G. Mairson. Deciding ML typability is complete for deterministic exponential time. In POPL '90: Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 382--401. ACM Press, 1990. Google ScholarDigital Library
- Harry G. Mairson. Axiom-sensitive normalization bounds for multiplicative linear logic, 2006. Unpublished manuscript.Google Scholar
- Harry G. Mairson. A simple proof of a theorem of Statman. Theoretical Computer Science, 103(2): 387--394, 1992. Google ScholarDigital Library
- Harry G. Mairson and Kazushige Terui. On the computational complexity of cut-elimination in linear logic. In Carlo Blundo and Cosimo Laneve, editors, ICTCS, volume 2841 of Lecture Notes in Computer Science, pages 23--36. Springer, 2003.Google Scholar
- Christian Mossin. Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, University of Copenhagen, January (revised August) 1997.Google Scholar
- Christian Mossin. Exact flow analysis. In SAS '97: Proceedings of the 4th International Symposium on Static Analysis, pages 250--264. Springer-Verlag, 1997. Google ScholarDigital Library
- Peter Møller Neergaard and Harry G. Mairson. Types, potency, and idempotency: why nonlinearity and amnesia make a type system work. In ICFP '04: Proceedings of the ninth ACM SIGPLAN international conference on Functional programming, pages 138--149. ACM Press, 2004. Google ScholarDigital Library
- Flemming Nielson and Hanne Riis Nielson. Infinitary control flow analysis: a collecting semantics for closure analysis. In POPL '97: Proceedings of the 24th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 332--345. ACM Press, 1997. Google ScholarDigital Library
- Flemming Nielson, Hanne R. Nielson, and Chris Hankin. Principles of Program Analysis. Springer-Verlag New York, Inc., Secaucus, NJ, USA, 1999. Google ScholarDigital Library
- Jens Palsberg. Closure analysis in constraint form. ACM Trans. Program. Lang. Syst., 17(1): 47--62, 1995. Google ScholarDigital Library
- Jens Palsberg and Patrick O'Keefe. A type system equivalent to flow analysis. ACM Trans. Program. Lang. Syst., 17(4): 576--599, 1995. Google ScholarDigital Library
- Jens Palsberg and Christina Pavlopoulou. From polyvariant flow information to intersection and union types. In POPL '98: Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 197--208. ACM Press, 1998. Google ScholarDigital Library
- Michel Parigot. Lambda-mu-calculus: An algorithmic interpretation of classical natural deduction. In Andrei Voronkov, editor, LPAR, volume 624 of Lecture Notes in Computer Science, pages 190--201. Springer, 1992. Google ScholarDigital Library
- Thomas Reps. Undecidability of context-sensitive data-independence analysis. ACM Trans. Program. Lang. Syst., 22(1): 162--186, 2000. Google ScholarDigital Library
- Peter Sestoft. Replacing function parameters by global variables. In FPCA '89: Proceedings of the fourth international conference on Functional programming languages and computer architecture, pages 39--53. ACM Press, 1989. Google ScholarDigital Library
- Peter Sestoft. Replacing function parameters by global variables. Master's thesis, DIKU, University of Copenhagen, Denmark, Oct 1988. Master's thesis no. 254.Google Scholar
- Olin Shivers. Control-flow analysis of higher-order languages of taming lambda. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, USA, 1991. Google ScholarDigital Library
- Olin Shivers. Higher-order control-flow analysis in retrospect: lessons learned, lessons abandoned. SIGPLAN Not., 39(4): 257--269, 2004. Google ScholarDigital Library
- Richard Statman. The typed λ-calculus is not elementary recursive. Theor. Comput. Sci., 9: 73--81, 1979.Google ScholarCross Ref
- Yan Mei Tang and Pierre Jouvelot. Separate abstract interpretation for control-flow analysis. In TACS '94: Proceedings of the International Conference on Theoretical Aspects of Computer Software, pages 224--243. Springer-Verlag, 1994. Google ScholarDigital Library
- Kazushige Terui. On the complexity of cut-elimination in linear logic, July 2002. Invited talk at LL2002 (LICS2002 affiliated workshop),. Copenhagen.Google Scholar
- Andrew K. Wright and Suresh Jagannathan. Polymorphic splitting: an effective polyvariant flow analysis. ACM Trans. Program. Lang. Syst., 20(1): 166--207, 1998. Google ScholarDigital Library
Index Terms
- Relating complexity and precision in control flow analysis
Recommendations
Relating complexity and precision in control flow analysis
Proceedings of the ICFP '07 conferenceWe 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 ...
The Landscape of Communication Complexity Classes
We prove several results which, together with prior work, provide a nearly-complete picture of the relationships among classical communication complexity classes between $${\mathsf{P}}$$P and $${\mathsf{PSPACE}}$$PSPACE, short of proving lower bounds ...
Pushdown control-flow analysis for free
POPL '16Traditional control-flow analysis (CFA) for higher-order languages introduces spurious connections between callers and callees, and different invocations of a function may pollute each other's return flows. Recently, three distinct approaches have been ...
Comments