Logic Programming

Clausal-Form Logic (2)

There are some alternative classifications of clauses:

  • Jacques HerbrandIndefinite clauses are called non-Horn clauses (all others are Horn clauses).
  • In the logic programming context, positive unit clauses are also called assertions.
  • All other definite clauses are called conditional clauses.
  • In the Prolog context, positive unit clauses are called facts.
  • All other definite clauses are called rules.
  • Negative clauses are called either queries or goal clauses in logic programming or Prolog.

A set of clauses can also be classified.

  • A program is a set of non-negative clauses. (a.k.a. A database, a knowledge base or a rule base).
  • A set of definite clauses whose positive literals all share the same predicate symbol is referred to as either a definition or as a procedure for that symbol.
Clausal Form Prolog equivalent Classification
a a. Fact
a OR ¬b OR ¬c a :- b, c Rule

The second example can be clarified as follows

a OR ¬b OR ¬c
 = a OR ¬(b AND c)
 = (b AND c) IMPLIES a
 = a IF (b AND c)
 = a :- b, c.     (reads as "a if b and c")

Programs can be separated into two parts, definite and indefinite. A program consisting of only definite clauses is a definite program. Any other program is an indefinite program. Indefinite programs are much more complicated to implement. The following is an example of a definite program, it is a definition for 'likes':

likes(sim, X) IMPLIES likes(X, logic)
likes(sim, logic)
likes(max, logic)
likes(X, Y) IMPLIES loves(X, Y)

In some cases, sentences are naturally written down in unrestricted first order logic. They then need to be converted into clausal form. This can be done using a sequence of steps, that can be defined in an algorithm.