+
    ‹°³jœI  ã                   óž   € ^ RI t ^ RIHtHtHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt  ! R R	4      tRR
 ltR tR tR tRR ltR tR# )é    N)ÚFpGroupÚ
FpSubgroupÚsimplify_presentation)Ú	FreeGroup)ÚPermutationGroup)Úigcd)Útotient)ÚSc                   ó~   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V tR# )ÚGroupHomomorphismzÂ
A class representing group homomorphisms. Instantiate using `homomorphism()`.

References
==========

.. [1] Holt, D., Eick, B. and O'Brien, E. (2005). Handbook of computational group theory.

c                óT   € Wn         W n        W0n        R V n        R V n        R V n        R # ©N)ÚdomainÚcodomainÚimagesÚ	_inversesÚ_kernelÚ_image)Úselfr   r   r   s   &&&&Úb/home/luca/screen-checking/.venv/lib/python3.14/site-packages/sympy/combinatorics/homomorphisms.pyÚ__init__ÚGroupHomomorphism.__init__   s&   € ØŒØ ŒØŒØˆŒØˆŒØˆŽó    c                óÊ  € V P                  4       p/ p\        V P                  P                  4       4       F6  pV P                  V,          pWB9   d   K  VP                  '       d   K2  W2V&   K8  	  \        V P                  \        4      '       d   VP                  pMVP                  pV F´  pWb9   g   VP                  '       d   K  V P                  P                  p\        V P                  \        4      '       d   VP                  V,          RRR1,          pMTpV F7  p	W’9   d   WrV	,          ,          pK  WrV	R,          ,          R,          ,          pK9  	  WrV&   K¶  	  V# )zº
Return a dictionary with `{gen: inverse}` where `gen` is a rewriting
generator of `codomain` (e.g. strong generator for permutation groups)
and `inverse` is an element of its preimage

Néÿÿÿÿ)ÚimageÚlistr   ÚkeysÚis_identityÚ
isinstancer   r   Ústrong_gensÚ
generatorsr   ÚidentityÚ_strong_gens_slp)
r   r   ÚinversesÚkÚvÚgensÚgÚwÚpartsÚss
   &         r   Ú_invsÚGroupHomomorphism._invs   s  € ð —
‘
“ˆØˆÜ�d—k‘k×&Ñ&Ó(Ö)ˆAØ—‘˜A•ˆAØ–MØ—}—}’}Ø˜“ñ	 *ô
 �d—m‘mÔ%5×6Ò6Ø×$Ñ$‰Dà×#Ñ#ˆDÛˆAØŒ} §§ ÙØ—‘×$Ñ$ˆAÜ˜$Ÿ-™-Ô)9×:Ò:Ø×.Ñ.¨qÕ1±$°B°$Õ7‘à�Û�Ø”=Ø 1�+�’Aà 1 b¥5�/¨2Õ-Õ-’Añ	 ð
 �Q‹Kñ ð ˆr   c                óV  € ^ RI Hp ^ RIHp \	        WV34      '       EdN   \	        V P
                  \        4      '       d   V P
                  P                  V4      pV P                  f   V P                  4       V n        V P                  4       pV P                  P                  p\	        V P
                  \        4      '       d   VP                  V4      RRR1,          pMTp\        \!        V4      4       Fq  pWg,          pVP"                  '       d   K  W€P                  9   d   WPP                  V,          ,          pKJ  WPP                  VR,          ,          R,          ,          pKs  	  V# \	        V\$        4      '       d!   V U	u. uF  q�P'                  V	4      NK  	  up	# R# u up	i )a  
Return an element of the preimage of ``g`` or of each element
of ``g`` if ``g`` is a list.

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

If the codomain is an FpGroup, the inverse for equal
elements might not always be the same unless the FpGroup's
rewriting system is confluent. However, making a system
confluent can be time-consuming. If it's important, try
`self.codomain.make_confluent()` first.

