alloy

Model a finite set of integers

早过忘川 提交于 2019-12-11 14:08:33
问题 Below is an Alloy model representing this set of integers: {0, 2, 4, 6} As you know, the plus symbol (+) denotes set union. How can 0 be unioned to 2 ? 0 and 2 are not sets. I thought the union operator applies only to sets? Isn't this violating a basic notion of set union? Second question: Is there a better way to model this, one that is less cognitively jarring? one sig List { numbers: set Int } { numbers = 0 + 2 + 4 + 6 } 回答1: In Alloy, everything you work with is a set of tuples. none is

How to build recursive predicates/functions in Alloy

*爱你&永不变心* 提交于 2019-12-11 11:51:22
问题 I am trying to generate in Alloy two sets of classes, for instance, classes before a refactoring application and classes after a refactoring application. Suppose in the first set we have the following classes: ALeft -> BLeft -> CLeft Class1 Class2 -> Class3 -> Class4 meaning that ALeft is the parent of BLeft which in turn is the parent of CLeft, Class1 and Class2, which in turn is the parent of Class3 and Class4. On the other hand, following the same reasoning, we have in the second set the

run command scope in alloy

依然范特西╮ 提交于 2019-12-11 11:34:19
问题 In alloy consider sig Queue{ link : Queue, elem: Int } consider that I have some predicate predicate-1, How would I define scope when I run predicate-1 for Queue <=1 , int ={-3,-2,0,2}. I have not listed the predicate here run predicate-1 for 1 Queue, int scope here don't know what would be the syntax for int scope 回答1: The syntax is run predicate1 for 1 Queue, 3 Int The scope for integers is always a bitwidth, so you can't specify that the Int set contains exactly {-3. -2. 0. 2}; you can

Is using util/ordering exactly the same as axiomatizing a total order in the usual way?

只愿长相守 提交于 2019-12-11 10:26:13
问题 The util/ordering module contains a comment at the top of the file about the fact that the bound of the module parameter is constrained to have exactly the bound permitted by the scope for the said signature. I have read a few times (here for instance) that it is an optimization that allows to generate a nice symmetry-breaking predicate, which I can grasp. (BTW, with respect to the said post, am I right to infer that the exactly keyword in the module parameter specification is here to enforce

Modelling a vending box using Alloy

馋奶兔 提交于 2019-12-11 07:07:20
问题 I am trying to model a vending machine program using alloy . I wish to create a model in which I could insert some money and provide the machine a selection option for an item and it would provide me the same and in case the money supplied is less then nothing would be provided . Here I am trying to input a coin along with a button as input and it should return the desired item from the vending machine provided the value ie. amount assigned to each item is provided as input. So here button a

How to iterate over solutions using the Alloy API?

喜欢而已 提交于 2019-12-11 02:28:20
问题 I'm using Alloy using its API as explained in Alloy - Generate .xml instance from .als. I want to iterate over all solutions. How to do this? 回答1: In order to iterate over all the satisfiable solutions, you can simply loop over calls of the next() method on your A4Solution object, until the solution obtained is unsatisfiable (check with the satisfiable() method). You will have something like : A4Solution mySolution = TranslateAlloyToKodkod.execute_command(null, model.getAllReachableSigs(),

Multiplicities in ternary relations

假装没事ソ 提交于 2019-12-11 01:47:50
问题 The semantics of the lower-bound multiplicities some and one in ternary relations are hard to grasp. According to Software Abstractions (Rev. ed.) pp.79-80 the relation addr: Book -> (Name -> some Addr) should be equivalent to all b: Book | b.addr in Name -> some Addr (see also p.97). But what does the latter formula exactly mean? My imagination fails here. That's why I did some experiments in the Alloy Analyser 4.1.0. The implication in this model: sig Name, Addr {} sig Book { addr: Name ->

How to evaluate in a given solution a predicate declared in a different model than the one used to generate the aforementionned solution

为君一笑 提交于 2019-12-11 00:57:43
问题 Suppose we have two modules A and B, (A is opened in B) You generate a solution from A, and have some parametrized predicates in B that only reasons about elements of A BUT for some reasons you can't put those predicates in the module A. How to evaluate the predicates declared in B in the solution generated from A ? Here are the following steps I follow to try reaching this goal (unsuccessfully) Generate a solution from A Read this solution using all the reachable signatures of B Parse an

Programming recursive functions in alloy

只愿长相守 提交于 2019-12-11 00:10:13
问题 I am trying to construct a recursive function in Alloy. According to the grammar displayed on Daniel Jackson's book, this is possible. My function is: fun auxiliaryToAvoidCyclicRecursion[idTarget:MethodId, m:Method]: Method{ (m.b.id = idTarget) => { m } else (m.b.id != idTarget) => { (m.b = LiteralValue) => { m } else { some mRet:Method, c:Class | mRet in c.methods && m.b.id = mRet.id => auxiliaryToAvoidCyclicRecursion[idTarget, mRet] } } } But the solver claims about the call

Why do solver options like MiniSat, MiniSat with Unsat Core, Lingeling, Glucose do not appear in my Alloy*/Alloy tool?

元气小坏坏 提交于 2019-12-10 23:16:30
问题 In the tool I downloaded from: http://alloy.mit.edu/alloy/hola/ the only options of solvers that appear are SAT4J and PLingeling. Why do the other options not also appear? I am using Windows and executing the tool by double clicking the file hola-0.2.jar... The same error occurs with the Alloy Tool downloaded from: http://alloy.mit.edu/alloy/download.html However, when i run it in windows 7, solver options such as miniSAT, miniSAT with Unsat Core, ZChaff appear! The solver options available