more general version of IF_EQUALS_OPTION

also exported as a rewrite from optionTheory