Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ... Transformation of Applicative Specifications into Imperative ...

26.09.2013 Views

CHAPTER 7. CORRECTNESS OF TRANSFORMATION RULES 7.4 An Institution for RSLI In [Lin04] and [LH04] an institution for mRSL is defined. As mentioned above mRSL is an applicative subset of RSL. It is in the following outlined how an institution for the imperative subset RSLI can be defined and in that way an outline of a verification of the transformation rules is given. To simplify matters sort definitions, variant definitions and short record definitions are not considered, nor are hidden and implicit observers or hidden and implicit generators. In a proper definition they must be included. Furthermore, only maximal type expressions are considered. Signatures An RSLI signature is a triple Σ = 〈A, OP, V 〉 where • A = Id →m T (A, V ) is a map, which represents a set of non-cyclic abbreviation definitions. It maps type identifiers to the type expressions they abbreviate. • OP = Id →m T (A, V ) is a map, which represents a set of value declarations. It maps value identifiers to their declared type expressions. • V = Id →m T (A, V ) is a map, which represents a set of variable definitions. It maps variable identifiers to the corresponding type expressions. such that dom A, dom OP and dom V are disjoint. T (A, V ) is a set of RSL type expressions referring to type identifiers in dom A and variable identifers in dom V . A signature is said to be applicative if V = [ ], since there are no variable declarations in the applicative case. Signature Morphisms An RSLI signature morphism σ : Σ → Σ ′ is defined as the transformation from the transformable specification SP to the specification SP ′ such that Sign(SP ) = Σ and Sign(SP ′ ) = Σ ′ . Composition is defined in the obvious way and the identities are defined such that a signature is mapped to itself. Recalling the definition of the transformation rules, note that for a signature morphism σ : Σ → Σ ′ , where Σ = 〈A, OP, V 〉 and Σ ′ = 〈A ′ , OP ′ , V ′ 〉: • A = A ′ , since the abbreviation definitions are the same • dom OP = dom OP ′ , since the value declarations are transformed into value declarations of the same names • dom V ⊆ dom V ′ , since variables cannot be removed, only added 62

Sentences 7.4. AN INSTITUTION FOR RSLI An RSLI Σ-sentence is a boolean value expression, which is well-formed according to the static semantics of RSL and is within the subset of RSLI. Sentence Morphisms As a specification represents a signature and a collection of sentences, the transformation rules do not only define a transformation between the signatures of the specifications but also a transformation between sentences. An RSLI sentence morphism Sen(σ) : Sen(Σ) → Sen(Σ ′ ) should be defined such that it respects the defined transformation rules for sentences. Sentence Functor The functor Sen : Sign → Set is a functor that maps signatures Σ in Sign to the set Sen(Σ) of Σ-sentences and maps each signature morphism σ : Σ → Σ ′ in Sign to the sentence morphism Sen(σ) : Sen(Σ) → Sen(Σ ′ ) as described above. Models Let Σ = 〈A, OP, V 〉 be a signature. An RSLI Σ-model is a triple m = 〈mA, mOP , sinit〉 where where • mA : Id →m Types, such that dom mA = dom A and mA(a) = M(A ∗ (a)). That is mA maps type identifiers into the types their abbreviations denote. • mOP : Id →m Values, such that dom mOP = dom OP and mOP (op) ∈ M(OP (op)). That is mOP maps value identifiers into the values they denote. These values must be in the types denoted by their type expressions. • sinit ∈ Store. That is sinit denotes the initial store that maps variable identifiers to their initial values. • A ∗ is a function that takes a type expression to its canonical form, i.e. a type expression not referring to any type identifiers, by recursively expanding type identifiers according to their abbreviations. • M : T (A, V ) → Types is a meaning function mapping type expressions into the types they denote: M(t) = Value A ∗ (t). A type is a set of values, also known as a value domain. Valuet denotes the value domain for a type expression t ∈ T (∅, V ), e.g.: 63

CHAPTER 7. CORRECTNESS OF TRANSFORMATION RULES<br />

7.4 An Institution for RSLI<br />

In [Lin04] and [LH04] an institution for mRSL is defined. As mentioned<br />

above mRSL is an applicative subset <strong>of</strong> RSL. It is in the following outlined<br />

how an institution for the imperative subset RSLI can be defined and in that<br />

way an outline <strong>of</strong> a verification <strong>of</strong> the transformation rules is given. To simplify<br />

matters sort definitions, variant definitions and short record definitions<br />

are not considered, nor are hidden and implicit observers or hidden and implicit<br />

generators. In a proper definition they must be included. Furthermore,<br />

only maximal type expressions are considered.<br />

Signatures<br />

An RSLI signature is a triple Σ = 〈A, OP, V 〉 where<br />

• A = Id →m T (A, V ) is a map, which represents a set <strong>of</strong> non-cyclic abbreviation<br />

definitions. It maps type identifiers to the type expressions<br />

they abbreviate.<br />

• OP = Id →m T (A, V ) is a map, which represents a set <strong>of</strong> value declarations.<br />

It maps value identifiers to their declared type expressions.<br />

• V = Id →m T (A, V ) is a map, which represents a set <strong>of</strong> variable definitions.<br />

It maps variable identifiers to the corresponding type expressions.<br />

such that dom A, dom OP and dom V are disjoint.<br />

T (A, V ) is a set <strong>of</strong> RSL type expressions referring to type identifiers in<br />

dom A and variable identifers in dom V .<br />

A signature is said to be applicative if V = [ ], since there are no variable<br />

declarations in the applicative case.<br />

Signature Morphisms<br />

An RSLI signature morphism σ : Σ → Σ ′ is defined as the transformation<br />

from the transformable specification SP to the specification SP ′ such that<br />

Sign(SP ) = Σ and Sign(SP ′ ) = Σ ′ . Composition is defined in the obvious<br />

way and the identities are defined such that a signature is mapped to itself.<br />

Recalling the definition <strong>of</strong> the transformation rules, note that for a signature<br />

morphism σ : Σ → Σ ′ , where Σ = 〈A, OP, V 〉 and Σ ′ = 〈A ′ , OP ′ , V ′ 〉:<br />

• A = A ′ , since the abbreviation definitions are the same<br />

• dom OP = dom OP ′ , since the value declarations are transformed<br />

<strong>into</strong> value declarations <strong>of</strong> the same names<br />

• dom V ⊆ dom V ′ , since variables cannot be removed, only added<br />

62

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

Saved successfully!

Ooh no, something went wrong!