+
    ‹°³j†+  ã                   ól   € ^ RI Ht ^ RIHt ]P                  tR tRR ltR tRR ltRR lt	R	 t
R
 tR# )é    )ÚPermutation)Ú_distribute_gens_by_basec                ó„   € V  Uu0 uF  p\        V4      kK  	  upV Uu0 uF  p\        V4      kK  	  up8H  # u upi u upi )a'  
Compare two lists of permutations as sets.

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

This is used for testing purposes. Since the array form of a
permutation is currently a list, Permutation is not hashable
and cannot be put into a set.

Examples
========

>>> from sympy.combinatorics.permutations import Permutation
>>> from sympy.combinatorics.testutil import _cmp_perm_lists
>>> a = Permutation([0, 2, 3, 4, 1])
>>> b = Permutation([1, 2, 0, 4, 3])
>>> c = Permutation([3, 4, 0, 1, 2])
>>> ls1 = [a, b, c]
>>> ls2 = [b, c, a]
>>> _cmp_perm_lists(ls1, ls2)
True

)Útuple)ÚfirstÚsecondÚas   && Ú]/home/luca/screen-checking/.venv/lib/python3.14/site-packages/sympy/combinatorics/testutil.pyÚ_cmp_perm_listsr      s@   € ñ2 $Ó$™e˜ŒE�!ŽH™eÑ$Ù$Ó%™f˜ŒE�!ŽH™fÑ%ñ&ð &ùÒ$ùÚ%s   …8Ÿ=c                 ó^  a	a
€ ^ RI Hp  ^ RIHo	 \	        VR4      '       d¾   \        V P                  RR7      4      pVP                   Uu. uF  qUP                  NK  	  upo
V	V
3R lp. pV'       gA   V F8  pV! V4      '       g   K  VP                  \        P                  ! V4      4       K:  	  V# V F$  pV! V4      '       g   K  VP                  V4       K&  	  V# \	        VR4      '       d   \        W! V4      V4      # \	        VR4      '       d   \        W! V.4      V4      # R	# u upi )
r   ©ÚPermutationGroup)Ú_af_commutes_withÚ
generatorsT©Úafc                 ó~   <a € \         ;QJ d     VV 3R  lS 4       F  '       d   K   R# 	  R# ! VV 3R  lS 4       4      # )c              3   ó6   <"  € T F  pS! SV4      x € K  	  R # 5i©N© )Ú.0Úgenr   Úxs   & €€r
   Ú	<genexpr>Ú<_naive_list_centralizer.<locals>.<lambda>.<locals>.<genexpr>C   s   øé € Ð*UÑPTÈÑ+<¸QÀ×+DÐ+DÓPTùs   ƒFT)Úall)r   r   Úgenss   f€€r
   Ú<lambda>Ú)_naive_list_centralizer.<locals>.<lambda>C   s*   ù€ §s£sÕ*UÑPTÓ*U§s¤sÐ'U¢sÐ'U sÕ*UÑPTÓ*UÔ'Uó    ÚgetitemÚ
array_formN)Úsympy.combinatorics.perm_groupsr   Ú sympy.combinatorics.permutationsr   ÚhasattrÚlistÚgenerate_diminor   Ú_array_formÚappendr   Ú_af_newÚ_naive_list_centralizer)ÚselfÚotherr   r   Úelementsr   Úcommutes_with_gensÚcentralizer_listÚelementr   r   s   &&&      @@r
   r+   r+   $   s  ù€ Ý@ðõ2 CÜˆu�l×#Ò#Ü˜×,Ñ,°Ð,Ó5Ó6ˆØ',×'7Ò'7Ó8Ñ'7 !—”Ñ'7Ñ8ˆÝUÐØÐßÛ#�Ù% g×.Ô.Ø$×+Ñ+¬K×,?Ò,?ÀÓ,HÖIñ $ð  Ðó $�Ù% g×.Ô.Ø$×+Ñ+¨GÖ4ñ $ð  ÐÜ	�˜	×	"Ò	"Ü& tÐ-=¸eÓ-DÀbÓIÐIÜ	�˜×	%Ò	%Ü& tÐ-=¸u¸gÓ-FÈÓKÐKñ 
