On Redundancy in Alloy Models
Authors/Creators
Description
On Redundancy in Alloy Models
This artifact accompanies the paper On Redundancy in Alloy Models.
It contains the source code of our custom Alloy Analyzer with redundancy analysis, the dataset of Alloy models used in our experiments, and all scripts to reproduce the results presented in the paper.
The artifact can be downloaded from Zenodo: https://doi.org/10.5281/zenodo.21333886
It has the following structure:
├── alloy-redundancy.tar # Docker image
├── alloy-redundancy.zip # Source code archive
├── Dockerfile # Dockerfile to build the image
├── LICENSE # License file
├── org.alloytools.alloy.dist.jar # Customized Alloy Analyzer
├── paper.pdf # Copy of the accepted paper
├── README.md
├── REQUIREMENTS.md
└── STATUS.md
Setup
Docker (recommended)
Load the image:
docker load -i alloy-redundancy.tar
- Run the container for your architecture:
docker run --rm --name alloy-redundancy -it alloy-redundancy
This gives you an interactive shell with all tools ready to use. The dataset and pre-computed results are available in the container at /alloy-redundancy/analysis/ for quick access.
Manual Setup
If you prefer to set up the environment manually, follow these steps:
-
Install the pre-requisites:
- Java 17
- Python 3.13 with poetry
-
Extract the
alloy-redundancy.ziparchive.
unzip alloy-redundancy.zip
- Build the project using Gradle:
cd alloy-redundancy
./gradlew clean build -x test
For Windows, use gradlew.bat instead of ./gradlew.
The built JAR file for the custom Alloy Analyzer will be located at org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar. You can run it with:
java -jar org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar
- To set up the Python environment for the analysis scripts, use poetry:
cd alloy-redundancy
poetry install
Alternatively, you can also build the docker image yourself using the provided Dockerfile:
docker build -t alloy-redundancy .
And then run the container as described above (Docker (recommended)).
Usage
Checking Redundancy via Custom Alloy Analyzer
The pre-built custom Alloy Analyzer with redundancy analysis is included as org.alloytools.alloy.dist.jar. You can use it or build it yourself using the instructions above.
NOTE: Run from the host machine, NOT inside the Docker container.
- Copy the JAR to your local machine:
docker cp alloy-redundancy:/alloy-redundancy/org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar .
- Run the jar file:
java -jar org.alloytools.alloy.dist.jar
It will open the Alloy GUI. You can load any .als file and use the new "Redundancy" and "Exp. Red." buttons to analyze your model. You need to SAVE the model before running the analysis.
Smoke Test (Quick Run)
[!WARNING]
Running the smoke test will overwrite the existing CSV files inanalysis/results/csv/with new results. If you want to preserve our results, consider copying theresultsdirectory before running the smoke test.
# Optional
docker cp alloy-redundancy:/alloy-redundancy/analysis/results/ ./results
smokeTest.sh runs the entire pipeline on only 5 files per step, verifying that all scripts work correctly:
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/smokeTest.sh
Full Pipeline
[!WARNING]
The full benchmark runs on the entire dataset and may take couple of weeks depending on your hardware. Each script applies a 10-minute timeout per file.
If you want to run the full pipeline on a subset of the dataset, you can use the --max argument in the smokeTest.sh script to limit the number of alloy models processed. For example:
# Run from /alloy-redundancy (Docker container)
# For 100 models, run:
./analysis/scripts/smokeTest.sh --max 100
All scripts live in analysis/scripts/ and must be run from /alloy-redundancy. Each script accepts two optional arguments:
| Option | Default | Description |
|---|---|---|
--dataset |
analysis/dataset/ |
Path to the dataset directory |
--max |
0 (all files) |
Maximum number of files to process |
Output CSVs are written to analysis/results/csv/.
- Collect Model Metadata:
modelStats.shcomputes structural metrics for every.alsfile: lines of code, number of signatures, facts, flat facts, and commands.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/modelStats.sh
Output: analysis/results/csv/modelStats.csv
- Detect Global Redundancy:
checkGlobal.shfinds constraints that are redundant across all commands in a model.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/checkGlobal.sh
Output: analysis/results/csv/checkGlobal.csv
- Detect Local Redundancy:
checkLocal.shfinds constraints that are redundant within each individual command.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/checkLocal.sh
Output: analysis/results/csv/checkLocal.csv
- Check SAT/UNSAT Status:
checkUnsat.shruns each command in every model and records whether the result isSATorUNSAT.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/checkUnsat.sh
Output: analysis/results/csv/checkUnsat.csv
- Filter Higher-Order Failures:
checkHigherOrderFail.shidentifies models that cannot be analyzed due to higher-order quantification that Alloy cannot skolemize.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/checkHigherOrderFail.sh
Output: analysis/results/csv/higherOrderFail.csv
- Compute Maximal Redundant Set (Global):
maxRedSetGlobal.shcomputes the largest set of constraints that are jointly redundant, considering all commands globally.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/maxRedSetGlobal.sh
Output: analysis/results/csv/maxRedSetGlobal.csv
- Compute Maximal Redundant Set (Local):
maxRedSetLocal.shcomputes the maximal redundant set per command.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/maxRedSetLocal.sh
Output: analysis/results/csv/maxRedSetLocal.csv
- Explain Redundancy (SAT4J):
explainGlobal.shreadsmaxRedSetGlobal.csvand uses DDMin with SAT4J to find a minimal explanation for each globally redundant constraint.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/explainGlobal.sh
Output: analysis/results/csv/explainGlobal.csv
- Explain Redundancy (MiniSat Native):
explainNativeGlobal.shperforms the same explanation task as Step 8, but uses MiniSat with UNSAT core extraction.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/explainNativeGlobal.sh
Output: analysis/results/csv/explainNativeGlobal.csv
- Measure Solving Overhead:
checkOverhead.shreadsmaxRedSetLocal.csvand compares solving time and SAT variable counts with and without redundant constraints.
# Run from /alloy-redundancy (Docker container)
./analysis/scripts/checkOverhead.sh
Output: analysis/results/csv/checkOverhead.csv
- Generate Paper Figures and Tables:
paper.pyreads all result CSVs and produces the tables, statistics, and figures used in the paper.
# Run from /alloy-redundancy (Docker container)
python ./analysis/scripts/paper.py
Output figures are saved to analysis/results/figures/ and the tables are shown in the terminal:
| Figure | File | Content |
|---|---|---|
| Maximal redundant set sizes | maxRedSet-Sizes.pdf |
Figure 2 |
| Constraint lengths | maxRedSet-len.pdf |
Figure 3 |
| Explanation sizes | expl-sizes.pdf |
Figure 4 |
| Explanation lengths | expl-len.pdf |
Figure 5 |
Files
alloy-redundancy.zip
Files
(1.1 GB)
| Name | Size | |
|---|---|---|
|
md5:89b8a8a6f86efff89756b3561b147eac
|
959.8 MB | Download |
|
md5:74ac2c80301ef901dddbc0a0dc24b567
|
140.5 MB | Preview Download |
|
md5:dd42d142dcea45846645ae7a7218cb4f
|
7.4 kB | Preview Download |
|
md5:e8ddca02b5dbb35200848406323bb82e
|
215.9 kB | Preview Download |
|
md5:bd8d24e98554f9c815ac55b9687eee2f
|
1.1 kB | Download |
|
md5:a1aac49e927fe4203ade9a54fd2d1dec
|
21.1 MB | Download |
|
md5:f360d48ef3729f27da790b582f82eb11
|
1.2 MB | Preview Download |
|
md5:6c2e49f0115784066ebe0765100b3031
|
12.9 kB | Preview Download |
|
md5:3ffc3f18fa02ae47bd6ec30de06b939e
|
315.2 kB | Preview Download |
|
md5:49638f5a582af572c60ce703ba7a298e
|
2.4 kB | Preview Download |
|
md5:e35b1a916611af25cc852c798589e5ec
|
160.1 kB | Preview Download |
|
md5:5c35fae45aecdba57020e9d6c86987c2
|
1.9 kB | Preview Download |
|
md5:f67b08319b00d8922b927df48ef86007
|
53.2 kB | Preview Download |
Additional details
Software
- Repository URL
- https://github.com/se-buw/alloy-redundancy
- Programming language
- Java