diff --git a/gap/LINS.gd b/gap/LINS.gd index 3b87e4b..92c97ef 100644 --- a/gap/LINS.gd +++ b/gap/LINS.gd @@ -264,11 +264,3 @@ DeclareGlobalFunction( "LINS_FindPModules" ); DeclareGlobalFunction( "LINS_MustCheckP" ); DeclareGlobalFunction( "LINS_FindIntersections" ); - - -############################################################################# -## helper function -############################################################################# - -DeclareGlobalFunction( "LINS_IsSubgroupFp" ); -DeclareGlobalFunction( "LINS_SetParent" ); diff --git a/gap/LINS.gi b/gap/LINS.gi index 6974da7..62138f1 100644 --- a/gap/LINS.gi +++ b/gap/LINS.gi @@ -184,6 +184,7 @@ function(gr) fi; end); + ############################################################################# ####=====================================================================#### ## diff --git a/gap/addGroup.gi b/gap/addGroup.gi index 1c4aa9f..453c75f 100644 --- a/gap/addGroup.gi +++ b/gap/addGroup.gi @@ -23,7 +23,7 @@ ## We need coset tables of both `H` and `G` in the parent `P`. ############################################################################# -InstallGlobalFunction(LINS_IsSubgroupFp, function(G, H) +BindGlobal("LINS_IsSubgroupFp", function(G, H) local word; for word in AugmentedCosetTableInWholeGroup(H).primaryGeneratorWords do @@ -44,7 +44,7 @@ end); ## Sets parent and attributes for normal subgroup `H` of `G`. ############################################################################# -InstallGlobalFunction(LINS_SetParent, +BindGlobal("LINS_SetParent", function(H, G) SetParent(H, G); SetIsNormalInParent(H, true); @@ -135,8 +135,8 @@ InstallGlobalFunction(LINS_AddGroup, function(gr, H, Supers, test, opts) local G, # group: located in the root node # of LINS graph `gr`. - rH, # LINS node: containing `H` n, # pos-int: index bound of LINS graph `gr`. + rH, # LINS node: containing `H` allSupergroups, # [LINS node]: supergroups of `rH` allSubgroups, # [LINS node]: subgroups of `rH` pos, # pos-int: position of level at index $[G : H]$ @@ -146,6 +146,11 @@ InstallGlobalFunction(LINS_AddGroup, function(gr, H, Supers, test, opts) K; # group: located in node `rK` G := Grp(LinsRoot(gr)); + + if opts.DoSetParent then + LINS_SetParent(H, G); + fi; + rH := LinsNode(H, Index(G, H)); # Search for correct level diff --git a/gap/findTQuotients.gi b/gap/findTQuotients.gi index 4120d92..e7adad8 100644 --- a/gap/findTQuotients.gi +++ b/gap/findTQuotients.gi @@ -13,50 +13,6 @@ ############################################################################# -BindGlobal("Terminate", MakeImmutable("Terminate")); - -# Terminate, if we found sufficient enough groups -# true, if K is a new group -# false, if K was already found beforehand -BindGlobal("LINS_AddGroup_Caller", -function(gr, rH, K, opts, infoText) - local - G, # group: located in the root node of the LINS graph `gr`. - n, # pos-int: index bound of LINS graph `gr`. - data, # tuple: [`rK`, `isNew`] - rK, # LINS node: containing group `K` - isNew; # boolean: whether the group `K` is new in `gr` - - G := Grp(LinsRoot(gr)); - n := IndexBound(gr); - - if opts.DoSetParent then - LINS_SetParent(K, G); - fi; - - if Index(G, K) <= n then - data := LINS_AddGroup(gr, K, [rH], true, opts); - rK := data[1]; - isNew := data[2]; - - if isNew then - Info(InfoLINS, 3, LINS_tab3, infoText, - "Found new normal subgroup ", LINS_red, "K = ", K, LINS_reset, - " of index ", LINS_red, Index(G, K), LINS_reset, "."); - - if opts.DoTerminate(gr, rH, rK) then - gr!.TerminatedUnder := rH; - gr!.TerminatedAt := rK; - return Terminate; - else - return true; - fi; - fi; - fi; - - return false; -end); - ############################################################################# ## LINS_FindTQuotients ############################################################################# @@ -149,8 +105,10 @@ InstallGlobalFunction( LINS_FindTQuotients, function(gr, opts) homs, # [hom]: list of homomorphisms into `Q` hom, # hom: loop var, homomorphism in `L` from `H` into `Q` K, # group: normal subgroup of `G` (with Q-quotient) - data, # state: bool or Terminate - nrFound; # pos-int: number of newly found normal subgroups + rK, # LINS node: containing `K` + isNew, # boolean: whether the group `K` is new in `gr` + nrFound, # pos-int: number of newly found normal subgroups + data; # tuple: [`rK`, `isNew`] # Initialize data from input. rG := LinsRoot(gr); @@ -189,11 +147,19 @@ InstallGlobalFunction( LINS_FindTQuotients, function(gr, opts) for L in LL do if Position(I, Index(G, L)) <> fail then K := Core(G, L); - data := LINS_AddGroup_Caller(gr, rG, K, opts, ""); - if data = true then + data := LINS_AddGroup(gr, K, [rG], true, opts); + rK := data[1]; + isNew := data[2]; + if isNew then nrFound := nrFound + 1; - elif data = Terminate then - return [true, nrFound + 1]; + Info(InfoLINS, 3, LINS_tab3, + "Found new normal subgroup ", LINS_red, "K = ", K, LINS_reset, + " of index ", LINS_red, Index(G, K), LINS_reset, "."); + fi; + if isNew and opts.DoTerminate(gr, rG, rK) then + gr!.TerminatedUnder := rG; + gr!.TerminatedAt := rK; + return [true, nrFound]; fi; fi; od; @@ -203,11 +169,19 @@ InstallGlobalFunction( LINS_FindTQuotients, function(gr, opts) homs := GQuotients(H, Q); for hom in homs do K := Image(iso, Kernel(hom)); - data := LINS_AddGroup_Caller(gr, rG, K, opts, ""); - if data = true then + data := LINS_AddGroup(gr, K, [rG], true, opts); + rK := data[1]; + isNew := data[2]; + if isNew then nrFound := nrFound + 1; - elif data = Terminate then - return [true, nrFound + 1]; + Info(InfoLINS, 3, LINS_tab3, + "Found new normal subgroup ", LINS_red, "K = ", K, LINS_reset, + " of index ", LINS_red, Index(G, K), LINS_reset, "."); + fi; + if isNew and opts.DoTerminate(gr, rG, rK) then + gr!.TerminatedUnder := rG; + gr!.TerminatedAt := rK; + return [true, nrFound]; fi; od; od;