Logic programming is one of the 4 main programming paradigms. Its theory of computation is based on first order logic. Programming languages such as Prolog and Datalog implement it.
A form of logical sentences commonly found in logic programming, but not exclusively, is the Horn clause. An example is:
-
- p(X, Y) if q(X) and r(Y)
Some logic programming languages accept other logical sentences, such as the "choice" sentence in answer set programming.
Logical sentences can be understood purely declaratively. They can also be understood procedurally as goal-reduction procedures : to solve p(X, Y), first solve q(X), then solve r(Y).
The programmer can use the declarative reading of logic programs to verify their correctness. In addition, the programmer can use the known behaviour of the program executor to develop a procedural understanding of his program. This may be helpful when seeking better execution speed. However, many logically-based program transformation techniques have been developed to transform logic programs automatically and make them efficient.
Read more about Logic Programming: History, Prolog, Negation As Failure, Problem Solving, Knowledge Representation, Abductive Logic Programming, Metalogic Programming, Constraint Logic Programming, Concurrent Logic Programming, Inductive Logic Programming, Higher-order Logic Programming, Linear Logic Programming
Famous quotes containing the words logic and/or programming:
“Histories make men wise; poets witty; the mathematics subtle; natural philosophy deep; moral grave; logic and rhetoric able to contend.”
—Francis Bacon (15611626)
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)