The common symmetries underlying quantum theory, probability theory, and number systems