py-aiger-dfa
Python library for converting between AIG circuits and DFAs.
Table of Contents
Installation
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
Usage
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.
DFA to AIG
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(
start=0,
inputs={0, 1},
label=lambda s: (s % 4) == 3,
transition=lambda s, c: (s + c) % 4,
)
my_aig, relabels, valid = 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': .. , # Mapping from input alphabet -> py-aiger input.
'outputs': .. , # Mapping from py-aiger output -> output alphabet.
'states': .. , # Mapping from state space -> py-aiger latches.
}
Finally, valid is another aiger circuit which tests if all inputs
are 1-hot encoded.
AIG to DFA
We also support converting a sequential circuit (AIG) to a Moore
Machine (DFA) using
aig2dfa. Using the same example:
from aiger_dfa import aig2dfa
my_dfa2 = aig2dfa(my_aig, relabels=relabels)
Note that the output of a sequential circuit (AIG) is dependent on the state AND the action (a Mealy Machine).
We use the standard Mealy ↦ Moore reduction where one introduces a
1-step delay on the output. The default initial output is None, but
can be set using the initial_label argument.
Metadata
Release files for py-aiger-dfa 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_aiger_dfa-0.4.4.tar.gz | 6.5 kB | Without provenance | Details for py_aiger_dfa-0.4.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_aiger_dfa-0.4.4-py3-none-any.whl | Python 3 | none | any | Details for py_aiger_dfa-0.4.4-py3-none-any.whl |
Total release size: 14.5 kB
Release files / py_aiger_dfa-0.4.4.tar.gz
| Download URL | py_aiger_dfa-0.4.4.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b83f42ccad739c75129b34951f3031de681a3e224291566af06c16c92ee378ca
|
|
BLAKE2b-256 checksum How to use checksums |
298d8aea163ac11cd2961938392cd37135a9dc1a9a89b5e17adaa4618545743e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.8 Linux/6.6.31
|
Release files / py_aiger_dfa-0.4.4-py3-none-any.whl
| Download URL | py_aiger_dfa-0.4.4-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0020ef5562592337ef8ab5a6070b5ef66b63391fdac812c49c20f90014578264
|
|
BLAKE2b-256 checksum How to use checksums |
0b92b16e854fdfee173477d55ad350343a4c86bd1ac3fd9717097e6fe80cfdb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.8 Linux/6.6.31
|
Security for py-aiger-dfa 0.4.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.