Dear Forum. It seems that Vipul's code double counts permuting subgroup pairs, since if the pair (S,T) is permuting, then so is (T,S). In G := AlternatingGroup( 4 ), which has 10 subgroups, there is a normal subgroup <(1,3)(2,4), (1,2)(3,4)> of index 3, which will permute with every subgroup. So Vipul's code will count the pair <(2,4,3)>, <(1,3)(2,4), (1,2)(3,4)>, as well as the pair <(1,3)(2,4), (1,2)(3,4)>, <(2,4,3)>, which are the same. Also, there are some trivial pairs, such as (S,S), or (S,{1}), or (S,G) which you may not want to consider.
I think the following code will count all the nontrivial, distinct pairs of permuting subgroups of a given group G. (I've also used Burkhard Höfling's permuting subgroups function.) ------------------------------------------------------------------------------------------------------------------------ PermutingSubgroups := function( H, K ) return Size ( ClosureGroup ( H, K ) ) * Size ( Intersection ( H, K ) ) = Size( H ) * Size( K ); end; DistinctNontrivialPermutingSubgroupPairs := function( G ) local subs, len, num; subs := Flat( List( ConjugacyClassesSubgroups( G ), Elements ) ); len := Length( subs ); Print( "\n(", len, " subgroups) pairs are: " ); num := 0; for i in [2..len-1] do for j in [i+1..len-1] do if ( i < j ) then if ( PermutingSubgroups( subs[i], subs[j] ) ) then Print( "\nsubs[", i, "]: ", subs[i], ", subs[", j, "]: ", subs[j] ); num := num + 1; fi; fi; od; od; Print( "\n\n", num, " pairs " ); return num; end; ------------------------------------------------------------------------------------------------------------------------ The output for G := AlternatingGroup( 4 ) is: ------------------------------------------------------------------------------------------------------------------------ G has 10 subgroups. subs[2]: Group( [ (1,2)(3,4) ] ), subs[3]: Group( [ (1,3)(2,4) ] ) subs[2]: Group( [ (1,2)(3,4) ] ), subs[4]: Group( [ (1,4)(2,3) ] ) subs[2]: Group( [ (1,2)(3,4) ] ), subs[9]: Group( [ (1,3)(2,4), (1,2)(3,4) ] ) subs[3]: Group( [ (1,3)(2,4) ] ), subs[4]: Group( [ (1,4)(2,3) ] ) subs[3]: Group( [ (1,3)(2,4) ] ), subs[9]: Group( [ (1,3)(2,4), (1,2)(3,4) ] ) subs[4]: Group( [ (1,4)(2,3) ] ), subs[9]: Group( [ (1,3)(2,4), (1,2)(3,4) ] ) subs[5]: Group( [ (2,4,3) ] ), subs[9]: Group( [ (1,3)(2,4), (1,2)(3,4) ] ) subs[6]: Group( [ (1,2,3) ] ), subs[9]: Group( [ (1,3)(2,4), (1,2)(3,4) ] ) subs[7]: Group( [ (1,4,2) ] ), subs[9]: Group( [ (1,3)(2,4), (1,2)(3,4) ] ) subs[8]: Group( [ (1,3,4) ] ), subs[9]: Group( [ (1,3)(2,4), (1,2)(3,4) ] ) 10 distinct, nontrivial pairs of permuting subgroups. 10 ------------------------------------------------------------------------------------------------------------------------ Sincerely, Sandeep. On 8 Mar 2012, at 05:07, Vipul Naik wrote: > 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 _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum