Purpose: practice writing expression using the Alloy logic
This is a team homework assignment. All work must be done by the team members together. All team members should understand all work submitted. If you have concerns about your own understanding or that of your teammates, please let me know. I want everyone to learn all they can in this course!
Do exercise A.1.4 in Appendix A of the text. Some extra guidance:
In Alloy 4, type scopes don’t limit the number of Int instances. To be able to create smaller counterexamples, use the following template model rather than that provided in the text:
// Problem A.1.4
module homework/hw3_1
sig Thing {}
assert union {
all s: set Thing, p, q: Thing->Thing |
s.(p+q) = s.p + s.q
}
check union for 4
s, p, and q. (You can read these from the picture in the visualizer if you reduce the scope enough.)
Do problem A.1.5 in Appendix A of the text. Again, some extra guidance:
Use the following template model rather than that provided in the text:
// Problem A.1.5
module homework/hw3_2
sig Node {}
pred isTree[r: Node -> Node] {
...
}
run isTree for 4
// Problem A.1.10
module homework/hw3_3
abstract sig Name {
address: set Addr + Name
}
sig Alias, Group extends Name {}
sig Addr {}
// invariants
fact {
// Put your answers to a and b here, plus the
// additional invariant noted below.
}
// simulation constraints
pred show[] {
// Put your answers to c and d here.
// You may want to add additional constraints to make
// the generated instances more interesting.
}
run show for 3 but 6 Name
address relation) eventually map to an address.”