Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alloy built-in integer math functions don't work in imported files

Tags:

alloy

I have an alloy model in avlTree.als. This model uses integer arithmetic, specifically the plus and minus functions. This model has some assertions in it, and I can run those just fine using the Alloy Analyzer GUI.

I have another alloy model in test.als. This model imports avlTree (using "open avlTree") and then has some assertions about the relations in the avlTree model. But when I try to run these assertions in the Alloy Analyzer GUI, I get the following message:

A syntax error has occurred:

The name "plus" cannot be found.

And the link to the syntax error takes me to my avlTree model. So it seems that the avlTree model's use of integer math works fine when I run that model by itself, but it breaks when I try to import it into another model. Is there a fix for this?

I am running Alloy 4.2.

like image 982
SethQ Avatar asked Oct 07 '22 13:10

SethQ


1 Answers

Yes, that is a bug, but there is a quick workaround, which is to explicitly open the integer module, by writing

open util/integer

at the beginning of your avlTree.als file. After that, you'll be able to open avlTree and check its assertions from other modules.

like image 136
Aleksandar Milicevic Avatar answered Oct 09 '22 01:10

Aleksandar Milicevic