&ùò 9s   ÁD*c                ó&  € ^ RI Hp \        W4      pT p\        \	        V4      4       FN  pV! WF,          4      pVP                  4       VP                  4       8w  d    R# VP                  W,          4      pKP  	  VP                  4       ^8w  d   R# R# )aƒ  
Verify the correctness of a base and strong generating set.

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

This is a naive implementation using the definition of a base and a strong
generating set relative to it. There are other procedures for
verifying a base and strong generating set, but this one will
serve for more robust testing.

Examples
========

>>> from sympy.combinatorics.named_groups import AlternatingGroup
>>> from sympy.combinatorics.testutil import _verify_bsgs
>>> A = AlternatingGroup(4)
>>> A.schreier_sims()
>>> _verify_bsgs(A, A.base, A.strong_gens)
True

See Also
========

sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims

r   FT)r#   r   r   ÚrangeÚlenÚorderÚ
stabilizer)ÚgroupÚbaser   r   Ústrong_gens_distrÚcurrent_stabilizerÚiÚ	candidates   &&&     r
   Ú_verify_bsgsr=   T   s�   € õ8 AÜ0°Ó<ÐØÐÜ”3�t“9ÖˆÙ$Ð%6Õ%9Ó:ˆ	Ø×#Ñ#Ó%¨¯©Ó):Ô:ÚØ/×:Ñ:¸4½7ÓCÒñ	 ð
 ×ÑÓ! QÔ&ÙÙr    Nc                ó’   € Vf   V P                  V4      p\        VP                  RR7      4      p\        WRR7      p\	        W44      # )aß  
Verify the centralizer of a group/set/element inside another group.

This is used for testing ``.centralizer()`` from
``sympy.combinatorics.perm_groups``

Examples
========

>>> from sympy.combinatorics.named_groups import (SymmetricGroup,
... AlternatingGroup)
>>> from sympy.combinatorics.perm_groups import PermutationGroup
>>> from sympy.combinatorics.permutations import Permutation
>>> from sympy.combinatorics.testutil import _verify_centralizer
>>> S = SymmetricGroup(5)
>>> A = AlternatingGroup(5)
>>> centr = PermutationGroup([Permutation([0, 1, 2, 3, 4])])
>>> _verify_centralizer(S, A, centr)
True

See Also
========

_naive_list_centralizer,
sympy.combinatorics.perm_groups.PermutationGroup.centralizer,
_cmp_perm_lists

Tr   )Úcentralizerr&   r'   r+   r   )r7   ÚargÚcentrÚ
centr_listÚcentr_list_naives   &&&  r
   Ú_verify_centralizerrD   }   sI   € ð: ‚}Ø×!Ñ! #Ó&ˆÜ�e×+Ñ+¨tÐ+Ó4Ó5€JÜ.¨u¸dÔCÐÜ˜:Ó8Ð8r    c                 óŠ  a€ ^ RI Hp  Vf   V P                  V4      p\        4       p\	        VR4      '       d   VP
                  pM*\	        VR4      '       d   TpM\	        VR4      '       d   V.pV P                  4        F  oVP                  V3R lX 4       4       K   	  V! \        V4      4      pVP                  V4      # )r   r   r   Ú__getitem__r"   c              3   ó4   <"  € T F  qS,          x € K  	  R # 5ir   r   )r   r   Úels   & €r
   r   Ú)_verify_normal_closure.<locals>.<genexpr>Ä   s   øé € Ð9©j s Ÿ(š(«jùs   ƒ)
r#   r   Únormal_closureÚsetr%   r   r'   Úupdater&   Úis_subgroup)r7   r@   Úclosurer   Ú
conjugatesÚ
subgr_gensÚnaive_closurerH   s   &&&    @r
   Ú_verify_normal_closurerR   ¡   s¬   ø€ Ý@ðð. ‚Ø×&Ñ& sÓ+ˆÜ“€JÜˆs�L×!Ò!Ø—^‘^‰
Ü	��m×	$Ò	$Ø‰
Ü	��l×	#Ò	#Ø�Uˆ
Ø×#Ñ#Ö%ˆØ×ÑÔ9©jÓ9Ö9ñ &á$¤T¨*Ó%5Ó6€MØ×Ñ˜}Ó-Ð-r    c           	     óÞ  € ^ RI Hp ^ RIHpHp ^ RIHp . p\        \        V4      4       F*  p	W9,          w  r«rÍVP                  W«. .V,          V34       K,  	  V! V!  w  rïpV! WV^,
          4      p\        V\        4      '       d
   ^pV.pV.pM\        V4      p. p\        V4       F/  p	VP                  V! W,          W),          V^,
          4      4       K1  	  V! V4      pT! V Uu. uF  p\        V4      NK  	  up4      p\        VP                  RR7      4      pV P                   p \#        4       pVP                  RR7       F8  pV! V V4      pV F&  p\%        V! VV4      4      pVP'                  V4       K(  	  K:  	  \        V4      pVP)                  4        RV,          pV F*  pVRR VRR 8X  d   VR	,          VR	,          8w  d    ^ # TpK,  	  \        V^ ,          4      # u upi )
