needs "Library/prime.ml";;
needs "Examples/seq-compiled.hl";;
open Ssrfun;;
open Ssrbool;;
open Ssrnat;;
open Seq;;
let group = new_definition `group (G,op,i,e) <=> (!x y. x IN G /\ y IN G ==> op x y IN G) /\
(!x. x IN G ==> i x IN G) /\ e IN G /\
(!x. x IN G ==> op x e = x /\ op e x = x) /\
(!x. x IN G ==> op x (i x) = e /\ op (i x) x = e) /\
(!x y z. x IN G /\ y IN G /\ z IN G ==> op x (op y z) = op (op x y) z)`;;
(* Lemma inE *)
let inE = Sections.section_proof []
`(!p x. x IN {y | p y} <=> p x) /\
(!P x. x IN GSPEC (\v. P (SETSPEC v)) <=> P (\p t. p /\ x = t))`
[
((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac));
];;
(* Lemma in_trans *)
let in_trans = Sections.section_proof ["t";"A";"B"]
`A SUBSET B ==> t IN A ==> t IN B`
[
((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (exact_tac) THEN (done_tac));
];;
(* Lemma coset_op *)
let coset_op = Sections.section_proof ["op";"x";"H"]
`coset op x H = set_op op {x} H`
[
((((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (split_tac));
(BETA_TAC THEN (case THEN ((move ["z"]) THEN (case THEN ((move ["zH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))));
((((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("z", [])) (term_tac exists_tac))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["z"])) THEN (case THEN (move ["t"])) THEN (case THEN ((case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["tH"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma set_op1_sing *)
let set_op1_sing = Sections.section_proof ["f";"x"]
`set_op1 f {x} = {f x}`
[
((((((use_arg_then2 ("set_op1", [set_op1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN (move ["a"])) THEN (split_tac));
((BETA_TAC THEN (case THEN (move ["b"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac));
((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma set_op1_lmul *)
let set_op1_lmul = Sections.section_proof ["g";"op"]
`set_op1 (op g) = set_op op {g}`
[
((((((use_arg_then2 ("set_op1", [set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["S"]) THEN (move ["a"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xS"]) THEN (move ["a_eq"]))));
((((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xg"]) THEN (move ["yS"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("yS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma coset_op1 *)
let coset_op1 = Sections.section_proof ["op";"x";"H"]
`coset (op:A->A->A) x H = set_op1 (op x) H`
[
(((((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("coset_op", [coset_op]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma normal_conj *)
let normal_conj = Sections.section_proof ["op";"i";"G";"H";"x";"y"]
`normal op i H G /\ x IN G /\ y IN H ==> conjg (op, i) x y IN H`
[
(((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma normal_subgroup *)
let normal_subgroup = Sections.section_proof ["op";"i";"H";"G"]
`normal op i H G ==> subgroup op i H G`
[
(((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma in_subgroup *)
let in_subgroup = Sections.section_proof ["op";"i";"H";"G";"x"]
`subgroup op i H G ==> x IN H ==> x IN G`
[
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma subgroup_subset *)
let subgroup_subset = Sections.section_proof ["op";"i";"H";"G"]
`subgroup op i H G ==> H SUBSET G`
[
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma subgroup_subset_trans *)
let subgroup_subset_trans = Sections.section_proof ["op";"i";"H";"K";"G"]
`subgroup op i H G ==> H SUBSET K ==> subgroup op i H K`
[
(((repeat_tactic 1 9 (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma normal_subset_trans *)
let normal_subset_trans = Sections.section_proof ["op";"i";"H";"K";"G"]
`normal op i H G ==> H SUBSET K ==> K SUBSET G ==> normal op i H K`
[
(((repeat_tactic 1 9 (((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [(`K SUBSET G`)]))))) THEN ALL_TAC THEN (case THEN (move ["subHG"])) THEN (move ["nH"]) THEN (move ["sHK"]) THEN (move ["sKG"]));
(((((fun arg_tac -> (use_arg_then2 ("subgroup_subset_trans", [subgroup_subset_trans])) (fun fst_arg -> (use_arg_then2 ("subHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["h"]) THEN (case THEN ((move ["kK"]) THEN (move ["hH"]))));
(((((use_arg_then2 ("nH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sKG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma cosets_full_preimage_sub *)
let cosets_full_preimage_sub = Sections.section_proof ["op";"G";"H";"K"]
`K SUBSET G ==> K SUBSET {g | g IN G /\ coset op g H IN (cosets op K H)}`
[
(((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))))) THEN (BETA_TAC THEN (move ["sKG"])) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["k"]) THEN (move ["kK"])));
(((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("sKG", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma op_in_coset *)
let op_in_coset = Sections.section_proof ["op";"k";"x";"K"]
`k IN K ==> op x k IN coset op x K`
[
((BETA_TAC THEN (move ["kK"])) THEN ((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma eqxx *)
let eqxx = Sections.section_proof ["x"]
`x = x <=> T`
[
((ALL_TAC) THEN (done_tac));
];;
let divides = GEN_ALL divides;;
(* Lemma set_op_sing *)
let set_op_sing = Sections.section_proof ["a";"b";"op"]
`set_op op {a} {b} = {op a b}`
[
((((((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN (move ["x"])) THEN (split_tac));
((BETA_TAC THEN (case THEN (move ["z"])) THEN (case THEN (move ["y"])) THEN (case THEN ((case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac));
((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("b", [])) (term_tac exists_tac))) THEN (done_tac));
];;
(* Lemma in_set_op1 *)
let in_set_op1 = Sections.section_proof ["f";"S";"x"]
`x IN set_op1 f S <=> ?s. s IN S /\ x = f s`
[
(((((use_arg_then2 ("set_op1", [set_op1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma in_set_op *)
let in_set_op = Sections.section_proof ["f";"S1";"S2";"x"]
`x IN set_op f S1 S2 <=> ?s1 s2. s1 IN S1 /\ s2 IN S2 /\ x = f s1 s2`
[
(((((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("CONJ_ASSOC", [CONJ_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conjg_set_alt *)
let conjg_set_alt = Sections.section_proof ["op";"i";"g";"S"]
`set_op1 (conjg (op, i) g) S = set_op1 (op (i g)) (set_op op S {g})`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (move ["x_eq"]));
(((fun arg_tac -> arg_tac (Arg_term (`op s g`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (move ["s2_eq"])) THEN (move ["s_eq"]) THEN (move ["x_eq"]));
(((use_arg_then2 ("s1", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_op1_eq_image *)
let set_op1_eq_image = Sections.section_proof ["f";"S"]
`set_op1 f S = IMAGE f S`
[
(((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL CONJ_ACI)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_op_eq_union *)
let set_op_eq_union = Sections.section_proof ["f";"S1";"S2"]
`set_op f S1 S2 = UNIONS {IMAGE (f x) S2 | x | x IN S1}`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (move ["s2S"])) THEN (move ["x_eq"]));
(((THENL) (((fun arg_tac -> arg_tac (Arg_term (`IMAGE (f s1) S2`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) [((use_arg_then2 ("s1", [])) (term_tac exists_tac)); ((use_arg_then2 ("s2", [])) (term_tac exists_tac))]) THEN (done_tac));
((BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s1S"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s2"])) THEN (case THEN (move ["x_eq"])) THEN (move ["s2S"])));
((((use_arg_then2 ("s1", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("s2", [])) (term_tac exists_tac))) THEN (done_tac));
];;
(* Lemma set_op_eq_image *)
let set_op_eq_image = Sections.section_proof ["f";"S";"y"]
`set_op f S {y} = IMAGE (\x. f x y) S`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((use_arg_then2 ("s1", [])) (term_tac exists_tac)) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["sS"]));
((((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac))) THEN (done_tac));
];;
(* Section Groups *)
Sections.begin_section "Groups";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("op", (`:A -> A -> A`))));;
(Sections.add_section_var (mk_var ("i", (`:A -> A`))));;
(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));;
(* Lemma e_in_group *)
let e_in_group = Sections.section_proof []
`e IN G`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma in_group *)
let in_group = Sections.section_proof ["x";"y"]
`x IN G ==> y IN G ==> op x y IN G`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma i_in_group *)
let i_in_group = Sections.section_proof ["x"]
`x IN G ==> i x IN G`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma mul1g *)
let mul1g = Sections.section_proof ["x"]
`x IN G ==> op e x = x`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma mulg1 *)
let mulg1 = Sections.section_proof ["x"]
`x IN G ==> op x e = x`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma mulIg *)
let mulIg = Sections.section_proof ["x"]
`x IN G ==> op (i x) x = e`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma mulgI *)
let mulgI = Sections.section_proof ["x"]
`x IN G ==> op x (i x) = e`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma mulgA *)
let mulgA = Sections.section_proof ["x";"y";"z"]
`x IN G ==> y IN G ==> z IN G ==> op x (op y z) = op (op x y) z`
[
((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma mulgK *)
let mulgK = Sections.section_proof ["x";"y"]
`x IN G ==> y IN G ==> op (op x y) (i y) = x`
[
((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"])) THEN ((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma mulKg *)
let mulKg = Sections.section_proof ["x";"y"]
`x IN G ==> y IN G ==> op (op x (i y)) y = x`
[
((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"])) THEN ((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma i_uniq *)
let i_uniq = Sections.section_proof ["x";"y"]
`x IN G ==> y IN G ==> op x y = e ==> y = i x`
[
(BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["eq"]));
((fun arg_tac -> arg_tac (Arg_term (`op (op (i x) x) y = op (i x) e`))) (term_tac (have_gen_tac []ALL_TAC)));
(((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("yG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (done_tac));
(((((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma invgK *)
let invgK = Sections.section_proof ["x"]
`x IN G ==> i (i x) = x`
[
((BETA_TAC THEN (move ["xG"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[IMP_IMP] i_uniq))) (disch_tac [])) THEN (DISCH_THEN apply_tac)));
(((((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma invg1 *)
let invg1 = Sections.section_proof []
`i e = e`
[
(((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i e`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma mulI *)
let mulI = Sections.section_proof ["x";"y"]
`x IN G ==> y IN G ==> i (op x y) = op (i y) (i x)`
[
((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_uniq", [i_uniq])) (disch_tac [])) THEN (clear_assumption "i_uniq") THEN (DISCH_THEN apply_tac)));
(((repeat_tactic 1 9 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgK", [mulgK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma mulg_leftI *)
let mulg_leftI = Sections.section_proof ["x";"y";"z"]
`x IN G ==> y IN G ==> z IN G ==> op x y = op x z ==> y = z`
[
(BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"]) THEN (move ["eq"]));
(((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma mulg_rightI *)
let mulg_rightI = Sections.section_proof ["x";"y";"z"]
`x IN G ==> y IN G ==> z IN G ==> op y x = op z x ==> y = z`
[
(BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"]) THEN (move ["eq"]));
(((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(gsym_then (thm_tac (new_rewrite [] [(`z`)]))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma mulg_left *)
let mulg_left = Sections.section_proof ["x";"y";"z"]
`x IN G ==> y IN G ==> z IN G ==> (op x y = z <=> x = op z (i y))`
[
((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"])) THEN ((THENL) (split_tac) [(move ["opxy"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]));
(((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma mulg_right *)
let mulg_right = Sections.section_proof ["x";"y";"z"]
`x IN G ==> y IN G ==> z IN G ==> (op x y = z <=> y = op (i x) z)`
[
((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"])) THEN ((THENL) (split_tac) [(move ["opxy"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]));
(((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma invg_e *)
let invg_e = Sections.section_proof []
`i e = e`
[
((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_uniq", [i_uniq])) (disch_tac [])) THEN (clear_assumption "i_uniq") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma subgroup_alt *)
let subgroup_alt = Sections.section_proof ["H"]
`subgroup op i H G <=>
H SUBSET G /\ ~(H = {}) /\ (!x y. x IN H ==> y IN H ==> op x y IN H) /\
(!x. x IN H ==> i x IN H)`
[
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["subHG"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))));
(((((use_arg_then2 ("subHG", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (BETA_TAC THEN (move ["h"])));
((fun arg_tac -> arg_tac (Arg_term (`x IN H ==> i x IN H`))) (term_tac (have_gen_tac ["x"](move ["ixH"]))));
(BETA_TAC THEN (move ["xH"]));
((fun arg_tac -> (use_arg_then2 ("subHG", [])) (fun fst_arg -> (use_arg_then2 ("xH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["xG"])));
(((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("ixH", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (move ["x"]) THEN (move ["y"]) THEN (move ["xH"]) THEN (move ["yH"]));
(((fun arg_tac -> (use_arg_then2 ("subHG", [])) (fun fst_arg -> (use_arg_then2 ("xH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["xG"]))) THEN ((fun arg_tac -> (use_arg_then2 ("subHG", [])) (fun fst_arg -> (use_arg_then2 ("yH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["yG"]))));
(((((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ixH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma subgroup_group *)
let subgroup_group = Sections.section_proof ["H"]
`subgroup op i H G ==> group (H, op, i, e)`
[
(((use_arg_then2 ("grG", [])) (disch_tac [])) THEN BETA_TAC);
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["opG"])) THEN (case THEN (move ["iG"])) THEN (case THEN (move ["eG"])) THEN (case THEN (move ["idG"])) THEN (case THEN ((move ["invG"]) THEN (move ["aG"]))) THEN (case THEN (move ["sHG"])) THEN (case THEN ((move ["nH"]) THEN (move ["op_iH"]))));
((fun arg_tac -> arg_tac (Arg_term (`e IN H`))) (term_tac (have_gen_tac [](move ["eH"]))));
((((use_arg_then2 ("nH", [])) (disch_tac [])) THEN (clear_assumption "nH") THEN BETA_TAC) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["x"]) THEN (move ["xH"])))));
(((((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("op_iH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`y IN H ==> i y IN H`))) (term_tac (have_gen_tac ["y"](move ["iH"]))));
(BETA_TAC THEN (move ["yH"]));
(((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("op_iH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(repeat_tactic 0 6 (((split_tac) THEN ((TRY done_tac)))));
((BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xH"]) THEN (move ["yH"])))) THEN ((((use_arg_then2 ("invgK", [invgK]))(gsym_then (thm_tac (new_rewrite [] [(`y`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("op_iH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((BETA_TAC THEN (move ["x"]) THEN (move ["xH"])) THEN (((use_arg_then2 ("idG", [])) (disch_tac [])) THEN (clear_assumption "idG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((BETA_TAC THEN (move ["x"]) THEN (move ["xH"])) THEN (((use_arg_then2 ("invG", [])) (disch_tac [])) THEN (clear_assumption "invG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (move ["z"]) THEN (case THEN (move ["xH"])) THEN (case THEN ((move ["yH"]) THEN (move ["zH"]))));
((((use_arg_then2 ("aG", [])) (disch_tac [])) THEN (clear_assumption "aG") THEN (DISCH_THEN apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma subgroup_e *)
let subgroup_e = Sections.section_proof []
`subgroup op i {e} G`
[
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma set_opK *)
let set_opK = Sections.section_proof []
`set_op op G G = G`
[
((((((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["x'"])) THEN (case THEN (move ["y"])) THEN (case THEN ((case THEN ((move ["xG"]) THEN (move ["yG"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(BETA_TAC THEN (move ["xG"]));
((((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma normal_conj2 *)
let normal_conj2 = Sections.section_proof ["H";"x";"y"]
`normal op i H G ==> x IN G ==> y IN H ==>
op x (op y (i x)) IN H`
[
(((DISCH_THEN (fun snd_th -> (use_arg_then2 ("normal_conj", [normal_conj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (move ["conj"]) THEN (move ["xG"]) THEN (move ["yH"])));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("conj", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
(((((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("yH", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_opA *)
let set_opA = Sections.section_proof ["A";"B";"C"]
`A SUBSET G ==> B SUBSET G ==> C SUBSET G ==>
set_op op A (set_op op B C) = set_op op (set_op op A B) C`
[
((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["AG"]) THEN (move ["BG"]) THEN (move ["CG"]));
((((repeat_tactic 1 9 (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (simp_tac)) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["u"])) THEN (case THEN (case THEN (move ["aA"]))) THEN (case THEN (move ["b"])) THEN (case THEN (move ["c"])) THEN (case THEN ((case THEN ((move ["bB"]) THEN (move ["cC"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["x_eq"]));
(((fun arg_tac -> arg_tac (Arg_term (`op a b`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("c", [])) (term_tac exists_tac)));
((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("AG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("BG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("CG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cC", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
((((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("b", [])) (term_tac exists_tac))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["c"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN ((case THEN ((move ["aA"]) THEN (move ["bB"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["cC"]) THEN (move ["x_eq"]));
(((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`op b c`))) (term_tac exists_tac)));
((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("AG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("BG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("aA", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
((((use_arg_then2 ("b", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("c", [])) (term_tac exists_tac))) THEN (done_tac));
];;
(* Lemma coset_subset *)
let coset_subset = Sections.section_proof ["x";"S"]
`x IN G ==> S SUBSET G ==> coset op x S SUBSET G`
[
((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["xG"]) THEN (move ["SG"]));
((((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (case THEN ((move ["zS"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
(((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma coset_e *)
let coset_e = Sections.section_proof ["S"]
`S SUBSET G ==> coset op e S = S`
[
((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sSG"]));
(((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac));
((BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN ((move ["yH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((BETA_TAC THEN (move ["xH"])) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma coset_eq_e *)
let coset_eq_e = Sections.section_proof ["g"]
`g IN G ==> coset op g G = G`
[
((((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["gG"]) THEN (move ["g'"])) THEN ((THENL) (split_tac) [ALL_TAC; (move ["g'G"])]));
((BETA_TAC THEN (case THEN (move ["h"])) THEN (case THEN (move ["hG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`op (i g) g'`))) (term_tac exists_tac));
(((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma left_mul_coset *)
let left_mul_coset = Sections.section_proof ["g";"h";"S"]
`g IN G ==> h IN G ==> S SUBSET G ==>
set_op1 (op g) (coset op h S) = coset op (op g h) S`
[
(BETA_TAC THEN (move ["gG"]) THEN (move ["hG"]) THEN (move ["sSG"]));
((((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("coset_op", [coset_op]))(thm_tac (new_rewrite [] []))))));
((((use_arg_then2 ("set_opA", [set_opA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((use_arg_then2 ("congr2", [congr2])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac));
((BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN ALL_TAC) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac));
((BETA_TAC THEN (move ["x_eq"])) THEN (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac))) THEN (done_tac));
];;
(* Lemma set_lmul_subset *)
let set_lmul_subset = Sections.section_proof ["g";"S"]
`g IN G ==> S SUBSET G ==> set_op1 (op g) S SUBSET G`
[
(((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["x"]) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_rmul_subset *)
let set_rmul_subset = Sections.section_proof ["g";"S"]
`g IN G ==> S SUBSET G ==> set_op op S {g} SUBSET G`
[
(((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["x"]) THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_lmul_has_size *)
let set_lmul_has_size = Sections.section_proof ["g";"S";"n"]
`g IN G ==> S SUBSET G ==> S HAS_SIZE n ==> set_op1 (op g) S HAS_SIZE n`
[
(BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"]));
((((use_arg_then2 ("set_op1_eq_image", [set_op1_eq_image]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("sizeS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xS"])) THEN (case THEN (move ["yS"]))));
((((use_arg_then2 ("mulg_leftI", [mulg_leftI])) (disch_tac [])) THEN (clear_assumption "mulg_leftI") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma set_rmul_has_size *)
let set_rmul_has_size = Sections.section_proof ["g";"S";"n"]
`g IN G ==> S SUBSET G ==> S HAS_SIZE n ==> set_op op S {g} HAS_SIZE n`
[
(BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"]));
((((use_arg_then2 ("set_op_eq_image", [set_op_eq_image]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("sizeS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xS"])) THEN (case THEN (move ["yS"])) THEN (simp_tac)));
((((use_arg_then2 ("mulg_rightI", [mulg_rightI])) (disch_tac [])) THEN (clear_assumption "mulg_rightI") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma set_lmul_card *)
let set_lmul_card = Sections.section_proof ["g";"S"]
`g IN G ==> S SUBSET G ==> FINITE S ==> CARD (set_op1 (op g) S) = CARD S`
[
((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"]));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("set_lmul_has_size", [set_lmul_has_size])) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sizeS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
(((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_rmul_card *)
let set_rmul_card = Sections.section_proof ["g";"S"]
`g IN G ==> S SUBSET G ==> FINITE S ==> CARD (set_op op S {g}) = CARD S`
[
((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"]));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("set_rmul_has_size", [set_rmul_has_size])) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sizeS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
(((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_lrmul_card *)
let set_lrmul_card = Sections.section_proof ["g1";"g2";"S"]
`g1 IN G ==> g2 IN G ==> S SUBSET G ==> FINITE S ==>
CARD (set_op1 (op g1) S) = CARD (set_op op S {g2})`
[
((BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["finS"])) THEN ((((use_arg_then2 ("set_lmul_card", [set_lmul_card]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_card", [set_rmul_card]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_llmul_card *)
let set_llmul_card = Sections.section_proof ["g1";"g2";"S"]
`g1 IN G ==> g2 IN G ==> S SUBSET G ==> FINITE S ==>
CARD (set_op1 (op g1) S) = CARD (set_op1 (op g2) S)`
[
((BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["finS"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_lmul_card", [set_lmul_card]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_lmul1 *)
let set_lmul1 = Sections.section_proof ["S"]
`S SUBSET G ==> set_op1 (op e) S = S`
[
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["sSG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sS"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xS"])]));
(((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_rmul1 *)
let set_rmul1 = Sections.section_proof ["S"]
`S SUBSET G ==> set_op op S {e} = S`
[
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["sSG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (move ["xS"])]));
(((((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conjg_in *)
let conjg_in = Sections.section_proof ["x";"g"]
`g IN G ==> x IN G ==> conjg (op, i) g x IN G`
[
((BETA_TAC THEN (move ["gG"]) THEN (move ["xG"])) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma mul_conjg *)
let mul_conjg = Sections.section_proof ["x";"g1";"g2"]
`x IN G ==> g1 IN G ==> g2 IN G ==>
conjg (op, i) (op g1 g2) x = conjg (op, i) g2 (conjg (op, i) g1 x)`
[
((BETA_TAC THEN (move ["xG"]) THEN (move ["g1G"]) THEN (move ["g2G"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma conjg_mul *)
let conjg_mul = Sections.section_proof ["x";"y";"g"]
`x IN G ==> y IN G ==> g IN G ==>
conjg (op, i) g (op x y) = op (conjg (op, i) g x) (conjg (op, i) g y)`
[
((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["gG"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgK", [mulgK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma inv_conjg *)
let inv_conjg = Sections.section_proof ["x";"g"]
`g IN G ==> x IN G ==> i (conjg (op, i) g x) = conjg (op, i) g (i x)`
[
((BETA_TAC THEN (move ["gG"]) THEN (move ["xG"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma conj1g *)
let conj1g = Sections.section_proof ["x"]
`x IN G ==> conjg (op, i) e x = x`
[
((BETA_TAC THEN (move ["xG"])) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("invg1", [invg1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conjg1 *)
let conjg1 = Sections.section_proof ["g"]
`g IN G ==> conjg (op, i) g e = e`
[
((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conjg_inj *)
let conjg_inj = Sections.section_proof ["x";"y";"g"]
`x IN G ==> y IN G ==> g IN G ==>
(conjg (op, i) g x = conjg (op, i) g y <=> x = y)`
[
((THENL_LAST) ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["gG"])) THEN (split_tac)) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
(((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) (i g)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("mul_conjg", [mul_conjg]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("conj1g", [conj1g]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma conjg_set_subset *)
let conjg_set_subset = Sections.section_proof ["g";"S"]
`g IN G ==> S SUBSET G ==> set_op1 (conjg (op, i) g) S SUBSET G`
[
(BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]));
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["y"])) THEN (case THEN (move ["yS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("conjg_in", [conjg_in]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma conj1g_set *)
let conj1g_set = Sections.section_proof ["S"]
`S SUBSET G ==> set_op1 (conjg (op, i) e) S = S`
[
((BETA_TAC THEN (move ["sSG"])) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_rmul1", [set_rmul1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("invg1", [invg1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_lmul1", [set_lmul1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma mul_conjg_set *)
let mul_conjg_set = Sections.section_proof ["S";"g1";"g2"]
`g1 IN G ==> g2 IN G ==> S SUBSET G ==>
set_op1 (conjg (op, i) (op g1 g2)) S = set_op1 (conjg (op, i) g2) (set_op1 (conjg (op, i) g1) S)`
[
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))))) THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["x"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (move ["x_eq"]));
(((fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) g1 s`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul_conjg", [mul_conjg]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g1G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x_eq"]));
(((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul_conjg", [mul_conjg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g1G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma conjg_set_has_size *)
let conjg_set_has_size = Sections.section_proof ["S";"g";"n"]
`g IN G ==> S SUBSET G ==> S HAS_SIZE n ==>
set_op1 (conjg (op, i) g) S HAS_SIZE n`
[
(BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"]));
(((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_lmul_has_size", [set_lmul_has_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_subset", [set_rmul_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_has_size", [set_rmul_has_size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conjg_set_card *)
let conjg_set_card = Sections.section_proof ["S";"g"]
`g IN G ==> S SUBSET G ==> FINITE S ==>
CARD (set_op1 (conjg (op, i) g) S) = CARD S`
[
((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"]));
((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("conjg_set_has_size", [conjg_set_has_size])) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sizeS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conjg_set_card2 *)
let conjg_set_card2 = Sections.section_proof ["S";"g1";"g2"]
`g1 IN G ==> g2 IN G ==> S SUBSET G ==> FINITE S ==>
CARD (set_op1 (conjg (op, i) g1) S) = CARD (set_op1 (conjg (op, i) g2) S)`
[
((BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["finS"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("conjg_set_card", [conjg_set_card]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conjg_set_equiv *)
let conjg_set_equiv = Sections.section_proof ["S";"U";"g"]
`g IN G ==> S SUBSET G ==> U SUBSET G ==>
((set_op1 (conjg (op, i) g) S) = U <=> set_op op S {g} = set_op1 (op g) U)`
[
((BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sUG"])) THEN (split_tac));
((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_opA", [set_opA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("set_rmul_subset", [set_rmul_subset]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
(((((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_lmul1", [set_lmul1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_subset", [set_rmul_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`set_op1 (op (i g))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
(((repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_opA", [set_opA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_lmul1", [set_lmul1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_mulI *)
let set_mulI = Sections.section_proof ["S";"U"]
`S SUBSET G ==> U SUBSET G ==>
set_op1 i (set_op op S U) = set_op op (set_op1 i U) (set_op1 i S)`
[
((((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] []))))) THEN (move ["sSG"]) THEN (move ["sUG"]) THEN (move ["x"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["u"])) THEN (case THEN (move ["sS"])) THEN (case THEN (move ["uU"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
((((fun arg_tac -> arg_tac (Arg_term (`i u`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`i s`))) (term_tac exists_tac))) THEN ((((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sUG", [])) (fun fst_arg -> (use_arg_then2 ("uU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
(((THENL) (split_tac) [((use_arg_then2 ("u", [])) (term_tac exists_tac)); ((use_arg_then2 ("s", [])) (term_tac exists_tac))]) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u"])) THEN (case THEN (move ["uU"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x_eq"]));
(((fun arg_tac -> arg_tac (Arg_term (`op s u`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sUG", [])) (fun fst_arg -> (use_arg_then2 ("uU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
((((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac))) THEN (done_tac));
];;
(* Lemma set_invgK *)
let set_invgK = Sections.section_proof ["S"]
`S SUBSET G ==> set_op1 i (set_op1 i S) = S`
[
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))))) THEN (move ["sSG"]) THEN (move ["x"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((BETA_TAC THEN (move ["xS"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`i x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma group_invK *)
let group_invK = Sections.section_proof []
`set_op1 i G = G`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xG"])]));
((((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((fun arg_tac -> arg_tac (Arg_term (`i x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma group_lmulK *)
let group_lmulK = Sections.section_proof ["g"]
`g IN G ==> set_op1 (op g) G = G`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xG"])]));
((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`op (i g) x`))) (term_tac exists_tac));
(((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma group_rmulK *)
let group_rmulK = Sections.section_proof ["g"]
`g IN G ==> set_op op G {g} = G`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["aG"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (move ["xG"])]));
((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((fun arg_tac -> arg_tac (Arg_term (`op x (i g)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac)));
(((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma group_conjgK *)
let group_conjgK = Sections.section_proof ["g"]
`g IN G ==> set_op1 (conjg (op, i) g) G = G`
[
((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("group_rmulK", [group_rmulK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("group_lmulK", [group_lmulK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Finalization of the section Groups *)
let e_in_group = Sections.finalize_theorem e_in_group;;
let in_group = Sections.finalize_theorem in_group;;
let i_in_group = Sections.finalize_theorem i_in_group;;
let mul1g = Sections.finalize_theorem mul1g;;
let mulg1 = Sections.finalize_theorem mulg1;;
let mulIg = Sections.finalize_theorem mulIg;;
let mulgI = Sections.finalize_theorem mulgI;;
let mulgA = Sections.finalize_theorem mulgA;;
let mulgK = Sections.finalize_theorem mulgK;;
let mulKg = Sections.finalize_theorem mulKg;;
let i_uniq = Sections.finalize_theorem i_uniq;;
let invgK = Sections.finalize_theorem invgK;;
let invg1 = Sections.finalize_theorem invg1;;
let mulI = Sections.finalize_theorem mulI;;
let mulg_leftI = Sections.finalize_theorem mulg_leftI;;
let mulg_rightI = Sections.finalize_theorem mulg_rightI;;
let mulg_left = Sections.finalize_theorem mulg_left;;
let mulg_right = Sections.finalize_theorem mulg_right;;
let invg_e = Sections.finalize_theorem invg_e;;
let subgroup_alt = Sections.finalize_theorem subgroup_alt;;
let subgroup_group = Sections.finalize_theorem subgroup_group;;
let subgroup_e = Sections.finalize_theorem subgroup_e;;
let set_opK = Sections.finalize_theorem set_opK;;
let normal_conj2 = Sections.finalize_theorem normal_conj2;;
let set_opA = Sections.finalize_theorem set_opA;;
let coset_subset = Sections.finalize_theorem coset_subset;;
let coset_e = Sections.finalize_theorem coset_e;;
let coset_eq_e = Sections.finalize_theorem coset_eq_e;;
let left_mul_coset = Sections.finalize_theorem left_mul_coset;;
let set_lmul_subset = Sections.finalize_theorem set_lmul_subset;;
let set_rmul_subset = Sections.finalize_theorem set_rmul_subset;;
let set_lmul_has_size = Sections.finalize_theorem set_lmul_has_size;;
let set_rmul_has_size = Sections.finalize_theorem set_rmul_has_size;;
let set_lmul_card = Sections.finalize_theorem set_lmul_card;;
let set_rmul_card = Sections.finalize_theorem set_rmul_card;;
let set_lrmul_card = Sections.finalize_theorem set_lrmul_card;;
let set_llmul_card = Sections.finalize_theorem set_llmul_card;;
let set_lmul1 = Sections.finalize_theorem set_lmul1;;
let set_rmul1 = Sections.finalize_theorem set_rmul1;;
let conjg_in = Sections.finalize_theorem conjg_in;;
let mul_conjg = Sections.finalize_theorem mul_conjg;;
let conjg_mul = Sections.finalize_theorem conjg_mul;;
let inv_conjg = Sections.finalize_theorem inv_conjg;;
let conj1g = Sections.finalize_theorem conj1g;;
let conjg1 = Sections.finalize_theorem conjg1;;
let conjg_inj = Sections.finalize_theorem conjg_inj;;
let conjg_set_subset = Sections.finalize_theorem conjg_set_subset;;
let conj1g_set = Sections.finalize_theorem conj1g_set;;
let mul_conjg_set = Sections.finalize_theorem mul_conjg_set;;
let conjg_set_has_size = Sections.finalize_theorem conjg_set_has_size;;
let conjg_set_card = Sections.finalize_theorem conjg_set_card;;
let conjg_set_card2 = Sections.finalize_theorem conjg_set_card2;;
let conjg_set_equiv = Sections.finalize_theorem conjg_set_equiv;;
let set_mulI = Sections.finalize_theorem set_mulI;;
let set_invgK = Sections.finalize_theorem set_invgK;;
let group_invK = Sections.finalize_theorem group_invK;;
let group_lmulK = Sections.finalize_theorem group_lmulK;;
let group_rmulK = Sections.finalize_theorem group_rmulK;;
let group_conjgK = Sections.finalize_theorem group_conjgK;;
Sections.end_section "Groups";;
(* Lemma subgroup_alt2 *)
let subgroup_alt2 = Sections.section_proof ["G";"op";"i";"e";"H"]
`group (G, op, i, e) ==>
(subgroup op i H G <=> (H SUBSET G /\ group (H, op, i, e)))`
[
((BETA_TAC THEN (move ["grG"])) THEN ((THENL) (split_tac) [(move ["subHG"]); (case THEN ((move ["sHG"]) THEN (move ["grH"])))]));
(((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (split_tac));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xH"]) THEN (move ["yH"]))));
(((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xH", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Section Normal *)
Sections.begin_section "Normal";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("H", (`:A->bool`))));;
(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));;
(* Lemma group_subgroup *)
let group_subgroup = Sections.section_proof []
`subgroup op i G G`
[
(((((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma group_normal *)
let group_normal = Sections.section_proof []
`normal op i G G`
[
(((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("group_subgroup", [group_subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xG"]) THEN (move ["yG"]))));
(((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma subgroup_conjg *)
let subgroup_conjg = Sections.section_proof ["g"]
`subgroup op i H G ==> g IN G ==>
subgroup op i (set_op1 (conjg (op, i) g) H) G`
[
(BETA_TAC THEN (move ["subH"]) THEN (move ["gG"]));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_subset", [conjg_set_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg1", [conjg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["h1"])) THEN (case THEN (move ["h1H"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h2H"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((fun arg_tac -> arg_tac (Arg_term (`op h1 (i h2)`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
(((((fun arg_tac -> (use_arg_then2 ("inv_conjg", [inv_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_mul", [conjg_mul])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma subgroup_trans *)
let subgroup_trans = Sections.section_proof ["H";"K"]
`subgroup op i H K ==> subgroup op i K G ==> subgroup op i H G`
[
(BETA_TAC THEN (move ["subHK"]));
((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["sKG"]) THEN (move ["grK"]))));
((((use_arg_then2 ("subHK", [])) (disch_tac [])) THEN (clear_assumption "subHK") THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["sHK"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (fun fst_arg -> (use_arg_then2 ("sHK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
];;
(* Lemma cosets_full_preimage0 *)
let cosets_full_preimage0 = Sections.section_proof ["K"]
`subgroup op i K G ==> H SUBSET K ==> ~(H = {}) ==>
K = {g | g IN G /\ coset op g H IN (cosets op K H)}`
[
(((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["subKG"]) THEN (move ["sHK"]) THEN (case THEN (move ["h"])) THEN (move ["hH"]));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sKG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK"])));
(((((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cosets_full_preimage_sub", [cosets_full_preimage_sub]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]));
(((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["gG"])) THEN (case THEN (move ["x"])) THEN (case THEN (move ["xK"])));
(((repeat_tactic 1 9 (((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ((move ["h1"]) THEN (move ["_"]))) THEN (move ["_"]));
((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`op g h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) (((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac)));
(BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN (move ["yH"])));
((((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xK", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sHK", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sHK", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xK", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHK", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma preimages_eq0 *)
let preimages_eq0 = Sections.section_proof ["K1";"K2"]
`subgroup op i K1 G ==> subgroup op i K2 G ==>
H SUBSET K1 ==> H SUBSET K2 ==> ~(H = {}) ==>
(cosets op K1 H = cosets op K2 H <=> K1 = K2)`
[
((BETA_TAC THEN (move ["subK1G"]) THEN (move ["subK2G"]) THEN (move ["sHK1"]) THEN (move ["sHK2"]) THEN (move ["nH0"])) THEN ((THENL) (split_tac) [(move ["c_eq"]); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]));
(((((fun arg_tac -> (use_arg_then2 ("cosets_full_preimage0", [cosets_full_preimage0])) (fun fst_arg -> (use_arg_then2 ("K1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("cosets_full_preimage0", [cosets_full_preimage0])) (fun fst_arg -> (use_arg_then2 ("K2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma normal_alt *)
let normal_alt = Sections.section_proof []
`normal op i H G <=> subgroup op i H G /\ (!g. g IN G ==> set_op1 (conjg (op, i) g) H = H)`
[
((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["subH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((THENL) (split_tac) [((move ["h1"]) THEN (move ["g"]) THEN (move ["gG"])); ((move ["h1"]) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xG"]) THEN (move ["yH"]))))]);
((THENL_FIRST) ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["hH"])])) ((((use_arg_then2 ("h1", [])) (disch_tac [])) THEN (clear_assumption "h1") THEN (DISCH_THEN apply_tac)) THEN (done_tac)));
((fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) (i g) h`))) (term_tac exists_tac));
((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mul_conjg", [mul_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g", [conj1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("xG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(Sections.add_section_hyp "normH" (`normal op i H G`));;
(* Lemma cosets_full_preimage *)
let cosets_full_preimage = Sections.section_proof ["K"]
`subgroup op i K G ==> H SUBSET K ==>
K = {g | g IN G /\ coset op g H IN (cosets op K H)}`
[
((BETA_TAC THEN (move ["subKG"]) THEN (move ["sHK"])) THEN (((use_arg_then2 ("cosets_full_preimage0", [cosets_full_preimage0])) (disch_tac [])) THEN (clear_assumption "cosets_full_preimage0") THEN (DISCH_THEN apply_tac)));
((((use_arg_then2 ("sHK", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subKG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
((((use_arg_then2 ("normH", [])) (disch_tac [])) THEN (clear_assumption "normH") THEN BETA_TAC) THEN ((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma preimages_eq *)
let preimages_eq = Sections.section_proof ["K1";"K2"]
`subgroup op i K1 G ==> subgroup op i K2 G ==>
H SUBSET K1 ==> H SUBSET K2 ==> (cosets op K1 H = cosets op K2 H <=> K1 = K2)`
[
((BETA_TAC THEN (move ["sub1"]) THEN (move ["sub2"]) THEN (move ["s1"]) THEN (move ["s2"])) THEN (((use_arg_then2 ("preimages_eq0", [preimages_eq0])) (disch_tac [])) THEN (clear_assumption "preimages_eq0") THEN (DISCH_THEN apply_tac)));
((((use_arg_then2 ("normH", [])) (disch_tac [])) THEN (clear_assumption "normH") THEN BETA_TAC) THEN ((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sub1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sub2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma normal_conjg *)
let normal_conjg = Sections.section_proof ["g"]
`g IN G ==> set_op1 (conjg (op, i) g) H = H`
[
((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xH"])]));
((((fun arg_tac -> (use_arg_then2 ("normal_conj", [normal_conj])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) (i g) x`))) (term_tac exists_tac));
((((fun arg_tac -> (use_arg_then2 ("normal_conj", [normal_conj])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul_conjg", [mul_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g", [conj1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma left_right_coset *)
let left_right_coset = Sections.section_proof ["x"]
`x IN G ==> coset op x H = set_op op H {x}`
[
(BETA_TAC THEN (move ["xG"]));
(((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_equiv", [conjg_set_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("normal_conjg", [normal_conjg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma coset_mul_normal *)
let coset_mul_normal = Sections.section_proof ["x";"y"]
`x IN G ==> y IN G ==>
set_op op (coset op x H) (coset op y H) = coset op (op x y) H`
[
(BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]));
((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subH"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((repeat_tactic 1 9 (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("set_lmul_subset", [set_lmul_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))));
((((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`set_op op _1 {y}`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("left_right_coset", [left_right_coset]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))));
((((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((((fun arg_tac -> (use_arg_then2 ("set_opK", [set_opK])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Lemma coset_inv_normal *)
let coset_inv_normal = Sections.section_proof ["x"]
`x IN G ==> set_op1 i (coset op x H) = coset op (i x) H`
[
(BETA_TAC THEN (move ["xG"]));
((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_mulI", [set_mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("group_invK", [group_invK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_sing", [set_op1_sing]))(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("left_right_coset", [left_right_coset]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma quotient_group *)
let quotient_group = Sections.section_proof []
`group (cosets op G H, set_op op, set_op1 i, H)`
[
(((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["subH"]));
(((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["sHG"]));
(((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["SHG"]));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grH"]));
(((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] []))));
((repeat_tactic 0 6 ((split_tac))) THEN ((((use_arg_then2 ("cosets", [cosets]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["v"])) THEN (case THEN ((move ["vG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((fun arg_tac -> arg_tac (Arg_term (`op u v`))) (term_tac exists_tac)) THEN ((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((fun arg_tac -> arg_tac (Arg_term (`i u`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))));
((((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((((fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2; 4] [(`H`)]))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["A"]) THEN (move ["B"]) THEN (move ["C"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN ((move ["aG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["b"])) THEN (case THEN ((move ["bG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["c"])) THEN (case THEN ((move ["cG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("coset_subset", [coset_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma subgroup_of_quotient *)
let subgroup_of_quotient = Sections.section_proof ["K1"]
`subgroup (set_op op) (set_op1 i) K1 (cosets op G H) <=>
?K. subgroup op i K G /\ normal op i H K /\ cosets op K H = K1`
[
((THENL_ROT (-1)) (split_tac));
(BETA_TAC THEN (case THEN (move ["K"])) THEN (case THEN ((move ["subKG"]) THEN (case THEN ((move ["nHK"]) THEN (move ["eqK"]))))));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK"])));
((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqK", []))(gsym_then (thm_tac (new_rewrite [] []))))));
(((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((THENL) (split_tac) [((move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN (move ["gK"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ALL_TAC]));
(((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((THENL_FIRST) (split_tac) ((((fun arg_tac -> arg_tac (Arg_term (`coset op e H`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
(BETA_TAC THEN (move ["c1"]) THEN (move ["c2"]) THEN (case THEN ((case THEN (move ["g1"])) THEN (case THEN ((move ["g1K"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) THEN (case THEN (move ["g2"])) THEN (case THEN ((move ["g2K"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((fun arg_tac -> arg_tac (Arg_term (`op g1 (i g2)`))) (term_tac exists_tac));
((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(BETA_TAC THEN (move ["subK1"]));
((use_arg_then2 ("quotient_group", [quotient_group])) (fun arg -> thm_tac MP_TAC arg THEN (move ["grG1"])));
((fun arg_tac -> arg_tac (Arg_term (`{g | g IN G /\ coset op g H IN K1}`))) (term_tac (set_tac "K")));
((use_arg_then2 ("K", [])) (term_tac exists_tac));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK1"])));
((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["eK1"])));
((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> arg_tac (Arg_term (`H SUBSET K`))) (term_tac (have_gen_tac [](move ["sHK"]))));
(((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["h"]) THEN (move ["hH"]));
(((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("coset_eq_e", [coset_eq_e])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("eK1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`K SUBSET G`))) (term_tac (have_gen_tac [](move ["sKG"]))));
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["g"]) THEN (case THEN (move ["g'"])) THEN (case THEN (move ["in_h"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`subgroup op i K G`))) (term_tac (have_gen_tac [](move ["subKG"])))));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
((((use_arg_then2 ("subKG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("normal_subset_trans", [normal_subset_trans])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac));
((THENL_FIRST) ((BETA_TAC THEN (move ["inK1"]) THEN (move ["c"])) THEN ((THENL) (split_tac) [ALL_TAC; (move ["cK1"])])) ((BETA_TAC THEN (case THEN (move ["g'"])) THEN (case THEN (case THEN (move ["g"]))) THEN (case THEN ((case THEN ((move ["gG"]) THEN (move ["cK1"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["c_eq"])) THEN (done_tac)));
(((fun arg_tac -> (use_arg_then2 ("inK1", [])) (fun fst_arg -> (use_arg_then2 ("cK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (move ["eq"]))));
(((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sKG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac));
((((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac))) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((case THEN (move ["h"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["hG"]) THEN (move ["chK1"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["k"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["kG"]) THEN (move ["ckK1"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((fun arg_tac -> arg_tac (Arg_term (`op h (i k)`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))));
((((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("chK1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Finalization of the section Normal *)
let group_subgroup = Sections.finalize_theorem group_subgroup;;
let group_normal = Sections.finalize_theorem group_normal;;
let subgroup_conjg = Sections.finalize_theorem subgroup_conjg;;
let subgroup_trans = Sections.finalize_theorem subgroup_trans;;
let cosets_full_preimage0 = Sections.finalize_theorem cosets_full_preimage0;;
let preimages_eq0 = Sections.finalize_theorem preimages_eq0;;
let normal_alt = Sections.finalize_theorem normal_alt;;
let cosets_full_preimage = Sections.finalize_theorem cosets_full_preimage;;
let preimages_eq = Sections.finalize_theorem preimages_eq;;
let normal_conjg = Sections.finalize_theorem normal_conjg;;
let left_right_coset = Sections.finalize_theorem left_right_coset;;
let coset_mul_normal = Sections.finalize_theorem coset_mul_normal;;
let coset_inv_normal = Sections.finalize_theorem coset_inv_normal;;
let quotient_group = Sections.finalize_theorem quotient_group;;
let subgroup_of_quotient = Sections.finalize_theorem subgroup_of_quotient;;
Sections.end_section "Normal";;
(* Section Normalizer *)
Sections.begin_section "Normalizer";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("H", (`:A->bool`))));;
(* Lemma image_eq *)
let image_eq = Sections.section_proof []
`!f g H. (!x. x IN H ==> f x = g x) ==> IMAGE (f:A->A) H = IMAGE g H`
[
((BETA_TAC THEN (move ["f"]) THEN (move ["g"]) THEN (move ["H"]) THEN (move ["eq"])) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["xx"])) THEN ((split_tac) THEN (case THEN (move ["yy"])) THEN (case THEN ((move ["eq2"]) THEN (move ["in_s"])))));
(((use_arg_then2 ("yy", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(((use_arg_then2 ("yy", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma normalizer_subset *)
let normalizer_subset = Sections.section_proof []
`normalizer op i G H SUBSET G`
[
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("normalizer", [normalizer]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN (move ["g"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["gG"])) THEN (move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));;
(* Lemma set_op_subset *)
let set_op_subset = Sections.section_proof ["A";"B"]
`A SUBSET G ==> B SUBSET G ==> set_op op A B SUBSET G`
[
(((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["sAG"]) THEN (move ["sBG"]) THEN (move ["g"]) THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN ((case THEN ((move ["aA"]) THEN (move ["bB"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("sBG", [])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sAG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma in_normalizer0 *)
let in_normalizer0 = Sections.section_proof ["g";"H"]
`g IN normalizer op i G H <=> g IN G /\ H = set_op1 (conjg (op, i) g) H`
[
(((((use_arg_then2 ("normalizer", [normalizer]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["gG"])) THEN ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))]) THEN (done_tac));
];;
(* Lemma normalizerK *)
let normalizerK = Sections.section_proof []
`normalizer op i G G = G`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((THENL) (split_tac) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (move ["xG"])]));
(((((fun arg_tac -> (use_arg_then2 ("normal_conjg", [normal_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("group_normal", [group_normal])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma normalizer_norm *)
let normalizer_norm = Sections.section_proof []
`normal op i H G ==> normalizer op i G H = G`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (move ["normH"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (move ["xG"])]));
((((fun arg_tac -> (use_arg_then2 ("normal_conjg", [normal_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Lemma normalizer_subgroup *)
let normalizer_subgroup = Sections.section_proof []
`H SUBSET G ==> subgroup op i (normalizer op i G H) G`
[
((((((fun arg_tac -> (use_arg_then2 ("subgroup_alt", [subgroup_alt])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("normalizer_subset", [normalizer_subset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["sHG"])) THEN (repeat_tactic 1 9 ((split_tac))));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g_set", [conj1g_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["xG"])) THEN (move ["eq_x"]) THEN (case THEN (move ["yG"])) THEN (move ["eq_y"]));
(((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul_conjg_set", [mul_conjg_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq_x", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_y", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["xG"])) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`set_op1 (conjg (op, i) (i x))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((((fun arg_tac -> (use_arg_then2 ("mul_conjg_set", [mul_conjg_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g_set", [conj1g_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(Sections.add_section_hyp "subH" (`subgroup op i H G`));;
(* Lemma subset_normalizer *)
let subset_normalizer = Sections.section_proof []
`H SUBSET (normalizer op i G H)`
[
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
(((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["hH"]));
(((((fun arg_tac -> (use_arg_then2 ("group_conjgK", [group_conjgK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma normal_in_normalizer *)
let normal_in_normalizer = Sections.section_proof []
`normal op i H (normalizer op i G H)`
[
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
(((((fun arg_tac -> (use_arg_then2 ("normal_alt", [normal_alt])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subset_normalizer", [subset_normalizer]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("grH", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["g"]));
(((((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma in_normalizer *)
let in_normalizer = Sections.section_proof ["g"]
`g IN normalizer op i G H <=> g IN G /\ coset op g H = set_op op H {g}`
[
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["gG"])));
(((((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_equiv", [conjg_set_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Finalization of the section Normalizer *)
let image_eq = Sections.finalize_theorem image_eq;;
let normalizer_subset = Sections.finalize_theorem normalizer_subset;;
let set_op_subset = Sections.finalize_theorem set_op_subset;;
let in_normalizer0 = Sections.finalize_theorem in_normalizer0;;
let normalizerK = Sections.finalize_theorem normalizerK;;
let normalizer_norm = Sections.finalize_theorem normalizer_norm;;
let normalizer_subgroup = Sections.finalize_theorem normalizer_subgroup;;
let subset_normalizer = Sections.finalize_theorem subset_normalizer;;
let normal_in_normalizer = Sections.finalize_theorem normal_in_normalizer;;
let in_normalizer = Sections.finalize_theorem in_normalizer;;
Sections.end_section "Normalizer";;
(* Section Lagrange *)
Sections.begin_section "Lagrange";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("op", (`:A -> A -> A`))));;
(Sections.add_section_var (mk_var ("i", (`:A -> A`))));;
(Sections.add_section_var (mk_var ("n", (`:num`))));;
(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));;
(Sections.add_section_var (mk_var ("H", (`:A->bool`))));;
(Sections.add_section_hyp "subH" (`subgroup op i H G`));;
(* Lemma coset_eq *)
let coset_eq = Sections.section_proof ["h";"x"]
`x IN G ==> h IN H ==> coset op (op x h) H = coset op x H`
[
(BETA_TAC THEN (move ["xG"]) THEN (move ["hH"]));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((repeat_tactic 1 9 (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op_sing", [set_op_sing]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then2 ("group_lmulK", [group_lmulK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma coset_inter *)
let coset_inter = Sections.section_proof ["x";"y"]
`x IN G ==> y IN G ==> ~(coset op x H = coset op y H) ==>
coset op x H INTER coset op y H = {}`
[
(BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["nc"]));
(((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["SHG"]));
((((use_arg_then2 ("SHG", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sHG"])));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grH"]));
((((use_arg_then2 ("negbK", [negbK]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nc", [])) (disch_tac [])) THEN (clear_assumption "nc") THEN BETA_TAC) THEN ((((use_arg_then2 ("CONTRAPOS_THM", [CONTRAPOS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))));
(BETA_TAC THEN (case THEN (move ["u"])));
(((repeat_tactic 2 0 (((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)));
(BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["h1"])) THEN (case THEN ((move ["h1H"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h2H"])) THEN (move ["eq"]));
((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`op (op x h1) (i h1) = op (op y h2) (i h1)`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
(((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("yG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
((fun arg_tac -> arg_tac (Arg_term (`op h2 _`))) (term_tac (set_tac "h")));
((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h IN H`))) (term_tac (have_gen_tac [](move ["hH"])))) (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
((((use_arg_then2 ("coset_eq", [coset_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Lemma x_in_coset *)
let x_in_coset = Sections.section_proof ["x"]
`x IN G ==> x IN coset op x H`
[
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grH"]));
((BETA_TAC THEN (move ["xG"])) THEN ((((use_arg_then2 ("coset", [coset]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma cosets_unions *)
let cosets_unions = Sections.section_proof []
`G = UNIONS (cosets op G H)`
[
(((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["SHG"]));
(((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (move ["x"]) THEN (simp_tac)) THEN (split_tac));
(BETA_TAC THEN (move ["xG"]));
(((fun arg_tac -> arg_tac (Arg_term (`coset op x H`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in_coset", [x_in_coset]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["c"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((move ["yG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
((((use_arg_then2 ("SHG", [])) (disch_tac [])) THEN (clear_assumption "SHG") THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sHG"])));
(((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma coset_equiv *)
let coset_equiv = Sections.section_proof ["g1";"g2"]
`g1 IN G ==> g2 IN G ==>
(coset op g1 H = coset op g2 H <=> op (i g2) g1 IN H)`
[
(BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"]));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
(((repeat_tactic 1 9 (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac));
((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`set_op op {i g2}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC);
((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] [])))))));
((((((fun arg_tac -> (use_arg_then2 ("set_lmul1", [set_lmul1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN (move ["h1"]) THEN (move ["x"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["h"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["hH"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((use_arg_then2 ("g2", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`op (op (i g2) g1) h`))) (term_tac exists_tac)));
((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["h"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["hH"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((use_arg_then2 ("g1", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`op (i (op (i g2) g1)) h`))) (term_tac exists_tac)));
((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulI", [mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
(((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("g1G", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma coset_not_empty *)
let coset_not_empty = Sections.section_proof ["g"]
`g IN G ==> ~(coset op g H = {})`
[
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac)));
(((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(* Lemma subgroup_size *)
let subgroup_size = Sections.section_proof []
`H HAS_SIZE (CARD H)`
[
(((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["SHG"]));
(((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (disch_tac [])) THEN (clear_assumption "FINITE_SUBSET") THEN (DISCH_THEN apply_tac));
(((use_arg_then2 ("G", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("SHG", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma coset_card *)
let coset_card = Sections.section_proof ["x"]
`x IN G ==> CARD (coset op x H) = CARD H`
[
((BETA_TAC THEN (move ["xG"])) THEN ((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_lmul_card", [set_lmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
(((((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("G", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma finite_index *)
let finite_index = Sections.section_proof []
`FINITE (cosets op G H)`
[
((fun arg_tac -> arg_tac (Arg_term (`cosets op G H = IMAGE (\x. coset op x H) G`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IMAGE", [IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac));
((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Lemma LaGrange *)
let LaGrange = Sections.section_proof []
`CARD G = CARD (cosets op G H) * CARD H`
[
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((THENL_ROT (-1)) ((((use_arg_then2 ("cosets_unions", [cosets_unions]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("CARD_UNIONS", [CARD_UNIONS]))(thm_tac (new_rewrite [] []))))));
((((use_arg_then2 ("NSUM_CONST", [NSUM_CONST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finite_index", [finite_index]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((use_arg_then2 ("NSUM_EQ", [NSUM_EQ])) (thm_tac apply_tac));
((BETA_TAC THEN (move ["c"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
((((use_arg_then2 ("coset_card", [coset_card]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((((use_arg_then2 ("finite_index", [finite_index]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac));
((BETA_TAC THEN (move ["c"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
((((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (disch_tac [])) THEN (clear_assumption "FINITE_SUBSET") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("G", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("coset_subset", [coset_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((BETA_TAC THEN (move ["c1"]) THEN (move ["c2"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((move ["yG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["nc"])));
(((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_inter", [coset_inter])) (fun fst_arg -> (use_arg_then2 ("xG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("yG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("nc", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
];;
(* Finalization of the section Lagrange *)
let coset_eq = Sections.finalize_theorem coset_eq;;
let coset_inter = Sections.finalize_theorem coset_inter;;
let x_in_coset = Sections.finalize_theorem x_in_coset;;
let cosets_unions = Sections.finalize_theorem cosets_unions;;
let coset_equiv = Sections.finalize_theorem coset_equiv;;
let coset_not_empty = Sections.finalize_theorem coset_not_empty;;
let subgroup_size = Sections.finalize_theorem subgroup_size;;
let coset_card = Sections.finalize_theorem coset_card;;
let finite_index = Sections.finalize_theorem finite_index;;
let LaGrange = Sections.finalize_theorem LaGrange;;
Sections.end_section "Lagrange";;
(* Section Z_group *)
Sections.begin_section "Z_group";;
(* Lemma grZ *)
let grZ = Sections.section_proof ["n"]
`0 < n ==> group({i:num | i < n}, (add_mod n), inv_add_mod n, 0)`
[
((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lt0n_neq0", [lt0n_neq0])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["n0"]));
((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("add_mod", [add_mod]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("inv_add_mod", [inv_add_mod]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 0 6 ((split_tac))));
((((fun arg_tac -> (use_arg_then2 ("DIVISION", [DIVISION])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac));
((case THEN (simp_tac)) THEN (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
((((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
((BETA_TAC THEN (move ["x"]) THEN (move ["xn"])) THEN ((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((THENL_FIRST) (((THENL) case [ALL_TAC; ((move ["m"]) THEN (move ["lt_m_n"]))]) THEN (simp_tac)) (((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_0", [MOD_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
(((((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnKC", [subnKC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("muln1", [muln1])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1; 3] []))))) THEN (((use_arg_then2 ("MOD_MULT", [MOD_MULT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (move ["z"]) THEN (case THEN ((move ["xn"]) THEN (case THEN ((move ["yn"]) THEN (move ["zn"]))))));
(((((fun arg_tac -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (fun fst_arg -> (use_arg_then2 ("xn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (fun fst_arg -> (use_arg_then2 ("zn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MOD_ADD_MOD", [MOD_ADD_MOD]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addnA", [addnA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma testZ *)
let testZ = Sections.section_proof ["n";"x";"y"]
`0 < n ==> x < n ==> y < n ==> add_mod n (add_mod n x y) (inv_add_mod n y) = x`
[
(BETA_TAC THEN (move ["n0"]) THEN (move ["xn"]) THEN (move ["yn"]));
(((((fun arg_tac -> (use_arg_then2 ("mulgK", [mulgK])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("grZ", [grZ])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac));
];;
(* Finalization of the section Z_group *)
let grZ = Sections.finalize_theorem grZ;;
let testZ = Sections.finalize_theorem testZ;;
Sections.end_section "Z_group";;
(* Lemma SING_HAS_SIZE_1 *)
let SING_HAS_SIZE_1 = Sections.section_proof ["x"]
`{x} HAS_SIZE 1`
[
((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] [])))));
((((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{}`))) (term_tac exists_tac))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma HAS_SIZE_1_SING *)
let HAS_SIZE_1_SING = Sections.section_proof ["X"]
`X HAS_SIZE 1 <=> ?x. X = {x}`
[
((THENL_LAST) (split_tac) ((BETA_TAC THEN (case THEN ((move ["x"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (((use_arg_then2 ("SING_HAS_SIZE_1", [SING_HAS_SIZE_1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
(((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE_0", [HAS_SIZE_0]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["t"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN ((move ["_"]) THEN (move ["eq"]))));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma BIJ_SYM *)
let BIJ_SYM = Sections.section_proof ["f";"V";"U"]
`BIJ f V U ==> ?g. BIJ g U V`
[
(((repeat_tactic 1 9 (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((case THEN ((move ["f_on"]) THEN (move ["f_inj"]))) THEN (case THEN ((move ["_"]) THEN (move ["f_surj"]))))));
(((fun arg_tac -> (use_arg_then2 ("BIJECTIVE_ON_LEFT_RIGHT_INVERSE", [BIJECTIVE_ON_LEFT_RIGHT_INVERSE])) (fun fst_arg -> (use_arg_then2 ("f_on", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
(((((use_arg_then2 ("f_inj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("f_surj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["g_on"])) THEN (case THEN ((move ["fg"]) THEN (move ["gf"]))));
(((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("g_on", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (split_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xU"])) THEN (case THEN (move ["yU"])) THEN (move ["g_eq"]));
(((((fun arg_tac -> (use_arg_then2 ("fg", [])) (fun fst_arg -> (use_arg_then2 ("yU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("fg", [])) (fun fst_arg -> (use_arg_then2 ("xU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["xV"]));
(((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("f_on", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("gf", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma bij_inverse *)
let bij_inverse = Sections.section_proof ["f";"s";"t"]
`BIJ (f:A->B) s t ==>
(?g. (!y. y IN t ==> g y IN s) /\ (!x. x IN s ==> g (f x) = x) /\ (!y. y IN t ==> f (g y) = y))`
[
(((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["f_on"])) THEN (move ["f_inj"]) THEN (case THEN (move ["_"])) THEN (move ["f_surj"]));
((((fun arg_tac -> (use_arg_then2 ("BIJECTIVE_ON_LEFT_RIGHT_INVERSE", [BIJECTIVE_ON_LEFT_RIGHT_INVERSE])) (fun fst_arg -> (use_arg_then2 ("f_on", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("f_inj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("f_surj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["g_on"])) THEN (case THEN (move ["g1"])) THEN (move ["g2"])));
(((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma BIJ_CARD_EQ *)
let BIJ_CARD_EQ = Sections.section_proof ["V";"U";"f"]
`FINITE V ==> BIJ f V U ==> CARD U = CARD V`
[
(BETA_TAC THEN (move ["finV"]) THEN (move ["bij_f"]));
(((fun arg_tac -> (use_arg_then2 ("bij_inverse", [bij_inverse])) (fun fst_arg -> (use_arg_then2 ("bij_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["g_on"])) THEN (case THEN (move ["gf"])) THEN (move ["fg"]));
(((use_arg_then2 ("BIJECTIONS_CARD_EQ", [BIJECTIONS_CARD_EQ])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("finV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((split_tac) THEN (move ["x"]) THEN (move ["x_in"])));
(((((use_arg_then2 ("g_on", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("bij_f", [])) (disch_tac [])) THEN (clear_assumption "bij_f") THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["f_on"])) THEN (move ["_"]) THEN (move ["_"])));
(((((use_arg_then2 ("gf", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_on", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma card_sing *)
let card_sing = Sections.section_proof ["a"]
`CARD {a} = 1`
[
(((use_arg_then2 ("HAS_SIZE_CARD", [HAS_SIZE_CARD])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma set_one_point *)
let set_one_point = Sections.section_proof ["s";"x"]
`FINITE s ==> CARD s = 1 ==> x IN s ==> s = {x}`
[
(BETA_TAC THEN (move ["finS"]) THEN (move ["cs"]) THEN (move ["xs"]));
((((fun arg_tac -> (use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["y"])) THEN (move ["cond"]) THEN (move ["a"])));
((((fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["xy"])) THEN (((fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma sing_eq *)
let sing_eq = Sections.section_proof ["x";"y"]
`{x} = {y} <=> x = y`
[
(((THENL) (split_tac) [ALL_TAC; ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Section Action *)
Sections.begin_section "Action";;
let acts = new_definition `acts (G, op, e) S a <=>
(!g x. g IN G ==> x IN S ==> a g x IN S) /\
(!g h x. g IN G ==> h IN G ==> x IN S ==> a g (a h x) = a (op g h) x) /\
(!x. x IN S ==> a e x = x)`;;
(Sections.add_section_var (mk_var ("G", (`:A -> bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A -> A -> A`))));;
(Sections.add_section_var (mk_var ("i", (`:A -> A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("S", (`:B -> bool`))));;
(Sections.add_section_var (mk_var ("a", (`:A -> B -> B`))));;
(* Lemma in_stab *)
let in_stab = Sections.section_proof ["g";"x"]
`g IN Stab G a x ==> a g x = x`
[
((((((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN ((move ["hyp"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac));
];;
(* Lemma fix_subset *)
let fix_subset = Sections.section_proof []
`Fix G S a SUBSET S`
[
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)) THEN (done_tac));
];;
(Sections.add_section_hyp "acts_a" (`acts (G, op, e) S a`));;
(* Lemma acts1 *)
let acts1 = Sections.section_proof ["x"]
`x IN S ==> a e x = x`
[
((((use_arg_then2 ("acts_a", [])) (disch_tac [])) THEN (clear_assumption "acts_a") THEN BETA_TAC) THEN ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma acts_in *)
let acts_in = Sections.section_proof ["g";"x"]
`g IN G ==> x IN S ==> a g x IN S`
[
((((use_arg_then2 ("acts_a", [])) (disch_tac [])) THEN (clear_assumption "acts_a") THEN BETA_TAC) THEN ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma acts_op *)
let acts_op = Sections.section_proof ["g";"h";"x"]
`g IN G ==> h IN G ==> x IN S ==> a g (a h x) = a (op g h) x`
[
((((use_arg_then2 ("acts_a", [])) (disch_tac [])) THEN (clear_assumption "acts_a") THEN BETA_TAC) THEN ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma acts_sub *)
let acts_sub = Sections.section_proof ["H"]
`H SUBSET G ==> acts (H, op, e) S a`
[
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] []))))) THEN (move ["sHG"])) THEN (repeat_tactic 1 9 ((split_tac))));
(BETA_TAC THEN (move ["g"]) THEN (move ["x"]) THEN (case THEN ((move ["gH"]) THEN (move ["xS"]))));
(((((use_arg_then2 ("acts_in", [acts_in]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["g"]) THEN (move ["h"]) THEN (move ["x"]) THEN (case THEN ((case THEN ((move ["gH"]) THEN (move ["hH"]))) THEN (move ["xS"]))));
(((((use_arg_then2 ("acts_op", [acts_op]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((BETA_TAC THEN (move ["x"]) THEN (move ["xS"])) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Lemma orbit_subset *)
let orbit_subset = Sections.section_proof ["x"]
`x IN S ==> Orbit G a x SUBSET S`
[
((BETA_TAC THEN (move ["xS"])) THEN (((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (case THEN ((move ["g"]) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))) THEN (((use_arg_then2 ("acts_in", [acts_in]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));;
(* Lemma x_in_orbit *)
let x_in_orbit = Sections.section_proof ["x"]
`x IN S ==> x IN Orbit G a x`
[
((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma stab_subgroup *)
let stab_subgroup = Sections.section_proof ["x"]
`x IN S ==> subgroup op i (Stab G a x) G`
[
((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 2 ((split_tac))));
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["h"]) THEN (case THEN ((case THEN ((move ["gG"]) THEN (move ["agx"]))) THEN (case THEN ((move ["hG"]) THEN (move ["ahx"]))))));
((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`a (i h) x = x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma stab_group *)
let stab_group = Sections.section_proof ["x"]
`x IN S ==> group (Stab G a x, op, i, e)`
[
((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("subgroup_group", [subgroup_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("stab_subgroup", [stab_subgroup]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma orbits_disj *)
let orbits_disj = Sections.section_proof ["x";"y"]
`x IN S ==> y IN S ==>
~(Orbit G a x = Orbit G a y) ==> (Orbit G a x INTER Orbit G a y = {})`
[
((BETA_TAC THEN (move ["xS"]) THEN (move ["yS"])) THEN (((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
((BETA_TAC THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN ((move ["g"]) THEN (case THEN ((move ["gG"]) THEN (move ["zgx"]))))) THEN (case THEN ((move ["h"]) THEN (case THEN ((move ["hG"]) THEN (move ["zhx"])))))))) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["t"])) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uG"]) THEN (move ["tu"])))));
((fun arg_tac -> arg_tac (Arg_term (`op u (op (i g) h)`))) (term_tac exists_tac));
((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((((use_arg_then2 ("tu", []))(thm_tac (new_rewrite [] [])))) THEN (congr_tac (`a u _`)));
(((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("zhx", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zgx", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`op u (op (i h) g)`))) (term_tac exists_tac));
((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((((use_arg_then2 ("tu", []))(thm_tac (new_rewrite [] [])))) THEN (congr_tac (`a u _`)));
(((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("zhx", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zgx", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma fix_orbit_imp *)
let fix_orbit_imp = Sections.section_proof ["x"]
`x IN Fix G S a ==> Orbit G a x = {x}`
[
(((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["xS"]) THEN (move ["fix"]))) THEN (move ["y"]));
((THENL_LAST) (split_tac) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
((BETA_TAC THEN (case THEN ((move ["g"]) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fix", [fix])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))) THEN (done_tac));
];;
(* Lemma fix_orbit *)
let fix_orbit = Sections.section_proof ["x"]
`x IN S ==> (x IN Fix G S a <=> Orbit G a x = {x})`
[
((THENL_FIRST) ((BETA_TAC THEN (move ["xS"])) THEN (split_tac)) (((use_arg_then2 ("fix_orbit_imp", [fix_orbit_imp])) (disch_tac [])) THEN (clear_assumption "fix_orbit_imp") THEN (exact_tac)));
((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))));
((BETA_TAC THEN (move ["eq"])) THEN (((((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["gG"])));
((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma x_in_orbit *)
let x_in_orbit = Sections.section_proof ["x"]
`x IN S ==> x IN Orbit G a x`
[
((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma sing_orbit *)
let sing_orbit = Sections.section_proof ["x"]
`x IN S ==> (x IN Fix G S a <=> Orbit G a x HAS_SIZE 1)`
[
((THENL_FIRST) ((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("fix_orbit", [fix_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC])) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)));
((BETA_TAC THEN (case THEN ((move ["y"]) THEN (move ["eq"])))) THEN (((fun arg_tac -> (use_arg_then2 ("x_in_orbit", [x_in_orbit])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC));
((((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma orbit_image *)
let orbit_image = Sections.section_proof ["x"]
`Orbit G a x = IMAGE (\g. a g x) G`
[
(((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma finite_orbit *)
let finite_orbit = Sections.section_proof ["x"]
`FINITE S ==> x IN S ==> FINITE (Orbit G a x)`
[
((BETA_TAC THEN (move ["finS"]) THEN (move ["xS"])) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("orbit_subset", [orbit_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Lemma bij_orbit_cosets *)
let bij_orbit_cosets = Sections.section_proof ["x"]
`x IN S ==> ?f. BIJ f (cosets op G (Stab G a x)) (Orbit G a x)`
[
(BETA_TAC THEN (move ["xS"]));
(((fun arg_tac -> (use_arg_then2 ("stab_subgroup", [stab_subgroup])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("stab_group", [stab_group])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grS"]) THEN (move ["subS"]));
((fun arg_tac -> arg_tac (Arg_term (`\c:A->bool. a (CHOICE c) x`))) (term_tac (set_tac "f")));
((fun arg_tac -> arg_tac (Arg_term (`!g. g IN G ==> f (coset op g (Stab G a x)) = a g x`))) (term_tac (have_gen_tac [](move ["f_eq"]))));
((BETA_TAC THEN (move ["g"]) THEN (move ["gG"])) THEN ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)));
((((fun arg_tac -> (use_arg_then2 ("CHOICE_DEF", [CHOICE_DEF])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`coset op g (Stab G a x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_not_empty", [coset_not_empty])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))));
(((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN ((move ["h_stab"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_stab", [in_stab])) (fun fst_arg -> (use_arg_then2 ("h_stab", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((use_arg_then2 ("f", [])) (term_tac exists_tac));
((THENL_ROT (-1)) ((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)));
(((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac));
((BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
(((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac));
((BETA_TAC THEN (move ["y"])) THEN (((((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (simp_tac) THEN (case THEN ((move ["y_eq"]) THEN (move ["gG"])))));
((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`coset op g (Stab G a x)`))) (term_tac exists_tac)) THEN (split_tac)) (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac)));
((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac));
((BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)));
(((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac));
(BETA_TAC THEN (move ["c1"]) THEN (move ["c2"]) THEN (case THEN ((case THEN ((move ["g"]) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["h"]) THEN (case THEN ((move ["hG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))))));
(((repeat_tactic 1 9 (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["a_eq"]));
((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_equiv", [coset_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
(((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma card_orbit *)
let card_orbit = Sections.section_proof ["x"]
`FINITE S ==> x IN S ==>
CARD (Orbit G a x) = CARD (cosets op G (Stab G a x))`
[
(BETA_TAC THEN (move ["finS"]) THEN (move ["xS"]));
(((fun arg_tac -> (use_arg_then2 ("bij_orbit_cosets", [bij_orbit_cosets])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["f"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("BIJ_SYM", [BIJ_SYM])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["g"])) THEN (move ["bij"]));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_orbit", [finite_orbit])) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["finO"]));
((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BIJ_CARD_EQ", [BIJ_CARD_EQ])) (fun fst_arg -> (use_arg_then2 ("finO", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma set_union_orbits *)
let set_union_orbits = Sections.section_proof []
`S = UNIONS (IMAGE (Orbit G a) S)`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN (split_tac));
((BETA_TAC THEN (move ["xS"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`Orbit G a x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in_orbit", [x_in_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["yS"]))));
((((((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["hG"]))) THEN (simp_tac)) THEN (((use_arg_then2 ("acts_in", [acts_in])) (disch_tac [])) THEN (clear_assumption "acts_in") THEN (exact_tac)));
];;
(* Lemma card_set *)
let card_set = Sections.section_proof []
`FINITE S ==> CARD S = nsum (IMAGE (Orbit G a) S) CARD`
[
((BETA_TAC THEN (move ["finS"])) THEN ((((use_arg_then2 ("set_union_orbits", [set_union_orbits]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("CARD_UNIONS", [CARD_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
((BETA_TAC THEN (move ["t"])) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["xS"])))) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)));
(((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("orbit_subset", [orbit_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((BETA_TAC THEN (move ["t"]) THEN (move ["u"])) THEN ((repeat_tactic 2 0 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["xS"]))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["yS"]))) THEN (move ["disj"])));
(((use_arg_then2 ("orbits_disj", [orbits_disj])) (disch_tac [])) THEN (clear_assumption "orbits_disj") THEN (exact_tac));
];;
(* Lemma card_set_fix *)
let card_set_fix = Sections.section_proof []
`FINITE S ==> CARD S = CARD (Fix G S a) +
nsum {Orbit G a x | x | x IN S /\ CARD (Orbit G a x) > 1} CARD`
[
(BETA_TAC THEN (move ["finS"]));
(((fun arg_tac -> (use_arg_then2 ("card_set", [card_set])) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))));
((fun arg_tac -> arg_tac (Arg_term (`{Orbit G a x | x | x IN S /\ CARD (Orbit G a x) > 1}`))) (term_tac (set_tac "A")));
((fun arg_tac -> arg_tac (Arg_term (`{Orbit G a x | x | x IN S /\ CARD (Orbit G a x) = 1}`))) (term_tac (set_tac "B")));
((fun arg_tac -> arg_tac (Arg_term (`IMAGE (Orbit G a) S = A UNION B`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((THENL_ROT (-1)) ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["orb"])) THEN (split_tac)));
(case THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xS"]) THEN (move ["eq"]))));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["eq"]) THEN (move ["xS"]))));
((fun arg_tac -> arg_tac (Arg_term (`CARD (Orbit G a x)`))) (term_tac (set_tac "n")));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_orbit", [finite_orbit])) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finO"])));
((THENL) (((use_arg_then2 ("n_def", [])) (disch_tac [])) THEN (clear_assumption "n_def") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; ((THENL) case [(move ["card1"]); ((move ["n"]) THEN (move ["card_ge2"]))])]);
(((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x_eq"]));
((((fun arg_tac -> (use_arg_then2 ("x_in_orbit", [x_in_orbit])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((DISJ2_TAC) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("card1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((DISJ1_TAC) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("card_ge2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gtE", [gtE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0Sn", [ltn0Sn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`FINITE B`))) (term_tac (have_gen_tac [](move ["finB"]))));
(((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (Orbit G a) S`))) (term_tac exists_tac)));
(((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["orb"]) THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xS"]) THEN (move ["_"]))) THEN (move ["eq"]));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
((((use_arg_then2 ("NSUM_UNION", [NSUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finB", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
(split_tac);
(((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (Orbit G a) S`))) (term_tac exists_tac)));
(((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["orb"]) THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xS"]) THEN (move ["_"]))) THEN (move ["eq"]));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac));
(((((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["orb"]));
((((fun arg_tac -> arg_tac (Arg_theorem (TAUT `!P. ~P <=> (P ==> F)`)))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xS"]) THEN (move ["gt1"]))) THEN (move ["eq"]) THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["yS"])) THEN (move ["eq1"]));
(((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["orb_eq"])) THEN (((use_arg_then2 ("gt1", [])) (disch_tac [])) THEN (clear_assumption "gt1") THEN ((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC));
((((use_arg_then2 ("orb_eq", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac));
((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_addr", [eqn_addr]))(thm_tac (new_rewrite [] [])))));
((fun arg_tac -> arg_tac (Arg_term (`nsum B CARD = CARD B`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("CARD_EQ_NSUM", [CARD_EQ_NSUM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("NSUM_EQ", [NSUM_EQ])) (thm_tac apply_tac)) THEN (move ["orb"])));
((((((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["xS"])) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`B = IMAGE (Orbit G a) (Fix G S a)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((((((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["orb"])) THEN (split_tac));
(BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((case THEN ((move ["xS"]) THEN (move ["card1"]))) THEN (move ["orb_eq"]))));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("orb_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("fix_orbit", [fix_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("set_one_point", [set_one_point])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`Orbit G a x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
(((((use_arg_then2 ("finite_orbit", [finite_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_in_orbit", [x_in_orbit]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["orb_eq"])) THEN (move ["fix"]));
((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x IN S`))) (term_tac (have_gen_tac [](move ["xS"])))) ((((use_arg_then2 ("fix_subset", [fix_subset])) (disch_tac [])) THEN (clear_assumption "fix_subset") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (exact_tac) THEN (done_tac)));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("orb_eq", [])) (disch_tac [])) THEN (clear_assumption "orb_eq") THEN ((use_arg_then2 ("fix", [fix])) (disch_tac [])) THEN (clear_assumption "fix") THEN BETA_TAC) THEN (((((use_arg_then2 ("fix_orbit", [fix_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_sing", [card_sing]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
((THENL_ROT (-1)) (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ])) (thm_tac apply_tac)) THEN (split_tac)));
(((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("fix_subset", [fix_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fix_orbit_imp", [fix_orbit_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fix_orbit_imp", [fix_orbit_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((((use_arg_then2 ("sing_eq", [sing_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(Sections.add_section_var (mk_var ("p", (`:num`))); Sections.add_section_var (mk_var ("r", (`:num`))));;
(Sections.add_section_hyp "prime_p" (`prime p`));;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(Sections.add_section_hyp "cardG" (`CARD G = p EXP r`));;
(Sections.add_section_hyp "finS" (`FINITE S`));;
(* Lemma card_orbit_p_group *)
let card_orbit_p_group = Sections.section_proof ["x"]
`x IN S ==> CARD (Orbit G a x) > 1 ==> p divides CARD (Orbit G a x)`
[
((BETA_TAC THEN (move ["xS"])) THEN (((((use_arg_then2 ("card_orbit", [card_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["card_gt1"])));
((fun arg_tac -> arg_tac (Arg_term (`CARD (cosets op G (Stab G a x)) divides p EXP r`))) (term_tac (have_gen_tac []ALL_TAC)));
(((((use_arg_then2 ("cardG", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL divides)))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`CARD (Stab G a x)`))) (term_tac exists_tac)));
(((((fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("stab_subgroup", [stab_subgroup]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL DIVIDES_PRIMEPOW)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["q"])) THEN (case THEN ((move ["_"]) THEN (move ["card_eq"]))));
(((use_arg_then2 ("card_gt1", [])) (disch_tac [])) THEN (clear_assumption "card_gt1") THEN ((use_arg_then2 ("card_eq", [])) (disch_tac [])) THEN (clear_assumption "card_eq") THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
((((use_arg_then2 ("q", [])) (disch_tac [])) THEN (clear_assumption "q") THEN case) THEN (((((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gtE", [gtE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["n"]) THEN (move ["_"])));
((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL divides)))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma DIVIDES_NSUM *)
let DIVIDES_NSUM = Sections.section_proof ["f";"s";"q"]
`(!x. x IN s ==> q divides f x) ==> q divides nsum s f`
[
(BETA_TAC THEN (move ["H"]));
((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nsum s (\x. f x DIV q)`))) (term_tac exists_tac)));
(((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NSUM_RMUL", [NSUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("NSUM_EQ", [NSUM_EQ])) (thm_tac apply_tac)) THEN (move ["x"]) THEN (move ["xs"]) THEN (simp_tac)));
(((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_DIV_MULT", [DIVIDES_DIV_MULT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma sum_orbit_p_group *)
let sum_orbit_p_group = Sections.section_proof []
`p divides nsum {Orbit G a x | x | x IN S /\ CARD (Orbit G a x) > 1} CARD`
[
((((use_arg_then2 ("DIVIDES_NSUM", [DIVIDES_NSUM])) (thm_tac apply_tac)) THEN (move ["orb"])) THEN (((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["xS"])) THEN (move ["card_gt1"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
(((use_arg_then2 ("card_orbit_p_group", [card_orbit_p_group])) (disch_tac [])) THEN (clear_assumption "card_orbit_p_group") THEN (exact_tac));
];;
(* Lemma p_div_fix *)
let p_div_fix = Sections.section_proof []
`p divides CARD S ==> p divides CARD (Fix G S a)`
[
(((((use_arg_then2 ("card_set_fix", [card_set_fix]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["p_div_sum"]));
((use_arg_then2 ("sum_orbit_p_group", [sum_orbit_p_group])) (fun arg -> thm_tac MP_TAC arg THEN (move ["p_div2"])));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIVIDES_ADD_REVL", [DIVIDES_ADD_REVL])) (fun fst_arg -> (use_arg_then2 ("p_div2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_div_sum", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
];;
(* Lemma fix_mod_p *)
let fix_mod_p = Sections.section_proof []
`CARD (Fix G S a) MOD p = CARD S MOD p`
[
((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_EQ", [MOD_EQ])) (disch_tac [])) THEN (clear_assumption "MOD_EQ") THEN (DISCH_THEN apply_tac)));
((((use_arg_then2 ("sum_orbit_p_group", [sum_orbit_p_group])) (disch_tac [])) THEN (clear_assumption "sum_orbit_p_group") THEN BETA_TAC) THEN ((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["q"])) THEN (move ["eq"])));
(((use_arg_then2 ("q", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("card_set_fix", [card_set_fix]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Finalization of the section Action *)
let in_stab = Sections.finalize_theorem in_stab;;
let fix_subset = Sections.finalize_theorem fix_subset;;
let acts1 = Sections.finalize_theorem acts1;;
let acts_in = Sections.finalize_theorem acts_in;;
let acts_op = Sections.finalize_theorem acts_op;;
let acts_sub = Sections.finalize_theorem acts_sub;;
let orbit_subset = Sections.finalize_theorem orbit_subset;;
let x_in_orbit = Sections.finalize_theorem x_in_orbit;;
let stab_subgroup = Sections.finalize_theorem stab_subgroup;;
let stab_group = Sections.finalize_theorem stab_group;;
let orbits_disj = Sections.finalize_theorem orbits_disj;;
let fix_orbit_imp = Sections.finalize_theorem fix_orbit_imp;;
let fix_orbit = Sections.finalize_theorem fix_orbit;;
let x_in_orbit = Sections.finalize_theorem x_in_orbit;;
let sing_orbit = Sections.finalize_theorem sing_orbit;;
let orbit_image = Sections.finalize_theorem orbit_image;;
let finite_orbit = Sections.finalize_theorem finite_orbit;;
let bij_orbit_cosets = Sections.finalize_theorem bij_orbit_cosets;;
let card_orbit = Sections.finalize_theorem card_orbit;;
let set_union_orbits = Sections.finalize_theorem set_union_orbits;;
let card_set = Sections.finalize_theorem card_set;;
let card_set_fix = Sections.finalize_theorem card_set_fix;;
let card_orbit_p_group = Sections.finalize_theorem card_orbit_p_group;;
let DIVIDES_NSUM = Sections.finalize_theorem DIVIDES_NSUM;;
let sum_orbit_p_group = Sections.finalize_theorem sum_orbit_p_group;;
let p_div_fix = Sections.finalize_theorem p_div_fix;;
let fix_mod_p = Sections.finalize_theorem fix_mod_p;;
Sections.end_section "Action";;
(* Lemma has_size_tuples *)
let has_size_tuples = Sections.section_proof ["s";"n"]
`FINITE (s:T -> bool) ==>
{t | sizel t = n /\ (!x. x <- t ==> x IN s)} HAS_SIZE CARD s EXP n`
[
(BETA_TAC THEN (move ["finS"]));
(((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])]) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))));
((((use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`[]:(T)list`))) (term_tac exists_tac)));
(((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]));
(((split_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (move ["y"])) THEN (((use_arg_then2 ("MEM", [MEM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "r")));
((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "l")));
(BETA_TAC THEN (move ["IHn"]));
((fun arg_tac -> arg_tac (Arg_term (`l = IMAGE (\p. FST p :: SND p) (s CROSS r)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CROSS", [CROSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["u"]));
((THENL) (((use_arg_then2 ("u", [])) (disch_tac [])) THEN (clear_assumption "u") THEN case) [ALL_TAC; ((move ["a"]) THEN (move ["u"]))]);
(((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = _`)])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]));
(((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] []))))) THEN (split_tac));
((BETA_TAC THEN (case THEN ((move ["size_u"]) THEN (move ["x_mem"])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`a, u`))) (term_tac exists_tac)) THEN (simp_tac)) THEN ((((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac))) THEN (simp_tac)));
(((((fun arg_tac -> (use_arg_then2 ("x_mem", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_u", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["mem_x"]));
((((fun arg_tac -> (use_arg_then2 ("x_mem", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["p"])) THEN (case THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (case THEN (move ["a"])) THEN (case THEN (move ["u"])) THEN (case THEN ((case THEN ((move ["as"]) THEN (move ["ur"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (simp_tac));
((((use_arg_then2 ("ur", [])) (disch_tac [])) THEN (clear_assumption "ur") THEN BETA_TAC) THEN (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["mem_x"])))));
((((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((THENL) case [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ALL_TAC]) THEN (((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN (exact_tac)) THEN (done_tac));
((((use_arg_then2 ("IHn", [])) (disch_tac [])) THEN (clear_assumption "IHn") THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["finR"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))))));
((THENL_ROT (-1)) (((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (split_tac)));
(((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_CROSS", [FINITE_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CARD_CROSS", [CARD_CROSS]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((BETA_TAC THEN (move ["p1"]) THEN (move ["p2"]) THEN (simp_tac) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))) THEN (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))));
((((use_arg_then2 ("p1", [])) (disch_tac [])) THEN (clear_assumption "p1") THEN case THEN (move ["x1"]) THEN (move ["y1"])) THEN (((use_arg_then2 ("p2", [])) (disch_tac [])) THEN (clear_assumption "p2") THEN case THEN (move ["x2"]) THEN (move ["y2"]) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma card_tuples *)
let card_tuples = Sections.section_proof ["s";"n"]
`FINITE s ==> CARD {t | sizel t = n /\ (!x. x <- t ==> x IN s)} = CARD s EXP n`
[
(((DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_size_tuples", [has_size_tuples])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma finite_tuples *)
let finite_tuples = Sections.section_proof ["s";"n"]
`FINITE s ==> FINITE {t | sizel t = n /\ (!x. x <- t ==> x IN s)}`
[
(((DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_size_tuples", [has_size_tuples])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Section MoreSeq *)
Sections.begin_section "MoreSeq";;
(* Lemma rot_nseq *)
let rot_nseq = Sections.section_proof ["n";"x";"k"]
`rot k (nseq n x) = nseq n x`
[
((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac));
(((((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["jn"]));
((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] [])))));
((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n - k`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["ineq"]); ALL_TAC]);
(((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("nth_drop", [nth_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
((THENL_FIRST) ((THENL) (((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN case) [ALL_TAC; (move ["k"])]) (((((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
((THENL_FIRST) (((use_arg_then2 ("nth_take", [nth_take]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("jn", [])) (disch_tac [])) THEN (clear_assumption "jn") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
(((((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma in_nseq_imp *)
let in_nseq_imp = Sections.section_proof ["n";"x";"y"]
`y <- nseq n x ==> y = x`
[
(((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN case THEN (done_tac));
];;
(* Lemma in_nseq *)
let in_nseq = Sections.section_proof ["n";"x";"y"]
`~(n = 0) ==> (y <- nseq n x <=> y = x)`
[
((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [((simp_tac THEN TRY done_tac)); ((move ["n"]) THEN (move ["IHn"]) THEN (move ["_"]))]);
((((use_arg_then2 ("IHn", [])) (disch_tac [])) THEN (clear_assumption "IHn") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case THEN ((simp_tac THEN TRY done_tac))) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma rot_same *)
let rot_same = Sections.section_proof ["t"]
`(!k. k < sizel t ==> rot k t = t) <=> (!k. rot k t = t)`
[
((split_tac) THEN (simp_tac) THEN (move ["rot_eq"]) THEN (move ["k"]));
((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) THEN (TRY ((exact_tac))));
(((use_arg_then2 ("rot_oversize", [rot_oversize])) (thm_tac apply_tac)) THEN (done_tac));
];;
(* Lemma rot_const *)
let rot_const = Sections.section_proof ["t"]
`(!k. k < sizel t ==> rot k t = t) ==> t = nseq (sizel t) (HD t)`
[
(((use_arg_then2 ("rot_same", [rot_same]))(thm_tac (new_rewrite [] []))));
((THENL_FIRST) (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN (((use_arg_then2 ("HD", [HD]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) (((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)));
(((fun arg_tac -> arg_tac (Arg_term (`h :: t`))) (term_tac (set_tac "l"))) THEN (BETA_TAC THEN (move ["rot_eq"])));
(((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
((((((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_size"])) THEN ((((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))));
(((fun arg_tac -> (use_arg_then2 ("rot_eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel l - j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))));
((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subKn", [subKn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("nth0", [nth0])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
((fun arg_tac -> arg_tac (Arg_term (`?n. sizel l - j = SUC n`))) (term_tac (have_gen_tac []ALL_TAC)));
(((fun arg_tac -> arg_tac (Arg_term (`sizel l - j - 1`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("j_size", [])) (disch_tac [])) THEN (clear_assumption "j_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
((BETA_TAC THEN (case THEN ((move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma cat_nseq_nseq *)
let cat_nseq_nseq = Sections.section_proof ["n";"m";"x"]
`cat (nseq n x) (nseq m x) = nseq (n + m) x`
[
(((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))));
(((((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nseq", [nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("IHn", []))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac));
];;
(* Finalization of the section MoreSeq *)
let rot_nseq = Sections.finalize_theorem rot_nseq;;
let in_nseq_imp = Sections.finalize_theorem in_nseq_imp;;
let in_nseq = Sections.finalize_theorem in_nseq;;
let rot_same = Sections.finalize_theorem rot_same;;
let rot_const = Sections.finalize_theorem rot_const;;
let cat_nseq_nseq = Sections.finalize_theorem cat_nseq_nseq;;
Sections.end_section "MoreSeq";;
(* Section ProdExp *)
Sections.begin_section "ProdExp";;
let expg = GEN_ALL (define `expg (op, e) g 0 = e /\
expg (op, e) g (SUC n) = op g (expg (op, e) g n)`);;
(* Lemma expg_prod *)
let expg_prod = Sections.section_proof ["op";"e";"g";"n"]
`expg (op, e) g n = foldr op e (nseq n g)`
[
(((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nseq", [nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))));
(((((use_arg_then2 ("ncons", [ncons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma expg0 *)
let expg0 = Sections.section_proof ["op";"e";"g"]
`expg (op, e) g 0 = e`
[
((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Lemma expgS *)
let expgS = Sections.section_proof ["op";"e";"g";"n"]
`expg (op, e) g (SUC n) = op g (expg (op, e) g n)`
[
((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));;
(* Lemma exp1g *)
let exp1g = Sections.section_proof ["n"]
`expg (op, e) e n = e`
[
(((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))));
(((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma expg1 *)
let expg1 = Sections.section_proof ["g"]
`g IN G ==> expg (op, e) g 1 = g`
[
((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma prod_in *)
let prod_in = Sections.section_proof ["t"]
`(!g. g <- t ==> g IN G) ==> foldr op e t IN G`
[
((THENL_FIRST) (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN elim) [ALL_TAC; ((move ["a"]) THEN (move ["t"]) THEN (move ["IHt"]))]) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
((BETA_TAC THEN (move ["memG"])) THEN (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))));
((((((use_arg_then2 ("memG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHt", []))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["mem_g"])) THEN (((use_arg_then2 ("memG", [])) (disch_tac [])) THEN (clear_assumption "memG") THEN (DISCH_THEN apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma expg_in *)
let expg_in = Sections.section_proof ["n";"g"]
`g IN G ==> expg (op, e) g n IN G`
[
((BETA_TAC THEN (move ["gG"])) THEN (((((use_arg_then2 ("expg_prod", [expg_prod]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("prod_in", [prod_in]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_nseq_imp", [in_nseq_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma prod_cat *)
let prod_cat = Sections.section_proof ["t1";"t2"]
`(!g. g <- t1 \/ g <- t2 ==> g IN G) ==>
foldr op e (t1 ++ t2) = op (foldr op e t1) (foldr op e t2)`
[
(((THENL) (((use_arg_then2 ("t2", [])) (disch_tac [])) THEN (clear_assumption "t2") THEN ((use_arg_then2 ("t1", [])) (disch_tac [])) THEN (clear_assumption "t1") THEN elim) [((move ["t2"]) THEN (move ["inG"])); ((move ["a"]) THEN (move ["t"]) THEN (move ["IHt"]) THEN (move ["t2"]) THEN (move ["inG"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))));
((((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("prod_in", [prod_in]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["mem_g"])) THEN (((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("prod_in", [prod_in]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((BETA_TAC THEN (move ["g"]) THEN (move ["mem_g"])))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
((((((use_arg_then2 ("IHt", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["g"])) THEN (case THEN (move ["h"])) THEN ((((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma expg_add *)
let expg_add = Sections.section_proof ["g";"n";"m"]
`g IN G ==>
expg (op, e) g (n + m) = op (expg (op, e) g n) (expg (op, e) g m)`
[
((BETA_TAC THEN (move ["inG"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("expg_prod", [expg_prod]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("prod_cat", [prod_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cat_nseq_nseq", [cat_nseq_nseq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))));
((BETA_TAC THEN (move ["x"])) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_nseq_imp", [in_nseq_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma expg_expg *)
let expg_expg = Sections.section_proof ["g";"n";"m"]
`g IN G ==>
expg (op, e) (expg (op, e) g n) m = expg (op, e) g (n * m)`
[
((BETA_TAC THEN (move ["gG"])) THEN ((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]));
(((((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHm", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnS", [mulnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_add", [expg_add]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma expg_inv *)
let expg_inv = Sections.section_proof ["n";"g"]
`g IN G ==> i (expg (op, e) g n) = expg (op, e) (i g) n`
[
((THENL_FIRST) ((BETA_TAC THEN (move ["gG"])) THEN ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))])) (((repeat_tactic 1 9 (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("invg_e", [invg_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
(((((use_arg_then2 ("addn1", [addn1]))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("expg_add", [expg_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulI", [mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("expg_in", [expg_in]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg1", [expg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Finalization of the section ProdExp *)
let expg_prod = Sections.finalize_theorem expg_prod;;
let expg0 = Sections.finalize_theorem expg0;;
let expgS = Sections.finalize_theorem expgS;;
let exp1g = Sections.finalize_theorem exp1g;;
let expg1 = Sections.finalize_theorem expg1;;
let prod_in = Sections.finalize_theorem prod_in;;
let expg_in = Sections.finalize_theorem expg_in;;
let prod_cat = Sections.finalize_theorem prod_cat;;
let expg_add = Sections.finalize_theorem expg_add;;
let expg_expg = Sections.finalize_theorem expg_expg;;
let expg_inv = Sections.finalize_theorem expg_inv;;
Sections.end_section "ProdExp";;
(* Lemma minP_exists *)
let minP_exists = Sections.section_proof ["P";"k"]
`P k ==> ?n. P n /\ (!m. P m ==> n <= m)`
[
((((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN BETA_TAC) THEN (((use_arg_then2 ("num_WF", [num_WF])) (disch_tac [])) THEN (clear_assumption "num_WF") THEN (DISCH_THEN apply_tac) THEN (move ["k"]) THEN (move ["IH"]) THEN (move ["Pk"])));
(((fun arg_tac -> (use_arg_then2 ("orbN", [orbN])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`?m. m < k /\ P m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case);
((BETA_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["mk"]) THEN (move ["Pm"])))) THEN (((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)) THEN (done_tac));
(((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]));
(((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("Pk", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["m"]) THEN (move ["Pm"])));
((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("Pm", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Section Cyclic *)
Sections.begin_section "Cyclic";;
let orderg = new_definition `orderg (op, e) g =
@n. ~(n = 0) /\ expg (op, e) g n = e /\ (!m. ~(m = 0) /\ expg (op, e) g m = e ==> n <= m)`;;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("g", (`:A`))));;
(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));;
(* Lemma order_e *)
let order_e = Sections.section_proof []
`orderg (op, e) e = 1`
[
((THENL_ROT (-1)) ((((use_arg_then2 ("orderg", [orderg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SELECT_UNIQUE", [SELECT_UNIQUE])) (thm_tac apply_tac)) THEN (simp_tac) THEN (move ["n"])) THEN (split_tac)));
((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((((fun arg_tac -> (use_arg_then2 ("expg1", [expg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["m"])) THEN (arith_tac) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["n0"])) THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)));
(((((fun arg_tac -> (use_arg_then2 ("expg1", [expg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
];;
(* Lemma INFINITE_SUBSET *)
let INFINITE_SUBSET = Sections.section_proof ["s";"t"]
`INFINITE s ==> s SUBSET t ==> INFINITE t`
[
(((repeat_tactic 1 9 (((use_arg_then2 ("INFINITE", [INFINITE]))(thm_tac (new_rewrite [] []))))) THEN (move ["hs"]) THEN (move ["hst"])) THEN (((use_arg_then2 ("hs", [])) (disch_tac [])) THEN (clear_assumption "hs") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["fin_t"])));
(((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(Sections.add_section_hyp "gG" (`g IN G`));;
(* Lemma order_exists0 *)
let order_exists0 = Sections.section_proof []
`?n. ~(n = 0) /\ expg (op, e) g n = e`
[
((((use_arg_then2 ("finG", [])) (disch_tac [])) THEN (clear_assumption "finG") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INFINITE", [INFINITE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (move ["Hexp"])));
((use_arg_then2 ("INFINITE_SUBSET", [INFINITE_SUBSET])) (thm_tac apply_tac));
((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`IMAGE (expg (op, e) g) UNIV`))) (term_tac exists_tac)) THEN (split_tac)));
((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (case THEN (move ["n"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((((use_arg_then2 ("INFINITE_IMAGE_INJ", [INFINITE_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("num_INFINITE", [num_INFINITE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["n"]) THEN (move ["m"]));
((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac ALL_TAC[`n`; `m`])));
(BETA_TAC THEN (move ["h"]));
(((THENL_LAST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_total", [leq_total])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac));
(BETA_TAC THEN (move ["n_le_m"]));
((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltngtP", [ltngtP])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_le_m", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
((THENL) case [((move ["n_lt_m"]) THEN (move ["exp_eq"])); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]);
(((fun arg_tac -> (use_arg_then2 ("Hexp", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m - n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
((((use_arg_then2 ("subn_eq0", [subn_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_lt_m", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac));
(((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac) THEN (move ["_"]));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulg_rightI", [mulg_rightI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`expg (op, e) g n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac));
((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma order_exists *)
let order_exists = Sections.section_proof []
`~(orderg (op, e) g = 0) /\
expg (op, e) g (orderg (op, e) g) = e /\
(!m. ~(m = 0) /\ expg (op, e) g m = e ==> orderg (op, e) g <= m)`
[
((fun arg_tac -> arg_tac (Arg_term (`\n. ~(n = 0) /\ expg (op, e) g n = e /\ (!m. ~(m = 0) /\ expg (op, e) g m = e ==> n <= m)`))) (term_tac (set_tac "P")));
(((fun arg_tac -> (use_arg_then2 ("SELECT_AX", [SELECT_AX])) (fun fst_arg -> (use_arg_then2 ("P", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC);
(((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("orderg", [orderg]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN apply_tac));
((((use_arg_then2 ("CONJ_ASSOC", [CONJ_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minP_exists", [minP_exists])) (disch_tac [])) THEN (clear_assumption "minP_exists") THEN (DISCH_THEN apply_tac)));
(((use_arg_then2 ("order_exists0", [order_exists0])) (disch_tac [])) THEN (clear_assumption "order_exists0") THEN (exact_tac));
];;
(* Lemma order1 *)
let order1 = Sections.section_proof []
`orderg (op, e) g = 1 <=> g = e`
[
((THENL_LAST) (split_tac) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("order_e", [order_e]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
((BETA_TAC THEN (move ["o1"])) THEN (((use_arg_then2 ("order_exists", [order_exists])) (disch_tac [])) THEN (clear_assumption "order_exists") THEN BETA_TAC));
((((((use_arg_then2 ("o1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg1", [expg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma fin_inv_expg *)
let fin_inv_expg = Sections.section_proof []
`?k. i g = expg (op, e) g k`
[
((((use_arg_then2 ("order_exists0", [order_exists0])) (disch_tac [])) THEN (clear_assumption "order_exists0") THEN BETA_TAC) THEN ((((use_arg_then2 ("lt0n", [lt0n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["n"])) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["n_eq"]) THEN (move ["exp1"])))));
((fun arg_tac -> arg_tac (Arg_term (`n - 1`))) (term_tac exists_tac));
((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulg_leftI", [mulg_leftI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("expgS", [expgS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("exp1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma expg_inj *)
let expg_inj = Sections.section_proof ["n";"m"]
`n < orderg (op, e) g ==> m < orderg (op, e) g ==>
(expg (op, e) g n = expg (op, e) g m <=> n = m)`
[
((THENL) ((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac ALL_TAC[`n`; `m`]))) [((move ["h"]) THEN (move ["n_lt"]) THEN (move ["m_lt"])); ((move ["n_le_m"]) THEN (move ["n_lt"]) THEN (move ["m_lt"]))]);
((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (exact_tac) THEN (done_tac)));
((((((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`expg (op, e) g n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_LE", [NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (exact_tac) THEN (done_tac));
((THENL_LAST) (split_tac) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
((((fun arg_tac -> (use_arg_then2 ("subnK", [subnK])) (fun fst_arg -> (use_arg_then2 ("n_le_m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
(((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["eq"]));
((((use_arg_then2 ("n_le_m", [])) (disch_tac [])) THEN (clear_assumption "n_le_m") THEN BETA_TAC) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN (case THEN ((TRY done_tac)) THEN (move ["n_lt_m"])));
((((use_arg_then2 ("order_exists", [order_exists])) (disch_tac [])) THEN (clear_assumption "order_exists") THEN BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m - n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
((THENL_FIRST) (ANTS_TAC) ((((use_arg_then2 ("n_lt_m", [])) (disch_tac [])) THEN (clear_assumption "n_lt_m") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)));
((((use_arg_then2 ("m_lt", [])) (disch_tac [])) THEN (clear_assumption "m_lt") THEN ((use_arg_then2 ("n_lt_m", [])) (disch_tac [])) THEN (clear_assumption "n_lt_m") THEN BETA_TAC) THEN (arith_tac));
];;
(* Lemma expg_eq_mod *)
let expg_eq_mod = Sections.section_proof ["n"]
`expg (op, e) g n = expg (op, e) g (n MOD orderg (op, e) g) /\
n MOD orderg (op, e) g < orderg (op, e) g`
[
((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["_"])))))));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIVMOD_EXIST", [DIVMOD_EXIST])) (fun fst_arg -> (use_arg_then2 ("on0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["q"])) THEN (case THEN (move ["r"])) THEN (case THEN ((move ["n_eq"]) THEN (move ["r_lt"]))));
(((fun arg_tac -> (use_arg_then2 ("DIVMOD_UNIQ", [DIVMOD_UNIQ])) (fun fst_arg -> (use_arg_then2 ("n_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
((((use_arg_then2 ("r_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_expg", [expg_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("exp1g", [exp1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma expg_eq *)
let expg_eq = Sections.section_proof ["n"]
`?r. r < orderg (op, e) g /\ expg (op, e) g n = expg (op, e) g r`
[
((fun arg_tac -> arg_tac (Arg_term (`n MOD orderg (op, e) g`))) (term_tac exists_tac));
(((((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma cyclic_eq *)
let cyclic_eq = Sections.section_proof []
`IMAGE (expg (op, e) g) UNIV = IMAGE (expg (op, e) g) (0..(orderg (op, e) g - 1))`
[
((THENL_ROT (-1)) ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"])) THEN ((THENL) (split_tac) [(case THEN ((move ["n"]) THEN (move ["y_eq"]))); ((case THEN (move ["n"])) THEN (move ["h"]))])));
(((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (done_tac));
(((fun arg_tac -> (use_arg_then2 ("expg_eq", [expg_eq])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["r"])) THEN (case THEN ((move ["r_lt"]) THEN (move ["r_eq"]))));
(((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("r_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r_lt", [])) (disch_tac [])) THEN (clear_assumption "r_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
];;
(* Lemma cyclic_eq2 *)
let cyclic_eq2 = Sections.section_proof []
`IMAGE (expg (op, e) g) UNIV = IMAGE (expg (op, e) g) (1..orderg (op, e) g)`
[
((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["_"])))))));
((((((use_arg_then2 ("cyclic_eq", [cyclic_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"])) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["n"])) THEN (case THEN ((move ["y_eq"]) THEN (move ["n_in"])))));
(((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["n_eq"]));
(((fun arg_tac -> arg_tac (Arg_term (`orderg (op, e) g`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg0", [expg0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("on0", [])) (disch_tac [])) THEN (clear_assumption "on0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
(((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN ((use_arg_then2 ("n_eq", [])) (disch_tac [])) THEN (clear_assumption "n_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
(((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n = orderg (op, e) g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["n_eq"]));
(((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg0", [expg0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN ((use_arg_then2 ("n_eq", [])) (disch_tac [])) THEN (clear_assumption "n_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
];;
(* Lemma cyclic_finite *)
let cyclic_finite = Sections.section_proof []
`FINITE (IMAGE (expg (op, e) g) UNIV)`
[
(((((use_arg_then2 ("cyclic_eq2", [cyclic_eq2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma cyclic_card *)
let cyclic_card = Sections.section_proof []
`CARD (IMAGE (expg (op, e) g) UNIV) = orderg (op, e) g`
[
((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["_"])))))));
((((use_arg_then2 ("cyclic_eq", [cyclic_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CARD_NUMSEG", [CARD_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))));
(BETA_TAC THEN (move ["n"]) THEN (move ["m"]) THEN (case THEN (move ["n_in"])) THEN (case THEN (move ["m_in"])));
(((((use_arg_then2 ("expg_inj", [expg_inj]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("on0", [])) (disch_tac [])) THEN (clear_assumption "on0") THEN ((use_arg_then2 ("m_in", [])) (disch_tac [])) THEN (clear_assumption "m_in") THEN ((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
((((use_arg_then2 ("on0", [])) (disch_tac [])) THEN (clear_assumption "on0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
];;
(* Lemma lt_order *)
let lt_order = Sections.section_proof ["n"]
`expg (op, e) g n = e ==> n < orderg (op, e) g ==> n = 0`
[
(BETA_TAC THEN (move ["n_eq"]) THEN (move ["n_lt"]));
((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["o_min"])))))));
((((fun arg_tac -> (use_arg_then2 ("o_min", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("implyNb", [implyNb]))(thm_tac (new_rewrite [] []))))) THEN (case THEN ((TRY done_tac))));
((((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
];;
(* Lemma order_div *)
let order_div = Sections.section_proof ["n"]
`expg (op, e) g n = e <=> orderg (op, e) g divides n`
[
((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ALL_TAC) THEN (move ["oe"]) THEN (move ["_"])))));
((THENL) (split_tac) [(move ["n_eq"]); ALL_TAC]);
((((fun arg_tac -> (use_arg_then2 ("DIVIDES_MOD", [DIVIDES_MOD])) (fun fst_arg -> (use_arg_then2 ("on0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_order", [lt_order])) (disch_tac [])) THEN (clear_assumption "lt_order") THEN (DISCH_THEN apply_tac)));
(((((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["q"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((((fun arg_tac -> (use_arg_then2 ("expg_expg", [expg_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("exp1g", [exp1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma order_prime *)
let order_prime = Sections.section_proof ["p"]
`prime p ==> expg (op, e) g p = e ==> g = e \/ orderg (op, e) g = p`
[
(((((use_arg_then2 ("prime", [prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("order_div", [order_div]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["pH"]));
(((DISCH_THEN (fun snd_th -> (use_arg_then2 ("pH", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("order1", [order1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Finalization of the section Cyclic *)
let order_e = Sections.finalize_theorem order_e;;
let INFINITE_SUBSET = Sections.finalize_theorem INFINITE_SUBSET;;
let order_exists0 = Sections.finalize_theorem order_exists0;;
let order_exists = Sections.finalize_theorem order_exists;;
let order1 = Sections.finalize_theorem order1;;
let fin_inv_expg = Sections.finalize_theorem fin_inv_expg;;
let expg_inj = Sections.finalize_theorem expg_inj;;
let expg_eq_mod = Sections.finalize_theorem expg_eq_mod;;
let expg_eq = Sections.finalize_theorem expg_eq;;
let cyclic_eq = Sections.finalize_theorem cyclic_eq;;
let cyclic_eq2 = Sections.finalize_theorem cyclic_eq2;;
let cyclic_finite = Sections.finalize_theorem cyclic_finite;;
let cyclic_card = Sections.finalize_theorem cyclic_card;;
let lt_order = Sections.finalize_theorem lt_order;;
let order_div = Sections.finalize_theorem order_div;;
let order_prime = Sections.finalize_theorem order_prime;;
Sections.end_section "Cyclic";;
(* Section MoreCyclic *)
Sections.begin_section "MoreCyclic";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("g", (`:A`))));;
(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(Sections.add_section_hyp "gG" (`g IN G`));;
(* Lemma cyclic_subgroup *)
let cyclic_subgroup = Sections.section_proof []
`subgroup op i (IMAGE (expg (op, e) g) UNIV) G`
[
(((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac));
((BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["n"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((((use_arg_then2 ("IMAGE_EQ_EMPTY", [IMAGE_EQ_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("UNIV_NOT_EMPTY", [UNIV_NOT_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ((move ["m"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fin_inv_expg", [fin_inv_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`expg (op, e) g m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
(((((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["k"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
((fun arg_tac -> arg_tac (Arg_term (`n + m * k`))) (term_tac exists_tac));
(((((fun arg_tac -> (use_arg_then2 ("expg_expg", [expg_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma cyclic_group *)
let cyclic_group = Sections.section_proof []
`group (IMAGE (expg (op, e) g) UNIV, op, i, e)`
[
((((fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("cyclic_subgroup", [cyclic_subgroup])) (disch_tac [])) THEN (clear_assumption "cyclic_subgroup") THEN (exact_tac)) THEN (done_tac));
];;
(* Lemma order_div_group *)
let order_div_group = Sections.section_proof []
`orderg (op, e) g divides CARD G`
[
((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cyclic_subgroup", [cyclic_subgroup])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("cyclic_card", [cyclic_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "c")));
((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("c", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Finalization of the section MoreCyclic *)
let cyclic_subgroup = Sections.finalize_theorem cyclic_subgroup;;
let cyclic_group = Sections.finalize_theorem cyclic_group;;
let order_div_group = Sections.finalize_theorem order_div_group;;
Sections.end_section "MoreCyclic";;
(* Section Cauchy *)
Sections.begin_section "Cauchy";;
(Sections.add_section_var (mk_var ("p", (`:num`))));;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(* Lemma add_mod_alt *)
let add_mod_alt = Sections.section_proof ["n";"m"]
`n < p ==> m < p ==>
add_mod p n m = if n + m < p then n + m else (n + m) - p`
[
((BETA_TAC THEN (move ["np"]) THEN (move ["mp"])) THEN (((use_arg_then2 ("add_mod", [add_mod]))(thm_tac (new_rewrite [] [])))));
((THENL_FIRST) (((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n + m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [ALL_TAC; (move ["le"])]) THEN (simp_tac)) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)));
((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("subnK", [subnK])) (fun fst_arg -> (use_arg_then2 ("le", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1n", [mul1n])) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("MOD_MULT_ADD", [MOD_MULT_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
((((use_arg_then2 ("np", [])) (disch_tac [])) THEN (clear_assumption "np") THEN ((use_arg_then2 ("mp", [])) (disch_tac [])) THEN (clear_assumption "mp") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
];;
(Sections.add_section_hyp "prime_p" (`prime p`));;
(* Lemma PRIME_DIVIDES *)
let PRIME_DIVIDES = Sections.section_proof ["n"]
`p divides n ==> n = 0 \/ 2 <= n`
[
((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISJ2_TAC));
((((fun arg_tac -> (use_arg_then2 ("PRIME_GE_2", [PRIME_GE_2])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
];;
(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(* Lemma has_size_group_tuples *)
let has_size_group_tuples = Sections.section_proof []
`{t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e} HAS_SIZE CARD G EXP (p - 1)`
[
((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "l")));
((fun arg_tac -> arg_tac (Arg_term (`l = IMAGE (\y. i (foldr op e y) :: y) {t | sizel t = p - 1 /\ (!g. g <- t ==> g IN G)}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["t"]));
((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]);
(((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = p`)])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`[] = _`)])))) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC));
(((((fun arg_tac -> arg_tac (Arg_theorem (TAUT `!P. ~P <=> (P ==> F)`)))(thm_tac (new_rewrite [] [])))) THEN (move ["p_eq"])) THEN (((use_arg_then2 ("prime_p", [])) (disch_tac [])) THEN (clear_assumption "prime_p") THEN BETA_TAC));
(((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PRIME_0", [PRIME_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (split_tac));
((BETA_TAC THEN (case THEN (move ["size_t"])) THEN (case THEN (move ["inG"]))) THEN ((((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (move ["prod_eq"])));
((THENL_ROT (-1)) (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addn1", [addn1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)));
((BETA_TAC THEN (move ["g"]) THEN (move ["mem_g"])) THEN ((((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("prod_eq", [])) (disch_tac [])) THEN (clear_assumption "prod_eq") THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (TRY ((BETA_TAC THEN (move ["g"]) THEN (move ["mem_g"])))) THEN ((((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((BETA_TAC THEN (case THEN (move ["t2"]))) THEN ((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["inG"])))));
((((use_arg_then2 ("prednK", [prednK]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
((((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"])) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ((TRY done_tac))]));
(((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((THENL_LAST) (((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (split_tac)) ((((use_arg_then2 ("has_size_tuples", [has_size_tuples]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
((BETA_TAC THEN (move ["x"]) THEN (move ["y"])) THEN ((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma actsZ *)
let actsZ = Sections.section_proof []
`acts ({k | k < p}, add_mod p, 0)
{t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e} rot`
[
((THENL_LAST) ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 2 ((split_tac)))) ((((use_arg_then2 ("rot0", [rot0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)));
((BETA_TAC THEN (move ["k"]) THEN (move ["t"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["k_p"])) THEN (case THEN (move ["size_t"])) THEN (case THEN (move ["inG"]))));
(((((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("inG", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)));
(((THENL) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("prod_cat", [prod_cat])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) [(move ["g"]); (move ["g"]); ALL_TAC]) THEN (TRY (case)) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_drop", [mem_drop])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_take", [mem_take])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY ((done_tac))));
(((THENL) ((((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) [(move ["g"]); (move ["g"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_drop", [mem_drop])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_take", [mem_take])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY ((done_tac))));
((((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["g"])) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_drop", [mem_drop])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac));
((BETA_TAC THEN (move ["k1"]) THEN (move ["k2"]) THEN (move ["t"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (case THEN ((move ["k1_p"]) THEN (move ["k2_p"])))) THEN (case THEN ((move ["size_t"]) THEN (move ["_"])))));
((((use_arg_then2 ("rot_add_mod", [rot_add_mod]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [(`k1 <= _`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [(`k2 <= _`)]))))) THEN ((TRY done_tac)));
(((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leqP", [leqP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k1 + k2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac));
((((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) case [(move ["eq"]); (move ["ineq"])]));
(((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_size", [rot_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_mod_alt", [add_mod_alt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot0", [rot0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("add_mod_alt", [add_mod_alt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["ineq"]));
((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_mod_alt", [add_mod_alt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] []))))));
((((fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma fix_order *)
let fix_order = Sections.section_proof []
`Fix {k | k < p} {t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e} rot =
{nseq p g | g | g IN G /\ expg (op, e) g p = e}`
[
((THENL_ROT (-1)) ((((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["t"])) THEN (split_tac)));
(BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((case THEN ((move ["gG"]) THEN (move ["eq"]))) THEN (move ["t_eq"]))));
(((((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("expg_prod", [expg_prod]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["h"])));
(((((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_nseq", [in_nseq]))(thm_tac (new_rewrite [] []))))) THEN (TRY (((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)))));
(((((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["p0"])) THEN (((use_arg_then2 ("prime_p", [])) (disch_tac [])) THEN (clear_assumption "prime_p") THEN BETA_TAC));
(((((use_arg_then2 ("p0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PRIME_0", [PRIME_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_nseq", [rot_nseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (case THEN (case THEN (move ["size_t"]))) THEN (case THEN ((move ["inG"]) THEN (move ["prod_e"]) THEN (move ["rot_eq"]))));
((fun arg_tac -> arg_tac (Arg_term (`HD t`))) (term_tac exists_tac));
(((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`t = nseq p (HD t)`))) (term_tac (have_gen_tac [](move ["eq"])))));
((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [3] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_prod", [expg_prod]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("prod_e", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))));
((THENL_LAST) ((THENL) (((use_arg_then2 ("size_t", [])) (disch_tac [])) THEN (clear_assumption "size_t") THEN ((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["tt"]))]) (((((use_arg_then2 ("HD", [HD]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)));
(((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"])) THEN (((use_arg_then2 ("prime_p", [])) (disch_tac [])) THEN (clear_assumption "prime_p") THEN BETA_TAC));
(((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PRIME_0", [PRIME_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_const", [rot_const]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma cauchy0 *)
let cauchy0 = Sections.section_proof []
`p divides CARD G ==> ?g. g IN G /\ ~(g = e) /\ expg (op, e) g p = e`
[
(BETA_TAC THEN (move ["p_div_G"]));
((fun arg_tac -> arg_tac (Arg_term (`{t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e}`))) (term_tac (set_tac "S")));
((fun arg_tac -> arg_tac (Arg_term (`p divides CARD S /\ FINITE S`))) (term_tac (have_gen_tac []ALL_TAC)));
((((use_arg_then2 ("has_size_group_tuples", [has_size_group_tuples])) (disch_tac [])) THEN (clear_assumption "has_size_group_tuples") THEN BETA_TAC) THEN (((((use_arg_then2 ("S_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
((((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_REXP", [DIVIDES_REXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_div_G", []))(thm_tac (new_rewrite [] [])))));
((((fun arg_tac -> (use_arg_then2 ("PRIME_GE_2", [PRIME_GE_2])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
(BETA_TAC THEN (case THEN ((move ["p_divS"]) THEN (move ["finS"]))));
((((fun arg_tac -> (use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lt0n", [lt0n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("grZ", [grZ])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["grZ"])));
((fun arg_tac -> arg_tac (Arg_term (`CARD {k | k < p} = p EXP 1`))) (term_tac (have_gen_tac [](move ["cardZ"]))));
(((((use_arg_then2 ("CARD_NUMSEG_LT", [CARD_NUMSEG_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP_1", [EXP_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p_div_fix", [p_div_fix])) (fun fst_arg -> (use_arg_then2 ("actsZ", [actsZ])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grZ", [grZ])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("FINITE_NUMSEG_LT", [FINITE_NUMSEG_LT])) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cardZ", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
((((use_arg_then2 ("S_def", []))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_divS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)));
((fun arg_tac -> arg_tac (Arg_term (`FINITE (Fix {k | k < p} S rot)`))) (term_tac (have_gen_tac [](move ["fix_finite"]))));
(((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("finS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fix_subset", [fix_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("fix_finite", [])) (disch_tac [])) THEN (clear_assumption "fix_finite") THEN BETA_TAC) THEN (((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fix_order", [fix_order]))(thm_tac (new_rewrite [] []))))) THEN (move ["fix_finite"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("PRIME_DIVIDES", [PRIME_DIVIDES])) (thm_tac (match_mp_then snd_th MP_TAC))))));
case;
((((fun arg_tac -> (use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0])) (fun fst_arg -> (use_arg_then2 ("fix_finite", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])));
((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nseq p e`))) (term_tac exists_tac)));
(((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("exp1g", [exp1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "fix"))) THEN (move ["fix2"]));
((fun arg_tac -> arg_tac (Arg_term (`?n. fix HAS_SIZE (SUC (SUC n))`))) (term_tac (have_gen_tac []ALL_TAC)));
(((fun arg_tac -> arg_tac (Arg_term (`CARD fix - 2`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("addn1", [addn1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
((BETA_TAC THEN (case THEN (move ["n"]))) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["a1"])) THEN (case THEN (move ["t1"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a2"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
(((((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["na12"]) THEN (move ["_"]))) THEN (move ["fix_eq"]));
((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a1 IN fix /\ a2 IN fix`))) (term_tac (have_gen_tac []ALL_TAC))) (((((use_arg_then2 ("fix_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
(((repeat_tactic 1 9 (((use_arg_then2 ("fix_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (case THEN (move ["g1"]))) THEN (case THEN ((case THEN ((move ["g1G"]) THEN (move ["g1e"]))) THEN (move ["a1_eq"]))) THEN (case THEN (move ["g2"])) THEN (case THEN ((case THEN ((move ["g2G"]) THEN (move ["g2e"]))) THEN (move ["a2_eq"]))));
((THENL_LAST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g1 = e`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) ((BETA_TAC THEN (move ["g1_not_e"])) THEN ((use_arg_then2 ("g1", [])) (term_tac exists_tac)) THEN (done_tac)));
(BETA_TAC THEN (move ["g1_eq_e"]));
(((use_arg_then2 ("g2", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g2e", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g1_eq_e", []))(gsym_then (thm_tac (new_rewrite [] [])))))));
((((use_arg_then2 ("na12", [])) (disch_tac [])) THEN (clear_assumption "na12") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("a1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a2_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma cauchy *)
let cauchy = Sections.section_proof []
`p divides CARD G ==> ?H. subgroup op i H G /\ CARD H = p`
[
((DISCH_THEN (fun snd_th -> (use_arg_then2 ("cauchy0", [cauchy0])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (case THEN (move ["gne"])) THEN (move ["exp_e"]));
((fun arg_tac -> arg_tac (Arg_term (`IMAGE (expg (op, e) g) UNIV`))) (term_tac exists_tac));
((((fun arg_tac -> (use_arg_then2 ("cyclic_subgroup", [cyclic_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("cyclic_card", [cyclic_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("order_prime", [order_prime])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("exp_e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
((((use_arg_then2 ("gne", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
];;
(* Finalization of the section Cauchy *)
let add_mod_alt = Sections.finalize_theorem add_mod_alt;;
let PRIME_DIVIDES = Sections.finalize_theorem PRIME_DIVIDES;;
let has_size_group_tuples = Sections.finalize_theorem has_size_group_tuples;;
let actsZ = Sections.finalize_theorem actsZ;;
let fix_order = Sections.finalize_theorem fix_order;;
let cauchy0 = Sections.finalize_theorem cauchy0;;
let cauchy = Sections.finalize_theorem cauchy;;
Sections.end_section "Cauchy";;
(* Section GroupActions *)
Sections.begin_section "GroupActions";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("H", (`:A->bool`))));;
(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));;
(* Lemma finite_subgroups *)
let finite_subgroups = Sections.section_proof []
`FINITE G ==> FINITE {K | subgroup op i K G}`
[
((BETA_TAC THEN (move ["finG"])) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)));
(((fun arg_tac -> arg_tac (Arg_term (`{t | t SUBSET G}`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("FINITE_POWERSET", [FINITE_POWERSET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma finite_n_subgroups *)
let finite_n_subgroups = Sections.section_proof ["n"]
`FINITE G ==> FINITE {K | subgroup op i K G /\ K HAS_SIZE n}`
[
((BETA_TAC THEN (move ["finG"])) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)));
(((fun arg_tac -> arg_tac (Arg_term (`{K | subgroup op i K G}`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("finite_subgroups", [finite_subgroups]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac));
];;
(* Lemma subgroups_size_eq_card *)
let subgroups_size_eq_card = Sections.section_proof ["n"]
`FINITE G ==>
{K | subgroup op i K G /\ K HAS_SIZE n} = {K | subgroup op i K G /\ CARD K = n}`
[
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN (move ["finG"]) THEN (move ["K"])) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["subK"])));
(((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("K", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("G", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma group_acts_on_cosets *)
let group_acts_on_cosets = Sections.section_proof ["K"]
`K SUBSET G ==> acts (G, op, e) (cosets op G K) (\g. set_op1 (op g))`
[
((BETA_TAC THEN (move ["sKG"])) THEN (((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 ((split_tac))));
((BETA_TAC THEN (move ["g"]) THEN (move ["c"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["gG"])) THEN (case THEN (move ["h"])) THEN (case THEN (move ["hG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
(((fun arg_tac -> arg_tac (Arg_term (`op g h`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("left_mul_coset", [left_mul_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["c"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["g1G"]) THEN (move ["g2G"]))) THEN (case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("left_mul_coset", [left_mul_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))));
(((((fun arg_tac -> (use_arg_then2 ("left_mul_coset", [left_mul_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma group_acts_on_subgroups *)
let group_acts_on_subgroups = Sections.section_proof ["n"]
`acts (G, op, e)
{K | subgroup op i K G /\ K HAS_SIZE n} (\g. set_op1 (conjg (op, i) (i g)))`
[
(((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (repeat_tactic 1 9 ((split_tac))));
(BETA_TAC THEN (move ["g"]) THEN (move ["K"]) THEN (case THEN (move ["gG"])) THEN (case THEN (move ["subK"])) THEN (move ["sizeK"]));
((((fun arg_tac -> (use_arg_then2 ("subgroup_conjg", [subgroup_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
(((((fun arg_tac -> (use_arg_then2 ("conjg_set_has_size", [conjg_set_has_size])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["K"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["g1G"])) THEN (move ["g2G"]) THEN (case THEN (move ["subK"])) THEN (move ["sizeK"]));
(((((fun arg_tac -> (use_arg_then2 ("mul_conjg_set", [mul_conjg_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulI", [mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (move ["K"]) THEN (case THEN (move ["subK"])) THEN (move ["sizeK"]));
(((((fun arg_tac -> (use_arg_then2 ("invg1", [invg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g_set", [conj1g_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma conj_subgroup_stab *)
let conj_subgroup_stab = Sections.section_proof ["K"]
`K SUBSET G ==>
(Stab G (\g. set_op1 (conjg (op, i) (i g))) K = normalizer op i G K)`
[
(BETA_TAC THEN (move ["sKG"]));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"])));
((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN ((THENL) (split_tac) [(case THEN ((move ["xG"]) THEN (move ["K_eq"]))); (move ["xN"])]));
(((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("xN", [])) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(Sections.add_section_hyp "subH" (`subgroup op i H G`));;
(* Lemma subgroup_acts_on_cosets *)
let subgroup_acts_on_cosets = Sections.section_proof ["K"]
`K SUBSET G ==> acts (H, op, e) (cosets op G K) (\h. set_op1 (op h))`
[
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
(BETA_TAC THEN (move ["sKG"]));
(((fun arg_tac -> (use_arg_then2 ("acts_sub", [acts_sub])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("group_acts_on_cosets", [group_acts_on_cosets])) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
];;
(* Lemma subgroup_acts_on_subgroups *)
let subgroup_acts_on_subgroups = Sections.section_proof ["n"]
`acts (H, op, e)
{K | subgroup op i K G /\ K HAS_SIZE n} (\g. set_op1 (conjg (op, i) (i g)))`
[
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
(((fun arg_tac -> (use_arg_then2 ("acts_sub", [acts_sub])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("group_acts_on_subgroups", [group_acts_on_subgroups])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac));
];;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(* Lemma subgroup_left_mul_fix *)
let subgroup_left_mul_fix = Sections.section_proof []
`Fix H (cosets op G H) (\h. set_op1 (op h)) =
cosets op (normalizer op i G H) H`
[
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"])));
((((use_arg_then2 ("sHG", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sHG'"])));
((THENL_ROT (-1)) ((((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["c"])) THEN (split_tac)));
((BETA_TAC THEN (case THEN (move ["x"]))) THEN (((((fun arg_tac -> (use_arg_then2 ("in_normalizer", [in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["xG"])) THEN (move ["eq"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))));
((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`coset op x H`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)));
((BETA_TAC THEN (move ["h"]) THEN (move ["hH"])) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG'", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_op", [coset_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("coset_eq_e", [coset_eq_e])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
(BETA_TAC THEN (case THEN (move ["c1"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (move ["c1_eq"]))) THEN (move ["h_eq"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("c1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))));
((((fun arg_tac -> (use_arg_then2 ("in_normalizer", [in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
((THENL_ROT (-1)) ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET_CARD_EQ", [SUBSET_CARD_EQ]))(gsym_then (thm_tac (new_rewrite [] [])))))));
(((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_lmul_card", [set_lmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("set_rmul_card", [set_rmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_eq_image", [set_op1_eq_image]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["a"]) THEN (case THEN (move ["h"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["hH"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
((((fun arg_tac -> (use_arg_then2 ("h_eq", [])) (fun fst_arg -> (use_arg_then2 ("hH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("c1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`op h x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (ANTS_TAC));
((((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("x_in_coset", [x_in_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h2H"])) THEN (move ["op_eq"]) THEN (move ["_"]));
(((use_arg_then2 ("h2", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Finalization of the section GroupActions *)
let finite_subgroups = Sections.finalize_theorem finite_subgroups;;
let finite_n_subgroups = Sections.finalize_theorem finite_n_subgroups;;
let subgroups_size_eq_card = Sections.finalize_theorem subgroups_size_eq_card;;
let group_acts_on_cosets = Sections.finalize_theorem group_acts_on_cosets;;
let group_acts_on_subgroups = Sections.finalize_theorem group_acts_on_subgroups;;
let conj_subgroup_stab = Sections.finalize_theorem conj_subgroup_stab;;
let subgroup_acts_on_cosets = Sections.finalize_theorem subgroup_acts_on_cosets;;
let subgroup_acts_on_subgroups = Sections.finalize_theorem subgroup_acts_on_subgroups;;
let subgroup_left_mul_fix = Sections.finalize_theorem subgroup_left_mul_fix;;
Sections.end_section "GroupActions";;
(* Lemma max_expn_divides *)
let max_expn_divides = Sections.section_proof ["c";"p";"n";"m"]
`prime p ==> c = (p EXP n) * m ==> coprime (p, m) ==>
p EXP n divides c /\ ~(p EXP (SUC n) divides c)`
[
((BETA_TAC THEN (move ["prime_p"]) THEN (move ["c_eq"]) THEN (move ["c_pm"])) THEN (split_tac));
(((((use_arg_then2 ("c_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN (done_tac));
(((((use_arg_then2 ("c_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_LMUL2_EQ", [DIVIDES_LMUL2_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("expn_eq0", [expn_eq0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PRIME_COPRIME_EQ", [PRIME_COPRIME_EQ]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Section Sylow *)
Sections.begin_section "Sylow";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("p", (`:num`))));;
(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(Sections.add_section_hyp "prime_p" (`prime p`));;
(* Lemma sylow1 *)
let sylow1 = Sections.section_proof []
`!n. p EXP n divides CARD G ==> ?H. subgroup op i H G /\ CARD H = p EXP n`
[
((THENL_FIRST) ((THENL) elim [(move ["_"]); ((move ["n"]) THEN (move ["IH"]) THEN (move ["pSn"]))]) (((fun arg_tac -> arg_tac (Arg_term (`{e}`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("subgroup_e", [subgroup_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_sing", [card_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)));
((((use_arg_then2 ("pSn", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("DIVIDES_LMUL2", [DIVIDES_LMUL2])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IH", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["H"])) THEN (case THEN ((move ["subH"]) THEN (move ["cH"])))));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normal_in_normalizer", [normal_in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["normH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("quotient_group", [quotient_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grNH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subset", [normalizer_subset])) (fun fst_arg -> (use_arg_then2 ("op", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("G", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finN"])));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_index", [finite_index])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finNH"])));
((fun arg_tac -> arg_tac (Arg_term (`normalizer op i G H`))) (term_tac (set_tac "N")));
(((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`p divides CARD (cosets op N H)`))) (term_tac (have_gen_tac [](move ["p_div"])))));
(((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cauchy", [cauchy])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grNH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finNH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["K1"])) THEN (case THEN ((move ["subK1"]) THEN (move ["cK1"]))));
((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_of_quotient", [subgroup_of_quotient])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("K1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("subK1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["K"])) THEN (case THEN (move ["subK"])) THEN (case THEN (move ["normK"])) THEN (move ["K_eq_K1"])));
(((use_arg_then2 ("K", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_trans", [subgroup_trans])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("K_eq_K1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cK1", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (disch_tac [])) THEN (clear_assumption "FINITE_SUBSET") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("N", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("finN", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_left_mul_fix", [subgroup_left_mul_fix])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
(((use_arg_then2 ("p_div_fix", [p_div_fix])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("op", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac))));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"])));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_index", [finite_index])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finGH"])));
((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_acts_on_cosets", [subgroup_acts_on_cosets])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("prime_p", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finGH", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
((((use_arg_then2 ("DIVIDES_CMUL2", [DIVIDES_CMUL2])) (disch_tac [])) THEN (clear_assumption "DIVIDES_CMUL2") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (term_tac exists_tac)));
(((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("expn_eq0", [expn_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("cH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac));
];;
(* Lemma sylow2 *)
let sylow2 = Sections.section_proof ["n";"H";"K"]
`~(p EXP (SUC n) divides CARD G) /\
subgroup op i H G /\ subgroup op i K G /\ CARD H = p EXP n /\ CARD K = p EXP n ==>
?g. g IN G /\ H = set_op1 (conjg (op, i) g) K`
[
(BETA_TAC THEN (case THEN (move ["p_n_div"])) THEN (case THEN (move ["subH"])) THEN (case THEN (move ["subK"])) THEN (case THEN (move ["cH"])) THEN (move ["cK"]));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sKG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finK"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"])));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_index", [finite_index])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finGH"])));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_acts_on_cosets", [subgroup_acts_on_cosets])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["actsK"])));
(((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fix_mod_p", [fix_mod_p])) (fun fst_arg -> (use_arg_then2 ("actsK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finGH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((fun arg_tac -> arg_tac (Arg_term (`Fix K _1 _2`))) (term_tac (set_tac "S"))));
(BETA_TAC THEN (move ["fix_mod"]));
((fun arg_tac -> arg_tac (Arg_term (`?c. c IN S`))) (term_tac (have_gen_tac []ALL_TAC)));
((THENL_LAST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`S HAS_SIZE 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((((use_arg_then2 ("HAS_SIZE_0", [HAS_SIZE_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)));
((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["finS"]) THEN (move ["cS0"]))));
((((use_arg_then2 ("fix_mod", [])) (disch_tac [])) THEN (clear_assumption "fix_mod") THEN BETA_TAC) THEN ((((use_arg_then2 ("cS0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_0", [MOD_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_MOD", [DIVIDES_MOD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))));
((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("p_n_div", [])) (disch_tac [])) THEN (clear_assumption "p_n_div") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["p_div"])));
(((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_MUL_R", [DIVIDES_MUL_R]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((BETA_TAC THEN (case THEN (move ["c"]))) THEN (((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["x_eq"])));
(((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))));
((THENL_ROT (-1)) ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_equiv", [conjg_set_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUBSET_CARD_EQ", [SUBSET_CARD_EQ]))(gsym_then (thm_tac (new_rewrite [] [])))))));
(((((fun arg_tac -> (use_arg_then2 ("set_lmul_card", [set_lmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("set_rmul_card", [set_rmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("set_op1_eq_image", [set_op1_eq_image]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["a"]) THEN (case THEN (move ["k"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["kK"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
((((fun arg_tac -> (use_arg_then2 ("x_eq", [])) (fun fst_arg -> (use_arg_then2 ("kK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`op k x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (ANTS_TAC));
((((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("x_in_coset", [x_in_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac));
(((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN (move ["hH"])) THEN (move ["op_eq"]) THEN (move ["_"]));
(((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac));
];;
(* Lemma sylow3_1 *)
let sylow3_1 = Sections.section_proof ["n";"H"]
`~(p EXP (SUC n) divides CARD G) /\ subgroup op i H G /\ CARD H = p EXP n ==>
CARD {K | subgroup op i K G /\ CARD K = p EXP n} = CARD (cosets op G (normalizer op i G H))`
[
(BETA_TAC THEN (case THEN (move ["p_n_div"])) THEN (case THEN (move ["subH"])) THEN (move ["cH"]));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (fun arg_tac ->(use_arg_then2 ("finG", []))(fun tmp_arg1 -> (use_arg_then2 ("sHG", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("group_acts_on_subgroups", [group_acts_on_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["actsG"])));
((((fun arg_tac -> (use_arg_then2 ("conj_subgroup_stab", [conj_subgroup_stab])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("card_orbit", [card_orbit])) (fun fst_arg -> (use_arg_then2 ("actsG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))));
(((((fun arg_tac -> (use_arg_then2 ("finite_n_subgroups", [finite_n_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((THENL_ROT (-1)) (((use_arg_then2 ("congr1", [congr1])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["K"])) THEN ((THENL) (split_tac) [((case THEN (move ["subK"])) THEN (move ["cK"])); ((case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))])));
(((((fun arg_tac -> (use_arg_then2 ("subgroup_conjg", [subgroup_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("conjg_set_card", [conjg_set_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac));
(((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow2", [sylow2])) (fun fst_arg -> (use_arg_then2 ("p_n_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (move ["K_eq"]));
(((fun arg_tac -> arg_tac (Arg_term (`i g`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Lemma sylow3_2 *)
let sylow3_2 = Sections.section_proof ["n";"m"]
`CARD G = (p EXP n) * m /\ coprime (p, m) ==>
CARD {K | subgroup op i K G /\ CARD K = p EXP n} divides m`
[
(BETA_TAC THEN (case THEN ((move ["cG"]) THEN (move ["c_pm"]))));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("max_expn_divides", [max_expn_divides])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("c_pm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["p_div"]) THEN (move ["p_n_div"])))));
(((fun arg_tac -> (use_arg_then2 ("sylow1", [sylow1])) (fun fst_arg -> (use_arg_then2 ("p_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["H"])) THEN (case THEN (move ["subH"])) THEN (move ["cH"]));
(((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow3_1", [sylow3_1])) (fun fst_arg -> (use_arg_then2 ("p_n_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"])));
((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normal_in_normalizer", [normal_in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subHN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finN"])));
((fun arg_tac -> arg_tac (Arg_term (`normalizer op i G H`))) (term_tac (set_tac "N")));
(((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subHN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))));
(((((use_arg_then2 ("cG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnA", [mulnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_mul2r", [eqn_mul2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expn_eq0", [expn_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((THENL) case [(simp_tac); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]));
((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`CARD (cosets op N H)`))) (term_tac exists_tac)) THEN (done_tac));
];;
(* Finalization of the section Sylow *)
let sylow1 = Sections.finalize_theorem sylow1;;
let sylow2 = Sections.finalize_theorem sylow2;;
let sylow3_1 = Sections.finalize_theorem sylow3_1;;
let sylow3_2 = Sections.finalize_theorem sylow3_2;;
Sections.end_section "Sylow";;
(* Section Sylow3_final *)
Sections.begin_section "Sylow3_final";;
(Sections.add_section_var (mk_var ("G", (`:A->bool`))));;
(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));;
(Sections.add_section_var (mk_var ("i", (`:A->A`))));;
(Sections.add_section_var (mk_var ("e", (`:A`))));;
(Sections.add_section_var (mk_var ("p", (`:num`))));;
(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));;
(Sections.add_section_hyp "finG" (`FINITE G`));;
(Sections.add_section_hyp "prime_p" (`prime p`));;
(* Lemma sylow3_3 *)
let sylow3_3 = Sections.section_proof ["n";"m"]
`CARD G = (p EXP n) * m /\ coprime (p, m) ==>
CARD {K | subgroup op i K G /\ CARD K = p EXP n} MOD p = 1`
[
(BETA_TAC THEN (case THEN ((move ["cG"]) THEN (move ["c_pm"]))));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("max_expn_divides", [max_expn_divides])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("c_pm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["p_div"]) THEN (move ["p_n_div"])))));
(((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow1", [sylow1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["H"])) THEN (case THEN (move ["subH"])) THEN (move ["cH"]));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_acts_on_subgroups", [subgroup_acts_on_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["actsH"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"])));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"])));
((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (fun arg_tac ->(use_arg_then2 ("finG", []))(fun tmp_arg1 -> (use_arg_then2 ("sHG", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"])));
((((fun arg_tac -> (use_arg_then2 ("subgroups_size_eq_card", [subgroups_size_eq_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fix_mod_p", [fix_mod_p])) (fun fst_arg -> (use_arg_then2 ("actsH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("finite_n_subgroups", [finite_n_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)));
((fun arg_tac -> arg_tac (Arg_term (`Fix H _1 _2`))) (term_tac (set_tac "fix_set")));
(((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`fix_set = {H}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))));
(((((use_arg_then2 ("card_sing", [card_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("PRIME_GE_2", [PRIME_GE_2])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac));
((THENL_ROT (-1)) ((((((use_arg_then2 ("fix_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["K"])) THEN ((THENL) (split_tac) [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])));
(((((use_arg_then2 ("subH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["h"]) THEN (move ["hH"]));
(((((fun arg_tac -> (use_arg_then2 ("group_conjgK", [group_conjgK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["subK"])) THEN (case THEN (move ["finK"])) THEN (move ["cK"]) THEN (move ["k_eq"]));
((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sKG"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"])));
((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normal_in_normalizer", [normal_in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["normKN"])));
((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (fun arg_tac ->(use_arg_then2 ("finG", []))(fun tmp_arg1 -> (fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finN"])));
((fun arg_tac -> arg_tac (Arg_term (`normalizer op i G K`))) (term_tac (set_tac "N")));
((fun arg_tac -> arg_tac (Arg_term (`subgroup op i H N`))) (term_tac (have_gen_tac [](move ["subHN"]))));
(((((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("grH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["hH"]));
(((((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("k_eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((fun arg_tac -> arg_tac (Arg_term (`~(p EXP (SUC n) divides CARD N)`))) (term_tac (have_gen_tac [](move ["p_n_divN"]))));
((((use_arg_then2 ("p_n_div", [])) (disch_tac [])) THEN (clear_assumption "p_n_div") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["div"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIVIDES_LMUL", [DIVIDES_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac));
((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow2", [sylow2])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_n_divN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subHN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normKN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC));
((BETA_TAC THEN (case THEN (move ["g"]))) THEN (((((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac));
];;
(* Finalization of the section Sylow3_final *)
let sylow3_3 = Sections.finalize_theorem sylow3_3;;
Sections.end_section "Sylow3_final";;