§
    OŠtj¿P  ã                   óL  — d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZmZmZmZ ddlmZ ddlmZmZmZmZ ddl m!Z! ddl"m#Z#  G d„ de¦  «        Z$	 	 d d„Z%d„ Z&d!d„Z'd!d„Z(d!d„Z)d!d„Z*d!d„Z+d!d„Z,e#ddddœd„¦   «         Z-dS )"zà
Compute Galois groups of polynomials.

We use algorithms from [1], with some modifications to use lookup tables for
resolvents.

References
==========

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

é    )ÚdefaultdictN)ÚDummyÚsymbols)Ú	is_square©ÚZZ)Ú
dup_random)Údup_eval)Údup_discriminant)Údup_factor_listÚdup_irreducible_p)ÚGaloisGroupExceptionÚget_resolvent_by_lookupÚdefine_resolventsÚ	Resolvent)Úcoeff_search)ÚPolyÚpoly_from_exprÚPolificationFailedÚComputationFailed)Ú	dup_sqf_p)Úpublicc                   ó   — e Zd ZdS )ÚMaxTriesExceptionN)Ú__name__Ú
__module__Ú__qualname__© ó    úc/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/polys/numberfields/galoisgroups.pyr   r   #   s   € € € € € Ø€Cr   r   é
   é   Tc                 ó~  ‡— t          d¦  «        }|                      ¦   «         }|€t          ¦   «         }|                     | j        ¦  «         |ri Šd}d}ˆfd„}	t          |¦  «        D �]K}
|rŠ |	|¦  «        }t          |¦  «        }t          d„ |D ¦   «         ¦  «        }||z   |k    r0|dk    r|dz  }|dz
  }n|dz  } |	|¦  «        }t          |¦  «        }t          d¦  «        gd„ |D ¦   «         z   }nFt          |
d	z  dz   |¦  «        }t          j        d|dz
  ¦  «        }t          || |t          ¦  «        }t          || j        ¦  «        }t          |                      ||z
  ¦  «        |¦  «        }|j        |vr2t!          |j                             ¦   «         t          ¦  «        r||fc S �ŒMt$          ‚)
a  
    Given a univariate, monic, irreducible polynomial over the integers, find
    another such polynomial defining the same number field.

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

    See Alg 6.3.4 of [1].

    Parameters
    ==========

    T : Poly
        The given polynomial
    max_coeff : int
        When choosing a transformation as part of the process,
        keep the coeffs between plus and minus this.
    max_tries : int
        Consider at most this many transformations.
    history : set, None, optional (default=None)
        Pass a set of ``Poly.rep``'s in order to prevent any of these
        polynomials from being returned as the polynomial ``U`` i.e. the
        transformation of the given polynomial *T*. The given poly *T* will
        automatically be added to this set, before we try to find a new one.
    fixed_order : bool, default True
        If ``True``, work through candidate transformations A(x) in a fixed
        order, from small coeffs to large, resulting in deterministic behavior.
        If ``False``, the A(x) are chosen randomly, while still working our way
        up from small coefficients to larger ones.

    Returns
    =======

    Pair ``(A, U)``

        ``A`` and ``U`` are ``Poly``, ``A`` is the
        transformation, and ``U`` is the transformed polynomial that defines
        the same number field as *T*. The polynomial ``A`` maps the roots of
        *T* to the roots of ``U``.

    Raises
    ======

    MaxTriesException
        if could not find a polynomial before exceeding *max_tries*.

    ÚXNé   é   c                 óZ   •— ‰                      | t          | d¦  «        ¦  «        }|‰| <   |S )Né   )Úgetr   )ÚdegreeÚgenÚcoeff_generatorss     €r    Úget_coeff_generatorz9tschirnhausen_transformation.<locals>.get_coeff_generatorc   s2   ø€ Ø×"Ò" 6­<¸ÀÑ+BÔ+BÑCÔCˆØ#&Ð˜Ñ Øˆ
