# pyeda.boolalg.minimization — Logic Minimization¶

The pyeda.boolalg.minimization module contains interface functions for two-level logic minimization.

Interface Functions:

## Interface Functions¶

pyeda.boolalg.minimization.espresso_exprs(*exprs)[source]

Return a tuple of expressions optimized using Espresso.

The variadic exprs argument is a sequence of expressions.

For example:

>>> from pyeda.boolalg.expr import exprvar
>>> a, b, c = map(exprvar, 'abc')
>>> f1 = Or(And(~a, ~b, ~c), And(~a, ~b, c), And(a, ~b, c), And(a, b, c), And(a, b, ~c))
>>> f2 = Or(And(~a, ~b, c), And(a, ~b, c))
>>> f1m, f2m = espresso_exprs(f1, f2)
>>> f1.size, f1m.size
(21, 10)
>>> f1m.equivalent(f1)
True
>>> f2.size, f2m.size
(9, 3)
>>> f2m.equivalent(f2)
True

pyeda.boolalg.minimization.espresso_tts(*tts)[source]

Return a tuple of expressions optimized using Espresso.

The variadic tts argument is a sequence of truth tables.

For example:

>>> from pyeda.boolalg.bfarray import exprvars
>>> from pyeda.boolalg.table import truthtable
>>> X = exprvars('x', 4)
>>> f1 = truthtable(X, "0000011111------")
>>> f2 = truthtable(X, "0001111100------")
>>> f1m, f2m = espresso_tts(f1, f2)
>>> f1m.equivalent(X[3] | X[0] & X[2] | X[1] & X[2])
True
>>> f2m.equivalent(X[2] | X[0] & X[1])
True