Book contents
- Frontmatter
- Dedication
- Contents
- Preface
- 1 Logic-Based Approach to Agent Design
- 2 Answer Set Prolog (ASP)
- 3 Roots of Answer Set Prolog
- 4 Creating a Knowledge Base
- 5 Representing Defaults
- 6 The Answer-Set Programming Paradigm
- 7 Algorithms for Computing Answer Sets
- 8 Modeling Dynamic Domains
- 9 Planning Agents
- 10 Diagnostic Agents
- 11 Probabilistic Reasoning
- 12 The Prolog Programming Language
- Appendix A ASP Solver Quick-Start
- Appendix B Aspide
- Appendix C Introduction to SPARC
- Appendix D Code
- Bibliography
- Index
12 - The Prolog Programming Language
Published online by Cambridge University Press: 05 July 2014
- Frontmatter
- Dedication
- Contents
- Preface
- 1 Logic-Based Approach to Agent Design
- 2 Answer Set Prolog (ASP)
- 3 Roots of Answer Set Prolog
- 4 Creating a Knowledge Base
- 5 Representing Defaults
- 6 The Answer-Set Programming Paradigm
- 7 Algorithms for Computing Answer Sets
- 8 Modeling Dynamic Domains
- 9 Planning Agents
- 10 Diagnostic Agents
- 11 Probabilistic Reasoning
- 12 The Prolog Programming Language
- Appendix A ASP Solver Quick-Start
- Appendix B Aspide
- Appendix C Introduction to SPARC
- Appendix D Code
- Bibliography
- Index
Summary
We complete the book by a short discussion of an inference mechanism that is very different from the one presented in Chapter 7. It is only applicable to normal logic programs (nlps), and although sound with respect to answer set semantics of nlps, it is not complete and might not even terminate; however, it has a number of advantages. In particular, it is applicable to nlps with infinite answer sets, and it does not require grounding. The algorithm is implemented in interpreters for programming language Prolog. The language, introduced in the late 1970s, is still one of the most popular universal programming languages based on logic. Syntactically, Prolog can be viewed as an extension of the language of nlps by a number of nonlogical features. Its inference mechanism is based on two important algorithms called unification and resolution, implemented in standard Prolog interpreters. Unification is an algorithm for matching atoms; resolution uses unification to answer queries of the form “find X such that q(X) is the consequence of an nlp II.”
We end this chapter with several examples of the use of Prolog for finding declarative solutions to nontrivial programming problems. Procedural solutions to these problems are longer and much more complex.
The Prolog Interpreter
We start with defining unification and SLD resolution — an algorithm used by Prolog interpreters to answer queries to definite programs (i.e., nlps without default negation).
- Type
- Chapter
- Information
- Knowledge Representation, Reasoning, and the Design of Intelligent AgentsThe Answer-Set Programming Approach, pp. 271 - 306Publisher: Cambridge University PressPrint publication year: 2014