Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Library for moving between sequential circuits AIGs and DFAs.

Project description


Python library for converting between AIG circuits and DFAs.

Build Status codecov PyPI version License: MIT

Table of Contents


If you just need to use aiger_dfa, you can just run:

$ pip install py-aiger-dfa

For developers, note that this project uses the poetry python package/dependency management tool. Please familarize yourself with it and then run:

$ poetry install


The main entry points for using this library are the dfa2aig and aig2dfa functions. DFAs are represented using the dfa package. Familiarity with the dfa, py-aiger, and py-aiger-bv packages is assumed.


An example of going from a DFA to an AIG object is shown below.

from dfa import DFA
from aiger_dfa import dfa2aig

my_dfa = DFA(
    inputs={0, 1},
    label=lambda s: (s % 4) == 3,
    transition=lambda s, c: (s + c) % 4,
my_aig, relabels = dfa2aig(my_dfa)

Now circ is an AIG and relabels is a mapping from the inputs, states, and outputs of my_dfa to their 1-hot encoded counterparts in my_aig.

relabels has the following schema:

relabels = {
    'inputs': .. , # Bidict from 1-hot index to dfa input.
    'outputs': .. , # Bidict from 1-hot index to dfa output.
    'states': .. , # Bidict from 1-hot index to dfa state.

where bidict refers to


The inverse of dfa2aig is aig2dfa. Using the same example.

from aiger_dfa import aig2dfa

my_dfa2 = aig2dfa(my_aig, relabels=relabels)

assert my_dfa2.label((1,0,0,1,1,0)) == my_dfa.label((1,0,0,1,1,0))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-aiger-dfa, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size py_aiger_dfa-0.1.2-py3-none-any.whl (5.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size py-aiger-dfa-0.1.2.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page