CTAN Comprehensive TeX Archive Network

Verzeichnis macros/latex/contrib/boolalg

README.md

boolalg

A package for Boolean algebra: generate truth tables, simplify expressions step-by-step, and prove equivalences directly in your document. Everything runs in pure —no external scripts, Python, or --shell-escape needed.

Quick Start

\usepackage{boolalg}

% Truth table with sub-expressions
\btable{A'B + AB'}

% Step-by-step simplification citing Boolean laws
\bsimplify{(A + B)(A + B')}

% Prove equivalence or find a counterexample
\bprove{A \oplus B = (A + B)(AB)'}
\bprove{A + B = AB}   % prints counterexample: A=0, B=1

Commands

  • \btable{<expr>} — Truth table (aliases: \btruth, \truthtable, \btruthtable, \booltruthtable)
  • \btable*{<expr>} — Truth table with simplified answer
  • \bsimplify{<expr>} — Step-by-step simplification (alias: \boolsimplify)
  • \bsimplify*{<expr>} — Final simplified answer only
  • \bprove{<lhs> = <rhs>} — Step-by-step proof or counterexample (alias: \boolprove)

Input Syntax (highest to lowest priority)

Variables : Single letters A-Z, a-z
Constants : 0, 1
Grouping  : ( ... )
1. NOT    : not, \lnot, \neg, ', !, ~
2. AND    : AB, *, ., &, and, \land, \wedge, \cdot
   NAND   : nand, \nand, \uparrow, \barwedge
3. OR     : +, |, or, \lor, \vee
   NOR    : nor, \nor, \downarrow
4. XOR    : ^, xor, \xor, \oplus
   XNOR   : xnor, \xnor, \odot, \equiv, \iff
  • Examples: AB means A AND B; A' and !A both mean NOT A.
  • Note: Put a space after word operators, e.g. "not A".

Settings (override with \def)

\def\boolfname{f}          % Name of the output column (use \empty to hide)
\def\booltablemaxvars{5}   % Skip truth tables with more than 5 variables
\def\boolandsym{\land}     % Customise operator symbols (e.g. \def\boolandsym{\land})

Documentation

See boolalg-doc.pdf for the compiled reference manual and rendered examples.

Author & License

Param Srivastava

Released under the Project Public License (LPPL) v1.3c or later.

Herunterladen des vollständigen Inhalts dieses Pakets in einem Zip-Archiv (160.9k).

Boolalg – Truth tables, step-by-step simplification, and algebraic proofs for Boolean

The boolalg package provides pure- macros for parsing, evaluating, simplifying, and proving Boolean algebra expressions without requiring external tools, Python, or shell-escape:

– \btable and \btable*: Generate truth tables with intermediate subexpression columns and optional simplified results. – \bsimplify and \bsimplify*: Perform step-by-step algebraic simplification with explicit law justifications (Idempotence, Absorption, Consensus theorem, De Morgan’s laws, Distributivity, etc.). – \bprove: Construct step-by-step algebraic proofs between two equivalent expressions, or automatically find and print a concrete counterexample if the claim is false.

Expressions support flexible input syntax including implicit multiplication (AB), postfix primes (A'), prefix operators (!, ~), English words (and, or, xor, nand, nor, xnor, not), and standard math symbols (\land, \lor, \oplus, \lnot, etc.).

PaketBoolalg
Version1.0.0
LizenzenThe Project Public License 1.3c
Copyright2026 Param Srivastava
BetreuerParam Srivastava
Enthalten inTeX Live als boolalg
ThemenLogik
Siehe auchluatruthtable
truthtable
...
Gästebuch Seiten-Struktur Impressum Autor kontaktieren