DD2454 Semantics for Programming Languages

Lectures & Tutorials

Lecture 1.

Lecture 2.  Ch. 2.1-2.4.

Exercises:

Lecture 3.  Ch. 2.5.

Exercises:

Lecture 4.  Ch. 2.6.

Exercises:

Lectures 5 and 6.  Ch. 3, Ch. 4.

Exercises:

Lecture 7.  Ch. 5.1-5.2.

Lecture 8.  Ch. 5.4.

Exercises:

Lecture 9.  Ch. 5.3.

Part III. Axiomatic Semantics and Program Verification

Lecture 10.  Ch. 6.1, 6.4.

·  Introduction to axiomatic semantics and program verification.

·  Axiomatic semantics of IMP: the rules.

·  Some simple program verifications.

Exercises:  Derive the Hoare triples:

·  {X<0} if 0<=X then X:=X+1 else X:=1 {X=1}.

·  {X<0} while ~(X=0) do X:=X-1 {false}.

·  {true} while ~(X=0) do X:=X-1 {X=0}.

Lecture 11.  Ch. 6.6.

·  Program verification: pro's and con's.

·  Proof tableaux.

·  Verifying programs with while loops.

·  Loop invariants.

Exercises:  Specify and verify the programs:

·  computing the maximum of two numbers with if X<=Y then Z:=Y else Z:=X.

·  checking whether a non-negative integer is even or odd with  while 2<=X do X:=X-2.

·  computing the gcd of two positive integers with Euclid.

Lecture 12.

·  Solving the midterm assignment in class.

·  Weakest preconditions and semi-automatic program verification.

Lecture 13.  Ch. 6.2, 6.3, 6.5.

·  Syntax and semantics of the assertion language.

·  Semantics of Hoare triples (i.e., partial correctness assertions).

·  Soundness of the axiomatic semantics.

Part IV. Recursion Equations and Domain Theory

Lecture 14.  Ch. 9.1, 9.2, 9.5.

·  The applicative programming language REC.

·  Evaluation strategies: call-by-value, call-by-name.

·  Operational semantics of REC for call-by-value.

·  Operational semantics of REC for call-by-name.

Exercises:

·  Evaluate pow(2,1) under the declaration pow(x,y) = if y then 1 else x x pow(x,y-1)

·  Suggest a small-step operational semantics for call-by-value evaluation.

·  Evaluate pow(2,1) under your small-step semantics.

Lecture 15.  Ch. 9.3, 9.6, 8.1, 8.3

·        Denotational semantics of REC.

·        Domain Theory