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