Download Prolog

To download Prolog, go here .

Accessing Prolog on CSE Computers

Log on to the CSE computer system in the normal way, by entering your user name and password (as per the "Unix Primer"). Open an xterm window to perform the lab in. All commands in this lab should be entered in that window.

This lab will create a number of files. If you don't want them to go directly in your home directory, then create a new directory and cd to the new directory. For example:

$ mkdir ai_lab
$ cd ai_lab

NOTE! Whenever we show you an example session on the computer, what the system types to you will be in "this font", and what you are supposed to type in response will be in " italic font ". You do not need to type the dollar sign ($) shown at the start of these lines. In this situation, the dollar sign represents the Unix shell prompt.

The first command created a directory called ai_lab, the second command made ai_lab your current directory. Next time you log in you will not need to create the directory... so just change directories using the command, cd ai_lab .

First of all we will make sure you can run Prolog. We will start Prolog, directly enter some facts and queries, then quit.

Start prolog using the following command:

$ swipl
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 7.2.3)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit <a href="http://www.swi-prolog.org">http://www.swi-prolog.org</a> for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?-

The ?- is the Prolog prompt. It indicates Prolog is ready to accept input from the keyboard.

NOTE! If at any time you make a mistake and you want to get a fresh Prolog prompt, you can send the interrupt signal, control-C , then type a for abort.

Quitting Prolog

To exit from Prolog, type control-D at a ?- prompt. You may have to read the previous note to find out how to get a prompt.

?- control-D
 % halt

When we quit Prolog, (by typing control-D at a ?- prompt, the facts we have placed into memory are lost.

WARNING to Windows users! You should not try to quit SWI prolog using control-Z. On the Unix systems, this will suspend the Prolog process and leave it in the background. It does not quit the program! (However, this may be different on systems using Microsoft Windows.)

Resource created Saturday 06 February 2021, 09:11:01 PM.


Back to top

COMP3411/COMP9814 21T1 (Artificial Intelligence) is powered by WebCMS3
CRICOS Provider No. 00098G