r   c              3   ó4   K  — | ]}t          |¦  «        V — Œd S )N)Úabs©Ú.0Úcs     r    ú	<genexpr>z/tschirnhausen_transformation.<locals>.<genexpr>x   s(   è è € Ð+Ð+˜q•C˜‘F”FÐ+Ð+Ð+Ð+Ð+Ð+r   r(   c                 ó,   — g | ]}t          |¦  «        ‘ŒS r   r   r0   s     r    ú
<listcomp>z0tschirnhausen_transformation.<locals>.<listcomp>�   s   € Ð1Ð1Ð1 Q�2˜a™5œ5Ð1Ð1Ð1r   é   )r   r*   ÚsetÚaddÚrepÚrangeÚnextÚmaxr   ÚminÚrandomÚrandintr	   r   r+   Ú	resultantr   Úto_listr   )ÚTÚ	max_coeffÚ	max_triesÚhistoryÚfixed_orderr$   ÚnÚdeg_coeff_sumÚcurrent_degreer-   Úir+   ÚcoeffsÚmÚaÚCÚdÚAÚUr,   s                      @r    Útschirnhausen_transformationrR   '   sñ  ø€ õb 	ˆc‰
Œ
€AØ	�Š‰
Œ
€AØ€Ý‘%”%ˆØ‡K‚K�”ÑÔÐàð ØÐØˆØˆðð ð ð ð õ
 �9ÑÔð &ñ &ˆð ð 	)ð &Ð% nÑ5Ô5ˆCÝ˜#‘Y”YˆFÝÐ+Ð+ FÐ+Ñ+Ô+Ñ+Ô+ˆAØ Ñ! MÒ1Ð1Ø! QÒ&Ð&Ø! QÑ&�MØ%2°QÑ%6�N�Nà" aÑ'�NØ)Ð)¨.Ñ9Ô9�Ý˜c™œ�Ý�A‘”�Ð1Ð1¨&Ð1Ñ1Ô1Ñ1ˆAˆAõ �A�q‘D˜1‘H˜iÑ(Ô(ˆAÝ”˜q ! a¡%Ñ(Ô(ˆAÝ˜1˜q˜b !¥RÑ(Ô(ˆAå��A”E‰NŒNˆÝ�—’˜Q ™UÑ#Ô# QÑ'Ô'ˆØŒ5˜ÐÐ¥I¨a¬e¯mªm©o¬o½rÑ$BÔ$BÐØ�a�4ˆKˆKˆKùÝ
Ðr   c                 óœ   — t          | t          ¦  «        r|                      ¦   «         nt          | t          ¦  «        }t          |¦  «        S )z?Convenience to check if a Poly or dup has square discriminant. )Ú
isinstancer   Údiscriminantr   r   r   )rB   rO   s     r    Úhas_square_discrV   ’   s<   € å& q­$Ñ/Ô/ÐLˆ�ŠÑÔÐÕ5EÀaÍÑ5LÔ5L€AÝ�Q‰<Œ<Ðr   Fc                 óP   — ddl m} t          | ¦  «        r	|j        dfn|j        dfS )z~
    Compute the Galois group of a polynomial of degree 3.

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

    Uses Prop 6.3.5 of [1].

    r   )ÚS3TransitiveSubgroupsTF)Úsympy.combinatorics.galoisrX   rV   ÚA3ÚS3)rB   rD   Ú	randomizerX   s       r    Ú_galois_group_degree_3r]   ˜   sE   € ð AÐ@Ð@Ð@Ð@Ð@Ý0?ÀÑ0BÔ0Bð 3Ð"Ô% tÐ,Ð,Ø'Ô*¨EÐ2ð4r   c           	      ó¢  ‡— ddl m} ddlm} t	          d¦  «        }|d         |d         z  |d         |d         z  z   } |d¦  «          |d¦  «        dd¦  «          |d¦  «        dd¦  «        g}t          |||¦  «        }|d         |d         dz  z  |d         |d         dz  z  z   |d         |d         dz  z  z   |d         |d         dz  z  z   }	 |d¦  «          |d¦  «        dd¦  «        g}
