Determining if a mapping represents a function