author | lcp |
Tue, 16 Aug 1994 19:03:45 +0200 | |
changeset 534 | cd8bec47e175 |
parent 521 | dfca17a698b0 |
child 744 | 2054fa3c8d76 |
permissions | -rw-r--r-- |
0 | 1 |
(* Title: ZF/sum |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1992 University of Cambridge |
|
5 |
||
6 |
Disjoint sums in Zermelo-Fraenkel Set Theory |
|
7 |
*) |
|
8 |
||
9 |
open Sum; |
|
10 |
||
11 |
val sum_defs = [sum_def,Inl_def,Inr_def,case_def]; |
|
12 |
||
521 | 13 |
goalw Sum.thy (bool_def::sum_defs) "Sigma(bool,C) = C(0) + C(1)"; |
14 |
by (fast_tac eq_cs 1); |
|
15 |
val Sigma_bool = result(); |
|
16 |
||
0 | 17 |
(** Introduction rules for the injections **) |
18 |
||
19 |
goalw Sum.thy sum_defs "!!a A B. a : A ==> Inl(a) : A+B"; |
|
20 |
by (REPEAT (ares_tac [UnI1,SigmaI,singletonI] 1)); |
|
21 |
val InlI = result(); |
|
22 |
||
23 |
goalw Sum.thy sum_defs "!!b A B. b : B ==> Inr(b) : A+B"; |
|
24 |
by (REPEAT (ares_tac [UnI2,SigmaI,singletonI] 1)); |
|
25 |
val InrI = result(); |
|
26 |
||
27 |
(** Elimination rules **) |
|
28 |
||
29 |
val major::prems = goalw Sum.thy sum_defs |
|
30 |
"[| u: A+B; \ |
|
31 |
\ !!x. [| x:A; u=Inl(x) |] ==> P; \ |
|
32 |
\ !!y. [| y:B; u=Inr(y) |] ==> P \ |
|
33 |
\ |] ==> P"; |
|
34 |
by (rtac (major RS UnE) 1); |
|
35 |
by (REPEAT (rtac refl 1 |
|
36 |
ORELSE eresolve_tac (prems@[SigmaE,singletonE,ssubst]) 1)); |
|
37 |
val sumE = result(); |
|
38 |
||
39 |
(** Injection and freeness equivalences, for rewriting **) |
|
40 |
||
55 | 41 |
goalw Sum.thy sum_defs "Inl(a)=Inl(b) <-> a=b"; |
435 | 42 |
by (simp_tac ZF_ss 1); |
0 | 43 |
val Inl_iff = result(); |
44 |
||
55 | 45 |
goalw Sum.thy sum_defs "Inr(a)=Inr(b) <-> a=b"; |
435 | 46 |
by (simp_tac ZF_ss 1); |
0 | 47 |
val Inr_iff = result(); |
48 |
||
55 | 49 |
goalw Sum.thy sum_defs "Inl(a)=Inr(b) <-> False"; |
435 | 50 |
by (simp_tac (ZF_ss addsimps [one_not_0 RS not_sym]) 1); |
0 | 51 |
val Inl_Inr_iff = result(); |
52 |
||
55 | 53 |
goalw Sum.thy sum_defs "Inr(b)=Inl(a) <-> False"; |
435 | 54 |
by (simp_tac (ZF_ss addsimps [one_not_0]) 1); |
0 | 55 |
val Inr_Inl_iff = result(); |
56 |
||
55 | 57 |
(*Injection and freeness rules*) |
58 |
||
59 |
val Inl_inject = standard (Inl_iff RS iffD1); |
|
60 |
val Inr_inject = standard (Inr_iff RS iffD1); |
|
61 |
val Inl_neq_Inr = standard (Inl_Inr_iff RS iffD1 RS FalseE); |
|
62 |
val Inr_neq_Inl = standard (Inr_Inl_iff RS iffD1 RS FalseE); |
|
63 |
||
64 |
val sum_cs = ZF_cs addSIs [InlI,InrI] addSEs [sumE,Inl_neq_Inr,Inr_neq_Inl] |
|
0 | 65 |
addSDs [Inl_inject,Inr_inject]; |
66 |
||
435 | 67 |
val sum_ss = ZF_ss addsimps [InlI, InrI, Inl_iff, Inr_iff, |
68 |
Inl_Inr_iff, Inr_Inl_iff]; |
|
69 |
||
55 | 70 |
goal Sum.thy "!!A B. Inl(a): A+B ==> a: A"; |
71 |
by (fast_tac sum_cs 1); |
|
72 |
val InlD = result(); |
|
73 |
||
74 |
goal Sum.thy "!!A B. Inr(b): A+B ==> b: B"; |
|
75 |
by (fast_tac sum_cs 1); |
|
76 |
val InrD = result(); |
|
77 |
||
0 | 78 |
goal Sum.thy "u: A+B <-> (EX x. x:A & u=Inl(x)) | (EX y. y:B & u=Inr(y))"; |
79 |
by (fast_tac sum_cs 1); |
|
80 |
val sum_iff = result(); |
|
81 |
||
82 |
goal Sum.thy "A+B <= C+D <-> A<=C & B<=D"; |
|
83 |
by (fast_tac sum_cs 1); |
|
84 |
val sum_subset_iff = result(); |
|
85 |
||
86 |
goal Sum.thy "A+B = C+D <-> A=C & B=D"; |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
87 |
by (simp_tac (ZF_ss addsimps [extension,sum_subset_iff]) 1); |
0 | 88 |
by (fast_tac ZF_cs 1); |
89 |
val sum_equal_iff = result(); |
|
90 |
||
521 | 91 |
|
0 | 92 |
(*** Eliminator -- case ***) |
93 |
||
94 |
goalw Sum.thy sum_defs "case(c, d, Inl(a)) = c(a)"; |
|
95 |
by (rtac (split RS trans) 1); |
|
96 |
by (rtac cond_0 1); |
|
97 |
val case_Inl = result(); |
|
98 |
||
99 |
goalw Sum.thy sum_defs "case(c, d, Inr(b)) = d(b)"; |
|
100 |
by (rtac (split RS trans) 1); |
|
101 |
by (rtac cond_1 1); |
|
102 |
val case_Inr = result(); |
|
103 |
||
104 |
val major::prems = goal Sum.thy |
|
105 |
"[| u: A+B; \ |
|
106 |
\ !!x. x: A ==> c(x): C(Inl(x)); \ |
|
107 |
\ !!y. y: B ==> d(y): C(Inr(y)) \ |
|
108 |
\ |] ==> case(c,d,u) : C(u)"; |
|
109 |
by (rtac (major RS sumE) 1); |
|
110 |
by (ALLGOALS (etac ssubst)); |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
111 |
by (ALLGOALS (asm_simp_tac (ZF_ss addsimps |
0 | 112 |
(prems@[case_Inl,case_Inr])))); |
113 |
val case_type = result(); |
|
114 |
||
435 | 115 |
goal Sum.thy |
116 |
"!!u. u: A+B ==> \ |
|
117 |
\ R(case(c,d,u)) <-> \ |
|
118 |
\ ((ALL x:A. u = Inl(x) --> R(c(x))) & \ |
|
119 |
\ (ALL y:B. u = Inr(y) --> R(d(y))))"; |
|
120 |
by (etac sumE 1); |
|
121 |
by (asm_simp_tac (ZF_ss addsimps [case_Inl]) 1); |
|
122 |
by (fast_tac sum_cs 1); |
|
123 |
by (asm_simp_tac (ZF_ss addsimps [case_Inr]) 1); |
|
124 |
by (fast_tac sum_cs 1); |
|
125 |
val expand_case = result(); |
|
126 |
||
127 |
||
0 | 128 |
(** Rules for the Part primitive **) |
129 |
||
130 |
goalw Sum.thy [Part_def] |
|
131 |
"!!a b A h. [| a : A; a=h(b) |] ==> a : Part(A,h)"; |
|
132 |
by (REPEAT (ares_tac [exI,CollectI] 1)); |
|
133 |
val Part_eqI = result(); |
|
134 |
||
135 |
val PartI = refl RSN (2,Part_eqI); |
|
136 |
||
137 |
val major::prems = goalw Sum.thy [Part_def] |
|
138 |
"[| a : Part(A,h); !!z. [| a : A; a=h(z) |] ==> P \ |
|
139 |
\ |] ==> P"; |
|
140 |
by (rtac (major RS CollectE) 1); |
|
141 |
by (etac exE 1); |
|
142 |
by (REPEAT (ares_tac prems 1)); |
|
143 |
val PartE = result(); |
|
144 |
||
145 |
goalw Sum.thy [Part_def] "Part(A,h) <= A"; |
|
146 |
by (rtac Collect_subset 1); |
|
147 |
val Part_subset = result(); |
|
148 |
||
149 |
goal Sum.thy "!!A B h. A<=B ==> Part(A,h)<=Part(B,h)"; |
|
150 |
by (fast_tac (ZF_cs addIs [PartI] addSEs [PartE]) 1); |
|
151 |
val Part_mono = result(); |
|
152 |
||
153 |
goal Sum.thy "Part(A+B,Inl) = {Inl(x). x: A}"; |
|
154 |
by (fast_tac (sum_cs addIs [PartI,equalityI] addSEs [PartE]) 1); |
|
155 |
val Part_Inl = result(); |
|
156 |
||
157 |
goal Sum.thy "Part(A+B,Inr) = {Inr(y). y: B}"; |
|
158 |
by (fast_tac (sum_cs addIs [PartI,equalityI] addSEs [PartE]) 1); |
|
159 |
val Part_Inr = result(); |
|
160 |
||
161 |
goalw Sum.thy [Part_def] "!!a. a : Part(A,h) ==> a : A"; |
|
162 |
by (etac CollectD1 1); |
|
163 |
val PartD1 = result(); |
|
164 |
||
165 |
goal Sum.thy "Part(A,%x.x) = A"; |
|
166 |
by (fast_tac (ZF_cs addIs [PartI,equalityI] addSEs [PartE]) 1); |
|
167 |
val Part_id = result(); |
|
168 |
||
169 |
goal Sum.thy "Part(A+B, %x.Inr(h(x))) = {Inr(y). y: Part(B,h)}"; |
|
170 |
by (fast_tac (sum_cs addIs [PartI,equalityI] addSEs [PartE]) 1); |
|
171 |
val Part_Inr2 = result(); |
|
172 |
||
173 |
goal Sum.thy "!!A B C. C <= A+B ==> Part(C,Inl) Un Part(C,Inr) = C"; |
|
174 |
by (rtac equalityI 1); |
|
175 |
by (rtac Un_least 1); |
|
176 |
by (rtac Part_subset 1); |
|
177 |
by (rtac Part_subset 1); |
|
178 |
by (fast_tac (ZF_cs addIs [PartI] addSEs [sumE]) 1); |
|
179 |
val Part_sum_equality = result(); |