ArticleslgStudy

computer science

Unifying Theories of Programming

Unifying Theories of Programming is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Unifying Theories of Programming rather than just read about it. In short: 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.

Key takeaways

  • Unifying Theories of Programming belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Unifying Theories of Programming to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Unifying Theories of Programming from memory before moving on to harder problems.

Reference excerpt

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 has been made freely available on the web. A UTP Symposium series was started in 2006.

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. In UTP parlance, a theory is a model of a particular programming paradigm. A UTP theory is composed of three ingredients:

an alphabet, which is a set of variable names denoting the attributes of the paradigm that can be observed by an external entity; a signature, which is the set of programming language constructs intrinsic to the paradigm; and a collection of healthiness conditions, which define the space of programs that fit within the paradigm. These healthiness conditions are typically expressed as monotonic idempotent predicate transformers. Program refinement is an important concept in the UTP. A program P 1 {\displaystyle P_{1}} is refined by P 2 {\displaystyle P_{2}} if and only if every observation that can be made of P 2 {\displaystyle P_{2}} is also an observation of P 1 {\displaystyle P_{1}} . The definition of refinement is common across UTP theories:

P 1 ⊑ P 2 if and only if [ P 2 ⇒ P 1 ] {\displaystyle P_{1}\sqsubseteq P_{2}\quad {\text{if and only if}}\quad \left[P_{2}\Rightarrow P_{1}\right]}

where [ X ] {\displaystyle \left[X\right]} denotes 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:

undecorated variables ( v {\displaystyle v} ), modelling an observation of the program at the start of its execution; and primed variables ( v ′ {\displaystyle 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:

The skip statement, which does not alter the program state in any way, is modelled as the relational identity:

s k i p ≡ v ′ = v {\displaystyle \mathbf {skip} \equiv v'=v}

The assignment of value E {\displaystyle E} to a variable a {\displaystyle a} is modelled as setting a ′ {\displaystyle a'} to E {\displaystyle E} and keeping all other variables (denoted by u {\displaystyle u} ) constant:

a := E ≡ a ′ = E ∧ u ′ = u {\displaystyle a:=E\equiv a'=E\land u'=u}

The sequential composition of two programs is just relational composition of intermediate state:

P 1 ; P 2 ≡ ∃ v 0 ∙ P 1 [ v 0 / v ′ ] ∧ P 2 [ v 0 / v ] {\displaystyle P_{1};P_{2}\equiv \exists v_{0}\bullet P_{1}[v_{0}/v']\land P_{2}[v_{0}/v]}

Non-deterministic choice between programs is their greatest lower bound:

P 1 ⊓ P 2 ≡ P 1 ∨ P 2 {\displaystyle P_{1}\sqcap P_{2}\equiv P_{1}\lor P_{2}}

Conditional choice between programs is written using infix notation:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Unifying Theories of Programming

Start with the simplest possible case. Write down what Unifying Theories of Programming claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Unifying Theories of Programming before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Unifying Theories of Programming ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Unifying Theories of Programming

In research
Unifying Theories of Programming appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Unifying Theories of Programming in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Unifying Theories of Programming is common in secondary-school and first-year university syllabi. It links to neighbouring topics 1998 non-fiction books, Computer science books, Formal methods publications, so understanding it makes those chapters shorter.
In everyday life
Look for Unifying Theories of Programming outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Unifying Theories of Programming in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Unifying Theories of Programming means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Unifying Theories of Programming out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Unifying Theories of Programming in simple terms?

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 syste…

Why does Unifying Theories of Programming matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Unifying Theories of Programming?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Unifying Theories of Programming.

Tags

  • 1998 non-fiction books
  • Computer science books
  • Formal methods publications
  • Prentice Hall books
  • Programming language semantics
  • Tony Hoare

Keep exploring