Binary Operation Boolean Logic

15
Lecture 5 Binary Operation Boolean Logic Lecturer: Sumaira Hussain S.M.I university

Transcript of Binary Operation Boolean Logic

Page 1: Binary Operation Boolean Logic

Lecture 5Binary Operation

Boolean Logic

Lecturer: Sumaira Hussain

S.M.I university

Page 2: Binary Operation Boolean Logic

Binary Operations

• Addition• Subtraction • Multiplication• Division

Page 3: Binary Operation Boolean Logic

Addition

Page 4: Binary Operation Boolean Logic

Subtraction

Page 5: Binary Operation Boolean Logic

Multiplication

Page 6: Binary Operation Boolean Logic

Division

Page 7: Binary Operation Boolean Logic

Boolean Logic OperationsLet x, y, z be Boolean variables. Boolean variables can only have binary values i.e., theycan have values which are either 0 or 1.

For example, if we represent the state of a light switch with a Boolean variable x, we will assign a value of 0 to x when the switch is OFF, and 1 when it is ONA few other names for the states of these Boolean variables

0 1Off OnLow HighFalse True

Page 8: Binary Operation Boolean Logic

Boolean Logic

• AND• OR• NOT

Page 9: Binary Operation Boolean Logic

We define the following logic operations or functions among the Boolean variables

Name Example SymbolicallyNOT y = NOT(x) x´AND z = x AND y x · yOR z = x OR y x + y

Page 10: Binary Operation Boolean Logic

Truth Table

A truth table defines the output of a logic function for all possible inputs.

Number of rows in a truth table?2nn = number of input variables

Page 11: Binary Operation Boolean Logic

NOT Operation

Truth Table for the NOT OperationX y = x´0 11 0

Page 12: Binary Operation Boolean Logic

AND Operation

Truth Table for the AND OperationX y z = x · y0 0 00 1 01 0 01 1 1

Page 13: Binary Operation Boolean Logic

OR OperationTruth Table for the OR Operation

x y z = x + y0 0 00 1 11 0 11 1 1

Page 14: Binary Operation Boolean Logic

Examples

z = (x + y)´

x y x + y z = (x + y)´0 0 0 10 1 1 01 0 1 01 1 1 0

Page 15: Binary Operation Boolean Logic

Examples

z = y · (x + y)

x y x + y z = y · (x+ y)0 0 0 00 1 1 11 0 1 01 1 1 1