Some “facts” about software…

Download Report

Transcript Some “facts” about software…

Digital Logic Circuits – Chapter 1
Section 1-3, 1-2
Boolean Algebra
• What is “Algebra”?
– A branch of mathematics in which symbols
represent numbers or members of a
specified set and are used to represent
quantities and to express general
relationships that hold for all members of
the set.
Boolean Algebra
• What is “Boolean”?
– Of or relating to a data type or variable in a
programming language that can have one
of two values, true or false.
Boolean Algebra
• Therefore
– Boolean algebra is an algebra that deals
with binary variables and logic operations
• But why is it called “Boolean”?
– Invented by English mathematician George
Boole in the 1850’s (published in 1854)
Boolean Algebra
• Boolean algebra consists of…
– A set of symbols that represent variables
• Use letters just like “regular algebra”
• A, B, C, a, b, c…
– Variables are binary (2-valued)
• 0, 1
• true, false
– Three basic operators
• AND, OR, NOT
– Other symbols
• ()=
Boolean Operators
• AND
– Notation: A · B, AB, (AB), A(B)
– Yields a value of 1 when both A and B are
1
– Yields a value of 0 when either A or B is 0
Boolean Operators
• OR
– Notation: A + B
– Yields a value of 1 when either A or B is 1
– Yields a value of 0 when both A and B are
0
Boolean Operators
• NOT
– Notation: A, A’
– Yields a value of 1 A is 0
– Yields a value of 0 when A is 1
Boolean Expressions
• As in “regular” algebra, variables,
operators, and symbols can be
combined to form expressions or
functions
F(x, a, b) = x + (a · b)
– F is a boolean function of three variables
– Often written as:
F = x + (a · b)
Boolean Functions
• Solution is found by plugging in values
for the variables and applying the
operators
F = x + (a · b)
– Given x=0, a=1, b=0 we have
F(0, 1, 0) = 0 + (1 · 0)
F(0, 1, 0) = 0 + (1 · 1)
F(0, 1, 0) = 0 + (1 · 1)
F(0, 1, 0) = 0 + 1
F(0, 1, 0) = 1
Operator Precedence
• NOT operators are done first
• Parenthesized expressions second
• AND operators are done third (left to
right)
• OR operators are done fourth (left to
right)
• Thus
AB + CD is the same as (AB) + (CD),
not A(B + C)D
Boolean Functions
• Typically, we want to exhaustively
evaluate a given Boolean function
– That is, we want to know its functional
value for every possible combination of
inputs
– This leads us to Truth Tables
Truth Tables
• List all possible combinations of input values
in the left hand columns
• List expression result in the right hand
column
A
0
0
1
1
B
0
1
0
1
AB
A
B
A+B
A
A
0
0
0
0
1
0
1
1
1
0
1
0
1
1
1
1
0
0
0
1
Truth Tables
• For more complex expressions you will
[typically] create columns for each operation:
• F(x, a, b) = x + (a · b)
x
a
b
b
(a·b)
x+(a·b
)
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
1
0
0
0
1
0
0
1
0
1
1
0
1
0
0
1
1
1
0
1
1
1
1
1
1
0
0
1
Truth Tables
• Doesn’t matter what order the input variables
are, just a long as all combinations are
included.
x
a
b
b
(a·b)
x+(a·b)
0
0
0
1
0
0
1
0
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
1
0
1
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
0
1
1
1
0
0
1
Truth Tables
• Are they the same?
x
a
b
b
(a·b)
x+(a·b)
x
a
b
b
(a·b)
x+(a·b)
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1
0
1
0
1
1
1
0
0
1
0
0
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
1
0
1
0
1
0
1
1
1
1
0
1
0
0
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
0
1
1
1
0
0
1
1
1
1
0
0
1
Proof via Truth Table
• Proof that our earlier conjecture
(AB) + (CD) ≠ A(B + C)D
is true via truth table
Other Methods
• Truth tables can always be used to
evaluate Boolean expressions
• But, they’re not always convenient
– They can get big and unmanageable quite
fast
• Fortunately, as in any good algebra,
Boole gave us a set of axioms (laws,
identities) that can be used to simplify
boolean expressions symbolically
Axioms
1.
2.
3.
4.
5.
6.
7.
8.
9.
x+0=x
x+1=1
x+x=x
x + x’ = 1
x+y=y+x
x + (y + z) = (x + y) + z
x(y + z) = xy + xz
(x + y)’ = x’y’
(x’)’ = x
10.
11.
12.
13.
14.
15.
16.
17.
x·1=x
x·0=0
x·x=x
x · x’ = 0
xy = yx
x(yz) = (xy)z
x + yz = (x + y)(x + z)
(xy)’ = x’ + y’
Axioms
•
•
•
•
•
•
•
•
•
1, 10 – identity laws
2, 11 – one, zero laws
3, 12 – idempotence laws
4, 13 – inverse laws
5, 14 – commutative laws
6, 15 – associative laws
7, 16 – distributive laws
8, 17 – De’ Mogan’s laws
9 – double negation law (?? – I made that
name up)
Why?
• What’s all this stuff used for?
– “The purpose of Boolean algebra is to
facilitate the analysis and design of digital
circuits.”
• Express a truth table relationship in algebraic
(symbolic) notation
• Express a logic diagram’s input/output
relationships in algebraic notation
• Provides a means for finding simpler circuits to
implement a given function
Logic Circuits
• These are the things
computers (and other
digital devices) are made
of
• Circuit designers use
Boolean algebra to design
circuits drawn on
schematic drawings
• Fabrication facilities use
schematic drawings to
produce silicon chips
Schematic Symbols
AND
OR
NOT
Logic Circuits
• F(x, a, b) = x + (a · b)
b
NOT
a
b
a
b
a
AND
x
AND
x
x
OR
OR
Homework
• Prove all 17 axioms using truth tables
• Due next lecture