src/ZF/OrdQuant.thy
author wenzelm
Thu Sep 02 00:48:07 2010 +0200 (2010-09-02)
changeset 38980 af73cf0dc31f
parent 38715 6513ea67d95d
child 41777 1f7cbe39d425
permissions -rw-r--r--
turned show_question_marks into proper configuration option;
show_question_marks only affects regular type/term pretty printing, not raw Term.string_of_vname;
tuned;
paulson@2469
     1
(*  Title:      ZF/AC/OrdQuant.thy
paulson@2469
     2
    Authors:    Krzysztof Grabczewski and L C Paulson
paulson@2469
     3
*)
paulson@2469
     4
paulson@13253
     5
header {*Special quantifiers*}
paulson@13253
     6
haftmann@16417
     7
theory OrdQuant imports Ordinal begin
paulson@2469
     8
paulson@13253
     9
subsection {*Quantifiers and union operator for ordinals*}
paulson@13253
    10
wenzelm@24893
    11
definition
paulson@2469
    12
  (* Ordinal Quantifiers *)
wenzelm@24893
    13
  oall :: "[i, i => o] => o"  where
paulson@12620
    14
    "oall(A, P) == ALL x. x<A --> P(x)"
paulson@13298
    15
wenzelm@24893
    16
definition
wenzelm@24893
    17
  oex :: "[i, i => o] => o"  where
paulson@12620
    18
    "oex(A, P)  == EX x. x<A & P(x)"
paulson@2469
    19
wenzelm@24893
    20
definition
paulson@2469
    21
  (* Ordinal Union *)
wenzelm@24893
    22
  OUnion :: "[i, i => i] => i"  where
paulson@13615
    23
    "OUnion(i,B) == {z: \<Union>x\<in>i. B(x). Ord(i)}"
paulson@13298
    24
paulson@2469
    25
syntax
wenzelm@35112
    26
  "_oall"     :: "[idt, i, o] => o"        ("(3ALL _<_./ _)" 10)
wenzelm@35112
    27
  "_oex"      :: "[idt, i, o] => o"        ("(3EX _<_./ _)" 10)
wenzelm@35112
    28
  "_OUNION"   :: "[idt, i, i] => i"        ("(3UN _<_./ _)" 10)
paulson@2469
    29
paulson@2469
    30
translations
wenzelm@24893
    31
  "ALL x<a. P"  == "CONST oall(a, %x. P)"
wenzelm@24893
    32
  "EX x<a. P"   == "CONST oex(a, %x. P)"
wenzelm@24893
    33
  "UN x<a. B"   == "CONST OUnion(a, %x. B)"
paulson@2469
    34
wenzelm@12114
    35
syntax (xsymbols)
wenzelm@35112
    36
  "_oall"     :: "[idt, i, o] => o"        ("(3\<forall>_<_./ _)" 10)
wenzelm@35112
    37
  "_oex"      :: "[idt, i, o] => o"        ("(3\<exists>_<_./ _)" 10)
wenzelm@35112
    38
  "_OUNION"   :: "[idt, i, i] => i"        ("(3\<Union>_<_./ _)" 10)
kleing@14565
    39
syntax (HTML output)
wenzelm@35112
    40
  "_oall"     :: "[idt, i, o] => o"        ("(3\<forall>_<_./ _)" 10)
wenzelm@35112
    41
  "_oex"      :: "[idt, i, o] => o"        ("(3\<exists>_<_./ _)" 10)
wenzelm@35112
    42
  "_OUNION"   :: "[idt, i, i] => i"        ("(3\<Union>_<_./ _)" 10)
paulson@12620
    43
paulson@12620
    44
paulson@13302
    45
subsubsection {*simplification of the new quantifiers*}
paulson@12825
    46
paulson@12825
    47
paulson@13169
    48
(*MOST IMPORTANT that this is added to the simpset BEFORE Ord_atomize
paulson@13298
    49
  is proved.  Ord_atomize would convert this rule to
paulson@12825
    50
    x < 0 ==> P(x) == True, which causes dire effects!*)
paulson@12825
    51
lemma [simp]: "(ALL x<0. P(x))"
paulson@13298
    52
by (simp add: oall_def)
paulson@12825
    53
paulson@12825
    54
lemma [simp]: "~(EX x<0. P(x))"
paulson@13298
    55
by (simp add: oex_def)
paulson@12825
    56
paulson@12825
    57
lemma [simp]: "(ALL x<succ(i). P(x)) <-> (Ord(i) --> P(i) & (ALL x<i. P(x)))"
paulson@13298
    58
apply (simp add: oall_def le_iff)
paulson@13298
    59
apply (blast intro: lt_Ord2)
paulson@12825
    60
done
paulson@12825
    61
paulson@12825
    62
lemma [simp]: "(EX x<succ(i). P(x)) <-> (Ord(i) & (P(i) | (EX x<i. P(x))))"
paulson@13298
    63
apply (simp add: oex_def le_iff)
paulson@13298
    64
apply (blast intro: lt_Ord2)
paulson@12825
    65
done
paulson@12825
    66
paulson@13302
    67
subsubsection {*Union over ordinals*}
paulson@13118
    68
paulson@12620
    69
lemma Ord_OUN [intro,simp]:
paulson@13162
    70
     "[| !!x. x<A ==> Ord(B(x)) |] ==> Ord(\<Union>x<A. B(x))"
paulson@13298
    71
by (simp add: OUnion_def ltI Ord_UN)
paulson@12620
    72
paulson@12620
    73
lemma OUN_upper_lt:
paulson@13162
    74
     "[| a<A;  i < b(a);  Ord(\<Union>x<A. b(x)) |] ==> i < (\<Union>x<A. b(x))"
paulson@12620
    75
by (unfold OUnion_def lt_def, blast )
paulson@12620
    76
paulson@12620
    77
lemma OUN_upper_le:
paulson@13162
    78
     "[| a<A;  i\<le>b(a);  Ord(\<Union>x<A. b(x)) |] ==> i \<le> (\<Union>x<A. b(x))"
paulson@12820
    79
apply (unfold OUnion_def, auto)
paulson@12620
    80
apply (rule UN_upper_le )
paulson@13298
    81
apply (auto simp add: lt_def)
paulson@12620
    82
done
paulson@2469
    83
paulson@13615
    84
lemma Limit_OUN_eq: "Limit(i) ==> (\<Union>x<i. x) = i"
paulson@12620
    85
by (simp add: OUnion_def Limit_Union_eq Limit_is_Ord)
paulson@12620
    86
paulson@13615
    87
(* No < version; consider (\<Union>i\<in>nat.i)=nat *)
paulson@12620
    88
lemma OUN_least:
paulson@13615
    89
     "(!!x. x<A ==> B(x) \<subseteq> C) ==> (\<Union>x<A. B(x)) \<subseteq> C"
paulson@12620
    90
by (simp add: OUnion_def UN_least ltI)
paulson@12620
    91
paulson@13615
    92
(* No < version; consider (\<Union>i\<in>nat.i)=nat *)
paulson@12620
    93
lemma OUN_least_le:
paulson@13615
    94
     "[| Ord(i);  !!x. x<A ==> b(x) \<le> i |] ==> (\<Union>x<A. b(x)) \<le> i"
paulson@12620
    95
by (simp add: OUnion_def UN_least_le ltI Ord_0_le)
paulson@12620
    96
paulson@12620
    97
lemma le_implies_OUN_le_OUN:
paulson@13615
    98
     "[| !!x. x<A ==> c(x) \<le> d(x) |] ==> (\<Union>x<A. c(x)) \<le> (\<Union>x<A. d(x))"
paulson@12620
    99
by (blast intro: OUN_least_le OUN_upper_le le_Ord2 Ord_OUN)
paulson@12620
   100
paulson@12620
   101
lemma OUN_UN_eq:
paulson@12620
   102
     "(!!x. x:A ==> Ord(B(x)))
