Are the following two OCL statements equivalent for some function context?
post: if a > 0 then b < c
post: b < c implies a > 0
No.
In OCL, the construct is if
... then
... else
... endif
so your first example can only be 'equivalent' to a different syntax error.
The logical operations are rewritable using if
constructs, but considerable care is necessary to ensure that the possibilities with null or invalid inputs do not crash the if
condition term which must be a 2-valued Boolean
.