A relation can be between any number of objects, and if one of these objects is a variable, the interpreter will try to infer the value of that variable using the facts and the rules. The binding of the variable X to a constant such as wilma is called unification . Unification is used by the interpreter to match your query against the facts and rules in your program. The interpreter does exhaustive search of the facts and the rules in your program in order to unify all the variables. Backtracking allows the interpreter to unbind the variable and try to find another binding.
Rules Here are some examples of rules.
If a goal can be proven in several different ways, it is written as separate rules. A goal can be proven by proving a combination of subgoals. The primary data structure in Prolog is lists as in functional languages. For example, here are the rules defining a member relation that checks to see if an element is the member of a list. The first rule is the easy case when X is the first element on the list.