� ��g>7� ��ddlmZmZddlmZddlmZddlZddlm Z m Z m Z ddl m Z ddlmZmZddlmZmZdd lmZdd lmZdd lmZdd lmZmZmZmZmZdd l m!Z!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(m)Z)m*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1m2Z2m3Z3m4Z4ddl5m6Z6m7Z7m8Z8ddl9m:Z:m;Z;ddl<m=Z=m>Z>ddl?m@Z@mAZAmBZBmCZCmDZDmEZEddlFmGZGddlHmIZIddlJmKZKmLZLmMZMmNZNmOZOddlPmQZQmRZRddlSmTZTmUZUddlVmWZWed�de-jDe-jDe-jDd e-jEe-jEe-jEi��ZXeGd!�d"e e����ZYGd#�d$eY��ZZGd%�d&eY��Z[Gd'�d(eYe$��Z\Gd)�d*eYe$��Z]Gd+�d,eY��Z^Gd-�d.eYe,�/��Z_Gd0�d1eYe,�/��Z`Gd2�d3eY��Zad4�e8eb<d5�e8ec<Gd6�d7eY��ZdGd8�d9eY��Zed:�Zfd;�Zgd<�Zhd=�Zid>�Zjd?�Zkd@�ZldA�ZmdB�ZndC�ZodD�ZpdE�ZqGdF�dGe ��ZrdS)H�)�Any�Callable)�reduce)� defaultdictN)�Kind� UndefinedKind� NumberKind)�Basic)�Tuple� TupleKind)�sympify_method_args�sympify_return)� EvalfMixin)�Expr)�Lambda)� FuzzyBool� fuzzy_bool�fuzzy_or� fuzzy_and� fuzzy_not)�Float�Integer)� LatticeOp)�global_parameters)�Eq�Ne�is_lt)� Singleton�S)�ordered)�symbols�Symbol�Dummy�uniquely_named_symbol)�_sympify�sympify�_sympy_converter)�exp�log)�Max�Min)�And�Or�Not�Xor�true�false)� deprecated)�sympy_deprecation_warning)�iproduct�sift� roundrobin�iterable�subsets)� func_name� filldedent)�mpi�mpf)� prec_to_dpsc��dS�N�r@��_/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/sets/sets.py�<lambda>rC%s��$�rATFc��eZdZUdZdZdZdZdZdZdZ dZ dZ dZ e ed<dZe ed<dZe ed<dZdZe ed<dZe ed <eed d d � ��d�����Zed���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!ed���Z"ed���Z#ed���Z$ed���Z%d�Z&d�Z'd�Z(d �Z)d!�Z*d"�Z+d#�Z,d$�Z-d%�Z.d&�Z/d'�Z0d(�Z1ed)���Z2ed*���Z3ed+���Z4ed,���Z5ed-���Z6ed.���Z7ed/���Z8ed0���Z9ed1���Z:d2�Z;d3�Z<e=d4ge>��d5���Z?e=d4ge>��d6���Z@e=d4ge>��d7���ZAe=d4ge>��d8���ZBe=d4ge>��d9���ZCe=d:eDfge>��d;���ZEe=d4ge>��d<���ZFd=�ZGdS)>�Seta� The base class for any kind of set. Explanation =========== This is not meant to be used directly as a container of items. It does not behave like the builtin ``set``; see :class:`FiniteSet` for that. Real intervals are represented by the :class:`Interval` class and unions of sets by the :class:`Union` class. The empty set is represented by the :class:`EmptySet` class and available as a singleton as ``S.EmptySet``. r@FN�is_Intersection�is_UniversalSet� is_Complement�is_empty� is_finite_set�� The is_EmptySet attribute of Set objects is deprecated. Use 's is S.EmptySet" or 's.is_empty' instead. �1.5�deprecated-is-emptyset��deprecated_since_version�active_deprecations_targetc��dSr?r@��selfs rB� is_EmptySetzSet.is_EmptySetN� ���trAc�� |j}|jsJ�|���}n/#ttt t f$rtj}YnwxYw|S)z? Return infimum (if possible) else S.Infinity. ) �inf� is_comparable�evalf�NotImplementedError�AttributeError�AssertionError� ValueErrorr�Infinity)�expr�infimums rB� _infimum_keyzSet._infimum_keyZse��  !��h�G��(� (� (�(��m�m�o�o�G�G��#��� �<� !� !� !��j�G�G�G� !�����s�$'�)A�Ac�"�t||��S)a� Returns the union of ``self`` and ``other``. Examples ======== As a shortcut it is possible to use the ``+`` operator: >>> from sympy import Interval, FiniteSet >>> Interval(0, 1).union(Interval(2, 3)) Union(Interval(0, 1), Interval(2, 3)) >>> Interval(0, 1) + Interval(2, 3) Union(Interval(0, 1), Interval(2, 3)) >>> Interval(1, 2, True, True) + FiniteSet(2, 3) Union({3}, Interval.Lopen(1, 2)) Similarly it is possible to use the ``-`` operator for set differences: >>> Interval(0, 2) - Interval(0, 1) Interval.Lopen(1, 2) >>> Interval(1, 3) - FiniteSet(2) Union(Interval.Ropen(1, 2), Interval.Lopen(2, 3)) )�Union�rS�others rB�unionz Set.unionhs��2�T�5�!�!�!rAc�"�t||��S)a� Returns the intersection of 'self' and 'other'. Examples ======== >>> from sympy import Interval >>> Interval(1, 3).intersect(Interval(1, 2)) Interval(1, 2) >>> from sympy import imageset, Lambda, symbols, S >>> n, m = symbols('n m') >>> a = imageset(Lambda(n, 2*n), S.Integers) >>> a.intersect(imageset(Lambda(m, 2*m + 1), S.Integers)) EmptySet �� Intersectionrds rB� intersectz Set.intersect�s��&�D�%�(�(�(rAc�,�|�|��S)z/ Alias for :meth:`intersect()` �rjrds rB� intersectionzSet.intersection�����~�~�e�$�$�$rAc�H�|�|��tjkS)a} Returns True if ``self`` and ``other`` are disjoint. Examples ======== >>> from sympy import Interval >>> Interval(0, 2).is_disjoint(Interval(1, 2)) False >>> Interval(0, 2).is_disjoint(Interval(3, 4)) True References ========== .. [1] https://en.wikipedia.org/wiki/Disjoint_sets )rjr�EmptySetrds rB� is_disjointzSet.is_disjoint�s��$�~�~�e�$�$�� �2�2rAc�,�|�|��S)z1 Alias for :meth:`is_disjoint()` )rqrds rB� isdisjointzSet.isdisjoint��������&�&�&rAc�"�t||��S)ae The complement of 'self' w.r.t the given universe. Examples ======== >>> from sympy import Interval, S >>> Interval(0, 1).complement(S.Reals) Union(Interval.open(-oo, 0), Interval.open(1, oo)) >>> Interval(0, 1).complement(S.UniversalSet) Complement(UniversalSet, Interval(0, 1)) �� Complement�rS�universes rB� complementzSet.complement�s���(�D�)�)�)rAc ����t�t��r�t|t��r�t�j��t|j��kr|Sg}t t �j|j����}t t|����D]9��fd�t|��D��}|�t|����:t|�St|t��rKt�ttf��r-t|�� tj����SdSt|t��rt�fd�|jD���St|t"��r6t#|jdt|jd���d���S|tjur tjSt|t��rat'|�fd���}tt|d�|drt#t|d��d���n tj��SdS)Nc3�>�K�|]\}\}}|�kr|n||z V��dSr?r@)�.0�i�s�o�ns �rB� <genexpr>z"Set._complement.<locals>.<genexpr>�s;�����O�O���F�Q��Q�!�V�V����1��O�O�O�O�O�OrAc3�"�K�|] }|�z V�� dSr?r@)r}r�rSs �rBr�z"Set._complement.<locals>.<genexpr>�s'�����8�8��1�t�8�8�8�8�8�8�8rAr�F��evaluatec�H��t��|����Sr?�r�contains)�xrSs �rBrCz!Set._complement.<locals>.<lambda>�s���:�d�m�m�A�6F�6F�+G�+G�rA)� isinstance� ProductSet�len�sets�list�zip�range� enumerate�appendrc�Interval� FiniteSetrirzr�Reals�argsrwrpr5)rSre�overlaps�pairsr��siftedr�s` @rB� _complementzSet._complement�s)���� �d�J� '� '� 1�J�u�j�,I�,I� 1��4�9�~�~��U�Z���0�0�� ��H���T�Y�� �3�3�4�4�E��3�u�:�:�&�&� 3� 3��O�O�O�O�i��>N�>N�O�O�O����� �D� 1�2�2�2�2��(�#� #� ��x� (� (� 1��$��9� 5�6�6� E�#�E�4�?�?�1�7�+C�+C�D�D�D� E� E���u� %� %� 1��8�8�8�8�U�Z�8�8�8�9� 9� ��z� *� *� 1��e�j��m�U�5�:�a�=�$�-G�-G�RW�X�X�X� X� �a�j� � ��:� � ��y� )� )� 1��%�!G�!G�!G�!G�H�H�F���V�E�]�4��$�<�0� �9�v�d�|�5�t�e�L�L�L�L�%&�Z�1�1� 1� 1� 1rAc�"�t||��S)aW Returns symmetric difference of ``self`` and ``other``. Examples ======== >>> from sympy import Interval, S >>> Interval(1, 3).symmetric_difference(S.Reals) Union(Interval.open(-oo, 1), Interval.open(3, oo)) >>> Interval(1, 10).symmetric_difference(S.Reals) Union(Interval.open(-oo, 1), Interval.open(10, oo)) >>> from sympy import S, EmptySet >>> S.Reals.symmetric_difference(EmptySet) Reals References ========== .. [1] https://en.wikipedia.org/wiki/Symmetric_difference ��SymmetricDifferencerds rB�symmetric_differencezSet.symmetric_difference�s��,#�4��/�/�/rAc�Z�tt||��t||����Sr?)rcrwrds rB�_symmetric_differencezSet._symmetric_differences&���Z��e�,�,�j���.E�.E�F�F�FrAc��|jS)z� The infimum of ``self``. Examples ======== >>> from sympy import Interval, Union >>> Interval(0, 1).inf 0 >>> Union(Interval(0, 1), Interval(2, 3)).inf 0 )�_infrRs rBrWzSet.inf� ���y�rAc�&�td|z���)Nz (%s)._inf�rZrRs rBr�zSet._inf���!�+��"4�5�5�5rAc��|jS)z� The supremum of ``self``. Examples ======== >>> from sympy import Interval, Union >>> Interval(0, 1).sup 1 >>> Union(Interval(0, 1), Interval(2, 3)).sup 3 )�_suprRs rB�supzSet.supr�rAc�&�td|z���)Nz (%s)._supr�rRs rBr�zSet._sup.r�rAc���ddlm}t|d���}|�|��}t ||��r|S|�|||d���St |}|�|S|S)a Returns a SymPy value indicating whether ``other`` is contained in ``self``: ``true`` if it is, ``false`` if it is not, else an unevaluated ``Contains`` expression (or, as in the case of ConditionSet and a union of FiniteSet/Intervals, an expression indicating the conditions for containment). Examples ======== >>> from sympy import Interval, S >>> from sympy.abc import x >>> Interval(0, 1).contains(0.5) True As a shortcut it is possible to use the ``in`` operator, but that will raise an error unless an affirmative true or false is not obtained. >>> Interval(0, 1).contains(x) (0 <= x) & (x <= 1) >>> x in Interval(0, 1) Traceback (most recent call last): ... TypeError: did not evaluate to a bool: None The result of 'in' is a bool, not a SymPy value >>> 1 in Interval(0, 2) True >>> _ is S.true False r�)�ContainsT)�strictNFr�)r�r�r&� _containsr��tfn)rSrer��c�bs rBr�z Set.contains2s���F '�&�&�&�&�&���d�+�+�+�� �N�N�5� !� !�� �a�� "� "� ��H� �9��8�E�4�%�8�8�8� 8� ��F�� �9��H��rAc�J�tt|��j�d����)aTest if ``other`` is an element of the set ``self``. This is an internal method that is expected to be overridden by subclasses of ``Set`` and will be called by the public :func:`Set.contains` method or the :class:`Contains` expression. Parameters ========== other: Sympified :class:`Basic` instance The object whose membership in ``self`` is to be tested. Returns ======= Symbolic :class:`Boolean` or ``None``. A return value of ``None`` indicates that it is unknown whether ``other`` is contained in ``self``. Returning ``None`` from here ensures that ``self.contains(other)`` or ``Contains(self, other)`` will return an unevaluated :class:`Contains` expression. If not ``None`` then the returned value is a :class:`Boolean` that is logically equivalent to the statement that ``other`` is an element of ``self``. Usually this would be either ``S.true`` or ``S.false`` but not always. z ._contains)rZ�type�__name__rds rBr�z Set._containsbs$��8"�T�$�Z�Z�%8�"D�"D�"D�E�E�ErAc��t|t��std|z���||krdS|j}|durdSt |��r |jrdS|jdur |jrdS|�|��}|�|S|�|��}|�|Sddlm }|||��}|�|S|� |��|krdSdS)a' Returns True if ``self`` is a subset of ``other``. Examples ======== >>> from sympy import Interval >>> Interval(0, 0.5).is_subset(Interval(0, 1)) True >>> Interval(0, 1).is_subset(Interval(0, 1, left_open=True)) False �Unknown argument '%s'TFNr)�is_subset_sets) r�rEr]rIrrJ�_eval_is_subset�_eval_is_superset�sympy.sets.handlers.issubsetr�rj)rSrerI�retr�s rB� is_subsetz Set.is_subset�s���%��%�%� >��4�u�<�=�=� =� �5�=�=��4��=�� �t� � ��4� �x� � � �U�^� ��5� � �� &� &�5�+>� &��5��"�"�5�)�)�� �?��J��%�%�d�+�+�� �?��J� @�?�?�?�?�?��n�T�5�)�)�� �?��J� �>�>�%� � �D� (� (��4� )� (rAc��dS�z;Returns a fuzzy bool for whether self is a subset of other.Nr@rds rBr�zSet._eval_is_subset�����trAc��dSr�r@rds rBr�zSet._eval_is_superset�r�rAc�,�|�|��S)z/ Alias for :meth:`is_subset()` �r�rds rB�issubsetz Set.issubset�rnrAc��t|t��r||ko|�|��Std|z���)a, Returns True if ``self`` is a proper subset of ``other``. Examples ======== >>> from sympy import Interval >>> Interval(0, 0.5).is_proper_subset(Interval(0, 1)) True >>> Interval(0, 1).is_proper_subset(Interval(0, 1)) False r��r�rEr�r]rds rB�is_proper_subsetzSet.is_proper_subset�sE�� �e�S� !� !� >��5�=�:�T�^�^�E�%:�%:� :��4�u�<�=�=� =rAc�z�t|t��r|�|��Std|z���)a- Returns True if ``self`` is a superset of ``other``. Examples ======== >>> from sympy import Interval >>> Interval(0, 0.5).is_superset(Interval(0, 1)) False >>> Interval(0, 1).is_superset(Interval(0, 1, left_open=True)) True r�r�rds rB� is_supersetzSet.is_superset�s<�� �e�S� !� !� >��?�?�4�(�(� (��4�u�<�=�=� =rAc�,�|�|��S)z1 Alias for :meth:`is_superset()` )r�rds rB� issupersetzSet.issuperset�rtrAc��t|t��r||ko|�|��Std|z���)a2 Returns True if ``self`` is a proper superset of ``other``. Examples ======== >>> from sympy import Interval >>> Interval(0, 1).is_proper_superset(Interval(0, 0.5)) True >>> Interval(0, 1).is_proper_superset(Interval(0, 1)) False r�)r�rEr�r]rds rB�is_proper_supersetzSet.is_proper_superset�sG�� �e�S� !� !� >��5�=�<�T�%5�%5�e�%<�%<� <��4�u�<�=�=� =rAc�$�ddlm}||��S)Nr���PowerSet)�powersetr�)rSr�s rB�_eval_powersetzSet._eval_powersets"��&�&�&�&�&�&��x��~�~�rAc�*�|���S)a� Find the Power set of ``self``. Examples ======== >>> from sympy import EmptySet, FiniteSet, Interval A power set of an empty set: >>> A = EmptySet >>> A.powerset() {EmptySet} A power set of a finite set: >>> A = FiniteSet(1, 2) >>> a, b, c = FiniteSet(1), FiniteSet(2), FiniteSet(1, 2) >>> A.powerset() == FiniteSet(a, b, c, EmptySet) True A power set of an interval: >>> Interval(1, 2).powerset() PowerSet(Interval(1, 2)) References ========== .. [1] https://en.wikipedia.org/wiki/Power_set )r�rRs rBr�z Set.powersets��B�"�"�$�$�$rAc��|jS)z� The (Lebesgue) measure of ``self``. Examples ======== >>> from sympy import Interval, Union >>> Interval(0, 1).measure 1 >>> Union(Interval(0, 1), Interval(2, 3)).measure 2 )�_measurerRs rB�measurez Set.measure's ���}�rAc�*�|���S)a� The kind of a Set Explanation =========== Any :class:`Set` will have kind :class:`SetKind` which is parametrised by the kind of the elements of the set. For example most sets are sets of numbers and will have kind ``SetKind(NumberKind)``. If elements of sets are different in kind than their kind will ``SetKind(UndefinedKind)``. See :class:`sympy.core.kind.Kind` for an explanation of the kind system. Examples ======== >>> from sympy import Interval, Matrix, FiniteSet, EmptySet, ProductSet, PowerSet >>> FiniteSet(Matrix([1, 2])).kind SetKind(MatrixKind(NumberKind)) >>> Interval(1, 2).kind SetKind(NumberKind) >>> EmptySet.kind SetKind() A :class:`sympy.sets.powerset.PowerSet` is a set of sets: >>> PowerSet({1, 2, 3}).kind SetKind(SetKind(NumberKind)) A :class:`ProductSet` represents the set of tuples of elements of other sets. Its kind is :class:`sympy.core.containers.TupleKind` parametrised by the kinds of the elements of those sets: >>> p = ProductSet(FiniteSet(1, 2), FiniteSet(3, 4)) >>> list(p) [(1, 3), (2, 3), (1, 4), (2, 4)] >>> p.kind SetKind(TupleKind(NumberKind, NumberKind)) When all elements of the set do not have same kind, the kind will be returned as ``SetKind(UndefinedKind)``: >>> FiniteSet(0, Matrix([1, 2])).kind SetKind(UndefinedKind) The kind of the elements of a set are given by the ``element_kind`` attribute of ``SetKind``: >>> Interval(1, 2).kind.element_kind NumberKind See Also ======== NumberKind sympy.core.kind.UndefinedKind sympy.core.containers.TupleKind MatrixKind sympy.matrices.expressions.sets.MatrixSet sympy.sets.conditionset.ConditionSet Rationals Naturals Integers sympy.sets.fancysets.ImageSet sympy.sets.fancysets.Range sympy.sets.fancysets.ComplexRegion sympy.sets.powerset.PowerSet sympy.sets.sets.ProductSet sympy.sets.sets.Interval sympy.sets.sets.Union sympy.sets.sets.Intersection sympy.sets.sets.Complement sympy.sets.sets.EmptySet sympy.sets.sets.UniversalSet sympy.sets.sets.FiniteSet sympy.sets.sets.SymmetricDifference sympy.sets.sets.DisjointUnion )�_kindrRs rB�kindzSet.kind8s��f�z�z�|�|�rAc��|jS)ag The boundary or frontier of a set. Explanation =========== A point x is on the boundary of a set S if 1. x is in the closure of S. I.e. Every neighborhood of x contains a point in S. 2. x is not in the interior of S. I.e. There does not exist an open set centered on x contained entirely within S. There are the points on the outer rim of S. If S is open then these points need not actually be contained within S. For example, the boundary of an interval is its start and end points. This is true regardless of whether or not the interval is open. Examples ======== >>> from sympy import Interval >>> Interval(0, 1).boundary {0, 1} >>> Interval(0, 1, True, False).boundary {0, 1} )� _boundaryrRs rB�boundaryz Set.boundary�s ��>�~�rAc�6�t||j��jS)a� Property method to check whether a set is open. Explanation =========== A set is open if and only if it has an empty intersection with its boundary. In particular, a subset A of the reals is open if and only if each one of its points is contained in an open interval that is a subset of A. Examples ======== >>> from sympy import S >>> S.Reals.is_open True >>> S.Rationals.is_open False )rir�rIrRs rB�is_openz Set.is_open�s��*�D�$�-�0�0�9�9rAc�6�|j�|��S)a� A property method to check whether a set is closed. Explanation =========== A set is closed if its complement is an open set. The closedness of a subset of the reals is determined with respect to R and its standard topology. Examples ======== >>> from sympy import Interval >>> Interval(0, 1).is_closed True )r�r�rRs rB� is_closedz Set.is_closed�s��$�}�&�&�t�,�,�,rAc��||jzS)aN Property method which returns the closure of a set. The closure is defined as the union of the set itself and its boundary. Examples ======== >>> from sympy import S, Interval >>> S.Reals.closure Reals >>> Interval(0, 1).closure Interval(0, 1) �r�rRs rB�closurez Set.closure�����d�m�#�#rAc��||jz S)ax Property method which returns the interior of a set. The interior of a set S consists all points of S that do not belong to the boundary of S. Examples ======== >>> from sympy import Interval >>> Interval(0, 1).interior Interval.open(0, 1) >>> Interval(0, 1).boundary.interior EmptySet r�rRs rB�interiorz Set.interior�r�rAc��t���r?r�rRs rBr�z Set._boundary����!�#�#�#rAc�&�td|z���)Nz (%s)._measurer�rRs rBr�z Set._measure�s��!�/�D�"8�9�9�9rAc�*�tt��Sr?��SetKindrrRs rBr�z Set._kind����}�%�%�%rAc�X��t|���|j�fd�|jD���S)Nc�<��g|]}|�������S��r��rY)r}�arg�dpss �rB� <listcomp>z#Set._eval_evalf.<locals>.<listcomp>s'���A�A�A��3�9�9�s�9�+�+�A�A�ArA)r=�funcr��rS�precr�s @rB� _eval_evalfzSet._eval_evalfs6����$�����t�y�A�A�A�A�t�y�A�A�A�B�BrA)rerEc�,�|�|��Sr?�rfrds rB�__add__z Set.__add__ ����z�z�%� � � rAc�,�|�|��Sr?r�rds rB�__or__z Set.__or__r�rAc�,�|�|��Sr?rlrds rB�__and__z Set.__and__s���~�~�e�$�$�$rAc�"�t||��Sr?)r�rds rB�__mul__z Set.__mul__����$��&�&�&rAc�"�t||��Sr?r�rds rB�__xor__z Set.__xor__s��"�4��/�/�/rAr(c�Z�|jr|dkstd|z���t|g|z�S)Nrz'%s: Exponent must be a positive Integer)� is_Integerr]r�)rSr(s rB�__pow__z Set.__pow__s:���� N�3�!�8�8��F��L�M�M� M��D�6�#�:�&�&rAc�"�t||��Sr?rvrds rB�__sub__z Set.__sub__$rrAc��t|��}|�|��}t|}|�td|z���|S)Nzdid not evaluate to a bool: %r)r%r�r�� TypeError)rSrer�r�s rB� __contains__zSet.__contains__(sG������� �N�N�5� !� !�� ��F�� �9��<�q�@�A�A� A��rA)Hr�� __module__� __qualname__�__doc__� __slots__� is_number� is_iterable� is_interval� is_FiniteSet� is_Interval� is_ProductSet�is_UnionrFr�__annotations__rGrH�is_ComplexRegionrIrJ�propertyr2rT� staticmethodrarfrjrmrqrsrzr�r�r�rWr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�NotImplementedr�r�rrrrr r rr@rArBrErE,s������� � ��I��I��K��K��L��K��M��H�!%�O�Y�%�%�%�!%�O�Y�%�%�%�#�M�9�#�#�#����H�i����#�M�9�#�#�#� ��Z� �"'�#;� ��������X��� � ��\� �"�"�"�6)�)�)�*%�%�%� 3�3�3�('�'�'� *�*�*�""1�"1�"1�H0�0�0�0G�G�G�����X�� �6�6��X�6�����X�� �6�6��X�6�.�.�.�`F�F�F�</�/�/�b������ %�%�%� >�>�>�&>�>�>�('�'�'� >�>�>�&���!%�!%�!%�F����X�� �R�R��X�R�h����X��@�:�:��X�:�,�-�-��X�-�&�$�$��X�$� �$�$��X�$� �$�$��X�$��:�:��X�:�&�&�&�C�C�C��^�%�&��7�7�!�!�8�7�!��^�%�&��7�7�!�!�8�7�!��^�%�&��7�7�%�%�8�7�%��^�%�&��7�7�'�'�8�7�'��^�%�&��7�7�0�0�8�7�0��^�e�T�]�O�^�4�4�'�'�5�4�'� �^�%�&��7�7�'�'�8�7�'�����rArEc���eZdZdZdZd�Zed���Zd�Zd�Z d�Z ed���Z ed ���Z d �Z ed ���Zed ���Zed ���Zd�Zd�Zd�ZdS)r�a� Represents a Cartesian Product of Sets. Explanation =========== Returns a Cartesian product given several sets as either an iterable or individual arguments. Can use ``*`` operator on any sets for convenient shorthand. Examples ======== >>> from sympy import Interval, FiniteSet, ProductSet >>> I = Interval(0, 5); S = FiniteSet(1, 2, 3) >>> ProductSet(I, S) ProductSet(Interval(0, 5), {1, 2, 3}) >>> (2, 2) in ProductSet(I, S) True >>> Interval(0, 1) * Interval(0, 1) # The unit square ProductSet(Interval(0, 1), Interval(0, 1)) >>> coin = FiniteSet('H', 'T') >>> set(coin**2) {(H, H), (H, T), (T, H), (T, T)} The Cartesian product is not commutative or associative e.g.: >>> I*S == S*I False >>> (I*I)*I == I*(I*I) False Notes ===== - Passes most operations down to the argument sets References ========== .. [1] https://en.wikipedia.org/wiki/Cartesian_product Tc���t|��dkr^t|d��rIt|dttf��s't ddd���t |d��}d�|D��}td�|D����std ���t|��dkrtd ��Stj |vr tj Stj |g|�Ri|��S) Nr�rzX ProductSet(iterable) is deprecated. Use ProductSet(*iterable) instead. rLzdeprecated-productset-iterablerNc�,�g|]}t|����Sr@)r&�r}rs rBr�z&ProductSet.__new__.<locals>.<listcomp>os��)�)�)�q��� � �)�)�)rAc3�@K�|]}t|t��V��dSr?�r�rEr"s rBr�z%ProductSet.__new__.<locals>.<genexpr>qs,����4�4�!�:�a��%�%�4�4�4�4�4�4rAz-Arguments to ProductSet should be of type Setr@)r�r7r�rE�setr3�tuple�allr r�rrpr �__new__)�clsr�� assumptionss rBr(zProductSet.__new__ds�� �t�9�9��>�>�h�t�A�w�/�/�>� �4��7�S�RU�J�8W�8W�>� %��*/�+K�  � � � ���a��>�>�D�)�)�D�)�)�)���4�4�t�4�4�4�4�4� M��K�L�L� L� �t�9�9��>�>��R�=�=� � �:�� � ��:� ��}�S�7�4�7�7�7�;�7�7�7rAc��|jSr?�r�rRs rBr�zProductSet.sets}� ���y�rAc�<���fd��t�|j���S)Nc3�Z�K�|D]$}|jr�|j��Ed{V��� |V��%dSr?)rr�)r�r�_flattens �rBr0z$ProductSet.flatten.<locals>._flatten�s\������ � ���?��'�x���/�/�/�/�/�/�/�/�/�/��G�G�G�G�  � rA)r�r�)rSr0s @rB�flattenzProductSet.flatten�s5��� � � � � � �8�8�D�I�.�.�/�/rAc���|jrdSt|t��r%t|��t|j��kr t jStd�t|j|��D���S)a8 ``in`` operator for ProductSets. Examples ======== >>> from sympy import Interval >>> (2, 3) in Interval(0, 5) * Interval(0, 5) True >>> (10, 10) in Interval(0, 5) * Interval(0, 5) False Passes operation on to constituent sets Nc�>�g|]\}}|�|����Sr@�r��r}r�es rBr�z(ProductSet._contains.<locals>.<listcomp>�s&��G�G�G�t�q�!�Q�Z�Z��]�]�G�G�GrA) � is_Symbolr�r r�r�rr1r,r��rS�elements rBr�zProductSet._contains�sk�� � � ��4��'�5�)�)� �S��\�\�S���^�^�-K�-K��7�N��G�G�s�4�9�g�/F�/F�G�G�G�H�HrAc��d�|D��}t|��t|j��kstd�|D����std���t d�t |j|��D���S)Nc�,�g|]}t|����Sr@)r%r"s rBr�z,ProductSet.as_relational.<locals>.<listcomp>�s��0�0�0�1�8�A�;�;�0�0�0rAc3�$K�|] }|jV�� dSr?)r7�r}r~s rBr�z+ProductSet.as_relational.<locals>.<genexpr>�s5����5.�5.� !�� �5.�5.�5.�5.�5.�5.rAz/number of symbols must match the number of setsc�>�g|]\}}|�|����Sr@�� as_relational)r}rr~s rBr�z,ProductSet.as_relational.<locals>.<listcomp>�s(��L�L�L�D�A�q�Q�_�_�Q�'�'�L�L�LrA)r�r�r'r]r,r�)rSr!s rBr@zProductSet.as_relational�s���0�0��0�0�0�� �w�<�<�3�t�y�>�>� )� )��5.�5.�%,�5.�5.�5.�2.�2.� )��A�C�C� C��L�L�C�� �7�4K�4K�L�L�L�M�MrAc�R��t�fd�t�j��D���S)Nc3�n��K�|].\�}t�fd�t�j��D���V��/dS)c3�L�K�|]\}}�|kr ||jzn|jV��dSr?r�)r}�jr�r~s �rBr�z1ProductSet._boundary.<locals>.<genexpr>.<genexpr>�sW�����$B�$B�$(�A�q�78�1�f�f�A�� �N�N�!�*�$B�$B�$B�$B�$B�$BrAN)r�r�r�)r}�ar~rSs @�rBr�z'ProductSet._boundary.<locals>.<genexpr>�s�������B�B�$(�A�q�"�$B�$B�$B�$B�,5�d�i�,@�,@�$B�$B�$B�C�B�B�B�B�B�BrA)rcr�r�rRs`rBr�zProductSet._boundary�sI����B�B�B�B�,5�d�i�,@�,@�B�B�B�C� CrAc�>�td�|jD����S)a� A property method which tests whether a set is iterable or not. Returns True if set is iterable, otherwise returns False. Examples ======== >>> from sympy import FiniteSet, Interval >>> I = Interval(0, 1) >>> A = FiniteSet(1, 2, 3, 4, 5) >>> I.is_iterable False >>> A.is_iterable True c3�$K�|] }|jV�� dSr?�r�r}r%s rBr�z)ProductSet.is_iterable.<locals>.<genexpr>��$����8�8�s�3�?�8�8�8�8�8�8rA�r'r�rRs rBrzProductSet.is_iterable�s#��$�8�8�d�i�8�8�8�8�8�8rAc��t|j�S)z� A method which implements is_iterable property method. If self.is_iterable returns True (both constituent sets are iterable), then return the Cartesian Product. Otherwise, raise TypeError. )r4r�rRs rB�__iter__zProductSet.__iter__�s�� ���#�#rAc�>�td�|jD����S)Nc3�$K�|] }|jV�� dSr?�rIr"s rBr�z&ProductSet.is_empty.<locals>.<genexpr>�s$����6�6�q�� �6�6�6�6�6�6rA)rr�rRs rBrIzProductSet.is_empty�s!���6�6�D�I�6�6�6�6�6�6rAc�j�td�|jD����}t|j|g��S)Nc3�$K�|] }|jV�� dSr?�rJr"s rBr�z+ProductSet.is_finite_set.<locals>.<genexpr>��$����B�B�1�q��B�B�B�B�B�BrA�rr�rrI�rS� all_finites rBrJzProductSet.is_finite_set��5���B�B�� �B�B�B�B�B� ���� �3�4�4�4rAc�2�d}|jD] }||jz}� |S�Nr�)r�r�)rSr�rs rBr�zProductSet._measure�s+������ !� !�A� �q�y� �G�G��rAc�L�ttd�|jD�����S)Nc3�.K�|]}|jjV��dSr?)r�� element_kindr=s rBr�z#ProductSet._kind.<locals>.<genexpr>�s'����"J�"J�1�1�6�#6�"J�"J�"J�"J�"J�"JrA)r�r r�rRs rBr�zProductSet._kind�s&���y�"J�"J�� �"J�"J�"J�K�L�L�LrAc�B�td�d�|jD����S)Nc� �||zSr?r@�rEr�s rBrCz$ProductSet.__len__.<locals>.<lambda>�s ��1�Q�3�rAc3�4K�|]}t|��V��dSr?)r�r"s rBr�z%ProductSet.__len__.<locals>.<genexpr>�s(����(C�(C�A��Q���(C�(C�(C�(C�(C�(CrA)rr�rRs rB�__len__zProductSet.__len__�s'���&�&�(C�(C���(C�(C�(C�D�D�DrAc�*�t|j��Sr?rKrRs rB�__bool__zProductSet.__bool__�����4�9�~�~�rAN)r�rrrrr(rr�r1r�r@r�rrMrIrJr�r�rbrdr@rArBr�r�3sO������-�-�\�M�8�8�8�2����X��0�0�0�I�I�I�0N�N�N��C�C��X�C� �9�9��X�9�&$�$�$��7�7��X�7��5�5��X�5�����X�� M�M�M�E�E�E�����rAr�c���eZdZdZdZd d�Zed���Zed���Zed���Z ed���Z e d ���Z e d ���Z e d ���Zed ���Zed ���Zed���Zed���Zed���Zed���Zd�Zed���Zd�Zd�Zed���Zd�Zd!d�Zd�Zd�Zed���Zed���Zd�Z dS)"r�a Represents a real interval as a Set. Usage: Returns an interval with end points ``start`` and ``end``. For ``left_open=True`` (default ``left_open`` is ``False``) the interval will be open on the left. Similarly, for ``right_open=True`` the interval will be open on the right. Examples ======== >>> from sympy import Symbol, Interval >>> Interval(0, 1) Interval(0, 1) >>> Interval.Ropen(0, 1) Interval.Ropen(0, 1) >>> Interval.Ropen(0, 1) Interval.Ropen(0, 1) >>> Interval.Lopen(0, 1) Interval.Lopen(0, 1) >>> Interval.open(0, 1) Interval.open(0, 1) >>> a = Symbol('a', real=True) >>> Interval(0, a) Interval(0, a) Notes ===== - Only real end points are supported - ``Interval(a, b)`` with $a > b$ will return the empty set - Use the ``evalf()`` method to turn an Interval into an mpmath ``mpi`` interval instance References ========== .. [1] https://en.wikipedia.org/wiki/Interval_%28mathematics%29 TFc �>�t|��}t|��}t|��}t|��}td�||fD����std|�d|�����tt d�||||z fD������rt d���t ||��r tjS||z j r tjS||kr|s|r tjS||kr;|s9|s7|tj us|tj ur tjSt|��S|tj urt}|tj urt}|tj ks|tj kr tjStj|||||��S)Nc3�K�|]:}t|tt��tt��f��V��;dSr?)r�r�r0r1)r}rEs rBr�z#Interval.__new__.<locals>.<genexpr>sQ����.�.���a�$�t�*�*�d�5�k�k�!:�;�;�.�.�.�.�.�.rAz>left_open and right_open can have only true/false values, got z and c3�$K�|] }|jV�� dSr?)�is_extended_realr=s rBr�z#Interval.__new__.<locals>.<genexpr>"s%����S�S�a�q�1�S�S�S�S�S�SrAz$Non-real intervals are not supported)r%r'rZrrr]rrrp� is_negativer^�NegativeInfinityr�r0r r()r)�start�end� left_open� right_opens rBr(zInterval.__new__s���������s�m�m���Y�'�'� ��j�)�)� ��.�.���,�.�.�.�.�.� ;�%�%�#,�9�9�j�j�:�;�;� ;� �Y�S�S�E�3��E� �;R�S�S�S�S�S� T� T� E��C�D�D� D� ��e� � � ��:� ��E�k� &� ��:� � �%�<�<�Y�<�*�<��:� � �%�<�<��<�j�<��� �"�"�e�q�/A�&A�&A��z�!��S�>�>� !� �A�&� &� &��I� �!�*� � ��J� �A�J� � �#��);�";�";��:� ��}�S�%��i��D�D�DrAc��|jdS)z� The left end point of the interval. This property takes the same value as the ``inf`` property. Examples ======== >>> from sympy import Interval >>> Interval(0, 1).start 0 r��_argsrRs rBrmzInterval.start<����z�!�}�rAc��|jdS)z� The right end point of the interval. This property takes the same value as the ``sup`` property. Examples ======== >>> from sympy import Interval >>> Interval(0, 1).end 1 r�rrrRs rBrnz Interval.endMrtrAc��|jdS)a True if interval is left-open. Examples ======== >>> from sympy import Interval >>> Interval(0, 1, left_open=True).left_open True >>> Interval(0, 1, left_open=False).left_open False �rrrRs rBrozInterval.left_open^rtrAc��|jdS)a True if interval is right-open. Examples ======== >>> from sympy import Interval >>> Interval(0, 1, right_open=True).right_open True >>> Interval(0, 1, right_open=False).right_open False �rrrRs rBrpzInterval.right_openortrAc��|||dd��S)z.Return an interval including neither boundary.Tr@�r)rEr�s rB�openz Interval.open�s���s�1�a��t�$�$�$rAc��|||dd��S)z3Return an interval not including the left boundary.TFr@r{s rB�LopenzInterval.Lopen�s���s�1�a��u�%�%�%rAc��|||dd��S)z4Return an interval not including the right boundary.FTr@r{s rB�RopenzInterval.Ropen�s���s�1�a���%�%�%rAc��|jSr?�rmrRs rBr�z Interval._inf�� ���z�rAc��|jSr?�rnrRs rBr�z Interval._sup�� ���x�rAc��|jSr?r�rRs rB�leftz Interval.left�r�rAc��|jSr?r�rRs rB�rightzInterval.right�r�rAc�~�|js|jr|j|jk}n|j|jk}t |��Sr?)rorprmrnr)rS�conds rBrIzInterval.is_empty�sA�� �>� )�T�_� )��:���)�D�D��:���(�D��$���rAc��|jjSr?)r��is_zerorRs rBrJzInterval.is_finite_set�s ���|�#�#rAc�p�|tjkr^ttj|jd|j ��}t|jtj|j d��}t||��St|t��rd�|j D��}|gkrdSt�||��S)NTc� �g|] }|j� |�� Sr@)r)r}�ms rBr�z(Interval._complement.<locals>.<listcomp>�s��9�9�9�!�Q�[�9�A�9�9�9rA)rr�r�rlrmrornr^rprcr�r�r�rEr�)rSrerEr��numss rBr�zInterval._complement�s��� �A�G� � ���+�T�Z��4�>�1�3�3�A����1�:�4�?�/B�D�I�I�A���A�;�;� � �e�Y� '� '� �9�9�u�z�9�9�9�D��r�z�z��t����t�U�+�+�+rAc�D�d�|j|jfD��}t|�S)Nc�L�g|]!}t|��tjk�|��"Sr@)�absrr^)r}�ps rBr�z&Interval._boundary.<locals>.<listcomp>�s4��2�2�2�q���F�F�a�j�0�0��0�0�0rA)rmrnr�)rS� finite_pointss rBr�zInterval._boundary�s3��2�2�T�Z���$:�2�2�2� ��-�(�(rAc��t|t��r6|tjus(|jdus|�tj��rtS|jtj ur,|j tj ur|j�t|jSt��}|�|���||��S)NF)r�rr�NaN�is_real�has�ComplexInfinityr1rmrlrnr^r�r#r@�subs)rSre�ds rBr�zInterval._contains�s����5�$�'�'� �5�A�E�>�>��}��%�%����1�3D�)E�)E�%�� � �:��+� +� +���A�J�0F�0F��}�(��5�=�)�)� �G�G���!�!�!�$�$�)�)�!�U�3�3�3rAc��t|��}|jr ||jk}n ||jk}|jr |j|k}n |j|k}t ||��S)zARewrite an interval in terms of inequalities and logic operators.)r&rprnrormr,)rSr�r�r�s rBr@zInterval.as_relational�sa�� �A�J�J�� �?� "����L�E�E����M�E� �>� #��:��>�D�D��:��?�D��4����rAc� �|j|jz Sr?)rnrmrRs rBr�zInterval._measure�s���x�$�*�$�$rAc�*�tt��Sr?)r�r rRs rBr�zInterval._kind�s���z�"�"�"rA�5c��tt|j�|����t|j�|������Sr?)r;r<rmr�rn�rSr�s rB�to_mpizInterval.to_mpi�sI���3�t�z�-�-�d�3�3�4�4� ���$�$�T�*�*� +� +�-�-� -rAc��t|j�|��|j�|��|j|j���S)N)rorp)r�r��_evalfr�rorpr�s rBr�zInterval._eval_evalf�sJ���� �(�(��.�.�� �0A�0A�$�0G�0G��n���B�B�B� BrAc�x�|jj}||jjz}||jjz}||jjz}|Sr?)rmrXrn)rSrerXs rB�_is_comparablezInterval._is_comparable�s?��� �0� ����/�/� ����2�2� ����0�0� ��rAc�X�|jtjup|jtd��kS)z;Return ``True`` if the left endpoint is negative infinity. z-inf)r�rrlrrRs rB�is_left_unboundedzInterval.is_left_unbounded�s&���y�A�.�.�L�$�)�u�V�}�}�2L�LrAc�X�|jtjup|jtd��kS)z<Return ``True`` if the right endpoint is positive infinity. z+inf)r�rr^rrRs rB�is_right_unboundedzInterval.is_right_unbounded�s%���z�Q�Z�'�F�4�:��v���+F�FrAc��t|t��s:t|t��rtSt|t��rdStSdSr?)r�r�r�r1rErds rB�_eval_EqzInterval._eval_Eq�sQ���%��*�*� ��%��+�+� �� ��E�3�'�'� ��t��L�  � rAN)FF)r�)!r�rrrrr(rrmrnrorp� classmethodr|r~r�r�r�r�r�rIrJr�r�r�r@r�r�r�r�r�r�r�r�r@rArBr�r��s�������(�(�R�K�&E�&E�&E�&E�P����X�� ����X�� ����X�� ����X�� �%�%��[�%��&�&��[�&��&�&��[�&�����X������X������X������X��� � ��X� ��$�$��X�$� ,� ,� ,��)�)��X�)� 4� 4� 4�  �  �  ��%�%��X�%�#�#�#�-�-�-�-�B�B�B�����M�M��X�M��G�G��X�G�����rAr�c��eZdZdZdZed���Zed���Zd�Zed���Z d�Z ed���Z ed ���Z ed ���Z ed ���Zed ���Zd �Zed���Zd�Zd�Zd�Zed���Zd�ZdS)rca  Represents a union of sets as a :class:`Set`. Examples ======== >>> from sympy import Union, Interval >>> Union(Interval(1, 2), Interval(3, 4)) Union(Interval(1, 2), Interval(3, 4)) The Union constructor will always try to merge overlapping intervals, if possible. For example: >>> Union(Interval(1, 2), Interval(2, 3)) Interval(1, 3) See Also ======== Intersection References ========== .. [1] https://en.wikipedia.org/wiki/Union_%28set_theory%29 Tc��tjSr?�rrprRs rB�identityzUnion.identity!� ���z�rAc��tjSr?�r� UniversalSetrRs rB�zeroz Union.zero%� ���~�rAc�d�|�dtj��}t|��}|r1t |�|����}t |��St t|tj ����}tj |g|�R�}t|��|_ |S)Nr�)�getrr�r%r��_new_args_filter�simplify_unionr rErar r(� frozenset�_argset)r)r��kwargsr��objs rBr(z Union.__new__)s����:�:�j�*;�*D�E�E����~�~�� � (���,�,�T�2�2�3�3�D�!�$�'�'� '��G�D�#�"2�3�3�4�4���m�C�'�$�'�'�'����o�o�� �� rAc��|jSr?rrrRs rBr�z Union.args:r�rAc�D��t�fd�|jD����S)Nc3�B�K�|]}|����V��dSr?�rz)r}rrys �rBr�z$Union._complement.<locals>.<genexpr>@s/�����F�F�q�A�L�L��2�2�F�F�F�F�F�FrA)rir�rxs `rBr�zUnion._complement>s(����F�F�F�F�D�I�F�F�F�F�F�FrAc�2�td�|jD���S)Nc��g|] }|j�� Sr@)rWrIs rBr�zUnion._inf.<locals>.<listcomp>F���2�2�2��S�W�2�2�2rA)r+r�rRs rBr�z Union._infB� ���2�2�� �2�2�2�3�3rAc�2�td�|jD���S)Nc��g|] }|j�� Sr@)r�rIs rBr�zUnion._sup.<locals>.<listcomp>Lr�rA)r*r�rRs rBr�z Union._supHr�rAc�>�td�|jD����S)Nc3�$K�|] }|jV�� dSr?rPrIs rBr�z!Union.is_empty.<locals>.<genexpr>Ps$����;�;�#���;�;�;�;�;�;rA�rr�rRs rBrIzUnion.is_emptyNs!���;�;���;�;�;�;�;�;rAc�>�td�|jD����S)Nc3�$K�|] }|jV�� dSr?rSrIs rBr�z&Union.is_finite_set.<locals>.<genexpr>Ts%����@�@�s��*�@�@�@�@�@�@rAr�rRs rBrJzUnion.is_finite_setRs!���@�@�d�i�@�@�@�@�@�@rAc�B��d��jD��}d}d}|r�||td�|D����zz }�fd�|D��}d�|D��}g}g}|D]=}|d|vr� |�|d��|�|���>|}|dz}|��|S)Nc�0�g|]}t|��|f��Sr@�r�r"s rBr�z"Union._measure.<locals>.<listcomp>cs#��5�5�5�a��1���q�!�5�5�5rArr�c3�*K�|]\}}|jV��dSr?�r��r}�sos�inters rBr�z!Union._measure.<locals>.<genexpr>hs(����#I�#I�j�c�5�E�M�#I�#I�#I�#I�#I�#IrAc3��K�|]<\}}�jD]/}||v�|t|��z|�|��fV��0�=dSr?)r�r�rj)r}r�rm�newsetrSs �rBr�z!Union._measure.<locals>.<genexpr>lsr�����*�*�)��\�� �*�*�6<��S�(�(��9�V�,�,�,�f�.>�.>�|�.L�.L�M�(�(�(�(�(�*�*rAc�2�g|]\}}|jdk�||f��S�rr�r�s rBr�z"Union._measure.<locals>.<listcomp>qs,��N�N�N�Z�S�%�5�=�A�;M�;M�S�%�L�;M�;M�;MrA�����)r��sumr�)rSr�r��parity�sos_list� sets_list�_sets` rBr�zUnion._measureVs ���6�5�4�9�5�5�5������� � �v��#I�#I�D�#I�#I�#I� I� I�I� I�G�*�*�*�*�-1�*�*�*�D� O�N�4�N�N�N�D��H��I�� +� +����7�h�&�&���O�O�D��G�,�,�,��$�$�T�*�*�*�*��D� �b�L�F�3� �4�rAc����td�|jD������st��St�fd��D����r�dStt��S)Nc3�@K�|]}|tju�|jV��dSr?)rrpr��r}r�s rBr�zUnion._kind.<locals>.<genexpr>�s0����M�M�3�s�!�*�7L�7L�c�h�7L�7L�7L�7L�M�MrAc3�0�K�|]}|�dkV��dS�rNr@�r}r~�kindss �rBr�zUnion._kind.<locals>.<genexpr>��+�����.�.�1��e�A�h��.�.�.�.�.�.rAr)r&r�r�r'r�rSr�s @rBr�z Union._kind�so����M�M�$�)�M�M�M�M�M��� *��9�9� � �.�.�.�.��.�.�.� .� .� *���8�O��=�)�)� )rAc �z���fd�}tt|tt�j�������S)Nc����j|j}t�j��D]\}}||kr ||jz }�|S)z8 The boundary of set i minus interior of all other sets )r�r�r�r�)r~r�rDrErSs �rB�boundary_of_setz(Union._boundary.<locals>.boundary_of_set�sH���� �!� �%�A�!�$�)�,�,� '� '���1���6�6��A�J��A���HrA)rc�mapr�r�r�)rSr�s` rBr�zUnion._boundary�sC��� � � � � ��c�/�5��T�Y���+@�+@�A�A�B�BrAc�8��t�fd�|jD���S)Nc�:��g|]}|������Sr@r4�r}rres �rBr�z#Union._contains.<locals>.<listcomp>�s%���9�9�9�!�A�J�J�u�%�%�9�9�9rA)r-r�rds `rBr�zUnion._contains�s%����9�9�9�9�t�y�9�9�9�:�:rAc�D��t�fd�|jD����S)Nc3�B�K�|]}|����V��dSr?r�r�s �rBr�z"Union.is_subset.<locals>.<genexpr>�s/�����?�?�����U�+�+�?�?�?�?�?�?rAr�rds `rBr�zUnion.is_subset��(����?�?�?�?�T�Y�?�?�?�?�?�?rAc���t|j��dkr�td�|jD����r�|j\}}|j|jkrn|jrg|jr`|jr �|jkn �|jk}|jr �|jkn �|jk}t�|j��}t|||��St�fd�|jD���S)z<Rewrite a Union in terms of equalities and logic operators. rwc3�@K�|]}t|t��V��dSr?)r�r�r=s rBr�z&Union.as_relational.<locals>.<genexpr>�s,����?�?��J�q�(�+�+�?�?�?�?�?�?rAc�:��g|]}|������Sr@r?)r}r~�symbols �rBr�z'Union.as_relational.<locals>.<listcomp>�s%���?�?�?��A�O�O�F�+�+�?�?�?rA) r�r�r'r�rWrprorr,r-)rSr�rEr��mincond�maxcond�neconds ` rBr@zUnion.as_relational�s���� �� �N�N�a� � ��?�?�T�Y�?�?�?�?�?� ��9�D�A�q��u���~�~�!�,�~�1�;�~�,-�K�L�&�1�5�.�.�V�q�u�_��,-�L�M�&�1�5�.�.�f���o���F�A�E�*�*���6�7�G�4�4�4��?�?�?�?�T�Y�?�?�?�@�@rAc�>�td�|jD����S)Nc3�$K�|] }|jV�� dSr?rHr�s rBr�z$Union.is_iterable.<locals>.<genexpr>�rJrA�r'r�rRs rBrzUnion.is_iterable��!���8�8�d�i�8�8�8�8�8�8rAc�2�td�|jD���S)Nc3�4K�|]}t|��V��dSr?��iterr�s rBr�z!Union.__iter__.<locals>.<genexpr>�s(����;�;�#�D��I�I�;�;�;�;�;�;rA)r6r�rRs rBrMzUnion.__iter__�s���;�;���;�;�;�<�<rAN)r�rrrrrr�r�r(r�r�r�r�rIrJr�r�r�r�r�r@rrMr@rArBrcrcs���������4�H� ����X������X�����"����X��G�G�G��4�4��X�4� �4�4��X�4� �<�<��X�<��A�A��X�A��)�)��X�)�V*�*�*��C�C��X�C�;�;�;�@�@�@�A�A�A�"�9�9��X�9�=�=�=�=�=rArcc���eZdZdZdZed���Zed���Zdd�d�Zed���Z ed ���Z ed ���Z d �Z ed ���Z ed ���Zd�Zd�Zed���Zd�ZdS)ria� Represents an intersection of sets as a :class:`Set`. Examples ======== >>> from sympy import Intersection, Interval >>> Intersection(Interval(1, 3), Interval(2, 4)) Interval(2, 3) We often use the .intersect method >>> Interval(1,3).intersect(Interval(2,4)) Interval(2, 3) See Also ======== Union References ========== .. [1] https://en.wikipedia.org/wiki/Intersection_%28set_theory%29 Tc��tjSr?r�rRs rBr�zIntersection.identity�r�rAc��tjSr?r�rRs rBr�zIntersection.zero�r�rANr�c ��|� tj}ttt t |��������}|r1t|�|����}t|��Stt|tj ����}tj |g|�R�}t|��|_ |Sr?)rr�r�r r%r%r��simplify_intersectionrErar r(r�r�)r)r�r�r�s rBr(zIntersection.__new__�s��� � �(�1�H��G�C�����/�/�0�0�1�1�� � /���,�,�T�2�2�3�3�D�(��.�.� .��G�D�#�"2�3�3�4�4���m�C�'�$�'�'�'����o�o�� �� rAc��|jSr?rrrRs rBr�zIntersection.args�r�rAc�>�td�|jD����S)Nc3�$K�|] }|jV�� dSr?rHr�s rBr�z+Intersection.is_iterable.<locals>.<genexpr>�rJrA)�anyr�rRs rBrzIntersection.is_iterable�rrAc�F�td�|jD����rdSdS)Nc3�$K�|] }|jV�� dSr?rSr�s rBr�z-Intersection.is_finite_set.<locals>.<genexpr>�s%����;�;�#�C�%�;�;�;�;�;�;rAT)rr�rRs rBrJzIntersection.is_finite_set�s2�� �;�;���;�;�;� ;� ;� ��4� � rAc����td�|jD������stt��St �fd��D����r�dSt��S)Nc3�@K�|]}|tju�|jV��dSr?)rr�r�r�s rBr�z%Intersection._kind.<locals>.<genexpr>�s0����Q�Q�3�s�!�.�7P�7P�c�h�7P�7P�7P�7P�Q�QrAc3�0�K�|]}|�dkV��dSr�r@r�s �rBr�z%Intersection._kind.<locals>.<genexpr>�r�rAr)r&r�r�rr'r�s @rBr�zIntersection._kind�so����Q�Q�$�)�Q�Q�Q�Q�Q��� ��=�)�)� )� �.�.�.�.��.�.�.� .� .� ���8�O��9�9� rAc��t���r?r�rRs rBr�zIntersection._infr�rAc��t���r?r�rRs rBr�zIntersection._supr�rAc�8��t�fd�|jD���S)Nc�:��g|]}|������Sr@r4)r}r%res �rBr�z*Intersection._contains.<locals>.<listcomp> s%���>�>�>�S�S�\�\�%�(�(�>�>�>rA�r,r�rds `rBr�zIntersection._contains s%����>�>�>�>�D�I�>�>�>�?�?rAc#�,K�t|jd���}d}|d|dz}gg}}|D]Q}d} t|��}n%#t$r|�|��YnwxYw|�|�|���R|�t���||zD]M}t |j��|hz } t| ddi�} d}|D]} | | vr| V�� #t$rd}Y�wxYw|rdS�N|s |std���td���dS)Nc��|jSr?rH�r�s rBrCz'Intersection.__iter__.<locals>.<lambda> s��a�m�rAFT��keyr�z)None of the constituent sets are iterableziThe computation had not completed because of the undecidable set membership is found in every candidates.)r5r�r�r r��sortr%ri) rS� sets_sift� completed� candidates�finite_candidates�others� candidate�lengthr� other_setsrer�s rBrMzIntersection.__iter__ s��������$;�$;�<�<� �� ��t�_�y���6� �$&��6��#� 4� 4�I��F� )��Y������� )� )� )�� � �i�(�(�(�(�(� )�����!�!�(�(��3�3�3�����3��'�'�'�"�V�+� � �A��T�Y���1�#�-�J� �*�=�u�=�=�E��I�� &� &��&��E�z�z������� �&�&�&� %�I�I�I�&����� ���� �� L�� M�� K�L�L�L��K�L�L� L� L� Ls#�A�A)�(A)�C� C)�(C)c��� � ���t|d�d���\}}|sdSd�|D��}td�|t����� t��� � D]R�t�fd�|D����}|dur� ����|�|D]}|������Std�|t����}d �|D��}|r�|D]��t�fd �|D����}|dur� ����|�Qt |��D]*\} }�|vr!|����t|�|| <�+|����n��n|��t|��st��g}� r� fd �|D��}|t��gkr tj Sd �|D��} td �|t����� � fd���fd�|D��}|rZt|�} | tj ur tj S| j r| �| j��n| �| ��t#| ��dkr| dSt| ddi�S)z>Simplify intersection of one or more FiniteSets and other setsc��|jSr?�rrs rBrCz2Intersection._handle_finite_sets.<locals>.<lambda>7s��q�~�rAT��binaryNc�,�g|]}t|����Sr@)r%)r}�fss rBr�z4Intersection._handle_finite_sets.<locals>.<listcomp>>s��-�-�-�r�3�r�7�7�-�-�-rAc� �||zSr?r@r`s rBrCz2Intersection._handle_finite_sets.<locals>.<lambda>?� ��1�q�5�rAc3�B�K�|]}|����V��dSr?r4r5s �rBr�z3Intersection._handle_finite_sets.<locals>.<genexpr>Es-�����:�:��a�j�j��m�m�:�:�:�:�:�:rAc� �||zSr?r@r`s rBrCz2Intersection._handle_finite_sets.<locals>.<lambda>Vs ��!�a�%�rAc� �g|] }t|��� Sr@r�r"s rBr�z4Intersection._handle_finite_sets.<locals>.<listcomp>Ys��5�5�5��i��m�5�5�5rAc3�B�K�|]}|����V��dSr?r4r5s �rBr�z3Intersection._handle_finite_sets.<locals>.<genexpr>]s-����� C� C�1����A��� C� C� C� C� C� CrAc���g|]}|�z��Sr@r@)r}r-�definites �rBr�z4Intersection._handle_finite_sets.<locals>.<listcomp>ws���7�7�7��r�H�}�7�7�7rAc� �g|] }t|��� Sr@r�r"s rBr�z4Intersection._handle_finite_sets.<locals>.<listcomp>|s��/�/�/�!� �1� �/�/�/rAc� �||zSr?r@r`s rBrCz2Intersection._handle_finite_sets.<locals>.<lambda>�r/rAc�<���t�fd��D����S)Nc3�\�K�|]&}t��|����V��'dSr?r�)r}r6r�s �rBr�zEIntersection._handle_finite_sets.<locals>.<lambda>.<locals>.<genexpr>�s5�����$U�$U�1�Z�� � �1� � �%>�%>�$U�$U�$U�$U�$U�$UrA)r')r�� all_elementss`�rBrCz2Intersection._handle_finite_sets.<locals>.<lambda>�s%�����$U�$U�$U�$U� �$U�$U�$U�!U�!U�rAc�*��g|]}�|��� |��Sr@r@)r}r�� is_redundants �rBr�z4Intersection._handle_finite_sets.<locals>.<listcomp>�s&���;�;�;��<�<��?�?�;�!�;�;�;rAr�rr�F)r5rr%r�add�discardr��remover�r'rrprirF�extendr�r�r�)r��fs_argsr#�fs_sets�inallr� fs_elements� fs_symsets�infsr�r��restr:r5r6r<s @@@@rB�_handle_finite_setsz Intersection._handle_finite_sets2s������ �t�%=�%=�d�K�K�K����� � �F�.�-�W�-�-�-���0�0�'�3�5�5�A�A� ��5�5��� !� !�A��:�:�:�:�T�:�:�:�:�:�E���}�}�� � �Q����� � �!�!�A��I�I�a�L�L�L�L���/�/��#�%�%�@�@� �6�5�W�5�5�5� �� � � � �� � C� C� C� C� � C� C� C�C�C���4�<�<��L�L��O�O�O��#� )�'� 2� 2�:�:���1���6�6��H�H�Q�K�K�K�,5�q�M�J�q�M���&�&�q�)�)�)��E�$��!� �(�7�|�|� ��u�u�g�G� � 8�7�7�7�7�w�7�7�7�G� �s�u�u�g� � ��:� �/�/�w�/�/�/���0�0�'�3�5�5�A�A� �U�U�U�U� �;�;�;�;�V�;�;�;�� � "���(�D��q�z�!�!��z�!��#� "�� � �D�I�&�&�&�&�� � �D�!�!�!� �t�9�9��>�>���7�N���6��6�6� 6rAc�8��t�fd�|jD���S)zBRewrite an Intersection in terms of equalities and logic operatorsc�:��g|]}|������Sr@r?)r}r%r�s �rBr�z.Intersection.as_relational.<locals>.<listcomp>�s'���D�D�D�3�S�&�&�v�.�.�D�D�DrAr�rSr�s `rBr@zIntersection.as_relational�s%����D�D�D�D�$�)�D�D�D�E�ErA)r�rrrrFrr�r�r(r�rrJr�r�r�r�rMrrHr@r@rArBriri�se��������2�O� ����X������X��'+������$����X���9�9��X�9�����X������$�$��X�$��$�$��X�$�@�@�@�$L�$L�$L�L�a7�a7��\�a7�FF�F�F�F�FrAric�x�eZdZdZdZd d�Zed���Zd�Zd�Z d�Z e d���Z e d ���Z d �Zd S) rwa�Represents the set difference or relative complement of a set with another set. $$A - B = \{x \in A \mid x \notin B\}$$ Examples ======== >>> from sympy import Complement, FiniteSet >>> Complement(FiniteSet(0, 1, 2), FiniteSet(1)) {0, 2} See Also ========= Intersection, Union References ========== .. [1] https://mathworld.wolfram.com/ComplementSet.html Tc��tt||f��\}}|rt�||��St j|||��Sr?)r�r%rwrr r(�r)rEr�r�s rBr(zComplement.__new__�sK���8�a��V�$�$���1� � +��$�$�Q��*�*� *��}�S�!�Q�'�'�'rAc���|tjks��|��r tjSt |t ��rt �fd�|jD���S|����}|�|St�|d���S)z2 Simplify a :class:`Complement`. c3�B�K�|]}|����V��dSr?r�)r}r�As �rBr�z$Complement.reduce.<locals>.<genexpr>�s-�����!B�!B�a�!�,�,�q�/�/�!B�!B�!B�!B�!B�!BrANFr�) rr�r�rpr�rcrir�r�rw�rQ�B�results` rBrzComplement.reduce�s���� ��� � �!�+�+�a�.�.� ��:� � �a�� � � D��!B�!B�!B�!B�1�6�!B�!B�!B�C� C����q�!�!�� � ��M��a��U�3�3�3� 3rAc��|jd}|jd}t|�|��t|�|������S)Nrr�)r�r,r�r.)rSrerQrSs rBr�zComplement._contains�sH�� �I�a�L�� �I�a�L���1�:�:�e�$�$�c�!�*�*�U�*;�*;�&<�&<�=�=�=rAc��|j\}}|�|��}t|�|����}t||��S)zGRewrite a complement in terms of equalities and logic operators)r�r@r.r,�rSr�rQrS�A_rel�B_rels rBr@zComplement.as_relational�sI���y���1�����'�'���A�O�O�F�+�+�,�,���5�%� � � rAc�&�|jdjS�Nr)r�r�rRs rBr�zComplement._kind�s���y��|� � rAc�.�|jdjrdSdS)NrT)r�rrRs rBrzComplement.is_iterable�s"�� �9�Q�<� #� ��4� � rAc�R�|j\}}|j}|durdS|dur |jrdSdSdS)NTF)r�rJ)rSrQrS�a_finites rBrJzComplement.is_finite_set�sI���y���1��?�� �t� � ��4� �� � �1�?� ��5�� � � rAc#�:K�|j\}}|D] }||vr|V�� � dSr?r,)rSrQrSrEs rBrMzComplement.__iter__�sA�����y���1�� � �A���z�z��G�G�G�G��  � rAN�T)r�rrrrHr(rrr�r@r�rrrJrMr@rArBrwrw�s���������0�M�(�(�(�(��4�4��\�4�">�>�>� !�!�!�!�!�!�����X������X������rArwc��eZdZdZdZdZdZeeddd���d�����Z ed���Z d �Z d �Z d �Z d �Zd �Zed���Zd�Zd�Zd�ZdS)rpa� Represents the empty set. The empty set is available as a singleton as ``S.EmptySet``. Examples ======== >>> from sympy import S, Interval >>> S.EmptySet EmptySet >>> Interval(1, 2).intersect(S.EmptySet) EmptySet See Also ======== UniversalSet References ========== .. [1] https://en.wikipedia.org/wiki/Empty_set TrKrLrMrNc��dS)NTr@rRs rBrTzEmptySet.is_EmptySetrUrAc��dSr[r@rRs rBr�zEmptySet._measure!����qrAc��tSr?�r1rds rBr�zEmptySet._contains%���� rAc��tSr?rfrKs rBr@zEmptySet.as_relational(rgrAc��dSr[r@rRs rBrbzEmptySet.__len__+s���qrAc� �tg��Sr?rrRs rBrMzEmptySet.__iter__.s ���B�x�x�rAc� �t|��Sr?r�rRs rBr�zEmptySet._eval_powerset1s������rAc��|Sr?r@rRs rBr�zEmptySet._boundary4���� rAc��|Sr?r@rds rBr�zEmptySet._complement8���� rAc��t��Sr?)r�rRs rBr�zEmptySet._kind;s ���y�y�rAc��|Sr?r@rds rBr�zEmptySet._symmetric_difference>rorAN)r�rrrrIrJrrr2rTr�r�r@rbrMr�r�r�r�r�r@rArBrprp�s!��������0�H��M��L� ��Z� �"'�#;� ��������X������X���������������������X������������rArp)� metaclassc�h�eZdZdZdZdZdZd�Zd�Ze d���Z d�Z d�Z d �Z e d ���Zd S) r�a� Represents the set of all things. The universal set is available as a singleton as ``S.UniversalSet``. Examples ======== >>> from sympy import S, Interval >>> S.UniversalSet UniversalSet >>> Interval(1, 2).intersect(S.UniversalSet) Interval(1, 2) See Also ======== EmptySet References ========== .. [1] https://en.wikipedia.org/wiki/Universal_set TFc��tjSr?r�rds rBr�zUniversalSet._complement`s ���z�rAc��|Sr?r@rds rBr�z"UniversalSet._symmetric_differencecrorAc��tjSr?)rr^rRs rBr�zUniversalSet._measurefr�rAc�*�tt��Sr?r�rRs rBr�zUniversalSet._kindjr�rAc��tSr?�r0rds rBr�zUniversalSet._containsm���� rAc��tSr?ryrKs rBr@zUniversalSet.as_relationalprzrAc��tjSr?r�rRs rBr�zUniversalSet._boundarysr�rAN)r�rrrrGrIrJr�r�rr�r�r�r@r�r@rArBr�r�Bs���������2�O��H��M�����������X��&�&�&�����������X���rAr�c�2��eZdZUdZdZdZdZdZd�Zd�Z d�Z d�Z d�Z e d ���Ze d ���Ze d ���Ze d ���Zd �Zd�Zd�Zd�Zd�Zd�Ze d���Zd�Zd�Zd�Zd�Zd�Zd�Z�fd�Ze j!Z!e"e ge#fe$d<�xZ%S)r�a� Represents a finite set of Sympy expressions. Examples ======== >>> from sympy import FiniteSet, Symbol, Interval, Naturals0 >>> FiniteSet(1, 2, 3, 4) {1, 2, 3, 4} >>> 3 in FiniteSet(1, 2, 3, 4) True >>> FiniteSet(1, (1, 2), Symbol('x')) {1, x, (1, 2)} >>> FiniteSet(Interval(1, 2), Naturals0, {1, 2}) FiniteSet({1, 2}, Interval(1, 2), Naturals0) >>> members = [1, 2, 3, 4] >>> f = FiniteSet(*members) >>> f {1, 2, 3, 4} >>> f - FiniteSet(2) {1, 3, 4} >>> f + FiniteSet(2, 5) {1, 2, 3, 4, 5} References ========== .. [1] https://en.wikipedia.org/wiki/Finite_set TFc��|�dtj��}|rBtt t |����}t |��dkr tjSn"tt t |����}i}ttt|������D]<}|j r|||<� |||� ��<�(#t$r|||<Y�9wxYwt|�����}tt|t j����}t%j|g|�R�}||_|S)Nr�r)r�rr�r�r�r&r�rrp�reversedr r7�as_dummyr r%�valuesrErar r(� _args_set)r)r�r�r��dargsr~r�r�s rBr(zFiniteSet.__new__�sD���:�:�j�*;�*D�E�E�� � ,���G�T�*�*�+�+�D��4�y�y�A�~�~��z�!����G�T�*�*�+�+�D����$�w�t�}�}�-�-�.�.� !� !�A��{� !���a���!�*+�E�!�*�*�,�,�'�'�� �!�!�!� �E�!�H�H�H�!������ � ���'�'� ��G�I�s�'7�8�8�9�9���m�C�'�$�'�'�'��!�� �� s�C�C,�+C,c�*�t|j��Sr?)rr�rRs rBrMzFiniteSet.__iter__�s���D�I���rAc �&�t|t���r~gg}}|jD]G}|jr|jr|�|���&|jdkr�2|�|���H|t jkr�|gkr�|���g}|tt j |ddd��gz }t|dd�|dd���D]*\}}|�t||dd�����+|�t|dt j dd����|gkr#tt|ddi�t|�d���St|ddi�S|gkr|rt|t|�d���S|Sn�t|t��r�g}|D]U} t|�| ����} | t jur#| t jur|�| ���Vt|�}||krdSg} |D]G} t|�| ����} | t jur| �| ���Htt| �|��St&�||��S)NFrTr�r�r�r�)r�r�r�rr�r�rr�rrlr�r^rwrcr�r&r�r0r1rEr�) rSrer��symsr�� intervalsrEr��unkr~r��not_trues rBr�zFiniteSet._complement�s��� �e�X� &� &�, 9��R�$�D��Y� #� #���;�#�1�9�#��K�K��N�N�N�N��Y�%�'�'���K�K��N�N�N�N������D�B�J�J�� � � � � �� ��h�q�'9�4��7�D�$�O�O�P�P� ���S�b�S� �4����8�4�4�A�A�D�A�q��$�$�X�a��D�$�%?�%?�@�@�@�@�� � ��$�r�(�A�J��d�!K�!K�L�L�L��2�:�:�%�e�Y�&G��&G�&G�%�t�,�u�>�>�>�>�!�)�<�e�<�<�<������!�%�e�Y��-=��N�N�N�N� �L� � ��y� )� )� 9��C�� "� "���E�N�N�1�-�-�.�.���A�F�?�?�q���'7�'7��J�J�q�M�M�M���S�/�C��d�{�{����H�� '� '���D�M�M�!�,�,�-�-���A�F�?�?��O�O�A�&�&�&���i��2�C�8�8� 8����t�U�+�+�+rAc�b���|jvr tjSt�fd�|jD���S)a� Tests whether an element, other, is in the set. Explanation =========== The actual test is for mathematical equality (as opposed to syntactical equality). In the worst case all elements of the set must be checked. Examples ======== >>> from sympy import FiniteSet >>> 1 in FiniteSet(1, 2) True >>> 5 in FiniteSet(1, 2) False c�4��g|]}t|�d�����S)Tr��r�r}r6res �rBr�z'FiniteSet._contains.<locals>.<listcomp>s(���G�G�G���1�e�d�3�3�3�G�G�GrA)r�rr0r-r�rds `rBr�zFiniteSet._contains�s=���* �D�N� "� "��6�M��G�G�G�G�T�Y�G�G�G�H� HrAc�D��t�fd�|jD����S)Nc3�B�K�|]}��|��V��dSr?)r�r�s �rBr�z,FiniteSet._eval_is_subset.<locals>.<genexpr>s/�����?�?������+�+�?�?�?�?�?�?rAr�rds `rBr�zFiniteSet._eval_is_subsetr�rAc��|Sr?r@rRs rBr�zFiniteSet._boundary rmrAc��t|�Sr?)r+rRs rBr�zFiniteSet._inf� ���D�z�rAc��t|�Sr?)r*rRs rBr�zFiniteSet._supr�rAc��dSr[r@rRs rBr�zFiniteSet.measurerdrAc�����jst��St�fd��jD����rt�jdj��Stt��S)Nc3�N�K�|]}|j�jdjkV�� dSr��r�r��r}r~rSs �rBr�z"FiniteSet._kind.<locals>.<genexpr>�3�����@�@����4�9�Q�<�,�,�@�@�@�@�@�@rAr�r�r�r'r�rrRs`rBr�zFiniteSet._kindsc����y� *��9�9� � �@�@�@�@�d�i�@�@�@� @� @� *��4�9�Q�<�,�-�-� -��=�)�)� )rAc�*�t|j��Sr?)r�r�rRs rBrbzFiniteSet.__len__"rerAc�.��t�fd�|D���S)z@Rewrite a FiniteSet in terms of equalities and logic operators. c�0��g|]}t�|����Sr@r�)r}�elemr�s �rBr�z+FiniteSet.as_relational.<locals>.<listcomp>'s#���6�6�6��B�v�t�$�$�6�6�6rA)r-rKs `rBr@zFiniteSet.as_relational%s#����6�6�6�6��6�6�6�7�7rAc�@�t|��t|��z Sr?)�hashrds rB�comparezFiniteSet.compare)s���T� � �T�%�[�[�(�)rAc�L��t|���t�fd�|D���S)Nc�<��g|]}|�������Sr�r�)r}r�r�s �rBr�z)FiniteSet._eval_evalf.<locals>.<listcomp>.s'���>�>�>��4�:�:��:�,�,�>�>�>rA)r=r�r�s @rBr�zFiniteSet._eval_evalf,s0����$�����>�>�>�>��>�>�>�?�?rAc �>���ddlm�t��fd�|D���S)Nr)�simplifyc�"��g|] }�|fi����� Sr@r@)r}r�r�r�s ��rBr�z,FiniteSet._eval_simplify.<locals>.<listcomp>2s+���E�E�E��8�8�D�3�3�F�3�3�E�E�ErA)�sympy.simplifyr�r�)rSr�r�s `@rB�_eval_simplifyzFiniteSet._eval_simplify0s9����+�+�+�+�+�+��E�E�E�E�E��E�E�E�F�FrAc��|jSr?r,rRs rB� _sorted_argszFiniteSet._sorted_args4r-rAc�T���j�fd�t�j��D���S)Nc�$��g|] }�j|��� Sr@)r�)r}rrSs �rBr�z,FiniteSet._eval_powerset.<locals>.<listcomp>9s!���E�E�E�Q�9�4�9�a�=�E�E�ErA)r�r8r�rRs`rBr�zFiniteSet._eval_powerset8s1����t�y�E�E�E�E�'�$�)�2D�2D�E�E�E�F�FrAc���ddlm}d�}|t|����sdSd��t�fd�|D����sdSt |t���}t |j��D]}t|�}||vrdS�||��S)z1Rewriting method for a finite set to a power set.r�r�c�2�t|o||dz z ��SrZ)�boolr�s rBrCz5FiniteSet._eval_rewrite_as_PowerSet.<locals>.<lambda>?s��4�� 5�!�q�1�u�+�o�6�6�rANc�:�t|t��o|jSr?)r�rEr)r�s rBrCz5FiniteSet._eval_rewrite_as_PowerSet.<locals>.<lambda>Cs��j��c�2�2�G�s�7G�rAc3�.�K�|]}�|��V��dSr?r@)r}r��fs_tests �rBr�z6FiniteSet._eval_rewrite_as_PowerSet.<locals>.<genexpr>Ds+�����0�0�C�7�7�3�<�<�0�0�0�0�0�0rAr)r�r�r�r'�maxr8r�r�) rSr�r�r��is2pow�biggestr��arg_setr�s @rB�_eval_rewrite_as_PowerSetz#FiniteSet._eval_rewrite_as_PowerSet;s����&�&�&�&�&�&�6�6���v�c�$�i�i� � � ��4�G�G���0�0�0�0�4�0�0�0�0�0� ��4��d��$�$�$���7�<�(�(� � �C���o�G��d�"�"��t�t�#��x�� � � rAc��t|t��stdt|��z���|�|��S�Nz!Invalid comparison of set with %s�r�rEr r9r�rds rB�__ge__zFiniteSet.__ge__NsC���%��%�%� T��?�)�E�BR�BR�R�S�S� S����t�$�$�$rAc��t|t��stdt|��z���|�|��Sr�)r�rEr r9r�rds rB�__gt__zFiniteSet.__gt__SsE���%��%�%� T��?�)�E�BR�BR�R�S�S� S��&�&�u�-�-�-rAc��t|t��stdt|��z���|�|��Sr�r�rds rB�__le__zFiniteSet.__le__XsC���%��%�%� T��?�)�E�BR�BR�R�S�S� S��~�~�e�$�$�$rAc��t|t��stdt|��z���|�|��Sr�)r�rEr r9r�rds rB�__lt__zFiniteSet.__lt__]sE���%��%�%� T��?�)�E�BR�BR�R�S�S� S��$�$�U�+�+�+rAc���t|ttf��r |j|kSt ���|��Sr?)r�r%r�r��super�__eq__)rSre� __class__s �rBr�zFiniteSet.__eq__bs=��� �e�c�9�-� .� .� +��>�U�*� *��w�w�~�~�e�$�$�$rA�__hash__)&r�rrrrrrIrJr(rMr�r�r�rr�r�r�r�r�rbr@r�r�r�r�r�r�r�r�r�r�r�r r�rrr� __classcell__�r�s@rBr�r�xs����������:�L��K��H��M����8���/,�/,�/,�bI�I�I�8@�@�@�����X������X������X������X��*�*�*����8�8�8�*�*�*�@�@�@�G�G�G�����X��G�G�G�!�!�!�&%�%�%� .�.�.� %�%�%� ,�,�,� %�%�%�%�%� ).��H�x���� �%�6�6�6�6�6�6�6rAr�c��t|�Sr?r�rs rBrCrCis ��)�Q�-�rAc��t|�Sr?r�rs rBrCrCjs �� �1� �rAc�V�eZdZdZdZd d�Zed���Zd�Ze d���Z d�Z dS) r�a�Represents the set of elements which are in either of the sets and not in their intersection. Examples ======== >>> from sympy import SymmetricDifference, FiniteSet >>> SymmetricDifference(FiniteSet(1, 2, 3), FiniteSet(3, 4, 5)) {1, 2, 4, 5} See Also ======== Complement, Union References ========== .. [1] https://en.wikipedia.org/wiki/Symmetric_difference Tc�h�|rt�||��Stj|||��Sr?)r�rr r(rNs rBr(zSymmetricDifference.__new__�s4�� � 4�&�-�-�a��3�3� 3��}�S�!�Q�'�'�'rAc�X�|�|��}|�|St||d���S)NFr�)r�r�rRs rBrzSymmetricDifference.reduce�s5���(�(��+�+�� � ��M�&�q�!�e�<�<�<� <rAc��|j\}}|�|��}|�|��}t||��S)zQRewrite a symmetric_difference in terms of equalities and logic operators)r�r@r/rWs rBr@z!SymmetricDifference.as_relational�sA���y���1�����'�'������'�'���5�%� � � rAc�F�td�|jD����rdSdS)Nc3�$K�|] }|jV�� dSr?rHr�s rBr�z2SymmetricDifference.is_iterable.<locals>.<genexpr>�s$����4�4�3�s��4�4�4�4�4�4rATrrRs rBrzSymmetricDifference.is_iterable�s2�� �4�4�$�)�4�4�4� 4� 4� ��4� � rAc#�K�|j}td�|D���}|D]}d}|D] }||vr|dz }� |dzdkr|V�� dS)Nc3�4K�|]}t|��V��dSr?rr�s rBr�z/SymmetricDifference.__iter__.<locals>.<genexpr>�s(����7�7�3�T�#�Y�Y�7�7�7�7�7�7rArr�rw)r�r6)rSr�rf�item�countrs rBrMzSymmetricDifference.__iter__�s}�����y���7�7�$�7�7�7�8��� � �D��E�� � ���1�9�9��Q�J�E���q�y�A�~�~�� � � �� � rANr`) r�rrr�is_SymmetricDifferencer(rrr@rrrMr@rArBr�r�ms���������*"��(�(�(�(� �=�=��\�=�!�!�!�����X�� � � � � rAr�c��eZdZdZd�Zed���Zed���Zed���Zed���Z d�Z d�Z d �Z d �Z d �Zd S) � DisjointUniona� Represents the disjoint union (also known as the external disjoint union) of a finite number of sets. Examples ======== >>> from sympy import DisjointUnion, FiniteSet, Interval, Union, Symbol >>> A = FiniteSet(1, 2, 3) >>> B = Interval(0, 5) >>> DisjointUnion(A, B) DisjointUnion({1, 2, 3}, Interval(0, 5)) >>> DisjointUnion(A, B).rewrite(Union) Union(ProductSet({1, 2, 3}, {0}), ProductSet(Interval(0, 5), {1})) >>> C = FiniteSet(Symbol('x'), Symbol('y'), Symbol('z')) >>> DisjointUnion(C, C) DisjointUnion({x, y, z}, {x, y, z}) >>> DisjointUnion(C, C).rewrite(Union) ProductSet({x, y, z}, {0, 1}) References ========== https://en.wikipedia.org/wiki/Disjoint_union c��g}|D]>}t|t��r|�|���-td|z���t j|g|�R�}|S)NzQInvalid input: '%s', input args to DisjointUnion must be Sets)r�rEr�r r r()r)r�� dj_collection�set_ir�s rBr(zDisjointUnion.__new__�sz��� �� <� <�E��%��%�%� <��$�$�U�+�+�+�+��!3�5:�!;�<�<�<��m�C�0�-�0�0�0��� rAc��|jSr?r,rRs rBr�zDisjointUnion.sets�r-rAc�>�td�|jD����S)Nc3�$K�|] }|jV�� dSr?rPr"s rBr�z)DisjointUnion.is_empty.<locals>.<genexpr>�s$����7�7����7�7�7�7�7�7rA)rr�rRs rBrIzDisjointUnion.is_empty�s!���7�7�T�Y�7�7�7�7�7�7rAc�j�td�|jD����}t|j|g��S)Nc3�$K�|] }|jV�� dSr?rSr"s rBr�z.DisjointUnion.is_finite_set.<locals>.<genexpr>�rTrArUrVs rBrJzDisjointUnion.is_finite_set�rXrAc�P�|jrdSd}|jD]}|js |o|j}�|S)NFT)rIr�r)rS� iter_flagr�s rBrzDisjointUnion.is_iterable�sE�� �=� ��5�� ��Y� <� <�E��>� <�%�;�%�*;� ���rAc��tj}d}|D]I}t|t��r2t |t |����}t ||��}|dz}�J|S)z� Rewrites the disjoint union as the union of (``set`` x {``i``}) where ``set`` is the element in ``sets`` at index = ``i`` rr�)rrpr�rEr�r�rc)rSr�r��dj_union�indexr��crosss rB�_eval_rewrite_as_Unionz$DisjointUnion._eval_rewrite_as_Union�sf�� �:����� "� "�E��%��%�%� "�"�5�)�E�*:�*:�;�;�� ��5�1�1���� ����rAc�`�t|t��rt|��dkr tjS|djs tjS|dt|j��ks |ddkr tjS|j|d�|d��S)a� ``in`` operator for DisjointUnion Examples ======== >>> from sympy import Interval, DisjointUnion >>> D = DisjointUnion(Interval(0, 1), Interval(0, 2)) >>> (0.5, 0) in D True >>> (0.5, 1) in D True >>> (1.5, 0) in D False >>> (1.5, 1) in D True Passes operation on to constituent sets rwr�r)r�r r�rr1rr�r�r8s rBr�zDisjointUnion._contains�s���(�'�5�)�)� �S��\�\�Q�->�->��7�N��q�z�$� ��7�N� �1�:��T�Y��� '� '�7�1�:��>�>��7�N��y����$�.�.�w�q�z�:�:�:rAc����jst��St�fd��jD����r�jdjStt��S)Nc3�N�K�|]}|j�jdjkV�� dSr�r�r�s �rBr�z&DisjointUnion._kind.<locals>.<genexpr> r�rArr�rRs`rBr�zDisjointUnion._kind s[����y� *��9�9� � �@�@�@�@�d�i�@�@�@� @� @� *��9�Q�<�$� $��=�)�)� )rAc ���|jrcg}t|j��D]6\}}|�t |t |��h�����7t t|���Std|z���)Nz'%s' is not iterable.) rr�r�r�r4rrr6r])rS�itersr~rs rBrMzDisjointUnion.__iter__$ s}�� � � =��E�!�$�)�,�,� 8� 8���1�� � �X�a�'�!�*�*��6�6�7�7�7�7�� �E�*�+�+� +��4�t�;�<�<� <rAc�t�|jr d}|jD]}|t|��z }�|Std|z���)a1 Returns the length of the disjoint union, i.e., the number of elements in the set. Examples ======== >>> from sympy import FiniteSet, DisjointUnion, EmptySet >>> D1 = DisjointUnion(FiniteSet(1, 2, 3, 4), EmptySet, FiniteSet(3, 4, 5)) >>> len(D1) 7 >>> D2 = DisjointUnion(FiniteSet(3, 5, 7), EmptySet, FiniteSet(3, 5, 7)) >>> len(D2) 6 >>> D3 = DisjointUnion(EmptySet, EmptySet) >>> len(D3) 0 Adds up the lengths of the constituent sets. rz'%s' is not a finite set.)rJr�r�r])rS�sizer%s rBrbzDisjointUnion.__len__/ sQ��* � � A��D��y� !� !����C��� ����K��8�4�?�@�@� @rAN)r�rrrr(rr�rIrJrr�r�r�rMrbr@rArBr�r��s���������2 � � �����X���8�8��X�8��5�5��X�5�����X�� � � �;�;�;�>*�*�*� =� =� =�A�A�A�A�ArAr�c ���ddlm}ddlm}t |��dkrt dt |��z���t |dttf��r:t |��dkr't|d|d��}|dd�}n|d}|dd�}t |t��r�nt|��r�t|di��}|rct |��dkrttd �����|jd}|dkrd }n7d �td|dz��D��}nt!j|��j}t'|d �|D������t�fd �|D����}t|||���}n,t)tdt+|��z�����t-d�|D����rd�|D��} t d| z���t |��dk�r|d} ||| ��} | �t(�| s| Sn#t($r||| ��} YnwxYwt | |��r | j\}} |jd|jkr| St | |��r�t | jj��dkrzt |j��dkrb| jjd} |jd} t5t| |j�| | jj����g| j�R�S| �| S||g|�R�S)a� Return an image of the set under transformation ``f``. Explanation =========== If this function cannot compute the image, it returns an unevaluated ImageSet object. .. math:: \{ f(x) \mid x \in \mathrm{self} \} Examples ======== >>> from sympy import S, Interval, imageset, sin, Lambda >>> from sympy.abc import x >>> imageset(x, 2*x, Interval(0, 2)) Interval(0, 4) >>> imageset(lambda x: 2*x, Interval(0, 2)) Interval(0, 4) >>> imageset(Lambda(x, sin(x)), Interval(-2, 1)) ImageSet(Lambda(x, sin(x)), Interval(-2, 1)) >>> imageset(sin, Interval(-2, 1)) ImageSet(Lambda(x, sin(x)), Interval(-2, 1)) >>> imageset(lambda y: x + y, Interval(-2, 1)) ImageSet(Lambda(y, x + y), Interval(-2, 1)) Expressions applied to the set of Integers are simplified to show as few negatives as possible and linear expressions are converted to a canonical form. If this is not desirable then the unevaluated ImageSet should be used. >>> imageset(x, -2*x + 5, S.Integers) ImageSet(Lambda(x, 2*x + 1), Integers) See Also ======== sympy.sets.fancysets.ImageSet r���ImageSet)� set_functionrwz)imageset expects at least 2 args, got: %srN�nargsz� This function can take more than 1 arg but the potentially complicated set input has not been analyzed at this point to know its dimensions. TODO r�c�2�g|]}td|z����S)zx%i)r"r=s rBr�zimageset.<locals>.<listcomp>� s$��@�@�@�1�V�E�A�I�&�&�@�@�@rAc�*�g|]}t����Sr@)r#r=s rBr�zimageset.<locals>.<listcomp>� s��0�0�0��U�W�W�0�0�0rAc3�R�K�|]!}tt|�����V��"dSr?)r$r")r}r~�dexprs �rBr�zimageset.<locals>.<genexpr>� sL�����*�*�"#�*� �1�I�I�u���*�*�*�*�*�*rAzN expecting lambda, Lambda, or FunctionClass, not '%s'.c3�BK�|]}t|t�� V��dSr?r$r"s rBr�zimageset.<locals>.<genexpr>� s/���� 4� 4�a�z�!�S�!�!� !� 4� 4� 4� 4� 4� 4rAc�,�g|]}t|����Sr@)r9r"s rBr�zimageset.<locals>.<listcomp>� s��/�/�/�� �!� � �/�/�/rAz.arguments after mapping should be sets, not %s)� fancysetsr��setexprr�r�r]r�r"r&r�callable�getattrrZr:r�r��inspect� signature� parametersr%r r9r� variablesr_�lamda�imagesetr�� base_sets)r�r�r��f�set_listr��Nr�var�namer%�rr��yr�s @rBrrM s����^$�#�#�#�#�#�%�%�%�%�%�%� �4�y�y�1�}�}��D�s�4�y�y�P�Q�Q�Q��$�q�'�F�E�?�+�+���D� � �A� � � �4��7�D��G� $� $������8��� ��G������8���!�V���,� � �!���,���7�B�'�'�� � 0��5�z�z�Q���)�*�6�+�+���� � �1� �A��A�v�v����@�@��a��Q����@�@�@����!�!�$�$�/�A����0�0�a�0�0�0�1�2�2���*�*�*�*�'(�*�*�*�*�*�� �3���3�� � ���� �$�&�q�\�\�$*�+�+�,�,� ,� � 4� 4�8� 4� 4� 4�4�4�E�/�/�h�/�/�/��� <�t� C�E�E� E� �8�}�}�����q�k�� !�� �Q��$�$�A��y���� ��� ��� !� !� !����C� � �A�A�A� !���� �a�� "� "� ��V�F�A�s� �;�q�>�Q�V� #� #��J� �c�8� $� $� O� �3�9�&�'�'�1�,�,��Q�[�1A�1A�Q�1F�1F��I�'��*���K��N����1�a�f�k�k�!�S�Y�^�<�<�=�=�O�@C� �O�O�O�O� �=��H� �8�A� !�� !� !� !�!s�.I�I!� I!c��|ttfvrdStd��}||���|��}|dkdks |dkdkrdSdS)zk Checks whether function ``func`` is invertible when the domain is restricted to set ``setv``. T�urN)r(r)r#�diff)r��setvr �fdiffs rB�is_function_invertible_in_setr� sc��  ��S�z����t� �c� � �A� �D��G�G�L�L��O�O�E� �� �d���u�q�y�T�1�1��t� �4rAc�D�ddlm}|s tjS|D]&}t |t ��st d����'d�|D��}t|��dkr%d�|D��}t|�}|gd�|D��z}t|��}d}|rZ|D]U}d }||hz D]D}|||��} | �4t | t��s| h} |||hz � | ��}n�E|r|}n�V|�Zt|��dkr|� ��St|d d i�S) aZ Simplify a :class:`Union` using known rules. Explanation =========== We first start with global rules like 'Merge all FiniteSets' Then we iterate through all pairs and ask the constituent sets if they can simplify themselves with any other constituent. This process depends on ``union_sets(a, b)`` functions. r)� union_sets� Input args to Union must be Setsc� �g|] }|j� |�� Sr@r)�r}r�s rBr�z"simplify_union.<locals>.<listcomp>� s��5�5�5��a�n�5�1�5�5�5rAr�c3�$K�|] }|D]}|V��� dSr?r@)r}r%r�s rBr�z!simplify_union.<locals>.<genexpr>� s/���� 3� 3�3�s� 3� 3�!�Q� 3� 3� 3� 3� 3� 3� 3rAc� �g|] }|j� |�� Sr@r)rs rBr�z"simplify_union.<locals>.<listcomp>� s��E�E�E�Q�a�n�E�q�E�E�ErATFNr�) �sympy.sets.handlers.unionrrrpr�rEr r�r�r%rf�poprc) r�rr�� finite_setsrE� finite_set�new_argsr�t�new_sets rBr�r�� s���5�4�4�4�4�4� ���z���@�@���#�s�#�#� @��>�?�?� ?� @�6�5�d�5�5�5�K� �;���!��� 3� 3�+� 3� 3� 3����]� ��|�E�E�$�E�E�E�E�� �t�9�9�D��H� ��� � �A��H��Q�C�Z� � ��$�*�Q��*�*���&�%�g�s�3�3�,�#*�)�� $��1�v� �4�4�W�=�=�H��E� '� � ����� � ��  �4�y�y�A�~�~��x�x�z�z���d�+�U�+�+�+rAc�z� �|s tjS|D]&}t|t��st d����'tj|vr tjSt �|��}|�|S|D]d}|jr[t|��|hz }t|��dkr%t |�� t� fd�|j D���cSt|j �cS�e|D]S}|j rJ|�|��||j dgz}tt |�|j d��cS�Tddlm}t|��}d}|rC|D]>}d}||hz D]-}|||��}|�|||hz �|h��}n�.|r|}n�?|�Ct|��dkr|���St |d di�S) aI Simplify an intersection using known rules. Explanation =========== We first start with global rules like 'if any empty sets return empty set' and 'distribute any unions' Then we iterate through all pairs and ask the constituent sets if they can simplify themselves with any other constituent rNrc3�8�K�|]}t|���V��dSr?rh)r}r�res �rBr�z(simplify_intersection.<locals>.<genexpr>= s-�����J�J�C�|�C��7�7�J�J�J�J�J�JrAr�)�intersection_setsTFr�)rr�r�rEr rprirHrr%r�rcr�rHr?rw� sympy.sets.handlers.intersectionr!rfr) r�r��rvrr&r!rrrres @rBr r  s^��� ���~���@�@���#�s�#�#� @��>�?�?� ?� @� �z�T����z�� � )� )�$� /� /�B� �~�� ��&�&�� �:� &��T���a�S��J��:����"�"�$�j�1���J�J�J�J�1�6�J�J�J�K�K�K�K��a�f�~�%�%�%�  &��D�D�� �?� D� �K�K��N�N�N������ �+�J��l�J�7�����C�C� C� C� C� D� C�B�B�B�B�B� �t�9�9�D��H� � �� � �A��H��Q�C�Z� � ��+�+�A�q�1�1���&� $��1�v� �4�4�g�Y�?�?�H��E�'�� ����� � � � �4�y�y�A�~�~��x�x�z�z���T�2�E�2�2�2rAc������t||gd�d���\��t���dkrt��fd��dD���St���dkr���fd��dD��}t|�SdS) Nc�,�t|t��Sr?)r�r�rs rBrCz%_handle_finite_sets.<locals>.<lambda>g s��J�q�)�,D�,D�rATr*rwc�>��g|]}�dD]}�||�����S)r�r@)r}r~rDrA�ops ��rBr�z'_handle_finite_sets.<locals>.<listcomp>i s4���L�L�L�����L�L�A�2�2�a��8�8�L�L�L�LrArr�c�@��g|]}t��d|�����Sr�)�_apply_operation)r}r~� commutativer'res ���rBr�z'_handle_finite_sets.<locals>.<listcomp>k s,���S�S�S�1� ��U�1�X�q�+�>�>�S�S�SrA)r5r�r�rc)r'r�r r*r�rAres` ` @@rBrHrHe s��������1�a�&�"D�"D�T�R�R�R�N�G�U� �7�|�|�q����L�L�L�L�L�W�Q�Z�L�L�L�M�M� �W���� � �S�S�S�S�S�S��PQ� �S�S�S���d�|���trAc ��ddlm}td��}t||||��}|� |||��}|�|r |||��}|��t d��\}}t |t ��rLt |t ��s7|t||||����|�����}n�t |t ��sLt |t ��r7|t||||����|�����}n'|t||f|||����||��}|S)Nr�r�r�zx y) r�r�r#rHr!r�rEr�doit) r'r�r r*r�r��out�_x�_ys rBr)r)q sN��#�#�#�#�#�#� �c� � �A� �b�!�Q� � 4� 4�C� �{��b��A�h�h�� �{�{�{��b��A�h�h�� �{�������B� �a�� � � ?�j��C�&8�&8� ?��(�6�!�R�R��1�X�X�.�.��2�2�7�7�9�9�C�C��A�s�#�#� ?� �1�c�(:�(:� ?��(�6�!�R�R��1�X�X�.�.��2�2�7�7�9�9�C�C��(�6�2�r�(�B�B�r�2�J�J�7�7��A�>�>�C� �JrAc�4�ddlm}t|||d���S)Nr)�_set_addT�r*)�sympy.sets.handlers.addr1r))r�r r1s rB�set_addr4� �+��0�0�0�0�0�0� �H�a��� =� =� =�=rAc�4�ddlm}t|||d���S)Nr)�_set_subFr2)r3r7r))r�r r7s rB�set_subr8� �+��0�0�0�0�0�0� �H�a��� >� >� >�>rAc�4�ddlm}t|||d���S)Nr)�_set_mulTr2)�sympy.sets.handlers.mulr;r))r�r r;s rB�set_mulr=� r5rAc�4�ddlm}t|||d���S)Nr)�_set_divFr2)r<r?r))r�r r?s rB�set_divr@� r9rAc�4�ddlm}t|||d���S)Nr)�_set_powFr2)�sympy.sets.handlers.powerrBr))r�r rBs rB�set_powrD� s+��2�2�2�2�2�2� �H�a��� >� >� >�>rAc�&�ddlm}|||��S)Nr)� _set_function)�sympy.sets.handlers.functionsrF)rr�rFs rBr�r�� s&��;�;�;�;�;�;� �=��A� � �rAc�*��eZdZdZd�fd� Zd�Z�xZS)r�a# SetKind is kind for all Sets Every instance of Set will have kind ``SetKind`` parametrised by the kind of the elements of the ``Set``. The kind of the elements might be ``NumberKind``, or ``TupleKind`` or something else. When not all elements have the same kind then the kind of the elements will be given as ``UndefinedKind``. Parameters ========== element_kind: Kind (optional) The kind of the elements of the set. In a well defined set all elements will have the same kind. Otherwise the kind should :class:`sympy.core.kind.UndefinedKind`. The ``element_kind`` argument is optional but should only be omitted in the case of ``EmptySet`` whose kind is simply ``SetKind()`` Examples ======== >>> from sympy import Interval >>> Interval(1, 2).kind SetKind(NumberKind) >>> Interval(1,2).kind.element_kind NumberKind See Also ======== sympy.core.kind.NumberKind sympy.matrices.kind.MatrixKind sympy.core.containers.TupleKind Nc�Z��t���||��}||_|Sr?)r�r(r])r)r]r�r�s �rBr(zSetKind.__new__� s'����g�g�o�o�c�<�0�0��'���� rAc�(�|jsdSd|jzS)Nz SetKind()z SetKind(%s))r]rRs rB�__repr__zSetKind.__repr__� s ��� � 5��;� �4�#4�4� 4rAr?)r�rrrr(rKr�r�s@rBr�r�� sW�������"�"�F������ 5�5�5�5�5�5�5rAr�)s�typingrr� functoolsr� collectionsrr��sympy.core.kindrrr �sympy.core.basicr �sympy.core.containersr r �sympy.core.decoratorsr r�sympy.core.evalfr�sympy.core.exprr�sympy.core.functionr�sympy.core.logicrrrrr�sympy.core.numbersrr�sympy.core.operationsr�sympy.core.parametersr�sympy.core.relationalrrr�sympy.core.singletonrr�sympy.core.sortingr �sympy.core.symbolr!r"r#r$�sympy.core.sympifyr%r&r'�&sympy.functions.elementary.exponentialr(r)�(sympy.functions.elementary.miscellaneousr*r+�sympy.logic.boolalgr,r-r.r/r0r1�sympy.utilities.decoratorr2�sympy.utilities.exceptionsr3�sympy.utilities.iterablesr4r5r6r7r8�sympy.utilities.miscr9r:�mpmathr;r<�mpmath.libmp.libmpfr=r�rEr�r�rcrirwrpr�r�r%r�r�r�rrr�r rHr)r4r8r=r@rDr�r�r@rArB�<module>rhs��� � � � � � � � �������#�#�#�#�#�#�����;�;�;�;�;�;�;�;�;�;�"�"�"�"�"�"�2�2�2�2�2�2�2�2�E�E�E�E�E�E�E�E�'�'�'�'�'�'� � � � � � �&�&�&�&�&�&���������������-�-�-�-�-�-�-�-�+�+�+�+�+�+�3�3�3�3�3�3�/�/�/�/�/�/�/�/�/�/�-�-�-�-�-�-�-�-�&�&�&�&�&�&�K�K�K�K�K�K�K�K�K�K�K�K�B�B�B�B�B�B�B�B�B�B�;�;�;�;�;�;�;�;�=�=�=�=�=�=�=�=�>�>�>�>�>�>�>�>�>�>�>�>�>�>�>�>�0�0�0�0�0�0�@�@�@�@�@�@�0�0�0�0�0�0�0�0�0�0�0�0�0�0�6�6�6�6�6�6�6�6���������+�+�+�+�+�+��k�,�,��!�&��F�A�F� �1�7��G�Q�W� !�����C �C �C �C �C �%��C �C ���C �Lr�r�r�r�r��r�r�r�jY�Y�Y�Y�Y�s�Y�Y�Y�xn=�n=�n=�n=�n=�C��n=�n=�n=�bcF�cF�cF�cF�cF�3� �cF�cF�cF�LZ�Z�Z�Z�Z��Z�Z�Z�zG�G�G�G�G�s�i�G�G�G�G�T3�3�3�3�3�3�)�3�3�3�3�lo7�o7�o7�o7�o7��o7�o7�o7�b0�/����5�5����A�A�A�A�A�#�A�A�A�JXA�XA�XA�XA�XA�C�XA�XA�XA�v}"�}"�}"�@���$5,�5,�5,�pK3�K3�K3�\ � � ����*>�>�>� ?�?�?� >�>�>� ?�?�?� ?�?�?� ��� -5�-5�-5�-5�-5�d�-5�-5�-5�-5�-5rA
Memory