Upload
gwendolyn-lane
View
214
Download
1
Embed Size (px)
Citation preview
Automated reasoning Automated reasoning and theorem provingand theorem proving
Introduction: logic in AIIntroduction: logic in AI
Automated reasoningAutomated reasoning::
ResolutionResolution
UnificationUnification
NormalizationNormalization
Introduction:Introduction:
Motivating exampleMotivating example
Automated reasoningAutomated reasoning
Logic:Logic:
SyntaxSyntax
Model semanticsModel semantics
Logical entailment Logical entailment
3
The AI dream in the 60’s:The AI dream in the 60’s:
Logic allows to express almost everything Logic allows to express almost everything ‘formally’.‘formally’.
Logic also allows to prove “theorems” based on the information given.Logic also allows to prove “theorems” based on the information given.
Can we exploit this to build automated reasoning Can we exploit this to build automated reasoning systems ??systems ??
4
Underlying premises:Underlying premises: Logic is the ‘assembly language’ of Logic is the ‘assembly language’ of knowledge knowledge and is closely related to natural and is closely related to natural language.language.
Since computers are supposed to process Since computers are supposed to process the the knowledge, it should be expressed knowledge, it should be expressed
formally and unambiguously.formally and unambiguously.
Logical deductionLogical deduction allows us to derive allows us to derive systematicallysystematically new new knowledge from the knowledge from the existing one.existing one.
In logic almost all kinds of knowledge can be In logic almost all kinds of knowledge can be represented represented formallyformally and and unambiguouslyunambiguously..
Automating deduction ??Automating deduction ??
5
Example:Example: The following knowledge is given :The following knowledge is given :
1.1. Marcus was a man. Marcus was a man.
2.2. Marcus was a Pompeian. Marcus was a Pompeian.
3.3. All Pompeians were Romans. All Pompeians were Romans.
4.4. Caesar was a ruler. Caesar was a ruler.
5.5. All Romans were either loyal to Caesar or hated him. All Romans were either loyal to Caesar or hated him.
6.6. Everyone is loyal to someone. Everyone is loyal to someone.
7.7. People only try to assassinate rulers to whom they are People only try to assassinate rulers to whom they are not loyal.not loyal.
8.8. Marcus tried to assassinate Caesar. Marcus tried to assassinate Caesar.
Can we automatically answer the following questions?Can we automatically answer the following questions?
Was Marcus loyal to Caesar?Was Marcus loyal to Caesar? Did Marcus hate Caesar?Did Marcus hate Caesar?
6
Conversion to Conversion to the First Order Logic:the First Order Logic:
Representation of facts:Representation of facts:
1.1. Marcus was a man. Marcus was a man.
man(Marcus)man(Marcus)
2.2. Marcus was a Pompeian. Marcus was a Pompeian.
Pompeian(Marcus)Pompeian(Marcus)
4.4. Caesar was a ruler. Caesar was a ruler.
ruler(Caesar)ruler(Caesar)
8.8. Marcus tried to assassinate Caesar. Marcus tried to assassinate Caesar.
try_assassinate(Marcus, Caesar)try_assassinate(Marcus, Caesar)
7
5.5. All Romans were either loyal to Caesar or hated him. All Romans were either loyal to Caesar or hated him.
Conversion toConversion tothe First Order Logic (2):the First Order Logic (2):
General representation (representation of rules):General representation (representation of rules):
3.3. All Pompeians were Romans. All Pompeians were Romans.x Pompeian(x)x Pompeian(x) Roman(x) Roman(x)
6.6. Everyone is loyal to someone. Everyone is loyal to someone.xx yy loyal_to(x,y)loyal_to(x,y)
7.7. People only try to assassinate rulers to whom they People only try to assassinate rulers to whom they are not loyal.are not loyal.xxy person(x)y person(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y)
~loyal_to(x,y)~loyal_to(x,y)
( ( ))
~(~(loyal_to(x,Caesar) loyal_to(x,Caesar) hates(x,Caesar)hates(x,Caesar)) ) XORXOR
x Roman(x) x Roman(x) loyal_to(x,Caesar) loyal_to(x,Caesar) hates(x,Caesar)hates(x,Caesar)
8
Prove that he did:Prove that he did:
The “theorem” ?The “theorem” ?
Was Marcus loyal to Caesar?Was Marcus loyal to Caesar?
Did Marcus hate Caesar?Did Marcus hate Caesar?
hates(Marcus,Caesar)hates(Marcus,Caesar)
Try, for example, to prove that he was not :Try, for example, to prove that he was not :
~loyal_to(Marcus,Caesar)~loyal_to(Marcus,Caesar)
9
A proof using backward-A proof using backward-reasoning problem-reduction:reasoning problem-reduction:
~loyal_to(Marcus,Caesar)~loyal_to(Marcus,Caesar)
xxy person(x)y person(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y) ~loyal_to(x,y)~loyal_to(x,y)
++ substitution: x/Marcus substitution: x/Marcus y/Caesary/Caesar
person(Marcus)person(Marcus) ruler(Caesar)ruler(Caesar) try_assassi-try_assassi-nate(Marcus,Caesar)nate(Marcus,Caesar) ~loyal_to(Marcus,Caesar)~loyal_to(Marcus,Caesar)
++ Modus ponens Modus ponensperson(Marcus)person(Marcus)
ruler(Cesar)ruler(Cesar)
ANDAND
try_assassinate(Marcus, Caesar)try_assassinate(Marcus, Caesar)
Done!Done!4.4.
Done!Done!
8.8.
Extra rule:Extra rule:x man(x) x man(x) person(x)person(x)
man(Marcus)man(Marcus) Done!Done!1.1.
10
Problems:Problems:1) knowledge representation:1) knowledge representation:
Natural language is imprecise / ambiguousNatural language is imprecise / ambiguous see “People only try …”see “People only try …”
Obvious information is easily forgotten.Obvious information is easily forgotten. see man <-> personsee man <-> person
Some information is more difficult to represent Some information is more difficult to represent in in logic.logic. Vb.: “perhaps …”, “possibly…”, “probably…”,Vb.: “perhaps …”, “possibly…”, “probably…”,
“the chance of … is 45%”, “the chance of … is 45%”,
Logic is inconvenient from a software Logic is inconvenient from a software engineering perspective.engineering perspective.
too ‘fine-grained’ (like an assembly language)too ‘fine-grained’ (like an assembly language)
11
Problems:Problems:2) Problem solving:2) Problem solving:
All trade-offs that we had with search methods All trade-offs that we had with search methods based on states space representation:based on states space representation: backward/forward, tree/graph, OR-tree/AND-OR,backward/forward, tree/graph, OR-tree/AND-OR,
control aspects, ...control aspects, ...
What deduction rules are needed in general?What deduction rules are needed in general? Example: prove “ Example: prove “ hates(Marcus,Caesar) hates(Marcus,Caesar) ““
x Roman(x) x Roman(x) loyal_to(x,Caesar) loyal_to(x,Caesar) hates(x,Caesar)hates(x,Caesar)
The only applicable rule is:The only applicable rule is:
Modus ponens???Modus ponens???
How do we handle How do we handle x x andand y y ??
12
Problems:Problems:2) Problem solving (2):2) Problem solving (2):
How to compute substitutions in the general caseHow to compute substitutions in the general case ??
xxy person(x)y person(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y) ~loyal_to(x,y)~loyal_to(x,y)
++ substitution: x/Marcus substitution: x/Marcus y/Caesary/Caesar
In general:In general:more complexmore complex
Which theorem do we try to prove?Which theorem do we try to prove? Ex.: Ex.: loyal_to(Marcus,Caesar)loyal_to(Marcus,Caesar) or or ~loyal_to(Marcus,Caesar)~loyal_to(Marcus,Caesar)
How to handle equality of objects?How to handle equality of objects? Problem: combinatorial explosion of the derived Problem: combinatorial explosion of the derived
equalities (reflexivity, symmetry, transitivity, …) equalities (reflexivity, symmetry, transitivity, …)
How to guarantee correctness/completeness?How to guarantee correctness/completeness?
The formal model semantics of The formal model semantics of LogicLogic
The meaning of “Logical entailment” The meaning of “Logical entailment”
14
Semantics / Logical entailment:Semantics / Logical entailment:
Given a set of formulas Given a set of formulas SS::a a modelmodel is an interpretation that makes all is an interpretation that makes all
formulas in formulas in SS true. true.
Given a set of formulas Given a set of formulas S S and a formulaand a formula F F::FF is is logically entailedlogically entailed by by SS ( ( SS |=|= FF )), ,
if if all models of all models of SS also make also make FF true. true.
Additional: inconsistency:Additional: inconsistency:
Given a set of formulas Given a set of formulas SS::SS is is inconsistentinconsistent if if SS has no models. has no models.
Example:Example: SS = { p(a), ~p(a)} = { p(a), ~p(a)}
15
Marcus example:Marcus example:
xx yyVV
MarcusMarcusCaesarCaesar
CCAA
F = F =
manmanpersopersonn
rulerruler
RomanRoman PompeianPompeianhateshates loyal_toloyal_to
try_assassinatetry_assassinatePP
D = world of ~40 VC.D = world of ~40 VC.
““Marcus”Marcus”
““Caesar”Caesar”
““Intended” interpretation:Intended” interpretation:
Is a model IF ALL FORMULAS ARE CORRECTIs a model IF ALL FORMULAS ARE CORRECT
BooleanBoolean
truetrue
falsefalse
““was_ruler”was_ruler”
““was_pompeian”was_pompeian”BooleanBoolean
truetrue
falsefalse
16
Marcus example:Marcus example:
xx yyVV
MarcusMarcusCaesarCaesar
CCAA
F = F =
manman personpersonrulerruler
RomanRoman PompeianPompeianhateshates loyal_toloyal_to
try_assassinatetry_assassinatePP
NN
44
33
I(man) = I(person)= I(Roman)I(man) = I(person)= I(Roman)== “natural number”“natural number”
I(Pompeian) =I(Pompeian) = “even number”“even number”
I(ruler) =I(ruler) = “prime number”“prime number”
I(try_assassinate) =I(try_assassinate) = “ “ >> ” ”
I(loyal_to) =I(loyal_to) = “divides”“divides”
I(hates) =I(hates) = “doesn’t divide”“doesn’t divide”
17
Model ??Model ??1.1. Marcus was a man. Marcus was a man.
4 is a natural number4 is a natural number
2.2. Marcus was Pompeian. Marcus was Pompeian.
4 is an even number4 is an even number
4.4. Caesar was a ruler. Caesar was a ruler.
3 is a prime number3 is a prime number8.8. Marcus tried to Marcus tried to
assassinate Caesar. assassinate Caesar. 4 4 >> 3 3
3.3. All Pompeians were Romans. All Pompeians were Romans.Even numbers are naturals.Even numbers are naturals.
5.5. All Romans were either loyal to Caesar or hated him. All Romans were either loyal to Caesar or hated him.A number either divides 3 or doesn’t divide 3.A number either divides 3 or doesn’t divide 3.
6.6. Everybody is loyal to somebody. Everybody is loyal to somebody.
Each number is a divisor of some number.Each number is a divisor of some number.
7.7. People try to assassinate only those rulers to whom People try to assassinate only those rulers to whom they are not loyal. they are not loyal. A natural number that is greater than a A natural number that is greater than a prime number doesn’t divide the prime number. prime number doesn’t divide the prime number.
YES !YES !
18
““Logic is all form, no content”Logic is all form, no content”person(x) person(x) mortal(x) mortal(x)person(Socrates)person(Socrates) mortal(Socrates)mortal(Socrates)
January(x) January(x) cold(x) cold(x)January(21/1/01)January(21/1/01) cold(21/1/01)cold(21/1/01)
P(x) P(x) Q(x) Q(x)P(A)P(A) Q(A)Q(A)
Only the underlying structure of a set of logical formulas is Only the underlying structure of a set of logical formulas is important for the conclusions! (up to the names isomorphism)important for the conclusions! (up to the names isomorphism)
But from the knowledge representation perspective But from the knowledge representation perspective also the ‘contents’ is important.also the ‘contents’ is important.