Logic-based Programming Language: Difference between revisions
m (Text replacement - ". ----" to ". ----") |
m (Text replacement - "<P> " to "<P> ") |
||
Line 20: | Line 20: | ||
=== 2013 === | === 2013 === | ||
* http://en.wikipedia.org/wiki/Logic_programming | * http://en.wikipedia.org/wiki/Logic_programming | ||
** '''Logic programming</B> is one of the 4 main [[programming paradigm]]s. Its [[theory of computation]] is based on [[first order logic]]. [[Programming language]]s such as [[Prolog]] and [[Datalog]] implement [[it]]. <P> | ** '''Logic programming</B> is one of the 4 main [[programming paradigm]]s. Its [[theory of computation]] is based on [[first order logic]]. [[Programming language]]s such as [[Prolog]] and [[Datalog]] implement [[it]]. <P> A form of logical sentences commonly found in logic programming, but not exclusively, is the [[Horn clause]]. An example is: <P> ::<tt>p(X, Y)</tt> if <tt>q(X) and r(Y)</tt> <P> Some logic programming languages accept other logical sentences, such as the "choice" sentence in [[answer set programming]]. <P> Logical sentences can be understood purely [[Declarative programming|declaratively]]. They can also be understood [[Procedural programming|procedurally]] as goal-reduction procedures : to solve <tt>p(X, Y)</tt>, first solve <tt>q(X)</tt>, then solve <tt>r(Y)</tt>. <P> 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 technique]]s have been developed to transform logic programs automatically and make them efficient. | ||
---- | ---- |
Latest revision as of 18:19, 2 June 2024
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.