Let I be an ideal. Then a basis ⟨g1,…,gN⟩ is a Groebner basis iff for all pairs i=j, S(gi,gj)=0.
Recall that a basis is an Grober basis iff LT(I)=⟨LT(g1),…,LT(gN)⟩. That is, the ideal of leading terms of Iis generated by the leading terms of the generators.
for a basis F, we should consider r(i,j)≡remF(S(fi,fj)). If r(i,j)=0, then make F′≡F∪{S(fi,fj}.