Introduction
Let’s introduce a useful convention LOW, 0
and false
have the same logic meaning, as well as HIGH, 1
and true
.
Bool Algebra
Axioms | Single variable theorems |
---|---|
0 ⋅ 0 = 0 | x ⋅ 0 = 0 |
1 + 1 = 1 | x + 1 = 1 |
1 ⋅ 1 = 1 | x ⋅ 1 = x |
0 + 0 = 0 | x + 0 = x |
0 ⋅ 1 = 1 ⋅ 0 = 0 | x ⋅ x = x |
0 + 1 = 1 + 0 = 1 | x + x = x |
if x = 0 , then !x = 1 | x ⋅ !x = 0 |
if x = 1 , then !x = 0 | x + !x = 1 |
1 = !!1 and 0 = !!0 | x = !!x |
Please Note: Double negation is often used with a couple of overline signs.
Duality Principle
Given a logic expression, the dual is obtained by swapping:
- summations with multiplications (and vice-versa)
0
with1
(and vice-versa)
Main Gates
AND
AND gate is a logic gate that implements logical conjunction (∧).
If one or both the inputs are false
, the output is false
.
If both inputs are true
, the output is true
.
Truth table:
A | B | A ⋅ B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
OR gate
OR gate is a logic gate that implements logical disjunction (∨).
A true
output results if one or both the inputs are true
.
If neither input is true
, the output is false
.
Truth table:
A | B | A + B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
NOT gate
NOT gate is a logic gate that implements logical negation (¬).
It is more commonly referred with the exclamation mark !
before che operator: !A
means logical negation of A
.
Truth table:
A | ¬ A |
---|---|
0 | 1 |
1 | 0 |
Compound Gates
NOR gate
NOR gate is the result of the negation of the OR operator. It can also be seen as the inverse of an AND gate.
A true
output results if both the inputs are false
.
A false
output results if one or both the inputs are true
.
Truth table:
A | B | ¬ (A ∨ B) |
---|---|---|
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 0 |
NAND gate
NAND gate is the result of the negation of the NAND operator. It can also be seen as the inverse of an OR gate.
A true
output results if one or both the inputs are false
.
A false
output results if both the inputs are true
.
Truth table:
A | B | ¬ (A ∧ B) |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
XOR gate
XOR gate is an Exclusive OR gate that performs exclusive disjunction (⊕).
The output of an XOR gate is true
only when exactly one of its inputs is true
.
If inputs are both false
or both true
the output is false
.
Truth table:
A | B | A ⊕ B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
XNOR gate
XNOR gate is the logical complement of XOR gate (⨀).
The output of an XNOR gate is false
only when exactly one of its inputs is true
.
If inputs are both false
or both true
the output is true
.
Truth table:
A | B | A ⨀ B |
---|---|---|
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Conclusion
Useful links:
- Logic Gates Symbols
- wumbo.net
- AND sign, DOT operator
- OR sign, also on fileformat.info
- negation sign, also on fileformat.info
- XOR sign
- XNOR