+
    -åûjA+  ã                   óN   € R t ^ RIHt ^ RIHt  ! R R]4      t ! R R]4      tR# )z-Computations with ideals of polynomial rings.)ÚCoercionFailed)ÚIntegerPowerablec                   óæ   a € ] tR t^t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t]tR t ] t!R t"R t#R t$R  t%R!t&V t'R"# )#ÚIdeala*  
Abstract base class for ideals.

Do not instantiate - use explicit constructors in the ring class instead:

>>> from sympy import QQ
>>> from sympy.abc import x
>>> QQ.old_poly_ring(x).ideal(x+1)
<x + 1>

Attributes

- ring - the ring this ideal belongs to

Non-implemented methods:

- _contains_elem
- _contains_ideal
- _quotient
- _intersect
- _union
- _product
- is_whole_ring
- is_zero
- is_prime, is_maximal, is_primary, is_radical
- is_principal
- height, depth
- radical

Methods that likely should be overridden in subclasses:

- reduce_element
c                ó   € \         h)z&Implementation of element containment.©ÚNotImplementedError©ÚselfÚxs   &&ÚSC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\sympy\polys\agca\ideals.pyÚ_contains_elemÚIdeal._contains_elem*   ó   € ä!Ð!ó    c                ó   € \         h)z$Implementation of ideal containment.r   )r
   ÚIs   &&r   Ú_contains_idealÚIdeal._contains_ideal.   r   r   c                ó   € \         h)z!Implementation of ideal quotient.r   ©r
   ÚJs   &&r   Ú	_quotientÚIdeal._quotient2   r   r   c                ó   € \         h)z%Implementation of ideal intersection.r   r   s   &&r   Ú
_intersectÚIdeal._intersect6   r   r   c                ó   € \         h)z*Return True if ``self`` is the whole ring.r   ©r
   s   &r   Úis_whole_ringÚIdeal.is_whole_ring:   r   r   c                ó   € \         h)z*Return True if ``self`` is the zero ideal.r   r   s   &r   Úis_zeroÚIdeal.is_zero>   r   r   c                óV   € V P                  V4      ;'       d    VP                  V 4      # )z!Implementation of ideal equality.)r   r   s   &&r   Ú_equalsÚIdeal._equalsB   s&   € à×#Ñ# AÓ&×BÐB¨1×+<Ñ+<¸TÓ+BÐBr   c                ó   € \         h)z)Return True if ``self`` is a prime ideal.r   r   s   &r   Úis_primeÚIdeal.is_primeF   r   r   c                ó   € \         h)z+Return True if ``self`` is a maximal ideal.r   r   s   &r   Ú
is_maximalÚIdeal.is_maximalJ   r   r   c                ó   € \         h)z+Return True if ``self`` is a radical ideal.r   r   s   &r   Ú
is_radicalÚIdeal.is_radicalN   r   r   c                ó   € \         h)z+Return True if ``self`` is a primary ideal.r   r   s   &r   Ú
is_primaryÚIdeal.is_primaryR   r   r   c                ó   € \         h)z-Return True if ``self`` is a principal ideal.r   r   s   &r   Úis_principalÚIdeal.is_principalV   r   r   c                ó   € \         h)z Compute the radical of ``self``.r   r   s   &r   ÚradicalÚIdeal.radicalZ   r   r   c                ó   € \         h)zCompute the depth of ``self``.r   r   s   &r   ÚdepthÚIdeal.depth^   r   r   c                ó   € \         h)zCompute the height of ``self``.r   r   s   &r   ÚheightÚIdeal.heightb   r   r   c                ó   € Wn         R # ©N©Úring)r
   rB   s   &&r   Ú__init__ÚIdeal.__init__j   s   € ØŽ	r   c                ó¢   € \        V\        4      '       d   VP                  V P                  8w  d   \        RV P                  : RV: 24      hR# )z.Helper to check ``J`` is an ideal of our ring.zJ must be an ideal of z, got N)Ú
