26.09.2013 Views

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 7. CORRECTNESS OF TRANSFORMATION RULES<br />

• mA = [T ↦→ ValueBool] = [T ↦→ B]<br />

• mOP = [f ↦→ λx : B • ∼ x]<br />

• sinit = [ ], as there are no variable definitions in A_SPEC<br />

The semantics <strong>of</strong> the satisfaction relation is defined such that m |=Σ<br />

A_SP EC.<br />

Then the imperative specification I_SPEC is obtained by transforming<br />

A_SPEC using the transformation rules defined in Chapter 6 such that<br />

A_SPEC ✄ I_SPEC. The type <strong>of</strong> interest is T and the corresponding variable<br />

is named t.<br />

Specification 7.2 – <strong>Imperative</strong> specification I_SPEC<br />

scheme I_SPEC =<br />

class<br />

type T = Bool<br />

variable t : T<br />

value<br />

f : Unit → read t write t Unit<br />

f() ≡ t := ∼ t<br />

end<br />

I_SPEC can be regarded as a signature Σ ′ = σ(Σ) and a sentence e ′ =<br />

Sen(σ)(e).<br />

The signature Σ ′ = 〈A ′ , OP ′ , V ′ 〉 <strong>of</strong> I_SPEC is defined as follows:<br />

• A ′ = [T ↦→ Bool], reflecting the type <strong>of</strong> T<br />

• OP ′ = [f ↦→ Unit → read t write t Unit], reflecting the type <strong>of</strong> the<br />

function f<br />

• V ′ = [t ↦→ T ], reflecting the type <strong>of</strong> the variable t<br />

The sentence is defined as e ′ =✷ f() ≡ t := ∼ t<br />

Then the model m ′ = 〈m ′ A , m′ OP , s′ init 〉 <strong>of</strong> I_SPEC can be defined:<br />

• m ′ A = [T ↦→ ValueBool] = [T ↦→ B]<br />

• m ′ OP = [f ↦→ λu : Unit • s ′ : Store • ([t ↦→∼ s ′ (t)], d_unit)]<br />

68

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!