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

放肆的年华 提交于 2019-12-22 06:56:30

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!