Primary Operators¶
Since NOT, OR, and AND form a complete basis for a Boolean algebra, these three operators are primary.
- Not(arg, simplify=True, factor=False)¶
Return an expression that is the inverse of the input.
- Or(*args, simplify=True, factor=False)¶
Return an expression that evaluates to \(1\) if and only if any inputs are \(1\).
- And(*args, simplify=True, factor=False)¶
Return an expression that evaluates to \(1\) if and only if all inputs are \(1\).
Example of full adder logic using Not, Or, and And:
>>> s = Or(And(Not('a'), Not('b'), 'ci'), And(Not('a'), 'b', Not('ci')), And('a', Not('b'), Not('ci')), And('a', 'b', 'ci'))
>>> co = Or(And('a', 'b'), And('a', 'ci'), And('b', 'ci'))