Skip to content

Commit d3bc22c

Browse files
committed
Added a further degenerate partial correctness law (variant + "old" variables)
1 parent d324bf3 commit d3bc22c

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

UTP/ITree_THoare.thy

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ lemma thl_while_inv_var [hoare_safe]:
281281
unfolding while_inv_var_def
282282
by (auto intro!: thl_conseq[OF _ assms(2) assms(3)] thl_while assms(1))
283283

284-
text \<open> The next law is a degenerate partial correctness law, which ignores the variant. \<close>
284+
text \<open> The next two laws are degenerate partial correctness laws, which ignore the variant. \<close>
285285

286286
lemma hl_while_inv_var [hoare_safe]:
287287
assumes "\<^bold>{I \<and> B\<^bold>} S \<^bold>{I\<^bold>}" "`P \<longrightarrow> I`" "`(\<not> B \<and> I) \<longrightarrow> Q`"
@@ -296,6 +296,22 @@ proof -
296296
done
297297
qed
298298

299+
lemma hl_while_inv_var_prestate [hoare_safe]:
300+
assumes
301+
\<comment> \<open> The notation @{term "P\<lbrakk>\<guillemotleft>s\<^sub>0\<guillemotright>/\<^bold>v\<rbrakk>"} means the @{term P} holds on the initial state @{term s\<^sub>0}. \<close>
302+
"\<And> s\<^sub>0. \<^bold>{P\<lbrakk>\<guillemotleft>s\<^sub>0\<guillemotright>/\<^bold>v\<rbrakk> \<and> @(I s\<^sub>0) \<and> B\<^bold>} S \<^bold>{@(I s\<^sub>0)\<^bold>}"
303+
"\<And> s\<^sub>0. `P \<and> \<guillemotleft>s\<^sub>0\<guillemotright> = $\<^bold>v \<longrightarrow> @(I s\<^sub>0)`"
304+
"\<And> s\<^sub>0. `(P\<lbrakk>\<guillemotleft>s\<^sub>0\<guillemotright>/\<^bold>v\<rbrakk> \<and> \<not> B \<and> @(I s\<^sub>0)) \<longrightarrow> Q`"
305+
shows "\<^bold>{P\<^bold>}while B inv @(I old) var V do S od\<^bold>{Q\<^bold>}"
306+
proof -
307+
have 1: "while B inv @(I old) var V do S od = while B inv @(I old) do S od"
308+
by (simp add: while_inv_def while_inv_var_def)
309+
have 2: "\<^bold>{P\<^bold>}while B inv @(I old) do S od\<^bold>{Q\<^bold>}"
310+
using assms(1,2,3) hl_while_inv_prestate by blast
311+
from 1 2 show ?thesis by simp
312+
qed
313+
314+
299315
lemma thl_via_wlp_wp: "H[P] S [Q] = `P \<longrightarrow> (wlp S Q \<and> pre S)`"
300316
by (simp add: thoare_triple_def hl_via_wlp, expr_auto)
301317

0 commit comments

Comments
 (0)