<predicate> [:- <predicate_list>].
where <predicate> is <name>(<parameter_list>)
In Prolog:
mother (peggy, george).
NOTE the period at the end of each rule. This is another use of "Forward Polish" notation where the relationship precedes the operands.
If X is the mother of Y and Y is a parent of Z, then X is a grandmother of Z. Or put the "Prolog" way, X is the grandmother of Z provided that X is the mother of Y and Y is a parent of Z.
In Prolog:
In Prolog read ":-" as "provided that" and "," as "and". Though not shown here, Prolog uses ";" in rules to mean "or".
CS1104
Main Page
Last Updated 11/03/2000
©
J.A.N. Lee, 2000