'Compute syzygies. See [SCA, algorithm 2.5.4].'

def _syzygies(self):

    from sympy.matrices import eye
    k = len(self.gens)
    r = self.rank
    im = eye(k)
    Rkr = self.ring.free_module((r + k))
    newgens = []
    for (j, f) in enumerate(self.gens):
        m = ([0] * (r + k))
        for (i, v) in enumerate(f):
            m[i] = f[i]
        for i in range(k):
            m[(r + i)] = im[(j, i)]
        newgens.append(Rkr.convert(m))
    F = Rkr.submodule(order='ilex', TOP=False, *newgens)
    G = F._groebner_vec()
    G0 = [x[r:] for x in G if all(((y == self.ring.convert(0)) for y in x[:r]))]
    return G0
