CS100: Discrete structures

Slides:



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

The Foundations: Logic and Proofs
CSE115/ENGR160 Discrete Mathematics 01/26/12 Ming-Hsuan Yang UC Merced 1.
CS128 – Discrete Mathematics for Computer Science
Discrete Mathematics Lecture 1 Logic of Compound Statements Harper Langston New York University.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Discrete Mathematics Math 6A Instructor: M. Welling.
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
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
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.
Discrete Mathematics and Its Applications
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
CS 285- Discrete Mathematics Lecture 2. Section 1.1 Propositional Logic Propositions Conditional Statements Truth Tables of Compound Propositions Translating.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems or solving problems, creativity and insight.
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
Chapter 1: The Foundations: Logic and Proofs
Rules of Inference Section 1.6. Arguments in Propositional Logic A argument in propositional logic is a sequence of propositions. All but the final proposition.
CSci 2011 Recap ^Propositional operation summary not andorconditionalBi-conditional pq ppqqpqpqpqpqpqpqpqpq TTFFTTTT TFFTFTFF FTTFFTTF FFTTFFTT.
Chapter 2 Fundamentals of Logic 1. What is a valid argument or proof?
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 11 The Foundations: Logic and Proofs Rules of inference.
CSci 2011 Discrete Mathematics Lecture 4 CSci 2011.
رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
CS104 The Foundations: Logic and Proof 1. 2 What is Discrete Structure?  Discrete Objects  Separated from each other (Opposite of continuous)  e.g.,
Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems.
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
Chapter 1 Propositional Logic
Discrete Mathematical
2. The Logic of Compound Statements Summary
Advanced Algorithms Analysis and Design
CSE15 Discrete Mathematics 01/23/17
Discrete Mathematics Lecture 1 Logic of Compound Statements
CSNB 143 Discrete Mathematical Structures
CSE15 Discrete Mathematics 01/30/17
Discrete Mathematics Logic.
Chapter 1 Logic and Proofs Homework 1 Two merchants publish new marketing campaign to attract more customers. The first merchant launches a motto “Good.
Discrete Mathematics Logic of Compound Statements
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
COMP 1380 Discrete Structures I Thompson Rivers University
6/20/2018 Arab Open University Faculty of Computer Studies M131 - Discrete Mathematics 6/20/2018.
Logic.
Citra Noviyasari, S.Si, MT
COT 3100, Spr Applications of Discrete Structures
(CSC 102) Discrete Structures Lecture 2.
Proof Techniques.
The Foundations: Logic and Proofs
Principles of Computing – UFCFA3-30-1
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
Methods of Proof. Methods of Proof Definitions A theorem is a valid logical assertion which can be proved using Axioms: statements which are given.
Applied Discrete Mathematics Week 1: Logic
CS 103 Discrete Structures
Discrete Mathematics and Its Applications Kenneth H
Discrete Mathematics Logic.
Cs Discrete Mathematics
Foundations of Discrete Mathematics
COMP 1380 Discrete Structures I Thompson Rivers University
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Discrete Structures Prepositional Logic 2
CS201: Data Structures and Discrete Mathematics I
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Presentation transcript:

CS100: Discrete structures Discrete Mathematics -Lecture 1 - Logic CS100: Discrete structures Lecture 1: Logic Lecturer: Shaykhah

Discrete Mathematics -Lecture 1 - Logic Lecture Overview Statement Logical Connectives Conjunction Disjunction Propositions Conditional Bio-conditional Converse Inverse Contrapositive Laws of Logic Quantifiers Universal Existential 1440-03-12 Computer Science Department Lecturer: Shaykhah

Discrete Mathematics -Lecture 1 - Logic What is a Statement ? A statement is a sentence having a form that is typically used to express acts Examples: My name is Rawan I like orange 4 – 2 = 3 Do you live in Riyadh? تستخدم للتعبير عن الأفعال.. 1440-03-12 Computer Science Department Lecturer: Shaykhah

