0% found this document useful (0 votes)
43 views3 pages

Experiment 1

The document introduces Prolog, a logic programming language used in artificial intelligence. It discusses Prolog's declarative nature and use of facts and rules to represent logic. It also covers Prolog syntax, unification, backtracking, recursion, applications, and disadvantages compared to Lisp.

Uploaded by

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

Experiment 1

The document introduces Prolog, a logic programming language used in artificial intelligence. It discusses Prolog's declarative nature and use of facts and rules to represent logic. It also covers Prolog syntax, unification, backtracking, recursion, applications, and disadvantages compared to Lisp.

Uploaded by

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

Experiment-1

Aim: Introduction to Prolog


Theory: Prolog is a logic programming language. It has an important role in artificial intelligence.
Unlike many other programming languages, Prolog is intended primarily as a declarative
programming language. In prolog, logic is expressed as relations (called as Facts and Rules). Core
heart of prolog lies at the logic being applied.
Syntax:
In prolog, we declare some facts. These facts constitute the Knowledge Base of the system. We can
query against the Knowledge Base. We get output as affirmative if our query is already in the
knowledge Base or it is implied by Knowledge Base, otherwise we get output as negative. So,
Knowledge Base can be considered like a database, against which we can query. Prolog facts are
expressed in a definite pattern. Facts contain entities and their relation. Entities are written within the
parenthesis separated by comma (,). Their relation is expressed at the start and outside the
parentheses. Every fact/rule end with a dot (.). So, a typical prolog fact goes as follows:
Format: relation (entity1, entity2, .... k’th entity).
Example:
friends (Raju, Mahesh).
singer (Sonu).
odd_number (5).

Symbols

Prolog expressions are composed of the following truth-functional symbols, which have the
same interpretation as in the predicate calculus.

Variables and Names

Variables begin with an uppercase letter. Predicate names, function names, and the names for objects
must begin with a lowercase letter. Rules for forming names are the same as for the predicate
calculus.
Facts

A fact is a predicate expression that makes a declarative statement about the problem domain.
Whenever a variable occurs in a Prolog expression, it is assumed to be universally quantified. Note
that all Prolog sentences must end with a period.

likes (john, susie). /* John likes Susie */

likes (X, susie). /* Everyone likes Susie */

likes (john, Y). /* John likes everybody */

Key Features:
1. Unification: The basic idea is, can the given terms be made to represent the same structure.
2. Backtracking: When a task fails, prolog traces backwards and tries to satisfy previous task.
3. Recursion: Recursion is the basis for any search in program.

Some Applications of Prolog

Prolog is used in various domains. It plays a vital role in the automation system. Following are some
other important fields where Prolog is used −

● Intelligent Database Retrieval


● Natural Language Understanding
● Specification Language

Disadvantages:

● In general, LISP offers superior I/O capabilities than PROLOG.


● Graphics are not supported by PROLOG in general. Turbo PROLOG, which was just
released, is an exception.
● The sequence in which rules are entered has a significant impact on PROLOG’s efficiency.
The order of LISP functions has a negligible impact on the efficiency of the language.
● PROLOG and LISP can be combined. Certain AI applications are better suited to LISP,
whereas others are better suited to PROLOG. The best configuration may be a hybrid system
that combines and combines the two languages. This combination may be done in two
different ways.
Conclusion:

A logic programming language is PROLOG. It is crucial in the field of artificial intelligence.


PROLOG, unlike many other programming languages, is primarily intended as a declarative
language. PROLOG expresses logic as a set of relations (called as Facts and Rules). The reasoning
being applied is at the heart of PROLOGue. Running a query across these relations is used for
formulation or computation.

You might also like