Towards a Mathematical Theory of Abstraction