For all states s that satisfy R, executing S on s guarantees that S terminates, and the resulting state s' is such that s' staisfies Q.
{wp(S, Q)} S {Q}
Note that wp() is about total correctness: It includes termination.
This is known as the Law of Excluded Miracle. The phrase "is impossible" apparently confuses some of you. Understand it as "we cannot do it" as in we cannot satisfy the precondition False and then execute S. So, for any Q, wp(S, Q) = False is impossible.
As stated above, it "is impossible". But, what about wp(S, True ) = True? Dos this define liveness of S?
wp( {n := n + m; m := n + m; n := m - n}, (n == 6) and (m == 1) )
= wp( {n := n + m; m := n + m}, (m - n == 6) and (m == 1) ) = wp( {n := n + m}, (n + m - n == 6) and (n + m == 1) ) = wp( {n := n + m}, (m == 6) and (n + m == 1) ) = (m == 6) and (n + m + m == 1) = m == 6 and n == -11
wp( {if i > j then i := i - j else j := i fi}, i == j )
= (i > j => wp({i := i - j},i == j)) and (i <= j => wp({j := i}, i == j)) = (i > j => i - j == j) and (i <= j => i == i) = (i > j => i == 2*j) and (i > j or true) = (i <= j or i == 2*j) and (true) = (i <= j or i == 2*j)
wp( {while i > 3 do i := i - 3 od}, i == 3 )
P0 = (i <= 3) and (i == 3) = (i == 3) P1 = (i > 3) and wp({i := i - 3}, i==3) = (i > 3) and (i-3 == 3) = (i == 6) P2 = (i > 3) and wp({i := i - 3}, i==6) = (i > 3) and (i-3 == 6) = (i == 9) Pk = i == 3*(k+1) wp( {while i > 3 do i := i - 3 od}, i == 3 ) = (P0 or ∃ k>= 0: Pk) = (i == 3 or (∃ k>= 0: i == 3*(k+1))) = (∃ k>= 1: i == 3*k) = i == 3*k, for some k > 0