Katana VentraIP

Paradigm

1972 (1972)

Part 1: General core-Edition 1 (June 1995 (1995-06))
Part 2: Modules-Edition 1 (June 2000 (2000-06))

Untyped (its single data type is "term")

.pl, .pro, .P

Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily as a declarative programming language: the program is a set of facts and rules, which define relations. A computation is initiated by running a query over the program.[4]


Prolog was one of the first logic programming languages[5] and remains the most popular such language today, with several free and commercial implementations available. The language has been used for theorem proving,[6] expert systems,[7] term rewriting,[8] type systems,[9] and automated planning,[10] as well as its original intended field of use, natural language processing.[11][12]


Prolog is a Turing-complete, general-purpose programming language, which is well-suited for intelligent knowledge-processing applications.

An atom is a symbol name starting with a lower case letter or guarded by quotes. Examples of atoms include x, red, 'Taco', 'some atom', and 'p(a)'.

Numbers can be or integers. Most of the major Prolog systems support arbitrary length integer numbers.

floats

Variables are denoted by a string consisting of letters, numbers and underscore characters, and beginning with an upper-case letter or underscore. Variables closely resemble variables in logic in that they are placeholders for arbitrary terms.

A compound term is composed of an atom called a "functor" and a number of "arguments", which are again terms. Compound terms are ordinarily written as a functor followed by a comma-separated list of argument terms, which is contained in parentheses. The number of arguments is called the term's . An atom can be regarded as a compound term with arity zero. An example of a compound term is person_friends(zelda,[tom,jim]).

arity

Design patterns of Prolog[edit]

A design pattern is a general reusable solution to a commonly occurring problem in software design. Some design patterns in Prolog are skeletons, techniques,[16][17] cliches,[18] program schemata,[19] logic description schemata,[20] and higher-order programming.[21]

Modules[edit]

For programming in the large, Prolog provides a module system, which is in the ISO Standard.[24] However, while most Prolog systems support structuring the code into modules, virtually no implementation adheres to the modules part of the ISO standard. Instead, most Prolog systems have decided to support as de-facto module standard the Quintus/SICStus module system. However, further convenience predicates concerning modules are provided by some implementations only and often have subtle differences in their semantics.[25]


Some systems chose to implement module concepts as source-to-source compilation into base ISO Prolog, as is the case of Logtalk.[26] GNU Prolog initially diverted from ISO modules, opting instead for Contextual Logic Programming, in which unit (module) loading and unloading can be made dynamically.[27] Ciao designed a strict module system that, while being basically compatible with the de-facto standard used by other Prolog systems, is amenable to precise static analysis, supports term hiding, and facilitates programming in the large.[28] XSB takes a different approach and offers an atom-based module system.[29] The latter two Prolog systems allow controlling the visibility of terms in addition to that of predicates.[30]

Limits[edit]

Although Prolog is widely used in research and education,[52] Prolog and other logic programming languages have not had a significant impact on the computer industry in general.[53] Most applications are small by industrial standards, with few exceeding 100,000 lines of code.[53][54] Programming in the large is considered to be complex because not all Prolog compilers support modules, and there are compatibility problems between the module systems of the major Prolog compilers.[26] Portability of Prolog code across implementations has also been a problem, but developments since 2007 have meant: "the portability within the family of Edinburgh/Quintus derived Prolog implementations is good enough to allow for maintaining portable real-world applications."[55]


Software developed in Prolog has been criticised for having a high performance penalty compared to conventional programming languages. In particular, Prolog's non-deterministic evaluation strategy can be problematic when programming deterministic computations, or when even using "don't care non-determinism" (where a single choice is made instead of backtracking over all possibilities). Cuts and other language constructs may have to be used to achieve desirable performance, destroying one of Prolog's main attractions, the ability to run programs "backwards and forwards".[56]


Prolog is not purely declarative: because of constructs like the cut operator, a procedural reading of a Prolog program is needed to understand it.[57] The order of clauses in a Prolog program is significant, as the execution strategy of the language depends on it.[58] Other logic programming languages, such as Datalog, are truly declarative but restrict the language. As a result, many practical Prolog programs are written to conform to Prolog's depth-first search order, rather than as purely declarative logic programs.[56]

