(* (c) Copyright 2006-2016 Microsoft Corporation and Inria.                  *)
(* Distributed under the terms of CeCILL-B.                                  *)
From mathcomp
From mathcomp
From mathcomp
(******************************************************************************)
(*  Definitions of the symmetric and alternate groups, and some properties.   *)
(*     'Sym_T == The symmetric group over type T (which must have a finType   *)
(*               structure).                                                  *)
(*            := [set: {perm T}]                                              *)
(*     'Alt_T == The alternating group over type T.                           *)
(******************************************************************************)
Unset Printing Implicit Defensive.
Set Implicit Arguments.
Unset Strict Implicit.
Definition bool_groupMixin := FinGroup.Mixin addbA addFb addbb.
Canonical bool_baseGroup := Eval hnf in BaseFinGroupType bool bool_groupMixin.
Canonical boolGroup := Eval hnf in FinGroupType addbb.
Section SymAltDef.
Variable T : finType.
Implicit Types (s : {perm T}) (x y z : T).
(** Definitions of the alternate groups and some Properties **)
Definition Sym of phant T : {set {perm T}} := setT.
Canonical Sym_group phT := Eval hnf in [group of Sym phT].
Local Notation "'Sym_T" := (Sym (Phant T)) (at level 0).
Canonical sign_morph := @Morphism _ _ 'Sym_T _ (in2W (@odd_permM _)).
Definition Alt of phant T := 'ker (@odd_perm T).
Canonical Alt_group phT := Eval hnf in [group of Alt phT].
Local Notation "'Alt_T" := (Alt (Phant T)) (at level 0).

(* Specifications: *)
Lemma Alt_even p : (p \in 'Alt_T) = ~~ p.
Lemma card_Sym : #|'Sym_T| = n`!.
Lemma card_Alt : 1 < n -> (2 * #|'Alt_T|)%N = n`!.
Lemma Sym_trans : [transitive^n 'Sym_T, on setT | 'P].
Lemma Alt_trans : [transitive^n.-2 'Alt_T, on setT | 'P].
Lemma aperm_faithful (A : {group {perm T}}) : [faithful A, on setT | 'P].
End SymAltDef.