diff -r 5974111de158 -r f1ecb4a68a54 thys/Turing.thy --- a/thys/Turing.thy Thu Feb 21 05:33:57 2013 +0000 +++ b/thys/Turing.thy Thu Feb 21 05:34:39 2013 +0000 @@ -205,16 +205,19 @@ "shift p n = (map (\ (a, s). (a, (if s = 0 then 0 else s + n))) p)" fun - adjust :: "instr list \ instr list" + adjust :: "instr list \ nat \ instr list" where - "adjust p = map (\ (a, s). (a, if s = 0 then (Suc (length p div 2)) else s)) p" + "adjust p e = map (\ (a, s). (a, if s = 0 then e else s)) p" + +abbreviation + "adjust0 p \ adjust p (Suc (length p div 2))" lemma length_shift [simp]: shows "length (shift p n) = length p" by simp lemma length_adjust [simp]: - shows "length (adjust p) = length p" + shows "length (adjust p n) = length p" by (induct p) (auto) @@ -222,7 +225,7 @@ fun tm_comp :: "instr list \ instr list \ instr list" ("_ |+| _" [0, 0] 100) where - "tm_comp p1 p2 = ((adjust p1) @ (shift p2 (length p1 div 2)))" + "tm_comp p1 p2 = ((adjust0 p1) @ (shift p2 (length p1 div 2)))" lemma tm_comp_length: shows "length (A |+| B) = length A + length B"