src/HOL/IMP/Natural.thy
changeset 19796 d86e7b1fc472
parent 18372 2bffdf62fe7f
child 20503 503ac4c5ef91
equal deleted inserted replaced
19795:746274ca400b 19796:d86e7b1fc472
   163     -- "both cases together give us what we want:"
   163     -- "both cases together give us what we want:"
   164     have "\<langle>?if, s\<rangle> \<longrightarrow>\<^sub>c s'" by blast
   164     have "\<langle>?if, s\<rangle> \<longrightarrow>\<^sub>c s'" by blast
   165   }
   165   }
   166   moreover
   166   moreover
   167   -- "now the other direction:"
   167   -- "now the other direction:"
   168   { fix s s' assume if: "\<langle>?if, s\<rangle> \<longrightarrow>\<^sub>c s'"
   168   { fix s s' assume "if": "\<langle>?if, s\<rangle> \<longrightarrow>\<^sub>c s'"
   169     -- "again, if @{text b} is @{text False} in state @{text s}, then the False-branch"
   169     -- "again, if @{text b} is @{text False} in state @{text s}, then the False-branch"
   170     -- "of the @{text \<IF>} is executed, and both statements do nothing:"
   170     -- "of the @{text \<IF>} is executed, and both statements do nothing:"
   171     hence "\<not>b s \<Longrightarrow> s = s'" by simp
   171     hence "\<not>b s \<Longrightarrow> s = s'" by simp
   172     hence "\<not>b s \<Longrightarrow> \<langle>?w, s\<rangle> \<longrightarrow>\<^sub>c s'" by simp
   172     hence "\<not>b s \<Longrightarrow> \<langle>?w, s\<rangle> \<longrightarrow>\<^sub>c s'" by simp
   173     moreover
   173     moreover
   174     -- "on the other hand, if @{text b} is @{text True} in state @{text s},"
   174     -- "on the other hand, if @{text b} is @{text True} in state @{text s},"
   175     -- {* then this time only the @{text IfTrue} rule can have be used *}
   175     -- {* then this time only the @{text IfTrue} rule can have be used *}
   176     { assume b: "b s"
   176     { assume b: "b s"
   177       with if have "\<langle>c; ?w, s\<rangle> \<longrightarrow>\<^sub>c s'" by (cases set: evalc) auto
   177       with "if" have "\<langle>c; ?w, s\<rangle> \<longrightarrow>\<^sub>c s'" by (cases set: evalc) auto
   178       -- "and for this, only the Semi-rule is applicable:"
   178       -- "and for this, only the Semi-rule is applicable:"
   179       then obtain s'' where
   179       then obtain s'' where
   180         "\<langle>c, s\<rangle> \<longrightarrow>\<^sub>c s''" and "\<langle>?w, s''\<rangle> \<longrightarrow>\<^sub>c s'" by (cases set: evalc) auto
   180         "\<langle>c, s\<rangle> \<longrightarrow>\<^sub>c s''" and "\<langle>?w, s''\<rangle> \<longrightarrow>\<^sub>c s'" by (cases set: evalc) auto
   181       -- "with this information, we can build a derivation tree for the @{text \<WHILE>}"
   181       -- "with this information, we can build a derivation tree for the @{text \<WHILE>}"
   182       with b
   182       with b