Python library to convert between AIGER and CNF
Project description
py-aiger-cnf
Python library to convert between AIGER and CNF
Installation
If you just need to use aiger_cnf
, you can just run:
$ pip install py-aiger-cnf
For developers, note that this project uses the poetry python package/dependency management tool. Please familarize yourself with it and then run:
$ poetry install
Usage
The primary entry point for using aiger_cnf
is the aig2cnf
function which, unsurprisingly, maps AIG
objects to CNF
objects.
import aiger
from aiger_cnf import aig2cnf
x, y, z = map(aiger.atom, ('x', 'y', 'z'))
expr = (x & y) | ~z
cnf = aig2cnf(expr)
The CNF
object is a NamedTuple
with the following three fields:
clauses
: A list of tuples of ints, e.g.,[(1,2,3), (-1, 2)]
. Each integer represents a variable's id, with the sign indicating the polarity of the variable.symbol_table
: A bidict from strings to variable ids.max_var
: The maximum (in absolute value) index present inclauses
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-aiger-cnf-0.1.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for py_aiger_cnf-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19d4ba5a9438847c888784d33cae7bed3fae904d49bfa01389bc8f930c1ff8ed |
|
MD5 | d7e3a5bbc2355e3bbbe0631eba6308e6 |
|
BLAKE2b-256 | 268c525fc676cf6f466463156ee5813f45e3fe0968952348a488da9591107402 |