©ÚPermutation)ÚFreeGroupElementNr   )Úsympy.combinatoricsr1   Úsympy.combinatorics.free_groupsr2   r    r   r   Úreducer   r-   r   r   r#   r   Úgenerator_productÚrangeÚlenr   r   Úinvert)
r   r)   r1   r2   r   r*   r(   Úir,   Úes
   &&        r   r9   ÚGroupHomomorphism.invert?   s5  € õ 	4ÝDÜ�aÐ'7Ð8×9Ó9Ü˜$Ÿ-™-¬×1Ò1Ø—M‘M×(Ñ(¨Ó+�Ø�~‰~Ò%Ø!%§¡£�”Ø—J‘J“LˆEØ—‘×$Ñ$ˆAÜ˜$Ÿ-™-Ô)9×:Ò:Ø×.Ñ.¨qÓ1±$°B°$Õ7‘à�ô œ3˜t›9Ö%�Ø•G�Ø—=—=�=ÙØŸ™Ô&ØŸ.™.¨Õ+Õ+’AàŸ.™.¨¨B­Õ/°Õ3Õ3’Añ &ð ˆHÜ˜œ4× Ò Ù,-Ó.©A q—K‘K –N©AÑ.Ð.ñ !ùÚ.s   ÆF&c                ó`   € V P                   f   V P                  4       V n         V P                   # )z 
Compute the kernel of `self`.

)r   Ú_compute_kernel©r   s   &r   ÚkernelÚGroupHomomorphism.kernelm   s(   € ð
 �<‰<ÒØ×/Ñ/Ó1ˆDŒLØ�|‰|Ðr   c                ód  € V P                   pVP                  4       pV\        P                  J d   \	        R 4      h. p\        V\        4      '       d   \        VP                  4      pM\        WRR7      pV P                  4       P                  4       pVP                  4       V,          V8w  d€   VP                  4       pW`P                  V ! V4      4      R,          ,          pWt9  g   KX  VP                  V4       \        V\        4      '       d   \        V4      pKŒ  \        WRR7      pK›  V# )z9Kernel computation is not implemented for infinite groupsT)Únormalr   )r   Úorderr
   ÚInfinityÚNotImplementedErrorr    r   r#   r   r   Úrandomr9   Úappend)r   ÚGÚG_orderr(   ÚKr:   Úrr&   s   &       r   r>   Ú!GroupHomomorphism._compute_kernelv   så   € Ø�K‰KˆØ—'‘'“)ˆØ”a—j‘jÓ Ü%ØKóMð MàˆÜ�aÔ)×*Ò*Ü  §¡Ó,‰Aä˜1¨4Ô0ˆAØ�J‰J‹L×ÑÓ ˆØ�g‰g‹i˜�k˜WÔ$Ø—‘“
ˆAØ—+‘+™d 1›gÓ&¨Õ*Õ*ˆAØŽzØ—‘˜A”Ü˜aÔ!1×2Ò2Ü(¨Ó.’Aä" 1°4Ô8’AØˆr   c                ó\  € V P                   f”   \        \        V P                  P	                  4       4      4      p\        V P                  \        4      '       d-   V P                  P                  V4      V n         V P                   # \        V P                  V4      V n         V P                   # )z
Compute the image of `self`.

)
r   r   Úsetr   Úvaluesr    r   r   Úsubgroupr   )r   rP   s   & r   r   ÚGroupHomomorphism.image�   s|   € ð
 �;‰;ÒÜœ#˜dŸk™k×0Ñ0Ó2Ó3Ó4ˆFÜ˜$Ÿ-™-Ô)9×:Ò:Ø"Ÿm™m×4Ñ4°VÓ<�”ð �{‰{Ðô )¨¯©¸Ó?�”Ø�{‰{Ðr   c                ó  € WP                   9  dH   \        V\        \        34      '       d!   V Uu. uF  q P	                  V4      NK  	  up# \        R4      hVP                  '       d   V P                  P                  # V P                  pV P                  P                  p\        V P                   \        4      '       dg   V P                   P                  VRR7      pV FA  pW`P                  9   d   W6,          V,          pK$  W6R,          ,          R,          V,          pKC  	  V# ^ pVP                   FL  w  r‰V	^ 8  d   W,          R,          pMW,          pWCV,          V	,          ,          pV\        V	4      ,          pKN  	  V# u upi )z
Apply `self` to `elem`.

