src/ZF/EquivClass.thy
author wenzelm
Sat, 13 Mar 2010 16:44:12 +0100
changeset 35762 af3ff2ba4c54
parent 24893 b8ef7afe3a6b
child 46820 c656222c4dc1
permissions -rw-r--r--
removed old CVS Ids; tuned headers;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23146
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     1
(*  Title:      ZF/EquivClass.thy
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     3
    Copyright   1994  University of Cambridge
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     4
*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     5
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     6
header{*Equivalence Relations*}
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     7
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     8
theory EquivClass imports Trancl Perm begin
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
     9
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 24892
diff changeset
    10
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 24892
diff changeset
    11
  quotient   :: "[i,i]=>i"    (infixl "'/'/" 90)  (*set of equiv classes*)  where
23146
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    12
      "A//r == {r``{x} . x:A}"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    13
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 24892
diff changeset
    14
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 24892
diff changeset
    15
  congruent  :: "[i,i=>i]=>o"  where
23146
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    16
      "congruent(r,b) == ALL y z. <y,z>:r --> b(y)=b(z)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    17
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 24892
diff changeset
    18
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 24892
diff changeset
    19
  congruent2 :: "[i,i,[i,i]=>i]=>o"  where
23146
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    20
      "congruent2(r1,r2,b) == ALL y1 z1 y2 z2.
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    21
           <y1,z1>:r1 --> <y2,z2>:r2 --> b(y1,y2) = b(z1,z2)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    22
24892
c663e675e177 replaced some 'translations' by 'abbreviation';
wenzelm
parents: 23146
diff changeset
    23
abbreviation
c663e675e177 replaced some 'translations' by 'abbreviation';
wenzelm
parents: 23146
diff changeset
    24
  RESPECTS ::"[i=>i, i] => o"  (infixr "respects" 80) where
c663e675e177 replaced some 'translations' by 'abbreviation';
wenzelm
parents: 23146
diff changeset
    25
  "f respects r == congruent(r,f)"
c663e675e177 replaced some 'translations' by 'abbreviation';
wenzelm
parents: 23146
diff changeset
    26
c663e675e177 replaced some 'translations' by 'abbreviation';
wenzelm
parents: 23146
diff changeset
    27
abbreviation
c663e675e177 replaced some 'translations' by 'abbreviation';
wenzelm
parents: 23146
diff changeset
    28
  RESPECTS2 ::"[i=>i=>i, i] => o"  (infixr "respects2 " 80) where
c663e675e177 replaced some 'translations' by 'abbreviation';
wenzelm
parents: 23146
diff changeset
    29
  "f respects2 r == congruent2(r,r,f)"
23146
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    30
    --{*Abbreviation for the common case where the relations are identical*}
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    31
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    32
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    33
subsection{*Suppes, Theorem 70:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    34
    @{term r} is an equiv relation iff @{term "converse(r) O r = r"}*}
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    35
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    36
(** first half: equiv(A,r) ==> converse(r) O r = r **)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    37
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    38
lemma sym_trans_comp_subset:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    39
    "[| sym(r); trans(r) |] ==> converse(r) O r <= r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    40
by (unfold trans_def sym_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    41
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    42
lemma refl_comp_subset:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    43
    "[| refl(A,r); r <= A*A |] ==> r <= converse(r) O r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    44
by (unfold refl_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    45
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    46
lemma equiv_comp_eq:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    47
    "equiv(A,r) ==> converse(r) O r = r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    48
apply (unfold equiv_def)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    49
apply (blast del: subsetI intro!: sym_trans_comp_subset refl_comp_subset)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    50
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    51
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    52
(*second half*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    53
lemma comp_equivI:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    54
    "[| converse(r) O r = r;  domain(r) = A |] ==> equiv(A,r)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    55
apply (unfold equiv_def refl_def sym_def trans_def)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    56
apply (erule equalityE)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    57
apply (subgoal_tac "ALL x y. <x,y> : r --> <y,x> : r", blast+)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    58
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    59
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    60
(** Equivalence classes **)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    61
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    62
(*Lemma for the next result*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    63
lemma equiv_class_subset:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    64
    "[| sym(r);  trans(r);  <a,b>: r |] ==> r``{a} <= r``{b}"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    65
by (unfold trans_def sym_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    66
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    67
lemma equiv_class_eq:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    68
    "[| equiv(A,r);  <a,b>: r |] ==> r``{a} = r``{b}"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    69
apply (unfold equiv_def)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    70
apply (safe del: subsetI intro!: equalityI equiv_class_subset)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    71
apply (unfold sym_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    72
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    73
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    74
lemma equiv_class_self:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    75
    "[| equiv(A,r);  a: A |] ==> a: r``{a}"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    76
by (unfold equiv_def refl_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    77
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    78
(*Lemma for the next result*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    79
lemma subset_equiv_class:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    80
    "[| equiv(A,r);  r``{b} <= r``{a};  b: A |] ==> <a,b>: r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    81
by (unfold equiv_def refl_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    82
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    83
lemma eq_equiv_class: "[| r``{a} = r``{b};  equiv(A,r);  b: A |] ==> <a,b>: r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    84
by (assumption | rule equalityD2 subset_equiv_class)+
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    85
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    86
(*thus r``{a} = r``{b} as well*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    87
lemma equiv_class_nondisjoint:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    88
    "[| equiv(A,r);  x: (r``{a} Int r``{b}) |] ==> <a,b>: r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    89
by (unfold equiv_def trans_def sym_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    90
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    91
lemma equiv_type: "equiv(A,r) ==> r <= A*A"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    92
by (unfold equiv_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    93
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    94
lemma equiv_class_eq_iff:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    95
     "equiv(A,r) ==> <x,y>: r <-> r``{x} = r``{y} & x:A & y:A"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    96
by (blast intro: eq_equiv_class equiv_class_eq dest: equiv_type)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    97
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    98
lemma eq_equiv_class_iff:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
    99
     "[| equiv(A,r);  x: A;  y: A |] ==> r``{x} = r``{y} <-> <x,y>: r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   100
by (blast intro: eq_equiv_class equiv_class_eq dest: equiv_type)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   101
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   102
(*** Quotients ***)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   103
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   104
(** Introduction/elimination rules -- needed? **)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   105
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   106
lemma quotientI [TC]: "x:A ==> r``{x}: A//r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   107
apply (unfold quotient_def)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   108
apply (erule RepFunI)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   109
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   110
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   111
lemma quotientE:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   112
    "[| X: A//r;  !!x. [| X = r``{x};  x:A |] ==> P |] ==> P"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   113
by (unfold quotient_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   114
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   115
lemma Union_quotient:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   116
    "equiv(A,r) ==> Union(A//r) = A"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   117
by (unfold equiv_def refl_def quotient_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   118
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   119
lemma quotient_disj:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   120
    "[| equiv(A,r);  X: A//r;  Y: A//r |] ==> X=Y | (X Int Y <= 0)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   121
apply (unfold quotient_def)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   122
apply (safe intro!: equiv_class_eq, assumption)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   123
apply (unfold equiv_def trans_def sym_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   124
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   125
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   126
subsection{*Defining Unary Operations upon Equivalence Classes*}
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   127
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   128
(** Could have a locale with the premises equiv(A,r)  and  congruent(r,b)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   129
**)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   130
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   131
(*Conversion rule*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   132
lemma UN_equiv_class:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   133
    "[| equiv(A,r);  b respects r;  a: A |] ==> (UN x:r``{a}. b(x)) = b(a)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   134
apply (subgoal_tac "\<forall>x \<in> r``{a}. b(x) = b(a)") 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   135
 apply simp
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   136
 apply (blast intro: equiv_class_self)  
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   137
apply (unfold equiv_def sym_def congruent_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   138
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   139
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   140
(*type checking of  UN x:r``{a}. b(x) *)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   141
lemma UN_equiv_class_type:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   142
    "[| equiv(A,r);  b respects r;  X: A//r;  !!x.  x : A ==> b(x) : B |]
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   143
     ==> (UN x:X. b(x)) : B"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   144
apply (unfold quotient_def, safe)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   145
apply (simp (no_asm_simp) add: UN_equiv_class)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   146
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   147
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   148
(*Sufficient conditions for injectiveness.  Could weaken premises!
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   149
  major premise could be an inclusion; bcong could be !!y. y:A ==> b(y):B
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   150
*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   151
lemma UN_equiv_class_inject:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   152
    "[| equiv(A,r);   b respects r;
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   153
        (UN x:X. b(x))=(UN y:Y. b(y));  X: A//r;  Y: A//r;
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   154
        !!x y. [| x:A; y:A; b(x)=b(y) |] ==> <x,y>:r |]
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   155
     ==> X=Y"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   156
apply (unfold quotient_def, safe)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   157
apply (rule equiv_class_eq, assumption)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   158
apply (simp add: UN_equiv_class [of A r b])  
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   159
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   160
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   161
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   162
subsection{*Defining Binary Operations upon Equivalence Classes*}
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   163
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   164
lemma congruent2_implies_congruent:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   165
    "[| equiv(A,r1);  congruent2(r1,r2,b);  a: A |] ==> congruent(r2,b(a))"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   166
by (unfold congruent_def congruent2_def equiv_def refl_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   167
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   168
lemma congruent2_implies_congruent_UN:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   169
    "[| equiv(A1,r1);  equiv(A2,r2);  congruent2(r1,r2,b);  a: A2 |] ==>
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   170
     congruent(r1, %x1. \<Union>x2 \<in> r2``{a}. b(x1,x2))"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   171
apply (unfold congruent_def, safe)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   172
apply (frule equiv_type [THEN subsetD], assumption)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   173
apply clarify 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   174
apply (simp add: UN_equiv_class congruent2_implies_congruent)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   175
apply (unfold congruent2_def equiv_def refl_def, blast)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   176
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   177
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   178
lemma UN_equiv_class2:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   179
    "[| equiv(A1,r1);  equiv(A2,r2);  congruent2(r1,r2,b);  a1: A1;  a2: A2 |]
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   180
     ==> (\<Union>x1 \<in> r1``{a1}. \<Union>x2 \<in> r2``{a2}. b(x1,x2)) = b(a1,a2)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   181
by (simp add: UN_equiv_class congruent2_implies_congruent
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   182
              congruent2_implies_congruent_UN)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   183
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   184
(*type checking*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   185
lemma UN_equiv_class_type2:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   186
    "[| equiv(A,r);  b respects2 r;
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   187
        X1: A//r;  X2: A//r;
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   188
        !!x1 x2.  [| x1: A; x2: A |] ==> b(x1,x2) : B
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   189
     |] ==> (UN x1:X1. UN x2:X2. b(x1,x2)) : B"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   190
apply (unfold quotient_def, safe)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   191
apply (blast intro: UN_equiv_class_type congruent2_implies_congruent_UN 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   192
                    congruent2_implies_congruent quotientI)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   193
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   194
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   195
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   196
(*Suggested by John Harrison -- the two subproofs may be MUCH simpler
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   197
  than the direct proof*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   198
lemma congruent2I:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   199
    "[|  equiv(A1,r1);  equiv(A2,r2);  
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   200
        !! y z w. [| w \<in> A2;  <y,z> \<in> r1 |] ==> b(y,w) = b(z,w);
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   201
        !! y z w. [| w \<in> A1;  <y,z> \<in> r2 |] ==> b(w,y) = b(w,z)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   202
     |] ==> congruent2(r1,r2,b)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   203
apply (unfold congruent2_def equiv_def refl_def, safe)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   204
apply (blast intro: trans) 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   205
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   206
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   207
lemma congruent2_commuteI:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   208
 assumes equivA: "equiv(A,r)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   209
     and commute: "!! y z. [| y: A;  z: A |] ==> b(y,z) = b(z,y)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   210
     and congt:   "!! y z w. [| w: A;  <y,z>: r |] ==> b(w,y) = b(w,z)"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   211
 shows "b respects2 r"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   212
apply (insert equivA [THEN equiv_type, THEN subsetD]) 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   213
apply (rule congruent2I [OF equivA equivA])
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   214
apply (rule commute [THEN trans])
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   215
apply (rule_tac [3] commute [THEN trans, symmetric])
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   216
apply (rule_tac [5] sym) 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   217
apply (blast intro: congt)+
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   218
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   219
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   220
(*Obsolete?*)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   221
lemma congruent_commuteI:
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   222
    "[| equiv(A,r);  Z: A//r;
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   223
        !!w. [| w: A |] ==> congruent(r, %z. b(w,z));
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   224
        !!x y. [| x: A;  y: A |] ==> b(y,x) = b(x,y)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   225
     |] ==> congruent(r, %w. UN z: Z. b(w,z))"
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   226
apply (simp (no_asm) add: congruent_def)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   227
apply (safe elim!: quotientE)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   228
apply (frule equiv_type [THEN subsetD], assumption)
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   229
apply (simp add: UN_equiv_class [of A r]) 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   230
apply (simp add: congruent_def) 
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   231
done
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   232
0bc590051d95 moved Integ files to canonical place;
wenzelm
parents:
diff changeset
   233
end