合金中的谓词和Int

时间:2012-11-17 16:53:50

标签: alloy

我知道在合金中使用谓词,但我对以下描述感到有些惊讶:

pred locationConstraint(loc: Int -> Int){
    loc in (Int[0] + Int[1] + Int[2] + Int[3] + Int[4] + Int[5] + Int[6]) -> (Int[2] + Int[3])
 + (Int[2] + Int[3]) -> (Int[0] + Int[1] + Int[2] + Int[3] + Int[4] + Int[5])

}

有人可以向我解释一下。

1 个答案:

答案 0 :(得分:0)

run {}添加到模型中,并在评估程序中键入{x,y:Int | locationConstraint[x->y]}以获得结果:

enter image description here