## structure.gi RAQ Implementation of definitiions, reps, and elt operations ## Create structures with generators InstallGlobalFunction(CloneOfTypeByGenerators, function(cat, fam, gens, genAttrib) local M; if not(IsEmpty(gens) or IsIdenticalObj(FamilyObj(gens), fam)) then Error(" and family of do not match"); fi; M := Objectify(NewType( fam, cat and IsAttributeStoringRep), rec()); Setter(genAttrib)(M, AsList(gens)); return M; end); ## Functions for each of the magma categories here InstallGlobalFunction(LeftQuasigroup, function(arg) local fam; if Length(arg) = 0 then Error("usage: LeftQuasigroup([], )"); fi; # Extract the family if IsFamily(arg[1]) then fam := arg[1]; Remove(arg, 1); arg := Flat(arg); else arg := Flat(arg); fam := FamilyObj(arg[1]); fi; return CloneOfTypeByGenerators(IsLeftQuasigroup, fam, arg, GeneratorsOfLeftQuasigroup); end); InstallGlobalFunction(LeftRack, function(arg) local fam; if Length(arg) = 0 then Error("usage: LeftRack([], )"); fi; # Extract the family if IsFamily(arg[1]) then fam := arg[1]; Remove(arg, 1); arg := Flat(arg); else arg := Flat(arg); fam := FamilyObj(arg[1]); fi; return CloneOfTypeByGenerators(IsLeftRack, fam, arg, GeneratorsOfLeftQuasigroup); end); InstallGlobalFunction(RightQuasigroup, function(arg) local fam; if Length(arg) = 0 then Error("usage: RightQuasigroup([], )"); fi; # Extract the family if IsFamily(arg[1]) then fam := arg[1]; Remove(arg, 1); arg := Flat(arg); else arg := Flat(arg); fam := FamilyObj(arg[1]); fi; return CloneOfTypeByGenerators(IsRightQuasigroup, fam, arg, GeneratorsOfRightQuasigroup); end); InstallGlobalFunction(RightRack, function(arg) local fam; if Length(arg) = 0 then Error("usage: RightRack([], )"); fi; # Extract the family if IsFamily(arg[1]) then fam := arg[1]; Remove(arg, 1); arg := Flat(arg); else arg := Flat(arg); fam := FamilyObj(arg[1]); fi; return CloneOfTypeByGenerators(IsRightRack, fam, arg, GeneratorsOfRightQuasigroup); end); ## And now create them from multiplication tables InstallGlobalFunction(LeftQuasigroupByMultiplicationTable, function(T) if not IsLeftQuasigroupTable(T) then Error("Multiplication table must have each row a permutation of ", "the same entries."); fi; return MagmaByMultiplicationTableCreatorNC( CanonicalCayleyTableOfLeftQuasigroupTable(T), LeftQuasigroup, IsLeftQuotientElement and IsMagmaByMultiplicationTableObj ); end); ## And define the operation InstallOtherMethod(LeftQuotient, "for two elts in magma by mult table, when left has left quotients", IsIdenticalObj, [IsLeftQuotientElement, IsMagmaByMultiplicationTableObj], function (l,r) return LeftDivisionTable(FamilyObj(l))[l![1],r![1]]; end); ## Create division tables as needed InstallMethod(LeftDivisionTable, "for a family with a multiplication table", [IsFamily and HasMultiplicationTable], function(fam) local LS, n; LS := LeftSectionList(fam); n := Size(T); return List(T, x->ListPerm(Inverse(x), n)); end); ## Create section lists as needed InstallMethod(LeftSectionList, "for a family with a multiplication table", [IsFamily and HasMultiplicationTable], function(fam) return List(MultiplicationTable(fam), x->PermList(x)); end);