Remove a formula and its unused dependencies