logic languages
- Logic programming is based on Horn logic. A Horn clause is an
if-then rule with one conclusion in the then
part (head) and zero or more goals in the if part (body).
- The programmer specifies a problem by giving a set of Horn clauses
describing facts and properties about the problem.
- The user can ask questions to the system by giving it goals to
prove. The system automatically tries to prove the goals using
the Horn clauses. If the system is unable to prove the goal from
the Horn clauses it has available, it assumes that the goal
is not true.
- A logic programming system that has the completeness-of-search
property will always find a proof if one exists. Such systems
typically use a search strategy based on backtracking.
- Horn clauses may use logical variables, denoting unspecified
objects. A logical variable is initially unbound. It can be
bound only once, unless its value is unbound again during
the backtracking. Binding occurs as a side-effect of matching
a goal with the head of a clause.
- Horn clauses express relations rather than functions. The
arguments of a clause are not marked in advance as being input
or output, but can often be used in both ways.
- Structures and lists are the most important data structures
in logic languages.
- For efficiency, the programmer may control the order in which
alternative clauses for a goal are tried as well as the order
in which different subgoals in one clause are tried.
- Prolog is by far the most popular logic language.