z2The supplied element does not belong to the domainT)Úoriginalr   )r   r    r   ÚtupleÚ_applyÚ
ValueErrorr   r   r#   r   r   r6   Ú
array_formÚabs)
r   Úelemr;   r   Úvaluer(   r)   r:   Ú_Úps
   &&        r   rV   ÚGroupHomomorphism._applyš   s9  € ð
 —{‘{Ô"Ü˜$¤¤u ×.Ò.Ù04Ó5±¨1Ÿ™ Až±Ñ5Ð5ÜÐQÓRÐRØ××ÐØ—=‘=×)Ñ)Ð)à—[‘[ˆFØ—M‘M×*Ñ*ˆEÜ˜$Ÿ+™+Ô'7×8Ò8Ø—{‘{×4Ñ4°TÀDÐ4ÓI�Û�AØŸK™KÔ'Ø &¥	¨%¥šà &¨"¥u¥¨rÕ 1°%Õ 7šñ	 ð ˆð �Ø ŸOœO‘D�AØ˜1”uØ �G R�K™à �G˜Ø!¨¥)¨Q¥,Õ.�EØœ˜Q›•K’Añ ,ð ˆùò/ 6s   ±Fc                ó$   € V P                  V4      # r   )rV   )r   rZ   s   &&r   Ú__call__ÚGroupHomomorphism.__call__º   s   € Ø�{‰{˜4Ó Ð r   c                óD   € V P                  4       P                  4       ^8H  # )z)
Check if the homomorphism is injective

)r@   rD   r?   s   &r   Úis_injectiveÚGroupHomomorphism.is_injective½   s   € ð
 �{‰{‹}×"Ñ"Ó$¨Ñ)Ð)r   c                óÎ   € V P                  4       P                  4       pV P                  P                  4       pV\        P                  J d   V\        P                  J d   R# W8H  # )z*
Check if the homomorphism is surjective

N)r   rD   r   r
   rE   )r   ÚimÚoths   &  r   Úis_surjectiveÚGroupHomomorphism.is_surjectiveÄ   sL   € ð
 �Z‰Z‹\×ÑÓ!ˆØ�m‰m×!Ñ!Ó#ˆØ”—‘Ó ¤q§z¡zÓ 1Ùà‘9Ðr   c                óR   € V P                  4       ;'       d    V P                  4       # )z%
Check if `self` is an isomorphism.

)rc   rh   r?   s   &r   Úis_isomorphismÚ GroupHomomorphism.is_isomorphismÐ   s$   € ð
 × Ñ Ó"×;Ð; t×'9Ñ'9Ó';Ð;r   c                óD   € V P                  4       P                  4       ^8H  # )z[
Check is `self` is a trivial homomorphism, i.e. all elements
are mapped to the identity.

)r   rD   r?   s   &r   Ú
is_trivialÚGroupHomomorphism.is_trivial×   s   € ð �z‰z‹|×!Ñ!Ó# qÑ(Ð(r   c           	     ó  € VP                  4       P                  V P                  4      '       g   \        R4      hVP                   Uu/ uF  q"V ! V! V4      4      bK  	  pp\        VP                  V P                  V4      # u upi )z�
Return the composition of `self` and `other`, i.e.
the homomorphism phi such that for all g in the domain
of `other`, phi(g) = self(other(g))

