Simple relational correctness proofs for static analyses and program transformations

We show how some classical static analyses for imperative programs, and the optimizing transformations which they enable, may be expressed and proved correct using elementary logical and denotationaltechniques. The key ingredients are an interpretation of program properties as relations, rather than predicates, and a realization that although many program analyses are traditionally formulated in very intensional terms, the associated transformations are actually enabled by more liberal extensional properties.We illustrate our approach with formal systems for analysing and transforming while-programs. The first is a simple type system which tracks constancy and dependency information and can be used to perform dead-code elimination, constant propagation and program slicing as well as capturing a form of secure information flow. The second is a relational version of Hoare logic, which significantly generalizes our first type system and can also justify optimizations including hoisting loop invariants. Finally we show how a simple available expression analysis and redundancy elimination transformation may be justified by translation into relational Hoare logic.

[1]  Gary A. Kildall,et al.  A unified approach to global program optimization , 1973, POPL.

[2]  Martín Abadi,et al.  A PER model of polymorphism and recursive types , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[3]  Ferruccio Damiani Useless-Code Detection and Elimination for PCF with Algebraic Data types , 1999, TLCA.

[4]  Amir Pnueli,et al.  VOC: A Methodology for the Translation Validation of OptimizingCompilers , 2003, J. Univers. Comput. Sci..

[5]  Martín Abadi,et al.  A core calculus of dependency , 1999, POPL '99.

[6]  M. Rinard Credible Compilation , 1999 .

[7]  Martín Abadi,et al.  Formal Parametric Polymorphism , 1993, Theor. Comput. Sci..

[8]  Martin Rinard,et al.  Credible Compilation with Pointers , 1999 .

[9]  Torben Amtoft Minimal Thunkification , 1993, WSA.

[10]  Dexter Kozen,et al.  Certification of Compiler Optimizations Using Kleene Algebra with Tests , 2000, Computational Logic.

[11]  Geoffrey Smith,et al.  A Sound Type System for Secure Flow Analysis , 1996, J. Comput. Secur..

[12]  Mitchell Wand,et al.  Set constraints for destructive array update optimization , 1998, Proceedings of the 1998 International Conference on Computer Languages (Cat. No.98CB36225).

[13]  Anindya Banerjee,et al.  Secure information flow and pointer con .nement in a java-like language , 2002, Proceedings 15th IEEE Computer Security Foundations Workshop. CSFW-15.

[14]  Geoffrey Smith,et al.  Secure information flow in a multi-threaded imperative language , 1998, POPL '98.

[15]  Mitchell Wand,et al.  Constraint systems for useless variable elimination , 1999, POPL '99.

[16]  Andrew M. Pitts,et al.  Relational Properties of Domains , 1996, Inf. Comput..

[17]  Gilberto Filé,et al.  Proceedings of the Third International Workshop on Static Analysis , 1993 .

[18]  C. A. R. Hoare,et al.  An axiomatic basis for computer programming , 1969, CACM.

[19]  Eric Van Wyk,et al.  Proving correctness of compiler optimizations by temporal logic , 2002, POPL '02.

[20]  David W. Binkley,et al.  Program slicing , 2008, 2008 Frontiers of Software Maintenance.

[21]  C. A. R. HOARE,et al.  An axiomatic basis for computer programming , 1969, CACM.

[22]  Paola Giannini,et al.  Automatic useless-code elimination for HOT functional programs , 2000, Journal of Functional Programming.

[23]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[24]  Flemming Nielson,et al.  Program transformations in a denotational setting , 1981, ACM Trans. Program. Lang. Syst..

[25]  Glynn Winskel,et al.  The formal semantics of programming languages - an introduction , 1993, Foundation of computing series.

[26]  Mitchell Wand,et al.  Lightweight closure conversion , 1997, TOPL.

[27]  G. Winskel The formal semantics of programming languages , 1993 .

[28]  George C. Necula,et al.  Translation validation for an optimizing compiler , 2000, PLDI '00.

[29]  Matthew S. Hecht,et al.  Flow Analysis of Computer Programs , 1977 .

[30]  Sorin Lerner,et al.  Automatically proving the correctness of compiler optimizations , 2003, PLDI '03.

[31]  Peter Nicholas Benton,et al.  Strictness analysis of lazy functional programs , 1992 .

[32]  Naoki Kobayashi Type-Based Useless-Variable Elimination , 2001, High. Order Symb. Comput..

[33]  David Sands,et al.  Binding time analysis: a new PERspective , 1991, PEPM '91.

[34]  John Hughes,et al.  Type Specialisation for the lambda-Calculus; or, A New Paradigm for Partial Evaluation Based on Type Inference , 1996, Dagstuhl Seminar on Partial Evaluation.

[35]  David Aspinall,et al.  Subtyping with Singleton Types , 1994, CSL.

[36]  David Sands,et al.  A Per Model of Secure Information Flow in Sequential Programs , 1999, ESOP.

[37]  Mitchell Wand,et al.  Specifying the correctness of binding-time analysis , 1993, POPL '93.

[38]  Nick Benton,et al.  Monads, Effects and Transformations , 1999, Electron. Notes Theor. Comput. Sci..

[39]  Howard Hua Yang Verification of the schorr-waite graph marking algorithm by refinement , 2003 .

[40]  C. A. R. Hoare,et al.  An Axiomatic Basis for Computer Programming (Reprint) , 2002, Software Pioneers.

[41]  VolpanoDennis,et al.  A sound type system for secure flow analysis , 1996 .