Proving completeness of logic programs with the cut

Abstract

Completeness of a logic program means that the program produces all the answers required by its specification. The cut is an important construct of programming language Prolog. It prunes part of the search space, this may result in a loss of completeness. This paper proposes a way of proving completeness of programs with the cut. The semantics of the cut is formalized by describing how SLD-trees are pruned. A sufficient condition for completeness is presented, proved sound, and illustrated by examples.

This is a preview of subscription content, log in to check access.

References

  1. And03

    Andrews JH (2003) The witness properties and the semantics of the Prolog cut. TPLP 3(1): 1–59

    MathSciNet  MATH  Google Scholar 

  2. AP93

    Apt KR, Pedreschi D (1993) Reasoning about termination of pure Prolog programs. Inf Comput 106(1): 109–157

    MathSciNet  Article  MATH  Google Scholar 

  3. Apt97

    Apt KR (1997) From logic programming to Prolog. International Series in Computer Science. Prentice Hall Europe, Hemel Hempstead, Hertfordshire

  4. BC89

    Bossi A, Cocco N (1989) Verifying correctness of logic programs. In: Díaz J, Orejas F (eds) TAPSOFT, Vol.2, Lecture Notes in Computer Science, vol 352.. Springer, Berlin Heidelberg, pp 96–110

    Google Scholar 

  5. Bez93

    Bezem M (1993) Strong termination of logic programs. J Log Program 15(1&2): 79–97

    MathSciNet  Article  MATH  Google Scholar 

  6. Bil90

    Billaud M (1990) Simple operational and denotational semantics for Prolog with cut. Theor Comput Sci 71(2): 193–208

    MathSciNet  Article  MATH  Google Scholar 

  7. Cla79

    Clark KL (1979) Predicate logic as computational formalism. Technical Report 79/59, Imperial College, London

  8. Der93

    Deransart P (1993) Proof methods of declarative properties of definite programs. Theor Comput Sci 118(2): 99–166

    MathSciNet  Article  MATH  Google Scholar 

  9. DM88

    Drabent W, Małuszyński J (1988) Inductive assertion method for logic programs. Theor Comput Sci 59: 133–155

    MathSciNet  Article  MATH  Google Scholar 

  10. DM93

    Deransart P, Małuszyński J (1993) A Grammatical view of logic programming. The MIT Press, Cambridge, Massachusetts, London, England

    Google Scholar 

  11. DM05

    Drabent W, Miłkowska M (2005) Proving correctness and completeness of normal programs – a declarative approach. TPLP 5(6): 669–711

    MathSciNet  MATH  Google Scholar 

  12. Doe94

    Doets K (1994) From logic to logic programming. The MIT Press, Cambridge

    Google Scholar 

  13. Dra15

    Drabent W (2015) On completeness of logic programs. In: Logic based program synthesis and transformation, LOPSTR 2014. Revised Selected Papers, Lecture Notes in Computer Science, vol 8981. Springer, Berlin. Extended version in CoRR (2014). arXiv:1411.3015.

  14. Dra16a

    Drabent W (2016) Correctness and completeness of logic programs. ACM Trans Comput Log 17(3): 18–11832

    MathSciNet  Article  Google Scholar 

  15. Dra16b

    Drabent W (2016) On definite program answers and least Herbrand models. TPLP 16(4): 498–508

    MathSciNet  Google Scholar 

  16. dV89

    de Vink EP (1989) Comparative semantics for PROLOG with cut. Sci Comput Program 13(1): 237–264

    MathSciNet  MATH  Google Scholar 

  17. KK14

    Kriener J, King A (2014) Semantics for Prolog with cut-revisited. In: Codish M, Sumii E (eds) Functional and Logic Programming—12th International Symposium, FLOPS 2014, Kanazawa, Japan, June 4–6, 2014. Proceedings, Lecture Notes in Computer Science, vol 8475. Springer, Berlin, pp 270–284

  18. Llo87

    Lloyd JW, (1987) Foundations of logic programming. Second, extended edition. Springer, Berlin

  19. Mah88

    Maher MJ (1988) Equivalences of logic programs. In: Minker J (ed) Foundations of deductive databases and logic programming. Morgan Kaufmann, Los Altos, California, pp 627–658

  20. NM95

    Nilsson U, Małuszyński J (1995) Logic, programming and Prolog (2ed). Wiley, Chichester, West Sussex, England. http://www.ida.liu.se/~ulfni/lpp/.

  21. SGS+10

    Schneider-Kamp P, Giesl J, Ströder T, Serebrenik A, Thiemann R (2010) Automated termination analysis for logic programs with cut. TPLP 10(4-6): 365–381

    MathSciNet  MATH  Google Scholar 

  22. Sha83

    Shapiro E (1983) Algorithmic program debugging. The MIT Press, Cambridge, Massachusetts, London, England

    Google Scholar 

  23. Spo00

    Spoto F (2000) Operational and goal-independent denotational semantics for Prolog with cut. J Log Program 42(1): 1–46

    MathSciNet  Article  MATH  Google Scholar 

  24. SS94

    Sterling L, Shapiro E (1994) The art of Prolog, 2nd edn. The MIT Press, Cambridge, Massachusetts, London, England

    Google Scholar 

Download references

Author information

Affiliations

Authors

Corresponding author

Correspondence to Włodzimierz Drabent.

Additional information

Maurizio Proietti, Hirohisa Seki, and Jim Woodcock

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Drabent, W. Proving completeness of logic programs with the cut. Form Asp Comp 29, 155–172 (2017). https://doi.org/10.1007/s00165-016-0392-0

Download citation

Keywords

  • Logic programming
  • The cut
  • Operational semantics
  • Program completeness
  • Program correctness