A Mathematical Framework for the Global Brain