CS100 : Discrete Structures

Slides:



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

Grading Lecture attendance: -1% per 2 unexcused absences
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
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.
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.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
Adapted from Discrete Math
Predicates and Quantifiers
Chapter 1, Part I: Propositional Logic With Question/Answer Animations.
The Foundations: Logic and Proofs
Chapter 1: 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.
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
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.
MATH 213 A – Discrete Mathematics for Computer Science Dr. (Mr.) Bancroft.
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.
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
Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions = 32Bring me coffee! CS173 is Bryan’s favorite.
Review I Rosen , 3.1 Know your definitions!
Chapter 5 – Logic CSNB 143 Discrete Mathematical Structures.
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
Chapter 1, Part II With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Reading: Chapter 4 (44-59) from the text book
CS 381 DISCRETE STRUCTURES Gongjun Yan Aug 25, November 2015Introduction & Propositional Logic 1.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
Predicates and Quantified Statements
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
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
The Foundations: Logic and Proof, Sets, and Foundations PROPOSITIONS A proposition is a declarative sentence that is either True or False, but not the.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 1 The Foundations: Logic and Proofs Predicates and Quantifiers.
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
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.
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.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
 To combine propositions using connectives  To construct the truth table of a given compound proposition  To define de Morgan Law for logic  To define.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
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.,
Introduction to Discrete Mathematics Discrete Mathematics: is the part of mathematics devoted to the study of discrete objects. Discrete Mathematics is.
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
CSE15 Discrete Mathematics 01/23/17
CSNB 143 Discrete Mathematical Structures
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
6/20/2018 Arab Open University Faculty of Computer Studies M131 - Discrete Mathematics 6/20/2018.
Chapter 1 The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
CSCI 3310 Mathematical Foundation of Computer Science
CS100: Discrete structures
Information Technology Department
CHAPTER 1: LOGICS AND PROOF
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Cs Discrete Mathematics
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
The Foundations: Logic and Proofs
Presentation transcript:

