src/HOL/Predicate_Compile_Examples/IMP_1.thy
author wenzelm
Fri Dec 17 17:43:54 2010 +0100 (2010-12-17)
changeset 41229 d797baa3d57c
parent 40924 a9be7f26b4e6
child 41413 64cd30d6b0b8
permissions -rw-r--r--
replaced command 'nonterminals' by slightly modernized version 'nonterminal';
bulwahn@39186
     1
theory IMP_1
bulwahn@39186
     2
imports "Predicate_Compile_Quickcheck"
bulwahn@39186
     3
begin
bulwahn@39186
     4
bulwahn@39186
     5
subsection {* IMP *}
bulwahn@39186
     6
bulwahn@39186
     7
text {*
bulwahn@39186
     8
  In this example, the state is one boolean variable and the commands are Skip, Ass, Seq, and IF.
bulwahn@39186
     9
*}
bulwahn@39186
    10
bulwahn@39186
    11
types
bulwahn@39186
    12
  var = unit
bulwahn@39186
    13
  state = bool
bulwahn@39186
    14
bulwahn@39186
    15
datatype com =
bulwahn@39186
    16
  Skip |
bulwahn@39186
    17
  Ass bool |
bulwahn@39186
    18
  Seq com com |
bulwahn@39186
    19
  IF com com
bulwahn@39186
    20
bulwahn@39186
    21
inductive exec :: "com => state => state => bool" where
bulwahn@39186
    22
  "exec Skip s s" |
bulwahn@39186
    23
  "exec (Ass e) s e" |
bulwahn@39186
    24
  "exec c1 s1 s2 ==> exec c2 s2 s3 ==> exec (Seq c1 c2) s1 s3" |
bulwahn@39186
    25
  "s ==> exec c1 s t ==> exec (IF c1 c2) s t" |
bulwahn@39186
    26
  "\<not> s ==> exec c2 s t ==> exec (IF c1 c2) s t"
bulwahn@39186
    27
bulwahn@39186
    28
lemma
bulwahn@39186
    29
  "exec c s s' ==> exec (Seq c c) s s'"
bulwahn@40924
    30
quickcheck[tester = predicate_compile_wo_ff, size = 2, iterations = 10, expect = counterexample]
bulwahn@39186
    31
oops
bulwahn@39186
    32
bulwahn@39186
    33
bulwahn@39186
    34
end