Determining if a mapping is a function