-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommutators.ijs
92 lines (79 loc) · 2.46 KB
/
commutators.ijs
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
NB. Functions for finding commutators and
NB. commutator subgroups.
NB. @author Jon Hough
NB. @since 16 July 2014
NB. Returns the commutator of element x
NB. and element y. [x, y], defined as the product
NB. y^(_1) * x^(_1) * y * x.
commutator=: ( inverse @: ] ) C."(1 1) conjugate
NB. Returns the commutator (derived) subgroup of group y.
derived_subgroup=: 3 : 0
ord=. # y NB. order of group y
size=. 0{ #"1 y NB. size of set acted on
NB. If Group y is symmetric then calculation is pointless.
NB. Return isomorphism of alternating subgroup of y.
NB. Warning: directly computing the commutator subgroup on
NB. Sym(N) for N >= 7 can crash J, so this 'if block' is necessary.
if. (ord = ! size ) do.
alt=. Alt size
alt
NB. Similar argument for symmetric groups also applies to
NB. alternating groups. For N > 4, Alt(N) is simple.
NB. So commutator subgroup is itself.
elseif. ( ( ( 2 * ord ) = ! size ) *. (size > 4) ) do.
y
elseif. (1) do.
NB. All commutators. Commutator subgroup is generated by these.
grp=: ( ~. @: ,/ @: (<"1 @: commutator"(_ 1)/~ i.~ <"1@:]) { ] ) y
NB. For most cases.
generate grp
end.
)
NB. Returns true if group y is perfect.
NB. i.e. y is equal to its commutator subgroup.
is_perfect=: # = ( # @: derived_subgroup )
NB. =========================================================
NB. Derived series
NB. =========================================================
NB. derived series termination group
DST=: derived_subgroup^:_
NB. Returns 1 if group y is solvable,
NB. 0 otherwise.
is_solvable=: (1&=)@:#@:DST
NB. Returns the derived series of group y
NB. as a boxed list, with the group isomorphism of ech
NB. item in the series if known.
derived_series=: verb define
result=. ''
ord=. #@:{.
grp=. y
ogrp=. _1+ # grp
while. 0 = (ogrp = ( # grp)) do.
o=. ord grp
or=. # grp
if. or = 1 do.
result=. result, <'Identity'
elseif. is_symmetric grp do.
result=. result, <( 'Sym ',":o)
elseif. is_alternating grp do.
result=. result, <( 'Alt ',":o)
elseif. is_cyclic grp do.
result=. result, <( 'Cyc ',":or)
NB. TODO -- Dihedral case etc.
NB. direct product test
elseif. is_directproduct grp do.
result=. result, <( 'Direct product ',":or)
elseif. 1 do.
if. or > 10 do.
result=. result, <( 'Group of order ',":or)
elseif. 1 do.
if. IsV4Isomorphic grp do. result=. result, <('V4')
else. result=: result, <( 'Group: ',":(<"1 grp))
end.
end.
end.
ogrp=. # grp
grp=. derived_subgroup grp
end.
result
)