Theory Annotate

Up to index of Isabelle/HOL/CoreC++

theory Annotate
imports WellType

(*  Title:       CoreC++
    ID:          $Id: Annotate.thy,v 1.10 2008-06-23 21:24:36 makarius Exp $
    Author:      Tobias Nipkow, Daniel Wasserrab
    Maintainer:  Daniel Wasserrab <wasserra at fmi.uni-passau.de>
*)


header {* \isaheader{Program annotation} *}

theory Annotate imports WellType begin


abbreviation (output)
  unanFAcc :: "expr => vname => expr" ("(_•_)" [10,10] 90) where
  "unanFAcc e F == FAcc e F []"

abbreviation (output)
  unanFAss :: "expr => vname => expr => expr" ("(_•_ := _)" [10,0,90] 90) where
  "unanFAss e F e' == FAss e F [] e'"


inductive
  Anno :: "[prog,env, expr     , expr] => bool"
         ("_,_ \<turnstile> _ \<leadsto> _"   [51,0,0,51]50)
  and Annos :: "[prog,env, expr list, expr list] => bool"
         ("_,_ \<turnstile> _ [\<leadsto>] _" [51,0,0,51]50)
  for P :: prog
where
  
  AnnoNew: "is_class P C  ==>  P,E \<turnstile> new C \<leadsto> new C"
| AnnoCast: "P,E \<turnstile> e \<leadsto> e' ==> P,E \<turnstile> Cast C e \<leadsto> Cast C e'"
| AnnoStatCast: "P,E \<turnstile> e \<leadsto> e' ==> P,E \<turnstile> StatCast C e \<leadsto> StatCast C e'"
| AnnoVal: "P,E \<turnstile> Val v \<leadsto> Val v"
| AnnoVarVar: "E V = ⌊T⌋ ==> P,E \<turnstile> Var V \<leadsto> Var V"
| AnnoVarField: "[| E V = None; E this = ⌊Class C⌋; P \<turnstile> C has least V:T via Cs |]
               ==> P,E \<turnstile> Var V \<leadsto> Var this•V{Cs}"
| AnnoBinOp:
  "[| P,E \<turnstile> e1 \<leadsto> e1';  P,E \<turnstile> e2 \<leadsto> e2' |]
   ==> P,E \<turnstile> e1 «bop» e2 \<leadsto> e1' «bop» e2'"
| AnnoLAss:
  "P,E \<turnstile> e \<leadsto> e' ==> P,E \<turnstile> V:=e \<leadsto> V:=e'"
| AnnoFAcc:
  "[| P,E \<turnstile> e \<leadsto> e';  P,E \<turnstile> e' :: Class C;  P \<turnstile> C has least F:T via Cs |]
   ==> P,E \<turnstile> e•F{[]} \<leadsto> e'•F{Cs}"
| AnnoFAss: "[| P,E \<turnstile> e1 \<leadsto> e1';  P,E \<turnstile> e2 \<leadsto> e2';
             P,E \<turnstile> e1' :: Class C; P \<turnstile> C has least F:T via Cs |]
          ==> P,E \<turnstile> e1•F{[]} := e2 \<leadsto> e1'•F{Cs} := e2'"
| AnnoCall:
  "[| P,E \<turnstile> e \<leadsto> e';  P,E \<turnstile> es [\<leadsto>] es' |]
   ==> P,E \<turnstile> Call e Copt M es \<leadsto> Call e' Copt M es'"
| AnnoBlock:
  "P,E(V \<mapsto> T) \<turnstile> e \<leadsto> e'  ==>  P,E \<turnstile> {V:T; e} \<leadsto> {V:T; e'}"
| AnnoComp: "[| P,E \<turnstile> e1 \<leadsto> e1';  P,E \<turnstile> e2 \<leadsto> e2' |]
           ==>  P,E \<turnstile> e1;;e2 \<leadsto> e1';;e2'"
| AnnoCond: "[| P,E \<turnstile> e \<leadsto> e'; P,E \<turnstile> e1 \<leadsto> e1';  P,E \<turnstile> e2 \<leadsto> e2' |]
          ==> P,E \<turnstile> if (e) e1 else e2 \<leadsto> if (e') e1' else e2'"
| AnnoLoop: "[| P,E \<turnstile> e \<leadsto> e';  P,E \<turnstile> c \<leadsto> c' |]
          ==> P,E \<turnstile> while (e) c \<leadsto> while (e') c'"
| AnnoThrow: "P,E \<turnstile> e \<leadsto> e'  ==>  P,E \<turnstile> throw e \<leadsto> throw e'"

| AnnoNil: "P,E \<turnstile> [] [\<leadsto>] []"
| AnnoCons: "[| P,E \<turnstile> e \<leadsto> e';  P,E \<turnstile> es [\<leadsto>] es' |]
           ==>  P,E \<turnstile> e#es [\<leadsto>] e'#es'"

end