CS100 : Discrete Structures 4/24/2017 CS100 : Discrete Structures Chapter 1 Logic Theory Dr.Saad Alabbad Department of Computer Science E-mail: salabbad@gmail.com Office # SR 068 Tel # 2581888 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed 4/24/2017 Propositional Logic Proposition: A proposition is a declarative statement ( a statement that declares a fact) that is either TRUE or FALSE, but not both. The area of logic that deals with propositions is called propositional logic. Propositions Not Propositions Riyadh is the capital of Saudi Arabia How many students in this class? Every cow has 4 legs. Bring me coffee! 3 + 2 = 32 4 + 3 = 7 X + 2 = 3 Y + Z = X "x +2=3", where x is a variable representing a number, is not a proposition, because unless a specific value is given to x we can not say whether it is true or false, nor do we know what x represents. 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic - Negation 4/24/2017 Propositional Logic - Negation We use letters to denote propositional variables Truth value of true proposition is denoted by T Truth value of false proposition is denoted by F Negation: Suppose p is a proposition. The negation of p is written p and has meaning: “It is not the case that p.” The proposition p is read “NOT p” Example: p: “Today is Friday” p: “Today is NOT Friday” Truth table for negation: p p T F Notice that p is a proposition! 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic - Conjunction 4/24/2017 Propositional Logic - Conjunction Conjunction corresponds to English “and.” Conjunction: Let p and q be two propositions. The conjunction of p and q, denoted by p  q, is the proposition “p and q”. The p  q is true when both p and q are true, otherwise false. Example: p: “Today is Friday” q: “It is raining today” p  q: “Today is Friday and it is raining today” Truth table for conjunction: P q p  q T F 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic - Disjunction 4/24/2017 Propositional Logic - Disjunction Disjunction corresponds to English “or.” Disjunction: Let p and q be two propositions. The disjunction of p and q, denoted by p  q, is the proposition “p or q”. The p  q is false when both p and q are false, otherwise true. Example: p: “Today is Friday” q: “It is raining today” p  q: “Today is Friday or it is raining today” Truth table for disjunction: p q p  q T F Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed 4/24/2017 Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Exclusive Or 4/24/2017 Propositional Logic – Exclusive Or Exclusive Or: Let p and q be two propositions. 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, otherwise false. Example: p: “Today is Friday” q: “It is raining today” p ⊕ q: “Today is Friday exclusive or it is raining today” Truth table for Exclusive Or: p q p ⊕ q T F 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Conditional Statement 4/24/2017 Propositional Logic – Conditional Statement It corresponds to English “if p then q” or “p implies q.” Conditional: Let p and q be two propositions. 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. (p is called the hypothesis ,q is the conclusion) Example: If it is raining, then it is cloudy. If I am elected, then I will lower taxes. If you get 100% in the final, then you will get Grade A+. Truth table for implication: p q p  q T F 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic - Special Definitions 4/24/2017 Propositional Logic - Special Definitions 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. p  q: “If it is noon, then I am hungry.” q  p: “If I am not hungry, then it is not noon.” Inverse: p  q is inverse of p  q. p  q: “If it is not noon, then I am not hungry.” p  q has same truth values as q  p 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic - Questions 4/24/2017 Propositional Logic - Questions Q1: Give some examples of p  q, then tell what is q  p q  p p  q Q2: State the converse, contrapositive, and inverse of each of them If it rains today, then I will stay at home I come to class whenever there is going to be a examination A positive integer is prime only if it has no divisors other than 1 and itself. 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Biconditional Statement 4/24/2017 Propositional Logic – Biconditional Statement It corresponds to English “p if and only if q”. Biconditional: Let p and q be two propositions. The biconditional statement (bi-implication) p ↔ q is the proposition “if p and only if q”. The biconditional statement p ↔ q is true when p and q have the same truth values, otherwise false. p ↔ q has same truth value as (p q)  (q  p). Example: 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” p q p ↔ q T F 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Precedence 4/24/2017 Propositional Logic – Precedence Precedence of Logical Operators: P Λ ¬ q νr →s ↔w νm (((P Λ (¬ q)) ν r) →s) ↔(w νm) Operator Precedence ¬ Λ ν → ↔ 1 2 3 4 5 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Precedence 4/24/2017 Propositional Logic – Precedence A compound proposition that is: (1) always true is called a tautology (2) always false is called a contradiction (3) neither a tautology nor a contradiction is called contingency or satisfiable. p p p  p p  p T F 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Compound Propositions 4/24/2017 Propositional Logic – Compound Propositions Construct truth table for (p  q) → (p  q). Q3: Construct truth table for (p  q) ↔ (p  q). (p ⊕ q) → (p ⊕ q). (p  q) → (p  q) p  q p  q q q p T F 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Translating English Sentences 4/24/2017 Propositional Logic – Translating English Sentences The sentence “The automated reply cannot be sent when the file system is full” can be translated as q → p where p: “The automated reply can be sent ” q: “The file system is full” The sentence “You cannot drive a car if you are under 4 feet tall unless you are older than 16 years old” can be translated as (q r) → p where p: “You can drive a car ” q: “You are under 4 feet tall ” r: “You are older than 16 years old” 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic – Translating English Sentences 4/24/2017 Propositional Logic – Translating English Sentences The sentence “You can access the Internet from campus only if you are a computer science major or you are not a freshman” can be translated as p → (q  r) where p: “You can access the Internet from campus” q: “You are a computer science major” r: “You are a freshman” Q4: Translate the following sentences into logical expressions: “Access is granted whenever the user has paid the subscription fee and enters a valid password” “If the user has not entered a valid password but has paid the subscription fee, then access is granted” 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Equivalences – Logic and Bit Operations 4/24/2017 Propositional Equivalences – Logic and Bit Operations 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: 10101001 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. 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Equivalences – Logic and Bit Operations 4/24/2017 Propositional Equivalences – Logic and Bit Operations Truth table for bitwise OR, AND, and XOR: Q5: Find bitwise OR, AND, and XOR of the bit strings 01 0011 0100 and 10 1001 0101 00 1011 1010 and 11 1010 0101 11 0101 0110 and 10 1101 0010 x ⊕ y x  y x  y y x 1 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Logic - Applications 4/24/2017 Propositional Logic - Applications We are using propositional logic as a foundation for formal proofs. Propositional logic is also the key to writing good code…you can’t do any kind of conditional (if) statement without understanding the condition you’re testing. All the logical connectives we have discussed are also found in hardware and are called “gates.” 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Equivalences – Logical Equivalences 4/24/2017 Propositional Equivalences – Logical Equivalences Equivalence: The compound propositions p and q are logically equivalent if p↔q is a tautology. In other words, p and q are logically equivalent if their truth tables are the same. We write p  q. Example: (p  q)  p  q. Truth tables for (p  q) and p  q : p  q q p (p  q) p  q q p F T 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Equivalences – Logical Equivalences 4/24/2017 Propositional Equivalences – Logical Equivalences Example: p  q  p  q. Truth tables for p  q and p  q: Q5: Show that p  (q  r)  (p  q)  (p  r) Note: if we have n logical variable then the size of the truth table is 2n p  q p p  q q p T F 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Equivalence – Prove the following Logical Equivalences 4/24/2017 Equivalence Name p Λ T  p and p ν F  p Identity laws p ν T  T and p Λ F  F Domination laws p ν p  p and p Λ p  p Idempotent laws ¬( ¬ p)  p Double negation law p ν q  q ν p and p Λ q  q Λ p Commutative laws (p ν q) ν r  p ν (q ν r) and (p Λ q) Λ r  p Λ (q Λ r) Associative laws p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r) Distributive laws ¬(p ν q)  ¬p Λ ¬q and ¬(p Λ q)  ¬p ν ¬q De Morgan’s laws p  (p  q)  p and p  (p  q)  p Absorption laws p ν ¬p  T and p Λ ¬p  F Negation laws 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Propositional Equivalence – Prove the following Logical Equivalences 4/24/2017 Propositional Equivalence – Prove the following Logical Equivalences 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed 4/24/2017 Propositional Equivalences – Another way of proving Logical Equivalences In addition to truth table we can use logical identities that we already know to establish new logical equivalences Examples: ¬(p  q)  p ¬q (see p.26) Show that ¬(p (¬ p  q)) and ¬ p  ¬ q are equivalent. Show that p q  p  q is a tautology .(see p.27 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed 4/24/2017 Predicate Logic Introduction: x>20 (We must know x to tell if it is true or false) All students passed. (We have to write a proposition for every student asserting that he passed and take the conjunction of all these propositions) Some students didn’t pass (Can you make such an assertion without referring to a particular student?) X is father of y The above assertions are not propositions. However, they appear quite often in mathematics and we want to do deal with such assertions. Predicate logic is a more powerful logic than propositional logic and it addresses some of the limitations of propositional logic 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed 4/24/2017 Predicate Logic Predicate: refers to a property that the subject of the statement can have or relationships among other subjects Examples X>20. This statements has two parts. The variable x and is called the subject The property “is greater than 20” and is called the predicate We can also write P(x) where P is the predicate ‘’is greater than 20” and x is the subject. P(x) is called the propositional function P at x Note: once a value has been assigned to the variable x the statement P(x) becomes a proposition that has a truth value. For example P(8) is the statement that 8>20 which is false 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed 4/24/2017 Predicate Logic Examples x is father of y. This statements has two parts. The variables x and y and are called the subjects The relationship “is father of ” and is called the predicate We can also write P(x,y) where P is the predicate ‘is father of ” and x,y are the subjects. P(x,y) is called the propositional function P at x and y. As we have seen predicate logic can describe both relationships and properties of subjects 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Quantifiers 4/24/2017 Predicate Logic: Quantifiers Quantification expresses the extent to which a predicate is true over a range of elements. In English: all,some,none anf few are used. All birds have wings Some birds do not fly. The area of logic that deals with predicates and quantifiers is called predicate calculus or first order logic. 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Universal Quantifier 4/24/2017 Predicate Logic: Universal Quantifier Universal Quantifier: Asserts that a property is true for all values of a variable in a particular domain. Let P(x) be a propostional function.The universal quantifier of P(x) is the statement: P(x) is true for all x in the domain. The domain is called the universe of discourse We write We read it as “for all x P(x)” An element for which P(x) is false is called counterexample of The statement is either true of false, so is a proposition. 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Universal Quantifier 4/24/2017 Predicate Logic: Universal Quantifier Examples: Let P(x) be “x2 > 0” then Statement is not true when the universe of discourse consists of all real numbers P(0) is false ( counterexample) Statement is true when the universe of discourse consists of all real numbers which are greater than 0. What is the truth value of if the domain consists of all real numbers? 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Existential Quantifier 4/24/2017 Predicate Logic: Existential Quantifier Existential Quantifier: Asserts that there is an element with a certain property in a particular domain. Let P(x) be a propostional function.The Existential quantifier of P(x) is the statement: There exists an element x in the domain such that P(x) is true. The domain is called the universe of discourse We write We read it as “There is an x such that P(x)” or “For some x P(x)” The statement is false iff there is no element x in the domain for which P(x) is true The statement is either true of false, so is a proposition. 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Existential Quantifier 4/24/2017 Predicate Logic: Existential Quantifier Examples: Let P(x) be “x2 > 0” then Statement is true since for example P(2) is true Statement is false iff there is no element in the domain for which P(x) is true. Finding at least one element for which P(x) is true is sufficient to asserts that is true. What is the truth value of if the domain consists of all real numbers? 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Quantifiers 4/24/2017 Predicate Logic: Quantifiers When all the elements in domain can be listed as:x1,x2,…,xn then: is the same as P(x1) P(x2)…  P(xn) is the same as P(x1)  P(x2)…  P(xn) Quantifiers with restricted domain (note that it is the same as The two quantifiers have precedence over all logical operators from propositional logic. 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Negation of Quantified Expression 4/24/2017 Predicate Logic: Negation of Quantified Expression Examples Every Students in this class has taken calculus course Can be represented as: where P(x) is”x has taken calculus course” To negate it we write “there is a student in this class who has not taken calculus course” which can be translated to There is a man who can fly Can be represented as: where F(x) is”x can fly” To negate it we write “There is no man who can fly” Which can be stated as ”every man can not fly” 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: From English to Logic(1) 4/24/2017 Predicate Logic: From English to Logic(1) Every student in the class has taken calculus course 1- For every student x in the class, x has taken calculus 2- where T(x) is “x has taken calculus” The domain of x is students of this class For every Man, if the man has a job then he has a car 1- For every man x, if x has a job then x has a car 2- where J(x) is “x has a job” C(x) is “x has a car” The domain of x is all the men Some student in this class has visited Abha or Dammam For every Saudi, if he is a student then he has visitd Abha 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Nested Quantifiers 4/24/2017 Predicate Logic: Nested Quantifiers (1) The statement says that For every number x, there is a number y such that x+y=0 (additive inverse) (2) The statement says that (the domain is all non-negative integers) There exists x, such that for every number y, y is greater than or equal to x (0 is the smallest non-negative number) (3) The statement says that X+y=y+x for all numbers x and y (commutative law of addition). (4) The statement says that There exist two numbers x and y such that their product equals 17 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: From English to Logic and vice versa(2) 4/24/2017 Predicate Logic: From English to Logic and vice versa(2) The sum of two positive integers is always positive Every real number except zero has a multiplicative inverse or Translate(p.55) Translate If a person is a male and is a parent then this person is someone’s father. x(Male(x)Parent(x)y Father(x,y)) 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: From English to Logic(3) 4/24/2017 Predicate Logic: From English to Logic(3) Example: Let 1) S(x) be “x is s student” 2)F(x) be “x is a faculty member” 3) E(x,y) be “x has sent an email to y” and the domain is every person in our college. Translate the following sentences into logical Expressions: Every person in the college has sent an email to every person including himself xy(E(x,y)) Every person in the college has sent an email to every other person not including himself xy(xy  E(x,y)) At least one email has been sent from one person to another xy(xyE(x,y)) There is a person who sent an email to every other person xy(xyE(x,y)) Every person has been sent at least one email xy(xyE(y,x)) 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: From English to Logic(4) 4/24/2017 Predicate Logic: From English to Logic(4) Example: Let 1) S(x) be “x is s student” 2)F(x) be “x is a faculty member” 3) E(x,y) be “x has sent an email to y” and the domain is every person in our college. Translate the following sentences into logical Expressions: Ayman has sent an email to Dr.Saad: E(Ayman,Dr.Saad) Every student sent an email to Dr.Zakir x(S(x)E(x,Dr.Zakir)) Every Faculty member has either sent an email to Dr.Ahmad or has been sent an email by Dr.Ahmad. x(F(x)E(x,Dr.Ahmad) E(Dr.Ahmad,x)) Some student has not sent an email to any faculty member x(S(x) y(F(y)E(x,y)) There is a faculty member who has never been sent an email by a student. x(F(x) y(S(y)E(y,x)) Some student has sent an email to every faculty member x(S(x) y(F(y)E(x,y)) 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed

Predicate Logic: Negating Nested Quantifiers 4/24/2017 Predicate Logic: Negating Nested Quantifiers Negating Nested Quantifiers Negate 1- 2- 3- 4- 4/24/2017 Prepared by Dr.Saad Alabbad & Dr. Zakir Ahmed Prepared by Dr. Zakir H. Ahmed