14864_5_predicate logic (lecture 19-22).ppt

46
USING PREDICATE LOGIC

Upload: phillip-grimes

Post on 14-Apr-2015

21 views

Category:

Documents


4 download

DESCRIPTION

predicate logic

TRANSCRIPT

Page 1: 14864_5_Predicate logic (Lecture 19-22).ppt

USING PREDICATE LOGIC

Page 2: 14864_5_Predicate logic (Lecture 19-22).ppt

INTRODUCTION Previous chapter much has been illustrated about knowledge and KR

related issues This chapter , illustrates how knowledge may be represented as “symbol

structures” that characterize bits of knowledge about objects, concepts, facts, rules, strategies.

Language of Logic : way of representing fact

examples : “red” represents colour red; “car1” represents my car ; "red(car1)" represents fact that my car is red.

Page 3: 14864_5_Predicate logic (Lecture 19-22).ppt

ASSUMPTIONS ABOUT KR : Intelligent Behaviour can be achieved by manipulation languages

of symbol structures. KR are designed to facilitate operations over symbol structures,

have precise syntax and semantics;

Syntax tells which expression is legal ?,

e.g., red1(car1), red1 car1, car1(red1), red1(car1 & car2) ?; and

Semantic tells what an expression means ?

e.g., property “dark red” applies to my car. Make Inferences, draw new conclusions from existing facts.

Page 4: 14864_5_Predicate logic (Lecture 19-22).ppt

To satisfy these assumptions about KR, we need formal notation that allow automated inference and problem solving. One popular choice is use of logic.

Page 5: 14864_5_Predicate logic (Lecture 19-22).ppt

LOGIC :

Logic is concerned with the truth of statements about the world.

Generally each statement is either TRUE or FALSE. Logic includes : Syntax , Semantics and Inference Procedure.

Syntax :

Specifies the symbols in the language about how they can be combined

to form sentences. The facts about the world are represented as

sentences in logic. Semantic :

Specifies how to assign a truth value to a sentence based on its meaning in the world. It Specifies what facts a sentence refers to. A fact is a claim about the world, and it may be TRUE or FALSE.

Inference Procedure :

Specifies methods for computing new sentences from an existing sentences.

Page 6: 14864_5_Predicate logic (Lecture 19-22).ppt

Logic is a language for reasoning, a collection of rules used while doing logical reasoning. Logic is studied as KR languages in artificial intelligence.

Logics are of different types : Propositional logic, Predicate logic, Temporal logic, Modal logic, and Description logic etc;

They represent things and allow more or less efficient inference.

Propositional logic and Predicate logic are fundamental to all logic.

1) Propositional logic -is the study of statements and their connectivity.

2) Predicate Logic- is the study of individuals and their properties.

Page 7: 14864_5_Predicate logic (Lecture 19-22).ppt

REPRESENTING SIMPLE FACTS IN LOGIC

To present real world facts as logical prepositions written as well-formed formulas (wff)

If it is hot it will rain.

=> rain(X) rain(X)

7

.

Page 8: 14864_5_Predicate logic (Lecture 19-22).ppt

PROPOSITIONAL LOGIC

A proposition is a statement, which in English would be a declarative sentence. Every proposition is either TRUE or FALSE.

Examples:

(a) The sky is blue.,

(b) Snow is cold. ,

(c) 12 * 12=144 propositions are “sentences” , either true or false but not both. a sentence is smallest unit in propositional logic. if proposition is true, then truth value is "true" .if proposition is

false, then truth value is "false"

Page 9: 14864_5_Predicate logic (Lecture 19-22).ppt
Page 10: 14864_5_Predicate logic (Lecture 19-22).ppt

STATEMENT, VARIABLES AND SYMBOLS Simple statements (sentences),

TRUE or FALSE, that does not contain any other statement as a part, are basic propositions;

lower-case letters, p, q, r, are symbols for simple statements.

Large, compound or complex statement are constructed from basic propositions by combining them with connectives.

Page 11: 14864_5_Predicate logic (Lecture 19-22).ppt

CONNECTIVE OR OPERATOR

The connectives join simple statements into compounds, and joins compounds into larger compounds.

Table in next slide indicates, five basic connectives and their symbols : listed in decreasing order of operation priority; operations with higher priority is solved first.