Discrete Mathematics -Lecture 1 - Logic 1.1 Propositional Logic A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not both. Are the following sentences propositions? Riyadh is the capital of K.S.A. Read this carefully. 2+2=3 x+1=2 What time is it Take two books . The sun will rise tomorrow . (Yes) (No  Because it is not declarative sentence) (Yes) البرورزيشين هي مسألة أو فرضية تعرف الحقيقة وتحدد ما اذا كانت صحيحة او خاطئة (No  Because it is neither true or false) (No  Because it is not declarative sentence) (No  Because it is not declarative sentence) (Yes) 1440-03-12 Computer Science Department Lecturer: Shaykhah

Logical Connectives and Compound Statement In mathematics, the letters x, y, z, … are used to donate numerical variables that can be replaced by real numbers. Those variables can then be combined with the familiar operations +, -, x, ÷. In logic, the letters p, q, r, s, … denote the propositional variables; that can be replaced by a statements. 1440-03-12 Computer Science Department

1.1 Propositional Logic Propositional Logic: the area of logic that deals with propositions Propositional Variables: variables that represent propositions: p, q, r, s E.g. Proposition p – “Today is Friday.” Truth values: T, F 1440-03-12 Computer Science Department

1.1 Propositional Logic Examples DEFINITION 1 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.” The truth value of the negation of p, ¬p is the opposite of the truth value of p. Examples Find the negation of the following propositions and express this in simple English. “Today is Friday.” “At least 10 inches of rain fell today in Miami” . Solution: The negation is “It is not the case that today is Friday.” In simple English, “Today is not Friday.” or “It is not Friday today.” Solution: The negation is “It is not the case that at least 10 inches of rain fell today in Miami.” In simple English, “Less than 10 inches of rain fell today in Miami.” 1440-03-12

1.1 Propositional Logic Exercise .. Give the negation of the following: p: 2 + 3 > 1 q: It is cold . r: 2+3 ≠5 g: 2 is a positive integer ¬ p: 2 + 3 ≤ 1 ¬ q: It is not cold. ¬ r: 2 + 3 = 5 ¬ g: 2 is not a positive integer . OR ¬g: 2 is a negative integer .

1.1 Propositional Logic Truth table: Logical operators are used to form new propositions from two or more existing propositions. The logical operators are also called connectives. The Truth Table for the Negation of a Proposition. p ¬p T F 1440-03-12

1.1 Propositional Logic DEFINITION 2 Let p and q be propositions. 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. The Truth Table for the Conjunction of Two Propositions. p q p Λ q T T T F F T F F T F 1440-03-12 Computer Science Department

1.1 Propositional Logic Example Find the conjunction of the propositions p and q where p is the proposition “Today is Friday.” and q is the proposition “It is raining today.”, and the truth value of the conjunction. Solution: The conjunction is the proposition “Today is Friday and it is raining today” OR “Today is Friday but it is raining.” The proposition is: TRUE  on rainy Fridays. FALSE  on any day that is not a Friday and on Fridays when it does not rain . 1440-03-12 Computer Science Department

1.1 Propositional Logic Note: DEFINITION 3 Let p and q be propositions. The disjunction of p and q, denoted by p ν q, is the proposition “p or q”. The disjunction p ν q is false when both p and q are false and is true otherwise. Note: inclusive or : The disjunction is true when at least one of the two propositions is true. The Truth Table for the Disjunction of Two Propositions. p q p ν q T T T F F T F F T F E.g. “Students who have taken calculus or computer science can take this class.” – those who take one OR both classes. 1440-03-12 Computer Science Department

1.1 Propositional Logic Example Find the disjunction of the propositions p and q where p is the proposition “Today is Friday.” and q is the proposition “It is raining today.”, and the truth value of the conjunction. Solution: The conjunction is the proposition “Today is Friday or it is raining today” The proposition is: TRUE  whether today is Fridays or a rainy day including rainy Fridays FALSE  on days that are not a Fridays and when it does not rain . 1440-03-12 Computer Science Department

1.1 Propositional Logic 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. 1440-03-12 Computer Science Department

1.1 Propositional Logic DEFINITION 4 Let p and q be propositions. The exclusive or of p and q, denoted by 𝒑⊕𝒒 , 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 (XOR) of Two Propositions. p q p q T T T F F T F F F T 1440-03-12

