Formal Aspects of Computing

, Volume 29, Issue 1, pp 155–172 | Cite as

Proving completeness of logic programs with the cut

  • Włodzimierz DrabentEmail author
Original Article


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.


Logic programming The cut Operational semantics Program completeness Program correctness 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. And03.
    Andrews JH (2003) The witness properties and the semantics of the Prolog cut. TPLP 3(1): 1–59MathSciNetzbMATHGoogle Scholar
  2. AP93.
    Apt KR, Pedreschi D (1993) Reasoning about termination of pure Prolog programs. Inf Comput 106(1): 109–157MathSciNetCrossRefzbMATHGoogle Scholar
  3. Apt97.
    Apt KR (1997) From logic programming to Prolog. International Series in Computer Science. Prentice Hall Europe, Hemel Hempstead, HertfordshireGoogle Scholar
  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–110Google Scholar
  5. Bez93.
    Bezem M (1993) Strong termination of logic programs. J Log Program 15(1&2): 79–97MathSciNetCrossRefzbMATHGoogle Scholar
  6. Bil90.
    Billaud M (1990) Simple operational and denotational semantics for Prolog with cut. Theor Comput Sci 71(2): 193–208MathSciNetCrossRefzbMATHGoogle Scholar
  7. Cla79.
    Clark KL (1979) Predicate logic as computational formalism. Technical Report 79/59, Imperial College, LondonGoogle Scholar
  8. Der93.
    Deransart P (1993) Proof methods of declarative properties of definite programs. Theor Comput Sci 118(2): 99–166MathSciNetCrossRefzbMATHGoogle Scholar
  9. DM88.
    Drabent W, Małuszyński J (1988) Inductive assertion method for logic programs. Theor Comput Sci 59: 133–155MathSciNetCrossRefzbMATHGoogle Scholar
  10. DM93.
    Deransart P, Małuszyński J (1993) A Grammatical view of logic programming. The MIT Press, Cambridge, Massachusetts, London, EnglandzbMATHGoogle Scholar
  11. DM05.
    Drabent W, Miłkowska M (2005) Proving correctness and completeness of normal programs – a declarative approach. TPLP 5(6): 669–711MathSciNetzbMATHGoogle Scholar
  12. Doe94.
    Doets K (1994) From logic to logic programming. The MIT Press, CambridgezbMATHGoogle 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–11832MathSciNetCrossRefGoogle Scholar
  15. Dra16b.
    Drabent W (2016) On definite program answers and least Herbrand models. TPLP 16(4): 498–508MathSciNetGoogle Scholar
  16. dV89.
    de Vink EP (1989) Comparative semantics for PROLOG with cut. Sci Comput Program 13(1): 237–264MathSciNetzbMATHGoogle 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–284Google Scholar
  18. Llo87.
    Lloyd JW, (1987) Foundations of logic programming. Second, extended edition. Springer, BerlinGoogle Scholar
  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–658Google Scholar
  20. NM95.
    Nilsson U, Małuszyński J (1995) Logic, programming and Prolog (2ed). Wiley, Chichester, West Sussex, England.
  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–381MathSciNetzbMATHGoogle Scholar
  22. Sha83.
    Shapiro E (1983) Algorithmic program debugging. The MIT Press, Cambridge, Massachusetts, London, EnglandzbMATHGoogle Scholar
  23. Spo00.
    Spoto F (2000) Operational and goal-independent denotational semantics for Prolog with cut. J Log Program 42(1): 1–46MathSciNetCrossRefzbMATHGoogle Scholar
  24. SS94.
    Sterling L, Shapiro E (1994) The art of Prolog, 2nd edn. The MIT Press, Cambridge, Massachusetts, London, EnglandzbMATHGoogle Scholar

Copyright information

© British Computer Society 2016

Authors and Affiliations

  1. 1.Institute of Computer SciencePolish Academy of SciencesWarsawPoland
  2. 2.Linköping UniversityLinköpingSweden

Personalised recommendations