paulson@13615
   103
      ==> (\<Union>z < (\<Union>x\<in>A. B(x)). C(z)) = (\<Union>x\<in>A. \<Union>z < B(x). C(z))"
paulson@13298
   104
by (simp add: OUnion_def)
paulson@12620
   105
paulson@12620
   106
lemma OUN_Union_eq:
paulson@12620
   107
     "(!!x. x:X ==> Ord(x))
paulson@13615
   108
      ==> (\<Union>z < Union(X). C(z)) = (\<Union>x\<in>X. \<Union>z < x. C(z))"
paulson@13298
   109
by (simp add: OUnion_def)
paulson@12620
   110
paulson@12763
   111
(*So that rule_format will get rid of ALL x<A...*)
paulson@12763
   112
lemma atomize_oall [symmetric, rulify]:
paulson@12763
   113
     "(!!x. x<A ==> P(x)) == Trueprop (ALL x<A. P(x))"
paulson@12763
   114
by (simp add: oall_def atomize_all atomize_imp)
paulson@12763
   115
paulson@13302
   116
subsubsection {*universal quantifier for ordinals*}
paulson@13169
   117
paulson@13169
   118
lemma oallI [intro!]:
paulson@13169
   119
    "[| !!x. x<A ==> P(x) |] ==> ALL x<A. P(x)"
paulson@13298
   120
by (simp add: oall_def)
paulson@13169
   121
paulson@13169
   122
lemma ospec: "[| ALL x<A. P(x);  x<A |] ==> P(x)"
paulson@13298
   123
by (simp add: oall_def)
paulson@13169
   124
paulson@13169
   125
lemma oallE:
paulson@13169
   126
    "[| ALL x<A. P(x);  P(x) ==> Q;  ~x<A ==> Q |] ==> Q"
paulson@13298
   127
by (simp add: oall_def, blast)
paulson@13169
   128
paulson@13169
   129
lemma rev_oallE [elim]:
paulson@13169
   130
    "[| ALL x<A. P(x);  ~x<A ==> Q;  P(x) ==> Q |] ==> Q"
paulson@13298
   131
by (simp add: oall_def, blast)
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@13298
   140
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |]
paulson@13289
   141
     ==> oall(a, %x. P(x)) <-> oall(a', %x. P'(x))"
paulson@13169
   142
by (simp add: oall_def)
paulson@13169
   143
paulson@13169
   144
paulson@13302
   145
subsubsection {*existential quantifier for ordinals*}
paulson@13169
   146
paulson@13169
   147
lemma oexI [intro]:
paulson@13169
   148
    "[| P(x);  x<A |] ==> EX x<A. P(x)"
paulson@13298
   149
apply (simp add: oex_def, blast)
paulson@13169
   150
done
paulson@13169
   151
paulson@13169
   152
(*Not of the general form for such rules; ~EX has become ALL~ *)
paulson@13169
   153
lemma oexCI:
paulson@13169
   154
   "[| ALL x<A. ~P(x) ==> P(a);  a<A |] ==> EX x<A. P(x)"
paulson@13298
   155
apply (simp add: oex_def, blast)
paulson@13169
   156
done
paulson@13169
   157
paulson@13169
   158
lemma oexE [elim!]:
paulson@13169
   159
    "[| EX x<A. P(x);  !!x. [| x<A; P(x) |] ==> Q |] ==> Q"
paulson@13298
   160
apply (simp add: oex_def, blast)
paulson@13169
   161
done
paulson@13169
   162
paulson@13169
   163
lemma oex_cong [cong]:
paulson@13298
   164
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |]
paulson@13289
   165
     ==> oex(a, %x. P(x)) <-> oex(a', %x. P'(x))"
paulson@13169
   166
apply (simp add: oex_def cong add: conj_cong)
paulson@13169
   167
done
paulson@13169
   168
paulson@13169
   169
paulson@13302
   170
subsubsection {*Rules for Ordinal-Indexed Unions*}
paulson@13169
   171
paulson@13615
   172
