Some Prolog information

[ Running/Obtaining Prolog | On-line Documentation | Books ]

[ Sample Prolog code | Typing in and running Prolog code | Debugging]



Running/Obtaining Prolog



On-line Tutorials/Guides/Documentation/Web resources



Books

You can try out the following books :

You can check out a longer list of Prolog books here. And if you want to read about the general idea of logic programming, take a look at R. Kowalski's Logic for Problem Solving (North-Holland NY, 1979)



Sample Prolog code




Typing in and running Prolog code


A notation that you need to be familiar with is the Name/Number notation for denoting predicates : e.g., member/2 : this denotes a predicate called member which has 2 arguments. Also the comment delimiters for Prolog are /* and */ (a % marks the rest of the line as a comment.



Debugging


A separate lecture is being given on debugging, so you could refer to the notes for that lecture. Before you learn the debugging predicates available to you, you should understand the model of execution and goal satisfaction used by Prolog. Associated with every goal in Prolog are 4 events or ports :

The Prolog system basically offers you two debugging operations :

  1. Choosing the goals for which the Prolog system will report the occurrence of an event.
  2. Choosing the level of interaction with the execution of the program.

1. Choosing when Prolog reports the occurrence of an event :


2. Choosing the level of interaction with event reporting :  

    If you're doing some sort of leashed tracing (i.e. leash not set to off), then Prolog will stop after reporting an event and wait for your command. You can type any one of the following single-letter commands :