COS 140: Foundations of Computer Science

Similar documents
Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

BOOLEAN ALGEBRA. Introduction. 1854: Logical algebra was published by George Boole known today as Boolean Algebra

EEE130 Digital Electronics I Lecture #4

1 Boolean Algebra Simplification

Logic Design. Chapter 2: Introduction to Logic Circuits

INTRODUCTION TO INFORMATION & COMMUNICATION TECHNOLOGY LECTURE 8 : WEEK 8 CSC-110-T

Logic Gate Level. Part 2

CprE 281: Digital Logic

Number System conversions

2 Application of Boolean Algebra Theorems (15 Points - graded for completion only)

Unit 2 Boolean Algebra

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits

Lab 1 starts this week: go to your session

Boolean Algebra & Logic Gates. By : Ali Mustafa

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)

2. Associative Law: A binary operator * on a set S is said to be associated whenever (A*B)*C = A*(B*C) for all A,B,C S.

Chapter 2: Switching Algebra and Logic Circuits

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined

CS61c: Representations of Combinational Logic Circuits

CHAPTER III BOOLEAN ALGEBRA

Ex: Boolean expression for majority function F = A'BC + AB'C + ABC ' + ABC.

Chapter 2. Boolean Algebra and Logic Gates

Computer Organization: Boolean Logic

University of Technology

Boolean Algebra and Digital Logic

CHAPTER III BOOLEAN ALGEBRA

CS 173 Lecture 2: Propositional Logic

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Combinational Logic Design Principles

SAMPLE ANSWERS MARKER COPY

Chapter 2 Combinational Logic Circuits

Chapter 2 : Boolean Algebra and Logic Gates

CS/COE0447: Computer Organization and Assembly Language

ELEC Digital Logic Circuits Fall 2014 Boolean Algebra (Chapter 2)

Chapter 2 Combinational Logic Circuits

CHAPTER 2 BOOLEAN ALGEBRA

Chapter 2: Boolean Algebra and Logic Gates

Lecture 3: Boolean Algebra

3 Boolean Algebra 3.1 BOOLEAN ALGEBRA

Binary Logic and Gates

UNIVERSITI TENAGA NASIONAL. College of Information Technology

INTRO TO I & CT. (Boolean Algebra and Logic Simplification.) Lecture # By: Department of CS & IT.

Chapter 2: Princess Sumaya Univ. Computer Engineering Dept.

Digital Logic (2) Boolean Algebra

ECE 20B, Winter 2003 Introduction to Electrical Engineering, II LECTURE NOTES #2

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

CSE 311: Foundations of Computing. Lecture 3: Digital Circuits & Equivalence

Switches: basic element of physical implementations

Binary Logic and Gates. Our objective is to learn how to design digital circuits.

If f = ABC + ABC + A B C then f = AB C + A BC + AB C + A BC + A B C

Unit 8A Computer Organization. Boolean Logic and Gates

Boolean Algebra and Logic Gates

4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra

Boolean Algebra and Logic Design (Class 2.2 1/24/2013) CSE 2441 Introduction to Digital Logic Spring 2013 Instructor Bill Carroll, Professor of CSE

Boolean Algebra. Philipp Koehn. 9 September 2016

. T SHREE MAHAPRABHU PUBLIC SCHOOL & COLLEGE NOTES FOR BOARD EXAMINATION SUBJECT COMPUTER SCIENCE (Code: 083) Boolean Algebra

ENG2410 Digital Design Combinational Logic Circuits

Digital Circuit And Logic Design I. Lecture 3

Chapter 2. Digital Logic Basics

Week-I. Combinational Logic & Circuits

In Module 3, we have learned about Exclusive OR (XOR) gate. Boolean Expression AB + A B = Y also A B = Y. Logic Gate. Truth table

Chapter 2 Boolean Algebra and Logic Gates

Boolean Algebra, Gates and Circuits

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

Combinational Logic Fundamentals

Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions

Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps

Boolean Algebra CHAPTER 15

Doc112: Hardware. Department of Computing, Imperial College London. Doc112: Hardware Lecture 1 Slide 1

Digital Logic Design ABC. Representing Logic Operations. Dr. Kenneth Wong. Determining output level from a diagram. Laws of Boolean Algebra

DIGITAL CIRCUIT LOGIC BOOLEAN ALGEBRA

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

MC9211 Computer Organization

Chapter 2 Combinational Logic Circuits

Truth-Functional Logic

Chapter 2 Boolean Algebra and Logic Gates

Logic and Computer Design Fundamentals. Chapter 2 Combinational Logic Circuits. Part 1 Gate Circuits and Boolean Equations

Set Theory Basics of Set Theory. mjarrar Watch this lecture and download the slides

Solutions to Assignment No 5 Digital Techniques Fall 2007

1 Propositional Logic

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

ECE/CS 250 Computer Architecture

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

