removed quot_cond_function1, quot_function1;
authorwenzelm
Fri Nov 17 18:48:50 2000 +0100 (2000-11-17)
changeset 10483eb93ace45a6e
parent 10482 41de88cb2108
child 10484 1f7c944443fc
removed quot_cond_function1, quot_function1;
removed overloaded standard operations;
src/HOL/Library/Quotient.thy
     1.1 --- a/src/HOL/Library/Quotient.thy	Fri Nov 17 18:48:00 2000 +0100
     1.2 +++ b/src/HOL/Library/Quotient.thy	Fri Nov 17 18:48:50 2000 +0100
     1.3 @@ -1,11 +1,11 @@
     1.4  (*  Title:      HOL/Library/Quotient.thy
     1.5      ID:         $Id$
     1.6 -    Author:     Gertrud Bauer and Markus Wenzel, TU Muenchen
     1.7 +    Author:     Markus Wenzel, TU Muenchen
     1.8  *)
     1.9  
    1.10  header {*
    1.11    \title{Quotient types}
    1.12 -  \author{Gertrud Bauer and Markus Wenzel}
    1.13 +  \author{Markus Wenzel}
    1.14  *}
    1.15  
    1.16  theory Quotient = Main:
    1.17 @@ -160,7 +160,7 @@
    1.18    qed
    1.19  qed
    1.20  
    1.21 -theorem pick_inverse: "\<lfloor>pick A\<rfloor> = A"
    1.22 +theorem pick_inverse [intro]: "\<lfloor>pick A\<rfloor> = A"
    1.23  proof (cases A)
    1.24    fix a assume a: "A = \<lfloor>a\<rfloor>"
    1.25    hence "pick A \<sim> a" by (simp only: pick_equiv)
    1.26 @@ -170,145 +170,45 @@
    1.27  
    1.28  text {*
    1.29   \medskip The following rules support canonical function definitions
    1.30 - on quotient types.
    1.31 + on quotient types (with up to two arguments).  Note that the
    1.32 + stripped-down version without additional conditions is sufficient
    1.33 + most of the time.
    1.34  *}
    1.35  
    1.36 -theorem quot_cond_function1:
    1.37 -  "(!!X. f X == g (pick X)) ==>
    1.38 -    (!!x x'. x \<sim> x' ==> P x ==> P x' ==> g x = g x') ==>
    1.39 -    (!!x x'. x \<sim> x' ==> P x = P x') ==>
    1.40 -  P a ==> f \<lfloor>a\<rfloor> = g a"
    1.41 -proof -
    1.42 -  assume cong_g: "!!x x'. x \<sim> x' ==> P x ==> P x' ==> g x = g x'"
    1.43 -  assume cong_P: "!!x x'. x \<sim> x' ==> P x = P x'"
    1.44 -  assume P: "P a"
    1.45 -  assume "!!X. f X == g (pick X)"
    1.46 -  hence "f \<lfloor>a\<rfloor> = g (pick \<lfloor>a\<rfloor>)" by (simp only:)
    1.47 -  also have "\<dots> = g a"
    1.48 -  proof (rule cong_g)
    1.49 -    show "pick \<lfloor>a\<rfloor> \<sim> a" ..
    1.50 -    hence "P (pick \<lfloor>a\<rfloor>) = P a" by (rule cong_P)
    1.51 -    also note P
    1.52 -    finally show "P (pick \<lfloor>a\<rfloor>)" .
    1.53 -  qed
    1.54 -  finally show ?thesis .
    1.55 -qed
    1.56 -
    1.57 -theorem quot_function1:
    1.58 -  "(!!X. f X == g (pick X)) ==>
    1.59 -    (!!x x'. x \<sim> x' ==> g x = g x') ==>
    1.60 -    f \<lfloor>a\<rfloor> = g a"
    1.61 +theorem quot_cond_function:
    1.62 +  "(!!X Y. f X Y == g (pick X) (pick Y)) ==>
    1.63 +    (!!x x' y y'. \<lfloor>x\<rfloor> = \<lfloor>x'\<rfloor> ==> \<lfloor>y\<rfloor> = \<lfloor>y'\<rfloor> ==> P x y ==> P x' y'
    1.64 +      ==> g x y = g x' y') ==>
    1.65 +    (!!x x' y y'. \<lfloor>x\<rfloor> = \<lfloor>x'\<rfloor> ==> \<lfloor>y\<rfloor> = \<lfloor>y'\<rfloor> ==> P x y = P x' y') ==>
    1.66 +    P a b ==> f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = g a b"
    1.67 +  (is "PROP ?eq ==> PROP ?cong_g ==> PROP ?cong_P ==> _ ==> _")
    1.68  proof -
    1.69 -  case antecedent from this refl TrueI
    1.70 -  show ?thesis by (rule quot_cond_function1)
    1.71 -qed
    1.72 -
    1.73 -theorem quot_cond_operation1:
    1.74 -  "(!!X. f X == \<lfloor>g (pick X)\<rfloor>) ==>
    1.75 -    (!!x x'. x \<sim> x' ==> P x ==> P x' ==> g x \<sim> g x') ==>
    1.76 -    (!!x x'. x \<sim> x' ==> P x = P x') ==>
    1.77 -  P a ==> f \<lfloor>a\<rfloor> = \<lfloor>g a\<rfloor>"
    1.78 -proof -
    1.79 -  assume defn: "!!X. f X == \<lfloor>g (pick X)\<rfloor>"
    1.80 -  assume "!!x x'. x \<sim> x' ==> P x ==> P x' ==> g x \<sim> g x'"
    1.81 -  hence cong_g: "!!x x'. x \<sim> x' ==> P x ==> P x' ==> \<lfloor>g x\<rfloor> = \<lfloor>g x'\<rfloor>" ..
    1.82 -  assume "!!x x'. x \<sim> x' ==> P x = P x'" and "P a"
    1.83 -  with defn cong_g show ?thesis by (rule quot_cond_function1)
    1.84 -qed
    1.85 -
    1.86 -theorem quot_operation1:
    1.87 -  "(!!X. f X == \<lfloor>g (pick X)\<rfloor>) ==>
    1.88 -    (!!x x'. x \<sim> x' ==> g x \<sim> g x') ==>
    1.89 -    f \<lfloor>a\<rfloor> = \<lfloor>g a\<rfloor>"
    1.90 -proof -
    1.91 -  case antecedent from this refl TrueI
    1.92 -  show ?thesis by (rule quot_cond_operation1)
    1.93 -qed
    1.94 -
    1.95 -theorem quot_cond_function2:
    1.96 -  "(!!X Y. f X Y == g (pick X) (pick Y)) ==>
    1.97 -    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y ==> P x' y'
    1.98 -      ==> g x y = g x' y') ==>
    1.99 -    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y = P x' y') ==>
   1.100 -    P a b ==> f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = g a b"
   1.101 -proof -
   1.102 -  assume cong_g: "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y ==> P x' y'
   1.103 -    ==> g x y = g x' y'"
   1.104 -  assume cong_P: "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y = P x' y'"
   1.105 -  assume P: "P a b"
   1.106 -  assume "!!X Y. f X Y == g (pick X) (pick Y)"
   1.107 -  hence "f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = g (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>)" by (simp only:)
   1.108 +  assume cong_g: "PROP ?cong_g"
   1.109 +    and cong_P: "PROP ?cong_P" and P: "P a b"
   1.110 +  assume "PROP ?eq"
   1.111 +  hence "f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = g (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>)"
   1.112 +    by (simp only:)
   1.113    also have "\<dots> = g a b"
   1.114    proof (rule cong_g)
   1.115 -    show "pick \<lfloor>a\<rfloor> \<sim> a" ..
   1.116 -    moreover show "pick \<lfloor>b\<rfloor> \<sim> b" ..
   1.117 -    ultimately have "P (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>) = P a b" by (rule cong_P)
   1.118 -    also show "P a b" .
   1.119 +    show "\<lfloor>pick \<lfloor>a\<rfloor>\<rfloor> = \<lfloor>a\<rfloor>" ..
   1.120 +    moreover
   1.121 +    show "\<lfloor>pick \<lfloor>b\<rfloor>\<rfloor> = \<lfloor>b\<rfloor>" ..
   1.122 +    ultimately
   1.123 +    have "P (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>) = P a b"
   1.124 +      by (rule cong_P)
   1.125 +    also show \<dots> .
   1.126      finally show "P (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>)" .
   1.127    qed
   1.128    finally show ?thesis .
   1.129  qed
   1.130  
   1.131 -theorem quot_function2:
   1.132 +theorem quot_function:
   1.133    "(!!X Y. f X Y == g (pick X) (pick Y)) ==>
   1.134 -    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> g x y = g x' y') ==>
   1.135 +    (!!x x' y y'. \<lfloor>x\<rfloor> = \<lfloor>x'\<rfloor> ==> \<lfloor>y\<rfloor> = \<lfloor>y'\<rfloor> ==> g x y = g x' y') ==>
   1.136      f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = g a b"
   1.137  proof -
   1.138    case antecedent from this refl TrueI
   1.139 -  show ?thesis by (rule quot_cond_function2)
   1.140 -qed
   1.141 -
   1.142 -theorem quot_cond_operation2:
   1.143 -  "(!!X Y. f X Y == \<lfloor>g (pick X) (pick Y)\<rfloor>) ==>
   1.144 -    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y ==> P x' y'
   1.145 -      ==> g x y \<sim> g x' y') ==>
   1.146 -    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y = P x' y') ==>
   1.147 -    P a b ==> f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = \<lfloor>g a b\<rfloor>"
   1.148 -proof -
   1.149 -  assume defn: "!!X Y. f X Y == \<lfloor>g (pick X) (pick Y)\<rfloor>"
   1.150 -  assume "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y ==> P x' y'
   1.151 -    ==> g x y \<sim> g x' y'"
   1.152 -  hence cong_g: "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y ==> P x' y'
   1.153 -    ==> \<lfloor>g x y\<rfloor> = \<lfloor>g x' y'\<rfloor>" ..
   1.154 -  assume "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y = P x' y'" and "P a b"
   1.155 -  with defn cong_g show ?thesis by (rule quot_cond_function2)
   1.156 -qed
   1.157 -
   1.158 -theorem quot_operation2:
   1.159 -  "(!!X Y. f X Y == \<lfloor>g (pick X) (pick Y)\<rfloor>) ==>
   1.160 -    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> g x y \<sim> g x' y') ==>
   1.161 -    f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = \<lfloor>g a b\<rfloor>"
   1.162 -proof -
   1.163 -  case antecedent from this refl TrueI
   1.164 -  show ?thesis by (rule quot_cond_operation2)
   1.165 +  show ?thesis by (rule quot_cond_function)
   1.166  qed
   1.167  
   1.168 -text {*
   1.169 - \medskip HOL's collection of overloaded standard operations is lifted
   1.170 - to quotient types in the canonical manner.
   1.171 -*}
   1.172 -
   1.173 -instance quot :: (zero) zero ..
   1.174 -instance quot :: (plus) plus ..
   1.175 -instance quot :: (minus) minus ..
   1.176 -instance quot :: (times) times ..
   1.177 -instance quot :: (inverse) inverse ..
   1.178 -instance quot :: (power) power ..
   1.179 -instance quot :: (number) number ..
   1.180 -instance quot :: (ord) ord ..
   1.181 -
   1.182 -defs (overloaded)
   1.183 -  zero_quot_def: "0 == \<lfloor>0\<rfloor>"
   1.184 -  add_quot_def: "X + Y == \<lfloor>pick X + pick Y\<rfloor>"
   1.185 -  diff_quot_def: "X - Y == \<lfloor>pick X - pick Y\<rfloor>"
   1.186 -  minus_quot_def: "- X == \<lfloor>- pick X\<rfloor>"
   1.187 -  abs_quot_def: "abs X == \<lfloor>abs (pick X)\<rfloor>"
   1.188 -  mult_quot_def: "X * Y == \<lfloor>pick X * pick Y\<rfloor>"
   1.189 -  inverse_quot_def: "inverse X == \<lfloor>inverse (pick X)\<rfloor>"
   1.190 -  divide_quot_def: "X / Y == \<lfloor>pick X / pick Y\<rfloor>"
   1.191 -  power_quot_def: "X^n == \<lfloor>(pick X)^n\<rfloor>"
   1.192 -  number_of_quot_def: "number_of b == \<lfloor>number_of b\<rfloor>"
   1.193 -  le_quot_def: "X \<le> Y == pick X \<le> pick Y"
   1.194 -  less_quot_def: "X < Y == pick X < pick Y"
   1.195 -
   1.196  end