Advertisement

Formal Aspects of Computing

, Volume 28, Issue 3, pp 469–497 | Cite as

A language-independent proof system for full program equivalence

  • Ştefan CiobâcăEmail author
  • Dorel Lucanu
  • Vlad Rusu
  • Grigore Roşu
Original Article

Abstract

Two programs are fully equivalent if, for the same input, either they both diverge or they both terminate with the same result. Full equivalence is an adequate notion of equivalence for programs written in deterministic languages. It is useful in many contexts, such as capturing the correctness of program transformations within the same language, or capturing the correctness of compilers between two different languages. In this paper we introduce a language-independent proof system for full equivalence, which is parametric in the operational semantics of two languages and in a state-similarity relation. The proof system is sound: a proof tree establishes the full equivalence of the programs given to it as input. We illustrate it on two programs in two different languages (an imperative one and a functional one), that both compute the Collatz sequence. The Collatz sequence is an interesting case study since it is not known whether the sequence terminates or not; nevertheless, our proof system shows that the two programs are fully equivalent (even if we cannot establish termination or divergence of either one).

Keywords

Matching logic Programming language semantics Program equivalence Full equivalence Programming language aggregation 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. ADR09.
    Amal Ahmed, Derek Dreyer, Andreas Rossberg (2009) State-dependent representation independence. In POPL 2009, pp 340–353Google Scholar
  2. AEF+05.
    Tamarah Arons, Elad Elster, Limor Fix, Sela Mador-Haim, Michael Mishaeli, Jonathan Shalev, Eli Singerman, Andreas Tiemeyer, Moshe Y. Vardi, Lenore D. Zuck (2005) Formal verification of backward compatibility of microcode. In CAV 2005, volume 3576 of LNCS, pp 185–198Google Scholar
  3. BC10.
    Yves Bertot, Pierre Castran (2010) Interactive Theorem Proving and Program Development: Coq’Art The Calculus of Inductive Constructions. Springer, 1st editionGoogle Scholar
  4. Ben04.
    Nick Benton (2004) Simple relational correctness proofs for static analyses and program transformations. In POPL 2004, pp 14–25Google Scholar
  5. BH09.
    Nick Benton, Chung-Kil Hur (2009) Biorthogonality, step-indexing and compiler correctness. In ICFP 2009, pp 97–108Google Scholar
  6. BR15.
    Denis Bogdănaş, Grigore Roşu (2015) K-Java: A Complete Semantics of Java. In POPL 2015, pp 445–456Google Scholar
  7. CLRR15.
    Ştefan Ciobâcă, Dorel Lucanu, Vlad Rusu, Grigore Roşu (2015) A theoretical foundation for programming language aggregation. In WADT 2014, volume 9463 of LNCS, pp 30–47Google Scholar
  8. SCM+14.
    Andrei Ştefănescu, Ştefan Ciobâcă, Radu Mereuţă, Brandon M. Moore, Traian Florin Şerbănuţă, Grigore Roşu (2014) All-path reachability logic. In RTA-TLCA’14, volume 8560 of LNCS, pp 425–440Google Scholar
  9. CŞ15.
    Claudia Elena Chiriţă, Traian Florin Şerbănuţă (2015) An institutional foundation for the \({\mathbb{K}}\) semantic framework. In WADT 2014, volume 9463 of LNCS, pp 9–29Google Scholar
  10. CGS12.
    Sagar Chaki, Arie Gurfinkel, Ofer Strichman (2012) Regression verification for multi-threaded programs. In VMCAI 2012, volume 7148 of LNCS, pp 119–135Google Scholar
  11. Cio14.
    Ştefan Ciobâcă (2014) Reducing partial equivalence to partial correctness. In SYNASC 2014, pp 164–171. IEEEGoogle Scholar
  12. Cră02.
    Sorin Crăciunescu (2002) Proving the equivalence of CLP programs. In ICLP 2002, volume 2401 of LNCS, pp 287–301Google Scholar
  13. ER12.
    Chucky Ellison, Grigore Roşu (2012) An executable formal semantics of C with applications. In POPL 2012, pp 533–544Google Scholar
  14. GS08.
    Godlin Benny, Strichman Ofer (2008) Inference rules for proving the equivalence of recursive procedures. Acta Informatica 45(6): 403–439MathSciNetCrossRefzbMATHGoogle Scholar
  15. GS13.
    Godlin Benny, Strichman Ofer (2013) Regression verification: proving the equivalence of similar programs. Software Testing, Verification and Reliability 23(3): 241–258CrossRefGoogle Scholar
  16. Guy83.
    Richard K. Guy (1983) Don’t try to solve these problems. The American Mathematical Monthly, 90(1):35–38, 39–41Google Scholar
  17. HD11.
    Chung-Kil Hur, Derek Dreyer (2011) A kripke logical relation between ML and assembly. In POPL 2011, pp 133–146Google Scholar
  18. HDNV12.
    Chung-Kil Hur, Derek Dreyer, Georg Neis, Viktor Vafeiadis (2012) The marriage of bisimulations and kripke logical relations. In POPL 2012, pp 59–72Google Scholar
  19. HN96.
    Anne Elisabeth Haxthausen, Friederike Nickl (1996) Pushouts of order-sorted algebraic specifications. In AMAST 1996, pp 132–147. Springer-VerlagGoogle Scholar
  20. HNDV14.
    Chung-Kil Hur, Georg Neis, Derek Dreyer, Viktor Vafeiadis (2014) A Logical Step Forward in Parametric Bisimulations. Technical Report 003, MPI-SWS, JanuaryGoogle Scholar
  21. Hoa69.
    Hoare CharlesAntony Richard (1969) An axiomatic basis for computer programming. Communications of the ACM 12(10): 576–580CrossRefzbMATHGoogle Scholar
  22. KTL09.
    Sudipta Kundu, Zachary Tatlock, Sorin Lerner (2009) Proving optimizations correct using parameterized program equivalence. In PLDI 2009, pp 327–337. ACMGoogle Scholar
  23. Ler09.
    Leroy Xavier (2009) Formal verification of a realistic compiler. Communications of the ACM, 52(7): 107–115CrossRefGoogle Scholar
  24. LHKR12.
    Shuvendu K. Lahiri, Chris Hawblitzel, Ming Kawaguchi, Henrique Rebêlo (2012) SYMDIFF: A language-agnostic semantic diff tool for imperative programs. In CAV 2012, volume 7358 of LNCS, pp 712–717Google Scholar
  25. LR14.
    Dorel Lucanu, Vlad Rusu (2014) Program equivalence by circular reasoning. Formal Aspects of Computing, pp 1–26Google Scholar
  26. LRA16.
    Dorel Lucanu, Vlad Rusu, Andrei Arusoaie A Generic Framework for Symbolic Execution: Theory and Applications. Journal of Symbolic Computation, to appearGoogle Scholar
  27. Mil89.
    Robin Milner (1989) Communication and concurrency. Prentice HallGoogle Scholar
  28. Mit86.
    John C. Mitchell (1986) Representation independence and data abstraction. In POPL 1986, pp 263–276Google Scholar
  29. MR04.
    José Meseguer, Grigore Roşu (2004) Rewriting logic semantics: From language specifications to formal analysis tools. In IJCAR 2004, volume 3097 of LNCS, pp 1–44Google Scholar
  30. Nec00.
    George Necula (2000) Translation validation for an optimizing compiler. In PLDI 2000, pp 83–94. ACMGoogle Scholar
  31. PcR15.
    Daejun Park, Andrei Ştefănescu, Grigore Roşu (2015) KJS: A complete formal semantics of JavaScript. In PLDI 2015, pp 346–356Google Scholar
  32. Pit02.
    Andrew M. Pitts (2002) Operational semantics and program equivalence. In Applied Semantics Summer School, volume 2395 of LNCS, pp 378–412Google Scholar
  33. RŞ12a.
    Grigore Roşu, Andrei Ştefănescu (2012) Checking reachability using matching logic. In OOPSLA, pp 555–574. ACMGoogle Scholar
  34. RŞ12b.
    Grigore Roşu, Andrei Ştefănescu (2012) Towards a unified theory of operational and axiomatic semantics. In ICALP 2012, volume 7392 of LNCS, pp 351–363Google Scholar
  35. RŞCM13.
    Grigore Roşu, Andrei Ştefănescu, RŞ;tefan Ciobâcă, Brandon M. Moore (2013) One-path reachability logic. In LICS 2013, pp 358–367. IEEEGoogle Scholar
  36. RES10.
    Grigore Roşu, Chucky Ellison, Wolfram Schulte (2010) Matching logic: An alternative to Hoare/Floyd logic. In AMAST 2010, volume 6486 of LNCS, pp 142–162Google Scholar
  37. Rey02.
    John C. Reynolds (2002) Separation logic: A logic for shared mutable data structures. In LICS 2002, pp 55–74Google Scholar
  38. Roş06.
    Grigore Roşu (2006) Equality of streams is a \({\Pi}_{2}^{0}\)-complete problem. In ICFP 2006, pp 184–191. ACMGoogle Scholar
  39. Roş15.
    Grigore Roşu (2015) Matching logic—extended abstract. In RTA 2015, volume 36 of LIPIcs, pp 5–21Google Scholar
  40. San11.
    Davide Sangiorgi (2011) Introduction to Bisimulation and Coinduction. Cambridge University Press, New York, NY, USAGoogle Scholar
  41. SK06.
    Fabio Somenzi, Andreas Kuehlmann (2006) Electronic Design Automation For Integrated Circuits Handbook, volume 2, chapter 4: Equivalence Checking. CRC PressGoogle Scholar
  42. SKS11.
    Davide Sangiorgi, Naoki Kobayashi, Eijiro Sumii (2011) Environmental bisimulations for higher-order languages. ACM Transactions on Programming Languages and Systems, 33(1):5Google Scholar
  43. ŞRM09.
    Traian-Florin Şerbănuţă, Grigore Roşu, José Meseguer (2009) A rewriting logic approach to operational semantics. Information and Computation, 207(2):305–340Google Scholar

Copyright information

© British Computer Society 2016

Authors and Affiliations

  • Ştefan Ciobâcă
    • 1
    Email author
  • Dorel Lucanu
    • 1
  • Vlad Rusu
    • 2
  • Grigore Roşu
    • 3
  1. 1.Faculty of Computer Science“Alexandru Ioan Cuza” UniversityIasiRomania
  2. 2.InriaLilleFrance
  3. 3.University of Illinois at Urbana-ChampaignChampaignUSA

Personalised recommendations