Professional Documents
Culture Documents
JAHANGIRNAGAR UNIVERSITY
Submitted To:
Dr. Mohammad Shahidul Islam
Associate Professor
Institute of Information Technology
Jahangirnagar University
Submitted By:
Niloy Paul
ID: 1779
4th Year 1st Semester
avg(X,Y,Z):-A is (X+Y+Z)/3,
write('Average is: '),
write(A).
Output:
Question-02:
Brother & sister rule from the family tree:
Code:
male(rahim).
male(ratul).
male(setu).
female(riya).
female(shila).
parents(rahim,ratul).
parents(rahim,riya).
parents(riya,shila).
parents(riya,setu).
father(X,Y):-parents(X,Y),male(X).
mother(X,Y):-parents(X,Y),female(X).
brother(X,Y):-parents(Z,X),parents(Z,Y),male(X),X\=Y.
sister(X,Y):-parents(Z,X),parents(Z,Y),female(X),X\=Y.
Output:
Question-03:
Importance of Prolog:
Prolog is a logic programming language associated with artificial intelligence and computational
linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other
programming languages, Prolog is intended primarily as a declarative programming language: the
program logic is expressed in terms of relations, represented as facts and rules.
Prolog allows us to flexibly implement various specification formalisms as well as the analysis
and verification tools that go along with it. At the same time, Prolog is very fast and SICStus
Prolog is one of the fastest and most stable Prolog systems, allows access to more than 256 MB of
heap even on 32 bit systems (important for model checking), and is easy to integrate with other
programming languages (so that the GUI does not have to be developed in Prolog). These features
make it a prominent programming language that plays an important role in artificial intelligence.
Question-04:
Two Applications of Prolog:
Two applications of prolog are as follows:
Specification Language and natural language understanding
Robot Planning and Automation System