Theory Bij (Isabelle2005: October 2005)

# Theory Bij

Up to index of Isabelle/HOL/HOL-Algebra

theory Bij
imports Group
begin

    (*  Title:      HOL/Algebra/Bij.thy
        ID:         $Id: Bij.thy,v 1.7 2005/06/17 14:13:05 haftmann Exp $
        Author:     Florian Kammueller, with new proofs by L C Paulson
    *)

    header {* Bijections of a Set, Permutation Groups, Automorphism Groups *}

    theory Bij imports Group begin

    constdefs
      Bij :: "'a set => ('a => 'a) set"
        --{*Only extensional functions, since otherwise we get too many.*}
      "Bij S ≡ extensional S ∩ {f. bij_betw f S S}"

      BijGroup :: "'a set => ('a => 'a) monoid"
      "BijGroup S ≡
        (|carrier = Bij S,
         mult = λg ∈ Bij S. λf ∈ Bij S. compose S g f,
         one = λx ∈ S. x|)),"

    declare Id_compose [simp] compose_Id [simp]

    lemma Bij_imp_extensional: "f ∈ Bij S ==> f ∈ extensional S"
      by (simp add: Bij_def)

    lemma Bij_imp_funcset: "f ∈ Bij S ==> f ∈ S -> S"
      by (auto simp add: Bij_def bij_betw_imp_funcset)

    subsection {*Bijections Form a Group *}

    lemma restrict_Inv_Bij: "f ∈ Bij S ==> (λx ∈ S. (Inv S f) x) ∈ Bij S"
      by (simp add: Bij_def bij_betw_Inv)

    lemma id_Bij: "(λx∈S. x) ∈ Bij S "
      by (auto simp add: Bij_def bij_betw_def inj_on_def)

    lemma compose_Bij: "[|x ∈ Bij S; y ∈ Bij S|] ==> compose S x y ∈ Bij S"
      by (auto simp add: Bij_def bij_betw_compose)

    lemma Bij_compose_restrict_eq:
         "f ∈ Bij S ==> compose S (restrict (Inv S f) S) f = (λx∈S. x)"
      by (simp add: Bij_def compose_Inv_id)

    theorem group_BijGroup: "group (BijGroup S)"
    apply (simp add: BijGroup_def)
    apply (rule groupI)
        apply (simp add: compose_Bij)
       apply (simp add: id_Bij)
      apply (simp add: compose_Bij)
      apply (blast intro: compose_assoc [symmetric] Bij_imp_funcset)
     apply (simp add: id_Bij Bij_imp_funcset Bij_imp_extensional, simp)
    apply (blast intro: Bij_compose_restrict_eq restrict_Inv_Bij)
    done

    subsection{*Automorphisms Form a Group*}

    lemma Bij_Inv_mem: "[| f ∈ Bij S;  x ∈ S|] ==> Inv S f x ∈ S"
    by (simp add: Bij_def bij_betw_def Inv_mem)

    lemma Bij_Inv_lemma:
     assumes eq: "!!x y. [|x ∈ S; y ∈ S|] ==> h(g x y) = g (h x) (h y)"
     shows "[|h ∈ Bij S;  g ∈ S -> S -> S;  x ∈ S;  y ∈ S|]
            ==> Inv S h (g x y) = g (Inv S h x) (Inv S h y)"
    apply (simp add: Bij_def bij_betw_def)
    apply (subgoal_tac "∃x'∈S. ∃y'∈S. x = h x' & y = h y'", clarify)
     apply (simp add: eq [symmetric] Inv_f_f funcset_mem [THEN funcset_mem], blast)
    done

    constdefs
      auto :: "('a, 'b) monoid_scheme => ('a => 'a) set"
      "auto G ≡ hom G G ∩ Bij (carrier G)"

      AutoGroup :: "('a, 'c) monoid_scheme => ('a => 'a) monoid"
      "AutoGroup G ≡ BijGroup (carrier G) (|carrier := auto G|)),"

    lemma (in group) id_in_auto: "(λx ∈ carrier G. x) ∈ auto G"
      by (simp add: auto_def hom_def restrictI group.axioms id_Bij)

    lemma (in group) mult_funcset: "mult G ∈ carrier G -> carrier G -> carrier G"
      by (simp add:  Pi_I group.axioms)

    lemma (in group) restrict_Inv_hom:
          "[|h ∈ hom G G; h ∈ Bij (carrier G)|]
           ==> restrict (Inv (carrier G) h) (carrier G) ∈ hom G G"
      by (simp add: hom_def Bij_Inv_mem restrictI mult_funcset
                    group.axioms Bij_Inv_lemma)

    lemma inv_BijGroup:
         "f ∈ Bij S ==> m_inv (BijGroup S) f = (λx ∈ S. (Inv S f) x)"
    apply (rule group.inv_equality)
    apply (rule group_BijGroup)
    apply (simp_all add: BijGroup_def restrict_Inv_Bij Bij_compose_restrict_eq)
    done

    lemma (in group) subgroup_auto:
          "subgroup (auto G) (BijGroup (carrier G))"
    proof (rule subgroup.intro)
      show "auto G ⊆ carrier (BijGroup (carrier G))"
        by (force simp add: auto_def BijGroup_def)
    next
      fix x y
      assume "x ∈ auto G" "y ∈ auto G"
      thus "x ⊗BijGroup (carrier G) y ∈ auto G"
        by (force simp add: BijGroup_def is_group auto_def Bij_imp_funcset
                            group.hom_compose compose_Bij)
    next
      show "\<one>BijGroup (carrier G) ∈ auto G" by (simp add:  BijGroup_def id_in_auto)
    next
      fix x
      assume "x ∈ auto G"
      thus "invBijGroup (carrier G) x ∈ auto G"
        by (simp del: restrict_apply
                 add: inv_BijGroup auto_def restrict_Inv_Bij restrict_Inv_hom)
    qed

    theorem (in group) AutoGroup: "group (AutoGroup G)"
    by (simp add: AutoGroup_def subgroup.subgroup_is_group subgroup_auto
                  group_BijGroup)

    end

