boolgen
boolgen is a Python library and command-line tool for generating and
simplifying Boolean expressions from truth tables.
The library implements a version of the Quine-McCluskey method to perform the simplification. I created it to help with designing digital logic circuits from truth tables.
Installation
To install boolgen, use pip:
pip install boolgen
If you download the source, you can run the unit tests.
Command-Line Interface
The boolgen tool can be used from the command line to process truth tables
stored in files and output simplified Boolean expressions.
Syntax
boolgen <input_file>
<input_file>: Path to the input file containing the truth table.
If no filename is provided, then boolgen will try to read the table from
STDIN.
Example Input File
Create a file named input.txt with the following content:
A B C D= E=
0 0 0 0 1
0 0 1 1 0
0 1 0 1 0
1 0 0 1 0
1 1 1 0 1
Input and output variables can be identified with any alphanumeric string (including underscores). Output variables are identified by a pre- or postfix '='. If no output variable is explicitly declared, the last column in the table is assumed to be the output.
Output
boolgen will output the simplified Boolean expressions for each output variable in the truth table.
D = A | B & ~C
E = ~A & ~B & ~C | A & B & C
In degenerate cases, an output variable might be set to 0 or 1.
Library
You can also import boolgen into your own project. See the function
definitions for an idea of how it all works.
Contributing
Contributions are welcome! Please fork the repository and submit pull requests.
License
This project is licensed under the MIT License. See LICENSE.md for details.
TBQH I used ChatGPT liberally when creating this module, so if you find your own code in here, please let me know so I can remove it or else attribute you properly.
Metadata
Release files for boolgen 1.1.0
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 |
|---|---|---|---|---|
| boolgen-1.1.0.tar.gz | 5.7 kB | Without provenance | Details for boolgen-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| boolgen-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for boolgen-1.1.0-py3-none-any.whl |
Total release size: 11.1 kB
Release files / boolgen-1.1.0.tar.gz
| Download URL | boolgen-1.1.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32c371c43494ffb8e94cb2cd50298df84aacf5ec72b1bb7aac71ba9de2dc07d7
|
|
BLAKE2b-256 checksum How to use checksums |
1b4561272a9f20cece652a3303ede1e18d1f7998ff76a82c7c09f6b5ae569527
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.6
|
Release files / boolgen-1.1.0-py3-none-any.whl
| Download URL | boolgen-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c418c0c3395b038c04610fa34a99101806b05fce3510f75f9151ef315391de9
|
|
BLAKE2b-256 checksum How to use checksums |
3f422f6c6656fe417a9408585098d84acdcb692001f09d6b56ba3e33795e5c08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.6
|
Security for boolgen 1.1.0
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.