Prolog Course‎ > ‎

1. A First Glimpse

This section explains the basic concepts of Prolog programs by means of simple examples. At the end of the section, the following will summarize the topics that have been touched:
  • Logic programming consists of defining relations and querying about relations.
  • A program consists of facts and rules, which we collectively call clauses. A set of facts and rules about the same relation is called a predicate.
  • Querying about relations, by means of goals, resembles querying a database. Prolog's answer to a query consists of a set of objects that satisfy the question (query).
  • In Prolog, to establish whether an object satisfies a query is often a complicated process that involves logical inference and exploring among alternatives. All this is done automatically by the Prolog system and is, in principle, hidden from the user.
  • Two types of interpretation (or meaning) of Prolog programs are distinguished: declarative and procedural.
  • The following concepts have been discussed: Clause, fact, rule, query, goal, head and body of a rule, recursive rule, predicate, variable, a goal succeeds or fails.
  • Special built-in predicates allow for arithmetic calculations, with a notation similar to the one of well-established procedural programming languages (e.g. Java). Arithmetic assignment is achieved by the is predicate.
ċ
AFirstGlimpse-WT.odt
Download
Course text  315k v. 3 Apr 13, 2010, 5:32 AM Werner Hett
Ċ Exercises.pdf
View Download
Exercises  310k v. 3 Apr 13, 2010, 5:34 AM Werner Hett
ċ
family1.pl
Download
Complete Prolog program  2k v. 3 Apr 13, 2010, 5:34 AM Werner Hett
Ċ Family.pdf
View Download
Our example family  45k v. 2 Apr 13, 2010, 5:33 AM Werner Hett
ċ
family.pl
Download
Family Prolog program  1k v. 3 Apr 13, 2010, 5:34 AM Werner Hett