skip to main content
research-article

Verifying Procedural Programs via Constrained Rewriting Induction

Published: 02 June 2017 Publication History

Abstract

This article aims to develop a verification method for procedural programs via a transformation into logically constrained term rewriting systems (LCTRSs). To this end, we extend transformation methods based on integer term rewriting systems to handle arbitrary data types, global variables, function calls, and arrays, and to encode safety checks. Then we adapt existing rewriting induction methods to LCTRSs and propose a simple yet effective method to generalize equations. We show that we can automatically verify memory safety and prove correctness of realistic functions. Our approach proves equivalence between two implementations; thus, in contrast to other works, we do not require an explicit specification in a separate specification language.

References

[1]
Elvira Albert, Puri Arenas, Samir Genaim, Germán Puebla, and Damiano Zanardini. 2008. Removing useless variables in cost analysis of java bytecode. In Proceedings of the 2008 SAC Conference (SAC’08). 368--375.
[2]
Elvira Albert, Miguel Gómez-Zamalloa, Laurent Hubert, and Germán Puebla. 2007. Verification of Java bytecode using analysis and transformation of logic programs. In Proceedings of the 2007 PADL Conference (PADL’07). 124--139.
[3]
Christophe Alias and Denis Barthou. 2003. Algorithm recognition based on demand-driven data-flow analysis. In Proceedings of the 2003 WCRE Conference (WCRE’03). 296--305.
[4]
María Alpuente, Santiago Escobar, and Salvador Lucas. 2007. Removing redundant arguments automatically. Theory and Practice of Logic Programming 7, 1--2, 3--35.
[5]
Raymond Aubin. 1979. Mechanizing structural induction part I: Formal system. Theoretical Computer Science 9, 3, 329--345.
[6]
Franz Baader and Tobias Nipkow. 1998. Term Rewriting and All That. Cambridge University Press.
[7]
Gilles Barthe, Pedro R. D’Argenio, and Tamara Rezk. 2011. Secure information flow by self-composition. Mathematical Structures in Computer Science 21, 6, 1207--1252.
[8]
David A. Basin and Toby Walsh. 1992. Difference matching. In Proceedings of the 1992 CADE Conference (CADE’92). 295--309.
[9]
Dirk Beyer, Alessandro Cimatti, Alberto Griggio, M. Erkan Keremoglu, and Roberto Sebastiani. 2009. Software model checking via large-block encoding. In Proceedings of the 2009 FMCAD Conference (FMCAD’09). 25--32.
[10]
Adel Bouhoula. 1997. Automated theorem proving by test set induction. Journal of Symbolic Computation 23, 1, 47--77.
[11]
Adel Bouhoula and Florent Jacquemard. 2008a. Automated induction with constrained tree automata. In Proceedings of the 2008 IJCAR Conference (IJCAR’08). 539--554.
[12]
Adel Bouhoula and Florent Jacquemard. 2008b. Automated Induction for Complex Data Structures. Technical Report. Available at http://arxiv.org/abs/0811.4720.
[13]
Marc Brockschmidt, Byron Cook, Samin Ishtiaq, Heidy Khlaaf, and Nir Piterman. 2016. T2: Temporal property verification. In Proceedings of the 2016 TACAS Conference (TACAS’16). 387--393.
[14]
Alan Bundy. 2001. The automation of proof by mathematical induction. In Handbook of Automated Reasoning. Elsevier, 845--911.
[15]
Alan Bundy, David Basin, Dieter Hutter, and Andrew Ireland. 2005. Rippling: Meta-Level Guidance for Mathematical Reasoning. Cambridge University Press.
[16]
Alan Bundy, Andrew Stevens, Frank van Harmelen, Andrew Ireland, and Alan Smaill. 1993. Rippling: A heuristic for guiding inductive proofs. Artificial Intelligence 62, 2, 185--253.
[17]
Cristiano Calcagno, Dino Distefano, Jérémy Dubreil, Dominik Gabi, Pieter Hooimeijer, Martino Luca, Peter W. O’Hearn, Irene Papakonstantinou, Jim Purbrick, and Dulma Rodriguez. 2015. Moving fast with software verification. In Proceedings of the 2015 NFM Conference (NFM’15). 3--11.
[18]
Leonardo de Moura and Nikolaj Bjørner. 2008. Z3: An efficient SMT solver. In Proceedings of the 2008 TACAS Conference (TACAS’08). 337--340.
[19]
Stephan Falke. 2009. Term Rewriting with Built-In Numbers and Collection Data Structures. Ph.D. Dissertation. University of New Mexico.
[20]
Stephan Falke and Deepak Kapur. 2009. A term rewriting approach to the automated termination analysis of imperative programs. In Proceedings of the 2009 CADE Conference (CADE’09). 277--293.
[21]
Stephan Falke and Deepak Kapur. 2012. Rewriting induction + linear arithmetic = Decision procedure. In Proceedings of the 2012 IJCAR Conference (IJCAR’12). 241--255.
[22]
Stephan Falke, Deepak Kapur, and Carsten Sinz. 2011. Termination analysis of C programs using compiler intermediate languages. In Proceedings of the 2011 RTA Conference (RTA’11). 41--50.
[23]
Dennis Felsing, Sarah Grebing, Vladimir Klebanov, Philipp Rümmer, and Mattias Ulbrich. 2014. Automating regression verification. In Proceedings of the 2014 ASE Conference (ASE’14). 349--360.
[24]
Carsten Fuhs, Jürgen Giesl, Martin Plücker, Peter Schneider-Kamp, and Stephan Falke. 2009. Proving termination of integer term rewriting. In Proceedings of the 2009 RTA Conference (RTA’09). 32--47.
[25]
Yuki Furuichi, Naoki Nishida, Masahiko Sakai, Keiichiro Kusakari, and Toshiki Sakabe. 2008. Approach to procedural-program verification based on implicit induction of constrained term rewriting systems. IPSJ Transactions on Programming 1, 2, 100--121. In Japanese; translated summary at http://www.trs.css.i.nagoya-u.ac.jp/crisys/.
[26]
Jürgen Giesl, Cornelius Aschermann, Marc Brockschmidt, Fabian Emmes, Florian Frohn, Carsten Fuhs, Jera Hensel, et al. 2017. Analyzing program termination and complexity automatically with AProVE. Journal of Automated Reasoning 58, 1, 3--31.
[27]
Jürgen Giesl, Armin Kühnemann, and Janis Voigtländer. 2007. Deaccumulation techniques for improving provability. Journal of Logic and Algebraic Programming 71, 2, 79--113.
[28]
Benny Godlin and Ofer Strichman. 2008. Inference rules for proving the equivalence of recursive procedures. Acta Informatica 45, 6, 403--439.
[29]
Benny Godlin and Ofer Strichman. 2013. Regression verification: Proving the equivalence of similar programs. Software Testing, Verification and Reliability 23, 3, 241--258.
[30]
Ashutosh Gupta, Corneliu Popeea, and Andrey Rybalchenko. 2011. Predicate abstraction and refinement for verifying multi-threaded programs. In Proceedings of the 2011 POPL Conference (POPL’11). 331--344.
[31]
Chris Hawblitzel, Ming Kawaguchi, Shuvendu K. Lahiri, and Henrique Rebêlo. 2013. Towards modularly comparing programs using automated theorem provers. In Proceedings of the 2013 CADE Conference (CADE’13). 282--299.
[32]
Gérard P. Huet and Jean-Marie Hullot. 1982. Proofs by induction in equational theories with constructors. Journal of Computer and System Sciences 25, 2, 239--266.
[33]
Michael Huth and Mark Ryan. 2000. Logic in Computer Science: Modelling and Reasoning About Systems. Cambridge University Press.
[34]
Deepak Kapur and Nikita A. Sakhanenko. 2003. Automatic generation of generalization lemmas for proving properties of tail-recursive definitions. In Proceedings of the 2003 TPHOLs Conference (TPHOLs’03). 136--154.
[35]
Deepak Kapur and Mahadevan Subramaniam. 1996. Lemma discovery in automated induction. In Proceedings of the 1996 CADE Conference (CADE’96). 538--552.
[36]
Hirotaka Koike and Yoshihito Toyama. 2000. Comparison between inductionless induction and rewriting induction. Computer Software 17, 6, 1--12. In Japanese.
[37]
Cynthia Kop. 2013. Termination of LCTRSs. In Proceedings of the 2013 WST Conference (WST’13). 59--63.
[38]
Cynthia Kop. 2017. Quasi-Reductivity of Logically Constrained Term Rewriting Systems. Technical Report. Available at https:/arxiv.org/abs/1702.02397.
[39]
Cynthia Kop and Naoki Nishida. 2013. Term rewriting with logical constraints. In Proceedings of the 2013 FroCoS Conference (FroCoS’13). 343--358.
[40]
Cynthia Kop and Naoki Nishida. 2014. Automatic constrained rewriting induction towards verifying procedural programs. In Proceedings of the 2014 APLAS Conference (ASPLAS’14). 334--353.
[41]
Cynthia Kop and Naoki Nishida. 2015. Constrained rewriting tool. In Proceedings of the 2015 LPAR Conference (LPAR’15). 549--557.
[42]
Sudipta Kundu, Zachary Tatlock, and Sorin Lerner. 2009. Proving optimizations correct using parameterized program equivalence. In Proceedings of the 2009 PLDI Conference (PLDI’09). 327--337.
[43]
Shuvendu K. Lahiri, Chris Hawblitzel, Ming Kawaguchi, and Henrique Rebêlo. 2012. SYMDIFF: A language-agnostic semantic diff tool for imperative programs. In Proceedings of the 2012 CAV Conference (CAV’12). 712--717.
[44]
Nuno P. Lopes and José Monteiro. 2016. Automatic equivalence checking of programs with uninterpreted functions and integer arithmetic. International Journal on Software Tools for Technology Transfer 18, 4, 359--374.
[45]
John McCarthy. 1960. Recursive functions of symbolic expressions and their computation by machine, part I. Communications of the ACM 3, 4, 184--195.
[46]
Naoki Nakabayashi, Naoki Nishida, Keiichiro Kusakari, Toshiki Sakabe, and Masahiko Sakai. 2010. Lemma generation method in rewriting induction for constrained term rewriting systems. Computer Software 28, 1, 173--189. In Japanese; translation at http://www.trs.css.i.nagoya-u.ac.jp/crisys/.
[47]
George C. Necula. 2000. Translation validation for an optimizing compiler. In Proceedings of the 2000 PLDI Conference (PLDI’00). 83--94.
[48]
Robert Nieuwenhuis, Albert Oliveras, and Cesare Tinelli. 2006. Solving SAT and SAT modulo theories: From an abstract davis--putnam--logemann--loveland procedure to DPLL(T). Journal of the ACM 53, 6, 937--977.
[49]
Carsten Otto, Marc Brockschmidt, Christan von Essen, and Jürgen Giesl. 2010. Automated termination analysis of Java bytecode by term rewriting. In Proceedings of the 2010 RTA Conference (RTA’10). 259--276.
[50]
Amir Pnueli, Michael Siegel, and Eli Singerman. 1998. Translation validation. In Proceedings of the 1998 TACAS Conference (TACAS’98). 151--166.
[51]
Uday S. Reddy. 1990. Term rewriting induction. In Proceedings of the 1990 CADE Conference (CADE’90). 162--177.
[52]
Tsubasa Sakata, Naoki Nishida, and Toshiki Sakabe. 2011. On proving termination of constrained term rewrite systems by eliminating edges from dependency graphs. In Proceedings of the 2011 WFLP Conference (WFLP’11). 138--155.
[53]
Tsubasa Sakata, Naoki Nishida, Toshiki Sakabe, Masahiko Sakai, and Keiichiro Kusakari. 2009. Rewriting induction for constrained term rewriting systems. IPSJ Transactions on Programming 2, 2, 80--96. In Japanese; a translated summary is available at http://www.trs.css.i.nagoya-u.ac.jp/crisys/.
[54]
Fausto Spoto, Lunjin Lu, and Fred Mesnard. 2009. Using CLP simplifications to improve Java bytecode termination analysis. Electronic Notes in Theoretical Computer Science 253, 5, 129--144.
[55]
SV-COMP. 2017. Competition on Software Verification. Retrieved May 1, 2017, from http://sv-comp.sosy-lab.org/
[56]
Tachio Terauchi and Alexander Aiken. 2005. Secure information flow as a safety problem. In Proceedings of the 2005 SAS Conference (SAS’05). 352--367.
[57]
Pascal Urso and Emmanuel Kounalis. 2004. Sound generalizations in mathematical induction. Theoretical Computer Science 323, 1--3, 443--471.
[58]
Sven Verdoolaege, Gerda Janssens, and Maurice Bruynooghe. 2012. Equivalence checking of static affine programs using widening to handle recurrences. ACM Transactions on Programming Languages and Systems 34, 3, 11.
[59]
Milena Vujosevic-Janicic, Mladen Nikolic, Dusan Tosic, and Viktor Kuncak. 2013. Software verification and graph similarity for automated evaluation of students’ assignments. Information and Software Technology 55, 6, 1004--1016.
[60]
Toby Walsh. 1996. A divergence critic for inductive proof. Journal of Artificial Intelligence Research 4, 209--235.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Computational Logic
ACM Transactions on Computational Logic  Volume 18, Issue 2
April 2017
306 pages
ISSN:1529-3785
EISSN:1557-945X
DOI:10.1145/3091105
  • Editor:
  • Orna Kupferman
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution-NonCommercial International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 02 June 2017
Accepted: 01 February 2017
Revised: 01 February 2017
Received: 01 December 2015
Published in TOCL Volume 18, Issue 2

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Constrained term rewriting
  2. inductive theorem proving
  3. lemma generation
  4. program analysis
  5. rewriting induction

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • Japan Society for the Promotion of Science (JSPS)
  • Austrian Science Fund (FWF) international project
  • Marie Skłodowska-Curie action “HORIP”
  • Nagoya University's Graduate Program for Real-World Data Circulation Leaders from MEXT, Japan

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)32
  • Downloads (Last 6 weeks)3
Reflects downloads up to 25 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media