If I have two lists of points ${x,y}$, say `list1` and `list2` and I need to find a continuous function $y(x)$ that goes above all the points in `list1` and below all points in `list2`. Is there any good way to do this?

For example if all the same $x$ occur in both lists one method would be to take the mean of the highest value in `list1` and the lowest value in `list2` and do a minimal Chi-Square fit. Is there something better to ensure that the curve absolutely has to go above/below the given points (there is no error in those points)?

What if `list1` and `list2` do not contain the same x values?

The application is that I have a costly function that tests whether $g(x,y)$ is true or false and it is known that if $g(x,y_1)$ is true so is $g(x,y_2)$ for all $y_2>y_1$. The goals is to find the (continuous) intersection $f(x)$.

The following image should clarify the goal. The goal is to find the continuous curve between the black and the red dots.

[![Example][1]][1]


  [1]: https://i.sstatic.net/D0KpG.png

----

In general the shape of the interface will be to difficult to recognize as simple analytic function (or sum of analytic functions).

Monotonicity is not always guaranteed but I am already very interested in any solution assuming monotonicity of f(x).