src/HOL/Predicate_Compile_Examples/IMP_3.thy
author bulwahn
Fri Mar 18 18:19:42 2011 +0100 (2011-03-18)
changeset 42031 2de57cda5b24
parent 41413 64cd30d6b0b8
child 43686 bc7d63c7fd6f
permissions -rw-r--r--
adapting predicate_compile_quickcheck; tuned
     1 theory IMP_3
     2 imports "~~/src/HOL/Library/Predicate_Compile_Quickcheck"
     3 begin
     4 
     5 subsection {* IMP *}
     6 
     7 text {*
     8   In this example, the state is one integer variable and the commands are Skip, Ass, Seq, IF, and While.
     9 *}
    10 
    11 type_synonym var = unit
    12 type_synonym state = int
    13 
    14 datatype com =
    15   Skip |
    16   Ass var "int" |
    17   Seq com com |
    18   IF "state list" com com |
    19   While "state list" com
    20 
    21 inductive exec :: "com => state => state => bool" where
    22   "exec Skip s s" |
    23   "exec (Ass x e) s e" |
    24   "exec c1 s1 s2 ==> exec c2 s2 s3 ==> exec (Seq c1 c2) s1 s3" |
    25   "s \<in> set b ==> exec c1 s t ==> exec (IF b c1 c2) s t" |
    26   "s \<notin> set b ==> exec c2 s t ==> exec (IF b c1 c2) s t" |
    27   "s \<notin> set b ==> exec (While b c) s s" |
    28   "s1 \<in> set b ==> exec c s1 s2 ==> exec (While b c) s2 s3 ==> exec (While b c) s1 s3"
    29 
    30 lemma
    31   "exec c s s' ==> exec (Seq c c) s s'"
    32   quickcheck[tester = predicate_compile_ff_nofs, size=2, iterations=10, quiet = false, expect = counterexample]
    33 oops
    34 
    35 
    36 end