Jump to content

Talk:Predicate transformer semantics

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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)[reply]
[edit]

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)[reply]

Expressions

[edit]

The mathematical interpretation of several expressions is rather inobvious, for example . Is the right-hand-side a formula? Then why not use parenthesis or words, such as follows?

is the formula

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

The While case needs a partial correctness rule

[edit]

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)[reply]

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 {x = 0} should satisfy the wlp , 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 , 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)[reply]

Stongest postconditions are missing a motivation

[edit]

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)[reply]

Strictness of wp depends on allowed statements

[edit]

If we allow an assume statement, the wp operator is not strict:
The weakest precondition of False before the statement assume !A is exactly the formula that satisfies A.

Assume statements are common in the field of software verification[1]

In model checking, often a program is represented as a control flow graph.[2] [3]

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 assume A and the edge entering C2 assume !A respectively.

References

  1. ^ Zee, Karen; Kuncak, Viktor; Rinard, Martin C. (2009). "An integrated proof language for imperative programs". ACM SIGPLAN Notices. 44 (6): 338. doi:10.1145/1543135.1542514. ISSN 0362-1340.
  2. ^ Arlt, Stephan; Rümmer, Philipp; Schäf, Martin (2013). "A Theory for Control-Flow Graph Exploration". 8172: 506–515. doi:10.1007/978-3-319-02444-8_44. ISSN 0302-9743. {{cite journal}}: Cite journal requires |journal= (help)
  3. ^ Cytron, Ron; Ferrante, Jeanne; Rosen, Barry K.; Wegman, Mark N.; Zadeck, F. Kenneth (1991). "Efficiently computing static single assignment form and the control dependence graph". ACM Transactions on Programming Languages and Systems. 13 (4): 451–490. doi:10.1145/115372.115320. ISSN 0164-0925.