t          ¦   «         }t          |¦  «        D �]3}|dk    rt          | ||| ¬¦  «        \  }} | 	                    | d	¬
¦  «        \  }}}t          |t          ¦  «        sŒQt          | ¦  «        }|€|r	|j        d	fn|j        dfc S |r|j        d	fc S ||         Š|	                     t#          | ‰|¦  «        ¦  «        d	¬¦  «        }ˆfd„|
D ¦   «         }t          |||¦  «        }| 	                    | ¦  «        \  }}}t%          |t          ¦  «        }|dk    r�Œt'          |¦  «        r|j        dfc S |j        dfc S t,          ‚)zª
    Compute the Galois group of a polynomial of degree 4.

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

    Follows Alg 6.3.7 of [1], using a pure root approximation approach.

    r   ©ÚPermutation©ÚS4TransitiveSubgroupszX0 X1 X2 X3r&   r(   r%   ©rD   rE   rF   T)Úfind_integer_rootNF©Úsimultaneousc                 ó    •— g | ]
}‰|z  ‰z  ‘ŒS r   r   ©r1   ÚtauÚsigmas     €r    r5   z6_galois_group_degree_4_root_approx.<locals>.<listcomp>ï   ó!   ø€ Ð0Ð0Ð0 #ˆe�C‰i˜‰oÐ0Ð0Ð0r   )Ú sympy.combinatorics.permutationsr`   rY   rb   r   r   r7   r:   rR   Úeval_for_polyr   r   rV   ÚA4ÚS4ÚVÚsubsÚzipr   r   ÚC4ÚD4r   )rB   rD   r\   r`   rb   r$   ÚF1Ús1ÚR1ÚF2_preÚs2_prerE   rJ   Ú_ÚR_dupÚi0Úsq_discÚF2Ús2ÚR2rO   rj   s                        @r    Ú"_galois_group_degree_4_root_approxr�   §   sæ  ø€ ð =Ð<Ð<Ð<Ð<Ð<Ø@Ð@Ð@Ð@Ð@Ð@å�ÑÔ€Að
 
ˆ1Œˆa�Œd‰�Q�q”T˜!˜Aœ$‘YÑ	€Bàˆ�A‰ŒØˆˆ�A‰Œ�q˜!ÑÔØˆˆ�A‰Œ�q˜!ÑÔð
€Bõ
 
�2�q˜"Ñ	Ô	€Bð
 ˆqŒT�!�A”$˜‘'‰\˜A˜aœD  1¤ q¡™LÑ(¨1¨Q¬4°°!´°a±©<Ñ7¸!¸A¼$¸qÀ¼tÀQ¹w¹,ÑF€Fàˆ�A‰ŒØˆˆ�A‰Œ�q˜!ÑÔð€Fõ
 ‰eŒe€GÝ�9ÑÔð .5ñ .5ˆØˆqŠ5ˆ5å/°¸YØ8?Ø@I¸MðKñ Kô K‰DˆAˆqð ×'Ò'¨¸TÐ'ÑBÔB‰ˆˆq�"å˜¥Ñ#Ô#ð 	Øõ " !Ñ$Ô$ˆàˆ:ð 9@ð ;Ð*Ô-¨tÐ4Ð4Ø/Ô2°EÐ:ð<ð <ð <ð ð 	3à)Ô+¨TÐ2Ð2Ð2Ð2ð �2”ˆð �[Š[�˜Q   a¡¤Ñ)Ô)¸ˆ[Ñ=Ô=ˆØ0Ð0Ð0Ð0¨Ð0Ñ0Ô0ˆÝ�r˜1˜bÑ!Ô!ˆØ×&Ò& qÑ)Ô)‰ˆˆq�!Ý˜U¥BÑ'Ô'ˆà�Š6ˆ6ÙÝ�Q‰<Œ<ð 	5Ø)Ô,¨eÐ4Ð4Ð4Ð4à)Ô,¨eÐ4Ð4Ð4Ð4å
