src/HOL/Library/Quotient.thy
 changeset 10459 df3cd3e76046 parent 10437 7528f9e30ca4 child 10473 4f15b844fea6
```     1.1 --- a/src/HOL/Library/Quotient.thy	Sun Nov 12 14:49:37 2000 +0100
1.2 +++ b/src/HOL/Library/Quotient.thy	Sun Nov 12 14:50:26 2000 +0100
1.3 @@ -73,7 +73,7 @@
1.4   relation.
1.5  *}
1.6
1.7 -theorem equivalence_class_eq [iff?]: "(\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor>) = (a \<sim> b)"
1.8 +theorem equivalence_class_iff [iff?]: "(\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor>) = (a \<sim> b)"
1.9  proof
1.10    assume eq: "\<lfloor>a\<rfloor> = \<lfloor>b\<rfloor>"
1.11    show "a \<sim> b"
1.12 @@ -136,19 +136,59 @@
1.13   on quotient types.
1.14  *}
1.15
1.16 +theorem quot_cond_definition1:
1.17 +  "(!!X. f X == \<lfloor>g (pick X)\<rfloor>) ==>
1.18 +    (!!x x'. x \<sim> x' ==> P x ==> P x' ==> g x \<sim> g x') ==>
1.19 +    (!!x x'. x \<sim> x' ==> P x = P x') ==>
1.20 +  P a ==> f \<lfloor>a\<rfloor> = \<lfloor>g a\<rfloor>"
1.21 +proof -
1.22 +  assume cong_g: "!!x x'. x \<sim> x' ==> P x ==> P x' ==> g x \<sim> g x'"
1.23 +  assume cong_P: "!!x x'. x \<sim> x' ==> P x = P x'"
1.24 +  assume P: "P a"
1.25 +  assume "!!X. f X == \<lfloor>g (pick X)\<rfloor>"
1.26 +  hence "f \<lfloor>a\<rfloor> = \<lfloor>g (pick \<lfloor>a\<rfloor>)\<rfloor>" by (simp only:)
1.27 +  also have "\<dots> = \<lfloor>g a\<rfloor>"
1.28 +  proof
1.29 +    show "g (pick \<lfloor>a\<rfloor>) \<sim> g a"
1.30 +    proof (rule cong_g)
1.31 +      show "pick \<lfloor>a\<rfloor> \<sim> a" ..
1.32 +      hence "P (pick \<lfloor>a\<rfloor>) = P a" by (rule cong_P)
1.33 +      also show "P a" .
1.34 +      finally show "P (pick \<lfloor>a\<rfloor>)" .
1.35 +    qed
1.36 +  qed
1.37 +  finally show ?thesis .
1.38 +qed
1.39 +
1.40  theorem quot_definition1:
1.41    "(!!X. f X == \<lfloor>g (pick X)\<rfloor>) ==>
1.42      (!!x x'. x \<sim> x' ==> g x \<sim> g x') ==>
1.43      f \<lfloor>a\<rfloor> = \<lfloor>g a\<rfloor>"
1.44  proof -
1.45 -  assume cong: "!!x x'. x \<sim> x' ==> g x \<sim> g x'"
1.46 -  assume "!!X. f X == \<lfloor>g (pick X)\<rfloor>"
1.47 -  hence "f \<lfloor>a\<rfloor> = \<lfloor>g (pick \<lfloor>a\<rfloor>)\<rfloor>" by (simp only:)
1.48 -  also have "\<dots> = \<lfloor>g a\<rfloor>"
1.49 +  case antecedent from this refl TrueI
1.50 +  show ?thesis by (rule quot_cond_definition1)
1.51 +qed
1.52 +
1.53 +theorem quot_cond_definition2:
1.54 +  "(!!X Y. f X Y == \<lfloor>g (pick X) (pick Y)\<rfloor>) ==>
1.55 +    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y ==> P x' y' ==> g x y \<sim> g x' y') ==>
1.56 +    (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y = P x' y') ==>
1.57 +    P a b ==> f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = \<lfloor>g a b\<rfloor>"
1.58 +proof -
1.59 +  assume cong_g: "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y ==> P x' y' ==> g x y \<sim> g x' y'"
1.60 +  assume cong_P: "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> P x y = P x' y'"
1.61 +  assume P: "P a b"
1.62 +  assume "!!X Y. f X Y == \<lfloor>g (pick X) (pick Y)\<rfloor>"
1.63 +  hence "f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = \<lfloor>g (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>)\<rfloor>" by (simp only:)
1.64 +  also have "\<dots> = \<lfloor>g a b\<rfloor>"
1.65    proof
1.66 -    show "g (pick \<lfloor>a\<rfloor>) \<sim> g a"
1.67 -    proof (rule cong)
1.68 +    show "g (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>) \<sim> g a b"
1.69 +    proof (rule cong_g)
1.70        show "pick \<lfloor>a\<rfloor> \<sim> a" ..
1.71 +      moreover show "pick \<lfloor>b\<rfloor> \<sim> b" ..
1.72 +      ultimately have "P (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>) = P a b" by (rule cong_P)
1.73 +      also show "P a b" .
1.74 +      finally show "P (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>)" .
1.75      qed
1.76    qed
1.77    finally show ?thesis .
1.78 @@ -159,21 +199,10 @@
1.79      (!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> g x y \<sim> g x' y') ==>
1.80      f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = \<lfloor>g a b\<rfloor>"
1.81  proof -
1.82 -  assume cong: "!!x x' y y'. x \<sim> x' ==> y \<sim> y' ==> g x y \<sim> g x' y'"
1.83 -  assume "!!X Y. f X Y == \<lfloor>g (pick X) (pick Y)\<rfloor>"
1.84 -  hence "f \<lfloor>a\<rfloor> \<lfloor>b\<rfloor> = \<lfloor>g (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>)\<rfloor>" by (simp only:)
1.85 -  also have "\<dots> = \<lfloor>g a b\<rfloor>"
1.86 -  proof
1.87 -    show "g (pick \<lfloor>a\<rfloor>) (pick \<lfloor>b\<rfloor>) \<sim> g a b"
1.88 -    proof (rule cong)
1.89 -      show "pick \<lfloor>a\<rfloor> \<sim> a" ..
1.90 -      show "pick \<lfloor>b\<rfloor> \<sim> b" ..
1.91 -    qed
1.92 -  qed
1.93 -  finally show ?thesis .
1.94 +  case antecedent from this refl TrueI
1.95 +  show ?thesis by (rule quot_cond_definition2)
1.96  qed
1.97
1.98 -
1.99  text {*
1.100   \medskip HOL's collection of overloaded standard operations is lifted
1.101   to quotient types in the canonical manner.
1.102 @@ -186,6 +215,7 @@
1.103  instance quot :: (inverse) inverse ..
1.104  instance quot :: (power) power ..
1.105  instance quot :: (number) number ..
1.106 +instance quot :: (ord) ord ..
1.107