Predicate Logic Limitations of the propositional logic
Propositional logic: the world is described in terms of
elementary propositions and their logical combinations Elementary statements: • Typically refer to objects, their properties and relations. • But these are not explicitly represented in the propositional logic. Example: “John is a CS student.” John a CS student
object properties
• Objects and properties are hidden in the statement.
… 1) Statements that must be repeated for many objects Example: If John is a CS post graduate then John has passed cs441 Translation: John is a CS post graduate → John has passed cs441 Similar statements can be written for other post graduates: Hana is a CS post graduate → Hana has passed cs441 Blen is a CS post graduate →Blen has passed cs441 …etc Solution: make statements with variables – If x is a CS post graduate then x has passed cs441 – x is a CS post graduate → x has passed cs441 … 2) Statements that define the property of the group of objects. Example: All new cars must be registered. Some of the CS graduates graduate with honors. Solution: make statements with quantifiers. Universal quantifier –the property is satisfied by all members of the group Existential quantifier – at least one member of the group satisfy the property Predicates • Remedies the limitations of the propositional logic Explicitly models objects and their properties. Allows to make statements with variables and quantify them. • A Predicate is a declarative sentence whose true/false value depends on one or more variables. • The statement “x is greater than 3" has two parts: the object: x is the object of the statement the predicate/property: “is greater than 3" (a property that the object can have). Predicates • We denote the statement “x is greater than 3" by P (x), where P is the predicate “is greater than 3" and x is the variable. • “The statement P (x) is also called the value of propositional function P at x”. • Assign a value to x, so P (x) becomes a proposition and has a truth value: • P (5) is the statement “5 is greater than 3“. so P (5) is true. • P (2) is the statement “2 is greater than 3", so P (2) is false. Predicates: Examples • Prime(x) = “x is a prime number." Prime(2) is true, since the only numbers that divide 2 are 1 and itself. Prime(9) is false, since 3 divides 9. • C(x, y)=“x is the capital of y". C(Ottawa,Canada) is true. C(Harar,Ethiopia) is false. • E(x, y, z) = “x + y = z". E(2, 3, 5) is ... E(4, 4, 17) is ... Basic building blocks of the predicate logic: • Constant:- models a specific object Examples: “John”, “France”, “7” • Variable:- represents object of specific type (defined by the universe of discourse) Examples: x, y • (universe of discourse can be people, students, numbers) • Predicate:- over one, two or many variables or constants. – Represents properties or relations among objects. Examples: Red(car23), student(x), married(John,Blen) … • A predicate P(x) assigns a value true or false to each x depending on whether the property holds or not for x. Example 1: • Assume Student(x) where the universe of discourse are people • Student(John) …. T (if John is a student) • Student(Tesfu) … F (if Tesfu is not a student) …etc … • Assume a predicate P(x) that represents the statement: Example2 :- x is a prime number What are the truth values of: • P(2) T • P(3) T • P(4) F • P(5) T All statements P(2), P(3), P(4), P(5) are propositions. … • Predicates can have more arguments which represent the relations between objects. Example: • Older(Feven , Hana) denotes “Feven is older than Hana” this is a proposition because it is either true or false. • Older(x , y) -‘x is older than y’ not a proposition, but after the substitution it becomes one. … Example: • Let Q(x,y) denote ‘x+5 >y’ – Is Q(x,y) a proposition? No! – Is Q(3,7) a proposition? Yes!.It is true. What is the truth value of: – Q(3,7) T – Q(1,6) F – Is Q(3,y) a proposition? No!We cannot say if it is true or false. Compound statements in predicate logic
• Compound statements are obtained via logical connectives.
Examples: • Student(Hana) ˄ Student(Blen) Translation:“Both Hana and Blen are students” Proposition:yes. • Country(Rasdashn) ˅ River(Rasdashn) Translation:“Rasdashn is a country or a river” Proposition:yes. • CS-rep(x) → Student(x) Translation:“if x is a CS-rep then x is a student” Proposition:no. Quantified statements • Predicate logic lets us to make statements about groups of objects. To do this we use special quantified expressions. • Two types of quantified statements: 1) Universal /for all / Example: ‘ all CS students to graduate they must pass cs441 course” – the statement is true for all graduates 2) Existential /exists/ Example: ‘Some CS students graduate with honor.’ – the statement is true for some people Universal quantifier • Defn: The universal quantification of P(x) is the proposition: “P(x) is true for all values of x in the domain of discourse.“ The notation x P(x) denotes the universal quantification of P(x), and is expressed as “for every x, P(x)”. Example: • Let P(x) denote x > x - 1. • What is the truth value of x P(x)? • Assume the universe of discourse of x is all real numbers. Answer: Since every number x is greater than itself minus 1. Therefore, x P(x) is true. … • Quantification converts a propositional function into a Proposition by binding a variable to a set of values from the universe of discourse. Example: • Let P(x) denote x > x - 1. • Is P(x) a proposition? No.Many possible substitutions. • Is x P(x) a proposition? Yes.True if for all x from the universe of discourse P(x) is true. Universally quantified statements Example:- A, CS-rep(x) → Student(x) –Translation:“if x is a CS-rep then x is a student” –Proposition: no!. B, x CS-rep(x) → Student(x) –Translation:“(For all people it holds that) if a person is a CS-rep then she/he is a student.” –Proposition: yes!. Existential quantifier Defn: The existential quantification of P(x) is the proposition "There exists an element in the domain (universe) of discourse such that P(x) is true." The notation x P(x)denotes :- • the existential quantification of P(x), and is expressed as “there is an x such that P(x) is true”. Example 1: • Let T(x) denote x > 5 and x is from Real numbers. • What is the truth value of x T(x)? Answer: • Since 10 > 5 is true. Therefore, it is true that x T(x). … Example 2: • Let Q(x) denote x = x + 2 where x is real numbers . • What is the truth value of x Q(x)? Answer: Since no real number is 2 larger than itself, the truth value of x Q(x) is false. Quantified statements • Statements about groups of objects. Example: • CS-post-graduate (x) ˄ Honor-student(x) –Translation:“x is a CS-post-graduate and x is an honor student” –Proposition: no!. • x CS-post-graduate (x) ˄ Honor-student(x) –Translation:“There is a person who is a CS-post- graduate and who is also an honor student.” –Proposition:yes!. Mixing Quantifiers • Existential and Universal quantifiers can be used together to quantify a predicate statement; For example: x y P(x,y) is perfectly valid. • However ,you must be careful it must be read left to right. • x y P(x,y) is not equivalent to y x P(x,y) ,thus ordering is important. Example: x y Loves(x,y):everybody loves somebody • y x Loves(x,y):there is someone loved by everyone. • However you can commute similar quantifiers; x y P(x,y) is equivalent to y x P(x,y). Precedence and scope of quantifiers • and have higher precedence than logical operators(connectives). Example: x P(x) ˅ Q(x) means (x P (x)) ˅ Q(x), it doesn't mean x(P (x) ˅ Q(x)). • (Note: This statement is not a proposition since there is a free variable!) Binding variables and scope • When a quantifier is used on the variable x we say that this occurrence of x is bound. • When the occurrence of a variable is not bound by a quantifier or set to a particular value, the variable is said to be free. • The part of a logical expression to which a quantifier is applied is the scope of the quantifier. • A variable is free if it is outside the scope of all quantifiers. • In the example above, (xP (x)) ˅ Q(x), the x in P (x) is bound by the universal quantifier, while the x in Q(x) is free. Summary of quantified statements When x P(x)and x P(x)are true and false? • Suppose the elements in the universe of discourse can be enumerated as x1, x2, ..., xN then: • x P(x) is true whenever P(x1) ˄ P(x2) ˄... ˄ P(xN) is true • x P(x) is true whenever P(x1) ˅ P(x2) ˅... ˅ P(xN) is true. Predicate logic as formal language • Generally predicates are used to describe certain properties or relationships between individuals or objects. Example: Hana and Blen are sisters, the phrase “are sisters” is a predicate(properties or relation). The entities connected this way Hana and Blen are constants/terms. • The arguments can be either variable or constants. • In predicate calculus ,each predicate is given a name, which is followed by the list of arguments. … • The list of arguments is enclosed in parentheses. Example :- mother(Blen,Nati) “Blen is the mother of Nati” • The order of arguments is important. • The statement mother(Blen,Nati) and mother(Nati,Blen) have completely different meaning. • A predicate name followed by argument list in parentheses is called an atomic formulas. • The atomic formulas can be combined by logical connectives (˄,˅,¬,→…) like propositions. Example: cat(Tomi)→hastail(Tomi) Translation • Translating sentences without variables or quantifiers is straightforward. • Just remember that proper names translate into individual constants or common nouns into predicates. • Be careful to combine the right number of arguments with each n-place predicate. • You combine two wffs together using the connectives just like you did in Propositional Logic. Here are two examples to get you started. Example 1 • If Addis will marry Helen or Tigistu will, then Yonas won’t Let MARRY = will marry, a = Addis, h = Helen, t=Tigistu Translation: (MARRY(a,h) ∨ MARRY(t,h)) → ¬ MARRY(y,h)) Addis will marry Helen MARRY(a,h) Tigistu will marry Helen MARRY(t,h) Yonas will marry Helen MARRY(y,h) Yonas won’t marry Helen ¬ MARRY(y,h) Addis will marry Helen or Tigistu will (MARRY(a,h) ∨ MARRY(t,h)) If Addis will marry Helen or Tigistu will, then Yonas won’t (MARRY(a,h)∨ MARRY(t,h))→¬ MARRY(y,h)) Example 2
• Blen and Addis left home but Thomas did not
Let L = left home, b = Blen, a= Addis, t = Thomas Translation: ((L(b) ∧ L(a)) ∧ ¬L(t)) Blen left home L(b) Addis left home L(a) Thomas left home L(t) Thomas didn’t leave home ¬L(t) Blen and Addis left home (L(b) ∧ L(a)) Blen and Addis left home but Thomas did not ((L(b) ∧ L(a)) ∧ ¬L(t)) Thank You!!!