Esempio n. 1
0
 def test_coset_enumeration(self):
     g1 = Permutation.read_cycle_form([[1,2,3,4]], 4)
     g2 = Permutation.read_cycle_form([[1,2]], 4)
     h1 = Permutation.read_cycle_form([[1,2,3]], 4)
     h2 = Permutation.read_cycle_form([[1,2]], 4)
     G = PermGroup([g1, g2])
     H = PermGroup([h1, h2])
     cosets = G._left_cosets(H)
     total = 0
     elements = []
     for coset in cosets:
         temp_eles = coset._list_elements()
         elements += temp_eles
         self.assertEqual(len(temp_eles),len(H))
         total += len(temp_eles)
     self.assertEqual(len(G), total)
     self.assertEqual(sorted(G._list_elements()), sorted(elements))        
     cosets = G._right_cosets(H)
     total = 0
     elements = []
     for coset in cosets:
         temp_eles = coset._list_elements()
         elements += temp_eles
         self.assertEqual(len(temp_eles),len(H))
         total += len(temp_eles)
     self.assertEqual(len(G), total)
     self.assertEqual(sorted(G._list_elements()), sorted(elements))
Esempio n. 2
0
 def test_len(self):
     s1 = Permutation.read_cycle_form([[1,2,3,4]], 4)
     s2 = Permutation.read_cycle_form([[1,2]], 4)
     G = PermGroup([s1, s2])
     self.assertEqual(len(G), len(G._list_elements()))
     self.assertEqual(len(G), 24)
     self.assertTrue(Permutation.read_cycle_form([[3,4]], 4) in G._list_elements())
Esempio n. 3
0
    def test_partition_backtrack_subgroup_two_prop_subgroup_stab(self):        
        cf = Permutation.read_cycle_form
        a = cf([[3,2,6]], 7)
        b = cf([[3,2],[6,7]], 7)
        G = PermGroup([a,b])
        fam_subgroup = SubgroupFamily(G)
        prop_subgroup = SubgroupProperty(G)
        stab = Partition([[1,3,5,7],[2,4,6]])
        fam_part_stab = PartitionStabaliserFamily(stab)        
        prop_part_stab = PartitionStabaliserProperty(stab)
        
        size = 7
        fam = Refinement([fam_part_stab, fam_subgroup])
        prop = CosetProperty([prop_part_stab, prop_subgroup])
        pbw = PBW(prop, fam, size)
        
        gens = pbw.find_partition_backtrack_subgroup()
        
        found = []
        s7 = PermGroup([cf([[1,2]],7),cf([[1,2,3,4,5,6,7]],7)])
        for ele in s7._list_elements():
            if prop.check(ele):
                found.append(ele)

        self.assertEqual(len(PermGroup(gens)), len(found))     
Esempio n. 4
0
 def test_partition_backtrack_subgroup_leon_paper(self):
     cf = Permutation.read_cycle_form
     a = cf([[2,3],[4,6],[5,8],[9,11]], 13)
     b = cf([[1,2,4,7,9,3,5,6,8,10,11,12,13]], 13)
     G = PermGroup([a,b])
     fam_subgroup = SubgroupFamily(G)
     prop_subgroup = SubgroupProperty(G)
     
     stab = Partition([[1,3,5,7,9,11],[2,4,6,8,10,12,13]])
     fam_part_stab = PartitionStabaliserFamily(stab)        
     prop_part_stab = PartitionStabaliserProperty(stab)
     
     size = 13
     fam = Refinement([fam_subgroup, fam_part_stab])
     prop = CosetProperty([prop_subgroup, prop_part_stab])
     pbw = PBW(prop, fam, size)     
     
     gens = pbw.find_partition_backtrack_subgroup()
     cand_G = PermGroup(gens)
     leon_gens = []
     leon_gens.append(cf([[2,12],[4,10],[5,7],[6,8]],13))
     leon_gens.append(cf([[2,8],[3,5],[4,6],[10,12]],13))
     leon_gens.append(cf([[1,9],[2,4],[6,8],[10,12]],13))
     leon_G = PermGroup(leon_gens)
     third_source = []
     for ele in G._list_elements():
         if prop.check(ele):
             third_source.append(ele)
     self.assertEqual(cand_G.order(), leon_G.order())
     for perm in leon_gens:
         self.assertTrue(perm in G)
         self.assertTrue(perm in cand_G)
Esempio n. 5
0
    def test_partition_backtrack_subgroup_two_prop_subgroup_stab(self):        
        cf = Permutation.read_cycle_form
        a = cf([[3,2,6]], 7)
        b = cf([[3,2],[6,7]], 7)
        G = PermGroup([a,b])
        fam_subgroup = SubgroupFamily(G)
        prop_subgroup = SubgroupProperty(G)
        stab = Partition([[1,3,5,7],[2,4,6]])
        fam_part_stab = PartitionStabaliserFamily(stab)        
        prop_part_stab = PartitionStabaliserProperty(stab)
        
        size = 7
        fam = RefinementUnion([fam_part_stab, fam_subgroup])
        prop = CosetPropertyUnion([prop_part_stab, prop_subgroup])
        con = PartitionStackConstraint()
        mods = ModifierUnion([fam, prop, con])
        ls = LeonSearch(mods, size)
        
        gens = ls.subgroup()
        
        found = []
        s7 = PermGroup([cf([[1,2]],7),cf([[1,2,3,4,5,6,7]],7)])
        for ele in s7._list_elements():
            if prop.property_check(ele):
                found.append(ele)

        self.assertEqual(len(PermGroup(gens)), len(found))     
