Journal of Automated Reasoning

, Volume 19, Issue 3, pp 277–318 | Cite as

A New Technique for Verifying and Correcting Logic Programs

  • Ricardo Caferra
  • Nicolas Peltier


A significant extension to a model-building method that we have beendeveloping for several years is presented. A quite complete, albeitreasonably short, description of the previous method is given in order tomake this article self-contained. The extension enables the handling ofPresburger arithmetic and the deducing of inductive consequences from setsof Horn clauses. For a large class of logic programs the extension alsopermits the deduction of negative facts and the detection of nontermination.It is shown how the extended method can be used in verifying and correctingprograms. The proposed method verifies programs w.r.t. formalspecifications, but its fundamentals (i.e., model building) make it usefulfor pointing out errors and for suggesting a way of correcting wrongprograms also w.r.t. informal specifications, such as specifications byexamples or specifications using implicit knowledge (the latter features areespecially useful when dealing with beginners’ programs). Theoreticalproperties of the extended method (e.g., soundness and refutationalcompleteness) are proven. The greater power of the extensions to logicprogramming enabled by our method relative to existing methods and withrespect to other standard features (like negation as failure) is alsoproven. Several nontrivial examples illustrate error detection andcorrection as well as the broadening of inference capabilities that can beobtained in logic programming by using the rules of this method. Thesedetailed examples show evidence of the interest of our approach. Maindirections for future research are given.

