canonicalizer: add ExtractRule and RewriteRule