Example of a formula : ((((a Λ ¬b) V c → d) ↔ ¬ (a V c ))

The propositions and connectives are the basic elements of propositional logic.

Page 12: 14864_5_Predicate logic (Lecture 19-22).ppt
Page 13: 14864_5_Predicate logic (Lecture 19-22).ppt

TRUTH VALUE

The truth value of a statement is its TRUTH or FALSITY ,

Example :

p is either TRUE or FALSE,

~p is either TRUE or FALSE,

p v q is either TRUE or FALSE, and so on.

use " T " or " 1 " to mean TRUE.

use " F " or " 0 " to mean FALSE

Page 14: 14864_5_Predicate logic (Lecture 19-22).ppt

FEW MORE RELATED TERMS

TautologiesA proposition that is always true is called a tautology.e.g., (P v ¬P) is always true regardless of the truth value of the

proposition P. Contradictions

A proposition that is always false is called a contradiction.e.g., (P ∧ ¬P) is always false regardless of the truth value of the

proposition P. Contingencies A proposition is called a contingency, if that proposition is neither a

tautology nor a contradiction

e.g., (P v Q) is a contingency. Antecedent, Consequent In the conditional statements, p → q , the

1st statement or "if - clause" (here p) is called antecedent ,

2nd statement or "then - clause" (here q) is called consequent.

Page 15: 14864_5_Predicate logic (Lecture 19-22).ppt

ARGUMENT Any argument can be expressed as a compound statement. Take all the premises, conjoin them, and make that

conjunction the antecedent of a conditional and make the conclusion the consequent. This implication statement is called the corresponding conditional of the argument.

An argument is valid "if and only if" its corresponding conditional is a tautology.

Two statements are consistent "if and only if" their conjunction is not a contradiction.

Two statements are logically equivalent "if and only if" their truth table columns are identical; "if and only if" the statement of their equivalence using " ≡ " is a tautology.

Page 16: 14864_5_Predicate logic (Lecture 19-22).ppt

USING PROPOSITIONAL LOGIC

Representing simple facts

It is rainingRAINING

It is sunnySUNNY

It is windyWINDY

If it is raining, then it is not sunnyRAINING SUNNY

16

.

Page 17: 14864_5_Predicate logic (Lecture 19-22).ppt

CONT…

If we want to represent Mohit is a man

Mohitman

Rohit is a man Rohitman

Not able to draw any conclusion about similarities between Mohit and Rohit.

17

.

Page 18: 14864_5_Predicate logic (Lecture 19-22).ppt

MAN(MOHIT)MAN(ROHIT)

Structure of representation reflects the structure of knowledge itself.

Need to use predicate applied to arguments

All man are Mortal MORTALMAN

Need variable and quantification 18

.

Page 19: 14864_5_Predicate logic (Lecture 19-22).ppt

PREDICATE LOGIC

The propositional logic, is not powerful enough for all types of assertions;

Example : The assertion "x > 1", where x is a variable, is not a proposition because it is neither true nor false unless value of x is defined.

For x > 1 to be a proposition , either we substitute a specific number for x ; or change it to something like

"There is a number x for which x > 1 holds"; or "For every number x, x > 1 holds".

Page 20: 14864_5_Predicate logic (Lecture 19-22).ppt

PREDICATE LOGIC

Consider example :“All men are mortal.Socrates is a man.Then Socrates is mortal” ,

These cannot be expressed in propositional logic as a finite and logically valid argument (formula).

We need languages : that allow us to describe properties (predicates) of objects, or a relationship among objects represented by the variables .

Predicate logic satisfies the requirements of a language.

− Predicate logic is powerful enough for expression and reasoning.

− Predicate logic is built upon the ideas of propositional logic.

Page 21: 14864_5_Predicate logic (Lecture 19-22).ppt

USING PREDICATE LOGIC

1. Marcus was a man.

2. Marcus was a Pompeian.

3. All Pompeians were Romans.

4. Caesar was a ruler.

5. All Pompeians were either loyal to Caesar or hated him.

6. Every one is loyal to someone.

7. People only try to assassinate rulers they are not loyal to.

8. Marcus tried to assassinate Caesar.21

Page 22: 14864_5_Predicate logic (Lecture 19-22).ppt

1. Marcus was a man.

man(Marcus)

2. Marcus was a Pompeian.

Pompeian(Marcus)

3. All Pompeians were Romans.

x: Pompeian(x) Roman(x)

4. Caesar was a ruler.

ruler(Caesar)22

Page 23: 14864_5_Predicate logic (Lecture 19-22).ppt

USING PREDICATE LOGIC

5. All Pompeians were either loyal to Caesar or hated him.

inclusive-or

x: Pompeians (x) loyalto(x, Caesar) hate(x, Caesar)

exclusive-or

x: Pompeians (x) (loyalto(x, Caesar) hate(x, Caesar))

(loyalto(x, Caesar) hate(x, Caesar))

23

Page 24: 14864_5_Predicate logic (Lecture 19-22).ppt

6. Every one is loyal to someone.

x: y: loyalto(x, y)

y: x: loyalto(x, y)

24

Page 25: 14864_5_Predicate logic (Lecture 19-22).ppt

CONT…

7. People only try to assassinate rulers they are not loyal to.

x: y: person(x) ruler(y) tryassassinate(x, y)

loyalto(x, y)

8. Marcus tried to assassinate Caesar.

tryassassinate(Marcus, Caesar) 25

Page 26: 14864_5_Predicate logic (Lecture 19-22).ppt

USING PREDICATE LOGIC

Was Marcus loyal to Caesar?

Using 7 & 8 fact, we can predict

Backward chaining

man(Marcus)

ruler(Caesar)

tryassassinate(Marcus, Caesar)

x: man(x) person(x)

loyalto(Marcus, Caesar) 26

Page 27: 14864_5_Predicate logic (Lecture 19-22).ppt

USING PREDICATE LOGIC

Many English sentences are ambiguous.

There is often a choice of how to represent knowledge.

Obvious information may be necessary for

reasoning

We may not know in advance which statements to deduce (P or P).

27

Page 28: 14864_5_Predicate logic (Lecture 19-22).ppt

REPRESENTATION INSTANCE AND ISA RELATIONSHIP

Property inheritance : Is a / has a

28

Page 29: 14864_5_Predicate logic (Lecture 19-22).ppt

WAY TO REPRESENT CLASS MEMBERSHIP

1. Class membership with unary predicates

1. Man(Marcus).

2. Pompeian(Marcus).

3. x: Pompeian(x) Roman(x).

4. ruler(Caesar).

5. x: Roman(x) loyalto(x, Caesar) hate(x, Caesar).

29

Page 30: 14864_5_Predicate logic (Lecture 19-22).ppt

CONT…

2. instance predicate explicitly

1. instance(Marcus, Man).

2. instance(Marcus ,Pompeian).

3. x: instance(x ,Pompeian) instance(x, Roman).

4. Instance(Caesar, ruler).

5. x: instance(x, Roman) loyalto(x, Caesar) hate(x, Caesar).

30

Page 31: 14864_5_Predicate logic (Lecture 19-22).ppt

CONT…

3. Both instance and is predicate explicitly

1. instance(Marcus, Man).

2. instance(Marcus ,Pompeian).

3. isa(Pompeian, Roman).

4. Instance(Caesar, ruler).

5. x: instance(x, Roman) loyalto(x, Caesar) hate(x ,Caesar).

6. x: y: z: instance(x, y) isa(y,z) instance(x,z) 31

Page 32: 14864_5_Predicate logic (Lecture 19-22).ppt

REASONING

1.. Marcus was a man

2. Marcus was Pompeian.

3. Marcus was born in 40 A.D

4. All man are mortal

5. All Pompeians died when the volcano erupted in 79 A.D.

6. No mortal lives longer than 150 year

7. It is now 2011 A.D.

Is Marcus alive?32

Page 33: 14864_5_Predicate logic (Lecture 19-22).ppt

1. Marcus was a man man(marcus)

2. Marcus was Pompeian. Pompeian(Marcus)

3. Marcus was born in 40 A.D born(marcus,40)

4. All man are mortal x: man(x) mortal(x)

5. All Pompeians died when the volcano erupted in 79 A.D.

erupted(volcano, 79) x: Pompeian(x) died(x, 79)

6. No mortal lives longer than 150 year

x: t1: t2: died(x, t1) greater-than(t2, t1) dead(x, t2)

7. It is now 2011 A.D.

now = 201133

.

Page 34: 14864_5_Predicate logic (Lecture 19-22).ppt

8. Alive means not deadx: t : [alive(x,t) died(x, t)] [ died(x, t)

alive(x,t) ]

9. If someone dies, then he is dead at all times.

x: t1: t2: died(x, t1) greater-than(t2, t1) dead(x, t2)

34

.

Page 35: 14864_5_Predicate logic (Lecture 19-22).ppt

REASONING

1. Marcus was a Pompeian.

Pompeian(Marcus)

2. All Pompeians died when the volcano erupted in 79 A.D.

erupted(volcano, 79) x: Pompeian(x) died(x, 79)

3. It is now 2008 A.D.

now = 2008

x: t1: t2: died(x, t1) greater-than(t2, t1) dead(x, t2)

35

Page 36: 14864_5_Predicate logic (Lecture 19-22).ppt

RESOLUTION

Goes from conclusions to the given facts.

Produce proof by refutation

It gains its efficiency from the fact that it operates on statements that have been converted to a very convenient standard form.

To prove a statement, resolution attempts to show that the negation of the statement produces a contradiction with the known statements ( i.e. that it is unsatisfiable.)

36

Page 37: 14864_5_Predicate logic (Lecture 19-22).ppt

RESOLUTIONThe basic ideas

KB | KB |false

( ) ( ) ( )

sound and complete

37

Page 38: 14864_5_Predicate logic (Lecture 19-22).ppt

CONVERSION TO CLAUSE FORM1. Eliminate .

P Q P Q

2. Reduce the scope of each to a single term.

(P Q) P Q(P Q) P Qx: P x: Px: p x: P P P

3. Standardize variables so that each quantifier binds a unique variable.

(x: P(x)) (x: Q(x)) (x: P(x)) (y: Q(y))

38

Page 39: 14864_5_Predicate logic (Lecture 19-22).ppt

CONVERSION TO CLAUSE FORM4. Move all quantifiers to the left without changing their

relative order.

(x: P(x)) (y: Q(y)) x: y: (P(x) (Q(y))

5. Eliminate (Skolemization).

x: P(x) P(c) Skolem constantx: y P(x, y) x: P(x, f(x)) Skolem function

6. Drop .

x: P(x) P(x)

7. Convert the formula into a conjunction of disjuncts.

(P Q) R (P R) (Q R)

8. Create a separate clause corresponding to each conjunct.

9. Standardize apart the variables in the set of obtained clauses. 39

Page 40: 14864_5_Predicate logic (Lecture 19-22).ppt

CONVERSION TO CLAUSE FORM1. Eliminate .

2. Reduce the scope of each to a single term.

3. Standardize variables so that each quantifier binds a unique variable.

4. Move all quantifiers to the left without changing their relative order.

5. Eliminate (Skolemization).

6. Drop .

7. Convert the formula into a conjunction of disjuncts.

8. Create a separate clause corresponding to each conjunct.

9. Standardize apart the variables in the set of obtained clauses.40

Page 41: 14864_5_Predicate logic (Lecture 19-22).ppt

EXAMPLE1. Marcus was a man.

2. Marcus was a Pompeian.

3. All Pompeians were Romans.

4. Caesar was a ruler.

5. All Pompeians were either loyal to Caesar or hated him.

6. Every one is loyal to someone.

7. People only try to assassinate rulers they are not loyal to.

8. Marcus tried to assassinate Caesar.41

Page 42: 14864_5_Predicate logic (Lecture 19-22).ppt

EXAMPLE1. Man(Marcus).

2. Pompeian(Marcus).

3. x: Pompeian(x) Roman(x).

4. ruler(Caesar).

5. x: Roman(x) loyalto(x, Caesar) hate(x, Caesar).

6. x: y: loyalto(x, y).

7. x: y: person(x) ruler(y) tryassassinate(x, y)

loyalto(x, y).

8. tryassassinate(Marcus, Caesar).42

Page 43: 14864_5_Predicate logic (Lecture 19-22).ppt

EXAMPLEProve:

hate(Marcus, Caesar)

43

Page 44: 14864_5_Predicate logic (Lecture 19-22).ppt

QUESTION ANSWERING1. When did Marcus die?

2. Whom did Marcus hate?

3. Who tried to assassinate a ruler?

4. What happen in 79 A.D.?.

5. Did Marcus hate everyone?

44

Page 45: 14864_5_Predicate logic (Lecture 19-22).ppt

LIMITATIONS OF RESOLUTION ( EVOLUTION OF NATURAL DEDUCTION)

The previous method of resolution brings uniformity, everything looks the same. Hence at times, it becomes very difficult to pick the statement that may be useful in solving the problem.

As we convert everything into clause form, we loose important heuristic information.

Eg. We believe that all judges who are not crooked are well-educated

¥x : judge(x) À ¬ crooked (x) educated(x)

In the clause form it will take the following shape

¬ judge (x) V crooked(x) V educated(x)

Page 46: 14864_5_Predicate logic (Lecture 19-22).ppt

NATURAL DEDUCTION

Another problem with the use of resolution is that people do not think in resolution.

Computers are still poor at proving very hard things, hence we need a practical standpoint. ( focus is on interaction)

To facilitate it we led to Natural Deduction.

It describes a blend of techniques, used in combination to solve problems that are not traceable by any one method alone.

One common technique is to talk about objects involved in the predicate and not the predicate itself.