Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
1

Find the longest word in a symmetric group which satisfies a certain property.

asked 3 years ago

lijr07 gravatar image

updated 3 years ago

Let A,B be two list of equal length k, where A is weakly increasing. For example, A=[1,1,2,3,3,4], B=[12,9,10,15,15,14].

Define mA,B to be the multiset of pairs [Ai,Bi], ik, (this is a multi-set of pairs of integers, not a list of pairs, so the order of pairs in mA,B does not matter).

By a result in symmetric group, there is a unique element with maximal length (length of the reduced word) in the symmetric group Sk (k is the length of A) such that mA,w(sorted(B))=mA,B, where sorted(B) is to sorted B such that it is weakly increasing, and the action of w=si1sim on a list L is defined by: sj(L) means exchanging the jth and j+1th elements of L, and for w,wSk, ww(L)=w(w(L)).

There is a method to compute the longest word w by checking all elements in Sk. But it takes a long time when k is large. The following function works fine and returns correct result.

 def LongestPerm(A,Bsorted,B):
    k = len(A)
    S = set([(A[i],B[i]) for i in range(k)])
    W = WeylGroup('A'+str(k-1), prefix = 's')

    winner = W.one()
    for w in W:
        wstr = w.inverse().to_permutation_string()
        if set([(A[int(wstr[i])-1],Bsorted[i]) for i in range(k)]) == S:      
            if w.length()>winner.length():
                winner = w
    return winner

In the example that

A=[1, 1, 2, 3, 3, 4]
B=[12, 9, 10, 15, 15, 14]

we have

w=s4*s5*s4*s2*s1

Is there some method to compute w faster (without checking all elements of Sk)? Thank you very much.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 3 years ago

Max Alekseyev gravatar image

updated 3 years ago

You don't need to consider all permutations - it's enough to take one suitable permutation and multiply it by elements of the stabilizers of A and B from left and right, respectively.

Here is an example:

# returns list of cycles generating the stabilizer of L
def fixed_sets(L):
    D = dict()
    for p,l in enumerate(L):
        D.setdefault(l,[]).append(p+1)
    return [tuple(s) for s in D.values() if len(s)>1]

A=[1,1,2,3,3,4]
B=[12,9,10,15,15,14]

k = len(A)

S = SymmetricGroup(k)
SA = S.subgroup(fixed_sets(A))
SB = S.subgroup(fixed_sets(B))

perm = S( Word(B).standard_permutation() / Word(A).standard_permutation() )

# testing can be done like this:
#sortedB = sorted(B)
#assert set( zip(A,[sortedB[i-1] for i in perm.domain()]) ) == set( zip(A,B) )

W = WeylGroup('A'+str(k-1), prefix = 's')
winner = max( (W(a*perm*b) for a in SA for b in SB), key=lambda s: s.length() )

print( winner )
Preview: (hide)
link

Comments

@max, thank you very much!

lijr07 gravatar imagelijr07 ( 3 years ago )

@max, I checked some more examples and found that some of the results given by your codes do not agree with the function LongestPerm in the question. I slightly modified your codes and wrote it as an answer below. Thanks again!

lijr07 gravatar imagelijr07 ( 3 years ago )

I've corrected an error in my code.

Max Alekseyev gravatar imageMax Alekseyev ( 3 years ago )

@max, thank you very much!

lijr07 gravatar imagelijr07 ( 3 years ago )
2

answered 3 years ago

lijr07 gravatar image

updated 3 years ago

I modified Max Alekseyev's answer. The result of the following codes agree with the result of the function LongestPerm in the post.

def LongestPermWInSBWInverseSA(W,A,B): 
    t1=StablizerOfTuple(A)
    t2=StablizerOfTuple(sorted(B))
    s=W.simple_reflections()
    #print(t1,t2)
    t3=[]
    for i in t1:
        t3.append(s[i])
    t4=[]
    for i in t2:
        t4.append(s[i])
    t5=find_permutation2(B,sorted(B))
    w=W.one()
    for i in t5:
        w=w*s[i]
    #print(t4,w,t3)
    r2=LongestPermInDoubleCosetWeylGroup(W,t4,w,t3)
    r=r2

    return r

def find_permutation2(L1, L2):
    perm = Word(L1).standard_permutation() / Word(L2).standard_permutation()
    assert [L2[i-1] for i in perm] == L1
    r=perm.reduced_word()
    return r

def LongestPermInDoubleCosetWeylGroup(W,S1,w,S2): 
    g1=W.subgroup(S1)
    g2=W.subgroup(S2)
    winner = W.one()
    for u1 in g1:
        for u2 in g2:
            t1=u1*w*u2
            if t1.length()>winner.length():
                winner=t1
    r=winner

    return r

def SymmetricGroupActionOnListSi(i,L): #  w=s_i,  L=[a1,a2,...,an]
    r1=[]
    for j in L:
        r1.append(j)

    t1=r1[i-1]
    r1[i-1]=r1[i]
    r1[i]=t1 

    r=r1

    return r

def StablizerOfTuple(A): # A is a list, weakly increasing
    k = len(A)
    r=[]
    for i in [1..k-1]:
        t1=SymmetricGroupActionOnListSi(i,A)
        if t1==A:
            r.append(i)
    return r

A=[1,1,2,3,3,4,6]
B=[12,9,12,15,15,14,12]
k = len(A)
W = WeylGroup('A'+str(k-1), prefix = 's')
t1=LongestPermWInSBWInverseSA(W,A,B)
print(t1)
Preview: (hide)
link

Comments

You can save some lines by using max() function like in my answer.

Max Alekseyev gravatar imageMax Alekseyev ( 3 years ago )

@max, thank you very much for your nice answer!

lijr07 gravatar imagelijr07 ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 276 times

Last updated: Jan 25 '22