author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Thu, 09 May 2013 18:16:36 +0100 | |
changeset 250 | 745547bdc1c7 |
parent 249 | 6e7244ae43b8 |
child 256 | 04700724250f |
permissions | -rwxr-xr-x |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
theory UF_Rec |
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
2 |
imports Recs Turing_Hoare |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
begin |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
8 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
9 |
section {* Universal Function in HOL *} |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
text {* |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
@{text "Entry sr i"} returns the @{text "i"}-th entry of a list of natural |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
numbers encoded by number @{text "sr"} using Godel's coding. |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
*} |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
fun Entry where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
"Entry sr i = Lo sr (Pi (Suc i))" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
fun Listsum2 :: "nat list \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
"Listsum2 xs 0 = 0" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
| "Listsum2 xs (Suc n) = Listsum2 xs n + xs ! n" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
text {* |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
24 |
@{text "Strt"} corresponds to the @{text "strt"} function on page 90 of the |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
25 |
B book, but this definition generalises the original one in order to deal |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
26 |
with multiple input arguments. *} |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
27 |
|
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
28 |
fun Strt' :: "nat list \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
29 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
30 |
"Strt' xs 0 = 0" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
31 |
| "Strt' xs (Suc n) = (let dbound = Listsum2 xs n + n |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
32 |
in Strt' xs n + (2 ^ (xs ! n + dbound) - 2 ^ dbound))" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
33 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
34 |
fun Strt :: "nat list \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
35 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
36 |
"Strt xs = (let ys = map Suc xs in Strt' ys (length ys))" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
37 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
38 |
text {* The @{text "Scan"} function on page 90 of B book. *} |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
39 |
fun Scan :: "nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
40 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
41 |
"Scan r = r mod 2" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
42 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
43 |
text {* The @{text Newleft} and @{text Newright} functions on page 91 of B book. *} |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
44 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
45 |
fun Newleft :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
46 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
47 |
"Newleft p r a = (if a = 0 \<or> a = 1 then p |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
48 |
else if a = 2 then p div 2 |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
49 |
else if a = 3 then 2 * p + r mod 2 |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
50 |
else p)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
51 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
52 |
fun Newright :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
53 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
54 |
"Newright p r a = (if a = 0 then r - Scan r |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
55 |
else if a = 1 then r + 1 - Scan r |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
56 |
else if a = 2 then 2 * r + p mod 2 |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
57 |
else if a = 3 then r div 2 |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
58 |
else r)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
59 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
60 |
text {* |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
61 |
The @{text "Actn"} function given on page 92 of B book, which is used to |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
62 |
fetch Turing Machine intructions. In @{text "Actn m q r"}, @{text "m"} is |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
63 |
the Goedel coding of a Turing Machine, @{text "q"} is the current state of |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
64 |
Turing Machine, @{text "r"} is the right number of Turing Machine tape. *} |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
65 |
|
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
66 |
fun Actn :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
67 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
68 |
"Actn m q r = (if q \<noteq> 0 then Entry m (4 * (q - 1) + 2 * Scan r) else 4)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
69 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
70 |
fun Newstat :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
71 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
72 |
"Newstat m q r = (if q \<noteq> 0 then Entry m (4 * (q - 1) + 2 * Scan r + 1) else 0)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
73 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
74 |
fun Trpl :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
75 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
76 |
"Trpl p q r = (Pi 0) ^ p * (Pi 1) ^ q * (Pi 2) ^ r" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
77 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
78 |
fun Left where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
"Left c = Lo c (Pi 0)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
80 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
81 |
fun Right where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
82 |
"Right c = Lo c (Pi 2)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
83 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
84 |
fun Stat where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
85 |
"Stat c = Lo c (Pi 1)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
86 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
87 |
lemma mod_dvd_simp: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
88 |
"(x mod y = (0::nat)) = (y dvd x)" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
89 |
by(auto simp add: dvd_def) |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
91 |
lemma Trpl_Left [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
92 |
"Left (Trpl p q r) = p" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
93 |
apply(simp) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
94 |
apply(subst Lo_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
95 |
apply(subst dvd_eq_mod_eq_0[symmetric]) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
96 |
apply(simp) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
97 |
apply(auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
98 |
thm Lo_def |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
99 |
thm mod_dvd_simp |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
100 |
apply(simp add: left.simps trpl.simps lo.simps |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
101 |
loR.simps mod_dvd_simp, auto simp: conf_decode1) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
102 |
apply(case_tac "Pi 0 ^ l * Pi (Suc 0) ^ st * Pi (Suc (Suc 0)) ^ r", |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
103 |
auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
104 |
apply(erule_tac x = l in allE, auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
105 |
|
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
106 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
107 |
fun Inpt :: "nat \<Rightarrow> nat list \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
108 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
109 |
"Inpt m xs = Trpl 0 1 (Strt xs)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
110 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
111 |
fun Newconf :: "nat \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
112 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
113 |
"Newconf m c = Trpl (Newleft (Left c) (Right c) (Actn m (Stat c) (Right c))) |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
114 |
(Newstat m (Stat c) (Right c)) |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
115 |
(Newright (Left c) (Right c) (Actn m (Stat c) (Right c)))" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
116 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
117 |
text {* |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
118 |
@{text "Conf k m r"} computes the TM configuration after @{text "k"} steps of execution |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
119 |
of TM coded as @{text "m"} starting from the initial configuration where the left |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
120 |
number equals @{text "0"}, right number equals @{text "r"}. *} |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
121 |
|
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
122 |
fun Conf :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> nat" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
123 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
124 |
"Conf 0 m r = Trpl 0 1 r" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
125 |
| "Conf (Suc k) m r = Newconf m (Conf k m r)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
126 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
127 |
text {* |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
128 |
@{text "Nstd c"} returns true if the configuration coded |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
129 |
by @{text "c"} is not a stardard final configuration. *} |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
130 |
|
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
131 |
fun Nstd :: "nat \<Rightarrow> bool" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
132 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
133 |
"Nstd c = (Stat c \<noteq> 0 \<or> |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
134 |
Left c \<noteq> 0 \<or> |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
135 |
Right c \<noteq> 2 ^ (Lg (Suc (Right c)) 2) - 1 \<or> |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
136 |
Right c = 0)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
137 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
138 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
139 |
text{* |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
140 |
@{text "Nostop t m r"} means that afer @{text "t"} steps of |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
141 |
execution the TM coded by @{text "m"} is not at a stardard |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
142 |
final configuration. *} |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
143 |
|
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
144 |
fun Nostop :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> bool" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
145 |
where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
146 |
"Nostop t m r = Nstd (Conf t m r)" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
147 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
148 |
fun Value where |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
149 |
"Value x = (Lg (Suc x) 2) - 1" |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
150 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
151 |
text{* |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
152 |
@{text "rec_halt"} is the recursive function calculating the steps a TM needs to execute before |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
153 |
to reach a stardard final configuration. This recursive function is the only one |
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
154 |
using @{text "Mn"} combinator. So it is the only non-primitive recursive function |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
155 |
needs to be used in the construction of the universal function @{text "rec_uf"}. *} |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
156 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
157 |
fun Halt :: "nat \<Rightarrow> nat \<Rightarrow> nat" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
158 |
where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
159 |
"Halt m r = (LEAST t. \<not> Nostop t m r)" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
160 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
161 |
fun UF :: "nat \<Rightarrow> nat \<Rightarrow> nat" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
162 |
where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
163 |
"UF c m = Value (Right (Conf (Halt c m) c m))" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
164 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
165 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
166 |
section {* Coding of Turing Machines *} |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
167 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
168 |
text {* |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
169 |
The purpose of this section is to construct the coding function of Turing |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
170 |
Machine, which is going to be named @{text "code"}. *} |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
171 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
172 |
fun bl2nat :: "cell list \<Rightarrow> nat \<Rightarrow> nat" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
173 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
174 |
"bl2nat [] n = 0" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
175 |
| "bl2nat (Bk # bl) n = bl2nat bl (Suc n)" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
176 |
| "bl2nat (Oc # bl) n = 2 ^ n + bl2nat bl (Suc n)" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
177 |
|
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
178 |
fun bl2wc :: "cell list \<Rightarrow> nat" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
179 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
180 |
"bl2wc xs = bl2nat xs 0" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
181 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
182 |
lemma bl2nat_double [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
183 |
"bl2nat xs (Suc n) = 2 * bl2nat xs n" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
184 |
apply(induct xs arbitrary: n) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
185 |
apply(auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
186 |
apply(case_tac a) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
187 |
apply(auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
188 |
done |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
189 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
190 |
lemma bl2nat_simps1 [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
191 |
shows "bl2nat (Bk \<up> y) n = 0" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
192 |
by (induct y) (auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
193 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
194 |
lemma bl2nat_simps2 [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
195 |
shows "bl2nat (Oc \<up> y) 0 = 2 ^ y - 1" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
196 |
apply(induct y) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
197 |
apply(auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
198 |
apply(case_tac "(2::nat)^ y") |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
199 |
apply(auto) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
200 |
done |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
201 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
202 |
fun Trpl_code :: "config \<Rightarrow> nat" |
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
203 |
where |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
204 |
"Trpl_code (st, l, r) = Trpl (bl2wc l) st (bl2wc r)" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
205 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
206 |
fun action_map :: "action \<Rightarrow> nat" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
207 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
208 |
"action_map W0 = 0" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
209 |
| "action_map W1 = 1" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
210 |
| "action_map L = 2" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
211 |
| "action_map R = 3" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
212 |
| "action_map Nop = 4" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
213 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
214 |
fun action_map_iff :: "nat \<Rightarrow> action" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
215 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
216 |
"action_map_iff (0::nat) = W0" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
217 |
| "action_map_iff (Suc 0) = W1" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
218 |
| "action_map_iff (Suc (Suc 0)) = L" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
219 |
| "action_map_iff (Suc (Suc (Suc 0))) = R" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
220 |
| "action_map_iff n = Nop" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
221 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
222 |
fun block_map :: "cell \<Rightarrow> nat" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
223 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
224 |
"block_map Bk = 0" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
225 |
| "block_map Oc = 1" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
226 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
227 |
fun Goedel_code' :: "nat list \<Rightarrow> nat \<Rightarrow> nat" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
228 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
229 |
"Goedel_code' [] n = 1" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
230 |
| "Goedel_code' (x # xs) n = (Pi n) ^ x * Goedel_code' xs (Suc n) " |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
231 |
|
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
232 |
fun Goedel_code :: "nat list \<Rightarrow> nat" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
233 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
234 |
"Goedel_code xs = 2 ^ (length xs) * (Goedel_code' xs 1)" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
235 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
236 |
fun modify_tprog :: "instr list \<Rightarrow> nat list" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
237 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
238 |
"modify_tprog [] = []" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
239 |
| "modify_tprog ((a, s) # nl) = action_map a # s # modify_tprog nl" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
240 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
241 |
text {* @{text "Code tp"} gives the Goedel coding of TM program @{text "tp"}. *} |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
242 |
fun Code :: "instr list \<Rightarrow> nat" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
243 |
where |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
244 |
"Code tp = Goedel_code (modify_tprog tp)" |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
245 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
246 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
247 |
section {* Universal Function as Recursive Functions *} |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
248 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
249 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
250 |
"rec_entry = CN rec_lo [Id 2 0, CN rec_pi [CN S [Id 2 1]]]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
251 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
252 |
fun rec_listsum2 :: "nat \<Rightarrow> nat \<Rightarrow> recf" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
253 |
where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
254 |
"rec_listsum2 vl 0 = CN Z [Id vl 0]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
255 |
| "rec_listsum2 vl (Suc n) = CN rec_add [rec_listsum2 vl n, Id vl n]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
256 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
257 |
fun rec_strt' :: "nat \<Rightarrow> nat \<Rightarrow> recf" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
258 |
where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
259 |
"rec_strt' xs 0 = Z" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
260 |
| "rec_strt' xs (Suc n) = |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
261 |
(let dbound = CN rec_add [rec_listsum2 xs n, constn n] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
262 |
let t1 = CN rec_power [constn 2, dbound] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
263 |
let t2 = CN rec_power [constn 2, CN rec_add [Id xs n, dbound]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
264 |
CN rec_add [rec_strt' xs n, CN rec_minus [t2, t1]])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
265 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
266 |
fun rec_map :: "recf \<Rightarrow> nat \<Rightarrow> recf list" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
267 |
where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
268 |
"rec_map rf vl = map (\<lambda>i. CN rf [Id vl i]) [0..<vl]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
269 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
270 |
fun rec_strt :: "nat \<Rightarrow> recf" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
271 |
where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
272 |
"rec_strt xs = CN (rec_strt' xs xs) (rec_map S xs)" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
273 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
274 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
275 |
"rec_scan = CN rec_mod [Id 1 0, constn 2]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
276 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
277 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
278 |
"rec_newleft = |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
279 |
(let cond1 = CN rec_disj [CN rec_eq [Id 3 2, Z], CN rec_eq [Id 3 2, constn 1]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
280 |
let cond2 = CN rec_eq [Id 3 2, constn 2] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
281 |
let cond3 = CN rec_eq [Id 3 2, constn 3] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
282 |
let case3 = CN rec_add [CN rec_mult [constn 2, Id 3 0], |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
283 |
CN rec_mod [Id 3 1, constn 2]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
284 |
CN rec_if [cond1, Id 3 0, |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
285 |
CN rec_if [cond2, CN rec_quo [Id 3 0, constn 2], |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
286 |
CN rec_if [cond3, case3, Id 3 0]]])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
287 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
288 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
289 |
"rec_newright = |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
290 |
(let condn = \<lambda>n. CN rec_eq [Id 3 2, constn n] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
291 |
let case0 = CN rec_minus [Id 3 1, CN rec_scan [Id 3 1]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
292 |
let case1 = CN rec_minus [CN rec_add [Id 3 1, constn 1], CN rec_scan [Id 3 1]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
293 |
let case2 = CN rec_add [CN rec_mult [constn 2, Id 3 1], |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
294 |
CN rec_mod [Id 3 0, constn 2]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
295 |
let case3 = CN rec_quo [Id 2 1, constn 2] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
296 |
CN rec_if [condn 0, case0, |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
297 |
CN rec_if [condn 1, case1, |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
298 |
CN rec_if [condn 2, case2, |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
299 |
CN rec_if [condn 3, case3, Id 3 1]]]])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
300 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
301 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
302 |
"rec_actn = (let add1 = CN rec_mult [constn 4, CN rec_pred [Id 3 1]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
303 |
let add2 = CN rec_mult [constn 2, CN rec_scan [Id 3 2]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
304 |
let entry = CN rec_entry [Id 3 0, CN rec_add [add1, add2]] |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
305 |
in CN rec_if [Id 3 1, entry, constn 4])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
306 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
307 |
definition rec_newstat :: "recf" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
308 |
where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
309 |
"rec_newstat = (let add1 = CN rec_mult [constn 4, CN rec_pred [Id 3 1]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
310 |
let add2 = CN S [CN rec_mult [constn 2, CN rec_scan [Id 3 2]]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
311 |
let entry = CN rec_entry [Id 3 0, CN rec_add [add1, add2]] |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
312 |
in CN rec_if [Id 3 1, entry, Z])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
313 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
314 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
315 |
"rec_trpl = CN rec_mult [CN rec_mult |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
316 |
[CN rec_power [constn (Pi 0), Id 3 0], |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
317 |
CN rec_power [constn (Pi 1), Id 3 1]], |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
318 |
CN rec_power [constn (Pi 2), Id 3 2]]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
319 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
320 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
321 |
"rec_left = CN rec_lo [Id 1 0, constn (Pi 0)]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
322 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
323 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
324 |
"rec_right = CN rec_lo [Id 1 0, constn (Pi 2)]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
325 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
326 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
327 |
"rec_stat = CN rec_lo [Id 1 0, constn (Pi 1)]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
328 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
329 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
330 |
"rec_newconf = (let act = CN rec_actn [Id 2 0, CN rec_stat [Id 2 1], CN rec_right [Id 2 1]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
331 |
let left = CN rec_left [Id 2 1] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
332 |
let right = CN rec_right [Id 2 1] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
333 |
let stat = CN rec_stat [Id 2 1] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
334 |
let one = CN rec_newleft [left, right, act] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
335 |
let two = CN rec_newstat [Id 2 0, stat, right] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
336 |
let three = CN rec_newright [left, right, act] |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
337 |
in CN rec_trpl [one, two, three])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
338 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
339 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
340 |
"rec_conf = PR (CN rec_trpl [constn 0, constn 1, Id 2 1]) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
341 |
(CN rec_newconf [Id 4 2 , Id 4 1])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
342 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
343 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
344 |
"rec_nstd = (let disj1 = CN rec_noteq [rec_stat, constn 0] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
345 |
let disj2 = CN rec_noteq [rec_left, constn 0] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
346 |
let rhs = CN rec_pred [CN rec_power [constn 2, CN rec_lg [CN S [rec_right], constn 2]]] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
347 |
let disj3 = CN rec_noteq [rec_right, rhs] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
348 |
let disj4 = CN rec_eq [rec_right, constn 0] in |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
349 |
CN rec_disj [CN rec_disj [CN rec_disj [disj1, disj2], disj3], disj4])" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
350 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
351 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
352 |
"rec_nostop = CN rec_nstd [rec_conf]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
353 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
354 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
355 |
"rec_value = CN rec_pred [CN rec_lg [S, constn 2]]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
356 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
357 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
358 |
"rec_halt = MN rec_nostop" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
359 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
360 |
definition |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
361 |
"rec_uf = CN rec_value [CN rec_right [CN rec_conf [rec_halt, Id 2 0, Id 2 1]]]" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
362 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
363 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
364 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
365 |
section {* Correctness Proofs for Recursive Functions *} |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
366 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
367 |
lemma entry_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
368 |
"rec_eval rec_entry [sr, i] = Entry sr i" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
369 |
by(simp add: rec_entry_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
370 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
371 |
lemma listsum2_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
372 |
"length xs = vl \<Longrightarrow> rec_eval (rec_listsum2 vl n) xs = Listsum2 xs n" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
373 |
by (induct n) (simp_all) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
374 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
375 |
lemma strt'_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
376 |
"length xs = vl \<Longrightarrow> rec_eval (rec_strt' vl n) xs = Strt' xs n" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
377 |
by (induct n) (simp_all add: Let_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
378 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
379 |
lemma map_suc: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
380 |
"map (\<lambda>x. Suc (xs ! x)) [0..<length xs] = map Suc xs" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
381 |
proof - |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
382 |
have "Suc \<circ> (\<lambda>x. xs ! x) = (\<lambda>x. Suc (xs ! x))" by (simp add: comp_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
383 |
then have "map (\<lambda>x. Suc (xs ! x)) [0..<length xs] = map (Suc \<circ> (\<lambda>x. xs ! x)) [0..<length xs]" by simp |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
384 |
also have "... = map Suc (map (\<lambda>x. xs ! x) [0..<length xs])" by simp |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
385 |
also have "... = map Suc xs" by (simp add: map_nth) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
386 |
finally show "map (\<lambda>x. Suc (xs ! x)) [0..<length xs] = map Suc xs" . |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
387 |
qed |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
388 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
389 |
lemma strt_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
390 |
"length xs = vl \<Longrightarrow> rec_eval (rec_strt vl) xs = Strt xs" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
391 |
by (simp add: comp_def map_suc[symmetric]) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
392 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
393 |
lemma scan_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
394 |
"rec_eval rec_scan [r] = r mod 2" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
395 |
by(simp add: rec_scan_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
396 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
397 |
lemma newleft_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
398 |
"rec_eval rec_newleft [p, r, a] = Newleft p r a" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
399 |
by (simp add: rec_newleft_def Let_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
400 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
401 |
lemma newright_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
402 |
"rec_eval rec_newright [p, r, a] = Newright p r a" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
403 |
by (simp add: rec_newright_def Let_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
404 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
405 |
lemma actn_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
406 |
"rec_eval rec_actn [m, q, r] = Actn m q r" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
407 |
by (simp add: rec_actn_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
408 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
409 |
lemma newstat_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
410 |
"rec_eval rec_newstat [m, q, r] = Newstat m q r" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
411 |
by (simp add: rec_newstat_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
412 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
413 |
lemma trpl_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
414 |
"rec_eval rec_trpl [p, q, r] = Trpl p q r" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
415 |
by (simp add: rec_trpl_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
416 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
417 |
lemma left_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
418 |
"rec_eval rec_left [c] = Left c" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
419 |
by(simp add: rec_left_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
420 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
421 |
lemma right_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
422 |
"rec_eval rec_right [c] = Right c" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
423 |
by(simp add: rec_right_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
424 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
425 |
lemma stat_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
426 |
"rec_eval rec_stat [c] = Stat c" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
427 |
by(simp add: rec_stat_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
428 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
429 |
lemma newconf_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
430 |
"rec_eval rec_newconf [m, c] = Newconf m c" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
431 |
by (simp add: rec_newconf_def Let_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
432 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
433 |
lemma conf_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
434 |
"rec_eval rec_conf [k, m, r] = Conf k m r" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
435 |
by(induct k) (simp_all add: rec_conf_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
436 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
437 |
lemma nstd_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
438 |
"rec_eval rec_nstd [c] = (if Nstd c then 1 else 0)" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
439 |
by(simp add: rec_nstd_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
440 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
441 |
lemma nostop_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
442 |
"rec_eval rec_nostop [t, m, r] = (if Nostop t m r then 1 else 0)" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
443 |
by (simp add: rec_nostop_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
444 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
445 |
lemma value_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
446 |
"rec_eval rec_value [x] = Value x" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
447 |
by (simp add: rec_value_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
448 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
449 |
lemma halt_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
450 |
"rec_eval rec_halt [m, r] = Halt m r" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
451 |
by (simp add: rec_halt_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
452 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
453 |
lemma uf_lemma [simp]: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
454 |
"rec_eval rec_uf [m, r] = UF m r" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
455 |
by (simp add: rec_uf_def) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
456 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
457 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
458 |
subsection {* Relating interperter functions to the execution of TMs *} |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
459 |
|
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
460 |
lemma rec_step: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
461 |
assumes "(\<lambda> (s, l, r). s \<le> length tp div 2) c" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
462 |
shows "Trpl_code (step0 c tp) = Newconf (Code tp) (Trpl_code c)" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
463 |
apply(cases c) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
464 |
apply(simp only: Trpl_code.simps) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
465 |
apply(simp only: Let_def step.simps) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
466 |
apply(case_tac "fetch tp (a - 0) (read ca)") |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
467 |
apply(simp only: prod.cases) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
468 |
apply(case_tac "update aa (b, ca)") |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
469 |
apply(simp only: prod.cases) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
470 |
apply(simp only: Trpl_code.simps) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
471 |
apply(simp only: Newconf.simps) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
472 |
apply(simp only: Left.simps) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
473 |
oops |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
474 |
|
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
475 |
lemma rec_steps: |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
476 |
assumes "tm_wf0 tp" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
477 |
shows "Trpl_code (steps0 (1, Bk \<up> l, <lm>) tp stp) = Conf stp (Code tp) (bl2wc (<lm>))" |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
478 |
apply(induct stp) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
479 |
apply(simp) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
480 |
apply(simp) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
481 |
oops |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
482 |
|
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
483 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
484 |
lemma F_correct: |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
485 |
assumes tm: "steps0 (1, Bk \<up> l, <lm>) tp stp = (0, Bk \<up> m, Oc \<up> rs @ Bk \<up> n)" |
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
486 |
and wf: "tm_wf0 tp" "0 < rs" |
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
487 |
shows "rec_eval rec_uf [Code tp, bl2wc (<lm>)] = (rs - Suc 0)" |
250
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
488 |
proof - |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
489 |
from least_steps[OF tm] |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
490 |
obtain stp_least where |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
491 |
before: "\<forall>stp' < stp_least. \<not> is_final (steps0 (1, Bk \<up> l, <lm>) tp stp')" and |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
492 |
after: "\<forall>stp' \<ge> stp_least. is_final (steps0 (1, Bk \<up> l, <lm>) tp stp')" by blast |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
493 |
have "Halt (Code tp) (bl2wc (<lm>)) = stp_least" sorry |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
494 |
show ?thesis |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
495 |
apply(simp only: uf_lemma) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
496 |
apply(simp only: UF.simps) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
497 |
apply(simp only: Halt.simps) |
745547bdc1c7
added lemmas about a pairing function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
249
diff
changeset
|
498 |
oops |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
499 |
|
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
500 |
|
248
aea02b5a58d2
repaired old files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
246
diff
changeset
|
501 |
end |
246
e113420a2fce
separated recursive functions and UF
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
502 |