Can UML with OCL be used for formal specifications?
I am asking because UML is used for informal specifications and has some ambiguities in its semantics. However, OCL can be used to define pre / post conditions and invariants and other constraints quite efficiently.
I recently came across Z-notation and algebraic specifications. My question is, is the combination of UML and OCL sufficient for formal specifications?
a source to share
Yes, for most systems you can build.
I mean, UML and OCL are only semiformal languages (their syntax is well defined, but their semantics are only partially formalized, many aspects are simply described in natural language in standard document specifications). So if you are building a critical system and you need to prove the system is correct, then UML / OCL may be short, but for many other types of systems, the formality that UML / OCL can provide is good enough.
a source to share