Martingales associated with functions of Markov and finitevariation processes