Performing Analyses on Alloy Models
Loading the Model
When executing commands in an Alloy model, Alloy always uses the current content in the text editor as the model to compile. Therefore, if you made some changes to the model, you do not have to save them before running the model.
Performing an Analysis on Alloy Models
A run command is used to search for solutions that satisfy the specification and a predicate, while a check command is used to search for solutions that satisfy the specification but violate an assertion.
To run either type of analysis, select the command to be run from the run menu, or click the "run" toolbar button.
The run menu will display the list of check and run commands present in the model. You can execute the commands one at a time, or click "run all" to execute them all.
The run toolbar button will executes the most recently executed command. If no command has been executed, it will execute the first command in the model.
The analysis will either terminate with a solution or indicate that one cannot be found within the search space specified by the type scopes of the command. If a solution is found, it can be displayed by clicking on the blue clickable hyperlink in the message panel. Or, if you enable "visualize automatically" in the Options menu, then the solution will be displayed automatically.
Here are some of the common errors that may be encountered:
- Higher-order quantification:
The declaration for
a variable in a quantified formula is higher-order and cannot be reduced via
Solving such formulas will always take
a significant amount of time and memory
unless the scope is very, very small,
since every combination must be enumerated.
Thus, the Alloy Analyzer will not attempt to solve such a formula.
- The module X cannot be found:
The Alloy Analyzer cannot
find the desired model to import in an "open" statement.
on the module finding mechanism used, see the page
on module paths.
- No scope specified for top-level type X in command:
A top level type is one that has no supertype (other than the implicit universal type univ).
All such types must be given a scope for execution, with the following exceptions:
1) The command has no explicit scopes at all -- all top-level types are given an implicit default scope of 3.
2) Type X is defined as "abstract" -- in this case, if all children
of X are scoped, then the scope of X is inferred and need not be set explicitly.
Things that may affect execution speed
Various things may affect the speed of analysis. These include:
- The size of the type scopes specified in the command. The difficulty of the analysis increases with scope in a quicker than linear fashion.
- The SAT solver used. By default, the SAT4J solver is used. However, other solvers may fare better in specific models. The SAT solver may changed by clicking the Options menu.