Conditional Statements 1.1 Propositional Logic Conditional Statements DEFINITION 5 Let p and q be propositions. The conditional statement p → q, is the proposition “if p, then q.” The conditional statement is false when p is true and q is false, and true otherwise. In the conditional statement p → q, p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or consequence). A conditional statement is also called an implication. Example: “If I am elected, then I will lower taxes.” p → q implication: elected, lower taxes. T T | T not elected, lower taxes. F T | T not elected, not lower taxes. F F | T elected, not lower taxes. T F | F 1440-03-12

1.1 Propositional Logic Example: Let p be the statement “Maria learns discrete mathematics.” and q the statement “Maria will find a good job.” Express the statement p → q as a statement in English. Solution: Any of the following - “If Maria learns discrete mathematics, then she will find a good job. “Maria will find a good job when she learns discrete mathematics.” “For Maria to get a good job, it is sufficient for her to learn discrete mathematics.” “Maria will find a good job unless she does not learn discrete mathematics.” 1440-03-12 Computer Science Department

1.1 Propositional Logic Equivalent Statements: Other conditional statements: Converse of p → q : q → p Contrapositive of p → q : ¬ q → ¬ p Inverse of p → q : ¬ p → ¬ q Equivalent Statements: Statements with the same truth table values. Converse and Inverse are equivalents. Contrapositive and p → q are equivalents. 1440-03-12 Computer Science Department

1.1 Propositional Logic “if and only if” can be expressed by “iff” DEFINITION 6 Let p and q be propositions. The biconditional statement 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, and is false otherwise. Biconditional statements are also called bi-implications. p ↔ q has the same truth value as (p → q) Λ (q → p) “if and only if” can be expressed by “iff” Example: Let p be the statement “You can take the flight” and let q be the statement “You buy a ticket.” Then p ↔ q is the statement “You can take the flight if and only if you buy a ticket.” Implication: If you buy a ticket you can take the flight. If you don’t buy a ticket you cannot take the flight. 1440-03-12 Computer Science Department

1.1 Propositional Logic The Truth Table for the Biconditional p ↔ q. T T T F F T F F T F 1440-03-12

1.1 Propositional Logic Exercise .. ¬𝑝 ¬𝑝→¬𝑞 ¬ 𝑝∨𝑞 Let p and q be the propositions   p : I bought a lottery ticket this week. q : I won the million dollar jackpot on Friday. Express each of these propositions as an English sentence. ¬𝑝 ¬𝑝→¬𝑞 ¬ 𝑝∨𝑞 I did not buy a lottery ticket this week. If I did not buy a lottery ticket this week, then I did not win the million dollar jackpot on Friday. I did not buy a lottery ticket this week, and I did not win the million dollar jackpot on Friday. 1440-03-12

Truth Tables of Compound Propositions 1.1 Propositional Logic Truth Tables of Compound Propositions We can use connectives to build up complicated compound propositions involving any number of propositional variables, then use truth tables to determine the truth value of these compound propositions. Example: Construct the truth table of the compound proposition (p ν ¬q) → (p Λ q) The Truth Table of (p ν ¬q) → (p Λ q). p q ¬q p ν ¬q p Λ q (p ν ¬q) → (p Λ q) T T T F F T F F F T

Types of statements A statements that is true for all possible values of its propositional variables is called tautology (𝑝∨𝑞)↔(𝑞∨𝑝) 𝑝∨∼𝑝 A statement that is always false is called contradiction 𝑝∧∼𝑝 A statement that can be either true or false, depending of the values of its propositional variables, is called a contingency (𝑝⟶𝑞)∧(𝑝∧𝑞) Examples of a Tautology and a Contradiction. p ¬p p ν ¬p p Λ ¬p T F 1440-03-12 Computer Science Department

