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 graphvizInstall python bindings:
pip3 install graphvizThe 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
PyDDlibrary (it requires thepython3-devheaders)
- 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-sharedflag. - You can also change the installation directory by adding
--prefix=/path/to/install/dirto 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
--prefixflag, or in/usr/local/libif you didn't specify a prefix.- I would recommend that you install it in
/usror/usr/localso that you don't have to add the library to yourLD_LIBRARY_PATHenvironment 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
ddctlcommand as mentioned above in theUsagesection should work.