Ðr   c                 ó  — ddl m} t          ¦   «         }t          |¦  «        D ]@}t	          | d¦  «        }t          |t          ¦  «        r nt          | ||| ¬¦  «        \  }} ŒAt          ‚t          |t          ¦  «        }t          t          d„ |d         D ¦   «         g ¦  «        ¦  «        }	|	dgk    r!t          | ¦  «        r	|j        dfn|j        dfS |	g d	¢k    r	|j        dfS |	g d
¢k    r	|j        dfS |	ddgk    sJ ‚|j        dfS )z¢
    Compute the Galois group of a polynomial of degree 4.

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

    Based on Alg 6.3.6 of [1], but uses resolvent coeff lookup.

    r   ra   rc   c                 ó@   — g | ]\  }}t          |¦  «        d z
  g|z  ‘ŒS )r(   ©Úlen)r1   ÚrÚes      r    r5   z1_galois_group_degree_4_lookup.<locals>.<listcomp>  s:   € ð ð ð Ù!˜Q �ˆQ‰Œ�!‰ˆ�qÑðð ð r   r(   é   TF©r(   r(   é   )r&   r&   r&   r&   rŠ   )rY   rb   r7   r:   r   r   r   rR   r   r   ÚsortedÚsumrV   rn   ro   rs   rp   rt   )
rB   rD   r\   rb   rE   rJ   r{   rz   ÚflÚLs
             r    Ú_galois_group_degree_4_lookupr�   þ   so  € ð AÐ@Ð@Ð@Ð@Ð@å‰eŒe€GÝ�9ÑÔð  ð  ˆÝ'¨¨1Ñ-Ô-ˆÝ�U�BÑÔð 	ØˆEÝ+¨A¸Ø4;Ø<E¸ðGñ Gô G‰ˆˆ1ˆ1õ  Ðõ 
˜¥Ñ	#Ô	#€BÝ�sð ð Ø%'¨¤Uðñ ô à	ñô ñ 	ô 	€Að 	ˆQˆC‚x€xÝ4CÀAÑ4FÔ4Fð 3Ð&Ô)¨4Ð0Ð0Ø'Ô*¨EÐ2ð	4ð 	ˆIˆIˆI‚~€~Ø%Ô(¨%Ð0Ð0àˆIˆIˆI‚~€~Ø%Ô'¨Ð.Ð.à��A�Š;ˆ;ˆ;ˆ;Ø!Ô$ eÐ,Ð,r   c           	      ó,  ‡— ddl m} ddlm} t	          d¦  «        }t          ¦   «         }|d         \  }}}	 |j        |Ž }t          |||	¦  «        }
t          ¦   «         }d}t          |¦  «        D �]}|dk    rt          | ||| ¬¦  «        \  }} t          | d¦  «        }t          |t          ¦  «        sŒF|sGt          | ¦  «        }t          |t          ¦  «        r|r	|j        d	fn|j        dfc S |s|j        dfc S d	}|
                     | ¦  «        }|                     ¦   «         D ]\  }}t+          ||t          ¦  «        s nŒ|}|d         |d         d
z  z  |d         |d
         d
z  z  z   |d
         |d         d
z  z  z   |d         |d         d
z  z  z   |d         |d         d
z  z  z   } |d¦  «           |d¦  «        dd¦  «        d
d¦  «        g}|}|	|         Š|                     t/          | ‰|¦  «        ¦  «        d	¬¦  «        }ˆfd„|D ¦   «         }t          |||¦  «        }|                     | ¦  «        \  }}}t3          |t          ¦  «        }|dk    r�Œùt5          |¦  «        r|j        d	fc S |j        d	fc S t:          ‚)zÜ
    Compute the Galois group of a polynomial of degree 5.

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

    Based on Alg 6.3.9 of [1], but uses a hybrid approach, combining resolvent
    coeff lookup, with root approximation.

    r   ©ÚS5TransitiveSubgroupsr_   zX0,X1,X2,X3,X4)r6   r(   Frc   r(   Tr&   r%   rŠ   re   c                 ó    •— g | ]
}‰|z  ‰z  ‘ŒS r   r   rh   s     €r    r5   z1_galois_group_degree_5_hybrid.<locals>.<listcomp>k  rk   r   )rY   r’   rl   r`   r   r   Úas_exprr   r7   r:   rR   r   r   r   rV   r   ÚA5ÚS5ÚM20Ú round_roots_to_integers_for_polyÚitemsr
   rq   rr   rm   r   r   ÚC5ÚD5r   )rB   rD   r\   r’   r`   ÚX5ÚresÚF51rz   Ús51ÚR51rE   Úreached_second_stagerJ   ÚR51_dupr}   Úrounded_rootsÚpermutation_indexÚcandidate_rootr$   rx   ry   r|   r~   r   r€   r{   rO   rj   s                               @r    Ú_galois_group_degree_5_hybridr¦   )  sA  ø€ ð AÐ@Ð@Ð@Ð@Ð@Ø<Ð<Ð<Ð<Ð<Ð<å	Ð!Ñ	"Ô	"€BÝ
