src/HOL/IMP/Comp_Rev.thy
changeset 45322 654cc47f6115
parent 45218 f115540543d8
child 45605 a89b4bc311a5
equal deleted inserted replaced
45321:b227989b6ee6 45322:654cc47f6115
    16 
    16 
    17 text {* The possible successor pc's of an instruction at position @{term n} *}
    17 text {* The possible successor pc's of an instruction at position @{term n} *}
    18 definition
    18 definition
    19   "isuccs i n \<equiv> case i of 
    19   "isuccs i n \<equiv> case i of 
    20      JMP j \<Rightarrow> {n + 1 + j}
    20      JMP j \<Rightarrow> {n + 1 + j}
    21    | JMPFLESS j \<Rightarrow> {n + 1 + j, n + 1}
    21    | JMPLESS j \<Rightarrow> {n + 1 + j, n + 1}
    22    | JMPFGE j \<Rightarrow> {n + 1 + j, n + 1}
    22    | JMPGE j \<Rightarrow> {n + 1 + j, n + 1}
    23    | _ \<Rightarrow> {n +1}"
    23    | _ \<Rightarrow> {n +1}"
    24 
    24 
    25 text {* The possible successors pc's of an instruction list *}
    25 text {* The possible successors pc's of an instruction list *}
    26 definition
    26 definition
    27   "succs P n = {s. \<exists>i. 0 \<le> i \<and> i < isize P \<and> s \<in> isuccs (P!!i) (n+i)}" 
    27   "succs P n = {s. \<exists>i. 0 \<le> i \<and> i < isize P \<and> s \<in> isuccs (P!!i) (n+i)}" 
    86   "succs [ADD] n = {n + 1}"
    86   "succs [ADD] n = {n + 1}"
    87   "succs [LOADI v] n = {n + 1}"
    87   "succs [LOADI v] n = {n + 1}"
    88   "succs [LOAD x] n = {n + 1}"
    88   "succs [LOAD x] n = {n + 1}"
    89   "succs [STORE x] n = {n + 1}"
    89   "succs [STORE x] n = {n + 1}"
    90   "succs [JMP i] n = {n + 1 + i}"
    90   "succs [JMP i] n = {n + 1 + i}"
    91   "succs [JMPFGE i] n = {n + 1 + i, n + 1}"
    91   "succs [JMPGE i] n = {n + 1 + i, n + 1}"
    92   "succs [JMPFLESS i] n = {n + 1 + i, n + 1}"
    92   "succs [JMPLESS i] n = {n + 1 + i, n + 1}"
    93   by (auto simp: succs_def isuccs_def)
    93   by (auto simp: succs_def isuccs_def)
    94 
    94 
    95 lemma succs_empty [iff]: "succs [] n = {}"
    95 lemma succs_empty [iff]: "succs [] n = {}"
    96   by (simp add: succs_def)
    96   by (simp add: succs_def)
    97 
    97 
   174   "exits [ADD] = {1}"
   174   "exits [ADD] = {1}"
   175   "exits [LOADI v] = {1}"
   175   "exits [LOADI v] = {1}"
   176   "exits [LOAD x] = {1}"
   176   "exits [LOAD x] = {1}"
   177   "exits [STORE x] = {1}"
   177   "exits [STORE x] = {1}"
   178   "i \<noteq> -1 \<Longrightarrow> exits [JMP i] = {1 + i}"
   178   "i \<noteq> -1 \<Longrightarrow> exits [JMP i] = {1 + i}"
   179   "i \<noteq> -1 \<Longrightarrow> exits [JMPFGE i] = {1 + i, 1}"
   179   "i \<noteq> -1 \<Longrightarrow> exits [JMPGE i] = {1 + i, 1}"
   180   "i \<noteq> -1 \<Longrightarrow> exits [JMPFLESS i] = {1 + i, 1}"
   180   "i \<noteq> -1 \<Longrightarrow> exits [JMPLESS i] = {1 + i, 1}"
   181   by (auto simp: exits_def)
   181   by (auto simp: exits_def)
   182 
   182 
   183 lemma acomp_succs [simp]:
   183 lemma acomp_succs [simp]:
   184   "succs (acomp a) n = {n + 1 .. n + isize (acomp a)}"
   184   "succs (acomp a) n = {n + 1 .. n + isize (acomp a)}"
   185   by (induct a arbitrary: n) auto
   185   by (induct a arbitrary: n) auto