lemma OUN_I [intro]: "[| a<i;  b: B(a) |] ==> b: (\<Union>z<i. B(z))"
paulson@13170
   173
by (unfold OUnion_def lt_def, blast)
paulson@13169
   174
paulson@13169
   175
lemma OUN_E [elim!]:
paulson@13615
   176
    "[| b : (\<Union>z<i. B(z));  !!a.[| b: B(a);  a<i |] ==> R |] ==> R"
paulson@13170
   177
apply (unfold OUnion_def lt_def, blast)
paulson@13169
   178
done
paulson@13169
   179
paulson@13615
   180
lemma OUN_iff: "b : (\<Union>x<i. B(x)) <-> (EX x<i. b : B(x))"
paulson@13170
   181
by (unfold OUnion_def oex_def lt_def, blast)
paulson@13169
   182
paulson@13169
   183
lemma OUN_cong [cong]:
paulson@13615
   184
    "[| i=j;  !!x. x<j ==> C(x)=D(x) |] ==> (\<Union>x<i. C(x)) = (\<Union>x<j. D(x))"
paulson@13169
   185
by (simp add: OUnion_def lt_def OUN_iff)
paulson@13169
   186
paulson@13298
   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@13298
   190
apply (erule conjE)
paulson@13298
   191
apply (erule Ord_induct, assumption, blast)
paulson@13169
   192
done
paulson@13169
   193
paulson@13253
   194
paulson@13253
   195
subsection {*Quantification over a class*}
paulson@13253
   196
wenzelm@24893
   197
definition
wenzelm@24893
   198
  "rall"     :: "[i=>o, i=>o] => o"  where
paulson@13253
   199
    "rall(M, P) == ALL x. M(x) --> P(x)"
paulson@13253
   200
wenzelm@24893
   201
definition
wenzelm@24893
   202
  "rex"      :: "[i=>o, i=>o] => o"  where
paulson@13253
   203
    "rex(M, P) == EX x. M(x) & P(x)"
paulson@13253
   204
paulson@13253
   205
syntax
wenzelm@35112
   206
  "_rall"     :: "[pttrn, i=>o, o] => o"        ("(3ALL _[_]./ _)" 10)
wenzelm@35112
   207
  "_rex"      :: "[pttrn, i=>o, o] => o"        ("(3EX _[_]./ _)" 10)
paulson@13253
   208
paulson@13253
   209
syntax (xsymbols)
wenzelm@35112
   210
  "_rall"     :: "[pttrn, i=>o, o] => o"        ("(3\<forall>_[_]./ _)" 10)
wenzelm@35112
   211
  "_rex"      :: "[pttrn, i=>o, o] => o"        ("(3\<exists>_[_]./ _)" 10)
kleing@14565
   212
syntax (HTML output)
wenzelm@35112
   213
  "_rall"     :: "[pttrn, i=>o, o] => o"        ("(3\<forall>_[_]./ _)" 10)
wenzelm@35112
   214
  "_rex"      :: "[pttrn, i=>o, o] => o"        ("(3\<exists>_[_]./ _)" 10)
paulson@13253
   215
paulson@13253
   216
translations
wenzelm@24893
   217
  "ALL x[M]. P"  == "CONST rall(M, %x. P)"
wenzelm@24893
   218
  "EX x[M]. P"   == "CONST rex(M, %x. P)"
paulson@13253
   219
paulson@13298
   220
paulson@13298
   221
subsubsection{*Relativized universal quantifier*}
paulson@13253
   222
paulson@13253
   223
lemma rallI [intro!]: "[| !!x. M(x) ==> P(x) |] ==> ALL x[M]. P(x)"
paulson@13253
   224
by (simp add: rall_def)
paulson@13253
   225
paulson@13253
   226
lemma rspec: "[| ALL x[M]. P(x); M(x) |] ==> P(x)"
paulson@13253
   227
by (simp add: rall_def)
paulson@13253
   228
paulson@13253
   229
(*Instantiates x first: better for automatic theorem proving?*)
paulson@13298
   230
