§
    OŠtj¦S  ã                   ón   — d dl mZ d dlmZ d dlmZ d dlmZ  G d„ de¦  «        Z G d„ de¦  «        Z	d	S )
é    ©Úisprime)ÚPermutationGroup)ÚDefaultPrinting)Ú
free_groupc                   ó*   — e Zd ZdZdZdd„Zd„ Zd„ ZdS )ÚPolycyclicGroupTNc                 ón   — || _         || _        || _        |st          | j         ||¦  «        n|| _        dS )a  

        Parameters
        ==========

        pc_sequence : list
            A sequence of elements whose classes generate the cyclic factor
            groups of pc_series.
        pc_series : list
            A subnormal sequence of subgroups where each factor group is cyclic.
        relative_order : list
            The orders of factor groups of pc_series.
        collector : Collector
            By default, it is None. Collector class provides the
            polycyclic presentation with various other functionalities.

        N)ÚpcgsÚ	pc_seriesÚrelative_orderÚ	CollectorÚ	collector)ÚselfÚpc_sequencer   r   r   s        ú[/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/combinatorics/pc_groups.pyÚ__init__zPolycyclicGroup.__init__   s>   € ð$  ˆŒ	Ø"ˆŒØ,ˆÔØPYÐh� 4¤9¨i¸ÑHÔHÐHÐ_hˆŒˆˆó    c                 ó>   — t          d„ | j        D ¦   «         ¦  «        S )Nc              3   ó4   K  — | ]}t          |¦  «        V — Œd S ©Nr   )Ú.0Úorders     r   ú	<genexpr>z1PolycyclicGroup.is_prime_order.<locals>.<genexpr>$   s(   è è € ÐCÐC e•7˜5‘>”>ÐCÐCÐCÐCÐCÐCr   )Úallr   ©r   s    r   Úis_prime_orderzPolycyclicGroup.is_prime_order#   s"   € ÝÐCÐC¨tÔ/BÐCÑCÔCÑCÔCÐCr   c                 ó*   — t          | j        ¦  «        S r   )Úlenr   r   s    r   ÚlengthzPolycyclicGroup.length&   s   € Ý�4”9‰~Œ~Ðr   r   )Ú__name__Ú
__module__Ú__qualname__Úis_groupÚis_solvabler   r   r    © r   r   r	   r	      sW   € € € € € à€HØ€Kðið ið ið ið.Dð Dð Dðð ð ð ð r   r	   c                   ób   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )r   zœ
    References
    ==========

    .. [1] Holt, D., Eick, B., O'Brien, E.
           "Handbook of Computational Group Theory"
           Section 8.1.3
    Nc                 ó.  — || _         || _        || _        |s5t          d                     t          |¦  «        ¦  «        ¦  «        d         n|| _        d„ t          | j        j        ¦  «        D ¦   «         | _        |  	                    ¦   «         | _
        dS )a  

        Most of the parameters for the Collector class are the same as for PolycyclicGroup.
        Others are described below.

        Parameters
        ==========

        free_group_ : tuple
            free_group_ provides the mapping of polycyclic generating
            sequence with the free group elements.
        pc_presentation : dict
            Provides the presentation of polycyclic groups with the
            help of power and conjugate relators.

        See Also
        ========

        PolycyclicGroup

        zx:{}r   c                 ó   — i | ]\  }}||“Œ	S r&   r&   )r   ÚiÚss      r   ú
