Which reaction mechanism involves formation of a carbocation intermediate followed by attack of a nucleophile?