מבוא למחשבים ספרתיים+ מבנה המחשב #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 a1 b Commutativity ab 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 ca a b c b c a b ca aa b c Distributivity aa 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 cb c a b cb a b cc Commutativity a b cb ba b c Distributivity ba b bc Distributivity ba bb bc Idempotent Law ba b bc Absorption Law ba b Commutativity Absorption Law b ba b a b cb c a b cb a b cc c Same transitions Putting it all together: A a b c a a b c b c · before + a b ca a b cb a b cc a a b c b c Also, A a b a b c ca b c aa b c ba b c ca 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 ab 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 11 1 Idempotent Law Commutativity a b ab ab a b Distributivity aba abb Commutativity baa abb Associativity baa abb Commutativity baa abb 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 00 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 PS , , 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 PS → |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 xZ 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 Af d dual Af dual Af 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 AA Af d fA ff d AA Af d fA ff d A’ is the complement of A 0 Af d fA ff d Identity Af d fA ff d Commutativity Af Af 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 ac bc ab ac Identity a’ is the complement of a ab ac bc ab1 ac1 bc1 ab1 ac1 bca a Distributivity ab1 ac1 bca bca Commutativity ab1 ac1 abc acb Commutativity abc ab1 acb ac1 Distributivity abc 1 acb 1 Theorem: For any a B, a+1=1 ab1 ac1 Identity ab ac dual g dual Af Af d ab ac bc ab ac Af Af d ff d Af Af d For example: f b cv f d bc v g ab cv abc v self-dual Easier proof (1) for switching algebra only: (using dual properties) dual g dual Af Af d Af Af d ff d f 0 and f d 1 Switching algebra OR f 1 and f d 0 Af Af d 0 Identity Af Af d ff d 0 Easier proof (2) for switching algebra only: (case analysis) dual g dual Af Af d Af Af 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