Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Binary boolean operation truth tables, various versions
0 !| < > & A B ==
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
| 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 |
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
| 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 |
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
| 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 |
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
| 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 | | 0 | 0 |
+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+ +---+---+
1 | !< !> !& !A !B !=
+---+---+
!A | 1 | 1 |
+---+---+
| 0 | 0 |
+-------+
!|, nor A |
+---+---+ +---+---+ +---+---+
!(A | B) | 1 | 0 | | 0 | 0 | | 0 | 1 | +
+---+---+ +---+---+ +---+---+ !(!A ^ !B)
| 0 | 0 | | 1 | 1 | | 1 | 1 |
+-------+ --------+ --------+
< ==, <=> !<, >=
+---+---+ +---+---+ +---+---+
!A & B | 0 | 1 | | 1 | 0 | | 1 | 0 | A | !B
+---+---+ +---+---+ +---+---+
+---+---+ | 0 | 0 | | 0 | 1 | | 1 | 1 | +---+---+
0 | 0 | 0 | +-------+ +-------+ +-------+ | 1 | 1 | 1
+---+---+ > !=, ^, - !>, <= +---+---+
| 0 | 0 | +---+---+ +---+---+ +---+---+ | 1 | 1 |
+---+---+ | 0 | 0 | | 0 | 1 | | 1 | 1 | +---+---+
+---+---+ +---+---+ +---+---+
A & !B | 1 | 0 | | 1 | 0 | | 0 | 1 | !A | B
+-------+ +-------+ +-------+
& B !&, nand
+---+---+ +---+---+ +---+---+
* | 0 | 0 | | 0 | 1 | | 1 | 1 | !(A & B)
!(!A v !B) +---+---+ +---+---+ +---+---+
| 0 | 1 | | 0 | 1 | | 1 | 0 |
+-------+ --------+ +-------+
+---+---+
!B | 1 | 0 |
+---+---+
| 1 | 0 |
+-------+
!& s
!0 rst
!< rt
!= s
!> rt
!A t
!B t
!| st
&& st
0 st
< t
== rst
> t
A t
B t
|| s
+---B---+
!A | 0 | 1 |
+----+---+---+
| 0 | 1 | 1 |
A----+---+---+
| 1 | 0 | 0 |
+------------+
+---B---+ +---B---+ +---B---+
!|| | 0 | 1 | A | 0 | 1 | || | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+
| 0 | 1 | 0 | | 0 | 0 | 0 | | 0 | 0 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 0 | | 1 | 1 | 1 | | 1 | 1 | 1 |
+------------+ +------------+ +------------+
+---B---+ +---B---+ +---B---+
< | 0 | 1 | == | 0 | 1 | !< | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+
| 0 | 0 | 1 | | 0 | 1 | 0 | | 0 | 1 | 0 |
+---B---+ A----+---+---+ A----+---+---+ A----+---+---+ +---B---+
0 | 0 | 1 | | 1 | 0 | 0 | | 1 | 0 | 1 | | 1 | 1 | 1 | 1 | 0 | 1 |
+----+---+---+ +------------+ +------------+ +------------+ +----+---+---+
| 0 | 0 | 0 | | 0 | 1 | 1 |
A----+---+---+ +---B---+ +---B---+ +---B---+ A----+---+---+
| 1 | 0 | 0 | > | 0 | 1 | != | 0 | 1 | !> | 0 | 1 | | 1 | 1 | 1 |
+------------+ +----+---+---+ +----+---+---+ +----+---+---+ +------------+
| 0 | 0 | 0 | | 0 | 0 | 1 | | 0 | 1 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 1 | 0 | | 1 | 1 | 0 | | 1 | 0 | 1 |
+------------+ +------------+ +------------+
+---B---+ +---B---+ +---B---+
&& | 0 | 1 | B | 0 | 1 | !&& | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+
| 0 | 0 | 0 | | 0 | 0 | 1 | | 0 | 1 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 1 | | 1 | 0 | 1 | | 1 | 1 | 0 |
+------------+ +------------+ +------------+
+---B---+
!B | 0 | 1 |
+----+---+---+
| 0 | 1 | 0 |
A----+---+---+
| 1 | 1 | 0 |
+------------+
+---+---+
!A | 1 | 1 |-r
+---+---+-s
| 0 | 0 |+t
+-------+
!|, nor A |
+---+---+ +---+---+ +---+---+
!(A | B) | 1 | 0 | | 0 | 0 |-r | 0 | 1 | +
+---+---+ +---+---+-s +---+---+
| 0 | 0 | | 1 | 1 |+t | 1 | 1 |
+-------+ --------+ --------+
< ==, <=> !<, >=
+---+---+ +---+---+ +---+---+
!A & B | 0 | 1 | | 1 | 0 |+r | 1 | 0 | A | !B
+---+---+ +---+---++s +---+---+
+---+---+ | 0 | 0 | | 0 | 1 |+t | 1 | 1 | +---+---+
0 | 0 | 0 | +-------+ +-------+ +-------+ | 1 | 1 | 1
+---+---+ > !=, ^, - !>, <= +---+---+
| 0 | 0 | +---+---+ +---+---+ +---+---+ | 1 | 1 |
+---+---+ | 0 | 0 | | 0 | 1 |-r | 1 | 1 | +---+---+
+---+---+ +---+---++s +---+---+
A & !B | 1 | 0 | | 1 | 0 |-t | 0 | 1 | !A | B
+-------+ +-------+ +-------+
& B !&, nand
+---+---+ +---+---+ +---+---+
* | 0 | 0 | | 0 | 1 |-r | 1 | 1 | !(A & B)
+---+---+ +---+---+-s +---+---+
| 0 | 1 | | 0 | 1 |+t | 1 | 0 |
+-------+ --------+ +-------+
+---+---+
!B | 1 | 0 |
+---+---+
| 1 | 0 |
+-------+
+---B---+ +---B---+ +---B---+ +---B---+
0 | 0 | 1 | && | 0 | 1 | > | 0 | 1 | A | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+ +----+---+---+
| 0 | 0 | 0 | | 0 | 0 | 0 | | 0 | 0 | 0 | | 0 | 0 | 0 |
A----+---+---+ A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 0 | | 1 | 0 | 1 | | 1 | 1 | 0 | | 1 | 1 | 1 |
+------+---+-----+------+---+-----+------+---+-----+-------+---+----+
| A && !A | A && B | A > B | A // B |
| | A * B | A >> B | A << B |
| | | A && !B | |
+----------------+----------------+----------------+----------------+
+---B---+ +---B---+ +---B---+ +---B---+
< | 0 | 1 | B | 0 | 1 | !== | 0 | 1 | || | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+ +----+---+---+
| 0 | 0 | 1 | | 0 | 0 | 1 | | 0 | 0 | 1 | | 0 | 0 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 0 | | 1 | 0 | 1 | | 1 | 1 | 0 | | 1 | 1 | 1 |
+------+---+-----+------+---+-----+------+---+-----+-------+---+----+
| A < B | | A !== B | A || B |
| !A & B | | A xor B | A + B |
| | | A - B | |
| | | A ^ B | |
+----------------+----------------+----------------+----------------+
+---B---+ +---B---+ +---B---+ +---B---+
!|| | 0 | 1 | == | 0 | 1 | !B | 0 | 1 | !< | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+ +----+---+---+
| 0 | 1 | 0 | | 0 | 1 | 0 | | 0 | 1 | 0 | | 0 | 1 | 0 |
A----+---+---+ A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 0 | | 1 | 0 | 1 | | 1 | 1 | 0 | | 1 | 1 | 1 |
+------+---+-----+------+---+-----+------+---+-----+-------+---+----+
| A nor B | A == B | | A !< B |
| A !|| B | A <=> B | | A >= B |
| !A && !B | | | A || !B |
| | | | A ** B |
+----------------+----------------+----------------+----------------+
+---B---+ +---B---+ +---B---+ +---B---+
!A | 0 | 1 | !> | 0 | 1 | !&& | 0 | 1 | 1 | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+ +----+---+---+
| 0 | 1 | 1 | | 0 | 1 | 1 | | 0 | 1 | 1 | | 0 | 1 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 0 | | 1 | 0 | 1 | | 1 | 1 | 0 | | 1 | 1 | 1 |
+------+---+-----+------+---+-----+------+---+-----+-------+---+----+
| | A => B | A nand B | A || !A |
| | !A || B | | |
| | | | |
+----------------+----------------+----------------+----------------+
-----------------------------------------------------------------------
-
-----------------------------------------------------------------------
+---+---+
!A | 1 | 1 |
+---+---+
| 0 | 0 |
+-------+
!||, nor A ||, +
+---+---+ +---+---+ +---+---+
!A && !B | 1 | 0 | | 0 | 0 | | 0 | 1 |
+---+---+ +---+---+ +---+---+
| 0 | 0 | | 1 | 1 | | 1 | 1 |
+-------+ --------+ --------+
< ==, <=> !<, >=
+---+---+ +---+---+ +---+---+
!A & B | 0 | 1 | | 1 | 0 | | 1 | 0 | A || !B
+---+---+ +---+---+ +---+---+
+---+---+ | 0 | 0 | | 0 | 1 | | 1 | 1 | +---+---+
0 | 0 | 0 | +-------+ +-------+ +-------+ | 1 | 1 | 1
+---+---+ > !=, ^, - !>, <= +---+---+
| 0 | 0 | +---+---+ +---+---+ +---+---+ | 1 | 1 |
+---+---+ | 0 | 0 | | 0 | 1 | | 1 | 1 | +---+---+
+---+---+ +---+---+ +---+---+
A && !B | 1 | 0 | | 1 | 0 | | 0 | 1 | !A || B
+-------+ +-------+ +-------+
& B !&&, nand
+---+---+ +---+---+ +---+---+
* | 0 | 0 | | 0 | 1 | | 1 | 1 |
+---+---+ +---+---+ +---+---+
| 0 | 1 | | 0 | 1 | | 1 | 0 |
+-------+ --------+ +-------+
+---+---+
!B | 1 | 0 |
+---+---+
| 1 | 0 |
+-------+
-----------------------------------------------------------------------
-
-----------------------------------------------------------------------
+---+---+
!A | 1 | 1 |
+---+---+
| 0 | 0 |
+-------+
!||,nor A ||, +
+---+---+ +---+---+ +---+---+
!A && !B | 1 | 0 | | 0 | 0 | | 0 | 1 |
+---+---+ +---+---+ +---+---+
| 0 | 0 | | 1 | 1 | | 1 | 1 |
+-------+ --------+ --------+
< ==, <=> !<, >=
+---+---+ +---+---+ +---+---+
!A & B | 0 | 1 | | 1 | 0 | | 1 | 0 | A || !B
+---+---+ +---+---+ +---+---+
+---+---+ | 0 | 0 | | 0 | 1 | | 1 | 1 | +---+---+
0 | 0 | 0 | +-------+ +-------+ +-------+ | 1 | 1 | 1
+---+---+ > !=,^,- !>, <= +---+---+
| 0 | 0 | +---+---+ +---+---+ +---+---+ | 1 | 1 |
+---+---+ | 0 | 0 | | 0 | 1 | | 1 | 1 | +---+---+
+---+---+ +---+---+ +---+---+
A && !B | 1 | 0 | | 1 | 0 | | 0 | 1 | !A || B
+-------+ +-------+ +-------+
&&, * B !&&, nand
+---+---+ +---+---+ +---+---+
| 0 | 0 | | 0 | 1 | | 1 | 1 |
+---+---+ +---+---+ +---+---+
| 0 | 1 | | 0 | 1 | | 1 | 0 |
+-------+ --------+ +-------+
+---+---+
!B | 1 | 0 |
+---+---+
| 1 | 0 |
+-------+
-----------------------------------------------------------------------
+---B---+
!A | 0 | 1 |
+----+---+---+
| 0 | 1 | 1 |
A----+---+---+
| 1 | 0 | 0 |
+------------+
+---B---+ +---B---+ +---B---+
!|| | 0 | 1 | A | 0 | 1 | || | 0 | 1 |
+----+---+---+ +----+---+---+ +----+---+---+
| 0 | 1 | 0 | | 0 | 0 | 0 | | 0 | 0 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 0 | | 1 | 1 | 1 | | 1 | 1 | 1 |
+------------+ +------------+ +------------+
< == !<
+----+---+---+ +----+---+---+ +----+---+---+
| 0 | 0 | 1 | | 0 | 1 | 0 | | 0 | 1 | 0 |
+---B---+ A----+---+---+ A----+---+---+ A----+---+---+ +---B---+
0 | 0 | 1 | | 1 | 0 | 0 | | 1 | 0 | 1 | | 1 | 1 | 1 | 1 | 0 | 1 |
+----+---+---+ +------------+ +------------+ +------------+ +----+---+---+
| 0 | 0 | 0 | | 0 | 1 | 1 |
A----+---+---+ A----+---+---+
| 1 | 0 | 0 | > != !> | 1 | 1 | 1 |
+------------+ +----+---+---+ +----+---+---+ +----+---+---+ +------------+
| 0 | 0 | 0 | | 0 | 0 | 1 | | 0 | 1 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 1 | 0 | | 1 | 1 | 0 | | 1 | 0 | 1 |
+------------+ +------------+ +------------+
&& B !&&
+----+---+---+ +----+---+---+ +----+---+---+
| 0 | 0 | 0 | | 0 | 0 | 1 | | 0 | 1 | 1 |
A----+---+---+ A----+---+---+ A----+---+---+
| 1 | 0 | 1 | | 1 | 0 | 1 | | 1 | 1 | 0 |
+------------+ +------------+ +------------+
!B
+----+---+---+
| 0 | 1 | 0 |
A----+---+---+
| 1 | 1 | 0 |
+------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.