+ All Categories
Home > Documents > Department of Computer and Information Science, School of Science, IUPUI

Department of Computer and Information Science, School of Science, IUPUI

Date post: 31-Dec-2015
Category:
Upload: joseph-carroll
View: 16 times
Download: 0 times
Share this document with a friend
Description:
Department of Computer and Information Science, School of Science, IUPUI. CSCI 240. Boolean Algebra. Dale Roberts, Lecturer Computer Science, IUPUI E-mail: [email protected]. Boolean Algebra. - PowerPoint PPT Presentation
21
Dale Robert Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI E-mail: [email protected] CSCI 240 Boolean Algebra
Transcript

Dale Roberts

Department of Computer and Information Science,School of Science, IUPUI

Dale Roberts, LecturerComputer Science, IUPUIE-mail: [email protected]

CSCI 240

Boolean Algebra

Dale Roberts

Boolean AlgebraBoolean Algebra

We observed in our introduction that early in the We observed in our introduction that early in the development of computer hardware, a decision development of computer hardware, a decision was made to use binary circuits because it greatly was made to use binary circuits because it greatly simplified the electronic circuit design.simplified the electronic circuit design.In order to work with binary circuits, it is helpful to In order to work with binary circuits, it is helpful to have a conceptual framework to manipulate the have a conceptual framework to manipulate the circuits algebraically, building only the final “most circuits algebraically, building only the final “most simple” result.simple” result.George Boole (1813-1864) developed a George Boole (1813-1864) developed a mathematical structure to deal with binary mathematical structure to deal with binary operations with just two values. Today, we call operations with just two values. Today, we call these structures these structures Boolean AlgebrasBoolean Algebras..

Dale Roberts

Boolean Algebra DefinedBoolean Algebra Defined

A Boolean Algebra B is defined as a 5-tupleA Boolean Algebra B is defined as a 5-tuple

{B, +, *, {B, +, *, ’, 0, 1}’, 0, 1}

+ and * are + and * are binarybinary operators; they have two operators; they have two operandsoperands

’ ’ is a is a unaryunary operator; it has one operand operator; it has one operand

The following five axioms must hold for any The following five axioms must hold for any elements a, b, c elements a, b, c {0,1}{0,1}

Dale Roberts

AxiomsAxioms

LawLaw Form 1Form 1 Form 2Form 2

CommutativeCommutative a + b = b + aa + b = b + a a * b = b * aa * b = b * a

DistributiveDistributive a + (b * c) = (a + b)*(a + c)a + (b * c) = (a + b)*(a + c) a * (b + c) = (a * b)+(a * c)a * (b + c) = (a * b)+(a * c)

IdentityIdentity a + 0 = aa + 0 = a a * 1 = aa * 1 = a

ComplementComplement a + a’ = 1a + a’ = 1 a * a’ = 0a * a’ = 0

Dale Roberts

Boolean Algebra is not regular algebra!Boolean Algebra is not regular algebra!

We recognize Form 2 of distributive law:We recognize Form 2 of distributive law: a * (b + c) = (a * b)+(a * c)a * (b + c) = (a * b)+(a * c)(Multiplication is distributive over addition)(Multiplication is distributive over addition)

Is Form 1 of distributive law is true?Is Form 1 of distributive law is true? a + (b * c) = (a + b)*(a + c) a + (b * c) = (a + b)*(a + c)

4 + (3 * 2) =? (4 + 3)(4 + 2)4 + (3 * 2) =? (4 + 3)(4 + 2)4 + 6 =? 7 * 64 + 6 =? 7 * 610 10 ≠ 42≠ 42

Dale Roberts

TerminologyTerminology

Element 0 is called the Element 0 is called the zerozero element. In computer element. In computer science, we’ll call the 0 element “FALSE”.science, we’ll call the 0 element “FALSE”.Element 1 is called the Element 1 is called the unitunit element. In computer element. In computer science, we’ll call the 1 element “TRUE”.science, we’ll call the 1 element “TRUE”.In computer science, we’ll call the + operation “OR”. In computer science, we’ll call the + operation “OR”. The result of + is called The result of + is called sum.sum.In computer science, we’ll call the * operation “AND”. In computer science, we’ll call the * operation “AND”. The result of * is called The result of * is called productproduct..In computer science, we’ll call the In computer science, we’ll call the ’ operation “NOT”. ’ operation “NOT”. The result of The result of ’’ is called is called complement.complement.Juxtaposition implies * operation: Juxtaposition implies * operation: ab = a * bab = a * bOperator order of precedence is: Operator order of precedence is: (), (), ’, *, +’, *, +..a+bc = a+(b*c) a+bc = a+(b*c) ≠ (a+b)*c≠ (a+b)*cab’ = a(b’) ≠ (a*b)’ab’ = a(b’) ≠ (a*b)’

Dale Roberts

Single Bit Boolean AlgebraSingle Bit Boolean AlgebraDefine a Boolean Algebra where Define a Boolean Algebra where 00

and and 11 are are bits.bits.1’ = 0 and 0’ = 11’ = 0 and 0’ = 1

++ 00 11

00 00 11

11 11 11

** 00 11

