0

How does one compare the equality of functions in Alloy? Something like:

--[(All x)(Exists y)[R(x,y)] 
-- and (All x)(All y)[R(x,y) -> R(y,x)]] 
-- = 
-- (All x)[R(x,x)] and 

assert checkEquality{
    ( all m: Model, x:m.A| some y:m.A | (y in x.(m.R)) ) and
    ( all m: Model, x:m.A, y:m.A | (y in x.(m.R) -> x in y.(m.R)) ) =
    ( all m: Model, x:m.A | (x in x.(m.R))
}
4

1 回答 1

0

这是一个初级版本。通过 '(All x)(All y)[R(x,y) -> R(y,x)]]' 部分猜测,您可能已经想到了一些更特别的东西;在这种情况下,请进一步说明您的问题。

sig Value {}

pred p1 [x, y: Value] {
    // ...
}

pred p2 [x, y: Value] {
    // ...    
}

assert equ_pred {
    all x, y: Value | p1 [x, y] <=> p2 [x, y]
}

check equ_pred
于 2016-06-13T16:17:43.323 回答