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.

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />

CheckTypeExpr(type_expr(c), typings, func, trans),<br />

/∗Checks for transformability <strong>of</strong> a type expression.<br />

∗/<br />

/∗<br />

Arguments:<br />

=======<br />

te: the type expression<br />

Results:<br />

=====<br />

Bool: true if the type expression is transformable,<br />

false otherwise<br />

∗/<br />

CheckTypeExpr :<br />

TypeExpr × TYPINGS × FUNC × TRANS → Bool<br />

CheckTypeExpr(te, typings, func, trans) ≡<br />

case te <strong>of</strong><br />

TypeLiteral(tn) → true,<br />

TypeName(tn) → true,<br />

TypeExprProduct(tep) →<br />

CheckTypeExprList(tep, typings, func, trans),<br />

TypeExprSet(tes) →<br />

case tes <strong>of</strong><br />

FiniteSetTypeExpr(fse) →<br />

∼ containsTRANSName(<br />

Known(fse), typings, dom trans),<br />

InfiniteSetTypeExpr(ise) →<br />

∼ containsTRANSName(<br />

Known(ise), typings, dom trans)<br />

end,<br />

TypeExprList(les) →<br />

case les <strong>of</strong><br />

FiniteListTypeExpr(fle) →<br />

∼ containsTRANSName(<br />

Known(fle), typings, dom trans),<br />

InfiniteListTypeExpr(ile) →<br />

∼ containsTRANSName(<br />

Known(ile), typings, dom trans)<br />

end,<br />

TypeExprMap(tem) →<br />

case tem <strong>of</strong><br />

FiniteMapTypeExpr(tedom, terange) →<br />

∼ (containsTRANSName(<br />

Known(tedom), typings, dom trans) ∨<br />

150

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

Saved successfully!

Ooh no, something went wrong!