Flow Analysis, Linearity, and PTIME
Flow analysis is a ubiquitous and much-studied component of compiler technology—and its variations abound. Amongst the most well known is Shivers’ 0CFA; however, the best known algorithm for 0CFA requires time cubic in the size of the analyzed program and is unlikely to be improved. Consequently, several analyses have been designed to approximate 0CFA by trading precision for faster computation. Henglein’s simple closure analysis, for example, forfeits the notion of directionality in flows and enjoys an “almost linear” time algorithm. But in making trade-offs between precision and complexity, what has been given up and what has been gained? Where do these analyses differ and where do they coincide?
We identify a core language—the linear λ-calculus—where 0CFA, simple closure analysis, and many other known approximations or restrictions to 0CFA are rendered identical. Moreover, for this core language, analysis corresponds with (instrumented) evaluation. Because analysis faithfully captures evaluation, and because the linear λ-calculus is complete for ptime, we derive ptime-completeness results for all of these analyses.
KeywordsFlow Analysis Turing Machine Linear Logic Type Inference Program Point
Unable to display preview. Download preview PDF.
- 1.Jones, N.D.: Flow analysis of lambda expressions (preliminary version). In: Proceedings of the 8th Colloquium on Automata, Languages and Programming, London, UK, pp. 114–128. Springer, Heidelberg (1981)Google Scholar
- 2.Sestoft, P.: Replacing function parameters by global variables. Master’s thesis, DIKU, University of Copenhagen, Denmark, Master’s thesis no. 254 (1988)Google Scholar
- 3.Shivers, O.: Control-Flow Analysis of Higher-Order Languages, or Taming Lambda. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, Technical Report CMU-CS-91-145 (1991)Google Scholar
- 4.Midtgaard, J.: Control-flow analysis of functional programs. Technical Report BRICS RS-07-18, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark (2007)Google Scholar
- 7.Henglein, F.: Simple closure analysis. DIKU Semantics Report D-193 (1992)Google Scholar
- 11.Girard, J.Y.: Linear logic: its syntax and semantics. In: Proceedings of the workshop on Advances in linear logic. Cambridge University Press, Cambridge (1995)Google Scholar
- 13.Mossin, C.: Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, University of Copenhagen (1997)Google Scholar
- 19.Hankin, C., Nagarajan, R., Sampath, P.: Flow analysis: games and nets. In: The essence of computation: complexity, analysis, transformation, pp. 135–156. Springer, New York (2002)Google Scholar
- 23.Shannon, C.E.: A mathematical theory of communication. Bell System Technical Journal 27 (1948)Google Scholar