src/ZF/Constructible/Relative.thy
author paulson
Fri Jul 12 16:41:39 2002 +0200 (2002-07-12)
changeset 13353 1800e7134d2e
parent 13352 3cd767f8d78b
child 13363 c26eeb000470
permissions -rw-r--r--
towards relativization of "iterates" and "wfrec"
paulson@13223
     1
header {*Relativization and Absoluteness*}
paulson@13223
     2
paulson@13223
     3
theory Relative = Main:
paulson@13223
     4
paulson@13223
     5
subsection{* Relativized versions of standard set-theoretic concepts *}
paulson@13223
     6
paulson@13223
     7
constdefs
paulson@13223
     8
  empty :: "[i=>o,i] => o"
paulson@13254
     9
    "empty(M,z) == \<forall>x[M]. x \<notin> z"
paulson@13223
    10
paulson@13223
    11
  subset :: "[i=>o,i,i] => o"
paulson@13298
    12
    "subset(M,A,B) == \<forall>x[M]. x\<in>A --> x \<in> B"
paulson@13223
    13
paulson@13223
    14
  upair :: "[i=>o,i,i,i] => o"
paulson@13298
    15
    "upair(M,a,b,z) == a \<in> z & b \<in> z & (\<forall>x[M]. x\<in>z --> x = a | x = b)"
paulson@13223
    16
paulson@13223
    17
  pair :: "[i=>o,i,i,i] => o"
paulson@13254
    18
    "pair(M,a,b,z) == \<exists>x[M]. upair(M,a,a,x) & 
paulson@13254
    19
                          (\<exists>y[M]. upair(M,a,b,y) & upair(M,x,y,z))"
paulson@13223
    20
paulson@13306
    21
paulson@13245
    22
  union :: "[i=>o,i,i,i] => o"
paulson@13254
    23
    "union(M,a,b,z) == \<forall>x[M]. x \<in> z <-> x \<in> a | x \<in> b"
paulson@13245
    24
paulson@13306
    25
  is_cons :: "[i=>o,i,i,i] => o"
paulson@13306
    26
    "is_cons(M,a,b,z) == \<exists>x[M]. upair(M,a,a,x) & union(M,x,b,z)"
paulson@13306
    27
paulson@13223
    28
  successor :: "[i=>o,i,i] => o"
paulson@13306
    29
    "successor(M,a,z) == is_cons(M,a,a,z)"
paulson@13223
    30
paulson@13223
    31
  powerset :: "[i=>o,i,i] => o"
paulson@13254
    32
    "powerset(M,A,z) == \<forall>x[M]. x \<in> z <-> subset(M,x,A)"
paulson@13223
    33
paulson@13223
    34
  inter :: "[i=>o,i,i,i] => o"
paulson@13254
    35
    "inter(M,a,b,z) == \<forall>x[M]. x \<in> z <-> x \<in> a & x \<in> b"
paulson@13223
    36
paulson@13223
    37
  setdiff :: "[i=>o,i,i,i] => o"
paulson@13254
    38
    "setdiff(M,a,b,z) == \<forall>x[M]. x \<in> z <-> x \<in> a & x \<notin> b"
paulson@13223
    39
paulson@13223
    40
  big_union :: "[i=>o,i,i] => o"
paulson@13298
    41
    "big_union(M,A,z) == \<forall>x[M]. x \<in> z <-> (\<exists>y[M]. y\<in>A & x \<in> y)"
paulson@13223
    42
paulson@13223
    43
  big_inter :: "[i=>o,i,i] => o"
paulson@13223
    44
    "big_inter(M,A,z) == 
paulson@13223
    45
             (A=0 --> z=0) &
paulson@13298
    46
	     (A\<noteq>0 --> (\<forall>x[M]. x \<in> z <-> (\<forall>y[M]. y\<in>A --> x \<in> y)))"
paulson@13223
    47
paulson@13223
    48
  cartprod :: "[i=>o,i,i,i] => o"
paulson@13223
    49
    "cartprod(M,A,B,z) == 
paulson@13298
    50
	\<forall>u[M]. u \<in> z <-> (\<exists>x[M]. x\<in>A & (\<exists>y[M]. y\<in>B & pair(M,x,y,u)))"
paulson@13223
    51
paulson@13350
    52
  is_sum :: "[i=>o,i,i,i] => o"
paulson@13350
    53
    "is_sum(M,A,B,Z) == 
paulson@13350
    54
       \<exists>A0[M]. \<exists>n1[M]. \<exists>s1[M]. \<exists>B1[M]. 
paulson@13350
    55
       number1(M,n1) & cartprod(M,n1,A,A0) & upair(M,n1,n1,s1) &
paulson@13350
    56
       cartprod(M,s1,B,B1) & union(M,A0,B1,Z)"
paulson@13350
    57
paulson@13223
    58
  is_converse :: "[i=>o,i,i] => o"
paulson@13223
    59
    "is_converse(M,r,z) == 
paulson@13299
    60
	\<forall>x[M]. x \<in> z <-> 
paulson@13299
    61
             (\<exists>w[M]. w\<in>r & (\<exists>u[M]. \<exists>v[M]. pair(M,u,v,w) & pair(M,v,u,x)))"
paulson@13223
    62
paulson@13223
    63
  pre_image :: "[i=>o,i,i,i] => o"
paulson@13223
    64
    "pre_image(M,r,A,z) == 
paulson@13299
    65
	\<forall>x[M]. x \<in> z <-> (\<exists>w[M]. w\<in>r & (\<exists>y[M]. y\<in>A & pair(M,x,y,w)))"
paulson@13223
    66
paulson@13223
    67
  is_domain :: "[i=>o,i,i] => o"
paulson@13223
    68
    "is_domain(M,r,z) == 
paulson@13299
    69
	\<forall>x[M]. (x \<in> z <-> (\<exists>w[M]. w\<in>r & (\<exists>y[M]. pair(M,x,y,w))))"
paulson@13223
    70
paulson@13223
    71
  image :: "[i=>o,i,i,i] => o"
paulson@13223
    72
    "image(M,r,A,z) == 
paulson@13299
    73
        \<forall>y[M]. (y \<in> z <-> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. x\<in>A & pair(M,x,y,w))))"
paulson@13223
    74
paulson@13223
    75
  is_range :: "[i=>o,i,i] => o"
paulson@13223
    76
    --{*the cleaner 
paulson@13299
    77
      @{term "\<exists>r'[M]. is_converse(M,r,r') & is_domain(M,r',z)"}
paulson@13223
    78
      unfortunately needs an instance of separation in order to prove 
paulson@13223
    79
        @{term "M(converse(r))"}.*}
paulson@13223
    80
    "is_range(M,r,z) == 
paulson@13299
    81
	\<forall>y[M]. (y \<in> z <-> (\<exists>w[M]. w\<in>r & (\<exists>x[M]. pair(M,x,y,w))))"
paulson@13223
    82
paulson@13245
    83
  is_field :: "[i=>o,i,i] => o"
paulson@13245
    84
    "is_field(M,r,z) == 
paulson@13298
    85
	\<exists>dr[M]. is_domain(M,r,dr) & 
paulson@13298
    86
            (\<exists>rr[M]. is_range(M,r,rr) & union(M,dr,rr,z))"
paulson@13245
    87
paulson@13223
    88
  is_relation :: "[i=>o,i] => o"
paulson@13223
    89
    "is_relation(M,r) == 
paulson@13298
    90
        (\<forall>z[M]. z\<in>r --> (\<exists>x[M]. \<exists>y[M]. pair(M,x,y,z)))"
paulson@13223
    91
paulson@13223
    92
  is_function :: "[i=>o,i] => o"
paulson@13223
    93
    "is_function(M,r) == 
paulson@13299
    94
	\<forall>x[M]. \<forall>y[M]. \<forall>y'[M]. \<forall>p[M]. \<forall>p'[M]. 
paulson@13299
    95
           pair(M,x,y,p) --> pair(M,x,y',p') --> p\<in>r --> p'\<in>r --> y=y'"
paulson@13223
    96
paulson@13223
    97
  fun_apply :: "[i=>o,i,i,i] => o"
paulson@13223
    98
    "fun_apply(M,f,x,y) == 
paulson@13352
    99
        (\<exists>xs[M]. \<exists>fxs[M]. 
paulson@13352
   100
         upair(M,x,x,xs) & image(M,f,xs,fxs) & big_union(M,fxs,y))"
paulson@13223
   101
paulson@13223
   102
  typed_function :: "[i=>o,i,i,i] => o"
paulson@13223
   103
    "typed_function(M,A,B,r) == 
paulson@13223
   104
        is_function(M,r) & is_relation(M,r) & is_domain(M,r,A) &
paulson@13306
   105
        (\<forall>u[M]. u\<in>r --> (\<forall>x[M]. \<forall>y[M]. pair(M,x,y,u) --> y\<in>B))"
paulson@13223
   106
paulson@13268
   107
  is_funspace :: "[i=>o,i,i,i] => o"
paulson@13268
   108
    "is_funspace(M,A,B,F) == 
paulson@13268
   109
        \<forall>f[M]. f \<in> F <-> typed_function(M,A,B,f)"
paulson@13268
   110
paulson@13245
   111
  composition :: "[i=>o,i,i,i] => o"
paulson@13245
   112
    "composition(M,r,s,t) == 
paulson@13306
   113
        \<forall>p[M]. p \<in> t <-> 
paulson@13323
   114
               (\<exists>x[M]. \<exists>y[M]. \<exists>z[M]. \<exists>xy[M]. \<exists>yz[M]. 
paulson@13323
   115
                pair(M,x,z,p) & pair(M,x,y,xy) & pair(M,y,z,yz) & 
paulson@13323
   116
                xy \<in> s & yz \<in> r)"
paulson@13245
   117
paulson@13223
   118
  injection :: "[i=>o,i,i,i] => o"
paulson@13223
   119
    "injection(M,A,B,f) == 
paulson@13223
   120
	typed_function(M,A,B,f) &
paulson@13306
   121
        (\<forall>x[M]. \<forall>x'[M]. \<forall>y[M]. \<forall>p[M]. \<forall>p'[M]. 
paulson@13306
   122
          pair(M,x,y,p) --> pair(M,x',y,p') --> p\<in>f --> p'\<in>f --> x=x')"
paulson@13223
   123
paulson@13223
   124
  surjection :: "[i=>o,i,i,i] => o"
paulson@13223
   125
    "surjection(M,A,B,f) == 
paulson@13223
   126
        typed_function(M,A,B,f) &
paulson@13299
   127
        (\<forall>y[M]. y\<in>B --> (\<exists>x[M]. x\<in>A & fun_apply(M,f,x,y)))"
