src/HOL/Algebra/Bij.thy
author wenzelm
Sun Mar 21 16:51:37 2010 +0100 (2010-03-21)
changeset 35848 5443079512ea
parent 35416 d8d7d1b785af
child 35849 b5522b51cb1e
permissions -rw-r--r--
slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm@14706
     1
(*  Title:      HOL/Algebra/Bij.thy
paulson@13945
     2
    Author:     Florian Kammueller, with new proofs by L C Paulson
paulson@13945
     3
*)
paulson@13945
     4
ballarin@20318
     5
theory Bij imports Group begin
paulson@13945
     6
ballarin@20318
     7
ballarin@27717
     8
section {* Bijections of a Set, Permutation and Automorphism Groups *}
paulson@13945
     9
wenzelm@35848
    10
definition
wenzelm@35848
    11
  Bij :: "'a set \<Rightarrow> ('a \<Rightarrow> 'a) set"
paulson@13945
    12
    --{*Only extensional functions, since otherwise we get too many.*}
wenzelm@35848
    13
   where "Bij S = extensional S \<inter> {f. bij_betw f S S}"
paulson@13945
    14
wenzelm@35848
    15
definition
wenzelm@35848
    16
  BijGroup :: "'a set \<Rightarrow> ('a \<Rightarrow> 'a) monoid"
wenzelm@35848
    17
  where "BijGroup S =
paulson@14963
    18
    \<lparr>carrier = Bij S,
paulson@14963
    19
     mult = \<lambda>g \<in> Bij S. \<lambda>f \<in> Bij S. compose S g f,
paulson@14963
    20
     one = \<lambda>x \<in> S. x\<rparr>"
paulson@13945
    21
paulson@13945
    22
paulson@13945
    23
declare Id_compose [simp] compose_Id [simp]
paulson@13945
    24
paulson@14963
    25
lemma Bij_imp_extensional: "f \<in> Bij S \<Longrightarrow> f \<in> extensional S"
wenzelm@14666
    26
  by (simp add: Bij_def)
paulson@13945
    27
paulson@14963
    28
lemma Bij_imp_funcset: "f \<in> Bij S \<Longrightarrow> f \<in> S \<rightarrow> S"
paulson@14853
    29
  by (auto simp add: Bij_def bij_betw_imp_funcset)
paulson@13945
    30
paulson@13945
    31
wenzelm@14666
    32
subsection {*Bijections Form a Group *}
paulson@13945
    33
nipkow@33057
    34
lemma restrict_inv_into_Bij: "f \<in> Bij S \<Longrightarrow> (\<lambda>x \<in> S. (inv_into S f) x) \<in> Bij S"
nipkow@33057
    35
  by (simp add: Bij_def bij_betw_inv_into)
paulson@13945
    36
paulson@13945
    37
lemma id_Bij: "(\<lambda>x\<in>S. x) \<in> Bij S "
paulson@14853
    38
  by (auto simp add: Bij_def bij_betw_def inj_on_def)
paulson@13945
    39
paulson@14963
    40
lemma compose_Bij: "\<lbrakk>x \<in> Bij S; y \<in> Bij S\<rbrakk> \<Longrightarrow> compose S x y \<in> Bij S"
paulson@14853
    41
  by (auto simp add: Bij_def bij_betw_compose) 
paulson@13945
    42
paulson@13945
    43
lemma Bij_compose_restrict_eq:
nipkow@33057
    44
     "f \<in> Bij S \<Longrightarrow> compose S (restrict (inv_into S f) S) f = (\<lambda>x\<in>S. x)"
nipkow@33057
    45
  by (simp add: Bij_def compose_inv_into_id)
paulson@13945
    46
paulson@13945
    47
theorem group_BijGroup: "group (BijGroup S)"
wenzelm@14666
    48
apply (simp add: BijGroup_def)
paulson@13945
    49
apply (rule groupI)
paulson@13945
    50
    apply (simp add: compose_Bij)
paulson@13945
    51
   apply (simp add: id_Bij)
paulson@13945
    52
  apply (simp add: compose_Bij)
nipkow@31754
    53
  apply (blast intro: compose_assoc [symmetric] dest: Bij_imp_funcset)
paulson@13945
    54
 apply (simp add: id_Bij Bij_imp_funcset Bij_imp_extensional, simp)
nipkow@33057
    55
apply (blast intro: Bij_compose_restrict_eq restrict_inv_into_Bij)
paulson@13945
    56
done
paulson@13945
    57
paulson@13945
    58
paulson@13945
    59
subsection{*Automorphisms Form a Group*}
paulson@13945
    60
nipkow@33057
    61
lemma Bij_inv_into_mem: "\<lbrakk> f \<in> Bij S;  x \<in> S\<rbrakk> \<Longrightarrow> inv_into S f x \<in> S"
nipkow@33057
    62
by (simp add: Bij_def bij_betw_def inv_into_into)
paulson@13945
    63
nipkow@33057
    64
lemma Bij_inv_into_lemma:
paulson@14963
    65
 assumes eq: "\<And>x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> h(g x y) = g (h x) (h y)"
