I'm working on improving the imageset evaluation for Intervals on
https://github.com/sympy/sympy/pull/2723
imagset basically returns the set of possible outputs of a functions given
an input set. I want to extend this functionality to piecewise functions.
So I want to know if there is a general
A piecewise could be thought of as a list of (Expr, Boolean) pairs. We can
translate this into a set of (Expr, Set) pairs, intersect each set with the
set that is input to imageset, apply that particular expr, and then Union
all of the imagesets together. That may have been a little unclear. To
Thanks for this. So, we are trying to convert something like `[(x, x >
0), (-x , x <=0)]` to `[(x, (0, oo) ), (-x, (-oo, 0] ) ]`. I wrote a
small script to try it out for univariate functions
```
def to_expr_set(p, input_set=None):
if input_set is None:
U = Interval(-oo, oo) # U: curr