mother(anne, bridget). mother(abigail, bridget). mother(bridget, carol). grandmother(C, GM) <= mother(C, M) and mother(M, GM). ? grandmother(anne, carol). { Grand Mother }The query logically follows from the other statements because it matches the general rule if C is anne, GM is carol, and M is bridget.
[Exercise: Now change the query above to ask "of whom is carol a grandmother?"]
The term procedural semantics refers to interpreting Prolog statements as procedure definitions to be called and run. The three Prolog statements above can be thought of as definitions of procedures `mother' and `grandmother'. In order to answer the previous query, call the procedure `grandmother' which calls `mother' twice. Procedural semantics require notions of the order of execution, a search strategy and so on.
Declarative semantics are easier to think about and to program in terms of and procedural semantics are needed for implementations. Unfortunately there is a gap between the two semantics. In some problems it is necessary to consider the procedural semantics to be able to write a correct Prolog program. Much research is aimed at reducing this gap.