Move rules to a separate file

Rules are registered by decorating a function mapping a value to a tuple
of features with @rule.
Annotate all rules