Determining if a given set of ordered pairs is a function