GAP:IsRetract

Function type
The function takes as input two groups, both of which are subgroups of a common big group, and outputs a boolean (true/false).

Behavior
The behavior is as follows:


 * If the second group is not a subgroup of the first group, the function returns false.
 * If the second group is a retract of the first group, i.e., it possesses a normal complement, the function returns true.
 * If the second group is a subgroup of the first, but is not a retract, the function returns false.

Code
This code works only for finite groups:

IsRetract := function(G,H) return(IsSubgroup(G,H) and ForAny(NormalSubgroups(G),L -> Order(L) * Order(H) = Order(G) and IsTrivial(Intersection(H,L)))); end;;