<dictcomp>z&Collector.__init__.<locals>.<dictcomp>O   s   € ÐJÐJÐJ™t˜q !�a˜ÐJÐJÐJr   N)r   r   r   r   Úformatr   Ú	enumerateÚsymbolsÚindexÚpc_relatorsÚpc_presentation)r   r   r   r   Úfree_group_r2   s         r   r   zCollector.__init__5   s‡   € ð, ˆŒ	Ø"ˆŒØ,ˆÔØITÐe�* V§]¢]µ3°t±9´9Ñ%=Ô%=Ñ>Ô>¸qÔAÐAÐZeˆŒØJÐJ¥y°´Ô1HÑ'IÔ'IÐJÑJÔJˆŒ
Ø#×/Ò/Ñ1Ô1ˆÔÐÐr   c                 ó®  — |sdS |j         }| j        }| j        }t          t	          |¦  «        ¦  «        D ]=}||         \  }}|||                  r"|dk     s||||                  dz
  k    r||ffc S Œ>t          t	          |¦  «        dz
  ¦  «        D ]A}||         \  }}||dz            \  }}	||         ||         k    r|	dk    rdnd}
||f||
ffc S ŒBdS )a¹  
        Returns the minimal uncollected subwords.

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

        A word ``v`` defined on generators in ``X`` is a minimal
        uncollected subword of the word ``w`` if ``v`` is a subword
        of ``w`` and it has one of the following form

        * `v = {x_{i+1}}^{a_j}x_i`

        * `v = {x_{i+1}}^{a_j}{x_i}^{-1}`

        * `v = {x_i}^{a_j}`

        for `a_j` not in `\{1, \ldots, s-1\}`. Where, ``s`` is the power
        exponent of the corresponding generator.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> from sympy.combinatorics import free_group
        >>> G = SymmetricGroup(4)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> F, x1, x2 = free_group("x1, x2")
        >>> word = x2**2*x1**7
        >>> collector.minimal_uncollected_subword(word)
        ((x2, 2),)

        Nr   é   éÿÿÿÿ)Ú
