Binary and Boolean logic · 二进制与布尔逻辑
| English | 中文 | Pinyin · 拼音 |
|---|---|---|
| Boolean algebra/ˈbuːlɪən ˈældʒɪbrə/ | 布尔代数 | bù ěr dài shù |
| bit/bɪt/ | 位 | wèi |
| binary arithmetic/ˈbaɪnəri əˈrɪθmətɪk/ | 二进制运算 | èr jìn zhì yùn suàn |
| byte/baɪt/ | 字节 | zì jié |
| truth table/truːθ ˈteɪbl/ | 真值表 | zhēn zhí biǎo |
| logic gate/ˈlɒdʒɪk ɡeɪt/ | 逻辑门 | luó jí mén |
| logic circuit/ˈlɒdʒɪk ˈsɜːkɪt/ | 逻辑电路 | luó jí diàn lù |
A two-value rule can still have several inputs
- Boolean algebra 布尔代数 uses true and false with operations such as AND, inclusive OR and NOT.
- A processor can implement arithmetic using digital logic. Abstract Boolean reasoning examines a stated input/output rule, rather than proving every detail of a real computer.
双值规则仍可拥有多个输入
- 布尔代数 使用真和假,以及AND、包容OR和NOT等运算。
- 处理器可通过数字逻辑实现算术运算。抽象的布尔推理考察给定的输入/输出规则,而非证明真实计算机的每一个细节。
Keep bit arithmetic and truth values distinct
- Binary arithmetic 二进制运算 carries at 2: binary $1+1=10$. A bit 位 is one binary digit and a byte 字节 is eight bits.
- A bit pattern can encode an unsigned value, a signed value or other information. Specify its width and interpretation before calling its value 255 or inverting it.
保持位运算与真值分离
- 二进制运算 以2为基进位:二进制 $1+1=10$。位 是一位二进制数,字节 由八位组成。
- 位模式可编码无符号值、有符号值或其他信息。在称其为255或对其取反之前,须明确其宽度及解释方式。
In binary, what is 1 + 1? · 二进制中 1 + 1 等于什么?
There is no digit for two, so it carries — the same rule as 9 + 1 in decimal. · 无数字2,故进位 —— 如同十进制 9 + 1。
Evaluate every Boolean combination
- A truth table 真值表 for n unrestricted Boolean inputs has $2^n$ rows. Include intermediate expressions to make grouping visible.
- Identical outputs in every row prove two expressions equivalent for those Boolean inputs. That does not establish circuit timing, authentication security or physical reliability.
评估所有布尔组合
- n个自由布尔输入的 真值表 包含 $2^n$ 行。应包含中间表达式以使分组清晰可见。
- 若每一行的输出都相同,则证明这两个表达式在这些布尔输入下等价。但这并不能确立电路时序、认证安全性或物理可靠性。
Flip the inputs and watch the output · 翻转输入观察输出
AND is true only when both are; OR is false only when neither is. · AND 仅当两者都为真时为真;OR 仅当两者都为假时为假。
How many rows does a truth table with three inputs have? · 三输入的真理表有多少行?
2³ = 8. Every input doubles the number of combinations. · 2³ = 8。每增加一个输入,组合数翻倍。
Two Boolean expressions have identical truth tables. What follows? · 两个布尔表达式真理表完全相同,由此可得?
Matching every row over the same Boolean inputs proves abstract Boolean equivalence. It does not establish physical timing or real-system security. · 针对相同布尔输入逐行匹配可证明抽象布尔等价性,但不能确立物理时序或真实系统安全性。
A complete two-input table. In row order 00, 01, 10, 11, AND outputs 0, 0, 0, 1; inclusive OR outputs 0, 1, 1, 1; NOT A outputs 1, 1, 0, 0. A single matching row is not enough to prove two expressions equivalent.
完整的双输入真值表。 按00、01、10、11的行序,AND输出为0、0、0、1;包容OR输出为0、1、1、1;NOT A输出为1、1、0、0。仅凭一行匹配不足以证明两表达式等价。
"A AND B" is true on exactly one row of its truth table. · "A AND B" 在其真理表上仅一行成立。
Only the row where both inputs are 1. That single row is the whole definition. · 仅输入全为1的那一行。该行即为全部定义。
Follow connections through the circuit
- A logic gate 逻辑门 implements a specified operation. A logic circuit 逻辑电路 connects those operations, with outputs feeding later inputs.
- Build intermediate columns according to that dependency order. De Morgan can rewrite NOT of an AND as OR of the negated inputs, but must negate both inputs.
沿电路连接逐层追踪
- 逻辑门 实现指定运算。逻辑电路 将这些运算连接起来,前级输出作为后级输入。
- 依此依赖顺序构建中间列。德摩根定律可将AND的否定改写为输入各自取反后的OR,但必须对两个输入分别取反。
Simplify and verify separately. $(A\land B)\lor(A\land\neg B)=A$ by distributivity and $B\lor\neg B$ being true. Sheet 4.3 checks all four rows and separately tests fixed-width bitwise operations.
分别化简与验证。 $(A\land B)\lor(A\land\neg B)=A$ 通过分配律得出,且 $B\lor\neg B$ 为真。练习纸4.3会检查全部四行,并单独测试固定宽度的按位运算。
In logic, when is "A OR B" false? · 逻辑中,“A OR B”何时为假?
Inclusive OR is false only when both inputs are false. Both true gives true; this question uses inclusive OR explicitly. · 包容性或运算仅在两个输入均为假时为假。两者皆真则为真;本题明确使用包容性或运算。
Inclusive OR is true when both inputs are true. Bitwise NOT inverts only the stated positions: four-bit NOT of 1100 is 0011, unsigned 3, rather than an unspecified signed or infinite-width value.
包容OR在两个输入均为真时为真。按位NOT仅反转指定位置的位:四位1100的按位NOT结果为0011,即无符号数3,而非未指明的有符号数或无限宽度值。