paulson@14963
    66
 shows "\<lbrakk>h \<in> Bij S;  g \<in> S \<rightarrow> S \<rightarrow> S;  x \<in> S;  y \<in> S\<rbrakk>
nipkow@33057
    67
        \<Longrightarrow> inv_into S h (g x y) = g (inv_into S h x) (inv_into S h y)"
paulson@14853
    68
apply (simp add: Bij_def bij_betw_def)
paulson@14853
    69
apply (subgoal_tac "\<exists>x'\<in>S. \<exists>y'\<in>S. x = h x' & y = h y'", clarify)
nipkow@32988
    70
 apply (simp add: eq [symmetric] inv_f_f funcset_mem [THEN funcset_mem], blast)
paulson@13945
    71
done
paulson@13945
    72
paulson@14963
    73
wenzelm@35848
    74
definition
wenzelm@35848
    75
  auto :: "('a, 'b) monoid_scheme \<Rightarrow> ('a \<Rightarrow> 'a) set"
wenzelm@35848
    76
  where "auto G = hom G G \<inter> Bij (carrier G)"
paulson@13945
    77
wenzelm@35848
    78
definition
wenzelm@35848
    79
  AutoGroup :: "('a, 'c) monoid_scheme \<Rightarrow> ('a \<Rightarrow> 'a) monoid"
wenzelm@35848
    80
  where "AutoGroup G = BijGroup (carrier G) \<lparr>carrier := auto G\<rparr>"
paulson@13945
    81
paulson@14963
    82
lemma (in group) id_in_auto: "(\<lambda>x \<in> carrier G. x) \<in> auto G"
wenzelm@14666
    83
  by (simp add: auto_def hom_def restrictI group.axioms id_Bij)
paulson@13945
    84
paulson@14963
    85
lemma (in group) mult_funcset: "mult G \<in> carrier G \<rightarrow> carrier G \<rightarrow> carrier G"
paulson@13945
    86
  by (simp add:  Pi_I group.axioms)
paulson@13945
    87
nipkow@33057
    88
lemma (in group) restrict_inv_into_hom:
paulson@14963
    89
      "\<lbrakk>h \<in> hom G G; h \<in> Bij (carrier G)\<rbrakk>
nipkow@33057
    90
       \<Longrightarrow> restrict (inv_into (carrier G) h) (carrier G) \<in> hom G G"
nipkow@33057
    91
  by (simp add: hom_def Bij_inv_into_mem restrictI mult_funcset
nipkow@33057
    92
                group.axioms Bij_inv_into_lemma)
paulson@13945
    93
paulson@13945
    94
lemma inv_BijGroup:
nipkow@33057
    95
     "f \<in> Bij S \<Longrightarrow> m_inv (BijGroup S) f = (\<lambda>x \<in> S. (inv_into S f) x)"
paulson@13945
    96
apply (rule group.inv_equality)
paulson@13945
    97
apply (rule group_BijGroup)
nipkow@33057
    98
apply (simp_all add:BijGroup_def restrict_inv_into_Bij Bij_compose_restrict_eq)
paulson@13945
    99
done
paulson@13945
   100
paulson@14963
   101
lemma (in group) subgroup_auto:
paulson@14963
   102
      "subgroup (auto G) (BijGroup (carrier G))"
paulson@14963
   103
proof (rule subgroup.intro)
paulson@14963
   104
  show "auto G \<subseteq> carrier (BijGroup (carrier G))"
paulson@14963
   105
    by (force simp add: auto_def BijGroup_def)
paulson@14963
   106
next
paulson@14963
   107
  fix x y
paulson@14963
   108
  assume "x \<in> auto G" "y \<in> auto G" 
paulson@14963
   109
  thus "x \<otimes>\<^bsub>BijGroup (carrier G)\<^esub> y \<in> auto G"
paulson@14963
   110
    by (force simp add: BijGroup_def is_group auto_def Bij_imp_funcset 
paulson@14963
   111
                        group.hom_compose compose_Bij)
paulson@14963
   112
next
paulson@14963
   113
  show "\<one>\<^bsub>BijGroup (carrier G)\<^esub> \<in> auto G" by (simp add:  BijGroup_def id_in_auto)
paulson@14963
   114
next
paulson@14963
   115
  fix x 
paulson@14963
   116
  assume "x \<in> auto G" 
paulson@14963
   117
  thus "inv\<^bsub>BijGroup (carrier G)\<^esub> x \<in> auto G"
paulson@14963
   118
    by (simp del: restrict_apply
nipkow@33057
   119
        add: inv_BijGroup auto_def restrict_inv_into_Bij restrict_inv_into_hom)
paulson@14963
   120
qed
paulson@13945
   121
paulson@14963
   122
theorem (in group) AutoGroup: "group (AutoGroup G)"
paulson@14963
   123
by (simp add: AutoGroup_def subgroup.subgroup_is_group subgroup_auto 
paulson@14963
   124
              group_BijGroup)
paulson@13945
   125
paulson@13945
   126
end