Foundations of a theory of social forms