5 - Predicate Logic (Lecture 19-22)
5 - Predicate Logic (Lecture 19-22)
5 - Predicate Logic (Lecture 19-22)
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.
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.
To satisfy these assumptions about KR, we need
formal notation that allow automated inference and
problem solving. One popular choice is use of
logic.
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.
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.
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
.
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"
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.
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.
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
FEW MORE RELATED TERMS
Tautologies
A 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.
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.
USING PROPOSITIONAL LOGIC
Representing simple facts
It is raining
RAINING
It is sunny
SUNNY
It is windy
WINDY
If it is raining, then it is not sunny
RAINING SUNNY
16
.
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
.
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
.
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".
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.
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
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
USING PREDICATE LOGIC
5. All Pompeians were either loyal to Caesar or hated him.
inclusive-or
x: Pompeians (x) loyalto(x, Caesar) v hate(x, Caesar)
exclusive-or
x: Pompeians (x) (loyalto(x, Caesar) . hate(x, Caesar)) v
(loyalto(x, Caesar) . hate(x, Caesar))
23
6. Every one is loyal to someone.
x: -y: loyalto(x, y)
-y: x: loyalto(x, y)
24
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
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
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
REPRESENTATION INSTANCE AND ISA
RELATIONSHIP
Property inheritance :
Is a / has a
28
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) v hate(x, Caesar).
29
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) v hate(x,
Caesar).
30
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) v hate(x
,Caesar).
6. x: y: z: instance(x, y) . isa(y,z) instance(x,z)
31
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
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: t
1
: t
2
: died(x, t
1
) . greater-than(t
2
, t
1
) dead(x, t
2
)
7. It is now 2011 A.D.
now = 2011
33
.
8. Alive means not dead
x: 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: t
1
: t
2
: died(x, t
1
) . greater-than(t
2
, t
1
)
dead(x, t
2
)
34
.
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: t
1
: t
2
: died(x, t
1
) . greater-than(t
2
, t
1
) dead(x, t
2
)
35
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
RESOLUTION
The basic ideas
KB |= o KB . o |= false
(o v |) . ( v |) (o v )
sound and complete
37
CONVERSION TO CLAUSE FORM
1. Eliminate .
P Q P v Q
2. Reduce the scope of each to a single term.
(P v Q) P . Q
(P . Q) P v Q
x: P -x: P
-x: p x: P
P P
3. Standardize variables so that each quantifier binds a unique
variable.
(x: P(x)) v (-x: Q(x)) (x: P(x)) v (-y: Q(y))
38
CONVERSION TO CLAUSE FORM
4. Move all quantifiers to the left without changing their relative
order.
(x: P(x)) v (-y: Q(y)) x: -y: (P(x) v (Q(y))
5. Eliminate - (Skolemization).
-x: P(x) P(c) Skolem constant
x: -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) v R (P v R) . (Q v R)
8. Create a separate clause corresponding to each conjunct.
9. Standardize apart the variables in the set of obtained clauses.
39
CONVERSION TO CLAUSE FORM
1. 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
EXAMPLE
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.
41
EXAMPLE
1. Man(Marcus).
2. Pompeian(Marcus).
3. x: Pompeian(x) Roman(x).
4. ruler(Caesar).
5. x: Roman(x) loyalto(x, Caesar) v 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
EXAMPLE
Prove:
hate(Marcus, Caesar)
43
QUESTION ANSWERING
1. 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
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)
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.