Simplify boolean expression