def checkerA12inE8(l,basis,orderList):
    print("Checking if conjugate to any of the complete ones:")
    print(checker(l,basis,orderList))

    #These are two two cases where we do not know lambda5: cases 28 and 29
    l28=[(4,), (4,), (0,), (0,)]
    l29=[(5,), (5,)]
    L28=[]
    L28=L28+concat([(0,)],wedge2(l28))
    L28=L28+[(2,0)]
    
    L29=[]
    L29=L29+concat([(0,)],wedge2(l29))
    L29=L29+[(2,0)]

    basisTemp=[[(0)]]
    basisTemp.append(l)
    print("Conjugate to case 28?")
    print(classifyIncomplete(L28,basisTemp,orderList2))
    if len(classifyIncomplete(L28,basisTemp,orderList2))>1:
        print("YES")
    print("Conjugate to case 29?")
    print(classifyIncomplete(L29,basisTemp,orderList2))
    if len(classifyIncomplete(L29,basisTemp,orderList2))>1:
        print("YES")
def diagA1(L,index1,index2):
    n=len(L[0])
    sol=[]
    ind1=index1-1
    ind2=index2-1
    for i in range(0,len(L)):
        #print("i= "+str(i))
        x=tensor([(L[i][ind1],)],[(L[i][ind2],)])
        #print("this is x:")
        #print(x)
        temp2=[]
        for t in range(0,len(x)):
            temp2.append((x[t],))
        #for t in range(0,len(x)):
        #    x=[(x[0],)]
        #print("This is temp2:")
        #print(temp2)
        
        s=()
        for j in range(0,n):
            if j!=ind1 and j!=ind2:
                s=s+(L[i][j],)
        #print("this is s:")
        #print(s)
        temp=[]
        temp.append(s)
        a=concat(temp2,temp)
        #print(a)
        for t in range(0,len(a)):
            sol.append(a[t])
        #sol.append(a)
    return(sol)
#What is the spin here?
lambda1.append([(5,), (5,)])
lambda5.append(expand("[(8,)^2/(4,)^2/(0,)^4]"))


for i in range(1,len(lambda1)):
    lambda2.append(wedge2(lambda1[i]))
    #print(dimChecker(lambda2[i]))


orderList2=order(2)
L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(1,len(lambda1)):
    L[i]=[]
    L[i]=L[i]+concat([(0,)],lambda2[i])
    L[i]=L[i]+[(2,0)]
    L[i]=L[i]+concat([(1,)],lambda5[i])
    x=checker(L[i],basisA12,orderList2)
 #   print("///////////////////////////////")
 #   print(i)
 #   print(x)
    basisA12.append(L[i])
    basisA12Lambda1.append(lambda1[i])
    checker(L[i],basisA12,orderList2)
 #   if dimChecker(L[i])!=133:
 #       print("////////////////////////////////////")
 #       print(latex(lambda1[i]))
 #       print(dimChecker(L[i]))
 #       print(latex(L[i]))
#    else:
#        print("Match!")


#print(problems)


orderList5=order(5)
basisA15=[[0]]

for i in range(1,37):
    #print(latex(lambda1[i]))
    #print(latex(lambda2[i]))
    #print(latex(lambda5[i]))
    LE8[i]=[]
    LE8[i]=concat([(1,1)],lambda1[i])
    LE8[i]=LE8[i]+concat([(1,0)],lambda5[i])
    LE8[i]=LE8[i]+[(2,0,0,0,0),(0,2,0,0,0)]
    LE8[i]=LE8[i]+concat([(0,0)],lambda2[i])
    LE8[i]=LE8[i]+concat([(0,1)],lambda5[i])
    #print(latex(LE8[i]))
    if dimChecker(LE8[i])!=248:
        print("LE8 does not have dim 248 at i=")
        print(i)
##        print(latex(lambda1[i]))
##        print(latex(lambda2[i]))
##        print(latex(lambda5[i]))
    temp=checker(LE8[i],basisA15,orderList5)

    #if temp!=-1:
    #    print("problem two of the LE8 are equal")
lambda4.append(expand("[(8,)^2/(4,)^2/(0,)^4]"))

for i in range(1,len(lambda1)):
    lambda2.append(wedge2(lambda1[i]))
    #print(dimChecker(lambda2[i]))



orderList3=order(3)
basisA13=[[0]]
basisA13Lambda1=[[0]]

for i in range(1,38):
    print("case i")
    LE8[i]=[]
    LE8[i]=concat([(1,1)],lambda1[i])
    LE8[i]=LE8[i]+concat([(1,0)],lambda4[i])
    LE8[i]=LE8[i]+[(2,0,0),(0,2,0)]
    LE8[i]=LE8[i]+concat([(0,0)],lambda2[i])
    LE8[i]=LE8[i]+concat([(0,1)],lambda5[i])
    if dimChecker(LE8[i])!=248:
        print("LE8 does not have dim 248 at i=")
        print(i)
        
    temp=checker(LE8[i],basisA13,orderList3)
    print(temp)
    if temp==-1:
        print("New element, added to basis")
        basisA13.append(LE8[i])
        basisA13Lambda1.append(lambda1[i])
    else:
l1[13]=expand("[(1,1,0,0)/(0,0,1,1)/(0,0,0,1)^2]")
l5[13]=expand("[(1,0,1,0)^2/(1,0,0,2)/(1,0,0,0)/(0,1,1,1)/(0,1,0,1)^2]")
l5b[13]=expand("[(1,0,1,1)/(1,0,0,1)^2/(0,1,1,0)^2/(0,1,0,2)/(0,1,0,0)]")

l1[14]=expand("[(1,1,0,0)/(0,1,1,0)/(0,1,0,1)]")
l5[14]=expand("[(1,1,0,1)/(1,1,1,0)/(0,3,0,0)/(0,1,0,0)^2/(0,1,1,1)]")
l5b[14]=expand("[(1,2,0,0)/(1,0,0,0)/(1,0,1,1)/(0,2,0,1)/(0,0,0,1)/(0,2,1,0)/(0,0,1,0)]")

basis2=[[0]]
orderList6=order(6)

for i in range(1,15):
    l2[i]=wedge2(l1[i])

for i in range(1,15):
    temp=concat([(1,1)],l1[i])
    temp = temp+concat([(1,0)],l5[i])
    temp = temp+[(2,0,0,0,0,0),(0,2,0,0,0,0)]
    temp=temp+concat([(0,0)],l2[i])
    L[i] = temp+concat([(0,1)],l5[i])
    #print("i= "+str(i))
    #print(checker(L[i],basis2,orderList6))
    basis2.append(L[i])

#print("MOVING ON TO CASE b")

for i in range(1,15):
    temp=concat([(1,1)],l1[i])
    temp = temp+concat([(1,0)],l5b[i])
    temp = temp+[(2,0,0,0,0,0),(0,2,0,0,0,0)]
    temp=temp+concat([(0,0)],l2[i])