问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/12573298/alloy-built-in-integer-math-functions-dont-work-in-imported-files