author | paulson |
Fri, 29 Oct 2004 15:16:02 +0200 | |
changeset 15270 | 8b3f707a78a7 |
parent 14864 | 419b45cdb400 |
child 16417 | 9bc16273c2d4 |
permissions | -rw-r--r-- |
13240 | 1 |
(* Title: ZF/pair |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1992 University of Cambridge |
|
5 |
||
6 |
*) |
|
7 |
||
13357 | 8 |
header{*Ordered Pairs*} |
9 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
2469
diff
changeset
|
10 |
theory pair = upair |
11694 | 11 |
files "simpdata.ML": |
13240 | 12 |
|
13 |
(** Lemmas for showing that <a,b> uniquely determines a and b **) |
|
14 |
||
15 |
lemma singleton_eq_iff [iff]: "{a} = {b} <-> a=b" |
|
16 |
by (rule extension [THEN iff_trans], blast) |
|
17 |
||
18 |
lemma doubleton_eq_iff: "{a,b} = {c,d} <-> (a=c & b=d) | (a=d & b=c)" |
|
19 |
by (rule extension [THEN iff_trans], blast) |
|
20 |
||
21 |
lemma Pair_iff [simp]: "<a,b> = <c,d> <-> a=c & b=d" |
|
22 |
by (simp add: Pair_def doubleton_eq_iff, blast) |
|
23 |
||
24 |
lemmas Pair_inject = Pair_iff [THEN iffD1, THEN conjE, standard, elim!] |
|
25 |
||
26 |
lemmas Pair_inject1 = Pair_iff [THEN iffD1, THEN conjunct1, standard] |
|
27 |
lemmas Pair_inject2 = Pair_iff [THEN iffD1, THEN conjunct2, standard] |
|
28 |
||
29 |
lemma Pair_not_0: "<a,b> ~= 0" |
|
30 |
apply (unfold Pair_def) |
|
31 |
apply (blast elim: equalityE) |
|
32 |
done |
|
33 |
||
34 |
lemmas Pair_neq_0 = Pair_not_0 [THEN notE, standard, elim!] |
|
35 |
||
36 |
declare sym [THEN Pair_neq_0, elim!] |
|
37 |
||
38 |
lemma Pair_neq_fst: "<a,b>=a ==> P" |
|
39 |
apply (unfold Pair_def) |
|
40 |
apply (rule consI1 [THEN mem_asym, THEN FalseE]) |
|
41 |
apply (erule subst) |
|
42 |
apply (rule consI1) |
|
43 |
done |
|
44 |
||
45 |
lemma Pair_neq_snd: "<a,b>=b ==> P" |
|
46 |
apply (unfold Pair_def) |
|
47 |
apply (rule consI1 [THEN consI2, THEN mem_asym, THEN FalseE]) |
|
48 |
apply (erule subst) |
|
49 |
apply (rule consI1 [THEN consI2]) |
|
50 |
done |
|
51 |
||
52 |
||
13357 | 53 |
subsection{*Sigma: Disjoint Union of a Family of Sets*} |
54 |
||
55 |
text{*Generalizes Cartesian product*} |
|
13240 | 56 |
|
57 |
lemma Sigma_iff [simp]: "<a,b>: Sigma(A,B) <-> a:A & b:B(a)" |
|
58 |
by (simp add: Sigma_def) |
|
59 |
||
60 |
lemma SigmaI [TC,intro!]: "[| a:A; b:B(a) |] ==> <a,b> : Sigma(A,B)" |
|
61 |
by simp |
|
62 |
||
63 |
lemmas SigmaD1 = Sigma_iff [THEN iffD1, THEN conjunct1, standard] |
|
64 |
lemmas SigmaD2 = Sigma_iff [THEN iffD1, THEN conjunct2, standard] |
|
65 |
||
66 |
(*The general elimination rule*) |
|
67 |
lemma SigmaE [elim!]: |
|
68 |
"[| c: Sigma(A,B); |
|
69 |
!!x y.[| x:A; y:B(x); c=<x,y> |] ==> P |
|
70 |
|] ==> P" |
|
13357 | 71 |
by (unfold Sigma_def, blast) |
13240 | 72 |
|
73 |
lemma SigmaE2 [elim!]: |
|
74 |
"[| <a,b> : Sigma(A,B); |
|
75 |
[| a:A; b:B(a) |] ==> P |
|
76 |
|] ==> P" |
|
13357 | 77 |
by (unfold Sigma_def, blast) |
13240 | 78 |
|
79 |
lemma Sigma_cong: |
|
80 |
"[| A=A'; !!x. x:A' ==> B(x)=B'(x) |] ==> |
|
81 |
Sigma(A,B) = Sigma(A',B')" |
|
82 |
by (simp add: Sigma_def) |
|
83 |
||
84 |
(*Sigma_cong, Pi_cong NOT given to Addcongs: they cause |
|
85 |
flex-flex pairs and the "Check your prover" error. Most |
|
86 |
Sigmas and Pis are abbreviated as * or -> *) |
|
87 |
||
88 |
lemma Sigma_empty1 [simp]: "Sigma(0,B) = 0" |
|
89 |
by blast |
|
90 |
||
91 |
lemma Sigma_empty2 [simp]: "A*0 = 0" |
|
92 |
by blast |
|
93 |
||
94 |
lemma Sigma_empty_iff: "A*B=0 <-> A=0 | B=0" |
|
95 |
by blast |
|
96 |
||
97 |
||
13357 | 98 |
subsection{*Projections @{term fst} and @{term snd}*} |
13240 | 99 |
|
100 |
lemma fst_conv [simp]: "fst(<a,b>) = a" |
|
13544 | 101 |
by (simp add: fst_def) |
13240 | 102 |
|
103 |
lemma snd_conv [simp]: "snd(<a,b>) = b" |
|
13544 | 104 |
by (simp add: snd_def) |
13240 | 105 |
|
106 |
lemma fst_type [TC]: "p:Sigma(A,B) ==> fst(p) : A" |
|
107 |
by auto |
|
108 |
||
109 |
lemma snd_type [TC]: "p:Sigma(A,B) ==> snd(p) : B(fst(p))" |
|
110 |
by auto |
|
111 |
||
112 |
lemma Pair_fst_snd_eq: "a: Sigma(A,B) ==> <fst(a),snd(a)> = a" |
|
113 |
by auto |
|
114 |
||
115 |
||
13357 | 116 |
subsection{*The Eliminator, @{term split}*} |
13240 | 117 |
|
118 |
(*A META-equality, so that it applies to higher types as well...*) |
|
119 |
lemma split [simp]: "split(%x y. c(x,y), <a,b>) == c(a,b)" |
|
120 |
by (simp add: split_def) |
|
121 |
||
122 |
lemma split_type [TC]: |
|
123 |
"[| p:Sigma(A,B); |
|
124 |
!!x y.[| x:A; y:B(x) |] ==> c(x,y):C(<x,y>) |
|
125 |
|] ==> split(%x y. c(x,y), p) : C(p)" |
|
126 |
apply (erule SigmaE, auto) |
|
127 |
done |
|
128 |
||
129 |
lemma expand_split: |
|
130 |
"u: A*B ==> |
|
131 |
R(split(c,u)) <-> (ALL x:A. ALL y:B. u = <x,y> --> R(c(x,y)))" |
|
132 |
apply (simp add: split_def, auto) |
|
133 |
done |
|
134 |
||
135 |
||
13357 | 136 |
subsection{*A version of @{term split} for Formulae: Result Type @{typ o}*} |
13240 | 137 |
|
138 |
lemma splitI: "R(a,b) ==> split(R, <a,b>)" |
|
139 |
by (simp add: split_def) |
|
140 |
||
141 |
lemma splitE: |
|
142 |
"[| split(R,z); z:Sigma(A,B); |
|
143 |
!!x y. [| z = <x,y>; R(x,y) |] ==> P |
|
144 |
|] ==> P" |
|
145 |
apply (simp add: split_def) |
|
146 |
apply (erule SigmaE, force) |
|
147 |
done |
|
148 |
||
149 |
lemma splitD: "split(R,<a,b>) ==> R(a,b)" |
|
150 |
by (simp add: split_def) |
|
151 |
||
14864 | 152 |
text {* |
153 |
\bigskip Complex rules for Sigma. |
|
154 |
*} |
|
155 |
||
156 |
lemma split_paired_Bex_Sigma [simp]: |
|
157 |
"(\<exists>z \<in> Sigma(A,B). P(z)) <-> (\<exists>x \<in> A. \<exists>y \<in> B(x). P(<x,y>))" |
|
158 |
by blast |
|
159 |
||
160 |
lemma split_paired_Ball_Sigma [simp]: |
|
161 |
"(\<forall>z \<in> Sigma(A,B). P(z)) <-> (\<forall>x \<in> A. \<forall>y \<in> B(x). P(<x,y>))" |
|
162 |
by blast |
|
163 |
||
13240 | 164 |
ML |
165 |
{* |
|
166 |
val singleton_eq_iff = thm "singleton_eq_iff"; |
|
167 |
val doubleton_eq_iff = thm "doubleton_eq_iff"; |
|
168 |
val Pair_iff = thm "Pair_iff"; |
|
169 |
val Pair_inject = thm "Pair_inject"; |
|
170 |
val Pair_inject1 = thm "Pair_inject1"; |
|
171 |
val Pair_inject2 = thm "Pair_inject2"; |
|
172 |
val Pair_not_0 = thm "Pair_not_0"; |
|
173 |
val Pair_neq_0 = thm "Pair_neq_0"; |
|
174 |
val Pair_neq_fst = thm "Pair_neq_fst"; |
|
175 |
val Pair_neq_snd = thm "Pair_neq_snd"; |
|
176 |
val Sigma_iff = thm "Sigma_iff"; |
|
177 |
val SigmaI = thm "SigmaI"; |
|
178 |
val SigmaD1 = thm "SigmaD1"; |
|
179 |
val SigmaD2 = thm "SigmaD2"; |
|
180 |
val SigmaE = thm "SigmaE"; |
|
181 |
val SigmaE2 = thm "SigmaE2"; |
|
182 |
val Sigma_cong = thm "Sigma_cong"; |
|
183 |
val Sigma_empty1 = thm "Sigma_empty1"; |
|
184 |
val Sigma_empty2 = thm "Sigma_empty2"; |
|
185 |
val Sigma_empty_iff = thm "Sigma_empty_iff"; |
|
186 |
val fst_conv = thm "fst_conv"; |
|
187 |
val snd_conv = thm "snd_conv"; |
|
188 |
val fst_type = thm "fst_type"; |
|
189 |
val snd_type = thm "snd_type"; |
|
190 |
val Pair_fst_snd_eq = thm "Pair_fst_snd_eq"; |
|
191 |
val split = thm "split"; |
|
192 |
val split_type = thm "split_type"; |
|
193 |
val expand_split = thm "expand_split"; |
|
194 |
val splitI = thm "splitI"; |
|
195 |
val splitE = thm "splitE"; |
|
196 |
val splitD = thm "splitD"; |
|
197 |
*} |
|
198 |
||
9570
e16e168984e1
installation of cancellation simprocs for the integers
paulson
parents:
2469
diff
changeset
|
199 |
end |
124 | 200 |
|
2469 | 201 |