Implement rule extract function.