There are several different
DeclarativeProgramming paradigms which are oft confused:
LogicProgramming,
ConstraintProgramming, and
ConstraintLogicProgramming.
In logic programming, one is given a finite set of
facts and a finite set of
axioms; together these comprise a system. If the facts and axioms lead to contradiction, the system is
inconsistent (and in error), otherwise it is consistent. A type of
TheoremProvingSystem called an
InferenceEngine is used to deduce whether a given query is true or false. Most such implemented systems use the
ClosedWorldAssumption--meaning that if something cannot be shown to be true, it is assumed false.
PrologLanguage is a well-known
LogicProgramming language.
In a constraint programming system (whether or not this is a full-fledged
ProgrammingParadigm), one is given a set of variables (and domains these variables may range over), and a set of
constraints on the variables. One attempts to find a
solution to this system--a set of values for each variable such that all constraints are satisfied. A system with no solutions is inconsistent. In some cases, one is only interested in the (non)existence of a solution; in others one wants all solutions, or an optimal solution. (In some cases, a system with more than one solution is undesirable). A well-known problem in constraint programming (solved using domain-specific techniques) is solving a system of linear equations. Unlike
LogicProgramming, there is no way to specify axioms (though
ConstraintSolvers may use well-known axioms of mathematics, such as transitivity of the < operator, in finding a solution).
ConstraintLogicProgramming is a hybrid of the two.