isinstancer   rB   Ú
ValueErrorr   s   &&r   Ú_check_idealÚIdeal._check_idealm   s>   € ä˜!œU×#Ò# q§v¡v°·±Ô':ÝØ6:·i´iÂÐCóEð Eñ (;r   c                óV   € V P                  V P                  P                  V4      4      # )zô
Return True if ``elem`` is an element of this ideal.

Examples
========

>>> from sympy.abc import x
>>> from sympy import QQ
>>> QQ.old_poly_ring(x).ideal(x+1, x-1).contains(3)
True
>>> QQ.old_poly_ring(x).ideal(x**2, x**3).contains(x)
False
)r   rB   Úconvert)r
   Úelems   &&r   ÚcontainsÚIdeal.containss   s$   € ð ×"Ñ" 4§9¡9×#4Ñ#4°TÓ#:Ó;Ð;r   c                óÆ   a € \        V\        4      '       d   S P                  V4      # \        ;QJ d    V 3R lV 4       F  '       d   K   R# 	  R# ! V 3R lV 4       4      # )aS  
Returns True if ``other`` is is a subset of ``self``.

Here ``other`` may be an ideal.

Examples
========

>>> from sympy.abc import x
>>> from sympy import QQ
>>> I = QQ.old_poly_ring(x).ideal(x+1)
>>> I.subset([x**2 - 1, x**2 + 2*x + 1])
True
>>> I.subset([x**2 + 1, x + 1])
False
>>> I.subset(QQ.old_poly_ring(x).ideal(x**2 - 1))
True
c              3   óF   <"  € T F  pSP                  V4      x € K  	  R # 5ir@   )r   )Ú.0r   r
   s   & €r   Ú	<genexpr>ÚIdeal.subset.<locals>.<genexpr>˜   s   øé € Ð9±5¨a�4×&Ñ& q×)Ð)³5ùs   ƒ!FT)rF   r   r   Úall)r
   Úothers   f&r   ÚsubsetÚIdeal.subsetƒ   sL   ø€ ô& �eœU×#Ò#Ø×'Ñ'¨Ó.Ð.ß‹sÔ9±5Ó9�sŒsÐ9ŠsÐ9ˆsÔ9±5Ó9Ó9Ð9r   c                óJ   € V P                  V4       V P                  ! V3/ VB # )a&  
Compute the ideal quotient of ``self`` by ``J``.

That is, if ``self`` is the ideal `I`, compute the set
`I : J = \{x \in R | xJ \subset I \}`.

Examples
========

>>> from sympy.abc import x, y
>>> from sympy import QQ
>>> R = QQ.old_poly_ring(x, y)
>>> R.ideal(x*y).quotient(R.ideal(x))
<y>
)rH   r   ©r
   r   Úoptss   &&,r   ÚquotientÚIdeal.quotientš   s&   € ð  	×Ñ˜!ÔØ�~Š~˜aÑ( 4Ñ(Ð(r   c                óF   € V P                  V4       V P                  V4      # )zÆ
Compute the intersection of self with ideal J.

Examples
========

>>> from sympy.abc import x, y
>>> from sympy import QQ
>>> R = QQ.old_poly_ring(x, y)
>>> R.ideal(x).intersect(R.ideal(y))
<x*y>
)rH   r   r   s   &&r   Ú	intersectÚIdeal.intersect­   s!   € ð 	×Ñ˜!ÔØ�‰˜qÓ!Ð!r   c                ó   € \         h)z¯
Compute the ideal saturation of ``self`` by ``J``.

That is, if ``self`` is the ideal `I`, compute the set
`I : J^\infty = \{x \in R | xJ^n \subset I \text{ for some } n\}`.
r   r   s   &&r   ÚsaturateÚIdeal.saturate½   s
   € ô "Ð!r   c                óF   € V P                  V4       V P                  V4      # )a  
Compute the ideal generated by the union of ``self`` and ``J``.

Examples
========

>>> from sympy.abc import x
>>> from sympy import QQ
>>> QQ.old_poly_ring(x).ideal(x**2 - 1).union(QQ.old_poly_ring(x).ideal((x+1)**2)) == QQ.old_poly_ring(x).ideal(x+1)
True
)rH   Ú_unionr   s   &&r   ÚunionÚIdeal.unionÇ   s    € ð 	×Ñ˜!ÔØ�{‰{˜1‹~Ðr   c                óF   € V P                  V4       V P                  V4      # )a7  
Compute the ideal product of ``self`` and ``J``.

That is, compute the ideal generated by products `xy`, for `x` an element
of ``self`` and `y \in J`.

Examples
========

>>> from sympy.abc import x, y
>>> from sympy import QQ
>>> QQ.old_poly_ring(x, y).ideal(x).product(QQ.old_poly_ring(x, y).ideal(y))
<x*y>
)rH   Ú_productr   s   &&r   ÚproductÚIdeal.productÖ   s!   € ð 	×Ñ˜!ÔØ�}‰}˜QÓÐr   c                ó   € V# )zÂ
Reduce the element ``x`` of our ring modulo the ideal ``self``.

