A Backtracking Horn-Clause Resolver
Maintain the rules in a database of rules.
Accept a query (goal) as a positive unit clause, e.g.,
Put this goal on the subgoal list.
Repeatedly try to satisfy the next clause on the subgoal list as follows:
Find a rule in the database whose head unifies with the subgoal. Apply the same unifier to the literals in the body of that rule and replace the subgoal by these new literals.
If the subgoal list is empty, stop. The combined set of unifiers includes the solution.