a  
Canonicalize tensor formed by tensors of the different types.

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

sym_i symmetry under exchange of two component tensors of type `i`
      None  no symmetry
      0     commuting
      1     anticommuting

Parameters
==========

g : Permutation representing the tensor.
dummies : List of dummy indices.
msym : Symmetry of the metric.
v : A list of (base_i, gens_i, n_i, sym_i) for tensors of type `i`.
    base_i, gens_i BSGS for tensors of this type
    n_i  number of tensors of type `i`

Returns
=======

Returns 0 if the tensor is zero, else returns the array form of
the permutation representing the canonical form of the tensor.

Examples
========

>>> from sympy.combinatorics.testutil import canonicalize_naive
>>> from sympy.combinatorics.tensor_can import get_symmetric_group_sgs
>>> from sympy.combinatorics import Permutation
>>> g = Permutation([1, 3, 2, 0, 4, 5])
>>> base2, gens2 = get_symmetric_group_sgs(2)
>>> canonicalize_naive(g, [2, 3], 0, (base2, gens2, 2, 0))
[0, 2, 1, 3, 4, 5]
r   )Úgens_productsÚ	dummy_sgs)Ú_af_rmulTr   N)r   éþÿÿÿéÿÿÿÿ)r#   r   Úsympy.combinatorics.tensor_canrT   rU   r$   rV   r3   r4   r)   Ú
isinstanceÚintÚextendr   r&   Úgenerater"   rK   r   ÚaddÚsort)ÚgÚdummiesÚsymÚvr   rT   rU   rV   Úv1r;   Úbase_iÚgens_iÚn_iÚsym_iÚsizeÚsbaseÚsgensÚdgensÚ	num_typesÚSr   ÚDÚdlistÚstÚsÚhÚdÚqr	   Úprevs   &&&*                          r
   Úcanonicalize_naiverw   É   s¿  € õN AßGÝ9Ø	€BÜ”3�q“6Ž]ˆØ%&¥TÑ"ˆ˜Ø
�	‰	�6 B 4¨¥8¨UÐ3Ö4ñ ñ '¨Ñ+Ñ€D�Ù�g D¨¥FÓ+€EÜ�#”s×ÒØˆ	Ø�)ˆØˆe‰ä˜“Hˆ	Ø€EÜ�9ÖˆØ�‰‘Y˜w�z¨3­6°4¸!µ8Ó<Ö=ñ á˜Ó€AÙ±%Ó8±%¨Qœ+ až.±%Ñ8Ó9€AÜ�—‘˜t�Ó$Ó%€EØ	�‰€AÜ	‹€BØ�Z‰Z˜4ˆZÖ ˆÙ�Q˜‹NˆÛˆAÜ‘h˜q !“nÓ%ˆAØ�F‰F�1ŽIó ñ !ô
 	ˆR‹€AØ‡F�F„HØ��9€DÛˆØˆSˆbˆ6�T˜#˜2�YÔØ��u˜˜R�Ô ÚØŠñ	 ô
 ��!•‹:Ðùò# 9s   Ã*G*c                ó˜  € ^ RI Hp ^ RIHpHp \        V P                  4       4      pVP                  R RR7       V Uu. uF  qU^ ,          NK  	  ppV! V4      p^ pV F  w  r‰V\        V	4      ,          pK  	  V U
