src/ZF/OrdQuant.thy
 author paulson Thu May 23 17:05:21 2002 +0200 (2002-05-23) changeset 13175 81082cfa5618 parent 13174 85d3c0981a16 child 13244 7b37e218f298 permissions -rw-r--r--
new definition of "apply" and new simprule "beta_if"
1 (*  Title:      ZF/AC/OrdQuant.thy
2     ID:         \$Id\$
3     Authors:    Krzysztof Grabczewski and L C Paulson
5 Quantifiers and union operator for ordinals.
6 *)
8 theory OrdQuant = Ordinal:
10 constdefs
12   (* Ordinal Quantifiers *)
13   oall :: "[i, i => o] => o"
14     "oall(A, P) == ALL x. x<A --> P(x)"
16   oex :: "[i, i => o] => o"
17     "oex(A, P)  == EX x. x<A & P(x)"
19   (* Ordinal Union *)
20   OUnion :: "[i, i => i] => i"
21     "OUnion(i,B) == {z: UN x:i. B(x). Ord(i)}"
23 syntax
24   "@oall"     :: "[idt, i, o] => o"        ("(3ALL _<_./ _)" 10)
25   "@oex"      :: "[idt, i, o] => o"        ("(3EX _<_./ _)" 10)
26   "@OUNION"   :: "[idt, i, i] => i"        ("(3UN _<_./ _)" 10)
28 translations
29   "ALL x<a. P"  == "oall(a, %x. P)"
30   "EX x<a. P"   == "oex(a, %x. P)"
31   "UN x<a. B"   == "OUnion(a, %x. B)"
33 syntax (xsymbols)
34   "@oall"     :: "[idt, i, o] => o"        ("(3\<forall>_<_./ _)" 10)
35   "@oex"      :: "[idt, i, o] => o"        ("(3\<exists>_<_./ _)" 10)
36   "@OUNION"   :: "[idt, i, i] => i"        ("(3\<Union>_<_./ _)" 10)
39 (** simplification of the new quantifiers **)
42 (*MOST IMPORTANT that this is added to the simpset BEFORE Ord_atomize
43   is proved.  Ord_atomize would convert this rule to
44     x < 0 ==> P(x) == True, which causes dire effects!*)
45 lemma [simp]: "(ALL x<0. P(x))"
48 lemma [simp]: "~(EX x<0. P(x))"
51 lemma [simp]: "(ALL x<succ(i). P(x)) <-> (Ord(i) --> P(i) & (ALL x<i. P(x)))"
52 apply (simp add: oall_def le_iff)
53 apply (blast intro: lt_Ord2)
54 done
56 lemma [simp]: "(EX x<succ(i). P(x)) <-> (Ord(i) & (P(i) | (EX x<i. P(x))))"
57 apply (simp add: oex_def le_iff)
58 apply (blast intro: lt_Ord2)
59 done
61 (** Now some very basic ZF theorems **)
63 (*FIXME: move to Rel.thy*)
64 lemma trans_imp_trans_on: "trans(r) ==> trans[A](r)"
65 by (unfold trans_def trans_on_def, blast)
67 lemma Ord_OUN [intro,simp]:
68      "[| !!x. x<A ==> Ord(B(x)) |] ==> Ord(\<Union>x<A. B(x))"
69 by (simp add: OUnion_def ltI Ord_UN)
71 lemma OUN_upper_lt:
72      "[| a<A;  i < b(a);  Ord(\<Union>x<A. b(x)) |] ==> i < (\<Union>x<A. b(x))"
73 by (unfold OUnion_def lt_def, blast )
75 lemma OUN_upper_le:
76      "[| a<A;  i\<le>b(a);  Ord(\<Union>x<A. b(x)) |] ==> i \<le> (\<Union>x<A. b(x))"
77 apply (unfold OUnion_def, auto)
78 apply (rule UN_upper_le )
79 apply (auto simp add: lt_def)
80 done
82 lemma Limit_OUN_eq: "Limit(i) ==> (UN x<i. x) = i"
83 by (simp add: OUnion_def Limit_Union_eq Limit_is_Ord)
85 (* No < version; consider (UN i:nat.i)=nat *)
86 lemma OUN_least:
87      "(!!x. x<A ==> B(x) \<subseteq> C) ==> (UN x<A. B(x)) \<subseteq> C"
88 by (simp add: OUnion_def UN_least ltI)
90 (* No < version; consider (UN i:nat.i)=nat *)
91 lemma OUN_least_le:
92      "[| Ord(i);  !!x. x<A ==> b(x) \<le> i |] ==> (UN x<A. b(x)) \<le> i"
93 by (simp add: OUnion_def UN_least_le ltI Ord_0_le)
95 lemma le_implies_OUN_le_OUN:
96      "[| !!x. x<A ==> c(x) \<le> d(x) |] ==> (UN x<A. c(x)) \<le> (UN x<A. d(x))"
97 by (blast intro: OUN_least_le OUN_upper_le le_Ord2 Ord_OUN)
99 lemma OUN_UN_eq:
100      "(!!x. x:A ==> Ord(B(x)))
101       ==> (UN z < (UN x:A. B(x)). C(z)) = (UN  x:A. UN z < B(x). C(z))"
104 lemma OUN_Union_eq:
105      "(!!x. x:X ==> Ord(x))
106       ==> (UN z < Union(X). C(z)) = (UN x:X. UN z < x. C(z))"
109 (*So that rule_format will get rid of ALL x<A...*)
110 lemma atomize_oall [symmetric, rulify]:
111      "(!!x. x<A ==> P(x)) == Trueprop (ALL x<A. P(x))"
112 by (simp add: oall_def atomize_all atomize_imp)
114 (*** universal quantifier for ordinals ***)
116 lemma oallI [intro!]:
117     "[| !!x. x<A ==> P(x) |] ==> ALL x<A. P(x)"
120 lemma ospec: "[| ALL x<A. P(x);  x<A |] ==> P(x)"
123 lemma oallE:
124     "[| ALL x<A. P(x);  P(x) ==> Q;  ~x<A ==> Q |] ==> Q"
125 apply (simp add: oall_def, blast)
126 done
128 lemma rev_oallE [elim]:
129     "[| ALL x<A. P(x);  ~x<A ==> Q;  P(x) ==> Q |] ==> Q"
130 apply (simp add: oall_def, blast)
131 done
134 (*Trival rewrite rule;   (ALL x<a.P)<->P holds only if a is not 0!*)
135 lemma oall_simp [simp]: "(ALL x<a. True) <-> True"
136 by blast
138 (*Congruence rule for rewriting*)
139 lemma oall_cong [cong]:
140     "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |] ==> oall(a,P) <-> oall(a',P')"
144 (*** existential quantifier for ordinals ***)
146 lemma oexI [intro]:
147     "[| P(x);  x<A |] ==> EX x<A. P(x)"
148 apply (simp add: oex_def, blast)
149 done
151 (*Not of the general form for such rules; ~EX has become ALL~ *)
152 lemma oexCI:
153    "[| ALL x<A. ~P(x) ==> P(a);  a<A |] ==> EX x<A. P(x)"
154 apply (simp add: oex_def, blast)
155 done
157 lemma oexE [elim!]:
158     "[| EX x<A. P(x);  !!x. [| x<A; P(x) |] ==> Q |] ==> Q"
159 apply (simp add: oex_def, blast)
160 done
162 lemma oex_cong [cong]:
163     "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |] ==> oex(a,P) <-> oex(a',P')"
165 done
168 (*** Rules for Ordinal-Indexed Unions ***)
170 lemma OUN_I [intro]: "[| a<i;  b: B(a) |] ==> b: (UN z<i. B(z))"
171 by (unfold OUnion_def lt_def, blast)
173 lemma OUN_E [elim!]:
174     "[| b : (UN z<i. B(z));  !!a.[| b: B(a);  a<i |] ==> R |] ==> R"
175 apply (unfold OUnion_def lt_def, blast)
176 done
178 lemma OUN_iff: "b : (UN x<i. B(x)) <-> (EX x<i. b : B(x))"
179 by (unfold OUnion_def oex_def lt_def, blast)
181 lemma OUN_cong [cong]:
182     "[| i=j;  !!x. x<j ==> C(x)=D(x) |] ==> (UN x<i. C(x)) = (UN x<j. D(x))"
183 by (simp add: OUnion_def lt_def OUN_iff)
185 lemma lt_induct:
186     "[| i<k;  !!x.[| x<k;  ALL y<x. P(y) |] ==> P(x) |]  ==>  P(i)"
187 apply (simp add: lt_def oall_def)
188 apply (erule conjE)
189 apply (erule Ord_induct, assumption, blast)
190 done
192 ML
193 {*
194 val oall_def = thm "oall_def"
195 val oex_def = thm "oex_def"
196 val OUnion_def = thm "OUnion_def"
198 val oallI = thm "oallI";
199 val ospec = thm "ospec";
200 val oallE = thm "oallE";
201 val rev_oallE = thm "rev_oallE";
202 val oall_simp = thm "oall_simp";
203 val oall_cong = thm "oall_cong";
204 val oexI = thm "oexI";
205 val oexCI = thm "oexCI";
206 val oexE = thm "oexE";
207 val oex_cong = thm "oex_cong";
208 val OUN_I = thm "OUN_I";
209 val OUN_E = thm "OUN_E";
210 val OUN_iff = thm "OUN_iff";
211 val OUN_cong = thm "OUN_cong";
212 val lt_induct = thm "lt_induct";
214 val Ord_atomize =
215     atomize (("OrdQuant.oall", [ospec])::ZF_conn_pairs, ZF_mem_pairs);
216 simpset_ref() := simpset() setmksimps (map mk_eq o Ord_atomize o gen_all);
217 *}
219 end