CS 103 Discrete Structures Lecture 05 Logic and Proofs (4)

84
CS 103 Discrete Structures Lecture 05 Logic and Proofs (4)

Transcript of CS 103 Discrete Structures Lecture 05 Logic and Proofs (4)

The Foundations: Logic and Proofs

CS 103 Discrete Structures Lecture 05Logic and Proofs (4)

1Chapter 1 section 1.1 by Dr. Mosaad HassanThe Foundations: Logic and ProofsChapter 1, Part II: Predicate LogicWith Question/Answer Animations2SummaryPredicate Logic (First-Order Logic (FOL), Predicate Calculus)The Language of QuantifiersLogical EquivalencesNested QuantifiersTranslation from Predicate Logic to EnglishTranslation from English to Predicate Logic

3Predicates and QuantifiersSection 1.44Section SummaryPredicates VariablesQuantifiersUniversal QuantifierExistential QuantifierNegating QuantifiersDe Morgans Laws for QuantifiersTranslating English to Logic

5Limitation of Propositional LogicPropositional 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."6Predicate Logic Predicate Logic is a more powerful type of logicIt 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

7PredicatePredicate 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"8Propositional Function We can denote the statement "x is greater than 3" by P(x), where:P denotes the predicate "is greater than 3" on xThe variable x is the subject of the statementThe 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 settingx = 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.9Predicates: ExampleLet 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.10Predicates: ExerciseLet P(x) = x is a multiple of 5

For what values of x is P(x) true?11Multi-Variable PredicatesWe 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 variablesQ is the predicate. When values are assigned to the variables x and y, the statement Q(x, y) has a truth value12Multi-Variable Predicates: ExampleLet 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 andy = 2 in the statement Q(x, y). Hence, Q(1, 2) is false

Similarly, the statement Q(3, 0) is true13Multi-Variable Predicates: ExampleLet 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.14Compound ExpressionsConnectives from propositional logic carry over to predicate logicIf P(x) denotes x > 0, find these truth values:P(3) P(-1) Solution: TP(3) P(-1) Solution: FP(3) P(-1) Solution: FP(3) P(-1) Solution: TExpressions 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

15QuantifiersQuantification 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 considerationExistential quantification tells us that there are one or more elements under consideration for which the predicate is true16Universal QuantificationThe 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 A17Universal Quantification: ExampleLet P(x) be the statement "x + 1 > x".

What is the truth value of the quantificationx 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 true18Universal Quantification: ExamplesLet Q(x) be the statement "x < 2 "

What is the truth value of the quantificationx 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 false19Universal Quantification: ExampleLet P(x) is "x/2 < x"

What is the truth value of the quantificationx 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 counterexamples20Universal Quantification: ExampleP(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 casesIn order to prove that a universal quantification is false, it must be shown to be false for only ONE case

21Existential QuantificationThe 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 quantifierA domain must always be specified when a statement x P(x) is used. The meaning of x P(x) changes when the domain changesWithout specifying the domain, the statementx P(x) has no meaning

Symbol name: Turned E22Existential Quantification: ExampleLet 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

23Existential Quantification: ExampleLet 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 its false for ALL values24Existential Quantification: ExampleWhat 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 true25Existential Quantification: ExampleWhat 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< xThus, x P(x) is falseb)There is a numerical value for which x + 1 > xIn fact, its true for all values of x. Thus,x P(x) is true26Some Notes on QuantifiersP(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 valueExample: P(5) is false, P(0) is trueProvide a quantificationExample: x P(x) is false, x P(x) is true. In the case of quantifications, the domain must be defined

27Precedence of QuantifiersThe 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), notx [P(x) Q(x)]

28Binding 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 freeAll the variables that occur in a propositional function must be bound or set equal to a particular value to turn it into a propositionThe 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 variable29Binding 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)

30Binding 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 proposition31Logical EquivalenceStatements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter whichpredicates 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 equivalent32Logical 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 matterwhat the predicates P and Q arewhich 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 trueIf x P(x) x Q(x) is true, then x [P(x) Q(x)] is true33Logical 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, thenP(a) Q(a) is trueHence, 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 thatx P(x) and x Q(x) are both trueThis means that x P(x) x Q(x) is true34Logical 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 trueIf 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 domainIt follows that for all a, P(a) Q(a) is trueThen x [P(x) Q(x)] is true35Thinking about Quantifiers as Conjunctions and DisjunctionsA universally quantified proposition is equivalent to a conjunction of propositions without quantifiersAn existentially quantified proposition is equivalent to a disjunction of propositions without quantifiers.

If U consists of the integers 1,2, and 3:

36CS 103 Discrete Structures Lecture 6Logic and Proofs (5)

37Chapter 1 section 1.1 by Dr. Mosaad HassanNegating 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 classNegation 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 equivalencex P(x) x P(x).38De Morgan's Laws for QuantifiersThe rules for negations for quantifiers are calledDe Morgan's Laws for Quantifiers

