src/HOL/IMP/Small_Step.thy
changeset 54192 a5eec4263b3a
parent 53015 a1119cf551e8
child 55834 459b5561ba4e
equal deleted inserted replaced
54191:7fba375a7e7d 54192:a5eec4263b3a
     2 
     2 
     3 theory Small_Step imports Star Big_Step begin
     3 theory Small_Step imports Star Big_Step begin
     4 
     4 
     5 subsection "The transition relation"
     5 subsection "The transition relation"
     6 
     6 
     7 text_raw{*\snip{SmallStepDef}{0}{2}{% *}
       
     8 inductive
     7 inductive
     9   small_step :: "com * state \<Rightarrow> com * state \<Rightarrow> bool" (infix "\<rightarrow>" 55)
     8   small_step :: "com * state \<Rightarrow> com * state \<Rightarrow> bool" (infix "\<rightarrow>" 55)
    10 where
     9 where
    11 Assign:  "(x ::= a, s) \<rightarrow> (SKIP, s(x := aval a s))" |
    10 Assign:  "(x ::= a, s) \<rightarrow> (SKIP, s(x := aval a s))" |
    12 
    11 
    16 IfTrue:  "bval b s \<Longrightarrow> (IF b THEN c\<^sub>1 ELSE c\<^sub>2,s) \<rightarrow> (c\<^sub>1,s)" |
    15 IfTrue:  "bval b s \<Longrightarrow> (IF b THEN c\<^sub>1 ELSE c\<^sub>2,s) \<rightarrow> (c\<^sub>1,s)" |
    17 IfFalse: "\<not>bval b s \<Longrightarrow> (IF b THEN c\<^sub>1 ELSE c\<^sub>2,s) \<rightarrow> (c\<^sub>2,s)" |
    16 IfFalse: "\<not>bval b s \<Longrightarrow> (IF b THEN c\<^sub>1 ELSE c\<^sub>2,s) \<rightarrow> (c\<^sub>2,s)" |
    18 
    17 
    19 While:   "(WHILE b DO c,s) \<rightarrow>
    18 While:   "(WHILE b DO c,s) \<rightarrow>
    20             (IF b THEN c;; WHILE b DO c ELSE SKIP,s)"
    19             (IF b THEN c;; WHILE b DO c ELSE SKIP,s)"
    21 text_raw{*}%endsnip*}
       
    22 
    20 
    23 
    21 
    24 abbreviation
    22 abbreviation
    25   small_steps :: "com * state \<Rightarrow> com * state \<Rightarrow> bool" (infix "\<rightarrow>*" 55)
    23   small_steps :: "com * state \<Rightarrow> com * state \<Rightarrow> bool" (infix "\<rightarrow>*" 55)
    26 where "x \<rightarrow>* y == star small_step x y"
    24 where "x \<rightarrow>* y == star small_step x y"