Rewrite.apply_lemma is written in state passing style.

This removes a use of Evd.merge.