Find the word definition

WordNet
logic programming
  1. n. a computer language designed in Europe to support natural language processing [syn: Prolog, logic programing]

  2. creating a program that enables the computer to reason logically

Wikipedia
Logic programming

Logic programming is a programming paradigm based on formal logic. A program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic programming language families include Prolog, Answer set programming (ASP) and Datalog. In all of these languages, rules are written in the form of clauses:

H :- B<sub>1</sub>, …, B<sub>n</sub>.

and are read declaratively as logical implications:

H if B<sub>1</sub> and … and B<sub>n</sub>.

H is called the head of the rule and B<sub>1</sub>, …, B<sub>n</sub> is called the body. Facts are rules that have no body, and are written in the simplified form:

H.

In the simplest case in which H, B<sub>1</sub>, …, B<sub>n</sub> are all atomic formulae, these clauses are called definite clauses or Horn clauses. However, there exist many extensions of this simple case, the most important one being the case in which conditions in the body of a clause can also be negations of atomic formulae. Logic programming languages that include this extension have the knowledge representation capabilities of a non-monotonic logic.

In ASP and Datalog, logic programs have only a declarative reading, and their execution is performed by means of a proof procedure or model generator whose behaviour is not meant to be under the control of the programmer. However, in the Prolog family of languages, logic programs also have a procedural interpretation as goal-reduction procedures:

to solve H, solve B<sub>1</sub>, and ... and solve B<sub>n</sub>.

Consider, for example, the following clause:

fallible(X) :- human(X).

based on an example used by Terry Winograd to illustrate the programming language Planner. As a clause in a logic program, it can be used both as a procedure to test whether X is fallible by testing whether X is human, and as a procedure to find an X that is fallible by finding an X that is human. Even facts have a procedural interpretation. For example, the clause:

human(socrates).

can be used both as a procedure to show that socrates is human, and as a procedure to find an X that is human by "assigning" socrates to X.

The declarative reading of logic programs can be used by a programmer to verify their correctness. Moreover, logic-based program transformation techniques can also be used to transform logic programs into logically equivalent programs that are more efficient. In the Prolog family of logic programming languages, the programmer can also use the known problem-solving behaviour of the execution mechanism to improve the efficiency of programs.