259 lemma (in M_wfrank) wfrank_separation': |
259 lemma (in M_wfrank) wfrank_separation': |
260 "M(r) ==> |
260 "M(r) ==> |
261 separation |
261 separation |
262 (M, \<lambda>x. ~ (\<exists>f[M]. is_recfun(r^+, x, %x f. range(f), f)))" |
262 (M, \<lambda>x. ~ (\<exists>f[M]. is_recfun(r^+, x, %x f. range(f), f)))" |
263 apply (insert wfrank_separation [of r]) |
263 apply (insert wfrank_separation [of r]) |
264 apply (simp add: is_recfun_abs [of "%x. range"]) |
264 apply (simp add: relativize2_def is_recfun_abs [of "%x. range"]) |
265 done |
265 done |
266 |
266 |
267 lemma (in M_wfrank) wfrank_strong_replacement': |
267 lemma (in M_wfrank) wfrank_strong_replacement': |
268 "M(r) ==> |
268 "M(r) ==> |
269 strong_replacement(M, \<lambda>x z. \<exists>y[M]. \<exists>f[M]. |
269 strong_replacement(M, \<lambda>x z. \<exists>y[M]. \<exists>f[M]. |
270 pair(M,x,y,z) & is_recfun(r^+, x, %x f. range(f), f) & |
270 pair(M,x,y,z) & is_recfun(r^+, x, %x f. range(f), f) & |
271 y = range(f))" |
271 y = range(f))" |
272 apply (insert wfrank_strong_replacement [of r]) |
272 apply (insert wfrank_strong_replacement [of r]) |
273 apply (simp add: is_recfun_abs [of "%x. range"]) |
273 apply (simp add: relativize2_def is_recfun_abs [of "%x. range"]) |
274 done |
274 done |
275 |
275 |
276 lemma (in M_wfrank) Ord_wfrank_separation': |
276 lemma (in M_wfrank) Ord_wfrank_separation': |
277 "M(r) ==> |
277 "M(r) ==> |
278 separation (M, \<lambda>x. |
278 separation (M, \<lambda>x. |
279 ~ (\<forall>f[M]. is_recfun(r^+, x, \<lambda>x. range, f) --> Ord(range(f))))" |
279 ~ (\<forall>f[M]. is_recfun(r^+, x, \<lambda>x. range, f) --> Ord(range(f))))" |
280 apply (insert Ord_wfrank_separation [of r]) |
280 apply (insert Ord_wfrank_separation [of r]) |
281 apply (simp add: is_recfun_abs [of "%x. range"]) |
281 apply (simp add: relativize2_def is_recfun_abs [of "%x. range"]) |
282 done |
282 done |
283 |
283 |
284 text{*This function, defined using replacement, is a rank function for |
284 text{*This function, defined using replacement, is a rank function for |
285 well-founded relations within the class M.*} |
285 well-founded relations within the class M.*} |
286 constdefs |
286 constdefs |
522 text{*Assuming @{term r} is transitive simplifies the occurrences of @{text H}. |
522 text{*Assuming @{term r} is transitive simplifies the occurrences of @{text H}. |
523 The premise @{term "relation(r)"} is necessary |
523 The premise @{term "relation(r)"} is necessary |
524 before we can replace @{term "r^+"} by @{term r}. *} |
524 before we can replace @{term "r^+"} by @{term r}. *} |
525 theorem (in M_trancl) trans_wfrec_relativize: |
525 theorem (in M_trancl) trans_wfrec_relativize: |
526 "[|wf(r); trans(r); relation(r); M(r); M(a); |
526 "[|wf(r); trans(r); relation(r); M(r); M(a); |
527 strong_replacement(M, \<lambda>x z. \<exists>y[M]. |
527 wfrec_replacement(M,MH,r); relativize2(M,MH,H); |
528 pair(M,x,y,z) & (\<exists>g[M]. is_recfun(r,x,H,g) & y = H(x,g))); |
|
529 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g))|] |
528 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g))|] |
530 ==> wfrec(r,a,H) = z <-> (\<exists>f[M]. is_recfun(r,a,H,f) & z = H(a,f))" |
529 ==> wfrec(r,a,H) = z <-> (\<exists>f[M]. is_recfun(r,a,H,f) & z = H(a,f))" |
531 by (simp cong: is_recfun_cong |
530 apply (frule wfrec_replacement', assumption+) |
532 add: wfrec_relativize trancl_eq_r |
531 apply (simp cong: is_recfun_cong |
533 is_recfun_restrict_idem domain_restrict_idem) |
532 add: wfrec_relativize trancl_eq_r |
534 |
533 is_recfun_restrict_idem domain_restrict_idem) |
|
534 done |
|
535 |
|
536 theorem (in M_trancl) trans_wfrec_abs: |
|
537 "[|wf(r); trans(r); relation(r); M(r); M(a); M(z); |
|
538 wfrec_replacement(M,MH,r); relativize2(M,MH,H); |
|
539 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g))|] |
|
540 ==> is_wfrec(M,MH,r,a,z) <-> z=wfrec(r,a,H)" |
|
541 apply (simp add: trans_wfrec_relativize [THEN iff_sym] is_wfrec_abs, blast) |
|
542 done |
535 |
543 |
536 lemma (in M_trancl) trans_eq_pair_wfrec_iff: |
544 lemma (in M_trancl) trans_eq_pair_wfrec_iff: |
537 "[|wf(r); trans(r); relation(r); M(r); M(y); |
545 "[|wf(r); trans(r); relation(r); M(r); M(y); |
538 strong_replacement(M, \<lambda>x z. \<exists>y[M]. |
546 wfrec_replacement(M,MH,r); relativize2(M,MH,H); |
539 pair(M,x,y,z) & (\<exists>g[M]. is_recfun(r,x,H,g) & y = H(x,g))); |
|
540 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g))|] |
547 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g))|] |
541 ==> y = <x, wfrec(r, x, H)> <-> |
548 ==> y = <x, wfrec(r, x, H)> <-> |
542 (\<exists>f[M]. is_recfun(r,x,H,f) & y = <x, H(x,f)>)" |
549 (\<exists>f[M]. is_recfun(r,x,H,f) & y = <x, H(x,f)>)" |
543 apply safe |
550 apply safe |
544 apply (simp add: trans_wfrec_relativize [THEN iff_sym, of concl: _ x]) |
551 apply (simp add: trans_wfrec_relativize [THEN iff_sym, of concl: _ x]) |
564 apply (blast intro: dest: pair_components_in_M ) |
571 apply (blast intro: dest: pair_components_in_M ) |
565 done |
572 done |
566 |
573 |
567 text{*Eliminates one instance of replacement.*} |
574 text{*Eliminates one instance of replacement.*} |
568 lemma (in M_wfrank) wfrec_replacement_iff: |
575 lemma (in M_wfrank) wfrec_replacement_iff: |
569 "strong_replacement(M, \<lambda>x z. \<exists>y[M]. \<exists>g[M]. |
576 "strong_replacement(M, \<lambda>x z. |
570 pair(M,x,y,z) & is_recfun(r,x,H,g) & y = H(x,g)) <-> |
577 \<exists>y[M]. pair(M,x,y,z) & (\<exists>g[M]. is_recfun(r,x,H,g) & y = H(x,g))) <-> |
571 strong_replacement(M, |
578 strong_replacement(M, |
572 \<lambda>x y. \<exists>f[M]. is_recfun(r,x,H,f) & y = <x, H(x,f)>)" |
579 \<lambda>x y. \<exists>f[M]. is_recfun(r,x,H,f) & y = <x, H(x,f)>)" |
573 apply simp |
580 apply simp |
574 apply (rule strong_replacement_cong, blast) |
581 apply (rule strong_replacement_cong, blast) |
575 done |
582 done |
576 |
583 |
577 text{*Useful version for transitive relations*} |
584 text{*Useful version for transitive relations*} |
578 theorem (in M_wfrank) trans_wfrec_closed: |
585 theorem (in M_wfrank) trans_wfrec_closed: |
579 "[|wf(r); trans(r); relation(r); M(r); M(a); |
586 "[|wf(r); trans(r); relation(r); M(r); M(a); |
580 strong_replacement(M, |
587 wfrec_replacement(M,MH,r); relativize2(M,MH,H); |
581 \<lambda>x z. \<exists>y[M]. \<exists>g[M]. |
|
582 pair(M,x,y,z) & is_recfun(r,x,H,g) & y = H(x,g)); |
|
583 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g)) |] |
588 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g)) |] |
584 ==> M(wfrec(r,a,H))" |
589 ==> M(wfrec(r,a,H))" |
|
590 apply (frule wfrec_replacement', assumption+) |
585 apply (frule wfrec_replacement_iff [THEN iffD1]) |
591 apply (frule wfrec_replacement_iff [THEN iffD1]) |
586 apply (rule wfrec_closed_lemma, assumption+) |
592 apply (rule wfrec_closed_lemma, assumption+) |
587 apply (simp_all add: wfrec_replacement_iff trans_eq_pair_wfrec_iff) |
593 apply (simp_all add: wfrec_replacement_iff trans_eq_pair_wfrec_iff) |
588 done |
594 done |
589 |
595 |
619 done |
625 done |
620 |
626 |
621 text{*Full version not assuming transitivity, but maybe not very useful.*} |
627 text{*Full version not assuming transitivity, but maybe not very useful.*} |
622 theorem (in M_wfrank) wfrec_closed: |
628 theorem (in M_wfrank) wfrec_closed: |
623 "[|wf(r); M(r); M(a); |
629 "[|wf(r); M(r); M(a); |
624 strong_replacement(M, \<lambda>x z. \<exists>y[M]. \<exists>g[M]. |
630 wfrec_replacement(M,MH,r^+); |
625 pair(M,x,y,z) & |
631 relativize2(M,MH, \<lambda>x f. H(x, restrict(f, r -`` {x}))); |
626 is_recfun(r^+, x, \<lambda>x f. H(x, restrict(f, r -`` {x})), g) & |
|
627 y = H(x, restrict(g, r -`` {x}))); |
|
628 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g)) |] |
632 \<forall>x[M]. \<forall>g[M]. function(g) --> M(H(x,g)) |] |
629 ==> M(wfrec(r,a,H))" |
633 ==> M(wfrec(r,a,H))" |
630 apply (frule wfrec_replacement_iff [THEN iffD1]) |
634 apply (frule wfrec_replacement' |
631 apply (rule wfrec_closed_lemma, assumption+) |
635 [of MH "r^+" "\<lambda>x f. H(x, restrict(f, r -`` {x}))"]) |
632 apply (simp_all add: eq_pair_wfrec_iff) |
636 prefer 4 |
|
637 apply (frule wfrec_replacement_iff [THEN iffD1]) |
|
638 apply (rule wfrec_closed_lemma, assumption+) |
|
639 apply (simp_all add: eq_pair_wfrec_iff func.function_restrictI) |
633 done |
640 done |
634 |
641 |
635 end |
642 end |