Proton stability in grand unified theories, in strings and in branes