equal
deleted
inserted
replaced
15 Therefore, we define notation for size and indexing for lists |
15 Therefore, we define notation for size and indexing for lists |
16 on @{typ int}: |
16 on @{typ int}: |
17 *} |
17 *} |
18 abbreviation "isize xs == int (length xs)" |
18 abbreviation "isize xs == int (length xs)" |
19 |
19 |
20 primrec |
20 fun inth :: "'a list \<Rightarrow> int \<Rightarrow> 'a" (infixl "!!" 100) where |
21 inth :: "'a list => int => 'a" (infixl "!!" 100) where |
21 "(x # xs) !! n = (if n = 0 then x else xs !! (n - 1))" |
22 inth_Cons: "(x # xs) !! n = (if n = 0 then x else xs !! (n - 1))" |
|
23 |
22 |
24 text {* |
23 text {* |
25 The only additional lemma we need is indexing over append: |
24 The only additional lemma we need is indexing over append: |
26 *} |
25 *} |
27 lemma inth_append [simp]: |
26 lemma inth_append [simp]: |
39 JMP int | |
38 JMP int | |
40 JMPLESS int | |
39 JMPLESS int | |
41 JMPGE int |
40 JMPGE int |
42 |
41 |
43 type_synonym stack = "val list" |
42 type_synonym stack = "val list" |
44 type_synonym config = "int\<times>state\<times>stack" |
43 type_synonym config = "int \<times> state \<times> stack" |
45 |
44 |
46 abbreviation "hd2 xs == hd(tl xs)" |
45 abbreviation "hd2 xs == hd(tl xs)" |
47 abbreviation "tl2 xs == tl(tl xs)" |
46 abbreviation "tl2 xs == tl(tl xs)" |
48 |
47 |
49 inductive iexec1 :: "instr \<Rightarrow> config \<Rightarrow> config \<Rightarrow> bool" |
48 inductive iexec1 :: "instr \<Rightarrow> config \<Rightarrow> config \<Rightarrow> bool" |