Introduction to Digital Computers

advertisement
‫ מבוא למחשבים ספרתיים‬+ ‫מבנה המחשב‬
#2 ‫תרגול‬
Boolean Algebra cont’
The digital abstraction
Theorem: Absorption Law
For every pair of elements a , b  B,
1. a + a · b = a
2. a · ( a + b ) = a
Proof:
(1)
Identity
a  ab  a 1  ab
Distributivity
 a1  b 
Commutativity
 ab  1
Theorem: For any a  B,
a+1=1
 a 1
a
Identity
(2) duality.
Theorem: Associative Law
In a Boolean algebra, each of the binary operations ( + ) and
( · ) is associative. That is, for every a , b , c  B,
1. a + ( b + c ) = ( a + b ) + c
2. a · ( b · c ) = ( a · b ) · c
Proof:
(1) Let
A  a  b   c a  b  c 
Distributivity
Commutativity
A  a  b   ca  a  b   c b  c 
a  b   ca  aa  b   c
Distributivity
 aa  b   ac
Distributivity
 aa  ab  ac
Idempotent Law
Absorption Law
Absorption Law
 a  ab  ac
 a  ac
a
A  a  b   c a  a  b   c b  c 
a  b   cb  c   a  b   cb  a  b   cc
Commutativity
a  b   cb  ba  b   c
Distributivity
 ba  b   bc
Distributivity
 ba  bb  bc
Idempotent Law
 ba  b  bc
Absorption Law
 ba  b
Commutativity
Absorption Law
 b  ba
b
a  b   cb  c   a  b   cb  a  b   cc
c
Same transitions
Putting it all together:
A  a  b   c a  a  b   c b  c 
· before
+
 a  b  ca   a  b  cb  a  b  cc
a
 a  b  c 
b
c
Also,
A  a  b a  b  c   ca  b   c 
 aa  b  c   ba  b  c    ca  b  c
 a  b   c
A  a  b   c  a  b  c 
(2) Duality
Theorem 11: DeMorgan’s Law
For every pair of elements a , b  B,
1. ( a + b )’ = a’ · b’
2. ( a · b )’ = a’ + b’
Proof:
(1) We first prove that (a+b) is the complement of a’·b’.
Thus, (a+b)’ = a’·b’
By the definition of the complement and its uniqueness, it suffices to
show: (i)
(a+b)+(a’b’) = 1 and
(ii)
(2) Duality
(a+b)(a’b’) = 0.
(a·b)’ = a’+b’
Distributivity
a  b   ab  a  b   a a  b   b
Commutativity
 b  a   a a  b   b
Associativity
 b  a  a a  b  b
a’ and b’ are the complements of
a and b respectively
Theorem: For any a  B,
a+1=1
 b  1  a  1
 11
1
Idempotent Law
Commutativity
a  b   ab  ab  a  b 
Distributivity
 aba  abb
Commutativity
 baa  abb
Associativity
 baa   abb 
Commutativity
 baa  abb
a’ and b’ are the complements of
a and b respectively
Theorem: For any a  B,
a·0=0
Idempotent Law
 b  0  a  0
 00
0
Algebra of Sets
Consider a set S.
B = all the subsets of S (denoted by P(S)).
“plus”  set-union ∪
“times”  set-intersection ∩
M  PS , , 
Additive identity element – empty set Ø
Multiplicative identity element – the set S.
Complement of X  B:
X  S \ X
Theorem: The algebra of sets is a Boolean algebra.
Proof:
By satisfying the axioms of Boolean algebra:
• B is a set of at least two elements
For every non empty set S:
 , S   PS 
→
|B| ≥ 2.
• Closure of (∪) and (∩) over B (functions B  B  B ) .
X , Y  S .
X  P(S ) by definition
Y  P(S ) by definition
X  Y  S and X  Y  P( S ) by definition
X  Y  S and X  Y  P( S ) by definition
A1. Cummutativity of ( ∪ ) and ( ∩ ).
X  Y  x : x  X or x  Y 
Y  X  x : x  Y or x  X 
An element lies in the union X  Y precisely when it lies in one of
the two sets X and Y. Equally an element lies in the union Y  X
precisely when it lies in one of the two sets X and Y. Hence,
X Y  Y  X
X  Y  x : x  X and x  Y 
Y  X  x : x  Y and x  X 
X Y  Y  X
A2. Distributivity of ( ∪ ) and ( ∩ ).
X  Y  Z    X  Y    X  Z 
x  X  Y  Z .
 Let
