how do you meant a->b?
prolog is programming logic, it is not object oriented and it is not your average language at all. It is a very recursive intense language and you must order your cases correctly as well as including the proper number of variables.
Here is a basic code which compares based on "enjoys", the first line enjoys.robert->baseball could be a meaning of this that it's implied that robert enjoys baseball. The last case of enjoys allows the item to be a list of 2 items, thus both items need to be shared, this can be extended easily with recursion.
I think the common method is straight forward, X and Y are people and Z is an activity. Hope this gives a basic start on teh structure. ! was my favorite thing in prolog.
CODE
enjoys(robert, baseball).
enjoys(robert, swimming).
enjoys(robert, basketball).
enjoys(robert, jogging).
enjoys(margaret, baseball).
enjoys(margaret, gardening).
enjoys(margaret, soccer).
enjoys(ronald, football).
enjoys(ronald, tv).
enjoys(ronald, baseball).
enjoys(X,[Y,Z]) :- enjoys(X,Y), enjoys(X,Z).
common(X, Y, Z) :- enjoys(X, Z), enjoys(Y, Z). /*returns the common activity */