# 1 Strictly Composite Numbers - Alloy A number c is said to be strictly ```1 Strictly Composite Numbers - Alloy A number c is said to be strictly
composite if 1 &lt; r &lt; c and gcd(c, r) = 1 implies r is prime. Create an Alloy
model that capture the concepts of prime, composite and strictly composite. Use
this model to demonstrate that 30 is stringly composite, while 45 is not. Use
meta–programming to test all numbers less than a command line parameter and
tabulate the results.
2 Strictly Composite Numbers - Isabelle Use Isabelle to implement
prime, composite, and strictly composite. Prove that there are only finitely
many strictly composite numbers. Find the largest strictly composite number
and prove that it has that property.
3 Hamiltonian Path Create an Alloy model of a graph that captures the
concepts of node, edge, path, and directness. Devise a series of Alloy assertions
to test that your model is internally consistent. For example, if you allow
multipe edges connecting the same (from,to) pair, how does the behavior of
the model difer from the case where at most one edge can exist between any
(from,to) pair?
Formulate the concepts of is connected and has a Hamiltonian path. Encode the Königsburg bridge problem (shown below) using Alloy initializers and
demonstrate that it is connected, but does not have any Hamiltonian path. Create the smallest possible modification to the Königsburg bridge problem such
that the modifier version is connected and has a Hamiltonian path.
Figure 1: The Königsburg bridge problem
1
4 Dijkstra Ordering
ment in Isabelle.
Extract dijkstra.als from the Alloy jar file. Reimple-
5 Process Priorities - Alloy Implement an Alloy model that has a numerical priority value for each process (for example, starting from dijkstra.als).
Create a test for priority inversion, and create two examples: one that displays
priority inversion, and one that does not. Choose any of the standard tactics for
preventing priority inversion, and demonstrate that the bad behavior of your
first example has been corrected.
6 Process Priorities - Isabelle
Implement project 5 using Isabelle.
7 Probabilistic Programming in Alloy Implement an Alloy model of a
directed graph that captures the concepts of node, edge, path and predecessors.
Consider the graph shown below.
Figure 2: A State Machine in Alloy
Observe that the ABD nodes occurs in 0.6 of all paths terminating at D,
2
while the ACD nodes occurs in 0.4 of all such paths. Write Alloy initializers to
represent this graph.
Given a set of probabilities pi with
N
X
= 1.0
i=1
create a meta–program that accepts the pi as command line parameters and
creates a set of Alloy initializes with that probability distribution. Make a
simplifying assumption about the pi so that the resulting Alloy initializer list is
reasonably compact.
3
```