Skip to main content Accessibility help
×
Hostname: page-component-7479d7b7d-pfhbr Total loading time: 0 Render date: 2024-07-12T16:14:58.153Z Has data issue: false hasContentIssue false

12 - The Prolog Programming Language

Published online by Cambridge University Press:  05 July 2014

Michael Gelfond
Affiliation:
Texas Tech University
Get access

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 Agents
The Answer-Set Programming Approach
, pp. 271 - 306
Publisher: Cambridge University Press
Print publication year: 2014

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×