src/HOL/Algebra/Bij.thy
author paulson
Mon, 30 Nov 2020 19:33:07 +0000
changeset 72796 d39a32cff5d7
parent 68687 2976a4a3b126
permissions -rw-r--r--
merged
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
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     5
theory Bij
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     6
imports Group
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     7
begin
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents: 16417
diff changeset
     8
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 35849
diff changeset
     9
section \<open>Bijections of a Set, Permutation and Automorphism Groups\<close>
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    10
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    11
definition
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    12
  Bij :: "'a set \<Rightarrow> ('a \<Rightarrow> 'a) set"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67091
diff changeset
    13
    \<comment> \<open>Only extensional functions, since otherwise we get too many.\<close>
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    14
   where "Bij S = extensional S \<inter> {f. bij_betw f S S}"
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    15
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    16
definition
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    17
  BijGroup :: "'a set \<Rightarrow> ('a \<Rightarrow> 'a) monoid"
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    18
  where "BijGroup S =
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    19
    \<lparr>carrier = Bij S,
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    20
     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
    21
     one = \<lambda>x \<in> S. x\<rparr>"
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    22
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    23
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    24
declare Id_compose [simp] compose_Id [simp]
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    25
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    26
lemma Bij_imp_extensional: "f \<in> Bij S \<Longrightarrow> f \<in> extensional S"
14666
65f8680c3f16 improved notation;
wenzelm
parents: 13945
diff changeset
    27
  by (simp add: Bij_def)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    28
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    29
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
    30
  by (auto simp add: Bij_def bij_betw_imp_funcset)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    31
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    32
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 35849
diff changeset
    33
subsection \<open>Bijections Form a Group\<close>
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    34
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    35
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
    36
  by (simp add: Bij_def bij_betw_inv_into)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    37
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    38
lemma id_Bij: "(\<lambda>x\<in>S. x) \<in> Bij S "
14853
8d710bece29f more on bij_betw
paulson
parents: 14761
diff changeset
    39
  by (auto simp add: Bij_def bij_betw_def inj_on_def)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    40
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    41
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
    42
  by (auto simp add: Bij_def bij_betw_compose) 
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    43
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    44
lemma Bij_compose_restrict_eq:
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    45
     "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
    46
  by (simp add: Bij_def compose_inv_into_id)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    47
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    48
theorem group_BijGroup: "group (BijGroup S)"
68687
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    49
  apply (simp add: BijGroup_def)
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    50
  apply (rule groupI)
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    51
      apply (auto simp: compose_Bij id_Bij Bij_imp_funcset Bij_imp_extensional compose_assoc [symmetric])
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    52
  apply (blast intro: Bij_compose_restrict_eq restrict_inv_into_Bij)
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    53
  done
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    54
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    55
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 35849
diff changeset
    56
subsection\<open>Automorphisms Form a Group\<close>
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    57
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    58
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
    59
by (simp add: Bij_def bij_betw_def inv_into_into)
13945
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_lemma:
68687
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    62
  assumes eq: "\<And>x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> h(g x y) = g (h x) (h y)"
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    63
      and hg: "h \<in> Bij S" "g \<in> S \<rightarrow> S \<rightarrow> S" and "x \<in> S" "y \<in> S"
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    64
  shows "inv_into S h (g x y) = g (inv_into S h x) (inv_into S h y)"
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    65
proof -
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    66
  have "h ` S = S"
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    67
    by (metis (no_types) Bij_def Int_iff assms(2) bij_betw_def mem_Collect_eq)
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    68
  with \<open>x \<in> S\<close> \<open>y \<in> S\<close> have "\<exists>x'\<in>S. \<exists>y'\<in>S. x = h x' \<and> y = h y'"
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    69
    by auto
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    70
  then show ?thesis
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    71
    using assms
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    72
    by (auto simp add: Bij_def bij_betw_def eq [symmetric] inv_f_f funcset_mem [THEN funcset_mem])
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    73
qed
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    74
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    75
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    76
definition
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    77
  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
    78
  where "auto G = hom G G \<inter> Bij (carrier G)"
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    79
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    80
definition
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35416
diff changeset
    81
  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
    82
  where "AutoGroup G = BijGroup (carrier G) \<lparr>carrier := auto G\<rparr>"
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    83
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    84
lemma (in group) id_in_auto: "(\<lambda>x \<in> carrier G. x) \<in> auto G"
14666
65f8680c3f16 improved notation;
wenzelm
parents: 13945
diff changeset
    85
  by (simp add: auto_def hom_def restrictI group.axioms id_Bij)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    86
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    87
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
    88
  by (simp add:  Pi_I group.axioms)
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    89
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    90
lemma (in group) restrict_inv_into_hom:
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
    91
      "\<lbrakk>h \<in> hom G G; h \<in> Bij (carrier G)\<rbrakk>
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    92
       \<Longrightarrow> restrict (inv_into (carrier G) h) (carrier G) \<in> hom G G"
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    93
  by (simp add: hom_def Bij_inv_into_mem restrictI mult_funcset
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    94
                group.axioms Bij_inv_into_lemma)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    95
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
    96
lemma inv_BijGroup:
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    97
     "f \<in> Bij S \<Longrightarrow> m_inv (BijGroup S) f = (\<lambda>x \<in> S. (inv_into S f) x)"
68687
2976a4a3b126 de-applying and simplification
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
    98
apply (rule group.inv_equality [OF group_BijGroup])
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
    99
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
   100
done
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
   101
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   102
lemma (in group) subgroup_auto:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   103
      "subgroup (auto G) (BijGroup (carrier G))"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   104
proof (rule subgroup.intro)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   105
  show "auto G \<subseteq> carrier (BijGroup (carrier G))"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   106
    by (force simp add: auto_def BijGroup_def)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   107
next
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   108
  fix x y
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   109
  assume "x \<in> auto G" "y \<in> auto G" 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   110
  thus "x \<otimes>\<^bsub>BijGroup (carrier G)\<^esub> y \<in> auto G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   111
    by (force simp add: BijGroup_def is_group auto_def Bij_imp_funcset 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   112
                        group.hom_compose compose_Bij)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   113
next
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   114
  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
   115
next
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   116
  fix x 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   117
  assume "x \<in> auto G" 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   118
  thus "inv\<^bsub>BijGroup (carrier G)\<^esub> x \<in> auto G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   119
    by (simp del: restrict_apply
33057
764547b68538 inv_onto -> inv_into
nipkow
parents: 32988
diff changeset
   120
        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
   121
qed
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
   122
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   123
theorem (in group) AutoGroup: "group (AutoGroup G)"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   124
by (simp add: AutoGroup_def subgroup.subgroup_is_group subgroup_auto 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14853
diff changeset
   125
              group_BijGroup)
13945
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
   126
5433b2755e98 moved Bij.thy from HOL/GroupTheory
paulson
parents:
diff changeset
   127
end