CS104 The Foundations: Logic and Proof 1. 2 What is Discrete Structure?  Discrete Objects  Separated from each other (Opposite of continuous)  e.g.,

Slides:



Advertisements
Similar presentations
Chapter 1: The Foundations: Logic and Proofs
Advertisements

Grading Lecture attendance: -1% per 2 unexcused absences
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.
CS128 – Discrete Mathematics for Computer Science
2.2 Conditional Statements. Goals Identify statements which are conditional Identify the antecedent and consequent of a conditional statement Negate conditional.
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.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
1 Section 1.1 Logic. 2 Proposition Statement that is either true or false –can’t be both –in English, must contain a form of “to be” Examples: –Cate Sheller.
Discrete Mathematics Math 6A Instructor: M. Welling.
Introduction to Logic Sections 1.1 and 1.2 of Rosen Fall 2010 CSCE 235 Introduction to Discrete Structures URL: cse.unl.edu/~cse235 Questions:
CSE115/ENGR160 Discrete Mathematics 01/17/12 Ming-Hsuan Yang UC Merced 1.
First Order Logic. Propositional Logic A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not.
Adapted from Discrete Math
The Foundations: Logic and Proofs
CS104 : Discrete Structures
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
Propositions and Truth Tables
Propositions and Truth Tables. Proposition: Makes a claim that may be either true or false; it must have the structure of a complete sentence.
2009/9 1 Logic and Proofs §1.1 Introduction §1.2 Propositional Equivalences §1.3 Predicates and Quantifiers §1.4 Nested Quantifiers §1.5~7 Methods of Proofs.
MATERI II PROPOSISI. 2 Tautology and Contradiction Definition A tautology is a statement form that is always true. A statement whose form is a tautology.
Discrete Mathematics and Its Applications
Discrete Mathematics CS 285. Lecture 12 Section 1.1: Logic Axiomatic concepts in math: Equals Opposite Truth and falsehood Statement Objects Collections.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Ch.1 (Part 1): The Foundations: Logic and Proofs Introduction.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
1 Logic Logic is a discipline that studies the principles and methods used in correct reasoning It includes: A formal language for expressing statements.
CS 285- Discrete Mathematics Lecture 2. Section 1.1 Propositional Logic Propositions Conditional Statements Truth Tables of Compound Propositions Translating.
Chapter 1: The Foundations: Logic and Proofs
CS 103 Discrete Structures Lecture 02
BY: MISS FARAH ADIBAH ADNAN IMK. CHAPTER OUTLINE: PART III 1.3 ELEMENTARY LOGIC INTRODUCTION PROPOSITION COMPOUND STATEMENTS LOGICAL.
Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions = 32Bring me coffee! CS173 is Bryan’s favorite.
Discrete Mathematics MCA 105 LOGICS Preeti Mehta.
Discrete Mathematics Lecture1 Miss.Amal Alshardy.
The Foundations Logic and Proofs by raedRASHEED 2014.
Chapter 2: The Logic of Compound Statements 2.2 Conditional Statements
Lecture 4. CONDITIONAL STATEMENTS: Consider the statement: "If you earn an A in Math, then I'll buy you a computer." This statement is made up of two.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
Reading: Chapter 4 (44-59) from the text book
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.
CS100 : Discrete Structures
Discrete Mathematics CS 285. Lecture 12 Quick Overview The conceptual center of computer science is the ALGORITHM.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Chapter 1: The Foundations: Logic and Proofs
The Foundations: Logic and Proof, Sets, and Foundations PROPOSITIONS A proposition is a declarative sentence that is either True or False, but not the.
Section 1.1. Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth.
Section 1.1 Propositions and Logical Operations. Introduction Remember that discrete is –the study of decision making in non-continuous systems. That.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
LECTURE 1. Disrete mathematics and its application by rosen 7 th edition THE FOUNDATIONS: LOGIC AND PROOFS 1.1 PROPOSITIONAL LOGIC.
رياضيات متقطعة لعلوم الحاسب 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.
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.
Discrete Mathematical الرياضيات المتقطعة Dr. Ahmad Tayyar Al Israa University
Chapter 1 Propositional Logic
Discrete Mathematical
2. The Logic of Compound Statements Summary
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
Logic.
Ch.1 (Part 1): The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Principles of Computing – UFCFA3-30-1
CS100: Discrete structures
Information Technology Department
Chapter 1 The Foundations: Logic and Proof, Sets, and Functions
CHAPTER 1: LOGICS AND PROOF
CS201: Data Structures and Discrete Mathematics I
Discrete Mathematics and Its Applications Kenneth H
Discrete Mathematics Lecture 2: Propositional Logic
MAT 3100 Introduction to Proof
Discrete Mathematics Lecture 2: Propositional Logic
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

