Add functions for rule rewriting.