A library for generating and simplifying Boolean expressions from truth tables
Project description
boolgen
boolgen is a Python library and command-line tool for generating and
simplifying Boolean expressions from truth tables.
The library implenents a version of the Quine-McCluskey method to perform the simplification.
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 Output1 Output2
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 the
case-insensitive prefix out.
Output
boolgen will output the simplified Boolean expressions for each output variable in the truth table.
Output1 = A | B & ~C
Output2 = ~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.
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
Built Distribution
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 boolgen-1.0.0.tar.gz.
File metadata
- Download URL: boolgen-1.0.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
496c8ec7764485dd3b60c38ed32e677376e611afd27ad06a00f6b128dc72c3df
|
|
| MD5 |
c26fc84fd6ad65d03402c89f02de9dc9
|
|
| BLAKE2b-256 |
2522787bceec8770adc4c8bb87489027b36d4000ab3d7691fcfd386ceb2105f6
|
File details
Details for the file boolgen-1.0.0-py3-none-any.whl.
File metadata
- Download URL: boolgen-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02c40d70e21fa661ed228be1cbdbd3be5b40c7bf3a4aef4279cde454efe7ab2c
|
|
| MD5 |
fd6bc9dcc52f9f2d0f1d4e890d652fbc
|
|
| BLAKE2b-256 |
4f6b9cc2fbfe827d78acdf0dc6d5c1d0a933ca4583b24f72734a77232504174f
|