IMP/Denotation.thy
changeset 138 bf044f0db994
parent 137 bca8203b0e91
child 144 6254f50e5ec9
equal deleted inserted replaced
137:bca8203b0e91 138:bf044f0db994
    13   B     :: "bexp => state => bool"
    13   B     :: "bexp => state => bool"
    14   C     :: "com => (state*state)set"
    14   C     :: "com => (state*state)set"
    15   Gamma :: "[bexp,com,(state*state)set] => (state*state)set"
    15   Gamma :: "[bexp,com,(state*state)set] => (state*state)set"
    16 
    16 
    17 primrec A aexp
    17 primrec A aexp
    18   A_nat_def	"A(N(n)) = (%s. n)"
    18   A_nat	"A(N(n)) = (%s. n)"
    19   A_loc_def	"A(X(x)) = (%s. s(x))" 
    19   A_loc	"A(X(x)) = (%s. s(x))" 
    20   A_op1_def	"A(Op1(f,a)) = (%s. f(A(a,s)))"
    20   A_op1	"A(Op1(f,a)) = (%s. f(A(a,s)))"
    21   A_op2_def	"A(Op2(f,a0,a1)) = (%s. f(A(a0,s),A(a1,s)))"
    21   A_op2	"A(Op2(f,a0,a1)) = (%s. f(A(a0,s),A(a1,s)))"
    22 
    22 
    23 primrec B bexp
    23 primrec B bexp
    24   B_true_def	"B(true) = (%s. True)"
    24   B_true  "B(true) = (%s. True)"
    25   B_false_def	"B(false) = (%s. False)"
    25   B_false "B(false) = (%s. False)"
    26   B_op_def	"B(ROp(f,a0,a1)) = (%s. f(A(a0,s),A(a1,s)))" 
    26   B_op	  "B(ROp(f,a0,a1)) = (%s. f(A(a0,s),A(a1,s)))" 
    27 
    27   B_not	  "B(noti(b)) = (%s. ~B(b,s))"
    28 
    28   B_and	  "B(b0 andi b1) = (%s. B(b0,s) & B(b1,s))"
    29   B_not_def	"B(noti(b)) = (%s. ~B(b,s))"
    29   B_or	  "B(b0 ori b1) = (%s. B(b0,s) | B(b1,s))"
    30   B_and_def	"B(b0 andi b1) = (%s. B(b0,s) & B(b1,s))"
       
    31   B_or_def	"B(b0 ori b1) = (%s. B(b0,s) | B(b1,s))"
       
    32 
    30 
    33 defs
    31 defs
    34   Gamma_def	"Gamma(b,c) ==   \
    32   Gamma_def	"Gamma(b,c) ==   \
    35 \		   (%phi.{io. io : (phi O C(c)) & B(b,fst(io))} Un \
    33 \		   (%phi.{io. io : (phi O C(c)) & B(b,fst(io))} Un \
    36 \	                 {io. io : id & ~B(b,fst(io))})"
    34 \	                 {io. io : id & ~B(b,fst(io))})"
    37 
    35 
    38 primrec C com
    36 primrec C com
    39   C_skip_def	"C(skip) = id"
    37   C_skip    "C(skip) = id"
    40   C_assign_def	"C(x := a) = {io . snd(io) = fst(io)[A(a,fst(io))/x]}"
    38   C_assign  "C(x := a) = {io . snd(io) = fst(io)[A(a,fst(io))/x]}"
    41   C_comp_def	"C(c0 ; c1) = C(c1) O C(c0)"
    39   C_comp    "C(c0 ; c1) = C(c1) O C(c0)"
    42   C_if_def	"C(ifc b then c0 else c1) =   \
    40   C_if	    "C(ifc b then c0 else c1) =   \
    43 \		   {io. io:C(c0) & B(b,fst(io))} Un \
    41 \		   {io. io:C(c0) & B(b,fst(io))} Un \
    44 \	           {io. io:C(c1) & ~B(b,fst(io))}"
    42 \	           {io. io:C(c1) & ~B(b,fst(io))}"
    45   C_while_def	"C(while b do c) = lfp(Gamma(b,c))"
    43   C_while   "C(while b do c) = lfp(Gamma(b,c))"
    46 
    44 
    47 end
    45 end