z?The image of `other` must be a subgroup of the domain of `self`)r   Úis_subgroupr   rW   r   r   r   )r   Úotherr)   r   s   &&  r   ÚcomposeÚGroupHomomorphism.composeß   sp   € ð �{‰{‹}×(Ñ(¨¯©×5Ò5Üð +ó ,ð ,à-2¯\ª\Ó:©\¨‘T™% ›(“^Ò#©\ˆÐ:Ü  §¡¨t¯}©}¸fÓEÐEùò ;s   Á	Bc                ó  € \        V\        4      '       d"   VP                  V P                  4      '       g   \	        R4      hTpVP
                   Uu/ uF  q3V ! V4      bK  	  pp\        W P                  V4      # u upi )zP
Return the restriction of the homomorphism to the subgroup `H`
of the domain.

z'Given H is not a subgroup of the domain)r    r   rq   r   rW   r"   r   r   )r   ÚHr   r)   r   s   &&   r   Úrestrict_toÚGroupHomomorphism.restrict_toì   si   € ô ˜!Ô-×.Ò.°a·m±mÀDÇKÁK×6PÒ6PÜÐFÓGÐGØˆØ&'§l¢lÓ3¡l ‘T˜!“W’*¡lˆÐ3Ü  ¯©¸Ó?Ð?ùò 4s   ÁA<c                óà  € VP                  V P                  4       4      '       g   \        R4      h. p\        V P                  4       P                  4      pVP
                   Fˆ  pV P                  V4      pWS9  d   VP                  V4       \        V4      pV P                  4       P
                   F4  pWe,          V9  g   K  VP                  We,          4       \        V4      pK6  	  KŠ  	  V# )zn
Return the subgroup of the domain that is the inverse image
of the subgroup ``H`` of the homomorphism image

z&Given H is not a subgroup of the image)	rq   r   rW   r   r#   r"   r9   rH   r@   )r   rv   r(   ÚPÚhÚh_ir&   s   &&     r   Úinvert_subgroupÚ!GroupHomomorphism.invert_subgroupø   s´   € ð �}‰}˜TŸZ™Z›\×*Ò*ÜÐEÓFÐFØˆÜ˜TŸZ™Z›\×2Ñ2Ó3ˆØ—”ˆAØ—+‘+˜a“.ˆCØŒ|Ø—‘˜CÔ Ü$ TÓ*�Ø—[‘[“]×-Ô-�Ø•5 –>Ø—K‘K ¥Ô&Ü(¨Ó.’Aó .ñ ð ˆr   )r   r   r   r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r-   r9   r@   r>   r   rV   r`   rc   rh   rk   rn   rs   rw   r}   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   	   s_   ø‡ € ñòò!òF,/ò\òò.òò@!ò*ò
ò<ò)òFò
@÷ð r   r   c                óà  aa€ \        V \        \        \        34      '       g   \	        R4      h\        S\        \        \        34      '       g   \	        R4      hV P
                  o\        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      '       g   \        R4      h\        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      '       g   \        R4      hV'       d%   \        V4      \        V4      8w  d   \        R	4      h\        V4      p\        V4      pVP                  SP                  .\        S4      \        V4      ,
          ,          4       TP                  S Uu. uF  qUV9  g   K  VNK  	  up4       \        \        W#4      4      pV'       d   \        V SV4      '       g   \        R
4      h\        V SV4      # u upi )a^  
Create (if possible) a group homomorphism from the group ``domain``
to the group ``codomain`` defined by the images of the domain's
generators ``gens``. ``gens`` and ``images`` can be either lists or tuples
of equal sizes. If ``gens`` is a proper subset of the group's generators,
the unspecified generators will be mapped to the identity. If the
images are not specified, a trivial homomorphism will be created.

If the given images of the generators do not define a homomorphism,
an exception is raised.

If ``check`` is ``False``, do not check whether the given images actually
define a homomorphism.

zThe domain must be a groupzThe codomain must be a groupc              3   ó,   <"  € T F	  qS9   x € K  	  R # 5ir   © )Ú.0r)   r"   s   & €r   Ú	<genexpr>Úhomomorphism.<locals>.<genexpr>#  s   øé € Ð-© 1�JŽ«ùó   ƒFTzCThe supplied generators must be a subset of the domain's generatorsc              3   ó,   <"  € T F	  qS9   x € K  	  R # 5ir   r‰   )rŠ   r)   r   s   & €r   r‹   rŒ   %  s   øé € Ð-¡f �HŽ}£fùr�   z+The images must be elements of the codomainz>The number of images must be equal to the number of generatorsz-The given images do not define a homomorphism)r    r   r   r   Ú	TypeErrorr"   ÚallrW   r8   r   Úextendr#   ÚdictÚzipÚ_check_homomorphismr   )r   r   r(   r   Úcheckr)   r"   s   &f&&& @r   Úhomomorphismr–     se  ù€ ô  �fÔ/´¼)ÐD×EÒEÜÐ4Ó5Ð5Ü�hÔ!1´7¼IÐ F×GÒGÜÐ6Ó7Ð7à×"Ñ"€Jß‹3Ô-©Ó-�3�3Š3Ô-©Ó-×-Ò-ÜÐ^Ó_Ð_ß‹3Ô-¡fÓ-�3�3Š3Ô-¡fÓ-×-Ò-ÜÐFÓGÐGç”#�f“+¤ T£Ô*ÜÐYÓZÐZä�‹:€DÜ�&‹\€Fà
‡M�M�8×$Ñ$Ð%¤s¨:£´s¸6³{Õ'BÕCÔDØ‡K�K™JÓ8™J�q°4©-—�™JÑ8Ô9Ü”#�dÓ"Ó#€FçÔ(¨°¸6×BÒBÜÐHÓIÐIÜ˜V X¨vÓ6Ð6ùò 9s   Æ
G+ÆG+c                ód  aaa€ \        V R4      '       d   T MV P                  4       pVP                  pVP                  pV Uu. uF  qfP                  ^ ,          NK  	  pp\        \        WpP                  4      4      oVP                  oVVV3R lpV F’  p	\        V\        4      '       d]   VP                  V! V	4      S4      p
V
f@   VP                  4       pVP                  V! V	4      S4      p
V
f   V'       g   \        R4      hMV! V	4      P                  p
V
'       d   K‘   R# 	  R# u upi )a9  
Check that a given mapping of generators to images defines a homomorphism.

Parameters
==========
domain : PermutationGroup, FpGroup, FreeGroup
codomain : PermutationGroup, FpGroup, FreeGroup
images : dict
    The set of keys must be equal to domain.generators.
    The values must be elements of the codomain.

Úrelatorsc                 óv   <€ SpV P                    F%  w  r#SV,          pVSV,          V,          ,          pK'  	  V# r   )rX   )rL   r*   ÚsymbolÚpowerr)   r#   r   Úsymbols_to_domain_generatorss   &    €€€r   r   Ú#_check_homomorphism.<locals>._imageJ  s<   ø€ ØˆØŸ\œ\‰MˆFØ,¨VÕ4ˆAØ�˜•˜EÕ!Õ!ŠAñ *ð ˆr   zÖCan't determine if the images define a homomorphism. Try increasing the maximum number of rewriting rules (group._rewriting_system.set_max(new_value); the current value is stored in group._rewriting_system.maxeqns)FT)ÚhasattrÚpresentationr˜   r"   Úext_repr’   r“   r#   r    r   ÚequalsÚmake_confluentÚRuntimeErrorr   )r   r   r   ÚpresÚrelsr(   r)   Úsymbolsr   rL   r,   Úsuccessr#   rœ   s   &&f         @@r   r”   r”   6  s  ú€ ô ˜V Z×0Ò0‰6°f×6IÑ6IÓ6K€DØ�=‰=€DØ�?‰?€DÙ%)Ó*¡T �y‰y˜�|ˆ|¡T€GÐ*Ü#'¬¨G×5FÑ5FÓ(GÓ#HÐ Ø× Ñ €H÷ó ˆÜ�h¤×(Ò(Ø—‘¡ q£	¨8Ó4ˆAØŠyð #×1Ñ1Ó3�Ø—O‘O¡F¨1£I¨xÓ8�Ø’9§WÜ&ð (+ó ,ð ,øñ �q“	×%Ñ%ˆAß‰qÚñ' ñ( ùò? +s   ÁD-c                ó  € ^ RI Hp ^ RIHp V! \	        V4      4      pVP
                  p\        V4      pV P                   UUu/ uF5  qfYR! V Uu. uF  qqP                  Wv,          4      NK  	  up4      ,          bK7  	  pppV P                  VR7       \        WV4      p	\	        V P                  4      \	        V4      8”  d$   V P                  \	        V4      ,          V	n        V	# \        V P
                  .4      V	n        V	# u upi u uppi )z‰
Return the homomorphism induced by the action of the permutation
group ``group`` on the set ``omega`` that is closed under the action.

r0   ©ÚSymmetricGroup)Úbase)r3   r1   Ú sympy.combinatorics.named_groupsrª   r8   r#   r   r"   ÚindexÚ_schreier_simsr   Úbasic_stabilizersr   r   )
ÚgroupÚomegar1   rª   r   r#   r)   Úor   rv   s
   &&        r   Úorbit_homomorphismr³   g  sá   € õ 0Ý?Ùœc %›jÓ)€HØ× Ñ €HÜ�‹K€EØRW×RbÒRbÔcÑRbÈQ�˜+ÁÓ&GÁ¸A§{¡{°1µ3Ö'7ÁÑ&GÓHÕHÒHÑRb€FÑcØ	×Ñ˜eÐÔ$Ü˜%¨6Ó2€AÜ
ˆ5×"Ñ"Ó#¤c¨%£jÔ0Ø×+Ñ+¬C°«JÕ7ˆŒ	ð €Hô % e§n¡nÐ%5Ó6ˆŒ	Ø€Hùò 'HùÓcs   ÁDÁDÁ.DÄDc                óô  € ^ RI Hp ^ RIHp \	        V4      p^ p. pR.V,          p\        V4       F0  pW,          V8X  g   K  VP                  V4       WWV&   V^,          pK2  	  \        V4       F  pWqV,          ,          Wx&   K  	  V! V4      p	\        V4      p
V P                   UUu/ uF.  q»T! V
 Uu. uF  q‡Wh,          V,          ,          NK  	  up4      bK0  	  ppp\        W	V4      pV# u upi u uppi )aJ  
Return the homomorphism induced by the action of the permutation
group ``group`` on the block system ``blocks``. The latter should be
of the same form as returned by the ``minimal_block`` method for
permutation groups, namely a list of length ``group.degree`` where
the i-th entry is a representative of the block i belongs to.

r0   r©   N)	r3   r1   r¬   rª   r8   r7   rH   r"   r   )r°   Úblocksr1   rª   ÚnÚmr]   Úbr:   r   r#   r)   r   rv   s   &&            r   Úblock_homomorphismr¹   {  sä   € õ 0Ý?äˆF‹€Að 	
€AØ
€AØ	ˆˆq�€AÜ�1ŽXˆØ�9˜Ž>Ø�H‰H�QŒKØˆa‰DØ��FŠAñ	 ô
 �1ŽXˆØ˜•�|ˆ‹ñ ñ ˜aÓ €Hä�Q‹x€HØEJ×EUÒEUÔVÑEUÀ‘±Ó:±¨A ¥ Q¥Ÿi˜i±Ñ:Ó;Ò;ÑEU€FÑVÜ˜%¨6Ó2€AØ€Hùò ;ùÓVs   Â*C4Â5C/ÃC4Ã/C4c           	     ó&  € \        V \        \        34      '       g   \        R4      h\        V\        \        34      '       g   \        R4      h\        V \        4      '       d¬   \        V\        4      '       d–   \	        V 4      p \	        V4      pV P
                  VP
                  8X  de   V P                  P                  4       VP                  P                  4       8X  d.   V'       g   R# R\        WV P
                  VP
                  4      3# TpV P                  4       pVP                  4       pV\        P                  J d   \        R4      h\        V\        4      '       d2   V\        P                  J d   \        R4      hVP                  4       w  r6WE8w  g   V P                  VP                  8w  d   V'       g   R# R# V'       g   Tp\        V\!        V4      4      ^8X  d   R# \#        V P
                  4      p\$        P&                  ! V\)        V4      4       Fã  p	\#        V	4      p
