Completions and localizations of groups and spaces