Class: Algebra::Group
- Inherits:
-
Set
show all
- Defined in:
- lib/algebra/finite-group.rb
Instance Attribute Summary collapse
Attributes inherited from Set
#body
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Set
#<, #>, [], #append, #append!, #bijections, #cast, #concat, #decreasing_series, #difference, #dup, #each, #each_member, #each_non_trivial_subset, #each_pair, #each_product, #each_subset, #empty?, #empty_set, empty_set, #eql?, #equiv_class, #hash, #identity_map, #include?, #increasing_series, #injections, #injections0, #inspect, #intersection, #map_s, new_a, new_h, null, phi, #pick, #power, #power_set, #product, #rehash, #shift, #singleton, singleton, #singleton?, #size, #sort, #subset?, #superset?, #surjections, #to_ary, #to_s, #union
#left_act, #left_orbit!, #left_quotient, #left_representatives, #right_act, #right_orbit!, #right_quotient, #right_representatives
Methods included from Enumerable
#all?, #any?, #collecti, #sum
Constructor Details
#initialize(u, *a) ⇒ Group
Returns a new instance of Group.
147
148
149
150
|
# File 'lib/algebra/finite-group.rb', line 147
def initialize(u, *a)
super(u, *a)
@unity = u
end
|
Instance Attribute Details
136
137
138
|
# File 'lib/algebra/finite-group.rb', line 136
def unity
@unity
end
|
Class Method Details
.generate_strong(u, *ary_of_gens) ⇒ Object
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
# File 'lib/algebra/finite-group.rb', line 175
def self.generate_strong(u, *ary_of_gens)
unless a = ary_of_gens.shift
return new(u)
end
a.first != u && (a = [u] + a)
while b = ary_of_gens.shift
b.first != u && (b = [u] + b)
c = []
a.each do |x|
b.each do |y|
c.push x * y
end
end
a = c
end
new(*a)
end
|
Instance Method Details
#ascending_central_series ⇒ Object
338
339
340
|
# File 'lib/algebra/finite-group.rb', line 338
def ascending_central_series
increasing_series(&:Z)
end
|
236
237
238
|
# File 'lib/algebra/finite-group.rb', line 236
def center
centralizer(self)
end
|
#center?(x) ⇒ Boolean
240
241
242
|
# File 'lib/algebra/finite-group.rb', line 240
def center?(x)
all? { |y| x * y == y * x }
end
|
#centralizer(s) ⇒ Object
C_self(s) not C_s(self) !!!!
232
233
234
|
# File 'lib/algebra/finite-group.rb', line 232
def centralizer(s)
separate { |x| s.all? { |y| x * y == y * x } }
end
|
#closed? ⇒ Boolean
193
194
195
196
197
198
199
200
201
|
# File 'lib/algebra/finite-group.rb', line 193
def closed?
each do |x|
return false unless include? x.inverse
each do |y|
return false unless include?(x * y)
end
end
true
end
|
#commutator(h = self) ⇒ Object
288
289
290
291
292
293
294
295
296
|
# File 'lib/algebra/finite-group.rb', line 288
def commutator(h = self)
gr = unit_group
each do |x|
h.each do |y|
gr.push x.inverse * y.inverse * x * y
end
end
self == h ? gr.semi_complete! : gr.complete!
end
|
#commutator_series ⇒ Object
306
307
308
|
# File 'lib/algebra/finite-group.rb', line 306
def commutator_series
decreasing_series(&:D)
end
|
171
172
173
|
# File 'lib/algebra/finite-group.rb', line 171
def complete
dup.complete!
end
|
#complete! ⇒ Object
166
167
168
169
|
# File 'lib/algebra/finite-group.rb', line 166
def complete!
concat collect(&:inverse)
orbit!(self)
end
|
#conjugacy_class(x) ⇒ Object
265
266
267
|
# File 'lib/algebra/finite-group.rb', line 265
def conjugacy_class(x)
(self % centralizer(Set[x])).map_s { |y| x.conjugate(y) }
end
|
#conjugacy_classes ⇒ Object
269
270
271
272
273
274
275
276
277
278
279
|
# File 'lib/algebra/finite-group.rb', line 269
def conjugacy_classes
s = Set.phi
t = cast
until t.empty?
x = conjugacy_class(t.pick)
yield x if block_given?
s.push x
t -= x
end
s
end
|
298
299
300
301
302
303
304
|
# File 'lib/algebra/finite-group.rb', line 298
def D(n = 1)
if n == 0
self
else
D(n - 1).commutator D(n - 1)
end
end
|
#descending_central_series ⇒ Object
322
323
324
325
326
|
# File 'lib/algebra/finite-group.rb', line 322
def descending_central_series
decreasing_series do |s|
commutator s
end
end
|
314
315
316
317
318
319
320
|
# File 'lib/algebra/finite-group.rb', line 314
def K(n = 1)
if n == 0
self
else
commutator K(n - 1)
end
end
|
#nilpotency_class ⇒ Object
347
348
349
350
|
# File 'lib/algebra/finite-group.rb', line 347
def nilpotency_class
a = descending_central_series
a.size - 1 if a.last.size == 1
end
|
#nilpotent? ⇒ Boolean
342
343
344
345
|
# File 'lib/algebra/finite-group.rb', line 342
def nilpotent?
descending_central_series.last.size == 1
end
|
#normal?(s) ⇒ Boolean
248
249
250
|
# File 'lib/algebra/finite-group.rb', line 248
def normal?(s)
all? { |x| s.right_act(Set[x]) == s.left_act(Set[x]) }
end
|
#normal_subgroups ⇒ Object
252
253
254
255
256
257
258
259
260
261
262
263
|
# File 'lib/algebra/finite-group.rb', line 252
def normal_subgroups
s = Set.phi
subgroups.each do |x|
if x.size == 1 ||
x.size == size ||
normal?(x)
yield x if block_given?
s.push x
end
end
s
end
|
#normalizer(s) ⇒ Object
244
245
246
|
# File 'lib/algebra/finite-group.rb', line 244
def normalizer(s)
separate { |x| s.right_act(Set[x]) == s.left_act(Set[x]) }
end
|
#quotient_group(u) ⇒ Object
138
139
140
141
|
# File 'lib/algebra/finite-group.rb', line 138
def quotient_group(u)
QuotientGroup.new(self, u)
end
|
#semi_complete ⇒ Object
162
163
164
|
# File 'lib/algebra/finite-group.rb', line 162
def semi_complete
dup.semi_complete!
end
|
#semi_complete! ⇒ Object
158
159
160
|
# File 'lib/algebra/finite-group.rb', line 158
def semi_complete!
orbit!(self)
end
|
#separate(&b) ⇒ Object
143
144
145
|
# File 'lib/algebra/finite-group.rb', line 143
def separate(&b)
self.class.new(unity, *find_all(&b))
end
|
#simple? ⇒ Boolean
281
282
283
284
285
286
|
# File 'lib/algebra/finite-group.rb', line 281
def simple?
subgroups.all? do |x|
x.size == 1 || x.size == size ||
!normal?(x)
end
end
|
#solvable? ⇒ Boolean
310
311
312
|
# File 'lib/algebra/finite-group.rb', line 310
def solvable?
commutator_series.last.size == 1
end
|
#subgroups {|e| ... } ⇒ Object
203
204
205
206
207
208
209
210
|
# File 'lib/algebra/finite-group.rb', line 203
def subgroups(&b)
e = unit_group
yield e if block_given?
subgrs = Set[e, self]
_subgroups(e, subgrs, &b)
yield self if block_given?
subgrs
end
|
352
353
354
|
# File 'lib/algebra/finite-group.rb', line 352
def to_a
[unity, *(super - [unity])]
end
|
#unit_group ⇒ Object
154
155
156
|
# File 'lib/algebra/finite-group.rb', line 154
def unit_group
self.class.new(@unity)
end
|
328
329
330
331
332
333
334
335
336
|
# File 'lib/algebra/finite-group.rb', line 328
def Z(n = 1)
if n == 0
unit_group
else
separate do |x|
commutator(Set[x]) <= Z(n - 1)
end
end
end
|