OCL 语句中 if-then 和 imply 的等价性

Equivalence of if-then and implies in OCL statements

对于某些函数上下文,以下两个 OCL 语句是否等效?

post: if a > 0 then b < c

post: b < c implies a > 0

没有

在 OCL 中,结构是 if ... then ... else ... endif 所以你的第一个例子只能是 'equivalent' 到不同的语法错误。

逻辑操作可使用 if 结构重写,但需要相当小心以确保具有空或无效输入的可能性不会使 if 条件项崩溃,该条件项必须是 2-价值 Boolean.