LogicLoom is a single-repository project for minimizing boolean expressions. It consists of logicloom_core (the engine and CLI) and logicloom_ui (an open-source desktop GUI that uses the core). The UI is built only for this project and is part of the same repo.
Core
- Minimal boolean expression output in string or LaTeX format
- Prime implicant chart data and terminal display
- Simple CLI with demo mode for quick checks
Desktop UI
- Variables and minterms input with live validation
- Prime implicants table (binary and literal forms)
- Essential prime implicants and PI chart
- Results as minimal SOP form
- LaTeX results tab with MathJax
Android App π±
- π― Native Android experience with intuitive touch interface
- π Easy input for variables and minterms with mobile-friendly keyboard
- π Interactive prime implicants table optimized for mobile screens
- π± Swipe between different result tabs (PI Chart, Results, LaTeX)
- π Zoom and scroll support for complex expressions
- π One-tap copy to clipboard for results
- π Dark/Light theme support (system default)
LogicLoom/
βββ README.md
βββ requirements.txt
βββ apps/
β βββ logicloom.apk # π± Pre-built Android app
βββ js/
β βββ tex-mml-chtml.js # MathJax for LaTeX in the UI
βββ shots/
β βββ screenshot.png # Desktop GUI screenshot
β βββ android.jpg # Android app screenshot
βββ logicloom_core/ # Core engine and CLI
β βββ pyproject.toml
β βββ logicloom/
βββ logicloom_ui/ # Desktop GUI (open source, uses logicloom_core)
βββ app.py
βββ icon.ico # Application icon
βββ main_window.py
βββ html_templates.py
βββ validation.py
βββ workers.py
βββ ...
- Python 3.10+
- PyQt6 (only for the desktop GUI; CLI works without it)
From the repository root (so js/ and both packages are available):
git clone https://github.com/mojtabaakhbari/LogicLoom.git
cd LogicLoom
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
pip install -e logicloom_coreCLI
logicloom --vars "A,B,C" --minterms "0,2,3,5" --output both
logicloom --demo --pichart terminalGUI
python -m logicloom_uiAndroid App π±
π Quick Start - Ready to Use!
- π₯ Download the pre-built APK: apps/logicloom.apk
- π² Install on your Android device (enable "Unknown Sources" in settings)
- π Launch LogicLoom and start simplifying boolean expressions!
π Android Requirements
- Android 5.0 (API level 21) or higher
- ~50MB storage space
- No additional dependencies required
Or with PYTHONPATH instead of installing the core:
pip install -r requirements.txt
PYTHONPATH=. python -m logicloom_uiCLI
| Argument | Short | Description |
|---|---|---|
--vars |
-v |
Comma-separated variable names (e.g. A,B,C). |
--minterms |
-m |
Comma-separated minterm numbers (e.g. 0,1,2,5). |
--output |
β | Output format: string, latex, or both (default: string). |
--all |
β | Print all minimal covers (not just the first). |
--pichart |
β | Print prime implicant chart: terminal or latex. |
--pitable |
β | Print prime implicants table (binary and literal form): terminal. |
--essentials |
β | Print essential prime implicants table (binary and literal form): terminal. |
--demo |
β | Run bundled demo problems (no --vars/--minterms needed). |
--version |
β | Print version and exit. |
Example: logicloom -v "x,y,z" -m "0,2,4,5,6" --output both --all --pitable terminal --essentials terminal --pichart terminal
GUI
- Variables β e.g.
A, B, Corx, y, z - Minterms β e.g.
0, 2, 4, 5, 6 - Click Compute and use the Prime Implicants, Essentials, PI Chart, Results, and LaTeX Results tabs.
from logicloom import LogicGateSimplifier, Term, PIChartData, PIChartRow
# From comma-separated strings (e.g. CLI-style)
simplifier = LogicGateSimplifier.from_strings("x,y,z", "0,2,4,5,6")
# Or from lists
simplifier = LogicGateSimplifier(minterms=[0, 2, 4, 5, 6], variables=["x", "y", "z"])
simplifier.simplify() # run minimization (required before get_* methods)Constructor / factory arguments
| Call | Arguments | Description |
|---|---|---|
LogicGateSimplifier(minterms, variables) |
minterms: list[int], variables: list[str] |
Build from lists of minterm indices and variable names. |
LogicGateSimplifier.from_strings(variables_str, minterms_str) |
variables_str: str, minterms_str: str |
Parse comma-separated strings (e.g. "A,B,C", "0,2,5"). |
Get structured data for the prime implicant chart (minterms Γ prime implicants, with a boolean matrix):
data = simplifier.get_pichart_data()
# data: PIChartData with:
# - minterm_numbers: list[int | None] β minterm indices
# - prime_implicants: list[str] β binary forms (e.g. "01-", "1-0")
# - matrix: list[list[bool]] β matrix[i][j] = PI j covers minterm i
# Pre-rendered chart strings (optional tick character for βcoveredβ cells)
latex_table = simplifier.get_pichart_latex(tick=r"$\checkmark$") # default LaTeX checkmark
terminal_table = simplifier.get_pichart_terminal(tick="x") # default "x"Chart method arguments
| Method | Argument | Type | Default | Description |
|---|---|---|---|---|
get_pichart_latex |
tick |
str |
r"$\checkmark$" |
String used in LaTeX for each covered (minterm, PI) cell. |
get_pichart_terminal |
tick |
str |
"x" |
Character used in the terminal table for each covered cell. |
Print tables of prime implicants or essential prime implicants (binary form and literal form) in a box-drawing terminal layout:
# Prime implicants table (Binary | Literal)
pi_table = simplifier.get_prime_implicants_terminal()
print(pi_table)
# Essential prime implicants table (Binary | Literal)
ess_table = simplifier.get_essentials_terminal()
print(ess_table)CLI: use --pitable terminal and/or --essentials terminal.
Get all minimal sum-of-products equations (string and LaTeX):
equations = simplifier.get_all_equations()
# list of dicts: [{"string": "F(x,y,z) = ...", "latex": "F(x,y,z) = ..."}, ...]
for eq in equations:
print(eq["string"])
print(eq["latex"])
# Single minimal cover as LaTeX only
latex_eq = simplifier.get_equation_latex()| Method / attribute | Arguments | Description |
|---|---|---|
simplify() |
β | Runs minimization; returns the first minimal cover as list[Term]. |
get_all_minimal_covers() |
β | Returns all minimal covers, each as list[Term]. |
get_all_equations() |
β | Returns all minimal equations as list[dict] with "string" and "latex" keys. |
get_equation_latex() |
β | Returns the first minimal equation as a single LaTeX string. |
get_pichart_data() |
β | Returns PIChartData (minterm_numbers, prime_implicants, matrix). |
get_pichart_latex(...) |
tick: str = r"$\checkmark$" |
Returns the PI chart as a LaTeX tabular string; tick is the mark for covered cells. |
get_pichart_terminal(...) |
tick: str = "x" |
Returns the PI chart as a plain-text table; tick is the character for covered cells. |
get_prime_implicants_terminal() |
β | Returns prime implicants table (Binary and Literal columns) as a terminal string. |
get_essentials_terminal() |
β | Returns essential prime implicants table (Binary and Literal columns) as a terminal string. |
variables |
β | list[str] β variable names. |
main_minterms |
β | list[Term] β input minterms. |
prime_implicants |
β | set[Term] β all prime implicants. |
essentials |
β | list[Term] β essential prime implicants. |
pichart |
β | list[PIChartRow] β chart rows (minterm, prime_implicants, is_remaining). |
All get_* methods call simplify() internally if it has not been run yet.
Termβ Binary form (e.g."01-"), optional number;.to_normal_expression(vars),.to_latex_expression(vars).PIChartDataβ Dataclass:minterm_numbers,prime_implicants,matrix.PIChartRowβ Dataclass:minterm,prime_implicants,is_remaining.
Mojtaba Akhbari
Email: [email protected]
MIT.

