The complexity of formula minimization