paulson@13223
   128
paulson@13223
   129
  bijection :: "[i=>o,i,i,i] => o"
paulson@13223
   130
    "bijection(M,A,B,f) == injection(M,A,B,f) & surjection(M,A,B,f)"
paulson@13223
   131
paulson@13223
   132
  restriction :: "[i=>o,i,i,i] => o"
paulson@13223
   133
    "restriction(M,r,A,z) == 
paulson@13306
   134
	\<forall>x[M]. x \<in> z <-> (x \<in> r & (\<exists>u[M]. u\<in>A & (\<exists>v[M]. pair(M,u,v,x))))"
paulson@13223
   135
paulson@13223
   136
  transitive_set :: "[i=>o,i] => o"
paulson@13299
   137
    "transitive_set(M,a) == \<forall>x[M]. x\<in>a --> subset(M,x,a)"
paulson@13223
   138
paulson@13223
   139
  ordinal :: "[i=>o,i] => o"
paulson@13223
   140
     --{*an ordinal is a transitive set of transitive sets*}
paulson@13299
   141
    "ordinal(M,a) == transitive_set(M,a) & (\<forall>x[M]. x\<in>a --> transitive_set(M,x))"
paulson@13223
   142
paulson@13223
   143
  limit_ordinal :: "[i=>o,i] => o"
paulson@13223
   144
    --{*a limit ordinal is a non-empty, successor-closed ordinal*}
paulson@13223
   145
    "limit_ordinal(M,a) == 
paulson@13223
   146
	ordinal(M,a) & ~ empty(M,a) & 
paulson@13299
   147
        (\<forall>x[M]. x\<in>a --> (\<exists>y[M]. y\<in>a & successor(M,x,y)))"
paulson@13223
   148
paulson@13223
   149
  successor_ordinal :: "[i=>o,i] => o"
paulson@13223
   150
    --{*a successor ordinal is any ordinal that is neither empty nor limit*}
paulson@13223
   151
    "successor_ordinal(M,a) == 
paulson@13223
   152
	ordinal(M,a) & ~ empty(M,a) & ~ limit_ordinal(M,a)"
paulson@13223
   153
paulson@13223
   154
  finite_ordinal :: "[i=>o,i] => o"
paulson@13223
   155
    --{*an ordinal is finite if neither it nor any of its elements are limit*}
paulson@13223
   156
    "finite_ordinal(M,a) == 
paulson@13223
   157
	ordinal(M,a) & ~ limit_ordinal(M,a) & 
paulson@13299
   158
        (\<forall>x[M]. x\<in>a --> ~ limit_ordinal(M,x))"
paulson@13223
   159
paulson@13223
   160
  omega :: "[i=>o,i] => o"
paulson@13223
   161
    --{*omega is a limit ordinal none of whose elements are limit*}
paulson@13299
   162
    "omega(M,a) == limit_ordinal(M,a) & (\<forall>x[M]. x\<in>a --> ~ limit_ordinal(M,x))"
paulson@13223
   163
paulson@13223
   164
  number1 :: "[i=>o,i] => o"
paulson@13299
   165
    "number1(M,a) == (\<exists>x[M]. empty(M,x) & successor(M,x,a))"
paulson@13223
   166
paulson@13223
   167
  number2 :: "[i=>o,i] => o"
paulson@13299
   168
    "number2(M,a) == (\<exists>x[M]. number1(M,x) & successor(M,x,a))"
paulson@13223
   169
paulson@13223
   170
  number3 :: "[i=>o,i] => o"
paulson@13299
   171
    "number3(M,a) == (\<exists>x[M]. number2(M,x) & successor(M,x,a))"
paulson@13223
   172
paulson@13350
   173
  is_quasinat :: "[i=>o,i] => o"
paulson@13350
   174
    "is_quasinat(M,z) == empty(M,z) | (\<exists>m[M]. successor(M,m,z))"
paulson@13350
   175
paulson@13350
   176
  is_nat_case :: "[i=>o, i, [i,i]=>o, i, i] => o"
paulson@13350
   177
    "is_nat_case(M, a, is_b, k, z) == 
paulson@13350
   178
       (empty(M,k) --> z=a) &
paulson@13350
   179
       (\<forall>m[M]. successor(M,m,k) --> is_b(m,z)) &
paulson@13350
   180
       (is_quasinat(M,k) | z=0)"
paulson@13350
   181
paulson@13353
   182
  relativize1 :: "[i=>o, [i,i]=>o, i=>i] => o"
paulson@13353
   183
    "relativize1(M,is_f,f) == \<forall>x[M]. \<forall>y[M]. is_f(x,y) <-> y = f(x)"
paulson@13353
   184
paulson@13353
   185
  relativize2 :: "[i=>o, [i,i,i]=>o, [i,i]=>i] => o"
paulson@13353
   186
    "relativize2(M,is_f,f) == \<forall>x[M]. \<forall>y[M]. \<forall>z[M]. is_f(x,y,z) <-> z = f(x,y)"
paulson@13353
   187
paulson@13353
   188
  relativize3 :: "[i=>o, [i,i,i,i]=>o, [i,i,i]=>i] => o"
paulson@13353
   189
    "relativize3(M,is_f,f) == 
paulson@13353
   190
       \<forall>x[M]. \<forall>y[M]. \<forall>z[M]. \<forall>u[M]. is_f(x,y,z,u) <-> u = f(x,y,z)"
paulson@13353
   191
paulson@13223
   192
paulson@13223
   193
subsection {*The relativized ZF axioms*}
paulson@13223
   194
constdefs
paulson@13223
   195
paulson@13223
   196
  extensionality :: "(i=>o) => o"
paulson@13223
   197
    "extensionality(M) == 
paulson@13290
   198
	\<forall>x[M]. \<forall>y[M]. (\<forall>z[M]. z \<in> x <-> z \<in> y) --> x=y"
paulson@13223
   199
paulson@13223
   200
  separation :: "[i=>o, i=>o] => o"
