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