-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgroup.h
101 lines (76 loc) · 2.88 KB
/
group.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#pragma once
#include <iostream>
#include <vector>
#include <memory>
#include <set>
#include <deque>
class _Group;
class Subgroup;
typedef std::shared_ptr<const _Group> Group;
#include "permutation.h"
#include "coset.h"
#include "fhl.h"
class _Group: public std::enable_shared_from_this<const _Group> {
public:
// checks whether the group contains the given permutation
virtual bool contains( const Permutation& ) const = 0;
// computes the degree of the group
virtual int degree() const = 0;
// computes the order of the group
virtual __int128_t order() const = 0;
// returns a copy of a list of generators for the group
virtual std::vector<Permutation> generators() const = 0;
// returns the group generated by this group and the generators
virtual Group join( std::deque<Permutation>&& ) const = 0;
// checks whether the group is the complete alternating or symmetric group
virtual bool isGiant() const = 0;
// returns a shared pointer to this group
Group share() const;
// returns the trivial permutation in this group
Permutation one() const;
// returns the point-wise stabiliser of x
Group stabilizer( int x ) const;
// checks whether the group has H as subgroup
bool hasSubgroup( Group H ) const;
// checks whether the group is equal to H
bool equals( Group H ) const;
// returns a vector containing {0,...,degree()-1}
std::vector<int> domain() const;
// destructor
virtual ~_Group() = 0;
// returns a vector of all left cosets of the quotient of this group with G
std::vector<Coset> allCosets( Group G ) const;
};
class Subgroup: public _Group {
Group _supergroup;
std::vector<Permutation> _generators;
mutable FHL<Permutation> _fhl;
public:
// returns a shared reference to the group this group is a subgroup of
Group supergroup() const;
virtual bool contains( const Permutation& ) const;
virtual int degree() const;
virtual __int128_t order() const;
virtual std::vector<Permutation> generators() const;
virtual Group join( std::deque<Permutation>&& ) const;
virtual bool isGiant() const;
// construct a subgroup generated by permutations S of G
Subgroup( Group G, std::vector<Permutation> S );
// construct a subgroup containing all permutations of G for which f returns true
// WARNING: it is undefined behaviour when f does not describe a group
Subgroup( Group G, std::function<bool(Permutation)> f );
virtual ~Subgroup();
};
class SymmetricGroup: public _Group {
int _degree;
public:
virtual bool contains( const Permutation& ) const;
virtual int degree() const;
virtual __int128_t order() const;
virtual std::vector<Permutation> generators() const;
virtual Group join( std::deque<Permutation>&& ) const;
virtual bool isGiant() const;
// construct a symmetric group on the elements {0,...,n-1}
SymmetricGroup( int n );
virtual ~SymmetricGroup();
};