This should really be a comment. But since I dont't have enough reputation I have to write it here.
If you only want to check ideal membership you "just" have to compute a gröbnerGröbner basis and check if all S-polynomials reduce to $0$. (the above mentioned computer algebra systems check ideal member ship in this way)
If you want to compute the $g_i$ you need to compute the syzygyssyzygies. (I think this is just bookkeeping during the gröbnerGröbner basis computation)
Edit: I think the CAS Singular is able to compute the $g_i$ using the command "lift". http://www.singular.uni-kl.de/Manual/latest/sing_331.htm#SEC371https://www.singular.uni-kl.de/Manual/4-0-3/sing_513.htm