📚 Boolean Algebra Revision Notes for A-Level WJEC Computer Science | A-Level WJEC 计算机:布尔代数考点精讲
Boolean algebra forms the backbone of digital logic design and is a core topic in the WJEC A-Level Computer Science specification. Mastery of Boolean expressions, truth tables, and simplification techniques is essential for solving logic circuit problems efficiently. These revision notes cover every key area, from basic laws to Karnaugh maps and practical adder circuits, providing clear bilingual explanations to strengthen your understanding.
布尔代数是数字逻辑设计的基石,也是 WJEC A-Level 计算机科学考试的核心主题。掌握布尔表达式、真值表和化简技巧对于高效解决逻辑电路问题至关重要。本复习笔记涵盖从基本定律到卡诺图及实际加法器电路的所有关键领域,提供清晰的双语解释,帮助加深理解。
1. Introduction to Boolean Algebra | 布尔代数简介
Boolean algebra is a mathematical system where variables can take only two values: true (1) or false (0). It was developed by George Boole and is the foundation of modern digital electronics. In WJEC Computer Science, you apply Boolean logic to design and simplify gates, circuits, and truth tables for real-world computing problems.
布尔代数是一种数学体系,变量只能取真 (1) 或假 (0) 两个值。它由乔治·布尔创立,是现代数字电子学的基础。在 WJEC 计算机科学中,你需要将布尔逻辑应用于门、电路和真值表的设计与化简,以解决实际计算问题。
All operations in Boolean algebra follow specific laws, and expressions can be manipulated without changing the underlying logic. This makes it possible to minimise the number of logic gates used in a circuit, reducing cost and complexity — a skill regularly tested in exam questions.
布尔代数中的所有运算都遵循特定定律,表达式可在不改变底层逻辑的前提下进行变换。这使得我们能够最小化电路中使用的逻辑门数量,从而降低成本和复杂度——这是考试题目中经常测试的一项技能。
2. Logic Gates and Truth Tables | 逻辑门与真值表
The basic logic gates are AND, OR, NOT, NAND, NOR, XOR, and XNOR. Each gate corresponds to a Boolean operator and can be described by a truth table showing output for every input combination. For two inputs A and B, the AND gate gives output 1 only when both inputs are 1; the OR gate gives 1 when any input is 1; NOT inverts a single input.
基本逻辑门包括与门、或门、非门、与非门、或非门、异或门和同或门。每个门对应一个布尔运算符,可通过真值表描述,展示每种输入组合下的输出。对于两个输入 A 和 B,与门仅在两个输入均为 1 时输出 1;或门在任一输入为 1 时输出 1;非门将单个输入反转。
Truth tables are fundamental in the WJEC exam: you must be able to write a table from a Boolean expression or logic diagram, and conversely derive an expression from a given table. A complete truth table for n inputs has 2ⁿ rows. The output column is filled according to the operator definitions.
真值表在 WJEC 考试中至关重要:你必须能够根据布尔表达式或逻辑图写出真值表,反之也能从给定的表推导出表达式。对于 n 个输入,完整的真值表有 2ⁿ 行。输出列根据运算符定义填写。
| A (Input A) | B | AND (A·B) | OR (A+B) | NAND (A·B)’ | NOR (A+B)’ |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Note that NAND and NOR are universal gates — any Boolean function can be implemented using only NAND gates or only NOR gates. This fact often appears in synthesis questions.
注意,与非门和或非门是通用门——任何布尔函数都可以仅用与非门或仅用或非门实现。这一事实常出现在综合题中。
3. Boolean Expressions and Notation | 布尔表达式与表示法
In WJEC notation, AND is represented by a middle dot ‘·’ (or simply by writing variables together), OR by a plus ‘+’, and NOT by a prime symbol or overbar. For example, F = A·B + C’ means (A AND B) OR (NOT C). Parentheses are used to group sub‑expressions, just as in ordinary algebra.
在 WJEC 记法中,与运算用中间点 ‘·’ 表示(或直接将变量并列书写),或用加号 ‘+’ 表示,非运算用撇号或上划线表示。例如,F = A·B + C’ 表示 (A 与 B) 或 (非 C)。括号用于对子表达式分组,与普通代数相同。
A Product of Sums (POS) expression is a series of OR terms ANDed together, e.g., (A + B)·(A’ + C). A Sum of Products (SOP) is a series of AND terms ORed together, e.g., A·B + A’·C. The exam expects you to be able to convert between these forms and to derive both from truth tables.
和之积 (POS) 表达式是一系列或项相与,例如 (A + B)·(A’ + C)。积之和 (SOP) 是一系列与项相或,例如 A·B + A’·C。考试要求你能够在这些形式之间转换,并从真值表推导出两者。
The order of precedence is NOT first, then AND, then OR, unless parentheses dictate otherwise. For instance, A·B + C is evaluated as (A·B) + C, not A·(B + C).
运算优先级为非最先,然后为与,最后为或,除非括号另有规定。例如,A·B + C 的求值顺序为 (A·B) + C,而不是 A·(B + C)。
4. Fundamental Laws of Boolean Algebra | 布尔代数的基本定律
The laws of Boolean algebra allow us to transform expressions without altering their truth tables. The most important ones for the WJEC exam include commutativity (A+B = B+A, A·B = B·A), associativity ((A+B)+C = A+(B+C), (A·B)·C = A·(B·C)), and distributivity (A·(B+C) = A·B + A·C, A+(B·C) = (A+B)·(A+C)).
布尔代数定律允许我们在不改变真值表的前提下变换表达式。WJEC 考试中最重要的定律包括交换律 (A+B = B+A, A·B = B·A)、结合律 ((A+B)+C = A+(B+C), (A·B)·C = A·(B·C)) 和分配律 (A·(B+C) = A·B + A·C, A+(B·C) = (A+B)·(A+C))。
Identity laws state that A+0 = A and A·1 = A; complement laws give A + A’ = 1 and A·A’ = 0. The idempotent laws (A+A = A, A·A = A) and absorption laws (A + A·B = A, A·(A+B) = A) are extremely useful for simplification.
恒等律指出 A+0 = A 和 A·1 = A;互补律给出 A + A’ = 1 和 A·A’ = 0。幂等律 (A+A = A, A·A = A) 和吸收律 (A + A·B = A, A·(A+B) = A) 在化简中极其有用。
Double negation law states (A’)’ = A. Memorising these laws is essential because algebraic simplification proofs in the exam often require naming the law used at each step.
双重否定律指出 (A’)’ = A。记住这些定律至关重要,因为考试中的代数化简证明题通常要求你在每一步注明所使用的定律名称。
Example: A + A·B = A (Absorption)
示例: A + A·B = A (吸收律)
5. De Morgan’s Theorems | 德摩根定理
De Morgan’s theorems are crucial in digital logic. The first theorem states that the complement of a product is the sum of the complements: (A·B)’ = A’ + B’. The second says that the complement of a sum is the product of the complements: (A + B)’ = A’·B’. These hold for any number of variables.
德摩根定理在数字逻辑中至关重要。第一定理指出,乘积的补等于补的和:(A·B)’ = A’ + B’。第二定理指出,和的补等于补的积:(A + B)’ = A’·B’。这些定理适用于任意数量的变量。
You can prove De Morgan’s laws using truth tables. For each input combination, the left‑hand side output equals the right‑hand side output. In exam questions, you will frequently be asked to apply these theorems to simplify expressions containing NAND and NOR gates or to convert a circuit from one gate type to another.
你可以使用真值表证明德摩根定律。对于每种输入组合,左侧输出等于右侧输出。在考试题目中,你经常需要应用这些定理来化简包含 NAND 和 NOR 门的表达式,或将电路从一种门类型转换为另一种。
Graphically, an AND gate with inverted output is equivalent to an OR gate with inverted inputs, and vice versa. This equivalence is the basis of bubble pushing in circuit diagrams.
从图形上看,输出带反相圈的与门等效于输入带反相圈的或门,反之亦然。这种等效性是电路图中“泡泡推演”的基础。
Example: (A·B·C)’ = A’ + B’ + C’
示例: (A·B·C)’ = A’ + B’ + C’
6. Simplifying Boolean Expressions Algebraically | 代数法化简布尔表达式
Algebraic simplification uses the fundamental laws to reduce the number of literals and operators. The goal is to obtain a minimal SOP or POS form that requires the fewest gates. A typical approach is to expand terms, apply absorption, use De Morgan’s to push NOTs inward, group common factors, and eliminate redundant terms.
代数化简利用基本定律来减少文字和运算符的数量。目标是获得需要最少门的最简 SOP 或 POS 形式。典型方法是展开各项、应用吸收律、用德摩根定律将非运算向内推、提取公因子,并消除冗余项。
Consider F = A·B + A·B’. Factorise out A: F = A·(B + B’) = A·1 = A. This shows how complement and identity laws reduce the expression dramatically. Always check if a variable appears in both complemented and uncomplemented forms — they can often be eliminated.
考虑 F = A·B + A·B’。提取公因子 A:F = A·(B + B’) = A·1 = A。这表明互补律和恒等律如何大幅化简表达式。务必检查变量是否同时以互补和非互补形式出现——它们常可被消去。
In the WJEC exam, you may need to simplify step‑by‑step, stating the law used. For instance: F = A·B + A’·C + A·B·C. Using absorption, A·B + A·B·C = A·B, so F = A·B + A’·C. Another method is to add a redundant term A·B·C that helps grouping.
在 WJEC 考试中,你可能需要逐步化简并注明所用定律。例如:F = A·B + A’·C + A·B·C。使用吸收律,A·B + A·B·C = A·B,因此 F = A·B + A’·C。另一种方法是添加一个冗余项 A·B·C 以辅助分组。
F = A·B·C + A·B’·C + A·B·C’ = A·C + A·B·C’ = A·(C + B·C’) …
F = A·B·C + A·B’·C + A·B·C’ = A·C + A·B·C’ = A·(C + B·C’) …
7. Karnaugh Maps | 卡诺图
Karnaugh maps (K‑maps) provide a visual method to simplify Boolean expressions of up to four variables. The cells are arranged so that adjacent cells differ by only one variable. By grouping adjacent 1s in powers of two (1,2,4,8), you can write the minimal SOP expression directly.
卡诺图提供了一种对最多四个变量的布尔表达式进行可视化简的方法。单元格的排列使得相邻单元格之间只有一个变量不同。通过将相邻的 1 按 2 的幂次分组(1、2、4、8),你可以直接写出最简的积之和表达式。
For a 2‑variable map (variables A and B), the four cells hold minterms A’B’, A’B, AB’, AB. For 3 variables, the map is a 2×4 grid; for 4 variables, a 4×4 grid. The edge cells are considered adjacent, so the map wraps around, enabling groupings across edges.
对于两变量卡诺图(变量 A 和 B),四个单元格分别存放最小项 A’B’、A’B、AB’、AB。对于三变量,卡诺图为 2×4 网格;对于四变量,为 4×4 网格。边缘单元格被视为相邻,因此卡诺图是环绕的,可以跨边缘分组。
When grouping, cover all 1s with the largest possible groups to minimise literals. Each group eliminates the variable that changes within the group. Overlapping groups are allowed. A ‘don’t care’ condition (X) in a truth table can be treated as either 0 or 1 to maximise grouping.
分组时,用尽可能大的组覆盖所有 1,以最小化文字数量。每个组消去在组内变化的变量。允许组之间重叠。真值表中的“无关项”(X) 可以视为 0 或 1,以最大化分组。
Example K‑map grouping leads to F = A·B’ + A·C. In the exam, you must draw the map clearly and indicate the groups.
示例卡诺图分组可得到 F = A·B’ + A·C。考试中必须清晰画出卡诺图并标明分组。
8. Deriving Expressions from Truth Tables (SOP & POS) | 从真值表推导表达式(积之和与和之积)
Given a truth table, you can write the Sum of Products (SOP) by summing (ORing) the minterms where the output is 1. Each minterm is an AND term that includes every variable in true or complemented form. For example, if F=1 when A=0,B=1,C=1, the minterm is A’·B·C.
给定真值表,你可以通过将输出为 1 的最小项求和(相或)来写出积之和 (SOP)。每个最小项是一个与项,包含所有变量的原变量或反变量形式。例如,若在 A=0,B=1,C=1 时 F=1,则最小项为 A’·B·C。
For Product of Sums (POS), you AND the maxterms where output is 0. A maxterm is an OR term covering all variables: if output=0 for A=0,B=0,C=0, the maxterm is (A+B+C). The POS expression is the AND of all such maxterms.
对于和之积 (POS),你将输出为 0 的最大项相与。最大项是涵盖所有变量的一个或项:若在 A=0,B=0,C=0 时输出=0,则最大项为 (A+B+C)。POS 表达式是所有此类最大项的与。
After deriving the canonical SOP or POS form, you can simplify using algebra or K‑maps. WJEC questions often ask you to obtain the minimal SOP directly from a truth table via K‑map, skipping the canonical expansion step.
在推导出规范 SOP 或 POS 形式后,你可以用代数或卡诺图进行化简。WJEC 题目通常要求你通过卡诺图直接从真值表得到最简 SOP,而跳过规范展开的步骤。
9. XOR and XNOR Gates | 异或门与同或门
The XOR (exclusive OR) gate outputs 1 when an odd number of inputs are 1; for two inputs, it’s represented as A ⊕ B and defined by F = A’·B + A·B’. XNOR (exclusive NOR) is the complement: F = A·B + A’·B’, which gives 1 when inputs are equal.
异或门在输入中 1 的个数为奇数时输出 1;对于两个输入,用 A ⊕ B 表示,定义为 F = A’·B + A·B’。同或门是其补:F = A·B + A’·B’,当输入相等时输出 1。
XOR and XNOR are not primitive gates in the Boolean algebra sense, but they appear frequently in arithmetic and parity circuits. The XOR operation is associative and commutative, and a ⊕ b ⊕ c can be implemented with two XOR gates. The XNOR can be built from XOR plus a NOT gate.
从布尔代数意义上说,XOR 和 XNOR 不是基本门,但它们常出现在算术和奇偶校验电路中。XOR 运算满足结合律和交换律,a ⊕ b ⊕ c 可用两个 XOR 门实现。XNOR 可由 XOR 加一个 NOT 门构成。
In simplification, recognise that A ⊕ A = 0, A ⊕ A’ = 1, A ⊕ 0 = A, A ⊕ 1 = A’. These identities help when XOR terms appear in larger expressions.
在化简中,要认识到 A ⊕ A = 0,A ⊕ A’ = 1,A ⊕ 0 = A,A ⊕ 1 = A’。当较大表达式中出现 XOR 项时,这些恒等式很有帮助。
10. Applying Boolean Algebra to Logic Circuits (Half and Full Adders) | 布尔代数在逻辑电路中的应用(半加器与全加器)
A half adder adds two single bits and produces a sum and a carry. The Boolean expressions are: Sum = A ⊕ B, Carry = A·B. This combinational circuit uses one XOR gate and one AND gate. It is the basic building block for addition.
半加器将两个单比特相加,产生一个和和一个进位。布尔表达式为:Sum = A ⊕ B,Carry = A·B。该组合电路使用一个 XOR 门和一个 AND 门。它是加法运算的基本构建模块。
A full adder adds three bits: A, B, and carry‑in (C_in). It outputs Sum = A ⊕ B ⊕ C_in and Carry_out = (A·B) + (C_in·(A ⊕ B)). This circuit can be constructed from two half adders and an OR gate. Understanding the Boolean derivation proves your ability to apply algebra to multi‑input circuits.
全加器将三个比特相加:A、B 和进位输入 (C_in)。它输出 Sum = A ⊕ B ⊕ C_in,Carry_out = (A·B) + (C_in·(A ⊕ B))。该电路可由两个半加器和一个或门构成。理解布尔推导可以证明你能将代数应用于多输入电路。
Exam questions often ask you to complete truth tables for half and full adders, write Boolean expressions, and simplify them. For instance, simplifying the full‑adder carry expression can be done algebraically or with a K‑map.
考试题目经常要求你填写半加器和全加器的真值表、写出布尔表达式并化简。例如,全加器进位表达式的化简既可以用代数法,也可以用卡诺图完成。
Carry_out = A·B + A·C_in + B·C_in (after simplification)
Carry_out = A·B + A·C_in + B·C_in (化简后)
11. Proving Equivalences Using Algebra | 用代数证明恒等式
Proving that two Boolean expressions are equivalent
Published by TutorHao | A-Level Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply