def galois_action_on_embeddings(G_K): K = G_K.number_field() Kgal = G_K.splitting_field() embeddings = K.embeddings(Kgal) # first a shortcut in the case where G_K is normal in S_d since then it doesn't # matter for our application since we only care about the image # of the galois group in S_d d = K.absolute_degree() G_K_roots = TransitiveGroup(d, G_K.transitive_number()) if G_K_roots.is_normal(SymmetricGroup(d)): id_G_K = G_K.Hom(G_K).identity() return G_K, id_G_K, id_G_K, Kgal, embeddings # now for the actual computation permutations = [] for g in G_K.gens(): phi = g.as_hom() g_perm = Permutation( [embeddings.index(phi * emb) + 1 for emb in embeddings]).inverse() permutations.append(g_perm) G_K_emb = PermutationGroup(permutations, canonicalize=False) to_emb = G_K.hom(G_K_emb.gens()) from_emb = G_K_emb.hom(G_K.gens()) return G_K_emb, to_emb, from_emb, Kgal, embeddings