Qlose: Program Repair with Quantitative Objectives

  • Loris D’Antoni
  • Roopsha SamantaEmail author
  • Rishabh Singh
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9780)


The goal of automatic program repair is to identify a set of syntactic changes that can turn a program that is incorrect with respect to a given specification into a correct one. Existing program repair techniques typically aim to find any program that meets the given specification. Such “best-effort” strategies can end up generating a program that is quite different from the original one. Novel techniques have been proposed to compute syntactically minimal program fixes, but the smallest syntactic fix to a program can still significantly alter the original program’s behaviour. We propose a new approach to program repair based on program distances, which can quantify changes not only to the program syntax but also to the program semantics. We call this the quantitative program repair problem where the “optimal” repair is derived using multiple distances. We implement a solution to the quantitative repair problem in a prototype tool called Qlose (Quantitatively close), using the program synthesizer Sketch. We evaluate the effectiveness of different distances in obtaining desirable repairs by evaluating Qlose on programs taken from educational tools such as CodeHunt and edX.


Repair Program Execution Distance Syntactic Distance Semantic Distance Student Solutions 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



The authors would like to thank the anonymous reviewers for their insightful feedback. Roopsha Samanta would like to thank Krishnendu Chatterjee and Tom Henzinger for inspiring discussions on quantitative repair for reactive systems.


  1. 1.
    Alur, R., D’Antoni, L., Gulwani, S., Kini, D., Viswanathan, M.: Automated grading of dfa constructions. In: Proceedings of the Twenty-Third International Joint Conference on Artificial Intelligence, IJCAI 2013, pp. 1976–1982. AAAI Press (2013)Google Scholar
  2. 2.
    Arcuri, A.: On the automation of fixing software bugs. In: International Conference on Software Engineering (ICSE), pp. 1003–1006. ACM (2008)Google Scholar
  3. 3.
    Ball, T., Naik, M., Rajamani, S.K.: From symptom to cause: localizing errors in counterexample traces. In: Principles of Programming Languages (POPL), pp. 97–105. ACM (2003)Google Scholar
  4. 4.
    Cerný, P., Henzinger, T.A.: From Boolean to quantitative synthesis. In: Proceedings of the 11th International Conference on Embedded Software (EMSOFT), pp. 149–154 (2011)Google Scholar
  5. 5.
    Cerný, P., Henzinger, T.A., Radhakrishna, A.: Simulation distances. Theor. Comput. Sci. 413(1), 21–35 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Chandra, S., Torlak, E., Barman, S., Bodik, R.: Angelic debugging. In: International Conference on Software Engineering (ICSE), pp. 121–130. ACM (2011)Google Scholar
  7. 7.
    Debroy, V., Wong, W.E.: Using mutation to automatically suggest fixes for faulty programs. In: Software Testing, Verification and Validation (ICST), pp. 65–74 (2010)Google Scholar
  8. 8.
    Goues, C.L., Dewey-Vogt, M., Forrest, S., Weimer, W.: A systematic study of automated program repair: fixing 55 out of 105 bugs for $8 each. In: International Conference on Software Engineering (ICSE), pp. 3–13. IEEE Press (2012)Google Scholar
  9. 9.
    Griesmayer, A., Bloem, R., Cook, B.: Repair of Boolean programs with an application to C. In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 358–371. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  10. 10.
    Gulwani, S., Korthikanti, V.A., Tiwari, A.: Synthesizing geometry constructions. SIGPLAN Not. 46(6), 50–61 (2011)CrossRefGoogle Scholar
  11. 11.
    Henzinger, T.A., Otop, J.: From model checking to model measuring. In: D’Argenio, P.R., Melgratti, H. (eds.) CONCUR 2013 – Concurrency Theory. LNCS, vol. 8052, pp. 273–287. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  12. 12.
    Hindle, A., Barr, E.T., Su, Z., Gabel, M., Devanbu, P.: On the naturalness of software. In: Proceedings of the 34th International Conference on Software Engineering, Piscataway, NJ, USA, ICSE 2012, pp. 837–847. IEEE Press (2012)Google Scholar
  13. 13.
    Itzhaky, S., Gulwani, S., Immerman, N., Sagiv, M.: Solving geometry problems using a combination of symbolic and numerical reasoning. In: McMillan, K., Middeldorp, A., Voronkov, A. (eds.) LPAR-19 2013. LNCS, vol. 8312, pp. 457–472. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  14. 14.
    Jobstmann, B., Griesmayer, A., Bloem, R.: Program repair as a game. In: Etessami, K., Rajamani, S.K. (eds.) CAV 2005. LNCS, vol. 3576, pp. 226–238. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  15. 15.
    Jose, M., Majumdar, R.: Cause clue clauses: error localization using maximum satisfiability. In: Programming Language Design and Implementation (PLDI), pp. 437–446. ACM (2011)Google Scholar
  16. 16.
    Könighofer, R., Bloem, R.: Automated error localization and correction for imperative programs. In: Formal Methods in Computer Aided Design (FMCAD), pp. 91–100 (2011)Google Scholar
  17. 17.
    Lahiri, S.K., Sinha, R., Hawblitzel, C.: Automatic rootcausing for program equivalence failures in binaries. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 362–379. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  18. 18.
    Logozzo, F., Ball, T.: Modular and verified automatic program repair. In: Object Oriented Programming Systems Languages and Applications (OOPSLA), pp. 133–146. ACM (2012)Google Scholar
  19. 19.
    Mechtaev, S., Yi, J., Roychoudhury, A.: Directfix: looking for simple program repairs. In: Proceedings of the 37th International Conference on Software Engineering, Piscataway, NJ, USA, ICSE 2015, vol. 1, pp. 448–458. IEEE Press (2015)Google Scholar
  20. 20.
    Nguyen, H.D.T., Qi, D., Roychoudhury, A., Chandra, S.: Semfix: program repair via semantic analysis. In: Proceedings of the 2013 International Conference on Software Engineering, Piscataway, NJ, USA, ICSE 2013, pp. 772–781. IEEE Press (2013)Google Scholar
  21. 21.
    Partush, N., Yahav, E.: Abstract semantic differencing via speculative correlation. In: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2014, part of SPLASH 2014, Portland, OR, USA, 20–24 October 2014, pp. 811–828 (2014)Google Scholar
  22. 22.
    Samanta, R., Deshmukh, J.V., Emerson, E.A.: Automatic generation of local repairs for Boolean programs. In: Formal Methods in Computer Aided Design (FMCAD), pp. 1–10 (2008)Google Scholar
  23. 23.
    Samanta, R., Olivo, O., Emerson, E.A.: Cost-aware automatic program repair. In: Müller-Olm, M., Seidl, H. (eds.) Static Analysis. LNCS, vol. 8723, pp. 268–284. Springer, Heidelberg (2014)Google Scholar
  24. 24.
    Singh, R., Gulwani, S., Solar-Lezama, A.: Automatic feedback generation for introductory programming assignments. In: Proceedings of Programming Language Design and Implementation (PLDI), pp. 15–26 (2013)Google Scholar
  25. 25.
    Singh, R., Solar-Lezma, A.: Synthesizing data-structure manipulations from storyboards. In: Foundations of Software Engineering (FSE), pp. 289–299 (2011)Google Scholar
  26. 26.
    Solar-Lezama, A.: Program sketching. STTT 15(5–6), 475–495 (2013)CrossRefGoogle Scholar
  27. 27.
    Solar-Lezama, A., Tancau, L., Bodik, R., Seshia, S., Saraswat, V.: Combinatorial sketching for finite programs. In: Architectural Support for Programming Languages and Operating Systems (ASPLOS), pp. 404–415. ACM (2006)Google Scholar
  28. 28.
    Srivastava, S., Gulwani, S., Foster, J.S.: From program verification to program synthesis. In: Principles of Programming Languages (POPL), pp. 313–326. ACM (2010)Google Scholar
  29. 29.
    Tillmann, N., de Halleux, J., Xie, T., Bishop, J.: Code hunt: gamifying teaching and learning of computer science at scale. In: Proceedings of the First ACM Conference on Learning @ Scale Conference, New York, NY, USA, L@S 2014, pp. 221–222. ACM (2014)Google Scholar
  30. 30.
    von Essen, C., Jobstmann, B.: Program repair without regret. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 896–911. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  31. 31.
    Wei, Y., Pei, Y., Furia, C.A., Silva, L.S., Buchholz, S., Meyer, B., Zeller, A.: Automated fixing of programs with contracts. In: International Symposium on Software Testing and Analysis (ISSTA), pp. 61–72. ACM (2010)Google Scholar
  32. 32.
    Nokhbeh Zaeem, R., Gopinath, D., Khurshid, S., McKinley, K.S.: History-aware data structure repair using SAT. In: Flanagan, C., König, B. (eds.) TACAS 2012. LNCS, vol. 7214, pp. 2–17. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  33. 33.
    Zeller, A., Hilebrandt, R.: Simplifying and isolating failure-inducing input. IEEE Trans. Softw. Eng. 28(2), 183–200 (2002)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • Loris D’Antoni
    • 1
  • Roopsha Samanta
    • 2
    Email author
  • Rishabh Singh
    • 3
  1. 1.University of Wisconsin-MadisonMadisonUSA
  2. 2.IST AustriaKlosterneuburgAustria
  3. 3.Microsoft ResearchRedmondUSA

Personalised recommendations