from __future__ import print_function, division

from sympy.core.basic import Basic
from sympy.logic.boolalg import And, Or, Not, true, false
from sympy.sets.sets import (Set, Interval, Intersection, EmptySet, Union,
                             FiniteSet)
from sympy.core.singleton import Singleton, S
from sympy.core.sympify import _sympify
from sympy.core.decorators import deprecated
from sympy.core.function import Lambda


class ConditionSet(Set):
    """
    Set of elements which satisfies a given condition.

    {x | condition(x) is True for x in S}

    Examples
    ========

    >>> from sympy import Symbol, S, ConditionSet, Lambda, pi, Eq, sin, Interval
    >>> x = Symbol('x')
    >>> sin_sols = ConditionSet(Lambda(x, Eq(sin(x), 0)), Interval(0, 2*pi))
    >>> 2*pi in sin_sols
    True
    >>> pi/2 in sin_sols
    False
    >>> 3*pi in sin_sols
    False
    >>> 5 in ConditionSet(Lambda(x, x**2 > 4), S.Reals)
    True
    """
    def __new__(cls, condition, base_set):
        return Basic.__new__(cls, condition, base_set)

    condition = property(lambda self: self.args[0])
    base_set = property(lambda self: self.args[1])

    def contains(self, other):
        return And(self.condition(other), self.base_set.contains(other))

from __future__ import print_function, division

from sympy.core.basic import Basic
from sympy.logic.boolalg import And
from sympy.sets.sets import (Set, Interval, Intersection, EmptySet, Union,
                             FiniteSet)


class ConditionSet(Set):
    """
    Set of elements which satisfies a given condition.

    {x | condition(x) is True for x in S}

    Examples
    ========

    >>> from sympy import Symbol, S, ConditionSet, Lambda, pi, Eq, sin, Interval
    >>> x = Symbol('x')
    >>> sin_sols = ConditionSet(Lambda(x, Eq(sin(x), 0)), Interval(0, 2*pi))
    >>> 2*pi in sin_sols
    True
    >>> pi/2 in sin_sols
    False
    >>> 3*pi in sin_sols
    False
    >>> 5 in ConditionSet(Lambda(x, x**2 > 4), S.Reals)
    True
    """
    def __new__(cls, condition, base_set):
        return Basic.__new__(cls, condition, base_set)

    condition = property(lambda self: self.args[0])
    base_set = property(lambda self: self.args[1])

    def contains(self, other):
        return And(self.condition(other), self.base_set.contains(other))

Remove unused imports in conditionset.py