To negate a universal quantification:Negate the propositional functionChange to an existential quantificationTo negate an existential quantification:Negate the propositional functionChange to a universal quantification

39De Morgan's Laws for QuantifiersWhat 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"40De Morgan's Laws for QuantifiersFind 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 xL(x).

This negation can be expressed in several different ways, including:"Some teachers dont explain lessons seriously" "There is a teacher who doesnt explain lessons seriously" 41De Morgan's Laws for QuantifiersFind 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 domain42De Morgan's Laws for QuantifiersFind 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 domain43De Morgan's Laws for QuantifiersShow 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 definitionx [P(x) Q(x)] De Morgan's 44Properties of QuantifiersThe 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 statementx < 2, then x P(x) is true, but x P(x) is falseIf U is the negative integers and P(x) is the statementx < 2, then both x P(x) and x P(x) are trueIf 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

45Translation from English to Predicate LogicTranslating 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 quantifier46Translation from English to Predicate LogicExpress 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 statementNow 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)]47Translation from English to Predicate LogicExpress 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)])48Section 1.4: Exercises1. 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)

49Exercises4. 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))50Exercises7. 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)51Exercises10. 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.52Exercises11. 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.53Exercises12. 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 conjunctiona) y Q(0, y, 0) b) x Q(x, 1, 1)c) z Q(0, 0, z) d) x Q(x, 0, 1)

54Exercises14. 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)

55Exercises16. 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)56CS 103 Discrete Structures Lecture 07aLogic and Proofs (6)

57Chapter 1 section 1.1 by Dr. Mosaad HassanFirst Midterm Exam2nd Lecture, week 7 (same time as the lecture)75 minute durationWill cover all lectures delivered before the exam dateWill consist of MCQs, 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 0.5-1 page answers.58Nested QuantifiersSection 1.559Section SummaryNested Quantifiers Order of QuantifiersTranslating from Nested Quantifiers into EnglishTranslating Mathematical Statements into Statements involving Nested Quantifiers.Translated English Sentences into Logical Expressions.Negating Nested Quantifiers.

60Nested QuantifiersTwo 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 asx Q(x),whereQ(x) is y P(x, y),andP(x, y) is x + y = 061Nested Quantifiers: ExampleAssume that the domain for the variables x and y consists of all real numbersx 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 thatx + y = 0 (Every real number has an additive inverse)x y z [x + (y + z)] = [(x + y) + z]Associative law for addition of real numbersx y (xy = 0)There exists an x such that for all y (xy = 0) is true62Nested Quantifiers: ExampleTranslate into English the statementx 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 < 0For real numbers x and y, if x is positive and y is negative, then xy is negativeThe product of a positive real number and a negative real number is always a negative real number63Order of Nested Quantifiersx y and x y are not equivalent

x y : for some x and every yx 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 yy 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

64Order of Nested Quantifiers: ExampleLet P(x, y) be the statement "x + y = y + x"

What are the truth values of the quantificationsx 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 true65Order of Nested Quantifiers: ExampleLet 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 equivalent66Quantification of Two Variables StatementWhen True?When FalseP(x,y) is true for every pair x,yThere is a pair x,y for which P(x,y) is falseFor every x there is a y for which P(x,y) is trueThere is an x such that P(x,y) is false for every yThere is an x for which P(x,y) is true for every yFor every x there is a y for which P(x,y) is falseThere is a pair x, y for which P(x,y) is trueP(x,y) is false for every pair x,y

67Order of Nested Quantifiers: ExampleLet Q(x, y, z) be the statement "x + y = z" What are the truth values of the propositionsx 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 important68Translation from English to Predicate LogicThe 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)69Translation from English to Predicate LogicTranslate 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)]70Translation from English to Predicate LogicTranslate 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|)71Translation from Predicate Logic to EnglishTranslate the following into English:x (C(x ) y [C(y) F(x, y)]), whereC(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 collegePossible 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 friendsEvery student in your college has a computer or has a friend who has a computer72Translating to English: Examplesx y (x + y = y)There exists an additive identity for all real numbersx y ([(x 0) (y < 0)] [x - y > 0])A non-negative number minus a negative number is greater than zerox 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-zero73Translating 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)]74Negating 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 statementx y (xy = 1) so that no negation precedes the quantifiersSolution:x y (xy = 1)x [y (xy = 1)]x [y (xy = 1)]x [y (xy = 1)]x [y (xy 1)]x y (xy 1)75Negating Nested Quantifiers: ExampleFind 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)76Section 1.5 Exercises1. 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 e-mail message to y," where the domain for both x and y is all students in your class. Express each of these quantifications in English.

77Exercises3. 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 them78Exercises(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

79Exercises4. 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.

80Exercises5. 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?

81Exercises6. Determine the truth value of each of these statements if the domain for all variables consists of all integers.

82Exercises7. Determine the truth value of each of these statements if the domain of each variable consists of all real numbers.

83Exercises8. Express the negations of each of these statements so that all negation symbols immediately precede predicates

84