

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The purpose of this document is to provide examples of cases from a structural induction proof that the denotational semantics and operational semantics defined for IMP by Winskel are equivalent. We will specifically look at showing:
C [[c]]σ = {(σ, σ′) |< c, σ >→ σ′} (1)
for cases where c is a command defined in IMP.
The first case to examine is sequencing of commands, c 0 ; c 1 , as a prototypical example of verifying command seman- tics. In this case, the proof goal abstractly defined as equation (1) has the form:
C [[c 0 ;c 1 ]]σ = {(σ, σ′) |< c 0 ; c 1 , σ >→ σ′} (2)
From the definition of C, we know the left side of equation (2) can be rewritten as:
{(σ, σ′) | ∃σ′′^ ∈ Σ · C [[c 0 ]]σ = σ′′^ ∧ C [[c 1 ]]σ′′^ = σ′} (3)
Resulting in the proof obligation:
{(σ, σ′) | ∃σ′′^ ∈ Σ · C [[c 0 ]]σ = σ′′^ ∧ C [[c 1 ]]σ′′^ = σ′} = {(σ, σ′) |< c 0 ; c 1 , σ >→ σ′} (4)
By the definition of set comprehension, equation (11) can be rewritten as:
∃σ′′^ ∈ Σ · C [[c 0 ]]σ = σ′′^ ∧ C [[c 1 ]]σ′′^ = σ′^ ⇐⇒< c 0 ; c 1 , σ >→ σ′^ (5)
From the overall structural induction proof, we have the induction hypotheses:
C [[C 0 ]]σ = σ′′^ ⇐⇒ < C 0 , σ >→ σ′′^ (6) C [[C 1 ]]σ′′^ = σ′^ ⇐⇒ < C 1 , σ′′^ >→ σ′^ (7)
To establish (12) we have two cases:
Case 1: ∃σ′′^ · C [[c 0 ]]σ = σ′′^ ∧ C [[c 1 ]]σ′′^ = σ′^ ⇒< C 0 ; C 1 , σ >→ σ′
To prove the implication, we assume the antecedent and prove the consequent. Assuming C [[C 0 ]]σ = σ′′^ and C [[C 1 ]]σ′′^ = σ′^ it follows from the induction hypothesis that < C 0 , σ >→ σ′′^ and < C 1 , σ >→ σ′.
Recall from the operational semantics definition of IMP the rule for deriving C 0 ; C 1 :
sequence
< c 0 , σ >→ σ′′^ < c 1 , σ >→ σ′ < c 0 ; c 1 , σ >→ σ′^
The induction hypothesis gives the precondition of the rule, thus it follows that < C 0 ; C 1 , σ >→ σ′^ which is the goal of Case 1.
Case 2: ∃σ′′^ · C [[c 0 ]]σ = σ′′^ ∧ C [[c 1 ]]σ′′^ = σ′^ ⇐< c 0 ; c 1 , σ >→ σ′
Note that sequence is the only rule in the operational semantics of IMP that derives < c 0 ; c 1 , σ >→ σ′. Thus, assuming that < c 0 ; c 1 , σ >→ σ′^ is derivable, the rule sequence must be the last rule applied in the derivation. Thus, the preconditions of sequence must be true in the derivation.
It then follows directly from the induction hypothesis that:
C [[c 0 ]]σ = σ′′^ ∧ C [[c 1 ]]σ′′^ = σ′
which is the goal of this case.
Having proved both cases from equation (12), we have proved the conjecture.
Q.E.D.
The second case to examine is the while loop whilebdoc, as a more aggressive example of verifying command seman- tics. In this case, the proof goal abstractly defined as equation (1) has the form:
C [[w]]σ = {(σ, σ′) |< w, σ >→ σ′} (9)
where w = while b do c.
From the definition of C, we know the left side of equation (9) can be rewritten as:
C [[w]]σ = f ix(Γ(ϕ)) =
n∈ω
R^ ˆn({}) (10)
Recall the definition of ϕ is really C [[w]]σ.
Here, the proof obligation is a bit different as we’re looking a fixed point. The fixed point is well-defined and indexed on ω, thus a proof by induction over the natural numbers is in order. Recall the following definitions:
R^ ˆn+1({}) = {(σ, σ′) | B[|b] |= true ∧ (σ, sigma′′) ∈ C[|c]| ∧ (σ′′, σ′) ∈ Rˆn({})}
Thus, we have a base case and an inductive case for an induction over n.
Our proof goal is:
∀n ∈ ω · (σ, σ′) ∈ Rˆn({}) ⇒< σ, w >→ σ′^ (11)
The base case is trivial as the left side reduces to (σ, sigma′′) ∈ {} which is false. Thus, by contradiction the right side is true.