V
P+                  VP,                  .\)        V P
                  4      \)        V
4      ,
          ,          4       \/        \1        WŠ4      4      p\3        WV4      '       g   K|  \        V\        4      '       d   XP5                  V
4      p
\        WV P
                  V
RR7      pVP7                  4       '       g   KÔ  V'       g    R# RV3u # 	  V'       g   R# R# )a¡  
Compute an isomorphism between 2 given groups.

Parameters
==========

G : A finite ``FpGroup`` or a ``PermutationGroup``.
    First group.

H : A finite ``FpGroup`` or a ``PermutationGroup``
    Second group.

isomorphism : bool
    This is used to avoid the computation of homomorphism
    when the user only wants to check if there exists
    an isomorphism between the groups.

Returns
=======

If isomorphism = False -- Returns a boolean.
If isomorphism = True  -- Returns a boolean and an isomorphism between `G` and `H`.

Examples
========

>>> from sympy.combinatorics import free_group, Permutation
>>> from sympy.combinatorics.perm_groups import PermutationGroup
>>> from sympy.combinatorics.fp_groups import FpGroup
>>> from sympy.combinatorics.homomorphisms import group_isomorphism
>>> from sympy.combinatorics.named_groups import DihedralGroup, AlternatingGroup

>>> D = DihedralGroup(8)
>>> p = Permutation(0, 1, 2, 3, 4, 5, 6, 7)
>>> P = PermutationGroup(p)
>>> group_isomorphism(D, P)
(False, None)

