30.01.2014 Aufrufe

Übersicht Formale Semantik Idee: Definiere Effekte

Übersicht Formale Semantik Idee: Definiere Effekte

Übersicht Formale Semantik Idee: Definiere Effekte

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

Direct Style Denotational Semantics<br />

Direct Style Denotational Semantics<br />

<strong>Semantik</strong> der While- Schleife: while b do S<br />

muß identisch sein mit der <strong>Semantik</strong> von<br />

if b then (S; while b do S) else skip<br />

S«while b do S¬ = cond(B« b¬, S«while b do S¬ ◦ S«S¬, id)<br />

Daraus ergibt sich eine kompositionale Definition<br />

der <strong>Semantik</strong> der While- Schleife:<br />

S«while b do S¬ = FIX F<br />

where F g = cond(B«b¬, g ◦ S«S¬, id)<br />

Problem: Definition ist nicht kompositional,<br />

drückt aber aus, dass <strong>Semantik</strong> der While- Schleife ein<br />

Fixpunkt des Funktionals F ist, wobei F definiert ist als:<br />

Abbildungsverhalten der Hilfsfunktion FIX:<br />

FIX: ((states → states) → (states → states)) → (states → states)<br />

13<br />

F g = cond(B«b¬, g ◦ S«S¬, id)<br />

HPS WS 2002/03<br />

Dr. Sabine Glesner<br />

14<br />

Argument ist ein Funktional<br />

HPS WS 2002/03<br />

Ergebnis ist eine Funktion<br />

Dr. Sabine Glesner<br />

Eigenschaften von F und FIX<br />

Denotationelle <strong>Semantik</strong> für While<br />

(Zusammenfassung direct style)<br />

S«while b do S¬ ist ein Fixpunkt von F:<br />

S«while b do S¬ =<br />

= S«if b then (S; while b do S) else skip¬<br />

= cond(B«b¬, S«S; while b do S¬, S«skip¬)<br />

=cond((B«b¬, S«while b do S¬ ◦ S«S¬, id)<br />

=F(S«while b do S¬ )<br />

S«x:=a¬s = s[xa A«a¬s]<br />

S«skip¬ = id<br />

S«S 1 ; S 2 ¬ = S«S 2 ¬ ◦ S«S 1 ¬<br />

S«if b then S 1 else S 2 ¬ = cond(B«b¬, S«S 1 ¬, S«S 2 ¬)<br />

S«while b do S¬ = FIX F<br />

where F g = cond(B«b¬, g ◦ S«S¬ , id)<br />

15<br />

HPS WS 2002/03<br />

Dr. Sabine Glesner<br />

16<br />

HPS WS 2002/03<br />

Dr. Sabine Glesner

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!