Open
Description
A common mistake is for people to define ActionHomomorphisms which are not valid.
It isn't reasonable for us to test every ActionHomomorphism, but we could provide helper functions we can at least point people at. It might be possible in some cases where code fails to then run these to see if we can tell why it failed. There are two functions here, one that does a random check if 10,000 elements, and one that checks the full group (which will of course only work for small, finite, G and Omega).
I've had these pieces of code lying around for a while, I'm curious if anyone has any comments, before I polish them up and make a PR:
FullTestActionHomomorphism := function(G, Omega, act)
local p1,p2,j;
p1 := One(G);
for j in Omega do
if act(j,p1) <> j then
Error("Identity: act(",j,",",p1, "<>",j);
fi;
od;
for p1 in G do
for j in Omega do
if not(act(j,p1) in Omega) then
Error("Closure: act(",j,",",p1, "not in Omega");
fi;
od;
od;
for p1 in G do
for p2 in G do
for j in Omega do
if act(act(j,p1),p2) <> act(j,p1*p2) then
Error("Homomorphism: act(act(",j,",",p1,"),",p2,") != act(",j,",",p1*p2,"))");
fi;
od;
od;
od;
end;
RandomTestActionHomomorphism := function(G, Omega, act)
local p1,p2,j, loop;
p1 := One(G);
for loop in [1..10000] do
j := Random(Omega);
if act(j,p1) <> j then
Error("Identity: act(",j,",",p1, "<>",j);
fi;
od;
for loop in [1..10000] do
p1 := Random(G);
p2 := Random(Omega);
if not(act(j,p1) in Omega) then
Error("act(Closure: ",j,",",p1, "not in Omega");
fi;
od;
for loop in [1..10000] do
p1 := Random(G);
p2 := Random(G);
j := Random(Omega);
if act(act(j,p1),p2) <> act(j,p1*p2) then
Error("Homomorphism: act(act(",j,",",p1,"),",p2,") != act(",j,",",p1*p2,"))");
fi;
od;
end;
FullTestActionHomomorphism(SymmetricGroup(4), Arrangements([1..4], 4), OnTuples);
RandomTestActionHomomorphism(SymmetricGroup(4), Arrangements([1..4], 4), OnTuples);
FullTestActionHomomorphism(SymmetricGroup(4), Combinations([1..4], 3), OnSets);
RandomTestActionHomomorphism(SymmetricGroup(4), Combinations([1..4], 3), OnSets);
Metadata
Assignees
Labels
No labels