simplify logic expression