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