Here "reduce" has no specific meaning: it could return a unique normal
form, simplify the expression a bit, or just do nothing.
© r	   s   &&r   Úreduce_elementÚIdeal.reduce_elementè   s	   € ð ˆr   c                ó^  € \        V\        4      '       gw   V P                  P                  V 4      p\        WP                  4      '       d   V# \        WP                  P                  4      '       d	   V! V4      # VP                  V4      # V P                  V4       V P                  V4      # r@   )rF   r   rB   Úquotient_ringÚdtyperK   rH   re   )r
   ÚeÚRs   && r   Ú__add__ÚIdeal.__add__ñ   s}   € Ü˜!œU×#Ò#Ø—	‘	×'Ñ'¨Ó-ˆAÜ˜!ŸW™W×%Ò%Ø�Ü˜!ŸV™VŸ\™\×*Ò*Ù˜“t�Ø—9‘9˜Q“<ÐØ×Ñ˜!ÔØ�z‰z˜!‹}Ðr   c                óØ   € \        V\        4      '       g    V P                  P                  V4      pV P                  V4       V P                  V4      #   \         d
    \
        u # i ; ir@   )rF   r   rB   Úidealr   ÚNotImplementedrH   ri   ©r
   rr   s   &&r   Ú__mul__ÚIdeal.__mul__þ   s[   € Ü˜!œU×#Ò#ð&Ø—I‘I—O‘O AÓ&�ð 	×Ñ˜!ÔØ�|‰|˜A‹Ðøô "ô &Ü%Ò%ð&ús   ˜A ÁA)Á(A)c                ó8   € V P                   P                  ^4      # ©é   )rB   rw   r   s   &r   Ú_zeroth_powerÚIdeal._zeroth_power	  s   € Ø�y‰y�‰˜qÓ!Ð!r   c                ó   € V ^,          # r}   rl   r   s   &r   Ú_first_powerÚIdeal._first_power  s   € ð �a�xˆr   c                óŠ   € \        V\        4      '       d   VP                  V P                  8w  d   R # V P                  V4      # )F)rF   r   rB   r%   ry   s   &&r   Ú__eq__ÚIdeal.__eq__  s/   € Ü˜!œU×#Ò# q§v¡v°·±Ô':ÙØ�|‰|˜A‹Ðr   c                ó   € W8X  * # r@   rl   ry   s   &&r   Ú__ne__ÚIdeal.__ne__  s
   € ØŠÐr   rA   N)(Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r   r   r"   r%   r(   r+   r.   r1   r4   r7   r:   r=   rC   rH   rM   rV   r[   r^   ra   re   ri   rm   rt   Ú__radd__rz   Ú__rmul__r   r‚   r…   rˆ   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s»   ø‡ € ñ òD"ò"ò"ò"ò"ò"òCò"ò"ò"ò"ò"ò"ò"ò"òòEò<ò :ò.)ò&"ò "òò ò$ò	ð €Hòð €Hò"òò
÷
ð r   r   c                   ó|   a € ] tR tRt o RtR tR tR tR tR t	R t
]R	 4       tR
 tR tR tR tR tR tRtV tR# )ÚModuleImplementedIdeali  zc
