src/ZF/OrderArith.thy
 author paulson Wed Aug 21 15:57:08 2002 +0200 (2002-08-21) changeset 13512 80edb859fd24 parent 13356 c9cfe1638bf2 child 13544 895994073bdf permissions -rw-r--r--
tweaks and new lemmas
```     1 (*  Title:      ZF/OrderArith.thy
```
```     2     ID:         \$Id\$
```
```     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
```
```     4     Copyright   1994  University of Cambridge
```
```     5
```
```     6 *)
```
```     7
```
```     8 header{*Combining Orderings: Foundations of Ordinal Arithmetic*}
```
```     9
```
```    10 theory OrderArith = Order + Sum + Ordinal:
```
```    11 constdefs
```
```    12
```
```    13   (*disjoint sum of two relations; underlies ordinal addition*)
```
```    14   radd    :: "[i,i,i,i]=>i"
```
```    15     "radd(A,r,B,s) ==
```
```    16                 {z: (A+B) * (A+B).
```
```    17                     (EX x y. z = <Inl(x), Inr(y)>)   |
```
```    18                     (EX x' x. z = <Inl(x'), Inl(x)> & <x',x>:r)   |
```
```    19                     (EX y' y. z = <Inr(y'), Inr(y)> & <y',y>:s)}"
```
```    20
```
```    21   (*lexicographic product of two relations; underlies ordinal multiplication*)
```
```    22   rmult   :: "[i,i,i,i]=>i"
```
```    23     "rmult(A,r,B,s) ==
```
```    24                 {z: (A*B) * (A*B).
```
```    25                     EX x' y' x y. z = <<x',y'>, <x,y>> &
```
```    26                        (<x',x>: r | (x'=x & <y',y>: s))}"
```
```    27
```
```    28   (*inverse image of a relation*)
```
```    29   rvimage :: "[i,i,i]=>i"
```
```    30     "rvimage(A,f,r) == {z: A*A. EX x y. z = <x,y> & <f`x,f`y>: r}"
```
```    31
```
```    32   measure :: "[i, i\<Rightarrow>i] \<Rightarrow> i"
```
```    33     "measure(A,f) == {<x,y>: A*A. f(x) < f(y)}"
```
```    34
```
```    35
```
```    36 subsection{*Addition of Relations -- Disjoint Sum*}
```
```    37
```
```    38 subsubsection{*Rewrite rules.  Can be used to obtain introduction rules*}
```
```    39
```
```    40 lemma radd_Inl_Inr_iff [iff]:
```
```    41     "<Inl(a), Inr(b)> : radd(A,r,B,s)  <->  a:A & b:B"
```
```    42 by (unfold radd_def, blast)
```
```    43
```
```    44 lemma radd_Inl_iff [iff]:
```
```    45     "<Inl(a'), Inl(a)> : radd(A,r,B,s)  <->  a':A & a:A & <a',a>:r"
```
```    46 by (unfold radd_def, blast)
```
```    47
```
```    48 lemma radd_Inr_iff [iff]:
```
```    49     "<Inr(b'), Inr(b)> : radd(A,r,B,s) <->  b':B & b:B & <b',b>:s"
```
```    50 by (unfold radd_def, blast)
```
```    51
```
```    52 lemma radd_Inr_Inl_iff [iff]:
```
```    53     "<Inr(b), Inl(a)> : radd(A,r,B,s) <->  False"
```
```    54 by (unfold radd_def, blast)
```
```    55
```
```    56 subsubsection{*Elimination Rule*}
```
```    57
```
```    58 lemma raddE:
```
```    59     "[| <p',p> : radd(A,r,B,s);
```
```    60         !!x y. [| p'=Inl(x); x:A; p=Inr(y); y:B |] ==> Q;
```
```    61         !!x' x. [| p'=Inl(x'); p=Inl(x); <x',x>: r; x':A; x:A |] ==> Q;
```
```    62         !!y' y. [| p'=Inr(y'); p=Inr(y); <y',y>: s; y':B; y:B |] ==> Q
```
```    63      |] ==> Q"
```
```    64 by (unfold radd_def, blast)
```
```    65
```
```    66 subsubsection{*Type checking*}
```
```    67
```
```    68 lemma radd_type: "radd(A,r,B,s) <= (A+B) * (A+B)"
```
```    69 apply (unfold radd_def)
```
```    70 apply (rule Collect_subset)
```
```    71 done
```
```    72
```
```    73 lemmas field_radd = radd_type [THEN field_rel_subset]
```
```    74
```
```    75 subsubsection{*Linearity*}
```
```    76
```
```    77 lemma linear_radd:
```
```    78     "[| linear(A,r);  linear(B,s) |] ==> linear(A+B,radd(A,r,B,s))"
```
```    79 by (unfold linear_def, blast)
```
```    80
```
```    81
```
```    82 subsubsection{*Well-foundedness*}
```
```    83
```
```    84 lemma wf_on_radd: "[| wf[A](r);  wf[B](s) |] ==> wf[A+B](radd(A,r,B,s))"
```
```    85 apply (rule wf_onI2)
```
```    86 apply (subgoal_tac "ALL x:A. Inl (x) : Ba")
```
```    87  --{*Proving the lemma, which is needed twice!*}
```
```    88  prefer 2
```
```    89  apply (erule_tac V = "y : A + B" in thin_rl)
```
```    90  apply (rule_tac ballI)
```
```    91  apply (erule_tac r = "r" and a = "x" in wf_on_induct, assumption)
```
```    92  apply blast
```
```    93 txt{*Returning to main part of proof*}
```
```    94 apply safe
```
```    95 apply blast
```
```    96 apply (erule_tac r = "s" and a = "ya" in wf_on_induct, assumption, blast)
```
```    97 done
```
```    98
```
```    99 lemma wf_radd: "[| wf(r);  wf(s) |] ==> wf(radd(field(r),r,field(s),s))"
```
```   100 apply (simp add: wf_iff_wf_on_field)
```
```   101 apply (rule wf_on_subset_A [OF _ field_radd])
```
```   102 apply (blast intro: wf_on_radd)
```
```   103 done
```
```   104
```
```   105 lemma well_ord_radd:
```
```   106      "[| well_ord(A,r);  well_ord(B,s) |] ==> well_ord(A+B, radd(A,r,B,s))"
```
```   107 apply (rule well_ordI)
```
```   108 apply (simp add: well_ord_def wf_on_radd)
```
```   109 apply (simp add: well_ord_def tot_ord_def linear_radd)
```
```   110 done
```
```   111
```
```   112 subsubsection{*An @{term ord_iso} congruence law*}
```
```   113
```
```   114 lemma sum_bij:
```
```   115      "[| f: bij(A,C);  g: bij(B,D) |]
```
```   116       ==> (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) : bij(A+B, C+D)"
```
```   117 apply (rule_tac d = "case (%x. Inl (converse(f)`x), %y. Inr(converse(g)`y))"
```
```   118        in lam_bijective)
```
```   119 apply (typecheck add: bij_is_inj inj_is_fun)
```
```   120 apply (auto simp add: left_inverse_bij right_inverse_bij)
```
```   121 done
```
```   122
```
```   123 lemma sum_ord_iso_cong:
```
```   124     "[| f: ord_iso(A,r,A',r');  g: ord_iso(B,s,B',s') |] ==>
```
```   125             (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z))
```
```   126             : ord_iso(A+B, radd(A,r,B,s), A'+B', radd(A',r',B',s'))"
```
```   127 apply (unfold ord_iso_def)
```
```   128 apply (safe intro!: sum_bij)
```
```   129 (*Do the beta-reductions now*)
```
```   130 apply (auto cong add: conj_cong simp add: bij_is_fun [THEN apply_type])
```
```   131 done
```
```   132
```
```   133 (*Could we prove an ord_iso result?  Perhaps
```
```   134      ord_iso(A+B, radd(A,r,B,s), A Un B, r Un s) *)
```
```   135 lemma sum_disjoint_bij: "A Int B = 0 ==>
```
```   136             (lam z:A+B. case(%x. x, %y. y, z)) : bij(A+B, A Un B)"
```
```   137 apply (rule_tac d = "%z. if z:A then Inl (z) else Inr (z) " in lam_bijective)
```
```   138 apply auto
```
```   139 done
```
```   140
```
```   141 subsubsection{*Associativity*}
```
```   142
```
```   143 lemma sum_assoc_bij:
```
```   144      "(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z))
```
```   145       : bij((A+B)+C, A+(B+C))"
```
```   146 apply (rule_tac d = "case (%x. Inl (Inl (x)), case (%x. Inl (Inr (x)), Inr))"
```
```   147        in lam_bijective)
```
```   148 apply auto
```
```   149 done
```
```   150
```
```   151 lemma sum_assoc_ord_iso:
```
```   152      "(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z))
```
```   153       : ord_iso((A+B)+C, radd(A+B, radd(A,r,B,s), C, t),
```
```   154                 A+(B+C), radd(A, r, B+C, radd(B,s,C,t)))"
```
```   155 by (rule sum_assoc_bij [THEN ord_isoI], auto)
```
```   156
```
```   157
```
```   158 subsection{*Multiplication of Relations -- Lexicographic Product*}
```
```   159
```
```   160 subsubsection{*Rewrite rule.  Can be used to obtain introduction rules*}
```
```   161
```
```   162 lemma  rmult_iff [iff]:
```
```   163     "<<a',b'>, <a,b>> : rmult(A,r,B,s) <->
```
```   164             (<a',a>: r  & a':A & a:A & b': B & b: B) |
```
```   165             (<b',b>: s  & a'=a & a:A & b': B & b: B)"
```
```   166
```
```   167 by (unfold rmult_def, blast)
```
```   168
```
```   169 lemma rmultE:
```
```   170     "[| <<a',b'>, <a,b>> : rmult(A,r,B,s);
```
```   171         [| <a',a>: r;  a':A;  a:A;  b':B;  b:B |] ==> Q;
```
```   172         [| <b',b>: s;  a:A;  a'=a;  b':B;  b:B |] ==> Q
```
```   173      |] ==> Q"
```
```   174 by blast
```
```   175
```
```   176 subsubsection{*Type checking*}
```
```   177
```
```   178 lemma rmult_type: "rmult(A,r,B,s) <= (A*B) * (A*B)"
```
```   179 by (unfold rmult_def, rule Collect_subset)
```
```   180
```
```   181 lemmas field_rmult = rmult_type [THEN field_rel_subset]
```
```   182
```
```   183 subsubsection{*Linearity*}
```
```   184
```
```   185 lemma linear_rmult:
```
```   186     "[| linear(A,r);  linear(B,s) |] ==> linear(A*B,rmult(A,r,B,s))"
```
```   187 by (simp add: linear_def, blast)
```
```   188
```
```   189 subsubsection{*Well-foundedness*}
```
```   190
```
```   191 lemma wf_on_rmult: "[| wf[A](r);  wf[B](s) |] ==> wf[A*B](rmult(A,r,B,s))"
```
```   192 apply (rule wf_onI2)
```
```   193 apply (erule SigmaE)
```
```   194 apply (erule ssubst)
```
```   195 apply (subgoal_tac "ALL b:B. <x,b>: Ba", blast)
```
```   196 apply (erule_tac a = "x" in wf_on_induct, assumption)
```
```   197 apply (rule ballI)
```
```   198 apply (erule_tac a = "b" in wf_on_induct, assumption)
```
```   199 apply (best elim!: rmultE bspec [THEN mp])
```
```   200 done
```
```   201
```
```   202
```
```   203 lemma wf_rmult: "[| wf(r);  wf(s) |] ==> wf(rmult(field(r),r,field(s),s))"
```
```   204 apply (simp add: wf_iff_wf_on_field)
```
```   205 apply (rule wf_on_subset_A [OF _ field_rmult])
```
```   206 apply (blast intro: wf_on_rmult)
```
```   207 done
```
```   208
```
```   209 lemma well_ord_rmult:
```
```   210      "[| well_ord(A,r);  well_ord(B,s) |] ==> well_ord(A*B, rmult(A,r,B,s))"
```
```   211 apply (rule well_ordI)
```
```   212 apply (simp add: well_ord_def wf_on_rmult)
```
```   213 apply (simp add: well_ord_def tot_ord_def linear_rmult)
```
```   214 done
```
```   215
```
```   216
```
```   217 subsubsection{*An @{term ord_iso} congruence law*}
```
```   218
```
```   219 lemma prod_bij:
```
```   220      "[| f: bij(A,C);  g: bij(B,D) |]
```
```   221       ==> (lam <x,y>:A*B. <f`x, g`y>) : bij(A*B, C*D)"
```
```   222 apply (rule_tac d = "%<x,y>. <converse (f) `x, converse (g) `y>"
```
```   223        in lam_bijective)
```
```   224 apply (typecheck add: bij_is_inj inj_is_fun)
```
```   225 apply (auto simp add: left_inverse_bij right_inverse_bij)
```
```   226 done
```
```   227
```
```   228 lemma prod_ord_iso_cong:
```
```   229     "[| f: ord_iso(A,r,A',r');  g: ord_iso(B,s,B',s') |]
```
```   230      ==> (lam <x,y>:A*B. <f`x, g`y>)
```
```   231          : ord_iso(A*B, rmult(A,r,B,s), A'*B', rmult(A',r',B',s'))"
```
```   232 apply (unfold ord_iso_def)
```
```   233 apply (safe intro!: prod_bij)
```
```   234 apply (simp_all add: bij_is_fun [THEN apply_type])
```
```   235 apply (blast intro: bij_is_inj [THEN inj_apply_equality])
```
```   236 done
```
```   237
```
```   238 lemma singleton_prod_bij: "(lam z:A. <x,z>) : bij(A, {x}*A)"
```
```   239 by (rule_tac d = "snd" in lam_bijective, auto)
```
```   240
```
```   241 (*Used??*)
```
```   242 lemma singleton_prod_ord_iso:
```
```   243      "well_ord({x},xr) ==>
```
```   244           (lam z:A. <x,z>) : ord_iso(A, r, {x}*A, rmult({x}, xr, A, r))"
```
```   245 apply (rule singleton_prod_bij [THEN ord_isoI])
```
```   246 apply (simp (no_asm_simp))
```
```   247 apply (blast dest: well_ord_is_wf [THEN wf_on_not_refl])
```
```   248 done
```
```   249
```
```   250 (*Here we build a complicated function term, then simplify it using
```
```   251   case_cong, id_conv, comp_lam, case_case.*)
```
```   252 lemma prod_sum_singleton_bij:
```
```   253      "a~:C ==>
```
```   254        (lam x:C*B + D. case(%x. x, %y.<a,y>, x))
```
```   255        : bij(C*B + D, C*B Un {a}*D)"
```
```   256 apply (rule subst_elem)
```
```   257 apply (rule id_bij [THEN sum_bij, THEN comp_bij])
```
```   258 apply (rule singleton_prod_bij)
```
```   259 apply (rule sum_disjoint_bij, blast)
```
```   260 apply (simp (no_asm_simp) cong add: case_cong)
```
```   261 apply (rule comp_lam [THEN trans, symmetric])
```
```   262 apply (fast elim!: case_type)
```
```   263 apply (simp (no_asm_simp) add: case_case)
```
```   264 done
```
```   265
```
```   266 lemma prod_sum_singleton_ord_iso:
```
```   267  "[| a:A;  well_ord(A,r) |] ==>
```
```   268     (lam x:pred(A,a,r)*B + pred(B,b,s). case(%x. x, %y.<a,y>, x))
```
```   269     : ord_iso(pred(A,a,r)*B + pred(B,b,s),
```
```   270                   radd(A*B, rmult(A,r,B,s), B, s),
```
```   271               pred(A,a,r)*B Un {a}*pred(B,b,s), rmult(A,r,B,s))"
```
```   272 apply (rule prod_sum_singleton_bij [THEN ord_isoI])
```
```   273 apply (simp (no_asm_simp) add: pred_iff well_ord_is_wf [THEN wf_on_not_refl])
```
```   274 apply (auto elim!: well_ord_is_wf [THEN wf_on_asym] predE)
```
```   275 done
```
```   276
```
```   277 subsubsection{*Distributive law*}
```
```   278
```
```   279 lemma sum_prod_distrib_bij:
```
```   280      "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x))
```
```   281       : bij((A+B)*C, (A*C)+(B*C))"
```
```   282 by (rule_tac d = "case (%<x,y>.<Inl (x),y>, %<x,y>.<Inr (x),y>) "
```
```   283     in lam_bijective, auto)
```
```   284
```
```   285 lemma sum_prod_distrib_ord_iso:
```
```   286  "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x))
```
```   287   : ord_iso((A+B)*C, rmult(A+B, radd(A,r,B,s), C, t),
```
```   288             (A*C)+(B*C), radd(A*C, rmult(A,r,C,t), B*C, rmult(B,s,C,t)))"
```
```   289 by (rule sum_prod_distrib_bij [THEN ord_isoI], auto)
```
```   290
```
```   291 subsubsection{*Associativity*}
```
```   292
```
```   293 lemma prod_assoc_bij:
```
```   294      "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) : bij((A*B)*C, A*(B*C))"
```
```   295 by (rule_tac d = "%<x, <y,z>>. <<x,y>, z>" in lam_bijective, auto)
```
```   296
```
```   297 lemma prod_assoc_ord_iso:
```
```   298  "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>)
```
```   299   : ord_iso((A*B)*C, rmult(A*B, rmult(A,r,B,s), C, t),
```
```   300             A*(B*C), rmult(A, r, B*C, rmult(B,s,C,t)))"
```
```   301 by (rule prod_assoc_bij [THEN ord_isoI], auto)
```
```   302
```
```   303 subsection{*Inverse Image of a Relation*}
```
```   304
```
```   305 subsubsection{*Rewrite rule*}
```
```   306
```
```   307 lemma rvimage_iff: "<a,b> : rvimage(A,f,r)  <->  <f`a,f`b>: r & a:A & b:A"
```
```   308 by (unfold rvimage_def, blast)
```
```   309
```
```   310 subsubsection{*Type checking*}
```
```   311
```
```   312 lemma rvimage_type: "rvimage(A,f,r) <= A*A"
```
```   313 apply (unfold rvimage_def, rule Collect_subset)
```
```   314 done
```
```   315
```
```   316 lemmas field_rvimage = rvimage_type [THEN field_rel_subset]
```
```   317
```
```   318 lemma rvimage_converse: "rvimage(A,f, converse(r)) = converse(rvimage(A,f,r))"
```
```   319 by (unfold rvimage_def, blast)
```
```   320
```
```   321
```
```   322 subsubsection{*Partial Ordering Properties*}
```
```   323
```
```   324 lemma irrefl_rvimage:
```
```   325     "[| f: inj(A,B);  irrefl(B,r) |] ==> irrefl(A, rvimage(A,f,r))"
```
```   326 apply (unfold irrefl_def rvimage_def)
```
```   327 apply (blast intro: inj_is_fun [THEN apply_type])
```
```   328 done
```
```   329
```
```   330 lemma trans_on_rvimage:
```
```   331     "[| f: inj(A,B);  trans[B](r) |] ==> trans[A](rvimage(A,f,r))"
```
```   332 apply (unfold trans_on_def rvimage_def)
```
```   333 apply (blast intro: inj_is_fun [THEN apply_type])
```
```   334 done
```
```   335
```
```   336 lemma part_ord_rvimage:
```
```   337     "[| f: inj(A,B);  part_ord(B,r) |] ==> part_ord(A, rvimage(A,f,r))"
```
```   338 apply (unfold part_ord_def)
```
```   339 apply (blast intro!: irrefl_rvimage trans_on_rvimage)
```
```   340 done
```
```   341
```
```   342 subsubsection{*Linearity*}
```
```   343
```
```   344 lemma linear_rvimage:
```
```   345     "[| f: inj(A,B);  linear(B,r) |] ==> linear(A,rvimage(A,f,r))"
```
```   346 apply (simp add: inj_def linear_def rvimage_iff)
```
```   347 apply (blast intro: apply_funtype)
```
```   348 done
```
```   349
```
```   350 lemma tot_ord_rvimage:
```
```   351     "[| f: inj(A,B);  tot_ord(B,r) |] ==> tot_ord(A, rvimage(A,f,r))"
```
```   352 apply (unfold tot_ord_def)
```
```   353 apply (blast intro!: part_ord_rvimage linear_rvimage)
```
```   354 done
```
```   355
```
```   356
```
```   357 subsubsection{*Well-foundedness*}
```
```   358
```
```   359 (*Not sure if wf_on_rvimage could be proved from this!*)
```
```   360 lemma wf_rvimage [intro!]: "wf(r) ==> wf(rvimage(A,f,r))"
```
```   361 apply (simp (no_asm_use) add: rvimage_def wf_eq_minimal)
```
```   362 apply clarify
```
```   363 apply (subgoal_tac "EX w. w : {w: {f`x. x:Q}. EX x. x: Q & (f`x = w) }")
```
```   364  apply (erule allE)
```
```   365  apply (erule impE)
```
```   366  apply assumption
```
```   367  apply blast
```
```   368 apply blast
```
```   369 done
```
```   370
```
```   371 lemma wf_on_rvimage: "[| f: A->B;  wf[B](r) |] ==> wf[A](rvimage(A,f,r))"
```
```   372 apply (rule wf_onI2)
```
```   373 apply (subgoal_tac "ALL z:A. f`z=f`y --> z: Ba")
```
```   374  apply blast
```
```   375 apply (erule_tac a = "f`y" in wf_on_induct)
```
```   376  apply (blast intro!: apply_funtype)
```
```   377 apply (blast intro!: apply_funtype dest!: rvimage_iff [THEN iffD1])
```
```   378 done
```
```   379
```
```   380 (*Note that we need only wf[A](...) and linear(A,...) to get the result!*)
```
```   381 lemma well_ord_rvimage:
```
```   382      "[| f: inj(A,B);  well_ord(B,r) |] ==> well_ord(A, rvimage(A,f,r))"
```
```   383 apply (rule well_ordI)
```
```   384 apply (unfold well_ord_def tot_ord_def)
```
```   385 apply (blast intro!: wf_on_rvimage inj_is_fun)
```
```   386 apply (blast intro!: linear_rvimage)
```
```   387 done
```
```   388
```
```   389 lemma ord_iso_rvimage:
```
```   390     "f: bij(A,B) ==> f: ord_iso(A, rvimage(A,f,s), B, s)"
```
```   391 apply (unfold ord_iso_def)
```
```   392 apply (simp add: rvimage_iff)
```
```   393 done
```
```   394
```
```   395 lemma ord_iso_rvimage_eq:
```
```   396     "f: ord_iso(A,r, B,s) ==> rvimage(A,f,s) = r Int A*A"
```
```   397 by (unfold ord_iso_def rvimage_def, blast)
```
```   398
```
```   399
```
```   400 subsubsection{*Other Results*}
```
```   401
```
```   402 subsubsection{*The "measure" relation is useful with wfrec*}
```
```   403
```
```   404 lemma measure_eq_rvimage_Memrel:
```
```   405      "measure(A,f) = rvimage(A,Lambda(A,f),Memrel(Collect(RepFun(A,f),Ord)))"
```
```   406 apply (simp (no_asm) add: measure_def rvimage_def Memrel_iff)
```
```   407 apply (rule equalityI, auto)
```
```   408 apply (auto intro: Ord_in_Ord simp add: lt_def)
```
```   409 done
```
```   410
```
```   411 lemma wf_measure [iff]: "wf(measure(A,f))"
```
```   412 by (simp (no_asm) add: measure_eq_rvimage_Memrel wf_Memrel wf_rvimage)
```
```   413
```
```   414 lemma measure_iff [iff]: "<x,y> : measure(A,f) <-> x:A & y:A & f(x)<f(y)"
```
```   415 by (simp (no_asm) add: measure_def)
```
```   416
```
```   417 subsubsection{*Well-foundedness of Unions*}
```
```   418
```
```   419 lemma wf_on_Union:
```
```   420  assumes wfA: "wf[A](r)"
```
```   421      and wfB: "!!a. a\<in>A ==> wf[B(a)](s)"
```
```   422      and ok: "!!a u v. [|<u,v> \<in> s; v \<in> B(a); a \<in> A|]
```
```   423                        ==> (\<exists>a'\<in>A. <a',a> \<in> r & u \<in> B(a')) | u \<in> B(a)"
```
```   424  shows "wf[\<Union>a\<in>A. B(a)](s)"
```
```   425 apply (rule wf_onI2)
```
```   426 apply (erule UN_E)
```
```   427 apply (subgoal_tac "\<forall>z \<in> B(a). z \<in> Ba", blast)
```
```   428 apply (rule_tac a = a in wf_on_induct [OF wfA], assumption)
```
```   429 apply (rule ballI)
```
```   430 apply (rule_tac a = z in wf_on_induct [OF wfB], assumption, assumption)
```
```   431 apply (rename_tac u)
```
```   432 apply (drule_tac x=u in bspec, blast)
```
```   433 apply (erule mp, clarify)
```
```   434 apply (frule ok, assumption+);
```
```   435 apply blast
```
```   436 done
```
```   437
```
```   438
```
```   439 ML {*
```
```   440 val measure_def = thm "measure_def";
```
```   441 val radd_Inl_Inr_iff = thm "radd_Inl_Inr_iff";
```
```   442 val radd_Inl_iff = thm "radd_Inl_iff";
```
```   443 val radd_Inr_iff = thm "radd_Inr_iff";
```
```   444 val radd_Inr_Inl_iff = thm "radd_Inr_Inl_iff";
```
```   445 val raddE = thm "raddE";
```
```   446 val radd_type = thm "radd_type";
```
```   447 val field_radd = thm "field_radd";
```
```   448 val linear_radd = thm "linear_radd";
```
```   449 val wf_on_radd = thm "wf_on_radd";
```
```   450 val wf_radd = thm "wf_radd";
```
```   451 val well_ord_radd = thm "well_ord_radd";
```
```   452 val sum_bij = thm "sum_bij";
```
```   453 val sum_ord_iso_cong = thm "sum_ord_iso_cong";
```
```   454 val sum_disjoint_bij = thm "sum_disjoint_bij";
```
```   455 val sum_assoc_bij = thm "sum_assoc_bij";
```
```   456 val sum_assoc_ord_iso = thm "sum_assoc_ord_iso";
```
```   457 val rmult_iff = thm "rmult_iff";
```
```   458 val rmultE = thm "rmultE";
```
```   459 val rmult_type = thm "rmult_type";
```
```   460 val field_rmult = thm "field_rmult";
```
```   461 val linear_rmult = thm "linear_rmult";
```
```   462 val wf_on_rmult = thm "wf_on_rmult";
```
```   463 val wf_rmult = thm "wf_rmult";
```
```   464 val well_ord_rmult = thm "well_ord_rmult";
```
```   465 val prod_bij = thm "prod_bij";
```
```   466 val prod_ord_iso_cong = thm "prod_ord_iso_cong";
```
```   467 val singleton_prod_bij = thm "singleton_prod_bij";
```
```   468 val singleton_prod_ord_iso = thm "singleton_prod_ord_iso";
```
```   469 val prod_sum_singleton_bij = thm "prod_sum_singleton_bij";
```
```   470 val prod_sum_singleton_ord_iso = thm "prod_sum_singleton_ord_iso";
```
```   471 val sum_prod_distrib_bij = thm "sum_prod_distrib_bij";
```
```   472 val sum_prod_distrib_ord_iso = thm "sum_prod_distrib_ord_iso";
```
```   473 val prod_assoc_bij = thm "prod_assoc_bij";
```
```   474 val prod_assoc_ord_iso = thm "prod_assoc_ord_iso";
```
```   475 val rvimage_iff = thm "rvimage_iff";
```
```   476 val rvimage_type = thm "rvimage_type";
```
```   477 val field_rvimage = thm "field_rvimage";
```
```   478 val rvimage_converse = thm "rvimage_converse";
```
```   479 val irrefl_rvimage = thm "irrefl_rvimage";
```
```   480 val trans_on_rvimage = thm "trans_on_rvimage";
```
```   481 val part_ord_rvimage = thm "part_ord_rvimage";
```
```   482 val linear_rvimage = thm "linear_rvimage";
```
```   483 val tot_ord_rvimage = thm "tot_ord_rvimage";
```
```   484 val wf_rvimage = thm "wf_rvimage";
```
```   485 val wf_on_rvimage = thm "wf_on_rvimage";
```
```   486 val well_ord_rvimage = thm "well_ord_rvimage";
```
```   487 val ord_iso_rvimage = thm "ord_iso_rvimage";
```
```   488 val ord_iso_rvimage_eq = thm "ord_iso_rvimage_eq";
```
```   489 val measure_eq_rvimage_Memrel = thm "measure_eq_rvimage_Memrel";
```
```   490 val wf_measure = thm "wf_measure";
```
```   491 val measure_iff = thm "measure_iff";
```
```   492 *}
```
```   493
```
```   494 end
```