Content deleted Content added
m →Reference: typo |
clarified lead, separate overview |
||
Line 1:
'''Constraint logic programming''' is a variant of [[logic programming]]
An example of a clause including a constraint is <code>A(X,Y) :- X+Y>0, B(X), C(Y)</code>. In this clause, <code>X+Y>0</code> is a constraint; <code>A(X,Y)</code>, <code>B(X)</code>, and <code>C(Y)</code> are literals like in regular logic programming.
Like in regular logic programming, programs are queried about the provability of a goal. A proof for a goal is composed of clauses whose constraints are satisfied and whose literals can in turn be proved using other clauses. Execution is done by an interpreter, which starts from the goal and [[Recursion|recursively]] scans the clauses trying to prove the goal. Constraints encountered during this scan are placed in a set called ''constraint store''. If this set is found out to be unsatisfiable, the interpreter [[Backtracking|backtrack]]s, trying to use other clauses for proving the goal. In practice, satisfiability of the constraint store is checked using a form of [[local consistency]], which does not always detect inconsistency. A complete check for satisfiability can be explicitely forced by using a specific literal.
==Overview==
Formally, constraint logic programs are like regular logic programs, but the body of clause can contain:
|