What is logical programming?

These are a programming paradigm based to a large extent on formal logic. Each programme developed in a logical programming language is a series of logically formed sentences describing facts and rules about a particular subject area. Logical programming belongs to the declarative programming languages and is the basis for application in the area of machine learning and Artificial intelligence.

This type of programming is a branch of computer programming that uses formal logical rules. In a sense, logic programming is the application of mathematical equations and other logical constructs to achieve programming results.

There is object-oriented and inductive logical programming:

  • with object-oriented programming, real requirements can be implemented in the system in order to derive realistic conclusions from them
  • inductive logic programming (ILP) is a certain area of machine learning. Thus, there is a procedure for automatically creating entire logical programmes from examples

One of the most important representatives of logical programming is the programming language Prolog. Prolog programmes consist of an extensive knowledge base and the entries are facts and rules. A user can formulate queries to this knowledge base.

The Prolog interpreter can use facts and rules to systematically find the appropriate answer. There are positive and negative results. With positive results, a query can be logically derived and with a negative result, the database is not able to find a derivation.

In which areas is logic programming used?

The Typical applications of logic programming are simulators, generators and systems for diagnosis and prognosis.. Applications can be found in the fields of artificial intelligence, Databases and expert systems.

Other areas of application are:

  • In business and commerce:
    Product configurator, route planner, market simulation (such as pricing)
  • Medicine:
    Diagnostic systems
  • Mathematics:
    Theorem provers and theorem generators
  • general natural sciences:
    Evaluate and interrogate geological and meteorological data collections as well as simulators and forecasting systems for weather, earthquakes and water levels.
  • Technique:
    CAD and CAM
  • Sociology
  • Psychology
  • Computational Linguistics:
    Machine translation natural language and the recognition and understanding of spoken language
  • Computer technology:
    Design and simulation of specific processors and of circuits
  • Compiler construction
  • Computer games:
    "intelligent" behaviour of simulated players, tactics and strategy
  • Document management:
    Systematically processing structured documents, semantic web and XSLT
  • Rapid prototyping

What is an example of a programme?

A declarative programming language always describes the desired end result and then lets the solution path be determined automatically. This always works quite well as long as the final state is clearly defined and a suitable execution procedure exists for it. If both are present, declarative programming is extremely efficient.

The following example illustrates the application:











married(werner, monika).

married(gerd, renate).

married(klaus, susanne).

motherFrom(monika, karin).

motherFrom(monika, klaus).

motherFrom(renate, susanne).

motherFrom(renate, peter).

motherFrom(susanne, aline).

motherFrom(susanne, dominique).



?- male(gerd).


?- married(gerd, monika).