extends Prolog with frames/objects for knowledge representation.

F-logic

extends Prolog with a logical theory of state-changing update operators. It has both a model-theoretic and procedural semantics.

Transaction logic

has been created in order to answer Prolog's lack of graphics and interface.

OW Prolog

The allows embedding LPA Prolog for Windows in other programming languages, including: C, C++, C#, Java, Visual Basic (VB), Delphi, .NET, Lua, Python, and others. It exploits the dedicated string data type which LPA Prolog provides

LPA Intelligence Server

The Application Programming Interface (API) allows both the extension and embedding of Prolog in C, C++, Java, Visual Basic (VB), Delphi, .NET, and any language or environment which can call a .dll or .so. It is implemented for Amzi! Prolog + Logic Server but the API specification can be made available for any implementation.

Logic Server

is a bi-directional Java Prolog bridge which ships with SWI-Prolog by default, allowing Java and Prolog to call each other (recursively). It is known to have good concurrency support and is under active development.

JPL

a programming library bridge between Java and Prolog, implementing bi-directional predicate/method calling between both languages. Java objects can be mapped into Prolog terms and vice versa. Allows the development of graphical user interfaces (GUIs) and other functions in Java while leaving logic processing in the Prolog layer. Supports XSB and SWI-Prolog.

InterProlog

provides native syntax integration with Java, agent messaging and reaction rules. Prova positions itself as a rule-based scripting (RBS) system for middleware. The language breaks new ground in combining imperative and declarative programming.

Prova

An embeddable Prolog engine for Java. It includes a small IDE and a few libraries.

PROL

is an implementation of ISO Prolog as a Java library (gnu.prolog)

GNU Prolog for Java

provides interfaces to C, C++, Java, and relational databases.

Ciao

is a Prolog interpreter written in (managed) C#. Can easily be integrated in C# programs. Characteristics: reliable and fairly fast interpreter, command line interface, Windows-interface, builtin DCG, XML-predicates, SQL-predicates, extendible. The complete source code is available, including a parser generator that can be used for adding special purpose extensions.

C#-Prolog

A Prolog compiler and interpreter in PHP 5.3. A library that can be used standalone or within Symfony2.1 framework which was translated from Stephan Buettcher's work in Java which can be found [here stefan.buettcher.org/cs/wam/]

A Warren Abstract Machine for PHP

is a lightweight Prolog system for distributed applications and infrastructures, intentionally designed around a minimal core, to be either statically or dynamically configured by loading/unloading libraries of predicates. tuProlog natively supports multi-paradigm programming, providing a clean, seamless integration model between Prolog and mainstream object-oriented languages, namely Java, for tuProlog Java version, and any .NET-based language (C#, F#..), for tuProlog .NET version.

tuProlog

is a bi-directional interface between Prolog and Python using portable low-level primitives. It was initially developed for XSB by Anderson and Swift,[76] but has been adopted as a joint initiative by the XSB, Ciao and SWI-Prolog teams.

Janus

Frameworks exist which can bridge between Prolog and other languages:

Use in industry[edit]

Prolog has been used in Watson. Watson uses IBM's DeepQA software and the Apache UIMA (Unstructured Information Management Architecture) framework. The system was written in various languages, including Java, C++, and Prolog, and runs on the SUSE Linux Enterprise Server 11 operating system using Apache Hadoop framework to provide distributed computing. Prolog is used for pattern matching over natural language parse trees. The developers have stated: "We required a language in which we could conveniently express pattern matching rules over the parse trees and other annotations (such as named entity recognition results), and a technology that could execute these rules very efficiently. We found that Prolog was the ideal choice for the language due to its simplicity and expressiveness."[12] Prolog is being used in the Low-Code Development Platform GeneXus, which is focused around AI. Open source graph database TerminusDB is implemented in Prolog.[82] TerminusDB is designed for collaboratively building and curating knowledge graphs.

Comparison of Prolog implementations

. A method for building knowledge-based system that uses Prolog.

Logico-linguistic modeling

. A fully declarative approach to logic programming.

Answer set programming

Association for Logic Programming