hoare-calculus

Definition

Implication (Rule of Consequence)

The rule of consequence allows the precondition to be strengthened and the postcondition to be weakened.

Formally,

Here, means that is stronger than , and means that is weaker than .

Intuition

If is correct for and , then it is also correct for any stronger precondition and any weaker postcondition .

This rule is used to adapt a proof step when the surrounding assertions do not match exactly.

Example

The program assignment is already known to satisfy the middle triple. The rule of consequence then strengthens the precondition from to and weakens the postcondition from to .

Semantic Requirement

The implications and are usually proved using the semantics of the underlying logic, not the Hoare calculus itself. This is closely related to monotonicity of entailment.