Primary Operators¶
- pyeda.boolalg.expr.Not(x, simplify=True)[source]¶
Expression negation operator
If simplify is True, return a simplified expression.
The pyeda.boolalg.expr module implements Boolean functions represented as expressions.
Data Types:
A nested tuple of entries that represents an expression. It is defined recursively:
ast := ('const', bool)
| ('lit', uniqid)
| (nary, ast, ...)
| ('not', ast)
| ('impl', ast, ast)
| ('ite', ast, ast, ast)
bool := 0 | 1
uniqid := nonzero int
nary := 'or'
| 'and'
| 'xor'
| 'eq'
Interface Functions:
Interface Classes:
Return a unique Expression variable.
A Boolean variable is an abstract numerical quantity that may assume any value in the set \(B = \{0, 1\}\). The exprvar function returns a unique Boolean variable instance represented by a logic expression. Variable instances may be used to symbolically construct larger expressions.
A variable is defined by one or more names, and zero or more indices. Multiple names establish hierarchical namespaces, and multiple indices group several related variables. If the name parameter is a single str, it will be converted to (name, ). The index parameter is optional; when empty, it will be converted to an empty tuple (). If the index parameter is a single int, it will be converted to (index, ).
Given identical names and indices, the exprvar function will always return the same variable:
>>> exprvar('a', 0) is exprvar('a', 0)
True
To create several single-letter variables:
>>> a, b, c, d = map(exprvar, 'abcd')
To create variables with multiple names (inner-most first):
>>> fifo_push = exprvar(('push', 'fifo'))
>>> fifo_pop = exprvar(('pop', 'fifo'))
See also
For creating arrays of variables with incremental indices, use the pyeda.boolalg.bfarray.exprvars() function.
Convert an arbitrary object into an Expression.
Convert an untyped point into an Expression point.
See also
For definitions of points and untyped points, see the pyeda.boolalg.boolfunc module.
Expression negation operator
If simplify is True, return a simplified expression.
Expression exclusive or (XOR) operator
If simplify is True, return a simplified expression.
Expression equality operator
If simplify is True, return a simplified expression.
Expression NOR (not OR) operator
If simplify is True, return a simplified expression.
Expression NAND (not AND) operator
If simplify is True, return a simplified expression.
Expression exclusive nor (XNOR) operator
If simplify is True, return a simplified expression.
Expression inequality operator
If simplify is True, return a simplified expression.
Return an expression that means “at most one input function is true”.
If simplify is True, return a simplified expression.
If conj is True, return a CNF. Otherwise, return a DNF.
Return an expression that means “exactly one input function is true”.
If simplify is True, return a simplified expression.
If conj is True, return a CNF. Otherwise, return a DNF.
Return an expression that means “the majority of input functions are true”.
If simplify is True, return a simplified expression.
If conj is True, return a CNF. Otherwise, return a DNF.
Boolean function represented by a logical expression
See also
This is a subclass of pyeda.boolalg.boolfunc.Function
The Expression class is useful for type checking, e.g. isinstance(f, Expression).
Do NOT create an Expression using the Expression constructor.
Return the depth of the expression.
Expression depth is defined recursively: