CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.

Slides:



Advertisements
Similar presentations
Logic The study of correct reasoning.
Advertisements

Constructing a Truth Table
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
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 3 1. Truth Tables and Validity of Arguments
The basics of propositional logic
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
2/17/2008Sultan Almuhammadi1 ICS Logic & Sets (An Overview) Week 1.
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.
1 Math 306 Foundations of Mathematics I Math 306 Foundations of Mathematics I Goals of this class Introduction to important mathematical concepts Development.
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,
Homework 3.
3.2 – Truth Tables and Equivalent Statements
TRUTH TABLES. Introduction Statements have truth values They are either true or false but not both Statements may be simple or compound Compound statements.
Logic ChAPTER 3.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
The Foundations: Logic and Proofs
Chapter 1 Section 1.4 More on Conditionals. There are three statements that are related to a conditional statement. They are called the converse, inverse.
Section 1.5 Implications. Implication Statements If Cara has a piano lesson, then it is Friday. If it is raining, then I need to remember my umbrella.
Discrete Maths 2. Propositional Logic Objective
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
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.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
Discrete Mathematics Lecture1 Miss.Amal Alshardy.
DISCRETE STRUCTURE Bs (IT).
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Chapter 3 section 3. Conditional pqpqpq TTT TFF FTT FFT The p is called the hypothesis and the q is called the conclusion.
CSNB143 – Discrete Structure LOGIC. Learning Outcomes Student should be able to know what is it means by statement. Students should be able to identify.
3.3: Truth Tables. Types of Statements Negation: ~p Conjunction: p ˄ q (p and q) Disjunction: p V q (p or q, or both) Conditional: p → q (if p, then q)
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
CS1022 Computer Programming & Principles Lecture 1 Logic and Proof.
Warmup Answer the following True/False questions in your head: I have brown hair AND I am wearing glasses I am male OR I am wearing sneakers I am NOT male.
How do I show that two compound propositions are logically equivalent?
Review Given p: Today is Thursday q: Tomorrow is Friday
Truth Tables Geometry Unit 11, Lesson 6 Mrs. King.
Chapter 7 Logic, Sets, and Counting Section 1 Logic.
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.
Logical Form and Logical Equivalence M Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program.
3.1 Statements and Quantifiers 3.2 Truth Tables.  A statement is a declarative sentence that is either true or false.  Examples: Mr. Healey is my math.
CS203 Discrete Mathematical Structures
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.
Notes - Truth Tables fun, fun, and more fun!!!!. A compound statement is created by combining two or more statements, p and q.
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.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
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.
Mathematics for Computing Lecture 2: Computer Logic and Truth Tables Dr Andrew Purkiss-Trew Cancer Research UK
TRUTH TABLES Edited from the original by: Mimi Opkins CECS 100 Fall 2011 Thanks for the ppt.
Ms. Andrejko 2-2 Logic. Real World Legally Blonde.
Welcome to Interactive Chalkboard Glencoe Geometry Interactive Chalkboard Copyright © by The McGraw-Hill Companies, Inc. Developed by FSCreations, Inc.,
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.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
MATH 15A – Discrete Mathematics
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Presentation transcript:

CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett

Today’s Topics: Propositional logic 1. Truth tables for basic logical connectives  not, and, or, xor, implies 2. Truth table for new/made-up connectives 3. “Step-by-step” truth tables for complex propositional formulas 2

1. Truth table for basic logical connectives 3 not, and, or, xor, implies

Logical connectives mathJava/C++  andp  qp && q  orp  qp || q  xorp  qp ^ q  not  p!p  If/then, impliesp  q  If and only if, iffp  q  We will use the math notation 4

Logical connectives: Operator precedence OperatorPrecedence  (not)1  (and) 2  (or) 3  (implies) 4  (iff) 5 5  As with programming, it is good practice to use parenthesis for clarity

Truth tables: AND  pq pqpq FF? FT? TF? TT? I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences? Is it: A. F,F,F,F B. F,T,T,T C. T,T,T,F D. F,F,F,T E. None/More/Other

Truth tables: AND  pq pqpq FFF FTF TFF TTT I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences? Is it: A. F,F,F,F B. F,T,T,T C. T,T,T,F D. F,F,F,T E. None/More/Other

Truth tables: AND  OR  pq pqpq FFF FTF TFF TTT pq pqpq FFF FTT TFT TTT I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences?

