3. Instantiation, predicate

Consider the Prolog database from the previous page:

  1. Fact: spouse (john, jane)
  2. Fact: spouse (david, mary)
  3. Fact: spouse(george, susan)
  4. Fact: female (jane)
  5. Fact: female (mary)
  6. Fact: female (susan)
  7. Fact: male (john)
  8. Fact: male (david)
  9. Fact: male (george)
  10. Rule: husband(A,B) IF spouse(A,B) AND male (A)
  11. Rule: wife (A,B) IF spouse(A,B) AND female(B)

Predicate Logic

In the examples discussed so far, the goal

 		wife(david,mary)?

was declared.

The wife part is called the 'predicate'. The predicate is a logic statement that will be checked to determine if it is true or false. If it is true, a specific value will be returned.

For example, the predicate

son(john)?

is certainly false as far as this database is concerned as there is no such fact or rule for 'son'.

The predicate contains 'arguments' that need to be checked. So david and mary are the arguments of the predicate 'wife'.

 wife(david,mary)?

Prediicates that may find a match within this database are

spouse 
female
male
husband
wife

Instantiate

A predicate can be declared with an unassigned value, like so

spouse(A,mary)

The 'A' argument is unassigned. This is asking the predicate logic question: "Does Mary have a spouse and if so, return the name of the spouse?"

The database will be scanned, the predicate is found to be true and 'david' is returned as 'A'.

The technical term to describe assigning values to the arguments of a predicate from within the database is called 'instantiation'

For example

The predicate: female(A) within this database can have the 'A' argument instantiated to any matching fact. In this case, the predicate can be instantiated to

jane 
mary
susan
  

 

Copyright © www.teach-ict.com