model building logic programming program verification 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Krzystof, R. Apt and Roland, N. Bol.: Logic programming and negation: A survey, J. Logic Programming 19, 20(1994), 9–71.Google Scholar
  2. 2.
    Bourely, Ch., Caferra, R. and Peltier, N.: A method for building models automatically. Experiments with an extension of OTTER, in Proc. CADE-12, LNAI 814, Springer, 1994, pp. 72–86.Google Scholar
  3. 3.
    Bourely, Ch. And Peltier, N.: Disc_atinf: a system for implementing strategies and calculi, in Proc. DISCO’96.Springer, 1996. To appear.Google Scholar
  4. 4.
    Caferra, R. and Peltier, N.: Extending semantic resolution via automated model building: applications, in Proc. IJCAI’95, Morgan Kaufmann, 1995, pp. 328–334.Google Scholar
  5. 5.
    Caferra, R. and Peltier, N.: Model building and interactive theory discovery, in Proc. Tableaux’95, LNAI 918, Springer, 1995, pages 154–168.Google Scholar
  6. 6.
    Caferra, R. and Peltier, N.: Decision procedures using model building techniques, in Proc. Computer Science Logic, CSL’95, LNCS 1092, Springer, 1996, pp. 130–144.Google Scholar
  7. 7.
    Caferra, R. and Peltier, N.: A significant extension of logic programming by adapting model buildings rules, in Proc. Extensions of Logic Programming 96, LNAI 1050, Springer, March 1996, pp. 51–65.Google Scholar
  8. 8.
    Caferra, R. and Zabel, N.:. Extending resolution for model construction, in Logics in AI, JELIA’90, LNAI 478, Springer, 1990, pp. 153–169.Google Scholar
  9. 9.
    Caferra, R. and Zabel, N.: A method for simultaneous search for refutations and models by equational constraint solving, J. Symbolic Computation 13(1992), 613–641.Google Scholar
  10. 10.
    Caferra, R. and Zabel, N.: Building models by using tableaux extended by equational problems, J. Logic and Computation 3(1993), 3–25.Google Scholar
  11. 11.
    Clark, K. L.: Negation as failure, in Hervé Gallaire and Jack Minker (eds), Logic and Data Bases, Plenum Press, 1978, pp. 293–322.Google Scholar
  12. 12.
    Clark, K. L. and Tarnlund, S.-A.: A first order theory of data and programs, in Proc. of IFIP-77, North-Holland, 1977, pp. 939–944.Google Scholar
  13. 13.
    Comon, H. and Lescanne, P.: Equational problems and disunification, J. Symbolic Computation 7(1989), 371–475.Google Scholar
  14. 14.
    Cooper, D. C.: Theorem proving in arithmetic without multiplication, in Bernard Meltzer and Donald Michie (eds), Machine Intelligence 7, Ch. 5, Edinburgh University Press, 1972, pp. 91–99.Google Scholar
  15. 15.
    Davis, M.: A computer program for Presburger arithmetic, in J. Siekmann and G. Wrighston (eds), Automation of Reasoning 1, Springer, 1983, pp. 41–48.Google Scholar
  16. 16.
    Deville, Y. Lau, K-K.: Logic program synthesis, J. Logic Programming 19(20) (1994), 321–350.Google Scholar
  17. 17.
    Enderton, H.: A Mathematical Introduction to Logic, Academic Press, 1972.Google Scholar
  18. 18.
    Fermüller, Ch, and Leitsch, A.: Hyperresolution and automated model building, J. Logic and Computation(1996), to appear.Google Scholar
  19. 19.
    Fermüller, Ch, Leitsch, A., Tamet, T. and Zamov, N.: Resolution Methods for the Decision Problem, LNAI 679. Springer, 1993.Google Scholar
  20. 20.
    Flener, P.: Logic Program Synthesis from Incomplete Information, Kluwer Academic Publishers, 1995.Google Scholar
  21. 21.
    Fujita, M., Slaney, J. and Bennett, F.: Automatic generation of some results in finite algebra, in Proc. IJCAI93, Morgan Kaufmann, 1993.Google Scholar
  22. 22.
    Gottlob, G. and Leitsch, A.: On the efficiency of subsumption algorithms, J. ACM 32(2) (1985), 280–295.Google Scholar
  23. 23.
    Hogger, C. J.: Derivation of logic programs, J. ACM 28(1981), 372–422.Google Scholar
  24. 24.
    Hogger, Ch. J.: Introduction to Logic Programming, Academic Press, 1984.Google Scholar
  25. 25.
    Huntbach, M. M.: An improved version of Shapiro’s model inference system, in Proc. Third Int. Conf. on Logic Programming, LNCS 225, Springer, 1986, pp. 180–187.Google Scholar
  26. 26.
    Kawamura, T.: Logic program synthesis from first order logic specification, Theor. Computer Science 122(1994), 69–96.Google Scholar
  27. 27.
    Kowalski, R.: The relation between logic programming and logic specification, in C. A. R. Hoare and J. C. Shepherdson (eds), Mathematical Logic and Programming Languages, Prentice-Hall, 1985, pp. 11–27.Google Scholar
  28. 28.
    Kunen, K.: Negation in logic programming, J. Logic Programming 8(1987), 289–308.Google Scholar
  29. 29.
    Lloyd, J. W.: Foundations of Logic Programming, second edition, Springer, 1987.Google Scholar
  30. 30.
    Lloyd, J. W.: Declarative error diagnosis, New Generation Computing 5(1987), 133–154.Google Scholar
  31. 31.
    Loveland, D. W.: Automated Theorem Proving: A Logical Basis, Fundamental Studies in Computer Science, Vol. 6, North Holland, 1978.Google Scholar
  32. 32.
    Lloyd, J. W. and Topor, R. W.: Making prolog more expressive. J. Logic Programming 1(3) (1984), 225–240.Google Scholar
  33. 33.
    Lugiez, D.: A deduction procedure for first order programs, in F. Levi and M. Martelli (eds), Proc. Sixth Int. Conf. Logic Programming, The MIT Press, July 1989, pp. 585–599.Google Scholar
  34. 34.
    Mal’cev, A. I.: The Metamathematics of Algebraic Systems: Collected Papers 1936–1967, chapter Axiomatizable classes of locally free algebra of various type, Benjamin Franklin Wells III (ed.), Ch. 23, North Holland, 1971.Google Scholar
  35. 35.
    Manthey, R. and Bry, F.: SATCHMO: A theorem prover implemented in Prolog, in Proc. CADE-9, LNCS 310, Springer, 1988, pp. 415–434.Google Scholar
  36. 36.
    McCune, W. W.: OTTER 2.0 Users Guide, Argonne National Laboratory, 1990.Google Scholar
  37. 37.
    Peltier, N.: Increasing the capabilities of model building by constraint solving with terms with integer exponents, 1997, preprint.Google Scholar
  38. 38.
    Pereira, L-M.: Rational debugging in logic programming, in Proc. Third Int. Conf. Logic Programming, LNCS 225, Springer, 1986, pp. 203–210.Google Scholar
  39. 39.
    Plaisted, D. A.: An efficient bug location algorithm, in Proc. Second Int. Logic Programming Conference, 1984, pp. 151–157.Google Scholar
  40. 40.
    Plaisted, D. A.: Non-Horn clause logic programming without contrapositives, J. Automated Reasoning 4(3) (1988), 287–325.Google Scholar
  41. 41.
    Presburger, M.: Über die Vollständigkeit eines gewissen Systems der Arithmetik ganzer Zahlen, in welchen die Addition als einzige Operation hervortritt, in Comptes Rendus du I Congrés de Mathématiciens des Pays Slaves, 1029, pp. 92–101.Google Scholar
  42. 42.
    Shapiro, E. Y.: Algorithmic Program Debugging, MIT Press, 1983.Google Scholar
  43. 43.
    Sterling, L. and Shapiro, E.: The Art of Prolog, The MIT Press, 1986.Google Scholar
  44. 44.
    Sato, T. and Tamaki, H.: First order compiler: A deterministic logic program synthesis algorithm, J. Symbolic Computation 8(1988), 605–627.Google Scholar
  45. 45.
    Stickel, M. E.: Automated deduction by theory resolution, J. Automated Reasoning 1(4) (1985), 333–355.Google Scholar
  46. 46.
    Stuckey, P.: Negation and constraint logic programming, Information and Computation 118(1995), 12–33.Google Scholar
  47. 47.
    Warren, D. S.: Memoing for logic programs, Comm. ACM 35(3) (1992), 93–111.Google Scholar
  48. 48.
    Winker, S.: Generation and verification of finite models and counter-examples using an automated theorem prover answering two open questions, J. ACM 29(2) (1982), 273–284.Google Scholar
  49. 49.
    Wos, L., Overbeek, R., Lusk, E. and Boyle, J.: Automated Reasoning: Introduction and Applications, second edition, McGraw-Hill, 1992.Google Scholar
  50. 50.
    Wos, L.: The kernel strategy and its use for the study of combinatory logic, J. Automated Reasoning 10(1993), 287–343.Google Scholar

Copyright information

© Kluwer Academic Publishers 1997

Authors and Affiliations

  • Ricardo Caferra
    • 1
  • Nicolas Peltier
    • 1
  1. 1.Leibniz LaboratoryGrenoble CedexFrance

Personalised recommendations