Parallel rewrite implemented.

A function to rewrite a graph based on several rules is implemented.
Also, now the rule builder generates keep rules.