src/ZF/Order.thy
author paulson
Sun Jul 14 15:14:43 2002 +0200 (2002-07-14)
changeset 13356 c9cfe1638bf2
parent 13339 0f89104dd377
child 13611 2edf034c902a
permissions -rw-r--r--
improved presentation markup
     1 (*  Title:      ZF/Order.thy
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1994  University of Cambridge
     5 
     6 Results from the book "Set Theory: an Introduction to Independence Proofs"
     7         by Kenneth Kunen.  Chapter 1, section 6.
     8 *)
     9 
    10 header{*Partial and Total Orderings: Basic Definitions and Properties*}
    11 
    12 theory Order = WF + Perm:
    13 
    14 constdefs
    15 
    16   part_ord :: "[i,i]=>o"          	(*Strict partial ordering*)
    17    "part_ord(A,r) == irrefl(A,r) & trans[A](r)"
    18 
    19   linear   :: "[i,i]=>o"          	(*Strict total ordering*)
    20    "linear(A,r) == (ALL x:A. ALL y:A. <x,y>:r | x=y | <y,x>:r)"
    21 
    22   tot_ord  :: "[i,i]=>o"          	(*Strict total ordering*)
    23    "tot_ord(A,r) == part_ord(A,r) & linear(A,r)"
    24 
    25   well_ord :: "[i,i]=>o"          	(*Well-ordering*)
    26    "well_ord(A,r) == tot_ord(A,r) & wf[A](r)"
    27 
    28   mono_map :: "[i,i,i,i]=>i"      	(*Order-preserving maps*)
    29    "mono_map(A,r,B,s) ==
    30 	      {f: A->B. ALL x:A. ALL y:A. <x,y>:r --> <f`x,f`y>:s}"
    31 
    32   ord_iso  :: "[i,i,i,i]=>i"		(*Order isomorphisms*)
    33    "ord_iso(A,r,B,s) ==
    34 	      {f: bij(A,B). ALL x:A. ALL y:A. <x,y>:r <-> <f`x,f`y>:s}"
    35 
    36   pred     :: "[i,i,i]=>i"		(*Set of predecessors*)
    37    "pred(A,x,r) == {y:A. <y,x>:r}"
    38 
    39   ord_iso_map :: "[i,i,i,i]=>i"      	(*Construction for linearity theorem*)
    40    "ord_iso_map(A,r,B,s) ==
    41      UN x:A. UN y:B. UN f: ord_iso(pred(A,x,r), r, pred(B,y,s), s). {<x,y>}"
    42 
    43   first :: "[i, i, i] => o"
    44     "first(u, X, R) == u:X & (ALL v:X. v~=u --> <u,v> : R)"
    45 
    46 
    47 syntax (xsymbols)
    48     ord_iso :: "[i,i,i,i]=>i"      ("(\<langle>_, _\<rangle> \<cong>/ \<langle>_, _\<rangle>)" 51)
    49 
    50 
    51 subsection{*Immediate Consequences of the Definitions*}
    52 
    53 lemma part_ord_Imp_asym:
    54     "part_ord(A,r) ==> asym(r Int A*A)"
    55 by (unfold part_ord_def irrefl_def trans_on_def asym_def, blast)
    56 
    57 lemma linearE:
    58     "[| linear(A,r);  x:A;  y:A;
    59         <x,y>:r ==> P;  x=y ==> P;  <y,x>:r ==> P |]
    60      ==> P"
    61 by (simp add: linear_def, blast)
    62 
    63 
    64 (** General properties of well_ord **)
    65 
    66 lemma well_ordI:
    67     "[| wf[A](r); linear(A,r) |] ==> well_ord(A,r)"
    68 apply (simp add: irrefl_def part_ord_def tot_ord_def
    69                  trans_on_def well_ord_def wf_on_not_refl)
    70 apply (fast elim: linearE wf_on_asym wf_on_chain3)
    71 done
    72 
    73 lemma well_ord_is_wf:
    74     "well_ord(A,r) ==> wf[A](r)"
    75 by (unfold well_ord_def, safe)
    76 
    77 lemma well_ord_is_trans_on:
    78     "well_ord(A,r) ==> trans[A](r)"
    79 by (unfold well_ord_def tot_ord_def part_ord_def, safe)
    80 
    81 lemma well_ord_is_linear: "well_ord(A,r) ==> linear(A,r)"
    82 by (unfold well_ord_def tot_ord_def, blast)
    83 
    84 
    85 (** Derived rules for pred(A,x,r) **)
    86 
    87 lemma pred_iff: "y : pred(A,x,r) <-> <y,x>:r & y:A"
    88 by (unfold pred_def, blast)
    89 
    90 lemmas predI = conjI [THEN pred_iff [THEN iffD2]]
    91 
    92 lemma predE: "[| y: pred(A,x,r);  [| y:A; <y,x>:r |] ==> P |] ==> P"
    93 by (simp add: pred_def)
    94 
    95 lemma pred_subset_under: "pred(A,x,r) <= r -`` {x}"
    96 by (simp add: pred_def, blast)
    97 
    98 lemma pred_subset: "pred(A,x,r) <= A"
    99 by (simp add: pred_def, blast)
   100 
   101 lemma pred_pred_eq:
   102     "pred(pred(A,x,r), y, r) = pred(A,x,r) Int pred(A,y,r)"
   103 by (simp add: pred_def, blast)
   104 
   105 lemma trans_pred_pred_eq:
   106     "[| trans[A](r);  <y,x>:r;  x:A;  y:A |]
   107      ==> pred(pred(A,x,r), y, r) = pred(A,y,r)"
   108 by (unfold trans_on_def pred_def, blast)
   109 
   110 
   111 subsection{*Restricting an Ordering's Domain*}
   112 
   113 (** The ordering's properties hold over all subsets of its domain
   114     [including initial segments of the form pred(A,x,r) **)
   115 
   116 (*Note: a relation s such that s<=r need not be a partial ordering*)
   117 lemma part_ord_subset:
   118     "[| part_ord(A,r);  B<=A |] ==> part_ord(B,r)"
   119 by (unfold part_ord_def irrefl_def trans_on_def, blast)
   120 
   121 lemma linear_subset:
   122     "[| linear(A,r);  B<=A |] ==> linear(B,r)"
   123 by (unfold linear_def, blast)
   124 
   125 lemma tot_ord_subset:
   126     "[| tot_ord(A,r);  B<=A |] ==> tot_ord(B,r)"
   127 apply (unfold tot_ord_def)
   128 apply (fast elim!: part_ord_subset linear_subset)
   129 done
   130 
   131 lemma well_ord_subset:
   132     "[| well_ord(A,r);  B<=A |] ==> well_ord(B,r)"
   133 apply (unfold well_ord_def)
   134 apply (fast elim!: tot_ord_subset wf_on_subset_A)
   135 done
   136 
   137 
   138 (** Relations restricted to a smaller domain, by Krzysztof Grabczewski **)
   139 
   140 lemma irrefl_Int_iff: "irrefl(A,r Int A*A) <-> irrefl(A,r)"
   141 by (unfold irrefl_def, blast)
   142 
   143 lemma trans_on_Int_iff: "trans[A](r Int A*A) <-> trans[A](r)"
   144 by (unfold trans_on_def, blast)
   145 
   146 lemma part_ord_Int_iff: "part_ord(A,r Int A*A) <-> part_ord(A,r)"
   147 apply (unfold part_ord_def)
   148 apply (simp add: irrefl_Int_iff trans_on_Int_iff)
   149 done
   150 
   151 lemma linear_Int_iff: "linear(A,r Int A*A) <-> linear(A,r)"
   152 by (unfold linear_def, blast)
   153 
   154 lemma tot_ord_Int_iff: "tot_ord(A,r Int A*A) <-> tot_ord(A,r)"
   155 apply (unfold tot_ord_def)
   156 apply (simp add: part_ord_Int_iff linear_Int_iff)
   157 done
   158 
   159 lemma wf_on_Int_iff: "wf[A](r Int A*A) <-> wf[A](r)"
   160 apply (unfold wf_on_def wf_def, fast) (*10 times faster than Blast_tac!*)
   161 done
   162 
   163 lemma well_ord_Int_iff: "well_ord(A,r Int A*A) <-> well_ord(A,r)"
   164 apply (unfold well_ord_def)
   165 apply (simp add: tot_ord_Int_iff wf_on_Int_iff)
   166 done
   167 
   168 
   169 subsection{*Empty and Unit Domains*}
   170 
   171 (** Relations over the Empty Set **)
   172 
   173 lemma irrefl_0: "irrefl(0,r)"
   174 by (unfold irrefl_def, blast)
   175 
   176 lemma trans_on_0: "trans[0](r)"
   177 by (unfold trans_on_def, blast)
   178 
   179 lemma part_ord_0: "part_ord(0,r)"
   180 apply (unfold part_ord_def)
   181 apply (simp add: irrefl_0 trans_on_0)
   182 done
   183 
   184 lemma linear_0: "linear(0,r)"
   185 by (unfold linear_def, blast)
   186 
   187 lemma tot_ord_0: "tot_ord(0,r)"
   188 apply (unfold tot_ord_def)
   189 apply (simp add: part_ord_0 linear_0)
   190 done
   191 
   192 lemma wf_on_0: "wf[0](r)"
   193 by (unfold wf_on_def wf_def, blast)
   194 
   195 lemma well_ord_0: "well_ord(0,r)"
   196 apply (unfold well_ord_def)
   197 apply (simp add: tot_ord_0 wf_on_0)
   198 done
   199 
   200 
   201 (** The unit set is well-ordered by the empty relation (Grabczewski) **)
   202 
   203 lemma tot_ord_unit: "tot_ord({a},0)"
   204 by (simp add: irrefl_def trans_on_def part_ord_def linear_def tot_ord_def)
   205 
   206 lemma wf_on_unit: "wf[{a}](0)"
   207 by (simp add: wf_on_def wf_def, fast)
   208 
   209 lemma well_ord_unit: "well_ord({a},0)"
   210 apply (unfold well_ord_def)
   211 apply (simp add: tot_ord_unit wf_on_unit)
   212 done
   213 
   214 
   215 subsection{*Order-Isomorphisms*}
   216 
   217 text{*Suppes calls them "similarities"*}
   218 
   219 (** Order-preserving (monotone) maps **)
   220 
   221 lemma mono_map_is_fun: "f: mono_map(A,r,B,s) ==> f: A->B"
   222 by (simp add: mono_map_def)
   223 
   224 lemma mono_map_is_inj:
   225     "[| linear(A,r);  wf[B](s);  f: mono_map(A,r,B,s) |] ==> f: inj(A,B)"
   226 apply (unfold mono_map_def inj_def, clarify)
   227 apply (erule_tac x=w and y=x in linearE, assumption+)
   228 apply (force intro: apply_type dest: wf_on_not_refl)+
   229 done
   230 
   231 lemma ord_isoI:
   232     "[| f: bij(A, B);
   233         !!x y. [| x:A; y:A |] ==> <x, y> : r <-> <f`x, f`y> : s |]
   234      ==> f: ord_iso(A,r,B,s)"
   235 by (simp add: ord_iso_def)
   236 
   237 lemma ord_iso_is_mono_map:
   238     "f: ord_iso(A,r,B,s) ==> f: mono_map(A,r,B,s)"
   239 apply (simp add: ord_iso_def mono_map_def)
   240 apply (blast dest!: bij_is_fun)
   241 done
   242 
   243 lemma ord_iso_is_bij:
   244     "f: ord_iso(A,r,B,s) ==> f: bij(A,B)"
   245 by (simp add: ord_iso_def)
   246 
   247 (*Needed?  But ord_iso_converse is!*)
   248 lemma ord_iso_apply:
   249     "[| f: ord_iso(A,r,B,s);  <x,y>: r;  x:A;  y:A |] ==> <f`x, f`y> : s"
   250 by (simp add: ord_iso_def, blast)
   251 
   252 lemma ord_iso_converse:
   253     "[| f: ord_iso(A,r,B,s);  <x,y>: s;  x:B;  y:B |]
   254      ==> <converse(f) ` x, converse(f) ` y> : r"
   255 apply (simp add: ord_iso_def, clarify)
   256 apply (erule bspec [THEN bspec, THEN iffD2])
   257 apply (erule asm_rl bij_converse_bij [THEN bij_is_fun, THEN apply_type])+
   258 apply (auto simp add: right_inverse_bij)
   259 done
   260 
   261 
   262 (** Symmetry and Transitivity Rules **)
   263 
   264 (*Reflexivity of similarity*)
   265 lemma ord_iso_refl: "id(A): ord_iso(A,r,A,r)"
   266 by (rule id_bij [THEN ord_isoI], simp)
   267 
   268 (*Symmetry of similarity*)
   269 lemma ord_iso_sym: "f: ord_iso(A,r,B,s) ==> converse(f): ord_iso(B,s,A,r)"
   270 apply (simp add: ord_iso_def)
   271 apply (auto simp add: right_inverse_bij bij_converse_bij
   272                       bij_is_fun [THEN apply_funtype])
   273 done
   274 
   275 (*Transitivity of similarity*)
   276 lemma mono_map_trans:
   277     "[| g: mono_map(A,r,B,s);  f: mono_map(B,s,C,t) |]
   278      ==> (f O g): mono_map(A,r,C,t)"
   279 apply (unfold mono_map_def)
   280 apply (auto simp add: comp_fun)
   281 done
   282 
   283 (*Transitivity of similarity: the order-isomorphism relation*)
   284 lemma ord_iso_trans:
   285     "[| g: ord_iso(A,r,B,s);  f: ord_iso(B,s,C,t) |]
   286      ==> (f O g): ord_iso(A,r,C,t)"
   287 apply (unfold ord_iso_def, clarify)
   288 apply (frule bij_is_fun [of f])
   289 apply (frule bij_is_fun [of g])
   290 apply (auto simp add: comp_bij)
   291 done
   292 
   293 (** Two monotone maps can make an order-isomorphism **)
   294 
   295 lemma mono_ord_isoI:
   296     "[| f: mono_map(A,r,B,s);  g: mono_map(B,s,A,r);
   297         f O g = id(B);  g O f = id(A) |] ==> f: ord_iso(A,r,B,s)"
   298 apply (simp add: ord_iso_def mono_map_def, safe)
   299 apply (intro fg_imp_bijective, auto)
   300 apply (subgoal_tac "<g` (f`x), g` (f`y) > : r")
   301 apply (simp add: comp_eq_id_iff [THEN iffD1])
   302 apply (blast intro: apply_funtype)
   303 done
   304 
   305 lemma well_ord_mono_ord_isoI:
   306      "[| well_ord(A,r);  well_ord(B,s);
   307          f: mono_map(A,r,B,s);  converse(f): mono_map(B,s,A,r) |]
   308       ==> f: ord_iso(A,r,B,s)"
   309 apply (intro mono_ord_isoI, auto)
   310 apply (frule mono_map_is_fun [THEN fun_is_rel])
   311 apply (erule converse_converse [THEN subst], rule left_comp_inverse)
   312 apply (blast intro: left_comp_inverse mono_map_is_inj well_ord_is_linear
   313                     well_ord_is_wf)+
   314 done
   315 
   316 
   317 (** Order-isomorphisms preserve the ordering's properties **)
   318 
   319 lemma part_ord_ord_iso:
   320     "[| part_ord(B,s);  f: ord_iso(A,r,B,s) |] ==> part_ord(A,r)"
   321 apply (simp add: part_ord_def irrefl_def trans_on_def ord_iso_def)
   322 apply (fast intro: bij_is_fun [THEN apply_type])
   323 done
   324 
   325 lemma linear_ord_iso:
   326     "[| linear(B,s);  f: ord_iso(A,r,B,s) |] ==> linear(A,r)"
   327 apply (simp add: linear_def ord_iso_def, safe)
   328 apply (drule_tac x1 = "f`x" and x = "f`y" in bspec [THEN bspec])
   329 apply (safe elim!: bij_is_fun [THEN apply_type])
   330 apply (drule_tac t = "op ` (converse (f))" in subst_context)
   331 apply (simp add: left_inverse_bij)
   332 done
   333 
   334 lemma wf_on_ord_iso:
   335     "[| wf[B](s);  f: ord_iso(A,r,B,s) |] ==> wf[A](r)"
   336 apply (simp add: wf_on_def wf_def ord_iso_def, safe)
   337 apply (drule_tac x = "{f`z. z:Z Int A}" in spec)
   338 apply (safe intro!: equalityI)
   339 apply (blast dest!: equalityD1 intro: bij_is_fun [THEN apply_type])+
   340 done
   341 
   342 lemma well_ord_ord_iso:
   343     "[| well_ord(B,s);  f: ord_iso(A,r,B,s) |] ==> well_ord(A,r)"
   344 apply (unfold well_ord_def tot_ord_def)
   345 apply (fast elim!: part_ord_ord_iso linear_ord_iso wf_on_ord_iso)
   346 done
   347 
   348 
   349 subsection{*Main results of Kunen, Chapter 1 section 6*}
   350 
   351 (*Inductive argument for Kunen's Lemma 6.1, etc.
   352   Simple proof from Halmos, page 72*)
   353 lemma well_ord_iso_subset_lemma:
   354      "[| well_ord(A,r);  f: ord_iso(A,r, A',r);  A'<= A;  y: A |]
   355       ==> ~ <f`y, y>: r"
   356 apply (simp add: well_ord_def ord_iso_def)
   357 apply (elim conjE CollectE)
   358 apply (rule_tac a=y in wf_on_induct, assumption+)
   359 apply (blast dest: bij_is_fun [THEN apply_type])
   360 done
   361 
   362 (*Kunen's Lemma 6.1: there's no order-isomorphism to an initial segment
   363                      of a well-ordering*)
   364 lemma well_ord_iso_predE:
   365      "[| well_ord(A,r);  f : ord_iso(A, r, pred(A,x,r), r);  x:A |] ==> P"
   366 apply (insert well_ord_iso_subset_lemma [of A r f "pred(A,x,r)" x])
   367 apply (simp add: pred_subset)
   368 (*Now we know  f`x < x *)
   369 apply (drule ord_iso_is_bij [THEN bij_is_fun, THEN apply_type], assumption)
   370 (*Now we also know f`x : pred(A,x,r);  contradiction! *)
   371 apply (simp add: well_ord_def pred_def)
   372 done
   373 
   374 (*Simple consequence of Lemma 6.1*)
   375 lemma well_ord_iso_pred_eq:
   376      "[| well_ord(A,r);  f : ord_iso(pred(A,a,r), r, pred(A,c,r), r);
   377          a:A;  c:A |] ==> a=c"
   378 apply (frule well_ord_is_trans_on)
   379 apply (frule well_ord_is_linear)
   380 apply (erule_tac x=a and y=c in linearE, assumption+)
   381 apply (drule ord_iso_sym)
   382 (*two symmetric cases*)
   383 apply (auto elim!: well_ord_subset [OF _ pred_subset, THEN well_ord_iso_predE]
   384             intro!: predI
   385             simp add: trans_pred_pred_eq)
   386 done
   387 
   388 (*Does not assume r is a wellordering!*)
   389 lemma ord_iso_image_pred:
   390      "[|f : ord_iso(A,r,B,s);  a:A|] ==> f `` pred(A,a,r) = pred(B, f`a, s)"
   391 apply (unfold ord_iso_def pred_def)
   392 apply (erule CollectE)
   393 apply (simp (no_asm_simp) add: image_fun [OF bij_is_fun Collect_subset])
   394 apply (rule equalityI)
   395 apply (safe elim!: bij_is_fun [THEN apply_type])
   396 apply (rule RepFun_eqI)
   397 apply (blast intro!: right_inverse_bij [symmetric])
   398 apply (auto simp add: right_inverse_bij  bij_is_fun [THEN apply_funtype])
   399 done
   400 
   401 lemma ord_iso_restrict_image:
   402      "[| f : ord_iso(A,r,B,s);  C<=A |] 
   403       ==> restrict(f,C) : ord_iso(C, r, f``C, s)"
   404 apply (simp add: ord_iso_def) 
   405 apply (blast intro: bij_is_inj restrict_bij) 
   406 done
   407 
   408 (*But in use, A and B may themselves be initial segments.  Then use
   409   trans_pred_pred_eq to simplify the pred(pred...) terms.  See just below.*)
   410 lemma ord_iso_restrict_pred:
   411    "[| f : ord_iso(A,r,B,s);   a:A |]
   412     ==> restrict(f, pred(A,a,r)) : ord_iso(pred(A,a,r), r, pred(B, f`a, s), s)"
   413 apply (simp add: ord_iso_image_pred [symmetric]) 
   414 apply (blast intro: ord_iso_restrict_image elim: predE) 
   415 done
   416 
   417 (*Tricky; a lot of forward proof!*)
   418 lemma well_ord_iso_preserving:
   419      "[| well_ord(A,r);  well_ord(B,s);  <a,c>: r;
   420          f : ord_iso(pred(A,a,r), r, pred(B,b,s), s);
   421          g : ord_iso(pred(A,c,r), r, pred(B,d,s), s);
   422          a:A;  c:A;  b:B;  d:B |] ==> <b,d>: s"
   423 apply (frule ord_iso_is_bij [THEN bij_is_fun, THEN apply_type], (erule asm_rl predI predE)+)
   424 apply (subgoal_tac "b = g`a")
   425 apply (simp (no_asm_simp))
   426 apply (rule well_ord_iso_pred_eq, auto)
   427 apply (frule ord_iso_restrict_pred, (erule asm_rl predI)+)
   428 apply (simp add: well_ord_is_trans_on trans_pred_pred_eq)
   429 apply (erule ord_iso_sym [THEN ord_iso_trans], assumption)
   430 done
   431 
   432 (*See Halmos, page 72*)
   433 lemma well_ord_iso_unique_lemma:
   434      "[| well_ord(A,r);
   435          f: ord_iso(A,r, B,s);  g: ord_iso(A,r, B,s);  y: A |]
   436       ==> ~ <g`y, f`y> : s"
   437 apply (frule well_ord_iso_subset_lemma)
   438 apply (rule_tac f = "converse (f) " and g = g in ord_iso_trans)
   439 apply auto
   440 apply (blast intro: ord_iso_sym)
   441 apply (frule ord_iso_is_bij [of f])
   442 apply (frule ord_iso_is_bij [of g])
   443 apply (frule ord_iso_converse)
   444 apply (blast intro!: bij_converse_bij
   445              intro: bij_is_fun apply_funtype)+
   446 apply (erule notE)
   447 apply (simp add: left_inverse_bij bij_is_fun comp_fun_apply [of _ A B])
   448 done
   449 
   450 
   451 (*Kunen's Lemma 6.2: Order-isomorphisms between well-orderings are unique*)
   452 lemma well_ord_iso_unique: "[| well_ord(A,r);
   453          f: ord_iso(A,r, B,s);  g: ord_iso(A,r, B,s) |] ==> f = g"
   454 apply (rule fun_extension)
   455 apply (erule ord_iso_is_bij [THEN bij_is_fun])+
   456 apply (subgoal_tac "f`x : B & g`x : B & linear(B,s)")
   457  apply (simp add: linear_def)
   458  apply (blast dest: well_ord_iso_unique_lemma)
   459 apply (blast intro: ord_iso_is_bij bij_is_fun apply_funtype
   460                     well_ord_is_linear well_ord_ord_iso ord_iso_sym)
   461 done
   462 
   463 subsection{*Towards Kunen's Theorem 6.3: Linearity of the Similarity Relation*}
   464 
   465 lemma ord_iso_map_subset: "ord_iso_map(A,r,B,s) <= A*B"
   466 by (unfold ord_iso_map_def, blast)
   467 
   468 lemma domain_ord_iso_map: "domain(ord_iso_map(A,r,B,s)) <= A"
   469 by (unfold ord_iso_map_def, blast)
   470 
   471 lemma range_ord_iso_map: "range(ord_iso_map(A,r,B,s)) <= B"
   472 by (unfold ord_iso_map_def, blast)
   473 
   474 lemma converse_ord_iso_map:
   475     "converse(ord_iso_map(A,r,B,s)) = ord_iso_map(B,s,A,r)"
   476 apply (unfold ord_iso_map_def)
   477 apply (blast intro: ord_iso_sym)
   478 done
   479 
   480 lemma function_ord_iso_map:
   481     "well_ord(B,s) ==> function(ord_iso_map(A,r,B,s))"
   482 apply (unfold ord_iso_map_def function_def)
   483 apply (blast intro: well_ord_iso_pred_eq ord_iso_sym ord_iso_trans)
   484 done
   485 
   486 lemma ord_iso_map_fun: "well_ord(B,s) ==> ord_iso_map(A,r,B,s)
   487            : domain(ord_iso_map(A,r,B,s)) -> range(ord_iso_map(A,r,B,s))"
   488 by (simp add: Pi_iff function_ord_iso_map
   489                  ord_iso_map_subset [THEN domain_times_range])
   490 
   491 lemma ord_iso_map_mono_map:
   492     "[| well_ord(A,r);  well_ord(B,s) |]
   493      ==> ord_iso_map(A,r,B,s)
   494            : mono_map(domain(ord_iso_map(A,r,B,s)), r,
   495                       range(ord_iso_map(A,r,B,s)), s)"
   496 apply (unfold mono_map_def)
   497 apply (simp (no_asm_simp) add: ord_iso_map_fun)
   498 apply safe
   499 apply (subgoal_tac "x:A & ya:A & y:B & yb:B")
   500  apply (simp add: apply_equality [OF _  ord_iso_map_fun])
   501  apply (unfold ord_iso_map_def)
   502  apply (blast intro: well_ord_iso_preserving, blast)
   503 done
   504 
   505 lemma ord_iso_map_ord_iso:
   506     "[| well_ord(A,r);  well_ord(B,s) |] ==> ord_iso_map(A,r,B,s)
   507            : ord_iso(domain(ord_iso_map(A,r,B,s)), r,
   508                       range(ord_iso_map(A,r,B,s)), s)"
   509 apply (rule well_ord_mono_ord_isoI)
   510    prefer 4
   511    apply (rule converse_ord_iso_map [THEN subst])
   512    apply (simp add: ord_iso_map_mono_map
   513 		    ord_iso_map_subset [THEN converse_converse])
   514 apply (blast intro!: domain_ord_iso_map range_ord_iso_map
   515              intro: well_ord_subset ord_iso_map_mono_map)+
   516 done
   517 
   518 
   519 (*One way of saying that domain(ord_iso_map(A,r,B,s)) is downwards-closed*)
   520 lemma domain_ord_iso_map_subset:
   521      "[| well_ord(A,r);  well_ord(B,s);
   522          a: A;  a ~: domain(ord_iso_map(A,r,B,s)) |]
   523       ==>  domain(ord_iso_map(A,r,B,s)) <= pred(A, a, r)"
   524 apply (unfold ord_iso_map_def)
   525 apply (safe intro!: predI)
   526 (*Case analysis on  xa vs a in r *)
   527 apply (simp (no_asm_simp))
   528 apply (frule_tac A = A in well_ord_is_linear)
   529 apply (rename_tac b y f)
   530 apply (erule_tac x=b and y=a in linearE, assumption+)
   531 (*Trivial case: b=a*)
   532 apply clarify
   533 apply blast
   534 (*Harder case: <a, xa>: r*)
   535 apply (frule ord_iso_is_bij [THEN bij_is_fun, THEN apply_type],
   536        (erule asm_rl predI predE)+)
   537 apply (frule ord_iso_restrict_pred)
   538  apply (simp add: pred_iff)
   539 apply (simp split: split_if_asm
   540           add: well_ord_is_trans_on trans_pred_pred_eq domain_UN domain_Union, blast)
   541 done
   542 
   543 (*For the 4-way case analysis in the main result*)
   544 lemma domain_ord_iso_map_cases:
   545      "[| well_ord(A,r);  well_ord(B,s) |]
   546       ==> domain(ord_iso_map(A,r,B,s)) = A |
   547           (EX x:A. domain(ord_iso_map(A,r,B,s)) = pred(A,x,r))"
   548 apply (frule well_ord_is_wf)
   549 apply (unfold wf_on_def wf_def)
   550 apply (drule_tac x = "A-domain (ord_iso_map (A,r,B,s))" in spec)
   551 apply safe
   552 (*The first case: the domain equals A*)
   553 apply (rule domain_ord_iso_map [THEN equalityI])
   554 apply (erule Diff_eq_0_iff [THEN iffD1])
   555 (*The other case: the domain equals an initial segment*)
   556 apply (blast del: domainI subsetI
   557 	     elim!: predE
   558 	     intro!: domain_ord_iso_map_subset
   559              intro: subsetI)+
   560 done
   561 
   562 (*As above, by duality*)
   563 lemma range_ord_iso_map_cases:
   564     "[| well_ord(A,r);  well_ord(B,s) |]
   565      ==> range(ord_iso_map(A,r,B,s)) = B |
   566          (EX y:B. range(ord_iso_map(A,r,B,s)) = pred(B,y,s))"
   567 apply (rule converse_ord_iso_map [THEN subst])
   568 apply (simp add: domain_ord_iso_map_cases)
   569 done
   570 
   571 text{*Kunen's Theorem 6.3: Fundamental Theorem for Well-Ordered Sets*}
   572 theorem well_ord_trichotomy:
   573    "[| well_ord(A,r);  well_ord(B,s) |]
   574     ==> ord_iso_map(A,r,B,s) : ord_iso(A, r, B, s) |
   575         (EX x:A. ord_iso_map(A,r,B,s) : ord_iso(pred(A,x,r), r, B, s)) |
   576         (EX y:B. ord_iso_map(A,r,B,s) : ord_iso(A, r, pred(B,y,s), s))"
   577 apply (frule_tac B = B in domain_ord_iso_map_cases, assumption)
   578 apply (frule_tac B = B in range_ord_iso_map_cases, assumption)
   579 apply (drule ord_iso_map_ord_iso, assumption)
   580 apply (elim disjE bexE)
   581    apply (simp_all add: bexI)
   582 apply (rule wf_on_not_refl [THEN notE])
   583   apply (erule well_ord_is_wf)
   584  apply assumption
   585 apply (subgoal_tac "<x,y>: ord_iso_map (A,r,B,s) ")
   586  apply (drule rangeI)
   587  apply (simp add: pred_def)
   588 apply (unfold ord_iso_map_def, blast)
   589 done
   590 
   591 
   592 subsection{*Miscellaneous Results by Krzysztof Grabczewski*}
   593 
   594 (** Properties of converse(r) **)
   595 
   596 lemma irrefl_converse: "irrefl(A,r) ==> irrefl(A,converse(r))"
   597 by (unfold irrefl_def, blast)
   598 
   599 lemma trans_on_converse: "trans[A](r) ==> trans[A](converse(r))"
   600 by (unfold trans_on_def, blast)
   601 
   602 lemma part_ord_converse: "part_ord(A,r) ==> part_ord(A,converse(r))"
   603 apply (unfold part_ord_def)
   604 apply (blast intro!: irrefl_converse trans_on_converse)
   605 done
   606 
   607 lemma linear_converse: "linear(A,r) ==> linear(A,converse(r))"
   608 by (unfold linear_def, blast)
   609 
   610 lemma tot_ord_converse: "tot_ord(A,r) ==> tot_ord(A,converse(r))"
   611 apply (unfold tot_ord_def)
   612 apply (blast intro!: part_ord_converse linear_converse)
   613 done
   614 
   615 
   616 (** By Krzysztof Grabczewski.
   617     Lemmas involving the first element of a well ordered set **)
   618 
   619 lemma first_is_elem: "first(b,B,r) ==> b:B"
   620 by (unfold first_def, blast)
   621 
   622 lemma well_ord_imp_ex1_first:
   623         "[| well_ord(A,r); B<=A; B~=0 |] ==> (EX! b. first(b,B,r))"
   624 apply (unfold well_ord_def wf_on_def wf_def first_def)
   625 apply (elim conjE allE disjE, blast)
   626 apply (erule bexE)
   627 apply (rule_tac a = x in ex1I, auto)
   628 apply (unfold tot_ord_def linear_def, blast)
   629 done
   630 
   631 lemma the_first_in:
   632      "[| well_ord(A,r); B<=A; B~=0 |] ==> (THE b. first(b,B,r)) : B"
   633 apply (drule well_ord_imp_ex1_first, assumption+)
   634 apply (rule first_is_elem)
   635 apply (erule theI)
   636 done
   637 
   638 ML {*
   639 val pred_def = thm "pred_def"
   640 val linear_def = thm "linear_def"
   641 val part_ord_def = thm "part_ord_def"
   642 val tot_ord_def = thm "tot_ord_def"
   643 val well_ord_def = thm "well_ord_def"
   644 val ord_iso_def = thm "ord_iso_def"
   645 val mono_map_def = thm "mono_map_def";
   646 
   647 val part_ord_Imp_asym = thm "part_ord_Imp_asym";
   648 val linearE = thm "linearE";
   649 val well_ordI = thm "well_ordI";
   650 val well_ord_is_wf = thm "well_ord_is_wf";
   651 val well_ord_is_trans_on = thm "well_ord_is_trans_on";
   652 val well_ord_is_linear = thm "well_ord_is_linear";
   653 val pred_iff = thm "pred_iff";
   654 val predI = thm "predI";
   655 val predE = thm "predE";
   656 val pred_subset_under = thm "pred_subset_under";
   657 val pred_subset = thm "pred_subset";
   658 val pred_pred_eq = thm "pred_pred_eq";
   659 val trans_pred_pred_eq = thm "trans_pred_pred_eq";
   660 val part_ord_subset = thm "part_ord_subset";
   661 val linear_subset = thm "linear_subset";
   662 val tot_ord_subset = thm "tot_ord_subset";
   663 val well_ord_subset = thm "well_ord_subset";
   664 val irrefl_Int_iff = thm "irrefl_Int_iff";
   665 val trans_on_Int_iff = thm "trans_on_Int_iff";
   666 val part_ord_Int_iff = thm "part_ord_Int_iff";
   667 val linear_Int_iff = thm "linear_Int_iff";
   668 val tot_ord_Int_iff = thm "tot_ord_Int_iff";
   669 val wf_on_Int_iff = thm "wf_on_Int_iff";
   670 val well_ord_Int_iff = thm "well_ord_Int_iff";
   671 val irrefl_0 = thm "irrefl_0";
   672 val trans_on_0 = thm "trans_on_0";
   673 val part_ord_0 = thm "part_ord_0";
   674 val linear_0 = thm "linear_0";
   675 val tot_ord_0 = thm "tot_ord_0";
   676 val wf_on_0 = thm "wf_on_0";
   677 val well_ord_0 = thm "well_ord_0";
   678 val tot_ord_unit = thm "tot_ord_unit";
   679 val wf_on_unit = thm "wf_on_unit";
   680 val well_ord_unit = thm "well_ord_unit";
   681 val mono_map_is_fun = thm "mono_map_is_fun";
   682 val mono_map_is_inj = thm "mono_map_is_inj";
   683 val ord_isoI = thm "ord_isoI";
   684 val ord_iso_is_mono_map = thm "ord_iso_is_mono_map";
   685 val ord_iso_is_bij = thm "ord_iso_is_bij";
   686 val ord_iso_apply = thm "ord_iso_apply";
   687 val ord_iso_converse = thm "ord_iso_converse";
   688 val ord_iso_refl = thm "ord_iso_refl";
   689 val ord_iso_sym = thm "ord_iso_sym";
   690 val mono_map_trans = thm "mono_map_trans";
   691 val ord_iso_trans = thm "ord_iso_trans";
   692 val mono_ord_isoI = thm "mono_ord_isoI";
   693 val well_ord_mono_ord_isoI = thm "well_ord_mono_ord_isoI";
   694 val part_ord_ord_iso = thm "part_ord_ord_iso";
   695 val linear_ord_iso = thm "linear_ord_iso";
   696 val wf_on_ord_iso = thm "wf_on_ord_iso";
   697 val well_ord_ord_iso = thm "well_ord_ord_iso";
   698 val well_ord_iso_predE = thm "well_ord_iso_predE";
   699 val well_ord_iso_pred_eq = thm "well_ord_iso_pred_eq";
   700 val ord_iso_image_pred = thm "ord_iso_image_pred";
   701 val ord_iso_restrict_pred = thm "ord_iso_restrict_pred";
   702 val well_ord_iso_preserving = thm "well_ord_iso_preserving";
   703 val well_ord_iso_unique = thm "well_ord_iso_unique";
   704 val ord_iso_map_subset = thm "ord_iso_map_subset";
   705 val domain_ord_iso_map = thm "domain_ord_iso_map";
   706 val range_ord_iso_map = thm "range_ord_iso_map";
   707 val converse_ord_iso_map = thm "converse_ord_iso_map";
   708 val function_ord_iso_map = thm "function_ord_iso_map";
   709 val ord_iso_map_fun = thm "ord_iso_map_fun";
   710 val ord_iso_map_mono_map = thm "ord_iso_map_mono_map";
   711 val ord_iso_map_ord_iso = thm "ord_iso_map_ord_iso";
   712 val domain_ord_iso_map_subset = thm "domain_ord_iso_map_subset";
   713 val domain_ord_iso_map_cases = thm "domain_ord_iso_map_cases";
   714 val range_ord_iso_map_cases = thm "range_ord_iso_map_cases";
   715 val well_ord_trichotomy = thm "well_ord_trichotomy";
   716 val irrefl_converse = thm "irrefl_converse";
   717 val trans_on_converse = thm "trans_on_converse";
   718 val part_ord_converse = thm "part_ord_converse";
   719 val linear_converse = thm "linear_converse";
   720 val tot_ord_converse = thm "tot_ord_converse";
   721 val first_is_elem = thm "first_is_elem";
   722 val well_ord_imp_ex1_first = thm "well_ord_imp_ex1_first";
   723 val the_first_in = thm "the_first_in";
   724 *}
   725 
   726 end