There are two problems with your code. The first is that LatticeSubgroups is not the set of subgroups but a different kind of structure. If you want to access all the subgroups, you should use the function Subgroups. This requires the SONATA package or some other equivalent package -- you can load that using LoadPackage("sonata");.
The problem is that GAP doesn't understand "HK" to be the product of H and K but rather thinks that that is a new variable. Copy and paste this code in the GAP interface (or put it in a file and read the file through GAP): LoadPackage("sonata"); ProductOfSubsets := function(A,B) local a,b,L; L := []; for a in Set(A) do for b in Set(B) do Add(L,Product([a,b])); od; od; return Set(L); end;; PermutingSubsets := function(H,K) return(ProductOfSubsets(H,K) = ProductOfSubsets(K,H)); end;; NumberOfPermutingSubgroupPairs := function(G) local S,F; S := Subgroups(G); F := Filtered(Cartesian(S,S), x -> PermutingSubsets(x[1],x[2]));; return Length(F); end;; end of code Now you can do: NumberOfPermutingSubgroupPairs(AlternatingGroup(4)); The answer in this case seems to be 64, for what it's worth. * Quoting Stefanos Dalamaidhs who at 2012-03-08 04:43:40+0000 (Thu) wrote > Dear Forum, > > I would like to write a short code to do the following task:for any two > subgroups of a group G, check whether their product is a subgroup of G and > count their number. A failed attempt was: > > G:=AlternatingGroup(4); > Alt( [ 1 .. 4 ] ) > > L:=LatticeSubgroups(G); > > count:=0; > > for H in L do; > for K in L do; > if IsSubgroup(G,HK) then count:=count+1; > > fi; > od; > od; > 0 > Error, no method found! For debugging hints type ?Recovery from > NoMethodFound > Error, no 1st choice method found for `Enumerator' on 1 arguments > > I would be obliged for any help. > > Thanks, > J. > _______________________________________________ > Forum mailing list > Forum@mail.gap-system.org > http://mail.gap-system.org/mailman/listinfo/forum _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum