Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A QUICK FUNDAMENTAL QUESTION IN PROLOG.... 1

Status
Not open for further replies.

Slight

Technical User
Oct 20, 2010
1
RO
Considering Adam is the father of John, does prolog recognize the two clauses below as the same? (thanks in anticipation)
father(john, adam).
father(adam, john).
 
You are the one that gives meaning to Prolog clauses. But once you give some meaning (semantic) to a Prolog term, you need to hold on to that semantic forever.

Example: for father(X, Y) you can assign the following semantic - "X is the father of Y". Remember that assigning a semantic is only in your head. You can read father(X, Y) the other way around, but then you will have to use it accordingly.

In our case, then:
- father(adam, john) means "adam is the father of john"
- father(john, adam) means "john is the father of adam"

Prolog will never know who is the father of who. If will only see father(adam, john). If you use the father(X, Y) facts with the correct meaning everywhere, Prolog doesn't even need to know who is the father of who. Only you know that. Hope you understood ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top