Precedence of Logical Operators 1.1 Propositional Logic Precedence of Logical Operators We can use parentheses to specify the order in which logical operators in a compound proposition are to be applied. To reduce the number of parentheses, the precedence order is defined for logical operators. Precedence of Logical Operators. Operator Precedence ¬ 1 Λ ν 2 3 → ↔ 4 5 E.g. ¬p Λ q = (¬p ) Λ q p Λ q ν r = (p Λ q ) ν r p ν q Λ r = p ν (q Λ r) 1440-03-12

1.1 Propositional Logic Exercise .. find the truth table of the following proposition p ˄ ( ¬( q ˅ ¬p)) p q ¬p q ˅ ¬p ¬( q ˅ ¬p) p ˄ ( ¬( q ˅ ¬p)) T F 1440-03-12

Translating English Sentences 1.1 Propositional Logic Translating English Sentences English (and every other human language) is often ambiguous. Translating sentences into compound statements removes the ambiguity. Example: How can this English sentence be translated into a logical expression? “You cannot ride the roller coaster if you are under 4 feet tall and you are not older than 16 years old.” Solution: Let q, r, and s represent “You can ride the roller coaster,” “You are under 4 feet tall,” and “You are older than 16 years old.” The sentence can be translated into: (r Λ ¬ s) → ¬q. 1440-03-12

1.1 Propositional Logic Example: How can this English sentence be translated into a logical expression? “You can access the Internet from campus only if you are a computer science major or you are not a freshman.” Solution: Let a, c, and f represent “You can access the Internet from campus,” “You are a computer science major,” and “You are a freshman.” The sentence can be translated into: a → (c ν ¬f ) . 1440-03-12

1.1 Propositional Logic Exercise .. Write the following statement in logic : If I do not study discrete structure and I go to movie , then I am in a good mood . Solution : p: I study discrete structure , q: I go to movie , r: I am in a good mood (¬p ˄ q )➝ r 1440-03-12

Logic and Bit Operations 1.1 Propositional Logic Logic and Bit Operations Computers represent information using bits. A bit (Binary Digit) is a symbol with two possible values, 0 and 1. By convention, 1 represents T (true) and 0 represents F (false). A variable is called a Boolean variable if its value is either true or false. Bit operation – replace true by 1 and false by 0 in logical operations. Table for the Bit Operators OR, AND, and XOR. x y 𝑥∨𝑦 𝑥∧𝑦 𝑥⊕𝑦 1 1440-03-12

1.1 Propositional Logic DEFINITION 7 A bit string is a sequence of zero or more bits. The length of this string is the number of bits in the string. Example: Find the bitwise OR, bitwise AND, and bitwise XOR of the bit string 01 1011 0110 and 11 0001 1101. Solution: 01 1011 0110 11 0001 1101 ------------------- 11 1011 1111 bitwise OR 01 0001 0100 bitwise AND 10 1010 1011 bitwise XOR 1440-03-12 Computer Science Department

1.2 Propositional Equivalences Introduction DEFINITION 1 A compound proposition that is always true, no matter what the truth values of the propositions that occurs in it, is called a tautology. A compound proposition that is always false is called a contradiction. A compound proposition that is neither a tautology or a contradiction is called a contingency. Examples of a Tautology and a Contradiction. p ¬p p ν ¬p p Λ ¬p T F 1440-03-12

1.2 Propositional Equivalences Logical Equivalences DEFINITION 2 The compound propositions p and q are called logically equivalent if p ↔ q is a tautology. The notation p ≡ q denotes that p and q are logically equivalent. Compound propositions that have the same truth values in all possible cases are called logically equivalent. Example: Show that ¬p ν q and p → q are logically equivalent. Truth Tables for ¬p ν q and p → q . p q ¬p ¬p ν q p → q T F 1440-03-12

1.2 Propositional Equivalences Exercise .. Show that this statements ((p ˄ ‎q) → (p ˅ ‎q)) is tautology , by using ‎The truth table : p q q ˄ p p ˅ ‎q‎ ‎(p ˄ ‎q) → (p ˅ ‎q)‎ T F 1440-03-12

Discrete Mathematics -Lecture 1 - Logic Laws of Logic Identity Laws p v F ≡ p p ^ T ≡ p Domination Laws p v T ≡ T P ^ F ≡ F 1440-03-12 Computer Science Department Lecturer: Shaykhah

