Transformation of Applicative Specifications into Imperative ...

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

26.09.2013 Views

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS end, CheckPreCondOptRestriction( or, func, trans, types) /∗Checks if a map expression contains generators or hidden generators.∗/ /∗ Arguments: ======= me: the map expression Results: ===== Bool: true if the map expression does not contain generators, false otherwise ∗/ CheckPreCondGenMap : MapExpr × FUNC × TRANS × TYPES → Bool CheckPreCondGenMap(me, func, trans, types) ≡ case me of EnumeratedMapExpr(ovel) → case ovel of ValueExprPairList(vel) → CheckPreCondPairList(vel, func, trans, types), NoValueExprPairList → true end, ComprehendedMapExpr(vep, t, or) → CheckPreCondGen(first(vep), func, trans, types) ∧ CheckPreCondGen(second(vep), func, trans, types) ∧ CheckPreCondOptRestriction( or, func, trans, types) end, /∗Checks if an optional restriction contains generators or hidden generators.∗/ /∗ Arguments: ======= or: the optional restriction Results: ===== Bool: true if the optional restriction does not contain generators, false otherwise ∗/ CheckPreCondOptRestriction : 158

C.1. FORMAL SPECIFICATION OF THE TRANSFORMER OptionalRestriction × FUNC × TRANS × TYPES → Bool CheckPreCondOptRestriction(or, func, trans, types) ≡ case or of Restriction(ve) → CheckPreCondGen(ve, func, trans, types), NoRestriction → true end, /∗Checks if a pair list contains generators or hidden generators.∗/ /∗ Arguments: ======= vepl: the pair list Results: ===== Bool: true if the pair list does not contain generators, false otherwise ∗/ CheckPreCondPairList : ValueExprPair ∗ × FUNC × TRANS × TYPES → Bool CheckPreCondPairList(vepl, func, trans, types) ≡ if vepl = 〈〉 then true else CheckPreCondGen(first(hd vepl), func, trans, types) ∧ CheckPreCondGen( second(hd vepl), func, trans, types) ∧ CheckPreCondPairList(tl vepl, func, trans, types) end, /∗Checks if an application expression contains generators or hidden generators.∗/ /∗ Arguments: ======= ve: the application id vel: the arguments of the application expression Results: ===== Bool: true if the application expression does not contain generators, false otherwise ∗/ CheckPreCondApplicationExpr : ValueExpr × ValueExpr ∗ × FUNC × TRANS × TYPES → 159

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />

end,<br />

CheckPreCondOptRestriction(<br />

or, func, trans, types)<br />

/∗Checks if a map expression contains generators<br />

or hidden generators.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

me: the map expression<br />

Results:<br />

=====<br />

Bool: true if the map expression does not contain<br />

generators, false otherwise<br />

∗/<br />

CheckPreCondGenMap :<br />

MapExpr × FUNC × TRANS × TYPES → Bool<br />

CheckPreCondGenMap(me, func, trans, types) ≡<br />

case me <strong>of</strong><br />

EnumeratedMapExpr(ovel) →<br />

case ovel <strong>of</strong><br />

ValueExprPairList(vel) →<br />

CheckPreCondPairList(vel, func, trans, types),<br />

NoValueExprPairList → true<br />

end,<br />

ComprehendedMapExpr(vep, t, or) →<br />

CheckPreCondGen(first(vep), func, trans, types) ∧<br />

CheckPreCondGen(second(vep), func, trans, types) ∧<br />

CheckPreCondOptRestriction(<br />

or, func, trans, types)<br />

end,<br />

/∗Checks if an optional restriction contains generators<br />

or hidden generators.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

or: the optional restriction<br />

Results:<br />

=====<br />

Bool: true if the optional restriction does not<br />

contain generators, false otherwise<br />

∗/<br />

CheckPreCondOptRestriction :<br />

158

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

Saved successfully!

Ooh no, something went wrong!