lemma rev_rallE [elim]:
paulson@13253
   231
    "[| ALL x[M]. P(x);  ~ M(x) ==> Q;  P(x) ==> Q |] ==> Q"
paulson@13298
   232
by (simp add: rall_def, blast)
paulson@13253
   233
paulson@13253
   234
lemma rallE: "[| ALL x[M]. P(x);  P(x) ==> Q;  ~ M(x) ==> Q |] ==> Q"
paulson@13253
   235
by blast
paulson@13253
   236
paulson@13253
   237
(*Trival rewrite rule;   (ALL x[M].P)<->P holds only if A is nonempty!*)
paulson@13253
   238
lemma rall_triv [simp]: "(ALL x[M]. P) <-> ((EX x. M(x)) --> P)"
paulson@13253
   239
by (simp add: rall_def)
paulson@13253
   240
paulson@13253
   241
(*Congruence rule for rewriting*)
paulson@13253
   242
lemma rall_cong [cong]:
paulson@13339
   243
    "(!!x. M(x) ==> P(x) <-> P'(x)) ==> (ALL x[M]. P(x)) <-> (ALL x[M]. P'(x))"
paulson@13253
   244
by (simp add: rall_def)
paulson@13253
   245
paulson@13298
   246
paulson@13298
   247
subsubsection{*Relativized existential quantifier*}
paulson@13253
   248
paulson@13253
   249
lemma rexI [intro]: "[| P(x); M(x) |] ==> EX x[M]. P(x)"
paulson@13253
   250
by (simp add: rex_def, blast)
paulson@13253
   251
paulson@13253
   252
(*The best argument order when there is only one M(x)*)
paulson@13253
   253
lemma rev_rexI: "[| M(x);  P(x) |] ==> EX x[M]. P(x)"
paulson@13253
   254
by blast
paulson@13253
   255
paulson@13253
   256
(*Not of the general form for such rules; ~EX has become ALL~ *)
paulson@13253
   257
lemma rexCI: "[| ALL x[M]. ~P(x) ==> P(a); M(a) |] ==> EX x[M]. P(x)"
paulson@13253
   258
by blast
paulson@13253
   259
paulson@13253
   260
lemma rexE [elim!]: "[| EX x[M]. P(x);  !!x. [| M(x); P(x) |] ==> Q |] ==> Q"
paulson@13253
   261
by (simp add: rex_def, blast)
paulson@13253
   262
paulson@13253
   263
(*We do not even have (EX x[M]. True) <-> True unless A is nonempty!!*)
paulson@13253
   264
lemma rex_triv [simp]: "(EX x[M]. P) <-> ((EX x. M(x)) & P)"
paulson@13253
   265
by (simp add: rex_def)
paulson@13253
   266
paulson@13253
   267
lemma rex_cong [cong]:
paulson@13339
   268
    "(!!x. M(x) ==> P(x) <-> P'(x)) ==> (EX x[M]. P(x)) <-> (EX x[M]. P'(x))"
paulson@13253
   269
by (simp add: rex_def cong: conj_cong)
paulson@13253
   270
paulson@13289
   271
lemma rall_is_ball [simp]: "(\<forall>x[%z. z\<in>A]. P(x)) <-> (\<forall>x\<in>A. P(x))"
paulson@13289
   272
by blast
paulson@13289
   273
paulson@13289
   274
lemma rex_is_bex [simp]: "(\<exists>x[%z. z\<in>A]. P(x)) <-> (\<exists>x\<in>A. P(x))"
paulson@13289
   275
by blast
paulson@13289
   276
paulson@13253
   277
lemma atomize_rall: "(!!x. M(x) ==> P(x)) == Trueprop (ALL x[M]. P(x))";
paulson@13253
   278
by (simp add: rall_def atomize_all atomize_imp)
paulson@13253
   279
paulson@13253
   280
declare atomize_rall [symmetric, rulify]
paulson@13253
   281
paulson@13253
   282
lemma rall_simps1:
paulson@13253
   283
     "(ALL x[M]. P(x) & Q)   <-> (ALL x[M]. P(x)) & ((ALL x[M]. False) | Q)"
