Boolean Logic In today’s lesson we will look at:

Slides:



Advertisements
Similar presentations
Logic Gates.
Advertisements

Notes on Logic Continued
BOOLEAN LOGIC CSC 171 FALL 2004 LECTURE 7. ASSIGNMENT Review Quiz # 2 Start reading Chapter 5.
Boolean Algebra and Truth Table The mathematics associated with binary number system (or logic) is call Boolean: –“0” and “1”, or “False” and “True” –Calculation.
EMB1006 Boolean Logic Jonathan-Lee Jones.
Boolean Logic & Truth Tables In today’s lesson we will look at: a reminder about truth values and NOT, AND, OR and EOR truth tables operator precedence.
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.
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
Module 3.  Binary logic consists of :  logic variables  designated by alphabet letters, e.g. A, B, C… x, y, z, etc.  have ONLY 2 possible values:
Introduction Each logical element or condition must always have a logic value of either "0" or "1", we also need to have ways to combine different logical.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
LOGIC GATES.
A-Level Computing#BristolMet Session Objectives#6 MUST understand and produce simple logic diagrams using the operations NOT, AND and OR SHOULD explain.
COMPUTER ARCHITECTURE TRUTH TABLES AND LOGIC GATES.
Laws of Boolean Algebra Commutative Law Associative Law Distributive Law Identity Law De Morgan's Theorem.
Minute Paper 4/4/04 Z=50+j86.7=100
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
GCSE Computing – Topic 2 Lesson 5a – Binary Logic CHALLENGE TO: identify the different types of logic diagrams. ASPIRE TO: Construct a truth table for.
LOGIC GATES. INTRODUCTION TO LOGIC GATES Boolean functions may be practically implemented by using electronic gates. The following points are important.
Boolean Algebra Learning Objectives Learn that Boolean algebra produces a result that equals TRUE or FALSE Learn how truth tables are used to represent.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Prof. Jeremy.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Based on slides by Shawn.
Unit 1 Logical operators.
GCSE OCR Computing A451 Binary logic Computing hardware 6.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Lesson Objectives Aims You should be able to:
Component 1 Logical operators.
Week 3 Part 2 Kyle Dewey.
Logic Gates.
Computer Science 210 Computer Organization
Propositional Logic.
Boolean Algebra & De Morgan's Theorems
Bool operators and, or, not
Welcome to Wk02 MATH225 Applications of Discrete Mathematics and Statistics
WELCOME to….. The If Statement.
COMPUTING FUNDAMENTALS
Mathematics for Computing
Lesson 9: "if-else-if" and Conditional Logic
Microsoft Visual Basic 2005 BASICS
Prime, Composite, FACTORS, and Multiples
How Boolean logic is implemented
How to Start This PowerPoint® Tutorial
Conditional Statements
Karnaugh Maps References: Lecture 4 from last semester
Lesson 8: Boolean Expressions and "if" Statements
Thursday, 22 November 2018 Logic Gates
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
How many squares are in the border?
Computer Science 210 Computer Organization
Key Words and Introduction to Expressions
CS 220: Discrete Structures and their Applications
Boolean Logic Boolean Logic is considered to be the basic of digital electronics. We know that a computer’s most basic operation is based on digital electronics.
Solving Linear Equations
Logical Operations In Matlab.
GCSE Computer Science – Logic Gates & Boolean Expressions
Introduction To Robot Decision Making
Relational & Logical Operators, if and switch Statements
Conditional Logic Presentation Name Course Name
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
Beginning C Lecture 3 Lecturer: Dr. Zhao Qinpei
Some basic electronics and truth tables
CS 240 – Lecture 7 Boolean Operations, Increment and Decrement Operators, Constant Types, enum Types, Precedence.
Objectives Construct truth tables for the following logic gates:
Truth tables Mrs. Palmer.
Computer Programming Basics
OPERATORS in C Programming
Component 1 – 2A, B, C Binary Logic
What are Logic Gates?.
OPERATORS in C Programming
Programming Techniques :: Arithmetic & Boolean Operators
Presentation transcript:

Boolean Logic In today’s lesson we will look at: what we mean by truth values what we mean by Boolean Operators how to use AND, OR and NOT how computers use these ideas!

Truth Values Some statements can be seen to be either true or false For example… you are in a Computing lesson this slide has a pale blue background it is Sunday Other statements are a matter of opinion, e.g. it’s warm today that’s a nice hat you’re wearing For this lesson, we will only consider statements about which everyone will agree TRUE FALSE

Mathematical Truths They might involve a variable, e.g. if x = 10: Most of the “truths” that you are likely to come across as a programmer will be mathematical. These are usually easier to determine, e.g. 1 is equal to 1 2 is more than 5 3 is NOT equal to 5 They might involve a variable, e.g. if x = 10: x is equal to 1 x is more than 5 x is NOT equal to 5 TRUE FALSE FALSE TRUE

Boolean Operators Arithmetic operators, e.g. +, -, X and ÷, tell us how to combine two numbers Everyone agrees on the results – e.g. 2 + 3 = 5 Boolean (also called logical) operators tell us how to combine truth values in a standard way You might also have seen them used in database searches Boolean operators include: NOT AND OR

NOT The NOT operator toggles the truth value to its opposite value, e.g. NOT true = false NOT false = true For example… you are NOT in a Computing lesson this slide’s background is NOT blue it is NOT Sunday FALSE TRUE

OR The OR operator gives a true result if any of the input values is true, e.g. false OR false = false false OR true = true true OR false = true true OR true = true For example… it is Saturday OR Sunday it is a weekday OR a weekend it is Friday OR this is a Computing lesson FALSE TRUE

AND The AND operator gives a true result if everything is true, e.g. false AND false = false false AND true = false true AND false = false true AND true = true For example… it is evening AND it is Monday this slide is blue AND the text is orange it is Friday AND this is a Computing lesson FALSE TRUE

Is Anything Always True? Are there operations that are always true (or false)? X OR NOT X is always true, e.g. it is Monday OR NOT Monday this slide is blue OR NOT blue X AND NOT X is always false, e.g. it is Monday AND NOT Monday this slide is blue AND NOT blue Think about this next time you hear someone say, “…whether or not…”! TRUE FALSE

What About Computers? Computers don’t understand the idea of truth, but they can detect whether a circuit or switch is on or off. Circuits being on and off can also represent 1 and 0 as we learnt in the binary lesson. When designing logic circuits for computers: true = on = 1 false = off = 0 False and true are also often represented by zero and non-zero numbers when programming.

Logic Circuits The above circuit could operate a security light AND it is dark motion detected light The above circuit could operate a security light OR landing light upstairs switch downstairs switch The above circuit could operate a landing light (if push switches were using)

Combining Operators Just like BODMAS or BIDMAS for Maths, there is a correct order to perform AND and OR AND is often written as a dot – e.g. A AND B could be written as A.B – and is done first, like multiplication in Maths OR is often written as a + - e.g. A OR B could be written as A+B – and is done second, like addition e.g. with A OR B AND C you would do the AND first and then the OR You can also use brackets, e.g. (A OR B) AND C