program-proofing

Definition

Program Semantics

The semantics of a program is the function computed by a program .

Formally, for every program configuration and every final configuration :

If no such exists, then is undefined.

Here, denotes the reflexive and transitive closure of the program transition relation.

Semantic Equivalence

Two programs and are semantically equivalent if they compute the same program semantics.

This means that for every input state , both programs produce the same output state whenever either of them terminates.

Important

Semantic equivalence does not distinguish between different causes of non-termination or failure. If one program loops forever and another aborts, they are still semantically equivalent as long as they compute the same partial function on all terminating inputs.

Sequencing

Associative Sequencing

Sequencing is associative at the level of program semantics:

So the order of bracketing does not change the computed function.

function composition.





Here we use that sequencing corresponds to composition:

Therefore, sequential programs can be grouped arbitrarily.