If: "\ \ {\s. P s \ bval b s} c\<^sub>1 {Q}; \ {\s. P s \ \ bval b s} c\<^sub>2 {Q} \ \<Longrightarrow> \<turnstile> {P} IF b THEN c\<^sub>1 ELSE c\<^sub>2 {Q}" |
While: "\ {\s. P s \ bval b s} c {P} \ \<turnstile> {P} WHILE b DO c {\<lambda>s. P s \<and> \<not> bval b s}" |
conseq: "\ \s. P' s \ P s; \ {P} c {Q}; \s. Q s \ Q' s \ \<Longrightarrow> \<turnstile> {P'} c {Q'}"
lemmas [simp] = hoare.Skip hoare.Assign hoare.Seq If
lemma strengthen_pre: "\ \s. P' s \ P s; \ {P} c {Q} \ \ \ {P'} c {Q}" by (blast intro: conseq)
lemma weaken_post: "\ \ {P} c {Q}; \s. Q s \ Q' s \ \ \ {P} c {Q'}" by (blast intro: conseq)
text\<open>The assignment and While rule are awkward to use in actual proofs
because their preand postcondition are of a very special form and the actual
goal would haveto match this form exactly. Therefore we derive two variants with arbitrary preand postconditions.\<close>
lemma Assign': "\s. P s \ Q(s[a/x]) \ \ {P} x ::= a {Q}" by (simp add: strengthen_pre[OF _ Assign])
lemma While': assumes"\ {\s. P s \ bval b s} c {P}" and "\s. P s \ \ bval b s \ Q s" shows"\ {P} WHILE b DO c {Q}" by(rule weaken_post[OF While[OF assms(1)] assms(2)])
end
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.