Discrete Mathematics -Lecture 1 - Logic Laws of Logic Idempotent Laws p v p ≡ p p ^ p ≡ p Double Negation Law ¬(¬p) ≡ p Commutative Laws p v q ≡ q v p p ^ q ≡ q ^ p 1440-03-12 Computer Science Department Lecturer: Shaykhah

Discrete Mathematics -Lecture 1 - Logic Laws of Logic Association Laws (p v q ) v r ≡ p v (q v r) Distributive Laws p v (q ^ r ) ≡ (p v q) ^ (p v r) p ^ (q v r) ≡ (p ^ q) v (p ^ r) 1440-03-12 Computer Science Department Lecturer: Shaykhah

Contd. De Morgan’s Laws Absorption Laws p v (p ^ q) ≡ p ~ (p v q) ≡ ~p ^ ~q ~ (p ^ q) ≡ ~p v ~q Absorption Laws p v (p ^ q) ≡ p p ^ (p v q) ≡ p 1440-03-12 Computer Science Department

Contd. Complement Laws p v ~p ≡ T p ^ ~p ≡ F ~ ~p ≡ p ~ T ≡ F , ~F ≡ T p → q ≡ ¬p ˅ q ¬(p → q ) ≡ p Λ ¬q Note: See tables 7 & 8 page 25 1440-03-12 Computer Science Department

1.2 Propositional Equivalences Discrete Mathematics -Lecture 1 - Logic 1.2 Propositional Equivalences Constructing New Logical Equivalences Example: Show that ¬(p → q ) and p Λ ¬q are logically equivalent. Solution: ¬(p → q ) ≡ ¬(¬p ν q) ≡ ¬(¬p) Λ ¬q (by the second De Morgan law) ≡ p Λ ¬q (by the double negation law) Lecturer: Shaykhah

1.2 Propositional Equivalences Example: Show that (p Λ q) → (p ν q) is a tautology. Solution: To show that this statement is a tautology, we will use logical equivalences to demonstrate that it is logically equivalent to T. (p Λ q) → (p ν q) ≡ ¬ (p Λ q) ν (p ν q) ≡ (¬ p ν ¬q) ν (p ν q) (by the first De Morgan law) ≡ (¬ p ν p) ν (¬ q ν q) (by the associative and communicative law for disjunction) ≡ T ν T ≡ T Note: The above examples can also be done using truth tables. 1440-03-12

Exercises Simplify the following statement (p v q ) ^ ~p Show that ~p ^ (~q ^ r) v (q ^ r) v (p ^ r) ≡ r (p → q) v (p → r) ≡ p → q v r 1440-03-12 Computer Science Department

Exercises – Continue (p v q ) ^ ~p ≡ ~p ^ ( p v q ) ≡ ( ~p ^ p ) v ( ~ p ^ q ) ≡ F v ( ~p ^ q ) ≡ ~p ^ q 1440-03-12 Computer Science Department

Exercises – Continue ~p ^ (~q ^ r) v (q ^ r) v (p ^ r) ≡ r ≡ ~p ^ r ^ (~q v q) v (p ^ r) ≡ ~p ^ r ^ T v (p ^ r) ≡ ~p ^ r v (p ^ r) ≡ (~p ^ r) v (p ^ r) ≡ r ^ (~p v p) ≡ r ^ T ≡ r 1440-03-12 Computer Science Department

Exercises – Continue (p → q) v (p → r) ≡ p → q v r ≡ ¬𝑝⋁𝑞 ⋁(¬𝑝⋁𝑟) ≡ ¬𝑝⋁𝑞 ⋁(¬𝑝⋁𝑟) ≡¬𝑝 ⋁𝑞⋁¬𝑝⋁𝑟 ≡ ¬𝑝 ⋁¬𝑝⋁𝑞⋁𝑟 ≡ ¬𝑝⋁𝑞⋁𝑟 ≡ ¬𝑝⋁(𝑞⋁𝑟) ≡ 𝑝→(𝑞⋁𝑟) 1440-03-12 Computer Science Department

