author | berghofe |
Tue, 30 Jul 1996 17:33:26 +0200 | |
changeset 1894 | c2c8279d40f0 |
parent 1844 | 791e79473966 |
child 1978 | e7df069acb74 |
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$ |
1465 | 3 |
Authors: Riccardo Mattolini, Dip. Sistemi e Informatica |
4 |
Lawrence C Paulson, Cambridge University Computer Laboratory |
|
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
5 |
Copyright 1994 Universita' di Firenze |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
6 |
Copyright 1993 University of Cambridge |
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 |
Equivalence relations in HOL Set Theory |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
9 |
*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
10 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
11 |
open Equiv; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
12 |
|
1894 | 13 |
Delrules [equalityI]; |
14 |
||
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
15 |
(*** Suppes, Theorem 70: r is an equiv relation iff converse(r) O r = r ***) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
16 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
17 |
(** first half: equiv A r ==> converse(r) O r = r **) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
18 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
19 |
goalw Equiv.thy [trans_def,sym_def,converse_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
20 |
"!!r. [| sym(r); trans(r) |] ==> converse(r) O r <= r"; |
1894 | 21 |
by (fast_tac (!claset addSEs [converseD]) 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
22 |
qed "sym_trans_comp_subset"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
23 |
|
1045 | 24 |
goalw Equiv.thy [refl_def] |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
25 |
"!!A r. refl A r ==> r <= converse(r) O r"; |
1894 | 26 |
by (fast_tac (!claset addIs [compI]) 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
27 |
qed "refl_comp_subset"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
28 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
29 |
goalw Equiv.thy [equiv_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
30 |
"!!A r. equiv A r ==> converse(r) O r = r"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
31 |
by (rtac equalityI 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
32 |
by (REPEAT (ares_tac [sym_trans_comp_subset, refl_comp_subset] 1 |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
33 |
ORELSE etac conjE 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
34 |
qed "equiv_comp_eq"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
35 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
36 |
(*second half*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
37 |
goalw Equiv.thy [equiv_def,refl_def,sym_def,trans_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
38 |
"!!A r. [| converse(r) O r = r; Domain(r) = A |] ==> equiv A r"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
39 |
by (etac equalityE 1); |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
40 |
by (subgoal_tac "ALL x y. (x,y) : r --> (y,x) : r" 1); |
1894 | 41 |
by (safe_tac (!claset)); |
42 |
by (fast_tac (!claset addSIs [converseI] addIs [compI]) 3); |
|
43 |
by (ALLGOALS (fast_tac (!claset addIs [compI] addSEs [compE]))); |
|
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
44 |
qed "comp_equivI"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
45 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
46 |
(** Equivalence classes **) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
47 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
48 |
(*Lemma for the next result*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
49 |
goalw Equiv.thy [equiv_def,trans_def,sym_def] |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
50 |
"!!A r. [| equiv A r; (a,b): r |] ==> r^^{a} <= r^^{b}"; |
1894 | 51 |
by (safe_tac (!claset)); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
52 |
by (rtac ImageI 1); |
1894 | 53 |
by (Fast_tac 2); |
54 |
by (Fast_tac 1); |
|
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
55 |
qed "equiv_class_subset"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
56 |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
57 |
goal Equiv.thy "!!A r. [| 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
|
58 |
by (REPEAT (ares_tac [equalityI, equiv_class_subset] 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
59 |
by (rewrite_goals_tac [equiv_def,sym_def]); |
1894 | 60 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
61 |
qed "equiv_class_eq"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
62 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
63 |
val prems = goalw Equiv.thy [equiv_def,refl_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
64 |
"[| equiv A r; a: A |] ==> a: r^^{a}"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
65 |
by (cut_facts_tac prems 1); |
1894 | 66 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
67 |
qed "equiv_class_self"; |
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 |
(*Lemma for the next result*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
70 |
goalw Equiv.thy [equiv_def,refl_def] |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
71 |
"!!A r. [| equiv A r; r^^{b} <= r^^{a}; b: A |] ==> (a,b): r"; |
1894 | 72 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
73 |
qed "subset_equiv_class"; |
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 prems = goal Equiv.thy |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
76 |
"[| r^^{a} = r^^{b}; equiv A r; b: A |] ==> (a,b): r"; |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
77 |
by (REPEAT (resolve_tac (prems @ [equalityD2, subset_equiv_class]) 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
78 |
qed "eq_equiv_class"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
79 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
80 |
(*thus r^^{a} = r^^{b} as well*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
81 |
goalw Equiv.thy [equiv_def,trans_def,sym_def] |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
82 |
"!!A r. [| equiv A r; x: (r^^{a} Int r^^{b}) |] ==> (a,b): r"; |
1894 | 83 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
84 |
qed "equiv_class_nondisjoint"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
85 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
86 |
val [major] = goalw Equiv.thy [equiv_def,refl_def] |
1642 | 87 |
"equiv A r ==> r <= A Times A"; |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
88 |
by (rtac (major RS conjunct1 RS conjunct1) 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
89 |
qed "equiv_type"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
90 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
91 |
goal Equiv.thy |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
92 |
"!!A r. equiv A r ==> ((x,y): r) = (r^^{x} = r^^{y} & x:A & y:A)"; |
1894 | 93 |
by (safe_tac (!claset)); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
94 |
by ((rtac equiv_class_eq 1) THEN (assume_tac 1) THEN (assume_tac 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
95 |
by ((rtac eq_equiv_class 3) THEN |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
96 |
(assume_tac 4) THEN (assume_tac 4) THEN (assume_tac 3)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
97 |
by ((dtac equiv_type 1) THEN (dtac rev_subsetD 1) THEN |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
98 |
(assume_tac 1) THEN (dtac SigmaD1 1) THEN (assume_tac 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
99 |
by ((dtac equiv_type 1) THEN (dtac rev_subsetD 1) THEN |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
100 |
(assume_tac 1) THEN (dtac SigmaD2 1) THEN (assume_tac 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
101 |
qed "equiv_class_eq_iff"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
102 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
103 |
goal Equiv.thy |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
104 |
"!!A r. [| equiv A r; x: A; y: A |] ==> (r^^{x} = r^^{y}) = ((x,y): r)"; |
1894 | 105 |
by (safe_tac (!claset)); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
106 |
by ((rtac eq_equiv_class 1) THEN |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
107 |
(assume_tac 1) THEN (assume_tac 1) THEN (assume_tac 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
108 |
by ((rtac equiv_class_eq 1) THEN |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
109 |
(assume_tac 1) THEN (assume_tac 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
110 |
qed "eq_equiv_class_iff"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
111 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
112 |
(*** Quotients ***) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
113 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
114 |
(** Introduction/elimination rules -- needed? **) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
115 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
116 |
val prems = goalw Equiv.thy [quotient_def] "x:A ==> r^^{x}: A/r"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
117 |
by (rtac UN_I 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
118 |
by (resolve_tac prems 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
119 |
by (rtac singletonI 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
120 |
qed "quotientI"; |
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 |
val [major,minor] = goalw Equiv.thy [quotient_def] |
1465 | 123 |
"[| 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
|
124 |
\ ==> P"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
125 |
by (resolve_tac [major RS UN_E] 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
126 |
by (rtac minor 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
127 |
by (assume_tac 2); |
1894 | 128 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
129 |
qed "quotientE"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
130 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
131 |
(** Not needed by Theory Integ --> bypassed **) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
132 |
(**goalw Equiv.thy [equiv_def,refl_def,quotient_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
133 |
"!!A r. equiv A r ==> Union(A/r) = A"; |
1844 | 134 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
135 |
qed "Union_quotient"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
136 |
**) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
137 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
138 |
(** Not needed by Theory Integ --> bypassed **) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
139 |
(*goalw Equiv.thy [quotient_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
140 |
"!!A r. [| equiv A r; X: A/r; Y: A/r |] ==> X=Y | (X Int Y <= 0)"; |
1894 | 141 |
by (safe_tac (!claset addSIs [equiv_class_eq])); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
142 |
by (assume_tac 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
143 |
by (rewrite_goals_tac [equiv_def,trans_def,sym_def]); |
1894 | 144 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
145 |
qed "quotient_disj"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
146 |
**) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
147 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
148 |
(**** Defining unary operations upon equivalence classes ****) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
149 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
150 |
(* theorem needed to prove UN_equiv_class *) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
151 |
goal Set.thy "!!A. [| a:A; ! y:A. b(y)=b(a) |] ==> (UN y:A. b(y))=b(a)"; |
1894 | 152 |
by (fast_tac (!claset addSEs [equalityE] addSIs [equalityI]) 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
153 |
qed "UN_singleton_lemma"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
154 |
val UN_singleton = ballI RSN (2,UN_singleton_lemma); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
155 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
156 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
157 |
(** These proofs really require as local premises |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
158 |
equiv A r; congruent r b |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
159 |
**) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
160 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
161 |
(*Conversion rule*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
162 |
val prems as [equivA,bcong,_] = goal Equiv.thy |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
163 |
"[| equiv A r; congruent r b; a: A |] ==> (UN x:r^^{a}. b(x)) = b(a)"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
164 |
by (cut_facts_tac prems 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
165 |
by (rtac UN_singleton 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
166 |
by (rtac equiv_class_self 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
167 |
by (assume_tac 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
168 |
by (assume_tac 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
169 |
by (rewrite_goals_tac [equiv_def,congruent_def,sym_def]); |
1894 | 170 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
171 |
qed "UN_equiv_class"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
172 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
173 |
(*Resolve th against the "local" premises*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
174 |
val localize = RSLIST [equivA,bcong]; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
175 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
176 |
(*type checking of UN x:r``{a}. b(x) *) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
177 |
val _::_::prems = goalw Equiv.thy [quotient_def] |
1465 | 178 |
"[| equiv A r; congruent r b; X: A/r; \ |
179 |
\ !!x. x : A ==> b(x) : B |] \ |
|
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
180 |
\ ==> (UN x:X. b(x)) : B"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
181 |
by (cut_facts_tac prems 1); |
1894 | 182 |
by (safe_tac (!claset)); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
183 |
by (rtac (localize UN_equiv_class RS ssubst) 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
184 |
by (REPEAT (ares_tac prems 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
185 |
qed "UN_equiv_class_type"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
186 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
187 |
(*Sufficient conditions for injectiveness. Could weaken premises! |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
188 |
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
|
189 |
*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
190 |
val _::_::prems = goalw Equiv.thy [quotient_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
191 |
"[| equiv A r; congruent r b; \ |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
192 |
\ (UN x:X. b(x))=(UN y:Y. b(y)); X: A/r; Y: A/r; \ |
1465 | 193 |
\ !!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
|
194 |
\ ==> X=Y"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
195 |
by (cut_facts_tac prems 1); |
1894 | 196 |
by (safe_tac ((!claset) delrules [equalityI])); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
197 |
by (rtac (equivA RS equiv_class_eq) 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
198 |
by (REPEAT (ares_tac prems 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
199 |
by (etac box_equals 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
200 |
by (REPEAT (ares_tac [localize UN_equiv_class] 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
201 |
qed "UN_equiv_class_inject"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
202 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
203 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
204 |
(**** Defining binary operations upon equivalence classes ****) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
205 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
206 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
207 |
goalw Equiv.thy [congruent_def,congruent2_def,equiv_def,refl_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
208 |
"!!A r. [| equiv A r; congruent2 r b; a: A |] ==> congruent r (b a)"; |
1894 | 209 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
210 |
qed "congruent2_implies_congruent"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
211 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
212 |
val equivA::prems = goalw Equiv.thy [congruent_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
213 |
"[| equiv A r; congruent2 r b; a: A |] ==> \ |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
214 |
\ congruent r (%x1. UN x2:r^^{a}. b x1 x2)"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
215 |
by (cut_facts_tac (equivA::prems) 1); |
1894 | 216 |
by (safe_tac (!claset)); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
217 |
by (rtac (equivA RS equiv_type RS subsetD RS SigmaE2) 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
218 |
by (assume_tac 1); |
1266 | 219 |
by (asm_simp_tac (!simpset addsimps [equivA RS UN_equiv_class, |
1465 | 220 |
congruent2_implies_congruent]) 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
221 |
by (rewrite_goals_tac [congruent2_def,equiv_def,refl_def]); |
1894 | 222 |
by (Fast_tac 1); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
223 |
qed "congruent2_implies_congruent_UN"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
224 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
225 |
val prems as equivA::_ = goal Equiv.thy |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
226 |
"[| equiv A r; congruent2 r b; a1: A; a2: A |] \ |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
227 |
\ ==> (UN x1:r^^{a1}. UN x2:r^^{a2}. b x1 x2) = b a1 a2"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
228 |
by (cut_facts_tac prems 1); |
1266 | 229 |
by (asm_simp_tac (!simpset addsimps [equivA RS UN_equiv_class, |
1465 | 230 |
congruent2_implies_congruent, |
231 |
congruent2_implies_congruent_UN]) 1); |
|
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
232 |
qed "UN_equiv_class2"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
233 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
234 |
(*type checking*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
235 |
val prems = goalw Equiv.thy [quotient_def] |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
236 |
"[| equiv A r; congruent2 r b; \ |
1465 | 237 |
\ X1: A/r; X2: A/r; \ |
238 |
\ !!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
|
239 |
\ ==> (UN x1:X1. UN x2:X2. b x1 x2) : B"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
240 |
by (cut_facts_tac prems 1); |
1894 | 241 |
by (safe_tac (!claset)); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
242 |
by (REPEAT (ares_tac (prems@[UN_equiv_class_type, |
1465 | 243 |
congruent2_implies_congruent_UN, |
244 |
congruent2_implies_congruent, quotientI]) 1)); |
|
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
245 |
qed "UN_equiv_class_type2"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
246 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
247 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
248 |
(*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
|
249 |
than the direct proof*) |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
250 |
val prems = goalw Equiv.thy [congruent2_def,equiv_def,refl_def] |
1465 | 251 |
"[| equiv A r; \ |
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
252 |
\ !! y z w. [| w: A; (y,z) : r |] ==> b y w = b z w; \ |
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
925
diff
changeset
|
253 |
\ !! 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
|
254 |
\ |] ==> congruent2 r b"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
255 |
by (cut_facts_tac prems 1); |
1894 | 256 |
by (safe_tac (!claset)); |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
257 |
by (rtac trans 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
258 |
by (REPEAT (ares_tac prems 1 |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
259 |
ORELSE etac (subsetD RS SigmaE2) 1 THEN assume_tac 2 THEN assume_tac 1)); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
260 |
qed "congruent2I"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
261 |
|
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
262 |
val [equivA,commute,congt] = goal Equiv.thy |
1465 | 263 |
"[| equiv A r; \ |
925
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
264 |
\ !! y z. [| y: A; z: A |] ==> b y z = b z y; \ |
1465 | 265 |
\ !! 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
|
266 |
\ |] ==> congruent2 r b"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
267 |
by (resolve_tac [equivA RS congruent2I] 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
268 |
by (rtac (commute RS trans) 1); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
269 |
by (rtac (commute RS trans RS sym) 3); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
270 |
by (rtac sym 5); |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
271 |
by (REPEAT (ares_tac [congt] 1 |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
272 |
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
|
273 |
qed "congruent2_commuteI"; |
15539deb6863
new version of HOL/Integ with curried function application
clasohm
parents:
diff
changeset
|
274 |