The fact that the list zdl is not empty means that there are cases, modulo which, p is zero. This is clear from the definition of p and rc.
Since q is regular with respect to T and since every variable q is algebraic with respect to T, we can compute the inverse of q modulo T.
For each case where r is regular modulo rc, we can compute its inverse.