35 text {* |
35 text {* |
36 The following functions are used to expression invariants of {\em Copying} TM. |
36 The following functions are used to expression invariants of {\em Copying} TM. |
37 *} |
37 *} |
38 fun tcopy_F0 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
38 fun tcopy_F0 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
39 where |
39 where |
40 "tcopy_F0 x tp = (let (ln, rn) = tp in |
40 "tcopy_F0 x (l, r) = (\<exists> i. l = Bk\<^bsup>i\<^esup> \<and> r = Oc\<^bsup>x\<^esup> @ Bk # Oc\<^bsup>x\<^esup>)" |
41 list_all isBk ln & rn = replicate x Oc |
|
42 @ [Bk] @ replicate x Oc)" |
|
43 |
41 |
44 fun tcopy_F1 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
42 fun tcopy_F1 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
45 where |
43 where |
46 "tcopy_F1 x (ln, rn) = (ln = [] & rn = replicate x Oc)" |
44 "tcopy_F1 x (l, r) = (l = [] \<and> r = Oc\<^bsup>x\<^esup>)" |
47 |
45 |
48 fun tcopy_F2 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
46 fun tcopy_F2 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
49 where |
47 where |
50 "tcopy_F2 0 tp = False" | |
48 "tcopy_F2 x (l, r) = (\<exists> i j. i > 0 \<and> i + j = x \<and> l = Oc\<^bsup>i\<^esup> \<and> r = Oc\<^bsup>j\<^esup>)" |
51 "tcopy_F2 (Suc x) (ln, rn) = (length ln > 0 & |
|
52 ln @ rn = replicate (Suc x) Oc)" |
|
53 |
49 |
54 fun tcopy_F3 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
50 fun tcopy_F3 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
55 where |
51 where |
56 "tcopy_F3 0 tp = False" | |
52 "tcopy_F3 x (l, r) = (x > 0 \<and> l = Bk # Oc\<^bsup>x\<^esup> \<and> tl r = [])" |
57 "tcopy_F3 (Suc x) (ln, rn) = |
|
58 (ln = Bk # replicate (Suc x) Oc & length rn <= 1)" |
|
59 |
53 |
60 fun tcopy_F4 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
54 fun tcopy_F4 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
61 where |
55 where |
62 "tcopy_F4 0 tp = False" | |
56 "tcopy_F4 x (l, r) = (x > 0 \<and> ((l = Oc\<^bsup>x\<^esup> \<and> r = [Bk, Oc]) \<or> (l = Oc\<^bsup>x - 1\<^esup> \<and> r = [Oc, Bk, Oc])))" |
63 "tcopy_F4 (Suc x) (ln, rn) = |
57 |
64 ((ln = replicate x Oc & rn = [Oc, Bk, Oc]) |
58 fun tcopy_F5_loop :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
65 | (ln = replicate (Suc x) Oc & rn = [Bk, Oc])) " |
59 where |
|
60 "tcopy_F5_loop x (l, r) = |
|
61 (\<exists> i j. i + j + 1 = x \<and> l = Oc\<^bsup>i\<^esup> \<and> r = Oc # Oc # Bk\<^bsup>j\<^esup> @ Oc\<^bsup>j\<^esup> \<and> j > 0)" |
|
62 |
|
63 fun tcopy_F5_exit :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
|
64 where |
|
65 "tcopy_F5_exit x (l, r) = |
|
66 (l = [] \<and> r = Bk # Oc # Bk\<^bsup>x\<^esup> @ Oc\<^bsup>x\<^esup> \<and> x > 0 )" |
66 |
67 |
67 fun tcopy_F5 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
68 fun tcopy_F5 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
68 where |
69 where |
69 "tcopy_F5 0 tp = False" | |
70 "tcopy_F5 x (l, r) = (tcopy_F5_loop x (l, r) \<or> tcopy_F5_exit x (l, r))" |
70 "tcopy_F5 (Suc x) (ln, rn) = |
|
71 (if rn = [] then False |
|
72 else if hd rn = Bk then (ln = [] & |
|
73 rn = Bk # (Oc # replicate (Suc x) Bk |
|
74 @ replicate (Suc x) Oc)) |
|
75 else if hd rn = Oc then |
|
76 (\<exists>n. ln = replicate (x - n) Oc |
|
77 & rn = Oc # (Oc # replicate n Bk @ replicate n Oc) |
|
78 & n > 0 & n <= x) |
|
79 else False)" |
|
80 |
|
81 |
71 |
82 fun tcopy_F6 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
72 fun tcopy_F6 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
83 where |
73 where |
84 "tcopy_F6 0 tp = False" | |
74 "tcopy_F6 x (l, r) = |
85 "tcopy_F6 (Suc x) (ln, rn) = |
75 (\<exists> i j any. i + j = x \<and> x > 0 \<and> i > 0 \<and> j > 0 \<and> l = Oc\<^bsup>i\<^esup> \<and> r = any#Bk\<^bsup>j\<^esup> @ Oc\<^bsup>j\<^esup>)" |
86 (\<exists>n. ln = replicate (Suc x -n) Oc |
76 |
87 & tl rn = replicate n Bk @ replicate n Oc |
|
88 & n > 0 & n <= x)" |
|
89 |
|
90 fun tcopy_F7 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
77 fun tcopy_F7 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
91 where |
78 where |
92 "tcopy_F7 0 tp = False" | |
79 "tcopy_F7 x (l, r) = |
93 "tcopy_F7 (Suc x) (ln, rn) = |
80 (\<exists> i j k t. i + j = x \<and> i > 0 \<and> j > 0 \<and> k + t = Suc j \<and> l = Bk\<^bsup>k\<^esup> @ Oc\<^bsup>i\<^esup> \<and> r = Bk\<^bsup>t\<^esup> @ Oc\<^bsup>j\<^esup>)" |
94 (let lrn = (rev ln) @ rn in |
81 |
95 (\<exists>n. lrn = replicate ((Suc x) - n) Oc @ |
|
96 replicate (Suc n) Bk @ replicate n Oc |
|
97 & n > 0 & n <= x & |
|
98 length rn >= n & length rn <= 2 * n ))" |
|
99 |
|
100 fun tcopy_F8 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
82 fun tcopy_F8 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
101 where |
83 where |
102 "tcopy_F8 0 tp = False" | |
84 "tcopy_F8 x (l, r) = |
103 "tcopy_F8 (Suc x) (ln, rn) = |
85 (\<exists> i j k t. i + j = x \<and> i > 0 \<and> j > 0 \<and> k + t = j \<and> l = Oc\<^bsup>k\<^esup> @ Bk\<^bsup>Suc j\<^esup> @ Oc\<^bsup>i\<^esup> \<and> r = Oc\<^bsup>t\<^esup>)" |
104 (let lrn = (rev ln) @ rn in |
86 |
105 (\<exists>n. lrn = replicate ((Suc x) - n) Oc @ |
87 fun tcopy_F9_loop :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
106 replicate (Suc n) Bk @ replicate n Oc |
88 where |
107 & n > 0 & n <= x & length rn < n)) " |
89 "tcopy_F9_loop x (l, r) = |
|
90 (\<exists> i j k t. i + j = Suc x \<and> i > 0 \<and> j > 0 \<and> k + t = j \<and> t > 0\<and> l = Oc\<^bsup>k\<^esup> @ Bk\<^bsup>j\<^esup> @ Oc\<^bsup>i\<^esup> \<and> r = Oc\<^bsup>t\<^esup>)" |
|
91 |
|
92 fun tcopy_F9_exit :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
|
93 where |
|
94 "tcopy_F9_exit x (l, r) = (\<exists> i j. i + j = Suc x \<and> i > 0 \<and> j > 0 \<and> l = Bk\<^bsup>j - 1\<^esup> @ Oc\<^bsup>i\<^esup> \<and> r = Bk # Oc\<^bsup>j\<^esup>)" |
108 |
95 |
109 fun tcopy_F9 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
96 fun tcopy_F9 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
110 where |
97 where |
111 "tcopy_F9 0 tp = False" | |
98 "tcopy_F9 x (l, r) = (tcopy_F9_loop x (l, r) \<or> |
112 "tcopy_F9 (Suc x) (ln, rn) = |
99 tcopy_F9_exit x (l, r))" |
113 (let lrn = (rev ln) @ rn in |
100 |
114 (\<exists>n. lrn = replicate (Suc (Suc x) - n) Oc |
101 fun tcopy_F10_loop :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
115 @ replicate n Bk @ replicate n Oc |
102 where |
116 & n > Suc 0 & n <= Suc x & length rn > 0 |
103 "tcopy_F10_loop x (l, r) = |
117 & length rn <= Suc n))" |
104 (\<exists> i j k t. i + j = Suc x \<and> i > 0 \<and> k + t + 1 = j \<and> l = Bk\<^bsup>k\<^esup> @ Oc\<^bsup>i\<^esup> \<and> r = Bk\<^bsup>Suc t\<^esup> @ Oc\<^bsup>j\<^esup>)" |
|
105 |
|
106 fun tcopy_F10_exit :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
|
107 where |
|
108 "tcopy_F10_exit x (l, r) = |
|
109 (\<exists> i j. i + j = x \<and> j > 0 \<and> l = Oc\<^bsup>i\<^esup> \<and> r = Oc # Bk\<^bsup>j\<^esup> @ Oc\<^bsup>j\<^esup>)" |
118 |
110 |
119 fun tcopy_F10 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
111 fun tcopy_F10 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
120 where |
112 where |
121 "tcopy_F10 0 tp = False" | |
113 "tcopy_F10 x (l, r) = (tcopy_F10_loop x (l, r) \<or> tcopy_F10_exit x (l, r))" |
122 "tcopy_F10 (Suc x) (ln, rn) = |
|
123 (let lrn = (rev ln) @ rn in |
|
124 (\<exists>n. lrn = replicate (Suc (Suc x) - n) Oc |
|
125 @ replicate n Bk @ replicate n Oc & n > Suc 0 |
|
126 & n <= Suc x & length rn > Suc n & |
|
127 length rn <= 2*n + 1 ))" |
|
128 |
114 |
129 fun tcopy_F11 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
115 fun tcopy_F11 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
130 where |
116 where |
131 "tcopy_F11 0 tp = False" | |
117 "tcopy_F11 x (l, r) = (x > 0 \<and> l = [Bk] \<and> r = Oc # Bk\<^bsup>x\<^esup> @ Oc\<^bsup>x\<^esup>)" |
132 "tcopy_F11 (Suc x) (ln, rn) = |
|
133 (ln = [Bk] & rn = Oc # replicate (Suc x) Bk |
|
134 @ replicate (Suc x) Oc)" |
|
135 |
118 |
136 fun tcopy_F12 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
119 fun tcopy_F12 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
137 where |
120 where |
138 "tcopy_F12 0 tp = False" | |
121 "tcopy_F12 x (l, r) = (\<exists> i j. i + j = Suc x \<and> x > 0 \<and> l = Oc\<^bsup>i\<^esup> @ [Bk] \<and> r = Bk\<^bsup>j\<^esup> @ Oc\<^bsup>x\<^esup>)" |
139 "tcopy_F12 (Suc x) (ln, rn) = |
|
140 (let lrn = ((rev ln) @ rn) in |
|
141 (\<exists>n. n > 0 & n <= Suc (Suc x) |
|
142 & lrn = Bk # replicate n Oc @ replicate (Suc (Suc x) - n) Bk |
|
143 @ replicate (Suc x) Oc |
|
144 & length ln = Suc n))" |
|
145 |
122 |
146 fun tcopy_F13 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
123 fun tcopy_F13 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
147 where |
124 where |
148 "tcopy_F13 0 tp = False" | |
125 "tcopy_F13 x (l, r) = |
149 "tcopy_F13 (Suc x) (ln, rn) = |
126 (\<exists> i j. x > 0 \<and> i + j = x \<and> l = Oc\<^bsup>i\<^esup> @ [Bk] \<and> r = Oc # Bk\<^bsup>j\<^esup> @ Oc\<^bsup>x\<^esup> )" |
150 (let lrn = ((rev ln) @ rn) in |
127 |
151 (\<exists>n. n > Suc 0 & n <= Suc (Suc x) |
|
152 & lrn = Bk # replicate n Oc @ replicate (Suc (Suc x) - n) Bk |
|
153 @ replicate (Suc x) Oc |
|
154 & length ln = n))" |
|
155 |
|
156 fun tcopy_F14 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
128 fun tcopy_F14 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
157 where |
129 where |
158 "tcopy_F14 0 tp = False" | |
130 "tcopy_F14 x (l, r) = (\<exists> any. x > 0 \<and> l = Oc\<^bsup>x\<^esup> @ [Bk] \<and> r = any#Oc\<^bsup>x\<^esup>)" |
159 "tcopy_F14 (Suc x) (ln, rn) = |
131 |
160 (ln = replicate (Suc x) Oc @ [Bk] & |
132 fun tcopy_F15_loop :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
161 tl rn = replicate (Suc x) Oc)" |
133 where |
|
134 "tcopy_F15_loop x (l, r) = |
|
135 (\<exists> i j. i + j = x \<and> x > 0 \<and> j > 0 \<and> l = Oc\<^bsup>i\<^esup> @ [Bk] \<and> r = Oc\<^bsup>j\<^esup> @ Bk # Oc\<^bsup>x\<^esup>)" |
|
136 |
|
137 fun tcopy_F15_exit :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
|
138 where |
|
139 "tcopy_F15_exit x (l, r) = (x > 0 \<and> l = [] \<and> r = Bk # Oc\<^bsup>x\<^esup> @ Bk # Oc\<^bsup>x\<^esup>)" |
162 |
140 |
163 fun tcopy_F15 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
141 fun tcopy_F15 :: "nat \<Rightarrow> tape \<Rightarrow> bool" |
164 where |
142 where |
165 "tcopy_F15 0 tp = False" | |
143 "tcopy_F15 x (l, r) = (tcopy_F15_loop x (l, r) \<or> tcopy_F15_exit x (l, r))" |
166 "tcopy_F15 (Suc x) (ln, rn) = |
|
167 (let lrn = ((rev ln) @ rn) in |
|
168 lrn = Bk # replicate (Suc x) Oc @ [Bk] @ |
|
169 replicate (Suc x) Oc & length ln <= (Suc x))" |
|
170 |
144 |
171 text {* |
145 text {* |
172 The following @{text "inv_tcopy"} is the invariant of the {\em Copying} TM. |
146 The following @{text "inv_tcopy"} is the invariant of the {\em Copying} TM. |
173 *} |
147 *} |
174 fun inv_tcopy :: "nat \<Rightarrow> t_conf \<Rightarrow> bool" |
148 fun inv_tcopy :: "nat \<Rightarrow> t_conf \<Rightarrow> bool" |
362 lemma listall_append: "list_all p (xs @ ys) = |
336 lemma listall_append: "list_all p (xs @ ys) = |
363 (list_all p xs \<and> list_all p ys)" |
337 (list_all p xs \<and> list_all p ys)" |
364 apply(induct xs) |
338 apply(induct xs) |
365 apply(simp+) |
339 apply(simp+) |
366 done |
340 done |
|
341 *) |
|
342 lemma false_case1: |
|
343 "\<lbrakk>Oc\<^bsup>j\<^esup> @ Bk # Oc\<^bsup>i + j\<^esup> = Oc # list; |
|
344 0 < i; |
|
345 \<forall>ia. tl (Oc\<^bsup>i\<^esup> @ [Bk]) = Oc\<^bsup>ia\<^esup> @ [Bk] \<longrightarrow> (\<forall>ja. ia + ja = i + j |
|
346 \<longrightarrow> hd (Oc\<^bsup>i\<^esup> @ [Bk]) # Oc # list \<noteq> Oc\<^bsup>ja\<^esup> @ Bk # Oc\<^bsup>i + j\<^esup>)\<rbrakk> |
|
347 \<Longrightarrow> RR" |
|
348 apply(case_tac i, auto simp: exp_ind_def) |
|
349 apply(erule_tac x = nat in allE, simp add:exp_ind_def) |
|
350 apply(erule_tac x = "Suc j" in allE, simp) |
|
351 done |
|
352 |
|
353 lemma false_case3:"\<forall>ja. ja \<noteq> i \<Longrightarrow> RR" |
|
354 by auto |
367 |
355 |
368 lemma [elim]: "\<lbrakk>tstep (15, b, c) tcopy = (15, ab, ba); |
356 lemma [elim]: "\<lbrakk>tstep (15, b, c) tcopy = (15, ab, ba); |
369 tcopy_F15 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F15 x (ab, ba)" |
357 tcopy_F15 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F15 x (ab, ba)" |
370 apply(case_tac x) |
|
371 apply(auto simp: tstep.simps tcopy_F15.simps |
358 apply(auto simp: tstep.simps tcopy_F15.simps |
372 tcopy_def fetch.simps new_tape.simps |
359 tcopy_def fetch.simps new_tape.simps |
373 split: if_splits list.splits block.splits) |
360 split: if_splits list.splits block.splits elim: false_case1) |
374 apply(case_tac b, simp+) |
361 apply(case_tac [!] i, simp_all add: exp_zero exp_ind_def) |
|
362 apply(erule_tac [!] x = nat in allE, simp_all add: exp_ind_def) |
|
363 apply(auto elim: false_case3) |
375 done |
364 done |
376 |
365 |
377 lemma [elim]: "\<lbrakk>tstep (14, b, c) tcopy = (14, ab, ba); |
366 lemma [elim]: "\<lbrakk>tstep (14, b, c) tcopy = (14, ab, ba); |
378 tcopy_F14 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F14 x (ab, ba)" |
367 tcopy_F14 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F14 x (ab, ba)" |
379 apply(case_tac x) |
|
380 apply(auto simp: tcopy_F14.simps tcopy_def tstep.simps |
368 apply(auto simp: tcopy_F14.simps tcopy_def tstep.simps |
381 tcopy_F14.simps fetch.simps new_tape.simps |
369 tcopy_F14.simps fetch.simps new_tape.simps |
382 split: if_splits list.splits block.splits) |
370 split: if_splits list.splits block.splits) |
383 done |
371 done |
384 |
372 |
385 lemma [intro]: "list_all isBk (replicate x Bk)" |
|
386 apply(induct x, simp+) |
|
387 done |
|
388 |
|
389 lemma [elim]: "list_all isBk (dropWhile (\<lambda>a. a = Oc) b) \<Longrightarrow> |
|
390 list_all isBk (dropWhile (\<lambda>a. a = Oc) (tl b))" |
|
391 apply(case_tac b, auto split: if_splits) |
|
392 apply(drule list_replicate_Bk) |
|
393 apply(case_tac "length list", auto) |
|
394 done |
|
395 |
|
396 lemma [elim]: "list_all (\<lambda> a. a = Oc) list \<Longrightarrow> |
|
397 list = replicate (length list) Oc" |
|
398 apply(induct list) |
|
399 apply(simp+) |
|
400 done |
|
401 |
|
402 lemma append_length: "\<lbrakk>as @ bs = cs @ ds; length bs = length ds\<rbrakk> |
|
403 \<Longrightarrow> as = cs & bs = ds" |
|
404 apply(auto) |
|
405 done |
|
406 |
|
407 lemma Suc_elim: "Suc (Suc m) - n = Suc na \<Longrightarrow> Suc m - n = na" |
|
408 apply(simp) |
|
409 done |
|
410 |
|
411 lemma [elim]: "\<lbrakk>0 < n; n \<le> Suc (Suc na); |
|
412 rev b @ Oc # list = |
|
413 Bk # replicate n Oc @ replicate (Suc (Suc na) - n) Bk @ |
|
414 Oc # replicate na Oc; |
|
415 length b = Suc n; b \<noteq> []\<rbrakk> |
|
416 \<Longrightarrow> list_all isBk (dropWhile (\<lambda>a. a = Oc) (tl b))" |
|
417 apply(case_tac "rev b", auto) |
|
418 done |
|
419 |
|
420 lemma b_cons_same: "b#bs = replicate x a @ as \<Longrightarrow> a \<noteq> b \<longrightarrow> x = 0" |
|
421 apply(case_tac x, simp+) |
|
422 done |
|
423 |
|
424 lemma tcopy_tmp[elim]: |
|
425 "\<lbrakk>0 < n; n \<le> Suc (Suc na); |
|
426 rev b @ Oc # list = |
|
427 Bk # replicate n Oc @ replicate (Suc (Suc na) - n) Bk |
|
428 @ Oc # replicate na Oc; length b = Suc n; b \<noteq> []\<rbrakk> |
|
429 \<Longrightarrow> list = replicate na Oc" |
|
430 apply(case_tac "rev b", simp+) |
|
431 apply(auto) |
|
432 apply(frule b_cons_same, auto) |
|
433 done |
|
434 |
373 |
435 lemma [elim]: "\<lbrakk>tstep (12, b, c) tcopy = (14, ab, ba); |
374 lemma [elim]: "\<lbrakk>tstep (12, b, c) tcopy = (14, ab, ba); |
436 tcopy_F12 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F14 x (ab, ba)" |
375 tcopy_F12 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F14 x (ab, ba)" |
437 apply(case_tac x) |
|
438 apply(auto simp:tcopy_F12.simps tcopy_F14.simps |
376 apply(auto simp:tcopy_F12.simps tcopy_F14.simps |
439 tcopy_def tstep.simps fetch.simps new_tape.simps |
377 tcopy_def tstep.simps fetch.simps new_tape.simps |
440 split: if_splits list.splits block.splits) |
378 split: if_splits list.splits block.splits) |
441 apply(frule tcopy_tmp, simp+) |
379 apply(case_tac [!] j, simp_all add: exp_zero exp_ind_def) |
442 apply(case_tac n, simp+) |
|
443 apply(case_tac nata, simp+) |
|
444 done |
|
445 |
|
446 lemma replicate_app_Cons: "replicate a b @ b # replicate c b |
|
447 = replicate (Suc (a + c)) b" |
|
448 apply(simp) |
|
449 apply(simp add: replicate_app_Cons_same) |
|
450 apply(simp only: replicate_add[THEN sym]) |
|
451 done |
|
452 |
|
453 lemma replicate_same_exE_pref: "\<exists>x. bs @ (b # cs) = replicate x y |
|
454 \<Longrightarrow> (\<exists>n. bs = replicate n y)" |
|
455 apply(induct bs) |
|
456 apply(rule_tac x = 0 in exI, simp) |
|
457 apply(drule impI) |
|
458 apply(erule impE) |
|
459 apply(erule exE, simp+) |
|
460 apply(case_tac x, auto) |
|
461 apply(case_tac x, auto) |
|
462 apply(rule_tac x = "Suc n" in exI, simp+) |
|
463 done |
|
464 |
|
465 lemma replicate_same_exE_inf: "\<exists>x. bs @ (b # cs) = replicate x y \<Longrightarrow> b = y" |
|
466 apply(induct bs, auto) |
|
467 apply(case_tac x, auto) |
|
468 apply(drule impI) |
|
469 apply(erule impE) |
|
470 apply(case_tac x, simp+) |
|
471 done |
|
472 |
|
473 lemma replicate_same_exE_suf: |
|
474 "\<exists>x. bs @ (b # cs) = replicate x y \<Longrightarrow> \<exists>n. cs = replicate n y" |
|
475 apply(induct bs, auto) |
|
476 apply(case_tac x, simp+) |
|
477 apply(drule impI, erule impE) |
|
478 apply(case_tac x, simp+) |
|
479 done |
|
480 |
|
481 lemma replicate_same_exE: "\<exists>x. bs @ (b # cs) = replicate x y |
|
482 \<Longrightarrow> (\<exists>n. bs = replicate n y) & (b = y) & (\<exists>m. cs = replicate m y)" |
|
483 apply(rule conjI) |
|
484 apply(drule replicate_same_exE_pref, simp) |
|
485 apply(rule conjI) |
|
486 apply(drule replicate_same_exE_inf, simp) |
|
487 apply(drule replicate_same_exE_suf, simp) |
|
488 done |
|
489 |
|
490 lemma replicate_same: "bs @ (b # cs) = replicate x y |
|
491 \<Longrightarrow> (\<exists>n. bs = replicate n y) & (b = y) & (\<exists>m. cs = replicate m y)" |
|
492 apply(rule_tac replicate_same_exE) |
|
493 apply(rule_tac x = x in exI) |
|
494 apply(assumption) |
|
495 done |
|
496 |
|
497 lemma [elim]: "\<lbrakk> 0 < n; n \<le> Suc (Suc na); |
|
498 (rev ab @ Bk # list) = Bk # replicate n Oc |
|
499 @ replicate (Suc (Suc na) - n) Bk @ Oc # replicate na Oc; ab \<noteq> []\<rbrakk> |
|
500 \<Longrightarrow> n \<le> Suc na" |
|
501 apply(rule contrapos_pp, simp+) |
|
502 apply(case_tac "rev ab", simp+) |
|
503 apply(auto) |
|
504 apply(simp only: replicate_app_Cons) |
|
505 apply(drule replicate_same) |
|
506 apply(auto) |
|
507 done |
|
508 |
|
509 |
|
510 lemma [elim]: "\<lbrakk>0 < n; n \<le> Suc (Suc na); |
|
511 rev ab @ Bk # list = Bk # replicate n Oc @ |
|
512 replicate (Suc (Suc na) - n) Bk @ Oc # replicate na Oc; |
|
513 length ab = Suc n; ab \<noteq> []\<rbrakk> |
|
514 \<Longrightarrow> rev ab @ Oc # list = Bk # Oc # replicate n Oc @ |
|
515 replicate (Suc na - n) Bk @ Oc # replicate na Oc" |
|
516 apply(case_tac "rev ab", simp+) |
|
517 apply(auto) |
|
518 apply(simp only: replicate_Cons_simp) |
|
519 apply(simp) |
|
520 apply(case_tac "Suc (Suc na) - n", simp+) |
|
521 done |
380 done |
522 |
381 |
523 lemma [elim]: "\<lbrakk>tstep (12, b, c) tcopy = (13, ab, ba); |
382 lemma [elim]: "\<lbrakk>tstep (12, b, c) tcopy = (13, ab, ba); |
524 tcopy_F12 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F13 x (ab, ba)" |
383 tcopy_F12 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F13 x (ab, ba)" |
525 apply(case_tac x) |
384 apply(auto simp:tcopy_F12.simps tcopy_F13.simps |
526 apply(simp_all add:tcopy_F12.simps tcopy_F13.simps |
385 tcopy_def tstep.simps fetch.simps new_tape.simps |
527 tcopy_def tstep.simps fetch.simps new_tape.simps) |
386 split: if_splits list.splits block.splits) |
528 apply(simp split: if_splits list.splits block.splits) |
387 apply(case_tac x, simp_all add: exp_ind_def exp_zero) |
529 apply(auto) |
388 apply(rule_tac [!] x = i in exI, simp_all) |
530 done |
389 apply(rule_tac [!] x = "j - 1" in exI) |
531 |
390 apply(case_tac [!] j, simp_all add: exp_ind_def exp_zero) |
|
391 apply(case_tac x, simp_all add: exp_ind_def exp_zero) |
|
392 done |
532 |
393 |
533 lemma [elim]: "\<lbrakk>tstep (11, b, c) tcopy = (12, ab, ba); |
394 lemma [elim]: "\<lbrakk>tstep (11, b, c) tcopy = (12, ab, ba); |
534 tcopy_F11 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F12 x (ab, ba)" |
395 tcopy_F11 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F12 x (ab, ba)" |
535 apply(case_tac x) |
|
536 apply(simp_all add:tcopy_F12.simps tcopy_F11.simps |
396 apply(simp_all add:tcopy_F12.simps tcopy_F11.simps |
537 tcopy_def tstep.simps fetch.simps new_tape.simps) |
397 tcopy_def tstep.simps fetch.simps new_tape.simps) |
538 apply(auto) |
398 apply(auto) |
539 done |
399 apply(rule_tac x = "Suc 0" in exI, |
540 |
400 rule_tac x = x in exI, simp add: exp_ind_def exp_zero) |
541 lemma equal_length: "a = b \<Longrightarrow> length a = length b" |
401 done |
542 by(simp) |
402 |
543 |
403 |
544 lemma [elim]: "\<lbrakk>tstep (13, b, c) tcopy = (12, ab, ba); |
404 lemma [elim]: "\<lbrakk>tstep (13, b, c) tcopy = (12, ab, ba); |
545 tcopy_F13 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F12 x (ab, ba)" |
405 tcopy_F13 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F12 x (ab, ba)" |
546 apply(case_tac x) |
406 apply(auto simp:tcopy_F12.simps tcopy_F13.simps |
547 apply(simp_all add:tcopy_F12.simps tcopy_F13.simps |
407 tcopy_def tstep.simps fetch.simps new_tape.simps |
548 tcopy_def tstep.simps fetch.simps new_tape.simps) |
408 split: if_splits list.splits block.splits) |
549 apply(simp split: if_splits list.splits block.splits) |
409 apply(rule_tac [!] x = "Suc i" in exI, simp_all add: exp_ind_def) |
550 apply(auto) |
|
551 apply(drule equal_length, simp) |
|
552 done |
410 done |
553 |
411 |
554 lemma [elim]: "\<lbrakk>tstep (5, b, c) tcopy = (11, ab, ba); |
412 lemma [elim]: "\<lbrakk>tstep (5, b, c) tcopy = (11, ab, ba); |
555 tcopy_F5 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F11 x (ab, ba)" |
413 tcopy_F5 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F11 x (ab, ba)" |
556 apply(case_tac x) |
|
557 apply(simp_all add:tcopy_F11.simps tcopy_F5.simps tcopy_def |
414 apply(simp_all add:tcopy_F11.simps tcopy_F5.simps tcopy_def |
558 tstep.simps fetch.simps new_tape.simps) |
415 tstep.simps fetch.simps new_tape.simps) |
559 apply(simp split: if_splits list.splits block.splits) |
416 apply(simp split: if_splits list.splits block.splits) |
560 done |
417 done |
561 |
418 |
562 lemma less_equal: "\<lbrakk>length xs <= b; \<not> Suc (length xs) <= b\<rbrakk> \<Longrightarrow> |
419 lemma F10_false: "tcopy_F10 x (b, []) = False" |
563 length xs = b" |
420 apply(auto simp: tcopy_F10.simps exp_ind_def) |
564 apply(simp) |
421 done |
565 done |
422 |
566 |
423 lemma F10_false2: "tcopy_F10 x ([], Bk # list) = False" |
567 lemma length_cons_same: "\<lbrakk>xs @ b # ys = as @ bs; |
424 apply(auto simp:tcopy_F10.simps) |
568 length ys = length bs\<rbrakk> \<Longrightarrow> xs @ [b] = as & ys = bs" |
425 apply(case_tac i, simp_all add: exp_ind_def exp_zero) |
569 apply(drule rev_equal) |
426 done |
570 apply(simp) |
427 |
571 apply(auto) |
428 lemma [simp]: "tcopy_F10_exit x (b, Bk # list) = False" |
572 apply(drule rev_equal, simp) |
429 apply(auto simp: tcopy_F10.simps) |
573 done |
430 done |
574 |
431 |
575 lemma replicate_set_equal: "\<lbrakk> xs @ [a] = replicate n b; a \<noteq> b\<rbrakk> \<Longrightarrow> RR" |
432 declare tcopy_F10_loop.simps[simp del] tcopy_F10_exit.simps[simp del] |
576 apply(drule rev_equal, simp) |
433 |
577 apply(case_tac n, simp+) |
434 lemma [simp]: "tcopy_F10_loop x (b, [Bk]) = False" |
|
435 apply(auto simp: tcopy_F10_loop.simps) |
|
436 apply(simp add: exp_ind_def) |
578 done |
437 done |
579 |
438 |
580 lemma [elim]: "\<lbrakk>tstep (10, b, c) tcopy = (10, ab, ba); |
439 lemma [elim]: "\<lbrakk>tstep (10, b, c) tcopy = (10, ab, ba); |
581 tcopy_F10 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F10 x (ab, ba)" |
440 tcopy_F10 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F10 x (ab, ba)" |
582 apply(case_tac x) |
441 apply(simp add: tcopy_def tstep.simps fetch.simps |
583 apply(auto simp:tcopy_F10.simps tcopy_def tstep.simps fetch.simps |
442 new_tape.simps exp_ind_def exp_zero_simp exp_zero_simp2 F10_false F10_false2 |
584 new_tape.simps |
|
585 split: if_splits list.splits block.splits) |
443 split: if_splits list.splits block.splits) |
586 apply(rule_tac x = n in exI, auto) |
444 apply(simp add: tcopy_F10.simps del: tcopy_F10_loop.simps tcopy_F10_exit.simps) |
587 apply(case_tac b, simp+) |
445 apply(case_tac b, simp, case_tac aa) |
588 apply(rule contrapos_pp, simp+) |
446 apply(rule_tac disjI1) |
589 apply(frule less_equal, simp+) |
447 apply(simp only: tcopy_F10_loop.simps) |
590 apply(drule length_cons_same, auto) |
448 apply(erule_tac exE)+ |
591 apply(drule replicate_set_equal, simp+) |
449 apply(rule_tac x = i in exI, rule_tac x = j in exI, |
592 done |
450 rule_tac x = "k - 1" in exI, rule_tac x = "Suc t" in exI, simp) |
593 |
451 apply(case_tac k, simp_all add: exp_ind_def exp_zero) |
594 lemma less_equal2: "\<not> (n::nat) \<le> m \<Longrightarrow> \<exists>x. n = x + m & x > 0" |
452 apply(case_tac i, simp_all add: exp_ind_def exp_zero) |
595 apply(rule_tac x = "n - m" in exI) |
453 apply(rule_tac disjI2) |
|
454 apply(simp only: tcopy_F10_loop.simps tcopy_F10_exit.simps) |
|
455 apply(erule_tac exE)+ |
|
456 apply(rule_tac x = "i - 1" in exI, rule_tac x = "j" in exI) |
|
457 apply(case_tac k, simp_all add: exp_ind_def exp_zero) |
|
458 apply(case_tac i, simp_all add: exp_ind_def exp_zero) |
596 apply(auto) |
459 apply(auto) |
597 done |
460 apply(simp add: exp_ind_def) |
598 |
461 done |
599 lemma replicate_tail_length[dest]: |
462 |
600 "\<lbrakk>rev b @ Bk # list = xs @ replicate n Bk @ replicate n Oc\<rbrakk> |
463 (* |
601 \<Longrightarrow> length list >= n" |
464 lemma false_case4: "\<lbrakk>i + (k + t) = Suc x; |
602 apply(rule contrapos_pp, simp+) |
465 0 < i; |
603 apply(drule less_equal2, auto) |
466 Bk # list = Oc\<^bsup>t\<^esup>; |
604 apply(drule rev_equal) |
467 \<forall>ia j. ia + j = Suc x \<longrightarrow> ia = 0 \<or> (\<forall>ka. tl (Oc\<^bsup>k\<^esup>) @ Bk\<^bsup>k + t\<^esup> @ Oc\<^bsup>i\<^esup> = Bk\<^bsup>ka\<^esup> @ Oc\<^bsup>ia\<^esup> \<longrightarrow> (\<forall>ta. Suc (ka + ta) = j \<longrightarrow> Oc # Oc\<^bsup>t\<^esup> \<noteq> Bk\<^bsup>Suc ta\<^esup> @ Oc\<^bsup>j\<^esup>)); |
605 apply(simp add: replicate_add) |
468 0 < k\<rbrakk> |
606 apply(auto) |
469 \<Longrightarrow> RR" |
607 apply(case_tac x, simp+) |
470 apply(case_tac t, simp_all add: exp_ind_def exp_zero) |
608 done |
471 done |
609 |
472 |
|
473 lemma false_case5: " |
|
474 \<lbrakk>Suc (i + nata) = x; |
|
475 0 < i; |
|
476 \<forall>ia j. ia + j = Suc x \<longrightarrow> ia = 0 \<or> (\<forall>k. Bk\<^bsup>nata\<^esup> @ Oc\<^bsup>i\<^esup> = Bk\<^bsup>k\<^esup> @ Oc\<^bsup>ia\<^esup> \<longrightarrow> (\<forall>t. Suc (k + t) = j \<longrightarrow> Bk # Oc # Oc # Oc\<^bsup>nata\<^esup> \<noteq> Bk\<^bsup>t\<^esup> @ Oc\<^bsup>j\<^esup>))\<rbrakk> |
|
477 \<Longrightarrow> False" |
|
478 apply(erule_tac x = i in allE, simp) |
|
479 apply(erule_tac x = "Suc (Suc nata)" in allE, simp) |
|
480 apply(erule_tac x = nata in allE, simp, simp add: exp_ind_def exp_zero) |
|
481 done |
|
482 |
|
483 lemma false_case6: "\<lbrakk>0 < x; \<forall>i. tl (Oc\<^bsup>x\<^esup>) = Oc\<^bsup>i\<^esup> \<longrightarrow> (\<forall>j. i + j = x \<longrightarrow> j = 0 \<or> [Bk, Oc] \<noteq> Bk\<^bsup>j\<^esup> @ Oc\<^bsup>j\<^esup>)\<rbrakk> |
|
484 \<Longrightarrow> False" |
|
485 apply(erule_tac x = "x - 1" in allE) |
|
486 apply(case_tac x, simp_all add: exp_ind_def exp_zero) |
|
487 apply(erule_tac x = "Suc 0" in allE, simp) |
|
488 done |
|
489 *) |
|
490 |
|
491 lemma [simp]: "tcopy_F9 x ([], b) = False" |
|
492 apply(auto simp: tcopy_F9.simps) |
|
493 apply(case_tac [!] i, simp_all add: exp_ind_def exp_zero) |
|
494 done |
|
495 |
|
496 lemma [simp]: "tcopy_F9 x (b, []) = False" |
|
497 apply(auto simp: tcopy_F9.simps) |
|
498 apply(case_tac [!] t, simp_all add: exp_ind_def exp_zero) |
|
499 done |
|
500 |
|
501 declare tcopy_F9_loop.simps[simp del] tcopy_F9_exit.simps[simp del] |
|
502 lemma [simp]: "tcopy_F9_loop x (b, Bk # list) = False" |
|
503 apply(auto simp: tcopy_F9_loop.simps) |
|
504 apply(case_tac [!] t, simp_all add: exp_ind_def exp_zero) |
|
505 done |
610 |
506 |
611 lemma [elim]: "\<lbrakk>tstep (9, b, c) tcopy = (10, ab, ba); |
507 lemma [elim]: "\<lbrakk>tstep (9, b, c) tcopy = (10, ab, ba); |
612 tcopy_F9 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F10 x (ab, ba)" |
508 tcopy_F9 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F10 x (ab, ba)" |
613 apply(case_tac x) |
509 apply(auto simp:tcopy_def |
614 apply(auto simp:tcopy_F10.simps tcopy_F9.simps tcopy_def |
510 tstep.simps fetch.simps new_tape.simps exp_zero_simp |
615 tstep.simps fetch.simps new_tape.simps |
511 exp_zero_simp2 |
616 split: if_splits list.splits block.splits) |
512 split: if_splits list.splits block.splits) |
617 apply(rule_tac x = n in exI, auto) |
513 apply(case_tac "hd b", simp add:tcopy_F9.simps tcopy_F10.simps ) |
618 apply(case_tac b, simp+) |
514 apply(simp only: tcopy_F9_exit.simps tcopy_F10_loop.simps) |
|
515 apply(erule_tac exE)+ |
|
516 apply(rule_tac x = i in exI, rule_tac x = j in exI, simp) |
|
517 apply(rule_tac x = "j - 2" in exI, simp add: exp_ind_def) |
|
518 apply(case_tac j, simp, simp) |
|
519 apply(case_tac nat, simp_all add: exp_zero exp_ind_def) |
|
520 apply(case_tac x, simp_all add: exp_ind_def exp_zero) |
|
521 apply(simp add: tcopy_F9.simps tcopy_F10.simps) |
|
522 apply(rule_tac disjI2) |
|
523 apply(simp only: tcopy_F10_exit.simps tcopy_F9_exit.simps) |
|
524 apply(erule_tac exE)+ |
|
525 apply(simp) |
|
526 apply(case_tac j, simp_all, case_tac nat, simp_all add: exp_ind_def exp_zero) |
|
527 apply(case_tac x, simp_all add: exp_ind_def exp_zero) |
|
528 apply(rule_tac x = nata in exI, rule_tac x = 1 in exI, simp add: exp_ind_def exp_zero) |
|
529 done |
|
530 |
|
531 lemma false_case7: |
|
532 "\<lbrakk>i + (n + t) = x; 0 < i; 0 < t; Oc # list = Oc\<^bsup>t\<^esup>; k = Suc n; |
|
533 \<forall>j. i + j = Suc x \<longrightarrow> (\<forall>k. Oc\<^bsup>n\<^esup> @ Bk # Bk\<^bsup>n + t\<^esup> = Oc\<^bsup>k\<^esup> @ Bk\<^bsup>j\<^esup> \<longrightarrow> |
|
534 (\<forall>ta. k + ta = j \<longrightarrow> ta = 0 \<or> Oc # Oc\<^bsup>t\<^esup> \<noteq> Oc\<^bsup>ta\<^esup>))\<rbrakk> |
|
535 \<Longrightarrow> RR" |
|
536 apply(erule_tac x = "k + t" in allE, simp) |
|
537 apply(erule_tac x = n in allE, simp add: exp_ind_def) |
|
538 apply(erule_tac x = "Suc t" in allE, simp) |
|
539 done |
|
540 |
|
541 lemma false_case8: |
|
542 "\<lbrakk>i + t = Suc x; |
|
543 0 < i; |
|
544 0 < t; |
|
545 \<forall>ia j. tl (Bk\<^bsup>t\<^esup> @ Oc\<^bsup>i\<^esup>) = Bk\<^bsup>j - Suc 0\<^esup> @ Oc\<^bsup>ia\<^esup> \<longrightarrow> |
|
546 ia + j = Suc x \<longrightarrow> ia = 0 \<or> j = 0 \<or> Oc\<^bsup>t\<^esup> \<noteq> Oc\<^bsup>j\<^esup>\<rbrakk> \<Longrightarrow> |
|
547 RR" |
|
548 apply(erule_tac x = i in allE, simp) |
|
549 apply(erule_tac x = t in allE, simp) |
|
550 apply(case_tac t, simp_all add: exp_ind_def exp_zero) |
619 done |
551 done |
620 |
552 |
621 lemma [elim]: "\<lbrakk>tstep (9, b, c) tcopy = (9, ab, ba); |
553 lemma [elim]: "\<lbrakk>tstep (9, b, c) tcopy = (9, ab, ba); |
622 tcopy_F9 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F9 x (ab, ba)" |
554 tcopy_F9 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F9 x (ab, ba)" |
623 apply(case_tac x) |
555 apply(auto simp: tcopy_F9.simps tcopy_def |
624 apply(simp_all add: tcopy_F9.simps tcopy_def |
556 tstep.simps fetch.simps new_tape.simps exp_zero_simp exp_zero_simp2 |
625 tstep.simps fetch.simps new_tape.simps |
557 tcopy_F9_exit.simps tcopy_F9_loop.simps |
626 split: if_splits list.splits block.splits) |
558 split: if_splits list.splits block.splits) |
627 apply(rule_tac x = n in exI, auto) |
559 apply(case_tac [!] k, simp_all add: exp_ind_def exp_zero) |
628 apply(case_tac b, simp+) |
560 apply(erule_tac [!] x = i in allE, simp) |
629 apply(rule contrapos_pp, simp+) |
561 apply(erule_tac false_case7, simp_all)+ |
630 apply(drule less_equal, simp+) |
562 apply(case_tac t, simp_all add: exp_zero exp_ind_def) |
631 apply(drule rev_equal, auto) |
563 apply(erule_tac false_case7, simp_all)+ |
632 apply(case_tac "length list", simp+) |
564 apply(erule_tac false_case8, simp_all) |
633 done |
565 apply(erule_tac false_case7, simp_all)+ |
634 |
566 apply(case_tac t, simp_all add: exp_ind_def exp_zero) |
635 lemma app_cons_app_simp: "xs @ a # bs @ ys = (xs @ [a]) @ bs @ ys" |
567 apply(erule_tac false_case7, simp_all) |
636 apply(simp) |
568 apply(erule_tac false_case8, simp_all) |
637 done |
569 apply(erule_tac false_case7, simp_all) |
638 |
570 done |
|
571 |
639 lemma [elim]: "\<lbrakk>tstep (8, b, c) tcopy = (9, ab, ba); |
572 lemma [elim]: "\<lbrakk>tstep (8, b, c) tcopy = (9, ab, ba); |
640 tcopy_F8 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F9 x (ab, ba)" |
573 tcopy_F8 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F9 x (ab, ba)" |
641 apply(case_tac x) |
|
642 apply(auto simp:tcopy_F8.simps tcopy_F9.simps tcopy_def |
574 apply(auto simp:tcopy_F8.simps tcopy_F9.simps tcopy_def |
643 tstep.simps fetch.simps new_tape.simps |
575 tstep.simps fetch.simps new_tape.simps tcopy_F9_loop.simps |
|
576 tcopy_F9_exit.simps |
644 split: if_splits list.splits block.splits) |
577 split: if_splits list.splits block.splits) |
645 apply(rule_tac x = "Suc n" in exI, auto) |
578 apply(case_tac [!] t, simp_all add: exp_ind_def exp_zero) |
646 apply(rule_tac x = "n" in exI, auto) |
579 apply(rule_tac x = i in exI) |
647 apply(simp only: app_cons_app_simp) |
580 apply(rule_tac x = "Suc k" in exI, simp) |
648 apply(frule replicate_tail_length, simp) |
581 apply(rule_tac x = "k" in exI, simp add: exp_ind_def exp_zero) |
649 done |
582 done |
|
583 |
650 |
584 |
651 lemma [elim]: "\<lbrakk>tstep (8, b, c) tcopy = (8, ab, ba); |
585 lemma [elim]: "\<lbrakk>tstep (8, b, c) tcopy = (8, ab, ba); |
652 tcopy_F8 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F8 x (ab, ba)" |
586 tcopy_F8 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F8 x (ab, ba)" |
653 apply(case_tac x) |
587 apply(auto simp:tcopy_F8.simps tcopy_def tstep.simps |
654 apply(simp_all add:tcopy_F8.simps tcopy_def tstep.simps |
588 fetch.simps new_tape.simps exp_zero_simp exp_zero split: if_splits list.splits |
655 fetch.simps new_tape.simps) |
589 |
656 apply(simp split: if_splits list.splits block.splits) |
590 block.splits) |
657 apply(rule_tac x = "n" in exI, auto) |
591 apply(rule_tac x = i in exI, rule_tac x = "k + t" in exI, simp) |
658 done |
592 apply(rule_tac x = "Suc k" in exI, simp) |
659 |
593 apply(rule_tac x = "t - 1" in exI, simp) |
660 lemma ex_less_more: "\<lbrakk>(x::nat) >= m ; x <= n\<rbrakk> \<Longrightarrow> |
594 apply(case_tac t, simp_all add: exp_zero exp_ind_def) |
661 \<exists>y. x = m + y & y <= n - m" |
595 done |
662 by(rule_tac x = "x -m" in exI, auto) |
596 |
663 |
|
664 lemma replicate_split: "x <= n \<Longrightarrow> |
|
665 (\<exists>y. replicate n b = replicate (y + x) b)" |
|
666 apply(rule_tac x = "n - x" in exI) |
|
667 apply(simp) |
|
668 done |
|
669 |
|
670 lemma app_app_app_app_simp: "as @ bs @ cs @ ds = |
|
671 (as @ bs) @ (cs @ ds)" |
|
672 by simp |
|
673 |
|
674 lemma lengthtailsame_append_elim: |
|
675 "\<lbrakk>as @ bs = cs @ ds; length bs = length ds\<rbrakk> \<Longrightarrow> bs = ds" |
|
676 apply(simp) |
|
677 done |
|
678 |
|
679 lemma rep_suc: "replicate (Suc n) x = replicate n x @ [x]" |
|
680 by(induct n, auto) |
|
681 |
|
682 lemma length_append_diff_cons: |
|
683 "\<lbrakk>b @ x # ba = xs @ replicate m y @ replicate n x; x \<noteq> y; |
|
684 Suc (length ba) \<le> m + n\<rbrakk> |
|
685 \<Longrightarrow> length ba < n" |
|
686 apply(induct n arbitrary: ba, simp) |
|
687 apply(drule_tac b = y in replicate_split, |
|
688 simp add: replicate_add, erule exE, simp del: replicate.simps) |
|
689 proof - |
|
690 fix ba ya |
|
691 assume h1: |
|
692 "b @ x # ba = xs @ y # replicate ya y @ replicate (length ba) y" |
|
693 and h2: "x \<noteq> y" |
|
694 thus "False" |
|
695 using append_eq_append_conv[of "b @ [x]" |
|
696 "xs @ y # replicate ya y" "ba" "replicate (length ba) y"] |
|
697 apply(auto) |
|
698 apply(case_tac ya, simp, |
|
699 simp add: rep_suc del: rep_suc_rev replicate.simps) |
|
700 done |
|
701 next |
|
702 fix n ba |
|
703 assume ind: "\<And>ba. \<lbrakk>b @ x # ba = xs @ replicate m y @ replicate n x; |
|
704 x \<noteq> y; Suc (length ba) \<le> m + n\<rbrakk> |
|
705 \<Longrightarrow> length ba < n" |
|
706 and h1: "b @ x # ba = xs @ replicate m y @ replicate (Suc n) x" |
|
707 and h2: "x \<noteq> y" and h3: "Suc (length ba) \<le> m + Suc n" |
|
708 show "length ba < Suc n" |
|
709 proof(cases "length ba") |
|
710 case 0 thus "?thesis" by simp |
|
711 next |
|
712 fix nat |
|
713 assume "length ba = Suc nat" |
|
714 hence "\<exists> ys a. ba = ys @ [a]" |
|
715 apply(rule_tac x = "butlast ba" in exI) |
|
716 apply(rule_tac x = "last ba" in exI) |
|
717 using append_butlast_last_id[of ba] |
|
718 apply(case_tac ba, auto) |
|
719 done |
|
720 from this obtain ys where "\<exists> a. ba = ys @ [a]" .. |
|
721 from this obtain a where "ba = ys @ [a]" .. |
|
722 thus "?thesis" |
|
723 using ind[of ys] h1 h2 h3 |
|
724 apply(simp del: rep_suc_rev replicate.simps add: rep_suc) |
|
725 done |
|
726 qed |
|
727 qed |
|
728 |
|
729 lemma [elim]: |
|
730 "\<lbrakk>b @ Oc # ba = xs @ Bk # replicate n Bk @ replicate n Oc; |
|
731 Suc (length ba) \<le> 2 * n\<rbrakk> |
|
732 \<Longrightarrow> length ba < n" |
|
733 apply(rule_tac length_append_diff_cons[of b Oc ba xs "Suc n" Bk n]) |
|
734 apply(simp, simp, simp) |
|
735 done |
|
736 |
|
737 lemma [elim]: "\<lbrakk>tstep (7, b, c) tcopy = (8, ab, ba); |
|
738 tcopy_F7 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F8 x (ab, ba)" |
|
739 apply(case_tac x) |
|
740 apply(simp_all add:tcopy_F8.simps tcopy_F7.simps |
|
741 tcopy_def tstep.simps fetch.simps new_tape.simps) |
|
742 apply(simp split: if_splits list.splits block.splits) |
|
743 apply(rule_tac x = "n" in exI, auto) |
|
744 done |
|
745 |
597 |
746 lemma [elim]: "\<lbrakk>tstep (7, b, c) tcopy = (7, ab, ba); |
598 lemma [elim]: "\<lbrakk>tstep (7, b, c) tcopy = (7, ab, ba); |
747 tcopy_F7 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F7 x (ab, ba)" |
599 tcopy_F7 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F7 x (ab, ba)" |
748 apply(case_tac x) |
600 apply(auto simp:tcopy_F7.simps tcopy_def tstep.simps fetch.simps |
749 apply(auto simp:tcopy_F7.simps tcopy_def tstep.simps |
601 new_tape.simps exp_ind_def exp_zero_simp |
750 fetch.simps new_tape.simps |
602 split: if_splits list.splits block.splits) |
|
603 apply(rule_tac x = i in exI) |
|
604 apply(rule_tac x = j in exI, simp) |
|
605 apply(rule_tac x = "Suc k" in exI, simp) |
|
606 apply(rule_tac x = "t - 1" in exI) |
|
607 apply(case_tac t, simp_all add: exp_zero exp_ind_def) |
|
608 apply(case_tac j, simp_all add: exp_zero exp_ind_def) |
|
609 done |
|
610 |
|
611 lemma [elim]: "\<lbrakk>tstep (7, b, c) tcopy = (8, ab, ba); |
|
612 tcopy_F7 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F8 x (ab, ba)" |
|
613 apply(auto simp:tcopy_F7.simps tcopy_def tstep.simps tcopy_F8.simps |
|
614 fetch.simps new_tape.simps exp_zero_simp |
751 split: if_splits list.splits block.splits) |
615 split: if_splits list.splits block.splits) |
752 apply(rule_tac x = "n" in exI, auto) |
616 apply(rule_tac x = i in exI, simp) |
753 apply(simp only: app_cons_app_simp) |
617 apply(rule_tac x = "Suc 0" in exI, simp add: exp_ind_def exp_zero) |
754 apply(frule replicate_tail_length, simp) |
618 apply(rule_tac x = "j - 1" in exI, simp) |
755 done |
619 apply(case_tac t, simp_all add: exp_ind_def ) |
756 |
620 apply(case_tac j, simp_all add: exp_ind_def exp_zero) |
757 lemma Suc_more: "n <= m \<Longrightarrow> Suc m - n = Suc (m - n)" |
621 done |
758 by simp |
|
759 |
622 |
760 lemma [elim]: "\<lbrakk>tstep (6, b, c) tcopy = (7, ab, ba); |
623 lemma [elim]: "\<lbrakk>tstep (6, b, c) tcopy = (7, ab, ba); |
761 tcopy_F6 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F7 x (ab, ba)" |
624 tcopy_F6 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F7 x (ab, ba)" |
762 apply(case_tac x) |
625 apply(case_tac x) |
763 apply(auto simp:tcopy_F7.simps tcopy_F6.simps |
626 apply(auto simp:tcopy_F7.simps tcopy_F6.simps |
764 tcopy_def tstep.simps fetch.simps new_tape.simps |
627 tcopy_def tstep.simps fetch.simps new_tape.simps exp_zero_simp |
765 split: if_splits list.splits block.splits) |
628 split: if_splits list.splits block.splits) |
|
629 apply(case_tac i, simp_all add: exp_ind_def exp_zero) |
|
630 apply(rule_tac x = i in exI, simp) |
|
631 apply(rule_tac x = j in exI, simp) |
|
632 apply(rule_tac x = "Suc 0" in exI, simp add: exp_ind_def exp_zero) |
766 done |
633 done |
767 |
634 |
768 lemma [elim]: "\<lbrakk>tstep (6, b, c) tcopy = (6, ab, ba); |
635 lemma [elim]: "\<lbrakk>tstep (6, b, c) tcopy = (6, ab, ba); |
769 tcopy_F6 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F6 x (ab, ba)" |
636 tcopy_F6 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F6 x (ab, ba)" |
770 apply(case_tac x) |
|
771 apply(auto simp:tcopy_F6.simps tcopy_def tstep.simps |
637 apply(auto simp:tcopy_F6.simps tcopy_def tstep.simps |
772 new_tape.simps fetch.simps |
638 new_tape.simps fetch.simps |
773 split: if_splits list.splits block.splits) |
639 split: if_splits list.splits block.splits) |
774 done |
640 done |
775 |
641 |
776 lemma [elim]: "\<lbrakk>tstep (5, b, c) tcopy = (6, ab, ba); |
642 lemma [elim]: "\<lbrakk>tstep (5, b, c) tcopy = (6, ab, ba); |
777 tcopy_F5 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F6 x (ab, ba)" |
643 tcopy_F5 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F6 x (ab, ba)" |
778 apply(case_tac x) |
|
779 apply(auto simp:tcopy_F5.simps tcopy_F6.simps tcopy_def |
644 apply(auto simp:tcopy_F5.simps tcopy_F6.simps tcopy_def |
780 tstep.simps fetch.simps new_tape.simps |
645 tstep.simps fetch.simps new_tape.simps exp_zero_simp2 |
781 split: if_splits list.splits block.splits) |
646 split: if_splits list.splits block.splits) |
782 apply(rule_tac x = n in exI, simp) |
647 apply(rule_tac x = "Suc 0" in exI, simp add: exp_ind_def exp_zero) |
783 apply(rule_tac x = n in exI, simp) |
648 apply(rule_tac x = "Suc i" in exI, simp add: exp_ind_def) |
784 apply(drule Suc_more, simp) |
|
785 done |
|
786 |
|
787 lemma ex_less_more2: "\<lbrakk>(n::nat) < x ; x <= 2 * n\<rbrakk> \<Longrightarrow> |
|
788 \<exists>y. (x = n + y & y <= n)" |
|
789 apply(rule_tac x = "x - n" in exI) |
|
790 apply(auto) |
|
791 done |
|
792 |
|
793 lemma app_app_app_simp: "xs @ ys @ za = (xs @ ys) @ za" |
|
794 apply(simp) |
|
795 done |
|
796 |
|
797 lemma [elim]: "rev xs = replicate n b \<Longrightarrow> xs = replicate n b" |
|
798 using rev_replicate[of n b] |
|
799 thm rev_equal |
|
800 by(drule_tac rev_equal, simp) |
|
801 |
|
802 lemma app_cons_tail_same[dest]: |
|
803 "\<lbrakk>rev b @ Oc # list = |
|
804 replicate (Suc (Suc na) - n) Oc @ replicate n Bk @ replicate n Oc; |
|
805 Suc 0 < n; n \<le> Suc na; n < length list; length list \<le> 2 * n; b \<noteq> []\<rbrakk> |
|
806 \<Longrightarrow> list = replicate n Bk @ replicate n Oc |
|
807 & b = replicate (Suc na - n) Oc" |
|
808 using length_append_diff_cons[of "rev b" Oc list |
|
809 "replicate (Suc (Suc na) - n) Oc" n Bk n] |
|
810 apply(case_tac "length list = 2*n", simp) |
|
811 using append_eq_append_conv[of "rev b @ [Oc]" "replicate |
|
812 (Suc (Suc na) - n) Oc" "list" "replicate n Bk @ replicate n Oc"] |
|
813 apply(case_tac n, simp, simp add: Suc_more rep_suc |
|
814 del: rep_suc_rev replicate.simps, auto) |
|
815 done |
|
816 |
|
817 lemma hd_replicate_false1: "\<lbrakk>replicate x Oc \<noteq> []; |
|
818 hd (replicate x Oc) = Bk\<rbrakk> \<Longrightarrow> RR" |
|
819 apply(case_tac x, auto) |
|
820 done |
|
821 |
|
822 lemma hd_replicate_false2: "\<lbrakk>replicate x Oc \<noteq> []; |
|
823 hd (replicate x Oc) \<noteq> Oc\<rbrakk> \<Longrightarrow> RR" |
|
824 apply(case_tac x, auto) |
|
825 done |
|
826 |
|
827 lemma Suc_more_less: "\<lbrakk>n \<le> Suc m; n >= m\<rbrakk> \<Longrightarrow> n = m | n = Suc m" |
|
828 apply(auto) |
|
829 done |
|
830 |
|
831 lemma replicate_not_Nil: "replicate x a \<noteq> [] \<Longrightarrow> x > 0" |
|
832 apply(case_tac x, simp+) |
|
833 done |
649 done |
834 |
650 |
835 lemma [elim]: "\<lbrakk>tstep (10, b, c) tcopy = (5, ab, ba); |
651 lemma [elim]: "\<lbrakk>tstep (10, b, c) tcopy = (5, ab, ba); |
836 tcopy_F10 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F5 x (ab, ba)" |
652 tcopy_F10 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F5 x (ab, ba)" |
837 apply(case_tac x) |
|
838 apply(auto simp:tcopy_F5.simps tcopy_F10.simps tcopy_def |
653 apply(auto simp:tcopy_F5.simps tcopy_F10.simps tcopy_def |
839 tstep.simps fetch.simps new_tape.simps |
654 tstep.simps fetch.simps new_tape.simps exp_zero_simp exp_zero_simp2 |
840 split: if_splits list.splits block.splits) |
655 exp_ind_def tcopy_F10.simps tcopy_F10_loop.simps tcopy_F10_exit.simps |
841 apply(frule app_cons_tail_same, simp+) |
656 split: if_splits list.splits block.splits ) |
842 apply(rule_tac x = n in exI, auto) |
657 apply(erule_tac [!] x = "i - 1" in allE) |
|
658 apply(erule_tac [!] x = j in allE, simp_all) |
|
659 apply(case_tac [!] i, simp_all add: exp_ind_def) |
843 done |
660 done |
844 |
661 |
845 lemma [elim]: "\<lbrakk>tstep (4, b, c) tcopy = (5, ab, ba); |
662 lemma [elim]: "\<lbrakk>tstep (4, b, c) tcopy = (5, ab, ba); |
846 tcopy_F4 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F5 x (ab, ba)" |
663 tcopy_F4 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F5 x (ab, ba)" |
847 apply(case_tac x) |
|
848 apply(auto simp:tcopy_F5.simps tcopy_F4.simps tcopy_def |
664 apply(auto simp:tcopy_F5.simps tcopy_F4.simps tcopy_def |
849 tstep.simps fetch.simps new_tape.simps |
665 tstep.simps fetch.simps new_tape.simps exp_zero_simp exp_zero_simp2 |
850 split: if_splits list.splits block.splits) |
666 split: if_splits list.splits block.splits) |
|
667 apply(case_tac x, simp, simp add: exp_ind_def exp_zero) |
|
668 apply(erule_tac [!] x = "x - 2" in allE) |
|
669 apply(erule_tac [!] x = "Suc 0" in allE) |
|
670 apply(case_tac [!] x, simp_all add: exp_ind_def exp_zero) |
|
671 apply(case_tac [!] nat, simp_all add: exp_ind_def exp_zero) |
851 done |
672 done |
852 |
673 |
853 lemma [elim]: "\<lbrakk>tstep (3, b, c) tcopy = (4, ab, ba); |
674 lemma [elim]: "\<lbrakk>tstep (3, b, c) tcopy = (4, ab, ba); |
854 tcopy_F3 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F4 x (ab, ba)" |
675 tcopy_F3 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F4 x (ab, ba)" |
855 apply(case_tac x) |
|
856 apply(auto simp:tcopy_F3.simps tcopy_F4.simps |
676 apply(auto simp:tcopy_F3.simps tcopy_F4.simps |
857 tcopy_def tstep.simps fetch.simps new_tape.simps |
677 tcopy_def tstep.simps fetch.simps new_tape.simps |
858 split: if_splits list.splits block.splits) |
678 split: if_splits list.splits block.splits) |
859 done |
679 done |
860 |
680 |
861 lemma [elim]: "\<lbrakk>tstep (4, b, c) tcopy = (4, ab, ba); |
681 lemma [elim]: "\<lbrakk>tstep (4, b, c) tcopy = (4, ab, ba); |
862 tcopy_F4 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F4 x (ab, ba)" |
682 tcopy_F4 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F4 x (ab, ba)" |
863 apply(case_tac x) |
683 apply(case_tac x) |
864 apply(auto simp:tcopy_F3.simps tcopy_F4.simps |
684 apply(auto simp:tcopy_F3.simps tcopy_F4.simps |
865 tcopy_def tstep.simps fetch.simps new_tape.simps |
685 tcopy_def tstep.simps fetch.simps new_tape.simps exp_zero_simp exp_zero_simp2 exp_ind_def |
866 split: if_splits list.splits block.splits) |
686 split: if_splits list.splits block.splits) |
867 done |
687 done |
868 |
688 |
869 lemma [elim]: "\<lbrakk>tstep (3, b, c) tcopy = (3, ab, ba); |
689 lemma [elim]: "\<lbrakk>tstep (3, b, c) tcopy = (3, ab, ba); |
870 tcopy_F3 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F3 x (ab, ba)" |
690 tcopy_F3 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F3 x (ab, ba)" |
871 apply(case_tac x) |
|
872 apply(auto simp:tcopy_F3.simps tcopy_F4.simps |
691 apply(auto simp:tcopy_F3.simps tcopy_F4.simps |
873 tcopy_def tstep.simps fetch.simps new_tape.simps |
692 tcopy_def tstep.simps fetch.simps new_tape.simps |
874 split: if_splits list.splits block.splits) |
693 split: if_splits list.splits block.splits) |
875 done |
|
876 |
|
877 lemma replicate_cons_back: "y # replicate x y = replicate (Suc x) y" |
|
878 apply(simp) |
|
879 done |
|
880 |
|
881 lemma replicate_cons_same: "bs @ (b # cs) = y # replicate x y \<Longrightarrow> |
|
882 (\<exists>n. bs = replicate n y) & (b = y) & (\<exists>m. cs = replicate m y)" |
|
883 apply(simp only: replicate_cons_back) |
|
884 apply(drule_tac replicate_same) |
|
885 apply(simp) |
|
886 done |
694 done |
887 |
695 |
888 lemma [elim]: "\<lbrakk>tstep (2, b, c) tcopy = (3, ab, ba); |
696 lemma [elim]: "\<lbrakk>tstep (2, b, c) tcopy = (3, ab, ba); |
889 tcopy_F2 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F3 x (ab, ba)" |
697 tcopy_F2 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F3 x (ab, ba)" |
890 apply(case_tac x) |
698 apply(case_tac x) |
891 apply(auto simp:tcopy_F3.simps tcopy_F2.simps |
699 apply(auto simp:tcopy_F3.simps tcopy_F2.simps |
892 tcopy_def tstep.simps fetch.simps new_tape.simps |
700 tcopy_def tstep.simps fetch.simps new_tape.simps |
|
701 exp_zero_simp exp_zero_simp2 exp_zero |
893 split: if_splits list.splits block.splits) |
702 split: if_splits list.splits block.splits) |
894 apply(drule replicate_cons_same, auto)+ |
703 apply(case_tac [!] j, simp_all add: exp_zero exp_ind_def) |
895 done |
704 done |
896 |
705 |
897 lemma [elim]: "\<lbrakk>tstep (2, b, c) tcopy = (2, ab, ba); |
706 lemma [elim]: "\<lbrakk>tstep (2, b, c) tcopy = (2, ab, ba); |
898 tcopy_F2 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F2 x (ab, ba)" |
707 tcopy_F2 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F2 x (ab, ba)" |
899 apply(case_tac x) |
|
900 apply(auto simp:tcopy_F3.simps tcopy_F2.simps |
708 apply(auto simp:tcopy_F3.simps tcopy_F2.simps |
901 tcopy_def tstep.simps fetch.simps new_tape.simps |
709 tcopy_def tstep.simps fetch.simps new_tape.simps |
|
710 exp_zero_simp exp_zero_simp2 exp_zero |
902 split: if_splits list.splits block.splits) |
711 split: if_splits list.splits block.splits) |
903 apply(frule replicate_cons_same, auto) |
712 apply(rule_tac x = "Suc i" in exI, simp add: exp_ind_def exp_zero) |
904 apply(simp add: replicate_app_Cons_same) |
713 apply(rule_tac x = "j - 1" in exI, simp) |
|
714 apply(case_tac j, simp_all add: exp_ind_def exp_zero) |
905 done |
715 done |
906 |
716 |
907 lemma [elim]: "\<lbrakk>tstep (Suc 0, b, c) tcopy = (2, ab, ba); |
717 lemma [elim]: "\<lbrakk>tstep (Suc 0, b, c) tcopy = (2, ab, ba); |
908 tcopy_F1 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F2 x (ab, ba)" |
718 tcopy_F1 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F2 x (ab, ba)" |
909 apply(case_tac x) |
719 apply(auto simp:tcopy_F1.simps tcopy_F2.simps |
910 apply(simp_all add:tcopy_F2.simps tcopy_F1.simps |
720 tcopy_def tstep.simps fetch.simps new_tape.simps |
911 tcopy_def tstep.simps fetch.simps new_tape.simps) |
721 exp_zero_simp exp_zero_simp2 exp_zero |
912 apply(auto) |
722 split: if_splits list.splits block.splits) |
|
723 apply(rule_tac x = "Suc 0" in exI, simp) |
|
724 apply(rule_tac x = "x - 1" in exI, simp) |
|
725 apply(case_tac x, simp_all add: exp_ind_def exp_zero) |
913 done |
726 done |
914 |
727 |
915 lemma [elim]: "\<lbrakk>tstep (Suc 0, b, c) tcopy = (0, ab, ba); |
728 lemma [elim]: "\<lbrakk>tstep (Suc 0, b, c) tcopy = (0, ab, ba); |
916 tcopy_F1 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F0 x (ab, ba)" |
729 tcopy_F1 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F0 x (ab, ba)" |
917 apply(case_tac x) |
|
918 apply(simp_all add:tcopy_F0.simps tcopy_F1.simps |
730 apply(simp_all add:tcopy_F0.simps tcopy_F1.simps |
919 tcopy_def tstep.simps fetch.simps new_tape.simps) |
731 tcopy_def tstep.simps fetch.simps new_tape.simps |
920 done |
732 exp_zero_simp exp_zero_simp2 exp_zero |
921 |
733 split: if_splits list.splits block.splits ) |
922 lemma ex_less: "Suc x <= y \<Longrightarrow> \<exists>z. y = x + z & z > 0" |
734 apply(case_tac x, simp_all add: exp_ind_def exp_zero, auto) |
923 apply(rule_tac x = "y - x" in exI, auto) |
|
924 done |
|
925 |
|
926 lemma [elim]: "\<lbrakk>xs @ Bk # ba = |
|
927 Bk # Oc # replicate n Oc @ Bk # Oc # replicate n Oc; |
|
928 length xs \<le> Suc n; xs \<noteq> []\<rbrakk> \<Longrightarrow> RR" |
|
929 apply(case_tac xs, auto) |
|
930 apply(case_tac list, auto) |
|
931 apply(drule ex_less, auto) |
|
932 apply(simp add: replicate_add) |
|
933 apply(auto) |
|
934 apply(case_tac z, simp+) |
|
935 done |
735 done |
936 |
736 |
937 lemma [elim]: "\<lbrakk>tstep (15, b, c) tcopy = (0, ab, ba); |
737 lemma [elim]: "\<lbrakk>tstep (15, b, c) tcopy = (0, ab, ba); |
938 tcopy_F15 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F0 x (ab, ba)" |
738 tcopy_F15 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F0 x (ab, ba)" |
939 apply(case_tac x) |
|
940 apply(auto simp: tcopy_F15.simps tcopy_F0.simps |
739 apply(auto simp: tcopy_F15.simps tcopy_F0.simps |
941 tcopy_def tstep.simps new_tape.simps fetch.simps |
740 tcopy_def tstep.simps new_tape.simps fetch.simps |
942 split: if_splits list.splits block.splits) |
741 split: if_splits list.splits block.splits) |
943 done |
742 apply(rule_tac x = "Suc 0" in exI, simp add: exp_ind_def exp_zero) |
|
743 apply(case_tac [!] j, simp_all add: exp_ind_def exp_zero) |
|
744 done |
|
745 |
944 |
746 |
945 lemma [elim]: "\<lbrakk>tstep (0, b, c) tcopy = (0, ab, ba); |
747 lemma [elim]: "\<lbrakk>tstep (0, b, c) tcopy = (0, ab, ba); |
946 tcopy_F0 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F0 x (ab, ba)" |
748 tcopy_F0 x (b, c)\<rbrakk> \<Longrightarrow> tcopy_F0 x (ab, ba)" |
947 apply(case_tac x) |
749 apply(case_tac x) |
948 apply(simp_all add: tcopy_F0.simps tcopy_def |
750 apply(simp_all add: tcopy_F0.simps tcopy_def |