Boolean Algebra Boolean Assertions Statements that will result in true or false outcomes a > 50 = = ba <= b.

Slides:



Advertisements
Similar presentations
Craps. /* * file : Craps.java * file : Craps.java * author: george j. grevera, ph.d. * author: george j. grevera, ph.d. * desc. : program to simulate.
Advertisements

 Working backwards  Do any of the phrases appear in the string?  Check for each phrase independently  If any appears, condition is TRUE  If TRUE,
James Tam Basic Logical Operations (Fascinating) In this section you will learn some basic logical operations and how to evaluate expressions Image from.
Boolean Algebra Computer Science AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is.
Assignment 2 Sample problems. Consider the following expression: ((False and not True) or False or (True and not True)) True False.
James Tam AND OR NOT NAND NOR XOR Basic logic operations (fascinating)
True/False. False True Subject May Go Here True / False ? Type correct answer here. Type incorrect answer here.
Chapter 9: Boolean Algebra
James Tam Basic Logical Operations (Fascinating) In this section you will learn some basic logical operations and how to evaluate expressions Image from.
Propositional Calculus Math Foundations of Computer Science.
Logic Gates Circuits to manipulate 0’s and 1’s. 0’s and 1’s used for numbers Also to make decisions within the computer. In that context, 1 corresponds.
Boolean Algebra and Logic Simplification. Boolean Addition & Multiplication Boolean Addition performed by OR gate Sum Term describes Boolean Addition.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Boolean Algebra Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Boolean Algebra Computer Organization 1 © McQuain Boolean Algebra A Boolean algebra is a set B of values together with: -two binary operations,
The game of Craps Rules of play: 1. Played with two dice (six faces to a die – numbers 1-6 per face) 2. Sequence of betting rounds (or just rounds) 3.
Iteration  Iteration just means we keep doing the same thing over and over until some threshold is reached, until a condition has been met.  We’ve already.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 3.4 Equivalent Statements.
Truth, like gold, is to be obtained not by its growth, but by washing away from it all that is not gold. ~Leo Tolstoy.
Formal Theories SIE 550 Lecture Matt Dube Doctoral Student - Spatial.
CHAPTER 2 Boolean Algebra
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.
Lecture 7 Topics –Boolean Algebra 1. Logic and Bits Operation Computers represent information by bit A bit has two possible values, namely zero and one.
MATH 102 Contemporary Math S. Rook
Rules of Fractions Investigation. What do you understand from this statement? What can we say about this? What do we need to know first? What should we.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
Boolean Algebra. Boolean algebra (or Boolean logic) is a logical calculus of truth values, developed by George Boole in the late 1830s. It created a notation.
Computer Science 111 Fundamentals of Programming I Making Choices with if Statements.
If…else statements. Boolean Expressions Boolean expression - An expression whose value is either true or false true = 1 false = 0 Datatype: boolean.
Boolean Values The true story ;=P. Expressions.
Boolean Values The true story ;=P Thanks to Margaret Reid-Miller for her original ideas at Carnegie Mellon’s CSE.
Lecture 4 Boolean Algebra. Logical Statements °A proposition that may or may not be true: Today is Monday Today is Sunday It is raining °Compound Statements.
Laws of Boolean Algebra Commutative Law Associative Law Distributive Law Identity Law De Morgan's Theorem.
booleans hold a true/false value We take advantage of this by using them to decide which route our program will take. Examples: stinky holds the boolean.
Module 7.  In Module 3 we have learned about NAND gate – it is a combination of AND operation followed by NOT operation  Symbol A. B = Y  Logic Gate.
1 CS161 Introduction to Computer Science Topic #6.
Warm Up Week 6 1) write an equation that passes through the given point and y-intercept. ( 2, 1 ) ; b = 5.
CS 270 Lecture 1 In Class Problems. Q1: Logic Puzzle You arrive at the end of a long hallway. There are two knights guarding two doors. One knight always.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Morgan Kaufmann Publishers
Computer Science 210 Computer Organization
Boolean Algebra.
Do Now: Factor the polynomial. (5.4 worksheet B)
Thinking Mathematically
Truth Tables for Negation, Conjunction, and Disjunction
Direct Proof by Contraposition Direct Proof by Contradiction
CHAPTER 2 Boolean Algebra
Classwork/Homework Classwork – Page 90 (11 – 49 odd)
How do I show that two compound propositions are logically equivalent?
CHAPTER 2 Boolean Algebra This chapter in the book includes:
Boolean Algebra.
Boolean Algebra A Boolean algebra is a set B of values together with:
Boolean Algebra A Boolean algebra is a set B of values together with:
DO NOW: Think back to the Elimination Game you played to answer the questions. What was the result when both chips were the same color? What was the result.
Factors, multiple, primes: Factors from prime factors
Week 3 Logic will get you from A to B. Imagination will take you everywhere. Albert Einstein.
Section 3.4 Equivalent Statements
CSE 20 Lecture 9 Boolean Algebra: Theorems and Transformations
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION Part (a)
TRUTH TABLES continued.
X Bad 1 Bad 2 Bad 3 Good 1 Good 2 Good 3 Question
CSE 20: Lecture 8 Boolean Postulates and Theorems CK Cheng
Boolean Algebra How gates get picked.
Evaluating Boolean expressions
Section 3.4 Equivalent Statements
2-2 Logic Part 2 Truth Tables.
Factors, multiple, primes: Multiples
Standard form: In standard form?
Coordinates: Naming 2D coordinates – quadrant 1
Presentation transcript:

Boolean Algebra

Boolean Assertions Statements that will result in true or false outcomes a > 50 = = ba <= b

Negating Boolean Assertions Rewriting code for easier readability is usually why we negate Boolean assertions if(!(x < 5)) becomes if( x > = 5)

Boolean Algebra Operands(values):true, false Operators:and (&&) or( | |) not(!)

DeMorgan’s Laws not(A or B) = not A and not B !(A || B) = !A && !B not(A and B) = not A or not B !(A && B) = !A || ! B

Application of DeMorgan’s Law “Craps” If you roll a 7 or 11 on the first roll, you win If you roll a 2, 3, or 12 on the first roll, you lose Otherwise on subsequent rolls you want to roll your original number before you roll a 7 to win

Here is the truth table that proves the first DeMorgan’s Law. not(A or B) = not A and not B !(A || B) = !A && !B AB !(A||B)!A!B!A&&!B true false truefalse truefalse truefalsetruefalse true True

Following is the truth table that proves the second DeMorgan's Law. not(A and B) = not A or not B !(A && B) = !A || ! B AB !(A&&B)!A!B!A||!B true false truefalsetruefalsetrue falsetrue falsetrue false true Notice that columns with the titles ! (A && B) and ! A || ! B result in the same answers.

initial roll – compare subsequent rolls until you won or lost the game: do –while with the sentinel: while( !((sum == point) || (sum == 7)) ); while( (sum != point) && (sum != 7) );

Proving Demorgan’s Law I ABnot(A or B)not Anot Bnot A and not B

Proving Demorgan’s Law II ABnot(A and B)not Anot Bnot A or not B