Applied Intelligence

, Volume 45, Issue 4, pp 1066–1088 | Cite as

Automated program repair using genetic programming and model checking

  • Zahra Zojaji
  • Behrouz Tork Ladani
  • Alireza KhalilianEmail author


Automated program repair is still a highly challenging problem mainly due to the reliance of the current techniques on test cases to validate candidate patches. This leads to the increasing unreliability of the final patches since test cases are partial specifications of the software. In the present paper, an automated program repair method is proposed by integrating genetic programming (GP) and model checking (MC). Due to its capabilities to verify the finite state systems, MC is employed as an appropriate criterion for evolving programs to calculate the fitness in GP. The application of MC for the fitness evaluation, which is novel in the context of program repair, addresses an important gap in the current heuristic approaches to the program repair. Being focused on fault detection based on the desired aspects, it enables the programmers to detect faults according to the definition of properties. Creating a general method, this characteristic can be effectively customized for different domains of application and the corresponding faults. Apart from various types of faults, the proposed method is capable of handling concurrency bugs which are not the case in many general repair methods. To evaluate the proposed method, it was implemented as a tool, named JBF, to repair Java programs. To meet the objectives of the study, some experiments were conducted in which certain programs with known bugs were automatically repaired by the JBF tool. The obtained results are encouraging and remarkably promising.


