• Keine Ergebnisse gefunden

Operationale vs. denotationale Semantik

N/A
N/A
Protected

Academic year: 2022

Aktie "Operationale vs. denotationale Semantik"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Korrekte Software: Grundlagen und Methoden Vorlesung 4 vom 23.04.19

Äquivalenz der Operationalen und Denotationalen Semantik

Serge Autexier, Christoph Lüth Universität Bremen Sommersemester 2019

11:27:21 2019-07-04 1 [16]

Fahrplan

IEinführung

IOperationale Semantik IDenotationale Semantik

IÄquivalenz der Operationalen und Denotationalen Semantik IDer Floyd-Hoare-Kalkül

IInvarianten und die Korrektheit des Floyd-Hoare-Kalküls IStrukturierte Datentypen

IVerifikationsbedingungen IVorwärts mit Floyd und Hoare IModellierung

ISpezifikation von Funktionen IReferenzen und Speichermodelle

IFunktionsaufrufe und das Framing-Problem IAusblick und Rückblick

Korrekte Software 2 [16]

Operationale vs. denotationale Semantik

Operationalha, σi →Aexpn DenotationalA[[a]]

m∈Z hm, σi →Aexpm {(σ,m)|σ∈Σ}

x∈Loc xDom(σ)

hx, σi →Aexpσ(x) {(σ, σ(x))|σ∈Σ,x∈ Dom(σ)}

x6∈Dom(σ) hx, σi →Aexp

a1a2

ha1, σi →Aexpn ha2, σi →Aexpm n,m6=⊥

ha1a2, σi →AexpnIm {(σ,nIm)|σ∈Σ,(σ,n)∈ A[[a1]],(σ,m)∈ A[[a2]]}

ha1, σi →Aexpn ha2, σi →Aexpm n=⊥oderm=⊥ ha1a2, σi →Aexp

◦ ∈ {+,∗,−}

Korrekte Software 3 [16]

Operationale vs. denotationale Semantik

Operationalha, σi →Aexpn DenotationalA[[a]]

a1/a2

ha1, σi →Aexpn ha2, σi →Aexpm m6= 0 m,n6=⊥

ha1a2, σi →AexpnIm {(σ,n/m)|σ∈Σ,(σ,n)∈ A[[a1]],(σ,m)∈ A[[a2]],m6=

0}

ha1, σi →Aexpn ha2, σi →Aexpm n=⊥,m=⊥oderm= 0

ha1/a2, σi →Aexp

Korrekte Software 4 [16]

Äquivalenz operationale und denotationale Semantik

IFür alleaAexp, für allen∈Z, für alle Zuständeσ:

ha, σi →Aexpn⇔(σ,n)∈ A[[a]]

ha, σi →Aexp⊥ ⇔σ6∈Dom(A[[a]])

IBeweis Prinzip?per struktureller Induktion übera. (Warum?)

Korrekte Software 5 [16]

Operationale vs. denotationale Semantik

Operationalhb, σi →Bexp0|1 DenotationalB[[b]]

1 h1, σi →Bexp1 {(σ,1)|σ∈Σ}

0 h0, σi →Bexp0 {(σ,0)|σ∈Σ}

Korrekte Software 6 [16]

Operationale vs. denotationale Semantik

Operat.hb, σi →Bexpt DenotationalB[[b]]

a0==a1

ha0, σi →Aexpn ha1, σi →Aexpm n,m6=⊥ n=m ha0==a1, σi →Bexp1

ha0, σi →Aexpn ha1, σi →Aexpm n,m6=⊥ n6=m ha0==a1, σi →Bexp0

ha0, σi →Aexpn ha1, σi →Aexpm n=⊥oderm=⊥ ha0==a1, σi →Bexp

{(σ,1)|σ∈Σ, (σ,n0)∈ A[[a0]], (σ,n1)∈ A[[a1]], n0=n1}

{(σ,0)|σ∈Σ, (σ,n0)∈ A[[a0]], (σ,n1)∈ A[[a1]], n06=n1}

a1<=a2 analog

Korrekte Software 7 [16]

Operationale vs. denotationale Semantik

Operationalha, σi →Bexpb DenotationalB[[b]]

b1&&b0

hb1, σi →Bexp0

hb1&&b2, σi →0 {(σ,0)|(σ,0)∈ B[[b1]]}

hb1, σi →Bexp1 hb2, σi →Bexpb

hb1&&b2, σi →b {(σ,b)|(σ,1)∈ B[[b1]],(σ,b)∈ B[[b2]]}

hb1, σi →Bexp⊥ hb1&&b2, σi → ⊥

b1||b2 analog

!n . . .

Korrekte Software 8 [16]

(2)

Äquivalenz operationale und denotationale Semantik

IFür allebBexp, für allet∈B, for alle Zuständeσ:

hb, σi →Bexpt⇔(σ,t)∈ B[[b]]

hb, σi →Bexp⊥ ⇔σ6∈Dom(B[[b]])

IBeweis Prinzip?per struktureller Induktion überb(unter Verwendung der Äquivalenz für AExp). (Warum?)

Korrekte Software 9 [16]

Operationale vs. denotationale Semantik

Operational hc, σi →Stmtσ0|⊥

DenotationalC[[c]]

{ } h{}, σi →Stmtσ C[[{ }]] =Id

c1;c2

hc1, σi →Stmtσ06=⊥ hc2, σ0i →Stmtσ00 hc1;c2, σi →Stmtσ00

hc1, σi →Stmt⊥ hc1;c2, σi →Stmt

C[[c2]]◦ C[[c1]]

x=a ha, σi →Aexpn hx=a, σi →Stmtσ[n/x]

ha, σi →Aexp⊥ hx=a, σi →Stmt