>>> F, a, b = free_group("a, b")
>>> G = FpGroup(F, [a**3, b**3, (a*b)**2])
>>> H = AlternatingGroup(4)
>>> (check, T) = group_isomorphism(G, H)
>>> check
True
>>> T(b*a*b**-1*a**-1*b**-1)
(0 2 3)

Notes
=====

Uses the approach suggested by Robert Tarjan to compute the isomorphism between two groups.
First, the generators of ``G`` are mapped to the elements of ``H`` and
we check if the mapping induces an isomorphism.

z2The group must be a PermutationGroup or an FpGroupTz<Isomorphism methods are not implemented for infinite groups.F)r•   )FN)r    r   r   r�   r   r"   r˜   Úsortr–   rD   r
   rE   rF   Ú_to_perm_groupÚ
is_abelianr   r	   r   Ú	itertoolsÚpermutationsr8   r‘   r#   r’   r“   r”   r9   rk   )rI   rv   ÚisomorphismÚ_HÚg_orderÚh_orderÚh_isomorphismr¶   r(   Úsubsetr   Ú_imagesÚTs   &&&          r   Úgroup_isomorphismrÈ   Ÿ  sH  € ôp �aÔ*¬GÐ4×5Ò5ÜÐLÓMÐMÜ�aÔ*¬GÐ4×5Ò5ÜÐLÓMÐMä�!”W×Ò¤*¨Q´×"8Ò"8Ü! !Ó$ˆÜ! !Ó$ˆð �<‰<˜1Ÿ<™<Ô'¨Q¯Z©Z×,=Ñ,=Ó,?ÀAÇJÁJ×CTÑCTÓCVÔ,VßÙØœ, q¨Q¯\©\¸1¿<¹<ÓHÐIÐIð 
€BØ�g‰g‹i€GØ�g‰g‹i€Gà”!—*‘*ÓÜ!Ð"`ÓaÐaä�!”W×ÒØ”a—j‘jÓ Ü%Ð&dÓeÐeØ×,Ñ,Ó.ÑˆàÔ §¡°·±Ô <ßÙØÐçð ˆÜ�”G˜A“JÓ AÔ%Ùô �—‘Ó€DÜ×(Ò(¨¬S°«YÖ7ˆÜ�f“ˆØ�‰�r—{‘{�m¤S¨¯©Ó%6´s¸6³{Õ%BÕCÔDÜ”s˜4Ó'Ó(ˆÜ˜q g×.Ô.Ü˜!œW×%Ò%Ø&×-Ñ-¨fÓ5�Ü˜a A§L¡L°&ÀÔFˆAØ×Ñ×!Ô!ç"ÚØ˜a�yÒ ñ 8÷ ÙØÐr   c                ó   € \        WRR7      # )zî
Check if the groups are isomorphic to each other

Parameters
==========

G : A finite ``FpGroup`` or a ``PermutationGroup``
    First group.

H : A finite ``FpGroup`` or a ``PermutationGroup``
    Second group.

Returns
=======

boolean
F)rÀ   )rÈ   )rI   rv   s   &&r   Úis_isomorphicrÊ     s   € ô$ ˜Q¨uÔ5Ð5r   )r‰   T)T)r¾   Úsympy.combinatorics.fp_groupsr   r   r   r4   r   Úsympy.combinatorics.perm_groupsr   Úsympy.core.intfuncr   Ú%sympy.functions.combinatorial.numbersr	   Úsympy.core.singletonr
   r   r–   r”   r³   r¹   rÈ   rÊ   r‰   r   r   Ú<module>rÐ      sM   ðÛ ß TÑ TÝ 5Ý <Ý #Ý 9Ý "÷Bñ BôH'7òR/òbò("ôHrôh6r   