A New Tool for Boolean Circuit Analysis and Synthesis.
Project description
Cirbo: A New Tool for Boolean Circuit Analysis and Synthesis
Cirbo is a Python library that provides methods for Boolean circuit manipulation, analysis, and synthesis
Usage example
from cirbo.core import Circuit, Gate, gate
from cirbo.synthesis.generation.arithmetics import add_sum_n_bits
# Create an empty circuit with 6 inputs.
ckt = Circuit.bare_circuit(input_size=6)
# Generate and connect a "gadget" subcircuit
# that computes the sum of the input bits.
b0, b1, b2 = add_sum_n_bits(ckt, ckt.inputs)
# Manually add output gate that yield True only
# if at least half of the inputs are True.
ckt.add_gate(Gate('a0', gate.AND, (b0, b1)))
ckt.add_gate(Gate('a1', gate.OR, ('a0', b2)))
ckt.mark_as_output('a1')
# Calculate general boolean function properties.
print(f"Is monotone: {ckt.is_monotone()}")
print(f"Is symmetric: {ckt.is_symmetric()}")
print(f"Is constant: {ckt.is_constant()}")
# Draw the graph and show the image in the default viewer.
ckt.view_graph()
More examples are available in the tutorial.
Installation
The package is currently available on Test PyPI and will be published on PyPI after testing.
To install the package from Test PyPI into your virtual environment, run:
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ cirbo
Instructions on how to set up the development environment are provided in the separate dev README.
Documentation
The main library features are described in the paper "Cirbo: A New Tool for Boolean Circuit Analysis and Synthesis" (arXiv, AAAI-25).
Currently, cirbo does not have web-hosted documentation, but it can be built locally using Sphinx (see the dev README for details).
Package structure
Some features of the package are demonstrated in the example modules located in
the tutorial/ directory. Similar code snippets are used in the paper's listings.
This is probably the first place to explore after environment is set up.
The cirbo/ directory is the root of the Python package and contains the following subpackages:
core— provides core classes and structures:- core abstractions for Boolean functions: the
Functionprotocol to represent any Boolean function and theFunctionModelprotocol to represent partially defined Boolean functions. - data structures for representing Boolean functions (
TruthTable,PyFunctionandCircuit) - the
Circuitclass along with circuit manipulation operations.
- core abstractions for Boolean functions: the
synthesis— provides tools for circuit synthesis:- methods to synthesize new circuit either by providing model of a function (e.g. truth table with don't care values) and then formulating and solving a SAT problem of finding feasible circuit.
- methods to generate circuits describing arithmetic and logical operations
(e.g.
generate_sum_n_bitsandgenerate_if_then_else) or to add such gadgets to an existing circuit.
minimization— provides methods to minimize circuits:- lightweight circuit minimization algorithms (e.g. cleaning redundant gates, merging unary operators, merging duplicates, brute-force search for equivalent gates).
- heavyweight circuit minimization that tries to simplify small subcircuits within original circuit.
sat— provides tools related to SAT solving:- a method to build a miter from two given circuits.
- a method to reduce of circuit satisfiability to SAT using Tseytin transformation.
- a method to call SAT solvers using pysat toolkit.
circuits_db— provides methods to manage (read and write) database of (nearly) optimal small circuits. It can be useful for searching for a circuit with a given (partially defined) truth table or for optimizing an existing circuit.
Note: most public methods have docstrings, which are useful when exploring
cirbo.
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cirbo-1.0.0-cp313-cp313-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 16.9 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f62774e97019db7a6b7238067b17b923fe5719cafa90904db7556a049040cfb3
|
|
| MD5 |
4598d6596d4f2311af305bf43a3a276f
|
|
| BLAKE2b-256 |
629ad24b0f51ee867f2b15c3f02ea68733ee35b93e1c4901b0e20d79dfe94b98
|
File details
Details for the file cirbo-1.0.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 15.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8643a7e1f1d06ee754d15593605f5dfacf263deb92ee766b0004c23b61a8d8cd
|
|
| MD5 |
dd4948bf89e4661afdd9acb126a81f76
|
|
| BLAKE2b-256 |
ce30c82656f5e2adf96613dafaf41551ae7358f4887d3b8f439d998c2beed763
|
File details
Details for the file cirbo-1.0.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.4 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66b27c9af88a255433bc9b15450c05f0352c784f74faaf1c160589e1edd0d99e
|
|
| MD5 |
d2736ab2358b9d4e7d730f718cb2c87e
|
|
| BLAKE2b-256 |
81d10a923916dc0ebcbbcedc8e7920a04792f3e03b978e60af3005ef18e03530
|
File details
Details for the file cirbo-1.0.0-cp313-cp313-macosx_10_15_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp313-cp313-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.8 MB
- Tags: CPython 3.13, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1f76e318da5b857bb5d42a7e607344beaed501e11338eec6e7f75e3da46ff8c
|
|
| MD5 |
5b31613b0e03ce7f4b945a67bdf5674e
|
|
| BLAKE2b-256 |
e08cd2089bb0203adf573bd6081678f8638bddf66f5f77f09c3da2456a2464d7
|
File details
Details for the file cirbo-1.0.0-cp312-cp312-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 16.9 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c824f47b5ce88e30d89b90656e1c5bf02cb88ee2fe303b20e19eb4aa66a9b34f
|
|
| MD5 |
d66fba1e9bc5fd9a29753b678761e61f
|
|
| BLAKE2b-256 |
029205a40a227399c6b31850e058c107fcd088101eaae26503f77d64cfabd36c
|
File details
Details for the file cirbo-1.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 15.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14375b9958d58e58942cacf7e6ea356272e20b60fe56a5b5173595083cfa5920
|
|
| MD5 |
d19d1009b8af211abafb2cc5a7275293
|
|
| BLAKE2b-256 |
7a5b6d378d29d8a00307c739264fdf805396d1e31e6b77d384bfba8b8cb68ce6
|
File details
Details for the file cirbo-1.0.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.4 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b51972202e60169da9ad5f4468fe24467bd89db550b8c615ed3125911f804449
|
|
| MD5 |
01361cffe68931b72f2aed3f1025a6a1
|
|
| BLAKE2b-256 |
b52d1081fc413be09a44f894851137c661a980b8c40186b9b143f0be8ede896b
|
File details
Details for the file cirbo-1.0.0-cp312-cp312-macosx_10_15_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp312-cp312-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.8 MB
- Tags: CPython 3.12, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d129711317f04c307237e552f843a4919334ac16cb29780774dc698bec52b66
|
|
| MD5 |
3ccd2d01f39305ab94a97d092cb8055b
|
|
| BLAKE2b-256 |
e663a460f4960ccba6bdb43dbb47af94e83d1b28b54fac81431bb600c93a4a1f
|
File details
Details for the file cirbo-1.0.0-cp311-cp311-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp311-cp311-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 16.9 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e96fd959dac1091fe5773063437a90cafce3e394ddf3c997d3e7c057d5fc565
|
|
| MD5 |
54f4b8f04ad7bf048b67ad965e573daa
|
|
| BLAKE2b-256 |
f06284679898ac9ecab9cd6294c85a257a6bb35520f163e043c7a1a9f3630412
|
File details
Details for the file cirbo-1.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 15.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb185ad06725db71506d8580842075dfdff01d69aa80e58ebaa4d27018472fe5
|
|
| MD5 |
9d8018089b86184534f9b6e99f9721e1
|
|
| BLAKE2b-256 |
812d9080907abb439e4295023a861f3be371f6e5498f715a238dfc972121e19f
|
File details
Details for the file cirbo-1.0.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.4 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7346ec615fe198ceefe49edb6f7e1619871d931c64d2a937f42bf0bd149840e8
|
|
| MD5 |
b594673d72a21575dc1d7e5edfee7bbd
|
|
| BLAKE2b-256 |
82c7b236154c22ded395b45cacac75d48cd3ef2e5ff4b4e45d28fc8ef2faf8ca
|
File details
Details for the file cirbo-1.0.0-cp311-cp311-macosx_10_15_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp311-cp311-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.8 MB
- Tags: CPython 3.11, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac1b181695aed5a8122eec006c51d0b1411dc68fe1424bb8d907897402bce124
|
|
| MD5 |
748abae74aac95e2acc0ca28ae721ff0
|
|
| BLAKE2b-256 |
4e10b33d570acd73472f12b28b197ae4b022c9616cd497986d4a3a602218548b
|
File details
Details for the file cirbo-1.0.0-cp310-cp310-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp310-cp310-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 16.9 MB
- Tags: CPython 3.10, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c32f697a4c64874f87914ad1875a3e2f40cf1f139881950b4c8dca1b91ae1bd2
|
|
| MD5 |
36aded4a3569a55b5fff013e5366b003
|
|
| BLAKE2b-256 |
3728b5e1f16a75568b4c01b25f6352e244cc8e0da9d76b46f03a2f6b1093f669
|
File details
Details for the file cirbo-1.0.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 15.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c921f4d73511583493ffecb4b1907ded0c9a601722497fb7b7f38e012c55d8d8
|
|
| MD5 |
bce96fed3cb2cd7ccf174eb1fd602ca3
|
|
| BLAKE2b-256 |
cbdbb038b4b42aa4d7728d25c2a99321e6d57bae8dfefad96c5a3dfd2577e390
|
File details
Details for the file cirbo-1.0.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.4 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a41557226348f915982155736716519d73d6eecb32d78a9e51ce0ef815162fb7
|
|
| MD5 |
c83a31eb0fa77415a5de1e13311403aa
|
|
| BLAKE2b-256 |
2dd7a0973a8e90ebd360cf9f10ea925981c3a6f272d9e6d3db7789b8404cd064
|
File details
Details for the file cirbo-1.0.0-cp310-cp310-macosx_10_15_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp310-cp310-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.8 MB
- Tags: CPython 3.10, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d373b58869d3f84b1cb28e568c15ec84af0b92fd22d675d2f7238d07f228743a
|
|
| MD5 |
7e71d8d049621c25be57c04638a369ab
|
|
| BLAKE2b-256 |
d737021950db424d0b666356039bc6500e52a3dcee8e917d8356972c87255a4c
|
File details
Details for the file cirbo-1.0.0-cp39-cp39-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp39-cp39-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 16.9 MB
- Tags: CPython 3.9, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c091ca86128ddab11d5ed371e0dc849b39cd237149f887e472f4063edb34d61b
|
|
| MD5 |
51d94af55a916db9086e492068329d61
|
|
| BLAKE2b-256 |
868704b69f535952764706d730280a384783a94bdfcc7b5e8c9a6ebf58fe33c8
|
File details
Details for the file cirbo-1.0.0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 15.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ed76f12b0d245a943f6ac863dff92f87325c041753d17473ecd6ee5e08105e0
|
|
| MD5 |
bb86e06f2e6a1f7b8dd3914e2893dfa1
|
|
| BLAKE2b-256 |
ebdd29e2438b422b8a47963e944998741f3ea14eaa34603575f860201fdf5f28
|
File details
Details for the file cirbo-1.0.0-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.4 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a980760f4ea3b201bed9cfee47460b2892cf1d2d89cdf58f730eccccfaf2216
|
|
| MD5 |
4903202e3f058d624395aa1cb6f2b731
|
|
| BLAKE2b-256 |
a9de2323bd382cb65054bee40f00adddfc2efd81ba52cd4c59c011bc7aa2e0e6
|
File details
Details for the file cirbo-1.0.0-cp39-cp39-macosx_10_15_x86_64.whl.
File metadata
- Download URL: cirbo-1.0.0-cp39-cp39-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.8 MB
- Tags: CPython 3.9, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa48c6c973337e5af08813060fac1022d11fdcd4082fc01a7390c0131c738051
|
|
| MD5 |
599bda78a4d01d9ef7086f0500f376a5
|
|
| BLAKE2b-256 |
665fe836e717d2dfde756b5e4a8c98bb42f4b2fbb08d2b56a1be892e085513c7
|