[Haskell-beginners] Using a concept from Category Theory to enable you to come back home after your function has taken you somewhere
miguel.negrao-lists at friendlyvirus.org
Sat Aug 4 19:48:54 CEST 2012
A 04/08/2012, às 17:43, Costello, Roger L. escreveu:
> [Important] In order for a function to have an inverse function, it must be both injective and surjective.
> One final piece of terminology: a function that is both injective and surjective is said to be bijective. So, in order for a function to have an inverse function, it must be bijective.
> Recap: if you want to be able to come back home after your function has taken you somewhere, then design your function to possess the properties of injectivity and surjectivity.
I learned that a function has an inverse (from it’s image) if and only if it is injective in high school, don’t think category theory is needed here... But I have sometimes wondered: a) How do you know that a Haskell function is injective ? I don’t think it’s possible to write a function which checks if another function is injective or not . b) How to automatically get the inverse of a Haskell function ? I think I’ve only seen this done automatically for functions that are explicitly constructed out of operations which are know to compose into still injective functions. Can you say something else about this ?
More information about the Beginners