CSCI 431 Lecture Notes - Semantics

Semantics

What does


     X.pay := X.pay + 1600 ;

mean?

What does


      DO 100 I = 1, J
 100  A(I) = I

do when J is 0?

How about?


     I := 1
     J := 2 ;
     while (I < J) do
     begin
        I := I+1 ;
        J := J+1 ;
     end

In the early days

Semantic Models

VDL -- Vienna Definition Language

Axiomatic Semantics

Notation

The Basic Idea

Example: {X=1} X:=X+1 {X=2}

Formal Specification

Example: I want a program that swaps the values in X and Y How do we determine when the program fulfills the specification?

A formal Proof

Weakest preconditions

Assignment Statements

Selection statements

Loop invariants