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 />

end,<br />

end<br />

typings, func, trans, env, types),<br />

(b3, env ′′ , types ′′ ) =<br />

CheckValueExpr(<br />

ve, Known(type_expr(res)), typings,<br />

func, trans, env, types ′ ) in<br />

b1 ∧ b2 ∧ b3 ∧<br />

CheckTypeExpr(arg, typings, func, trans) ∧<br />

CheckTypeExpr(<br />

type_expr(res), typings, func, trans)<br />

end<br />

/∗Checks for transformability <strong>of</strong> a pre condition.<br />

∗/<br />

/∗<br />

Arguments:<br />

=======<br />

precond: the pre condition<br />

et: the expected type <strong>of</strong> the value expression<br />

Results:<br />

=====<br />

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

false otherwise<br />

∗/<br />

CheckOptPreCondition :<br />

OptionalPreCondition × ExpType × TYPINGS ×<br />

FUNC × TRANS × ENV × TYPES →<br />

Bool × ENV × TYPES<br />

CheckOptPreCondition(<br />

precond, et, typings, func, trans, env, types) ≡<br />

case precond <strong>of</strong><br />

PreCondition(ve) →<br />

let<br />

(b, env ′ , types ′ ) =<br />

CheckValueExpr(<br />

ve, et, typings, func, trans, env, types)<br />

in<br />

(b ∧ CheckPreCondGen(ve, func, trans, types),<br />

env ′ , types ′ )<br />

end,<br />

NoPreCondition → (true, env, types)<br />

end,<br />

154

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

Saved successfully!

Ooh no, something went wrong!