319 neither of which is absolute.*} |
319 neither of which is absolute.*} |
320 lemma (in M_triv_axioms) list_rec_eq: |
320 lemma (in M_triv_axioms) list_rec_eq: |
321 "l \<in> list(A) ==> |
321 "l \<in> list(A) ==> |
322 list_rec(a,g,l) = |
322 list_rec(a,g,l) = |
323 transrec (succ(length(l)), |
323 transrec (succ(length(l)), |
324 \<lambda>x h. Lambda (list_N(A,x), |
324 \<lambda>x h. Lambda (list(A), |
325 list_case' (a, |
325 list_case' (a, |
326 \<lambda>a l. g(a, l, h ` succ(length(l)) ` l)))) ` l" |
326 \<lambda>a l. g(a, l, h ` succ(length(l)) ` l)))) ` l" |
327 apply (induct_tac l) |
327 apply (induct_tac l) |
328 apply (subst transrec, simp) |
328 apply (subst transrec, simp) |
329 apply (subst transrec) |
329 apply (subst transrec) |
330 apply (simp add: list_imp_list_N) |
330 apply (simp add: list_imp_list_N) |
331 done |
331 done |
627 "[|n \<in> nat; M(x)|] ==> M(tl'^n (x))" |
627 "[|n \<in> nat; M(x)|] ==> M(tl'^n (x))" |
628 apply (induct_tac n, simp) |
628 apply (induct_tac n, simp) |
629 apply (simp add: tl'_Cons tl'_closed) |
629 apply (simp add: tl'_Cons tl'_closed) |
630 done |
630 done |
631 |
631 |
632 locale (open) M_nth = M_datatypes + |
|
633 assumes nth_replacement1: |
|
634 "M(xs) ==> iterates_replacement(M, %l t. is_tl(M,l,t), xs)" |
|
635 |
|
636 text{*Immediate by type-checking*} |
632 text{*Immediate by type-checking*} |
637 lemma (in M_datatypes) nth_closed [intro,simp]: |
633 lemma (in M_datatypes) nth_closed [intro,simp]: |
638 "[|xs \<in> list(A); n \<in> nat; M(A)|] ==> M(nth(n,xs))" |
634 "[|xs \<in> list(A); n \<in> nat; M(A)|] ==> M(nth(n,xs))" |
639 apply (case_tac "n < length(xs)") |
635 apply (case_tac "n < length(xs)") |
640 apply (blast intro: nth_type transM) |
636 apply (blast intro: nth_type transM) |
647 \<exists>X[M]. \<exists>sn[M]. \<exists>msn[M]. |
643 \<exists>X[M]. \<exists>sn[M]. \<exists>msn[M]. |
648 successor(M,n,sn) & membership(M,sn,msn) & |
644 successor(M,n,sn) & membership(M,sn,msn) & |
649 is_wfrec(M, iterates_MH(M, is_tl(M), l), msn, n, X) & |
645 is_wfrec(M, iterates_MH(M, is_tl(M), l), msn, n, X) & |
650 is_hd(M,X,Z)" |
646 is_hd(M,X,Z)" |
651 |
647 |
652 lemma (in M_nth) nth_abs [simp]: |
648 lemma (in M_datatypes) nth_abs [simp]: |
653 "[|M(A); n \<in> nat; l \<in> list(A); M(Z)|] |
649 "[|iterates_replacement(M, %l t. is_tl(M,l,t), l); |
|
650 M(A); n \<in> nat; l \<in> list(A); M(Z)|] |
654 ==> is_nth(M,n,l,Z) <-> Z = nth(n,l)" |
651 ==> is_nth(M,n,l,Z) <-> Z = nth(n,l)" |
655 apply (subgoal_tac "M(l)") |
652 apply (subgoal_tac "M(l)") |
656 prefer 2 apply (blast intro: transM) |
653 prefer 2 apply (blast intro: transM) |
657 apply (insert nth_replacement1) |
|
658 apply (simp add: is_nth_def nth_eq_hd_iterates_tl nat_into_M |
654 apply (simp add: is_nth_def nth_eq_hd_iterates_tl nat_into_M |
659 tl'_closed iterates_tl'_closed |
655 tl'_closed iterates_tl'_closed |
660 iterates_abs [OF _ relativize1_tl]) |
656 iterates_abs [OF _ relativize1_tl]) |
661 done |
657 done |
662 |
|
663 |
|
664 |
658 |
665 |
659 |
666 subsection{*Relativization and Absoluteness for the @{term formula} Constructors*} |
660 subsection{*Relativization and Absoluteness for the @{term formula} Constructors*} |
667 |
661 |
668 constdefs |
662 constdefs |
910 apply (rule_tac i = m and j = n in Ord_linear_le, auto) |
904 apply (rule_tac i = m and j = n in Ord_linear_le, auto) |
911 apply (simp_all add: subset_Un_iff [THEN iffD1] subset_Un_iff2 [THEN iffD1] |
905 apply (simp_all add: subset_Un_iff [THEN iffD1] subset_Un_iff2 [THEN iffD1] |
912 le_imp_subset formula_N_mono) |
906 le_imp_subset formula_N_mono) |
913 done |
907 done |
914 |
908 |
915 lemma Nand_in_formula_N: |
|
916 "[|p \<in> formula; q \<in> formula|] |
|
917 ==> Nand(p,q) \<in> formula_N(succ(succ(depth(p))) \<union> succ(succ(depth(q))))" |
|
918 by (simp add: succ_Un_distrib [symmetric] formula_imp_formula_N le_Un_iff) |
|
919 |
|
920 |
|
921 text{*Express @{term formula_rec} without using @{term rank} or @{term Vset}, |
909 text{*Express @{term formula_rec} without using @{term rank} or @{term Vset}, |
922 neither of which is absolute.*} |
910 neither of which is absolute.*} |
923 lemma (in M_triv_axioms) formula_rec_eq: |
911 lemma (in M_triv_axioms) formula_rec_eq: |
924 "p \<in> formula ==> |
912 "p \<in> formula ==> |
925 formula_rec(a,b,c,d,p) = |
913 formula_rec(a,b,c,d,p) = |
926 transrec (succ(depth(p)), |
914 transrec (succ(depth(p)), |
927 \<lambda>x h. Lambda (formula_N(x), |
915 \<lambda>x h. Lambda (formula, |
928 formula_case' (a, b, |
916 formula_case' (a, b, |
929 \<lambda>u v. c(u, v, h ` succ(depth(u)) ` u, |
917 \<lambda>u v. c(u, v, h ` succ(depth(u)) ` u, |
930 h ` succ(depth(v)) ` v), |
918 h ` succ(depth(v)) ` v), |
931 \<lambda>u. d(u, h ` succ(depth(u)) ` u)))) |
919 \<lambda>u. d(u, h ` succ(depth(u)) ` u)))) |
932 ` p" |
920 ` p" |
933 apply (induct_tac p) |
921 apply (induct_tac p) |
934 txt{*Base case for @{term Member}*} |
922 txt{*Base case for @{term Member}*} |
935 apply (subst transrec, simp) |
923 apply (subst transrec, simp add: formula.intros) |
936 txt{*Base case for @{term Equal}*} |
924 txt{*Base case for @{term Equal}*} |
937 apply (subst transrec, simp) |
925 apply (subst transrec, simp add: formula.intros) |
938 txt{*Inductive step for @{term Nand}*} |
926 txt{*Inductive step for @{term Nand}*} |
939 apply (subst transrec) |
927 apply (subst transrec) |
940 apply (simp add: succ_Un_distrib Nand_in_formula_N) |
928 apply (simp add: succ_Un_distrib formula.intros) |
941 txt{*Inductive step for @{term Forall}*} |
929 txt{*Inductive step for @{term Forall}*} |
942 apply (subst transrec) |
930 apply (subst transrec) |
943 apply (simp add: formula_imp_formula_N) |
931 apply (simp add: formula_imp_formula_N formula.intros) |
944 done |
932 done |
945 |
933 |
946 |
934 |
947 constdefs |
935 constdefs |
948 is_formula_N :: "[i=>o,i,i] => o" |
936 is_formula_N :: "[i=>o,i,i] => o" |