Primary Operators¶
Since NOT, OR, and AND form a complete basis for a Boolean algebra, these three operators are primary.
-
Not
(x, simplify=True)¶ Return an expression that is the inverse of the input.
-
Or
(*xs, simplify=True)¶ Return an expression that evaluates to \(1\) if and only if any inputs are \(1\).
-
And
(*xs, simplify=True)¶ 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'))