-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem_1.py
More file actions
72 lines (53 loc) · 1.55 KB
/
problem_1.py
File metadata and controls
72 lines (53 loc) · 1.55 KB
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
from libsemigroups_pybind11 import Bipartition, FroidurePin, Gabow
def jones_identity(n):
if n < 0:
raise ValueError("the argument (an int) is not >= 0")
return Bipartition([[i, -i] for i in range(1, n + 1)])
def jones_generators(n):
if n < 0:
raise ValueError("the argument (an int) is not >= 0")
gens = []
for i in range(1, n):
part = [[i, i + 1], [-i, -i - 1]]
part.extend([j, -j] for j in range(1, i))
part.extend([j, -j] for j in range(i + 2, n + 1))
gens.append(Bipartition(part))
return gens
def jones_monoid(n):
return FroidurePin([jones_identity(n)] + jones_generators(n))
s = jones_monoid(14)
# Part (a)
s.size() # returns 2674440
# Part (b)
s.number_of_idempotents() # returns 1083028
# Part (c)
x = Bipartition(
[
[1, 4],
[2, 3],
[5, -3],
[6, 7],
[8, -6],
[9, -13],
[10, 13],
[11, 12],
[14, -14],
[-1, -2],
[-4, -5],
[-7, -12],
[-8, -9],
[-10, -11],
]
)
# Green's relations aren't yet directly supported, so we compute the strongly
# connected components of the right and left Cayley graphs instead.
right = Gabow(s.right_cayley_graph())
left = Gabow(s.left_cayley_graph())
dclass = set()
for index in right.component_of(s.position(x)):
dclass |= set(left.component_of(index))
sum(1 for x in dclass if s.is_idempotent(x)) # returns 226979
# Part (d)
sum(
1 for x in dclass if s.is_idempotent(x) and s[x].is_transverse_block(s[x][7])
) # returns 35733