CS104 The Foundations: Logic and Proof 1

2 What is Discrete Structure?  Discrete Objects  Separated from each other (Opposite of continuous)  e.g., integers, people, house,  Vs. Continuous objects: e.g., real number  Discrete Structures  The abstract mathematical structures used to represent discrete objects and relationships between the objects e.g. sets, relations, graphs

3 Why do we study Discrete Structures?  Information is stored and manipulated by computers in a discrete fashion …  As a student in computer science major, you need to know the basic language and conceptual foundation for all of the computer science, i.e., Discrete Structures!  Discrete structure concepts are also widely used throughout math, science, engineering, economics, biology, etc., …  Get training for rational thought!

1.1 Propositional Logic Introduction Propositions Propositional Logic Negation Connectives ( conjunction – disjunction – exclusive OR) Conditional statements (implication) Converse, Contrapositive and Inverse Biconditional Truth tables of Compound Propositions Precedence of Logic Operators Logic and Bit Operations 4

Introduction The rules of logic are used to distinguish between valid and invalid mathematical arguments. Logic has many applications to computer science. Ex: Computer circuits Construction of computer programs 5

Propositions The basic building blocks of logic. It is a declarative sentence (a sentence that declares a fact) that is either True or False, but not both. Example 1 1.Riyadh is the capital of Saudi Arabia. 2.Cairo is the capital of Lebanon = =3 Example 2 1.What time is it? 2.Read this carefully. 3.x+1=2 4.x+y=z All declarative sentences are propositions T – F – T – F Not propositions 1+2 not declarative sentences 3+4 neither true or nor false 6

Propositions We use letters to denote propositional variables that is used to represent propositions, just as letters used to denote numerical variables. The conventional letters used for propositions variables are p, q, r, s… The truth value if the proposition is true  T The truth value if the proposition is false  F The area of logic that deals with proposition is called the proposition calculus or propositional logic. 7

Propositions There are a methods for producing new propositions from those what we have. Many mathematical statement are constructed by combining one or more propositions (compound propositions) using logical operators. 8

Negation of a proposition Definition1 : Let p be a proposition. The negation of p, denoted by  p, is the statement “it is not the case that p”. The proposition  p is read “NOT p” Negation construct a new proposition from a single existing proposition. The truth table for the negation of a proposition. p pp FTFT TFTF Notice that  p is a proposition! 9

Negation of a proposition Example 3: Find the negation of the proposition “ Sara’s pc runs Linux ” and express this in simple English. Solution: Negation is: “ it is not the case that Sara’s pc runs Linux ” More simply: “ Sara’s pc does not runs Linux ” 10

Negation of a proposition Example 4: Find the negation of the proposition “ Ahmad’s smart phone has at least 32 GB of memory ” and express this in simple English. Solution: Negation is: “ Ahmad’s smart phone does not have at least32 GB of memory ” More simply: “ Ahmad’s smart phone has less than 32 GB of memory ” 11

Conjunction of propositions Definition2 : Let p and q be a proposition. The conjunction of p and q, denoted by p  q, is the proposition “p and q”. The conjunction p  q is true when both p and q are true, and is false otherwise. Sometimes “But” is used instead of “And” in conjunction. The truth table for the conjunction of two proposition. Notice that conjunction can be between two or more propositions pqp  q TTFFTTFF TFTFTFTF TFFFTFFF 12

Conjunction of propositions Example 5: Find the conjunction of the propositions p and q, where p is the proposition “ Ahmad’s pc has more than 16 GB free hard disk space ” and q is the proposition “ The processor in Ahmad’s pc runs faster than 1 GHz ” express this in simple English. Solution: Ahmad’s pc has more than 16 GB free hard disk space and The processor in Ahmad’s pc runs faster than 1 GHz. To be true, both conditions given must be true. It is false when one or both are false 13

Disjunction of propositions Definition3: Let p and q be a proposition. The disjunction of p and q, denoted by p  q, is the proposition “p or q”. The conjunction p  q is false when both p and q are false, and is true otherwise. The truth table for the disjunction of two proposition. Notice that disjunction can be between two or more propositions pqp  q TTFFTTFF TFTFTFTF TTTFTTTF 14

Disjunction of propositions Example 6: Find the disjunction of the propositions p and q, where p is the proposition “ Ahmad’s pc has more than 16 GB free hard disk space ” and q is the proposition “ The processor in Ahmad’s pc runs faster than 1 GHz ” express this in simple English. Solution: Ahmad’s pc has more than 16 GB free hard disk space or The processor in Ahmad’s pc runs faster than 1 GHz. When it will be true? False? 15

