Home [Search / Menue]

Object-Oriented Language: Prolog

[Logo]

Prolog is a goal-oriented, implicative language based on predicate logic. Goal-oriented means that a program proceeds by attempting to achieve a goal which is itself defined by other goals. Prolog operates in an inferential or implicative way: what you write are implications, and the operational flow is from one impliction to another. A line of Prolog code is generally either a rule or a fact - code and data being largely interchangable. Prolog code often has a declarative interpretation, meaning that it specifies "what" exists but not "how." This is different from imperative in which a program defines a series of steps to carry out (C or Basic for example).

PROLOG means PROgramming in LOGic. Implications are specified in the form of logical predicates called Horn clauses. A horn clause consists of a sought implication (a goal clause), and a set of clauses that must be be proven separated by :-. which simply means "if." A typical Prolog statement has the form:

goalclause(Vg) :- clause1(V1),..,clausem(Vm)

which means goalclause is true for variable set Vg if the series of clauses clause1,..,clausem are true. In other words:

goalclause(Vg) is true if clause1(V1) and ... and clausem(Vm) are true.

To represent just a fact instead of a rule, you specify just the head part of the horn clause (An implication with no conditions required to make it true is essentially a fact). Here is a sample with one rule and two facts:

grandmother(G,S) :- parent(P,S), mother(G,P).
mother(sarah,issac).
parent(issac, jacob).

The first statement means G is the grandmother of S if there is a parent P of S and G is the mother of P. The next two statements are facts indicating that issac is a parent of jacob and that sarah is the mother of issac.

For an implication to succeed, all goal variables Vg on the left side of :- must find a solution coming from what ever facts or rules are referred to on the right side. Prolog finds solutions by unification: binding a variable to a value. When all clauses are examined and all variables in Vg are bound, the goal succeeds. But if a variable can not be bound for a given clause, the clause fails. Standard Prolog evalutates clauses from left to right. When any clause fails, Prolog backtracks - it goes back to previous clauses to continue trying to unify with alternative bindings. Backtracking give Prolog the ability to find multiple solutions to for a given query or goal.

Prolog was created in the early 1970s by Alain Colmerauer, Robert Kowalski, Phillipe Roussel and collegues. Modern implementation began with a virtual machine called the "Warren Abstract Machine" implemented by David H. D. Warren at Edinburgh. The Prolog language is now defined by an ISO (1995) Standard. However, much current theoretical value comes from important extensions, modifications and experimental aspects. These include:

Many of these extensions include or relate to OO abilities. Some go beyond traditional OO.

For instance, some Constraint programming systems enhance Prolog so that it can bind variables "incrementally" so that variables are constrained (numerically, by enumarated type, or by class) before they are bound. Additionally, some Prolog systems include CLP extensions.

Some logic languages Mercury, KLIC, and Oz, both incorporate concurrency and parallelism and eliminate or restrict backtracking and unification. These are known as committed choice languages and are not Prolog, at least not as defined above. Others, ECLiPSe and BAP, however, offer parallelism and are extentions of Prolog.

Linear logic models causality, state transitions, and accounting for resources used in logic. Linear logic programming originated from the work of Jean-Yves Girard. Linear logic systems such as Lolli and LLP are supersets (more or less) of Prolog that define additional operations for these purposes. Closely related to LLP is higher-order logic (HOL), as embodied in Lambda Prolog. HOL concerns topics such as provability and correctness and other functional programming concepts as opposed to OO, but is also used in solving problems concerning mobile agents (Pi Calculus) as defined by Robin Milner and others.

Progol is a superset of Prolog that provides rapid definition of classes and attributes. It includes extensions for inductive logic. Inductive logic often uses a schema of classes, instances and attribute values to define a rule base.

In fact, objects, attributes, and inheritance are a frequent focus in logic applications. The ISO Prolog standard does not define traditional OO features: classes, inheritance, methods, and events (although OO standards are under consideration). However, Prolog is highly extensible. OO capabilities can be and often are implemented in extensions. Implementing traditional multiple inheritance can be done with just a few Prolog statem-ents, albiet maybe simplistically. But, it is equally possible to equip Prolog with additional object and inheritance capabilities not available in traditional OO.

Doing so is sometimes necessary. Many practical and research logic problems push beyond the capabilities of traditional OO. In reasoning about beliefs, norms, learning, linguistics, agents, and incomplete knowledge, inheritance is extra-hierarchial and fluid. Knowledge changes over time and occurs as inheritance networks rather than as strict hierarchies - Additional inheritance and object relation styles need to be considered. It is valuable to view inheritance network tools as advanced OO with added capabilities for role definition, defeasibility, nonmonotonicity, abduction, and preferencial inheritance.

LOGIN, an early OO extension of Prolog, was created in the mid-1980s by Ait Kaci (also the creator of the LIFE language) and Nasr. Today, there are numerous OO Prolog compilers and extensions both system specific and system independent versions. LogTalk is an OO add-on that can be used with numerous standard Prolog systems.

In addition to OO extensions, there are also OO interoperability tools, database tools, deductive database Prolog systems, open source C++ WAM implementations, and Java implementations of Prolog and Java-Prolog libraries. Some Prolog-Java implementations enable Prolog to manipulate Java objects and properties.

This page includes:

OO provides an exciting and even broad, if incomplete spectrum in which to view logic programming, a field which is extensive and growing. This page thus shows some of the flavors of LP:



Home   Mirrors/Hosts  
  What´s New?   Most Wanted   About Cetus   Cetus Team   Legal
  Download   Suggest   Moved/Broken   Feedback   URL-Minder   Copy & Paste

 
Partial match  
 
Search www.cetus-links.org

and=";"   or=","   no spaces!
 
  Tips
 

Copyright © 1996-1999 by Manfred Schneider
Page maintained by Richard Katz
Last revision: March 7, 1999
Site visits: [Site visits] since May 1996