array_formr   r0   Úranger   )r   ÚwordÚarrayÚrer0   r*   Ús1Úe1Ús2Úe2Úes              r   Úminimal_uncollected_subwordz%Collector.minimal_uncollected_subwordR   s  € ðF ð 	Ø�4à”ˆØÔ ˆØ”
ˆå•s˜5‘z”zÑ"Ô"ð 	$ð 	$ˆAØ˜1”X‰FˆB�à�%˜”)Œ}ð $ " q¢& &¨B°°E¸"´I´¸q±Ò,@Ð,@Ø˜R˜�|Ð#Ð#Ð#øå•s˜5‘z”z !‘|Ñ$Ô$ð 	+ð 	+ˆAØ˜1”X‰FˆB�Ø˜1˜Q™3”Z‰FˆB�à�RŒy˜5 œ9Ò$Ð$Ø˜aš˜�A�A R�Ø˜R˜ 2 q 'Ð*Ð*Ð*Ð*ð %ð ˆtr   c                 ó–   — i }i }| j                              ¦   «         D ](\  }}t          |j        ¦  «        dk    r|||<   Œ#|||<   Œ)||fS )a±  
        Separates the given relators of pc presentation in power and
        conjugate relations.

        Returns
        =======

        (power_rel, conj_rel)
            Separates pc presentation into power and conjugate relations.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> G = SymmetricGroup(3)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> power_rel, conj_rel = collector.relations()
        >>> power_rel
        {x0**2: (), x1**3: ()}
        >>> conj_rel
        {x0**-1*x1*x0: x1**2}

        See Also
        ========

        pc_relators

        r5   )r2   Úitemsr   r7   )r   Úpower_relatorsÚconjugate_relatorsÚkeyÚvalues        r   Ú	relationszCollector.relationsŒ   sm   € ð< ˆØÐØÔ.×4Ò4Ñ6Ô6ð 	0ð 	0‰JˆC�Ý�3”>Ñ"Ô" aÒ'Ð'Ø&+�˜sÑ#Ð#à*/Ð" 3Ñ'Ð'ØÐ1Ð1Ð1r   c                 óö   — d}d}t          t          |¦  «        t          |¦  «        z
  dz   ¦  «        D ]B}|                     ||t          |¦  «        z   ¦  «        |k    r|}|t          |¦  «        z   } nŒC||fS )aŒ  
        Returns the start and ending index of a given
        subword in a word.

        Parameters
        ==========

        word : FreeGroupElement
            word defined on free group elements for a
            polycyclic group.
        w : FreeGroupElement
            subword of a given word, whose starting and
            ending index to be computed.

        Returns
        =======

        (i, j)
            A tuple containing starting and ending index of ``w``
            in the given word. If not exists, (-1,-1) is returned.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> from sympy.combinatorics import free_group
        >>> G = SymmetricGroup(4)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> F, x1, x2 = free_group("x1, x2")
        >>> word = x2**2*x1**7
        >>> w = x2**2*x1
        >>> collector.subword_index(word, w)
        (0, 3)
        >>> w = x1**7
        >>> collector.subword_index(word, w)
        (2, 9)
        >>> w = x1**8
        >>> collector.subword_index(word, w)
        (-1, -1)

        r6   r5   )r8   r   Úsubword)r   r9   ÚwÚlowÚhighr*   s         r   Úsubword_indexzCollector.subword_index³   s‰   € ðV ˆØˆÝ•s˜4‘y”y¥ Q¡¤Ñ'¨Ñ)Ñ*Ô*ð 	ð 	ˆAØ�|Š|˜A˜q¥ Q¡¤™xÑ(Ô(¨AÒ-Ð-Ø�Ø�˜Q™œ‘x�Ø�ð .ð �DˆyÐr   c                 ó¬   — |j         }|d         d         }|d         d         }|df|df|dff}| j                             |¦  «        }| j        |         S )a  
        Return a conjugate relation.

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

        Given a word formed by two free group elements, the
        corresponding conjugate relation with those free
        group elements is formed and mapped with the collected
        word in the polycyclic presentation.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> from sympy.combinatorics import free_group
        >>> G = SymmetricGroup(3)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> F, x0, x1 = free_group("x0, x1")
        >>> w = x1*x0
        >>> collector.map_relation(w)
        x1**2

        See Also
        ========

        pc_presentation

        r   r5   r6   )r7   r   Údtyper2   )r   rK   r:   r<   r>   rF   s         r   Úmap_relationzCollector.map_relationç   s`   € ð> ”ˆØ�1ŒX�aŒ[ˆØ�1ŒX�aŒ[ˆØ�Bˆx˜"˜a˜ 2 q 'Ð*ˆØŒo×#Ò# CÑ(Ô(ˆØÔ# CÔ(Ð(r   c                 ó  — | j         }	 |                      |¦  «        }|s�nf|                      | |j        |¦  «        ¦  «        \  }}|dk    rŒH|d         \  }}t	          |¦  «        dk    ræ| j        | j        |                  }||z  }	||	|z  z
  }
|d         d         |ff} |j        |¦  «        }| j        |         rE| j        |         j        }|d         \  }}|d         d         |
f||	|z  ff} |j        |¦  «        }n*|
dk    r"|d         d         |
ff} |j        |¦  «        }nd}| 	                     |j        |¦  «        |¦  «        }t	          |¦  «        dk    r…|d         d         dk    rs|d         \  }}|dff} |j        |¦  «        }|  
                     |j        |¦  «        ¦  «        }|||z  z  } |j        |¦  «        }|                     |||¦  «        }nšt	          |¦  «        dk    r‡|d         d         dk     ru|d         \  }}|dff} |j        |¦  «        }|  
                     |j        |¦  «        ¦  «        }|dz  ||z  z  } |j        |¦  «        }|                     |||¦  «        }�Œ|S )a„  
        Return the collected form of a word.

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

        A word ``w`` is called collected, if `w = {x_{i_1}}^{a_1} * \ldots *
        {x_{i_r}}^{a_r}` with `i_1 < i_2< \ldots < i_r` and `a_j` is in
        `\{1, \ldots, {s_j}-1\}`.

        Otherwise w is uncollected.

        Parameters
        ==========

        word : FreeGroupElement
            An uncollected word.

        Returns
        =======

        word
            A collected word of form `w = {x_{i_1}}^{a_1}, \ldots,
            {x_{i_r}}^{a_r}` with `i_1, i_2, \ldots, i_r` and `a_j \in
            \{1, \ldots, {s_j}-1\}`.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> from sympy.combinatorics.perm_groups import PermutationGroup
        >>> from sympy.combinatorics import free_group
        >>> G = SymmetricGroup(4)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> F, x0, x1, x2, x3 = free_group("x0, x1, x2, x3")
        >>> word = x3*x2*x1*x0
        >>> collected_word = collector.collected_word(word)
        >>> free_to_perm = {}
        >>> free_group = collector.free_group
        >>> for sym, gen in zip(free_group.symbols, collector.pcgs):
        ...     free_to_perm[sym] = gen
        >>> G1 = PermutationGroup()
        >>> for w in word:
        ...     sym = w[0]
        ...     perm = free_to_perm[sym]
        ...     G1 = PermutationGroup([perm] + G1.generators)
        >>> G2 = PermutationGroup()
        >>> for w in collected_word:
        ...     sym = w[0]
        ...     perm = free_to_perm[sym]
        ...     G2 = PermutationGroup([perm] + G2.generators)

        The two are not identical, but they are equivalent:

        >>> G1.equals(G2), G1 == G2
        (True, False)

        See Also
        ========

        minimal_uncollected_subword

        Tr6   r   r5   Né   )r   rA   rN   rP   r   r   r0   r2   r7   Úeliminate_wordrQ   Úsubstituted_word)r   r9   r   rK   rL   rM   r<   r=   r;   ÚqÚrrF   ÚpresentationÚsymÚexpÚword_r>   r?   s                     r   Úcollected_wordzCollector.collected_word  sÚ  € ðB ”_ˆ
ð.	?Ø×0Ò0°Ñ6Ô6ˆAØð Ùà×*Ò*¨4Ð1A°Ô1AÀ!Ñ1DÔ1DÑEÔE‰IˆC�Ø�bŠyˆyØà�q”T‰FˆB�Ý�1‰vŒv˜Š{ˆ{ØÔ(¨¬°B¬Ô8�Ø˜"‘H�Ø�q˜‘t‘G�à˜!œ˜Qœ �}Ð'�Ø&�jÔ& sÑ+Ô+�ØÔ'¨Ô,ð 
%Ø#'Ô#7¸Ô#<Ô#G�LØ+¨Aœ‘H�C˜Ø œd 1œg q˜\¨C°°3±¨<Ð8�EØ,˜JÔ,¨UÑ3Ô3�E�Eà˜A’v�vØ"# A¤$ q¤'¨1 Ð 0˜Ø 0 
Ô 0°Ñ 7Ô 7˜˜à $˜Ø×*Ò*Ð+;¨:Ô+;¸AÑ+>Ô+>ÀÑFÔF�å�1‰vŒv˜Š{ˆ{˜q œt Aœw¨š{˜{Ø˜1œ‘��BØ˜1�g�[�Ø%�ZÔ% bÑ)Ô)�Ø×)Ò)Ð*:¨*Ô*:¸1Ñ*=Ô*=Ñ>Ô>�Ø˜5 "™9™�Ø(˜
Ô(¨Ñ/Ô/�Ø×,Ò,¨S°$¸Ñ>Ô>��å�Q‘”˜1’�  1¤ a¤¨1¢ Ø˜1œ‘��BØ˜1�g�[�Ø%�ZÔ% bÑ)Ô)�Ø×)Ò)Ð*:¨*Ô*:¸1Ñ*=Ô*=Ñ>Ô>�Ø˜B™˜u b™yÑ(�Ø(˜
Ô(¨Ñ/Ô/�Ø×,Ò,¨S°$¸Ñ>Ô>�ñ].	?ð` ˆr   c                 ó  — | j         }| j        }i }i }| j        }t          ||j        ¦  «        D ]\  }}|dz  ||dz  <   |||<   Œ|ddd…         }| j        ddd…         }|ddd…         }g }	t          |¦  «        D �]†\  }
}||
         }||         |z  }||
         }|                     ||z  d¬¦  «        }|                     ¦   «          |j	        }|D ]}|||         z  }Œ|  
                    |¦  «        }|r|nd||<   || _        |	                     |¦  «         t          |	¦  «        dk    rÓ|	t          |	¦  «        dz
           }||         }t          t          |	¦  «        dz
  ¦  «        D ]“}||	|                  }|dz  |z  |z  }|dz  |	|         z  |z  }|                     |d¬¦  «        }|                     ¦   «          |j	        }|D ]}|||         z  }Œ|  
                    |¦  «        }|r|nd||<   || _        Œ”�Œˆ|S )aM  
        Return the polycyclic presentation.

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

        There are two types of relations used in polycyclic
        presentation.

        * Power relations : Power relators are of the form `x_i^{re_i}`,
          where `i \in \{0, \ldots, \mathrm{len(pcgs)}\}`, ``x`` represents polycyclic
          generator and ``re`` is the corresponding relative order.

        * Conjugate relations : Conjugate relators are of the form `x_j^-1x_ix_j`,
          where `j < i \in \{0, \ldots, \mathrm{len(pcgs)}\}`.

        Returns
        =======

        A dictionary with power and conjugate relations as key and
        their collected form as corresponding values.

        Notes
        =====

        Identity Permutation is mapped with empty ``()``.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> from sympy.combinatorics.permutations import Permutation
        >>> S = SymmetricGroup(49).sylow_subgroup(7)
        >>> der = S.derived_series()
        >>> G = der[len(der)-2]
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> pcgs = PcGroup.pcgs
        >>> len(pcgs)
        6
        >>> free_group = collector.free_group
        >>> pc_resentation = collector.pc_presentation
        >>> free_to_perm = {}
        >>> for s, g in zip(free_group.symbols, pcgs):
        ...     free_to_perm[s] = g

        >>> for k, v in pc_resentation.items():
        ...     k_array = k.array_form
        ...     if v != ():
        ...        v_array = v.array_form
        ...     lhs = Permutation()
        ...     for gen in k_array:
        ...         s = gen[0]
        ...         e = gen[1]
        ...         lhs = lhs*free_to_perm[s]**e
        ...     if v == ():
        ...         assert lhs.is_identity
        ...         continue
        ...     rhs = Permutation()
        ...     for gen in v_array:
        ...         s = gen[0]
        ...         e = gen[1]
        ...         rhs = rhs*free_to_perm[s]**e
        ...     assert lhs == rhs

        r6   NT©Úoriginalr&   r5   )r   r   r   ÚzipÚ
