Implement rewriteToNF function.