author | Jian Xu |
Fri, 15 Feb 2013 23:02:20 +0800 | |
changeset 175 | bc6b6845d57c |
parent 173 | b51cb9aef3ae |
child 288 | a9003e6d0463 |
permissions | -rw-r--r-- |
173
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
(* Title: thys/Abacus_Mopup.thy |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
Author: Jian Xu, Xingyuan Zhang, and Christian Urban |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
*) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
header {* Mopup Turing Machine that deletes all "registers", except one *} |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
theory Abacus_Mopup |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
imports Uncomputable |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
begin |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
fun mopup_a :: "nat \<Rightarrow> instr list" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
"mopup_a 0 = []" | |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
"mopup_a (Suc n) = mopup_a n @ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
[(R, 2*n + 3), (W0, 2*n + 2), (R, 2*n + 1), (W1, 2*n + 2)]" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
definition mopup_b :: "instr list" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
"mopup_b \<equiv> [(R, 2), (R, 1), (L, 5), (W0, 3), (R, 4), (W0, 3), |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
(R, 2), (W0, 3), (L, 5), (L, 6), (R, 0), (L, 6)]" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
fun mopup :: "nat \<Rightarrow> instr list" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
24 |
"mopup n = mopup_a n @ shift mopup_b (2*n)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
26 |
type_synonym mopup_type = "config \<Rightarrow> nat list \<Rightarrow> nat \<Rightarrow> cell list \<Rightarrow> bool" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
27 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
28 |
fun mopup_stop :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
29 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
30 |
"mopup_stop (s, l, r) lm n ires= |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
31 |
(\<exists> ln rn. l = Bk\<up>ln @ Bk # Bk # ires \<and> r = <lm ! n> @ Bk\<up>rn)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
32 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
33 |
fun mopup_bef_erase_a :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
34 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
35 |
"mopup_bef_erase_a (s, l, r) lm n ires= |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
36 |
(\<exists> ln m rn. l = Bk\<up>ln @ Bk # Bk # ires \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
37 |
r = Oc\<up>m@ Bk # <(drop ((s + 1) div 2) lm)> @ Bk\<up>rn)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
38 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
39 |
fun mopup_bef_erase_b :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
40 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
41 |
"mopup_bef_erase_b (s, l, r) lm n ires = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
42 |
(\<exists> ln m rn. l = Bk\<up>ln @ Bk # Bk # ires \<and> r = Bk # Oc\<up>m @ Bk # |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
43 |
<(drop (s div 2) lm)> @ Bk\<up>rn)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
44 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
45 |
fun mopup_jump_over1 :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
46 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
47 |
"mopup_jump_over1 (s, l, r) lm n ires = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
48 |
(\<exists> ln m1 m2 rn. m1 + m2 = Suc (lm ! n) \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
49 |
l = Oc\<up>m1 @ Bk\<up>ln @ Bk # Bk # ires \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
50 |
(r = Oc\<up>m2 @ Bk # <(drop (Suc n) lm)> @ Bk\<up>rn \<or> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
51 |
(r = Oc\<up>m2 \<and> (drop (Suc n) lm) = [])))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
52 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
53 |
fun mopup_aft_erase_a :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
54 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
55 |
"mopup_aft_erase_a (s, l, r) lm n ires = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
56 |
(\<exists> lnl lnr rn (ml::nat list) m. |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
57 |
m = Suc (lm ! n) \<and> l = Bk\<up>lnr @ Oc\<up>m @ Bk\<up>lnl @ Bk # Bk # ires \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
58 |
(r = <ml> @ Bk\<up>rn))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
59 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
60 |
fun mopup_aft_erase_b :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
61 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
62 |
"mopup_aft_erase_b (s, l, r) lm n ires= |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
63 |
(\<exists> lnl lnr rn (ml::nat list) m. |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
64 |
m = Suc (lm ! n) \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
65 |
l = Bk\<up>lnr @ Oc\<up>m @ Bk\<up>lnl @ Bk # Bk # ires \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
66 |
(r = Bk # <ml> @ Bk\<up>rn \<or> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
67 |
r = Bk # Bk # <ml> @ Bk\<up>rn))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
68 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
69 |
fun mopup_aft_erase_c :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
70 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
71 |
"mopup_aft_erase_c (s, l, r) lm n ires = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
72 |
(\<exists> lnl lnr rn (ml::nat list) m. |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
73 |
m = Suc (lm ! n) \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
74 |
l = Bk\<up>lnr @ Oc\<up>m @ Bk\<up>lnl @ Bk # Bk # ires \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
75 |
(r = <ml> @ Bk\<up>rn \<or> r = Bk # <ml> @ Bk\<up>rn))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
76 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
77 |
fun mopup_left_moving :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
78 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
"mopup_left_moving (s, l, r) lm n ires = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
80 |
(\<exists> lnl lnr rn m. |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
81 |
m = Suc (lm ! n) \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
82 |
((l = Bk\<up>lnr @ Oc\<up>m @ Bk\<up>lnl @ Bk # Bk # ires \<and> r = Bk\<up>rn) \<or> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
83 |
(l = Oc\<up>(m - 1) @ Bk\<up>lnl @ Bk # Bk # ires \<and> r = Oc # Bk\<up>rn)))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
84 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
85 |
fun mopup_jump_over2 :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
86 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
87 |
"mopup_jump_over2 (s, l, r) lm n ires = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
88 |
(\<exists> ln rn m1 m2. |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
89 |
m1 + m2 = Suc (lm ! n) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
\<and> r \<noteq> [] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
91 |
\<and> (hd r = Oc \<longrightarrow> (l = Oc\<up>m1 @ Bk\<up>ln @ Bk # Bk # ires \<and> r = Oc\<up>m2 @ Bk\<up>rn)) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
92 |
\<and> (hd r = Bk \<longrightarrow> (l = Bk\<up>ln @ Bk # ires \<and> r = Bk # Oc\<up>(m1+m2)@ Bk\<up>rn)))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
93 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
94 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
95 |
fun mopup_inv :: "mopup_type" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
96 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
97 |
"mopup_inv (s, l, r) lm n ires = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
98 |
(if s = 0 then mopup_stop (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
99 |
else if s \<le> 2*n then |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
100 |
if s mod 2 = 1 then mopup_bef_erase_a (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
101 |
else mopup_bef_erase_b (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
102 |
else if s = 2*n + 1 then |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
103 |
mopup_jump_over1 (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
104 |
else if s = 2*n + 2 then mopup_aft_erase_a (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
105 |
else if s = 2*n + 3 then mopup_aft_erase_b (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
106 |
else if s = 2*n + 4 then mopup_aft_erase_c (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
107 |
else if s = 2*n + 5 then mopup_left_moving (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
108 |
else if s = 2*n + 6 then mopup_jump_over2 (s, l, r) lm n ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
109 |
else False)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
110 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
111 |
lemma mopup_fetch_0[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
112 |
"(fetch (mopup_a n @ shift mopup_b (2 * n)) 0 b) = (Nop, 0)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
113 |
by(simp add: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
114 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
115 |
lemma mop_bef_length[simp]: "length (mopup_a n) = 4 * n" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
116 |
apply(induct n, simp_all add: mopup_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
117 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
118 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
119 |
lemma mopup_a_nth: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
120 |
"\<lbrakk>q < n; x < 4\<rbrakk> \<Longrightarrow> mopup_a n ! (4 * q + x) = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
121 |
mopup_a (Suc q) ! ((4 * q) + x)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
122 |
apply(induct n, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
123 |
apply(case_tac "q < n", simp add: mopup_a.simps, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
124 |
apply(simp add: nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
125 |
apply(subgoal_tac "q = n", simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
126 |
apply(arith) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
127 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
128 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
129 |
lemma fetch_bef_erase_a_o[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
130 |
"\<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
131 |
\<Longrightarrow> (fetch (mopup_a n @ shift mopup_b (2 * n)) s Oc) = (W0, s + 1)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
132 |
apply(subgoal_tac "\<exists> q. s = 2*q + 1", auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
133 |
apply(subgoal_tac "length (mopup_a n) = 4*n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
134 |
apply(auto simp: fetch.simps nth_of.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
135 |
apply(subgoal_tac "mopup_a n ! (4 * q + 1) = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
136 |
mopup_a (Suc q) ! ((4 * q) + 1)", |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
137 |
simp add: mopup_a.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
138 |
apply(rule mopup_a_nth, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
139 |
apply arith |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
140 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
141 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
142 |
lemma fetch_bef_erase_a_b[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
143 |
"\<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
144 |
\<Longrightarrow> (fetch (mopup_a n @ shift mopup_b (2 * n)) s Bk) = (R, s + 2)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
145 |
apply(subgoal_tac "\<exists> q. s = 2*q + 1", auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
146 |
apply(subgoal_tac "length (mopup_a n) = 4*n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
147 |
apply(auto simp: fetch.simps nth_of.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
148 |
apply(subgoal_tac "mopup_a n ! (4 * q + 0) = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
149 |
mopup_a (Suc q) ! ((4 * q + 0))", |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
150 |
simp add: mopup_a.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
151 |
apply(rule mopup_a_nth, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
152 |
apply arith |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
153 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
154 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
155 |
lemma fetch_bef_erase_b_b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
156 |
"\<lbrakk>n < length lm; 0 < s; s \<le> 2 * n; s mod 2 = 0\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
157 |
(fetch (mopup_a n @ shift mopup_b (2 * n)) s Bk) = (R, s - 1)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
158 |
apply(subgoal_tac "\<exists> q. s = 2 * q", auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
159 |
apply(case_tac qa, simp, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
160 |
apply(auto simp: fetch.simps nth_of.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
161 |
apply(subgoal_tac "mopup_a n ! (4 * nat + 2) = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
162 |
mopup_a (Suc nat) ! ((4 * nat) + 2)", |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
163 |
simp add: mopup_a.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
164 |
apply(rule mopup_a_nth, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
165 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
166 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
167 |
lemma fetch_jump_over1_o: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
168 |
"fetch (mopup_a n @ shift mopup_b (2 * n)) (Suc (2 * n)) Oc |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
169 |
= (R, Suc (2 * n))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
170 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
171 |
apply(auto simp: fetch.simps nth_of.simps mopup_b_def nth_append |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
172 |
shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
173 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
174 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
175 |
lemma fetch_jump_over1_b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
176 |
"fetch (mopup_a n @ shift mopup_b (2 * n)) (Suc (2 * n)) Bk |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
177 |
= (R, Suc (Suc (2 * n)))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
178 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
179 |
apply(auto simp: fetch.simps nth_of.simps mopup_b_def |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
180 |
nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
181 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
182 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
183 |
lemma fetch_aft_erase_a_o: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
184 |
"fetch (mopup_a n @ shift mopup_b (2 * n)) (Suc (Suc (2 * n))) Oc |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
185 |
= (W0, Suc (2 * n + 2))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
186 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
187 |
apply(auto simp: fetch.simps nth_of.simps mopup_b_def |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
188 |
nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
189 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
190 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
191 |
lemma fetch_aft_erase_a_b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
192 |
"fetch (mopup_a n @ shift mopup_b (2 * n)) (Suc (Suc (2 * n))) Bk |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
193 |
= (L, Suc (2 * n + 4))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
194 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
195 |
apply(auto simp: fetch.simps nth_of.simps mopup_b_def |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
196 |
nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
197 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
198 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
199 |
lemma fetch_aft_erase_b_b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
200 |
"fetch (mopup_a n @ shift mopup_b (2 * n)) (2*n + 3) Bk |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
201 |
= (R, Suc (2 * n + 3))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
202 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
203 |
apply(subgoal_tac "2*n + 3 = Suc (2*n + 2)", simp only: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
204 |
apply(auto simp: nth_of.simps mopup_b_def nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
205 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
206 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
207 |
lemma fetch_aft_erase_c_o: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
208 |
"fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 4) Oc |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
209 |
= (W0, Suc (2 * n + 2))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
210 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
211 |
apply(subgoal_tac "2*n + 4 = Suc (2*n + 3)", simp only: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
212 |
apply(auto simp: nth_of.simps mopup_b_def nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
213 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
214 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
215 |
lemma fetch_aft_erase_c_b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
216 |
"fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 4) Bk |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
217 |
= (R, Suc (2 * n + 1))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
218 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
219 |
apply(subgoal_tac "2*n + 4 = Suc (2*n + 3)", simp only: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
220 |
apply(auto simp: nth_of.simps mopup_b_def nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
221 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
222 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
223 |
lemma fetch_left_moving_o: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
224 |
"(fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 5) Oc) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
225 |
= (L, 2*n + 6)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
226 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
227 |
apply(subgoal_tac "2*n + 5 = Suc (2*n + 4)", simp only: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
228 |
apply(auto simp: nth_of.simps mopup_b_def nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
229 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
230 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
231 |
lemma fetch_left_moving_b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
232 |
"(fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 5) Bk) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
233 |
= (L, 2*n + 5)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
234 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
235 |
apply(subgoal_tac "2*n + 5 = Suc (2*n + 4)", simp only: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
236 |
apply(auto simp: nth_of.simps mopup_b_def nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
237 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
238 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
239 |
lemma fetch_jump_over2_b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
240 |
"(fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 6) Bk) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
241 |
= (R, 0)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
242 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
243 |
apply(subgoal_tac "2*n + 6 = Suc (2*n + 5)", simp only: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
244 |
apply(auto simp: nth_of.simps mopup_b_def nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
245 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
246 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
247 |
lemma fetch_jump_over2_o: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
248 |
"(fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 6) Oc) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
249 |
= (L, 2*n + 6)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
250 |
apply(subgoal_tac "length (mopup_a n) = 4 * n") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
251 |
apply(subgoal_tac "2*n + 6 = Suc (2*n + 5)", simp only: fetch.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
252 |
apply(auto simp: nth_of.simps mopup_b_def nth_append shift.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
253 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
254 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
255 |
lemmas mopupfetchs = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
256 |
fetch_bef_erase_a_o fetch_bef_erase_a_b fetch_bef_erase_b_b |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
257 |
fetch_jump_over1_o fetch_jump_over1_b fetch_aft_erase_a_o |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
258 |
fetch_aft_erase_a_b fetch_aft_erase_b_b fetch_aft_erase_c_o |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
259 |
fetch_aft_erase_c_b fetch_left_moving_o fetch_left_moving_b |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
260 |
fetch_jump_over2_b fetch_jump_over2_o |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
261 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
262 |
declare |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
263 |
mopup_jump_over2.simps[simp del] mopup_left_moving.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
264 |
mopup_aft_erase_c.simps[simp del] mopup_aft_erase_b.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
265 |
mopup_aft_erase_a.simps[simp del] mopup_jump_over1.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
266 |
mopup_bef_erase_a.simps[simp del] mopup_bef_erase_b.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
267 |
mopup_stop.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
268 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
269 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
270 |
"\<lbrakk>mopup_bef_erase_a (s, l, Oc # xs) lm n ires\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
271 |
mopup_bef_erase_b (Suc s, l, Bk # xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
272 |
apply(auto simp: mopup_bef_erase_a.simps mopup_bef_erase_b.simps ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
273 |
apply(rule_tac x = "m - 1" in exI, rule_tac x = rn in exI) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
274 |
apply(case_tac m, simp, simp add: replicate_Suc) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
275 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
276 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
277 |
lemma mopup_false1: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
278 |
"\<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0; \<not> Suc s \<le> 2 * n\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
279 |
\<Longrightarrow> RR" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
280 |
apply(arith) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
281 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
282 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
283 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
284 |
"\<lbrakk>n < length lm; 0 < s; s \<le> 2 * n; s mod 2 = Suc 0; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
285 |
mopup_bef_erase_a (s, l, Oc # xs) lm n ires; r = Oc # xs\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
286 |
\<Longrightarrow> (Suc s \<le> 2 * n \<longrightarrow> mopup_bef_erase_b (Suc s, l, Bk # xs) lm n ires) \<and> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
287 |
(\<not> Suc s \<le> 2 * n \<longrightarrow> mopup_jump_over1 (Suc s, l, Bk # xs) lm n ires) " |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
288 |
apply(auto elim: mopup_false1) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
289 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
290 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
291 |
lemma tape_of_nl_cons: "<m # lm> = (if lm = [] then Oc\<up>(Suc m) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
292 |
else Oc\<up>(Suc m) @ Bk # <lm>)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
293 |
apply(case_tac lm, simp_all add: tape_of_nl_abv tape_of_nat_abv split: if_splits) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
294 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
295 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
296 |
lemma drop_tape_of_cons: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
297 |
"\<lbrakk>Suc q < length lm; x = lm ! q\<rbrakk> \<Longrightarrow> <drop q lm> = Oc # Oc \<up> x @ Bk # <drop (Suc q) lm>" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
298 |
by (metis Suc_lessD append_Cons list.simps(2) nth_drop' replicate_Suc tape_of_nl_cons) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
299 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
300 |
lemma erase2jumpover1: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
301 |
"\<lbrakk>q < length list; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
302 |
\<forall>rn. <drop q list> \<noteq> Oc # Oc \<up> (list ! q) @ Bk # <drop (Suc q) list> @ Bk \<up> rn\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
303 |
\<Longrightarrow> <drop q list> = Oc # Oc \<up> (list ! q)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
304 |
apply(erule_tac x = 0 in allE, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
305 |
apply(case_tac "Suc q < length list") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
306 |
apply(erule_tac notE) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
307 |
apply(rule_tac drop_tape_of_cons, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
308 |
apply(subgoal_tac "length list = Suc q", auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
309 |
apply(subgoal_tac "drop q list = [list ! q]") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
310 |
apply(simp add: tape_of_nl_abv tape_of_nat_abv replicate_Suc) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
311 |
by (metis append_Nil2 append_eq_conv_conj drop_Suc_conv_tl lessI) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
312 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
313 |
lemma erase2jumpover2: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
314 |
"\<lbrakk>q < length list; \<forall>rn. <drop q list> @ Bk # Bk \<up> n \<noteq> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
315 |
Oc # Oc \<up> (list ! q) @ Bk # <drop (Suc q) list> @ Bk \<up> rn\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
316 |
\<Longrightarrow> RR" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
317 |
apply(case_tac "Suc q < length list") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
318 |
apply(erule_tac x = "Suc n" in allE, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
319 |
apply(erule_tac notE, simp add: replicate_Suc) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
320 |
apply(rule_tac drop_tape_of_cons, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
321 |
apply(subgoal_tac "length list = Suc q", auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
322 |
apply(erule_tac x = "n" in allE, simp add: tape_of_nl_abv) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
323 |
by (metis append_Nil2 append_eq_conv_conj drop_Suc_conv_tl lessI replicate_Suc tape_of_nl_abv tape_of_nl_cons) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
324 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
325 |
lemma mod_ex1: "(a mod 2 = Suc 0) = (\<exists> q. a = Suc (2 * q))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
326 |
by arith |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
327 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
328 |
declare replicate_Suc[simp] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
329 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
330 |
lemma mopup_bef_erase_a_2_jump_over[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
331 |
"\<lbrakk>n < length lm; 0 < s; s mod 2 = Suc 0; s \<le> 2 * n; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
332 |
mopup_bef_erase_a (s, l, Bk # xs) lm n ires; \<not> (Suc (Suc s) \<le> 2 * n)\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
333 |
\<Longrightarrow> mopup_jump_over1 (s', Bk # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
334 |
apply(auto simp: mopup_bef_erase_a.simps mopup_jump_over1.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
335 |
apply(case_tac m, auto simp: mod_ex1) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
336 |
apply(subgoal_tac "n = Suc q", auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
337 |
apply(rule_tac x = "Suc ln" in exI, rule_tac x = 0 in exI, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
338 |
apply(case_tac [!] lm, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
339 |
apply(case_tac [!] rn, auto elim: erase2jumpover1 erase2jumpover2) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
340 |
apply(erule_tac x = 0 in allE, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
341 |
apply(rule_tac classical, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
342 |
apply(erule_tac notE) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
343 |
apply(rule_tac drop_tape_of_cons, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
344 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
345 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
346 |
lemma Suc_Suc_div: "\<lbrakk>0 < s; s mod 2 = Suc 0; Suc (Suc s) \<le> 2 * n\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
347 |
\<Longrightarrow> (Suc (Suc (s div 2))) \<le> n" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
348 |
apply(arith) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
349 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
350 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
351 |
lemma mopup_bef_erase_a_2_a[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
352 |
"\<lbrakk>n < length lm; 0 < s; s mod 2 = Suc 0; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
353 |
mopup_bef_erase_a (s, l, Bk # xs) lm n ires; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
354 |
Suc (Suc s) \<le> 2 * n\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
355 |
mopup_bef_erase_a (Suc (Suc s), Bk # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
356 |
apply(auto simp: mopup_bef_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
357 |
apply(subgoal_tac "drop (Suc (Suc (s div 2))) lm \<noteq> []") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
358 |
apply(case_tac m, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
359 |
apply(rule_tac x = "Suc ln" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
360 |
apply arith |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
361 |
apply(case_tac m, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
362 |
apply(rule_tac x = "Suc (lm ! (Suc s div 2))" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
363 |
apply(rule_tac x = rn in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
364 |
apply(rule_tac drop_tape_of_cons, simp, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
365 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
366 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
367 |
lemma mopup_false2: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
368 |
"\<lbrakk>0 < s; s \<le> 2 * n; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
369 |
s mod 2 = Suc 0; Suc s \<noteq> 2 * n; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
370 |
\<not> Suc (Suc s) \<le> 2 * n\<rbrakk> \<Longrightarrow> RR" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
371 |
apply(arith) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
372 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
373 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
374 |
lemma [simp]: "mopup_bef_erase_a (s, l, []) lm n ires \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
375 |
mopup_bef_erase_a (s, l, [Bk]) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
376 |
apply(auto simp: mopup_bef_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
377 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
378 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
379 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
380 |
"\<lbrakk>n < length lm; 0 < s; s \<le> 2 * n; s mod 2 = Suc 0; \<not> Suc (Suc s) \<le> 2 *n; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
381 |
mopup_bef_erase_a (s, l, []) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
382 |
\<Longrightarrow> mopup_jump_over1 (s', Bk # l, []) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
383 |
by auto |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
384 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
385 |
lemma "mopup_bef_erase_b (s, l, Oc # xs) lm n ires \<Longrightarrow> l \<noteq> []" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
386 |
apply(auto simp: mopup_bef_erase_b.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
387 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
388 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
389 |
lemma [simp]: "mopup_bef_erase_b (s, l, Oc # xs) lm n ires = False" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
390 |
apply(auto simp: mopup_bef_erase_b.simps ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
391 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
392 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
393 |
lemma [simp]: "\<lbrakk>0 < s; s \<le> 2 *n; s mod 2 \<noteq> Suc 0\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
394 |
(s - Suc 0) mod 2 = Suc 0" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
395 |
apply(arith) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
396 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
397 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
398 |
lemma [simp]: "\<lbrakk>0 < s; s \<le> 2 *n; s mod 2 \<noteq> Suc 0\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
399 |
s - Suc 0 \<le> 2 * n" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
400 |
apply(simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
401 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
402 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
403 |
lemma [simp]: "\<lbrakk>0 < s; s \<le> 2 *n; s mod 2 \<noteq> Suc 0\<rbrakk> \<Longrightarrow> \<not> s \<le> Suc 0" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
404 |
apply(arith) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
405 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
406 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
407 |
lemma [simp]: "\<lbrakk>n < length lm; 0 < s; s \<le> 2 * n; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
408 |
s mod 2 \<noteq> Suc 0; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
409 |
mopup_bef_erase_b (s, l, Bk # xs) lm n ires; r = Bk # xs\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
410 |
\<Longrightarrow> mopup_bef_erase_a (s - Suc 0, Bk # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
411 |
apply(auto simp: mopup_bef_erase_b.simps mopup_bef_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
412 |
apply(rule_tac x = "Suc ln" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
413 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
414 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
415 |
lemma [simp]: "\<lbrakk>mopup_bef_erase_b (s, l, []) lm n ires\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
416 |
mopup_bef_erase_a (s - Suc 0, Bk # l, []) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
417 |
apply(auto simp: mopup_bef_erase_b.simps mopup_bef_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
418 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
419 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
420 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
421 |
"\<lbrakk>n < length lm; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
422 |
mopup_jump_over1 (Suc (2 * n), l, Oc # xs) lm n ires; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
423 |
r = Oc # xs\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
424 |
\<Longrightarrow> mopup_jump_over1 (Suc (2 * n), Oc # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
425 |
apply(auto simp: mopup_jump_over1.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
426 |
apply(rule_tac x = ln in exI, rule_tac x = "Suc m1" in exI, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
427 |
rule_tac x = "m2 - 1" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
428 |
apply(case_tac "m2", simp, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
429 |
apply(rule_tac x = ln in exI, rule_tac x = "Suc m1" in exI, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
430 |
rule_tac x = "m2 - 1" in exI) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
431 |
apply(case_tac m2, simp, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
432 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
433 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
434 |
lemma mopup_jump_over1_2_aft_erase_a[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
435 |
"\<lbrakk>n < length lm; mopup_jump_over1 (Suc (2 * n), l, Bk # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
436 |
\<Longrightarrow> mopup_aft_erase_a (Suc (Suc (2 * n)), Bk # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
437 |
apply(simp only: mopup_jump_over1.simps mopup_aft_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
438 |
apply(erule_tac exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
439 |
apply(rule_tac x = ln in exI, rule_tac x = "Suc 0" in exI) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
440 |
apply(case_tac m2, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
441 |
apply(rule_tac x = rn in exI, rule_tac x = "drop (Suc n) lm" in exI, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
442 |
simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
443 |
apply(simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
444 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
445 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
446 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
447 |
"\<lbrakk>n < length lm; mopup_jump_over1 (Suc (2 * n), l, []) lm n ires\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
448 |
mopup_aft_erase_a (Suc (Suc (2 * n)), Bk # l, []) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
449 |
apply(rule mopup_jump_over1_2_aft_erase_a, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
450 |
apply(auto simp: mopup_jump_over1.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
451 |
apply(rule_tac x = ln in exI, rule_tac x = "Suc (lm ! n)" in exI, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
452 |
rule_tac x = 0 in exI, simp add: tape_of_nl_abv ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
453 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
454 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
455 |
lemma [simp]: "<[]> = []" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
456 |
apply(simp add: tape_of_nl_abv) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
457 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
458 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
459 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
460 |
"\<lbrakk>n < length lm; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
461 |
mopup_aft_erase_a (Suc (Suc (2 * n)), l, Oc # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
462 |
\<Longrightarrow> mopup_aft_erase_b (Suc (Suc (Suc (2 * n))), l, Bk # xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
463 |
apply(auto simp: mopup_aft_erase_a.simps mopup_aft_erase_b.simps ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
464 |
apply(case_tac ml) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
465 |
apply(simp_all add: tape_of_nl_cons split: if_splits) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
466 |
apply(case_tac rn, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
467 |
apply(case_tac a, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
468 |
apply(rule_tac x = rn in exI, rule_tac x = "[]" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
469 |
apply(rule_tac x = rn in exI, rule_tac x = "[nat]" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
470 |
apply(case_tac a, simp, simp add: tape_of_nl_abv tape_of_nat_abv) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
471 |
apply(case_tac a, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
472 |
apply(rule_tac x = rn in exI, rule_tac x = "list" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
473 |
apply(rule_tac x = rn in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
474 |
apply(rule_tac x = "nat # list" in exI, simp add: tape_of_nl_cons) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
475 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
476 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
477 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
478 |
"mopup_aft_erase_a (Suc (Suc (2 * n)), l, Bk # xs) lm n ires \<Longrightarrow> l \<noteq> []" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
479 |
apply(auto simp: mopup_aft_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
480 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
481 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
482 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
483 |
"\<lbrakk>n < length lm; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
484 |
mopup_aft_erase_a (Suc (Suc (2 * n)), l, Bk # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
485 |
\<Longrightarrow> mopup_left_moving (5 + 2 * n, tl l, hd l # Bk # xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
486 |
apply(simp only: mopup_aft_erase_a.simps mopup_left_moving.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
487 |
apply(erule exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
488 |
apply(case_tac lnr, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
489 |
apply(case_tac ml, auto simp: tape_of_nl_cons) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
490 |
apply(case_tac ml, auto simp: tape_of_nl_cons) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
491 |
apply(rule_tac x = "Suc rn" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
492 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
493 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
494 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
495 |
"mopup_aft_erase_a (Suc (Suc (2 * n)), l, []) lm n ires \<Longrightarrow> l \<noteq> []" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
496 |
apply(simp only: mopup_aft_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
497 |
apply(erule exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
498 |
apply(auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
499 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
500 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
501 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
502 |
"\<lbrakk>n < length lm; mopup_aft_erase_a (Suc (Suc (2 * n)), l, []) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
503 |
\<Longrightarrow> mopup_left_moving (5 + 2 * n, tl l, [hd l]) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
504 |
apply(simp only: mopup_aft_erase_a.simps mopup_left_moving.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
505 |
apply(erule exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
506 |
apply(subgoal_tac "ml = [] \<and> rn = 0", erule conjE, erule conjE, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
507 |
apply(case_tac lnr, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
508 |
apply(rule_tac x = lnl in exI, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
509 |
apply(rule_tac x = 1 in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
510 |
apply(case_tac ml, simp, simp add: tape_of_nl_cons split: if_splits) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
511 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
512 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
513 |
lemma [simp]: "mopup_aft_erase_b (2 * n + 3, l, Oc # xs) lm n ires = False" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
514 |
apply(auto simp: mopup_aft_erase_b.simps ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
515 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
516 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
517 |
lemma tape_of_ex1[intro]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
518 |
"\<exists>rna ml. Oc \<up> a @ Bk \<up> rn = <ml::nat list> @ Bk \<up> rna \<or> Oc \<up> a @ Bk \<up> rn = Bk # <ml> @ Bk \<up> rna" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
519 |
apply(case_tac a, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
520 |
apply(rule_tac x = rn in exI, rule_tac x = "[]" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
521 |
apply(rule_tac x = rn in exI, rule_tac x = "[nat]" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
522 |
apply(simp add: tape_of_nl_abv tape_of_nat_abv) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
523 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
524 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
525 |
lemma [intro]: "\<exists>rna ml. Oc \<up> a @ Bk # <list::nat list> @ Bk \<up> rn = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
526 |
<ml> @ Bk \<up> rna \<or> Oc \<up> a @ Bk # <list> @ Bk \<up> rn = Bk # <ml::nat list> @ Bk \<up> rna" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
527 |
apply(case_tac "list = []", simp add: replicate_Suc[THEN sym] del: replicate_Suc) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
528 |
apply(rule_tac rn = "Suc rn" in tape_of_ex1) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
529 |
apply(case_tac a, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
530 |
apply(rule_tac x = rn in exI, rule_tac x = list in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
531 |
apply(rule_tac x = rn in exI, rule_tac x = "nat # list" in exI) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
532 |
apply(simp add: tape_of_nl_cons) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
533 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
534 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
535 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
536 |
"\<lbrakk>n < length lm; |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
537 |
mopup_aft_erase_c (2 * n + 4, l, Oc # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
538 |
\<Longrightarrow> mopup_aft_erase_b (Suc (Suc (Suc (2 * n))), l, Bk # xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
539 |
apply(auto simp: mopup_aft_erase_c.simps mopup_aft_erase_b.simps ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
540 |
apply(case_tac ml, simp_all add: tape_of_nl_cons split: if_splits, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
541 |
apply(case_tac rn, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
542 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
543 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
544 |
lemma mopup_aft_erase_c_aft_erase_a[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
545 |
"\<lbrakk>n < length lm; mopup_aft_erase_c (2 * n + 4, l, Bk # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
546 |
\<Longrightarrow> mopup_aft_erase_a (Suc (Suc (2 * n)), Bk # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
547 |
apply(simp only: mopup_aft_erase_c.simps mopup_aft_erase_a.simps ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
548 |
apply(erule_tac exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
549 |
apply(erule conjE, erule conjE, erule disjE) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
550 |
apply(subgoal_tac "ml = []", simp, case_tac rn, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
551 |
simp, simp, rule conjI) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
552 |
apply(rule_tac x = lnl in exI, rule_tac x = "Suc lnr" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
553 |
apply(rule_tac x = nat in exI, rule_tac x = "[]" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
554 |
apply(case_tac ml, simp, simp add: tape_of_nl_cons split: if_splits) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
555 |
apply(rule_tac x = lnl in exI, rule_tac x = "Suc lnr" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
556 |
apply(rule_tac x = rn in exI, rule_tac x = "ml" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
557 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
558 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
559 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
560 |
"\<lbrakk>n < length lm; mopup_aft_erase_c (2 * n + 4, l, []) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
561 |
\<Longrightarrow> mopup_aft_erase_a (Suc (Suc (2 * n)), Bk # l, []) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
562 |
apply(rule mopup_aft_erase_c_aft_erase_a, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
563 |
apply(simp only: mopup_aft_erase_c.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
564 |
apply(erule exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
565 |
apply(rule_tac x = lnl in exI, rule_tac x = lnr in exI, simp add: ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
566 |
apply(rule_tac x = 0 in exI, rule_tac x = "[]" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
567 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
568 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
569 |
lemma mopup_aft_erase_b_2_aft_erase_c[simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
570 |
"\<lbrakk>n < length lm; mopup_aft_erase_b (2 * n + 3, l, Bk # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
571 |
\<Longrightarrow> mopup_aft_erase_c (4 + 2 * n, Bk # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
572 |
apply(auto simp: mopup_aft_erase_b.simps mopup_aft_erase_c.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
573 |
apply(rule_tac x = "lnl" in exI, rule_tac x = "Suc lnr" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
574 |
apply(rule_tac x = "lnl" in exI, rule_tac x = "Suc lnr" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
575 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
576 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
577 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
578 |
"\<lbrakk>n < length lm; mopup_aft_erase_b (2 * n + 3, l, []) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
579 |
\<Longrightarrow> mopup_aft_erase_c (4 + 2 * n, Bk # l, []) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
580 |
apply(rule_tac mopup_aft_erase_b_2_aft_erase_c, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
581 |
apply(simp add: mopup_aft_erase_b.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
582 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
583 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
584 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
585 |
"mopup_left_moving (2 * n + 5, l, Oc # xs) lm n ires \<Longrightarrow> l \<noteq> []" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
586 |
apply(auto simp: mopup_left_moving.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
587 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
588 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
589 |
lemma exp_ind: "a\<up>(Suc x) = a\<up>x @ [a]" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
590 |
apply(induct x, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
591 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
592 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
593 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
594 |
"\<lbrakk>n < length lm; mopup_left_moving (2 * n + 5, l, Oc # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
595 |
\<Longrightarrow> mopup_jump_over2 (2 * n + 6, tl l, hd l # Oc # xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
596 |
apply(simp only: mopup_left_moving.simps mopup_jump_over2.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
597 |
apply(erule_tac exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
598 |
apply(erule conjE, erule disjE, erule conjE) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
599 |
apply(case_tac rn, simp, simp add: ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
600 |
apply(case_tac "hd l", simp add: ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
601 |
apply(case_tac "lm ! n", simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
602 |
apply(rule_tac x = "lnl" in exI, rule_tac x = rn in exI, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
603 |
rule_tac x = "Suc 0" in exI, rule_tac x = 0 in exI) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
604 |
apply(case_tac lnl, simp,simp, simp add: exp_ind[THEN sym]) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
605 |
apply(case_tac "lm ! n", simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
606 |
apply(case_tac lnl, simp, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
607 |
apply(rule_tac x = lnl in exI, rule_tac x = rn in exI, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
608 |
apply(case_tac "lm ! n", simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
609 |
apply(case_tac lnl, simp_all add: numeral_2_eq_2) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
610 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
611 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
612 |
lemma [simp]: "mopup_left_moving (2 * n + 5, l, xs) lm n ires \<Longrightarrow> l \<noteq> []" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
613 |
apply(auto simp: mopup_left_moving.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
614 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
615 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
616 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
617 |
"\<lbrakk>n < length lm; mopup_left_moving (2 * n + 5, l, Bk # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
618 |
\<Longrightarrow> mopup_left_moving (2 * n + 5, tl l, hd l # Bk # xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
619 |
apply(simp only: mopup_left_moving.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
620 |
apply(erule exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
621 |
apply(case_tac lnr, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
622 |
apply(rule_tac x = "Suc rn" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
623 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
624 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
625 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
626 |
"\<lbrakk>n < length lm; mopup_left_moving (2 * n + 5, l, []) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
627 |
\<Longrightarrow> mopup_left_moving (2 * n + 5, tl l, [hd l]) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
628 |
apply(simp only: mopup_left_moving.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
629 |
apply(erule exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
630 |
apply(case_tac lnr, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
631 |
apply(rule_tac x = 1 in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
632 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
633 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
634 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
635 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
636 |
"mopup_jump_over2 (2 * n + 6, l, Oc # xs) lm n ires \<Longrightarrow> l \<noteq> []" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
637 |
apply(auto simp: mopup_jump_over2.simps ) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
638 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
639 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
640 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
641 |
"\<lbrakk>n < length lm; mopup_jump_over2 (2 * n + 6, l, Oc # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
642 |
\<Longrightarrow> mopup_jump_over2 (2 * n + 6, tl l, hd l # Oc # xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
643 |
apply(simp only: mopup_jump_over2.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
644 |
apply(erule_tac exE)+ |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
645 |
apply(simp add: , erule conjE, erule_tac conjE) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
646 |
apply(case_tac m1, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
647 |
apply(rule_tac x = ln in exI, rule_tac x = rn in exI, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
648 |
rule_tac x = 0 in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
649 |
apply(case_tac ln, simp, simp, simp only: exp_ind[THEN sym], simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
650 |
apply(rule_tac x = ln in exI, rule_tac x = rn in exI, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
651 |
rule_tac x = nat in exI, rule_tac x = "Suc m2" in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
652 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
653 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
654 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
655 |
"\<lbrakk>n < length lm; mopup_jump_over2 (2 * n + 6, l, Bk # xs) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
656 |
\<Longrightarrow> mopup_stop (0, Bk # l, xs) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
657 |
apply(auto simp: mopup_jump_over2.simps mopup_stop.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
658 |
apply(simp_all add: tape_of_nat_abv exp_ind[THEN sym]) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
659 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
660 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
661 |
lemma [simp]: "mopup_jump_over2 (2 * n + 6, l, []) lm n ires = False" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
662 |
apply(simp only: mopup_jump_over2.simps, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
663 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
664 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
665 |
declare fetch.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
666 |
lemma mod_ex2: "(a mod (2::nat) = 0) = (\<exists> q. a = 2 * q)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
667 |
by arith |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
668 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
669 |
lemma mod_2: "x mod 2 = 0 \<or> x mod 2 = Suc 0" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
670 |
by arith |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
671 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
672 |
lemma mopup_inv_step: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
673 |
"\<lbrakk>n < length lm; mopup_inv (s, l, r) lm n ires\<rbrakk> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
674 |
\<Longrightarrow> mopup_inv (step (s, l, r) (mopup_a n @ shift mopup_b (2 * n), 0)) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
675 |
apply(case_tac r, case_tac [2] a) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
676 |
apply(auto split:if_splits simp add:step.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
677 |
apply(simp_all add: mopupfetchs) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
678 |
apply(drule_tac mopup_false2, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
679 |
apply(drule_tac mopup_false2, simp_all) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
680 |
by (metis Suc_n_not_n mod2_Suc_Suc mod_ex1 mod_mult_self1_is_0) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
681 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
682 |
declare mopup_inv.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
683 |
lemma mopup_inv_steps: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
684 |
"\<lbrakk>n < length lm; mopup_inv (s, l, r) lm n ires\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
685 |
mopup_inv (steps (s, l, r) (mopup_a n @ shift mopup_b (2 * n), 0) stp) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
686 |
apply(induct_tac stp, simp add: steps.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
687 |
apply(simp add: step_red) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
688 |
apply(case_tac "steps (s, l, r) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
689 |
(mopup_a n @ shift mopup_b (2 * n), 0) na", simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
690 |
apply(rule_tac mopup_inv_step, simp, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
691 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
692 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
693 |
fun abc_mopup_stage1 :: "config \<Rightarrow> nat \<Rightarrow> nat" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
694 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
695 |
"abc_mopup_stage1 (s, l, r) n = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
696 |
(if s > 0 \<and> s \<le> 2*n then 6 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
697 |
else if s = 2*n + 1 then 4 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
698 |
else if s \<ge> 2*n + 2 \<and> s \<le> 2*n + 4 then 3 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
699 |
else if s = 2*n + 5 then 2 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
700 |
else if s = 2*n + 6 then 1 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
701 |
else 0)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
702 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
703 |
fun abc_mopup_stage2 :: "config \<Rightarrow> nat \<Rightarrow> nat" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
704 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
705 |
"abc_mopup_stage2 (s, l, r) n = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
706 |
(if s > 0 \<and> s \<le> 2*n then length r |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
707 |
else if s = 2*n + 1 then length r |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
708 |
else if s = 2*n + 5 then length l |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
709 |
else if s = 2*n + 6 then length l |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
710 |
else if s \<ge> 2*n + 2 \<and> s \<le> 2*n + 4 then length r |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
711 |
else 0)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
712 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
713 |
fun abc_mopup_stage3 :: "config \<Rightarrow> nat \<Rightarrow> nat" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
714 |
where |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
715 |
"abc_mopup_stage3 (s, l, r) n = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
716 |
(if s > 0 \<and> s \<le> 2*n then |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
717 |
if hd r = Bk then 0 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
718 |
else 1 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
719 |
else if s = 2*n + 2 then 1 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
720 |
else if s = 2*n + 3 then 0 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
721 |
else if s = 2*n + 4 then 2 |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
722 |
else 0)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
723 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
724 |
definition |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
725 |
"abc_mopup_measure = measures [\<lambda>(c, n). abc_mopup_stage1 c n, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
726 |
\<lambda>(c, n). abc_mopup_stage2 c n, |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
727 |
\<lambda>(c, n). abc_mopup_stage3 c n]" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
728 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
729 |
lemma wf_abc_mopup_measure: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
730 |
shows "wf abc_mopup_measure" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
731 |
unfolding abc_mopup_measure_def |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
732 |
by auto |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
733 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
734 |
lemma abc_mopup_measure_induct [case_names Step]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
735 |
"\<lbrakk>\<And>n. \<not> P (f n) \<Longrightarrow> (f (Suc n), (f n)) \<in> abc_mopup_measure\<rbrakk> \<Longrightarrow> \<exists>n. P (f n)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
736 |
using wf_abc_mopup_measure |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
737 |
by (metis wf_iff_no_infinite_down_chain) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
738 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
739 |
lemma [simp]: "mopup_bef_erase_a (a, aa, []) lm n ires = False" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
740 |
apply(auto simp: mopup_bef_erase_a.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
741 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
742 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
743 |
lemma [simp]: "mopup_bef_erase_b (a, aa, []) lm n ires = False" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
744 |
apply(auto simp: mopup_bef_erase_b.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
745 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
746 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
747 |
lemma [simp]: "mopup_aft_erase_b (2 * n + 3, aa, []) lm n ires = False" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
748 |
apply(auto simp: mopup_aft_erase_b.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
749 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
750 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
751 |
declare mopup_inv.simps[simp del] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
752 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
753 |
lemma [simp]: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
754 |
"\<lbrakk>0 < q; q \<le> n\<rbrakk> \<Longrightarrow> |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
755 |
(fetch (mopup_a n @ shift mopup_b (2 * n)) (2*q) Bk) = (R, 2*q - 1)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
756 |
apply(case_tac q, simp, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
757 |
apply(auto simp: fetch.simps nth_of.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
758 |
apply(subgoal_tac "mopup_a n ! (4 * nat + 2) = |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
759 |
mopup_a (Suc nat) ! ((4 * nat) + 2)", |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
760 |
simp add: mopup_a.simps nth_append) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
761 |
apply(rule mopup_a_nth, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
762 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
763 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
764 |
lemma [simp]: "(a mod 2 \<noteq> Suc 0) = (a mod 2 = 0) " |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
765 |
by arith |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
766 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
767 |
lemma mopup_halt: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
768 |
assumes |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
769 |
less: "n < length lm" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
770 |
and inv: "mopup_inv (Suc 0, l, r) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
771 |
and f: "f = (\<lambda> stp. (steps (Suc 0, l, r) (mopup_a n @ shift mopup_b (2 * n), 0) stp, n))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
772 |
and P: "P = (\<lambda> (c, n). is_final c)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
773 |
shows "\<exists> stp. P (f stp)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
774 |
proof (induct rule: abc_mopup_measure_induct) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
775 |
case (Step na) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
776 |
have h: "\<not> P (f na)" by fact |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
777 |
show "(f (Suc na), f na) \<in> abc_mopup_measure" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
778 |
proof(simp add: f) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
779 |
obtain a b c where g:"steps (Suc 0, l, r) (mopup_a n @ shift mopup_b (2 * n), 0) na = (a, b, c)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
780 |
apply(case_tac "steps (Suc 0, l, r) (mopup_a n @ shift mopup_b (2 * n), 0) na", auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
781 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
782 |
then have "mopup_inv (a, b, c) lm n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
783 |
using inv less mopup_inv_steps[of n lm "Suc 0" l r ires na] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
784 |
apply(simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
785 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
786 |
moreover have "a > 0" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
787 |
using h g |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
788 |
apply(simp add: f P) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
789 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
790 |
ultimately |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
791 |
have "((step (a, b, c) (mopup_a n @ shift mopup_b (2 * n), 0), n), (a, b, c), n) \<in> abc_mopup_measure" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
792 |
apply(case_tac c, case_tac [2] aa) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
793 |
apply(auto split:if_splits simp add:step.simps mopup_inv.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
794 |
apply(simp_all add: mopupfetchs abc_mopup_measure_def) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
795 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
796 |
thus "((step (steps (Suc 0, l, r) (mopup_a n @ shift mopup_b (2 * n), 0) na) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
797 |
(mopup_a n @ shift mopup_b (2 * n), 0), n), |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
798 |
steps (Suc 0, l, r) (mopup_a n @ shift mopup_b (2 * n), 0) na, n) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
799 |
\<in> abc_mopup_measure" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
800 |
using g by simp |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
801 |
qed |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
802 |
qed |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
803 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
804 |
lemma mopup_inv_start: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
805 |
"n < length am \<Longrightarrow> mopup_inv (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) am n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
806 |
apply(auto simp: mopup_inv.simps mopup_bef_erase_a.simps mopup_jump_over1.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
807 |
apply(case_tac [!] am, auto split: if_splits simp: tape_of_nl_cons) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
808 |
apply(rule_tac x = "Suc a" in exI, rule_tac x = k in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
809 |
apply(case_tac [!] n, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
810 |
apply(case_tac k, auto) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
811 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
812 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
813 |
lemma mopup_correct: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
814 |
assumes less: "n < length (am::nat list)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
815 |
and rs: "am ! n = rs" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
816 |
shows "\<exists> stp i j. (steps (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) (mopup_a n @ shift mopup_b (2 * n), 0) stp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
817 |
= (0, Bk\<up>i @ Bk # Bk # ires, Oc # Oc\<up> rs @ Bk\<up>j)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
818 |
using less |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
819 |
proof - |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
820 |
have a: "mopup_inv (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) am n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
821 |
using less |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
822 |
apply(simp add: mopup_inv_start) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
823 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
824 |
then have "\<exists> stp. is_final (steps (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) (mopup_a n @ shift mopup_b (2 * n), 0) stp)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
825 |
using less mopup_halt[of n am "Bk # Bk # ires" "<am> @ Bk \<up> k" ires |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
826 |
"(\<lambda>stp. (steps (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) (mopup_a n @ shift mopup_b (2 * n), 0) stp, n))" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
827 |
"(\<lambda>(c, n). is_final c)"] |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
828 |
apply(simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
829 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
830 |
from this obtain stp where b: |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
831 |
"is_final (steps (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) (mopup_a n @ shift mopup_b (2 * n), 0) stp)" .. |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
832 |
from a b have |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
833 |
"mopup_inv (steps (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) (mopup_a n @ shift mopup_b (2 * n), 0) stp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
834 |
am n ires" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
835 |
apply(rule_tac mopup_inv_steps, simp_all add: less) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
836 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
837 |
from b and this show "?thesis" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
838 |
apply(rule_tac x = stp in exI, simp) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
839 |
apply(case_tac "steps (Suc 0, Bk # Bk # ires, <am> @ Bk \<up> k) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
840 |
(mopup_a n @ shift mopup_b (2 * n), 0) stp") |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
841 |
apply(simp add: mopup_inv.simps mopup_stop.simps rs) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
842 |
using rs |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
843 |
apply(simp add: tape_of_nat_abv) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
844 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
845 |
qed |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
846 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
847 |
lemma wf_mopup[intro]: "tm_wf (mopup n, 0)" |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
848 |
apply(induct n, simp add: mopup.simps shift.simps mopup_b_def tm_wf.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
849 |
apply(auto simp: mopup.simps shift.simps mopup_b_def tm_wf.simps) |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
850 |
done |
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
851 |
|
b51cb9aef3ae
split Mopup TM into a separate file
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
852 |
end |