Metadata-Version: 2.1
Name: boolgen
Version: 1.0.0
Summary: A library for generating and simplifying Boolean expressions from truth tables
Home-page: https://github.com/schuyler/boolgen
Author: Schuyler Erle
Author-email: schuyler@nocat.net
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.md

# 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](https://en.wikipedia.org/wiki/Quine%E2%80%93McCluskey_algorithm) to
perform the simplification. 

## Installation

To install `boolgen`, use pip:

```bash
pip install boolgen
```

If you download the source, you can run the [unit tests](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

```bash
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](LICENSE.md)
for details.