paulson@13253
   284
     "(ALL x[M]. P(x) | Q)   <-> ((ALL x[M]. P(x)) | Q)"
paulson@13253
   285
     "(ALL x[M]. P(x) --> Q) <-> ((EX x[M]. P(x)) --> Q)"
paulson@13298
   286
     "(~(ALL x[M]. P(x))) <-> (EX x[M]. ~P(x))"
paulson@13253
   287
by blast+
paulson@13253
   288
paulson@13253
   289
lemma rall_simps2:
paulson@13253
   290
     "(ALL x[M]. P & Q(x))   <-> ((ALL x[M]. False) | P) & (ALL x[M]. Q(x))"
paulson@13253
   291
     "(ALL x[M]. P | Q(x))   <-> (P | (ALL x[M]. Q(x)))"
paulson@13253
   292
     "(ALL x[M]. P --> Q(x)) <-> (P --> (ALL x[M]. Q(x)))"
paulson@13253
   293
by blast+
paulson@13253
   294
paulson@13289
   295
lemmas rall_simps [simp] = rall_simps1 rall_simps2
paulson@13253
   296
paulson@13253
   297
lemma rall_conj_distrib:
paulson@13253
   298
    "(ALL x[M]. P(x) & Q(x)) <-> ((ALL x[M]. P(x)) & (ALL x[M]. Q(x)))"
paulson@13253
   299
by blast
paulson@13253
   300
paulson@13253
   301
lemma rex_simps1:
paulson@13253
   302
     "(EX x[M]. P(x) & Q) <-> ((EX x[M]. P(x)) & Q)"
paulson@13253
   303
     "(EX x[M]. P(x) | Q) <-> (EX x[M]. P(x)) | ((EX x[M]. True) & Q)"
paulson@13253
   304
     "(EX x[M]. P(x) --> Q) <-> ((ALL x[M]. P(x)) --> ((EX x[M]. True) & Q))"
paulson@13253
   305
     "(~(EX x[M]. P(x))) <-> (ALL x[M]. ~P(x))"
paulson@13253
   306
by blast+
paulson@13253
   307
paulson@13253
   308
lemma rex_simps2:
paulson@13253
   309
     "(EX x[M]. P & Q(x)) <-> (P & (EX x[M]. Q(x)))"
paulson@13253
   310
     "(EX x[M]. P | Q(x)) <-> ((EX x[M]. True) & P) | (EX x[M]. Q(x))"
paulson@13253
   311
     "(EX x[M]. P --> Q(x)) <-> (((ALL x[M]. False) | P) --> (EX x[M]. Q(x)))"
paulson@13253
   312
by blast+
paulson@13253
   313
paulson@13289
   314
lemmas rex_simps [simp] = rex_simps1 rex_simps2
paulson@13253
   315
paulson@13253
   316
lemma rex_disj_distrib:
paulson@13253
   317
    "(EX x[M]. P(x) | Q(x)) <-> ((EX x[M]. P(x)) | (EX x[M]. Q(x)))"
paulson@13253
   318
by blast
paulson@13253
   319
paulson@13253
   320
paulson@13298
   321
subsubsection{*One-point rule for bounded quantifiers*}
paulson@13253
   322
paulson@13253
   323
lemma rex_triv_one_point1 [simp]: "(EX x[M]. x=a) <-> ( M(a))"
paulson@13253
   324
by blast
paulson@13253
   325
paulson@13253
   326
lemma rex_triv_one_point2 [simp]: "(EX x[M]. a=x) <-> ( M(a))"
paulson@13253
   327
by blast
paulson@13253
   328
paulson@13253
   329
lemma rex_one_point1 [simp]: "(EX x[M]. x=a & P(x)) <-> ( M(a) & P(a))"
paulson@13253
   330
by blast
paulson@13253
   331
paulson@13253
   332
lemma rex_one_point2 [simp]: "(EX x[M]. a=x & P(x)) <-> ( M(a) & P(a))"
paulson@13253
   333
