/
primitivegroups.jl
214 lines (170 loc) · 6.18 KB
/
primitivegroups.jl
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
"""
has_number_of_primitive_groups(deg::Int)
Return `true` if the number of primitive permutation groups of degree `deg` is available
via `number_of_primitive_groups`, otherwise `false`.
Currently the number of primitive permutation groups is available up to degree 4095.
# Examples
```jldoctest
julia> has_number_of_primitive_groups(50)
true
julia> has_number_of_primitive_groups(5000)
false
```
"""
has_number_of_primitive_groups(deg::Int) = has_primitive_groups(deg) # for now just an alias
"""
has_primitive_group_identification(deg::Int)
Return `true` if identification is supported for the primitive permutation
groups of degree `deg` via `primitive_group_identification`, otherwise `false`.
Currently identification is available for all primitive permutation groups up to degree 4095.
# Examples
```jldoctest
julia> has_primitive_group_identification(50)
true
julia> has_primitive_group_identification(5000)
false
```
"""
has_primitive_group_identification(deg::Int) = has_primitive_groups(deg) # for now just an alias
"""
has_primitive_groups(deg::Int)
Return `true` if the primitive permutation groups of degree `deg` are available
via `primitive_group` and `all_primitive_groups`, otherwise `false`.
Currently all primitive permutation groups up to degree 4095 are available.
# Examples
```jldoctest
julia> has_primitive_groups(50)
true
julia> has_primitive_groups(5000)
false
```
"""
function has_primitive_groups(deg::Int)
@req deg >= 1 "degree must be positive, not $deg"
return GAP.Globals.PrimitiveGroupsAvailable(GAP.Obj(deg))
end
"""
number_of_primitive_groups(deg::Int)
Return the number of primitive permutation groups of degree `deg`,
up to permutation isomorphism.
# Examples
```jldoctest
julia> number_of_primitive_groups(10)
9
julia> number_of_primitive_groups(4096)
ERROR: ArgumentError: the number of primitive permutation groups of degree 4096 is not available
```
"""
function number_of_primitive_groups(deg::Int)
@req has_number_of_primitive_groups(deg) "the number of primitive permutation groups of degree $deg is not available"
return GAP.Globals.NrPrimitiveGroups(deg)::Int
end
"""
primitive_group(deg::Int, i::Int)
Return the `i`-th group in the catalogue of primitive permutation groups over the set
`{1, ..., deg}` in GAP's library of primitive permutation groups.
The output is a group of type `PermGroup`.
# Examples
```jldoctest
julia> primitive_group(10,1)
Permutation group of degree 10 and order 60
julia> primitive_group(10,10)
ERROR: ArgumentError: there are only 9 primitive permutation groups of degree 10, not 10
```
"""
function primitive_group(deg::Int, i::Int)
@req has_primitive_groups(deg) "primitive permutation groups of degree $deg are not available"
N = number_of_primitive_groups(deg)
@req i <= N "there are only $N primitive permutation groups of degree $deg, not $i"
return PermGroup(GAP.Globals.PrimitiveGroup(deg,i), deg)
end
"""
primitive_group_identification(G::PermGroup)
Return a pair `(d,n)` such that `G` is permutation isomorphic with
`primitive_group(d,n)`, where `G` acts primitively on `d` points.
If `G` is not primitive on its moved points, or if the primitive permutation groups of
degree `d` are not available, an exception is thrown.
# Examples
```jldoctest
julia> G = symmetric_group(7); m = primitive_group_identification(G)
(7, 7)
julia> order(primitive_group(m...)) == order(G)
true
julia> S = stabilizer(G, 1)[1]
Permutation group of degree 7 and order 720
julia> is_primitive(S)
false
julia> is_primitive(S, moved_points(S))
true
julia> m = primitive_group_identification(S)
(6, 4)
julia> order(primitive_group(m...)) == order(S)
true
julia> primitive_group_identification(symmetric_group(4096))
ERROR: ArgumentError: identification of primitive permutation groups of degree 4096 is not available
julia> S = sub(G, [perm([1,3,4,5,2,7,6])])[1];
julia> primitive_group_identification(S)
ERROR: ArgumentError: group is not primitive on its moved points
```
"""
function primitive_group_identification(G::PermGroup)
moved = moved_points(G)
@req is_primitive(G, moved) "group is not primitive on its moved points"
deg = length(moved)
@req has_primitive_groups(deg) "identification of primitive permutation groups of degree $(deg) is not available"
res = GAP.Globals.PrimitiveIdentification(G.X)::Int
return deg, res
end
"""
all_primitive_groups(L...)
Return the list of all primitive permutation groups (up to permutation isomorphism)
satisfying the conditions described by the arguments. These conditions
may be of one of the following forms:
- `func => intval` selects groups for which the function `func` returns `intval`
- `func => list` selects groups for which the function `func` returns any element inside `list`
- `func` selects groups for which the function `func` returns `true`
- `!func` selects groups for which the function `func` returns `false`
As a special case, the first argument may also be one of the following:
- `intval` selects groups whose degree equals `intval`; this is equivalent to `degree => intval`
- `intlist` selects groups whose degree is in `intlist`; this is equivalent to `degree => intlist`
The following functions are currently supported as values for `func`:
- `degree`
- `is_abelian`
- `is_almost_simple`
- `is_cyclic`
- `is_nilpotent`
- `is_perfect`
- `is_primitive`
- `is_quasisimple`
- `is_simple`
- `is_sporadic_simple`
- `is_solvable`
- `is_supersolvable`
- `is_transitive`
- `number_of_conjugacy_classes`
- `number_of_moved_points`
- `order`
- `transitivity`
The type of the returned groups is `PermGroup`.
# Examples
```jldoctest
julia> all_primitive_groups(4)
2-element Vector{PermGroup}:
Alt(4)
Sym(4)
julia> all_primitive_groups(degree => 3:5, is_abelian)
2-element Vector{PermGroup}:
Alt(3)
Permutation group of degree 5 and order 5
```
"""
function all_primitive_groups(L...)
@req !isempty(L) "must specify at least one filter"
if L[1] isa IntegerUnion || L[1] isa AbstractVector{<:IntegerUnion}
L = (degree => L[1], L[2:end]...)
end
gapargs = translate_group_library_args(L; filter_attrs = _permgroup_filter_attrs)
K = GAP.Globals.AllPrimitiveGroups(gapargs...)
return [PermGroup(x) for x in K]
end
# TODO: turn this into an iterator, possibly using PrimitiveGroupsIterator