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