Example:Bijective file conversions
Suppose you are writing a program to convert data from one file format to another (or a function to convert one data structure to another). Such a program describes a function . You can think of as describing the original file format, and as describing the new file format.
It is sensible to check that bijection. The reason a bijection is desirable is because it has a two-sided inverse which can be used to convert the file back into the original format.
is aIf injective, then it is "lossy": some information about the original file is lost.
is notIf surjective, then the resulting file format has more data than the original. Further edits to the data in the format (in other words, functions from to ) may prevent the object from being mapped back to the original file format.
is not