Ideal implementation relying on the modules code.

Attributes:

- _module - the underlying module
c                ó<   € \         P                  W4       W n        R # r@   )r   rC   Ú_module)r
   rB   Úmodules   &&&r   rC   ÚModuleImplementedIdeal.__init__#  s   € Ü�‰�tÔ"ØŽr   c                ó:   € V P                   P                  V.4      # r@   )r˜   rM   r	   s   &&r   r   Ú%ModuleImplementedIdeal._contains_elem'  s   € Ø�|‰|×$Ñ$ a SÓ)Ð)r   c                ó„   € \        V\        4      '       g   \        hV P                  P	                  VP                  4      # r@   )rF   r–   r   r˜   Úis_submoduler   s   &&r   r   Ú&ModuleImplementedIdeal._contains_ideal*  s/   € Ü˜!Ô3×4Ò4Ü%Ð%Ø�|‰|×(Ñ(¨¯©Ó3Ð3r   c                ó¸   € \        V\        4      '       g   \        hV P                  V P                  V P
                  P                  VP
                  4      4      # r@   )rF   r–   r   Ú	__class__rB   r˜   r^   r   s   &&r   r   Ú!ModuleImplementedIdeal._intersect/  s>   € Ü˜!Ô3×4Ò4Ü%Ð%Ø�~‰~˜dŸi™i¨¯©×)?Ñ)?ÀÇ	Á	Ó)JÓKÐKr   c                óˆ   € \        V\        4      '       g   \        hV P                  P                  ! VP                  3/ VB # r@   )rF   r–   r   r˜   Úmodule_quotientrY   s   &&,r   r   Ú ModuleImplementedIdeal._quotient4  s4   € Ü˜!Ô3×4Ò4Ü%Ð%Ø�|‰|×+Ò+¨A¯I©IÑ>¸Ñ>Ð>r   c                ó¸   € \        V\        4      '       g   \        hV P                  V P                  V P
                  P                  VP
                  4      4      # r@   )rF   r–   r   r¡   rB   r˜   re   r   s   &&r   rd   ÚModuleImplementedIdeal._union9  s>   € Ü˜!Ô3×4Ò4Ü%Ð%Ø�~‰~˜dŸi™i¨¯©×);Ñ);¸A¿I¹IÓ)FÓGÐGr   c                ó<   € R V P                   P                   4       # )a  
Return generators for ``self``.

Examples
========

>>> from sympy import QQ
>>> from sympy.abc import x, y
>>> list(QQ.old_poly_ring(x, y).ideal(x, y, x**2 + y).gens)
[DMP_Python([[1], []], QQ), DMP_Python([[1, 0]], QQ), DMP_Python([[1], [], [1, 0]], QQ)]
c              3   ó2   "  € T F  q^ ,          x € K  	  R# 5i)é    Nrl   )rQ   r   s   & r   rR   Ú.ModuleImplementedIdeal.gens.<locals>.<genexpr>K  s   é € Ð0Ñ/˜�!—’Ó/ùs   ‚)r˜   Úgensr   s   &r   r¬   ÚModuleImplementedIdeal.gens>  s   € ñ 1˜dŸl™l×/Ò/Ó0Ð0r   c                ó6   € V P                   P                  4       # )zÕ
Return True if ``self`` is the zero ideal.

Examples
========

>>> from sympy.abc import x
>>> from sympy import QQ
>>> QQ.old_poly_ring(x).ideal(x).is_zero()
False
>>> QQ.old_poly_ring(x).ideal().is_zero()
True
)r˜   r"   r   s   &r   r"   ÚModuleImplementedIdeal.is_zeroM  s   € ð �|‰|×#Ñ#Ó%Ð%r   c                ó6   € V P                   P                  4       # )aL  
Return True if ``self`` is the whole ring, i.e. one generator is a unit.

Examples
========

