Determining whether a relation is a function