00 00 00

11 00 11

Dale Roberts

Proof by Truth TableProof by Truth Table

Consider Form 1 of the distributive theorem:Consider Form 1 of the distributive theorem: a + (b * c) = (a a + (b * c) = (a + b)*(a + c).+ b)*(a + c). Is it true for a two bit Boolean Algebra? Is it true for a two bit Boolean Algebra?

Can prove using a truth table. How many possible combinations of Can prove using a truth table. How many possible combinations of aa, , bb, and , and cc are there? are there?

Three variables, each with two values: Three variables, each with two values: 2*2*2 = 22*2*2 = 233 = 8 = 8

aa bb cc b*cb*c a+(b*c)a+(b*c) a+ba+b a+ca+c (a+b)*(a+c(a+b)*(a+c))

00 00 00

00 00 11

00 11 00

00 11 11

11 00 00

11 00 11

11 11 00

11 11 11

Dale Roberts

Proof by Truth Table Proof by Truth Table (cont)(cont)

Consider Form 1 of the distributive theorem: Consider Form 1 of the distributive theorem: a + (b * c) a + (b * c) = (a + b)*(a + c).= (a + b)*(a + c). Is it true for a two bit Boolean Algebra? Is it true for a two bit Boolean Algebra?Can prove using a truth table. How many possible Can prove using a truth table. How many possible combinations of combinations of aa, , bb, and , and cc are there? are there? Three variables, each with two values: 2*2*2 = 2Three variables, each with two values: 2*2*2 = 233 = 8 = 8

aa bb cc b*cb*c a+(b*c)a+(b*c) a+ba+b a+ca+c (a+b)*(a+c(a+b)*(a+c))

00 00 00 00 00 00 00 00

00 00 11 00 00 00 11 00

00 11 00 00 00 11 00 00

00 11 11 11 11 11 11 11

11 00 00 00 11 11 11 11

11 00 11 00 11 11 11 11

11 11 00 00 11 11 11 11

11 11 11 11 11 11 11 11

Dale Roberts

n-bitn-bit Boolean Algebra Boolean Algebra

Single bit Boolean Algebra can be extended Single bit Boolean Algebra can be extended to to n-bitn-bit Boolean Algebra by define Boolean Algebra by define sum, sum, product product andand complement complement as bit-wise as bit-wise operationsoperations

Let a = 1101010, b = 1011011Let a = 1101010, b = 1011011

a + b = 1101010 + 1011011 = 1111011a + b = 1101010 + 1011011 = 1111011

a * b = 1101010 * 1011011 = 1001010a * b = 1101010 * 1011011 = 1001010

a’ = 1101010’ = 0010101a’ = 1101010’ = 0010101

Dale Roberts

Principle DualityPrinciple Duality

The dual of a statement S is obtained by The dual of a statement S is obtained by interchanging * and +; 0 and 1.interchanging * and +; 0 and 1.Write the dual of (a*1)*(0+a’) = 0.Write the dual of (a*1)*(0+a’) = 0.(a+0)+(1*a’) = 1(a+0)+(1*a’) = 1Did you notice that all the original axioms Did you notice that all the original axioms are duals of each other?are duals of each other?Thus, the dual of any theorem in a Boolean Thus, the dual of any theorem in a Boolean Algebra is also a theorem.Algebra is also a theorem.This is called the This is called the Principle of DualityPrinciple of Duality..

Dale Roberts

Named TheoremsNamed Theorems

All of the following theorems can be proven based on the All of the following theorems can be proven based on the axioms. They are used so often that they have names.axioms. They are used so often that they have names.

IdempotentIdempotent a + a = aa + a = a a * a = aa * a = a

BoundednessBoundedness a + 1 = 1a + 1 = 1 a * 0 = 0a * 0 = 0

AbsorptionAbsorption a + (a*b) = aa + (a*b) = a a*(a+b) = aa*(a+b) = a

AssociativeAssociative (a+b)+c=a+(b+c)(a+b)+c=a+(b+c) (a*b)*c=a*(b*c)(a*b)*c=a*(b*c)

The theorems can be proven for a two-bit Boolean Algebra The theorems can be proven for a two-bit Boolean Algebra using a truth table, but you must use the axioms to using a truth table, but you must use the axioms to prove it in general for all Boolean Algebras.prove it in general for all Boolean Algebras.

Dale Roberts

More Named TheoremsMore Named Theorems

InvolutionInvolution (a’)’ = a(a’)’ = a

DeMorgan’sDeMorgan’s (a+b)’ = a’ * b’(a+b)’ = a’ * b’ (a*b)’=a’ + b’(a*b)’=a’ + b’

DeMorgan’s Laws are particularly important in circuit DeMorgan’s Laws are particularly important in circuit design. It says that you can get rid of a complemented design. It says that you can get rid of a complemented output by complementing all the inputs and changing output by complementing all the inputs and changing ANDs to ORs. (More about circuits coming up…)ANDs to ORs. (More about circuits coming up…)

Dale Roberts

Proof using TheoremsProof using Theorems

