You are on page 1of 3

prolog :- Programming in Logic

what is prolog

Prolog is a general-purpose logic programming language associated with artificial


intelligence and computational linguistics.[1][2][3]

Prolog has its roots in first-order logic, a formal logic,


Prolog is declarative: the program logic is expressed in terms of relations,
represented as facts and rules.
Prolog is sometimes called a declarative language or a rule-based language because
its programs consist of a list of facts and rules.
A computation is initiated by running a query over these relations.[4]

The general idea behind declarative languages is that you describe a situation.
Based on this code, the interpreter or compiler will tell you a solution. In the
case of prolog, it will tell you whether a prolog sentence is true or not and, if
it contains variables, what the values of the variables need to be.

FEATURES
The main characteristics/notions of the Visual Prolog programming language are:

based on logical programming with Horn clauses


fully object oriented
object predicate values (delegates)
strongly typed
algebraic data types
pattern matching and unification
controlled non-determinism
fully integrated fact databases
supports parametric polymorphism
automatic memory management
supports direct linkage with C/C++
supports direct calling of Win32 API functions

Prolog is a rich collection of data structures in the language and human reasoning,
and a powerful notation for encoding end-user applications. It has its logical and
declarative aspects, interpretive natur, compactness, and inherent modularity.

Intelligent Systems - programs which perform useful tasks by utilizing


artificaial intelligence techniques.
Expert Systems - intelligent systems which reproduce decision-making at the
level of a human expert.
Natural Language Systems - which can analys and respond to statements made in
ordinary language as opposed to approved keywords or menu selections.
Relational Database Systems

ADVANTAGES

Logic based languages are able to represent the real world more accurately.
Prolog is able to derive new rules from the existing rules contained within the
knowledge base.
DISADVANTAGES

It can be very difficult to design a database that accurately represents


relationships.
Prolog is not best suited to solving complex arithmetical computations.
Prolog programs are not best suited to the current PC architecture (sequential
execution) and are best optimised on parallel architectures (fifth generation
computers).

USES
The language has been used for theorem proving,[8] expert systems,[9] term
rewriting,[10] type inference,[11] and automated planning,[12] as well as its
original intended field of use, natural language processing.[13][14] Modern Prolog
environments support the creation of graphical user interfaces, as well as
administrative and networked applications.

Prolog is well-suited for specific tasks that benefit from rule-based logical
queries such as searching databases, voice control systems, and filling templates

Some applications of Prolog are:

intelligent data base retrieval


natural language understanding
expert systems
specification language
machine learning
robot planning
automated reasoning
problem solving

Prolog is still being used nowadays in various industrial, medical & commercial
areas to:

build expert systems that solve complex problems without the help of humans
(e.g. automatically planning, monitoring, controlling and troubleshooting complex
systems)
build decision support systems that aid organizations in decision-making (e.g.
decision systems for medical diagnoses)
online support service for customers, etc.

SYNTAX
The User inputs a series of predicates that have three different meanings - facts
to be stored, goals to be searched for(queries), or commands(directives) which do
one thing. There is also a special kind of rule called a clause which defines
conditions underwhich a fact can be true.

facts
Facts are used to state things that are unconditionally true of some situation of
interest. For example, we can state that Mia, Jody, and Yolanda are women,
woman(mia).
woman(jody).
woman(yolanda).

Rules
happy(yolanda).
listens2Music(mia).
listens2Music(yolanda):- happy(yolanda).
playsAirGuitar(mia):- listens2Music(mia).
playsAirGuitar(yolanda):- listens2Music(yolanda).

There are two facts in KB2, listens2Music(mia) and happy(yolanda) . The last three
items it contains are rules.

Rules state information that is conditionally true of the situation of interest.


For example, the first rule says that Yolanda listens to music if she is happy, and
the last rule says that Yolanda plays air guitar if she listens to music.

You might also like