x X
x Y  Z
and
x Y
or
xZ
If
x  Y , We have
x  X and
x  Y . Hence,
x  X Y
If
x  Z , We have
x  X and x  Z . Hence,
x X Z
x  X  Y or x  X  Z
x  X Y  X  Z 
X  Y  Z    X  Y    X  Z 
 This can be conducted in the same manner as ⊆.
We present an alternative way:
Definition of intersection
X Y  X
and X  Z  X
X Y  X  Z   X *
Also, definition of intersection
X Y  Y
definition of union
Y Y Z
Similarly,
**
X Y  X  Z   Y  Z
X Y  Y  Z
X Z Y Z
Taking (*) and (**) we get,
 X  Y    X  Z   X  Y  Z 


X  Y  Z    X  Y    X  Z 
Distributivity of union over intersection can be conducted in the same manner.
X  Y  Z    X  Y    X  Z 
A3. Existence of additive and multiplicative identity element.
X  S . X      X  X
 - additive identity
X  S . X  S  S  X  X
S - multiplicative identity
A4. Existence of the complement.
X  B. X   S \ X
X  B. X  S \ X   S \ X   X  S
X  B. X  S \ X   S \ X   X  
All axioms are satisfied
Algebra of sets is Boolean algebra.
Boolean expression - Recursive definition:
base: 0 , 1 , a  B – expressions.
recursion step: Let E1 and E2 be Boolean expressions.
Then,
E1’
( E1 + E2 )
( E 1 · E2 )
Dual transformation - Recursive definition:
Dual: expressions → expressions
base: 0 → 1
1→0
a → a , a  B\{0,1}
recursion step: Let E1 and E2 be Boolean expressions.
Then,
E1’ → [dual(E1)]’
( E1 + E2 ) → [ dual(E1) · dual(E2) ]
( E1 · E2 ) → [ dual(E1) + dual(E2) ]
Let fd be the dual of a function f ( x1 , x2 , … , xn )
Lemma: In switching algebra,
fd = f’ ( x1’, x2’, … , xn’)
Proof:
Let f ( x1 , x2 , … , xn ) be a Boolean expression.
We show that applying the complement on the whole expression together
with replacing each variable by it’s complement, yields the dual
transformation definition.
Induction basis: 0 , 1 – expressions.

f x   0

f x   1
f   x1 , x2 ,, xn 

f  x   0  1  f d
f   x1 , x2 ,, xn 


f  x   1  0  f d
  
  
Induction hypothesis: Lemma holds for Boolean expressions: E1 and E2 .
That is:
E1 x1 , x2 ,  , xn   E1,d
E2  x1 , x2 ,  , xn   E2,d
Induction step: show that it is true for
E1’
( E 1 + E2 )
( E 1 · E2 )
E  x1 , x2 ,, xn   E1  x1 , x2 ,, xn   E2  x1 , x2 ,, xn 
If
then,

E  x1, x2 ,, xn   E1  x1, x2 , , xn   E2  x1, x2 ,, xn 
  
De' Morgan Law
 E1 x1, x2 ,, xn   E2  x1, x2 ,, xn 
hypothesis
induction

  E1,d  x1 , x2 ,, xn   E2,d x1 , x2 ,, xn 
 Ed  x1 , x2 ,, xn 



E x   E1  x   E2  x 


 
then,
E  x   E1  x   E2  x 
If
  





 E1  x   E2  x
   


 E1,d  x   E2,d  x 
De' Morgan Law
induction hypothesis

 Ed  x 
If



E x   E1  x 


E x  E1 x
 
 E1 x 
 
induction hypothesis
     E1,d  x 

 Ed  x 
then,
Definition: A function f is called self-dual if f = fd
Lemma: For any function f and any two-valued variable A, the
function g = Af + A’fd is a self-dual.
Proof: (holds for any Boolean algebra)
dual  g   dual  Af  Af d 
 dual  Af   dual  Af d 
Dual definition
 dual  A  dual  f   dual  A  dual  f d 
  A  f d    A  f 
Distributivity
  A  f d  A   A  f d  f
Commutativity
 A A  f d   f  A  f d 
 A A  f d   f  A  f d 
