Rewrite theorem problem