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