1.1 --- a/src/HOL/AxClasses/Group.thy Wed Mar 04 11:05:02 2009 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,124 +0,0 @@
1.4 -(* Title: HOL/AxClasses/Group.thy
1.5 - ID: $Id$
1.6 - Author: Markus Wenzel, TU Muenchen
1.7 -*)
1.8 -
1.9 -theory Group imports Main begin
1.10 -
1.11 -subsection {* Monoids and Groups *}
1.12 -
1.13 -consts
1.14 - times :: "'a => 'a => 'a" (infixl "[*]" 70)
1.15 - invers :: "'a => 'a"
1.16 - one :: 'a
1.17 -
1.18 -
1.19 -axclass monoid < type
1.20 - assoc: "(x [*] y) [*] z = x [*] (y [*] z)"
1.21 - left_unit: "one [*] x = x"
1.22 - right_unit: "x [*] one = x"
1.23 -
1.24 -axclass semigroup < type
1.25 - assoc: "(x [*] y) [*] z = x [*] (y [*] z)"
1.26 -
1.27 -axclass group < semigroup
1.28 - left_unit: "one [*] x = x"
1.29 - left_inverse: "invers x [*] x = one"
1.30 -
1.31 -axclass agroup < group
1.32 - commute: "x [*] y = y [*] x"
1.33 -
1.34 -
1.35 -subsection {* Abstract reasoning *}
1.36 -
1.37 -theorem group_right_inverse: "x [*] invers x = (one::'a::group)"
1.38 -proof -
1.39 - have "x [*] invers x = one [*] (x [*] invers x)"
1.40 - by (simp only: group_class.left_unit)
1.41 - also have "... = one [*] x [*] invers x"
1.42 - by (simp only: semigroup_class.assoc)
1.43 - also have "... = invers (invers x) [*] invers x [*] x [*] invers x"
1.44 - by (simp only: group_class.left_inverse)
1.45 - also have "... = invers (invers x) [*] (invers x [*] x) [*] invers x"
1.46 - by (simp only: semigroup_class.assoc)
1.47 - also have "... = invers (invers x) [*] one [*] invers x"
1.48 - by (simp only: group_class.left_inverse)
1.49 - also have "... = invers (invers x) [*] (one [*] invers x)"
1.50 - by (simp only: semigroup_class.assoc)
1.51 - also have "... = invers (invers x) [*] invers x"
1.52 - by (simp only: group_class.left_unit)
1.53 - also have "... = one"
1.54 - by (simp only: group_class.left_inverse)
1.55 - finally show ?thesis .
1.56 -qed
1.57 -
1.58 -theorem group_right_unit: "x [*] one = (x::'a::group)"
1.59 -proof -
1.60 - have "x [*] one = x [*] (invers x [*] x)"
1.61 - by (simp only: group_class.left_inverse)
1.62 - also have "... = x [*] invers x [*] x"
1.63 - by (simp only: semigroup_class.assoc)
1.64 - also have "... = one [*] x"
1.65 - by (simp only: group_right_inverse)
1.66 - also have "... = x"
1.67 - by (simp only: group_class.left_unit)
1.68 - finally show ?thesis .
1.69 -qed
1.70 -
1.71 -
1.72 -subsection {* Abstract instantiation *}
1.73 -
1.74 -instance monoid < semigroup
1.75 -proof intro_classes
1.76 - fix x y z :: "'a::monoid"
1.77 - show "x [*] y [*] z = x [*] (y [*] z)"
1.78 - by (rule monoid_class.assoc)
1.79 -qed
1.80 -
1.81 -instance group < monoid
1.82 -proof intro_classes
1.83 - fix x y z :: "'a::group"
1.84 - show "x [*] y [*] z = x [*] (y [*] z)"
1.85 - by (rule semigroup_class.assoc)
1.86 - show "one [*] x = x"
1.87 - by (rule group_class.left_unit)
1.88 - show "x [*] one = x"
1.89 - by (rule group_right_unit)
1.90 -qed
1.91 -
1.92 -
1.93 -subsection {* Concrete instantiation *}
1.94 -
1.95 -defs (overloaded)
1.96 - times_bool_def: "x [*] y == x ~= (y::bool)"
1.97 - inverse_bool_def: "invers x == x::bool"
1.98 - unit_bool_def: "one == False"
1.99 -
1.100 -instance bool :: agroup
1.101 -proof (intro_classes,
1.102 - unfold times_bool_def inverse_bool_def unit_bool_def)
1.103 - fix x y z
1.104 - show "((x ~= y) ~= z) = (x ~= (y ~= z))" by blast
1.105 - show "(False ~= x) = x" by blast
1.106 - show "(x ~= x) = False" by blast
1.107 - show "(x ~= y) = (y ~= x)" by blast
1.108 -qed
1.109 -
1.110 -
1.111 -subsection {* Lifting and Functors *}
1.112 -
1.113 -defs (overloaded)
1.114 - times_prod_def: "p [*] q == (fst p [*] fst q, snd p [*] snd q)"
1.115 -
1.116 -instance * :: (semigroup, semigroup) semigroup
1.117 -proof (intro_classes, unfold times_prod_def)
1.118 - fix p q r :: "'a::semigroup * 'b::semigroup"
1.119 - show
1.120 - "(fst (fst p [*] fst q, snd p [*] snd q) [*] fst r,
1.121 - snd (fst p [*] fst q, snd p [*] snd q) [*] snd r) =
1.122 - (fst p [*] fst (fst q [*] fst r, snd q [*] snd r),
1.123 - snd p [*] snd (fst q [*] fst r, snd q [*] snd r))"
1.124 - by (simp add: semigroup_class.assoc)
1.125 -qed
1.126 -
1.127 -end