1. Prove: A full m- ary tree with i internal vertices contains n = mi + 1 vertices.

Chapter 2 Combinational

CS 121 Digital Logic Design. Chapter 2. Teacher Assistant. Hanin Abdulrahman

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee

Digital Logic Design. Malik Najmus Siraj

WEEK 2.1 BOOLEAN ALGEBRA

BOOLEAN ALGEBRA CLASS XII. Presented By : Dinesh Patel PGT CS KV IIT Powai

Administrative Notes. Chapter 2 <9>

Slides for Lecture 10

Unit 2 Boolean Algebra

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

BOOLEAN LOGIC. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

EECS 1028 M: Discrete Mathematics for Engineers

Math.3336: Discrete Mathematics. Propositional Equivalences

CMSC 313 Lecture 17. Focus Groups. Announcement: in-class lab Thu 10/30 Homework 3 Questions Circuits for Addition Midterm Exam returned

CS 226: Digital Logic Design

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Transcription:

COS 140: Foundations of Computer Science Boolean Algebra Fall 2018 Introduction 3 Problem................................................................. 3 Boolean algebra........................................................... 4 Operators................................................................ 5 Expressions............................................................... 6 Precedence............................................................... 7 Proofs 8 Equivalence.............................................................. 8 Proof by Truth Table........................................................ 9 Algebraic substitution....................................................... 10 Laws 11 Double Negation Law....................................................... 11 Identity Law.............................................................. 12 Null Law................................................................ 13 Idempotent Law........................................................... 14 Inverse Law.............................................................. 15 Example................................................................ 16 Commutative Law.......................................................... 18 Associative Law........................................................... 19 Distributive Law........................................................... 20 Absorption Law............................................................ 21 DeMorgan s Law........................................................... 22 Using the Laws 23 Proving DeMorgan s Law..................................................... 23 Proof 1................................................................. 24 Proof 1a................................................................ 25 Proof 1b................................................................ 26 Proof 2................................................................. 27 Proof 3................................................................. 28 1

Homework and announcements! Reading: Chapter 5 Homework: exercises 1 6 Exercise 7 for extra credit Due: 1 week + 1 class from today (i.e., 9/21) Don t forget recitation this week! Slides: online now Copyright c 2002 2018 UMaine Computer Science Department 2 / 28 Introduction 3 / 28 Problem Computers compute digital logic functions Need some way to describe those functions For some ordinary mathematical functions, algebra works well But the functions we want aren t numeric, but give true/false (1/0) values What can we use? Copyright c 2002 2018 UMaine Computer Science Department 3 / 28 2

Boolean algebra Boolean algebra is analogous to regular algebra, but for true/false values Well-known, well-developed mathematical foundation for digital logic. Provides a formalism for specifying the functions that we wish to have performed. Provides a mechanism for proving circuits are equivalent. Named for George Boole, a 19 th -century mathematician. Copyright c 2002 2018 UMaine Computer Science Department 4 / 28 Operators Boolean operators correspond to gates and have same truth tables as corresponding gate. NOT: NOT A, A, A, A AND: A AND B, A B, AB, A B OR: A OR B, A+B, A B NAND: A nand B, A B, A B, AB NOR: A nor B, A B, (A+B) XOR: A XOR B, A B Copyright c 2002 2018 UMaine Computer Science Department 5 / 28 3

Boolean Algebra Expressions What is an expression? Value of an expression depends on the values of the variables Evaluate expression: assign values to variables, performing the operations Can create an expression for a function by determining when the function should be 1, then writing an expression that is 1 in only those cases. Example: Create a 3-variable expression that equals 1 when all of the inputs are 1, or when one, and only one, input is 0. Copyright c 2002 2018 UMaine Computer Science Department 6 / 28 Operator Precedence for Boolean Algebra Subexpressions inside of parentheses, beginning with innermost parentheses. NOT AND OR Evaluate A nand B as NOT(A B) and A nor B as NOT(A B) Evaluate subexpressions of equal precedence from left to right. Copyright c 2002 2018 UMaine Computer Science Department 7 / 28 4

Proofs 8 / 28 Proofs of Equivalence Two ways: truth tables and algebraic substitution Truth table method: if truth table for expression A same as for expression B, then A B Algebraic substitution method: Use laws of Boolean algebra to transform one expression into the other Proofs have to be convincing to others Have to provide enough detail to show how one step follows from another Have to provide justification for each step Copyright c 2002 2018 UMaine Computer Science Department 8 / 28 Proof by Truth Table Best to have column for each input and results of each operator Prove that A B is equivalent to (AB)+(AB) A B A B A B AB AB (AB)+(AB) 0 0 0 1 1 0 0 0 0 1 1 1 0 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 Copyright c 2002 2018 UMaine Computer Science Department 9 / 28 5

Proof by Algebraic Substitution If you are trying to prove that expression 1 is equivalent to expression 2: Start with one of the expressions, let s say 1. Change it into another expression (say 1 ) using an identity postulate (law). Continue the process with 1 until you arrive at 2. You must justify every change to the current expression by listing the identity postulate used. Some identity postulates: double negation law, identity law, null law, idempotent law, and inverse law Copyright c 2002 2018 UMaine Computer Science Department 10 / 28 Laws 11 / 28 Double Negation Law A = A Copyright c 2002 2018 UMaine Computer Science Department 11 / 28 6

Identity Law AND form: 1A = A OR form: 0 + A = A Copyright c 2002 2018 UMaine Computer Science Department 12 / 28 Null Law AND form: 0A = 0 OR form: 1 + A = 1 Copyright c 2002 2018 UMaine Computer Science Department 13 / 28 7

Idempotent Law AND form: AA = A OR form: A + A = A Copyright c 2002 2018 UMaine Computer Science Department 14 / 28 Inverse Law AND form: AA = 0 OR form: A + A = 1 Copyright c 2002 2018 UMaine Computer Science Department 15 / 28 8

Example: Finding Equivalent Circuits Starting with the following expression, find the equivalent expression that uses the least number of gates (has the smallest number of boolean operators) and the least number of inputs (A + A)(BB) Don t know what the final result will be so use algebraic substitution instead of truth tables Follow your intuition about what should be the case and what makes sense, then justify with a law. In other words, have a plan based on what makes sense. Sometimes you need to try things to make the plan. Copyright c 2002 2018 UMaine Computer Science Department 16 / 28 Example: Finding Equivalent Circuits (A + A)(BB) (A + A)(BB) (A + A)B 1B B A B B Copyright c 2002 2018 UMaine Computer Science Department 17 / 28 9

Commutative Law AND form: AB = BA OR form: A + B = B + A Copyright c 2002 2018 UMaine Computer Science Department 18 / 28 Associative Law AND form: (AB)C = A(BC) OR form: (A + B) + C = A + (B + C) Copyright c 2002 2018 UMaine Computer Science Department 19 / 28 10

Distributive Law AND form: A(B + C) = AB + AC OR form: A + BC = (A + B)(A + C)...or A (B C) = (A B) (A C) Copyright c 2002 2018 UMaine Computer Science Department 20 / 28 Absorption Law AND form: A(A + B) = A OR form: A + AB = A Copyright c 2002 2018 UMaine Computer Science Department 21 / 28 11

DeMorgan s Law AND form: AB = A + B OR form: A+B = A B Aside: recall that AB = A nand B, and A+B = A nor B NOTE: AB AB A+B A+B Copyright c 2002 2018 UMaine Computer Science Department 22 / 28 Using the Laws 23 / 28 How would you prove DeMorgan s Law? What approach would you use? Why? Copyright c 2002 2018 UMaine Computer Science Department 23 / 28 12

Example: Proof by Algebraic Substitution Prove AB + AB = (AB)(AB) (AB)(AB) (AB) +(AB) DeMorgan s Law (AB) +(AB) Double Negation (AB) +(AB) Double Negation AB + AB Def. of parentheses/precedence Copyright c 2002 2018 UMaine Computer Science Department 24 / 28 Example: Proof by Algebraic Substitution Prove AB + AB = (AB)(AB) (AB)(AB) XY X + Y Let X = (AB), Y = (AB) DeMorgan s Law (AB) +(AB) Substitution for X, Y (AB) +(AB) Double Negation (AB) +(AB) Double Negation AB + AB Def. of parentheses/precedence Copyright c 2002 2018 UMaine Computer Science Department 25 / 28 13

Example: Proof by Algebraic Substitution Prove AB + AB = (AB)(AB) AB + AB AB + AB Double Negation (AB)(AB) DeMorgan s Law Copyright c 2002 2018 UMaine Computer Science Department 26 / 28 Example: Another Proof by Algebraic Substitution Prove ACB + C(B + C) = C ACB + C(B + C) ACB + CB + CC Distributive Law ACB + CB + C Idempotent Law CB + ACB + C Commutative Law CB + CBA + C Commutative Law CB + C + CBA Commutative Law CB + C Absorption Law C + CB Commutative Law C Absorption Law Copyright c 2002 2018 UMaine Computer Science Department 27 / 28 14

Example: Another Proof by Algebraic Substitution Alternate proof of ACB + C(B + C) = C ACB + C(B + C) ACB + CB + CC Distributive Law ACB + CB + C Idempotent Law ABC + CB + 1C Identity Law CAB + CB + C1 Commutative Law, twice C(AB +B +1) Distributive Law C(1+AB +B) Commutative Law, twice C1 Null Law 1C Commutative Law C Identity Law Often more than one way to do proof! Copyright c 2002 2018 UMaine Computer Science Department 28 / 28 15