假设有一个方法接受两个参数 balance 和 price,它只执行以下操作:
if(price < balance) {
balance = balance - price;
}
我觉得有两种可能的方法可以用三元组来写这个:
(| price=p0 ^ balance = b0 |) buy (| ((p0 < balance) => balance = b0 - p0) v ((p0 >= balance) => balance = b0) |)
或者
(| price=p0 ^ balance = b0 |) buy (| ((p0 < balance) ^ (balance = b0-p0)) v ((p0 >= balance) ^ (balance = b0))
(=> 是暗示)我想知道哪个是正确的?或者两者都是正确的?