Martingales associated with functions of Markov and finite variation processes