Predicate transformer semantics
Predicate transformer semantics were introduced by Edsger Dijkstra in his seminal paper "Guarded commands, nondeterminacy and formal derivation of programs".[src] They define the semantics of an imperative programming paradigm by assigning to each statement in this language a corresponding predicate transformer: a total function between two predicates on the state space of the statement.[src] In this sense, predicate transformer semantics are a kind of denotational semantics.[src] Actually, in guarded commands, Dijkstra uses only one kind of predicate transformer: the well-known weakest preconditions (see below).[src] Moreover, predicate transformer semantics are a reformulation of Floyd–Hoare logic.[src] Whereas Hoare logic is presented as a deductive system, predicate transformer semantics (either by weakest-preconditions or by strongest-postconditions see below) are complete strategies to build valid deductions of Hoare logic.[src] In other words, they provide an effective algorithm to reduce the problem of verifying a Hoare triple to the problem of proving a first-order formula.[src] Technically, predicate transformer semantics perform a kind of symbolic execution of statements into predicates: execution runs backward in the case of weakest-preconditions, or runs forward in the case of strongest-postconditions.[src]
Predicate transformer semantics were introduced by Edsger Dijkstra in his seminal paper "Guarded commands, nondeterminacy and formal derivation of programs".[src] They define the semantics of an imperative programming paradigm by assigning to each statement in this language a corresponding predicate transformer: a total function between two predicates on the state space of the statement.[src] In this sense, predicate transformer semantics are a kind of denotational semantics.[src] Actually, in guarded commands, Dijkstra uses only one kind of predicate transformer: the well-known weakest preconditions (see below).[src] Moreover, predicate transformer semantics are a reformulation of Floyd–Hoare logic.[src] Whereas Hoare logic is presented as a deductive system, predicate transformer semantics (either by weakest-preconditions or by strongest-postconditions see below) are complete strategies to build valid deductions of Hoare logic.[src] In other words, they provide an effective algorithm to reduce the problem of verifying a Hoare triple to the problem of proving a first-order formula.[src] Technically, predicate transformer semantics perform a kind of symbolic execution of statements into predicates: execution runs backward in the case of weakest-preconditions, or runs forward in the case of strongest-postconditions.[src] For a statement S and a postcondition R, a weakest precondition is a predicate Q such that for any precondition , \{ P \} S \{ R \} if and only if P \Rightarrow Q .[src] In other words, it is the "loosest" or least restrictive requirement needed to guarantee that R holds after S.[src] Uniqueness follows easily from the definition: If both Q and Q' are weakest preconditions, then by the definition \{ Q' \} S \{ R \} so Q' \Rightarrow Q and \{ Q \} S \{ R \} so Q \Rightarrow Q' , and thus Q=Q' .[src] We often use wp(S, R) to denote the weakest precondition for statement S with respect to a postcondition R.[src] We use T to denote the predicate that is everywhere true and F to denote the one that is everywhere false.[src] We shouldn't at least conceptually confuse ourselves with a Boolean expression defined by some language syntax, which might also contain true and false as Boolean scalars.[src] For such scalars we need to do a type coercion such that we have T = predicate(true) and F = predicate(false).[src] Such a promotion is carried out often casually, so people tend to take T as true and F as false.[src] wp(x := x - 5, x > 10) & = & x - 5 > 10 \\ & \Leftrightarrow & x > 15 \end{array} This means that, for the postcondition x > 10 to be true after the assignment, the precondition x > 15 must be true before the assignment.[src] This is also the "weakest precondition", in that it is the "weakest" restriction on the value of x which makes x > 10 true after the assignment.[src] \begin{array}[t]{rcl} wp(x:=x-5;x:=x*2\ ,\ x>20) & = & wp(x:=x-5,wp(x:=x*2, x > 20))\\ & = & wp(x:=x-5,x*2 > 20)\\ & = & (x-5)*2 > 20\\ & = & x > 15 \end{array} wp(\texttt{if}\ x x:l[x = l, x = l+1] Another example is a computation of a square root of an integer.[src] x:l[x = l^2, x = l] The specification statement appears like a primitive in the sense that it does not contain other statements.[src] However, it is very expressive, as pre and post are arbitrary predicates.[src] Its weakest precondition is as follows.[src] It combines Morgan's syntactic idea with the sharpness idea by Bijlsma, Matthews and Wiltink.[src] The very advantage of this is its capability of defining wp of goto L and other jump statements.[src] wp(do x > 0 → L: x := x-1 od; if x 0 → L: x := x-1 od, (x 0 → L: x := x-1 od, x 0 ∧ wp(L: x := x-1, Z) ∨ x 0 ∧ Z(x ← x-1) ∨ x 0 ∧ Z(x ← x-1) ∨ x sp(x := x - 5, x > 15)\ =\ \exists y, x = y - 5 \wedge y > 15 \ \Leftrightarrow \ x > 10 On sequence, it appears that sp runs forward (whereas wp runs backward): S\ =\ \texttt{if}\ \texttt{true} \rightarrow x:=0\ [\!]\ \texttt{true} \rightarrow x:=1\ \texttt{fi} Then, wp(S,R) reduces to the formula R[x \leftarrow 0] \wedge R[x \leftarrow 1] .[src] Hence, wp(S,\ x=0 \vee x=1) reduces to the tautology (0=0 \vee 0=1) \wedge (1=0 \vee 1=1) Whereas, the formula wp(S, x=0) \vee wp(S,x=1) reduces to the wrong proposition (0=0 \wedge 1=0) \vee (1=0 \wedge 1=1) .[src]
34 sentences · 34 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Predicate transformer semantics." encyclopegia.org, 2026, https://encyclopegia.org/wiki/predicate-transformer-semantics. Accessed 03 December 2026.
Chicago
"Predicate transformer semantics." encyclopegia.org. Accessed December 3, 2026. https://encyclopegia.org/wiki/predicate-transformer-semantics.
APA
encyclopegia.org. (2026). Predicate transformer semantics. Retrieved December 3, 2026, from https://encyclopegia.org/wiki/predicate-transformer-semantics
Accessed December 3, 2026 · CC BY-SA 4.0 · citation page · JSON