MATH 226 رياضيات متقطعة لعلوم الحاسب Chapter 1 Predicates and Quantifiers 1.4 Predicates Statements involving variables, such as “x > 3,” “x = y + 3,” “x + y = z,” and “computer x is functioning properly,” Variables A variable is a symbol that stands for an individual in a collection. For example, the variable x may stand for one of the days. We may let x = Monday or x = Tuesday, etc. A collection of objects is called the domain of a variable. For the above example, the days in the week is the domain of variable x. Incomplete Statements A sentence containing a variable is called an incomplete statement. When we replace the variable by the name of an individual in the set we obtain a complete statement. Example : incomplete statement : “x has 30 days.” Here, x can be any month and substituting that, we will get a complete statement. “ April has 30 days.” The statement “x is greater than 3” has two parts. The first part, the variable x, The second part the predicate, “is greater than 3”— refers to a property that We can denote the statement “x is greater than 3” by P(x), Truth value for predicate EXAMPLE : Let P(x) denote the statement “x > 3.” What are the truth values of P(4) and P(2)? Solution: P(4), is the statement “4 > 3,” is true. However, P(2), is the statement “2 > 3,” is false. Quantifiers: Quantifiers : refer to given quantities, The area of logic that deals with predicates and quantifiers is called the predicate calculus. Two kinds of quantifiers: Universal and Existential Universal Quantifier: represented by ) ∀) The symbol is translated as and means “for all”, “given any”, “for each,” or “for every,” and is known as the universal quantifier. Existential Quantifier: represented by ) ∃( The symbol is translated as “for some,” “there exists,” “there is a,” or “for at least one”. “There is an x such that P(x),” or “There is at least one x such that P(x),” or“For some x P(x).” Truth of expression ∀x P(x) Example :“P(x) be the statement “x + 1 > x.” What is the truth value of the quantification ∀xP(x),where the domain consists of all real numbers? Because P(x) is true for all real numbers x, the quantification ∀xP(x) is true. Example :P(x) is the property that x is a plant, and the domain is the collection of all flowers: is true. Example P(x) is “x*2 > 0.” show that ∀xP(x) is false where the universe of discourse consists of all integers we give a counterexample. We see that x = 0 is a x*2 = 0 when x = 0, so that x2 is not greater than 0 cause when x = 0. Truth of expression ∃xP(x) EXAMPLE 5 : Let P(x) denote “x > 3.” What is the truth value of the quantification ∃xP(x),where the domain consists of all real numbers? Solution: Because “x > 3” is sometimes true—for instance, when x = 4 ∃xP(x), is true. That is, ∃xP(x) is false if and only if P(x) is false for every element of the domain. EXAMPLE 6: Let Q(x) :“x = x + 1.”What is the truth value ∃xQ(x), the domain consists of all real numbers? Solution: Because Q(x) is false for every real number ,∃xQ(x) is false. Negating Quantified Expressions • consider the negation of the statement “Every student in your class has taken a course in calculus.” the domain is the students in your class. • The negation of this statement is “It is not the case that every student in your class has taken a course in calculus.” This is equivalent to “There is a student in your class who has not taken a course in calculus.” And this is simply, ∃x ¬P(x). • This example illustrates that :¬∀xP(x) ≡ ∃x ¬P(x). consider the proposition“ There is a student in this class who has taken a course in calculus.” This is the existential quantification ∃xQ(x), The negation of this statement is “It is not the case that there is a student in this class who has taken a course in calculus.” This is equivalent to “Every student in this class has not taken calculus,” which is just ∀x ¬Q(x). This example illustrates the equivalence ¬∃xQ(x) ≡ ∀x ¬Q(x). Translating from English into Logical Expressions Example : Express the statement “Every student in this class has studied calculus” using predicates and quantifiers. Solution: introduce a variable x “For every student x in this class, x has studied calculus.” If S(x) represents the statement that (person x is student in this class) we introduce C(x): “x has studied calculus )and domain all people, we will need to express our statementas “For every person x, if person x is a student in this class then x has studied calculus.”” ∀x(S(x) → C(x)). Not as ∀x(S(x) ∧C(x)) because this statement says that all people are students in this class and have studied Example : Express the statements “Some student in this class has visited Mexico” using predicates and quantifiers. Solution: the domain for the variable x consists of all people , We introduce M(x), which is the statement “x has visited Mexico.”,. We introduce S(x) to represent “x is a student in this class.” Our solution is ∃x(S(x) ∧ M(x)) because the statement is that there is a person x who is a student in this class and who has visited Mexico. statement cannot be expressed as ∃x(S(x) → M(x)) why ? Example : • “Every person is nice” domain : any thing, if it is a person, then it is nice.” • So, if P(x) is “x is a person” and Q(x) be “x is nice,” the statement can be symbolized as (∀ x)[P(x) → Q(x)] • All persons are nice” or “Each person is nice” will also have the same symbolic form. Example “There is a nice person” can be rewritten as “There exists something that is both a person and nice.” In symbolic form, (∃ x([P(x( Λ Q(x(]. “Some persons are nice” or “There are nice persons.” will also have the same symbolic form. so almost always, ∃ goes with Λ (conjunction) and ∀ goes with → (implication