:lipstick: Refactor rule checking into its own predicate.

Also update the comments to improve readability and to be more
compatible with PlDoc.
Rename main module to 'rewrite'