>>> from sympy.abc import x
>>> from sympy import QQ, ilex
>>> QQ.old_poly_ring(x).ideal(x).is_whole_ring()
False
>>> QQ.old_poly_ring(x).ideal(3).is_whole_ring()
True
>>> QQ.old_poly_ring(x, order=ilex).ideal(2 + x).is_whole_ring()
True
)r˜   Úis_full_moduler   s   &r   r   Ú$ModuleImplementedIdeal.is_whole_ring]  s   € ð  �|‰|×*Ñ*Ó,Ð,r   c                óê   a€ ^ RI Ho V P                  P                   Uu. uF  w  qP                  P                  V4      NK!  	  ppRRP                  V3R lV 4       4      ,           R,           # u upi )rª   )ÚsstrÚ<Ú,c              3   ó4   <"  € T F  pS! V4      x € K  	  R # 5ir@   rl   )rQ   Úgr´   s   & €r   rR   Ú2ModuleImplementedIdeal.__repr__.<locals>.<genexpr>r  s   øé € Ð4©t¨!™d 1Ÿg˜g«tùs   ƒÚ>)Úsympy.printing.strr´   r˜   r¬   rB   Úto_sympyÚjoin)r
   r   r¬   r´   s   &  @r   Ú__repr__ÚModuleImplementedIdeal.__repr__o  sZ   ø€ Ý+Ø15·±×1BÒ1BÓCÑ1B©#¨1—	‘	×"Ñ" 1Ö%Ñ1BˆÐCØ�S—X‘XÔ4©tÓ4Ó4Õ4°sÕ:Ð:ùò Ds    %A0c                óH  € \        V\        4      '       g   \        hT P                  V P                  V P
                  P                  ! V P
                  P                   UUu. uF,  w  q!P
                  P                   F  w  q2V,          .NK  	  K.  	  upp!  4      # u uppi r@   )rF   r–   r   r¡   rB   r˜   Ú	submoduler¬   )r
   r   r   Úys   &&  r   rh   ÚModuleImplementedIdeal._productu  sx   € Ü˜!Ô3×4Ò4Ü%Ð%Ø�~‰~˜dŸi™i¨¯©×)?Ò)?Ø#Ÿ|™|×0Ò0ÔKÑ0™˜¿I¹I¿N¼N±S°a��s‹e¹N‰eÑ0ÒKñ*Mó Nð 	NùÛKs   Á"2Bc                ó:   € V P                   P                  V.4      # )a  
Express ``e`` in terms of the generators of ``self``.

Examples
========

>>> from sympy.abc import x
>>> from sympy import QQ
>>> I = QQ.old_poly_ring(x).ideal(x**2 + 1, x)
>>> I.in_terms_of_generators(1)  # doctest: +SKIP
[DMP_Python([1], QQ), DMP_Python([-1, 0], QQ)]
)r˜   Úin_terms_of_generatorsry   s   &&r   rÅ   Ú-ModuleImplementedIdeal.in_terms_of_generators{  s   € ð �|‰|×2Ñ2°A°3Ó7Ð7r   c                óL   € V P                   P                  ! V.3/ VB ^ ,          # )rª   )r˜   rm   )r
   r   Úoptionss   &&,r   rm   Ú%ModuleImplementedIdeal.reduce_elementŠ  s#   € Ø�|‰|×*Ò*¨A¨3Ñ:°'Ñ:¸1Õ=Ð=r   )r˜   N)rŠ   r‹   rŒ   r�   rŽ   rC   r   r   r   r   rd   Úpropertyr¬   r"   r   r¾   rh   rÅ   rm   r‘   r’   r“   s   @r   r–   r–     sb   ø‡ € ñòò*ò4ò
Lò
?ò
Hð
 ñ1ó ð1ò&ò -ò$;òNò8÷>ð >r   r–   N)rŽ   Úsympy.polys.polyerrorsr   Úsympy.polys.polyutilsr   r   r–   rl   r   r   Ú<module>rÍ      s,   ðÙ 3å 1Ý 2ôPÐô Pôfq>˜Uö q>r   