def diagram_poset(par): els = [] for i in range(len(par)): for j in range(par[i]): els += [(i,j)] return Poset([els, lambda x,y: x[0] <= y[0] and x[1] <= y[1]]) def shifted_diagram_poset(par): els = [] for i in range(len(par)): for j in range(par[i]): els += [(i,i+j)] return Poset([els, lambda x,y: x[0] <= y[0] and x[1] <= y[1]]) def rectangle_poset(a,b): return diagram_poset([a for i in range(b)]) def trapezoid_poset(a,b): return shifted_diagram_poset([a+b-1-2*i for i in range(a)]) def shifted_staircase(n): return shifted_diagram_poset([n-i for i in range(n)]) def i2_poset(n): x={i:[i+1] for i in range(n-2)} y={n-1:[1]} y.update(x) return Poset(y) def propeller_poset(n): x={i:[i+1] for i in range(1,n-1)} y={n-1:[n,n+1],n:[n+2]} z={i:[i+1] for i in range(n+1,2*n)} z.update(y) z.update(x) return Poset(z) def h3_poset(): return Poset({1:[4],2:[4,5],3:[5],4:[6,7],5:[7],6:[8,9],7:[9],8:[10],9:[10,11],10:[12],11:[12],12:[13],13:[14],14:[15]}) ###### def set_valued_rpp(P,m): L = list(P.linear_extensions()[0]) L.reverse() my_old_rpps = [{}] while L != []: x = L.pop() my_new_rpps = [] for R in my_old_rpps: my_max = 0 for y in P.principal_lower_set(x): if not y in L and not y==x: if not(R[y].is_empty()): if max(R[y]) > my_max: my_max = max(R[y]) for S in Set(range(my_max,m+1)).subsets(): if not(S.is_empty()): #this is needed for the minuscule doppelgangers! new_R = R.copy() new_R[x] = S my_new_rpps.append(new_R) my_old_rpps = my_new_rpps return my_old_rpps def sv_rpp_weak_counts(P,m): sv_rpp = set_valued_rpp(P,m) C = {} for R in sv_rpp: my_count = [] for p in P: my_count.append(R[p].cardinality()) my_count = sum(my_count) if my_count in C.keys(): C[my_count] = C[my_count] + 1 else: C[my_count] = 1 return C print print "minuscule doppelgangers set-valued p-partition test" print m_max = 3 print "5-shifted staircase and h3" P = shifted_staircase(5) Q = h3_poset() #P.show() #Q.show() for m in range(1,m_max+1): print "m= " + str(m) print "...works?: " + str(sv_rpp_weak_counts(P,m) == sv_rpp_weak_counts(Q,m)) print print "propeller and I2" for n in range(2,5): P = propeller_poset(n) Q = i2_poset(2*n) #P.show() #Q.show() print "n= " + str(n) for m in range(1,m_max+1): print "m= " + str(m) print "works?... " + str(bool(sv_rpp_weak_counts(P,m) == sv_rpp_weak_counts(Q,m))) print print "rectangle and trapezoid" for b in range(1,5): for a in range(1,b+1): P = rectangle_poset(a,b) Q = trapezoid_poset(a,b) #P.show() #Q.show() print "a= " + str(a) + " b= " + str(b) for m in range(1,m_max+1): print "m= " + str(m) print "works?... " + str(bool(sv_rpp_weak_counts(P,m) == sv_rpp_weak_counts(Q,m))) print ###### def p_partitions(P,m): L = list(P.linear_extensions()[0]) L.reverse() my_old_rpps = [{}] while L != []: x = L.pop() my_new_rpps = [] for R in my_old_rpps: my_max = 0 for y in P.lower_covers(x): if R[y] > my_max: my_max = R[y] for i in range(my_max,m+1): new_R = R.copy() new_R[x] = i my_new_rpps.append(new_R) my_old_rpps = my_new_rpps return my_old_rpps def p_partition_ddeg(P,R): my_ddeg = 0 for x in P: my_max = 0 for y in P.lower_covers(x): if R[y] > my_max: my_max = R[y] my_ddeg += R[x] - my_max return my_ddeg def p_partitions_ddeg_info(P,m): q = var('q') return sum([q^p_partition_ddeg(P,R) for R in p_partitions(P,m)]) print print "minuscule down-degree gf test" print m_max = 4 print "5-shifted staircase and h3" P = shifted_staircase(5) Q = h3_poset() #P.show() #Q.show() for m in range(1,m_max+1): print "m= " + str(m) print "works?... " + str(bool(p_partitions_ddeg_info(P,m) == p_partitions_ddeg_info(Q,m))) print print "propeller and I2" for n in range(2,5): P = propeller_poset(n) Q = i2_poset(2*n) #P.show() #Q.show() print "n= " + str(n) for m in range(1,m_max+1): print "m= " + str(m) print "works?... " + str(bool(p_partitions_ddeg_info(P,m) == p_partitions_ddeg_info(Q,m))) print print "rectangle and trapezoid" for b in range(1,5): for a in range(1,b+1): P = rectangle_poset(a,b) Q = trapezoid_poset(a,b) #P.show() #Q.show() print "a= " + str(a) + " b= " + str(b) for m in range(1,m_max+1): print "m= " + str(m) print "works?... " + str(bool(p_partitions_ddeg_info(P,m) == p_partitions_ddeg_info(Q,m))) print ###### def p_partitions(P,m): L = list(P.linear_extensions()[0]) L.reverse() my_old_rpps = [{}] while L != []: x = L.pop() my_new_rpps = [] for R in my_old_rpps: my_max = 0 for y in P.lower_covers(x): if R[y] > my_max: my_max = R[y] for i in range(my_max,m+1): new_R = R.copy() new_R[x] = i my_new_rpps.append(new_R) my_old_rpps = my_new_rpps return my_old_rpps def p_partition_toggle(P,m,R,x): new_R = R.copy() my_max = 0 my_min = m for y in P.lower_covers(x): if R[y] > my_max: my_max = R[y] for y in P.upper_covers(x): if R[y] < my_min: my_min = R[y] new_R[x] = my_max+my_min-R[x] return new_R def p_partition_rowmotion(P,m,R): L = list(P.linear_extensions()[0]) new_R = R.copy() for x in L: new_R = p_partition_toggle(P,m,new_R,x) return new_R def p_partition_rowmotion_orbits(P,m): my_return_list = [] mylist = p_partitions(P,m) while mylist != []: u = mylist.pop() my_orbit = [u] v = p_partition_rowmotion(P,m,u) while not(v in my_orbit): mylist.remove(v) my_orbit += [v] old_v = v v = p_partition_rowmotion(P,m,old_v) my_return_list = my_return_list + [my_orbit] return my_return_list def p_partition_ddeg(P,R): my_ddeg = 0 for x in P: my_max = 0 for y in P.lower_covers(x): if R[y] > my_max: my_max = R[y] my_ddeg += R[x] - my_max return my_ddeg def p_partition_rowmotion_orbits_info(P,m): L = [(len(o),sum([p_partition_ddeg(P,R) for R in o])) for o in p_partition_rowmotion_orbits(P,m)] L.sort() return L print print "minuscule doppelgangers p-partition rowmotion test" print m_max = 3 print "5-shifted staircase and h3" P = shifted_staircase(5) Q = h3_poset() #P.show() #Q.show() for m in range(1,m_max+1): print "m= " + str(m) print "...works?: " + str(p_partition_rowmotion_orbits_info(P,m) == p_partition_rowmotion_orbits_info(Q,m)) print print "propeller and I2" for n in range(2,5): P = propeller_poset(n) Q = i2_poset(2*n) #P.show() #Q.show() print "n= " + str(n) for m in range(1,m_max+1): print "m= " + str(m) print "works?... " + str(p_partition_rowmotion_orbits_info(P,m) == p_partition_rowmotion_orbits_info(Q,m)) print print "rectangle and trapezoid" for b in range(1,5): for a in range(1,b+1): P = rectangle_poset(a,b) Q = trapezoid_poset(a,b) #P.show() #Q.show() print "a= " + str(a) + " b= " + str(b) for m in range(1,m_max+1): print "m= " + str(m) print "works?... " + str(p_partition_rowmotion_orbits_info(P,m) == p_partition_rowmotion_orbits_info(Q,m)) print ######