BOOLEAN LOGIC CSC 171 FALL 2004 LECTURE 7. ASSIGNMENT Review Quiz # 2 Start reading Chapter 5.

Slides:



Advertisements
Similar presentations
INTRODUCTION LOGICAL OPERATIONS TRUTH TABLE AND RULES.
Advertisements

Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary.
1 If Control Construct A mechanism for deciding whether an action should be taken JPC and JWD © 2002 McGraw-Hill, Inc.
Boolean rules for simplification Dr. Ahmed Telba.
If Statements & Relational Operators Programming.
This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mode and activeX controls must be allowed.
Introduction to Computers and Programming Lecture 6 Professor: Evan Korth New York University.
Iteration & Branching CSC 171 FALL 2001 LECTURE 5.
Boolean Types & Compound Conditionals CSC 1401: Introduction to Programming with Java Lecture 4 – Part 3 Wanda M. Kunkle.
COMP 14 Introduction to Programming Miguel A. Otaduy May 18, 2004.
10/22/2004EE 42 fall 2004 lecture 221 Lecture #22 Truth tables and gates This week: Circuits for digital devices.
1 Boolean Algebra & Logic Design. 2 Developed by George Boole in the 1850s Mathematical theory of logic. Shannon was the first to use Boolean Algebra.
Chapter 4 Logic Gates and Boolean Algebra. Introduction Logic gates are the actual physical implementations of the logical operators. These gates form.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 30, 2005.
1 CSE 20: Lecture 7 Boolean Algebra CK Cheng 4/21/2011.
Data Types. Every program must deal with data The data is usually described as a certain type This type determines what you can do with the data and how.
Programming for GCSE Topic 3.3: Boolean Logic and Truth Tables
Computer Science 101 Boolean Algebra. What’s next? A new type of algebra – Helps us A new type of algebra – Helps us With logical reasoningWith logical.
22C:19 Discrete Math Boolean Algebra & Digital Logic Fall 2010 Sukumar Ghosh.
Digital Logic Circuits – Chapter 1 Section 1-3, 1-2.
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
Data types and their representation Jordi Cortadella Department of Computer Science.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
CS1Q Computer Systems Lecture 6 Simon Gay. Lecture 6CS1Q Computer Systems - Simon Gay2 Algebraic Notation Writing AND, OR, NOT etc. is long-winded and.
CSC Intro. to Computing Lecture 5: Boolean Logic, Gates, & Circuits.
Programming Fundamental Slides1 Data Types, Identifiers, and Expressions Topics to cover here: Data types Variables and Identifiers Arithmetic and Logical.
1 Compound Assignment C++ has a large set of operators for applying an operation to an object and then storing the result back into the object Examples.
Figure 2.6. A truth table for the AND and OR operations. 2.3 Truth Tables 1.
ICT Introduction to Programming Chapter 4 – Control Structures I.
CEC 220 Digital Circuit Design Boolean Algebra I Wed, Sept 2 CEC 220 Digital Circuit Design Slide 1 of 13.
13 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Lecture 3 Combinational Circuits
CS151 Introduction to Digital Design Chapter 2: Combinational Logic Circuits Lecture 5: Binary Logic and Gates.
Week 7 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Computer Programming Boolean Logic Trade & Industrial Education
Control statements Mostafa Abdallah
A: A: double “4” A: “34” 4.
ECE DIGITAL LOGIC LECTURE 6: BOOLEAN ALGEBRA Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 02/01/2016.
Logic Simplification-Using Boolean Laws Logic Design Laboratory EE 2121 Lectures By Manesh T EE2121-In Charge
DIGITAL ELECTRONICS. Everything in digital world is based on binary system. Numerically it involves only two symbols 0 or 1. –0 = False = No –1 = True.
Dept. of Electrical and Computer Eng., NCTU 1 Lab 5. 3-to-8 Decoder Presenter: Chun-Hsien Ko Contributors: Chung-Ting Jiang and Lin-Kai Chiu.
Operators A binary operator combines two values to get one result: x OP y where OP is any binary operators such as +, -, *, /, ==, !=, >, &&, or even =.
Inside Class Methods Chapter 4. 4 What are variables? Variables store values within methods and may change value as the method processes data.
Dr. ClincyLecture Slide 1 CS6020- Chapter 3 (3A and ) Dr. Clincy Professor of CS First Exam - Tuesday, September 6th Coverage: All subjects up to.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Prof. Jeremy.
Hoda Roodaki Boolean Algebra Hoda Roodaki
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Based on slides by Shawn.
Relational Operator and Operations
Revision of IO Streams printf scanf.
Logic Gates and Boolean Algebra
Computer Science 210 Computer Organization
Logic Gates and Boolean Algebra
CHAPTER 2 Boolean Algebra
Data Types, Identifiers, and Expressions
Overview Part 1 – Gate Circuits and Boolean Equations
COMPUTING FUNDAMENTALS
Boolean Algebra.
JavaScript conditional
Propositional Calculus: Boolean Algebra and Simplification
Boolean Algebra Digital Electronics
Relational Operators Operator Meaning < Less than > Greater than
Computer Science 210 Computer Organization
Dr. Clincy Professor of CS
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
ECS15 boolean.
Introductory Concepts
ECE Digital Electronics
Conditionals.
SYEN 3330 Digital Systems Chapter 2 – Part 1 SYEN 3330 Digital Systems.
Presentation transcript:

