-
Notifications
You must be signed in to change notification settings - Fork 0
/
group.py
39 lines (32 loc) · 907 Bytes
/
group.py
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
import types
def check_if_group(group, function):
if not len(group):
return False, "the set is empty"
if not _check_associvity(group, function):
return False, "the function is not associative on the group elements"
if not _check_closure(group, function):
return False, "the function is not closed"
class Group():
def __init__(self, group, function=None):
self.is_multiplicative = False
if function is None:
self.is_multiplicative = True
pass
elif not isinstance(function, types.FunctionType):
raise TypeError('should supply a function')
self.group = group
self.function = function
def cayley_table(self):
raise NotImplementedError
@property
def isFinite(self):
return True
@property
def isAbelian(self):
raise NotImplementedError
@property
def order(self):
raise NotImplementedError
@property
def is_Multiplicative(self):
return self.is_multiplicative