© Jalal Kawash 2010 Logic Peeking into Computer Science.

Slides:



Advertisements
Similar presentations
Logic The study of correct reasoning.
Advertisements

TRUTH TABLES Section 1.3.
TRUTH TABLES The general truth tables for each of the connectives tell you the value of any possible statement for each of the connectives. Negation.
Chapter 3 section 2. Please form your groups The 1 st column represents all possibilities for the statement that can be either True or False. The 2 nd.
1. Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: The Moon is made of green cheese. Trenton.
Logic Chapter 2. Proposition "Proposition" can be defined as a declarative statement having a specific truth-value, true or false. Examples: 2 is a odd.
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.
1 Section 1.2 Propositional Equivalences. 2 Equivalent Propositions Have the same truth table Can be used interchangeably For example, exclusive or and.
Discrete Mathematics Math 6A Instructor: M. Welling.
Propositional Logic Lecture 2: Sep 9. Conditional Statement If p then q p is called the hypothesis; q is called the conclusion “If your GPA is 4.0, then.
CSE 311 Foundations of Computing I Autumn 2011 Lecture 2 More Propositional Logic Application: Circuits Propositional Equivalence.
Propositional Logic 7/16/ Propositional Logic A proposition is a statement that is either true or false. We give propositions names such as p, q,
Truth Tables for Negation, Conjunction, and Disjunction.
3.2 – Truth Tables and Equivalent Statements
Lecture 8 Introduction to Logic CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
The Foundations: Logic and Proofs
Propositional Logic.
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
Intro to Discrete Structures
Propositions and Truth Tables
The Foundations: Logic and Proofs
Section 1-4 Logic Katelyn Donovan MAT 202 Dr. Marinas January 19, 2006.
Chapter 8 Logic DP Studies. Content A Propositions B Compound propositions C Truth tables and logical equivalence D Implication and equivalence E Converse,
Discrete Maths 2. Propositional Logic Objective
CS 285- Discrete Mathematics Lecture 2. Section 1.1 Propositional Logic Propositions Conditional Statements Truth Tables of Compound Propositions Translating.
Chapter 1 The Logic of Compound Statements. Section 1.1 Logical Form and Logical Equivalence.
BY: MISS FARAH ADIBAH ADNAN IMK. CHAPTER OUTLINE: PART III 1.3 ELEMENTARY LOGIC INTRODUCTION PROPOSITION COMPOUND STATEMENTS LOGICAL.
1 Propositional Logic Proposition 2 Propositions can be divided into simple propositions and compound propositions. A simple (or basic) proposition is.
MATH 102 Contemporary Math S. Rook
Chapter 5 – Logic CSNB 143 Discrete Mathematical Structures.
Math 240: Transition to Advanced Math Deductive reasoning: logic is used to draw conclusions based on statements accepted as true. Thus conclusions are.
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
© Jalal Kawash Logic Peeking into Computer Science.
Discrete Mathematics Lecture1 Miss.Amal Alshardy.
© Jalal Kawash 2010Peeking into Computer Science George Boole English Mathematician His The Mathematical Analysis of Logic, 1848 is the first.
The Foundations Logic and Proofs by raedRASHEED 2014.
CSNB143 – Discrete Structure LOGIC. Learning Outcomes Student should be able to know what is it means by statement. Students should be able to identify.
Boolean Algebra. Logical Statements A proposition that may or may not be true:  Today is Monday  Today is Sunday  It is raining.
LOGIC Lesson 2.1. What is an on-the-spot Quiz  This quiz is defined by me.  While I’m having my lectures, you have to be alert.  Because there are.
Chapter 7 Logic, Sets, and Counting
Conditional Statements
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
Lecture 9 Conditional Statements CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
How do I show that two compound propositions are logically equivalent?
Chapter 7 Logic, Sets, and Counting Section 1 Logic.
Logic. Statements, Connectives, and Quantifiers In symbolic logic, we only care whether statements are true or false – not their content. In logic, a.
6.1 Logic Logic is not only the foundation of mathematics, but also is important in numerous fields including law, medicine, and science. Although the.
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005.
1 Propositional Logic Introduction. 2 What is propositional logic? Propositional Logic is concerned with propositions and their interrelationships. 
Section 1.1. Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth.
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
Logic and Boolean Algebra. Logic statements  Real life statements  “I use public transportation when the car is broken and I have to go to work”  “All.
Joan Ridgway. If a proposition is not indeterminate then it is either true (T) or false (F). True and False are complementary events. For two propositions,
رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill.
Section 1.1. Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: a) The Moon is made of green.
Conditional Statements Lecture 2 Section 1.2 Fri, Jan 20, 2006.
Conditional statement or implication IF p then q is denoted p ⇒ q p is the antecedent or hypothesis q is the consequent or conclusion ⇒ means IF…THEN.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Chapter 1. Chapter Summary  Propositional Logic  The Language of Propositions (1.1)  Logical Equivalences (1.3)  Predicate Logic  The Language of.
Chapter 1 Logic and proofs
Logical Operators (Connectives) We will examine the following logical operators: Negation (NOT,  ) Negation (NOT,  ) Conjunction (AND,  ) Conjunction.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
Chapter 1 Propositional Logic
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
The Foundations: Logic and Proofs
Principles of Computing – UFCFA3-30-1
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
Logic You will learn three common logical operations that will be applied in much of the course (spreadsheets, databases, web searches and both programming.
MAT 3100 Introduction to Proof
Presentation transcript:

© Jalal Kawash 2010 Logic Peeking into Computer Science

© Jalal Kawash 2010Peeking into Computer Science Reading Assignment Mandatory: Chapter 2 – Section 2.1 2

Propositional Logic 3

© Jalal Kawash 2010Peeking into Computer Science Objectives By the end of this section, you will be able to: 1. Define a proposition 2. Define and combine the logic operators: AND, OR, NOT, XOR, and implies 3. Use truth tables to determine equivalence of propositions 4. Determine if a proposition is a tautology, contradiction, or contingency 4

© Jalal Kawash 2010Peeking into Computer Science Propositions and Truth Values A proposition is a statement whose value is either TRUE or FALSE It is snowing today I am not older than you Canada is the largest country Canada shares a border with the US 5

© Jalal Kawash 2010Peeking into Computer Science Not Propositions X > 12 Mr. X is taller than 250cm X+Y = 5 Mrs. Y weighs 50kg Unless we know what the values of X and Y are, these are not propositions 6

© Jalal Kawash 2010Peeking into Computer Science JT’s Extra: Not Propositions The number 5 lol! 7

© Jalal Kawash 2010Peeking into Computer Science Compound propositions Propositions can be built from other propositions using logical operators: ◦AND, OR, NOT, and XOR (exclusive OR) It is raining today AND it is very warm At 12:00 today, I will be eating OR I will be home (inclusive OR) I will be either at the beach OR hiking (XOR) I will NOT be home at 6 8

© Jalal Kawash 2010Peeking into Computer Science JT’s Extra: Logical AND The popular usage of the logical AND applies when ALL conditions must be met (very stringent). ◦In terms of logic: ‘AND’ applies when all propositions must be true. ◦Example: I picked up all the kids today. ◦ Picked up son AND picked up daughter. 9

© Jalal Kawash 2010Peeking into Computer Science JT’s Extra: Logical OR The correct everyday usage of the logical OR applies when ATLEAST one condition must be met (less stringent). In terms of logic: ‘OR’ applies when one or more propositions are true. Example: Using the ‘Peeking’ book OR using the ‘Alice’ book 10

© Jalal Kawash 2010Peeking into Computer Science JT’s Extra: Logical NOT The everyday usage of logical NOT negates (or reverses) a statement. In terms of logic: ‘NOT’ reverses a proposition (true becomes false and false becomes true). I am finding this class quite stimulating and exciting NOT!!! Statement (logical condition) Negation of the statement/condition

© Jalal Kawash 2010Peeking into Computer Science Example: U of C Calendar Bachelor of Commerce (Year 1) Required Grade 12 High School Subject ◦English 30 or ELA 30-1 and ◦Pure Mathematics 30 and ◦Subject from Group A or B 12

© Jalal Kawash 2010Peeking into Computer Science Example: Income Tax Guide Eligible tuition fees Generally, a course qualifies if it was taken at the post-secondary level or (for individuals aged 16 or over at the end of the year) it develops or improves skills in an occupation and the educational institution has been certified by Human Resources and Social Development Canada. In addition, you must have taken the course in

© Jalal Kawash 2010Peeking into Computer Science Example: Income Tax Guide Line Donations and gifts You can claim donations either you or your spouse or common-law partner made. For more information about donations and gifts, or if you donated any of the following: gifts of property other than cash; or gifts to organizations outside Canada; or gifts to Canada, a province, or a territory made after 1997 and agreed to in writing before February 19,

© Jalal Kawash 2010Peeking into Computer Science Negation (JT ‘NOT’) If A is a proposition, then A is a proposition that is true when A is false And false when A is true A is read NOT A 15

© Jalal Kawash 2010Peeking into Computer Science Truth Table for Negation A  A TF FT It is raining today It is not raining today 16

© Jalal Kawash 2010Peeking into Computer Science Conjunction (JT: ‘AND’) If A and B are a propositions, then A  B is a proposition that is true when both A and B are true otherwise, it is false A  B is read A and B 17

© Jalal Kawash 2010Peeking into Computer Science Disjunction (JT: ‘OR’) If A and B are a propositions, then A  B is a proposition that is false when both A and B are false otherwise, it is true A  B is read A or B 18

© Jalal Kawash 2010Peeking into Computer Science Truth Table for Conjunction AB A  B TTT It is raining today and it is cold TFF FTF FFF 19 JT: Column A JT: Column B

© Jalal Kawash 2010Peeking into Computer Science Truth Table for Disjunction ABA OR B TTT It is raining today or it is cold TFT FTT FFF 20 JT: Column AJT: Column B

© Jalal Kawash 2010Peeking into Computer Science Inclusive Vs. Exclusive OR JT’s Extra: sometimes the everyday usage of ‘OR’ does not correspond to ‘Logical OR’. To be eligible for the job, you have to be above 21 or attending a post-secondary institution We’ll drive you to your place; my friend or I will be driving your car 21

© Jalal Kawash 2010Peeking into Computer Science Exclusive OR If A and B are a propositions, then A  B is a proposition that is true when exactly one of A and B is true otherwise, it is false A  B is read A xor B 22

© Jalal Kawash 2010Peeking into Computer Science Truth Table for XOR AB A  B TTF It will be at home or at school TFT FTT FFF 23

© Jalal Kawash 2010Peeking into Computer Science XOR is Redundant AB A  B TTF A xor B = (A or B) and not (A and B) TFT FTT FFF A  B T T T F A  B T F F F (A  B) F T T T 24

© Jalal Kawash 2010Peeking into Computer Science XOR is Redundant AB A  B TTF A  B = (A  B)   (A  B) TFT FTT FFF A  B T T T F A  B T F F F (A  B) F T T T 25

© Jalal Kawash 2010Peeking into Computer Science XOR is Redundant A  B T T T F A  B T F F F (A  B) F T T T A  B F T T F 26 A  B = (A  B)   (A  B)

© Jalal Kawash 2010Peeking into Computer Science XOR is Redundant A  B T T T F A  B T F F F (A  B) F T T T A  B F T T F C  D CD F T T F 27 A  B = (A  B)   (A  B)

© Jalal Kawash 2010Peeking into Computer Science XOR is Redundant A B T T T F A  B T F F F (A  B) F T T T A  B F T T F C  D CD F T T F 28 A  B = (A  B)   (A  B)

© Jalal Kawash 2010Peeking into Computer Science DeMorgan’s Rules Use a truth table to show that the following propositions are equivalent  (A  B) = ( A)  ( B) I never drink wine at the beach It is never the case that I drink wine AND I am at the beach It is always the case that I do NOT drink wine OR I am NOT at the beach 29

© Jalal Kawash 2010Peeking into Computer Science Truth Table AB A  B TTT TFF FTF FFF  (A  B) = (  A)  (  B)  (A  B) F T T T 30

© Jalal Kawash 2010Peeking into Computer Science Truth Table AB A  B TTT TFF FTF FFF  (A  B) F T T T  A F F T T 31  (A  B) = (  A)  (  B)

© Jalal Kawash 2010Peeking into Computer Science Truth Table AB A  B TTT TFF FTF FFF  (A  B) F T T T  A A F F T T  B B F T F T 32  (A  B) = (  A)  (  B)

© Jalal Kawash 2010Peeking into Computer Science Truth Table AB A  B TTT TFF FTF FFF  (A  B) F T T T  A F F T T  B B F T F T  A   B F T T T 33  (A  B) = (  A)  (  B)

© Jalal Kawash 2010Peeking into Computer Science Truth Table AB A  B TTT TFF FTF FFF  (A  B) F T T T AA F F T T  B B F T F T  A   B F T T T 34  (A  B) = (  A)  (  B)

© Jalal Kawash 2010Peeking into Computer Science Truth Tables in Excel 35

© Jalal Kawash 2010Peeking into Computer Science DeMorgan’s Rules Use a truth table to show that the following propositions are equivalent  (A  B) = ( A)  ( B) It is never the case that I am bored OR tired It is always the case that I am NOT bored AND NOT tired 36

© Jalal Kawash 2010Peeking into Computer Science Augusts DeMorgan British Mathematician born in India Wrote more than 1000 articles! He introduced Mathematical Induction in

© Jalal Kawash 2010Peeking into Computer Science Implication If A and B are a propositions, then A → B is a proposition that is false when A is true and B is false otherwise, it is true A → B is read if A then B, or A implies B 38

© Jalal Kawash 2010Peeking into Computer Science Implication If you have a Canadian passport, then you’re a Canadian citizen A = you have a Canadian passport B = you’re a Canadian citizen Logical expression: A → B 39

© Jalal Kawash 2010Peeking into Computer Science If you have a Canadian passport, then you’re a Canadian citizen Maybe you have a Canadian passport (T) and you’re a Canadian citizen (T) ◦JT: Can be true Maybe you do not have a Canadian passport (F) and you’re a Canadian citizen (T) ◦JT: Can be true Maybe you do not have a Canadian passport (F) and you’re not a Canadian citizen (F) ◦JT: Can be true It is not the case that (you have a Canadian passport (T) and you’re not a Canadian citizen) (F) ◦JT: Claim cannot be true (i.e., it’s a False claim) Implication 40

© Jalal Kawash 2010Peeking into Computer Science Truth Table Implication ABA → B TTT If you have a DL, then you can drive TFF FTT FFT 41

Truth Table for Implication ABA → B TTT Have pass, citizen TFF FTT FFT Have pass, not citizen Have not pass, citizen Have not pass, not citizen 42

© Jalal Kawash 2010Peeking into Computer Science Implication is Redundant A → B is logically equivalent to: ◦ A  B ◦Prove it using a truth table If you have a Canadian passport, then you’re a Canadian citizen You do not have a Canadian passport or you’re a Canadian Citizen 43

© Jalal Kawash 2010Peeking into Computer Science Contrapositive A → B is logically equivalent to: ◦ B → A If you have a Canadian passport, then you’re a Canadian citizen If you you’re not a Canadian citizen, then you do not have a Canadian passport 44

© Jalal Kawash 2010Peeking into Computer Science Precedence If a complex proposition does not have brackets apply operators in the following order 1. 2. or  or xor, left to right 3.→ A  B = ( A)  B This is different from (A  B) A  B  C = (A  B)  C 45

© Jalal Kawash 2010Peeking into Computer Science Tautologies A tautology is a proposition that is always true At the end, I will pass the course or I will not pass it A = I will pass the course A  ( A) 46

© Jalal Kawash 2010Peeking into Computer Science Tautologies A AA TF FT A ( A) T T 47

© Jalal Kawash 2010Peeking into Computer Science Contradictions A contradiction is a proposition that is always false The past season, the Flames won the Stanley Cup and the Oilers won the Stanley Cup If the Oilers won, then the Flames lost A = The Flames won A  ( A) 48

© Jalal Kawash 2010Peeking into Computer Science Contradictions A  A TF FT A (A) F F 49

© Jalal Kawash 2010Peeking into Computer Science Contingencies A contingency is a proposition that is neither a contradiction nor a tautology This season, the Flames will win the Stanley Cup 50