A topological theory of the brain