1 (* Title: ZF/pair.thy |
1 (* Title: ZF/pair.thy |
2 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
2 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 Copyright 1992 University of Cambridge |
3 Copyright 1992 University of Cambridge |
4 *) |
4 *) |
5 |
5 |
6 section{*Ordered Pairs*} |
6 section\<open>Ordered Pairs\<close> |
7 |
7 |
8 theory pair imports upair |
8 theory pair imports upair |
9 begin |
9 begin |
10 |
10 |
11 ML_file "simpdata.ML" |
11 ML_file "simpdata.ML" |
12 |
12 |
13 setup {* |
13 setup \<open> |
14 map_theory_simpset |
14 map_theory_simpset |
15 (Simplifier.set_mksimps (fn ctxt => |
15 (Simplifier.set_mksimps (fn ctxt => |
16 map mk_eq o ZF_atomize o Drule.gen_all (Variable.maxidx_of ctxt)) |
16 map mk_eq o ZF_atomize o Drule.gen_all (Variable.maxidx_of ctxt)) |
17 #> Simplifier.add_cong @{thm if_weak_cong}) |
17 #> Simplifier.add_cong @{thm if_weak_cong}) |
18 *} |
18 \<close> |
19 |
19 |
20 ML {* val ZF_ss = simpset_of @{context} *} |
20 ML \<open>val ZF_ss = simpset_of @{context}\<close> |
21 |
21 |
22 simproc_setup defined_Bex ("\<exists>x\<in>A. P(x) & Q(x)") = {* |
22 simproc_setup defined_Bex ("\<exists>x\<in>A. P(x) & Q(x)") = \<open> |
23 fn _ => Quantifier1.rearrange_bex |
23 fn _ => Quantifier1.rearrange_bex |
24 (fn ctxt => |
24 (fn ctxt => |
25 unfold_tac ctxt @{thms Bex_def} THEN |
25 unfold_tac ctxt @{thms Bex_def} THEN |
26 Quantifier1.prove_one_point_ex_tac ctxt) |
26 Quantifier1.prove_one_point_ex_tac ctxt) |
27 *} |
27 \<close> |
28 |
28 |
29 simproc_setup defined_Ball ("\<forall>x\<in>A. P(x) \<longrightarrow> Q(x)") = {* |
29 simproc_setup defined_Ball ("\<forall>x\<in>A. P(x) \<longrightarrow> Q(x)") = \<open> |
30 fn _ => Quantifier1.rearrange_ball |
30 fn _ => Quantifier1.rearrange_ball |
31 (fn ctxt => |
31 (fn ctxt => |
32 unfold_tac ctxt @{thms Ball_def} THEN |
32 unfold_tac ctxt @{thms Ball_def} THEN |
33 Quantifier1.prove_one_point_all_tac ctxt) |
33 Quantifier1.prove_one_point_all_tac ctxt) |
34 *} |
34 \<close> |
35 |
35 |
36 |
36 |
37 (** Lemmas for showing that <a,b> uniquely determines a and b **) |
37 (** Lemmas for showing that <a,b> uniquely determines a and b **) |
38 |
38 |
39 lemma singleton_eq_iff [iff]: "{a} = {b} \<longleftrightarrow> a=b" |
39 lemma singleton_eq_iff [iff]: "{a} = {b} \<longleftrightarrow> a=b" |
76 moreover have "b \<in> {a, b}" by blast |
76 moreover have "b \<in> {a, b}" by blast |
77 ultimately show "P" by (rule mem_asym) |
77 ultimately show "P" by (rule mem_asym) |
78 qed |
78 qed |
79 |
79 |
80 |
80 |
81 subsection{*Sigma: Disjoint Union of a Family of Sets*} |
81 subsection\<open>Sigma: Disjoint Union of a Family of Sets\<close> |
82 |
82 |
83 text{*Generalizes Cartesian product*} |
83 text\<open>Generalizes Cartesian product\<close> |
84 |
84 |
85 lemma Sigma_iff [simp]: "<a,b>: Sigma(A,B) \<longleftrightarrow> a \<in> A & b \<in> B(a)" |
85 lemma Sigma_iff [simp]: "<a,b>: Sigma(A,B) \<longleftrightarrow> a \<in> A & b \<in> B(a)" |
86 by (simp add: Sigma_def) |
86 by (simp add: Sigma_def) |
87 |
87 |
88 lemma SigmaI [TC,intro!]: "[| a \<in> A; b \<in> B(a) |] ==> <a,b> \<in> Sigma(A,B)" |
88 lemma SigmaI [TC,intro!]: "[| a \<in> A; b \<in> B(a) |] ==> <a,b> \<in> Sigma(A,B)" |
121 |
121 |
122 lemma Sigma_empty_iff: "A*B=0 \<longleftrightarrow> A=0 | B=0" |
122 lemma Sigma_empty_iff: "A*B=0 \<longleftrightarrow> A=0 | B=0" |
123 by blast |
123 by blast |
124 |
124 |
125 |
125 |
126 subsection{*Projections @{term fst} and @{term snd}*} |
126 subsection\<open>Projections @{term fst} and @{term snd}\<close> |
127 |
127 |
128 lemma fst_conv [simp]: "fst(<a,b>) = a" |
128 lemma fst_conv [simp]: "fst(<a,b>) = a" |
129 by (simp add: fst_def) |
129 by (simp add: fst_def) |
130 |
130 |
131 lemma snd_conv [simp]: "snd(<a,b>) = b" |
131 lemma snd_conv [simp]: "snd(<a,b>) = b" |
139 |
139 |
140 lemma Pair_fst_snd_eq: "a \<in> Sigma(A,B) ==> <fst(a),snd(a)> = a" |
140 lemma Pair_fst_snd_eq: "a \<in> Sigma(A,B) ==> <fst(a),snd(a)> = a" |
141 by auto |
141 by auto |
142 |
142 |
143 |
143 |
144 subsection{*The Eliminator, @{term split}*} |
144 subsection\<open>The Eliminator, @{term split}\<close> |
145 |
145 |
146 (*A META-equality, so that it applies to higher types as well...*) |
146 (*A META-equality, so that it applies to higher types as well...*) |
147 lemma split [simp]: "split(%x y. c(x,y), <a,b>) == c(a,b)" |
147 lemma split [simp]: "split(%x y. c(x,y), <a,b>) == c(a,b)" |
148 by (simp add: split_def) |
148 by (simp add: split_def) |
149 |
149 |
157 "u \<in> A*B ==> |
157 "u \<in> A*B ==> |
158 R(split(c,u)) \<longleftrightarrow> (\<forall>x\<in>A. \<forall>y\<in>B. u = <x,y> \<longrightarrow> R(c(x,y)))" |
158 R(split(c,u)) \<longleftrightarrow> (\<forall>x\<in>A. \<forall>y\<in>B. u = <x,y> \<longrightarrow> R(c(x,y)))" |
159 by (auto simp add: split_def) |
159 by (auto simp add: split_def) |
160 |
160 |
161 |
161 |
162 subsection{*A version of @{term split} for Formulae: Result Type @{typ o}*} |
162 subsection\<open>A version of @{term split} for Formulae: Result Type @{typ o}\<close> |
163 |
163 |
164 lemma splitI: "R(a,b) ==> split(R, <a,b>)" |
164 lemma splitI: "R(a,b) ==> split(R, <a,b>)" |
165 by (simp add: split_def) |
165 by (simp add: split_def) |
166 |
166 |
167 lemma splitE: |
167 lemma splitE: |
171 by (auto simp add: split_def) |
171 by (auto simp add: split_def) |
172 |
172 |
173 lemma splitD: "split(R,<a,b>) ==> R(a,b)" |
173 lemma splitD: "split(R,<a,b>) ==> R(a,b)" |
174 by (simp add: split_def) |
174 by (simp add: split_def) |
175 |
175 |
176 text {* |
176 text \<open> |
177 \bigskip Complex rules for Sigma. |
177 \bigskip Complex rules for Sigma. |
178 *} |
178 \<close> |
179 |
179 |
180 lemma split_paired_Bex_Sigma [simp]: |
180 lemma split_paired_Bex_Sigma [simp]: |
181 "(\<exists>z \<in> Sigma(A,B). P(z)) \<longleftrightarrow> (\<exists>x \<in> A. \<exists>y \<in> B(x). P(<x,y>))" |
181 "(\<exists>z \<in> Sigma(A,B). P(z)) \<longleftrightarrow> (\<exists>x \<in> A. \<exists>y \<in> B(x). P(<x,y>))" |
182 by blast |
182 by blast |
183 |
183 |