A BDD-based model checker for CTL (Computational Tree Logic).
You can directly use the model checker by called the Model
class like below:
(Basically this is what the ddctl commandline tool does)
from model import *
m = Model(specfile=args.specfile, ectl_only=args.ectl_only, output=args.output)
print(m.ectlrepr, end=', ')
print(m.check())
# alternatively if you want you can print true or false as well instead of the
# colorized message
print(m.check().status)
$ ./ddctl -h
$ ./ddctl -s <specfile.json> [--ectl-only] [--output <outputfile.png>]
The specification file is a json file with the following structure:
The JSON file should contain the kripke structure and the CTL formula you want to see model checked.
The output will give you
- No RELEASE operator yet
Example Specfile:
{
"states" : ["a", "b", "c"],
"init" : ["a"],
"T" : {
"a" : ["b", "c"],
"b" : ["c"],
"c" : ["a"]
},
"ap" : {
"a" : ["p", "q"],
"b" : ["q"]
},
"ctlf" : "(AG p) -> AF !q"
}
- Note: labels are atomic propositions
- Graphviz (for visualization)
- PyDD - CuDD Python Binding (for BDDs)
- PLY - Python Lex-Yacc (for parsing)
If you don't have graphviz installed, you can install it with:
$ sudo apt-get install graphviz
Install python bindings:
pip3 install graphviz
The project internally usescudd
python bindings called PyDD
for BDDs. The tar file for both cudd
and PyDD
are included in the lib
folder. To build the project, you need to have python3
, cython
and python3-dev
installed.
- To get cython, run
pip3 install cython
- To get python3-dev, run
sudo apt-get install python3-dev
- we need this to build the
PyDD
library (it requires thepython3-dev
headers)
- we need this to build the
- To build Cudd,
- Go to the lib directory
- Run
tar -xvf cudd-3.1.0.tar.gz
- Go to the cudd directory
- Run
./configure --enable-dddmp --enable-obj --enable-shared
- If you want to build a static library, remove the
--enable-shared
flag. - You can also change the installation directory by adding
--prefix=/path/to/install/dir
to the configure command.
- If you want to build a static library, remove the
- Run
make
- If you want to verify that the library is built correctly, run
make check
(but this is optional)
- If you want to verify that the library is built correctly, run
- Run
make install
- You should see that the cudd library is installed in the directory specified by the
--prefix
flag, or in/usr/local/lib
if you didn't specify a prefix.- I would recommend that you install it in
/usr
or/usr/local
so that you don't have to add the library to yourLD_LIBRARY_PATH
environment variable.
- I would recommend that you install it in
- To build PyDD,
- Go to the lib directory
- Run
tar -xvf PyDD-0.2.0.tar.gz
- Go to the PyDD directory
- Run
python3 setup.py build
- Run
python3 setup.py install
- You can verify this by opening your python interpreter and running
import cudd
- Once you have these installed, running the
ddctl
command as mentioned above in theUsage
section should work.