skip to main content
10.1145/1291151.1291166acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Relating complexity and precision in control flow analysis

Published:01 October 2007Publication History

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.

References

  1. Andrea Asperti and Cosimo Laneve. Paths, computations and labels in the lambda-calculus. Theor. Comput. Sci., 142(2): 277--297, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle Scholar
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarCross RefCross Ref
  9. 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 ScholarGoogle Scholar
  10. Jean-Yves Girard, Paul Taylor, and Yves Lafont. Proofs and types. Cambridge University Press, New York, NY, USA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. Richard E. Ladner. The circuit value problem is log space complete for P. SIGACT News, 7(1): 18--20, 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. Jean-Jacques Lévy. Réductions correctes et optimales dans le lambda-calcul. PhD thesis, Paris 7, January 1978. thése d'Etat.Google ScholarGoogle Scholar
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. Harry G. Mairson. Linear lambda calculus and PTIME-completeness. Journal of Functional Programming, 14(6): 623--633, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. Harry G. Mairson. Axiom-sensitive normalization bounds for multiplicative linear logic, 2006. Unpublished manuscript.Google ScholarGoogle Scholar
  27. Harry G. Mairson. A simple proof of a theorem of Statman. Theoretical Computer Science, 103(2): 387--394, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle Scholar
  29. Christian Mossin. Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, University of Copenhagen, January (revised August) 1997.Google ScholarGoogle Scholar
  30. Christian Mossin. Exact flow analysis. In SAS '97: Proceedings of the 4th International Symposium on Static Analysis, pages 250--264. Springer-Verlag, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. Flemming Nielson, Hanne R. Nielson, and Chris Hankin. Principles of Program Analysis. Springer-Verlag New York, Inc., Secaucus, NJ, USA, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Jens Palsberg. Closure analysis in constraint form. ACM Trans. Program. Lang. Syst., 17(1): 47--62, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Jens Palsberg and Patrick O'Keefe. A type system equivalent to flow analysis. ACM Trans. Program. Lang. Syst., 17(4): 576--599, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. Thomas Reps. Undecidability of context-sensitive data-independence analysis. ACM Trans. Program. Lang. Syst., 22(1): 162--186, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  40. Peter Sestoft. Replacing function parameters by global variables. Master's thesis, DIKU, University of Copenhagen, Denmark, Oct 1988. Master's thesis no. 254.Google ScholarGoogle Scholar
  41. Olin Shivers. Control-flow analysis of higher-order languages of taming lambda. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, USA, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Olin Shivers. Higher-order control-flow analysis in retrospect: lessons learned, lessons abandoned. SIGPLAN Not., 39(4): 257--269, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Richard Statman. The typed λ-calculus is not elementary recursive. Theor. Comput. Sci., 9: 73--81, 1979.Google ScholarGoogle ScholarCross RefCross Ref
  44. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  45. Kazushige Terui. On the complexity of cut-elimination in linear logic, July 2002. Invited talk at LL2002 (LICS2002 affiliated workshop),. Copenhagen.Google ScholarGoogle Scholar
  46. Andrew K. Wright and Suresh Jagannathan. Polymorphic splitting: an effective polyvariant flow analysis. ACM Trans. Program. Lang. Syst., 20(1): 166--207, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Relating complexity and precision in control flow analysis

                Recommendations

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in
                • Published in

                  cover image ACM Conferences
                  ICFP '07: Proceedings of the 12th ACM SIGPLAN international conference on Functional programming
                  October 2007
                  346 pages
                  ISBN:9781595938152
                  DOI:10.1145/1291151
                  • cover image ACM SIGPLAN Notices
                    ACM SIGPLAN Notices  Volume 42, Issue 9
                    Proceedings of the ICFP '07 conference
                    September 2007
                    331 pages
                    ISSN:0362-1340
                    EISSN:1558-1160
                    DOI:10.1145/1291220
                    Issue’s Table of Contents

                  Copyright © 2007 ACM

                  Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 October 2007

                  Permissions

                  Request permissions about this article.

                  Request Permissions

                  Check for updates

                  Qualifiers

                  • Article

                  Acceptance Rates

                  Overall Acceptance Rate333of1,064submissions,31%

                  Upcoming Conference

                  ICFP '24

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader