# Replacing Polynomials with another Polynomial

So I am working with quotient rings so I want to be able to replace terms as there can be many representatives. Let's say I have a polynomial ring of four variables quotiented off by some ideal. Futhermore, we have

```
x*w "=" x*y+y*z
```

in the quotient. Is there some replace function that will let me replace polynomial expressions with one another? For example, if I had 3*x*w+x*y, is there something like

```
replace(3*x*w+x*y, x*w for x*y+y*z)
```

which should output

```
4*x*y+3*y*z
```