learn rules and use rules