Esempio n. 6
0
    def test_partition_backtrack_subgroup_one_prop_stab(self):
        cf = Permutation.read_cycle_form
        stab = Partition([[1,3,5],[2,4,6]])
        fam_part_stab = PartitionStabaliserFamily(stab)        
        prop_part_stab = PartitionStabaliserProperty(stab)
        
        size = 6
        fam = Refinement([fam_part_stab])
        prop = CosetProperty([prop_part_stab])
        pbw = PBW(prop, fam, size)     
        
        gens = pbw.find_partition_backtrack_subgroup()
        
        found = []
        s6 = PermGroup([cf([[1,2]],6),cf([[1,2,3,4,5,6]],6)])
        for ele in s6._list_elements():
            if prop.check(ele):
                found.append(ele)

        self.assertEqual(len(PermGroup(gens)), len(found))
Esempio n. 7
0
    def test_partition_backtrack_subgroup_one_prop_subgroup(self):
        cf = Permutation.read_cycle_form
        a = cf([[1,2,3]], 5)
        b = cf([[1,2],[3,4]], 5)
        G = PermGroup([a,b])
        fam_subgroup = SubgroupFamily(G)
        prop_subgroup = SubgroupProperty(G)
        
        fam = Refinement([fam_subgroup])
        prop = CosetProperty([prop_subgroup])
        pbw = PBW(prop, fam, 5)
        
        gens = pbw.find_partition_backtrack_subgroup()
        
        found = []
        s5 = PermGroup([cf([[1,2]],5),cf([[1,2,3,4,5]],5)])
        for ele in s5._list_elements():
            if prop.check(ele):
                found.append(ele)

        self.assertEqual(len(PermGroup(gens)), len(found))
Esempio n. 8
0
    def test_partition_backtrack_subgroup_one_prop_stab(self):
        cf = Permutation.read_cycle_form
        stab = Partition([[1,3,5],[2,4,6]])
        fam_part_stab = PartitionStabaliserFamily(stab)        
        prop_part_stab = PartitionStabaliserProperty(stab)
        
        size = 6
        fam = RefinementUnion([fam_part_stab])
        prop = CosetPropertyUnion([prop_part_stab])
        con = PartitionStackConstraint()
        mods = ModifierUnion([fam, prop, con])
        ls = LeonSearch(mods, size)
        
        gens = ls.subgroup()
        
        found = []
        s6 = PermGroup([cf([[1,2]],6),cf([[1,2,3,4,5,6]],6)])
        for ele in s6._list_elements():
            if prop.property_check(ele):
                found.append(ele)

        self.assertEqual(sorted(PermGroup(gens)._list_elements()), sorted(found))
Esempio n. 9
0
    def test_partition_backtrack_subgroup_one_prop_subgroup(self):
        cf = Permutation.read_cycle_form
        a = cf([[1,2,3]], 5)
        b = cf([[1,2],[3,4]], 5)
        G = PermGroup([a,b])
        fam_subgroup = SubgroupFamily(G)
        prop_subgroup = SubgroupProperty(G)
        
        fam = RefinementUnion([fam_subgroup])
        prop = CosetPropertyUnion([prop_subgroup])
        con = PartitionStackConstraint()
        mods = ModifierUnion([fam, prop, con])
        
        ls = LeonSearch(mods, 5)
        
        gens = ls.subgroup()
        
        found = []
        s5 = PermGroup([cf([[1,2]],5),cf([[1,2,3,4,5]],5)])
        for ele in s5._list_elements():
            if prop.property_check(ele):
                found.append(ele)

        self.assertEqual(sorted(PermGroup(gens)._list_elements()), sorted(found))
from permutation import Permutation
from group import PermGroup as Group
from coset_property import permutation_commuter

cf =Permutation.read_cycle_form
a = cf([[1, 2]],4)
check = permutation_commuter(a)
b = cf([[1,2,3,4]], 4)
c = cf([[3, 4]], 4)
d = cf([[2, 3]], 4)
e = cf([[3, 4]], 4)
G = Group([a,b])   
G1 = Group([c,d])
G2 = Group([e])
identity = cf([],4)
sub = Group([identity])
for g in G._list_elements():
    d = sub * g * sub
    p_flag = check(g)
    d_flag = d.mid_minimal()
    if g != identity and p_flag and d_flag:
        sub = Group([t for t in sub.generators + [g] if t != identity])
    print("{}\nprop: {}\nmin: {} sub: {}\nd: {}\n".format(g, p_flag, d_flag, sub.generators, d._list_elements()))
Dcosets = [(G2*g*G1, g) for g in G._list_elements()]
for d, g in sorted(Dcosets,key = lambda x: x[0]._list_elements()):
    eles = d._list_elements()
    #print("{} ({}) {}:\n{}\n".format(g,len(eles),d.mid_minimal(),eles))

a = cf([[1,2],[3,4]],4)
b = cf([[1,2,3]],4)
print(len(Group([a,b])))