Skip to main content

Abstract

This chapter presents the family of logic programming languages in which computation is viewed as deduction in a logical formalism. We first present the foundation of logic programming with Horn clauses illustrated by the Prolog language. From this first concept are born numerous extensions; here we describe two of them in details: constraint logic programming which allows a more elegant treatment of domains other than finite terms and Answer Set Programming which gives a better treatment of negation and appears to be an effective implementation of non-monotonic reasoning.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 149.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 199.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    To be precise, logic programming refers more to programming in logic as many programming activities require the use of logic.

  2. 2.

    Predicate is

  3. 3.

    However, this program does not terminate if it is called with an invalid second argument, like fib(N,4) because it will try to generate increasing values for F1 and F2. It is simple to correct it by noticing that in fib(N,F), we have \(F \ge N\).

  4. 4.

    see http://www.kr.tuwien.ac.at/staff/tkren/deb.html, http://assat.cs.ust.hk/ and http://www.cs.utexas.edu/users/tag/cmodels.html.

  5. 5.

    http://aspcomp2015.dibris.unige.it [Sixth Answer Set Programming Competition] and http://aspcomp2017.dibris.unige.it/ [Seventh Answer Set Programming Competition].

References

  • Arish J, Carro M (2015) Towards a generic interface to integrate CLP and tabled execution (extended abstract). In: Vos MD, Eiter T, Lierler Y, Toni F (eds) Proceedings of the technical communications of the 31st international conference on logic programming (ICLP 2015), Cork, Ireland, 31 August– 4 Sept 2015. CEUR workshop proceedings, vol 1433. http://CEUR-WS.org

  • Baral C (2003) Knowledge representation, reasoning and declarative problem solving. Cambridge University Press, Cambridge

    Book  MATH  Google Scholar 

  • Bauters K, Schockaert S, Cock MD, Vermeir D (2014) Semantics for possibilistic answer set programs: uncertain rules versus rules with uncertain conclusions. Int J Approx Reason 55(2):739–761

    Article  MathSciNet  MATH  Google Scholar 

  • Bauters K, Schockaert S, Cock MD, Vermeir D (2015) Characterizing and extending answer set semantics using possibility theory. Theory Pract Log Program 15(1):79–116

    Article  MathSciNet  MATH  Google Scholar 

  • Benferhat S, Ben-Naim J, Papini O, Würbel É (2010) An answer set programming encoding of prioritized removed sets revision: application to GIS. Appl Intell 32(1):60–87

    Article  MATH  Google Scholar 

  • Benhamou F, Bouvier P, Colmerauer A, Garreta H, Gilleta B, Massat J-L, Narboni G-A, N’Dong S, Pasero R, Pique J-F, Touravane Caneghem MV, Vtillard E, Zhou J (1996) Le manuel de Prolog IV, Prologia

    Google Scholar 

  • Bistarelli S, Montanari U, Rossi F (2001) Semiring-based constraint logic programming: syntax and semantics. ACM Trans Program Lang Syst 23(1):1–29

    Article  Google Scholar 

  • Blondeel M, Schockaert S, Vermeir D, Cock MD (2013) In: Yager R, Abbasov A, Reformat M, Shahbazova S (eds) Soft computing: state of the art theory and novel applications. Springer, Berlin, pp 209–222

    Chapter  Google Scholar 

  • Blondeel M, Schockaert S, Vermeir D, Cock MD (2014) Complexity of fuzzy answer set programming under łukasiewicz semantics. Int J Approx Reason 55(9):1971–2003

    Article  MATH  Google Scholar 

  • Brewka G (2004) Complex preferences for answer set optimization. In: Principles of knowledge representation and reasoning: proceedings of the ninth international conference (KR2004), Whistler, Canada, 2–5 June 2004, pp 213–223

    Google Scholar 

  • Brewka G, Delgrande JP, Romero J, Schaub T (2015) asprin: customizing answer set preferences without a headache. In: Proceedings of the twenty-ninth AAAI conference on artificial intelligence, 25–30 January 2015, Austin, Texas, USA, pp 1467–1474

    Google Scholar 

  • Brewka G, Niemelä I, Syrjänen T (2004) Logic programs with ordered disjunction. Comput Intell 20(2):333–357

    Article  MathSciNet  MATH  Google Scholar 

  • Cabalar P, Ferraris P (2007) Propositional theories are strongly equivalent to logic programs. Theory Pract Log Program 7(6):745–759

    Article  MathSciNet  MATH  Google Scholar 

  • Calimeri F, Cozza S, Ianni G, Leone N (2008) Computable functions in ASP: theory and implementation. In: Proceedings of the international conference on logic programming (ICLP’08). Springer, Berlin, pp 407–424

    Google Scholar 

  • Calimeri F, Gebser M, Maratea M, Ricca F (2016) Design and results of the fifth answer set programming competition. Artif Intell 231:151–181

    Article  MathSciNet  MATH  Google Scholar 

  • Calimeri F, Ianni G, Truszczynski M (eds) (2015) Logic programming and nonmonotonic reasoning - 13th international conference, LPNMR 2015, Lexington, KY, USA, 27–30 September 2015. Proceedings. Lecture notes in computer science, vol 9345. Springer, Berlin

    Google Scholar 

  • Carlsson M, Ottosson G, Carlson B (1997) An open-ended finite domain constraint solver. In: Proceedings of the international symposium on programming language implementation and logic programming (PLILP’97), pp 191–206

    Google Scholar 

  • Clark KL (1977) Negation as failure. In: Gallaire H, Minker J (eds) Logic and data bases. Plenum, New York, pp 293–322

    Google Scholar 

  • Colmerauer A (1983) Prolog in ten figures. In: International joint conference on artificial intelligence (IJCAI’83), pp 487–499

    Google Scholar 

  • Colmerauer A (1990) An introduction to prolog III. Commun ACM 33(7):69–90

    Article  Google Scholar 

  • Colmerauer A, Kanoui A, Roussel P, Pasero R (1973) Un systme de communication homme-machine en franais. Artificielle, Universit d’Aix-Marseille, Technical report, Groupe de Recherche en Intelligence

    Google Scholar 

  • Colmerauer A, Roussel P (1996) The birth of prolog. In: Et Gibson RG, Berjin TJ (eds) History of programming languages. ACM Press/Addison-Wesley, New York, pp 37–52

    Google Scholar 

  • Confalonieri R, Nieves JC, Osorio M, Vázquez-Salceda J (2010) Possibilistic semantics for logic programs with ordered disjunction. International symposium on foundations of information and knowledge systems (FoIKS’09). Springer, Berlin, pp 133–152

    Chapter  Google Scholar 

  • Costantini S, Formisano A, Petturiti D (2010) Extending and implementing RASP. Fundam Inf 105(1–2):1–33

    MathSciNet  MATH  Google Scholar 

  • de Kergommeaux JC, Codognet P (1994) Parallel logic programming systems. ACM Comput Surv 26(3):295–336

    Article  Google Scholar 

  • de la Banda MG, Pontelli E (eds) (2008). Logic programming, 24th international conference, ICLP 2008, Udine, Italy, 9–13 December 2008, Proceedings. LNCS, vol 5366. Springer, Berlin

    Google Scholar 

  • Delgrande JP, Schaub T, Tompits H, Wang K (2004) A classification and survey of preference handling approaches in nonmonotonic reasoning. Comput Intell 20(2):308–334

    Article  MathSciNet  Google Scholar 

  • Deransart P, Ed-Dbali A, Cervoni L (1996) Prolog - the standard: reference manual. Springer, Berlin

    Book  MATH  Google Scholar 

  • Diaz D (2001) Design and implementation of the GNU Prolog system. J Funct Log Program 2001(6)

    Google Scholar 

  • Dincbas M, Van Hentenryck P, Simonis H, Aggoun A, Herold A (1988) The CHIP system: constraint handling in Prolog. In: Lusk E, Overbeek R (eds) 9th international conference on automated deduction. Springer, Argonne

    Google Scholar 

  • Drescher C, Walsh T (2010) A translational approach to constraint answer set solving. TPLP 10(4–6):465–480

    MathSciNet  MATH  Google Scholar 

  • Dubois D, Prade H, Schockaert S (2015) Extending answer set programming using generalized possibilistic logic. In: Proceedings of the joint ontology workshops 2015 episode 1: the argentine winter of ontology co-located with the 24th international joint conference on artificial intelligence (IJCAI 2015), Buenos Aires, Argentina, 25–27 July 2015

    Google Scholar 

  • Egly U, Gaggl SA, Woltran S (2010) Answer-set programming encodings for argumentation frameworks. Argum Comput 1(2):147–177

    Article  MATH  Google Scholar 

  • Eiter T, Ianni G, Krennwallner T (2009) Answer set programming: a primer. In: Tessaris S, Franconi E, Eiter T, Gutierrez C, Handschuh S, Rousset M-C, Schmidt RA (eds) 5th international reasoning web summer school (RW 2009), Brixen/Bressanone, Italy, 30 August–4 September 2009. LNCS, vol 5689. Springer, Berlin pp 40–110

    Google Scholar 

  • Erdem E, Erdem O, Türe F (2009) HAPLO-ASP: haplotype inference using answer set programming. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’09). Springer, Berlin, pp 573–578

    Google Scholar 

  • Ferraris P, Lee J, Lifschitz V (2007) A new perspective on stable models. In: International joint conference on artificial intelligence (IJCAI’07), pp 372–379

    Google Scholar 

  • Ferraris P, Lee J (2010) Stable models and circumscription. Artif Intell 175:236–263

    Article  MathSciNet  MATH  Google Scholar 

  • Fruhwirth T (1998) Theory and practice of constraint handling rules. J Log Program 37(1–3):95–138

    Article  MathSciNet  MATH  Google Scholar 

  • Frühwirth T (2009) Constraint handling rules, 1st edn. Cambridge University Press, New York

    Google Scholar 

  • Frühwirth TW (1994) Constraint handling rules. Constraint programming, pp 90–107

    Google Scholar 

  • Garcia L, Ngoma S, Nicolas P (2009) Dealing automatically with exceptions by introducing specificity in ASP. In: Proceedings of the European conference on symbolic and quantitative approaches to reasoning with uncertainty (ECSQARU’09). Springer, Berlin, pp 614–625

    Google Scholar 

  • Gebser M, Kaminski R, Knig A, Schaub T (2011a) Advances in gringo series 3. In: Delgrande JP Faber W (eds) Logic programming and nonmonotonic reasoning - 11th international conference, LPNMR 2011. Lecture notes in computer science, vol 6645. Springer, Berlin, pp 345–351

    Google Scholar 

  • Gebser M, Schaub T, Thiele S, Veber P (2011b) Detecting inconsistencies in large biological networks with answer set programming. Theory Pract Log Program 11(2):1–38

    MathSciNet  MATH  Google Scholar 

  • Gebser M, Kaufmann B, Schaub T (2009) The conflict-driven answer set solver clasp: progress report. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’09). Springer, Berlin, pp 509–514

    Google Scholar 

  • Gebser M, Konig A, Schaub TTS, Veber P (2010) The BioASP library: ASP solutions for systems biology. In: Proceedings of the international conference on tools with artificial intelligence (ICTAI’10). IEEE Computer Society, Washington

    Google Scholar 

  • Gebser M, Maratea M, Ricca F (2017). The design of the seventh answer set programming competition. In: Proceedings of the 14th international conference on logic programming and nonmonotonic reasoning (LPNMR’17). Springer, Berlin, pp 3–9

    Google Scholar 

  • Gebser M, Schaub T, Thiele S (2007) Gringo: a new grounder for answer set programming. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’07). Springer, Berlin, pp 266–271

    Google Scholar 

  • Gelfond M, Leone N (2002) Logic programming and knowledge representation - the A-Prolog perspective. Artif Intell 138(1–2):3–38

    Article  MathSciNet  MATH  Google Scholar 

  • Gelfond M, Lifschitz V (1988) The stable model semantics for logic programming. In: Kowalski RA, Bowen K (eds) Proceedings of the conference and symposium on logic programming. The MIT Press, Cambridge, Massachusetts, pp 1070–1080

    Google Scholar 

  • Gelfond M, Lifschitz V (1991) Classical negation in logic programs and disjunctive databases. New Gener Comput 9(3sps4):365–386

    Google Scholar 

  • Gelfond M, Przymusinska H, Przymusinski TC (1986) The extended closed world assumpution and its relationship to parallel circumscription. In: Proceedings of the international symposium on principles of database systems (PODS’86). ACM, New York, pp 133–139

    Google Scholar 

  • Giannesini F, Kanoui H, Pasero R, Caneghem MV (1985) Prolog (Prface de A. Colmerauer), InterEditions

    Google Scholar 

  • Giunchiglia E, Lierler Y, Maratea M (2006) Answer set programming based on propositional satisfiability. J Autom Reason 36(4):345–377

    Article  MathSciNet  MATH  Google Scholar 

  • Grasso G, Iiritano S, Leone N, Ricca F (2009) Some DLV applications for knowledge management. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’09). Springer, Berlin, pp 591–597

    Google Scholar 

  • Hentenryck PV, Saraswat VA, Deville Y (1998) Design, implementation, and evaluation of the constraint language cc(FD). J Log Program 37(1–3):139–164

    Article  MATH  Google Scholar 

  • Hill PM, Lloyd JW (1994) The Gödel programming language. MIT Press, Cambridge

    MATH  Google Scholar 

  • Hué J, Papini O, Würbel É (2010) Implementing prioritized merging with ASP. In: Proceedings of the international conference on information processing and management of uncertainty in knowledge-based systems. Springer, Berlin, pp 138–147

    Google Scholar 

  • Ielpa SM, Iiritano S, Leone N, Ricca F (2009) An ASP-based system for e-tourism. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’09). Springer, Berlin, pp 368–381

    Google Scholar 

  • Jaffar J, Lassez J-L (1987) Constraint logic programming. In: Proceedings of the symposium on principles of programming languages (POPL’87). ACM, New York, pp 111–119

    Google Scholar 

  • Jaffar J, Michaylov S, Stuckey PJ, Yap RHC (1992) The CLP(R) language and system. ACM Trans Program Lang Syst 14(3):339–395

    Article  Google Scholar 

  • Janssen J, Schockaert S, Vermeir D, Cock MD (2012) Answer set programming for continuous domains - a fuzzy logic approach. Atlantis computational intelligence systems, vol 5. Atlantis Press, Paris

    Google Scholar 

  • Kayser D, Nouioua F (2009) From the textual description of an accident to its causes. Artif Intell 173(12–13):1154–1193

    Article  Google Scholar 

  • Kowalski R (1974) Predicate logic as a programming language. Inf Process 74:569–574

    MathSciNet  MATH  Google Scholar 

  • Lefèvre C, Béatrix C, Stéphan I, Garcia L (2017) ASPeRix, a first order forward chaining approach for answer set computing. Theory Prat Log Program 1–45

    Google Scholar 

  • Lefèvre C, Nicolas P (2009a) A first order forward chaining approach for answer set computing. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’09). Springer, Berlin, pp 196–208

    Google Scholar 

  • Lefèvre C, Nicolas P (2009b) The first version of a new ASP solver : ASPeRiX. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’09). Springer, Berlin, pp 522–527

    Google Scholar 

  • Leone N, Faber W (2008) The DLV project: a tour from theory and research to applications and market. In: Proceedings of the international conference on logic programming (ICLP’08). Springer, Berlin, pp 53–68

    Google Scholar 

  • Leone N, Pfeifer G, Faber W, Eiter T, Gottlob G, Perri S, Scarcello F (2006) The DLV system for knowledge representation and reasoning. ACM Trans Comput Log 7(3):499–562

    Article  MathSciNet  MATH  Google Scholar 

  • Lifschitz V (1989) Between circumscription and autoepistemic logic. In: International conference on principles of knowledge representation and reasoning (KR’89), pp 235–244

    Google Scholar 

  • Lifschitz V (2002) Answer set programming and plan generation. Artif Intell 138(1–2):39–54

    Article  MathSciNet  MATH  Google Scholar 

  • Lifschitz V (2008a) Twelve definitions of a stable model. In: Proceedings of the international conference on logic programming (ICLP’08). Springer, Berlin, pp 37–51

    Google Scholar 

  • Lifschitz V (2008b) What is answer set programming? In: Proceedings of the international conference on artificial intelligence (AAAI’08), pp 1594–1597

    Google Scholar 

  • Lin F, Zhao Y (2004) ASSAT: computing answer sets of a logic program by SAT solvers. Artif Intell 157(1–2):115–137

    Article  MathSciNet  MATH  Google Scholar 

  • Lloyd J (1987) Foundations of logic programming. Springer, New York Inc

    Book  MATH  Google Scholar 

  • Loveland D (1968) A linear format for resolution. In: Proceedings of the symposium on automatic demonstration. Springer, Berlin

    Google Scholar 

  • Luckham D (1968) Refinements theorems in resolution theory. In: Proceedings of the symposium on automatic demonstration. Springer, Berlin

    Google Scholar 

  • Mancosu P (1998) From Brouwer to Hilbert: the debate on the foundations of mathematics in the 1920s. Oxford University Press, Oxford

    MATH  Google Scholar 

  • McCarthy J (1980) Circumscription - a form of non-monotonic reasoning. Artif Intell 13(1–2):27–39

    Article  MATH  Google Scholar 

  • McCarthy J (1986) Applications of circumscription to formalizing common-sense knowledge. Artif Intell 28(1):89–116

    Article  MathSciNet  Google Scholar 

  • Moore RC (1985) Semantical considerations on nonmonotonic logic. Artif Intell 25(1):75–94

    Article  MathSciNet  MATH  Google Scholar 

  • Mushthofa M, Schockaert S, Cock MD (2014) A finite-valued solver for disjunctive fuzzy answer set programs. In: ECAI 2014 - 21st European conference on artificial intelligence, 18–22 August 2014, Prague, Czech republic - including prestigious applications of intelligent systems (PAIS 2014), pp 645–650

    Google Scholar 

  • Nadathur G, Miller D (1998) Higher-order logic programming. In: Gabbay CHD, Robinson A (eds) Handbook of logic in artificial intelligence and logic programming, vol 5. Oxford University Press, Oxford, pp 499–590

    MATH  Google Scholar 

  • Nicolas P, Garcia L, Stphan I, Lefvre C (2006) Possibilistic uncertainty handling for answer set programming. Ann Math Artif Intell 47(1–2):139–181

    Article  MathSciNet  Google Scholar 

  • Niemelä I (1999) Logic programs with stable model semantics as a constraint programming paradigm. Ann Math Artif Intell 25(3–4):241–273

    Article  MathSciNet  MATH  Google Scholar 

  • Niemelä I, Simons P, Soininen T (1999) Stable model semantics of weight constraint rules. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’ 99). Springer, Berlin, pp 317–331

    Google Scholar 

  • Nieuwenborgh DV, Cock MD, Vermeir D (2007) An introduction to fuzzy answer set programming. Ann Math Artif Intell 50(3–4):363–388

    Article  MathSciNet  MATH  Google Scholar 

  • Older WJ, Vellino A (1990) Extending prolog with constraint arithmetic on real intervals. In: Canadian Conference on Electrical and Computer Engineering

    Google Scholar 

  • Palu AD, Dovier A, Pontelli E, Rossi G (2009) Answer set programming with constraints using lazy grounding. In: Proceedings of the international conference on logic programming (ICLP’09). LNCS, vol 5649. Springer, Berlin, pp 115–129

    Google Scholar 

  • Pearce D (1996) A new logical characterisation of stable models and answer sets. In: Non-monotonic extensions of logic programming (NMELP’96). Springer, Berlin, pp 57–70

    Google Scholar 

  • Reiter R (1980) A logic for default reasoning. Artif Intell 13(1–2):81–132

    Article  MathSciNet  MATH  Google Scholar 

  • Robinson J (1965) A machine-oriented logic based on the resolution principle. J ACM 12(1):23–41

    Article  MathSciNet  MATH  Google Scholar 

  • Rossi F, van Beek P, Walsh T (eds) (2006) Handbook of constraint programming. Elsevier, Amsterdam

    MATH  Google Scholar 

  • Sakama C, Inoue K (1993) Relating disjunctive logic programs to default theories. In: Proceedings of the international conference on logic programming and nonmonotonic reasoning (LPNMR’93), pp 266–282

    Google Scholar 

  • Schaub T, Wang K (2001) A comparative study of logic programs with preference. In International Joint Conference on Artificial Intelligence (IJCAI’01), pp 597–602

    Google Scholar 

  • Simons P, Niemelä I, Soininen T (2002) Extending and implementing the stable model semantics. Artif Intell 138(1–2):181–234

    Article  MathSciNet  MATH  Google Scholar 

  • Somogyi Z, Henderson F, Conway T (1996) The execution algorithm of Mercury, an efficient purely declarative logic programming language. J Log Program 29

    Google Scholar 

  • Son TC, Pontelli E (2006) Planning with preferences using logic programming. TPLP 6(5):559–607

    MathSciNet  MATH  Google Scholar 

  • Stéphan I, Mota BD, Nicolas P (2009) From (quantified) boolean formulae to answer set programming. J Log Comput 19(4):565–590

    Article  MathSciNet  MATH  Google Scholar 

  • Syrjänen T (1998) Implementation of local grounding for logic programs for stable model semantics. Technical report, Helsinki University of Technology

    Google Scholar 

  • Van Roy P, Brand P, Duchier D, Haridi S, Henz M, Schulte C (2003) Logic programming in the context of multiparadigm programming: the Oz experience. Theory Prac Log Program 3(6):717–763

    Article  MATH  Google Scholar 

  • Vos MD, Eiter T, Lierler Y, Toni F (eds) (2015) Proceedings of the technical communications of the 31st international conference on logic programming (ICLP 2015), Cork, Ireland, 31 August– 4 September 2015. CEUR workshop proceedings, vol 1433. http://CEUR-WS.org

  • Waltz D (1975) Understanding line drawings in scenes with shadow. Hill McGraw, New York, pp 19–91

    Google Scholar 

  • Warren DS (1983) An abstract Prolog instruction set. Technical note 309, SRI

    Google Scholar 

  • Wielemaker J, Schrijvers T, Triska M, Lager T (2012) Swi-prolog. TPLP 12(1–2):67–96

    Google Scholar 

  • Yahya AH, Henschen LJ (1985) Deduction in non-Horn databases. J Autom Reason 1(2):141–160

    Article  MathSciNet  MATH  Google Scholar 

  • Yuan L-Y, You J-H (1993) Autoepistemic circumscription and logic programming. J Autom Reason 10(2):143–160

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Arnaud Lallouet .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Lallouet, A., Moinard, Y., Nicolas, P., Stéphan, I. (2020). Logic Programming. In: Marquis, P., Papini, O., Prade, H. (eds) A Guided Tour of Artificial Intelligence Research. Springer, Cham. https://doi.org/10.1007/978-3-030-06167-8_4

Download citation

Publish with us

Policies and ethics