Skip to content
A model checker for safe Petri nets based on partial-order semantics
C++ Python C Shell Perl Perl 6 Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Cunf: An Unfolder for Contextual Nets

Cunf is a set of research tools to carrying out unfolding-based formal verification of Petri nets extended with read arcs, also called contextual nets, or c-nets. The package specifically contains the tools:

  • cunf: constructs the unfolding of a c-net;
  • cna: performs reachability and deadlock analysis using unfoldings constructed by cunf;
  • Scripts such as pep2dot or grml2pep to do format conversion between various Petri net formats, unfolding formats, etc.
  • ptnet: a small Python module (see scripts/ptnet/) suitable to programmatically generate and manage Petri net models.



To run cna you will need to have the minisat SAT solver in the $PATH (download it here). Compiling the source code will just require make and a C/C++11-compatible compiler. Building the documentation requires latex.

From Precompiled Binaries (includes examples)

Please check the latest release to find a .tar.gz file with precompiled binaries (currently only available for Linux x86_64).

  1. Download the .tar.gz file and uncompress it.
  2. All binaries are in the bin/, you can directly invoke them from there.
  3. You may move the cunf binary elsewhere in your system, but do not move the cna binary as it locates a necessary Python package using a relative path from the bin folder.

From Source Code

Please note that development takes place in the master branch of this repository. If you want a stable version of the tool you should download and compile the sources of the latest release available.

  1. Download and uncompress the source code (in this case for Cunf v1.6.1):

    cd cunf-1.6.1
  2. Compile the source code:

    make all
    make dist

    This will put all binaries and libraries into the dist/ folder, from where you may directly run them or copy them to suitable locations in your machine.

  3. In particular, make available to Python the module in:


    by copying it to any folder pointed by your installation-dependent default module search path, or any folder pointed by the environment variable PYTHONPATH. The tool cna and other Python scripts won't work without this step.


The Cunf user's manual (available with the latest release) contains all documentation available, including a guided tutorial of the tool.


Cunf implements the contextual net unfolding algorithm proposed by Baldan et al. in [BCKS08]. The algorithms and data structures actually implemented have been partially described in [RSB11], [BBCKRS12]. Cunf can only unfold 1-safe c-nets (i.e., no reachable marking puts more than one token on every place), and for the time being the tool will blindly assume the input is 1-safe.

Cna, whose name stands for Contextual Net Analyzer, checks for place coverability or deadlock-freedom of a c-net by examining its unfolding. The tool reduces these problems to the satisfiability of a propositional formula that it generates out of the unfolding, and uses Minisat as a back-end to solve the formula. The algorithms used by Cna has been described in [RS12].

[BBCKRS12]Paolo Baldan, Alessandro Bruni, Andrea Corradini, Barbara König, César Rodríguez, and Stefan Schwoon. Efficient Unfolding of Contextual Petri Nets. Theoretical Computer Science 449, 2 – 22 (2012).
[BCKS08]Paolo Baldan, Andrea Corradini, Barbara König, and Stefan Schwoon. McMillan's Complete Prefix for Contextual Nets. In Transactions on Petri Nets and Other Models of Concurrency I, p. 199-220, 2008. Springer-Verlag.
[RSB11]César Rodríguez, Stefan Schwoon, and Paolo Baldan. Efficient contextual unfolding. In Proc. of CONCUR'11, volume 6901 of LNCS. Springer, 2011.
[RS12]César Rodríguez and Stefan Schwoon. Verification of Petri Nets with Read Arcs. In Proc. of CONCUR'12, vol. 7454 of LNCS, pages 471–485, September 2012.

Related Tools

  • Stefan Schwoon's Mole unfolder.
  • Victor Khomenko's Punf unfolder.
  • The PEP homepage.
  • DPU, an unfolder for multithreaded C programs.

Author and Contact

The Cunf Tool is developed and maintained by César Rodríguez. Please feel free to contact me with questions or to send feedback.

You can’t perform that action at this time.