Download presentation
Presentation is loading. Please wait.
1
CS 103 Discrete Structures Lecture 05
Logic and Proofs (4) Chapter 1 section 1.1 by Dr. Mosaad Hassan
2
The Foundations: Logic and Proofs
Chapter 1, Part II: Predicate Logic With Question/Answer Animations
3
Summary Predicate Logic (First-Order Logic (FOL), Predicate Calculus)
The Language of Quantifiers Logical Equivalences Nested Quantifiers Translation from Predicate Logic to English Translation from English to Predicate Logic
4
Predicates and Quantifiers
Section 1.4
5
Section Summary Predicates Variables Quantifiers Negating Quantifiers
Universal Quantifier Existential Quantifier Negating Quantifiers De Morgan’s Laws for Quantifiers Translating English to Logic
6
Limitation of Propositional Logic
Propositional logic cannot always adequately express the meaning of statements in mathematics and in natural language. Example 1: Suppose that we know that: "Every computer connected to the university network is functioning properly." Propositional logic cannot conclude the truth of the statement: "MATH3 is functioning properly", where MATH3 is one of the computers connected to the university network. Example 2: If one computer is under attack such as: "CS2 is under attack by a hacker." We cannot conclude the truth of the statement: "There is a computer on the university network that is under attack by a hacker."
7
Predicate Logic Predicate Logic is a more powerful type of logic
It can be used to express the meaning of a wide range of statements in mathematics and computer science in ways that permit us to reason and explore relationships between objects To understand predicate logic, we need to define the concepts of predicate and quantifier
8
Predicate Predicate refers to a property that the subject of the statement can have Consider statements involving variables such as: "x > 3" , "x = y + 3" , "x + y = z" "computer x is under attack by a hacker" "computer x is functioning properly" The statement "x is greater than 3" has two parts: The first part is the subject of the statement, x The second part is the predicate, "is greater than 3"
9
Propositional Function
We can denote the statement "x is greater than 3" by P(x), where: P denotes the predicate "is greater than 3" on x The variable x is the subject of the statement The statement P(x) is said to be the truth value of the propositional function P at x Example: Let P(x) denote the statement "x > 3". What are the truth values of P(4) and P(2)? Solution: We obtain the statement P(4) by setting x = 4 in the statement "x > 3“. Hence, P(4) is true, and similarly, P(2) is false. Remark: P(x) will become a proposition and have a truth value only when x is given a value.
10
Predicates: Example Let A(x) denote the statement "Computer x is under attack by a hacker." Suppose that of the computers on campus, only CS2 and MATH1 are currently under attack by hackers. What are truth values of A(CS1), A(CS2), and A(MATH1)? Solution: We obtain the statement A(CS1) by setting x = CS1 in the statement "Computer x is under attack by a hacker." As CS1 is not on the list of computers currently under attack, A(CS1) is false. As CS2 and MATH1 are on the list of computers under attack, A(CS2) & A(MATH1) are true.
11
Predicates: Exercise Let P(x) = “x is a multiple of 5” For what values of x is P(x) true?
12
Multi-Variable Predicates
We can also have statements (i.e. propositional functions) that involve more than one variable. Consider the statement "x = y + 3." We can denote this statement by Q(x, y), where: x and y are variables Q is the predicate. When values are assigned to the variables x and y, the statement Q(x, y) has a truth value
13
Multi-Variable Predicates: Example
Let Q(x, y) denote the statement "x = y + 3“. What are the truth values of the propositions Q(1, 2) and Q(3, 0)? Solution: To obtain Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y). Hence, Q(1, 2) is false Similarly, the statement Q(3, 0) is true
14
Multi-Variable Predicates: Example
Let R(x, y, z) denote the statement "x + y = z". Find the truth values of R(1, 2, 3) & R(0, 0, 1)? Solution: The proposition R(1, 2, 3) is true. R(0, 0, 1) is false. In general: A statement involving the n variables x1, x2,…, xn can be denoted by P(x1, x2, … , xn) P(x1, x2, … , xn) is the value of propositional function P at the n-tuple (x1, x2, … ,xn) P is also called a n-place predicate or a n-ary predicate.
15
Compound Expressions Connectives from propositional logic carry over to predicate logic If P(x) denotes “x > 0,” find these truth values: P(3) ∨ P(-1) Solution: T P(3) ∧ P(-1) Solution: F P(3) → P(-1) Solution: F P(3) → P(-1) Solution: T Expressions with variables are not propositions and therefore do not have truth values. For example, P(3) ∧ P(y) P(x) → P(y) When used with quantifiers (to be introduced next), these expressions (propositional functions) become propositions
16
Quantifiers Quantification expresses the extent to which a predicate is true over a range of elements. A quantifier is "an operator that limits the variables of a proposition" In English, the words all, some, many, none, and few are used as quantifiers. We will focus on two types of quantification: Universal quantification tells us that a predicate is true for every element under consideration Existential quantification tells us that there are one or more elements under consideration for which the predicate is true
17
Universal Quantification
The universal quantification of P(x) is the statement: "P(x) for all values of x in the domain U." 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 is called a counterexample of x P(x) Symbol name: Turned A
18
Universal Quantification: Example
Let P(x) be the statement "x + 1 > x". What is the truth value of the quantification x P(x), where the domain U consists of all real numbers? Solution: Because P(x) is true for all real numbers x, the quantification x P(x) is true
19
Universal Quantification: Examples
Let Q(x) be the statement "x < 2 " What is the truth value of the quantification x Q(x), where the domain U consists of all real numbers? Solution: Q(x) is not true for every real number x, because, for instance, Q(3) is false. Hence, x = 3 is a counterexample for the statement x Q(x). Therefore, x Q(x) is false Remark: Only a single counterexample is needed to prove that the universal quantification is false
20
Universal Quantification: Example
Let P(x) is "x/2 < x" What is the truth value of the quantification x P(x), where the domain consists of all real numbers? Solution: The statement x P(x) is false because all negative values of x are counterexamples
21
Universal Quantification: Example
P(x) is the statement "x2 < 10" What is the truth value of x P(x), where the domain consists of 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), but P(4) is a counterexample, therefore x P(x) is false Remarks: In order to prove that a universal quantification is true, it must be shown for ALL cases In order to prove that a universal quantification is false, it must be shown to be false for only ONE case
22
Existential Quantification
The existential 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 existential quantification of P(x). is called the existential quantifier A domain must always be specified when a statement x P(x) is used. The meaning of x P(x) changes when the domain changes Without specifying the domain, the statement x P(x) has no meaning Symbol name: Turned E
23
Existential Quantification: Example
Let P(x) denote the statement "x > 3". What is the truth value of the quantification x P(x), where the domain consists of all real numbers? Solution: Because "x > 3" is sometimes true, for example, for x = 4, therefore x P(x) is true Remark: The statement x P(x) is false if and only if there is no element x in the domain for which P(x) is true. That is, x P(x) is false if and only P(x) is false for every element of the domain
24
Existential Quantification: Example
Let Q(x) denote the statement "x = x + 1". What is the truth value of the quantification x Q(x), where the domain consists of all real numbers? Solution: As Q(x) is false for every real number x, therefore x Q(x) is false. Remarks: In order to show an existential quantification is true, you only have to find ONE value. In order to show an existential quantification is false, you have to show it’s false for ALL values
25
Existential Quantification: Example
What is the truth value of x P(x), where P(x) is the statement "x2 > 10" and the domain consists of the positive integers not exceeding 4? Solution: As the domain is {1, 2, 3, 4}, the proposition x P(x) is the same as the disjunction P(1) P(2) P(3) P(4) As P(4) is true, therefore x P(x) is true
26
Existential Quantification: Example
What is the truth value of x P(x), where: a) P(x) denotes the statement x + 1 < x b) P(x) denotes the statement x + 1 > x and the domain consists of all real numbers Solution: a) There is no numerical value x for which x+1< x Thus, x P(x) is false b) There is a numerical value for which x + 1 > x In fact, it’s true for all values of x. Thus, x P(x) is true
27
Some Notes on Quantifiers
P(x) is not a proposition. P(x) is called a propositional function, e.g., let P(x) be "x = 0" There are two ways to convert a propositional function into a proposition: Supply it with a value Example: P(5) is false, P(0) is true Provide a quantification Example: x P(x) is false, x P(x) is true. In the case of quantifications, the domain must be defined
28
Precedence of Quantifiers
The quantifiers and have higher precedence then all logical operators from propositional calculus Example: x P(x) Q(x) is the disjunction of x P(x) and Q(x). It is the same as [x P(x)] Q(x), not x [P(x) Q(x)]
29
Binding Variables and Scope
When a quantifier is used on the variable x, then we say that this occurrence of the variable is bound. An occurrence of a variable that is not bound by a quantifier or set equal to a particular value is said to be free All the variables that occur in a propositional function must be bound or set equal to a particular value to turn it into a proposition The part of a logical expression to which a quantifier is applied is called the scope of this quantifier. A variable is free if it is outside the scope of all quantifiers in the formula that specifies this variable
30
Binding Variables: Example
In the statement x [P(x) Q(x)] x R(x), all variables are bound The scope of the first quantifier, x, is the expression P(x) Q(x) because x is applied only to P(x) Q(x) and not to the rest of the statement Similarly, the scope of the second quantifier, x , is the expression R(x). That is, the existential quantifier binds the variable x in P(x) Q(x) and the universal quantifier x binds the variable x in R(x)
31
Binding Variables: Examples
[x P(x)] Q(x) x in Q(x) is not bound, thus it is not a proposition [x P(x)] [x Q(x)] Both x values are bound, thus it is a proposition x [P(x) Q(x)] [y R(y)] All variables are bound, thus it is a proposition [x P(x) Q(y)] [y R(y)] y in Q(y) is not bound, thus it is not a proposition
32
Logical Equivalence Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements Values from the domain are used for the variables in these propositional functions We use the notation S T to indicate that two statements S and T involving predicates and quantifiers are logically equivalent
33
Logical Equivalences: Example
Show that x [P(x) Q(x)] and x P(x) x Q(x) are logically equivalent, when the same domain is used Solution: To show logical equivalence, we must show that they always take the same truth value, no matter what the predicates P and Q are which domain is used Suppose we have particular predicates P and Q, with a common domain. We can show logical equivalence between x [P(x) Q(x)] and x P(x) x Q(x) by showing two things: If x [P(x) Q(x)] is true, then x P(x) x Q(x) is true If x P(x) x Q(x) is true, then x [P(x) Q(x)] is true
34
Logical Equivalences: Example
Solution (contd.) If x [P(x) Q(x)] is true, then x P(x) x Q(x) is true Suppose that x [P(x) Q(x)] is true This means that if a is in the domain, then P(a) Q(a) is true Hence, P(a) is true and Q(a) is true Because P(a) is true and Q(a) is true for every element in the domain, we can conclude that x P(x) and x Q(x) are both true This means that x P(x) x Q(x) is true
35
Logical Equivalences: Example
Solution (contd.) If x P(x) x Q(x) is true, then x [P(x) Q(x)] is true Suppose that x P(x) x Q(x) is true Then x P(x) is true and x Q(x) is also true If a is in the domain, then P(a) is true and Q(a) is true because P(x) and Q(x) are both true for all elements in the domain It follows that for all a, P(a) Q(a) is true Then x [P(x) Q(x)] is true
36
Thinking about Quantifiers as Conjunctions and Disjunctions
A universally quantified proposition is equivalent to a conjunction of propositions without quantifiers An existentially quantified proposition is equivalent to a disjunction of propositions without quantifiers. If U consists of the integers 1,2, and 3:
37
CS 103 Discrete Structures Lecture 6
Logic and Proofs (5) Chapter 1 section 1.1 by Dr. Mosaad Hassan
38
Negating Universal Quantification
"Every student in the class has taken calculus" This statement is a universal quantification x P(x), P(x) is "x has taken calculus" The domain consists of the students in the class Negation of statement is "It is not the case that every student in the class has taken calculus", i.e. ¬x P(x) This is equivalent to "There is a student in the class who has not taken calculus." This is the existential quantification of the negation of the original propositional function x ¬P(x) This example illustrates the logical equivalence ¬x P(x) x ¬P(x).
39
De Morgan's Laws for Quantifiers
The rules for negations for quantifiers are called De Morgan's Laws for Quantifiers To negate a universal quantification: Negate the propositional function Change to an existential quantification To negate an existential quantification: Change to a universal quantification
40
De Morgan's Laws for Quantifiers
What is the negation of the statement "There is an excellent student"? Solution: Let P(x) denote “x is excellent”. Then the statement "There is an excellent student" is represented by x P(x), where the domain consists of all students The negation of this statement is ¬x P(x), which is equivalent to x ¬P(x) This negation can be expressed in English as "Every student is not excellent"
41
De Morgan's Laws for Quantifiers
Find the negation of the statement "All teachers explain lessons seriously" Solution: Let L(x) denote "x explains lessons seriously" Then the statement "All teachers explain lessons seriously" is represented by x L(x), where the domain consists of all teachers. The negation of this statement is ¬x L(x), which is equivalent to x¬L(x). This negation can be expressed in several different ways, including: "Some teachers don’t explain lessons seriously" "There is a teacher who doesn’t explain lessons seriously"
42
De Morgan's Laws for Quantifiers
Find the negation of the statement x (x2 > x) Negation of x (x2 > x) is the statement, ¬x (x2 > x), which is equivalent to x ¬(x2 > x) This can be rewritten as x (x2 ≤ x) Remark: The truth values of this statement depend on the domain
43
De Morgan's Laws for Quantifiers
Find the negation of the statement x (x2 = 2) Negation of x (x2 = 2) is the statement, ¬x (x2 = 2), which is equivalent to x ¬(x2 = 2) This can be rewritten as x (x2 ≠ 2) Remark: The truth values of this statement depend on the domain
44
De Morgan's Laws for Quantifiers
Show that ¬x [P(x) → Q(x)] and x [P(x) ¬Q(x)] are logically equivalent ¬x [P(x) → Q(x)] x ¬[P(x) → Q(x)] De Morgan's x ¬[¬P(x) Q(x)] Implication definition x [P(x) ¬Q(x)] De Morgan's
45
Properties of Quantifiers
The truth value of x P(x) and x P(x) depend on both the propositional function P(x) and the domain U Examples: If U is the positive integers and P(x) is the statement “x < 2”, then x P(x) is true, but x P(x) is false If U is the negative integers and P(x) is the statement “x < 2”, then both x P(x) and x P(x) are true If U consists of 3, 4, and 5, and P(x) is the statement “x > 2”, then both x P(x) and x P(x) are true. But if P(x) is the statement “x < 2”, then both x P(x) and x P(x) are false
46
Translation from English to Predicate Logic
Translating sentences in English (or other natural languages) into logical expressions is a crucial task in Mathematics, Logic Programming, Artificial Intelligence, Software Engineering, and many other disciplines The goal in this translation is to produce simple and useful logical expressions Here, we restrict ourselves to sentences that can be translated into logical expressions using a single quantifier
47
Translation from English to Predicate Logic
Express the statement "Every student in this class has studied calculus" using predicates and a quantifier Solution: We can introduce the following two: A variable x to represent student (object) Predicates to represent each property in the statement Now let: S(x) be "x is in this class" C(x) be "x has studied calculus" Then the required expression is x [S(x) → C(x)]
48
Translation from English to Predicate Logic
Express the statements "Some student in this class has visited Egypt" and "Every student in this class has visited either Jordan or Egypt" using predicates and quantifier Solution: Let, x represent a student S(x): "x is in this class" E(x): "x has visited Egypt" J(x): "x has visited Jordan", then The 1st statement is expressed as x [S(x) E(x)] 2nd one is expressed as x (S(x) → [E(x) J(x)])
49
Section 1.4: Exercises a) Q(Riyad, Saudi Arabia) b) Q(Riyad, Egypt)
1. Let P(x) denote the statement "x ≤ 4" What are the truth values? a) P(0) b) P(4) c) P(6) 2. Let P(x) be the statement "the word x contains the letter a" What are the truth values? a) P(orange) b) P(lemon) c) P(true) d) P(false) 3. Let Q(x, y) denote the statement "x is the capital of y." What are these truth values? a) Q(Riyad, Saudi Arabia) b) Q(Riyad, Egypt) c) Q(Cairo, Saudi Arabia) d) Q(Cairo, Egypt)
50
Exercises 4. Let P(x) be the statement "x spends more than five hours every weekday in class," where the domain for x consists of all students. Express each of these quantifications in English. a) x P(x) b) x P(x) c) x ¬P(x) d) x ¬P(x) 5. Translate these statements into English, where C(x) is "x is a comedian" and F(x) is "x is funny" and the domain consists of all people. a) x (C(x) → F(x)) b) x (C(x) → F(x)) c) x (C(x) F(x)) d) x (C(x) F(x)) 6. Translate these statements into English, where R(x) is "x is a rabbit" and H (x) is "x hops" and the domain consists of all animals. a) x (R(x) → H(x)) b) x (R(x) → H(x)) c) x (R(x) H(x)) d) x (R(x) H(x))
51
Exercises 7. Suppose that the domain of the propositional function P(x) consists of the integers 1, 2, 3, 4, and 5. Express these statements without using quantifiers, instead using only negations, disjunctions, and conjunctions. a) x P(x) b) x P(x) c) ¬x P(x) d) ¬x P(x) 8. Let P(x) be the statement "x = x2" If the domain consists of the integers, what are the truth values? a) P(0) b) P(-1) c)P(1) d) x P(x) e) P(2) f) x P(x) 9. Let Q(x) be the statement "x + 1 > 2x" If the domain consists of all integers, what are these truth values? a) Q(0) b) Q(-1) c) Q(1) d) x Q(x) e) x Q(x) f) x ¬Q(x) g) x ¬Q(x)
52
Exercises 10. Translate each of these statements into logical expressions using predicates, quantifiers, and logical connectives. First, let the domain consist of the students in your class and second, let it consist of all people. a) Someone in your class can speak Hindi. b) Everyone in your class is friendly. c) There is a person in your class who was not born in California. d) A student in your class has been in a trip. e) No student in your class has taken a course in logic programming. f) Everyone in your class has a cellular phone. g) All students in your class can solve quadratic equations. h) Some student in your class does not want to be rich.
53
Exercises 11. Translate each of these statements into logical expressions using predicates, quantifiers, and logical connectives. a) No one is perfect. b) Not everyone is perfect. c) All your friends are perfect. d) At least one of your friends is perfect. e) Everyone is your friend and is perfect. f) Not everybody is your friend or someone is not perfect.
54
Exercises 12. Suppose the domain of the propositional function P (x, y) consists of pairs x and y, where x is 1, 2, or 3 and y is 1,2, or 3. Write out these propositions using disjunctions and conjunctions. a) x P(x, 3) b) y P(1, y) c) y ¬P(2, y) d) x ¬P(x, 2) 13. Suppose that the domain of Q(x, y, z) consists of triples x, y, z, where x = 0, 1, or 2, y = 0 or 1, and z = 0 or 1. Write out these propositions using disjunctions and conjunction a) y Q(0, y, 0) b) x Q(x, 1, 1) c) z ¬Q(0, 0, z) d) x ¬Q(x, 0, 1)
55
Exercises 14. Find a counterexample, if possible, to these universally quantified statements, where the domain for all variables consists of all integers. a) x (x2 ≥ x) b) x (x > 0 x < 0) c) x (x = 1) 15. Find a counterexample, if possible, to these universally quantified statements, where the domain for all variables consists of all real numbers. a) x (x2 ≠ x) b) x (x2 ≠ 2) c) x (|x| > 0)
56
Exercises 16. Determine whether each of the following pairs are logically equivalent. Justify your answer: a) x (P(x) → Q(x)) and x P(x) → x Q(x) b) x (P(x) Q(x))and x P(x) x Q(x) c) x (P(x) Q(x)) and x P(x) x Q(x)
57
CS 103 Discrete Structures Lecture 07a
Logic and Proofs (6) Chapter 1 section 1.1 by Dr. Mosaad Hassan
58
First Midterm Exam 2nd Lecture, week 7 (same time as the lecture)
75 minute duration Will cover all lectures delivered before the exam date Will consist of MCQ’s, fill-in-the-blanks, questions with short answers, writing of proofs, and drawing of diagrams If you miss this exam for any reason, you will have to appear for a makeup exam on the Thursday of the last week of teaching. That exam will cover all lectures delivered in the semester. It will consist of writing of proofs, drawing of diagrams and answering questions having page answers.
59
Nested Quantifiers Section 1.5
60
Section Summary Nested Quantifiers Order of Quantifiers
Translating from Nested Quantifiers into English Translating Mathematical Statements into Statements involving Nested Quantifiers. Translated English Sentences into Logical Expressions. Negating Nested Quantifiers.
61
Nested Quantifiers Two quantifiers can be nested if one is within the scope of the other: x y (x + y = 0) This is can also be written as: x [y (x + y = 0)] Everything within the scope of a quantifier can be thought of as a propositional function. For example, x y (x + y = 0) is the same thing as x Q(x), where Q(x) is y P(x, y), and P(x, y) is x + y = 0
62
Nested Quantifiers: Example
Assume that the domain for the variables x and y consists of all real numbers x y (x + y = y + x) Means x + y = y + x for all x and y (Commutative law for addition of real numbers) x y (x + y = 0) Means that for every x there is some y such that x + y = 0 (Every real number has an additive inverse) x y z [x + (y + z)] = [(x + y) + z] Associative law for addition of real numbers x y (xy = 0) There exists an x such that for all y (xy = 0) is true
63
Nested Quantifiers: Example
Translate into English the statement x y [(x > 0) (y < 0] → (xy < 0) where the domain U for x and y is all real numbers Possible Solutions: For every real number x and for every real number y, if x > 0 and y < 0, then xy < 0 For real numbers x and y, if x is positive and y is negative, then xy is negative The product of a positive real number and a negative real number is always a negative real number
64
Order of Nested Quantifiers
x y and x y are not equivalent x y : for some x and every y x y : for every x and some y However, the order of nested universal quantifiers (without other quantifiers) can be changed without changing the meaning of the statement x y : for every x and every y y x : for every y and every x Similarly, the order of nested existential quantifiers (without other quantifiers) can be changed without changing the meaning of the statement x y : for some x and some y y x : for some y and some x
65
Order of Nested Quantifiers: Example
Let P(x, y) be the statement "x + y = y + x" What are the truth values of the quantifications x y P(x, y) and y x P(x, y) where the domain for all variables consists of all real numbers? Solution Both x y P(x, y) & y x P(x, y) mean "For all real numbers x, for all real numbers y, x + y = y + x" Since P(x, y) is true for all real numbers x and y, the propositions x y P(x, y) and y x P(x, y) are true
66
Order of Nested Quantifiers: Example
Let Q(x, y) be "x + y = 0" What are the truth values of y x Q(x, y) & x y Q(x, y), where the domain for x and y consists of all real numbers? Solution: y x Q(x, y) denotes the proposition "There is a y such that for every x, Q(x, y)" There is no y such that x + y = 0 for all x, therefore the statement y x Q(x, y) is false x y Q(x, y) denotes the proposition "For every x there is a y such that Q(x, y)" Given an x, there is a y such that x + y = 0; (y = -x), therefore the statement x y Q(x, y) is true Conclusion: The order of dissimilar quantifiers is important. y x Q(x, y) and x y Q(x, y) are not logically equivalent
67
Quantification of Two Variables
Statement When True? When False P(x,y) is true for every pair x,y There is a pair x,y for which P(x,y) is false For every x there is a y for which P(x,y) is true There is an x such that P(x,y) is false for every y There is an x for which P(x,y) is true for every y For every x there is a y for which P(x,y) is false There is a pair x, y for which P(x,y) is true P(x,y) is false for every pair x,y
68
Order of Nested Quantifiers: Example
Let Q(x, y, z) be the statement "x + y = z" What are the truth values of the propositions x y z Q(x, y, z) and z x y Q(x, y, z), where the domain of all variables consists of all real numbers? Solution: x y z Q(x, y, z) means "For all x and for all y, there is a z such that x + y = z" and is true z x y Q(x, y, z) means "There is a z such that for all x and for all y it is true that x + y = z" It is false because there is no value of z that satisfies the equation x + y = z for all values of x and y The order of the quantifiers here is important
69
Translation from English to Predicate Logic
“The sum of two positive integers is always positive” Solution: We can rewrite the statement by introducing the variables x and y as: "For all positive integers x and y, x + y is positive“ Consequently, we can express this statement as: x y [(x > 0) (y > 0) → (x + y > 0)] where the domain for x and y consists of all integers If we consider the positive integers as the domain, then the original statement becomes: “For every two positive integers, the sum of these integers is positive” We can express this as x y(x + y > 0)
70
Translation from English to Predicate Logic
Translate the statement "Every real number except zero has a multiplicative inverse" Solution: We can rewrite this as "For every real number x, if x ≠ 0, then there exists a real number y such that xy = 1" This can be rewritten as: x [(x ≠ 0) → y (xy = 1)] Translate the statement "The product of two negative integers is positive" Solution: x y [(x < 0) (y < 0) → (xy > 0)]
71
Translation from English to Predicate Logic
Translate the statement "The average of two positive integers is positive" Solution: x y [(x>0) (y>0) → (x + y)/2 > 0)] Translate the statement "The difference of two negative integers is not necessarily negative" Solution: x y [(x < 0) (y < 0) (x - y < 0)] Translate the statement "Absolute value of the sum of two integers does not exceed the sum of their absolute values" Solution: x y (|x + y| ≤ |x| + |y|)
72
Translation from Predicate Logic to English
Translate the following into English: x (C(x ) y [C(y) F(x, y)]), where C(x) is "x has a computer" F(x, y) is "x and y are friends" The domain for both x and y consists of all students in your college Possible Solutions: For every student x in your college, x has a computer or there is a student y such that y has a computer and x and y are friends Every student in your college has a computer or has a friend who has a computer
73
Translating to English: Examples
x y (x + y = y) There exists an additive identity for all real numbers x y ([(x ≥ 0) (y < 0)] → [x - y > 0]) A non-negative number minus a negative number is greater than zero x y ([(x ≤ 0 ) (y ≤ 0 )] [x - y > 0]) The difference between two non-positive numbers is not necessarily non-positive (i.e. can be positive) x y ([(x ≠ 0) (y ≠ 0)] ↔ [xy ≠ 0]) The product of two non-zero numbers is non- zero iff both factors are non-zero
74
Translating to English: Example
"If a person is female and is a parent, then this person is someone's mother" (domain consists of all people) Solution: This statement can be rephrased as "For every person x, if person x is female and person x is a parent, then there exists a person y such that person x is the mother of person y." Suppose that: F(x) represents "x is female," P(x) represents "x is a parent" M(x, y) represents "x is the mother of y" Then, we can say x [[F(x) P(x)] → y M(x, y)] As y is not in the scope of , we can move y to the left after x. The result then is: x y [[F(x) P(x)] → M(x, y)]
75
Negating Nested Quantifiers
Recall negation rules for single quantifiers: ¬x P(x) = x ¬P(x) ¬x P(x) = x ¬P(x) Example: Express the negation of the statement x y (xy = 1) so that no negation precedes the quantifiers Solution: ¬x y (xy = 1) ¬x [y (xy = 1)] x ¬[y (xy = 1)] x [y ¬(xy = 1)] x [y (xy ≠ 1)] x y (xy ≠ 1)
76
Negating Nested Quantifiers: Example
Find the negation of the statements: a) x y P(x, y) b) x y z P(x, y, z) Solution: a) ¬[x y P(x, y)] x ¬y P(x, y) x y ¬P(x, y) b) ¬[x y z P(x, y, z)] x ¬y z P(x, y, z) x y ¬z P(x, y, z) x y z ¬P(x, y, z)
77
Section 1.5 Exercises 1. Translate these statements into English, where the domain for each variable consists of all real numbers 2. Let Q(x, y) be the statement "x has sent an message to y," where the domain for both x and y is all students in your class. Express each of these quantifications in English.
78
Exercises 3. Let I(x) be the statement "x has an Internet connection" and C(x , y) be the statement "x and y have chatted over the Internet," where the domain for the variables x and y consists of all students in your class. Use quantifiers to express each of these statements: a) Ahmad does not have an Internet connection. b) Ali has not chatted over the Internet with Basel. c) Tourky and Naif have never chatted over the Internet. d) No one in the class has chatted with Zeiad. e) Saleh has chatted with everyone except Yousf. f) Someone in your class does not have an Internet connection. g) Not everyone in your class has an Internet connection. h) Exactly one student in your class has an Internet connection. i) There are two students in the class who between them
79
Exercises (follow exercise 3)
j) Everyone in your class with an Internet connection has chatted over the Internet with at least one other student in your class. k) Someone in your class has an Internet connection but has not chatted with anyone else in your class. I) There are two students in your class who have not chatted with each other over the Internet. m) There is a student in your class who has chatted with everyone in your class over the Internet. n) There are at least two students in your class who have not chatted with the same person in your class. o) Everyone except one student in your class has an Internet connection
80
Exercises 4. Translate each of these nested quantifications into an English statement that expresses a mathematical fact. The domain in each case consists of all real numbers.
81
Exercises 5. Let Q(x, y) be the statement "x + y = x -y" If the domain for both variables consists of all integers, what are the truth values?
82
Exercises 6. Determine the truth value of each of these statements if the domain for all variables consists of all integers.
83
Exercises 7. Determine the truth value of each of these statements if the domain of each variable consists of all real numbers.
84
Exercises 8. Express the negations of each of these statements so that all negation symbols immediately precede predicates
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.