Repository: sympy/sympy

Issue:
Complements with symbols should remain unevaluated
Complements with symbols should remain unevaluated for the same reason Intersections with symbols should remain unevaluated i.e., we don't know what the complement is unless we the value of the symbol. Our current behaviour is:
```python
In [14]: Complement(FiniteSet(y), FiniteSet(1))
Out[14]: {y} # should be {y}\{1}
```

Discussion:
gxyd: Are the tests-failures related to this ?

Patch:
diff --git a/sympy/series/order.py b/sympy/series/order.py
index d3dd991efe..e5a153dc1f 100644
--- a/sympy/series/order.py
+++ b/sympy/series/order.py
@@ -6,6 +6,7 @@
 from sympy.core.compatibility import default_sort_key, is_sequence
 from sympy.core.containers import Tuple
 from sympy.utilities.iterables import uniq
+from sympy.sets.sets import Complement
 
 
 class Order(Expr):
@@ -415,6 +416,10 @@ def _eval_subs(self, old, new):
                         from sympy.solvers.solveset import solveset
                         d = Dummy()
                         sol = solveset(old - new.subs(var, d), d)
+                        if isinstance(sol, Complement):
+                            e1 = sol.args[0]
+                            e2 = sol.args[1]
+                            sol = set(e1) - set(e2)
                         res = [dict(zip((d, ), sol))]
                         point = d.subs(res[0]).limit(old, self.point[i])
                     newvars[i] = var
diff --git a/sympy/sets/sets.py b/sympy/sets/sets.py
index fc3411d6ec..a748db622c 100644
--- a/sympy/sets/sets.py
+++ b/sympy/sets/sets.py
@@ -1784,6 +1784,12 @@ def _complement(self, other):
             elif nums == []:
                 return None
 
+        elif isinstance(other, FiniteSet):
+            elms_unknown = FiniteSet(*[el for el in self if other.contains(el) not in (True, False)])
+            if elms_unknown == self:
+                return
+            return Complement(FiniteSet(*[el for el in other if self.contains(el) != True]), elms_unknown)
+
         return Set._complement(self, other)
 
 


Test patch:
diff --git a/sympy/sets/tests/test_sets.py b/sympy/sets/tests/test_sets.py
index 8ad2b79745..b841e4be20 100644
--- a/sympy/sets/tests/test_sets.py
+++ b/sympy/sets/tests/test_sets.py
@@ -888,3 +888,9 @@ def test_issue_9637():
         Complement(Union(Interval(1, 2, False, True), Interval(2, 3, True, False)), a)
     assert Complement(a, S.Reals) == Complement(a, S.Reals, evaluate=False)
     assert Complement(a, Interval(1, 3)) == Complement(a, Interval(1, 3), evaluate=False)
+
+
+def test_issue_9808():
+    assert Complement(FiniteSet(y), FiniteSet(1)) == Complement(FiniteSet(y), FiniteSet(1), evaluate=False)
+    assert Complement(FiniteSet(1, 2, x), FiniteSet(x, y, 2, 3)) == \
+        Complement(FiniteSet(1), FiniteSet(y), evaluate=False)