Equivalence of if-then and implies in OCL statements

557 Views Asked by At

Are the following two OCL statements equivalent for some function context?

post: if a > 0 then b < c

post: b < c implies a > 0

1

There are 1 best solutions below

2
Ed Willink On BEST ANSWER

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.