src/ZF/Constructible/Rank.thy
author blanchet
Wed, 27 Aug 2014 08:41:12 +0200
changeset 58043 a90847f03ec8
parent 46823 57bf0cecb366
child 58860 fee7cfa69c50
permissions -rw-r--r--
avoid 'PolyML.makestring'
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     1
(*  Title:      ZF/Constructible/Rank.thy
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     3
*)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     4
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     5
header {*Absoluteness for Order Types, Rank Functions and Well-Founded 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     6
         Relations*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     7
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 13721
diff changeset
     8
theory Rank imports WF_absolute begin
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
     9
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    10
subsection {*Order Types: A Direct Construction by Replacement*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    11
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    12
locale M_ordertype = M_basic +
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    13
assumes well_ord_iso_separation:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    14
     "[| M(A); M(f); M(r) |]
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
    15
      ==> separation (M, \<lambda>x. x\<in>A \<longrightarrow> (\<exists>y[M]. (\<exists>p[M].
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    16
                     fun_apply(M,f,x,y) & pair(M,y,x,p) & p \<in> r)))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    17
  and obase_separation:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    18
     --{*part of the order type formalization*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    19
     "[| M(A); M(r) |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    20
      ==> separation(M, \<lambda>a. \<exists>x[M]. \<exists>g[M]. \<exists>mx[M]. \<exists>par[M].
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    21
             ordinal(M,x) & membership(M,x,mx) & pred_set(M,A,a,r,par) &
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    22
             order_isomorphism(M,par,r,x,mx,g))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    23
  and obase_equals_separation:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    24
     "[| M(A); M(r) |]
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
    25
      ==> separation (M, \<lambda>x. x\<in>A \<longrightarrow> ~(\<exists>y[M]. \<exists>g[M].
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    26
                              ordinal(M,y) & (\<exists>my[M]. \<exists>pxr[M].
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    27
                              membership(M,y,my) & pred_set(M,A,x,r,pxr) &
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    28
                              order_isomorphism(M,pxr,r,y,my,g))))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    29
  and omap_replacement:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    30
     "[| M(A); M(r) |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    31
      ==> strong_replacement(M,
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    32
             \<lambda>a z. \<exists>x[M]. \<exists>g[M]. \<exists>mx[M]. \<exists>par[M].
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    33
             ordinal(M,x) & pair(M,a,x,z) & membership(M,x,mx) &
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
    34
             pred_set(M,A,a,r,par) & order_isomorphism(M,par,r,x,mx,g))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    35
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    36
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    37
text{*Inductive argument for Kunen's Lemma I 6.1, etc.
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    38
      Simple proof from Halmos, page 72*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    39
lemma  (in M_ordertype) wellordered_iso_subset_lemma: 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    40
     "[| wellordered(M,A,r);  f \<in> ord_iso(A,r, A',r);  A'<= A;  y \<in> A;  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    41
       M(A);  M(f);  M(r) |] ==> ~ <f`y, y> \<in> r"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    42
apply (unfold wellordered_def ord_iso_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    43
apply (elim conjE CollectE) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    44
apply (erule wellfounded_on_induct, assumption+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    45
 apply (insert well_ord_iso_separation [of A f r])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    46
 apply (simp, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    47
apply (drule_tac a = x in bij_is_fun [THEN apply_type], assumption, blast)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    48
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    49
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    50
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    51
text{*Kunen's Lemma I 6.1, page 14: 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    52
      there's no order-isomorphism to an initial segment of a well-ordering*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    53
lemma (in M_ordertype) wellordered_iso_predD:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    54
     "[| wellordered(M,A,r);  f \<in> ord_iso(A, r, Order.pred(A,x,r), r);  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    55
       M(A);  M(f);  M(r) |] ==> x \<notin> A"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    56
apply (rule notI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    57
apply (frule wellordered_iso_subset_lemma, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    58
apply (auto elim: predE)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    59
(*Now we know  ~ (f`x < x) *)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    60
apply (drule ord_iso_is_bij [THEN bij_is_fun, THEN apply_type], assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    61
(*Now we also know f`x  \<in> pred(A,x,r);  contradiction! *)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    62
apply (simp add: Order.pred_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    63
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    64
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    65
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    66
lemma (in M_ordertype) wellordered_iso_pred_eq_lemma:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    67
     "[| f \<in> \<langle>Order.pred(A,y,r), r\<rangle> \<cong> \<langle>Order.pred(A,x,r), r\<rangle>;
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    68
       wellordered(M,A,r); x\<in>A; y\<in>A; M(A); M(f); M(r) |] ==> <x,y> \<notin> r"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    69
apply (frule wellordered_is_trans_on, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    70
apply (rule notI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    71
apply (drule_tac x2=y and x=x and r2=r in 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    72
         wellordered_subset [OF _ pred_subset, THEN wellordered_iso_predD]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    73
apply (simp add: trans_pred_pred_eq) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    74
apply (blast intro: predI dest: transM)+
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    75
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    76
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    77
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    78
text{*Simple consequence of Lemma 6.1*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    79
lemma (in M_ordertype) wellordered_iso_pred_eq:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    80
     "[| wellordered(M,A,r);
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    81
       f \<in> ord_iso(Order.pred(A,a,r), r, Order.pred(A,c,r), r);   
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    82
       M(A);  M(f);  M(r);  a\<in>A;  c\<in>A |] ==> a=c"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    83
apply (frule wellordered_is_trans_on, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    84
apply (frule wellordered_is_linear, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    85
apply (erule_tac x=a and y=c in linearE, auto) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    86
apply (drule ord_iso_sym)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    87
(*two symmetric cases*)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    88
apply (blast dest: wellordered_iso_pred_eq_lemma)+ 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    89
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    90
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    91
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    92
text{*Following Kunen's Theorem I 7.6, page 17.  Note that this material is
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    93
not required elsewhere.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    94
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    95
text{*Can't use @{text well_ord_iso_preserving} because it needs the
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    96
strong premise @{term "well_ord(A,r)"}*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    97
lemma (in M_ordertype) ord_iso_pred_imp_lt:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    98
     "[| f \<in> ord_iso(Order.pred(A,x,r), r, i, Memrel(i));
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
    99
         g \<in> ord_iso(Order.pred(A,y,r), r, j, Memrel(j));
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   100
         wellordered(M,A,r);  x \<in> A;  y \<in> A; M(A); M(r); M(f); M(g); M(j);
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   101
         Ord(i); Ord(j); \<langle>x,y\<rangle> \<in> r |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   102
      ==> i < j"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   103
apply (frule wellordered_is_trans_on, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   104
apply (frule_tac y=y in transM, assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   105
apply (rule_tac i=i and j=j in Ord_linear_lt, auto)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   106
txt{*case @{term "i=j"} yields a contradiction*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   107
 apply (rule_tac x1=x and A1="Order.pred(A,y,r)" in 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   108
          wellordered_iso_predD [THEN notE]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   109
   apply (blast intro: wellordered_subset [OF _ pred_subset]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   110
  apply (simp add: trans_pred_pred_eq)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   111
  apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   112
 apply (simp_all add: pred_iff pred_closed converse_closed comp_closed)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   113
txt{*case @{term "j<i"} also yields a contradiction*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   114
apply (frule restrict_ord_iso2, assumption+) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   115
apply (frule ord_iso_sym [THEN ord_iso_is_bij, THEN bij_is_fun]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   116
apply (frule apply_type, blast intro: ltD) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   117
  --{*thus @{term "converse(f)`j \<in> Order.pred(A,x,r)"}*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   118
apply (simp add: pred_iff) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   119
apply (subgoal_tac
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   120
       "\<exists>h[M]. h \<in> ord_iso(Order.pred(A,y,r), r, 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   121
                               Order.pred(A, converse(f)`j, r), r)")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   122
 apply (clarify, frule wellordered_iso_pred_eq, assumption+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   123
 apply (blast dest: wellordered_asym)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   124
apply (intro rexI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   125
 apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans)+
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   126
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   127
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   128
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   129
lemma ord_iso_converse1:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   130
     "[| f: ord_iso(A,r,B,s);  <b, f`a>: s;  a:A;  b:B |] 
13721
2cf506c09946 stylistic tweaks
paulson
parents: 13647
diff changeset
   131
      ==> <converse(f) ` b, a> \<in> r"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   132
apply (frule ord_iso_converse, assumption+) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   133
apply (blast intro: ord_iso_is_bij [THEN bij_is_fun, THEN apply_funtype]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   134
apply (simp add: left_inverse_bij [OF ord_iso_is_bij])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   135
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   136
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   137
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   138
definition  
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   139
  obase :: "[i=>o,i,i] => i" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   140
       --{*the domain of @{text om}, eventually shown to equal @{text A}*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   141
   "obase(M,A,r) == {a\<in>A. \<exists>x[M]. \<exists>g[M]. Ord(x) & 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   142
                          g \<in> ord_iso(Order.pred(A,a,r),r,x,Memrel(x))}"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   143
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   144
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   145
  omap :: "[i=>o,i,i,i] => o" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   146
    --{*the function that maps wosets to order types*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   147
   "omap(M,A,r,f) == 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   148
        \<forall>z[M].
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   149
         z \<in> f \<longleftrightarrow> (\<exists>a\<in>A. \<exists>x[M]. \<exists>g[M]. z = <a,x> & Ord(x) & 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   150
                        g \<in> ord_iso(Order.pred(A,a,r),r,x,Memrel(x)))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   151
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   152
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   153
  otype :: "[i=>o,i,i,i] => o" where --{*the order types themselves*}
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   154
   "otype(M,A,r,i) == \<exists>f[M]. omap(M,A,r,f) & is_range(M,f,i)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   155
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   156
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   157
text{*Can also be proved with the premise @{term "M(z)"} instead of
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   158
      @{term "M(f)"}, but that version is less useful.  This lemma
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   159
      is also more useful than the definition, @{text omap_def}.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   160
lemma (in M_ordertype) omap_iff:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   161
     "[| omap(M,A,r,f); M(A); M(f) |] 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   162
      ==> z \<in> f \<longleftrightarrow>
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   163
          (\<exists>a\<in>A. \<exists>x[M]. \<exists>g[M]. z = <a,x> & Ord(x) & 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   164
                                g \<in> ord_iso(Order.pred(A,a,r),r,x,Memrel(x)))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   165
apply (simp add: omap_def Memrel_closed pred_closed) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   166
apply (rule iffI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   167
 apply (drule_tac [2] x=z in rspec)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   168
 apply (drule_tac x=z in rspec)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   169
 apply (blast dest: transM)+
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   170
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   171
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   172
lemma (in M_ordertype) omap_unique:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   173
     "[| omap(M,A,r,f); omap(M,A,r,f'); M(A); M(r); M(f); M(f') |] ==> f' = f" 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   174
apply (rule equality_iffI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   175
apply (simp add: omap_iff) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   176
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   177
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   178
lemma (in M_ordertype) omap_yields_Ord:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   179
     "[| omap(M,A,r,f); \<langle>a,x\<rangle> \<in> f; M(a); M(x) |]  ==> Ord(x)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   180
  by (simp add: omap_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   181
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   182
lemma (in M_ordertype) otype_iff:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   183
     "[| otype(M,A,r,i); M(A); M(r); M(i) |] 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   184
      ==> x \<in> i \<longleftrightarrow> 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   185
          (M(x) & Ord(x) & 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   186
           (\<exists>a\<in>A. \<exists>g[M]. g \<in> ord_iso(Order.pred(A,a,r),r,x,Memrel(x))))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   187
apply (auto simp add: omap_iff otype_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   188
 apply (blast intro: transM) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   189
apply (rule rangeI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   190
apply (frule transM, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   191
apply (simp add: omap_iff, blast)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   192
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   193
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   194
lemma (in M_ordertype) otype_eq_range:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   195
     "[| omap(M,A,r,f); otype(M,A,r,i); M(A); M(r); M(f); M(i) |] 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   196
      ==> i = range(f)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   197
apply (auto simp add: otype_def omap_iff)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   198
apply (blast dest: omap_unique) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   199
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   200
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   201
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   202
lemma (in M_ordertype) Ord_otype:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   203
     "[| otype(M,A,r,i); trans[A](r); M(A); M(r); M(i) |] ==> Ord(i)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   204
apply (rule OrdI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   205
prefer 2 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   206
    apply (simp add: Ord_def otype_def omap_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   207
    apply clarify 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   208
    apply (frule pair_components_in_M, assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   209
    apply blast 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   210
apply (auto simp add: Transset_def otype_iff) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   211
  apply (blast intro: transM)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   212
 apply (blast intro: Ord_in_Ord) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   213
apply (rename_tac y a g)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   214
apply (frule ord_iso_sym [THEN ord_iso_is_bij, THEN bij_is_fun, 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   215
                          THEN apply_funtype],  assumption)  
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   216
apply (rule_tac x="converse(g)`y" in bexI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   217
 apply (frule_tac a="converse(g) ` y" in ord_iso_restrict_pred, assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   218
apply (safe elim!: predE) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   219
apply (blast intro: restrict_ord_iso ord_iso_sym ltI dest: transM)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   220
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   221
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   222
lemma (in M_ordertype) domain_omap:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   223
     "[| omap(M,A,r,f);  M(A); M(r); M(B); M(f) |] 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   224
      ==> domain(f) = obase(M,A,r)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   225
apply (simp add: domain_closed obase_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   226
apply (rule equality_iffI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   227
apply (simp add: domain_iff omap_iff, blast) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   228
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   229
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   230
lemma (in M_ordertype) omap_subset: 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   231
     "[| omap(M,A,r,f); otype(M,A,r,i); 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   232
       M(A); M(r); M(f); M(B); M(i) |] ==> f \<subseteq> obase(M,A,r) * i"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   233
apply clarify 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   234
apply (simp add: omap_iff obase_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   235
apply (force simp add: otype_iff) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   236
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   237
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   238
lemma (in M_ordertype) omap_funtype: 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   239
     "[| omap(M,A,r,f); otype(M,A,r,i); 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   240
         M(A); M(r); M(f); M(i) |] ==> f \<in> obase(M,A,r) -> i"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   241
apply (simp add: domain_omap omap_subset Pi_iff function_def omap_iff) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   242
apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   243
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   244
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   245
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   246
lemma (in M_ordertype) wellordered_omap_bij:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   247
     "[| wellordered(M,A,r); omap(M,A,r,f); otype(M,A,r,i); 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   248
       M(A); M(r); M(f); M(i) |] ==> f \<in> bij(obase(M,A,r),i)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   249
apply (insert omap_funtype [of A r f i]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   250
apply (auto simp add: bij_def inj_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   251
prefer 2  apply (blast intro: fun_is_surj dest: otype_eq_range) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   252
apply (frule_tac a=w in apply_Pair, assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   253
apply (frule_tac a=x in apply_Pair, assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   254
apply (simp add: omap_iff) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   255
apply (blast intro: wellordered_iso_pred_eq ord_iso_sym ord_iso_trans) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   256
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   257
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   258
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   259
text{*This is not the final result: we must show @{term "oB(A,r) = A"}*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   260
lemma (in M_ordertype) omap_ord_iso:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   261
     "[| wellordered(M,A,r); omap(M,A,r,f); otype(M,A,r,i); 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   262
       M(A); M(r); M(f); M(i) |] ==> f \<in> ord_iso(obase(M,A,r),r,i,Memrel(i))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   263
apply (rule ord_isoI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   264
 apply (erule wellordered_omap_bij, assumption+) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   265
apply (insert omap_funtype [of A r f i], simp) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   266
apply (frule_tac a=x in apply_Pair, assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   267
apply (frule_tac a=y in apply_Pair, assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   268
apply (auto simp add: omap_iff)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   269
 txt{*direction 1: assuming @{term "\<langle>x,y\<rangle> \<in> r"}*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   270
 apply (blast intro: ltD ord_iso_pred_imp_lt)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   271
 txt{*direction 2: proving @{term "\<langle>x,y\<rangle> \<in> r"} using linearity of @{term r}*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   272
apply (rename_tac x y g ga) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   273
apply (frule wellordered_is_linear, assumption, 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   274
       erule_tac x=x and y=y in linearE, assumption+) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   275
txt{*the case @{term "x=y"} leads to immediate contradiction*} 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   276
apply (blast elim: mem_irrefl) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   277
txt{*the case @{term "\<langle>y,x\<rangle> \<in> r"}: handle like the opposite direction*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   278
apply (blast dest: ord_iso_pred_imp_lt ltD elim: mem_asym) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   279
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   280
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   281
lemma (in M_ordertype) Ord_omap_image_pred:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   282
     "[| wellordered(M,A,r); omap(M,A,r,f); otype(M,A,r,i); 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   283
       M(A); M(r); M(f); M(i); b \<in> A |] ==> Ord(f `` Order.pred(A,b,r))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   284
apply (frule wellordered_is_trans_on, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   285
apply (rule OrdI) 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   286
        prefer 2 apply (simp add: image_iff omap_iff Ord_def, blast) 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   287
txt{*Hard part is to show that the image is a transitive set.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   288
apply (simp add: Transset_def, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   289
apply (simp add: image_iff pred_iff apply_iff [OF omap_funtype [of A r f i]])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   290
apply (rename_tac c j, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   291
apply (frule omap_funtype [of A r f, THEN apply_funtype], assumption+)
13721
2cf506c09946 stylistic tweaks
paulson
parents: 13647
diff changeset
   292
apply (subgoal_tac "j \<in> i") 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   293
        prefer 2 apply (blast intro: Ord_trans Ord_otype)
13721
2cf506c09946 stylistic tweaks
paulson
parents: 13647
diff changeset
   294
apply (subgoal_tac "converse(f) ` j \<in> obase(M,A,r)") 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   295
        prefer 2 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   296
        apply (blast dest: wellordered_omap_bij [THEN bij_converse_bij, 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   297
                                      THEN bij_is_fun, THEN apply_funtype])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   298
apply (rule_tac x="converse(f) ` j" in bexI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   299
 apply (simp add: right_inverse_bij [OF wellordered_omap_bij]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   300
apply (intro predI conjI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   301
 apply (erule_tac b=c in trans_onD) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   302
 apply (rule ord_iso_converse1 [OF omap_ord_iso [of A r f i]])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   303
apply (auto simp add: obase_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   304
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   305
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   306
lemma (in M_ordertype) restrict_omap_ord_iso:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   307
     "[| wellordered(M,A,r); omap(M,A,r,f); otype(M,A,r,i); 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   308
       D \<subseteq> obase(M,A,r); M(A); M(r); M(f); M(i) |] 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   309
      ==> restrict(f,D) \<in> (\<langle>D,r\<rangle> \<cong> \<langle>f``D, Memrel(f``D)\<rangle>)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   310
apply (frule ord_iso_restrict_image [OF omap_ord_iso [of A r f i]], 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   311
       assumption+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   312
apply (drule ord_iso_sym [THEN subset_ord_iso_Memrel]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   313
apply (blast dest: subsetD [OF omap_subset]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   314
apply (drule ord_iso_sym, simp) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   315
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   316
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   317
lemma (in M_ordertype) obase_equals: 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   318
     "[| wellordered(M,A,r); omap(M,A,r,f); otype(M,A,r,i);
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   319
       M(A); M(r); M(f); M(i) |] ==> obase(M,A,r) = A"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   320
apply (rule equalityI, force simp add: obase_def, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   321
apply (unfold obase_def, simp) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   322
apply (frule wellordered_is_wellfounded_on, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   323
apply (erule wellfounded_on_induct, assumption+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   324
 apply (frule obase_equals_separation [of A r], assumption) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   325
 apply (simp, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   326
apply (rename_tac b) 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   327
apply (subgoal_tac "Order.pred(A,b,r) \<subseteq> obase(M,A,r)") 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   328
 apply (blast intro!: restrict_omap_ord_iso Ord_omap_image_pred)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   329
apply (force simp add: pred_iff obase_def)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   330
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   331
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   332
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   333
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   334
text{*Main result: @{term om} gives the order-isomorphism 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   335
      @{term "\<langle>A,r\<rangle> \<cong> \<langle>i, Memrel(i)\<rangle>"} *}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   336
theorem (in M_ordertype) omap_ord_iso_otype:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   337
     "[| wellordered(M,A,r); omap(M,A,r,f); otype(M,A,r,i);
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   338
       M(A); M(r); M(f); M(i) |] ==> f \<in> ord_iso(A, r, i, Memrel(i))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   339
apply (frule omap_ord_iso, assumption+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   340
apply (simp add: obase_equals)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   341
done 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   342
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   343
lemma (in M_ordertype) obase_exists:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   344
     "[| M(A); M(r) |] ==> M(obase(M,A,r))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   345
apply (simp add: obase_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   346
apply (insert obase_separation [of A r])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   347
apply (simp add: separation_def)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   348
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   349
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   350
lemma (in M_ordertype) omap_exists:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   351
     "[| M(A); M(r) |] ==> \<exists>z[M]. omap(M,A,r,z)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   352
apply (simp add: omap_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   353
apply (insert omap_replacement [of A r])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   354
apply (simp add: strong_replacement_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   355
apply (drule_tac x="obase(M,A,r)" in rspec) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   356
 apply (simp add: obase_exists) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   357
apply (simp add: Memrel_closed pred_closed obase_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   358
apply (erule impE) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   359
 apply (clarsimp simp add: univalent_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   360
 apply (blast intro: Ord_iso_implies_eq ord_iso_sym ord_iso_trans, clarify)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   361
apply (rule_tac x=Y in rexI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   362
apply (simp add: Memrel_closed pred_closed obase_def, blast, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   363
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   364
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   365
declare rall_simps [simp] rex_simps [simp]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   366
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   367
lemma (in M_ordertype) otype_exists:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   368
     "[| wellordered(M,A,r); M(A); M(r) |] ==> \<exists>i[M]. otype(M,A,r,i)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   369
apply (insert omap_exists [of A r])  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   370
apply (simp add: otype_def, safe)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   371
apply (rule_tac x="range(x)" in rexI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   372
apply blast+
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   373
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   374
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   375
lemma (in M_ordertype) ordertype_exists:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   376
     "[| wellordered(M,A,r); M(A); M(r) |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   377
      ==> \<exists>f[M]. (\<exists>i[M]. Ord(i) & f \<in> ord_iso(A, r, i, Memrel(i)))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   378
apply (insert obase_exists [of A r] omap_exists [of A r] otype_exists [of A r], simp, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   379
apply (rename_tac i) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   380
apply (subgoal_tac "Ord(i)", blast intro: omap_ord_iso_otype)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   381
apply (rule Ord_otype) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   382
    apply (force simp add: otype_def range_closed) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   383
   apply (simp_all add: wellordered_is_trans_on) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   384
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   385
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   386
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   387
lemma (in M_ordertype) relativized_imp_well_ord: 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   388
     "[| wellordered(M,A,r); M(A); M(r) |] ==> well_ord(A,r)" 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   389
apply (insert ordertype_exists [of A r], simp)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   390
apply (blast intro: well_ord_ord_iso well_ord_Memrel)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   391
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   392
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   393
subsection {*Kunen's theorem 5.4, page 127*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   394
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   395
text{*(a) The notion of Wellordering is absolute*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   396
theorem (in M_ordertype) well_ord_abs [simp]: 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   397
     "[| M(A); M(r) |] ==> wellordered(M,A,r) \<longleftrightarrow> well_ord(A,r)" 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   398
by (blast intro: well_ord_imp_relativized relativized_imp_well_ord)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   399
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   400
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   401
text{*(b) Order types are absolute*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   402
theorem (in M_ordertype) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   403
     "[| wellordered(M,A,r); f \<in> ord_iso(A, r, i, Memrel(i));
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   404
       M(A); M(r); M(f); M(i); Ord(i) |] ==> i = ordertype(A,r)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   405
by (blast intro: Ord_ordertype relativized_imp_well_ord ordertype_ord_iso
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   406
                 Ord_iso_implies_eq ord_iso_sym ord_iso_trans)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   407
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   408
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   409
subsection{*Ordinal Arithmetic: Two Examples of Recursion*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   410
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   411
text{*Note: the remainder of this theory is not needed elsewhere.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   412
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   413
subsubsection{*Ordinal Addition*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   414
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   415
(*FIXME: update to use new techniques!!*)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   416
 (*This expresses ordinal addition in the language of ZF.  It also 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   417
   provides an abbreviation that can be used in the instance of strong
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   418
   replacement below.  Here j is used to define the relation, namely
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   419
   Memrel(succ(j)), while x determines the domain of f.*)
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   420
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   421
  is_oadd_fun :: "[i=>o,i,i,i,i] => o" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   422
    "is_oadd_fun(M,i,j,x,f) == 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   423
       (\<forall>sj msj. M(sj) \<longrightarrow> M(msj) \<longrightarrow> 
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   424
                 successor(M,j,sj) \<longrightarrow> membership(M,sj,msj) \<longrightarrow> 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   425
                 M_is_recfun(M, 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   426
                     %x g y. \<exists>gx[M]. image(M,g,x,gx) & union(M,i,gx,y),
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   427
                     msj, x, f))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   428
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   429
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   430
  is_oadd :: "[i=>o,i,i,i] => o" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   431
    "is_oadd(M,i,j,k) == 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   432
        (~ ordinal(M,i) & ~ ordinal(M,j) & k=0) |
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   433
        (~ ordinal(M,i) & ordinal(M,j) & k=j) |
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   434
        (ordinal(M,i) & ~ ordinal(M,j) & k=i) |
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   435
        (ordinal(M,i) & ordinal(M,j) & 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   436
         (\<exists>f fj sj. M(f) & M(fj) & M(sj) & 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   437
                    successor(M,j,sj) & is_oadd_fun(M,i,sj,sj,f) & 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   438
                    fun_apply(M,f,j,fj) & fj = k))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   439
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   440
definition
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   441
 (*NEEDS RELATIVIZATION*)
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   442
  omult_eqns :: "[i,i,i,i] => o" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   443
    "omult_eqns(i,x,g,z) ==
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   444
            Ord(x) & 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   445
            (x=0 \<longrightarrow> z=0) &
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   446
            (\<forall>j. x = succ(j) \<longrightarrow> z = g`j ++ i) &
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   447
            (Limit(x) \<longrightarrow> z = \<Union>(g``x))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   448
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   449
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   450
  is_omult_fun :: "[i=>o,i,i,i] => o" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   451
    "is_omult_fun(M,i,j,f) == 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   452
            (\<exists>df. M(df) & is_function(M,f) & 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   453
                  is_domain(M,f,df) & subset(M, j, df)) & 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   454
            (\<forall>x\<in>j. omult_eqns(i,x,f,f`x))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   455
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   456
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   457
  is_omult :: "[i=>o,i,i,i] => o" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   458
    "is_omult(M,i,j,k) == 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   459
        \<exists>f fj sj. M(f) & M(fj) & M(sj) & 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   460
                  successor(M,j,sj) & is_omult_fun(M,i,sj,f) & 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   461
                  fun_apply(M,f,j,fj) & fj = k"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   462
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   463
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   464
locale M_ord_arith = M_ordertype +
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   465
  assumes oadd_strong_replacement:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   466
   "[| M(i); M(j) |] ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   467
    strong_replacement(M, 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   468
         \<lambda>x z. \<exists>y[M]. pair(M,x,y,z) & 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   469
                  (\<exists>f[M]. \<exists>fx[M]. is_oadd_fun(M,i,j,x,f) & 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   470
                           image(M,f,x,fx) & y = i \<union> fx))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   471
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   472
 and omult_strong_replacement':
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   473
   "[| M(i); M(j) |] ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   474
    strong_replacement(M, 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   475
         \<lambda>x z. \<exists>y[M]. z = <x,y> &
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   476
             (\<exists>g[M]. is_recfun(Memrel(succ(j)),x,%x g. THE z. omult_eqns(i,x,g,z),g) & 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   477
             y = (THE z. omult_eqns(i, x, g, z))))" 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   478
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   479
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   480
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   481
text{*@{text is_oadd_fun}: Relating the pure "language of set theory" to Isabelle/ZF*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   482
lemma (in M_ord_arith) is_oadd_fun_iff:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   483
   "[| a\<le>j; M(i); M(j); M(a); M(f) |] 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   484
    ==> is_oadd_fun(M,i,j,a,f) \<longleftrightarrow>
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   485
        f \<in> a \<rightarrow> range(f) & (\<forall>x. M(x) \<longrightarrow> x < a \<longrightarrow> f`x = i \<union> f``x)"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   486
apply (frule lt_Ord) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   487
apply (simp add: is_oadd_fun_def Memrel_closed Un_closed 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   488
             relation2_def is_recfun_abs [of "%x g. i \<union> g``x"]
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   489
             image_closed is_recfun_iff_equation  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   490
             Ball_def lt_trans [OF ltI, of _ a] lt_Memrel)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   491
apply (simp add: lt_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   492
apply (blast dest: transM) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   493
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   494
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   495
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   496
lemma (in M_ord_arith) oadd_strong_replacement':
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   497
    "[| M(i); M(j) |] ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   498
     strong_replacement(M, 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   499
            \<lambda>x z. \<exists>y[M]. z = <x,y> &
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   500
                  (\<exists>g[M]. is_recfun(Memrel(succ(j)),x,%x g. i \<union> g``x,g) & 
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   501
                  y = i \<union> g``x))" 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   502
apply (insert oadd_strong_replacement [of i j]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   503
apply (simp add: is_oadd_fun_def relation2_def
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   504
                 is_recfun_abs [of "%x g. i \<union> g``x"])  
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   505
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   506
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   507
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   508
lemma (in M_ord_arith) exists_oadd:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   509
    "[| Ord(j);  M(i);  M(j) |]
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   510
     ==> \<exists>f[M]. is_recfun(Memrel(succ(j)), j, %x g. i \<union> g``x, f)"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   511
apply (rule wf_exists_is_recfun [OF wf_Memrel trans_Memrel])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   512
    apply (simp_all add: Memrel_type oadd_strong_replacement') 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   513
done 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   514
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   515
lemma (in M_ord_arith) exists_oadd_fun:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   516
    "[| Ord(j);  M(i);  M(j) |] ==> \<exists>f[M]. is_oadd_fun(M,i,succ(j),succ(j),f)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   517
apply (rule exists_oadd [THEN rexE])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   518
apply (erule Ord_succ, assumption, simp) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   519
apply (rename_tac f) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   520
apply (frule is_recfun_type)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   521
apply (rule_tac x=f in rexI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   522
 apply (simp add: fun_is_function domain_of_fun lt_Memrel apply_recfun lt_def
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   523
                  is_oadd_fun_iff Ord_trans [OF _ succI1], assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   524
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   525
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   526
lemma (in M_ord_arith) is_oadd_fun_apply:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   527
    "[| x < j; M(i); M(j); M(f); is_oadd_fun(M,i,j,j,f) |] 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   528
     ==> f`x = i \<union> (\<Union>k\<in>x. {f ` k})"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   529
apply (simp add: is_oadd_fun_iff lt_Ord2, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   530
apply (frule lt_closed, simp)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   531
apply (frule leI [THEN le_imp_subset])  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   532
apply (simp add: image_fun, blast) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   533
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   534
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   535
lemma (in M_ord_arith) is_oadd_fun_iff_oadd [rule_format]:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   536
    "[| is_oadd_fun(M,i,J,J,f); M(i); M(J); M(f); Ord(i); Ord(j) |] 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   537
     ==> j<J \<longrightarrow> f`j = i++j"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   538
apply (erule_tac i=j in trans_induct, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   539
apply (subgoal_tac "\<forall>k\<in>x. k<J")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   540
 apply (simp (no_asm_simp) add: is_oadd_def oadd_unfold is_oadd_fun_apply)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   541
apply (blast intro: lt_trans ltI lt_Ord) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   542
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   543
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   544
lemma (in M_ord_arith) Ord_oadd_abs:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   545
    "[| M(i); M(j); M(k); Ord(i); Ord(j) |] ==> is_oadd(M,i,j,k) \<longleftrightarrow> k = i++j"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   546
apply (simp add: is_oadd_def is_oadd_fun_iff_oadd)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   547
apply (frule exists_oadd_fun [of j i], blast+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   548
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   549
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   550
lemma (in M_ord_arith) oadd_abs:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   551
    "[| M(i); M(j); M(k) |] ==> is_oadd(M,i,j,k) \<longleftrightarrow> k = i++j"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   552
apply (case_tac "Ord(i) & Ord(j)")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   553
 apply (simp add: Ord_oadd_abs)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   554
apply (auto simp add: is_oadd_def oadd_eq_if_raw_oadd)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   555
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   556
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   557
lemma (in M_ord_arith) oadd_closed [intro,simp]:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   558
    "[| M(i); M(j) |] ==> M(i++j)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   559
apply (simp add: oadd_eq_if_raw_oadd, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   560
apply (simp add: raw_oadd_eq_oadd) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   561
apply (frule exists_oadd_fun [of j i], auto)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   562
apply (simp add: apply_closed is_oadd_fun_iff_oadd [symmetric]) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   563
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   564
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   565
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   566
subsubsection{*Ordinal Multiplication*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   567
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   568
lemma omult_eqns_unique:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   569
     "[| omult_eqns(i,x,g,z); omult_eqns(i,x,g,z') |] ==> z=z'";
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   570
apply (simp add: omult_eqns_def, clarify) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   571
apply (erule Ord_cases, simp_all) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   572
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   573
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   574
lemma omult_eqns_0: "omult_eqns(i,0,g,z) \<longleftrightarrow> z=0"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   575
by (simp add: omult_eqns_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   576
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   577
lemma the_omult_eqns_0: "(THE z. omult_eqns(i,0,g,z)) = 0"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   578
by (simp add: omult_eqns_0)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   579
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   580
lemma omult_eqns_succ: "omult_eqns(i,succ(j),g,z) \<longleftrightarrow> Ord(j) & z = g`j ++ i"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   581
by (simp add: omult_eqns_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   582
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   583
lemma the_omult_eqns_succ:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   584
     "Ord(j) ==> (THE z. omult_eqns(i,succ(j),g,z)) = g`j ++ i"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   585
by (simp add: omult_eqns_succ) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   586
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   587
lemma omult_eqns_Limit:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   588
     "Limit(x) ==> omult_eqns(i,x,g,z) \<longleftrightarrow> z = \<Union>(g``x)"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   589
apply (simp add: omult_eqns_def) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   590
apply (blast intro: Limit_is_Ord) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   591
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   592
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   593
lemma the_omult_eqns_Limit:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   594
     "Limit(x) ==> (THE z. omult_eqns(i,x,g,z)) = \<Union>(g``x)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   595
by (simp add: omult_eqns_Limit)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   596
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   597
lemma omult_eqns_Not: "~ Ord(x) ==> ~ omult_eqns(i,x,g,z)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   598
by (simp add: omult_eqns_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   599
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   600
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   601
lemma (in M_ord_arith) the_omult_eqns_closed:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   602
    "[| M(i); M(x); M(g); function(g) |] 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   603
     ==> M(THE z. omult_eqns(i, x, g, z))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   604
apply (case_tac "Ord(x)")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   605
 prefer 2 apply (simp add: omult_eqns_Not) --{*trivial, non-Ord case*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   606
apply (erule Ord_cases) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   607
  apply (simp add: omult_eqns_0)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   608
 apply (simp add: omult_eqns_succ apply_closed oadd_closed) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   609
apply (simp add: omult_eqns_Limit) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   610
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   611
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   612
lemma (in M_ord_arith) exists_omult:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   613
    "[| Ord(j);  M(i);  M(j) |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   614
     ==> \<exists>f[M]. is_recfun(Memrel(succ(j)), j, %x g. THE z. omult_eqns(i,x,g,z), f)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   615
apply (rule wf_exists_is_recfun [OF wf_Memrel trans_Memrel])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   616
    apply (simp_all add: Memrel_type omult_strong_replacement') 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   617
apply (blast intro: the_omult_eqns_closed) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   618
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   619
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   620
lemma (in M_ord_arith) exists_omult_fun:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   621
    "[| Ord(j);  M(i);  M(j) |] ==> \<exists>f[M]. is_omult_fun(M,i,succ(j),f)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   622
apply (rule exists_omult [THEN rexE])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   623
apply (erule Ord_succ, assumption, simp) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   624
apply (rename_tac f) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   625
apply (frule is_recfun_type)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   626
apply (rule_tac x=f in rexI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   627
apply (simp add: fun_is_function domain_of_fun lt_Memrel apply_recfun lt_def
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   628
                 is_omult_fun_def Ord_trans [OF _ succI1])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   629
 apply (force dest: Ord_in_Ord' 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   630
              simp add: omult_eqns_def the_omult_eqns_0 the_omult_eqns_succ
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   631
                        the_omult_eqns_Limit, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   632
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   633
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   634
lemma (in M_ord_arith) is_omult_fun_apply_0:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   635
    "[| 0 < j; is_omult_fun(M,i,j,f) |] ==> f`0 = 0"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   636
by (simp add: is_omult_fun_def omult_eqns_def lt_def ball_conj_distrib)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   637
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   638
lemma (in M_ord_arith) is_omult_fun_apply_succ:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   639
    "[| succ(x) < j; is_omult_fun(M,i,j,f) |] ==> f`succ(x) = f`x ++ i"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   640
by (simp add: is_omult_fun_def omult_eqns_def lt_def, blast) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   641
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   642
lemma (in M_ord_arith) is_omult_fun_apply_Limit:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   643
    "[| x < j; Limit(x); M(j); M(f); is_omult_fun(M,i,j,f) |] 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   644
     ==> f ` x = (\<Union>y\<in>x. f`y)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   645
apply (simp add: is_omult_fun_def omult_eqns_def domain_closed lt_def, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   646
apply (drule subset_trans [OF OrdmemD], assumption+)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   647
apply (simp add: ball_conj_distrib omult_Limit image_function)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   648
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   649
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   650
lemma (in M_ord_arith) is_omult_fun_eq_omult:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   651
    "[| is_omult_fun(M,i,J,f); M(J); M(f); Ord(i); Ord(j) |] 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   652
     ==> j<J \<longrightarrow> f`j = i**j"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   653
apply (erule_tac i=j in trans_induct3)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   654
apply (safe del: impCE)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   655
  apply (simp add: is_omult_fun_apply_0) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   656
 apply (subgoal_tac "x<J") 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   657
  apply (simp add: is_omult_fun_apply_succ omult_succ)  
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   658
 apply (blast intro: lt_trans) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   659
apply (subgoal_tac "\<forall>k\<in>x. k<J")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   660
 apply (simp add: is_omult_fun_apply_Limit omult_Limit) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   661
apply (blast intro: lt_trans ltI lt_Ord) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   662
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   663
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   664
lemma (in M_ord_arith) omult_abs:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   665
    "[| M(i); M(j); M(k); Ord(i); Ord(j) |] ==> is_omult(M,i,j,k) \<longleftrightarrow> k = i**j"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   666
apply (simp add: is_omult_def is_omult_fun_eq_omult)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   667
apply (frule exists_omult_fun [of j i], blast+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   668
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   669
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   670
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   671
13647
7f6f0ffc45c3 tidying and reorganization
paulson
parents: 13634
diff changeset
   672
subsection {*Absoluteness of Well-Founded Relations*}
7f6f0ffc45c3 tidying and reorganization
paulson
parents: 13634
diff changeset
   673
7f6f0ffc45c3 tidying and reorganization
paulson
parents: 13634
diff changeset
   674
text{*Relativized to @{term M}: Every well-founded relation is a subset of some
7f6f0ffc45c3 tidying and reorganization
paulson
parents: 13634
diff changeset
   675
inverse image of an ordinal.  Key step is the construction (in @{term M}) of a
7f6f0ffc45c3 tidying and reorganization
paulson
parents: 13634
diff changeset
   676
rank function.*}
7f6f0ffc45c3 tidying and reorganization
paulson
parents: 13634
diff changeset
   677
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   678
locale M_wfrank = M_trancl +
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   679
  assumes wfrank_separation:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   680
     "M(r) ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   681
      separation (M, \<lambda>x. 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   682
         \<forall>rplus[M]. tran_closure(M,r,rplus) \<longrightarrow>
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   683
         ~ (\<exists>f[M]. M_is_recfun(M, %x f y. is_range(M,f,y), rplus, x, f)))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   684
 and wfrank_strong_replacement:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   685
     "M(r) ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   686
      strong_replacement(M, \<lambda>x z. 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   687
         \<forall>rplus[M]. tran_closure(M,r,rplus) \<longrightarrow>
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   688
         (\<exists>y[M]. \<exists>f[M]. pair(M,x,y,z)  & 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   689
                        M_is_recfun(M, %x f y. is_range(M,f,y), rplus, x, f) &
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   690
                        is_range(M,f,y)))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   691
 and Ord_wfrank_separation:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   692
     "M(r) ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   693
      separation (M, \<lambda>x.
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   694
         \<forall>rplus[M]. tran_closure(M,r,rplus) \<longrightarrow> 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   695
          ~ (\<forall>f[M]. \<forall>rangef[M]. 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   696
             is_range(M,f,rangef) \<longrightarrow>
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   697
             M_is_recfun(M, \<lambda>x f y. is_range(M,f,y), rplus, x, f) \<longrightarrow>
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   698
             ordinal(M,rangef)))" 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   699
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   700
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   701
text{*Proving that the relativized instances of Separation or Replacement
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   702
agree with the "real" ones.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   703
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   704
lemma (in M_wfrank) wfrank_separation':
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   705
     "M(r) ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   706
      separation
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   707
           (M, \<lambda>x. ~ (\<exists>f[M]. is_recfun(r^+, x, %x f. range(f), f)))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   708
apply (insert wfrank_separation [of r])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   709
apply (simp add: relation2_def is_recfun_abs [of "%x. range"])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   710
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   711
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   712
lemma (in M_wfrank) wfrank_strong_replacement':
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   713
     "M(r) ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   714
      strong_replacement(M, \<lambda>x z. \<exists>y[M]. \<exists>f[M]. 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   715
                  pair(M,x,y,z) & is_recfun(r^+, x, %x f. range(f), f) &
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 21404
diff changeset
   716
                  y = range(f))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   717
apply (insert wfrank_strong_replacement [of r])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   718
apply (simp add: relation2_def is_recfun_abs [of "%x. range"])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   719
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   720
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   721
lemma (in M_wfrank) Ord_wfrank_separation':
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   722
     "M(r) ==>
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   723
      separation (M, \<lambda>x. 
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   724
         ~ (\<forall>f[M]. is_recfun(r^+, x, \<lambda>x. range, f) \<longrightarrow> Ord(range(f))))" 
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   725
apply (insert Ord_wfrank_separation [of r])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   726
apply (simp add: relation2_def is_recfun_abs [of "%x. range"])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   727
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   728
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   729
text{*This function, defined using replacement, is a rank function for
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   730
well-founded relations within the class M.*}
21233
5a5c8ea5f66a tuned specifications;
wenzelm
parents: 16417
diff changeset
   731
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21233
diff changeset
   732
  wellfoundedrank :: "[i=>o,i,i] => i" where
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   733
    "wellfoundedrank(M,r,A) ==
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   734
        {p. x\<in>A, \<exists>y[M]. \<exists>f[M]. 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   735
                       p = <x,y> & is_recfun(r^+, x, %x f. range(f), f) &
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   736
                       y = range(f)}"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   737
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   738
lemma (in M_wfrank) exists_wfrank:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   739
    "[| wellfounded(M,r); M(a); M(r) |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   740
     ==> \<exists>f[M]. is_recfun(r^+, a, %x f. range(f), f)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   741
apply (rule wellfounded_exists_is_recfun)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   742
      apply (blast intro: wellfounded_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   743
     apply (rule trans_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   744
    apply (erule wfrank_separation')
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   745
   apply (erule wfrank_strong_replacement')
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   746
apply (simp_all add: trancl_subset_times)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   747
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   748
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   749
lemma (in M_wfrank) M_wellfoundedrank:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   750
    "[| wellfounded(M,r); M(r); M(A) |] ==> M(wellfoundedrank(M,r,A))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   751
apply (insert wfrank_strong_replacement' [of r])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   752
apply (simp add: wellfoundedrank_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   753
apply (rule strong_replacement_closed)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   754
   apply assumption+
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   755
 apply (rule univalent_is_recfun)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   756
   apply (blast intro: wellfounded_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   757
  apply (rule trans_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   758
 apply (simp add: trancl_subset_times) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   759
apply (blast dest: transM) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   760
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   761
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   762
lemma (in M_wfrank) Ord_wfrank_range [rule_format]:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   763
    "[| wellfounded(M,r); a\<in>A; M(r); M(A) |]
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   764
     ==> \<forall>f[M]. is_recfun(r^+, a, %x f. range(f), f) \<longrightarrow> Ord(range(f))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   765
apply (drule wellfounded_trancl, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   766
apply (rule wellfounded_induct, assumption, erule (1) transM)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   767
  apply simp
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   768
 apply (blast intro: Ord_wfrank_separation', clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   769
txt{*The reasoning in both cases is that we get @{term y} such that
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   770
   @{term "\<langle>y, x\<rangle> \<in> r^+"}.  We find that
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   771
   @{term "f`y = restrict(f, r^+ -`` {y})"}. *}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   772
apply (rule OrdI [OF _ Ord_is_Transset])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   773
 txt{*An ordinal is a transitive set...*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   774
 apply (simp add: Transset_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   775
 apply clarify
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   776
 apply (frule apply_recfun2, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   777
 apply (force simp add: restrict_iff)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   778
txt{*...of ordinals.  This second case requires the induction hyp.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   779
apply clarify
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   780
apply (rename_tac i y)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   781
apply (frule apply_recfun2, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   782
apply (frule is_recfun_imp_in_r, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   783
apply (frule is_recfun_restrict)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   784
    (*simp_all won't work*)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   785
    apply (simp add: trans_trancl trancl_subset_times)+
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   786
apply (drule spec [THEN mp], assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   787
apply (subgoal_tac "M(restrict(f, r^+ -`` {y}))")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   788
 apply (drule_tac x="restrict(f, r^+ -`` {y})" in rspec)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   789
apply assumption
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   790
 apply (simp add: function_apply_equality [OF _ is_recfun_imp_function])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   791
apply (blast dest: pair_components_in_M)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   792
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   793
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   794
lemma (in M_wfrank) Ord_range_wellfoundedrank:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   795
    "[| wellfounded(M,r); r \<subseteq> A*A;  M(r); M(A) |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   796
     ==> Ord (range(wellfoundedrank(M,r,A)))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   797
apply (frule wellfounded_trancl, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   798
apply (frule trancl_subset_times)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   799
apply (simp add: wellfoundedrank_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   800
apply (rule OrdI [OF _ Ord_is_Transset])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   801
 prefer 2
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   802
 txt{*by our previous result the range consists of ordinals.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   803
 apply (blast intro: Ord_wfrank_range)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   804
txt{*We still must show that the range is a transitive set.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   805
apply (simp add: Transset_def, clarify, simp)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   806
apply (rename_tac x i f u)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   807
apply (frule is_recfun_imp_in_r, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   808
apply (subgoal_tac "M(u) & M(i) & M(x)")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   809
 prefer 2 apply (blast dest: transM, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   810
apply (rule_tac a=u in rangeI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   811
apply (rule_tac x=u in ReplaceI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   812
  apply simp 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   813
  apply (rule_tac x="restrict(f, r^+ -`` {u})" in rexI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   814
   apply (blast intro: is_recfun_restrict trans_trancl dest: apply_recfun2)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   815
  apply simp 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   816
apply blast 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   817
txt{*Unicity requirement of Replacement*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   818
apply clarify
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   819
apply (frule apply_recfun2, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   820
apply (simp add: trans_trancl is_recfun_cut)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   821
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   822
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   823
lemma (in M_wfrank) function_wellfoundedrank:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   824
    "[| wellfounded(M,r); M(r); M(A)|]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   825
     ==> function(wellfoundedrank(M,r,A))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   826
apply (simp add: wellfoundedrank_def function_def, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   827
txt{*Uniqueness: repeated below!*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   828
apply (drule is_recfun_functional, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   829
     apply (blast intro: wellfounded_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   830
    apply (simp_all add: trancl_subset_times trans_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   831
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   832
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   833
lemma (in M_wfrank) domain_wellfoundedrank:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   834
    "[| wellfounded(M,r); M(r); M(A)|]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   835
     ==> domain(wellfoundedrank(M,r,A)) = A"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   836
apply (simp add: wellfoundedrank_def function_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   837
apply (rule equalityI, auto)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   838
apply (frule transM, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   839
apply (frule_tac a=x in exists_wfrank, assumption+, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   840
apply (rule_tac b="range(f)" in domainI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   841
apply (rule_tac x=x in ReplaceI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   842
  apply simp 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   843
  apply (rule_tac x=f in rexI, blast, simp_all)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   844
txt{*Uniqueness (for Replacement): repeated above!*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   845
apply clarify
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   846
apply (drule is_recfun_functional, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   847
    apply (blast intro: wellfounded_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   848
    apply (simp_all add: trancl_subset_times trans_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   849
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   850
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   851
lemma (in M_wfrank) wellfoundedrank_type:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   852
    "[| wellfounded(M,r);  M(r); M(A)|]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   853
     ==> wellfoundedrank(M,r,A) \<in> A -> range(wellfoundedrank(M,r,A))"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   854
apply (frule function_wellfoundedrank [of r A], assumption+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   855
apply (frule function_imp_Pi)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   856
 apply (simp add: wellfoundedrank_def relation_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   857
 apply blast
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   858
apply (simp add: domain_wellfoundedrank)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   859
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   860
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   861
lemma (in M_wfrank) Ord_wellfoundedrank:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   862
    "[| wellfounded(M,r); a \<in> A; r \<subseteq> A*A;  M(r); M(A) |]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   863
     ==> Ord(wellfoundedrank(M,r,A) ` a)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   864
by (blast intro: apply_funtype [OF wellfoundedrank_type]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   865
                 Ord_in_Ord [OF Ord_range_wellfoundedrank])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   866
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   867
lemma (in M_wfrank) wellfoundedrank_eq:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   868
     "[| is_recfun(r^+, a, %x. range, f);
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   869
         wellfounded(M,r);  a \<in> A; M(f); M(r); M(A)|]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   870
      ==> wellfoundedrank(M,r,A) ` a = range(f)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   871
apply (rule apply_equality)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   872
 prefer 2 apply (blast intro: wellfoundedrank_type)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   873
apply (simp add: wellfoundedrank_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   874
apply (rule ReplaceI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   875
  apply (rule_tac x="range(f)" in rexI) 
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   876
  apply blast
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   877
 apply simp_all
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   878
txt{*Unicity requirement of Replacement*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   879
apply clarify
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   880
apply (drule is_recfun_functional, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   881
    apply (blast intro: wellfounded_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   882
    apply (simp_all add: trancl_subset_times trans_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   883
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   884
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   885
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   886
lemma (in M_wfrank) wellfoundedrank_lt:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   887
     "[| <a,b> \<in> r;
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   888
         wellfounded(M,r); r \<subseteq> A*A;  M(r); M(A)|]
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   889
      ==> wellfoundedrank(M,r,A) ` a < wellfoundedrank(M,r,A) ` b"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   890
apply (frule wellfounded_trancl, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   891
apply (subgoal_tac "a\<in>A & b\<in>A")
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   892
 prefer 2 apply blast
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   893
apply (simp add: lt_def Ord_wellfoundedrank, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   894
apply (frule exists_wfrank [of concl: _ b], erule (1) transM, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   895
apply clarify
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   896
apply (rename_tac fb)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   897
apply (frule is_recfun_restrict [of concl: "r^+" a])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   898
    apply (rule trans_trancl, assumption)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   899
   apply (simp_all add: r_into_trancl trancl_subset_times)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   900
txt{*Still the same goal, but with new @{text is_recfun} assumptions.*}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   901
apply (simp add: wellfoundedrank_eq)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   902
apply (frule_tac a=a in wellfoundedrank_eq, assumption+)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   903
   apply (simp_all add: transM [of a])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   904
txt{*We have used equations for wellfoundedrank and now must use some
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   905
    for  @{text is_recfun}. *}
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   906
apply (rule_tac a=a in rangeI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   907
apply (simp add: is_recfun_type [THEN apply_iff] vimage_singleton_iff
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   908
                 r_into_trancl apply_recfun r_into_trancl)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   909
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   910
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   911
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   912
lemma (in M_wfrank) wellfounded_imp_subset_rvimage:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   913
     "[|wellfounded(M,r); r \<subseteq> A*A; M(r); M(A)|]
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   914
      ==> \<exists>i f. Ord(i) & r \<subseteq> rvimage(A, f, Memrel(i))"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   915
apply (rule_tac x="range(wellfoundedrank(M,r,A))" in exI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   916
apply (rule_tac x="wellfoundedrank(M,r,A)" in exI)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   917
apply (simp add: Ord_range_wellfoundedrank, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   918
apply (frule subsetD, assumption, clarify)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   919
apply (simp add: rvimage_iff wellfoundedrank_lt [THEN ltD])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   920
apply (blast intro: apply_rangeI wellfoundedrank_type)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   921
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   922
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   923
lemma (in M_wfrank) wellfounded_imp_wf:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   924
     "[|wellfounded(M,r); relation(r); M(r)|] ==> wf(r)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   925
by (blast dest!: relation_field_times_field wellfounded_imp_subset_rvimage
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   926
          intro: wf_rvimage_Ord [THEN wf_subset])
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   927
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   928
lemma (in M_wfrank) wellfounded_on_imp_wf_on:
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   929
     "[|wellfounded_on(M,A,r); relation(r); M(r); M(A)|] ==> wf[A](r)"
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   930
apply (simp add: wellfounded_on_iff_wellfounded wf_on_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   931
apply (rule wellfounded_imp_wf)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   932
apply (simp_all add: relation_def)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   933
done
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   934
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   935
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   936
theorem (in M_wfrank) wf_abs:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   937
     "[|relation(r); M(r)|] ==> wellfounded(M,r) \<longleftrightarrow> wf(r)"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   938
by (blast intro: wellfounded_imp_wf wf_imp_relativized)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   939
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   940
theorem (in M_wfrank) wf_on_abs:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 32960
diff changeset
   941
     "[|relation(r); M(r); M(A)|] ==> wellfounded_on(M,A,r) \<longleftrightarrow> wf[A](r)"
13634
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   942
by (blast intro: wellfounded_on_imp_wf_on wf_on_imp_relativized)
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   943
99a593b49b04 Re-organization of Constructible theories
paulson
parents:
diff changeset
   944
end