Professional Documents
Culture Documents
AI - Lab 2
AI - Lab 2
Lab Manual # 2
SWI-Prolog
v7.2.3 (Multi-threaded)
Write a program that take a number from user input and tells its zero or not.
Task 9:
Write a program that take a number from user input and tells its less than 100 or greater.
Task 10:
Write a program that take 2 numbers from user input and divides them and display either
result on screen or display division not possible because denominator is zero.
Task 11: Practice The Following Questions on Prolog and also add in lab
manual
1. write('Hello World'),nl,write('Welcome to Prolog'),nl.
2. ?-halt. ?-
statistics.
3. Try following DB
4. Try following:
6. Try this.
7. Try this.
8. Try this.
9. Try Arithmetic Operators.
____________________________________________________________
17. Deduction:
GIVEN THAT
any X is an animal if it is a dog
AND
fido is a dog
DEDUCE
fido must be an animal
Eaxmple:
dog (fido).
dog (tommy).
dog (henry).
Consult on Prolog.
Start asking questions.
?- dog (fido).
Yes
?- dog(rover).
No
?- animal(fido).
Yes
?- dog(X).
X=fido;
X=tommy;
X=henry.
?- listing(dog).
dog( fido ).
dog( rover ).
dog( tom ).
dog( henry).
yes
______________________________________________________________________
https://www.youtube.com/watch?v=EdbWdZlEDm4
https://www.youtube.com/watch?v=SykxWpFwMGs
Check Out Following Links (If you are interested in advance Prolog):
Amzi! Prolog
http://www.amzi.com/products/prolog_products.htm
B-Prolog
http://www.probp.com/
Ciao Prolog
http://clip.dia.fi.upm.es/Software/Ciao/
GNU Prolog
http://gnu-prolog.inria.fr/
SICStus Prolog
http://www.sics.se/isl/sicstuswww/site/index.html
SWI Prolog
http://www.swi-prolog.org/
YAP Prolog
http://www.ncc.up.pt/~vsc/Yap/
Sehar
Rehman
Lecturer
Govt. Islamia Postgraduate College, Faisalabad (GIC)