SE 504 Formal Methods and Models
Some laws and properties of Hoare triples and the wp predicate transformer
(2.5) Relationship between Hoare triples and wp:
{P} S {Q} ≡ [P ⇒ wp.S.Q]
Properties/Laws of Hoare triples:
(2.0) Excluded Miracle: {P} S {false} ≡ [¬P]
Termination: {P} S {true} ≡
"S is guaranteed to terminate if executed
beginning in a state satisfying P"
(2.1) Strengthening the Precondition:
{P} S {Q} ∧ [P' ⇒ P] ⇒ {P'} S {Q}
(2.2) Weakening the Postcondition:
{P} S {Q} ∧ [Q ⇒ Q'] ⇒ {P} S {Q'}
(2.3) Law of Conjunctivity:
{P} S {Q1} ∧ {P} S {Q2} ≡
{P} S {Q1 ∧ Q2}
(2.4) Law of Disjunctivity:
{P1} S {Q} ∧ {P2} S {Q} ≡
{P1 ∨ P2} S {Q}
(2.3.1) Law of Catenation:
{P} S0 {R} ∧ {R} S1 {Q} ⇒
{P} S0; S1 {Q}
Properties/Laws of wp:
(2.6) Excluded Miracle: [¬wp.S.false]
(2.7) Distributivity of Conjunction:
[wp.S.Q1 ∧ wp.S.Q2 ≡
wp.S.(Q1 ∧ Q2)]
Monotonicity: [Q1 ⇒ Q2] ⇒
[wp.S.Q1 ⇒ wp.S.Q2]
(2.8) Distributivity of Disjunction:
[wp.S.Q1 ∨ wp.S.Q2 ⇒
wp.S.(Q1 ∨ Q2)]
In the case that S is deterministic, the implication can be strengthened
to an equivalence.
(2.3.2) Catenation: [wp.(S0; S1).Q ≡
wp.S0.(wp.S1.Q)]