Exclusive-OR of propositions Definition4: Let p and q be a proposition. The exclusive or of p and q, denoted by p ⊕ q, is the proposition that is true when exactly one of p and q is true and is false otherwise. The truth table for the exclusive or of two proposition. Notice it can be between two or more propositions pqp ⊕ q TTFFTTFF TFTFTFTF FTTFFTTF 16

Note: inclusive or : The disjunction is true when at least one of the two propositions is true. E.g. “Students who have taken calculus or computer science can take this class.” – those who take one or both classes. exclusive or : The disjunction is true only when one of the proposition is true. E.g. “Students who have taken calculus or computer science, but not both, can take this class.” – only those who take one of them. 17

Conditional Statement (Implication) Definition5: Let p and q be a proposition. The conditional statement (implication) p  q is the proposition “if p, then q”. The conditional statement p  q is false when p is true and q is false, otherwise true. In the conditional statement p  q, p is called the hypothesis or (antecedent or premise) and q is called the conclusion or (consequence). Comes in format: If p, then q If p, q p is sufficient for q p implies q … you will find rest of them in book. Look at them! 18

Conditional Statement (Implication) The truth table for the implication of two proposition. Ex: “If you get 100% on the final, then you will get an A”. pqp  q TTFFTTFF TFTFTFTF TFTTTFTT HypothesisConclusion 19

Conditional Statement (Implication) Example If Juan has a smart phone, then 2+3 = 5 This proposition is true, because conclusion is true. If Juan has a smart phone, then 2+3 = 6 This proposition is true, if Juan does not have a smart phone even though 2+3=6 is false. There are no relation between hypothesis and conclusion. In programming we have if-then. HypothesisConclusion 20

Conditional Statement (Implication) Example 7: Let p the statement “ Maria learns discrete mathematics ” and q the statement “ Maria will find job ” express the statement p  q as a statement in English. Solution: If Maria learns discrete mathematics, then she will find job. Maria will find job when she learns discrete mathematics. Rest example in book page 7 When it will be true? False? 21

Converse, Contrapositive and Inverse  Converse: q  p is converse of p  q. Ex.: p  q: “If it is noon, then I am hungry.” q  p: “If I am hungry, then it is noon.”  Contrapositive:  q   p is contapositive of p  q. Ex.:  q   p: “If I am not hungry, then it is not noon.”  Inverse:  p   q is inverse of p  q. Ex.:  p   q: “If it is not noon, then I am not hungry.” p  q has same truth values as  q   p See example 7 22

Biconditional Statement Definition6: Let p and q be two propositions. The biconditional statement (bi-implication) p ↔ q is the proposition “p if and only if q”. The biconditional statement p ↔ q is true when p and q have the same truth values, otherwise false. It corresponds to English “p if and only if q”. The truth table of biconditional pqp ↔ q TTFFTTFF TFTFTFTF TFFTTFFT 23

Biconditional Statement Example10: p: “You can take the flight” q: “You buy a ticket” p ↔ q: “You can take the flight if and only if you buy a ticket” True if p and q both true or both false False otherwise 24

Implicit Biconditional Statement Not always explicit in natural language. Often expressed using an “if, then” or “only, if” Converse is implied but not stated. Ex: “if you finish your meal, then you can have dessert” Means “You can have dessert if and only if you finish your meal” 25

Truth Table of Compound Proposition Used to build up complicated compound positions involving any numbers of propositional variables. Example: Construct the truth table of the compound proposition (p ν ¬q) → (p Λ q). The Truth Table of (p ν ¬q) → (p Λ q). p q¬q¬qp ν ¬qp Λ qp Λ q (p ν ¬q) → (p Λ q) T T F F T F FTFTFTFT TTFTTTFT TFFFTFFF TFTFTFTF 26  Q3: Construct truth table for  (p   q) ↔ (p  q).  (p ⊕  q) → (p ⊕ q). # of raws = 2 # of variable

Precedence 27  Precedence of Logical Operators: OperatorPrecedence ( )¬Λν→↔ ( )¬Λν→↔

Logic and Bit Operations 28  Bit: A bit is a symbol with two possible values, namely, 0 (zero) and 1 (one).  A bit can be used to represent a truth value as 1 for T and 0 for F  Bit string: A bit string is a sequence of bits. The length of the string is number of bits in the string.  Example: is a bit string of length eight  We define the bitwise OR, AND, and XOR of two strings of same length to be the strings that have as their bits the OR, AND, and XOR of the corresponding bits in the two strings, respectively.  We use the symbols , , and ⊕ to represent bitwise OR, AND, and XOR, respectively.

Logic and Bit Operations x ⊕ y x  yx  y yx Truth table for bitwise OR, AND, and XOR: Example 13 Find bitwise OR, AND, and XOR of the bit strings and