| author | berghofe | 
| Fri, 23 Jun 2000 12:24:37 +0200 | |
| changeset 9114 | de99e37effda | 
| parent 8703 | 816d8f6513be | 
| child 9167 | 5b6b65c90eeb | 
| permissions | -rw-r--r-- | 
| 1465 | 1 | (* Title: Equiv.ML | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 2 | ID: $Id$ | 
| 2215 | 3 | Authors: Lawrence C Paulson, Cambridge University Computer Laboratory | 
| 4 | Copyright 1996 University of Cambridge | |
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 5 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 6 | Equivalence relations in HOL Set Theory | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 7 | *) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 8 | |
| 1978 | 9 | val RSLIST = curry (op MRS); | 
| 10 | ||
| 3439 | 11 | (*** Suppes, Theorem 70: r is an equiv relation iff r^-1 O r = r ***) | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 12 | |
| 3439 | 13 | (** first half: equiv A r ==> r^-1 O r = r **) | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 14 | |
| 5069 | 15 | Goalw [trans_def,sym_def,converse_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 16 | "[| sym(r); trans(r) |] ==> r^-1 O r <= r"; | 
| 4746 | 17 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 18 | qed "sym_trans_comp_subset"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 19 | |
| 5069 | 20 | Goalw [refl_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 21 | "refl A r ==> r <= r^-1 O r"; | 
| 3718 | 22 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 23 | qed "refl_comp_subset"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 24 | |
| 5069 | 25 | Goalw [equiv_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 26 | "equiv A r ==> r^-1 O r = r"; | 
| 3718 | 27 | by (Clarify_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 28 | by (rtac equalityI 1); | 
| 3718 | 29 | by (REPEAT (ares_tac [sym_trans_comp_subset, refl_comp_subset] 1)); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 30 | qed "equiv_comp_eq"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 31 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 32 | (*second half*) | 
| 5069 | 33 | Goalw [equiv_def,refl_def,sym_def,trans_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 34 | "[| r^-1 O r = r; Domain(r) = A |] ==> equiv A r"; | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 35 | by (etac equalityE 1); | 
| 972 
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
 clasohm parents: 
925diff
changeset | 36 | by (subgoal_tac "ALL x y. (x,y) : r --> (y,x) : r" 1); | 
| 3718 | 37 | by (ALLGOALS Fast_tac); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 38 | qed "comp_equivI"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 39 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 40 | (** Equivalence classes **) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 41 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 42 | (*Lemma for the next result*) | 
| 5069 | 43 | Goalw [equiv_def,trans_def,sym_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 44 |     "[| equiv A r;  (a,b): r |] ==> r^^{a} <= r^^{b}";
 | 
| 3718 | 45 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 46 | qed "equiv_class_subset"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 47 | |
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5069diff
changeset | 48 | Goal "[| equiv A r;  (a,b): r |] ==> r^^{a} = r^^{b}";
 | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 49 | by (REPEAT (ares_tac [equalityI, equiv_class_subset] 1)); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 50 | by (rewrite_goals_tac [equiv_def,sym_def]); | 
| 3718 | 51 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 52 | qed "equiv_class_eq"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 53 | |
| 5069 | 54 | Goalw [equiv_def,refl_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 55 |     "[| equiv A r;  a: A |] ==> a: r^^{a}";
 | 
| 3718 | 56 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 57 | qed "equiv_class_self"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 58 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 59 | (*Lemma for the next result*) | 
| 5069 | 60 | Goalw [equiv_def,refl_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 61 |     "[| equiv A r;  r^^{b} <= r^^{a};  b: A |] ==> (a,b): r";
 | 
| 3718 | 62 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 63 | qed "subset_equiv_class"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 64 | |
| 5278 | 65 | Goal "[| r^^{a} = r^^{b};  equiv A r;  b: A |] ==> (a,b): r";
 | 
| 2215 | 66 | by (REPEAT (ares_tac [equalityD2, subset_equiv_class] 1)); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 67 | qed "eq_equiv_class"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 68 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 69 | (*thus r^^{a} = r^^{b} as well*)
 | 
| 5069 | 70 | Goalw [equiv_def,trans_def,sym_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 71 |     "[| equiv A r;  x: (r^^{a} Int r^^{b}) |] ==> (a,b): r";
 | 
| 3718 | 72 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 73 | qed "equiv_class_nondisjoint"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 74 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 75 | val [major] = goalw Equiv.thy [equiv_def,refl_def] | 
| 8703 | 76 | "equiv A r ==> r <= A <*> A"; | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 77 | by (rtac (major RS conjunct1 RS conjunct1) 1); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 78 | qed "equiv_type"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 79 | |
| 5278 | 80 | Goal "equiv A r ==> ((x,y): r) = (r^^{x} = r^^{y} & x:A & y:A)";
 | 
| 4089 | 81 | by (blast_tac (claset() addSIs [equiv_class_eq] | 
| 3718 | 82 | addDs [eq_equiv_class, equiv_type]) 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 83 | qed "equiv_class_eq_iff"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 84 | |
| 5278 | 85 | Goal "[| equiv A r;  x: A;  y: A |] ==> (r^^{x} = r^^{y}) = ((x,y): r)";
 | 
| 4089 | 86 | by (blast_tac (claset() addSIs [equiv_class_eq] | 
| 3718 | 87 | addDs [eq_equiv_class, equiv_type]) 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 88 | qed "eq_equiv_class_iff"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 89 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 90 | (*** Quotients ***) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 91 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 92 | (** Introduction/elimination rules -- needed? **) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 93 | |
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5069diff
changeset | 94 | Goalw [quotient_def] "x:A ==> r^^{x}: A/r";
 | 
| 3718 | 95 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 96 | qed "quotientI"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 97 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 98 | val [major,minor] = goalw Equiv.thy [quotient_def] | 
| 1465 | 99 |     "[| X:(A/r);  !!x. [| X = r^^{x};  x:A |] ==> P |]  \
 | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 100 | \ ==> P"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 101 | by (resolve_tac [major RS UN_E] 1); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 102 | by (rtac minor 1); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 103 | by (assume_tac 2); | 
| 3718 | 104 | by (Fast_tac 1); (*Blast_tac FAILS to prove it*) | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 105 | qed "quotientE"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 106 | |
| 5069 | 107 | Goalw [equiv_def,refl_def,quotient_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 108 | "equiv A r ==> Union(A/r) = A"; | 
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 109 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 110 | qed "Union_quotient"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 111 | |
| 5069 | 112 | Goalw [quotient_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 113 |     "[| equiv A r;  X: A/r;  Y: A/r |] ==> X=Y | (X Int Y = {})";
 | 
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 114 | by (Clarify_tac 1); | 
| 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 115 | by (rtac equiv_class_eq 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 116 | by (assume_tac 1); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 117 | by (rewrite_goals_tac [equiv_def,trans_def,sym_def]); | 
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 118 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 119 | qed "quotient_disj"; | 
| 3358 
13f1df323daf
Restoration of the two "bypassed" theorems Union_quotient and quotient_disj
 paulson parents: 
2215diff
changeset | 120 | |
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 121 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 122 | (**** Defining unary operations upon equivalence classes ****) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 123 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 124 | (* theorem needed to prove UN_equiv_class *) | 
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 125 | Goal "[| a:A; ! y:A. b(y)=c |] ==> (UN y:A. b(y))=c"; | 
| 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 126 | by Auto_tac; | 
| 6715 
89891b0b596f
UN_singleton->UN_constant_eq removes clash with other UN_singleton
 paulson parents: 
5278diff
changeset | 127 | qed "UN_constant_eq"; | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 128 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 129 | |
| 6715 
89891b0b596f
UN_singleton->UN_constant_eq removes clash with other UN_singleton
 paulson parents: 
5278diff
changeset | 130 | (** Could introduce a LOCALE with the assumptions | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 131 | equiv A r; congruent r b | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 132 | **) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 133 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 134 | (*Conversion rule*) | 
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5069diff
changeset | 135 | Goal "[| equiv A r; congruent r b; a: A |] \ | 
| 6715 
89891b0b596f
UN_singleton->UN_constant_eq removes clash with other UN_singleton
 paulson parents: 
5278diff
changeset | 136 | \     ==> (UN x:r^^{a}. b(x)) = b(a)";
 | 
| 
89891b0b596f
UN_singleton->UN_constant_eq removes clash with other UN_singleton
 paulson parents: 
5278diff
changeset | 137 | by (rtac (equiv_class_self RS UN_constant_eq) 1 THEN REPEAT (assume_tac 1)); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 138 | by (rewrite_goals_tac [equiv_def,congruent_def,sym_def]); | 
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 139 | by (blast_tac (claset() delrules [equalityI]) 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 140 | qed "UN_equiv_class"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 141 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 142 | (*type checking of  UN x:r``{a}. b(x) *)
 | 
| 2215 | 143 | val prems = goalw Equiv.thy [quotient_def] | 
| 1465 | 144 | "[| equiv A r; congruent r b; X: A/r; \ | 
| 2215 | 145 | \ !!x. x : A ==> b(x) : B |] \ | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 146 | \ ==> (UN x:X. b(x)) : B"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 147 | by (cut_facts_tac prems 1); | 
| 3718 | 148 | by (Clarify_tac 1); | 
| 2215 | 149 | by (stac UN_equiv_class 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 150 | by (REPEAT (ares_tac prems 1)); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 151 | qed "UN_equiv_class_type"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 152 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 153 | (*Sufficient conditions for injectiveness. Could weaken premises! | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 154 | major premise could be an inclusion; bcong could be !!y. y:A ==> b(y):B | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 155 | *) | 
| 2215 | 156 | val prems = goalw Equiv.thy [quotient_def] | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 157 | "[| equiv A r; congruent r b; \ | 
| 2215 | 158 | \ (UN x:X. b(x))=(UN y:Y. b(y)); X: A/r; Y: A/r; \ | 
| 1465 | 159 | \ !!x y. [| x:A; y:A; b(x)=b(y) |] ==> (x,y):r |] \ | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 160 | \ ==> X=Y"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 161 | by (cut_facts_tac prems 1); | 
| 3718 | 162 | by (Clarify_tac 1); | 
| 2215 | 163 | by (rtac equiv_class_eq 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 164 | by (REPEAT (ares_tac prems 1)); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 165 | by (etac box_equals 1); | 
| 2215 | 166 | by (REPEAT (ares_tac [UN_equiv_class] 1)); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 167 | qed "UN_equiv_class_inject"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 168 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 169 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 170 | (**** Defining binary operations upon equivalence classes ****) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 171 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 172 | |
| 5069 | 173 | Goalw [congruent_def,congruent2_def,equiv_def,refl_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 174 | "[| equiv A r; congruent2 r b; a: A |] ==> congruent r (b a)"; | 
| 3718 | 175 | by (Blast_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 176 | qed "congruent2_implies_congruent"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 177 | |
| 5069 | 178 | Goalw [congruent_def] | 
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 179 | "[| equiv A r; congruent2 r b; a: A |] ==> \ | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 180 | \    congruent r (%x1. UN x2:r^^{a}. b x1 x2)";
 | 
| 3718 | 181 | by (Clarify_tac 1); | 
| 2215 | 182 | by (rtac (equiv_type RS subsetD RS SigmaE2) 1 THEN REPEAT (assume_tac 1)); | 
| 4089 | 183 | by (asm_simp_tac (simpset() addsimps [UN_equiv_class, | 
| 1465 | 184 | congruent2_implies_congruent]) 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 185 | by (rewrite_goals_tac [congruent2_def,equiv_def,refl_def]); | 
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 186 | by (blast_tac (claset() delrules [equalityI]) 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 187 | qed "congruent2_implies_congruent_UN"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 188 | |
| 5278 | 189 | Goal "[| equiv A r; congruent2 r b; a1: A; a2: A |] \ | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 190 | \    ==> (UN x1:r^^{a1}. UN x2:r^^{a2}. b x1 x2) = b a1 a2";
 | 
| 4089 | 191 | by (asm_simp_tac (simpset() addsimps [UN_equiv_class, | 
| 1465 | 192 | congruent2_implies_congruent, | 
| 193 | congruent2_implies_congruent_UN]) 1); | |
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 194 | qed "UN_equiv_class2"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 195 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 196 | (*type checking*) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 197 | val prems = goalw Equiv.thy [quotient_def] | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 198 | "[| equiv A r; congruent2 r b; \ | 
| 1465 | 199 | \ X1: A/r; X2: A/r; \ | 
| 200 | \ !!x1 x2. [| x1: A; x2: A |] ==> b x1 x2 : B |] \ | |
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 201 | \ ==> (UN x1:X1. UN x2:X2. b x1 x2) : B"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 202 | by (cut_facts_tac prems 1); | 
| 3718 | 203 | by (Clarify_tac 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 204 | by (REPEAT (ares_tac (prems@[UN_equiv_class_type, | 
| 1465 | 205 | congruent2_implies_congruent_UN, | 
| 206 | congruent2_implies_congruent, quotientI]) 1)); | |
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 207 | qed "UN_equiv_class_type2"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 208 | |
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 209 | (*Allows a natural expression of binary operators, without explicit calls | 
| 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 210 | to "split"*) | 
| 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 211 | Goal "(UN (x1,x2):X. UN (y1,y2):Y. A x1 x2 y1 y2) = \ | 
| 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 212 | \ (UN x:X. UN y:Y. split(%x1 x2. split(%y1 y2. A x1 x2 y1 y2) y) x)"; | 
| 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 213 | by Auto_tac; | 
| 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 214 | qed "UN_UN_split_split_eq"; | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 215 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 216 | (*Suggested by John Harrison -- the two subproofs may be MUCH simpler | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 217 | than the direct proof*) | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 218 | val prems = goalw Equiv.thy [congruent2_def,equiv_def,refl_def] | 
| 1465 | 219 | "[| equiv A r; \ | 
| 972 
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
 clasohm parents: 
925diff
changeset | 220 | \ !! y z w. [| w: A; (y,z) : r |] ==> b y w = b z w; \ | 
| 
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
 clasohm parents: 
925diff
changeset | 221 | \ !! y z w. [| w: A; (y,z) : r |] ==> b w y = b w z \ | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 222 | \ |] ==> congruent2 r b"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 223 | by (cut_facts_tac prems 1); | 
| 3718 | 224 | by (Clarify_tac 1); | 
| 4089 | 225 | by (blast_tac (claset() addIs (trans::prems)) 1); | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 226 | qed "congruent2I"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 227 | |
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 228 | val [equivA,commute,congt] = goal Equiv.thy | 
| 1465 | 229 | "[| equiv A r; \ | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 230 | \ !! y z. [| y: A; z: A |] ==> b y z = b z y; \ | 
| 1465 | 231 | \ !! y z w. [| w: A; (y,z): r |] ==> b w y = b w z \ | 
| 925 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 232 | \ |] ==> congruent2 r b"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 233 | by (resolve_tac [equivA RS congruent2I] 1); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 234 | by (rtac (commute RS trans) 1); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 235 | by (rtac (commute RS trans RS sym) 3); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 236 | by (rtac sym 5); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 237 | by (REPEAT (ares_tac [congt] 1 | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 238 | ORELSE etac (equivA RS equiv_type RS subsetD RS SigmaE2) 1)); | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 239 | qed "congruent2_commuteI"; | 
| 
15539deb6863
new version of HOL/Integ with curried function application
 clasohm parents: diff
changeset | 240 | |
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 241 | |
| 4195 | 242 | (*** Cardinality results suggested by Florian Kammueller ***) | 
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 243 | |
| 8703 | 244 | (*Recall that equiv A r implies r <= A <*> A (equiv_type) *) | 
| 245 | Goal "[| finite A; r <= A <*> A |] ==> finite (A/r)"; | |
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 246 | by (rtac finite_subset 1); | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 247 | by (etac (finite_Pow_iff RS iffD2) 2); | 
| 3457 | 248 | by (rewtac quotient_def); | 
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 249 | by (Blast_tac 1); | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 250 | qed "finite_quotient"; | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 251 | |
| 5069 | 252 | Goalw [quotient_def] | 
| 8703 | 253 | "[| finite A; r <= A <*> A; X : A/r |] ==> finite X"; | 
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 254 | by (rtac finite_subset 1); | 
| 3457 | 255 | by (assume_tac 2); | 
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 256 | by (Blast_tac 1); | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 257 | qed "finite_equiv_class"; | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 258 | |
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 259 | Goal "[| finite A; equiv A r; ! X : A/r. k dvd card(X) |] ==> k dvd card(A)"; | 
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 260 | by (rtac (Union_quotient RS subst) 1); | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 261 | by (assume_tac 1); | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 262 | by (rtac dvd_partition 1); | 
| 7375 
2cb340e66d15
tidied, allowing pattern-matching in defs of zadd and zmult
 paulson parents: 
6715diff
changeset | 263 | by (blast_tac (claset() addEs [quotient_disj RS disjE]) 4); | 
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 264 | by (ALLGOALS | 
| 4089 | 265 | (asm_simp_tac (simpset() addsimps [Union_quotient, equiv_type, | 
| 3374 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 266 | finite_quotient]))); | 
| 
182a2b76d19e
New proofs about cardinality.  Suggested by Florian Kammueller
 paulson parents: 
3358diff
changeset | 267 | qed "equiv_imp_dvd_card"; |