boolean algebra - tauguy/computer_structure03/slides/exercise1.pdf · in a boolean algebra, each of...

27
Boolean Algebra Reference: Introduction to Digital Systems Miloš Ercegovac, Tomás Lang, Jaime H. Moreno Pages: 480-487

Upload: phamnhi

Post on 04-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Boolean Algebra

Reference: Introduction to Digital SystemsMiloš Ercegovac, Tomás Lang, Jaime H. MorenoPages: 480-487

��������������� ������������

����������

Page 2: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

A Boolean Algebra is a 3-tuple { B , + , · } , where

• B is a set of at least 2 elements

• ( + ) and ( · ) are binary operations (i.e. functions )

satisfying the following axioms:

BBB ��

A1. Commutative laws: For every a, b � B

I. a + b = b + a

II. a · b = b · a

“times” / ”AND”“plus” / ”OR”

A2. Distributive laws: For every a, b, c � B

I. a + (b · c) = (a+ b) ·(a + c)

II. a · (b + c) = (a · b) + (a · c)

Page 3: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

A3. Existence of identity elements: The set B has two distinct identity elements, denoted as 0 and 1, such that for every element a � B

I. a + 0 = 0 + a = a

II. a · 1 = 1 · a = a

multiplicative identity element

additive identity element

A4. Existence of a complement: For every element a � B there exists an element a’ such that

I. a + a’ = 1

II. a · a’ = 0 the complement of a

Precedence ordering: · before +

For example:a + (b · c) = a + bc

Page 4: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Switching Algebra

101

000

10ANDB = { 0 , 1 }

111

100

10OR

Theorem 1: The switching algebra is a Boolean algebra.

Page 5: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Proof:

By satisfying the axioms of Boolean algebra:

• B is a set of at least two elements

B = { 0 , 1} , 0 � 1 and |B| � 2.

101

000

10AND

111

100

10OR

closure

• Closure of (+) and (·) over B (functions ) . BBB ��

Page 6: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

101

000

10AND

111

100

10OR

A1. Cummutativity of ( + ) and ( · ).

Symmetric about the main diagonal

A2. Distributivity of ( + ) and ( · ).

11111

11110

11101

11100

11011

00010

00001

00000

(a + b )(a + c)a + bcabc

11111

11110

11101

00100

00011

00010

00001

00000

ab + aca(b + c)abc

Page 7: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

* Alternative proof of the distributive laws:

Claim: (follow directly from operators table)

• AND( 0 , x ) = 0 AND( 1 , x ) = x

• OR( 1 , x ) = 1 OR( 0 , x ) = x

Consider the distributive law of ( · ):

AND( a , OR( b , c ) ) = OR( AND( a , b ) , AND( a , c ) )

a = 0 : AND( 0 , OR( b , c ) ) = OR( AND( 0 , b ) , AND( 0 , c ) )

0 0

0

0

a = 1 : AND( 1 , OR( b , c ) ) = OR( AND( 1 , b ) , AND( 1 , c ) )

b c

OR( b , c )

OR( b , c )

Page 8: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Consider the distributive law of ( + ):

OR( a , AND( b , c ) ) = AND( OR( a , b ) , OR( a , c ) )

a = 0 : OR( 0 , AND( b , c ) ) = AND( OR( 0 , b ) , OR( 0 , c ) )

b c

AND( b , c )

AND( b , c )

a = 1 : OR( 1 , AND( b , c ) ) = AND( OR( 1 , b ) , OR( 1 , c ) )

1 1

1

1

Why have we done that?!

For complex expressions truth tables are not an option.

Page 9: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

A3. Existence of additive and multiplicative identity element.

0 + 1 = 1 + 0 = 1

0 · 1 = 1 · 0 = 0

0 – additive identity

1 – multiplicative identity

A4. Existence of the complement.

0110

0101

a · a’a + a’a’a

All axioms are satisfied Switching algebra is Boolean algebra.

Page 10: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorems in Boolean Algebra Theorem 2:

Every element in B has a unique complement.

Proof:

Let a � B. Assume that a1’ and a2’ are both complements of a, (i.e. ai’ + a = 1 & ai’ · a = 0), we show that a1’ = a2’ .

111 ���� aa

� �21 aaa ����

211 aaaa ������

211 aaaa ������

210 aa ����

21 aa ����

Identity

a2’ is the complement of a

distributivity

commutativity

a1’ is the complement of a

Identity

Page 11: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

We swap a1’ and a2’ to obtain,

21

122

aa

aaa

����

�����

21 aa ���

’ can be considered as a unary operation

called complementation

Complement uniqueness

BB�

Page 12: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Boolean expression - Recursive definition:base: 0 , 1 , a � B – expressions.recursion step: Let E1 and E2 be Boolean expressions.

Then,E1’( E1 + E2 ) ( E1 · E2 )

expressions

Example:

c

b aa’ 0

( a’ + 0 )

( ( a’ + 0 ) · c )

( b + a )

( ( a’ + 0 ) · c ) + ( b + a )’ )

( b + a )’

a

Page 13: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Dual transformation - Recursive definition:Dual: expressions expressionsbase: 0 1

1 0a a , a � B

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) ]

Example:( ( a + b ) + ( a’ · b’ ) ) · 1

( ( a · b ) · ( a’ + b’ ) ) + 0

