Rewrite formulas that don't have the same entity as their input variables.