Content deleted Content added
references and category |
m some links and minor fixes |
||
Line 1:
'''Constraint logic programming''' is a variant of [[logic programming]] that
A constraint logic programming is a logic program that includes constraints in the body of clauses. A clause can be used to prove the goal if its constraints are satisfied and its literals can be proved. More precisely, the set of constraints of clauses used in a derivation is supposed to be satisfiable in order for the derivation to be valid.
When the interpreter scans the body of a clause, it
If the constraint store becomes unsatisfiable, the interpreter should backtrack, as the clause it is evaluating contains a constraint that cannot be satisfied. In practice, some form of [[local consistency
Formally, constraint logic programs are like regular logic programs, but the body of clause can contain:
Line 13:
# labeling literals
During evaluation, a pair <math>\langle G,S \rangle</math> is maintained. The first element is the current goal; the second element is
Initially, the current goal is the goal and the constraint store is empty. At each step, the first element of the goal is removed and checked. This checking may introduce new literals in the current goal and new constraints in the constraint store.
At each step, the first literal of the goal is considered and removed from the current goal. If it is a constraint, it is added to the constraint store. If it is a literal, it is treated as in regular logic programming: a clause whose head has the same top-level predicate as the literal is chosen; its body is placed in front of the current goal; equality between the literal and the head of the clause is added to the constraint store.
Line 19 ⟶ 21:
If the constraint store is unsatisfiable, backtracking should be done. However, checking unsatisfiability at each step would be inefficient. For this reason, some form of local consistency is checked instead.
When the current goal is empty, a regular logic program interpreter
==Reference==
|