Section ExtremalClass.
Variables (gT : finGroupType) (G : {group gT}).
Inductive extremal_group_type :=
ModularGroup | Dihedral | SemiDihedral | Quaternion | NotExtremal.
Definition index_extremal_group_type c :=
match c with
| ModularGroup => 0
| Dihedral => 1
| SemiDihedral => 2
| Quaternion => 3
| NotExtremal => 4
end%N.
Definition enum_extremal_groups :=
[:: ModularGroup; Dihedral; SemiDihedral; Quaternion].
End ExtremalClass.

Theorem extremal2_structure (gT : finGroupType) (G : {group gT}) n x y :
let cG := extremal_class G in
let m := (2 ^ n)%N in let q := (2 ^ n.-1)%N in let r := (2 ^ n.-2)%N in
let X := <[x]> in let yG := y ^: G in let xyG := (x * y) ^: G in
let My := <<yG>> in let Mxy := <<xyG>> in
extremal_generators G 2 n (x, y) ->
extremal2 G -> (cG == SemiDihedral) ==> (#[y] == 2) ->
[/\ [/\ (if cG == Quaternion then pprod X <[y]> else X ><| <[y]>) = G,
if cG == SemiDihedral then #[x * y] = 4 else
{in G :\: X, forall z, #[z] = (if cG == Dihedral then 2 else 4)},
if cG != Quaternion then True else
{in G, forall z, #[z] = 2 -> z = x ^+ r}
& {in X & G :\: X, forall t z,
t ^ z = (if cG == SemiDihedral then t ^+ r.-1 else t^-1)}],
[/\ G ^`(1) = <[x ^+ 2]>, 'Phi(G) = G ^`(1), #|G^`(1)| = r
& nil_class G = n.-1],
[/\ if n > 2 then 'Z(G) = <[x ^+ r]> /\ #|'Z(G)| = 2 else 2.-abelem G,
'Ohm_1(G) = (if cG == Quaternion then <[x ^+ r]> else
if cG == SemiDihedral then My else G),
'Ohm_2(G) = G
& forall k, k > 0 -> 'Mho^k(G) = <[x ^+ (2 ^ k)]>],
[/\ yG :|: xyG = G :\: X, [disjoint yG & xyG]
& forall H : {group gT}, maximal H G = (gval H \in pred3 X My Mxy)]
& if n <= (cG == Quaternion) + 2 then True else
[/\ forall U, cyclic U -> U \subset G -> #|G : U| = 2 -> U = X,
if cG == Quaternion then My \isog 'Q_q else My \isog 'D_q,
extremal_class My = (if cG == Quaternion then cG else Dihedral),
if cG == Dihedral then Mxy \isog 'D_q else Mxy \isog 'Q_q
& extremal_class Mxy = (if cG == Dihedral then cG else Quaternion)]].