Ñ
Ô
€CØ�f”+�K€CˆˆCØ
ˆ#Œ+�rÐ
€CÝ
�C˜˜SÑ
!Ô
!€Cå‰eŒe€GØ ÐÝ�9ÑÔð 64ñ 64ˆØˆqŠ5ˆ5Ý/°¸YØ8?Ø@I¸MðKñ Kô K‰DˆAˆqõ *¨!¨QÑ/Ô/ˆÝ˜¥"Ñ%Ô%ð 	Øð
 $ð 	:Ý% aÑ(Ô(ˆGå  ­"Ñ-Ô-ð @Ø<Cð ?Ð.Ô1°4Ð8Ð8Ø3Ô6¸Ð>ð@ð @ð @ð ð :Ø-Ô1°5Ð9Ð9Ð9Ð9ð  $Ðð ×<Ò<¸QÑ?Ô?ˆð 2?×1DÒ1DÑ1FÔ1Fð 	ð 	Ñ-Ð˜~Ý˜G ^µRÑ8Ô8ð Ø�ðð ˆØ�1”�a˜”d˜A‘g‘  !¤ Q q¤T¨1¡W¡Ñ,¨q°¬t°A°a´D¸!±G©|Ñ;¸aÀ¼dÀ1ÀQÄ4ÈÁ7¹lÑJÈQÈqÌTÐRSÐTUÔRVÐXYÑRYÉ\ÑYˆàˆK˜‰NŒNØ ˆNˆKˆK˜‰NŒN˜1˜aÑ Ô   AÑ&Ô&ð
ˆð
 ˆØ�B”ˆØ�[Š[�˜Q   a¡¤Ñ)Ô)¸ˆ[Ñ=Ô=ˆØ0Ð0Ð0Ð0¨Ð0Ñ0Ô0ˆÝ�r˜1˜bÑ!Ô!ˆØ×&Ò& qÑ)Ô)‰ˆˆq�!Ý˜U¥BÑ'Ô'ˆà�Š6ˆ6ÙÝ�Q‰<Œ<ð 	4Ø)Ô,¨dÐ3Ð3Ð3Ð3à)Ô,¨dÐ3Ð3Ð3Ð3å