lemma Bij_imp_extensional:

      f ∈ Bij S ==> f ∈ extensional S

lemma Bij_imp_funcset:

      f ∈ Bij S ==> f ∈ S -> S

### Bijections Form a Group

lemma restrict_Inv_Bij:

      f ∈ Bij S ==> restrict (Inv S f) S ∈ Bij S

lemma id_Bij:

      (λx∈S. x) ∈ Bij S

lemma compose_Bij:

      [| x ∈ Bij S; y ∈ Bij S |] ==> compose S x y ∈ Bij S

lemma Bij_compose_restrict_eq:

      f ∈ Bij S ==> compose S (restrict (Inv S f) S) f = (λx∈S. x)

theorem group_BijGroup:

      group (BijGroup S)

### Automorphisms Form a Group

lemma Bij_Inv_mem:

      [| f ∈ Bij S; x ∈ S |] ==> Inv S f x ∈ S

lemma Bij_Inv_lemma:

      [| !!x y. [| x ∈ S; y ∈ S |] ==> h (g x y) = g (h x) (h y); h ∈ Bij S;
         g ∈ S -> S -> S; x ∈ S; y ∈ S |]
      ==> Inv S h (g x y) = g (Inv S h x) (Inv S h y)

lemma id_in_auto:

      group G ==> (λx∈carrier G. x) ∈ auto G

lemma mult_funcset:

      group G ==> op ⊗G ∈ carrier G -> carrier G -> carrier G

lemma restrict_Inv_hom:

      [| group G; h ∈ hom G G; h ∈ Bij (carrier G) |]
      ==> restrict (Inv (carrier G) h) (carrier G) ∈ hom G G

lemma inv_BijGroup:

      f ∈ Bij S ==> invBijGroup S f = restrict (Inv S f) S

lemma subgroup_auto:

      group G ==> subgroup (auto G) (BijGroup (carrier G))

theorem AutoGroup:

      group G ==> group (AutoGroup G)