Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),

Similar presentations

Presentation on theme: "1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),"— Presentation transcript:

1 1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G), and (F ↔G) are formulae. If F is a formula such that x is a free variable in it then  x F and  x F are formulae. There are no other formulae. Quantifiers have precedance over the logical operators. So, (  u(GT(u, v)) /\  v (ODD(v))) Can be written as  u GT(u, v) /\  v ODD(v) This predicate logic is called first order prediacte logic where only variables can be quantified.

2 2 Interpretations An interpretation consists of 1. Specifying a domain 2. Defining the mapping of every function f(c 1,c 2,…,c n ) 3. Assigning truth values to every predicate P(c 1,c 2,…,c n ) A formula with free variables can not be evaluated. So, we assume that they are all bound. Formulae that have the same truth values under all interpretations are equivalent. Constants

3 3 Evaluate the truth value of the formula  x  y(P(x) /\ Q(x,f(y))) Under the following two interpretations. 1.Given: Domain={a,b}, f(a) = b and f(b) = a, and the following truth values of atoms. P(a)P(b)Q(a,a)Q(a,b)Q(b,a)Q(b,b) falsetrue falsetrue Evaluation: For x=a, P(x) is false. So, the formula is not true for all values of x in the domain. Hence,  x  y(P(x) /\ Q(x,f(y))) is false.

4 4 2. Given: Domain={1, 2}, f(1) = 2 and f(2) = 1, and the following truth values for atoms. P(1)P(2)Q(1, 1)Q(1, 2)Q(2, 1)Q(2, 2) true falsetrue Evaluation: For x=1, P(x) is true. Q(x,f(y)) is true for both y = 1 and y = 2. For x=2, P(x) is true. Q(x,f(y)) is true for y = 1. So, for all values of x in the domain, there is a value of y in the domain that makes the formula true. Hence,  x  y(P(x) /\ Q(x,f(y))) is true.  x  y(P(x) /\ Q(x,f(y)))

5 5 Rules of inference Just as in propositional logic, rules of inference can be used in predicate logic. Besides the rules used in propositional logic, we have other rules in predicate logic. Universal specialization (Universal instantiation) From  x F(x) we can deduce F(a) where a is a constant. Example: Suppose the following premisses are given: 1.Every father argues with his son. 2.John is a father. Prove the goal: John argues with his son.

6 6 Using predicate logic we can represent the above statements as:  x (FATHER(x) → ARGUES (x,son(x))) 2.FATHER(John) Applying the rule of universal specialization to 1, we get, 3. FATHER(John) → ARGUES(John, son(John)) Applying the modus ponens to 2 and 3 we get, 4.ARGUES(John, son(John)) And the goal is proved to be a theorem.

7 7 Predicate logic is semi-decidable. A domain can contain an infinite number of elements Hence, there can be an infinite number of interpretations for of a formula We can not show that a formula is a tautology or an inconsistency by evaluating it under all interpretations In predicate logic, there exists no general proof procedure that will prove a goal G if G is a theorem and that will disprove G if G is not a theorem. There are procedures that prove G if G is a theorem but will not terminate if it is not (Resolution).

8 8 Resolution in predicate logic Before we can apply resolution we must: Convert formulae to clause form Clause: disjunction of literals Literal: an atom or the negation of an atom Conjunction exists implicitly between clauses all variables in a clause are universally quantified There is a ten stage procedure for converting a formula to clause form in predicate logic.

9 9 Resolution in predicate logic is similar to that in propositional logic. In propositional logic, however, it is easy to check if two literals are contradictory. In predicate logic it is more difficult. man(John) ~man(John) Are contradictory but, man(John) ~man(George) are not. And, man(x) ~man(John) are also contradictory. There is an algorithm known as a unification algorithm that does this matching and produces the resolvent clause.