Ðr   c                 ó"  — ddl m} | }t          ¦   «         }t          |¦  «        D ]@}t	          | d¦  «        }t          |t          ¦  «        r nt          | ||| ¬¦  «        \  }} ŒAt          ‚t          | ¦  «        }	t          |t          ¦  «        r|	r	|j        dfn|j        dfS |	s	|j        dfS t          |t          j        |¦  «        ¬¦  «                             ¦   «         d         }
t#          |
¦  «        dk    r	|j        dfS |j        dfS )	zÖ
    Compute the Galois group of a polynomial of degree 5.

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

    Based on Alg 6.3.9 of [1], but uses resolvent coeff lookup, plus
    factorization over an algebraic extension.

    r   r‘   r(   rc   TF)Údomainr6   )rY   r’   r7   r:   r   r   r   rR   r   rV   r   r•   r–   r—   r   Úalg_field_from_polyÚfactor_listr…   rš   r›   )rB   rD   r\   r’   Ú_TrE   rJ   r{   rz   r}   r�   s              r    Ú(_galois_group_degree_5_lookup_ext_factorr¬   z  sK  € ð AÐ@Ð@Ð@Ð@Ð@à	
€Bå‰eŒe€GÝ�9ÑÔð  ð  ˆÝ'¨¨1Ñ-Ô-ˆÝ�U�BÑÔð 	ØˆEÝ+¨A¸Ø4;Ø<E¸ðGñ Gô G‰ˆˆ1ˆ1õ  Ðå˜aÑ Ô €Gå˜¥Ñ#Ô#ð 8Ø4;ð 7Ð&Ô)¨4Ð0Ð0Ø+Ô.°Ð6ð	8ð ð 2Ø%Ô)¨5Ð1Ð1õ
 
ˆb�Ô/°Ñ3Ô3Ð	4Ñ	4Ô	4×	@Ò	@Ñ	BÔ	BÀ1Ô	E€BÝ
ˆ2�w„w�!‚|€|Ø%Ô(¨$Ð/Ð/à%Ô(¨$Ð/Ð/r   c                 ó®  — ddl m} t          ¦   «         }t          |¦  «        D ]@}t	          | d¦  «        }t          |t          ¦  «        r nt          | ||| ¬¦  «        \  }} ŒAt          ‚t          |t          ¦  «        }t          t          ¦  «        }	|d         D ]0\  }
}|	t          |
¦  «        dz
                                |
¦  «         Œ1t          t          d„ |	                     ¦   «         D ¦   «         g ¦  «        ¦  «        }t#          | ¦  «        }|g d¢k    r/|	d         d         }t#          |¦  «        r	|j        dfn|j        dfS |ddgk    r=|	d         \  }}t#          |¦  «        pt#          |¦  «        }|r	|j        dfn|j        dfS |d	d
gk    r:|r	|j        dfS |	d
         d         }t#          |¦  «        r	|j        dfn|j        dfS |g d¢k    r|r	|j        dfn|j        dfS |ddgk    r|r	|j        dfn|j        dfS |g d¢k    r	|j        dfS |dgk    sJ ‚t          ¦   «         }t          |¦  «        D ]@}t	          | d	¦  «        }t          |t          ¦  «        r nt          | ||| ¬¦  «        \  }} ŒAt          ‚t#          | ¦  «        }t=          |t          ¦  «        r|r	|j        dfn|j         dfS |r	|j!        dfn|j"        dfS )z£
    Compute the Galois group of a polynomial of degree 6.

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

    Based on Alg 6.3.10 of [1], but uses resolvent coeff lookup.

    r   )ÚS6TransitiveSubgroupsr(   rc   c                 ó:   — g | ]\  }}|gt          |¦  «        z  ‘ŒS r   r„   )r1   rO   Úffs      r    r5   z1_galois_group_degree_6_lookup.<locals>.<listcomp>Ç  s5   € ð ð ð Ù˜!˜Rˆˆ�c�"‰gŒg‰ðð ð r   )r(   r&   r%   r%   Fr&   rŠ   Tr‰   r6   )r(   r(   r(   r%   rˆ   )#rY   r®   r7   r:   r   r   r   rR   r   r   r   Úlistr…   Úappendr‹   rŒ   r™   rV   ÚC6ÚD6ÚG18ÚG36mÚS4pÚA4xC2ÚS4xC2rn   ÚS4mÚPSL2F5ÚPGL2F5r[   r   ÚA6ÚS6ÚG36pÚG72)rB   rD   r\   r®   rE   rJ   r{   rz   r�   Úfactors_by_degr†   rŽ   ÚT_has_sq_discÚf1Úf2Ú
