Repository: sympy/sympy

Issue:
Incorrect result for Intersection of S.Integers( and S.Naturals) with Interval
```python
In []: Intersection(S.Integers, Interval(0.2, 0.8)) # results in a NotImplementedError

In []: Intersection(S.Naturals, Interval(0.2, 0.8)) # results in a NotImplementedError
```
The correct intersection should be an `EmptySet`.



Discussion:

Patch:
diff --git a/sympy/sets/fancysets.py b/sympy/sets/fancysets.py
index d819ea4f59..430a2294b1 100644
--- a/sympy/sets/fancysets.py
+++ b/sympy/sets/fancysets.py
@@ -552,8 +552,12 @@ def _intersect(self, other):
             if not all(i.is_number for i in other.args[:2]):
                 return
 
+            # In case of null Range, return an EmptySet.
+            if self.size == 0:
+                return S.EmptySet
+
             # trim down to self's size, and represent
-            # as a Range with step 1
+            # as a Range with step 1.
             start = ceiling(max(other.inf, self.inf))
             if start not in other:
                 start += 1


Test patch:
diff --git a/sympy/sets/tests/test_fancysets.py b/sympy/sets/tests/test_fancysets.py
index ebee5c5668..d4e77e2748 100644
--- a/sympy/sets/tests/test_fancysets.py
+++ b/sympy/sets/tests/test_fancysets.py
@@ -314,6 +314,10 @@ def test_range_interval_intersection():
     assert Range(4).intersect(Interval.open(0, 3)) == Range(1, 3)
     assert Range(4).intersect(Interval.open(0.1, 0.5)) is S.EmptySet
 
+    # Null Range intersections
+    assert Range(0).intersect(Interval(0.2, 0.8)) is S.EmptySet
+    assert Range(0).intersect(Interval(-oo, oo)) is S.EmptySet
+
 
 def test_Integers_eval_imageset():
     ans = ImageSet(Lambda(x, 2*x + S(3)/7), S.Integers)