Page 14: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

A1. Commutative laws: For every a, b � B

I. a + b = b + a

II. a · b = b · a

A2. Distributive laws: For every a, b, c � B

I. a + (b · c) = (a+ b) ·(a + c)

II. a · (b + c) = (a · b) + (a · c)

A3. Existence of identity elements: The set B has two distinct identity elements, denoted as 0 and 1, such that for every element a � B

I. a + 0 = 0 + a = a

II. a · 1 = 1 · a = a

A4. Existence of a complement: For every element a � B there exists an element a’ such that

I. a + a’ = 1

II. a · a’ = 0

The axioms of Boolean algebra are in dual pairs.

Page 15: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 3:

For every a � B:

1. a + 1 = 1

2. a · 0 = 0

Proof:

(1)

� �111 �� aa

� � � �1��� aaa

� �1��� aa

aa ��

1�

Identity

a’ is the complement of a

distributivity

Identity

a’ is the complement of a

Page 16: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

(2) we can do the same way:

� �000 ��� aa

� � � �0���� aaa

� �0��� aa

aa ���

0�

Identity

a’ is the complement of a

distributivity

Identity

a’ is the complement of a

Note that:• a · 0 , 0 are the dual of a + 1 , 1 respectively.• The proof of (2) follows the same steps exactly as the proof of (1) with

the same arguments, but applying the dual axiom in each step.

Page 17: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 4: Principle of Duality

Every algebraic identity deducible from the axioms of a Boolean algebra attains:

For example:( a + b ) + a’ · b’ = 1

( a · b ) · ( a’ + b’ ) = 0

Correctness by the fact that each axiom has a dual axiom as shown

� � � �2121 EdualEdualEE ��

Every theorem has its dual for “ free”

Page 18: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 5:

The complement of the element 1 is 0, and vice versa:

1. 0’ = 1

2. 1’ = 0

Proof:

By Theorem 3,

0 + 1 = 1 and

0 · 1 = 0

By the uniqueness of the complement, the Theorem follows.

Page 19: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 6: Idempotent Law

For every a � B

1. a + a = a

2. a · a = a

Proof:

(1)

� � 1�� aaaa

� � � �aaaa ���

� �� �aaa ���

0� aa�

Identity

a’ is the complement of a

distributivity

Identity

a’ is the complement of a

(2) duality.

Page 20: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 7: Involution Law

For every a � B

( a’ )’ = a

Proof:

( a’ )’ and a are both complements of a’ .

Uniqueness of the complement ( a’ )’ = a.

Theorem 8: Absorption Law

For every pair of elements a , b � B,

1. a + a · b = a

2. a · ( a + b ) = a

Proof: home assignment.

Page 21: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 9:

For every pair of elements a , b � B,

1. a + a’ · b = a + b

2. a · ( a’ + b ) = a·b

Proof:

(1)� �� �baaabaa �� '

� �ba�1

ba�

distributivity

a’ is the complement of a

Identity

(2) duality.

Page 22: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 10:

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: home assignment (hint: prove that both sides in (1) equal

[ ( a + b ) + c ] · [ a + ( b + c ) ] .)

Theorem 11: DeMorgan’s Law

For every pair of elements a , b � B,

1. ( a + b )’ = a’ · b’

2. ( a · b )’ = a’ + b’

Proof: home assignment.

Page 23: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Theorem 12: Generalized DeMorgan’s Law

Let { a , b , … , c , d} be a set of elements in a Boolean algebra. Then, the following identities hold:

1. (a + b + . . . + c + d)’ = a’ b’ . . .c’ d’

2. (a · b · . . . · c · d)’ = a’ + b’ + . . . + c’ + d’

Page 24: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

� � � �� ����

dcbadcba ��

� � dcba ��

� �

dcba ����� �

Induction assumption � � cbacba �����

��

Proof: By induction.

Induction basis: follows from DeMorgan’sLaw

( a + b )’ = a’ · b’ .

Induction hypothesis: DeMorgan’s law is true for n elements.

Induction step: show that it is true for n+1 elements.

Let a , b , . . . , c be the n elements, and d be the (n+1)st element.

Associativity

DeMorgan’s Law

Page 25: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

The symbols a, b, c, . . . appearing in theorems and axioms are gener ic var iables

Can be substituted by complemented variables or

expressions (formulas)

For example:

� � ''' baba �

� � abba ����

� �� � cbacba )'( ���

DeMorgan’sLaw� �

cb

baa

bb

aa

etc.

Page 26: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Other Examples of Boolean Algebras

Algebra of SetsConsider a set S.

B = all the subsets of S (denoted by P(S)).

� �� ���,,SPM �

“plus” � set-union U

“times” � set-intersection

Additive identity element – empty set Ø

Multiplicative identity element – the set S.

P(S) has 2|S| elements, where |S | is the number of elements of S

Page 27: Boolean Algebra - TAUguy/Computer_Structure03/slides/exercise1.pdf · In a Boolean algebra, each of the binary operations ( + ) and ( ·) is associative. ... Other Examples of Boolean

Algebra of Logic (Propositional Calculus)

Elements of B are T and F (true and false).

“plus” � Logical OR

“times” � Logical AND

� �� ���� ,,,FTM

Additive identity element – F

Multiplicative identity element – T