Distributivity
Commutativity
 AA  Af d  fA  ff d
 AA  Af d  fA  ff d
A’ is the complement of A
 0  Af d  fA  ff d
Identity
 Af d  fA  ff d
Commutativity
 Af  Af d  ff d
Notice that the above expression has the form:
ab + a’c +bc
where “a” =A, “b”=f, “c” = fd.
We now prove a stronger claim:
a, b, c  B. ab  ac  bc  ab  ac
Identity
a’ is the complement of a
ab  ac  bc  ab1  ac1  bc1
 ab1  ac1  bca  a
Distributivity
 ab1  ac1  bca  bca
Commutativity
 ab1  ac1  abc  acb
Commutativity
 abc  ab1  acb  ac1
Distributivity
 abc  1  acb  1
Theorem: For any a  B,
a+1=1
 ab1  ac1
Identity
 ab  ac
dual  g   dual  Af  Af d 

ab  ac  bc  ab  ac
 Af  Af d  ff d
 Af  Af d
For example:
f  b  cv
f d  bc  v 
g  ab  cv   abc  v 
self-dual
Easier proof (1) for switching algebra only: (using dual properties)
dual  g   dual  Af  Af d 

 Af  Af d  ff d
f  0 and f d  1
Switching algebra
OR
f  1 and f d  0
 Af  Af d  0
Identity
 Af  Af d
ff d  0
Easier proof (2) for switching algebra only: (case analysis)
dual  g   dual  Af  Af d 

 Af  Af d  ff d
A=0
0’ = 1
Identity
Commutativity
dual ( g )  0  f  0  f d  ff d
 0  f  1 f d  ff d
 0  f  f d  ff d
 f  0  fd  fd f
Theorem: For any a  B,
a·0=0
 0  fd
Identity
 fd
Absorption Law
g  0  f  0  f d    f d
A=1
dual ( g )  1 f  1  f d  ff d

 f
g  1 f  1  f d    f
Example of a transfer function for an inverter
f : 0,1  0,1
f  x  strictly decreasing in 0,  
x  0,  .
f  x   0
f x
f  x  concave in the interval 0,  
f  x  strictly increasing in  ,1
x   ,1.
f  x   0
f  x  is convex in the interval  ,1
f  x  monotone decreasing
f x
f 0  -1
f    -1
! x1   .
f  x1   1
f 1  -1
! x2   .
f  x2   1
f  x  continuous
f x
slope = -1
1
slope = -1
x1  x2
1
x
f x
slope = -1
1
Vhigh,out
slope = -1
Vlow ,out
Vlow,in  Vhigh,in
1
x
true only if:
Vhigh,out  Vhigh,in  Vlow,in  Vlow,out
BUT, this is not always the case.
For example:
f x
1
slope = -1
slope = -1
Vhigh,out
Vlow,out

1
x
Vlow,in Vhigh,in
Vhigh,in  Vhigh,out
Moreover, in this example it can be proved that no threshold values exist,
which are consistent with definition 3 from lecture notes.
there exists a point x0 : x1  x0  x2
Using the assumption:
such that f  x0   x0
f x
start with :
 ,out  Vhigh
 ,in  Vlow
 ,in  Vlow
 ,out  x0
Vhigh
f (x) = x
1
f  x0 
y
x1 x0 x2
1
x
f  x0   
slope < -1
y  x
x
x0 x0  
set :
 ,in    x0  
Vhigh,in  Vhigh
Vlow,out  f Vhigh,in   f  x0   
f x
 f  x0   
f (x) = x
1
 x0  
f  x0 
y
f  x0   
x
x0
x1 x0 x2
1
x
y  x  
x0  
 ,in    x0  
Vlow,in  Vlow
Vhigh,out  f Vlow,in   f  x0   
 f  x0   
slope < -1
 x0  
Vhigh,in  x0  
Vlow,out  x0  
slope = -1
f x
Vlow,in  x0  
f (x) = x
Vhigh,out  x0  
1
Vhigh,out
slope = -1
Vhigh,out  Vhigh,in  Vlow,in  Vlow,out
true if:
Vlow ,out
x1 x0 x2
Vlow,in
1
  min  x2  x0 , x0  x1 
x
Vhigh,in
slope < -1
 set
  min  x2  x0 , x0  x1 
Download