Unifying Theories of Programming explained

Unifying Theories of Programming (UTP) in computer science deals with program semantics. It shows how denotational semantics, operational semantics and algebraic semantics can be combined in a unified framework for the formal specification, design and implementation of programs and computer systems.

The book of this title by C.A.R. Hoare and He Jifeng was published in the Prentice Hall International Series in Computer Science in 1998 and is now freely available on the web.[1]

Theories

The semantic foundation of the UTP is the first-order predicate calculus, augmented with fixed point constructs from second-order logic. Following the tradition of Eric Hehner, programs are predicates in the UTP, and there is no distinction between programs and specifications at the semantic level. In the words of Hoare:

A computer program is identified with the strongest predicate describing every relevant observation that can be made of the behaviour of a computer executing that program.[2]

In UTP parlance, a theory is a model of a particular programming paradigm. A UTP theory is composed of three ingredients:

Program refinement is an important concept in the UTP. A program

P1

is refined by

P2

if and only if every observation that can be made of

P2

is also an observation of

P1

.The definition of refinement is common across UTP theories:

P1\sqsubseteqP2ifandonlyif\left[P2P1\right]

where

\left[X\right]

denotes[3] the universal closure of all variables in the alphabet.

Relations

The most basic UTP theory is the alphabetised predicate calculus, which has no alphabet restrictions or healthiness conditions. The theory of relations is slightly more specialised, since a relation's alphabet may consist of only:

v

), modelling an observation of the program at the start of its execution; and

v'

), modelling an observation of the program at a later stage of its execution.

Some common language constructs can be defined in the theory of relations as follows:

skip\equivv'=v

E

to a variable

a

is modelled as setting

a'

to

E

and keeping all other variables (denoted by

u

) constant:

a:=E\equiva'=E\landu'=u

P1;P2\equiv\existsv0\bulletP1[v0/v']\landP2[v0/v]

P1\sqcapP2\equivP1\lorP2

P1\triangleleftC\trianglerightP2\equiv(C\landP1)\lor(lnotC\landP2)

\muF

of a monotonic predicate transformer

F

:

\muX\bulletF(X)\equiv\sqcap\left\{X\midF(X)\sqsubseteqX\right\}

Further reading

External links

Notes and References

  1. Book: C.A.R. Hoare . Hoare. C. A. R.. Jifeng. He. Unifying Theories of Programming. April 1, 1998. Prentice Hall . 978-0-13-458761-5. 320. 17 September 2014.
  2. Hoare. C.A.R. . Programming: Sorcery or science? . . 1 . 2 . 5–16 . April 1984 . 10.1109/MS.1984.234042. 375578 .
  3. Book: Edsger W. Dijkstra . Edsger W. . Dijkstra . Carel S. Scholten . Carel S. . Scholten . Predicate calculus and program semantics . Texts and Monographs in Computer Science . Springer . 1990 . 0-387-96957-8.