+
    /åûjE   ã                   ó�   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^RIHtHtHt ^RIHt R tRR
 ltR t]
RR l4       tR	# )z,Computing integral bases for number fields. )ÚPoly)ÚAlgebraicField)ÚZZ)ÚQQ)Úpublic)ÚModuleEndomorphismÚModuleHomomorphismÚ
PowerBasis)Ú extract_fundamental_discriminantc                ó²  € V P                   p\        WR7      pVP                  4       w  rEV^8X  g   Q h\        ^W!R7      pV F  w  rxWg,          pK  	  W6,          p	\        V\        R7      p
\        V	\        R7      pW«,          V ,
          V,          p\        WÁR7      pTpWi3 F  pVP	                  V4      pK  	  W>,          pVP                  4       pVV3# )zn
Apply the "Dedekind criterion" to test whether the order needs to be
enlarged relative to a given prime *p*.
©Úmodulus©Údomain)Úgenr   Úfactor_listr   ÚgcdÚdegree)ÚTÚpÚxÚT_barÚlcÚflÚg_barÚti_barÚ_Úh_barÚgÚhÚfÚf_barÚZ_barÚbÚU_barÚms   &&                ÚZC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\sympy\polys\numberfields\basis.pyÚ_apply_Dedekind_criterionr'      sÃ   € ð
 	
�‰€AÜ�Ô€EØ×ÑÓ �F€BØ�Œ7€Nˆ7Ü��AÔ!€EÛ‰	ˆØ�Šñ à�N€EÜˆUœ2Ô€AÜˆUœ2Ô€AØ	
����qÕ€AÜ�Ô€EØ€EØ‹^ˆØ—	‘	˜!“Šñ à�N€EØ�‰‹€AØ�!ˆ8€Oó    Nc                ó�   a€ V P                   pSf   VoSV8  d   SV,          oK  \        V V3R l4      pVP                  VR7      # )a¦  
Compute the nilradical mod *p* for a given order *H*, and prime *p*.

Explanation
===========

This is the ideal $I$ in $H/pH$ consisting of all elements some positive
power of which is zero in this quotient ring, i.e. is a multiple of *p*.

Parameters
==========

H : :py:class:`~.Submodule`
    The given order.
p : int
    The rational prime.
q : int, optional
    If known, the smallest power of *p* that is $>=$ the dimension of *H*.
    If not provided, we compute it here.

Returns
=======

:py:class:`~.Module` representing the nilradical mod *p* in *H*.

References
==========

.. [1] Cohen, H. *A Course in Computational Algebraic Number Theory*.
(See Lemma 6.1.6.)

