1 cse 20: lecture 7 boolean algebra ck cheng. 2 outline 1.introduction 2.definitions interpretation...

17
1 CSE 20: Lecture 7 Boolean Algebra CK Cheng

Upload: audra-stevens

Post on 20-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

1

CSE 20: Lecture 7Boolean Algebra

CK Cheng

Page 2: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

2

Outline

1. Introduction 2. Definitions

Interpretation of Set Operations Interpretation of Logic Operations

3. Theorems and Proofs Multi-valued Boolean Algebra

4. Transformations

Page 3: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

3

1. Introduction: iClicker

Boolean algebra can be used for: A.Set operationB.Logic operationC.Software verificationD.Hardware designsE.All of the above.                                     

Page 4: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

4

1. Introduction

Boolean algebra can be used for: A.Set operation (union, intersect, exclusion)B.Logic operation (AND, OR, NOT)C.Software verificationD.Hardware designs (control, data process)                                     

Page 5: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

5

Introduction: Basic ComponentsWe use binary bits to represent true or false.A=1: A is trueA=0: A is falseWe use AND, OR, NOT gates to operate the logic.

NOT gate inverts the value (flip 0 and 1)y = NOT (A)= A’

                  

id A NOT A

0 0 11 1 0

A A’

Page 6: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

6

Introduction: Basic Components

OR gate: Output is true if either input is truey= A OR B

id A B A OR B0 0  0 0

1 0  1 1

2 1  0 1

3 1  1 1

A

BA OR B

Page 7: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

7

Introduction: Basic Components

AND gate: Output is true only if all inputs are truey= A AND B

Id A B A AND B0 0  0 0

1 0  1 0

2 1  0 0

3 1  1 1

A

BA AND B

Page 8: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

8

Introduction: Half Adder A Half Adder:Carry = A AND BSum = (A AND B’) OR (A’ AND B)  

A

B

Cout = A AND B

id A, B Cout, Sum

0 00 0 0

1 01 0 1

2 10 0 1

3 11 1 0

Page 9: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

9

Introduction: Half Adder A Half Adder:

Cout = A AND BSum = (A AND B’) OR (A’ AND B)  

Sum:

A

BB’

A’ A’ and B

A and B’

(A and B’) or (A’ and B)

Page 10: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

10

Introduction: Multiplexer

A multiplexer: If S then Z=A else Z=B  

A S and A

S’and B

(S and A) or (S’ and B)

B

S

Page 11: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

11

2. DefinitionBoolean Algebra: A set of elements B with two operations. + (OR, U, ˅ )

* (AND, ∩, ˄ ),satisfying the following 4 laws for every a, b, c in B. P1. Commutative Laws:

a+b = b+a; a*b = b*a, P2. Distributive Laws:

a+(b*c) = (a+b)*(a+c); a*(b+c)= (a*b)+(a*c), P3. Identity Elements: Set B has two distinct elements

denoted as 0 and 1, such that a+0 = a; a*1 = a, P4. Complement Laws:

a+a’ = 1; a*a’ = 0.

Page 12: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

Interpretation of Set Operations• Set: Collection of Objects • Example: • A = {1, 3, 5, 7, 9} • N = {x | x is a positive integer}, e.g. {1, 2, 3,…} • Z = {x | x is an integer}, e.g. {-1, 0, 4}• Q = {x | x is a rational number}, e.g. {-0.75, ⅔, 100} • R = {x | x is a real number}, e.g. {π, 12, -⅓} • C = {x | x is a complex number}, e.g. {2 + 7i} • Ф = {} or empty set

12

Page 13: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

P1. Commutative Laws in Venn Diagram

A U B= B U A

13

A∩B= B∩A

A A

B

B

Page 14: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

P2. Distributive Laws

• A∩(B U C) = (A∩B) U (A∩C)

14

A B

C

Page 15: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

P2. Distributive Laws

• A U (B∩C) = (A U B)∩(A U C)

15

A B

C

Page 16: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

P3. Identity Elements

• 0 = {}

• 1 = Universe of the set

• A U 0 = A

• A∩1 = A

16

A1

Page 17: 1 CSE 20: Lecture 7 Boolean Algebra CK Cheng. 2 Outline 1.Introduction 2.Definitions Interpretation of Set Operations Interpretation of Logic Operations

P4: Complement

• A U A’= 1

• A∩A’= 0

17

A

A’