any_squares                   r    Ú_galois_group_degree_6_lookuprÆ   §  sÈ  € ð AÐ@Ð@Ð@Ð@Ð@õ ‰eŒe€GÝ�9ÑÔð  ð  ˆÝ'¨¨1Ñ-Ô-ˆÝ�U�BÑÔð 	ØˆEÝ+¨A¸Ø4;Ø<E¸ðGñ Gô G‰ˆˆ1ˆ1õ  Ðå	˜¥Ñ	#Ô	#€Bõ !¥Ñ&Ô&€NØ�1”ð -ð -‰ˆˆ1Ø•s˜1‘v”v ‘zÔ"×)Ò)¨!Ñ,Ô,Ð,Ð,å�sð ð Ø#1×#7Ò#7Ñ#9Ô#9ðñ ô à	ñô ñ 	ô 	€Aõ $ AÑ&Ô&€MàˆIˆIˆI‚~€~Ø˜AÔ˜qÔ!ˆÝ5DÀRÑ5HÔ5Hð 7Ð&Ô)¨5Ð1Ð1Ø+Ô.°Ð6ð	8ð 
ˆq�!ˆfŠˆØ Ô"‰ˆˆBÝ$ RÑ(Ô(Ð?­O¸BÑ,?Ô,?ˆ
Ø6@ð 9Ð&Ô*¨EÐ2Ð2Ø+Ô0°%Ð8ð	:ð 
ˆq�!ˆfŠˆØð 	?Ø)Ô-¨tÐ4Ð4à Ô" 1Ô%ˆBÝ<KÈBÑ<OÔ<Oð >Ð*Ô0°%Ð8Ð8Ø/Ô5°uÐ=ð?ð 
ˆiˆiˆiŠˆØ4Að 8Ð&Ô)¨4Ð0Ð0Ø+Ô/°Ð7ð	9ð 
ˆq�!ˆfŠˆØ8Eð ;Ð&Ô-¨tÐ4Ð4Ø+Ô2°EÐ:ð	<ð 
ˆlˆlˆlÒ	Ð	Ø%Ô(¨%Ð0Ð0à��Š8ˆ8ˆ8ˆ8õ ‰eŒe€GÝ�9ÑÔð  ð  ˆÝ'¨¨1Ñ-Ô-ˆÝ�U�BÑÔð 	ØˆEÝ+¨A¸Ø4;Ø<E¸ðGñ Gô G‰ˆˆ1ˆ1õ  Ðå# AÑ&Ô&€Må˜¥Ñ#Ô#ð 9Ø4Að 7Ð&Ô)¨4Ð0Ð0Ø+Ô.°Ð6ð	8ð 7Dð 8Ð&Ô+¨TÐ2Ð2Ø+Ô/°Ð7ð	9r   ©Úby_namerD   r\   c                ó²   — |pg }|pi }	 t          | g|¢R i |¤Ž\  }}n## t          $ r}t          dd|¦  «        ‚d}~ww xY w|                     |||¬¦  «        S )a˜  
    Compute the Galois group for polynomials *f* up to degree 6.

    Examples
    ========

    >>> from sympy import galois_group
    >>> from sympy.abc import x
    >>> f = x**4 + 1
    >>> G, alt = galois_group(f)
    >>> print(G)
    PermutationGroup([
    (0 1)(2 3),
    (0 2)(1 3)])

    The group is returned along with a boolean, indicating whether it is
    contained in the alternating group $A_n$, where $n$ is the degree of *T*.
    Along with other group properties, this can help determine which group it
    is:

    >>> alt
    True
    >>> G.order()
    4

    Alternatively, the group can be returned by name:

    >>> G_name, _ = galois_group(f, by_name=True)
    >>> print(G_name)
    S4TransitiveSubgroups.V

    The group itself can then be obtained by calling the name's
    ``get_perm_group()`` method:

    >>> G_name.get_perm_group()
    PermutationGroup([
    (0 1)(2 3),
    (0 2)(1 3)])

    Group names are values of the enum classes
    :py:class:`sympy.combinatorics.galois.S1TransitiveSubgroups`,
    :py:class:`sympy.combinatorics.galois.S2TransitiveSubgroups`,
    etc.

    Parameters
    ==========

    f : Expr
        Irreducible polynomial over :ref:`ZZ` or :ref:`QQ`, whose Galois group
        is to be determined.
    gens : optional list of symbols
        For converting *f* to Poly, and will be passed on to the
        :py:func:`~.poly_from_expr` function.
    by_name : bool, default False
        If ``True``, the Galois group will be returned by name.
        Otherwise it will be returned as a :py:class:`~.PermutationGroup`.
    max_tries : int, default 30
        Make at most this many attempts in those steps that involve
        generating Tschirnhausen transformations.
    randomize : bool, default False
        If ``True``, then use random coefficients when generating Tschirnhausen
        transformations. Otherwise try transformations in a fixed order. Both
        approaches start with small coefficients and degrees and work upward.
    args : optional
        For converting *f* to Poly, and will be passed on to the
        :py:func:`~.poly_from_expr` function.

    Returns
    =======

    Pair ``(G, alt)``
        The first element ``G`` indicates the Galois group. It is an instance
        of one of the :py:class:`sympy.combinatorics.galois.S1TransitiveSubgroups`
        :py:class:`sympy.combinatorics.galois.S2TransitiveSubgroups`, etc. enum
        classes if *by_name* was ``True``, and a :py:class:`~.PermutationGroup`
        if ``False``.

        The second element is a boolean, saying whether the group is contained
        in the alternating group $A_n$ ($n$ the degree of *T*).

    Raises
    ======

    ValueError
        if *f* is of an unsupported degree.

    MaxTriesException
        if could not complete before exceeding *max_tries* in those steps
        that involve generating Tschirnhausen transformations.

    See Also
    ========

    .Poly.galois_group

    Úgalois_groupr(   NrÇ   )r   r   r   rÊ   )	ÚfrÈ   rD   r\   ÚgensÚargsÚFÚoptÚexcs	            r    rÊ   rÊ     s”   € ðD ˆ:�2€DØˆ:�2€Dð8Ý Ð1 DÐ1Ð1Ð1¨DÐ1Ð1‰ˆˆ3ˆ3øÝð 8ð 8ð 8Ý °°3Ñ7Ô7Ð7øøøøð8øøøð �>Š> '°YØ$-ð ñ /ô /ð /s   Š ž
