DP rewrite complete