by blast
paulson@13253
   334
paulson@13253
   335
lemma rall_one_point1 [simp]: "(ALL x[M]. x=a --> P(x)) <-> ( M(a) --> P(a))"
paulson@13253
   336
by blast
paulson@13253
   337
paulson@13253
   338
lemma rall_one_point2 [simp]: "(ALL x[M]. a=x --> P(x)) <-> ( M(a) --> P(a))"
paulson@13253
   339
by blast
paulson@13253
   340
paulson@13253
   341
paulson@13298
   342
subsubsection{*Sets as Classes*}
paulson@13298
   343
wenzelm@24893
   344
definition
wenzelm@24893
   345
  setclass :: "[i,i] => o"       ("##_" [40] 40)  where
paulson@13362
   346
   "setclass(A) == %x. x : A"
paulson@13298
   347
paulson@13362
   348
lemma setclass_iff [simp]: "setclass(A,x) <-> x : A"
paulson@13362
   349
by (simp add: setclass_def)
paulson@13298
   350
paulson@13807
   351
lemma rall_setclass_is_ball [simp]: "(\<forall>x[##A]. P(x)) <-> (\<forall>x\<in>A. P(x))"
paulson@13298
   352
by auto
paulson@13298
   353
paulson@13807
   354
lemma rex_setclass_is_bex [simp]: "(\<exists>x[##A]. P(x)) <-> (\<exists>x\<in>A. P(x))"
paulson@13298
   355
by auto
paulson@13298
   356
paulson@13298
   357
paulson@13169
   358
ML
paulson@13169
   359
{*
paulson@13169
   360
val Ord_atomize =
wenzelm@24893
   361
    atomize ([("OrdQuant.oall", [@{thm ospec}]),("OrdQuant.rall", [@{thm rspec}])]@
paulson@13298
   362
                 ZF_conn_pairs,
paulson@13253
   363
             ZF_mem_pairs);
wenzelm@26339
   364
*}
wenzelm@26339
   365
declaration {* fn _ =>
wenzelm@36543
   366
  Simplifier.map_ss (fn ss => ss setmksimps (K (map mk_eq o Ord_atomize o gen_all)))
paulson@13169
   367
*}
paulson@13169
   368
wenzelm@13462
   369
text {* Setting up the one-point-rule simproc *}
paulson@13253
   370
wenzelm@26480
   371
ML {*
wenzelm@13462
   372
local
paulson@13253
   373
wenzelm@24893
   374
val unfold_rex_tac = unfold_tac [@{thm rex_def}];
wenzelm@18324
   375
fun prove_rex_tac ss = unfold_rex_tac ss THEN Quantifier1.prove_one_point_ex_tac;
paulson@13253
   376
val rearrange_bex = Quantifier1.rearrange_bex prove_rex_tac;
paulson@13253
   377
wenzelm@24893
   378
val unfold_rall_tac = unfold_tac [@{thm rall_def}];
wenzelm@18324
   379
fun prove_rall_tac ss = unfold_rall_tac ss THEN Quantifier1.prove_one_point_all_tac;
paulson@13253
   380
val rearrange_ball = Quantifier1.rearrange_ball prove_rall_tac;
paulson@13253
   381
paulson@13253
   382
in
paulson@13253
   383
wenzelm@38715
   384
val defREX_regroup = Simplifier.simproc_global @{theory}
wenzelm@13462
   385
  "defined REX" ["EX x[M]. P(x) & Q(x)"] rearrange_bex;
wenzelm@38715
   386
val defRALL_regroup = Simplifier.simproc_global @{theory}
wenzelm@13462
   387
  "defined RALL" ["ALL x[M]. P(x) --> Q(x)"] rearrange_ball;
paulson@13253
   388
paulson@13253
   389
end;
wenzelm@13462
   390
wenzelm@13462
   391
Addsimprocs [defRALL_regroup,defREX_regroup];
paulson@13253
   392
*}
paulson@13253
   393
paulson@2469
   394
end