src/HOL/IMP/VC.thy
author nipkow
Tue Jan 23 10:59:35 1996 +0100 (1996-01-23)
changeset 1447 bc2c0acbbf29
child 1451 6803ecb9b198
permissions -rw-r--r--
Added a verified verification-condition generator.
     1 (*  Title: 	HOL/IMP/VC.thy
     2     ID:         $Id$
     3     Author: 	Tobias Nipkow
     4     Copyright   1996 TUM
     5 
     6 acom: annotated commands
     7 vc:   verification-conditions
     8 wp:   weakest (liberal) precondition
     9 *)
    10 
    11 VC  =  Hoare +
    12 
    13 datatype  acom = Askip
    14                | Aass   loc aexp
    15                | Asemi  acom acom
    16                | Aif    bexp acom acom
    17                | Awhile bexp assn acom
    18 
    19 consts
    20   vc,wp :: acom => assn => assn
    21   astrip :: acom => com
    22 
    23 primrec wp acom
    24   wp_Askip  "wp Askip Q = Q"
    25   wp_Aass   "wp (Aass x a) Q = (%s.Q(s[A a s/x]))"
    26   wp_Asemi  "wp (Asemi c d) Q = wp c (wp d Q)"
    27   wp_Aif    "wp (Aif b c d) Q = (%s. (B b s-->wp c Q s)&(~B b s-->wp d Q s))" 
    28   wp_Awhile "wp (Awhile b I c) Q = I"
    29 
    30 primrec vc acom
    31   vc_Askip  "vc Askip Q = (%s.True)"
    32   vc_Aass   "vc (Aass x a) Q = (%s.True)"
    33   vc_Asemi  "vc (Asemi c d) Q = (%s. vc c (wp d Q) s & vc d Q s)"
    34   vc_Aif    "vc (Aif b c d) Q = (%s. vc c Q s & vc d Q s)" 
    35   vc_Awhile "vc (Awhile b I c) Q = (%s. (I s & ~B b s --> Q s) &
    36                               (I s & B b s --> wp c I s) & vc c I s)"
    37 
    38 primrec astrip acom
    39   astrip_Askip  "astrip Askip = skip"
    40   astrip_Aass   "astrip (Aass x a) = (x:=a)"
    41   astrip_Asemi  "astrip (Asemi c d) = (astrip c;astrip d)"
    42   astrip_Aif    "astrip (Aif b c d) = ifC b (astrip c) (astrip d)"
    43   astrip_Awhile "astrip (Awhile b I c) = whileC b (astrip c)"
    44   
    45 end