Questions tagged [alloy]

Alloy from MIT is a declarative specification language for expressing complex structural constraints and behavior in a software system, and a tool for exploring and checking properties of the resulting structures.

Alloy from MIT is a declarative specification language for expressing complex structural constraints and behavior in a software system, and a tool for exploring and checking properties of the resulting structures.

The home page for Alloy is alloy.mit.edu.

Tutorials and documentation

  1. MIT Alloy tutorial page
  2. Official Alloy documentation

Reference books

  1. Software Abstraction by Daniel Jackson
594 questions
3
votes
1 answer

Parsing an expression containing an atom from a String

The method CompUtil.parseOneExpression_fromString gives the following error : The name "Atom$0" cannot be found when the String parsed contains an expression containing the label of an atom directly. This can be understandable as separate atoms…
Loïc Gammaitoni
  • 4,173
  • 16
  • 39
3
votes
1 answer

Alloy constraint specification

I wrote the following code block in Alloy: one h: Human | h in s.start => { s'.currentCall = h.from } I want to pick one 'human' from a set of humans (s.start) and set a variable (s'.currentCall) equal to h.from. However I think this code is…
jvermeulen
  • 505
  • 1
  • 6
  • 14
3
votes
1 answer

eval() is not working properly

I get the following error while trying to evaluate a predicate in a a4solution: Fatal error in /some/path at line 9 column 2: Field "field (A/Attribute <: type)" is not bound to a legal value during translation. Here is the code at the origin…
Loïc Gammaitoni
  • 4,173
  • 16
  • 39
3
votes
1 answer

Programming recursive functions in alloy

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)…
Tarciana
  • 113
  • 10
3
votes
2 answers

express equivalence between several instances

Suppose I have a sig A in my module that is related to a sig B. Imagine now that we have the several instances : A$1 -> B$1 , A$2 -> B$2 and A$1 -> B$2 , A$2 -> B$1 I would like to express that B$1 and B$2 are equivalent (under certain…
Loïc Gammaitoni
  • 4,173
  • 16
  • 39
3
votes
1 answer

Difference Between Function and Predicate In Alloy 4?

I'm having a hard time understanding the difference between predicates and functions in Alloy 4. I've read section 4.5.2 in Software Abstractions but it's still not clear to me. Can someone help me understand?
Union Boss
  • 35
  • 2
3
votes
1 answer

From CompModule to Alloy

Using the Alloy API, it is possible to get from an alloy file a CompModule that contains all the things you need in order to play around with that given alloy module. This is easily achieved using : CompUtil.parseEverything_fromFile(...) My question…
Loïc Gammaitoni
  • 4,173
  • 16
  • 39
3
votes
1 answer

Hiding a field for a subtype in Alloy

Suppose I have the following signature declarations, in Alloy 4.2: sig Target {} abstract sig A { parent: lone A, r: some Target } sig B extends A {} sig C extends A {} When running, the resulting instances would have arrows from every B…
afsantos
  • 5,178
  • 4
  • 30
  • 54
3
votes
1 answer

Modeling random failures in a connected graph in Alloy

Is it possible to model random failures in Alloy? For instance, I currently have a connected graph that is passing data at various time steps to its neighbors. What I am trying to do is figure out some method for allowing the model to randomly kill…
erik
  • 3,810
  • 6
  • 32
  • 63
3
votes
1 answer

Modeling a completely connected graph in Alloy

I'm trying to get my feet wet with Alloy (also relatively new-ish to formal logic as well), and I'm trying to start with a completely connected graph of nodes. sig Node { adj : set Node } fact { adj = ~adj -- symmetrical no iden & adj …
erik
  • 3,810
  • 6
  • 32
  • 63
3
votes
2 answers

Barber Paradox Why is this model inconsistent?

I would like to know why is this model inconsistent? We can have the following tuples in shaves. shaves = {(man,man)} sig Man {shaves: set Man} one sig Barber extends Man {} fact { Barber.shaves = (m:Man |m not in m.shaves} } Barber.shaves…
Qin Zhengquan
  • 467
  • 1
  • 8
  • 20
3
votes
1 answer

Impact of semantics changes of Alloy 4.2 on exercise A.1.6 of the Alloy book?

According to the release notes for Alloy 4.2, there are semantics changes related to integers. These changes seem to have an impact on exercise A.1.6 of the Alloy book. In this exercise, the following code is given as a basis (I added the "Int" at…
Simon Busard
  • 145
  • 1
  • 5
2
votes
1 answer

Why would prime (aka ') raise an error in the following: pred add (b, b': Book, n: Name, a: Addr) { b’.addr = b.addr + n -> a }?

I have Alloy 6.1.0 running on Windows 10 I have "Software Abstractions" text by Daniel Jackson and working through book. I am at the examples in the "Whirlwind Tour" and section 2.2 "Dynamics: Adding Operations". Verbatim from the book I have coded…
2
votes
2 answers

How to sum more than two numbers in Alloy Analyzer?

I am trying to sum all the numbers in a set in Alloy. For instance, in the signature abc, I want the value to be the sum of a.value + b.value + c.value, which is 4+1+3=8. However, if I use "+", it gives me the union set and not the sum. PS. I know…
Griselle Z
  • 127
  • 1
  • 9
2
votes
1 answer

What is the difference between assertions and unparameterized predicates in Alloy?

Is there a difference between an assertion and an unparameterized predicate in Alloy? You can use the "check" command on both unparameterized predicates and assertions to find a counterexample to a given constraint. Are these two constructs…
E. Eid
  • 49
  • 5
1 2
3
39 40