Prolog - PGCE

Download Report

Transcript Prolog - PGCE

Programming in Logic
ProLog
Amy Radford
Introduction
•
•
•
•
•
•
Introduction to Prolog
How Prolog works
Examples of use
Downloading
Summary
Questions
Amy Radford
Prolog
• Prolog was developed in the 1970s at the
University of Marseilles
• Known as a fifth generation language
• A declarative language
• Prolog is concerned with the relationships
defined by the programmer, and being able to
give a ‘true’ or ‘false’ answer
• Based on predicate calculus
Amy Radford
How does it work?
• The first step is to enter the facts into the
database. This is done in a simple text program
such as notepad and saved as a .pl file.
Amy Radford
How does it work?
• When this file is opened in prolog, queries are
used to find out the answers to questions.
Amy Radford
How does it work?
• In the same way, if a query is asked that does
not follow the facts held in the database, then
the result will be ‘No’.
Amy Radford
How does it work?
• Variables can be used to find out the answer to a
query. These are distinguished by starting with
a capital letter, eg:
Amy Radford
Examples of Uses of Prolog
• Clarissa, a fully voice-operated procedure
browser developed by the NASA Intelligent
Systems Division
• Hewlett-Packard uses a Prolog rule-base to test
and repair their personal computer boards.
• Boeing uses Prolog to advises its engineers,
manufacturing and field personnel how to
properly assemble electric connectors that
require special tools.
Amy Radford
Download
• A widely used version of Prolog can be obtained
from http://www.swi-prolog.org
• Alternatively you can download it from the link
on the Prolog page of my website
http://ww.personal.soton.ac.uk/ar1606
Amy Radford
Summary
• Prolog is a high level declarative language
based on predicate calculus
• It is used widely for Artificial Intelligence
• Functions based on the true values/rules
entered into the database.
• Queries ran to find out the true value or to
deduce information held in the database
Amy Radford
Any Questions?
Amy Radford