I just read up on the concept of perfect hash functions on a set $S$. I am quoting:
"A perfect hash function for a set S is a hash function that maps distinct elements in S to a set of integers, with no collisions."
It seems to me it's just lingo for an injection to $\mathbb{N}$. I am wondering whether this is correct, or whether there are subtleties that I am missing or whether there are more useful definitions that add subtleties that I am currently not aware of.
First a note on the concept of a hash function:
A hash function is more a cloud of ideas than a single definition. In its plainest form, a hash function is merely a function $h : S \to T$, possibly randomized. However, depending on the context and the reader, the term hash could imply any of the following (and this list is likely not exhaustive):
$h$ does not have any collisions (or, collisions occur with low probability). Sometimes we incorporate this property into the name, and call such a function a collision-resistant hash.
$h$ has some limited independence property. For instance, a pairwise-independent hash is a randomized function $h : S \to T$ such that for any distinct $s_1, s_2 \in S$, the $T$-valued random variables $h(s_1)$ and $h(s_2)$ are independent.
We can use $h$ to store and retrieve $S$ quickly. Here we could think of $S$ as some data, and $T$ as the bins to hold it.
For the items (1.) and (2.) above, it is usually sufficient to consider $h$ as a mathematical function with some additional properties; but this does not give the complete picture for (3.). For item (3.), we might also fast algorithms to compute $h$, to perform insertions and lookups, and so on. Such a collection of algorithms is sometimes called a hashing scheme/*technique*, or a hash function construction. (More details on this follow.)
Perfect hashing.
Definition 1: Let me quote from the introduction in the section on perfect hashing in Cormen et. al., Introduction to Algorithms (2nd ed., Chapter/Section 11.5, p. 245):
From this paragraph, it is clear that (at least from the point of view of this book), the difference between a regular hash function and perfect hash function is not that perfect hashing is injective, but that we get a guaranteed worst-case performance. (It is possible that worst-case guarantee would be considered attractive by these authors, simply because this is a textbook on the mathematical aspects of algorithms. Perhaps a systems engineer might care more about the fast search time than the fact that this is worst-case.)
Definition 2: Here's a slightly different definition. The following excerpt is from Djamal Belazzougui, Fabiano C. Botelho, and Martin Dietzfelbinger, Hash, Displace, and Compress, referenced in the Wikipedia article on Perfect hash function:
(I suppressed the references cited in the above paragraph.)
Notice that these authors segregate the mathematical aspect --for want of a better phrase-- of $h$ (i.e., it is one-to-one on a given subset $S$) from the computation aspect. This is usually done so that the author could focus on one or the other aspect; however, the computation aspect seldom just disappears completely.