Theoretical study of catalytic reactions of carbenes: haptotropic rearrangements and the Dötz reaction