Основная логика
NOT
- Обозначение
- ¬A, A'
- Программирование
- Схема
- Inverter gate
Пример
Reverses a truth value.
If A means logged in, ¬A means not logged in.
Таблица истинности
| A | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
Компьютерные науки
Понимание AND, OR, NOT, XOR, NAND, NOR и связанных операторов через таблицы истинности, булеву алгебру, цифровые схемы, программирование и примеры AI-запросов.
Основная логика
Reverses a truth value.
If A means logged in, ¬A means not logged in.
| A | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
Основная логика
True only when every input is true.
isLoggedIn && hasPermission
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Основная логика
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 |
Производные операторы
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 |
Производные операторы
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 |
Производные операторы
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 |
Производные операторы
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 |
Побитовые операторы
Applies AND to each bit position. It is different from logical &&.
0101 & 0011 = 0001
Программирование
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.