As discussed by other mean, the pb is not in rules but in the argument type of the method (seq in place of set). And in fact, there is no real problem, it was more than the refactoring was mixing optimization and algo logic, and Nico found a clean way to refactor again to make the optimization part apparent (so that it is not lost in the futur).