src/ZF/OrdQuant.thy
author paulson
Mon Jun 24 11:59:14 2002 +0200 (2002-06-24)
changeset 13244 7b37e218f298
parent 13175 81082cfa5618
child 13253 edbf32029d33
permissions -rw-r--r--
moving some results around
     1 (*  Title:      ZF/AC/OrdQuant.thy
     2     ID:         $Id$
     3     Authors:    Krzysztof Grabczewski and L C Paulson
     4 
     5 Quantifiers and union operator for ordinals. 
     6 *)
     7 
     8 theory OrdQuant = Ordinal:
     9 
    10 constdefs
    11   
    12   (* Ordinal Quantifiers *)
    13   oall :: "[i, i => o] => o"
    14     "oall(A, P) == ALL x. x<A --> P(x)"
    15   
    16   oex :: "[i, i => o] => o"
    17     "oex(A, P)  == EX x. x<A & P(x)"
    18 
    19   (* Ordinal Union *)
    20   OUnion :: "[i, i => i] => i"
    21     "OUnion(i,B) == {z: UN x:i. B(x). Ord(i)}"
    22   
    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)
    27 
    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)"
    32 
    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)
    37 
    38 
    39 (** simplification of the new quantifiers **)
    40 
    41 
    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))"
    46 by (simp add: oall_def) 
    47 
    48 lemma [simp]: "~(EX x<0. P(x))"
    49 by (simp add: oex_def) 
    50 
    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
    55 
    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
    60 
    61 (** Union over ordinals **)
    62 
    63 lemma Ord_OUN [intro,simp]:
    64      "[| !!x. x<A ==> Ord(B(x)) |] ==> Ord(\<Union>x<A. B(x))"
    65 by (simp add: OUnion_def ltI Ord_UN) 
    66 
    67 lemma OUN_upper_lt:
    68      "[| a<A;  i < b(a);  Ord(\<Union>x<A. b(x)) |] ==> i < (\<Union>x<A. b(x))"
    69 by (unfold OUnion_def lt_def, blast )
    70 
    71 lemma OUN_upper_le:
    72      "[| a<A;  i\<le>b(a);  Ord(\<Union>x<A. b(x)) |] ==> i \<le> (\<Union>x<A. b(x))"
    73 apply (unfold OUnion_def, auto)
    74 apply (rule UN_upper_le )
    75 apply (auto simp add: lt_def) 
    76 done
    77 
    78 lemma Limit_OUN_eq: "Limit(i) ==> (UN x<i. x) = i"
    79 by (simp add: OUnion_def Limit_Union_eq Limit_is_Ord)
    80 
    81 (* No < version; consider (UN i:nat.i)=nat *)
    82 lemma OUN_least:
    83      "(!!x. x<A ==> B(x) \<subseteq> C) ==> (UN x<A. B(x)) \<subseteq> C"
    84 by (simp add: OUnion_def UN_least ltI)
    85 
    86 (* No < version; consider (UN i:nat.i)=nat *)
    87 lemma OUN_least_le:
    88      "[| Ord(i);  !!x. x<A ==> b(x) \<le> i |] ==> (UN x<A. b(x)) \<le> i"
    89 by (simp add: OUnion_def UN_least_le ltI Ord_0_le)
    90 
    91 lemma le_implies_OUN_le_OUN:
    92      "[| !!x. x<A ==> c(x) \<le> d(x) |] ==> (UN x<A. c(x)) \<le> (UN x<A. d(x))"
    93 by (blast intro: OUN_least_le OUN_upper_le le_Ord2 Ord_OUN)
    94 
    95 lemma OUN_UN_eq:
    96      "(!!x. x:A ==> Ord(B(x)))
    97       ==> (UN z < (UN x:A. B(x)). C(z)) = (UN  x:A. UN z < B(x). C(z))"
    98 by (simp add: OUnion_def) 
    99 
   100 lemma OUN_Union_eq:
   101      "(!!x. x:X ==> Ord(x))
   102       ==> (UN z < Union(X). C(z)) = (UN x:X. UN z < x. C(z))"
   103 by (simp add: OUnion_def) 
   104 
   105 (*So that rule_format will get rid of ALL x<A...*)
   106 lemma atomize_oall [symmetric, rulify]:
   107      "(!!x. x<A ==> P(x)) == Trueprop (ALL x<A. P(x))"
   108 by (simp add: oall_def atomize_all atomize_imp)
   109 
   110 (*** universal quantifier for ordinals ***)
   111 
   112 lemma oallI [intro!]:
   113     "[| !!x. x<A ==> P(x) |] ==> ALL x<A. P(x)"
   114 by (simp add: oall_def) 
   115 
   116 lemma ospec: "[| ALL x<A. P(x);  x<A |] ==> P(x)"
   117 by (simp add: oall_def) 
   118 
   119 lemma oallE:
   120     "[| ALL x<A. P(x);  P(x) ==> Q;  ~x<A ==> Q |] ==> Q"
   121 apply (simp add: oall_def, blast) 
   122 done
   123 
   124 lemma rev_oallE [elim]:
   125     "[| ALL x<A. P(x);  ~x<A ==> Q;  P(x) ==> Q |] ==> Q"
   126 apply (simp add: oall_def, blast)  
   127 done
   128 
   129 
   130 (*Trival rewrite rule;   (ALL x<a.P)<->P holds only if a is not 0!*)
   131 lemma oall_simp [simp]: "(ALL x<a. True) <-> True"
   132 by blast
   133 
   134 (*Congruence rule for rewriting*)
   135 lemma oall_cong [cong]:
   136     "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |] ==> oall(a,P) <-> oall(a',P')"
   137 by (simp add: oall_def)
   138 
   139 
   140 (*** existential quantifier for ordinals ***)
   141 
   142 lemma oexI [intro]:
   143     "[| P(x);  x<A |] ==> EX x<A. P(x)"
   144 apply (simp add: oex_def, blast) 
   145 done
   146 
   147 (*Not of the general form for such rules; ~EX has become ALL~ *)
   148 lemma oexCI:
   149    "[| ALL x<A. ~P(x) ==> P(a);  a<A |] ==> EX x<A. P(x)"
   150 apply (simp add: oex_def, blast) 
   151 done
   152 
   153 lemma oexE [elim!]:
   154     "[| EX x<A. P(x);  !!x. [| x<A; P(x) |] ==> Q |] ==> Q"
   155 apply (simp add: oex_def, blast) 
   156 done
   157 
   158 lemma oex_cong [cong]:
   159     "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |] ==> oex(a,P) <-> oex(a',P')"
   160 apply (simp add: oex_def cong add: conj_cong)
   161 done
   162 
   163 
   164 (*** Rules for Ordinal-Indexed Unions ***)
   165 
   166 lemma OUN_I [intro]: "[| a<i;  b: B(a) |] ==> b: (UN z<i. B(z))"
   167 by (unfold OUnion_def lt_def, blast)
   168 
   169 lemma OUN_E [elim!]:
   170     "[| b : (UN z<i. B(z));  !!a.[| b: B(a);  a<i |] ==> R |] ==> R"
   171 apply (unfold OUnion_def lt_def, blast)
   172 done
   173 
   174 lemma OUN_iff: "b : (UN x<i. B(x)) <-> (EX x<i. b : B(x))"
   175 by (unfold OUnion_def oex_def lt_def, blast)
   176 
   177 lemma OUN_cong [cong]:
   178     "[| i=j;  !!x. x<j ==> C(x)=D(x) |] ==> (UN x<i. C(x)) = (UN x<j. D(x))"
   179 by (simp add: OUnion_def lt_def OUN_iff)
   180 
   181 lemma lt_induct: 
   182     "[| i<k;  !!x.[| x<k;  ALL y<x. P(y) |] ==> P(x) |]  ==>  P(i)"
   183 apply (simp add: lt_def oall_def)
   184 apply (erule conjE) 
   185 apply (erule Ord_induct, assumption, blast) 
   186 done
   187 
   188 ML
   189 {*
   190 val oall_def = thm "oall_def"
   191 val oex_def = thm "oex_def"
   192 val OUnion_def = thm "OUnion_def"
   193 
   194 val oallI = thm "oallI";
   195 val ospec = thm "ospec";
   196 val oallE = thm "oallE";
   197 val rev_oallE = thm "rev_oallE";
   198 val oall_simp = thm "oall_simp";
   199 val oall_cong = thm "oall_cong";
   200 val oexI = thm "oexI";
   201 val oexCI = thm "oexCI";
   202 val oexE = thm "oexE";
   203 val oex_cong = thm "oex_cong";
   204 val OUN_I = thm "OUN_I";
   205 val OUN_E = thm "OUN_E";
   206 val OUN_iff = thm "OUN_iff";
   207 val OUN_cong = thm "OUN_cong";
   208 val lt_induct = thm "lt_induct";
   209 
   210 val Ord_atomize =
   211     atomize (("OrdQuant.oall", [ospec])::ZF_conn_pairs, ZF_mem_pairs);
   212 simpset_ref() := simpset() setmksimps (map mk_eq o Ord_atomize o gen_all);
   213 *}
   214 
   215 end