alloy - Unexpected results in playing with relations -
/* sig { } sig b { } */ pred rel_test(r : univ -> univ) { # r = 1 } run { r : univ -> univ { rel_test [r] } } 2
running small test, $r contains 1 element in every generated instance. when sig a , sig b uncommented, however, first instance this:
in explanation, $r has 9 tuples here , still, predicate asks 1 tuple relation succeeds. wrong?
an auxiliary question: these 2 declarations equivalent?
pred rel_test(r : univ -> univ) pred rel_test(r : set univ -> univ)
the problem forbid overflow option set no integer semantics in alloy wrap around, , default scope of 3 (bits), indeed 9=1, can confirm in evaluator.
with signatures , b commented biggest relation can generated scope 2 has 4 tuples (since max size of univ 2), problem not occur.
it not occur in latest build because believe comes forbid overflow option set yes default, , option semantics of integers rules out instances overflows occur, precisely case when compute size of relation 9 tuples. more details alternative integer semantics can found in paper "preventing arithmetic overflows in alloy" aleksandar milicevic , daniel jackson.
Comments
Post a Comment