>¨9¹>)r!   r"   NT)r"   F).Ú__doc__Úcollectionsr   r>   Úsympy.core.symbolr   r   Úsympy.ntheory.primetestr   Úsympy.polys.domainsr   Úsympy.polys.densebasicr	   Úsympy.polys.densetoolsr
   Úsympy.polys.euclidtoolsr   Úsympy.polys.factortoolsr   r   Ú*sympy.polys.numberfields.galois_resolventsr   r   r   r   Ú"sympy.polys.numberfields.utilitiesr   Úsympy.polys.polytoolsr   r   r   r   Úsympy.polys.sqfreetoolsr   Úsympy.utilitiesr   r   rR   rV   r]   r�   r�   r¦   r¬   rÆ   rÊ   r   r   r    ú<module>rß      s•  ððð ð $Ð #Ð #Ð #Ð #Ð #Ø €€€à ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø -Ð -Ð -Ð -Ð -Ð -Ø "Ð "Ð "Ð "Ð "Ð "Ø -Ð -Ð -Ð -Ð -Ð -Ø +Ð +Ð +Ð +Ð +Ð +Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø FÐ FÐ FÐ FÐ FÐ FÐ FÐ Fðð ð ð ð ð ð ð ð ð ð ð ð <Ð ;Ð ;Ð ;Ð ;Ð ;ðJð Jð Jð Jð Jð Jð Jð Jð Jð Jð Jð Jà -Ð -Ð -Ð -Ð -Ð -Ø "Ð "Ð "Ð "Ð "Ð "ðð ð ð ð Ð,ñ ô ð ð IMØ-1ðhð hð hð hðVð ð ð4ð 4ð 4ð 4ðTð Tð Tð Tðn(-ð (-ð (-ð (-ðVNð Nð Nð Nðb*0ð *0ð *0ð *0ðZZ9ð Z9ð Z9ð Z9ðz Ø#(°BÀ%ð j/ð j/ð j/ð j/ñ „ðj/ð j/ð j/r   