src/HOL/IMP/Big_Step.thy
changeset 51513 7a2912282391
parent 50054 6da283e4497b
child 52021 59963cda805a
equal deleted inserted replaced
51512:193ba70666bd 51513:7a2912282391
    76 subsection "Rule inversion"
    76 subsection "Rule inversion"
    77 
    77 
    78 text{* What can we deduce from @{prop "(SKIP,s) \<Rightarrow> t"} ?
    78 text{* What can we deduce from @{prop "(SKIP,s) \<Rightarrow> t"} ?
    79 That @{prop "s = t"}. This is how we can automatically prove it: *}
    79 That @{prop "s = t"}. This is how we can automatically prove it: *}
    80 
    80 
    81 inductive_cases skipE[elim!]: "(SKIP,s) \<Rightarrow> t"
    81 inductive_cases SkipE[elim!]: "(SKIP,s) \<Rightarrow> t"
    82 thm skipE
    82 thm SkipE
    83 
    83 
    84 text{* This is an \emph{elimination rule}. The [elim] attribute tells auto,
    84 text{* This is an \emph{elimination rule}. The [elim] attribute tells auto,
    85 blast and friends (but not simp!) to use it automatically; [elim!] means that
    85 blast and friends (but not simp!) to use it automatically; [elim!] means that
    86 it is applied eagerly.
    86 it is applied eagerly.
    87 
    87 
   213 lemma commute_if:
   213 lemma commute_if:
   214   "(IF b1 THEN (IF b2 THEN c11 ELSE c12) ELSE c2) 
   214   "(IF b1 THEN (IF b2 THEN c11 ELSE c12) ELSE c2) 
   215    \<sim> 
   215    \<sim> 
   216    (IF b2 THEN (IF b1 THEN c11 ELSE c2) ELSE (IF b1 THEN c12 ELSE c2))"
   216    (IF b2 THEN (IF b1 THEN c11 ELSE c2) ELSE (IF b1 THEN c12 ELSE c2))"
   217 by blast
   217 by blast
       
   218 
       
   219 lemma sim_while_cong_aux:
       
   220   "(WHILE b DO c,s) \<Rightarrow> t  \<Longrightarrow> c \<sim> c' \<Longrightarrow>  (WHILE b DO c',s) \<Rightarrow> t"
       
   221 apply(induction "WHILE b DO c" s t arbitrary: b c rule: big_step_induct)
       
   222  apply blast
       
   223 apply blast
       
   224 done
       
   225 
       
   226 lemma sim_while_cong: "c \<sim> c' \<Longrightarrow> WHILE b DO c \<sim> WHILE b DO c'"
       
   227 by (metis sim_while_cong_aux)
   218 
   228 
   219 
   229 
   220 subsection "Execution is deterministic"
   230 subsection "Execution is deterministic"
   221 
   231 
   222 text {* This proof is automatic. *}
   232 text {* This proof is automatic. *}