10 10 1. man(Marcus) 2. ~man(x1) \/ mortal(x1) man(Marcus) unifies with man(x1) with the substitution Marcus/x1 which means that for x1=Marcus, ~man(Marcus) is false. We can not cancel out the literals and generate mortal(x1) Clause 2 says that for a given x1 either ~man(x1) or mortal(x1) Here, we can only conclude mortal(Marcus) is true We can not say mortal(x1) for all x1 because for some x1, ~man(x1) might be true. The resolvent generated will be mortal(Marcus) which is obtained by applying the result of the unification to the resolvent.

11 11 An algorithm for resolution for predicate logic. F is the set of given statements S is the statement to be proved 1. Convert the statements in F to clause form. 2. Negate S and convert the result to clause form. Add it to the set of clauses obtained in 1. 3. Repeat until either a contradiction is found, no progress is possible, or a predetermined amount of effort has been expended. a. Select two clauses. Call them parent clauses. b. Resolve them together. The resolvent will be the disjunction of all the literals of the parent clauses with appropriate substitutions performed and with the following exceptions. If there is a pair of literals T1 and ~T2 such that one of the parent clauses contains T1 and the other contains T2 and if T1 and T2 are unifiable, then neither T1 nor T2 should appear in the resolvent. We will call T1 and T2 complimentary literals. Use the substitution produced by the unification to create the resolvent. c. If the resolvent is empty then a contradiction has been found.If it is not then add it to the set of clauses available to the procedure.

12 12 Let’ see how the resolution principle can be used to prove new statements from given ones. Example: Given statements converted to formulae in predicate logic: 1.Marcus was a man. man(Marcus). (Past tense lost which is ok in this case) 2. Marcus was a Pompein. Pompein(Marcus). 3. All Pompeins were Romans.  x Pompein(x) → Roman(x). 4. Caesaer was a ruler. ruler(Caeser). 5. All Romans were either loyal to Caeser or (EOR) hated him  x Roman(x) → loyalto(x, Caeser) \/ hate(x,Caeser). OR  x Roman(x) → ((loyalto(x, Caeser) \/ hate(x,Caeser) /\ ~(loyalto(x, Caeser) /\ hate(x,Caeser))). EOR

13 13 6. Everyone is loyal to someone.  x  y loyalto(x, y). For every person there is someone…  y  x loyalto(x, y). There is someone who is loyal to all… 7. People only try to assassinate rulers they are not loyal to.  x  y person(x)/\ ruler(y) /\ tryassassinate(x,y) → ~loyalto(x,y). Does this mean that people try to assassinate rulers if they are not loyal to them or the only thing people do is to try to assassinate rulers they are not loyal to (Ambiguous). 8. Marcus tried to assassinate Caeser. tryassassinate(Marcus, Caeser). Converting from English to logic is not easy.

14 14 We want to prove: hate (Marcus, Caesar) We first have to convert our formulae into clause form. Axioms in clause form: 1. man(Marcus). 2. Pompein(Marcus). 3. Pompein(Marcus) \/ Roman(x1). 4. ruler(Caeser). 5. ~Roman(x2) \/ loyalto(x2, Caeser) \/ hate(x2,Caeser). 6. loyalto(x3, f1(x3)). 7. ~man(x4) \/ ~ruler(y1) \/ ~tryassassinate(x4, y1) \/ ~loyalto(x4,y1). 8. tryassassinate(Marcus, Caeser).

15 15 prove: hate (Marcus, Caesar) 5 Marcus/x2 3 ~Roman(Marcus) \/ loyalto(Marcus, Caeser) Marcus/x1 ~Pompein(Marcus) \/ loyalto(Marcus, Caeser) 2 7 loyalto (Marcus, Caeser) Marcus/x4, Caesar/y1 1 ~man(Marcus) \/ ~ruler(Caeser) \/ ~tryassassinate(Marcus, Caeser) 4 ~ruler(Caeser) \/ ~tryassassinate(Marcus, Caeser) ~tryassassinate(Marcus, Caeser) 8

Download ppt "1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),"

Similar presentations

Ads by Google