Esempio n. 1
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 = RefinementUnion([fam_subgroup, fam_part_stab])
     prop = CosetPropertyUnion([prop_subgroup, prop_part_stab])
     con = PartitionStackConstraint()
     multi_back = MultiBacktracker()
     mods = ModifierUnion([fam, prop, con, multi_back])
     ls = LeonSearch(mods, size)
     
     gens = ls.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.property_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. 2
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))     
 def test_multi_coset_property(self):
     cf = Permutation.read_cycle_form
     a = cf([[1,2,3]],4)
     b = cf([[1,2],[3,4]],4)
     gens = [a,b]
     G= PermGroup(gens)
     prop1 = SubgroupProperty(G)
     prop2 = PartitionStabaliserProperty(Partition([[2,3],[1,4]]))
     co_prop = CosetPropertyUnion([prop1,prop2])
     pos = cf([[2,3],[1,4]])
     self.assertTrue(co_prop.property_check(pos))
 def test_subgroup_property(self):
     cf = Permutation.read_cycle_form
     a = cf([[1,2,3]],4)
     b = cf([[1,2],[3,4]],4)
     gens = [a,b]
     G= PermGroup(gens)
     prop = CosetPropertyUnion([SubgroupProperty(G)])
     pos = cf([[2,3,4]],4)        
     neg = cf([[3,4]],4)
     self.assertTrue(prop.property_check(pos))
     self.assertFalse(prop.property_check(neg))
Esempio n. 5
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. 6
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))
 def test_permutation_commuter_property(self):
     prop = CosetPropertyUnion([PermutationCommuterProperty(Permutation([2,1,3,4]))])
     pos = Permutation.read_cycle_form([[3,4]],4)
     neg = Permutation.read_cycle_form([[2,3]],4)
     self.assertTrue(prop.property_check(pos))
     self.assertFalse(prop.property_check(neg))
 def test_partition_stabaliser_property(self):
     prop = CosetPropertyUnion([PartitionStabaliserProperty(Partition([[1,2],[3,4],[5]]))])
     pos = Permutation.read_cycle_form([[1,2]],5)
     neg = Permutation.read_cycle_form([[1,2],[4,5]],5)
     self.assertTrue(prop.property_check(pos))
     self.assertFalse(prop.property_check(neg))
 def test_coset_property_init(self):
     prop = CosetPropertyUnion([IdentityProperty()])
     self.assertTrue(prop.property_check(Permutation.read_cycle_form([[1,2,3,4]], 5)))