T1 04 Exp8
T1 04 Exp8
ROLL NO: 4
BATCH: T11
THEORY:
1. What is PROLOG:
● Prolog stands for programming in logic. In the logic programming
paradigm, prolog language is most widely available. Prolog is a
declarative language, which means that a program consists of data based
on the facts and rules (Logical relationship) rather than computing how
to find a solution. A logical relationship describes the relationships
which hold for the given application.
● To obtain the solution, the user asks a question rather than running a
program. When a user asks a question, then to determine the answer, the
run time system searches through the database of facts and rules.
● The first Prolog was 'Marseille Prolog', which is based on work by
Colmerauer. The major example of fourth-generation programming
language was prolog. It supports the declarative programming
paradigm.
● Prolog is a declarative language that means we can specify what
Disadvantages :
1.LISP (another logic programming language) dominates over
prolog with respect to I/O features.
2. Sometimes input and output is not easy.
Applications :
○ Specification Language
○ Robot Planning
○ Machine Learning
○ Problem Solving
○ Expert System
○ Automated Reasoning
CODE:
happy(lili) :- dances(lili). hungry(tom) :-
search_for_food(tom). friends(jack, bili) :-
lovesCricket(jack), lovesCricket(bili).
goToPlay(ryan) :- isClosed(school), free(ryan).
cat(tom). loves_to_eat(kunal,pasta).
of_color(hair,black).
loves_to_play_games(nawaz). lazy(pratyusha).
OUTPUT: