next up previous contents
Next: The Logical Variable Up: Knowledge Representation Previous: Rules

Semantics

Here is an informal version of the procedural semantics for the example above:

If we can find a value of X that satisfies the goal even(X) then we have also found a number that satisfies the goal divisible_by_two(X).
The declarative semantics.
If we can prove that X is ``even'' then we have proved that X is ``divisible_by_two''.
Note that there is an implicit universal quantification here. That is, for all objects those that are even are also divisible by two.
X.(even(X) divisible_by_two(X))
Also note that the head goal is found on the right of the standard logical implication symbol. It is a common error to reverse the implication.

Two final examples of a single rule. The first:

all scots people are british
can be turned into:
 
british(Person):-

scottish(Person).

Note that Person is another logical variable. Now for the final example:
if you go from one country to another they you are a tourist
turns into:
 
tourist(P):-

move(P,Country1,Country2).

where move(P,A,B) has the informal meaning that a person P has moved from country A to country B.

There is a problem here. We really need to specify that Country1 and Country2 are legitimate and distinct countriesgif.

 



Paul Brna
Mon May 24 20:14:48 BST 1999