abstract rewrite