Programming Languages


The PROLOG language was released in 1971 and is a completely declarative language, although it is also capable of carrying out mathematical calculations. Numerous implementations of PROLOG have been produced, with two main variations. Programs are structured with only onr data type called the term, with four kinds of terms. Relations are structured on the pattern of “well-formed formulas” in logic, using rules and facts. A program is executed as a query run on a relation, and the result is evaluated as true or false by determining whether the query disagrees with any of the rules. PROLOG is used extensively in the field of artificial intelligence, and is more popular with European researchers, while the similar language LISP is more popular witrh North American researchers.



PROLOG was released in 1971 after being developed at l'Université de Marseilles, in France. The name is a contraction of the words PROgrammation en LOGique (in English, PROgramming in LOGic). It is one of the first logic programming languages, and although not as old as LISP, it is one of the oldest still in common usage. PROLOG is more commonly used in Europe, while LISP is more popular with North American researchers and developers. Both PROLOG and LISP are used extensively for research and development in the field of artificial intelligence. Numerous implementations of PROLOG have been produced, the two major variations being ISO Prolog and Edinburgh Prolog. PROLOG is geared to natural language processing, or the use of computers to process natural language. PROLOG can be implemented in any programming language or environment that is capable of calling a dynamic linked library, or .dll, file. This includes languages such as C, C++, C#, PHP, Java, Visual BASIC, Delphi and .NET, as well as other similar languages. PROLOG is particularly useful for database manipulation, symbolic math and language parsing applications.


atom (arg1, arg2,…)

A list can also be used as an argument, as can a string of characters enclosed in quotation marks, as for example

atom (arg1, [arg2, arg3], “some text”)


Relations in PROLOG are stated as clauses, which are described as a fact or a rule. A rule essentially states a logical relationship of the type “this head statement is true if the following body conditions are true,” and has the form

head statement :- body condition statement(s)

The symbol “:-” is read as “is true if.” A simple logical statement of this form might be something like “(a = 2) is true if (a = b) and (b = 2).” In this simple example, the conditions described by “(a = b) and (b = 2)” would correspond to the body statements, and would be written as facts in the form


Given these facts, one could then pose the query

?- b(2).

equivalent to the question “is b equal to 2?,” which would then return the value statement “yes” to indicate the “true” condition.


Write a rule, facts, and a query statement to test the fact of whether a cat is green.



The facts specify that cats are red, blue, brown, tabby and black but no other colors are defined and therefore are not “true.” The rule states that cats are green only if they are defined to be green. The query asks “are cats green?,” and because comparisons with the facts all fail the program returns the value statement “no.”


Scientific method relies strictly on the application of pure logic to achieve results in any field. Strictly speaking, scientific method, in any area of application, seeks to eliminate as many unpredictable variables as possible in determining the answer to a specific question. In logic, this depends on the construction of “well-formed formulas,” and such are the essential components of PROLOG programs. This is a central aspect in the development of artificial intelligence programs.

—Richard M. Renneboog M.Sc.

Batchelor, Bruce. Intelligent Image Processing in PROLOG. London, UK: Springer-Verlag, 1991. Print.

Brauer, Max. Logic Programming With Prolog. New York, NY: Springer, 2005. Print.

Coelho, Helder, and José C. Cotta. Prolog by Example: How to Learn, Teach and Use It. New York, NY: Springer, 1996. Print.

Deransart, P., A. Ed-Dbali, and L. Cervoni. PROLOG: The Standard Reference Manual. New York, NY: Springer, 1996. Print.

Jones, M. Tim, Artificial Intelligence: A Systems Approach. Sudbury, MA: Jones and Bartlett, 2009. Print.

Mathews, Clive. An Introduction to Natural Language Processing Through Prolog New York, NY: Routledge, 2014. Print.

Scott, Michael L. Programming Language Pragmatics. Waltham, MA: Morgan Kaufmann, 2016. Print.

Sterling, Leon, ed. The Practice of Prolog. Boston, MA: MIT Press, 1990. Print.