Automated software repair Automatic bug fixing Genetic programming Model checking 


  1. 1.
    Ammann P, Offutt J (2008) Introduction to software testing. Cambridge University PressGoogle Scholar
  2. 2.
    Wilkerson JL, Tauritz DR, Bridges JM (2012) Multi-objective coevolutionary automated software correction. In: Proceedings of the 14th annual conference on Genetic and evolutionary computation. ACM, pp 1229–1236Google Scholar
  3. 3.
    Ballou MC (2008) Improving software quality to drive business agility. White paper, International Data CorporationGoogle Scholar
  4. 4.
    Yin Z, Yuan D, Zhou Y, Pasupathy S, Bairavasundaram LN (2011) How do fixes become bugs?. In: Foundations of Software Engineering, pp 26–36Google Scholar
  5. 5.
    Jeffrey DB (2009) Dynamic State Alteration Techniques for Automatically Locating Software Errors. Phd Thesis, University of California, RiversideGoogle Scholar
  6. 6.
    Kim D, Nam J, Song J, Kim S (2013) Automatic patch generation learned from human-written patches. In: proceedings of the International Conference on Software Engineering (ICSE ’13). IEEE Press, NJ, USA, pp 802–811Google Scholar
  7. 7.
    Le Goues C (2013) Automatic program repair using genetic programming. PhD Thesis, University of VirginiaGoogle Scholar
  8. 8.
    Arcuri A, Yao X (2008) A novel co-evolutionary approach to automatic software bug fixing. In: IEEE Congress on Evolutionary ComputationGoogle Scholar
  9. 9.
    Forrest S, Weimer W, Nguyen T, Le Goues C (2009) A genetic programming approach to automated software repair. In: Genetic and Evolutionary Computation Conference (GECCO)Google Scholar
  10. 10.
    Arcuri A (2008) On the automation of fixing software bugs. In: proceedings of the Doctoral Symposium of the IEEE International Conference on Software EngineeringGoogle Scholar
  11. 11.
    Weimer W, Nguyen T, Le Goues C, Forrest S (2009) Automatically finding patches using genetic programming. In: International Conference on Software EngineeringGoogle Scholar
  12. 12.
    Nguyen T, Weimer W, Le Goues C, Forrest S (2009) Using execution paths to evolve software patches. In: IEEE international conference on software testing, Verification, and Validation Workshops, pp 152–153Google Scholar
  13. 13.
    Liu P, Zhang C (2012) Axis Automatically fixing atomicity violations through solving control constraints. In: International conference on software engineering, pp 299–309Google Scholar
  14. 14.
    Dallmeier V, Zeller A, Meyer b. (2009) Generating fixes from object behavior anoMalies. In: IEEE Computer Society, pp 550–554Google Scholar
  15. 15.
    Jin G, Song L, Zhang W, Lu S, Liblit B (2011) Automated atomicity-violation fixing. In: Proceedings of the 32nd ACM SIGPLAN conference on Programming language design and implementation (PLDI ’11). ACM, NY, USA, pp 389–400Google Scholar
  16. 16.
    Perkins JH, Kim S, Larsen S, Amarasinghe S, Bachrach J, Carbin M, Pacheco C, Sherwood F, Sidiroglou S, Sullivan G, Wong W, Zibin Y, Ernst MD, Rinard M (2009) Automatically patching errors in deployed software. In: Proceedings of the ACM SIGOPS 22nd symposium on Operating systems principles (SOSP ’09). ACM, NY USA, pp 87–102Google Scholar
  17. 17.
    Bradbury JS, Jalbert K (2010) Automatic repair of concurrency bugs. In: International Symposium on Search Based Software Engineering - Fast Abstracts, pp 1–2Google Scholar
  18. 18.
    Staber S, Jobstmann B, Bloem R (2005) Finding and fixing faults. In: Conference on Correct Hardware Design and Verification Methods (CHARME), pp 35–49Google Scholar
  19. 19.
    Dennis LA, Monroy R, Nogueira P (2006) Proof-directed debugging and repair. In: Seventh Symposium on Trends in Functional Programming, pp 131–140Google Scholar
  20. 20.
    Demsky B, Ernst MD, Guo PJ, McCamant S, Perkins JH, Rinard M (2006) Inference and enforcement of data structure consistency specifications. In: International Symposium on Software Testing and Analysis, pp 233–244Google Scholar
  21. 21.
    Deeprasertkul P, Bhattarakosol P, O’Brien F (2005) Automatic detection and correction of programming faults for software applications. J Syst Softw 78(2):101–110CrossRefGoogle Scholar
  22. 22.
    Le Goues C, Nguyen T, Forrest S, Weimer W (2012) Genprog a generic method for automatic software repair. IEEE Trans Softw Eng 38(1):54–72CrossRefGoogle Scholar
  23. 23.
    Le Goues C, Dewey-Vogt M, Forrest S, Weimer W (2012) A systematic study of automated program repair: fixing 55 out of 105 bugs for $8 each. In: Proceedings of the 34th International Conference on Software Engineering (ICSE ’12). IEEE Press, pp 3–13Google Scholar
  24. 24.
    Babovic V, Keijzer M (2000) Genetic programming as a model induction engine. J Hydro Inf 2(1):35–60Google Scholar
  25. 25.
    Lin WY, Kuo IC (2004) A genetic selection algorithm for OLAP data cubes. Knowl Inf Syst 6(1):83–102CrossRefGoogle Scholar
  26. 26.
    Rodriguez-Vazquez K, Fleming PJ (2005) Evolution of mathematical models of chaotic systems based on multiobjective genetic programming. Knowl Inf Syst 8(2):235–256CrossRefGoogle Scholar
  27. 27.
    Visser W, Havelund K, Brat G, Park SJ, Lerda F (2003) Model checking programs. Autom Softw Eng J 10:2Google Scholar
  28. 28.
    Rice HG (1953) Classes of recursively enumerable sets and their decision problems. Trans Am Math Soc 74:358–366MathSciNetCrossRefzbMATHGoogle Scholar
  29. 29.
    Weimer W (2013) Advances in automated program repair and a call to arms. In: Proceedings of symposium on search based software engineering (SSBSE 2013), vol 8084, pp 1–3Google Scholar
  30. 30.
    Koza JR (1989) Hierarchical genetic algorithms operation on populations of computer programs. In: Proceedings of the 11th International Joint Conference on Artificial Intelligence, pp 768–774Google Scholar
  31. 31.
    Montana DJ (1995) Strongly typed genetic algorithm. Evol Comput 3(2):199–230CrossRefGoogle Scholar
  32. 32.
    Koza JR, Keane MA, Streeter MJ, Mydlowec W, Yu J, Lanza G (2003) Genetic programming IV Routine human-competitive machine intelligence. Kluwer Academic Publishers, Boston MAzbMATHGoogle Scholar
  33. 33.
    Haynes TD, Schoenfeld DA, Wainwright RL (1996) Type inheritance in strongly typed genetic programming. In: Angeline PJ, Kinnear KE Jr. (eds) Advances in Genetic Programming. MIT Press Cambridge, MA, pp 359–375Google Scholar
  34. 34.
    Ratle A, Sebag M (2001) Grammar-guided genetic programming and dimensional consistency: Application to non-parametric identification in mechanics. Appl Soft Comput 1(1):105– 118CrossRefGoogle Scholar
  35. 35.
    Clarke E, Filkorn T, Jha S (1993) Exploiting symmetry in temporal logic model checking. In: Proceedings of the Fifth International Conference for Computer-Aided Verification, vol 697. Lecture Notes in Computer ScienceGoogle Scholar
  36. 36.
    Baier C, Katoen J (2008) Principles of model checking. MIT PressGoogle Scholar
  37. 37.
    Leue S, Holzmann G (1999) V-promela: A visual, object-oriented language for Spin. In: 2nd IEEE International Symposium on Object-Oriented Real-Time Distributed Computing, (ISORC’99) ProceedingsGoogle Scholar
  38. 38.
    Pnueli A (1977) The temporal logic of programs. In: Proceedings of the 18th Annual Symposium on Foundations of Computer Science (FOCS), pp 46–57Google Scholar
  39. 39.
    Emerson E, Sistla A (1993) Symmetry and model checking. In: CAV ’93: 5th International Conference on Computer Aided Verification, Vol. 697 of Lecture Notes in Computer ScienceGoogle Scholar
  40. 40.
    Clarke E, Emerson E, Jha S, Sistla A (1998) Lect Notes Comput SciGoogle Scholar
  41. 41.
    Ip C, Dill D (1993) Better verification through symmetry. Inproceedings of the Eleventh International Symposium on Computer Hardware Description Languages and their Application, North HollandGoogle Scholar
  42. 42.
    Cousot P, Cousot R (1977) Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pp 238–252Google Scholar
  43. 43.
    Clarke E, Fujita M, Rajan S, Reps T, Shankar S, Teitelbaum T. (1999) Program slicing of hardware description languages. Technical Report CMU-CS-99-103, Carnegie Mellon University, School of Computer ScienceGoogle Scholar
  44. 44.
    Hatcliff J, Corbett J, Dwyer M, Sokolowski S, Zheng H (1999) A Formal Study of Slicing for Multi-threaded Programs with JVM Concurrency Primitives. In: Proceedings on the 1999 International Symposium on Static Analysis, pp 1–18Google Scholar
  45. 45.
    Millett LI, Teitelbaum T (1998) Slicing Promela and its Application to Model Checking, Simulation, and Protocol Understanding. In: Proceedings of the 4th International SPIN WorkshopGoogle Scholar
  46. 46.
    Savage S, Burrows M, Nelson G, Sobalvarro P (1997) Eraser a dynamic data race detector for multithreaded programs. ACM Trans Comput Syst 15(4):391–411CrossRefGoogle Scholar
  47. 47.
    Dennis LA (2006) Program slicing and middle-out reasoning for error location and repair. In: Disproving: Non-Theorems, Non-Validity and Non-ProvabilityGoogle Scholar
  48. 48.
    Stumptner M, Wotawa F Model-based program debugging and repair. In: Proceedings of the International Conference on Industrial and Engineering Application of Artificial Intelligence and Expert SystemsGoogle Scholar
  49. 49.
    Wang F, Cheng CH (2008) Program repair suggestions from graphical state-transition specifications. In: Proceedings of the International conference on Formal Techniques for Networked and Distributed Systems, pp 185–200Google Scholar
  50. 50.
    Johnson CG (2007) Genetic programming with fitness based on model checking. In: EuroGP 2007, LNCS, vol 4445. Springer, pp 114--124Google Scholar
  51. 51.
    Katz G, Peled D (2008) Genetic programming and model checking: Synthesizing new mutual exclusion algorithms. In: ATVA, Vol. 5311 of LNCS, pp 33–47Google Scholar
  52. 52.
    Katz G, Peled D (2008) Model checking-based genetic programming with an application to mutual exclusion. In: TACAS, Vol. 4963 of LNCS, pp 141–156Google Scholar
  53. 53.
    Katz G, Peled D (2010) Code mutation in verification and automatic code correction. In: TACAS, Lecture Notes in Computer Science, vol 6051. Springer, pp 435--450Google Scholar
  54. 54.
    Koza JR (1992) Genetic programming On the programming of computers by means of natural selection. MIT Press, Cambridge MAzbMATHGoogle Scholar
  55. 55.
    McKay B, Willis MJ, Barton G.W (1995) Using a tree structured genetic algorithm to perform symbolic regression. In: First International Conference on Genetic Algorithms in Engineering Systems: Innovations and Applications, Sheffield, UK, pp 487--492Google Scholar
  56. 56.
    Chellapilla K (1998) A preliminary investigation into evolving modular programs without subtree crossover. In: genetic programming proceedings of the third annual conference, vol 1998. Morgan Kaufmann, Wisconsin, pp 22–25Google Scholar
  57. 57.
    Riccardo P, McPhe N, Vanneschi L (2008) Elitism reduces bloat in genetic programming. In: Genetic and Evolutionary Computation Conference (GECCO)Google Scholar
  58. 58.
    Penix J, Visser W, Engstrom E, Larson A, Weininger N (2000) Verification of Time Partitioning in the DEOS Scheduler Kernel. In: Proceedings of the 22nd International Conference on Software Engineering (ICSE), Limeric, IrelandGoogle Scholar
  59. 59.
    Brat G, Giannakopoulou D, Goldberg A, Havelund K, Lowry M, Pasareanu C, Venet A, Visser W, Washington R (2003) Experimental evaluation of verification and validation tools on martian rover software. In: Proceedings of the SEI/CM Software Model Checking Workshop, PittsburghGoogle Scholar
  60. 60.
    Raynal M (1986) Algorithms for mutual exclusion. MIT PressGoogle Scholar
  61. 61.
    Britton T, Jeng L, Carver G, Cheak P, Katzenellenbogen T (2013) Reversible debugging software. Technical Report, University of Cambridge Judge Business SchoolGoogle Scholar
  62. 62.
    Clarke EM, Grumberg O, Peled D (1999) Model checking. MIT PressGoogle Scholar
  63. 63.
    Arcuri A (2011) Evolutionary repair of faulty software. Appl Soft Comput 11(4):3494–3514CrossRefGoogle Scholar
  64. 64.
    Weimer W (2013) Advances in automated program repair and a call to arms. In: The 5th International Symposium on Search Based Software Engineering (SSBSE), St. Petersburg, Russia, pp 1–3Google Scholar
  65. 65.
    Barnes JGP (2003) High integrity software: the spark approach to safety and security: sample chapters. Pearson EducationGoogle Scholar
  66. 66.
    De Moura L, Bjørner N (2008) Z3: An efficient SMT solver. In: Tools and Algorithms for the Construction and Analysis of Systems. Springer Berlin Heidelberg, pp 337–340Google Scholar
  67. 67.
    Flanagan C, Leino KRM, Lillibridge M, Nelson G, Saxe JB, Stata R (2002) Extended static checking for Java. In: Programming Language Design and Implementation, pp 234–245Google Scholar
  68. 68.
    Weimer W (2006) Patches as better bug reports. In: Proceedings of the 5th international conference on Generative programming and component engineering. ACM, pp 181–190Google Scholar
  69. 69.
    Myers GJ, Sandler C, Badgett T (2011) The art of software testing. WileyGoogle Scholar
  70. 70.
    Penix J (2012) Large-scale test automation in the cloud (invited industrial talk). In: 2012 34th International Conference on Software Engineering (ICSE). IEEE, pp 1122–1122Google Scholar
  71. 71.
    Smith EK, Barr ET, Le Goues C, Brun Y (2015) Is the cure worse than the disease? overfitting in automated program repair. In: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. ACM, pp 532–543Google Scholar
  72. 72.
    Le Goues C, Weimer W, Forrest S (2012) Representations and operators for improving evolutionary software repair. In: Proceedings of the 14th annual conference on Genetic and evolutionary computation. ACM, pp 959–966Google Scholar
  73. 73.
    Pei YU, Furia C, Nordio M, Yi Wei, Meyer B, Zeller A (2014) Automated fixing of programs with contracts. IEEE Trans Softw Eng 40(5):427–449CrossRefGoogle Scholar
  74. 74.
    Le Goues C, Holtschulte N, Smith E, Brun Y, Devanbu P, Forrest S, Weimer W (2015) The ManyBugs and IntroClass benchmarks for automated repair of C programs. IEEE Transactions on Software Engineering, In PressGoogle Scholar
  75. 75.
    Schulte E, DiLorenzo J, Weimer W, Forrest S (2013) Automated repair of binary and assembly programs for cooperating embedded devices. ACM SIGARCH Comput Archit News 41(1):317–328Google Scholar
  76. 76.
    Le G, Claire SF, Weimer W (2013) Current challenges in automatic software repair. Softw Qual J 21 (3):421–443CrossRefGoogle Scholar
  77. 77.
    Harman M (2010) Automated patching techniques: the fix is in: technical perspective. Commun ACM 53 (5):108–108CrossRefGoogle Scholar
  78. 78.
    Qi Y, Mao X, Lei Y (2013) Efficient automated program repair through fault-recorded testing prioritization. In: 2013 IEEE International Conference on Software Maintenance. IEEE, pp 180–189Google Scholar

Copyright information

© Springer Science+Business Media New York 2016

Authors and Affiliations

  • Zahra Zojaji
    • 1
  • Behrouz Tork Ladani
    • 1
  • Alireza Khalilian
    • 1
    Email author
  1. 1.Department of Software EngineeringUniversity of IsfahanIsfahanIran

Personalised recommendations