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
This means that for every input state
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.
Proof
We reduce the statement to associativity of function composition.
Here we use that sequencing corresponds to composition:
Therefore, sequential programs can be grouped arbitrarily.