c                 ó   <€ V S,          # ©N© )r   Úqs   &€r&   Ú<lambda>Ú"nilradical_mod_p.<locals>.<lambda>K   s	   ø€ ¨!¨Q®$r(   r   )Únr   Úkernel)ÚHr   r-   r0   Úphis   &&f  r&   Únilradical_mod_pr4   %   sF   ø€ ðB 	
�‰€AØ‚yØˆØ�!ŒeØ��FŠAÜ
˜Q¤Ó
/€CØ�:‰:˜aˆ:Ó Ð r(   c                óÎ  a
€ \        WVR7      pV P                  P                  V P                  VP                  ,          V P                  R7      pWAV ,          ,           pVP                  4       o
\        V S
V
3R l4      pVP                  VR7      pV P                  P                  V P                  VP                  ,          V P                  V,          R7      pW€,           p	W“3# )z<
Perform the second enlargement in the Round Two algorithm.
)r-   )Údenomc                 ó&   <€ SP                  V 4      # r+   )Úinner_endomorphism)r   ÚEs   &€r&   r.   Ú%_second_enlargement.<locals>.<lambda>W   s   ø€ ¨Q×-AÑ-AÀ!Ô-Dr(   r   )r4   ÚparentÚsubmodule_from_matrixÚmatrixr6   Úendomorphism_ringr   r1   )r2   r   r-   ÚIpÚBÚCr3   ÚgammaÚGÚH1r9   s   &&&       @r&   Ú_second_enlargementrE   O   s°   ø€ ô 
˜! !Ô	$€BØ	�‰×&Ñ& q§x¡x°"·)±)Õ';À1Ç7Á7Ð&ÓK€AØ	ˆa�C�€AØ	×ÑÓ€AÜ
˜Q Ô#DÓ
E€CØ�J‰J˜qˆJÓ!€EØ	�‰×&Ñ& q§x¡x°%·,±,Õ'>ÀaÇgÁgÐPQÅkÐ&ÓR€AØ	
�€BØˆ6€Mr(   c                ód  € Rp\        V \        4      '       d   Y P                  P                  4       rV P                  '       d.   V P
                  '       d   V P                  \        \        39  d   \        R4      hV P                  4       w  rV P                  4       pV P                  4       p\        P                  ! \        V4      4      p\        V4      w  r7\!        T;'       g    T 4      pVP#                  4       p	Rp
V'       d°   VP%                  4       w  r¼\'        W4      w  rÞV^ 8X  d   K0  VP)                  \+        V\        R7      4      pV	P-                  Wû,          V	,          VR7      p	WÎ8:  d   Kx  TpVV8  d   VV,          pK  \/        W›V4      w  pp
VV	8w  g   K¤  Tp	\/        W›V4      w  pp
K  V
e   \        V\0        4      '       d   W¡X&   T	pRVn        RVn        VVP6                  P9                  4       ^,          ,          VP:                  ^V,          ,          ,          pVV3# )aö
  
Zassenhaus's "Round 2" algorithm.

Explanation
===========

Carry out Zassenhaus's "Round 2" algorithm on an irreducible polynomial
*T* over :ref:`ZZ` or :ref:`QQ`. This computes an integral basis and the
discriminant for the field $K = \mathbb{Q}[x]/(T(x))$.

Alternatively, you may pass an :py:class:`~.AlgebraicField` instance, in
place of the polynomial *T*, in which case the algorithm is applied to the
minimal polynomial for the field's primitive element.

Ordinarily this function need not be called directly, as one can instead
access the :py:meth:`~.AlgebraicField.maximal_order`,
:py:meth:`~.AlgebraicField.integral_basis`, and
:py:meth:`~.AlgebraicField.discriminant` methods of an
:py:class:`~.AlgebraicField`.

Examples
========

Working through an AlgebraicField:

>>> from sympy import Poly, QQ
>>> from sympy.abc import x
>>> T = Poly(x ** 3 + x ** 2 - 2 * x + 8)
>>> K = QQ.alg_field_from_poly(T, "theta")
>>> print(K.maximal_order())
Submodule[[2, 0, 0], [0, 2, 0], [0, 1, 1]]/2
>>> print(K.discriminant())
-503
>>> print(K.integral_basis(fmt='sympy'))
[1, theta, theta/2 + theta**2/2]

Calling directly:

>>> from sympy import Poly
>>> from sympy.abc import x
>>> from sympy.polys.numberfields.basis import round_two
>>> T = Poly(x ** 3 + x ** 2 - 2 * x + 8)
>>> print(round_two(T))
(Submodule[[2, 0, 0], [0, 2, 0], [0, 1, 1]]/2, -503)

The nilradicals mod $p$ that are sometimes computed during the Round Two
algorithm may be useful in further calculations. Pass a dictionary under
`radicals` to receive these:

>>> T = Poly(x**3 + 3*x**2 + 5)
>>> rad = {}
>>> ZK, dK = round_two(T, radicals=rad)
>>> print(rad)
{3: Submodule[[-1, 1, 0], [-1, 0, 1]]}

Parameters
==========

T : :py:class:`~.Poly`, :py:class:`~.AlgebraicField`
    Either (1) the irreducible polynomial over :ref:`ZZ` or :ref:`QQ`
    defining the number field, or (2) an :py:class:`~.AlgebraicField`
    representing the number field itself.

radicals : dict, optional
    This is a way for any $p$-radicals (if computed) to be returned by
    reference. If desired, pass an empty dictionary. If the algorithm
    reaches the point where it computes the nilradical mod $p$ of the ring
    of integers $Z_K$, then an $\mathbb{F}_p$-basis for this ideal will be
    stored in this dictionary under the key ``p``. This can be useful for
    other algorithms, such as prime decomposition.

Returns
=======

Pair ``(ZK, dK)``, where:

    ``ZK`` is a :py:class:`~sympy.polys.numberfields.modules.Submodule`
    representing the maximal order.

    ``dK`` is the discriminant of the field $K = \mathbb{Q}[x]/(T(x))$.

See Also
========

.AlgebraicField.maximal_order
.AlgebraicField.integral_basis
.AlgebraicField.discriminant

References
==========

.. [1] Cohen, H. *A Course in Computational Algebraic Number Theory.*

NzDRound 2 requires an irreducible univariate polynomial over ZZ or QQ.r   )Úhnf_modulusT)Ú
isinstancer   ÚextÚminpoly_of_elementÚis_univariateÚis_irreducibler   r   r   Ú
ValueErrorÚ)make_monic_over_integers_by_scaling_rootsr   ÚdiscriminantÚ
from_sympyÚabsr
   r	   Úwhole_submoduleÚpopitemr'   Úelement_from_polyr   ÚaddrE   ÚdictÚ_starts_with_unityÚ_is_sq_maxrank_HNFr=   Údetr6   )r   ÚradicalsÚKr   r0   ÚDÚ	D_modulusÚFÚZthetar2   Únilradr   Úer$   r%   ÚUr-   rD   ÚZKÚdKs   &&                  r&   Ú	round_twore   ^   sÌ  € ð@ 	€AÜ�!”^×$Ò$Ø—%‘%×*Ñ*Ó,ˆ1Ø��ˆØ××ÐØ�8‰8œB¤˜8Ô#ÜÐ_Ó`Ð`Ø×6Ñ6Ó8�D€AØ	�‰‹
€AØ	�‰Ó€AÜ—’œc !›fÓ%€Iô ,¨AÓ.�D€AÜ˜Ÿ˜˜QÓ€FØ×ÑÓ €AØ€Fß
à�y‰y‹{‰ˆÜ,¨QÓ2‰ˆØ�Œ6Ùð ×$Ñ$¤T¨%¼Ô%;Ó<ˆð
 �E‰E�!•&˜1•*¨)ˆEÓ4ˆØŒ6Ùð ˆØ�!ŒeØ��FŠAÜ(¨¨qÓ1‰
ˆˆFØ�AŽgØˆAÜ,¨Q°1Ó5‰JˆB’ð Òœj¨´4×8Ò8Ø�‰Ø	
€Bà €BÔØ €BÔØ
ˆb�i‰i�m‰m‹o Õ"Õ
" r§x¡x°A¸µEÕ':Õ	:€BØˆrˆ6€Mr(   r+   )Ú__doc__Úsympy.polys.polytoolsr   Ú"sympy.polys.domains.algebraicfieldr   Úsympy.polys.domains.integerringr   Ú!sympy.polys.domains.rationalfieldr   Úsympy.utilities.decoratorr   Úmodulesr   r   r	   Ú	utilitiesr
   r'   r4   rE   re   r,   r(   r&   Ú<module>rn      sF   ðÙ 2å &Ý =Ý .Ý 0Ý ,ß GÑ GÝ 7òô2'!òTð óWó òWr(   