The invariant formulation of CP violation involves the generation of s
ets of invariant constraints for CP conservation, the manipulation of
their expressions and the identification of complete and minimal subse
ts of such constraints. In this paper we present a collection of subro
utines to deal with these three tasks in a fast, reliable and systemat
ic way, with examples for the leptonic sector.