(defrule link-exists :backward
((link-exists ?town1 ?town2)
<--
(or (link ?link town1 ?town1 town2 ?town2)
(link ?link town2 ?town1 town1 ?town2))
(cut))((link-exists ?town1 ?town2)
<--
(route-exists ?town1 ?town2)))
which says that a link exists between two towns either if there is a link object between them in the object base or if there is a route between the towns. The
route-exists
predicate would be defined by another backward chaining rule, or might be in the Prolog database.
KnowledgeWorks and Prolog User Guide (Unix version) - 6 Dec 2011