Logic-based Programming Language
A Logic-based Programming Language is a declarative programming language that is based on restricted forms of logic statements (e.g. horn clauses).
- Context:
- It can be associated with a Logic-based Computer Program.
- It can provide nondeterminism and predicates with multiple input/output modes that offer Code Reuse.
- It can be based on Predicate Logic.
- Example(s):
- Counter-Example(s):
- See: Imperative Programming Language.
References
2013
- http://en.wikipedia.org/wiki/Logic_programming
- 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.
- 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.