Basic logic
NOT
- Notation
- ¬A, A'
- Programming
- Circuit
- Inverter gate
Example
Reverses a truth value.
If A means logged in, ¬A means not logged in.
Truth table
| A | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
Computer science reference
Understand AND, OR, NOT, XOR, NAND, NOR, and related operators across truth tables, Boolean algebra, digital circuits, programming, and AI prompts.
Basic logic
Reverses a truth value.
If A means logged in, ¬A means not logged in.
| A | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
Basic logic
True only when every input is true.
isLoggedIn && hasPermission
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Basic logic
True when at least one input is true.
isAdmin || isOwner
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Derived operators
True when the inputs are different.
Half adder sum = A XOR B.
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Derived operators
The negation of AND. NAND gates can build any Boolean circuit.
A NAND B = NOT (A AND B).
| A | B | Out |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Derived operators
The negation of OR. NOR is also functionally complete.
A NOR B is true only when both inputs are false.
| A | B | Out |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Derived operators
True when the inputs are the same.
A XNOR B behaves like equality for Boolean values.
| A | B | Out |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Bitwise operators
Applies AND to each bit position. It is different from logical &&.
0101 & 0011 = 0001
Programming
The second expression may not run if the first expression already determines the result.
user && user.name
A ∧ 1 = A, A ∨ 0 = ACombining with the neutral truth value leaves A unchanged.
A ∧ 0 = 0, A ∨ 1 = 1One fixed input can determine the entire result.
A ∧ ¬A = 0, A ∨ ¬A = 1A statement and its negation cannot both be true, but at least one is true.
¬(A ∧ B) = ¬A ∨ ¬B, ¬(A ∨ B) = ¬A ∧ ¬BMoves a negation across AND or OR while switching the operator.
A ∨ (A ∧ B) = A, A ∧ (A ∨ B) = AA repeated condition can absorb a more specific condition.