src/ZF/OrdQuant.thy
author paulson
Thu Mar 15 16:35:02 2012 +0000 (2012-03-15)
changeset 46953 2b6e55924af3
parent 46820 c656222c4dc1
child 51717 9e7d1c139569
permissions -rw-r--r--
replacing ":" by "\<in>"
wenzelm@41777
     1
(*  Title:      ZF/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@46820
    14
    "oall(A, P) == \<forall>x. x<A \<longrightarrow> P(x)"
paulson@13298
    15
wenzelm@24893
    16
definition
wenzelm@24893
    17
  oex :: "[i, i => o] => o"  where
paulson@46820
    18
    "oex(A, P)  == \<exists>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@46820
    51
lemma [simp]: "(\<forall>x<0. P(x))"
paulson@13298
    52
by (simp add: oall_def)
paulson@12825
    53
paulson@46820
    54
lemma [simp]: "~(\<exists>x<0. P(x))"
paulson@13298
    55
by (simp add: oex_def)
paulson@12825
    56
paulson@46820
    57
lemma [simp]: "(\<forall>x<succ(i). P(x)) <-> (Ord(i) \<longrightarrow> P(i) & (\<forall>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@46820
    62
lemma [simp]: "(\<exists>x<succ(i). P(x)) <-> (Ord(i) & (P(i) | (\<exists>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@46820
    87
(* No < version of this theorem: consider that @{term"(\<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@12620
    92
lemma OUN_least_le:
paulson@13615
    93
     "[| Ord(i);  !!x. x<A ==> b(x) \<le> i |] ==> (\<Union>x<A. b(x)) \<le> i"
paulson@12620
    94
by (simp add: OUnion_def UN_least_le ltI Ord_0_le)
paulson@12620
    95
paulson@12620
    96
lemma le_implies_OUN_le_OUN:
paulson@13615
    97
     "[| !!x. x<A ==> c(x) \<le> d(x) |] ==> (\<Union>x<A. c(x)) \<le> (\<Union>x<A. d(x))"
paulson@12620
    98
by (blast intro: OUN_least_le OUN_upper_le le_Ord2 Ord_OUN)
paulson@12620
    99
paulson@12620
   100
lemma OUN_UN_eq:
paulson@46953
   101
     "(!!x. x \<in> A ==> Ord(B(x)))
paulson@13615
   102
      ==> (\<Union>z < (\<Union>x\<in>A. B(x)). C(z)) = (\<Union>x\<in>A. \<Union>z < B(x). C(z))"
paulson@13298
   103
by (simp add: OUnion_def)
paulson@12620
   104
paulson@12620
   105
lemma OUN_Union_eq:
paulson@46953
   106
     "(!!x. x \<in> X ==> Ord(x))
paulson@46820
   107
      ==> (\<Union>z < \<Union>(X). C(z)) = (\<Union>x\<in>X. \<Union>z < x. C(z))"
paulson@13298
   108
by (simp add: OUnion_def)
paulson@12620
   109
paulson@46820
   110
(*So that rule_format will get rid of this quantifier...*)
paulson@12763
   111
lemma atomize_oall [symmetric, rulify]:
paulson@46820
   112
     "(!!x. x<A ==> P(x)) == Trueprop (\<forall>x<A. P(x))"
paulson@12763
   113
by (simp add: oall_def atomize_all atomize_imp)
paulson@12763
   114
paulson@13302
   115
subsubsection {*universal quantifier for ordinals*}
paulson@13169
   116
paulson@13169
   117
lemma oallI [intro!]:
paulson@46820
   118
    "[| !!x. x<A ==> P(x) |] ==> \<forall>x<A. P(x)"
paulson@13298
   119
by (simp add: oall_def)
paulson@13169
   120
paulson@46820
   121
lemma ospec: "[| \<forall>x<A. P(x);  x<A |] ==> P(x)"
paulson@13298
   122
by (simp add: oall_def)
paulson@13169
   123
paulson@13169
   124
lemma oallE:
paulson@46820
   125
    "[| \<forall>x<A. P(x);  P(x) ==> Q;  ~x<A ==> Q |] ==> Q"
paulson@13298
   126
by (simp add: oall_def, blast)
paulson@13169
   127
paulson@13169
   128
lemma rev_oallE [elim]:
paulson@46820
   129
    "[| \<forall>x<A. P(x);  ~x<A ==> Q;  P(x) ==> Q |] ==> Q"
paulson@13298
   130
by (simp add: oall_def, blast)
paulson@13169
   131
paulson@13169
   132
paulson@46820
   133
(*Trival rewrite rule.  @{term"(\<forall>x<a.P)<->P"} holds only if a is not 0!*)
paulson@46820
   134
lemma oall_simp [simp]: "(\<forall>x<a. True) <-> True"
paulson@13170
   135
by blast
paulson@13169
   136
paulson@13169
   137
(*Congruence rule for rewriting*)
paulson@13169
   138
lemma oall_cong [cong]:
paulson@13298
   139
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |]
paulson@13289
   140
     ==> oall(a, %x. P(x)) <-> oall(a', %x. P'(x))"
paulson@13169
   141
by (simp add: oall_def)
paulson@13169
   142
paulson@13169
   143
paulson@13302
   144
subsubsection {*existential quantifier for ordinals*}
paulson@13169
   145
paulson@13169
   146
lemma oexI [intro]:
paulson@46820
   147
    "[| P(x);  x<A |] ==> \<exists>x<A. P(x)"
paulson@13298
   148
apply (simp add: oex_def, blast)
paulson@13169
   149
done
paulson@13169
   150
paulson@46820
   151
(*Not of the general form for such rules... *)
paulson@13169
   152
lemma oexCI:
paulson@46820
   153
   "[| \<forall>x<A. ~P(x) ==> P(a);  a<A |] ==> \<exists>x<A. P(x)"
paulson@13298
   154
apply (simp add: oex_def, blast)
paulson@13169
   155
done
paulson@13169
   156
paulson@13169
   157
lemma oexE [elim!]:
paulson@46820
   158
    "[| \<exists>x<A. P(x);  !!x. [| x<A; P(x) |] ==> Q |] ==> Q"
paulson@13298
   159
apply (simp add: oex_def, blast)
paulson@13169
   160
done
paulson@13169
   161
paulson@13169
   162
lemma oex_cong [cong]:
paulson@13298
   163
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |]
paulson@13289
   164
     ==> oex(a, %x. P(x)) <-> oex(a', %x. P'(x))"
paulson@13169
   165
apply (simp add: oex_def cong add: conj_cong)
paulson@13169
   166
done
paulson@13169
   167
paulson@13169
   168
paulson@13302
   169
subsubsection {*Rules for Ordinal-Indexed Unions*}
paulson@13169
   170
paulson@46953
   171
lemma OUN_I [intro]: "[| a<i;  b \<in> B(a) |] ==> b: (\<Union>z<i. B(z))"
paulson@13170
   172
by (unfold OUnion_def lt_def, blast)
paulson@13169
   173
paulson@13169
   174
lemma OUN_E [elim!]:
paulson@46953
   175
    "[| b \<in> (\<Union>z<i. B(z));  !!a.[| b \<in> B(a);  a<i |] ==> R |] ==> R"
paulson@13170
   176
apply (unfold OUnion_def lt_def, blast)
paulson@13169
   177
done
paulson@13169
   178
paulson@46820
   179
lemma OUN_iff: "b \<in> (\<Union>x<i. B(x)) <-> (\<exists>x<i. b \<in> B(x))"
paulson@13170
   180
by (unfold OUnion_def oex_def lt_def, blast)
paulson@13169
   181
paulson@13169
   182
lemma OUN_cong [cong]:
paulson@13615
   183
    "[| i=j;  !!x. x<j ==> C(x)=D(x) |] ==> (\<Union>x<i. C(x)) = (\<Union>x<j. D(x))"
paulson@13169
   184
by (simp add: OUnion_def lt_def OUN_iff)
paulson@13169
   185
paulson@13298
   186
lemma lt_induct:
paulson@46820
   187
    "[| i<k;  !!x.[| x<k;  \<forall>y<x. P(y) |] ==> P(x) |]  ==>  P(i)"
paulson@13169
   188
apply (simp add: lt_def oall_def)
paulson@13298
   189
apply (erule conjE)
paulson@13298
   190
apply (erule Ord_induct, assumption, blast)
paulson@13169
   191
done
paulson@13169
   192
paulson@13253
   193
paulson@13253
   194
subsection {*Quantification over a class*}
paulson@13253
   195
wenzelm@24893
   196
definition
wenzelm@24893
   197
  "rall"     :: "[i=>o, i=>o] => o"  where
paulson@46820
   198
    "rall(M, P) == \<forall>x. M(x) \<longrightarrow> P(x)"
paulson@13253
   199
wenzelm@24893
   200
definition
wenzelm@24893
   201
  "rex"      :: "[i=>o, i=>o] => o"  where
paulson@46820
   202
    "rex(M, P) == \<exists>x. M(x) & P(x)"
paulson@13253
   203
paulson@13253
   204
syntax
wenzelm@35112
   205
  "_rall"     :: "[pttrn, i=>o, o] => o"        ("(3ALL _[_]./ _)" 10)
wenzelm@35112
   206
  "_rex"      :: "[pttrn, i=>o, o] => o"        ("(3EX _[_]./ _)" 10)
paulson@13253
   207
paulson@13253
   208
syntax (xsymbols)
wenzelm@35112
   209
  "_rall"     :: "[pttrn, i=>o, o] => o"        ("(3\<forall>_[_]./ _)" 10)
wenzelm@35112
   210
  "_rex"      :: "[pttrn, i=>o, o] => o"        ("(3\<exists>_[_]./ _)" 10)
kleing@14565
   211
syntax (HTML output)
wenzelm@35112
   212
  "_rall"     :: "[pttrn, i=>o, o] => o"        ("(3\<forall>_[_]./ _)" 10)
wenzelm@35112
   213
  "_rex"      :: "[pttrn, i=>o, o] => o"        ("(3\<exists>_[_]./ _)" 10)
paulson@13253
   214
paulson@13253
   215
translations
wenzelm@24893
   216
  "ALL x[M]. P"  == "CONST rall(M, %x. P)"
wenzelm@24893
   217
  "EX x[M]. P"   == "CONST rex(M, %x. P)"
paulson@13253
   218
paulson@13298
   219
paulson@13298
   220
subsubsection{*Relativized universal quantifier*}
paulson@13253
   221
paulson@46820
   222
lemma rallI [intro!]: "[| !!x. M(x) ==> P(x) |] ==> \<forall>x[M]. P(x)"
paulson@13253
   223
by (simp add: rall_def)
paulson@13253
   224
paulson@46820
   225
lemma rspec: "[| \<forall>x[M]. P(x); M(x) |] ==> P(x)"
paulson@13253
   226
by (simp add: rall_def)
paulson@13253
   227
paulson@13253
   228
(*Instantiates x first: better for automatic theorem proving?*)
paulson@13298
   229
lemma rev_rallE [elim]:
paulson@46820
   230
    "[| \<forall>x[M]. P(x);  ~ M(x) ==> Q;  P(x) ==> Q |] ==> Q"
paulson@13298
   231
by (simp add: rall_def, blast)
paulson@13253
   232
paulson@46820
   233
lemma rallE: "[| \<forall>x[M]. P(x);  P(x) ==> Q;  ~ M(x) ==> Q |] ==> Q"
paulson@13253
   234
by blast
paulson@13253
   235
paulson@13253
   236
(*Trival rewrite rule;   (ALL x[M].P)<->P holds only if A is nonempty!*)
paulson@13253
   237
lemma rall_triv [simp]: "(ALL x[M]. P) <-> ((EX x. M(x)) --> P)"
paulson@13253
   238
by (simp add: rall_def)
paulson@13253
   239
paulson@13253
   240
(*Congruence rule for rewriting*)
paulson@13253
   241
lemma rall_cong [cong]:
paulson@46820
   242
    "(!!x. M(x) ==> P(x) <-> P'(x)) ==> (\<forall>x[M]. P(x)) <-> (\<forall>x[M]. P'(x))"
paulson@13253
   243
by (simp add: rall_def)
paulson@13253
   244
paulson@13298
   245
paulson@13298
   246
subsubsection{*Relativized existential quantifier*}
paulson@13253
   247
paulson@46820
   248
lemma rexI [intro]: "[| P(x); M(x) |] ==> \<exists>x[M]. P(x)"
paulson@13253
   249
by (simp add: rex_def, blast)
paulson@13253
   250
paulson@13253
   251
(*The best argument order when there is only one M(x)*)
paulson@46820
   252
lemma rev_rexI: "[| M(x);  P(x) |] ==> \<exists>x[M]. P(x)"
paulson@13253
   253
by blast
paulson@13253
   254
paulson@46820
   255
(*Not of the general form for such rules... *)
paulson@46820
   256
lemma rexCI: "[| \<forall>x[M]. ~P(x) ==> P(a); M(a) |] ==> \<exists>x[M]. P(x)"
paulson@13253
   257
by blast
paulson@13253
   258
paulson@46820
   259
lemma rexE [elim!]: "[| \<exists>x[M]. P(x);  !!x. [| M(x); P(x) |] ==> Q |] ==> Q"
paulson@13253
   260
by (simp add: rex_def, blast)
paulson@13253
   261
paulson@13253
   262
(*We do not even have (EX x[M]. True) <-> True unless A is nonempty!!*)
paulson@13253
   263
lemma rex_triv [simp]: "(EX x[M]. P) <-> ((EX x. M(x)) & P)"
paulson@13253
   264
by (simp add: rex_def)
paulson@13253
   265
paulson@13253
   266
lemma rex_cong [cong]:
paulson@46820
   267
    "(!!x. M(x) ==> P(x) <-> P'(x)) ==> (\<exists>x[M]. P(x)) <-> (\<exists>x[M]. P'(x))"
paulson@13253
   268
by (simp add: rex_def cong: conj_cong)
paulson@13253
   269
paulson@13289
   270
lemma rall_is_ball [simp]: "(\<forall>x[%z. z\<in>A]. P(x)) <-> (\<forall>x\<in>A. P(x))"
paulson@13289
   271
by blast
paulson@13289
   272
paulson@13289
   273
lemma rex_is_bex [simp]: "(\<exists>x[%z. z\<in>A]. P(x)) <-> (\<exists>x\<in>A. P(x))"
paulson@13289
   274
by blast
paulson@13289
   275
paulson@46820
   276
lemma atomize_rall: "(!!x. M(x) ==> P(x)) == Trueprop (\<forall>x[M]. P(x))";
paulson@13253
   277
by (simp add: rall_def atomize_all atomize_imp)
paulson@13253
   278
paulson@13253
   279
declare atomize_rall [symmetric, rulify]
paulson@13253
   280
paulson@13253
   281
lemma rall_simps1:
paulson@46820
   282
     "(\<forall>x[M]. P(x) & Q)   <-> (\<forall>x[M]. P(x)) & ((\<forall>x[M]. False) | Q)"
paulson@46820
   283
     "(\<forall>x[M]. P(x) | Q)   <-> ((\<forall>x[M]. P(x)) | Q)"
paulson@46820
   284
     "(\<forall>x[M]. P(x) \<longrightarrow> Q) <-> ((\<exists>x[M]. P(x)) \<longrightarrow> Q)"
paulson@46820
   285
     "(~(\<forall>x[M]. P(x))) <-> (\<exists>x[M]. ~P(x))"
paulson@13253
   286
by blast+
paulson@13253
   287
paulson@13253
   288
lemma rall_simps2:
paulson@46820
   289
     "(\<forall>x[M]. P & Q(x))   <-> ((\<forall>x[M]. False) | P) & (\<forall>x[M]. Q(x))"
paulson@46820
   290
     "(\<forall>x[M]. P | Q(x))   <-> (P | (\<forall>x[M]. Q(x)))"
paulson@46820
   291
     "(\<forall>x[M]. P \<longrightarrow> Q(x)) <-> (P \<longrightarrow> (\<forall>x[M]. Q(x)))"
paulson@13253
   292
by blast+
paulson@13253
   293
paulson@13289
   294
lemmas rall_simps [simp] = rall_simps1 rall_simps2
paulson@13253
   295
paulson@13253
   296
lemma rall_conj_distrib:
paulson@46820
   297
    "(\<forall>x[M]. P(x) & Q(x)) <-> ((\<forall>x[M]. P(x)) & (\<forall>x[M]. Q(x)))"
paulson@13253
   298
by blast
paulson@13253
   299
paulson@13253
   300
lemma rex_simps1:
paulson@46820
   301
     "(\<exists>x[M]. P(x) & Q) <-> ((\<exists>x[M]. P(x)) & Q)"
paulson@46820
   302
     "(\<exists>x[M]. P(x) | Q) <-> (\<exists>x[M]. P(x)) | ((\<exists>x[M]. True) & Q)"
paulson@46820
   303
     "(\<exists>x[M]. P(x) \<longrightarrow> Q) <-> ((\<forall>x[M]. P(x)) \<longrightarrow> ((\<exists>x[M]. True) & Q))"
paulson@46820
   304
     "(~(\<exists>x[M]. P(x))) <-> (\<forall>x[M]. ~P(x))"
paulson@13253
   305
by blast+
paulson@13253
   306
paulson@13253
   307
lemma rex_simps2:
paulson@46820
   308
     "(\<exists>x[M]. P & Q(x)) <-> (P & (\<exists>x[M]. Q(x)))"
paulson@46820
   309
     "(\<exists>x[M]. P | Q(x)) <-> ((\<exists>x[M]. True) & P) | (\<exists>x[M]. Q(x))"
paulson@46820
   310
     "(\<exists>x[M]. P \<longrightarrow> Q(x)) <-> (((\<forall>x[M]. False) | P) \<longrightarrow> (\<exists>x[M]. Q(x)))"
paulson@13253
   311
by blast+
paulson@13253
   312
paulson@13289
   313
lemmas rex_simps [simp] = rex_simps1 rex_simps2
paulson@13253
   314
paulson@13253
   315
lemma rex_disj_distrib:
paulson@46820
   316
    "(\<exists>x[M]. P(x) | Q(x)) <-> ((\<exists>x[M]. P(x)) | (\<exists>x[M]. Q(x)))"
paulson@13253
   317
by blast
paulson@13253
   318
paulson@13253
   319
paulson@13298
   320
subsubsection{*One-point rule for bounded quantifiers*}
paulson@13253
   321
paulson@46820
   322
lemma rex_triv_one_point1 [simp]: "(\<exists>x[M]. x=a) <-> ( M(a))"
paulson@13253
   323
by blast
paulson@13253
   324
paulson@46820
   325
lemma rex_triv_one_point2 [simp]: "(\<exists>x[M]. a=x) <-> ( M(a))"
paulson@13253
   326
by blast
paulson@13253
   327
paulson@46820
   328
lemma rex_one_point1 [simp]: "(\<exists>x[M]. x=a & P(x)) <-> ( M(a) & P(a))"
paulson@13253
   329
by blast
paulson@13253
   330
paulson@46820
   331
lemma rex_one_point2 [simp]: "(\<exists>x[M]. a=x & P(x)) <-> ( M(a) & P(a))"
paulson@13253
   332
by blast
paulson@13253
   333
paulson@46820
   334
lemma rall_one_point1 [simp]: "(\<forall>x[M]. x=a \<longrightarrow> P(x)) <-> ( M(a) \<longrightarrow> P(a))"
paulson@13253
   335
by blast
paulson@13253
   336
paulson@46820
   337
lemma rall_one_point2 [simp]: "(\<forall>x[M]. a=x \<longrightarrow> P(x)) <-> ( M(a) \<longrightarrow> P(a))"
paulson@13253
   338
by blast
paulson@13253
   339
paulson@13253
   340
paulson@13298
   341
subsubsection{*Sets as Classes*}
paulson@13298
   342
wenzelm@24893
   343
definition
wenzelm@24893
   344
  setclass :: "[i,i] => o"       ("##_" [40] 40)  where
paulson@46820
   345
   "setclass(A) == %x. x \<in> A"
paulson@13298
   346
paulson@46820
   347
lemma setclass_iff [simp]: "setclass(A,x) <-> x \<in> A"
paulson@13362
   348
by (simp add: setclass_def)
paulson@13298
   349
paulson@13807
   350
lemma rall_setclass_is_ball [simp]: "(\<forall>x[##A]. P(x)) <-> (\<forall>x\<in>A. P(x))"
paulson@13298
   351
by auto
paulson@13298
   352
paulson@13807
   353
lemma rex_setclass_is_bex [simp]: "(\<exists>x[##A]. P(x)) <-> (\<exists>x\<in>A. P(x))"
paulson@13298
   354
by auto
paulson@13298
   355
paulson@13298
   356
paulson@13169
   357
ML
paulson@13169
   358
{*
paulson@13169
   359
val Ord_atomize =
wenzelm@24893
   360
    atomize ([("OrdQuant.oall", [@{thm ospec}]),("OrdQuant.rall", [@{thm rspec}])]@
paulson@13298
   361
                 ZF_conn_pairs,
paulson@13253
   362
             ZF_mem_pairs);
wenzelm@26339
   363
*}
wenzelm@26339
   364
declaration {* fn _ =>
wenzelm@45625
   365
  Simplifier.map_ss (Simplifier.set_mksimps (K (map mk_eq o Ord_atomize o gen_all)))
paulson@13169
   366
*}
paulson@13169
   367
wenzelm@13462
   368
text {* Setting up the one-point-rule simproc *}
paulson@13253
   369
paulson@46820
   370
simproc_setup defined_rex ("\<exists>x[M]. P(x) & Q(x)") = {*
wenzelm@42455
   371
  let
wenzelm@42455
   372
    val unfold_rex_tac = unfold_tac @{thms rex_def};
wenzelm@42455
   373
    fun prove_rex_tac ss = unfold_rex_tac ss THEN Quantifier1.prove_one_point_ex_tac;
wenzelm@42459
   374
  in fn _ => fn ss => Quantifier1.rearrange_bex (prove_rex_tac ss) ss end
wenzelm@42455
   375
*}
paulson@13253
   376
paulson@46820
   377
simproc_setup defined_rall ("\<forall>x[M]. P(x) \<longrightarrow> Q(x)") = {*
wenzelm@42455
   378
  let
wenzelm@42455
   379
    val unfold_rall_tac = unfold_tac @{thms rall_def};
wenzelm@42455
   380
    fun prove_rall_tac ss = unfold_rall_tac ss THEN Quantifier1.prove_one_point_all_tac;
wenzelm@42459
   381
  in fn _ => fn ss => Quantifier1.rearrange_ball (prove_rall_tac ss) ss end
paulson@13253
   382
*}
paulson@13253
   383
paulson@2469
   384
end