u. uF  p
. NK  	  pp
^ p
V Fo  w  r‰V	 Fd  pWh,          Wl,          8  g   K  W¶V,          ,          P                  V
4       W¶V,          ,          P                  V
^,           4       V
^,          p
Kf  	  Kq  	  . pV F  pVP                  V4       K  	  \        V4      V8X  g   Q hW×V^,           .,          pV^,           p\        V4      \        \        V4      4      8X  g   Q h\        V4      p^ .\        V^ ,          4      ^,           ,          pV F!  p	V\        V	4      ;;,          ^,          uu&   K#  	  . p\        \        V4      4       F5  p
Wú,          pV'       g   K  V! V
4      w  ppVP                  VVV^ 34       K7  	  VP                  4        \        \        V4      4      pV! VV^ .VO5!  pV# u upi u up
i )a¯  
Return a certificate for the graph

Parameters
==========

gr : adjacency list

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

The graph is assumed to be unoriented and without
external lines.

Associate to each vertex of the graph a symmetric tensor with
number of indices equal to the degree of the vertex; indices
are contracted when they correspond to the same line of the graph.
The canonical form of the tensor gives a certificate for the graph.

This is not an efficient algorithm to get the certificate of a graph.

Examples
========

>>> from sympy.combinatorics.testutil import graph_certificate
>>> gr1 = {0:[1, 2, 3, 5], 1:[0, 2, 4], 2:[0, 1, 3, 4], 3:[0, 2, 4], 4:[1, 2, 3, 5], 5:[0, 4]}
>>> gr2 = {0:[1, 5], 1:[0, 2, 3, 4], 2:[1, 3, 5], 3:[1, 2, 4, 5], 4:[1, 3, 5], 5:[0, 2, 3, 4]}
>>> c1 = graph_certificate(gr1)
>>> c2 = graph_certificate(gr2)
>>> c1
[0, 2, 4, 6, 1, 8, 10, 12, 3, 14, 16, 18, 5, 9, 15, 7, 11, 17, 13, 19, 20, 21]
>>> c1 == c2
True
)Ú
_af_invert)Úget_symmetric_group_sgsÚcanonicalizec                 ó&   € \        V ^,          4      # )é   )r4   )r   s   &r
   r   Ú#graph_certificate.<locals>.<lambda>=  s   € œS  1¥œYr    T)ÚkeyÚreverse)r$   ry   rY   rz   r{   r&   Úitemsr_   r4   r)   r\   Úsortedr3   r   r€   )Úgrry   rz   r{   r�   r   ÚpvertÚnum_indicesrc   Úneighr;   ÚverticesÚv2r`   ri   ÚvlenÚnr8   r   ra   Úcans   &                    r
   Úgraph_certificaterŒ     s  € õF <ßTÜ�—‘“Ó€EØ	‡J�JÑ&°€JÔ5Ù Ó!™5�aˆq�TˆT™5€EÐ!Ù�uÓ€Eð €KÛ‰ˆØ”s˜5“zÕ!Šñ ñ "Ó"™E�q“™E€HÐ"Ø	€AÛ‰ˆÛˆBØ�x˜%�)Ö#Ø˜q�Õ"×)Ñ)¨!Ô,Ø˜r�Õ#×*Ñ*¨1¨Q­3Ô/Ø�Q•’ó	 ñ ð 	€AÛˆØ	�‰�Žñ äˆq‹6�[Ô Ð Ð Ø�{ Q•Ð	'Õ'€AØ˜�?€DÜ�!‹9œœU 4›[Ó)Ô)Ð)Ð)Ü�A‹€AØˆ3”�H˜Q•KÓ  Õ"Õ#€DÛˆØŒS�‹Z×˜AÕÕñ à
€AÜ”3�t“9ÖˆØ�Gˆß‰1Ù0°Ó3‰JˆD�$Ø�H‰H�d˜D ! QÐ'Ö(ñ	 ð
 ‡I�I„KÜ”5˜Ó%Ó&€GÙ
�q˜' 1Ð
) qÓ
)€CØ€JùòO "ùò #s   Á IÁ>I)Fr   )Úsympy.combinatoricsr   Úsympy.combinatorics.utilr   Úrmulr   r+   r=   rD   rR   rw   rŒ   r   r    r
   Ú<module>r�      sA   ðÝ +Ý =à×Ñ€ò&ô:-Lò`&ôR!9ôH%.òPKô\Nr    