paulson@13223
   201
    --{*Big problem: the formula @{text P} should only involve parameters
paulson@13223
   202
        belonging to @{text M}.  Don't see how to enforce that.*}
paulson@13223
   203
    "separation(M,P) == 
paulson@13290
   204
	\<forall>z[M]. \<exists>y[M]. \<forall>x[M]. x \<in> y <-> x \<in> z & P(x)"
paulson@13223
   205
paulson@13223
   206
  upair_ax :: "(i=>o) => o"
paulson@13299
   207
    "upair_ax(M) == \<forall>x y. M(x) --> M(y) --> (\<exists>z[M]. upair(M,x,y,z))"
paulson@13223
   208
paulson@13223
   209
  Union_ax :: "(i=>o) => o"
paulson@13299
   210
    "Union_ax(M) == \<forall>x[M]. (\<exists>z[M]. big_union(M,x,z))"
paulson@13223
   211
paulson@13223
   212
  power_ax :: "(i=>o) => o"
paulson@13299
   213
    "power_ax(M) == \<forall>x[M]. (\<exists>z[M]. powerset(M,x,z))"
paulson@13223
   214
paulson@13223
   215
  univalent :: "[i=>o, i, [i,i]=>o] => o"
paulson@13223
   216
    "univalent(M,A,P) == 
paulson@13299
   217
	(\<forall>x[M]. x\<in>A --> (\<forall>y z. M(y) --> M(z) --> P(x,y) & P(x,z) --> y=z))"
paulson@13223
   218
paulson@13223
   219
  replacement :: "[i=>o, [i,i]=>o] => o"
paulson@13223
   220
    "replacement(M,P) == 
paulson@13299
   221
      \<forall>A[M]. univalent(M,A,P) -->
paulson@13299
   222
      (\<exists>Y[M]. (\<forall>b[M]. ((\<exists>x[M]. x\<in>A & P(x,b)) --> b \<in> Y)))"
paulson@13223
   223
paulson@13223
   224
  strong_replacement :: "[i=>o, [i,i]=>o] => o"
paulson@13223
   225
    "strong_replacement(M,P) == 
paulson@13299
   226
      \<forall>A[M]. univalent(M,A,P) -->
paulson@13299
   227
      (\<exists>Y[M]. (\<forall>b[M]. (b \<in> Y <-> (\<exists>x[M]. x\<in>A & P(x,b)))))"
paulson@13223
   228
paulson@13223
   229
  foundation_ax :: "(i=>o) => o"
paulson@13223
   230
    "foundation_ax(M) == 
paulson@13299
   231
	\<forall>x[M]. (\<exists>y\<in>x. M(y))
paulson@13299
   232
                 --> (\<exists>y[M]. y\<in>x & ~(\<exists>z[M]. z\<in>x & z \<in> y))"
paulson@13223
   233
paulson@13223
   234
paulson@13223
   235
subsection{*A trivial consistency proof for $V_\omega$ *}
paulson@13223
   236
paulson@13223
   237
text{*We prove that $V_\omega$ 
paulson@13223
   238
      (or @{text univ} in Isabelle) satisfies some ZF axioms.
paulson@13223
   239
     Kunen, Theorem IV 3.13, page 123.*}
paulson@13223
   240
paulson@13223
   241
lemma univ0_downwards_mem: "[| y \<in> x; x \<in> univ(0) |] ==> y \<in> univ(0)"
paulson@13223
   242
apply (insert Transset_univ [OF Transset_0])  
paulson@13223
   243
apply (simp add: Transset_def, blast) 
paulson@13223
   244
done
paulson@13223
   245
paulson@13223
   246
lemma univ0_Ball_abs [simp]: 
paulson@13223
   247
     "A \<in> univ(0) ==> (\<forall>x\<in>A. x \<in> univ(0) --> P(x)) <-> (\<forall>x\<in>A. P(x))" 
paulson@13223
   248
by (blast intro: univ0_downwards_mem) 
paulson@13223
   249
paulson@13223
   250
lemma univ0_Bex_abs [simp]: 
paulson@13223
   251
     "A \<in> univ(0) ==> (\<exists>x\<in>A. x \<in> univ(0) & P(x)) <-> (\<exists>x\<in>A. P(x))" 
paulson@13223
   252
by (blast intro: univ0_downwards_mem) 
paulson@13223
   253
paulson@13223
   254
text{*Congruence rule for separation: can assume the variable is in @{text M}*}
paulson@13254
   255
lemma separation_cong [cong]:
paulson@13339
   256
     "(!!x. M(x) ==> P(x) <-> P'(x)) 
paulson@13339
   257
      ==> separation(M, %x. P(x)) <-> separation(M, %x. P'(x))"
paulson@13223
   258
by (simp add: separation_def) 
paulson@13223
   259
paulson@13223
   260
text{*Congruence rules for replacement*}
paulson@13254
   261
lemma univalent_cong [cong]:
paulson@13223
   262
     "[| A=A'; !!x y. [| x\<in>A; M(x); M(y) |] ==> P(x,y) <-> P'(x,y) |] 
paulson@13339
   263
      ==> univalent(M, A, %x y. P(x,y)) <-> univalent(M, A', %x y. P'(x,y))"
paulson@13223
   264
by (simp add: univalent_def) 
paulson@13223
   265
paulson@13254
   266
lemma strong_replacement_cong [cong]:
paulson@13223
   267
     "[| !!x y. [| M(x); M(y) |] ==> P(x,y) <-> P'(x,y) |] 
paulson@13339
   268
      ==> strong_replacement(M, %x y. P(x,y)) <-> 
paulson@13339
   269
          strong_replacement(M, %x y. P'(x,y))" 
paulson@13223
   270
by (simp add: strong_replacement_def) 
paulson@13223
   271
paulson@13223
   272
text{*The extensionality axiom*}
paulson@13223
   273
lemma "extensionality(\<lambda>x. x \<in> univ(0))"
paulson@13223
   274
apply (simp add: extensionality_def)
paulson@13223
   275
apply (blast intro: univ0_downwards_mem) 
paulson@13223
   276
done
paulson@13223
   277
paulson@13223
   278
text{*The separation axiom requires some lemmas*}
paulson@13223
   279
lemma Collect_in_Vfrom:
paulson@13223
   280
     "[| X \<in> Vfrom(A,j);  Transset(A) |] ==> Collect(X,P) \<in> Vfrom(A, succ(j))"
paulson@13223
   281
apply (drule Transset_Vfrom)
paulson@13223
   282
apply (rule subset_mem_Vfrom)
paulson@13223
   283
apply (unfold Transset_def, blast)
paulson@13223
   284
done
paulson@13223
   285
paulson@13223
   286
lemma Collect_in_VLimit:
paulson@13223
   287
     "[| X \<in> Vfrom(A,i);  Limit(i);  Transset(A) |] 
paulson@13223
   288
      ==> Collect(X,P) \<in> Vfrom(A,i)"
paulson@13223
   289
apply (rule Limit_VfromE, assumption+)
paulson@13223
   290
apply (blast intro: Limit_has_succ VfromI Collect_in_Vfrom)
paulson@13223
   291
done
paulson@13223
   292
paulson@13223
   293
lemma Collect_in_univ:
paulson@13223
   294
     "[| X \<in> univ(A);  Transset(A) |] ==> Collect(X,P) \<in> univ(A)"
paulson@13223
   295
by (simp add: univ_def Collect_in_VLimit Limit_nat)
paulson@13223
   296
paulson@13223
   297
lemma "separation(\<lambda>x. x \<in> univ(0), P)"
paulson@13290
   298
apply (simp add: separation_def, clarify) 
paulson@13339
   299
apply (rule_tac x = "Collect(z,P)" in bexI) 
paulson@13290
   300
apply (blast intro: Collect_in_univ Transset_0)+
paulson@13223
   301
done
paulson@13223
   302
paulson@13223
   303
text{*Unordered pairing axiom*}
paulson@13223
   304
lemma "upair_ax(\<lambda>x. x \<in> univ(0))"
paulson@13223
   305
apply (simp add: upair_ax_def upair_def)  
paulson@13223
   306
apply (blast intro: doubleton_in_univ) 
paulson@13223
   307
done
paulson@13223
   308
paulson@13223
   309
text{*Union axiom*}
paulson@13223
   310
lemma "Union_ax(\<lambda>x. x \<in> univ(0))"  
paulson@13299
   311
apply (simp add: Union_ax_def big_union_def, clarify) 
paulson@13299
   312
apply (rule_tac x="\<Union>x" in bexI)  
paulson@13299
   313
 apply (blast intro: univ0_downwards_mem)
paulson@13299
   314
apply (blast intro: Union_in_univ Transset_0) 
paulson@13223
   315
done
paulson@13223
   316
paulson@13223
   317
text{*Powerset axiom*}
paulson@13223
   318
paulson@13223
   319
lemma Pow_in_univ:
paulson@13223
   320
     "[| X \<in> univ(A);  Transset(A) |] ==> Pow(X) \<in> univ(A)"
paulson@13223
   321
apply (simp add: univ_def Pow_in_VLimit Limit_nat)
paulson@13223
   322
done
paulson@13223
   323
paulson@13223
   324
lemma "power_ax(\<lambda>x. x \<in> univ(0))"  
paulson@13299
   325
apply (simp add: power_ax_def powerset_def subset_def, clarify) 
paulson@13299
   326
apply (rule_tac x="Pow(x)" in bexI)
paulson@13299
   327
 apply (blast intro: univ0_downwards_mem)
paulson@13299
   328
apply (blast intro: Pow_in_univ Transset_0) 
paulson@13223
   329
done
paulson@13223
   330
paulson@13223
   331
text{*Foundation axiom*}
paulson@13223
   332
lemma "foundation_ax(\<lambda>x. x \<in> univ(0))"  
paulson@13223
   333
apply (simp add: foundation_ax_def, clarify)
paulson@13299
   334
apply (cut_tac A=x in foundation) 
paulson@13299
   335
apply (blast intro: univ0_downwards_mem)
paulson@13223
   336
done
paulson@13223
   337
paulson@13223
   338
lemma "replacement(\<lambda>x. x \<in> univ(0), P)"  
paulson@13223
   339
apply (simp add: replacement_def, clarify) 
paulson@13223
   340
oops
paulson@13223
   341
text{*no idea: maybe prove by induction on the rank of A?*}
paulson@13223
   342
paulson@13223
   343
text{*Still missing: Replacement, Choice*}
paulson@13223
   344
paulson@13223
   345
subsection{*lemmas needed to reduce some set constructions to instances
paulson@13223
   346
      of Separation*}
paulson@13223
   347
paulson@13223
   348
lemma image_iff_Collect: "r `` A = {y \<in> Union(Union(r)). \<exists>p\<in>r. \<exists>x\<in>A. p=<x,y>}"
paulson@13223
   349
apply (rule equalityI, auto) 
paulson@13223
   350
apply (simp add: Pair_def, blast) 
paulson@13223
   351
done
paulson@13223
   352
paulson@13223
   353
lemma vimage_iff_Collect:
paulson@13223
   354
     "r -`` A = {x \<in> Union(Union(r)). \<exists>p\<in>r. \<exists>y\<in>A. p=<x,y>}"
paulson@13223
   355
apply (rule equalityI, auto) 
paulson@13223
   356
apply (simp add: Pair_def, blast) 
paulson@13223
   357
done
paulson@13223
   358
paulson@13223
   359
text{*These two lemmas lets us prove @{text domain_closed} and 
paulson@13223
   360
      @{text range_closed} without new instances of separation*}
paulson@13223
   361
paulson@13223
   362
lemma domain_eq_vimage: "domain(r) = r -`` Union(Union(r))"
paulson@13223
   363
apply (rule equalityI, auto)
paulson@13223
   364
apply (rule vimageI, assumption)
paulson@13223
   365
apply (simp add: Pair_def, blast) 
paulson@13223
   366
done
paulson@13223
   367
paulson@13223
   368
lemma range_eq_image: "range(r) = r `` Union(Union(r))"
paulson@13223
   369
apply (rule equalityI, auto)
paulson@13223
   370
apply (rule imageI, assumption)
paulson@13223
   371
apply (simp add: Pair_def, blast) 
paulson@13223
   372
done
paulson@13223
   373
paulson@13223
   374
lemma replacementD:
paulson@13223
   375
    "[| replacement(M,P); M(A);  univalent(M,A,P) |]
paulson@13299
   376
     ==> \<exists>Y[M]. (\<forall>b[M]. ((\<exists>x[M]. x\<in>A & P(x,b)) --> b \<in> Y))"
paulson@13223
   377
by (simp add: replacement_def) 
paulson@13223
   378
paulson@13223
   379
lemma strong_replacementD:
paulson@13223
   380
    "[| strong_replacement(M,P); M(A);  univalent(M,A,P) |]
paulson@13299
   381
     ==> \<exists>Y[M]. (\<forall>b[M]. (b \<in> Y <-> (\<exists>x[M]. x\<in>A & P(x,b))))"
paulson@13223
   382
by (simp add: strong_replacement_def) 
paulson@13223
   383
paulson@13223
   384
lemma separationD:
paulson@13290
   385
    "[| separation(M,P); M(z) |] ==> \<exists>y[M]. \<forall>x[M]. x \<in> y <-> x \<in> z & P(x)"
paulson@13223
   386
by (simp add: separation_def) 
paulson@13223
   387
paulson@13223
   388
paulson@13223
   389
text{*More constants, for order types*}
paulson@13223
   390
constdefs
paulson@13223
   391
paulson@13223
   392
  order_isomorphism :: "[i=>o,i,i,i,i,i] => o"
paulson@13223
   393
    "order_isomorphism(M,A,r,B,s,f) == 
paulson@13223
   394
        bijection(M,A,B,f) & 
paulson@13306
   395
        (\<forall>x[M]. x\<in>A --> (\<forall>y[M]. y\<in>A -->
paulson@13306
   396
          (\<forall>p[M]. \<forall>fx[M]. \<forall>fy[M]. \<forall>q[M].
paulson@13223
   397
            pair(M,x,y,p) --> fun_apply(M,f,x,fx) --> fun_apply(M,f,y,fy) --> 
paulson@13306
   398
            pair(M,fx,fy,q) --> (p\<in>r <-> q\<in>s))))"
paulson@13223
   399
paulson@13223
   400
  pred_set :: "[i=>o,i,i,i,i] => o"
paulson@13223
   401
    "pred_set(M,A,x,r,B) == 
paulson@13299
   402
	\<forall>y[M]. y \<in> B <-> (\<exists>p[M]. p\<in>r & y \<in> A & pair(M,y,x,p))"
paulson@13223
   403
paulson@13223
   404
  membership :: "[i=>o,i,i] => o" --{*membership relation*}
paulson@13223
   405
    "membership(M,A,r) == 
paulson@13306
   406
	\<forall>p[M]. p \<in> r <-> (\<exists>x[M]. x\<in>A & (\<exists>y[M]. y\<in>A & x\<in>y & pair(M,x,y,p)))"
paulson@13223
   407
paulson@13223
   408
paulson@13223
   409
subsection{*Absoluteness for a transitive class model*}
paulson@13223
   410
paulson@13223
   411
text{*The class M is assumed to be transitive and to satisfy some
paulson@13223
   412
      relativized ZF axioms*}
paulson@13290
   413
locale M_triv_axioms =
paulson@13223
   414
  fixes M
paulson@13223
   415
  assumes transM:           "[| y\<in>x; M(x) |] ==> M(y)"
paulson@13223
   416
      and nonempty [simp]:  "M(0)"
paulson@13223
   417
      and upair_ax:	    "upair_ax(M)"
paulson@13223
   418
      and Union_ax:	    "Union_ax(M)"
paulson@13223
   419
      and power_ax:         "power_ax(M)"
paulson@13223
   420
      and replacement:      "replacement(M,P)"
paulson@13268
   421
      and M_nat [iff]:      "M(nat)"           (*i.e. the axiom of infinity*)
paulson@13290
   422
paulson@13290
   423
lemma (in M_triv_axioms) ball_abs [simp]: 
paulson@13290
   424
     "M(A) ==> (\<forall>x\<in>A. M(x) --> P(x)) <-> (\<forall>x\<in>A. P(x))" 
paulson@13290
   425
by (blast intro: transM) 
paulson@13290
   426
paulson@13290
   427
lemma (in M_triv_axioms) rall_abs [simp]: 
paulson@13290
   428
     "M(A) ==> (\<forall>x[M]. x\<in>A --> P(x)) <-> (\<forall>x\<in>A. P(x))" 
paulson@13290
   429
by (blast intro: transM) 
paulson@13290
   430
paulson@13290
   431
lemma (in M_triv_axioms) bex_abs [simp]: 
paulson@13290
   432
     "M(A) ==> (\<exists>x\<in>A. M(x) & P(x)) <-> (\<exists>x\<in>A. P(x))" 
paulson@13290
   433
by (blast intro: transM) 
paulson@13290
   434
paulson@13290
   435
lemma (in M_triv_axioms) rex_abs [simp]: 
paulson@13290
   436
     "M(A) ==> (\<exists>x[M]. x\<in>A & P(x)) <-> (\<exists>x\<in>A. P(x))" 
paulson@13290
   437
by (blast intro: transM) 
paulson@13290
   438
paulson@13290
   439
lemma (in M_triv_axioms) ball_iff_equiv: 
paulson@13299
   440
     "M(A) ==> (\<forall>x[M]. (x\<in>A <-> P(x))) <-> 
paulson@13290
   441
               (\<forall>x\<in>A. P(x)) & (\<forall>x. P(x) --> M(x) --> x\<in>A)" 
paulson@13290
   442
by (blast intro: transM)
paulson@13290
   443
paulson@13290
   444
text{*Simplifies proofs of equalities when there's an iff-equality
paulson@13290
   445
      available for rewriting, universally quantified over M. *}
paulson@13290
   446
lemma (in M_triv_axioms) M_equalityI: 
paulson@13290
   447
     "[| !!x. M(x) ==> x\<in>A <-> x\<in>B; M(A); M(B) |] ==> A=B"
paulson@13290
   448
by (blast intro!: equalityI dest: transM) 
paulson@13290
   449
paulson@13290
   450
lemma (in M_triv_axioms) empty_abs [simp]: 
paulson@13290
   451
     "M(z) ==> empty(M,z) <-> z=0"
paulson@13290
   452
apply (simp add: empty_def)
paulson@13290
   453
apply (blast intro: transM) 
paulson@13290
   454
done
paulson@13290
   455
paulson@13290
   456
lemma (in M_triv_axioms) subset_abs [simp]: 
paulson@13290
   457
     "M(A) ==> subset(M,A,B) <-> A \<subseteq> B"
paulson@13290
   458
apply (simp add: subset_def) 
paulson@13290
   459
apply (blast intro: transM) 
paulson@13290
   460
done
paulson@13290
   461
paulson@13290
   462
lemma (in M_triv_axioms) upair_abs [simp]: 
paulson@13290
   463
     "M(z) ==> upair(M,a,b,z) <-> z={a,b}"
paulson@13290
   464
apply (simp add: upair_def) 
paulson@13290
   465
apply (blast intro: transM) 
paulson@13290
   466
done
paulson@13290
   467
paulson@13290
   468
lemma (in M_triv_axioms) upair_in_M_iff [iff]:
paulson@13290
   469
     "M({a,b}) <-> M(a) & M(b)"
paulson@13290
   470
apply (insert upair_ax, simp add: upair_ax_def) 
paulson@13290
   471
apply (blast intro: transM) 
paulson@13290
   472
done
paulson@13290
   473
paulson@13290
   474
lemma (in M_triv_axioms) singleton_in_M_iff [iff]:
paulson@13290
   475
     "M({a}) <-> M(a)"
paulson@13290
   476
by (insert upair_in_M_iff [of a a], simp) 
paulson@13290
   477
paulson@13290
   478
lemma (in M_triv_axioms) pair_abs [simp]: 
paulson@13290
   479
     "M(z) ==> pair(M,a,b,z) <-> z=<a,b>"
paulson@13290
   480
apply (simp add: pair_def ZF.Pair_def)
paulson@13290
   481
apply (blast intro: transM) 
paulson@13290
   482
done
paulson@13290
   483
paulson@13290
   484
lemma (in M_triv_axioms) pair_in_M_iff [iff]:
paulson@13290
   485
     "M(<a,b>) <-> M(a) & M(b)"
paulson@13290
   486
by (simp add: ZF.Pair_def)
paulson@13290
   487
paulson@13290
   488
lemma (in M_triv_axioms) pair_components_in_M:
paulson@13290
   489
     "[| <x,y> \<in> A; M(A) |] ==> M(x) & M(y)"
paulson@13290
   490
apply (simp add: Pair_def)
paulson@13290
   491
apply (blast dest: transM) 
paulson@13290
   492
done
paulson@13290
   493
paulson@13290
   494
lemma (in M_triv_axioms) cartprod_abs [simp]: 
paulson@13290
   495
     "[| M(A); M(B); M(z) |] ==> cartprod(M,A,B,z) <-> z = A*B"
paulson@13290
   496
apply (simp add: cartprod_def)
paulson@13290
   497
apply (rule iffI) 
paulson@13290
   498
 apply (blast intro!: equalityI intro: transM dest!: rspec) 
paulson@13290
   499
apply (blast dest: transM) 
paulson@13290
   500
done
paulson@13290
   501
paulson@13290
   502
lemma (in M_triv_axioms) union_abs [simp]: 
paulson@13290
   503
     "[| M(a); M(b); M(z) |] ==> union(M,a,b,z) <-> z = a Un b"
paulson@13290
   504
apply (simp add: union_def) 
paulson@13290
   505
apply (blast intro: transM) 
paulson@13290
   506
done
paulson@13290
   507
paulson@13290
   508
lemma (in M_triv_axioms) inter_abs [simp]: 
paulson@13290
   509
     "[| M(a); M(b); M(z) |] ==> inter(M,a,b,z) <-> z = a Int b"
paulson@13290
   510
apply (simp add: inter_def) 
paulson@13290
   511
apply (blast intro: transM) 
paulson@13290
   512
done
paulson@13290
   513
paulson@13290
   514
lemma (in M_triv_axioms) setdiff_abs [simp]: 
paulson@13290
   515
     "[| M(a); M(b); M(z) |] ==> setdiff(M,a,b,z) <-> z = a-b"
paulson@13290
   516
apply (simp add: setdiff_def) 
paulson@13290
   517
apply (blast intro: transM) 
paulson@13290
   518
done
paulson@13290
   519
paulson@13290
   520
lemma (in M_triv_axioms) Union_abs [simp]: 
paulson@13290
   521
     "[| M(A); M(z) |] ==> big_union(M,A,z) <-> z = Union(A)"
paulson@13290
   522
apply (simp add: big_union_def) 
paulson@13290
   523
apply (blast intro!: equalityI dest: transM) 
paulson@13290
   524
done
paulson@13290
   525
paulson@13290
   526
lemma (in M_triv_axioms) Union_closed [intro,simp]:
paulson@13290
   527
     "M(A) ==> M(Union(A))"
paulson@13290
   528
by (insert Union_ax, simp add: Union_ax_def) 
paulson@13290
   529
paulson@13290
   530
lemma (in M_triv_axioms) Un_closed [intro,simp]:
paulson@13290
   531
     "[| M(A); M(B) |] ==> M(A Un B)"
paulson@13290
   532
by (simp only: Un_eq_Union, blast) 
paulson@13290
   533
paulson@13290
   534
lemma (in M_triv_axioms) cons_closed [intro,simp]:
paulson@13290
   535
     "[| M(a); M(A) |] ==> M(cons(a,A))"
paulson@13290
   536
by (subst cons_eq [symmetric], blast) 
paulson@13290
   537
paulson@13306
   538
lemma (in M_triv_axioms) cons_abs [simp]: 
paulson@13306
   539
     "[| M(b); M(z) |] ==> is_cons(M,a,b,z) <-> z = cons(a,b)"
paulson@13306
   540
by (simp add: is_cons_def, blast intro: transM)  
paulson@13306
   541
paulson@13290
   542
lemma (in M_triv_axioms) successor_abs [simp]: 
paulson@13306
   543
     "[| M(a); M(z) |] ==> successor(M,a,z) <-> z = succ(a)"
paulson@13290
   544
by (simp add: successor_def, blast)  
paulson@13290
   545
paulson@13290
   546
lemma (in M_triv_axioms) succ_in_M_iff [iff]:
paulson@13290
   547
     "M(succ(a)) <-> M(a)"
paulson@13290
   548
apply (simp add: succ_def) 
paulson@13290
   549
apply (blast intro: transM) 
paulson@13290
   550
done
paulson@13290
   551
paulson@13290
   552
lemma (in M_triv_axioms) separation_closed [intro,simp]:
paulson@13290
   553
     "[| separation(M,P); M(A) |] ==> M(Collect(A,P))"
paulson@13290
   554
apply (insert separation, simp add: separation_def) 
paulson@13290
   555
apply (drule rspec, assumption, clarify) 
paulson@13290
   556
apply (subgoal_tac "y = Collect(A,P)", blast)
paulson@13290
   557
apply (blast dest: transM) 
paulson@13290
   558
done
paulson@13290
   559
paulson@13290
   560
text{*Probably the premise and conclusion are equivalent*}
paulson@13348
   561
lemma (in M_triv_axioms) strong_replacementI [rule_format]:
paulson@13306
   562
    "[| \<forall>A[M]. separation(M, %u. \<exists>x[M]. x\<in>A & P(x,u)) |]
paulson@13290
   563
     ==> strong_replacement(M,P)"
paulson@13290
   564
apply (simp add: strong_replacement_def, clarify) 
paulson@13290
   565
apply (frule replacementD [OF replacement], assumption, clarify) 
paulson@13299
   566
apply (drule_tac x=A in rspec, clarify)  
paulson@13290
   567
apply (drule_tac z=Y in separationD, assumption, clarify) 
paulson@13299
   568
apply (rule_tac x=y in rexI) 
paulson@13299
   569
apply (blast dest: transM)+
paulson@13290
   570
done
paulson@13290
   571
paulson@13290
   572
paulson@13290
   573
(*The last premise expresses that P takes M to M*)
paulson@13290
   574
lemma (in M_triv_axioms) strong_replacement_closed [intro,simp]:
paulson@13290
   575
     "[| strong_replacement(M,P); M(A); univalent(M,A,P); 
paulson@13290
   576
       !!x y. [| x\<in>A; P(x,y); M(x) |] ==> M(y) |] ==> M(Replace(A,P))"
paulson@13290
   577
apply (simp add: strong_replacement_def) 
paulson@13299
   578
apply (drule rspec, auto) 
paulson@13290
   579
apply (subgoal_tac "Replace(A,P) = Y")
paulson@13290
   580
 apply simp 
paulson@13290
   581
apply (rule equality_iffI) 
paulson@13290
   582
apply (simp add: Replace_iff, safe)
paulson@13290
   583
 apply (blast dest: transM) 
paulson@13290
   584
apply (frule transM, assumption) 
paulson@13290
   585
 apply (simp add: univalent_def)
paulson@13299
   586
 apply (drule rspec [THEN iffD1], assumption, assumption)
paulson@13290
   587
 apply (blast dest: transM) 
paulson@13290
   588
done
paulson@13290
   589
paulson@13290
   590
(*The first premise can't simply be assumed as a schema.
paulson@13290
   591
  It is essential to take care when asserting instances of Replacement.
paulson@13290
   592
  Let K be a nonconstructible subset of nat and define
paulson@13290
   593
  f(x) = x if x:K and f(x)=0 otherwise.  Then RepFun(nat,f) = cons(0,K), a 
paulson@13290
   594
  nonconstructible set.  So we cannot assume that M(X) implies M(RepFun(X,f))
paulson@13290
   595
  even for f : M -> M.
paulson@13290
   596
*)
paulson@13353
   597
lemma (in M_triv_axioms) RepFun_closed:
paulson@13290
   598
     "[| strong_replacement(M, \<lambda>x y. y = f(x)); M(A); \<forall>x\<in>A. M(f(x)) |]
paulson@13290
   599
      ==> M(RepFun(A,f))"
paulson@13290
   600
apply (simp add: RepFun_def) 
paulson@13290
   601
apply (rule strong_replacement_closed) 
paulson@13290
   602
apply (auto dest: transM  simp add: univalent_def) 
paulson@13290
   603
done
paulson@13290
   604
paulson@13353
   605
lemma Replace_conj_eq: "{y . x \<in> A, x\<in>A & y=f(x)} = {y . x\<in>A, y=f(x)}"
paulson@13353
   606
by simp
paulson@13353
   607
paulson@13353
   608
text{*Better than @{text RepFun_closed} when having the formula @{term "x\<in>A"}
paulson@13353
   609
      makes relativization easier.*}
paulson@13353
   610
lemma (in M_triv_axioms) RepFun_closed2:
paulson@13353
   611
     "[| strong_replacement(M, \<lambda>x y. x\<in>A & y = f(x)); M(A); \<forall>x\<in>A. M(f(x)) |]
paulson@13353
   612
      ==> M(RepFun(A, %x. f(x)))"
paulson@13353
   613
apply (simp add: RepFun_def)
paulson@13353
   614
apply (frule strong_replacement_closed, assumption)
paulson@13353
   615
apply (auto dest: transM  simp add: Replace_conj_eq univalent_def) 
paulson@13353
   616
done
paulson@13353
   617
paulson@13290
   618
lemma (in M_triv_axioms) lam_closed [intro,simp]:
paulson@13290
   619
     "[| strong_replacement(M, \<lambda>x y. y = <x,b(x)>); M(A); \<forall>x\<in>A. M(b(x)) |]
paulson@13290
   620
      ==> M(\<lambda>x\<in>A. b(x))"
paulson@13353
   621
by (simp add: lam_def, blast intro: RepFun_closed dest: transM) 
paulson@13290
   622
paulson@13290
   623
lemma (in M_triv_axioms) image_abs [simp]: 
paulson@13290
   624
     "[| M(r); M(A); M(z) |] ==> image(M,r,A,z) <-> z = r``A"
paulson@13290
   625
apply (simp add: image_def)
paulson@13290
   626
apply (rule iffI) 
paulson@13290
   627
 apply (blast intro!: equalityI dest: transM, blast) 
paulson@13290
   628
done
paulson@13290
   629
paulson@13290
   630
text{*What about @{text Pow_abs}?  Powerset is NOT absolute!
paulson@13290
   631
      This result is one direction of absoluteness.*}
paulson@13290
   632
paulson@13290
   633
lemma (in M_triv_axioms) powerset_Pow: 
paulson@13290
   634
     "powerset(M, x, Pow(x))"
paulson@13290
   635
by (simp add: powerset_def)
paulson@13290
   636
paulson@13290
   637
text{*But we can't prove that the powerset in @{text M} includes the
paulson@13290
   638
      real powerset.*}
paulson@13290
   639
lemma (in M_triv_axioms) powerset_imp_subset_Pow: 
paulson@13290
   640
     "[| powerset(M,x,y); M(y) |] ==> y <= Pow(x)"
paulson@13290
   641
apply (simp add: powerset_def) 
paulson@13290
   642
apply (blast dest: transM) 
paulson@13290
   643
done
paulson@13290
   644
paulson@13290
   645
lemma (in M_triv_axioms) nat_into_M [intro]:
paulson@13290
   646
     "n \<in> nat ==> M(n)"
paulson@13290
   647
by (induct n rule: nat_induct, simp_all)
paulson@13290
   648
paulson@13350
   649
lemma (in M_triv_axioms) nat_case_closed [intro,simp]:
paulson@13290
   650
  "[|M(k); M(a); \<forall>m[M]. M(b(m))|] ==> M(nat_case(a,b,k))"
paulson@13290
   651
apply (case_tac "k=0", simp) 
paulson@13290
   652
apply (case_tac "\<exists>m. k = succ(m)", force)
paulson@13290
   653
apply (simp add: nat_case_def) 
paulson@13290
   654
done
paulson@13290
   655
paulson@13350
   656
lemma (in M_triv_axioms) quasinat_abs [simp]: 
paulson@13350
   657
     "M(z) ==> is_quasinat(M,z) <-> quasinat(z)"
paulson@13350
   658
by (auto simp add: is_quasinat_def quasinat_def)
paulson@13350
   659
paulson@13350
   660
lemma (in M_triv_axioms) nat_case_abs [simp]: 
paulson@13353
   661
     "[| relativize1(M,is_b,b); M(k); M(z) |] 
paulson@13353
   662
      ==> is_nat_case(M,a,is_b,k,z) <-> z = nat_case(a,b,k)"
paulson@13350
   663
apply (case_tac "quasinat(k)") 
paulson@13350
   664
 prefer 2 
paulson@13350
   665
 apply (simp add: is_nat_case_def non_nat_case) 
paulson@13350
   666
 apply (force simp add: quasinat_def) 
paulson@13350
   667
apply (simp add: quasinat_def is_nat_case_def)
paulson@13350
   668
apply (elim disjE exE) 
paulson@13353
   669
 apply (simp_all add: relativize1_def) 
paulson@13350
   670
done
paulson@13350
   671
paulson@13353
   672
(*Needed?  surely better to replace is_nat_case by nat_case?*)
paulson@13352
   673
lemma (in M_triv_axioms) is_nat_case_cong [cong]:
paulson@13352
   674
     "[| a = a'; k = k';  z = z';  M(z');
paulson@13352
   675
       !!x y. [| M(x); M(y) |] ==> is_b(x,y) <-> is_b'(x,y) |]
paulson@13352
   676
      ==> is_nat_case(M, a, is_b, k, z) <-> is_nat_case(M, a', is_b', k', z')"
paulson@13352
   677
by (simp add: is_nat_case_def) 
paulson@13352
   678
paulson@13290
   679
lemma (in M_triv_axioms) Inl_in_M_iff [iff]:
paulson@13290
   680
     "M(Inl(a)) <-> M(a)"
paulson@13290
   681
by (simp add: Inl_def) 
paulson@13290
   682
paulson@13290
   683
lemma (in M_triv_axioms) Inr_in_M_iff [iff]:
paulson@13290
   684
     "M(Inr(a)) <-> M(a)"
paulson@13290
   685
by (simp add: Inr_def)
paulson@13290
   686
paulson@13290
   687
paulson@13290
   688
subsection{*Absoluteness for ordinals*}
paulson@13290
   689
text{*These results constitute Theorem IV 5.1 of Kunen (page 126).*}
paulson@13290
   690
paulson@13290
   691
lemma (in M_triv_axioms) lt_closed:
paulson@13290
   692
     "[| j<i; M(i) |] ==> M(j)" 
paulson@13290
   693
by (blast dest: ltD intro: transM) 
paulson@13290
   694
paulson@13290
   695
lemma (in M_triv_axioms) transitive_set_abs [simp]: 
paulson@13290
   696
     "M(a) ==> transitive_set(M,a) <-> Transset(a)"
paulson@13290
   697
by (simp add: transitive_set_def Transset_def)
paulson@13290
   698
paulson@13290
   699
lemma (in M_triv_axioms) ordinal_abs [simp]: 
paulson@13290
   700
     "M(a) ==> ordinal(M,a) <-> Ord(a)"
paulson@13290
   701
by (simp add: ordinal_def Ord_def)
paulson@13290
   702
paulson@13290
   703
lemma (in M_triv_axioms) limit_ordinal_abs [simp]: 
paulson@13290
   704
     "M(a) ==> limit_ordinal(M,a) <-> Limit(a)"
paulson@13290
   705
apply (simp add: limit_ordinal_def Ord_0_lt_iff Limit_def) 
paulson@13290
   706
apply (simp add: lt_def, blast) 
paulson@13290
   707
done
paulson@13290
   708
paulson@13290
   709
lemma (in M_triv_axioms) successor_ordinal_abs [simp]: 
paulson@13299
   710
     "M(a) ==> successor_ordinal(M,a) <-> Ord(a) & (\<exists>b[M]. a = succ(b))"
paulson@13290
   711
apply (simp add: successor_ordinal_def, safe)
paulson@13290
   712
apply (drule Ord_cases_disj, auto) 
paulson@13290
   713
done
paulson@13290
   714
paulson@13290
   715
lemma finite_Ord_is_nat:
paulson@13290
   716
      "[| Ord(a); ~ Limit(a); \<forall>x\<in>a. ~ Limit(x) |] ==> a \<in> nat"
paulson@13290
   717
by (induct a rule: trans_induct3, simp_all)
paulson@13290
   718
paulson@13290
   719
lemma naturals_not_limit: "a \<in> nat ==> ~ Limit(a)"
paulson@13290
   720
by (induct a rule: nat_induct, auto)
paulson@13290
   721
paulson@13290
   722
lemma (in M_triv_axioms) finite_ordinal_abs [simp]: 
paulson@13290
   723
     "M(a) ==> finite_ordinal(M,a) <-> a \<in> nat"
paulson@13290
   724
apply (simp add: finite_ordinal_def)
paulson@13290
   725
apply (blast intro: finite_Ord_is_nat intro: nat_into_Ord 
paulson@13290
   726
             dest: Ord_trans naturals_not_limit)
paulson@13290
   727
done
paulson@13290
   728
paulson@13290
   729
lemma Limit_non_Limit_implies_nat:
paulson@13290
   730
     "[| Limit(a); \<forall>x\<in>a. ~ Limit(x) |] ==> a = nat"
paulson@13290
   731
apply (rule le_anti_sym) 
paulson@13290
   732
apply (rule all_lt_imp_le, blast, blast intro: Limit_is_Ord)  
paulson@13290
   733
 apply (simp add: lt_def)  
paulson@13290
   734
 apply (blast intro: Ord_in_Ord Ord_trans finite_Ord_is_nat) 
paulson@13290
   735
apply (erule nat_le_Limit)
paulson@13290
   736
done
paulson@13290
   737
paulson@13290
   738
lemma (in M_triv_axioms) omega_abs [simp]: 
paulson@13290
   739
     "M(a) ==> omega(M,a) <-> a = nat"
paulson@13290
   740
apply (simp add: omega_def) 
paulson@13290
   741
apply (blast intro: Limit_non_Limit_implies_nat dest: naturals_not_limit)
paulson@13290
   742
done
paulson@13290
   743
paulson@13290
   744
lemma (in M_triv_axioms) number1_abs [simp]: 
paulson@13290
   745
     "M(a) ==> number1(M,a) <-> a = 1"
paulson@13290
   746
by (simp add: number1_def) 
paulson@13290
   747
paulson@13290
   748
lemma (in M_triv_axioms) number1_abs [simp]: 
paulson@13290
   749
     "M(a) ==> number2(M,a) <-> a = succ(1)"
paulson@13290
   750
by (simp add: number2_def) 
paulson@13290
   751
paulson@13290
   752
lemma (in M_triv_axioms) number3_abs [simp]: 
paulson@13290
   753
     "M(a) ==> number3(M,a) <-> a = succ(succ(1))"
paulson@13290
   754
by (simp add: number3_def) 
paulson@13290
   755
paulson@13290
   756
text{*Kunen continued to 20...*}
paulson@13290
   757
paulson@13290
   758
(*Could not get this to work.  The \<lambda>x\<in>nat is essential because everything 
paulson@13290
   759
  but the recursion variable must stay unchanged.  But then the recursion
paulson@13290
   760
  equations only hold for x\<in>nat (or in some other set) and not for the 
paulson@13290
   761
  whole of the class M.
paulson@13290
   762
  consts
paulson@13290
   763
    natnumber_aux :: "[i=>o,i] => i"
paulson@13290
   764
paulson@13290
   765
  primrec
paulson@13290
   766
      "natnumber_aux(M,0) = (\<lambda>x\<in>nat. if empty(M,x) then 1 else 0)"
paulson@13290
   767
      "natnumber_aux(M,succ(n)) = 
paulson@13299
   768
	   (\<lambda>x\<in>nat. if (\<exists>y[M]. natnumber_aux(M,n)`y=1 & successor(M,y,x)) 
paulson@13290
   769
		     then 1 else 0)"
paulson@13290
   770
paulson@13290
   771
  constdefs
paulson@13290
   772
    natnumber :: "[i=>o,i,i] => o"
paulson@13290
   773
      "natnumber(M,n,x) == natnumber_aux(M,n)`x = 1"
paulson@13290
   774
paulson@13290
   775
  lemma (in M_triv_axioms) [simp]: 
paulson@13290
   776
       "natnumber(M,0,x) == x=0"
paulson@13290
   777
*)
paulson@13290
   778
paulson@13290
   779
subsection{*Some instances of separation and strong replacement*}
paulson@13290
   780
paulson@13290
   781
locale M_axioms = M_triv_axioms +
paulson@13290
   782
assumes Inter_separation:
paulson@13268
   783
     "M(A) ==> separation(M, \<lambda>x. \<forall>y[M]. y\<in>A --> x\<in>y)"
paulson@13223
   784
  and cartprod_separation:
paulson@13223
   785
     "[| M(A); M(B) |] 
paulson@13298
   786
      ==> separation(M, \<lambda>z. \<exists>x[M]. x\<in>A & (\<exists>y[M]. y\<in>B & pair(M,x,y,z)))"
paulson@13223
   787
  and image_separation:
paulson@13223
   788
     "[| M(A); M(r) |] 
paulson@13268
   789
      ==> separation(M, \<lambda>y. \<exists>p[M]. p\<in>r & (\<exists>x[M]. x\<in>A & pair(M,x,y,p)))"
paulson@13223
   790
  and converse_separation:
paulson@13298
   791
     "M(r) ==> separation(M, 
paulson@13298
   792
         \<lambda>z. \<exists>p[M]. p\<in>r & (\<exists>x[M]. \<exists>y[M]. pair(M,x,y,p) & pair(M,y,x,z)))"
paulson@13223
   793
  and restrict_separation:
paulson@13268
   794
     "M(A) ==> separation(M, \<lambda>z. \<exists>x[M]. x\<in>A & (\<exists>y[M]. pair(M,x,y,z)))"
paulson@13223
   795
  and comp_separation:
paulson@13223
   796
     "[| M(r); M(s) |]
paulson@13268
   797
      ==> separation(M, \<lambda>xz. \<exists>x[M]. \<exists>y[M]. \<exists>z[M]. \<exists>xy[M]. \<exists>yz[M]. 
paulson@13268
   798
		  pair(M,x,z,xz) & pair(M,x,y,xy) & pair(M,y,z,yz) & 
paulson@13268
   799
                  xy\<in>s & yz\<in>r)"
paulson@13223
   800
  and pred_separation:
paulson@13298
   801
     "[| M(r); M(x) |] ==> separation(M, \<lambda>y. \<exists>p[M]. p\<in>r & pair(M,y,x,p))"
paulson@13223
   802
  and Memrel_separation:
paulson@13298
   803
     "separation(M, \<lambda>z. \<exists>x[M]. \<exists>y[M]. pair(M,x,y,z) & x \<in> y)"
paulson@13268
   804
  and funspace_succ_replacement:
paulson@13268
   805
     "M(n) ==> 
paulson@13306
   806
      strong_replacement(M, \<lambda>p z. \<exists>f[M]. \<exists>b[M]. \<exists>nb[M]. \<exists>cnbf[M]. 
paulson@13306
   807
                pair(M,f,b,p) & pair(M,n,b,nb) & is_cons(M,nb,f,cnbf) &
paulson@13306
   808
                upair(M,cnbf,cnbf,z))"
paulson@13223
   809
  and well_ord_iso_separation:
paulson@13223
   810
     "[| M(A); M(f); M(r) |] 
paulson@13299
   811
      ==> separation (M, \<lambda>x. x\<in>A --> (\<exists>y[M]. (\<exists>p[M]. 
paulson@13245
   812
		     fun_apply(M,f,x,y) & pair(M,y,x,p) & p \<in> r)))"
paulson@13306
   813
  and obase_separation:
paulson@13306
   814
     --{*part of the order type formalization*}
paulson@13306
   815
     "[| M(A); M(r) |] 
paulson@13306
   816
      ==> separation(M, \<lambda>a. \<exists>x[M]. \<exists>g[M]. \<exists>mx[M]. \<exists>par[M]. 
paulson@13306
   817
	     ordinal(M,x) & membership(M,x,mx) & pred_set(M,A,a,r,par) &
paulson@13306
   818
	     order_isomorphism(M,par,r,x,mx,g))"
paulson@13223
   819
  and obase_equals_separation:
paulson@13223
   820
     "[| M(A); M(r) |] 
paulson@13316
   821
      ==> separation (M, \<lambda>x. x\<in>A --> ~(\<exists>y[M]. \<exists>g[M]. 
paulson@13316
   822
			      ordinal(M,y) & (\<exists>my[M]. \<exists>pxr[M]. 
paulson@13316
   823
			      membership(M,y,my) & pred_set(M,A,x,r,pxr) &
paulson@13316
   824
			      order_isomorphism(M,pxr,r,y,my,g))))"
paulson@13306
   825
  and omap_replacement:
paulson@13306
   826
     "[| M(A); M(r) |] 
paulson@13306
   827
      ==> strong_replacement(M,
paulson@13306
   828
             \<lambda>a z. \<exists>x[M]. \<exists>g[M]. \<exists>mx[M]. \<exists>par[M]. 
paulson@13306
   829
	     ordinal(M,x) & pair(M,a,x,z) & membership(M,x,mx) & 
paulson@13306
   830
	     pred_set(M,A,a,r,par) & order_isomorphism(M,par,r,x,mx,g))"
paulson@13223
   831
  and is_recfun_separation:
paulson@13319
   832
     --{*for well-founded recursion*}
paulson@13319
   833
     "[| M(r); M(f); M(g); M(a); M(b) |] 
paulson@13319
   834
     ==> separation(M, 
paulson@13319
   835
            \<lambda>x. \<exists>xa[M]. \<exists>xb[M]. 
paulson@13319
   836
                pair(M,x,a,xa) & xa \<in> r & pair(M,x,b,xb) & xb \<in> r & 
paulson@13319
   837
                (\<exists>fx[M]. \<exists>gx[M]. fun_apply(M,f,x,fx) & fun_apply(M,g,x,gx) & 
paulson@13319
   838
                                   fx \<noteq> gx))"
paulson@13223
   839
paulson@13223
   840
lemma (in M_axioms) cartprod_iff_lemma:
paulson@13254
   841
     "[| M(C);  \<forall>u[M]. u \<in> C <-> (\<exists>x\<in>A. \<exists>y\<in>B. u = {{x}, {x,y}}); 
paulson@13254
   842
         powerset(M, A \<union> B, p1); powerset(M, p1, p2);  M(p2) |]
paulson@13223
   843
       ==> C = {u \<in> p2 . \<exists>x\<in>A. \<exists>y\<in>B. u = {{x}, {x,y}}}"
paulson@13223
   844
apply (simp add: powerset_def) 
paulson@13254
   845
apply (rule equalityI, clarify, simp)
paulson@13254
   846
 apply (frule transM, assumption) 
paulson@13223
   847
 apply (frule transM, assumption, simp) 
paulson@13223
   848
 apply blast 
paulson@13223
   849
apply clarify
paulson@13223
   850
apply (frule transM, assumption, force) 
paulson@13223
   851
done
paulson@13223
   852
paulson@13223
   853
lemma (in M_axioms) cartprod_iff:
paulson@13223
   854
     "[| M(A); M(B); M(C) |] 
paulson@13223
   855
      ==> cartprod(M,A,B,C) <-> 
paulson@13223
   856
          (\<exists>p1 p2. M(p1) & M(p2) & powerset(M,A Un B,p1) & powerset(M,p1,p2) &
paulson@13223
   857
                   C = {z \<in> p2. \<exists>x\<in>A. \<exists>y\<in>B. z = <x,y>})"
paulson@13223
   858
apply (simp add: Pair_def cartprod_def, safe)
paulson@13223
   859
defer 1 
paulson@13223
   860
  apply (simp add: powerset_def) 
paulson@13223
   861
 apply blast 
paulson@13223
   862
txt{*Final, difficult case: the left-to-right direction of the theorem.*}
paulson@13223
   863
apply (insert power_ax, simp add: power_ax_def) 
paulson@13299
   864
apply (frule_tac x="A Un B" and P="\<lambda>x. rex(M,?Q(x))" in rspec) 
paulson@13299
   865
apply (blast, clarify) 
paulson@13299
   866
apply (drule_tac x=z and P="\<lambda>x. rex(M,?Q(x))" in rspec)
paulson@13299
   867
apply assumption
paulson@13223
   868
apply (blast intro: cartprod_iff_lemma) 
paulson@13223
   869
done
paulson@13223
   870
paulson@13223
   871
lemma (in M_axioms) cartprod_closed_lemma:
paulson@13299
   872
     "[| M(A); M(B) |] ==> \<exists>C[M]. cartprod(M,A,B,C)"
paulson@13223
   873
apply (simp del: cartprod_abs add: cartprod_iff)
paulson@13223
   874
apply (insert power_ax, simp add: power_ax_def) 
paulson@13299
   875
apply (frule_tac x="A Un B" and P="\<lambda>x. rex(M,?Q(x))" in rspec) 
paulson@13299
   876
apply (blast, clarify) 
paulson@13299
   877
apply (drule_tac x=z and P="\<lambda>x. rex(M,?Q(x))" in rspec) 
paulson@13299
   878
apply (blast, clarify)
paulson@13299
   879
apply (intro rexI exI conjI) 
paulson@13299
   880
prefer 5 apply (rule refl) 
paulson@13299
   881
prefer 3 apply assumption
paulson@13299
   882
prefer 3 apply assumption
paulson@13245
   883
apply (insert cartprod_separation [of A B], auto)
paulson@13223
   884
done
paulson@13223
   885
paulson@13223
   886
text{*All the lemmas above are necessary because Powerset is not absolute.
paulson@13223
   887
      I should have used Replacement instead!*}
paulson@13245
   888
lemma (in M_axioms) cartprod_closed [intro,simp]: 
paulson@13223
   889
     "[| M(A); M(B) |] ==> M(A*B)"
paulson@13223
   890
by (frule cartprod_closed_lemma, assumption, force)
paulson@13223
   891
paulson@13268
   892
lemma (in M_axioms) sum_closed [intro,simp]: 
paulson@13268
   893
     "[| M(A); M(B) |] ==> M(A+B)"
paulson@13268
   894
by (simp add: sum_def)
paulson@13268
   895
paulson@13350
   896
lemma (in M_axioms) sum_abs [simp]:
paulson@13350
   897
     "[| M(A); M(B); M(Z) |] ==> is_sum(M,A,B,Z) <-> (Z = A+B)"
paulson@13350
   898
by (simp add: is_sum_def sum_def singleton_0 nat_into_M)
paulson@13350
   899
paulson@13290
   900
paulson@13290
   901
subsubsection {*converse of a relation*}
paulson@13290
   902
paulson@13290
   903
lemma (in M_axioms) M_converse_iff:
paulson@13290
   904
     "M(r) ==> 
paulson@13290
   905
      converse(r) = 
paulson@13290
   906
      {z \<in> Union(Union(r)) * Union(Union(r)). 
paulson@13290
   907
       \<exists>p\<in>r. \<exists>x[M]. \<exists>y[M]. p = \<langle>x,y\<rangle> & z = \<langle>y,x\<rangle>}"
paulson@13290
   908
apply (rule equalityI)
paulson@13290
   909
 prefer 2 apply (blast dest: transM, clarify, simp) 
paulson@13290
   910
apply (simp add: Pair_def) 
paulson@13290
   911
apply (blast dest: transM) 
paulson@13290
   912
done
paulson@13290
   913
paulson@13290
   914
lemma (in M_axioms) converse_closed [intro,simp]: 
paulson@13290
   915
     "M(r) ==> M(converse(r))"
paulson@13290
   916
apply (simp add: M_converse_iff)
paulson@13290
   917
apply (insert converse_separation [of r], simp)
paulson@13290
   918
done
paulson@13290
   919
paulson@13290
   920
lemma (in M_axioms) converse_abs [simp]: 
paulson@13290
   921
     "[| M(r); M(z) |] ==> is_converse(M,r,z) <-> z = converse(r)"
paulson@13290
   922
apply (simp add: is_converse_def)
paulson@13290
   923
apply (rule iffI)
paulson@13290
   924
 prefer 2 apply blast 
paulson@13290
   925
apply (rule M_equalityI)
paulson@13290
   926
  apply simp
paulson@13290
   927
  apply (blast dest: transM)+
paulson@13290
   928
done
paulson@13290
   929
paulson@13290
   930
paulson@13290
   931
subsubsection {*image, preimage, domain, range*}
paulson@13290
   932
paulson@13245
   933
lemma (in M_axioms) image_closed [intro,simp]: 
paulson@13223
   934
     "[| M(A); M(r) |] ==> M(r``A)"
paulson@13223
   935
apply (simp add: image_iff_Collect)
paulson@13245
   936
apply (insert image_separation [of A r], simp) 
paulson@13223
   937
done
paulson@13223
   938
paulson@13223
   939
lemma (in M_axioms) vimage_abs [simp]: 
paulson@13223
   940
     "[| M(r); M(A); M(z) |] ==> pre_image(M,r,A,z) <-> z = r-``A"
paulson@13223
   941
apply (simp add: pre_image_def)
paulson@13223
   942
apply (rule iffI) 
paulson@13223
   943
 apply (blast intro!: equalityI dest: transM, blast) 
paulson@13223
   944
done
paulson@13223
   945
paulson@13245
   946
lemma (in M_axioms) vimage_closed [intro,simp]: 
paulson@13223
   947
     "[| M(A); M(r) |] ==> M(r-``A)"
paulson@13290
   948
by (simp add: vimage_def)
paulson@13290
   949
paulson@13290
   950
paulson@13290
   951
subsubsection{*Domain, range and field*}
paulson@13223
   952
paulson@13223
   953
lemma (in M_axioms) domain_abs [simp]: 
paulson@13223
   954
     "[| M(r); M(z) |] ==> is_domain(M,r,z) <-> z = domain(r)"
paulson@13223
   955
apply (simp add: is_domain_def) 
paulson@13223
   956
apply (blast intro!: equalityI dest: transM) 
paulson@13223
   957
done
paulson@13223
   958
paulson@13245
   959
lemma (in M_axioms) domain_closed [intro,simp]: 
paulson@13223
   960
     "M(r) ==> M(domain(r))"
paulson@13223
   961
apply (simp add: domain_eq_vimage)
paulson@13223
   962
done
paulson@13223
   963
paulson@13223
   964
lemma (in M_axioms) range_abs [simp]: 
paulson@13223
   965
     "[| M(r); M(z) |] ==> is_range(M,r,z) <-> z = range(r)"
paulson@13223
   966
apply (simp add: is_range_def)
paulson@13223
   967
apply (blast intro!: equalityI dest: transM)
paulson@13223
   968
done
paulson@13223
   969
paulson@13245
   970
lemma (in M_axioms) range_closed [intro,simp]: 
paulson@13223
   971
     "M(r) ==> M(range(r))"
paulson@13223
   972
apply (simp add: range_eq_image)
paulson@13223
   973
done
paulson@13223
   974
paulson@13245
   975
lemma (in M_axioms) field_abs [simp]: 
paulson@13245
   976
     "[| M(r); M(z) |] ==> is_field(M,r,z) <-> z = field(r)"
paulson@13245
   977
by (simp add: domain_closed range_closed is_field_def field_def)
paulson@13245
   978
paulson@13245
   979
lemma (in M_axioms) field_closed [intro,simp]: 
paulson@13245
   980
     "M(r) ==> M(field(r))"
paulson@13245
   981
by (simp add: domain_closed range_closed Un_closed field_def) 
paulson@13245
   982
paulson@13245
   983
paulson@13290
   984
subsubsection{*Relations, functions and application*}
paulson@13254
   985
paulson@13223
   986
lemma (in M_axioms) relation_abs [simp]: 
paulson@13223
   987
     "M(r) ==> is_relation(M,r) <-> relation(r)"
paulson@13223
   988
apply (simp add: is_relation_def relation_def) 
paulson@13223
   989
apply (blast dest!: bspec dest: pair_components_in_M)+
paulson@13223
   990
done
paulson@13223
   991
paulson@13223
   992
lemma (in M_axioms) function_abs [simp]: 
paulson@13223
   993
     "M(r) ==> is_function(M,r) <-> function(r)"
paulson@13223
   994
apply (simp add: is_function_def function_def, safe) 
paulson@13223
   995
   apply (frule transM, assumption) 
paulson@13223
   996
  apply (blast dest: pair_components_in_M)+
paulson@13223
   997
done
paulson@13223
   998
paulson@13245
   999
lemma (in M_axioms) apply_closed [intro,simp]: 
paulson@13223
  1000
     "[|M(f); M(a)|] ==> M(f`a)"
paulson@13290
  1001
by (simp add: apply_def)
paulson@13223
  1002
paulson@13352
  1003
lemma (in M_axioms) apply_abs [simp]: 
paulson@13352
  1004
     "[| M(f); M(x); M(y) |] ==> fun_apply(M,f,x,y) <-> f`x = y"
paulson@13353
  1005
apply (simp add: fun_apply_def apply_def, blast) 
paulson@13223
  1006
done
paulson@13223
  1007
paulson@13223
  1008
lemma (in M_axioms) typed_function_abs [simp]: 
paulson@13223
  1009
     "[| M(A); M(f) |] ==> typed_function(M,A,B,f) <-> f \<in> A -> B"
paulson@13223
  1010
apply (auto simp add: typed_function_def relation_def Pi_iff) 
paulson@13223
  1011
apply (blast dest: pair_components_in_M)+
paulson@13223
  1012
done
paulson@13223
  1013
paulson@13223
  1014
lemma (in M_axioms) injection_abs [simp]: 
paulson@13223
  1015
     "[| M(A); M(f) |] ==> injection(M,A,B,f) <-> f \<in> inj(A,B)"
paulson@13223
  1016
apply (simp add: injection_def apply_iff inj_def apply_closed)
paulson@13247
  1017
apply (blast dest: transM [of _ A]) 
paulson@13223
  1018
done
paulson@13223
  1019
paulson@13223
  1020
lemma (in M_axioms) surjection_abs [simp]: 
paulson@13223
  1021
     "[| M(A); M(B); M(f) |] ==> surjection(M,A,B,f) <-> f \<in> surj(A,B)"
paulson@13352
  1022
by (simp add: surjection_def surj_def)
paulson@13223
  1023
paulson@13223
  1024
lemma (in M_axioms) bijection_abs [simp]: 
paulson@13223
  1025
     "[| M(A); M(B); M(f) |] ==> bijection(M,A,B,f) <-> f \<in> bij(A,B)"
paulson@13223
  1026
by (simp add: bijection_def bij_def)
paulson@13223
  1027
paulson@13223
  1028
paulson@13290
  1029
subsubsection{*Composition of relations*}
paulson@13223
  1030
paulson@13223
  1031
lemma (in M_axioms) M_comp_iff:
paulson@13223
  1032
     "[| M(r); M(s) |] 
paulson@13223
  1033
      ==> r O s = 
paulson@13223
  1034
          {xz \<in> domain(s) * range(r).  
paulson@13268
  1035
            \<exists>x[M]. \<exists>y[M]. \<exists>z[M]. xz = \<langle>x,z\<rangle> & \<langle>x,y\<rangle> \<in> s & \<langle>y,z\<rangle> \<in> r}"
paulson@13223
  1036
apply (simp add: comp_def)
paulson@13223
  1037
apply (rule equalityI) 
paulson@13247
  1038
 apply clarify 
paulson@13247
  1039
 apply simp 
paulson@13223
  1040
 apply  (blast dest:  transM)+
paulson@13223
  1041
done
paulson@13223
  1042
paulson@13245
  1043
lemma (in M_axioms) comp_closed [intro,simp]: 
paulson@13223
  1044
     "[| M(r); M(s) |] ==> M(r O s)"
paulson@13223
  1045
apply (simp add: M_comp_iff)
paulson@13245
  1046
apply (insert comp_separation [of r s], simp) 
paulson@13245
  1047
done
paulson@13245
  1048
paulson@13245
  1049
lemma (in M_axioms) composition_abs [simp]: 
paulson@13245
  1050
     "[| M(r); M(s); M(t) |] 
paulson@13245
  1051
      ==> composition(M,r,s,t) <-> t = r O s"
paulson@13247
  1052
apply safe
paulson@13245
  1053
 txt{*Proving @{term "composition(M, r, s, r O s)"}*}
paulson@13245
  1054
 prefer 2 
paulson@13245
  1055
 apply (simp add: composition_def comp_def)
paulson@13245
  1056
 apply (blast dest: transM) 
paulson@13245
  1057
txt{*Opposite implication*}
paulson@13245
  1058
apply (rule M_equalityI)
paulson@13245
  1059
  apply (simp add: composition_def comp_def)
paulson@13245
  1060
  apply (blast del: allE dest: transM)+
paulson@13223
  1061
done
paulson@13223
  1062
paulson@13290
  1063
text{*no longer needed*}
paulson@13290
  1064
lemma (in M_axioms) restriction_is_function: 
paulson@13290
  1065
     "[| restriction(M,f,A,z); function(f); M(f); M(A); M(z) |] 
paulson@13290
  1066
      ==> function(z)"
paulson@13290
  1067
apply (rotate_tac 1)
paulson@13290
  1068
apply (simp add: restriction_def ball_iff_equiv) 
paulson@13290
  1069
apply (unfold function_def, blast) 
paulson@13269
  1070
done
paulson@13269
  1071
paulson@13290
  1072
lemma (in M_axioms) restriction_abs [simp]: 
paulson@13290
  1073
     "[| M(f); M(A); M(z) |] 
paulson@13290
  1074
      ==> restriction(M,f,A,z) <-> z = restrict(f,A)"
paulson@13290
  1075
apply (simp add: ball_iff_equiv restriction_def restrict_def)
paulson@13290
  1076
apply (blast intro!: equalityI dest: transM) 
paulson@13290
  1077
done
paulson@13290
  1078
paulson@13223
  1079
paulson@13290
  1080
lemma (in M_axioms) M_restrict_iff:
paulson@13290
  1081
     "M(r) ==> restrict(r,A) = {z \<in> r . \<exists>x\<in>A. \<exists>y[M]. z = \<langle>x, y\<rangle>}"
paulson@13290
  1082
by (simp add: restrict_def, blast dest: transM)
paulson@13290
  1083
paulson@13290
  1084
lemma (in M_axioms) restrict_closed [intro,simp]: 
paulson@13290
  1085
     "[| M(A); M(r) |] ==> M(restrict(r,A))"
paulson@13290
  1086
apply (simp add: M_restrict_iff)
paulson@13290
  1087
apply (insert restrict_separation [of A], simp) 
paulson@13290
  1088
done
paulson@13223
  1089
paulson@13223
  1090
lemma (in M_axioms) Inter_abs [simp]: 
paulson@13223
  1091
     "[| M(A); M(z) |] ==> big_inter(M,A,z) <-> z = Inter(A)"
paulson@13223
  1092
apply (simp add: big_inter_def Inter_def) 
paulson@13223
  1093
apply (blast intro!: equalityI dest: transM) 
paulson@13223
  1094
done
paulson@13223
  1095
paulson@13245
  1096
lemma (in M_axioms) Inter_closed [intro,simp]:
paulson@13223
  1097
     "M(A) ==> M(Inter(A))"
paulson@13245
  1098
by (insert Inter_separation, simp add: Inter_def)
paulson@13223
  1099
paulson@13245
  1100
lemma (in M_axioms) Int_closed [intro,simp]:
paulson@13223
  1101
     "[| M(A); M(B) |] ==> M(A Int B)"
paulson@13223
  1102
apply (subgoal_tac "M({A,B})")
paulson@13247
  1103
apply (frule Inter_closed, force+) 
paulson@13223
  1104
done
paulson@13223
  1105
paulson@13290
  1106
subsubsection{*Functions and function space*}
paulson@13268
  1107
paulson@13245
  1108
text{*M contains all finite functions*}
paulson@13245
  1109
lemma (in M_axioms) finite_fun_closed_lemma [rule_format]: 
paulson@13245
  1110
     "[| n \<in> nat; M(A) |] ==> \<forall>f \<in> n -> A. M(f)"
paulson@13245
  1111
apply (induct_tac n, simp)
paulson@13245
  1112
apply (rule ballI)  
paulson@13245
  1113
apply (simp add: succ_def) 
paulson@13245
  1114
apply (frule fun_cons_restrict_eq)
paulson@13245
  1115
apply (erule ssubst) 
paulson@13245
  1116
apply (subgoal_tac "M(f`x) & restrict(f,x) \<in> x -> A") 
paulson@13245
  1117
 apply (simp add: cons_closed nat_into_M apply_closed) 
paulson@13245
  1118
apply (blast intro: apply_funtype transM restrict_type2) 
paulson@13245
  1119
done
paulson@13245
  1120
paulson@13245
  1121
lemma (in M_axioms) finite_fun_closed [rule_format]: 
paulson@13245
  1122
     "[| f \<in> n -> A; n \<in> nat; M(A) |] ==> M(f)"
paulson@13245
  1123
by (blast intro: finite_fun_closed_lemma) 
paulson@13245
  1124
paulson@13268
  1125
text{*The assumption @{term "M(A->B)"} is unusual, but essential: in 
paulson@13268
  1126
all but trivial cases, A->B cannot be expected to belong to @{term M}.*}
paulson@13268
  1127
lemma (in M_axioms) is_funspace_abs [simp]:
paulson@13268
  1128
     "[|M(A); M(B); M(F); M(A->B)|] ==> is_funspace(M,A,B,F) <-> F = A->B";
paulson@13268
  1129
apply (simp add: is_funspace_def)
paulson@13268
  1130
apply (rule iffI)
paulson@13268
  1131
 prefer 2 apply blast 
paulson@13268
  1132
apply (rule M_equalityI)
paulson@13268
  1133
  apply simp_all
paulson@13268
  1134
done
paulson@13268
  1135
paulson@13268
  1136
lemma (in M_axioms) succ_fun_eq2:
paulson@13268
  1137
     "[|M(B); M(n->B)|] ==>
paulson@13268
  1138
      succ(n) -> B = 
paulson@13268
  1139
      \<Union>{z. p \<in> (n->B)*B, \<exists>f[M]. \<exists>b[M]. p = <f,b> & z = {cons(<n,b>, f)}}"
paulson@13268
  1140
apply (simp add: succ_fun_eq)
paulson@13268
  1141
apply (blast dest: transM)  
paulson@13268
  1142
done
paulson@13268
  1143
paulson@13268
  1144
lemma (in M_axioms) funspace_succ:
paulson@13268
  1145
     "[|M(n); M(B); M(n->B) |] ==> M(succ(n) -> B)"
paulson@13306
  1146
apply (insert funspace_succ_replacement [of n], simp) 
paulson@13268
  1147
apply (force simp add: succ_fun_eq2 univalent_def) 
paulson@13268
  1148
done
paulson@13268
  1149
paulson@13268
  1150
text{*@{term M} contains all finite function spaces.  Needed to prove the
paulson@13268
  1151
absoluteness of transitive closure.*}
paulson@13268
  1152
lemma (in M_axioms) finite_funspace_closed [intro,simp]:
paulson@13268
  1153
     "[|n\<in>nat; M(B)|] ==> M(n->B)"
paulson@13268
  1154
apply (induct_tac n, simp)
paulson@13268
  1155
apply (simp add: funspace_succ nat_into_M) 
paulson@13268
  1156
done
paulson@13268
  1157
paulson@13350
  1158
paulson@13223
  1159
end