In general, please try to boil down your problem to something that can be displayed here, because dropbox files tend to have a short lifetime.

`product_rule`

only works when you have a derivative acting on a product. It does not work when you have a derivative acting on a sum of products. In those cases, you first need to `distribute`

the derivative over the terms in the product.

Thanks for spotting the second issue. `eliminate_metric`

should by default act at an arbitrary level in the expression, but has `deep=False`

as default argument, and hence does not go into the individual terms of the sum which forms your expression. You can work around this bug for the time being by using

```
eliminate_metric(_, deep=True);
```