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