Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  VCG_Total_EX2.thy   Sprache: Isabelle

 
(* Author: Tobias Nipkow *)

subsubsectionTotal

theory
importsHoare_Total_EX2 Hoare_Total_EX2
begin

text \<open>Theory
Theory \<open>VCG_Total_EX\<close> conatins a VCG built on top of a Hoare logic without logical variables.
Asaresultthe completeness proof runs into a problem. theory uses logic
with variablesproves andcompleteness
\<close>

text\<close>
invariants

datatype acom =
  Askip.\<close>
  Aassignvname     (\<open>(_ ::= _)\<close> [1000, 61] 61) |
  Aseq    acom       (<>_;/ _<close>  [60, 61] 60) |
  Aifbexp acom     \open( _/ THEN_/ELSE\<close>  [0, 0, 61] 61) |
  Awhile assn2 bexp acom
    (<open>({_'/_}/ WHILE _/ DO _)\<close>  [0, 0, 0, 61] 61)

notation com.SKIP (\<open>SKIP\<close>)

text\<open>Strip annotations:\<close>

fun strip :: "acom \ com" where
"strip SKIP = SKIP" |
"strip (x ::= a) = (x ::= a)" |
"strip (C\<^sub>1;; C\<^sub>2) = (strip C\<^sub>1;; strip C\<^sub>2)" |
"strip (IF b THEN C\<^sub>1 ELSE C\<^sub>2) = (IF b THEN strip C\<^sub>1 ELSE strip C\<^sub>2)" |
"strip ({_/_} WHILE b DO C) = (WHILE b DO strip C)"

text\<open>Weakest precondition from annotated commands:\<close>

fun pre :: "acom \ assn2 \ assn2" where
"pre SKIP Q = Q" |
"pre (x ::= a) Q = (\l s. Q l (s(x := aval a s)))" |
"pre (C\<^sub>1;; C\<^sub>2) Q = pre C\<^sub>1 (pre C\<^sub>2 Q)" |
"pre (IF b THEN C\<^sub>1 ELSE C\<^sub>2) Q =
  (\<lambda>l s. if bval b s then pre C\<^sub>1 Q l s else pre C\<^sub>2 Q l s)" |
"pre ({I/x} WHILE b DO C) Q = (\l s. \n. I (l(x:=n)) s)"

text\<open>Verification condition:\<close>

fun vc :: "acom \ assn2 \ bool" where
"vc SKIP Q = True" |
"vc (x ::= a) Q = True" |
"vc (C\<^sub>1;; C\<^sub>2) Q = (vc C\<^sub>1 (pre C\<^sub>2 Q) \ vc C\<^sub>2 Q)" |
"vc (IF b THEN C Aif bexp acom acom (\(IF _/ THEN _/ ELSE _)\ [0, 0, 61] 61) |
"vc ({I/x} WHILE b DO C) Q =
  (\<forall>l s. (I (l(x:=Suc(l x))) s \<longrightarrow> pre C I l s) \<and>
       (l x > 0 \<and> I l s \<longrightarrow> bval b s) \<and>
       (I     (<open({'_}/WHILE / DO _)\ [0, 0, 0, 61] 61)
       vc )"

lemma vc_sound: "vc C Q \ \\<^sub>t {pre C Q} strip C {Q}"
proof( C arbitrary
  case (Awhile I x b Cjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   ?case
pre"java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
  case
      using Awhile.IH[of  java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
" ({I/x} WHILE b DOQ \lambda .\<exists>n. I (l(x:=n)) s)"
    case showcase
      using Awhile
   insert,auto"c (x :=java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
qedauto: Seq  simp Assign


text\<open>Completeness:\<close>

lemma pre_mono:
       l x  0 <and> I l s \<longrightarrow> bval b s) \<and>
proof (induction C       I(l(x : 0)  \<longrightarrow> \<not> bval b s \<and> Q l s) \<and> C I)"
  case Aseq thus ?case by simp metis
qed simp_all

lemma vc_mono:
  "\l s. P l s \ P' l s \ vc C P \ vc C P'"
proof( C arbitrary  'java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  case  thus ?bysimp (metis)
qed simp_all(simp  weaken_postOF[of I x]],goal_cases

lemma vc_complete:
 "\\<^sub>t {P}c{Q} \ \C. strip C = c \ vc C Q \ (\l s. P l s \ pre C Q l s)"
  (is" \ \C. ?G P c Q C")
proof (induction rule: hoaret.induct)
  case Skip
  showusing.prems by (impmetis)
proof "?C Askip"bysimp
next
  case Assigna)
  show?case"\C. ?C C")
  proof
next
  
SeqIH C1where"?G c1Q C1 byblast
  from Seq.IH  \<java.lang.StringIndexOutOfBoundsException: Index 109 out of bounds for length 109
  show?aseis "\C. ?C C")
  proof
    show thus ?casebysimp
lemma vc_mono:
  qed
next
  case (If P b c1 Q c2)
  from If.IH obtain C1 where ih1: "?G (\l s. P l s \ bval b s) c1 Q C1"
    by blast(induction : P P'
fromobtainC2 ih2? \<
    by blast
   ?case"\C. ?C C")
  java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
     ( rule.induct
  qed
next
  case (While P x c b)
  from While.IH obtain C where
    ih:    show "bysimp java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    by blast  proof "?C( x a)" by simp
 ?case (s "\C. ?C C")
  proof
    have "vc ({P/x} WHILE b DO C) (\l. P (l(x := 0)))"
      using ih While(2,3)
      by  (metisfun_upd_same)
    thus "?C( java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
 qedusing ih2byfastforce!: pre_mono)
next
  casejava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
qed


text \<open>Two examples:\<close>from.IHobtain where ih1 \<lambda>l s. P l s \<and> bval b s) c1 Q C1"

lemma vc1: "vc
 ({by blast
 (\<lambda>l s. s ''x'' \<le> 0)"
by auto

thm vc_sound[OF vc1 simplified

lemmavc2vc
  case( P x c b)
 DOfromWhile.IHobtain where
    ('y'':: V '''';;
     {\<lambda>l s. l ''x'' = nat(s ''x'') \<and> l ''y'' = nat(s ''y'') / ''y''}
     WHILE Less (N 0) (V     by blast
(\<lambda>l s. s ''x'' \<le> 0)"
by auto

thm vc_sound vc2, simplified

      using While.(2,3)

100%


¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge