How to write rules using CPL (with examples)