Skip to content

Instantly share code, notes, and snippets.

@felixdae
Created January 15, 2022 16:05
Show Gist options
  • Save felixdae/afbe6e0e7a1b8e5e33306bde8c8aca85 to your computer and use it in GitHub Desktop.
Save felixdae/afbe6e0e7a1b8e5e33306bde8c8aca85 to your computer and use it in GitHub Desktop.
to show the insolvability of the quintic by computing nested commutators
import itertools
def reverse(forward: tuple) -> tuple:
lst = [-1 for _ in forward]
for idx in range(len(forward)):
lst[forward[idx]] = idx
return tuple(lst)
def compose(perm1: tuple, perm2: tuple) -> tuple:
assert len(perm2) == len(perm1)
lst = [-1 for _ in perm1]
for idx in range(len(perm1)):
lst[idx] = perm2[perm1[idx]]
return tuple(lst)
def commutator(perms: set) -> set:
res = []
for perm1 in perms:
for perm2 in perms:
res.append(
compose(
compose(
compose(
perm1,
perm2
),
reverse(perm1)),
reverse(perm2)
)
)
return set(res)
# https://www.youtube.com/watch?v=RhpVSV6iCko
if __name__ == '__main__':
n = 3
perms_set = set(itertools.permutations(range(n)))
depth = 4
for i in range(depth):
print(i, len(perms_set), perms_set)
perms_set = commutator(perms_set)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment