Logic Programming Paradigm

From GM-RKB
(Redirected from Logic Programming)
Jump to navigation Jump to search

A Logic Programming Paradigm is a Declarative Programming Paradigm that is based on a formal logic.



References

2014

  • (Wikipedia, 2014) ⇒ http://en.wikipedia.org/wiki/logic_programming Retrieved:2014-7-12.
    • 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 :- B1, …, Bn.

      and are read declaratively as logical implications:

       :H if B1 and … and Bn.

      H is called the head of the rule and B1, …, Bn 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, B1, …, Bn 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 B1, and … and solve Bn.

      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.