0% found this document useful (0 votes)
25 views6 pages

Prolog Lab1 Installation

The document provides instructions for installing and using Prolog programming on Windows. It explains that SWI-Prolog can be downloaded and installed, creating a directory containing executables and libraries. Users can then open .pl files to run Prolog queries, with the program responding with solutions or indicating no more answers. The user can press semicolon or spacebar to see additional solutions or RETURN to end the query.

Uploaded by

Faten Ben Hmida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views6 pages

Prolog Lab1 Installation

The document provides instructions for installing and using Prolog programming on Windows. It explains that SWI-Prolog can be downloaded and installed, creating a directory containing executables and libraries. Users can then open .pl files to run Prolog queries, with the program responding with solutions or indicating no more answers. The user can press semicolon or spacebar to see additional solutions or RETURN to end the query.

Uploaded by

Faten Ben Hmida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Computer Science

Department

Artificial Intelligence

Prolog programming
Installation

1
 Follow the link for download your version 7.2.2 or 7.1.29 (what i
s available and free)

 https://www.swi-prolog.org/download/stable

2
Starting SWI-Prolog on Windows

 After SWI-Prolog has been installed on a Windows system, the


following important new things are available to the user:

 A folder (called directory in the remainder of this document)


called swipl containing the executables, libraries, etc., of the
system. No files are installed outside this directory.

 A program swipl-win.exe, providing a window for interaction


with Prolog. The program swipl-win.exe is a version of SWI-
Prolog that runs in a console window.

3
 The file extension is associated with the program .exe. Opening
a .pl swipl-win.pl

 file will cause to start, change directory to the directory in which


the file to swipl-win.exe

 simply double clicking likes.pl (program files->swipl-


>demo->likes)

4
Executing a query
 After loading a program, one can ask Prolog queries about the
program. The query below asks Prolog what food ‘sam’ likes.
The system responds with
 X = (value) if it can prove the goal for a certain X.

 The user can type the semi-colon (;) or spacebar(On most


installations, single-character commands are executed without
waiting for the RETURN key.) if (s)he wants another solution.

 Use the RETURN key if you do not want to see the more
answers.

 Prolog completes the output with a full stop (.) if the user uses
the RETURN key or Prolog knows there are no more answers.
5
 If Prolog cannot find (more) answers, it exit.

 Finally, Prolog answers using an error message to indicate the


query or program contains an error.

You might also like