Use the properties of Boolean Algebra to reduce Use the properties of Boolean Algebra to reduce (x + y)(x + x)(x + y)(x + x) to to xx. . Warning, make sure you use Warning, make sure you use the laws precisely.the laws precisely.

(x + y)(x + x)(x + y)(x + x) Given Given

(x + y)x(x + y)x Idempotent Idempotent

x(x + y)x(x + y) Commutative Commutative

xx Absorption Absorption

Unlike truth tables, proofs using Theorems are valid for any boolean algebra, but just bits.

Dale Roberts

Standard FormStandard Form

Like regular algebra, Boolean equations can be Like regular algebra, Boolean equations can be expressed as a sum of products. Each product expressed as a sum of products. Each product is a is a termterm of the equation. of the equation.

Consider the term xyx’z. We define a term to be Consider the term xyx’z. We define a term to be a a Fundamental ProductFundamental Product (FP) if it does not repeat (FP) if it does not repeat any literal. Since our term repeats x, is it not FP.any literal. Since our term repeats x, is it not FP.

You call always minimize a term to make it FP.You call always minimize a term to make it FP.xyx’z = xx’yz = 0yz (which law) = 0 (which law?)xyx’z = xx’yz = 0yz (which law) = 0 (which law?)

An expression E is sum-of-products form if it is An expression E is sum-of-products form if it is the sum of one ore more FPs, none of which is the sum of one ore more FPs, none of which is included in another.included in another.

Dale Roberts

Sum-of-Products FormSum-of-Products Form1. Consider E=xz’ + y’z + xyz’.

This is a sum of products, but is not sum-of-products form because xz’ is contained within xyz’. i.e. it can be reduced. (which law?)

2. Consider E=xz’ + x’yz’ + xy’z.

This is already sum-of-products form.

Any non-zero Boolean expression can be changed to sum-of-products form. (By duality, there is also a product-of-sums form, but it is used less often.)

Dale Roberts

Converting to Sum-of-Products FormConverting to Sum-of-Products Form1.1. Use DeMorgan’s Laws and Involution to Use DeMorgan’s Laws and Involution to

move complements inside parenthesis move complements inside parenthesis until only variables are complemented.until only variables are complemented.

2.2. Use distributive law to transform in to Use distributive law to transform in to sum of productssum of products

3.3. Use commutative, idempotent, and Use commutative, idempotent, and complement laws to transform each complement laws to transform each term into 0 or FP.term into 0 or FP.

4.4. Use absorption law to make sum-of-Use absorption law to make sum-of-products form.products form.

Dale Roberts

Example of conversion to sum-of-products formExample of conversion to sum-of-products form

Consider Consider E=((ab)’c)’((a’+c)(b’+c’))’E=((ab)’c)’((a’+c)(b’+c’))’

E=((ab)’’+c’)((a’+c)’+(b’+c’)’) – DeMorgan’s LawE=((ab)’’+c’)((a’+c)’+(b’+c’)’) – DeMorgan’s Law

E=(ab+c’)(ac’+bc) – DeMorgan’s and Involution LawsE=(ab+c’)(ac’+bc) – DeMorgan’s and Involution Laws

E=abac’ + abbc +ac’c’ + bcc’ – Distributive LawE=abac’ + abbc +ac’c’ + bcc’ – Distributive Law

E=abc’ + abc + ac’ + 0 – Idempotent and ComplementE=abc’ + abc + ac’ + 0 – Idempotent and Complement

E=ac’ + abc – Absorption LawE=ac’ + abc – Absorption Law

Dale Roberts

Complete Sum-of-Products FormComplete Sum-of-Products Form

A A complete sum-of-productscomplete sum-of-products form is a sum-of- form is a sum-of-products form where each term involves all the products form where each term involves all the variables. (Each term will have the same variables. (Each term will have the same number of literals.number of literals.

You can add missing variables by multiplying by You can add missing variables by multiplying by 1, where 1 is of the form 1, where 1 is of the form x + x’.x + x’.

Theorem: Every non-zero Boolean expression Theorem: Every non-zero Boolean expression can be placed in complete sum-of-products can be placed in complete sum-of-products form, and it is form, and it is uniqueunique..

Dale Roberts

Complete Sum-of-Products ExampleComplete Sum-of-Products Example

Express Express E(x,y,z) = (x’ + y)’ + x’yE(x,y,z) = (x’ + y)’ + x’y in complete sum- in complete sum-of-products form.of-products form.

E = xy’ + x’yE = xy’ + x’y – DeMorgan’s Law. – DeMorgan’s Law.If we didn’t know z was involved, we’d think we If we didn’t know z was involved, we’d think we were done.were done.

E=xy’(z + z’) + x’y(z + z’)E=xy’(z + z’) + x’y(z + z’)

E=xy’z + xy’z’ + x’yz + x’yz’E=xy’z + xy’z’ + x’yz + x’yz’ – Distributive Law – Distributive Law(Don’t simplify using Absorption, or you’ll take it (Don’t simplify using Absorption, or you’ll take it back out of Complete S-O-P form)back out of Complete S-O-P form)

Dale Roberts

SourcesSources

Lipschutz, Discrete Mathematics

Mowle, A Systematic Approach to Digital Logic Design


Recommended