代写 C A Boolean algebra is a set B of values together with:

A Boolean algebra is a set B of values together with:
– two binary operations, commonly denoted by + and ∙ ,
– a unary operation, usually denoted by ˉ or ~ or ’,
– two elements usually called zero and one, such that for every element x of B: x  x  1 and x  x  0
In addition, certain axioms must be satisfied:
– closure properties for both binary operations and the unary operation
– associativity of each binary operation over the other,
– commutativity of each each binary operation,
– distributivityofeachbinaryoperationovertheother,
– absorptionrules,
– existence of complements with respect to each binary operation
We will assume that ∙ has higher precedence than +; however, this is not a general rule for all Boolean algebras.
Boolean Algebra
BooleanAlgebra 1
CS@VT Computer Organization ©2005-2015 McQuain

Associative Laws: for all a, b and c in B,
(a  b)  c  a  (b  c) (a  b)  c  a  (b  c)
Commutative Laws: for all a and b in B,
abba abba
Distributive Laws: for all a, b and c in B, a(bc)(ab)(ac)
a(bc)(ab)(ac) a(ab)a a(ab)a
Absorption Laws: for all a, b and c in B,
Existence of Complements: for all a in B, there exists an element ā in B such that aa 1 aa 0
Axioms of Boolean Algebra
BooleanAlgebra 2
CS@VT Computer Organization ©2005-2015 McQuain

The classic example is B = {true, false} with the operations AND, OR and NOT. An isomorphic example is B = {1, 0} with the operations +, ∙ and ~ defined by:
a
b
a+b
a*b
~a
0
0
0
0
1
1
0
1
0
0
0
1
1
0
1
1
1
1
Given a set S, the power set of S, P(S) is a Boolean algebra under the operations union, intersection and relative complement.
Other, interesting examples exist…
Examples of Boolean Algebras
BooleanAlgebra 3
CS@VT Computer Organization ©2005-2015 McQuain

It’s also possible to derive some additional facts, including:
– the elements 0 and 1 are unique
– the complement of an element a is unique
– 0 and 1 are complements of each other
More Properties
BooleanAlgebra 4
CS@VT Computer Organization ©2005-2015 McQuain

DeMorgan’s Laws are useful theorems that can be derived from the fundamental properties of a Boolean algebra.
For all a and b in B, a  b  a  b
Of course, there’s also a double-negation law:
a  b  a  b a  a
aa  a a00
a1a
And there are idempotency laws: Boundedness properties:
a  a  a a  0  a
a11
DeMorgan’s Laws & More
BooleanAlgebra 5
CS@VT Computer Organization ©2005-2015 McQuain

A logic expression is defined in terms of the three basic Boolean operators and variables which may take on the values 0 and 1. For example:
z: x0y0x0y0
y: (x x )(x x x )x (x x )
12123123
A logic equation is an assertion that two logic equations are equal, where equal means that the values of the two expressions are the same for all possible assignments of values to their variables. For example:
x0y0x0y0 x0y0x0y0
Of course, equations may be true or false. What about the one above?
Logic Expressions and Equations
BooleanAlgebra 6
CS@VT Computer Organization ©2005-2015 McQuain

A Boolean expression can often be usefully transformed by using the theorems and properties stated earlier:
x0 y0x0 y0x0 y0x0 y0  x0  y0  x0  y0
 x0  y0  x0  y0
That is a relatively simple example of a reduction.
Try showing the following expressions are equal:
x0 y0 z0x0 y0 x0 z0
Why do they call it “algebra”?
BooleanAlgebra 7
CS@VT Computer Organization ©2005-2015 McQuain

Here’s another that happens to be related to binary addition:
ZABCABCABCABC Given
 ABC  ABC  ABC  ABC  ABC  ABC
 A  B  C  A  B  C  A  B  C  A  B  C  A  B  C  A  B  C 
 A  A  B  C  A  C  B  B  A  B  C  C  
1BC  AC1 AB1
ACBCAB Boundedness
Idempotence
Commutativity, Associativity
Commutativity, Distributivity
Complements
Why do they call it “algebra”?
BooleanAlgebra 8
CS@VT Computer Organization ©2005-2015 McQuain

A tautology is a Boolean expression that evaluates to true (1) for all possible values of its variables.
abababab
A contradiction is a Boolean expression that evaluates to false (0) for all possible values
aa of its variables.
aa
A Boolean expression is satisfiable if there is at least one assignment of values to its
variables for which the expression evaluates to true (1).
abab
Tautologies, Contradictions & Satisfiables
BooleanAlgebra 9
CS@VT Computer Organization ©2005-2015 McQuain