BOOLEAN LOGIC CSC 171 FALL 2004 LECTURE 7

ASSIGNMENT Review Quiz # 2 Start reading Chapter 5

History Boolean Logic George Boole describes his system for symbolic and logical reasoning: An Investigation into the Laws of thought Boolean logic later becomes the basis for computer design

Quote “No matter how correct a mathematical theorem may appear to be, one ought never to be satisfied that there was not something imperfect about it until it also gives the impression of being beautiful.” George Boole - Quoted in D MacHale, Comic Sections (Dublin 1993)

Basic Idea Boolean Logic is two valued logic – True – False

JAVA The strings “true” and “false” are keywords in JAVA – Constants representing boolean value Variables can be declared to as boolean boolean b1, b2 ; Variables can be assigned a value b1 = true ; b2 = false ;

Relational Operators < // less than <= // less than or equal to > // greater than >= // greater than or equal to == // equal to != // not equal to

Examples ( 4 < 5) ( 4 <= 3) ( 3 > 3) ( 3 >= 3) (7 == 2) ( 2 != 7)

Example values ( 4 < 5) ( 4 <= 3) ( 3 > 3) ( 3 >= 3) (7 == 2) ( 2 != 7) true false true false true

Example assignments boolean b1, b2, b3, b4, b5, b6; b1 = ( 4 < 5); b2 = ( 4 <= 3); b3 = ( 3 > 3); b4 = ( 3 >= 3); b5 = (7 == 2); b6 = ( 2 != 7);

Can be more complex boolean b1, b2; b1 = ( 4 < (3 + 2)); int x = 7; b2 = ((x – 5) <= 3);

“AND” OPERATION ABA && B False TrueFalse TrueFalse True

Using AND boolean b1 ; double inc = ; int numChild = 5; 11 = ((inc 3));

“OR” OPERATION ABA || B False True FalseTrue

Using or boolean b2 ; double inc = ; int numChild = 5; b2 = ((inc 3));

“NOT” OPERATION A!A FALSETRUE FALSE

Using not boolean b3 ; double inc = ; int numChild = 5; b3 = !(!(inc 3));

Multiple modes of expression We can express booleans in many ways – Table – Formula – Symbolic diagram

The mathematical basis for computer design An open switch can represent – Zero – False A closed switch can represent – One – True A switch can control another switch – A logic gate

Boolean Arithmetic -True → False -False → True False + False → False False + True → True True + False → True True + True → True False * False → False False * True → False True * False → False True * True → True

Boolean Arithmetic -(0) → 1 //looks funny -(1) → 0 // more like -1, → → → → 1 (no “carry”) 0 * 0 → 0 0 * 1 → 0 1 * 0 → 0 1 * 1 → 1 (intuitive)

Boolean Arithmetic -(0) → 1 // NOT -(1) → → → → → 1 OR 0 * 0 → 0 0 * 1 → 0 1 * 0 → 0 1 * 1 → 1 AND

Notation To keep things straight Boolean negation “!” replaces “-” Boolean addition “ || “ replaces “+” Boolean multiplication “&&” replaces “*”

Boolean Operations & Circuits AND OR NOT X

Boolean Expressions & Circuits AND: z = x && y ; OR: z = x || y ; NOT: z = !x ; X x y z x y z z x

Some practice Express the “circuit” as – A truth table – A formula (boolean assignment in JAVA)

So what? We can represent numbers in binary We can perform operations on boolean So, we can use boolean circuits to automate arithmetic operations

Binary Addition = = = = 10 A + B = CS

Addition = = = = 10 A + B = CS ABCS

QUESTION: “Carry in” = ?? = ?? = ?? = ?? = ?? = ?? = ?? = ??

QUESTION: “Carry in” = = = = = = = = 11