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.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.X.(even(X)
divisible_by_two(X))
Two final examples of a single rule. The first:
all scots people are britishcan be turned into:
british(Person):-Note that Person is another logical variable. Now for the final example:scottish(Person).
if you go from one country to another they you are a touristturns into:
tourist(P):-where move(P,A,B) has the informal meaning that a person P has moved from country A to country B.move(P,Country1,Country2).
There is a problem here.
We really need to specify that Country1 and Country2 are legitimate
and distinct countries.