src/HOL/IMP/Hoare.thy
changeset 80914 d97fdabd9e2b
parent 68776 403dd13cf6e9
equal deleted inserted replaced
80913:46f59511b7bb 80914:d97fdabd9e2b
     7 theory Hoare imports Big_Step begin
     7 theory Hoare imports Big_Step begin
     8 
     8 
     9 type_synonym assn = "state \<Rightarrow> bool"
     9 type_synonym assn = "state \<Rightarrow> bool"
    10 
    10 
    11 definition
    11 definition
    12 hoare_valid :: "assn \<Rightarrow> com \<Rightarrow> assn \<Rightarrow> bool" ("\<Turnstile> {(1_)}/ (_)/ {(1_)}" 50) where
    12 hoare_valid :: "assn \<Rightarrow> com \<Rightarrow> assn \<Rightarrow> bool" (\<open>\<Turnstile> {(1_)}/ (_)/ {(1_)}\<close> 50) where
    13 "\<Turnstile> {P}c{Q} = (\<forall>s t. P s \<and> (c,s) \<Rightarrow> t  \<longrightarrow>  Q t)"
    13 "\<Turnstile> {P}c{Q} = (\<forall>s t. P s \<and> (c,s) \<Rightarrow> t  \<longrightarrow>  Q t)"
    14 
    14 
    15 abbreviation state_subst :: "state \<Rightarrow> aexp \<Rightarrow> vname \<Rightarrow> state"
    15 abbreviation state_subst :: "state \<Rightarrow> aexp \<Rightarrow> vname \<Rightarrow> state"
    16   ("_[_'/_]" [1000,0,0] 999)
    16   (\<open>_[_'/_]\<close> [1000,0,0] 999)
    17 where "s[a/x] == s(x := aval a s)"
    17 where "s[a/x] == s(x := aval a s)"
    18 
    18 
    19 inductive
    19 inductive
    20   hoare :: "assn \<Rightarrow> com \<Rightarrow> assn \<Rightarrow> bool" ("\<turnstile> ({(1_)}/ (_)/ {(1_)})" 50)
    20   hoare :: "assn \<Rightarrow> com \<Rightarrow> assn \<Rightarrow> bool" (\<open>\<turnstile> ({(1_)}/ (_)/ {(1_)})\<close> 50)
    21 where
    21 where
    22 Skip: "\<turnstile> {P} SKIP {P}"  |
    22 Skip: "\<turnstile> {P} SKIP {P}"  |
    23 
    23 
    24 Assign:  "\<turnstile> {\<lambda>s. P(s[a/x])} x::=a {P}"  |
    24 Assign:  "\<turnstile> {\<lambda>s. P(s[a/x])} x::=a {P}"  |
    25 
    25