Talk:Predicate transformer semantics

A more in-depth discussion of if and do is required, as well as nondeterminism. Also, an example of how to use predicate transformers to derive a non-trivial algorithm might be good, as long as it doesn't conflict with policy. Also, the references section could use some filling out, specifically to the Gries' and Backhous' newer books on the subject. The relationship to predicate calculus could also be filled out. --jayinbmore 23:58, 31 Jan 2005 (UTC)

Also needs accounting of the wlp "weakest liberal precondition" predicate transformer. --jayinbmore 07:53, 1 Feb 2005 (UTC)


 * Have merged wlp into this article, as suggested in that article, but it could do with more detail PJTraill (talk) 18:14, 3 December 2009 (UTC)

Link to Assertion (computing)
The link of "predicate" to Assertion (computing) is rather unhelpful, but the article Predicate (mathematical logic), though more relevant is a mess, and perhaps not much more helpful. Can somebody do better? PJTraill (talk) 00:10, 23 November 2009 (UTC)


 * I disagree re: the unhelpfulness of the link to Assertion (computing) since that's exactly what "predicate" means in the context of "predicate transformer semantics". --Jdinolt (talk) 21:28, 4 December 2009 (UTC)
 * Actually I retract. The page for Assertion (computing) has changed a lot since I initially put that link in. —Preceding unsigned comment added by Jdinolt (talk • contribs) 21:33, 4 December 2009 (UTC)
 * In the meantime, I have changed the link. Of course, assertions (in the programming sense) are also worth linking too, but not at that particular point, I feel. —Preceding unsigned comment added by PJTraill (talk • contribs) 20:00, 6 December 2009 (UTC)

Expressions
The mathematical interpretation of several expressions is rather inobvious, for example $$ sp(x := E, R)\ =\ \exists y, x=E[x \leftarrow y] \wedge R[x \leftarrow y]$$. Is the right-hand-side a formula? Then why not use parenthesis or words, such as follows?

$$ sp(x := E, R)$$ is the formula $$\exists y \mbox{ s.t. } x=E[x \leftarrow y] \land R[x \leftarrow y]$$

I ask because I'm not certain I understand the formula as originally formatted. Diggory Hardy (talk) 17:48, 14 March 2012 (UTC)

The While case needs a partial correctness rule
Currently, only the total correctness rule for while is provided. The rule is (unavoidably) complex, and unfortunately obscures the essence of the weakest precondition semantics of while. Newcomers in particular will be scared away perhaps never to look at weakest preconditions again. If we remove the termination requirement, a much simpler rule emerges for the weakest liberal precondition, which I denote wlp which simplifies even further to This simply states that the invariant must always hold and additionally the invariant and guard taken together be strong enough to establish the postcondition, and at the end of the loop when the loop guard is false it together with the invariant should be able to establish the required postcondition.

If no one has any objections I will make the change to the page

Houseofwealth (talk) 00:56, 5 March 2015 (UTC)

The middle clause of the wlp doesn't guarantee that the whole wlp is still true after the first iteration (when E is true at first), only the invariant, which makes it too weak. For instance, with the following program and given some valid invariant I (just True?)

while x < 2 do x := x+1 done

The state  should satisfy the wlp $$I \wedge (E \Rightarrow I[x \leftarrow x+1]) \wedge (\neg E \Rightarrow R)$$, for any tautology R, so the first and second clauses are true, and the last one is actually true independently of the value of R; so we can replace it with an unsatisfiable postcondition $$(x = 42)$$, and our wlp would still hold; even though it should never do, as the loop always terminates. A universal quantification like in the total correctness subsection seems necessary here as well. Syrak (talk) 22:41, 9 April 2015 (UTC)

Stongest postconditions are missing a motivation
Also a slightly better motivation for weakest preconditions could be given. Something along the lines of:

Given a program that needs to satisfy some condition when it has finished executing, what are the minimum conditions that need to hold prior to the program execution to ensure this?

Houseofwealth (talk) 01:12, 5 March 2015 (UTC)

Strictness of wp depends on allowed statements
If we allow an assume statement, the wp operator is not strict: The weakest precondition of False before the statement  is exactly the formula that satisfies A. Assume statements are common in the field of software verification

In model checking, often a program is represented as a control flow graph.

For example a statement if A then C1 else C2 is typically translated to a start location with two outgoing edges to nodes that represent the entry to the representation of the subprograms C1 and C2. The edge entering C1 is labeled  and the edge entering C2   respectively.