A Formal Approach to Specification, Analysis and Implementation of