generatorsr   r.   Úgenerator_productÚreverseÚidentityr\   r2   Úappendr   r8   )r   r   Ú	rel_orderr1   Úperm_to_freer   Úgenr+   ÚseriesÚcollected_gensr*   r;   ÚrelationÚGÚlr9   ÚgÚconjÚ
conjugatorÚjÚ
conjugatedÚgenss                         r   r1   zCollector.pc_relatorsƒ  s{  € ðF ”_ˆ
ØÔ'ˆ	ØˆØˆØŒyˆå˜$ 
Ô 5Ñ6Ô6ð 	"ð 	"‰FˆC�Ø$% r¡EˆL˜˜b™Ñ!Ø !ˆL˜ÑÐà�D�D�b�DŒzˆØ”   " Ô%ˆØ˜d˜d ˜d”Oˆ	Øˆå ‘o”oð #	7ñ #	7‰FˆAˆsØ˜1”ˆBØ# CÔ(¨"Ñ,ˆHØ�q”	ˆAà×#Ò# C¨¡G¸Ð#Ñ=Ô=ˆAØ�IŠI‰KŒKˆKàÔ&ˆDØð ,ð ,�Ø˜L¨œOÑ+��à×&Ò& tÑ,Ô,ˆDØ,0Ð$8 D D°bˆK˜Ñ!Ø#.ˆDÔ à×!Ò! #Ñ&Ô&Ð&Ý�>Ñ"Ô" QÒ&Ð&Ø%¥c¨.Ñ&9Ô&9¸!Ñ&;Ô<�Ø)¨$Ô/�
å�s >Ñ2Ô2°1Ñ4Ñ5Ô5ð 7ð 7�AØ!-¨n¸QÔ.?Ô!@�Jà)¨2™~¨jÑ8¸ÑC�HØ ™8 N°1Ô$5Ñ5°dÑ:�Dà×+Ò+¨D¸TÐ+ÑBÔB�AØ—I’I‘K”K�KØ%Ô.�DØð 4ð 4˜Ø# L°¤OÑ3˜˜à×.Ò.¨tÑ4Ô4�DØ48Ð,@¨D¨D¸b�K Ñ)Ø+6�DÔ(Ð(ùàÐr   c                 ó   — | j         }t          ¦   «         }| j        D ]}t          |g|j        z   ¦  «        }Œ|                     |d¬¦  «        }|                     ¦   «          i }t          |j        | j        ¦  «        D ]\  }}|dz  ||dz  <   |||<   Œ|j        }|D ]}|||         z  }Œ|                      |¦  «        }	| j	        }
dgt          |¦  «        z  }|	j        }	|	D ]}|d         ||
|d                  <   Œ|S )aJ  
        Return the exponent vector of length equal to the
        length of polycyclic generating sequence.

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

        For a given generator/element ``g`` of the polycyclic group,
        it can be represented as `g = {x_1}^{e_1}, \ldots, {x_n}^{e_n}`,
        where `x_i` represents polycyclic generators and ``n`` is
        the number of generators in the free_group equal to the length
        of pcgs.

        Parameters
        ==========

        element : Permutation
            Generator of a polycyclic group.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> from sympy.combinatorics.permutations import Permutation
        >>> G = SymmetricGroup(4)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> pcgs = PcGroup.pcgs
        >>> collector.exponent_vector(G[0])
        [1, 0, 0, 0]
        >>> exp = collector.exponent_vector(G[1])
        >>> g = Permutation()
        >>> for i in range(len(exp)):
        ...     g = g*pcgs[i]**exp[i] if exp[i] else g
        >>> assert g == G[1]

        References
        ==========

        .. [1] Holt, D., Eick, B., O'Brien, E.
               "Handbook of Computational Group Theory"
               Section 8.1.1, Definition 8.4

        Tr^   r6   r   r5   )r   r   r   ra   rb   rc   r`   rd   r\   r0   r   r7   )r   Úelementr   rl   rn   rs   rg   rY   rK   r9   r0   Ú
exp_vectorÚts                r   Úexponent_vectorzCollector.exponent_vectorü  s1  € ðZ ”_ˆ
ÝÑÔˆØ”ð 	5ð 	5ˆAÝ  !  q¤|Ñ!3Ñ4Ô4ˆAˆAØ×"Ò" 7°tÐ"Ñ<Ô<ˆØ�Š‰ŒˆàˆÝ˜*Ô/°´Ñ;Ô;ð 	"ð 	"‰FˆC�Ø"% r¡'ˆL˜˜B™ÑØ!ˆL˜‰OˆOØÔˆØð 	"ð 	"ˆAØ�,˜q”/Ñ!ˆAˆAà×"Ò" 1Ñ%Ô%ˆà”
ˆØ�S�˜Z™œÑ(ˆ
ØŒˆØð 	+ð 	+ˆAØ&'¨¤dˆJ�u˜Q˜qœT”{Ñ#Ð#ØÐr   c                 ó¤   — |                       |¦  «        }t          d„ t          |¦  «        D ¦   «         t          | j        ¦  «        dz   ¦  «        S )a  
        Return the depth of a given element.

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

        The depth of a given element ``g`` is defined by
        `\mathrm{dep}[g] = i` if `e_1 = e_2 = \ldots = e_{i-1} = 0`
        and `e_i != 0`, where ``e`` represents the exponent-vector.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> G = SymmetricGroup(3)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> collector.depth(G[0])
        2
        >>> collector.depth(G[1])
        1

        References
        ==========

        .. [1] Holt, D., Eick, B., O'Brien, E.
               "Handbook of Computational Group Theory"
               Section 8.1.1, Definition 8.5

        c              3   ó*   K  — | ]\  }}|¯|d z   V — ŒdS )r5   Nr&   )r   r*   Úxs      r   r   z"Collector.depth.<locals>.<genexpr>a  s/   è è € Ð@Ð@™T˜Q ¸aÐ@�Q�q‘SÐ@Ð@Ð@Ð@Ð@Ð@r   r5   )rx   Únextr.   r   r   )r   ru   rv   s      r   ÚdepthzCollector.depthA  sL   € ð> ×)Ò)¨'Ñ2Ô2ˆ
ÝÐ@Ð@¥Y¨zÑ%:Ô%:Ð@Ñ@Ô@Å#ÀdÄiÁ.Ä.ÐQRÑBRÑSÔSÐSr   c                 ó¦   — |                       |¦  «        }|                      |¦  «        }|t          | j        ¦  «        dz   k    r||dz
           S dS )a  
        Return the leading non-zero exponent.

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

        The leading exponent for a given element `g` is defined
        by `\mathrm{leading\_exponent}[g]` `= e_i`, if `\mathrm{depth}[g] = i`.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> G = SymmetricGroup(3)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> collector.leading_exponent(G[1])
        1

        r5   N)rx   r}   r   r   )r   ru   rv   r}   s       r   Úleading_exponentzCollector.leading_exponentc  sT   € ð* ×)Ò)¨'Ñ2Ô2ˆ
Ø—
’
˜7Ñ#Ô#ˆØ•C˜œ	‘N”N 1Ñ$Ò$Ð$Ø˜e A™gÔ&Ð&Øˆtr   c                 ó¤  — |}|                       |¦  «        }|t          | j        ¦  «        k     r ||dz
           dk    r‘||dz
           }|                      |¦  «        |                      |¦  «        dz  z  }|| j        |dz
           z  }|| z  |z  }|                       |¦  «        }|t          | j        ¦  «        k     r||dz
           dk    °‘|S )Nr5   r6   )r}   r   r   r   r   )r   Úzrn   ÚhÚdÚkr@   s          r   Ú_siftzCollector._sift~  sÑ   € ØˆØ�JŠJ�q‰MŒMˆØ•#�d”i‘.”.Ò Ð  Q q¨¡s¤V¨q¢[ [Ø�!�A‘#”ˆAØ×%Ò% aÑ(Ô(¨$×*?Ò*?ÀÑ*BÔ*BÀRÑ)GÑGˆAØ�DÔ'¨¨!©Ô,Ñ,ˆAØ�A�2‘�a‘ˆAØ—
’
˜1‘”ˆAð •#�d”i‘.”.Ò Ð  Q q¨¡s¤V¨q¢[ [ð ˆr   c                 óx  — dgt          | j        ¦  «        z  }|}|r‘|                     d¦  «        }|                      ||¦  «        }|                      |¦  «        }|t          | j        ¦  «        k     r7|D ],}|dk    r$|                     |dz  |dz  z  |z  |z  ¦  «         Œ-|||dz
  <   |°‘d„ |D ¦   «         }|S )a8  

        Parameters
        ==========

        gens : list
            A list of generators on which polycyclic subgroup
            is to be defined.

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import SymmetricGroup
        >>> S = SymmetricGroup(8)
        >>> G = S.sylow_subgroup(2)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> gens = [G[0], G[1]]
        >>> ipcgs = collector.induced_pcgs(gens)
        >>> [gen.order() for gen in ipcgs]
        [2, 2, 2]
        >>> G = S.sylow_subgroup(3)
        >>> PcGroup = G.polycyclic_group()
        >>> collector = PcGroup.collector
        >>> gens = [G[0], G[1]]
        >>> ipcgs = collector.induced_pcgs(gens)
        >>> [gen.order() for gen in ipcgs]
        [3]

        r5   r   r6   c                 ó   — g | ]
}|d k    ¯|‘ŒS )r5   r&   )r   rh   s     r   ú
<listcomp>z*Collector.induced_pcgs.<locals>.<listcomp>³  s   € Ð*Ð*Ð*�S ¨¢ ˆS   r   )r   r   Úpopr…   r}   re   )r   rs   r�   rl   rn   r‚   rƒ   rh   s           r   Úinduced_pcgszCollector.induced_pcgs‰  sÚ   € ð> ˆC•�D”I‘”ÑˆØˆØð 	Ø—’�a‘”ˆAØ—
’
˜1˜aÑ Ô ˆAØ—
’
˜1‘”ˆAØ•3�t”y‘>”>Ò!Ð!Øð 6ð 6�CØ˜a’x�xØŸš  B¡ s¨B¡w¡¨q¡°Ñ!4Ñ5Ô5Ð5øØ��!�A‘#‘ð ð 	ð +Ð*˜AÐ*Ñ*Ô*ˆØˆr   c                 óº  — dgt          |¦  «        z  }|}|                      |¦  «        }t          |¦  «        D ]˜\  }}|                      |¦  «        |k    rz|                      |¦  «        |                      |¦  «        z  }|| j        |dz
           z  }|| z  |z  }|||<   |                      |¦  «        }|                      |¦  «        |k    °zŒ™|dk    r|S dS )z>
        Return the exponent vector for induced pcgs.
        r   r5   F)r   r}   r.   r   r   )	r   Úipcgsrn   r@   r‚   rƒ   r*   rh   Úfs	            r   Úconstructive_membership_testz&Collector.constructive_membership_test¶  sé   € ð ˆC•�E‘
”
‰NˆØˆØ�JŠJ�q‰MŒMˆÝ Ñ&Ô&ð 	"ð 	"‰FˆAˆsØ—*’*˜S‘/”/ QÒ&Ð&Ø×)Ò)¨!Ñ,Ô,¨T×-BÒ-BÀ3Ñ-GÔ-GÑG�Ø˜Ô+¨A¨a©CÔ0Ñ0�Ø˜1˜"‘I˜a‘K�Ø��!‘Ø—J’J˜q‘M”M�ð —*’*˜S‘/”/ QÒ&Ð&øð �Š6ˆ6ØˆHØˆur   )NN)r!   r"   r#   Ú__doc__r   rA   rH   rN   rQ   r\   r1   rx   r}   r   r…   rŠ   rŽ   r&   r   r   r   r   *   sû   € € € € € ðð ð2ð 2ð 2ð 2ð:8ð 8ð 8ðt%2ð %2ð %2ðN2ð 2ð 2ðh$)ð $)ð $)ðNrð rð rðjwð wð wðrCð Cð CðJ Tð  Tð  TðDð ð ð6	ð 	ð 	ð+ð +ð +ðZð ð ð ð r   r   N)
Úsympy.ntheory.primetestr   Úsympy.combinatorics.perm_groupsr   Úsympy.printing.defaultsr   Úsympy.combinatorics.free_groupsr   r	   r   r&   r   r   ú<module>r”      s¶   ðØ +Ð +Ð +Ð +Ð +Ð +Ø <Ð <Ð <Ð <Ð <Ð <Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6ð ð  ð  ð  ð  �oñ  ô  ð  ðF\
ð \
ð \
ð \
ð \
�ñ \
ô \
ð \
ð \
ð \
r   