{(σ, σ[n/x])|(σ,n)∈ A[[a]]}

Korrekte Software 10 [16]

Operationale vs. denotationale Semantik

Operational hc, σi →Stmtσ0|⊥

DenotationalC[[c]]

if(b)c0

hb, σi →Bexp⊥ hc, σi →Stmt⊥ hb, σi →Bexp1 hc0, σi →Stmtσ0 hc, σi →Stmtσ0

{(σ, σ0)|(σ,1)∈ B[[b]],(σ, σ0)∈ C[[c0]]}

elsec1

hb, σi →Bexp0 hc1, σi →Stmtσ0

hc, σi →Stmtσ0 {(σ, σ0)|(σ,0)∈ B[[b]],(σ, σ0)∈ C[[c1]]}

Korrekte Software 11 [16]

Operationale vs. denotationale Semantik

Operational hc, σi →Stmtσ0|⊥

DenotationalC[[c]]

while(b)c

| {z } w

hb, σi →Bexp0 hw, σi →Stmtσ

hb, σi →Bexp⊥ hw, σi →Stmt

hb, σi →Bexp1 hc, σi →Stmtσ06=⊥ hw, σ0i →Stmtσ00 hw, σi →Stmtσ00

fix(Γ)

hb, σi →Bexp1 hc, σi →Stmt⊥ hw, σi →Stmt⊥ mit

Γ(ϕ) = {(σ, σ0)|(σ,1)∈ B[[b]],(σ, σ0)∈ϕ◦ C[[c]]}

∪{(σ, σ)|(σ,0)∈ B[[b]]}

Korrekte Software 12 [16]

Äquivalenz operationale und denotationale Semantik

IFür allecStmt, für alle Zuständeσ, σ0: hc, σi →Stmtσ0⇔(σ, σ0)∈ C[[c]]

hc, σi →Stmt⊥ ⇒σ6∈Dom(C[[c]]) I⇒Beweis Prinzip?per Induktion über die Ableitung in der

operationalen Semantik (Warum?)

I⇐Beweis Prinzip?per struktureller Induktion überc(Verwendung der Äquivalenz für arithmetische und boolsche Ausdrücke). Für die While-Schleife Rückgriff auf Definition des Fixpunkts und Induktion über die Teilmengen Γi(∅) des Fixpunkts. (Warum?)

Korrekte Software 13 [16]

Knackpunkt

C[[w]] =fix(Γ) = Γ(fix(Γ)) = Γ([

i≥0

Γi(∅)) =[

i≥0

Γ(Γi(∅))

=[

i≥0

{(σ, σ0)|(σ,1)∈ B[[b]],(σ, σ00)∈ C[[c]],(σ00, σ0)∈Γi(∅)}

∪ {(σ, σ)|(σ,0)∈ B[[b]]}

mitwwhile(b)cInduktion überi≥0 {(σ, σ0)|(σ,1)∈ B[[b]]

| {z }

hb,σi→Bexp1

, (σ, σ00)∈ C[[c]]

| {z }

(strukt.IH)hc,σi→Stmtσ0

,00, σ0)∈Γi(∅)

| {z }

(≤i IH)hw,σ00i→Stmtσ0

∪{(σ, σ)|(σ,0)∈ B[[b]]

| {z }

hw,σi→Stmtσ

}

hw, σi →Stmtσ0

Korrekte Software 14 [16]

Äquivalenz operationale und denotationale Semantik

IFür allecStmt, für alle Zuständeσ, σ0: hc, σi →Stmtσ0⇔(σ, σ0)∈ C[[c]]

hc, σi →Stmt⊥ ⇒σ6∈Dom(C[[c]])

IGegenbeispiel für⇐in der zweiten Aussage: wählecwhile(1){}:

C[[c]] =∅aberhc, σi →Stmt⊥gilt nicht (sondern?).

Korrekte Software 15 [16]

Fahrplan

IEinführung

IOperationale Semantik IDenotationale Semantik

IÄquivalenz der Operationalen und Denotationalen Semantik IDer Floyd-Hoare-Kalkül

IInvarianten und die Korrektheit des Floyd-Hoare-Kalküls IStrukturierte Datentypen

IVerifikationsbedingungen IVorwärts mit Floyd und Hoare IModellierung

ISpezifikation von Funktionen IReferenzen und Speichermodelle

IFunktionsaufrufe und das Framing-Problem IAusblick und Rückblick

Korrekte Software 16 [16]

Referenzen

ÄHNLICHE DOKUMENTE

Für die While-Schleife Rückgriff auf Definition des Fixpunkts und Induktion über die Teilmengen Γ i (∅) des Fixpunkts.. Für die While-Schleife Rückgriff auf Definition des

I Modellierung und Spezifikation I Verifikationsbedingungen I Vorwärts mit Floyd und Hoare I Funktionen und Prozeduren I Referenzen. I Ausblick

• Erweitern Sie die Syntax auch für boolesche Ausdrücke um den ternären Bedingungsoperator und defi- nieren Sie die operationale Semantik entsprechend. — Seite 2 von

die denotationale Semantik der Schleife (Zeile 1– 8), indem wir die Tabelle solange horizontal fortsetzen, bis die Schleife terminiert.. (c) Geben Sie danach eine geschlossene

Korrekte Software: Grundlagen und Methoden Vorlesung 5 vom 04.05.17: Äquivalenz der Operationalen und..

• Erweitern Sie die Syntax auch für boolesche Ausdrücke um den ternären Bedingungsoperator und defi- nieren Sie die operationale Semantik entsprechend. — Seite 2 von

Serge Autexier, Christoph Lüth.

Korrekte Software: Grundlagen und Methoden Vorlesung 5 vom 2.05.16: Äquivalenz operationale und.