Theory of interaction of metals and alloys with a corrosive environment