Data-Flow Analyses as Effects and Graded Monads

In static analysis, two frameworks have been studied extensively: monotone data-flow analysis and type-and-effect systems. Whilst both are seen as general analysis frameworks, their relationship has remained unclear. Here we show that monotone data-flow analyses can be encoded as effect systems in a uniform way, via algebras of transfer functions. This helps to answer questions about the most appropriate structure for general effect algebras, especially with regards capturing control-flow precisely. Via the perspective of capturing data-flow analyses, we show the recent suggestion of using effect quantales is not general enough as it excludes non-distributive analyses e.g., constant propagation. By rephrasing the McCarthy transformation, we then model monotone data-flow effects via graded monads. This provides a model of data-flow analyses that can be used to reason about analysis correctness at the semantic level, and to embed data-flow analyses into type systems. 2012 ACM Subject Classification Theory of computation → Type theory

[1]  Patrick Cousot,et al.  Abstract Interpretation Frameworks , 1992, J. Log. Comput..

[2]  Thomas W. Reps,et al.  Precise interprocedural dataflow analysis via graph reachability , 1995, POPL '95.

[3]  Amitabha Sanyal,et al.  Data Flow Analysis - Theory and Practice , 2009 .

[4]  Neil D. Jones,et al.  Program flow analysis - theory and applications , 1981, Prentice Hall software series.

[5]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[6]  Tarmo Uustalu,et al.  Type systems equivalent to data-flow analyses for imperative languages , 2006, Theor. Comput. Sci..

[7]  Ross Tate,et al.  The sequential semantics of producer effect systems , 2013, POPL.

[8]  Shin-ya Katsumata,et al.  Parametric effect monads and semantics of effect systems , 2014, POPL.

[9]  Pierre Jouvelot,et al.  The Type and Effect Discipline , 1994, Inf. Comput..

[10]  Martin Hofmann,et al.  Counting Successes: Effects and Transformations for Non-deterministic Programs , 2016, A List of Successes That Can Change the World.

[11]  Dominic A. Orchard,et al.  Embedding effect systems in Haskell , 2014, Haskell 2014.

[12]  Flemming Nielson,et al.  Type and effect systems - behaviours for concurrency , 1999 .

[13]  Alan Mycroft,et al.  The semantic marriage of monads and effects , 2014, ArXiv.

[14]  Philip Wadler,et al.  The marriage of effects and monads , 1998, ICFP '98.

[15]  Colin S. Gordon A Generic Approach to Flow-Sensitive Polymorphic Effects , 2017, ECOOP.

[16]  Peter W. O'Hearn,et al.  A Primer on Separation Logic (and Automatic Program Verification and Analysis) , 2012, Software Safety and Security.

[17]  Juan Chen,et al.  Verifying higher-order programs with the dijkstra monad , 2013, PLDI.

[18]  Jeffrey D. Ullman,et al.  Monotone data flow analysis frameworks , 1977, Acta Informatica.

[19]  Flemming Nielson,et al.  Logical and Operational Methods in the Analysis of Programs and Systems , 1996, LOMAPS.

[20]  Alan Mycroft,et al.  Effect Systems Revisited - Control-Flow Algebra and Semantics , 2015, Semantics, Logics, and Calculi.

[21]  Philip Wadler,et al.  The essence of functional programming , 1992, POPL '92.

[22]  Shin-ya Katsumata,et al.  Towards a Formal Theory of Graded Monads , 2016, FoSSaCS.

[23]  Ramana Kumar,et al.  A new verified compiler backend for CakeML , 2016, ICFP.

[24]  Flemming Nielson,et al.  Principles of Program Analysis , 1999, Springer Berlin Heidelberg.

[25]  John McCarthy,et al.  Recursive functions of symbolic expressions and their computation by machine, Part I , 1960, Commun. ACM.

[26]  A Pnueli,et al.  Two Approaches to Interprocedural Data Flow Analysis , 2018 .

[27]  David K. Gifford,et al.  Integrating functional and imperative programming , 1986, LFP '86.