在书上实现问题A.3.6时,我需要表达以下条件:
After putting on a glove, for the hand that the glove is on something happens while for gloves on the other hand should stay the same.
由于手套和手套的结构相同,我如何在不指定手套右手和手套左手的情况下整齐地表达条件。
我的代码在这里:https://github.com/huanhulan/alloy-exercises/blob/master/book/appendixA/gloves.als#L137
一种选择是将公式写在谓词中,然后传入实例化之间不同的部分(在这种情况下,leftHand和rightHand绑定到该关系)。