Exercises – Continue Show that this statements (¬ q ˄ (p  q )  ¬p is tautology , by using ‎The laws of logic : ‎‎≡ ‎ ¬ (¬ q ˄ (p  q ) ˅ ¬p ‎‎‎≡ ¬ (¬ q ˄ (¬p ˅ q ) ˅ ¬p ‎‎‎≡ q ˅ ¬ (¬p ˅ q ) ˅ ¬p ‎ ‎‎≡ (¬p ˅ q ) ˅ ¬ (¬p ˅ q ) ‎‎≡ T 1440-03-12 Computer Science Department

Exercises – Continue Without using truth tables prove the statement (P ∧( P ➝ q)) ➝ q is tautology. (P ∧( P ➝ q)) ➝ q ≡¬ 𝑝˄ 𝑝→𝑞 ˅𝑞 ≡ ¬𝑝˅¬(¬𝑝˅𝑞 ˅ 𝑞 ≡ ¬𝑝˅ 𝑞 ˅¬ ¬𝑝˅ 𝑞 ≡𝑇 1440-03-12 Computer Science Department

1.5 Rules of Inference page 63 Valid Arguments in Propositional Logic: DEFINITION 1 An argument in propositional logic is a sequence of propositions. All but the final proposition in the final argument are called premises and the final proposition is called the conclusion.. An argument is valid of the truth of all its premises implies that the conclusion is true. An argument form in propositional logic is a sequence of compound propositions involving propositional variables. 20-Nov-18 Computer Science Department

1.5 Rules of Inference page 63 Example: “If you have access to the network, then you can change your grade” “You have access to the network” -------------------------------------------------- ∴ “You can change your grade” Valid Argument 20-Nov-18 Computer Science Department

Rules of Inference for Propositional Logic: We can always use a truth table to show that an argument form is valid. This is a tedious approach. when, for example, an argument involves 9 different propositional variables. To use a truth table to show this argument is valid. It requires 2⁹= 512 different rows !!!!!!! 20-Nov-18 Computer Science Department

Rules of Inference: Fortunately, we do not have to resort to truth tables. Instead we can first establish the validity of some simple argument forms, called rules of inference. These rules of inference can then be used to construct more complicated valid argument forms. 20-Nov-18 Computer Science Department

Hypothetical syllogism Rules of Inference Name Tautology Modus ponens [p ^ (p  q)]  q p p  q -------------------- ∴q Modus tollens [ q ^ (p  q)]   p  q ------------------------ ∴  p Hypothetical syllogism [(p  q) ^ (q  r)]  (p  r) q  r ----------------------- ∴ p  r Disjunctive syllogism [(p v q) ^  p]  q p v q P --------------------- ∴ q Addition p  (p v q) ------------------ ∴ (p v q) Simplification (p ^ q)  p p ^ q ∴ p Conjunction (p) ^ (q)  (p ^ q) q ∴ (p ^ q) Resolution (p v q) ^ (p v r)  (q v r) p v r --------------- ∴ q v r 20-Nov-18 Computer Science Department

Rules of Inference (Cont.) : EXAMPLE State which rule of inference is the basis of the following statement: “it is below freezing now. Therefore, it is either freezing or raining now” SOLTUION: Let p: “it is below freezing now” q: “it is raining now” Then this argument is of the form p ------------- (Addition) ∴ p v q 20-Nov-18 Computer Science Department

Rules of Inference (Cont.) : EXAMPLE “ it is below freezing and it is raining now. Therefore, it is below freezing” SOLUTION: Let p: “it is below freezing now” q: “it is raining now” Then this argument is of the form p ^ q ----------- (Simplification) ∴ p 20-Nov-18 Computer Science Department

Rules of Inference (Cont.) : What rule of inference is used in each of these arguments ? If it is rainy, then the pool will be closed. It is rainy. Therefore, the pool is closed. SOLUTION: Let p: “It is rainy” q: “the pool is closed” Then this argument is of the form p pq ---------------- (Modus ponens) ∴q 20-Nov-18 Computer Science Department

Rules of Inference (Cont.) : What rule of inference is used in each of these arguments ? If I go swimming, then I will stay in the sun too long. If I stay in the sun too long, then I will sunburn. Therefore, if I go swimming, then I will sunburn. SOLUTION: Let p: “I go swimming” q: “I stay in the sun too long” r: “I will sunburn” Then this argument is of the form p→q q→ r ------- (Hypothetical syllogism) p→r 20-Nov-18 Computer Science Department

Rules of Inference (Cont.) : What rule of inference is used in each of these arguments ? If it snows today, the university will close. The university is not closed today. Therefore, it did not snow today. SOLUTION: Let p: “it snows today” q: “The university is not closed today” Then this argument is of the form  q pq -------------- (Modus tollens) ∴ p 20-Nov-18 Computer Science Department

Using Rules of Inference to Build Arguments: When there are many premises, several rules of inference are often needed to show that an argument is valid. 20-Nov-18 Computer Science Department

Using Rules of Inference to Build Arguments (Cont.): Find the argument form for the following argument and determine whether it is valid or invalid. If I try hard and I have talent, then I will become a musician. If I become a musician, then I will be happy. ∴ If I will not happy, then I did not try hard or I do not have talent. It's valid, Hypothetical syllogism. 20-Nov-18 Computer Science Department

Using Rules of Inference to Build Arguments (Cont.): Find the argument form for the following argument and determine whether it is valid or invalid. If I drive to work, then I will arrive tired. I do not drive to work. ∴ I will not arrive tired. It's invalid 20-Nov-18 Computer Science Department

Using Rules of Inference to Build Arguments (Cont.): Find the argument form for the following argument and determine whether it is valid or invalid. I will become famous or I will become a writer. I will not become a writer. ∴I will become famous Its valid, Disjunctive syllogism 20-Nov-18 Computer Science Department

Using Rules of Inference to Build Arguments (Cont.): Find the argument form for the following argument and determine whether it is valid or invalid. If taxes are lowered, then income rises. Income rises. ∴Taxes are lowered It's invalid 20-Nov-18 Computer Science Department

Using Rules of Inference to Build Arguments (Cont.) : EXAMPLE Show that the hypotheses “it is not sunny this afternoon and it is colder than yesterday,” “we will go swimming only if it is sunny,” “if we do not go swimming, then we will take a canoe trip,” “and “if we take a canoe trip, we will be home by sunset.” lead to “we will be home by sunset” 20-Nov-18 Computer Science Department

Let p: “it is sunny this afternoon” Using Rules of Inference to Build Arguments (Cont.) : SOLUTION Let p: “it is sunny this afternoon” q: “it is colder than yesterday” r: “we will go swimming” s: “we will take a canoe trip” t: “we will be home by sunset” The hypotheses become  p ^ q, r  p,  r  s, s  t the conclusion is t 20-Nov-18 Computer Science Department

Cont’d: We construct an argument to show that our hypotheses lead to desired conclusion as follows Step Reason  p ^ q Hypothesis  p Simplification using (1) r  p Hypothesis  r Modus tollens (2,3)  r  s Hypothesis s Modus ponens (4,5) s  t Hypothesis t Modus ponens (6,7) Note that if we used the truth table, we would end up with 32 rows !!! 20-Nov-18 Computer Science Department

Resolution: Computer programs make use of rule of inference called resolution to automate the task of reasoning and proving theorems. This rule of inference is based on the tautology ((p v q) ^ (¬ p v r))  ( q v r ) 20-Nov-18 Computer Science Department

Resolution (Cont.): EXAMPLE Use resolution to show that the hypotheses “Jasmine is skiing or it is not snowing” and “it is snowing or Bart is playing hockey” imply that “Jasmine is skiing or Bart is playing hockey” 20-Nov-18 Computer Science Department

Resolution (Cont.): SOLUTION p: “it is snowing”, q: “Jasmine is skiing”, r: “Bart is playing hockey” We can represent the hypotheses as ¬ p v q and p v r, respectively Using Resolution, the proposition q v r, “Jasmine is skiing or Bart is playing hockey” follows 20-Nov-18 Computer Science Department

1.3 Quantifiers page 33 So far we have discussed the propositions in which each statement has been about a particular object. In this section we shall see how to write propositions that are about whole classes of objects. Consider the statement: p: x is an even number The truth value of p depends on the value of x. e.g. p is true when x = 4, and false when x = 7 1440-03-12 Computer Science Department

1.Universal Quantifiers DEFINITION 1 The universal quantification of p(x) is the statement “P(x) for all values of x in the domain.” The notation ∀ x P(x) denotes the universal quantification of P(x). Here ∀is called the universal quantifier. We read ∀ x P(x) as “for all x P(x)” or “for every x P(x) ”. An element for which P(x) is false called counterexample of ∀ x P(x) “For all values of x, P(x) is true”. For every x For any x ∀ x Every x We assume that only values of x that make sense in P(x) are considered. ∀ x P(x) 1440-03-12 Computer Science Department

1.Universal Quantifiers Example 8.. Let P(X) be the statement “x+1>x”. What is the truth value of the quantification ∀ x P(x), where the domain consists of all real numbers? Solution The quantification ∀ x P(x),is true because P(x) is true for all real numbers. 1440-03-12 Computer Science Department

1.Universal Quantifiers Example 9.. Let Q(X) be the statement “x < 2”. What is the truth value of the quantification ∀ x Q(x), where the domain consists of all real numbers? Solution Q(x) is not true for every real number x, because Q(3) is false. That is, x=3 is a counterexample for the statement ∀ x Q(x), thus ∀ x Q(x) is false 1440-03-12 Computer Science Department

1.Universal Quantifiers Example 11.. What is the truth value of the quantification ∀ x P(x), where P(X) is the statement “x2 < 10” and the domain consists of the positive integers not exceeding 4 ? Solution The statement ∀ x P(x) is the same as the conjunction P(1) ^ P(2) ^ P(3) ^ P(4) Because the domain consists of the positive integers 1,2,3 and 4. Because P(4), which the statement “42 < 10” is false, it follows that ∀ x P(x) is false. 1440-03-12 Computer Science Department

2.Existential Quantifiers DEFINITION 2 The essential quantification of p(x) is the proposition “There exists an element x in the domain such that P(x).” We use the notation ∃ x P(x) for the essential quantification of P(x). Here ∃ is called the essential quantifier. In some situations, we only require that there is at least one value for which the predicate is true. The existential quantification of a predicate P(x) is the statement “there exists a value of x, for which P(x) is true. ∃x P(x) There is a dog without tail (∃ a dog) (a dog without tail) 1440-03-12 Computer Science Department

2.Existential Quantifiers Example 16.. What is the truth value of ∃ x P(x), where P(X) is the statement “x2 > 10” and the universe of discourse consists of the positive integers not exceeding 4? Solution Because the domain is {1, 2, 3, 4}, the proposition ∃ x P(x) is the same as the disjunction P(1) v P(2) v P(3) v P(4) Because P(4), which the statement “42 > 10” is true, it follows that ∃x P(x) is true. 1440-03-12 Computer Science Department

Quantifiers - Negation Rule: ∀x p(x)  ∃x ¬p(x) ∃x p(x)  ∀ x ¬p(x) Negate the following: ( ∀ integers x) (x > 8)  (∃ an integer x) (x ≤ 8) Negate the following; (∃ an integer x) (0 ≤ x ≤ 8)  ( ∀ integers x) (x < 0 OR x > 8) 1440-03-12 Computer Science Department

Quantifiers Exercise .. p(x): x is even q(x): x is a prime number r(x,y): x+y is even . Write an English sentence that represent the following : ∀x P(x) ∃x Q(x) ∀x ∃y R(x,y) Find negation for a. and b. ∃x ¬p(x) there is exist x where x is odd ∀x ¬q(x) for every x where x not prime number for every x where x is even there is exists x where x is a prime number for all x there exists y where x+y is even 1440-03-12 Computer Science Department

Any Questions Refer to chapter 1 of the book for further reading 1440-03-12 Computer Science Department