Educational Python reimplementation of the Espresso two-level Boolean logic minimizer.
This project provides a small, readable implementation of the classic Espresso flow (expand → reduce → irredundant) for Boolean function minimization over PLA inputs. It prints the original and optimized truth tables, the Boolean expressions (sum-of-products), and compares literal counts before and after optimization.
Focused on clarity and correctness for small PLAs; not intended for large-scale/industrial use.
espresso-py/
├── src/
│ ├── pla.py # PLA data structures and parsing
│ ├── visualization.py # Truth table + SOP printing and metrics
│ └── espresso.py # Expand/Reduce/Irredundant + simple iterative loop
├── examples/ # Example PLA files
├── main.py # CLI entry point
├── requirements.txt # Minimal dependencies
└── README.md
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# Run with an example file
python main.py examples/simple.pla
# Run with your own PLA file
python main.py path/to/your/file.pla
The program prints the original/optimized truth tables and SOP expressions, and a literal count comparison.
- PLA parsing and validation
- Truth table rendering (pandas DataFrame)
- SOP expression printing (single and multi-output)
- Simple Espresso-style cycle: expand → reduce → irredundant with a small iterative improvement loop
- Literal count comparison before/after optimization
- Educational heuristic, not a full Espresso reimplementation
- No explicit handling of separate on/off/don’t-care sets
- Aimed at small inputs; no performance tuning
python main.py examples/4x1_parity.pla
Don't-care demo (shows a clear reduction by leveraging -
rows):
python main.py examples/dont_care.pla
- Python 3.8+
- pandas
MIT — see LICENSE
.
Inspired by the original Espresso implementation (UC Berkeley).