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