End ExtremalClass.

(* Specifications: *)
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)]].
(* This is Aschbacher (23.4).  *)
Lemma maximal_cycle_extremal gT p (G X : {group gT}) :
p.-group G -> ~~ abelian G -> cyclic X -> X \subset G -> #|G : X| = p ->
(extremal_class G == ModularGroup) || (p == 2) && extremal2 G.
(* This is Aschbacher (23.5) *)
Lemma cyclic_SCN gT p (G U : {group gT}) :
p.-group G -> U \in 'SCN(G) -> ~~ abelian G -> cyclic U ->
[/\ p = 2, #|G : U| = 2 & extremal2 G]
\/ exists M : {group gT},
[/\ M :=: 'C_G('Mho^1(U)), #|M : U| = p, extremal_class M = ModularGroup,
'Ohm_1(M)%G \in 'E_p^2(G) & 'Ohm_1(M) \char G].
(* This is Aschbacher, exercise (8.4) *)
Lemma normal_rank1_structure gT p (G : {group gT}) :
p.-group G -> (forall X : {group gT}, X <| G -> abelian X -> cyclic X) ->
cyclic G \/ [&& p == 2, extremal2 G & (#|G| >= 16) || (G \isog 'Q_8)].
(* Replacement for Section 4 proof. *)
Lemma odd_pgroup_rank1_cyclic gT p (G : {group gT}) :
p.-group G -> odd #|G| -> cyclic G = ('r_p(G) <= 1).
(* This is the second part of Aschbacher, exercise (8.4). *)
Lemma prime_Ohm1P gT p (G : {group gT}) :
p.-group G -> G :!=: 1 ->
reflect (#|'Ohm_1(G)| = p)
(cyclic G || (p == 2) && (extremal_class G == Quaternion)).
(* This is Aschbacher (23.9) *)
Theorem symplectic_type_group_structure gT p (G : {group gT}) :
p.-group G -> (forall X : {group gT}, X \char G -> abelian X -> cyclic X) ->
exists2 E : {group gT}, E :=: 1 \/ extraspecial E
& exists R : {group gT},
[/\ cyclic R \/ [/\ p = 2, extremal2 R & #|R| >= 16],
E \* R = G
& E :&: R = 'Z(E)].