program-proofing

Definition

Program Proofing

Program proofing (or program verification) is the formal process of proving that a program is correct with respect to a formal specification.

Methods

Hoare Calculus

Decompose correctness assertions into simpler ones using inference rules until only true statements and valid formulas remain. This method uses the Hoare calculus directly.

Definition

Hoare Calculus

Hoare calculus is a formal system used to reason about the correctness of programs. It uses a set of axioms and inference rules to prove that if a program starts in a state satisfying a specific condition (precondition), it will end in a state satisfying another condition (postcondition).

Link to original

Weakest Precondition

Calculate the weakest formula such that holds, and show that the given precondition implies .

Definition

Weakest Precondition

The weakest precondition (WP) is the most general (least restrictive) formula such that the Hoare triple is totally correct.

Link to original

Strongest Postcondition

Calculate the strongest formula such that holds, and show that implies the desired postcondition .

Definition

Strongest Postcondition

The strongest postcondition (SP), denoted as , is the most specific (most restrictive) formula such that the Hoare triple is partially correct.

Formal Semantics

In terms of the set of states , the SP represents the image of the set of states satisfying under the execution of :

Link to original