A Boolean expression may be analyzed by creating a table that shows the value of the expression for all possible assignments of values to its variables:
a
b
ab
ab
abab
0
0
0
1
1
1
0
0
0
0
0
1
0
0
0
1
1
1
0
1
Truth Tables
Boolean Algebra 10
CS@VT Computer Organization ©2005-2015 McQuain

Boolean equations may be proved using truth tables (dull and mechanical): a11 abc  abc
a
a+1
0
1
1
1
a
b
c
~(a*b*c)
~a*~b*~c
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
0
1
1
1
1
1
0
0
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
0
0
Proving Equations with Truth Tables
Boolean Algebra 11
CS@VT Computer Organization ©2005-2015 McQuain

Boolean equations may be proved using truth tables, which is dull and boring, or using the algebraic properties:
aB,a1a
a  a  a  a 
 a 1
aB,a0a
a  a  a  a 
 a  0
absorption, with b  a law of complements
absorption, with b  a law of complements
Note the duality
Proving Equations Algebraically
Boolean Algebra 12
CS@VT Computer Organization ©2005-2015 McQuain

a  B, a  a  a
a  a  a 1
 a  a  (a  a)  a  a
absorption, with b  1 law of complements
absorption, with b = a
Proving Equations Algebraically
Boolean Algebra 13
CS@VT Computer Organization ©2005-2015 McQuain

A Boolean expression is said to be in sum-of-products form if it is expressed as a sum of terms, each of which is a product of variables and/or their complements:
abab
It’s relatively easy to see that every Boolean expression can be written in this form.
Why?
The summands in the sum-of-products form are called minterms.
– each minterm contains each of the variables, or its complement, exactly once
– each minterm is unique, and therefore so is the representation (aside from order)
Sum-of-Products Form
Boolean Algebra 14
CS@VT Computer Organization ©2005-2015 McQuain

Given a truth table for a Boolean function, construction of the sum-of-products representation is trivial:
– for each row in which the function value is 1, form a product term involving all the variables, taking the variable if its value is 1 and the complement if the variable’s value is 0
– take the sum of all such product terms
x
y
z
F
0
0
0
0
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
xyz xyz
F  xyzxyzxyzxyz xyz
xyz
Example
Boolean Algebra 15
CS@VT Computer Organization ©2005-2015 McQuain

A Boolean expression is said to be in product-of-sums form if it is expressed as a product of terms, each of which is a sum of variables:
abab
Every Boolean expression can also be written in this form, as a product of maxterms.
Facts similar to the sum-of-products form can also be asserted here.
The product-of-sums form can be derived by expressing the complement of the expression in sum-of-products form, and then complementing.
Product-of-Sums Form
Boolean Algebra 16
CS@VT Computer Organization ©2005-2015 McQuain

Given a truth table for a Boolean function, construction of the product-of-sums representation is trivial:
– for each row in which the function value is 0, form a product term involving all the variables, taking the variable if its value is 1 and the complement if the variable’s value is 0
– take the sum of all such product terms; then complement the result
xyz
xyz
xyz Fxyzxyzxyzxyz
 (x  y  z)(x  y  z) (x  y  z)(x  y  z)
x
y
z
F
0
0
0
0
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
F  xyzxyzxyzxyz
xyz
Example
Boolean Algebra 17
CS@VT Computer Organization ©2005-2015 McQuain

A Boolean function takes n inputs from the elements of a Boolean algebra and produces a single value also an element of that Boolean algebra.
For example, here are all possible 2-input Boolean functions on the set {0, 1}:
A
B
zero
and
A
B
xor
or
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
0
0
1
1
0
0
1
1
1
1
0
1
0
1
0
1
0
1
A
B
nor
eq
B’
A’
nand
one
0
0
1
1
1
1
1
1
1
1
0
1
0
0
0
0
1
1
1
1
1
0
0
0
1
1
0
0
1
1
1
1
0
1
0
1
0
1
0
1
Boolean Functions
Boolean Algebra 18
CS@VT Computer Organization ©2005-2015 McQuain

Any Boolean function can be expressed using:
– only AND, OR and NOT
– only AND and NOT
– onlyORandNOT
– only AND and XOR
– onlyNAND
– onlyNOR
The first assertion should be entirely obvious.
The remaining ones are obvious if you consider how to represent each of the functions in the first set using only the relevant functions in the relevant set.
Universality
Boolean Algebra 19
CS@VT Computer Organization ©2005-2015 McQuain