Math 2.0

Computer science Semantics and logic in computer science Concept

Weakest precondition

Builds on Hoare logic

Summary

The weakest precondition wp(C,Q)\mathrm{wp}(C, Q) of a command CC and a postcondition QQ is a condition on the starting state. It is the most general condition that guarantees that CC terminates in a state satisfying QQ. Edsger W. Dijkstra introduced it in 1975, with his language of guarded commands. He used it to define the meaning of programs and to derive programs from their specifications. The map Q↦wp(C,Q)Q \mapsto \mathrm{wp}(C, Q) is a predicate transformer, and it can be computed by structural rules for every construct except loops. It is the backward-reasoning counterpart of Hoare logic and the basis of many verification tools.

Reading path

To understand this page from the ground up, read these 13 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Binary relation concept
  2. Proposition concept
  3. Operational semantics concept
  4. Conjunction definition
  5. Disjunction definition
  6. Implication definition
  7. Negation definition
  8. Predicate definition
  9. Biconditional definition
  10. Propositional logic concept
  11. Predicate logic concept
  12. Hoare logic concept
  13. Weakest precondition concept

Further reading

  1. Web https://en.wikipedia.org/wiki/Predicate_transformer_semantics
About this page
TagDRWV1K987X
URIm2://DRWV1K987X
Kindconcept
WritingW0 stub
MSC68Q60, 03B70
UsesHoare logic
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

Definitions