OR is tricky in English OR pqp OR q FFF FTT TFT TTT XOR pqp XOR q FFF FTT TFT TTF 9 Birthday party host: “Do you want some cake OR ice- crem?” YOU CAN HAVE BOTH (imagine it is rude to have nothing) Diner breakfast special : “Pancake, two eggs and bacon XOR sausage.” YOU MUST PICK EXACTLY ONE

What does it mean: IMPLIES 10  Prof Lovett says: “If you win the CA state lottery between now and the end of quarter, you will get an A+ in this class.” 4 months later… under which of the following scenarios is Prof. Lovett a liar? A. You won the lottery and got an A+ B. You won the lottery and got a B+ C. You did not win the lottery and got an A+ D. You did not win the lottery and got a B+ E. None/More/Other

What does it mean: IMPLIES 11  Your roommate: “If you come to my party Friday, you will have fun” Under which of the following scenarios is your roommate a liar? A. You stayed home studying Friday and you did not have fun. B. You stayed home studying Friday and you had fun. C. You went to the party Friday and did not have fun. D. You went to the party Friday and you had fun E. None/More/Other

Truth tables: IMPLIES pq pqpq FF FT TF TT A. T, F, F, T B. F, T, T, T C. F, F, F, T D. F, T, T, F E. None/more/other I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences?

Truth tables: IMPLIES pq pqpq FFT FTT TFF TTT A. T, F, F, T B. F, T, T, T C. F, F, F, T D. F, T, T, F E. None/more/other I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences?

2. Truth table for new/made- up connectives 14

Making our own connective: AtLeastOneOfTheseThree ALOOTT(p,q,r)  Let’s make a truth table for ALOOTT. How many rows and columns should be in our truth table (ignoring header row)? A. 5 rows, 4 columns B. 6 rows, 4 columns C. 7 rows, 4 columns D. 8 rows, 4 columns E. 9 rows, 4 columns 15 pqp OR q FFF FTT TFT TTT

Making our own connective: AtLeastOneOfTheseThree ALOOTT(p,q,r)  Let’s make a truth table for ALOOTT. How many rows and columns should be in our truth table (ignoring header row)? A. 5 rows, 4 columns B. 6 rows, 4 columns C. 7 rows, 4 columns D. 8 rows, 4 columns E. 9 rows, 4 columns 16 pqp OR q FFF FTT TFT TTT N variables  2 N rows (ignoring header row)

Making our own connective: AtLeastOneOfTheseThree ALOOTT(p,q,r) 17 pqrALOOTT(p,q,r) FFF FFT FTF FTT TFF TFT TTF TTT

3. “Step-by-step” truth tables for complex propositional formulas 18

Truth table for (p  q)   p 19 pq pqpq pp (p  q)   p FF FT TF TT Use truth tables of IMPLIES,NOT,AND!

Truth table for (p  q)   p 20 pq pqpq pp (p  q)   p FF T FT T TF F TT T pqp  q FFT FTT TFF TTT

Truth table for (p  q)   p 21 pq pqpq pp (p  q)   p FFT T FTT T TFF F TTT F p pp FT TF

Truth table for (p  q)   p 22 pq pqpq pp (p  q)   p FFTT T FTTT T TFFF F TTTF F pq pqpq FFF FTF TFF TTT

Truth tables for complex formulas  Intermediate columns: build complex expression step by step  Each intermediate column is a basic connective (NOT,AND,OR,…) applied to already calculated previous columns  Use truth tables of basic connectives to compute the value of new column, one at a time

Truth table for  (p  (q  p)) 24 pq??  (p  (q  p)) FF ? FT ? TF ? TT ? A.F,F,T,T B.T,F,T,F C.T,T,T,F D.F,F,F,T E.Other pq p  q FFT FTT TFF TTT

Truth table for (p  q)  (q  p) 25 pq?? (p  q)  (q  p) FF ? FT ? TF ? TT ? pq p  q FFF FTT TFT TTF A.F,F,T,T B.T,F,T,F C.T,T,T,F D.F,F,F,T E.Other pq p  q FFT FTT TFF TTT

Composing truth tables 26 pq?? (p NAND (p NAND q)) FF ? FT ? TF ? TT ? A.F,F,T,T B.T,F,T,F C.T,T,T,F D.F,F,F,T E.Other pq p NAND q FFT FTT TFT TTF