Let $f(x_1,\ldots, x_n)\in\Bbbk [x_1,\ldots,x_n]$ be a given polynomial (assume $\Bbbk$ algebraically closed if you want). Suppose that we are given $n$ polynomials $v_1,\ldots v_n \in\Bbbk[x_1,\ldots, x_n]$. Suppose that we know that there exists a polynomial $P(t_1,\ldots,t_n)\in\Bbbk[t_1,\ldots,t_n]$ such that
$$f(x_1,\ldots,x_n)=P(v_1(x_1,\ldots,x_n),\ldots,v_n(x_1,\ldots,x_n))\in\Bbbk[x_1,\ldots,x_n]$$
How to find $P$ explicitely? Is there a computer program that can easily solve this problem?
I'm also interested in answers under the hypothesis that $v_1,\ldots, v_n$ are homogeneus of degrees $d_1,\ldots, d_n$ (and possibly some symplifying assumptions on $d_i$), and/or $f$ is itself homogeneus.
To me this is just a practical question which is natural enough to be asked on MO; I apologize if it is totally trivial for some people more knowledgeable in computational matters.