Towards a theory of emergent functionality