src/ZF/Constructible/Wellorderings.thy
author paulson
Thu Jul 04 10:54:04 2002 +0200 (2002-07-04)
changeset 13293 09276ee04361
parent 13269 3ba9be497c33
child 13295 ca2e9b273472
permissions -rw-r--r--
tweaks
     1 header {*Relativized Wellorderings*}
     2 
     3 theory Wellorderings = Relative:
     4 
     5 text{*We define functions analogous to @{term ordermap} @{term ordertype} 
     6       but without using recursion.  Instead, there is a direct appeal
     7       to Replacement.  This will be the basis for a version relativized
     8       to some class @{text M}.  The main result is Theorem I 7.6 in Kunen,
     9       page 17.*}
    10 
    11 
    12 subsection{*Wellorderings*}
    13 
    14 constdefs
    15   irreflexive :: "[i=>o,i,i]=>o"
    16     "irreflexive(M,A,r) == \<forall>x\<in>A. M(x) --> <x,x> \<notin> r"
    17   
    18   transitive_rel :: "[i=>o,i,i]=>o"
    19     "transitive_rel(M,A,r) == 
    20 	\<forall>x\<in>A. M(x) --> (\<forall>y\<in>A. M(y) --> (\<forall>z\<in>A. M(z) --> 
    21                           <x,y>\<in>r --> <y,z>\<in>r --> <x,z>\<in>r))"
    22 
    23   linear_rel :: "[i=>o,i,i]=>o"
    24     "linear_rel(M,A,r) == 
    25 	\<forall>x\<in>A. M(x) --> (\<forall>y\<in>A. M(y) --> <x,y>\<in>r | x=y | <y,x>\<in>r)"
    26 
    27   wellfounded :: "[i=>o,i]=>o"
    28     --{*EVERY non-empty set has an @{text r}-minimal element*}
    29     "wellfounded(M,r) == 
    30 	\<forall>x. M(x) --> ~ empty(M,x) 
    31                  --> (\<exists>y\<in>x. M(y) & ~(\<exists>z\<in>x. M(z) & <z,y> \<in> r))"
    32   wellfounded_on :: "[i=>o,i,i]=>o"
    33     --{*every non-empty SUBSET OF @{text A} has an @{text r}-minimal element*}
    34     "wellfounded_on(M,A,r) == 
    35 	\<forall>x. M(x) --> ~ empty(M,x) --> subset(M,x,A)
    36                  --> (\<exists>y\<in>x. M(y) & ~(\<exists>z\<in>x. M(z) & <z,y> \<in> r))"
    37 
    38   wellordered :: "[i=>o,i,i]=>o"
    39     --{*every non-empty subset of @{text A} has an @{text r}-minimal element*}
    40     "wellordered(M,A,r) == 
    41 	transitive_rel(M,A,r) & linear_rel(M,A,r) & wellfounded_on(M,A,r)"
    42 
    43 
    44 subsubsection {*Trivial absoluteness proofs*}
    45 
    46 lemma (in M_axioms) irreflexive_abs [simp]: 
    47      "M(A) ==> irreflexive(M,A,r) <-> irrefl(A,r)"
    48 by (simp add: irreflexive_def irrefl_def)
    49 
    50 lemma (in M_axioms) transitive_rel_abs [simp]: 
    51      "M(A) ==> transitive_rel(M,A,r) <-> trans[A](r)"
    52 by (simp add: transitive_rel_def trans_on_def)
    53 
    54 lemma (in M_axioms) linear_rel_abs [simp]: 
    55      "M(A) ==> linear_rel(M,A,r) <-> linear(A,r)"
    56 by (simp add: linear_rel_def linear_def)
    57 
    58 lemma (in M_axioms) wellordered_is_trans_on: 
    59     "[| wellordered(M,A,r); M(A) |] ==> trans[A](r)"
    60 by (auto simp add: wellordered_def )
    61 
    62 lemma (in M_axioms) wellordered_is_linear: 
    63     "[| wellordered(M,A,r); M(A) |] ==> linear(A,r)"
    64 by (auto simp add: wellordered_def )
    65 
    66 lemma (in M_axioms) wellordered_is_wellfounded_on: 
    67     "[| wellordered(M,A,r); M(A) |] ==> wellfounded_on(M,A,r)"
    68 by (auto simp add: wellordered_def )
    69 
    70 lemma (in M_axioms) wellfounded_imp_wellfounded_on: 
    71     "[| wellfounded(M,r); M(A) |] ==> wellfounded_on(M,A,r)"
    72 by (auto simp add: wellfounded_def wellfounded_on_def)
    73 
    74 lemma (in M_axioms) wellfounded_on_subset_A:
    75      "[| wellfounded_on(M,A,r);  B<=A |] ==> wellfounded_on(M,B,r)"
    76 by (simp add: wellfounded_on_def, blast)
    77 
    78 
    79 subsubsection {*Well-founded relations*}
    80 
    81 lemma  (in M_axioms) wellfounded_on_iff_wellfounded:
    82      "wellfounded_on(M,A,r) <-> wellfounded(M, r \<inter> A*A)"
    83 apply (simp add: wellfounded_on_def wellfounded_def, safe)
    84  apply blast 
    85 apply (drule_tac x=x in spec, blast) 
    86 done
    87 
    88 lemma (in M_axioms) wellfounded_on_imp_wellfounded:
    89      "[|wellfounded_on(M,A,r); r \<subseteq> A*A|] ==> wellfounded(M,r)"
    90 by (simp add: wellfounded_on_iff_wellfounded subset_Int_iff)
    91 
    92 lemma (in M_axioms) wellfounded_on_field_imp_wellfounded:
    93      "wellfounded_on(M, field(r), r) ==> wellfounded(M,r)"
    94 by (simp add: wellfounded_def wellfounded_on_iff_wellfounded, fast)
    95 
    96 lemma (in M_axioms) wellfounded_iff_wellfounded_on_field:
    97      "M(r) ==> wellfounded(M,r) <-> wellfounded_on(M, field(r), r)"
    98 by (blast intro: wellfounded_imp_wellfounded_on
    99                  wellfounded_on_field_imp_wellfounded)
   100 
   101 (*Consider the least z in domain(r) such that P(z) does not hold...*)
   102 lemma (in M_axioms) wellfounded_induct: 
   103      "[| wellfounded(M,r); M(a); M(r); separation(M, \<lambda>x. ~P(x));  
   104          \<forall>x. M(x) & (\<forall>y. <y,x> \<in> r --> P(y)) --> P(x) |]
   105       ==> P(a)";
   106 apply (simp (no_asm_use) add: wellfounded_def)
   107 apply (drule_tac x="{z \<in> domain(r). ~P(z)}" in spec)
   108 apply (blast dest: transM)
   109 done
   110 
   111 lemma (in M_axioms) wellfounded_on_induct: 
   112      "[| a\<in>A;  wellfounded_on(M,A,r);  M(A);  
   113        separation(M, \<lambda>x. x\<in>A --> ~P(x));  
   114        \<forall>x\<in>A. M(x) & (\<forall>y\<in>A. <y,x> \<in> r --> P(y)) --> P(x) |]
   115       ==> P(a)";
   116 apply (simp (no_asm_use) add: wellfounded_on_def)
   117 apply (drule_tac x="{z\<in>A. z\<in>A --> ~P(z)}" in spec)
   118 apply (blast intro: transM) 
   119 done
   120 
   121 text{*The assumption @{term "r \<subseteq> A*A"} justifies strengthening the induction
   122       hypothesis by removing the restriction to @{term A}.*}
   123 lemma (in M_axioms) wellfounded_on_induct2: 
   124      "[| a\<in>A;  wellfounded_on(M,A,r);  M(A);  r \<subseteq> A*A;  
   125        separation(M, \<lambda>x. x\<in>A --> ~P(x));  
   126        \<forall>x\<in>A. M(x) & (\<forall>y. <y,x> \<in> r --> P(y)) --> P(x) |]
   127       ==> P(a)";
   128 by (rule wellfounded_on_induct, assumption+, blast)
   129 
   130 
   131 subsubsection {*Kunen's lemma IV 3.14, page 123*}
   132 
   133 lemma (in M_axioms) linear_imp_relativized: 
   134      "linear(A,r) ==> linear_rel(M,A,r)" 
   135 by (simp add: linear_def linear_rel_def) 
   136 
   137 lemma (in M_axioms) trans_on_imp_relativized: 
   138      "trans[A](r) ==> transitive_rel(M,A,r)" 
   139 by (unfold transitive_rel_def trans_on_def, blast) 
   140 
   141 lemma (in M_axioms) wf_on_imp_relativized: 
   142      "wf[A](r) ==> wellfounded_on(M,A,r)" 
   143 apply (simp add: wellfounded_on_def wf_def wf_on_def, clarify) 
   144 apply (drule_tac x="x" in spec, blast) 
   145 done
   146 
   147 lemma (in M_axioms) wf_imp_relativized: 
   148      "wf(r) ==> wellfounded(M,r)" 
   149 apply (simp add: wellfounded_def wf_def, clarify) 
   150 apply (drule_tac x="x" in spec, blast) 
   151 done
   152 
   153 lemma (in M_axioms) well_ord_imp_relativized: 
   154      "well_ord(A,r) ==> wellordered(M,A,r)" 
   155 by (simp add: wellordered_def well_ord_def tot_ord_def part_ord_def
   156        linear_imp_relativized trans_on_imp_relativized wf_on_imp_relativized)
   157 
   158 
   159 subsection{* Relativized versions of order-isomorphisms and order types *}
   160 
   161 lemma (in M_axioms) order_isomorphism_abs [simp]: 
   162      "[| M(A); M(B); M(f) |] 
   163       ==> order_isomorphism(M,A,r,B,s,f) <-> f \<in> ord_iso(A,r,B,s)"
   164 by (simp add: typed_apply_abs [OF bij_is_fun] apply_closed 
   165               order_isomorphism_def ord_iso_def)
   166 
   167 
   168 lemma (in M_axioms) pred_set_abs [simp]: 
   169      "[| M(r); M(B) |] ==> pred_set(M,A,x,r,B) <-> B = Order.pred(A,x,r)"
   170 apply (simp add: pred_set_def Order.pred_def)
   171 apply (blast dest: transM) 
   172 done
   173 
   174 lemma (in M_axioms) pred_closed [intro,simp]: 
   175      "[| M(A); M(r); M(x) |] ==> M(Order.pred(A,x,r))"
   176 apply (simp add: Order.pred_def) 
   177 apply (insert pred_separation [of r x], simp) 
   178 done
   179 
   180 lemma (in M_axioms) membership_abs [simp]: 
   181      "[| M(r); M(A) |] ==> membership(M,A,r) <-> r = Memrel(A)"
   182 apply (simp add: membership_def Memrel_def, safe)
   183   apply (rule equalityI) 
   184    apply clarify 
   185    apply (frule transM, assumption)
   186    apply blast
   187   apply clarify 
   188   apply (subgoal_tac "M(<xb,ya>)", blast) 
   189   apply (blast dest: transM) 
   190  apply auto 
   191 done
   192 
   193 lemma (in M_axioms) M_Memrel_iff:
   194      "M(A) ==> 
   195       Memrel(A) = {z \<in> A*A. \<exists>x. M(x) \<and> (\<exists>y. M(y) \<and> z = \<langle>x,y\<rangle> \<and> x \<in> y)}"
   196 apply (simp add: Memrel_def) 
   197 apply (blast dest: transM)
   198 done 
   199 
   200 lemma (in M_axioms) Memrel_closed [intro,simp]: 
   201      "M(A) ==> M(Memrel(A))"
   202 apply (simp add: M_Memrel_iff) 
   203 apply (insert Memrel_separation, simp)
   204 done
   205 
   206 
   207 subsection {* Main results of Kunen, Chapter 1 section 6 *}
   208 
   209 text{*Subset properties-- proved outside the locale*}
   210 
   211 lemma linear_rel_subset: 
   212     "[| linear_rel(M,A,r);  B<=A |] ==> linear_rel(M,B,r)"
   213 by (unfold linear_rel_def, blast)
   214 
   215 lemma transitive_rel_subset: 
   216     "[| transitive_rel(M,A,r);  B<=A |] ==> transitive_rel(M,B,r)"
   217 by (unfold transitive_rel_def, blast)
   218 
   219 lemma wellfounded_on_subset: 
   220     "[| wellfounded_on(M,A,r);  B<=A |] ==> wellfounded_on(M,B,r)"
   221 by (unfold wellfounded_on_def subset_def, blast)
   222 
   223 lemma wellordered_subset: 
   224     "[| wellordered(M,A,r);  B<=A |] ==> wellordered(M,B,r)"
   225 apply (unfold wellordered_def)
   226 apply (blast intro: linear_rel_subset transitive_rel_subset 
   227 		    wellfounded_on_subset)
   228 done
   229 
   230 text{*Inductive argument for Kunen's Lemma 6.1, etc.
   231       Simple proof from Halmos, page 72*}
   232 lemma  (in M_axioms) wellordered_iso_subset_lemma: 
   233      "[| wellordered(M,A,r);  f \<in> ord_iso(A,r, A',r);  A'<= A;  y \<in> A;  
   234        M(A);  M(f);  M(r) |] ==> ~ <f`y, y> \<in> r"
   235 apply (unfold wellordered_def ord_iso_def)
   236 apply (elim conjE CollectE) 
   237 apply (erule wellfounded_on_induct, assumption+)
   238  apply (insert well_ord_iso_separation [of A f r])
   239  apply (simp add: typed_apply_abs [OF bij_is_fun] apply_closed, clarify) 
   240 apply (drule_tac a = x in bij_is_fun [THEN apply_type], assumption, blast)
   241 done
   242 
   243 
   244 text{*Kunen's Lemma 6.1: there's no order-isomorphism to an initial segment
   245       of a well-ordering*}
   246 lemma (in M_axioms) wellordered_iso_predD:
   247      "[| wellordered(M,A,r);  f \<in> ord_iso(A, r, Order.pred(A,x,r), r);  
   248        M(A);  M(f);  M(r) |] ==> x \<notin> A"
   249 apply (rule notI) 
   250 apply (frule wellordered_iso_subset_lemma, assumption)
   251 apply (auto elim: predE)  
   252 (*Now we know  ~ (f`x < x) *)
   253 apply (drule ord_iso_is_bij [THEN bij_is_fun, THEN apply_type], assumption)
   254 (*Now we also know f`x  \<in> pred(A,x,r);  contradiction! *)
   255 apply (simp add: Order.pred_def)
   256 done
   257 
   258 
   259 lemma (in M_axioms) wellordered_iso_pred_eq_lemma:
   260      "[| f \<in> \<langle>Order.pred(A,y,r), r\<rangle> \<cong> \<langle>Order.pred(A,x,r), r\<rangle>;
   261        wellordered(M,A,r); x\<in>A; y\<in>A; M(A); M(f); M(r) |] ==> <x,y> \<notin> r"
   262 apply (frule wellordered_is_trans_on, assumption)
   263 apply (rule notI) 
   264 apply (drule_tac x2=y and x=x and r2=r in 
   265          wellordered_subset [OF _ pred_subset, THEN wellordered_iso_predD]) 
   266 apply (simp add: trans_pred_pred_eq) 
   267 apply (blast intro: predI dest: transM)+
   268 done
   269 
   270 
   271 text{*Simple consequence of Lemma 6.1*}
   272 lemma (in M_axioms) wellordered_iso_pred_eq:
   273      "[| wellordered(M,A,r);
   274        f \<in> ord_iso(Order.pred(A,a,r), r, Order.pred(A,c,r), r);   
   275        M(A);  M(f);  M(r);  a\<in>A;  c\<in>A |] ==> a=c"
   276 apply (frule wellordered_is_trans_on, assumption)
   277 apply (frule wellordered_is_linear, assumption)
   278 apply (erule_tac x=a and y=c in linearE, auto) 
   279 apply (drule ord_iso_sym)
   280 (*two symmetric cases*)
   281 apply (blast dest: wellordered_iso_pred_eq_lemma)+ 
   282 done
   283 
   284 lemma (in M_axioms) wellfounded_on_asym:
   285      "[| wellfounded_on(M,A,r);  <a,x>\<in>r;  a\<in>A; x\<in>A;  M(A) |] ==> <x,a>\<notin>r"
   286 apply (simp add: wellfounded_on_def) 
   287 apply (drule_tac x="{x,a}" in spec) 
   288 apply (simp add: cons_closed) 
   289 apply (blast dest: transM) 
   290 done
   291 
   292 lemma (in M_axioms) wellordered_asym:
   293      "[| wellordered(M,A,r);  <a,x>\<in>r;  a\<in>A; x\<in>A;  M(A) |] ==> <x,a>\<notin>r"
   294 by (simp add: wellordered_def, blast dest: wellfounded_on_asym)
   295 
   296 
   297 text{*Surely a shorter proof using lemmas in @{text Order}?
   298      Like well_ord_iso_preserving?*}
   299 lemma (in M_axioms) ord_iso_pred_imp_lt:
   300      "[| f \<in> ord_iso(Order.pred(A,x,r), r, i, Memrel(i));
   301        g \<in> ord_iso(Order.pred(A,y,r), r, j, Memrel(j));
   302        wellordered(M,A,r);  x \<in> A;  y \<in> A; M(A); M(r); M(f); M(g); M(j);
   303        Ord(i); Ord(j); \<langle>x,y\<rangle> \<in> r |]
   304       ==> i < j"
   305 apply (frule wellordered_is_trans_on, assumption)
   306 apply (frule_tac y=y in transM, assumption) 
   307 apply (rule_tac i=i and j=j in Ord_linear_lt, auto)  
   308 txt{*case @{term "i=j"} yields a contradiction*}
   309  apply (rule_tac x1=x and A1="Order.pred(A,y,r)" in 
   310           wellordered_iso_predD [THEN notE]) 
   311    apply (blast intro: wellordered_subset [OF _ pred_subset]) 
   312   apply (simp add: trans_pred_pred_eq)
   313   apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans) 
   314  apply (simp_all add: pred_iff pred_closed converse_closed comp_closed)
   315 txt{*case @{term "j<i"} also yields a contradiction*}
   316 apply (frule restrict_ord_iso2, assumption+) 
   317 apply (frule ord_iso_sym [THEN ord_iso_is_bij, THEN bij_is_fun]) 
   318 apply (frule apply_type, blast intro: ltD) 
   319   --{*thus @{term "converse(f)`j \<in> Order.pred(A,x,r)"}*}
   320 apply (simp add: pred_iff) 
   321 apply (subgoal_tac
   322        "\<exists>h. M(h) & h \<in> ord_iso(Order.pred(A,y,r), r, 
   323                                Order.pred(A, converse(f)`j, r), r)")
   324  apply (clarify, frule wellordered_iso_pred_eq, assumption+)
   325  apply (blast dest: wellordered_asym)  
   326 apply (intro exI conjI) 
   327  prefer 2 apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans)+
   328 done
   329 
   330 
   331 lemma ord_iso_converse1:
   332      "[| f: ord_iso(A,r,B,s);  <b, f`a>: s;  a:A;  b:B |] 
   333       ==> <converse(f) ` b, a> : r"
   334 apply (frule ord_iso_converse, assumption+) 
   335 apply (blast intro: ord_iso_is_bij [THEN bij_is_fun, THEN apply_funtype]) 
   336 apply (simp add: left_inverse_bij [OF ord_iso_is_bij])
   337 done
   338 
   339 
   340 subsection {* Order Types: A Direct Construction by Replacement*}
   341 
   342 text{*This follows Kunen's Theorem I 7.6, page 17.*}
   343 
   344 constdefs
   345   
   346   obase :: "[i=>o,i,i,i] => o"
   347        --{*the domain of @{text om}, eventually shown to equal @{text A}*}
   348    "obase(M,A,r,z) == 
   349 	\<forall>a[M]. 
   350          a \<in> z <-> 
   351           (a\<in>A & (\<exists>x g mx par. M(x) & M(g) & M(mx) & M(par) & ordinal(M,x) & 
   352                                membership(M,x,mx) & pred_set(M,A,a,r,par) &  
   353                                order_isomorphism(M,par,r,x,mx,g)))"
   354 
   355 
   356   omap :: "[i=>o,i,i,i] => o"  
   357     --{*the function that maps wosets to order types*}
   358    "omap(M,A,r,f) == 
   359 	\<forall>z[M].
   360          z \<in> f <-> 
   361           (\<exists>a\<in>A. M(a) & 
   362            (\<exists>x g mx par. M(x) & M(g) & M(mx) & M(par) & ordinal(M,x) & 
   363                          pair(M,a,x,z) & membership(M,x,mx) & 
   364                          pred_set(M,A,a,r,par) &  
   365                          order_isomorphism(M,par,r,x,mx,g)))"
   366 
   367 
   368   otype :: "[i=>o,i,i,i] => o"  --{*the order types themselves*}
   369    "otype(M,A,r,i) == \<exists>f. M(f) & omap(M,A,r,f) & is_range(M,f,i)"
   370 
   371 
   372 
   373 lemma (in M_axioms) obase_iff:
   374      "[| M(A); M(r); M(z) |] 
   375       ==> obase(M,A,r,z) <-> 
   376           z = {a\<in>A. \<exists>x g. M(x) & M(g) & Ord(x) & 
   377                           g \<in> ord_iso(Order.pred(A,a,r),r,x,Memrel(x))}"
   378 apply (simp add: obase_def Memrel_closed pred_closed)
   379 apply (rule iffI) 
   380  prefer 2 apply blast 
   381 apply (rule equalityI) 
   382  apply (clarify, frule transM, assumption, rotate_tac -1, simp) 
   383 apply (clarify, frule transM, assumption, force)
   384 done
   385 
   386 text{*Can also be proved with the premise @{term "M(z)"} instead of
   387       @{term "M(f)"}, but that version is less useful.*}
   388 lemma (in M_axioms) omap_iff:
   389      "[| omap(M,A,r,f); M(A); M(r); M(f) |] 
   390       ==> z \<in> f <->
   391       (\<exists>a\<in>A. \<exists>x g. M(x) & M(g) & z = <a,x> & Ord(x) & 
   392                    g \<in> ord_iso(Order.pred(A,a,r),r,x,Memrel(x)))"
   393 apply (rotate_tac 1) 
   394 apply (simp add: omap_def Memrel_closed pred_closed) 
   395 apply (rule iffI)
   396  apply (drule_tac [2] x=z in rspec)
   397  apply (drule_tac x=z in rspec)
   398  apply (blast dest: transM)+
   399 done
   400 
   401 lemma (in M_axioms) omap_unique:
   402      "[| omap(M,A,r,f); omap(M,A,r,f'); M(A); M(r); M(f); M(f') |] ==> f' = f" 
   403 apply (rule equality_iffI) 
   404 apply (simp add: omap_iff) 
   405 done
   406 
   407 lemma (in M_axioms) omap_yields_Ord:
   408      "[| omap(M,A,r,f); \<langle>a,x\<rangle> \<in> f; M(a); M(x) |]  ==> Ord(x)"
   409 apply (simp add: omap_def, blast) 
   410 done
   411 
   412 lemma (in M_axioms) otype_iff:
   413      "[| otype(M,A,r,i); M(A); M(r); M(i) |] 
   414       ==> x \<in> i <-> 
   415           (\<exists>a\<in>A. \<exists>g. M(x) & M(g) & Ord(x) & 
   416                      g \<in> ord_iso(Order.pred(A,a,r),r,x,Memrel(x)))"
   417 apply (simp add: otype_def, auto)
   418   apply (blast dest: transM)
   419  apply (blast dest!: omap_iff intro: transM)
   420 apply (rename_tac a g) 
   421 apply (rule_tac a=a in rangeI) 
   422 apply (frule transM, assumption)
   423 apply (simp add: omap_iff, blast)
   424 done
   425 
   426 lemma (in M_axioms) otype_eq_range:
   427      "[| omap(M,A,r,f); otype(M,A,r,i); M(A); M(r); M(f); M(i) |] ==> i = range(f)"
   428 apply (auto simp add: otype_def omap_iff)
   429 apply (blast dest: omap_unique) 
   430 done
   431 
   432 
   433 lemma (in M_axioms) Ord_otype:
   434      "[| otype(M,A,r,i); trans[A](r); M(A); M(r); M(i) |] ==> Ord(i)"
   435 apply (rotate_tac 1) 
   436 apply (rule OrdI) 
   437 prefer 2 
   438     apply (simp add: Ord_def otype_def omap_def) 
   439     apply clarify 
   440     apply (frule pair_components_in_M, assumption) 
   441     apply blast 
   442 apply (auto simp add: Transset_def otype_iff) 
   443  apply (blast intro: transM)
   444 apply (rename_tac y a g)
   445 apply (frule ord_iso_sym [THEN ord_iso_is_bij, THEN bij_is_fun, 
   446 			  THEN apply_funtype],  assumption)  
   447 apply (rule_tac x="converse(g)`y" in bexI)
   448  apply (frule_tac a="converse(g) ` y" in ord_iso_restrict_pred, assumption) 
   449 apply (safe elim!: predE) 
   450 apply (intro conjI exI) 
   451 prefer 3
   452   apply (blast intro: restrict_ord_iso ord_iso_sym ltI)
   453  apply (blast intro: transM)
   454  apply (blast intro: Ord_in_Ord)
   455 done
   456 
   457 lemma (in M_axioms) domain_omap:
   458      "[| omap(M,A,r,f);  obase(M,A,r,B); M(A); M(r); M(B); M(f) |] 
   459       ==> domain(f) = B"
   460 apply (rotate_tac 2) 
   461 apply (simp add: domain_closed obase_iff) 
   462 apply (rule equality_iffI) 
   463 apply (simp add: domain_iff omap_iff, blast) 
   464 done
   465 
   466 lemma (in M_axioms) omap_subset: 
   467      "[| omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i); 
   468        M(A); M(r); M(f); M(B); M(i) |] ==> f \<subseteq> B * i"
   469 apply (rotate_tac 3, clarify) 
   470 apply (simp add: omap_iff obase_iff) 
   471 apply (force simp add: otype_iff) 
   472 done
   473 
   474 lemma (in M_axioms) omap_funtype: 
   475      "[| omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i); 
   476        M(A); M(r); M(f); M(B); M(i) |] ==> f \<in> B -> i"
   477 apply (rotate_tac 3) 
   478 apply (simp add: domain_omap omap_subset Pi_iff function_def omap_iff) 
   479 apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans) 
   480 done
   481 
   482 
   483 lemma (in M_axioms) wellordered_omap_bij:
   484      "[| wellordered(M,A,r); omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i); 
   485        M(A); M(r); M(f); M(B); M(i) |] ==> f \<in> bij(B,i)"
   486 apply (insert omap_funtype [of A r f B i]) 
   487 apply (auto simp add: bij_def inj_def) 
   488 prefer 2  apply (blast intro: fun_is_surj dest: otype_eq_range) 
   489 apply (frule_tac a="w" in apply_Pair, assumption) 
   490 apply (frule_tac a="x" in apply_Pair, assumption) 
   491 apply (simp add: omap_iff) 
   492 apply (blast intro: wellordered_iso_pred_eq ord_iso_sym ord_iso_trans) 
   493 done
   494 
   495 
   496 text{*This is not the final result: we must show @{term "oB(A,r) = A"}*}
   497 lemma (in M_axioms) omap_ord_iso:
   498      "[| wellordered(M,A,r); omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i); 
   499        M(A); M(r); M(f); M(B); M(i) |] ==> f \<in> ord_iso(B,r,i,Memrel(i))"
   500 apply (rule ord_isoI)
   501  apply (erule wellordered_omap_bij, assumption+) 
   502 apply (insert omap_funtype [of A r f B i], simp) 
   503 apply (frule_tac a="x" in apply_Pair, assumption) 
   504 apply (frule_tac a="y" in apply_Pair, assumption) 
   505 apply (auto simp add: omap_iff)
   506  txt{*direction 1: assuming @{term "\<langle>x,y\<rangle> \<in> r"}*}
   507  apply (blast intro: ltD ord_iso_pred_imp_lt)
   508  txt{*direction 2: proving @{term "\<langle>x,y\<rangle> \<in> r"} using linearity of @{term r}*}
   509 apply (rename_tac x y g ga) 
   510 apply (frule wellordered_is_linear, assumption, 
   511        erule_tac x=x and y=y in linearE, assumption+) 
   512 txt{*the case @{term "x=y"} leads to immediate contradiction*} 
   513 apply (blast elim: mem_irrefl) 
   514 txt{*the case @{term "\<langle>y,x\<rangle> \<in> r"}: handle like the opposite direction*}
   515 apply (blast dest: ord_iso_pred_imp_lt ltD elim: mem_asym) 
   516 done
   517 
   518 lemma (in M_axioms) Ord_omap_image_pred:
   519      "[| wellordered(M,A,r); omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i); 
   520        M(A); M(r); M(f); M(B); M(i); b \<in> A |] ==> Ord(f `` Order.pred(A,b,r))"
   521 apply (frule wellordered_is_trans_on, assumption)
   522 apply (rule OrdI) 
   523 	prefer 2 apply (simp add: image_iff omap_iff Ord_def, blast) 
   524 txt{*Hard part is to show that the image is a transitive set.*}
   525 apply (rotate_tac 3)
   526 apply (simp add: Transset_def, clarify) 
   527 apply (simp add: image_iff pred_iff apply_iff [OF omap_funtype [of A r f B i]])
   528 apply (rename_tac c j, clarify)
   529 apply (frule omap_funtype [of A r f B, THEN apply_funtype], assumption+)
   530 apply (subgoal_tac "j : i") 
   531 	prefer 2 apply (blast intro: Ord_trans Ord_otype)
   532 apply (subgoal_tac "converse(f) ` j : B") 
   533 	prefer 2 
   534 	apply (blast dest: wellordered_omap_bij [THEN bij_converse_bij, 
   535                                       THEN bij_is_fun, THEN apply_funtype])
   536 apply (rule_tac x="converse(f) ` j" in bexI) 
   537  apply (simp add: right_inverse_bij [OF wellordered_omap_bij]) 
   538 apply (intro predI conjI)
   539  apply (erule_tac b=c in trans_onD) 
   540  apply (rule ord_iso_converse1 [OF omap_ord_iso [of A r f B i]])
   541 apply (auto simp add: obase_iff)
   542 done
   543 
   544 lemma (in M_axioms) restrict_omap_ord_iso:
   545      "[| wellordered(M,A,r); omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i); 
   546        D \<subseteq> B; M(A); M(r); M(f); M(B); M(i) |] 
   547       ==> restrict(f,D) \<in> (\<langle>D,r\<rangle> \<cong> \<langle>f``D, Memrel(f``D)\<rangle>)"
   548 apply (frule ord_iso_restrict_image [OF omap_ord_iso [of A r f B i]], 
   549        assumption+)
   550 apply (drule ord_iso_sym [THEN subset_ord_iso_Memrel]) 
   551 apply (blast dest: subsetD [OF omap_subset]) 
   552 apply (drule ord_iso_sym, simp) 
   553 done
   554 
   555 lemma (in M_axioms) obase_equals: 
   556      "[| wellordered(M,A,r); omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i);
   557        M(A); M(r); M(f); M(B); M(i) |] ==> B = A"
   558 apply (rotate_tac 4)
   559 apply (rule equalityI, force simp add: obase_iff, clarify) 
   560 apply (subst obase_iff [of A r B, THEN iffD1], assumption+, simp) 
   561 apply (frule wellordered_is_wellfounded_on, assumption)
   562 apply (erule wellfounded_on_induct, assumption+)
   563  apply (insert obase_equals_separation, simp add: Memrel_closed pred_closed, clarify) 
   564 apply (rename_tac b) 
   565 apply (subgoal_tac "Order.pred(A,b,r) <= B") 
   566  prefer 2 apply (force simp add: pred_iff obase_iff)  
   567 apply (intro conjI exI) 
   568     prefer 4 apply (blast intro: restrict_omap_ord_iso) 
   569 apply (blast intro: Ord_omap_image_pred)+
   570 done
   571 
   572 
   573 
   574 text{*Main result: @{term om} gives the order-isomorphism 
   575       @{term "\<langle>A,r\<rangle> \<cong> \<langle>i, Memrel(i)\<rangle>"} *}
   576 theorem (in M_axioms) omap_ord_iso_otype:
   577      "[| wellordered(M,A,r); omap(M,A,r,f); obase(M,A,r,B); otype(M,A,r,i);
   578        M(A); M(r); M(f); M(B); M(i) |] ==> f \<in> ord_iso(A, r, i, Memrel(i))"
   579 apply (frule omap_ord_iso, assumption+) 
   580 apply (frule obase_equals, assumption+, blast) 
   581 done 
   582 
   583 lemma (in M_axioms) obase_exists:
   584      "[| M(A); M(r) |] ==> \<exists>z[M]. obase(M,A,r,z)"
   585 apply (simp add: obase_def) 
   586 apply (insert obase_separation [of A r])
   587 apply (simp add: separation_def)  
   588 done
   589 
   590 lemma (in M_axioms) omap_exists:
   591      "[| M(A); M(r) |] ==> \<exists>z[M]. omap(M,A,r,z)"
   592 apply (insert obase_exists [of A r]) 
   593 apply (simp add: omap_def) 
   594 apply (insert omap_replacement [of A r])
   595 apply (simp add: strong_replacement_def, clarify) 
   596 apply (drule_tac x=x in spec, clarify) 
   597 apply (simp add: Memrel_closed pred_closed obase_iff)
   598 apply (erule impE) 
   599  apply (clarsimp simp add: univalent_def)
   600  apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans, clarify)  
   601 apply (rule_tac x=Y in rexI) 
   602 apply (simp add: Memrel_closed pred_closed obase_iff, blast, assumption)
   603 done
   604 
   605 declare rall_simps [simp] rex_simps [simp]
   606 
   607 lemma (in M_axioms) otype_exists:
   608      "[| wellordered(M,A,r); M(A); M(r) |] ==> \<exists>i. M(i) & otype(M,A,r,i)"
   609 apply (insert omap_exists [of A r])  
   610 apply (simp add: otype_def, safe)
   611 apply (rule_tac x="range(x)" in exI) 
   612 apply blast 
   613 done
   614 
   615 theorem (in M_axioms) omap_ord_iso_otype:
   616      "[| wellordered(M,A,r); M(A); M(r) |]
   617       ==> \<exists>f. M(f) & (\<exists>i. M(i) & Ord(i) & f \<in> ord_iso(A, r, i, Memrel(i)))"
   618 apply (insert obase_exists [of A r] omap_exists [of A r] otype_exists [of A r], simp, clarify)
   619 apply (subgoal_tac "Ord(i)", blast intro: omap_ord_iso_otype) 
   620 apply (rule Ord_otype) 
   621     apply (force simp add: otype_def range_closed) 
   622    apply (simp_all add: wellordered_is_trans_on) 
   623 done
   624 
   625 lemma (in M_axioms) ordertype_exists:
   626      "[| wellordered(M,A,r); M(A); M(r) |]
   627       ==> \<exists>f. M(f) & (\<exists>i. M(i) & Ord(i) & f \<in> ord_iso(A, r, i, Memrel(i)))"
   628 apply (insert obase_exists [of A r] omap_exists [of A r] otype_exists [of A r], simp, clarify)
   629 apply (subgoal_tac "Ord(i)", blast intro: omap_ord_iso_otype) 
   630 apply (rule Ord_otype) 
   631     apply (force simp add: otype_def range_closed) 
   632    apply (simp_all add: wellordered_is_trans_on) 
   633 done
   634 
   635 
   636 lemma (in M_axioms) relativized_imp_well_ord: 
   637      "[| wellordered(M,A,r); M(A); M(r) |] ==> well_ord(A,r)" 
   638 apply (insert ordertype_exists [of A r], simp)
   639 apply (blast intro: well_ord_ord_iso well_ord_Memrel )  
   640 done
   641 
   642 subsection {*Kunen's theorem 5.4, poage 127*}
   643 
   644 text{*(a) The notion of Wellordering is absolute*}
   645 theorem (in M_axioms) well_ord_abs [simp]: 
   646      "[| M(A); M(r) |] ==> wellordered(M,A,r) <-> well_ord(A,r)" 
   647 by (blast intro: well_ord_imp_relativized relativized_imp_well_ord)  
   648 
   649 
   650 text{*(b) Order types are absolute*}
   651 lemma (in M_axioms) 
   652      "[| wellordered(M,A,r); f \<in> ord_iso(A, r, i, Memrel(i));
   653        M(A); M(r); M(f); M(i); Ord(i) |] ==> i = ordertype(A,r)"
   654 by (blast intro: Ord_ordertype relativized_imp_well_ord ordertype_ord_iso
   655                  Ord_iso_implies_eq ord_iso_sym ord_iso_trans)
   656 
   657 end