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:

enter image description here

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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -