Presentation is loading. Please wait.

Presentation is loading. Please wait.

Predicate logic Also known as predicate calculus or First-Order-Logic(FOL) or First- Order-Predicate-Calculus (FOPC). Meant to overcome the weaknesses.

Similar presentations


Presentation on theme: "Predicate logic Also known as predicate calculus or First-Order-Logic(FOL) or First- Order-Predicate-Calculus (FOPC). Meant to overcome the weaknesses."— Presentation transcript:

1 Predicate logic Also known as predicate calculus or First-Order-Logic(FOL) or First- Order-Predicate-Calculus (FOPC). Meant to overcome the weaknesses of propositional logic.

2 Propositional Logic can’t say
If X is married to Y, then Y is married to X. If X is west of Y, and Y is west of Z, then X is west of Z. And a million other simple things. Fix: extend representation: add predicates Extend operator(resolution): add quantification

3 Propositional logic is a weak language
Hard to identify “individuals” (e.g., Mary, 3) Can’t directly talk about properties of individuals or relations between individuals (e.g., “Bill is tall”) Generalizations, patterns, regularities can’t easily be represented (e.g., “all triangles have 3 sides”) First-Order Logic (abbreviated FOL or FOPC) is expressive enough to concisely represent this kind of information FOL adds relations, variables, and quantifiers, e.g., “Every elephant is gray”:  x (elephant(x) → gray(x)) “There is a white alligator”:  x (alligator(X) ^ white(X))

4 First-order logic First-order logic (FOL) models the world in terms of
Objects, which are things with individual identities Properties of objects that distinguish them from other objects Relations that hold among sets of objects Functions, which are a subset of relations where there is only one “value” for any given “input” Examples: Objects: Students, lectures, companies, cars ... Relations: Brother-of, bigger-than, outside, part-of, has- color, occurs-after, owns, visits, precedes, ... Properties: blue, oval, even, large, ... Functions: father-of, best-friend, second-half, one-more- than ...

5 Propositional Functions
Propositional functions (or predicates) are propositions that contain variables. Ex: Let P(x) denote x > 3 where P denotes the predicate “is greater than 3” and x is the variable. The statement P(x) is also said to be the value of the propositional function P at x. Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value. P(x) has no truth value until the variable x is bound by either assigning it a value or by quantifying it.

6 Quantifiers xP(x) True when P(x) is true for every x.
Universal x Existential x xP(x) True when P(x) is true for every x. False if there is an x for which P(x) is false. xP(x) True if there exists an x for which P(x) is true. False if P(x) is false for every x.

7 When the variables in a propositional function are assigned values, the resulting statement becomes a proposition with a certain truth value. However, there is another important way, called quantification, to create a proposition from a propositional function. Quantification expresses the extent to which a predicate is true over a range of elements. In English, the words all, some, many, none, and few are used in quantifications. We will focus on two types of quantification here: universal quantification, which tells us that a predicate is true for every element under consideration, and existential quantification, which tells us that there is one or more element under consideration for which the predicate is true. The area of logic that deals with predicates and quantifiers is called the predicate calculus.

8 Negation (it is not the case)
xP(x) equivalent to xP(x) True when P(x) is false for every x False if there is an x for which P(x) is true.  xP(x) is equivalent to xP(x) True if there exists an x for which P(x) is false. False if P(x) is true for every x.

9 Universal Quantification of P(x)
xP(x) “for all x P(x)” “for every x P(x)” Defined as: P(x0)  P(x1)  P(x2)  P(x3)  for all xi in U Example: Let P(x) denote x2  x If U is x such that 0 < x < 1 then xP(x) is false. If U is x such that 1 < x then xP(x) is true.

10 Examples using universal quantifier
EXAMPLE 1: Let 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? Solution: Because P(x) is true for all real numbers x, the quantification ∀xP(x) is true.

11 Besides “for all” and “for every,” universal quantification can be expressed in many other ways, including “all of,” “for each,” “given any,” “for arbitrary,” “for each,” and “for any.” Remark: It is best to avoid using “for any x” because it is often ambiguous as to whether “any” means “every” or “some.” In some cases, “any” is unambiguous, such as when it is used in negatives, for example, “there is not any reason to avoid studying.”

12 A statement ∀xP(x) is false, where P(x) is a propositional function, if and only if P(x) is not always true when x is in the domain. One way to show that P(x) is not always true when x is in the domain is to find a counterexample to the statement ∀xP(x). Note that a single counterexample is all we need to establish that ∀xP(x) is false.

13 EXAMPLE 2: Let Q(x) be the statement “x < 2
EXAMPLE 2: Let Q(x) be the statement “x < 2.” What is the truth value of the quantification ∀xQ(x), where the domain consists of all real numbers? Solution: Q(x) is not true for every real number x, because, for instance, Q(3) is false. That is, x = 3 is a counterexample for the statement ∀xQ(x). Thus ∀xQ(x) is false.

14 EXAMPLE 3: Suppose that P(x) is “x2 > 0
EXAMPLE 3: Suppose that P(x) is “x2 > 0.” To show that the statement ∀xP(x) is false where the universe of discourse consists of all integers, we give a counterexample. We see that x = 0 is a counterexample because x2 = 0 when x = 0, so that x2 is not greater than 0 when x = 0.

15 EXAMPLE 4: What is the truth value of ∀xP(x), where P(x) is the statement “x2 < 10” and the domain consists of the positive integers not exceeding 4? Solution: The statement ∀xP(x) is the same as the conjunction P(1) ∧ P(2) ∧ P(3) ∧ P(4), because the domain consists of the integers 1, 2, 3, and 4. Because P(4), which is the statement “42 < 10,” is false, it follows that ∀xP(x) is false.

16 EXAMPLE 5: What does the statement ∀xN(x) mean if N(x) is “Computer x is connected to the network” and the domain consists of all computers on campus? Solution: The statement ∀xN(x) means that for every computer x on campus, that computer x is connected to the network. This statement can be expressed in English simply as “Every computer on campus is connected to the network.”

17 EXAMPLE 6: What is the truth value of ∀x(x2 ≥ x) if the domain consists of all real numbers? What is the truth value of this statement if the domain consists of all integers? Solution: The universal quantification ∀x(x2 ≥ x), where the domain consists of all real numbers, is false. For example, ( 1/2 )2 ≱ 1/2. Note that x2 ≥ x if and only if x2 − x = x(x − 1) ≥ 0. Consequently, x2 ≥ x if and only if x ≤ 0 or x ≥ 1. It follows that ∀x(x2 ≥ x) is false if the domain consists of all real numbers (because the inequality is false for all real numbers x with 0 < x < 1). However, if the domain consists of the integers, ∀x(x2 ≥ x) is true, because there are no integers x with 0 < x < 1.

18 A domain must always be specified when the statement ∀xP(x) is used
A domain must always be specified when the statement ∀xP(x) is used. Furthermore, the meaning of ∀xP(x) changes when its domain changes. Without specifying the domain, the statement ∀xP(x) has no meaning.

19 Existential Quantification of P(x)
xP(x) “there is an x such that P(x)” “there is at least one x such that P(x)” “there exists at least one x such that P(x)” Defined as: P(x0)  P(x1)  P(x2)  P(x3)  for all xi in U Example: Let P(x) denote x2  x If U is x such that 0 < x  1 then xP(x) is true. If U is x such that x < 1 then xP(x) is true.

20 EXAMPLE1: Let P(x) denote the statement “x > 3
EXAMPLE1: Let P(x) denote the statement “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—the existential quantification of P(x), which is ∃xP(x), is true. Observe that the statement ∃xP(x) is false if and only if there is no element x in the domain for which P(x) is true. That is, ∃xP(x) is false if and only if P(x) is false for every element of the domain.

21 EXAMPLE 2: Let Q(x) denote the statement “x = x + 1
EXAMPLE 2: Let Q(x) denote the statement “x = x + 1.”What is the truth value of the quantification ∃xQ(x), where the domain consists of all real numbers? Solution: Because Q(x) is false for every real number x, the existential quantification of Q(x), which is ∃xQ(x), is false.

22 When all elements in the domain can be listed—say, x1, x2,
When all elements in the domain can be listed—say, x1, x2, , xn— the existential quantification ∃xP(x) is the same as the disjunction P(x1) ∨ P(x2) ∨ · · · ∨ P(xn), because this disjunction is true if and only if at least one of P(x1), P(x2), , P (xn) is true.

23 EXAMPLE 3: What is the truth value of ∃xP(x), where P(x) is the statement “x2 > 10” and the universe of discourse consists of the positive integers not exceeding 4? Solution: Because the domain is {1, 2, 3, 4}, the proposition ∃xP(x) is the same as the disjunction P(1) ∨ P(2) ∨ P(3) ∨ P(4). Because P(4), which is the statement “42 > 10,” is true, it follows that ∃xP(x) is true.

24 Negating Quantified Expressions
We will often want to consider the negation of a quantified expression. For instance, consider the negation of the statement “Every student in your class has taken a course in calculus.” This statement is a universal quantification, namely, ∀xP(x), where P(x) is the statement “x has taken a course in calculus” and the domain consists of 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 the existential quantification of the negation of the original propositional function, namely, ∃x ¬P(x). This example illustrates the following logical equivalence: ¬∀xP(x) ≡ ∃x ¬P(x).

25 Suppose we wish to negate an existential quantification
Suppose we wish to negate an existential quantification. For instance, consider the proposition “There is a student in this class who has taken a course in calculus.” This is the existential quantification ∃xQ(x), where Q(x) is the statement “x has taken a course in calculus.” The negation of this statement is the proposition “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 the universal quantification of the negation of the original propositional function, or, phrased in the language of quantifiers, ∀x ¬Q(x). This example illustrates the equivalence ¬∃xQ(x) ≡ ∀x ¬Q(x).

26 EXAMPLE : What are the negations of the statements ∀x(x2 > x) and ∃x(x2 = 2)?
Solution: The 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). The 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). The truth values of these statements depend on the domain.

27 Example Let T(a,b) denote the propositional function “a trusts b.” Let U be the set of all people in the world. Everybody trusts Bob. xT(x,Bob) Bob trusts somebody. xT(Bob,x)

28 Example Alice trusts herself. T(Alice, Alice)
Alice trusts nobody. (everybody is not trusted by Alice) x T(Alice,x) Carol trusts everyone trusted by David. x(T(David,x)  T(Carol,x)) Everyone trusts somebody. x y T(x,y)

29 Examples x y T(x,y) Someone trusts everybody. y x T(x,y)
Somebody is trusted by everybody. Bob trusts only Alice. x (x=Alice  T(Bob,x))

30 Quantification of Two Variables
xyP(x,y) True when for every x there is a y for which P(x,y) is true. (in this case y can depend on x) False if there is an x such that P(x,y) is false for every y. yxP(x,y) True if there is a y for which P(x,y) is true for every x. (i.e., true for a particular y regardless (or independent) of x) False if for every y there is an x for which P(x,y) is false. Note that order matters here In particular, if yxP(x,y) is true, then xyP(x,y) is true. However, if xyP(x,y) is true, it is not necessary that yxP(x,y) is true.

31 Examples Let L(x,y) be the statement “x loves y” where U for both x and y is the set of all people in the world. Everybody loves Jerry. xL(x,Jerry) Everybody loves somebody. x yL(x,y) There is somebody whom everybody loves. yxL(x,y)

32 Examples There is somebody whom Lydia does not love. xL(Lydia,x)
Nobody loves everybody. (For each person there is at least one person they do not love.) xyL(x,y) There is somebody (one or more) whom nobody loves y x L(x,y)

33 Sentences are built from terms and atoms
A term (denoting a real-world individual) is a constant symbol, a variable symbol, or an n-place function of n terms. x and f(x1, ..., xn) are terms, where each xi is a term. A term with no variables is a ground term An atomic sentence (which has value true or false) is an n- place predicate of n terms A complex sentence is formed from atomic sentences connected by the logical connectives: P, PQ, PQ, PQ, PQ where P and Q are sentences A quantified sentence adds quantifiers  and  A well-formed formula (wff) is a sentence containing no “free” variables. That is, all variables are “bound” by universal or existential quantifiers. (x)P(x,y) has x bound as a universally quantified variable, but y is free.

34 Quantifiers Universal quantifiers are often used with “implies” to form “rules”: (x) student(x)  smart(x) means “All students are smart” Universal quantification is rarely used to make blanket statements about every individual in the world: (x)student(x)smart(x) means “Everyone in the world is a student and is smart” Existential quantifiers are usually used with “and” to specify a list of properties about an individual: (x) student(x)  smart(x) means “There is a student who is smart” A common mistake is to represent this English sentence as the FOL sentence: (x) student(x)  smart(x) But what happens when there is a person who is not a student?

35 Quantifier Scope Switching the order of universal quantifiers does not change the meaning: (x)(y)P(x,y) ↔ (y)(x) P(x,y) Similarly, you can switch the order of existential quantifiers: (x)(y)P(x,y) ↔ (y)(x) P(x,y) Switching the order of universals and existentials does change meaning: Everyone likes someone: (x)(y) likes(x,y) Someone is liked by everyone: (y)(x) likes(x,y)

36 Connections between All and Exists
We can relate sentences involving  and  using De Morgan’s laws: (x) P(x) ↔ (x) P(x) (x) P ↔ (x) P(x) (x) P(x) ↔  (x) P(x) (x) P(x) ↔ (x) P(x)

37 Universal instantiation (a.k.a. universal elimination)
If (x) P(x) is true, then P(C) is true, where C is any constant in the domain of x Example: (x) eats(Ziggy, x)  eats(Ziggy, IceCream) The variable symbol can be replaced by any ground term, i.e., any constant symbol or function symbol applied to ground terms only

38 Existential instantiation (a.k.a. existential elimination)
From (x) P(x) infer P(c) Example: (x) eats(Ziggy, x)  eats(Ziggy, Stuff) Note that the variable is replaced by a brand-new constant not occurring in this or any other sentence in the KB Also known as skolemization; constant is a skolem constant In other words, we don’t want to accidentally draw other inferences about it by introducing the constant Convenient to use this to reason about the unknown object, rather than constantly manipulating the existential quantifier

39 Existential generalization (a.k.a. existential introduction)
If P(c) is true, then (x) P(x) is inferred. Example eats(Ziggy, IceCream)  (x) eats(Ziggy, x) All instances of the given constant symbol are replaced by the new variable symbol Note that the variable symbol cannot already exist anywhere in the expression

40 Thinking of Quantification as Loops
Quantifications of more than one variable can be thought of as nested loops. For example, xyP(x,y) can be thought of as a loop over x, inside of which we loop over y (i.e., for each value of x). Likewise, xyP(x,y) can be thought of as a loop over x with a loop over y nested inside. This can be extended to any number of variables.

41 Quantification as Loops
Using this procedure xyP(x,y) is true if P(x,y) is true for all values of x,y as we loop through y for each value of x. xyP(x,y) is true if P(x,y) is true for at least one set of values x,y as we loop through y for each value of x. …And so on….

42 Quantification of 3 Variables
Let Q(x,y,z) be the statement “x + y = z”, where x,y,z are real numbers. What is the truth values of xyzQ(x,y,z)? zxyQ(x,y,z)?

43 Quantification of 3 Variables
Let Q(x,y,z) be the statement “x + y = z”, where x,y,z are real numbers. xyzQ(x,y,z) is the statement, “For all real numbers x and for all real numbers y, there is a real number z such that x + y = z.” True

44 Quantification of 3 Variables
Let Q(x,y,z) be the statement “x + y = z”, where x,y,z are real numbers. zxyQ(x,y,z) is the statement, “There is a real number z such that for all real numbers x and for all real numbers y, x + y = z.” False

45 Examples No Georgia Tech students are ignorant. x(P(x) Q(x))
Let P(x) be the statement: “x is a Georgia Tech student” Q(x) be the statement: “ x is ignorant” R(x) be the statement: “x wears red” and U is the set of all people. No Georgia Tech students are ignorant. x(P(x) Q(x)) x(P(x) Q(x)) OK by Implication equivalence. x(P(x)  Q(x)) Does not work. Why?

46 Examples No Georgia Tech students are ignorant. x(P(x) Q(x))
x (P(x)  Q(x)) Negation equivalence x ( P(x)  Q(x)) Implication equivalence x (  P(x)   Q(x)) DeMorgan’s x ( P(x)   Q(x)) Double negation Only true if everyone is a GT student and is not ignorant.

47 Examples No Georgia Tech students are ignorant.
P(x) be the statement: “x is a Georgia Tech student” Q(x) be the statement: “ x is ignorant” R(x) be the statement: “x wears red” and U is the set of all people. No Georgia Tech students are ignorant. x(P(x)  Q(x)) Also works. Why?

48 Examples No Georgia Tech students are ignorant. x(P(x) Q(x))
 x (P(x)  Q(x)) Negation equivalence x (P(x)  Q(x)) DeMorgan x (P(x) Q(x)) Implication equivalence

49 Examples Let P(x) be the statement: “x is a Georgia Tech student”
Q(x) be the statement: “ x is ignorant” R(x) be the statement: “x wears red” and U is the set of all people. All ignorant people wear red. x(Q(x) R(x))

50 Examples Let P(x) be the statement: “x is a Georgia Tech student”
Q(x) be the statement: “ x is ignorant” R(x) be the statement: “x wears red” and U is the set of all people. No Georgia Tech student wears red. x(P(x) R(x)) What about this? x(R(x)  P(x))

51 Examples This can be shown with a truth table or Venn diagrams
If “no Georgia Tech students are ignorant” and “all ignorant people wear red”, does it follow that “no Georgia Tech student wears red?” x((P(x) Q(x))  (Q(x) R(x))) NO Some misguided GT student might wear red!! This can be shown with a truth table or Venn diagrams


Download ppt "Predicate logic Also known as predicate calculus or First-Order-Logic(FOL) or First- Order-Predicate-Calculus (FOPC). Meant to overcome the weaknesses."

Similar presentations


Ads by Google